Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for ticket #298 (identify tool radius was too large).
Comprises an actual bug fix (the QSettings path that the identify used
was not the same path that the Options dialog box was using, hence
changing the radius using the ui had no effect on the identify), and some
improvements to the setting and use of the identify radius.


git-svn-id: http://svn.osgeo.org/qgis/trunk@6160 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Dec 1, 2006
1 parent b27481b commit e826214
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 69 deletions.
2 changes: 1 addition & 1 deletion src/core/qgis.cpp
Expand Up @@ -37,5 +37,5 @@ const char* QGis::qgisFeatureTypes[] =
"WKBMultiPolygon"
};

const int QGis::DEFAULT_IDENTIFY_RADIUS=5;
const int QGis::DEFAULT_IDENTIFY_RADIUS=0.5;

6 changes: 3 additions & 3 deletions src/gui/qgsmaptoolidentify.cpp
Expand Up @@ -187,10 +187,10 @@ void QgsMapToolIdentify::identifyVectorLayer(QgsVectorLayer* layer, const QgsPoi

// load identify radius from settings
QSettings settings;
int identifyValue = settings.readNumEntry("/qgis/map/identifyRadius", QGis::DEFAULT_IDENTIFY_RADIUS);
double identifyValue = settings.value("/Map/identifyRadius", QGis::DEFAULT_IDENTIFY_RADIUS).toDouble();

// create the search rectangle
double searchRadius = mCanvas->extent().width() * (identifyValue/1000.0);
double searchRadius = mCanvas->extent().width() * (identifyValue/100.0);

QgsRect r;
r.setXmin(point.x() - searchRadius);
Expand Down Expand Up @@ -311,7 +311,7 @@ void QgsMapToolIdentify::identifyVectorLayer(QgsVectorLayer* layer, const QgsPoi
else
{
QString title = layer->name();
title += QString(" - %d").arg(featureCount);
title += QString(" - %1").arg(featureCount);
title += QObject::tr(" features found");
mResults->setTitle(title);
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsoptions.cpp
Expand Up @@ -54,7 +54,7 @@ QgsOptions::QgsOptions(QWidget *parent, Qt::WFlags fl) :
#ifdef QGISDEBUG
std::cout << "Standard Identify radius setting: " << QGis::DEFAULT_IDENTIFY_RADIUS << std::endl;
#endif
int identifyValue = settings.readNumEntry("/Map/identifyRadius",QGis::DEFAULT_IDENTIFY_RADIUS);
double identifyValue = settings.value("/Map/identifyRadius",QGis::DEFAULT_IDENTIFY_RADIUS).toDouble();
#ifdef QGISDEBUG
std::cout << "Standard Identify radius setting read from settings file: " << identifyValue << std::endl;
#endif
Expand Down
121 changes: 57 additions & 64 deletions src/ui/qgsoptionsbase.ui
@@ -1,14 +1,11 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>QgsOptionsBase</class>
<widget class="QDialog" name="QgsOptionsBase" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>554</width>
<width>576</width>
<height>451</height>
</rect>
</property>
Expand Down Expand Up @@ -401,23 +398,10 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" >
<widget class="QGroupBox" name="groupBox_6" >
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox_7" >
<property name="title" >
<string>Measure tool</string>
<string>Search radius</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
Expand All @@ -426,26 +410,53 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="0" colspan="2" >
<widget class="QLabel" name="textLabel2" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Note:&lt;/span> Specify the search radius as a percentage of the map width.&lt;/p>
&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="textLabel1_8" >
<widget class="QLabel" name="textLabel1_3" >
<property name="text" >
<string>Ellipsoid for distance calculations:</string>
<string>Search Radius for Identifying Features</string>
</property>
<property name="buddy" >
<cstring>cmbEllipsoid</cstring>
<cstring>spinBoxIdentifyValue</cstring>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="cmbEllipsoid" />
<widget class="QDoubleSpinBox" name="spinBoxIdentifyValue" >
<property name="suffix" >
<string>%</string>
</property>
<property name="maximum" >
<double>1000.000000000000000</double>
</property>
<property name="singleStep" >
<double>0.010000000000000</double>
</property>
<property name="value" >
<double>5.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox_7" >
<item row="1" column="0" >
<widget class="QGroupBox" name="groupBox_6" >
<property name="title" >
<string>Search radius</string>
<string>Measure tool</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
Expand All @@ -454,51 +465,35 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="0" colspan="2" >
<widget class="QLabel" name="textLabel2" >
<property name="text" >
<string>&lt;html>

&lt;b>Note:&lt;/b> Specify the value in thousandths. The search radius is calculated as:&lt;br>

&amp;nbsp;&amp;nbsp;&lt;i>(Map View Width) * ( Value/1000.0)&lt;/i>

&lt;br>

By default QGIS uses a value of 5. Increase the value if you have trouble

identifying features without zooming in very close.

&lt;/html></string>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QSpinBox" name="spinBoxIdentifyValue" >
<property name="maximum" >
<number>100</number>
</property>
<property name="minimum" >
<number>1</number>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="textLabel1_3" >
<widget class="QLabel" name="textLabel1_8" >
<property name="text" >
<string>Search Radius for Identifying Features</string>
<string>Ellipsoid for distance calculations:</string>
</property>
<property name="buddy" >
<cstring>spinBoxIdentifyValue</cstring>
<cstring>cmbEllipsoid</cstring>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="cmbEllipsoid" />
</item>
</layout>
</widget>
</item>
<item row="2" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="TabPage" >
Expand Down Expand Up @@ -734,7 +729,6 @@ identifying features without zooming in very close.
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>btnFindBrowser</tabstop>
Expand All @@ -745,7 +739,6 @@ identifying features without zooming in very close.
<tabstop>spinBoxUpdateThreshold</tabstop>
<tabstop>chkAddedVisibility</tabstop>
<tabstop>chkAntiAliasing</tabstop>
<tabstop>spinBoxIdentifyValue</tabstop>
<tabstop>cmbEllipsoid</tabstop>
<tabstop>radPromptForProjection</tabstop>
<tabstop>radUseProjectProjection</tabstop>
Expand Down

0 comments on commit e826214

Please sign in to comment.