23 #include <QMessageBox>
24 #include <QInputDialog>
64 if ( symbolList.
size() < 1 )
73 for ( ; symbolIt != symbolList.
end(); ++symbolIt )
75 ( *symbolIt )->setColor( color );
84 if ( symbolList.
size() < 1 )
90 double oldTransparency = ( 1 - symbolList.
at( 0 )->alpha() ) * 100;
91 double transparency =
QInputDialog::getDouble(
this,
tr(
"Transparency" ),
tr(
"Change symbol transparency [%]" ), oldTransparency, 0.0, 100.0, 0, &ok );
95 for ( ; symbolIt != symbolList.
end(); ++symbolIt )
97 ( *symbolIt )->setAlpha( 1 - transparency / 100 );
106 if ( symbolList.
size() < 1 )
112 int currentUnit = ( symbolList.
at( 0 )->outputUnit() ==
QgsSymbolV2::MM ) ? 0 : 1;
119 for ( ; symbolIt != symbolList.
end(); ++symbolIt )
121 ( *symbolIt )->setOutputUnit( unit );
130 if ( symbolList.
size() < 1 )
138 if ( QDialog::Accepted == dlg.
exec() )
140 if ( !dlg.mDDBtn->isActive() )
143 for ( ; symbolIt != symbolList.
end(); ++symbolIt )
146 static_cast<QgsLineSymbolV2*>( *symbolIt )->setWidth( dlg.mSpinBox->
value() );
156 if ( symbolList.
size() < 1 )
164 if ( QDialog::Accepted == dlg.
exec() )
166 if ( !dlg.mDDBtn->isActive() )
169 for ( ; symbolIt != symbolList.
end(); ++symbolIt )
172 static_cast<QgsMarkerSymbolV2*>( *symbolIt )->setSize( dlg.mSpinBox->
value() );
182 if ( symbolList.
size() < 1 )
190 if ( QDialog::Accepted == dlg.
exec() )
192 if ( !dlg.mDDBtn->isActive() )
195 for ( ; symbolIt != symbolList.
end(); ++symbolIt )
198 static_cast<QgsMarkerSymbolV2*>( *symbolIt )->setAngle( dlg.mSpinBox->
value() );
233 :
QObject( menu ), mLayer( layer )
295 bool hasField =
false;
297 for (
int idx = 0; idx < flds.
count(); ++idx )
300 if ( fld.
type() == QVariant::Int || fld.
type() == QVariant::Double )
304 if ( fieldName == fld.
name() )
322 aExpr->
setText(
tr(
"- expression -" ) + fieldName );
337 if ( fldName ==
tr(
"- no field -" ) )
341 else if ( fldName.
startsWith(
tr(
"- expression -" ) ) )
344 expr.
replace( 0,
tr(
"- expression -" ).length(),
"" );
346 if ( !dialog.
exec() )
return;
349 a->
setText(
tr(
"- expression -" ) + fldName );
364 if ( fldName ==
tr(
"- no field -" ) )
368 else if ( fldName.
startsWith(
tr(
"- expression -" ) ) )
371 expr.
replace( 0,
tr(
"- expression -" ).length(),
"" );
373 if ( !dialog.
exec() )
return;
376 a->
setText(
tr(
"- expression -" ) + fldName );
387 if ( a->
text() ==
tr(
"Scale area" ) )
391 else if ( a->
text() ==
tr(
"Scale diameter" ) )
396 #if 0 // MK: is there any reason for this?
397 void QgsRendererV2DataDefinedMenus::updateMenu(
QActionGroup* actionGroup,
QString fieldName )
407 : mSymbolList( symbolList )
413 mLabel->setText( label );
464 mSpinBox->setEnabled( !mDDBtn->isActive() );
481 mSpinBox->setEnabled( !dd.
isActive() );
double value(const QgsSymbolV2 *symbol) const override
void setText(const QString &text)
Class for parsing and evaluation of expressions (formerly called "search strings").
const QString & name() const
Gets the name of the field.
OutputUnit
The unit of the output.
A container class for data source field mapping or expression.
void init(const QString &description)
static QgsExpressionContextScope * atlasScope(const QgsAtlasComposition *atlas)
Creates a new scope which contains variables and functions relating to a QgsAtlasComposition.
void setDataDefined(QgsSymbolV2 *symbol, const QgsDataDefined &dd) override
QgsFields fields() const
Returns the list of fields of this layer.
void setDataDefined(QgsSymbolV2 *symbol, const QgsDataDefined &dd) override
QgsDataDefined dataDefinedSize() const
Returns data defined size for whole symbol (including all symbol layers).
Calculate scale by the diameter.
const T & at(int i) const
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
Container of fields for a vector layer.
const QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
QString tr(const char *sourceText, const char *disambiguation, int n)
Map canvas is a class for displaying all GIS data types on a canvas.
double value(const QgsSymbolV2 *symbol) const override
QgsDataDefined dataDefinedWidth() const
Returns data defined size for whole symbol (including all symbol layers).
The QgsMapSettings class contains configuration for rendering of the map.
QgsDataDefined symbolDataDefined() const
Utility classes for "en masse" size definition.
The output shall be in millimeters.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context...
virtual void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
virtual QgsLegendSymbolList legendSymbolItems(double scaleDenominator=-1, const QString &rule="")
return a list of item text / symbol
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
virtual void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the dialog.
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
The output shall be in map unitx.
int count() const
Return number of items.
QGis::GeometryType geometryType() const
Returns point, line or polygon.
double value(const QgsSymbolV2 *symbol) const override
Encapsulate a field in an attribute table or data source.
Single scope for storing variables and functions for use within a QgsExpressionContext.
virtual double value(const QgsSymbolV2 *) const =0
void setShortcut(const QKeySequence &shortcut)
void setDataDefined(QgsSymbolV2 *symbol, const QgsDataDefined &dd) override
void dataDefinedChanged()
void setUsingSymbolLevels(bool usingSymbolLevels)
QString & replace(int position, int n, QChar after)
QList< QgsSymbolV2 * > mSymbolList
const QgsVectorLayer * vectorLayer() const
Returns the vector layer associated with the widget.
QList< QAction * > actions() const
static QColor getColor(const QColor &initialColor, QWidget *parent, const QString &title=QString(), const bool allowAlpha=false)
Return a color selection from a color dialog.
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object...
QgsExpressionContextScope & expressionContextScope()
Returns a reference to the expression context scope for the map canvas.
QgsDataDefined dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
virtual void setDataDefined(QgsSymbolV2 *symbol, const QgsDataDefined &dd)=0
bool usingSymbolLevels() const
QgsMapCanvas * mMapCanvas
Calculate scale by the area.
static QgsExpressionContextScope * projectScope()
Creates a new scope which contains variables and functions relating to the current QGIS project...
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Represents a vector layer which manages a vector based data sets.
int compare(const QString &other) const
A generic dialog for building expression strings.
QgsDataDefinedValueDialog(const QList< QgsSymbolV2 * > &symbolList, QgsVectorLayer *layer, const QString &label)
Constructor.
QVariant::Type type() const
Gets variant type of the field as it will be retrieved from data source.