23 changes: 21 additions & 2 deletions src/gui/qgshighlight.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgsfeaturestore.h"
#include "qgsgeometry.h"
#include "qgsrendererv2.h"
#include "qgssymbolv2.h"
#include <QBrush>
#include <QColor>
#include <QList>
Expand Down Expand Up @@ -46,11 +47,25 @@ class GUI_EXPORT QgsHighlight: public QgsMapCanvasItem
QgsHighlight( QgsMapCanvas *mapCanvas, const QgsFeature& feature, QgsVectorLayer *layer );
~QgsHighlight();

/** Set line/outline to color, polygon fill to color with alpha = 63.
* This is legacy function, use setFillColor() after setColor() if different fill color is required. */
void setColor( const QColor & color );

/** Set polygons fill color.
* @note: added in version 2.3 */
void setFillColor( const QColor & fillColor );

/** Set width. Ignored in feature mode. */
void setWidth( int width );

/** Set line / outline buffer in milimeters.
* @note: added in version 2.3 */
void setBuffer( double buffer ) { mBuffer = buffer; }

/** Set minimum line / outline width in milimeters.
* @note: added in version 2.3 */
void setMinWidth( double width ) { mMinWidth = width; }

protected:
virtual void paint( QPainter* p );

Expand All @@ -59,7 +74,10 @@ class GUI_EXPORT QgsHighlight: public QgsMapCanvasItem

private:
void init();
void setSymbolColor( QgsSymbolV2* symbol, const QColor & color );
void setSymbol( QgsSymbolV2* symbol, const QgsRenderContext & context, const QColor & color );
double getSymbolWidth( const QgsRenderContext & context, double width, QgsSymbolV2::OutputUnit unit );
/** Get renderer for current color mode and colors. The renderer should be freed by caller. */
QgsFeatureRendererV2 * getRenderer( const QgsRenderContext & context );
void paintPoint( QPainter *p, QgsPoint point );
void paintLine( QPainter *p, QgsPolyline line );
void paintPolygon( QPainter *p, QgsPolygon polygon );
Expand All @@ -73,8 +91,9 @@ class GUI_EXPORT QgsHighlight: public QgsMapCanvasItem
QgsGeometry *mGeometry;
QgsMapLayer *mLayer;
QgsFeature mFeature;
QgsFeatureRendererV2 *mRenderer;
QColor mTemporaryFillColor;
double mBuffer; // line / outline buffer in pixels
double mMinWidth; // line / outline minimum width in pixels
};

#endif
252 changes: 189 additions & 63 deletions src/ui/qgsoptionsbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>801</width>
<width>820</width>
<height>636</height>
</rect>
</property>
Expand Down Expand Up @@ -248,7 +248,7 @@
<item>
<widget class="QStackedWidget" name="mOptionsStackedWidget">
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="mOptionsPageGeneral">
<layout class="QVBoxLayout" name="verticalLayout_3">
Expand All @@ -268,8 +268,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>524</width>
<height>706</height>
<width>646</width>
<height>586</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_28">
Expand Down Expand Up @@ -931,8 +931,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>645</width>
<height>803</height>
<width>610</width>
<height>867</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_22">
Expand Down Expand Up @@ -1293,8 +1293,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>529</width>
<height>480</height>
<width>502</width>
<height>381</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_27">
Expand Down Expand Up @@ -1603,8 +1603,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>702</width>
<height>890</height>
<width>669</width>
<height>744</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_29">
Expand Down Expand Up @@ -2202,8 +2202,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<height>394</height>
<width>469</width>
<height>335</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_25">
Expand Down Expand Up @@ -2538,32 +2538,99 @@
<rect>
<x>0</x>
<y>0</y>
<width>650</width>
<height>770</height>
<width>630</width>
<height>687</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_30">
<item>
<widget class="QgsCollapsibleGroupBox" name="groupBox_7">
<widget class="QgsCollapsibleGroupBox" name="mIdentifyGroupBox">
<property name="title">
<string>Identify</string>
</property>
<layout class="QGridLayout" name="layout_7">
<item row="0" column="0" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout_37">
<item>
<widget class="QCheckBox" name="cbxIdentifyResultsDocked">
<property name="text">
<string>Open identify results in a dock window (QGIS restart required)</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item>
<layout class="QHBoxLayout" name="mIdentifyModeHorizontalLayout">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cmbIdentifyMode"/>
</item>
<item>
<spacer name="horizontalSpacer_43">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="cbxAutoFeatureForm">
<property name="text">
<string>Open feature form, if a single feature is identified</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item>
<layout class="QHBoxLayout" name="mIdentifyRadiusHorizontalLayout">
<item>
<widget class="QLabel" name="textLabel1_3">
<property name="text">
<string>Search radius for identifying features and displaying map tips</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="spinBoxIdentifyValue">
<property name="suffix">
<string> %</string>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_44">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="textLabel2">
<property name="text">
<string>&lt;b&gt;Note:&lt;/b&gt; Specify the search radius as a percentage of the map width</string>
Expand All @@ -2573,38 +2640,97 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cmbIdentifyMode"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="textLabel1_3">
<property name="text">
<string>Search radius for identifying features and displaying map tips</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="spinBoxIdentifyValue">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Mode</string>
</property>
</widget>
<item>
<layout class="QHBoxLayout" name="mIdentifyHighlightHorizontalLayout">
<item>
<widget class="QLabel" name="mIdentifyHighlighColorLabel">
<property name="text">
<string>Highlight color</string>
</property>
</widget>
</item>
<item>
<widget class="QgsColorButton" name="mIdentifyHighlightColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The color used to highlight identified feature. The alpha channel is only used for polygons fill, lines and outlines are fully opaque.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="mIdentifyHighlightBufferLabel">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Buffer</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="mIdentifyHighlightBufferSpinBox">
<property name="toolTip">
<string>Lines / outlines buffer in milimeters.</string>
</property>
<property name="suffix">
<string> mm</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="mIdentifyHighlightMinWidthLabel">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Minimum width</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="mIdentifyHighlightMinWidthSpinBox">
<property name="toolTip">
<string>Minimum line / outline width in milimeters.</string>
</property>
<property name="suffix">
<string> mm</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_45">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
Expand Down Expand Up @@ -2949,8 +3075,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>507</width>
<height>396</height>
<width>470</width>
<height>360</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_39">
Expand Down Expand Up @@ -3160,8 +3286,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>494</width>
<height>691</height>
<width>472</width>
<height>579</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_31">
Expand Down Expand Up @@ -3651,8 +3777,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>464</width>
<height>386</height>
<width>432</width>
<height>364</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
Expand Down Expand Up @@ -3781,8 +3907,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>635</width>
<height>762</height>
<width>598</width>
<height>700</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_15">
Expand Down Expand Up @@ -4035,8 +4161,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>298</width>
<height>240</height>
<width>283</width>
<height>221</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_32">
Expand Down Expand Up @@ -4125,8 +4251,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>528</width>
<height>754</height>
<width>486</width>
<height>649</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_33">
Expand Down