mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
identify/highlight default constants
This commit is contained in:
parent
8fff180ac0
commit
3dfacc77bc
@ -152,6 +152,10 @@ class QGis
|
||||
|
||||
//! Default threshold between map coordinates and device coordinates for map2pixel simplification
|
||||
static const float DEFAULT_MAPTOPIXEL_THRESHOLD;
|
||||
|
||||
static const QColor DEFAULT_HIGHLIGHT_COLOR;
|
||||
static double DEFAULT_HIGHLIGHT_BUFFER_MM;
|
||||
static double DEFAULT_HIGHLIGHT_MIN_WIDTH_MM;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1265,10 +1265,10 @@ void QgsIdentifyResultsDialog::highlightFeature( QTreeWidgetItem *item )
|
||||
}
|
||||
|
||||
QSettings settings;
|
||||
QColor color = QColor( settings.value( "/Map/identify/highlight/color", "#ff0000" ).toString() );
|
||||
int alpha = settings.value( "/Map/identify/highlight/colorAlpha", "128" ).toInt();
|
||||
double buffer = settings.value( "/Map/identify/highlight/buffer", "0.5" ).toDouble();
|
||||
double minWidth = settings.value( "/Map/identify/highlight/minWidth", "1." ).toDouble();
|
||||
QColor color = QColor( settings.value( "/Map/highlight/color", QGis::DEFAULT_HIGHLIGHT_COLOR.name() ).toString() );
|
||||
int alpha = settings.value( "/Map/highlight/colorAlpha", QGis::DEFAULT_HIGHLIGHT_COLOR.alpha() ).toInt();
|
||||
double buffer = settings.value( "/Map/highlight/buffer", QGis::DEFAULT_HIGHLIGHT_BUFFER_MM ).toDouble();
|
||||
double minWidth = settings.value( "/Map/highlight/minWidth", QGis::DEFAULT_HIGHLIGHT_MIN_WIDTH_MM ).toDouble();
|
||||
|
||||
highlight->setColor( color ); // sets also fill with default alpha
|
||||
color.setAlpha( alpha );
|
||||
|
@ -119,13 +119,13 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
|
||||
identifyValue = QGis::DEFAULT_SEARCH_RADIUS_MM;
|
||||
spinBoxIdentifyValue->setMinimum( 0.0 );
|
||||
spinBoxIdentifyValue->setValue( identifyValue );
|
||||
QColor highlightColor = QColor( settings.value( "/Map/identify/highlight/color", "#ff0000" ).toString() );
|
||||
int highlightAlpha = settings.value( "/Map/identify/highlight/colorAlpha", "63" ).toInt();
|
||||
QColor highlightColor = QColor( settings.value( "/Map/highlight/color", QGis::DEFAULT_HIGHLIGHT_COLOR.name() ).toString() );
|
||||
int highlightAlpha = settings.value( "/Map/highlight/colorAlpha", QGis::DEFAULT_HIGHLIGHT_COLOR.alpha() ).toInt();
|
||||
highlightColor.setAlpha( highlightAlpha );
|
||||
mIdentifyHighlightColorButton->setColor( highlightColor );
|
||||
double highlightBuffer = settings.value( "/Map/identify/highlight/buffer", "0.5" ).toDouble();
|
||||
double highlightBuffer = settings.value( "/Map/highlight/buffer", QGis::DEFAULT_HIGHLIGHT_BUFFER_MM ).toDouble();
|
||||
mIdentifyHighlightBufferSpinBox->setValue( highlightBuffer );
|
||||
double highlightMinWidth = settings.value( "/Map/identify/highlight/minWidth", "1." ).toDouble();
|
||||
double highlightMinWidth = settings.value( "/Map/highlight/minWidth", QGis::DEFAULT_HIGHLIGHT_MIN_WIDTH_MM ).toDouble();
|
||||
mIdentifyHighlightMinWidthSpinBox->setValue( highlightMinWidth );
|
||||
|
||||
// custom environment variables
|
||||
@ -1046,10 +1046,10 @@ void QgsOptions::saveOptions()
|
||||
settings.setValue( "/Map/identifyMode", cmbIdentifyMode->itemData( cmbIdentifyMode->currentIndex() ).toInt() );
|
||||
settings.setValue( "/Map/identifyAutoFeatureForm", cbxAutoFeatureForm->isChecked() );
|
||||
settings.setValue( "/Map/searchRadiusMM", spinBoxIdentifyValue->value() );
|
||||
settings.setValue( "/Map/identify/highlight/color", mIdentifyHighlightColorButton->color().name() );
|
||||
settings.setValue( "/Map/identify/highlight/colorAlpha", mIdentifyHighlightColorButton->color().alpha() );
|
||||
settings.setValue( "/Map/identify/highlight/buffer", mIdentifyHighlightBufferSpinBox->value() );
|
||||
settings.setValue( "/Map/identify/highlight/minWidth", mIdentifyHighlightMinWidthSpinBox->value() );
|
||||
settings.setValue( "/Map/highlight/color", mIdentifyHighlightColorButton->color().name() );
|
||||
settings.setValue( "/Map/highlight/colorAlpha", mIdentifyHighlightColorButton->color().alpha() );
|
||||
settings.setValue( "/Map/highlight/buffer", mIdentifyHighlightBufferSpinBox->value() );
|
||||
settings.setValue( "/Map/highlight/minWidth", mIdentifyHighlightMinWidthSpinBox->value() );
|
||||
|
||||
bool showLegendClassifiers = settings.value( "/qgis/showLegendClassifiers", false ).toBool();
|
||||
settings.setValue( "/qgis/showLegendClassifiers", cbxLegendClassifiers->isChecked() );
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "qgsversion.h"
|
||||
#endif
|
||||
#include <QCoreApplication>
|
||||
#include <QColor>
|
||||
#include <QDate>
|
||||
#include <QTime>
|
||||
#include <QDateTime>
|
||||
@ -77,6 +78,12 @@ const double QGis::DEFAULT_SEARCH_RADIUS_MM = 2.;
|
||||
//! Default threshold between map coordinates and device coordinates for map2pixel simplification
|
||||
const float QGis::DEFAULT_MAPTOPIXEL_THRESHOLD = 1.0f;
|
||||
|
||||
const QColor QGis::DEFAULT_HIGHLIGHT_COLOR = QColor( 255, 0, 0, 128 );
|
||||
|
||||
double QGis::DEFAULT_HIGHLIGHT_BUFFER_MM = 0.5;
|
||||
|
||||
double QGis::DEFAULT_HIGHLIGHT_MIN_WIDTH_MM = 1.0;
|
||||
|
||||
// description strings for units
|
||||
// Order must match enum indices
|
||||
const char* QGis::qgisUnitTypes[] =
|
||||
|
@ -275,6 +275,19 @@ class CORE_EXPORT QGis
|
||||
//! Default threshold between map coordinates and device coordinates for map2pixel simplification
|
||||
static const float DEFAULT_MAPTOPIXEL_THRESHOLD;
|
||||
|
||||
/** Default highlight color. The transparency is expected to only be applied to polygon
|
||||
* fill. Lines and outlines are rendered opaque.
|
||||
* @note added in 2.3 */
|
||||
static const QColor DEFAULT_HIGHLIGHT_COLOR;
|
||||
|
||||
/** Default highlight buffer in mm.
|
||||
* @note added in 2.3 */
|
||||
static double DEFAULT_HIGHLIGHT_BUFFER_MM;
|
||||
|
||||
/** Default highlight line/outline minimum width in mm.
|
||||
* @note added in 2.3 */
|
||||
static double DEFAULT_HIGHLIGHT_MIN_WIDTH_MM;
|
||||
|
||||
private:
|
||||
// String representation of unit types (set in qgis.cpp)
|
||||
static const char *qgisUnitTypes[];
|
||||
|
Loading…
x
Reference in New Issue
Block a user