41 #include <QAbstractButton> 42 #include <QColorDialog> 45 #include <QFileDialog> 48 #include <QStandardItemModel> 49 #include <QSvgRenderer> 50 #include <QMessageBox> 79 if (
const QgsSymbolLayerV2* symbolLayer = const_cast< QgsSymbolLayerV2Widget* >( widget )->symbolLayer() )
85 expContext << symbolScope;
120 button->
setProperty(
"propertyName", propertyName );
146 if ( entryName ==
"size" )
148 label =
tr(
"Size" );
155 label +=
" (" +
tr(
"area" ) +
')';
158 label +=
" (" +
tr(
"diameter" ) +
')';
176 btnChangeColor->setAllowAlpha(
true );
177 btnChangeColor->setColorDialogTitle(
tr(
"Select line color" ) );
178 btnChangeColor->setContext(
"symbology" );
180 spinOffset->setClearValue( 0.0 );
185 mDrawInsideCheckBox->hide();
204 connect(
this, SIGNAL(
changed() ),
this, SLOT( updateAssistantSymbol() ) );
209 delete mAssistantPreviewSymbol;
212 void QgsSimpleLineSymbolLayerV2Widget::updateAssistantSymbol()
214 for (
int i = mAssistantPreviewSymbol->
symbolLayerCount() - 1 ; i >= 0; --i )
227 if ( !layer || layer->
layerType() !=
"SimpleLine" )
234 mPenWidthUnitWidget->blockSignals(
true );
237 mPenWidthUnitWidget->blockSignals(
false );
238 mOffsetUnitWidget->blockSignals(
true );
241 mOffsetUnitWidget->blockSignals(
false );
242 mDashPatternUnitWidget->blockSignals(
true );
246 mDashPatternUnitWidget->blockSignals(
false );
249 spinWidth->blockSignals(
true );
251 spinWidth->blockSignals(
false );
252 btnChangeColor->blockSignals(
true );
254 btnChangeColor->blockSignals(
false );
255 spinOffset->blockSignals(
true );
257 spinOffset->blockSignals(
false );
258 cboPenStyle->blockSignals(
true );
259 cboJoinStyle->blockSignals(
true );
260 cboCapStyle->blockSignals(
true );
264 cboPenStyle->blockSignals(
false );
265 cboJoinStyle->blockSignals(
false );
266 cboCapStyle->blockSignals(
false );
270 mChangePatternButton->setEnabled( useCustomDashPattern );
271 label_3->setEnabled( !useCustomDashPattern );
272 cboPenStyle->setEnabled( !useCustomDashPattern );
273 mCustomCheckBox->blockSignals(
true );
274 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
275 mCustomCheckBox->blockSignals(
false );
279 mDrawInsideCheckBox->blockSignals(
true );
280 mDrawInsideCheckBox->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
281 mDrawInsideCheckBox->blockSignals(
false );
293 updateAssistantSymbol();
332 bool checked = ( state == Qt::Checked );
333 mChangePatternButton->setEnabled( checked );
334 label_3->setEnabled( !checked );
335 cboPenStyle->setEnabled( !checked );
344 if ( d.exec() == QDialog::Accepted )
384 bool checked = ( state == Qt::Checked );
403 mChangePatternButton->setIcon( buttonIcon );
421 btnChangeColorFill->setAllowAlpha(
true );
422 btnChangeColorFill->setColorDialogTitle(
tr(
"Select fill color" ) );
423 btnChangeColorFill->setContext(
"symbology" );
424 btnChangeColorFill->setShowNoColor(
true );
425 btnChangeColorFill->setNoColorString(
tr(
"Transparent fill" ) );
426 btnChangeColorBorder->setAllowAlpha(
true );
427 btnChangeColorBorder->setColorDialogTitle(
tr(
"Select border color" ) );
428 btnChangeColorBorder->setContext(
"symbology" );
429 btnChangeColorBorder->setShowNoColor(
true );
430 btnChangeColorBorder->setNoColorString(
tr(
"Transparent border" ) );
432 spinOffsetX->setClearValue( 0.0 );
433 spinOffsetY->setClearValue( 0.0 );
443 names <<
"circle" <<
"rectangle" <<
"diamond" <<
"pentagon" <<
"cross" <<
"cross2" <<
"triangle" 444 <<
"equilateral_triangle" <<
"star" <<
"regular_star" <<
"arrow" <<
"line" <<
"arrowhead" <<
"filled_arrowhead";
446 for (
int i = 0; i < names.
count(); ++i )
451 item->
setData( Qt::UserRole, names[i] );
455 connect( lstNames, SIGNAL( currentRowChanged(
int ) ),
this, SLOT(
setName() ) );
458 connect( spinSize, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setSize() ) );
459 connect( spinAngle, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setAngle() ) );
460 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
461 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
462 connect(
this, SIGNAL(
changed() ),
this, SLOT( updateAssistantSymbol() ) );
467 delete mAssistantPreviewSymbol;
472 if ( layer->
layerType() !=
"SimpleMarker" )
480 for (
int i = 0; i < lstNames->count(); ++i )
482 if ( lstNames->item( i )->data( Qt::UserRole ).toString() ==
name )
484 lstNames->setCurrentRow( i );
488 btnChangeColorBorder->blockSignals(
true );
490 btnChangeColorBorder->blockSignals(
false );
491 btnChangeColorFill->blockSignals(
true );
493 btnChangeColorFill->blockSignals(
false );
494 spinSize->blockSignals(
true );
496 spinSize->blockSignals(
false );
497 spinAngle->blockSignals(
true );
499 spinAngle->blockSignals(
false );
500 mOutlineStyleComboBox->blockSignals(
true );
502 mOutlineStyleComboBox->blockSignals(
false );
503 mOutlineWidthSpinBox->blockSignals(
true );
505 mOutlineWidthSpinBox->blockSignals(
false );
508 spinOffsetX->blockSignals(
true );
510 spinOffsetX->blockSignals(
false );
511 spinOffsetY->blockSignals(
true );
513 spinOffsetY->blockSignals(
false );
515 mSizeUnitWidget->blockSignals(
true );
518 mSizeUnitWidget->blockSignals(
false );
519 mOffsetUnitWidget->blockSignals(
true );
522 mOffsetUnitWidget->blockSignals(
false );
523 mOutlineWidthUnitWidget->blockSignals(
true );
526 mOutlineWidthUnitWidget->blockSignals(
false );
529 mHorizontalAnchorComboBox->blockSignals(
true );
530 mVerticalAnchorComboBox->blockSignals(
true );
533 mHorizontalAnchorComboBox->blockSignals(
false );
534 mVerticalAnchorComboBox->blockSignals(
false );
537 "<b>pentagon</b>|<b>triangle</b>|<b>equilateral_triangle</b>|" 538 "<b>star</b>|<b>regular_star</b>|<b>arrow</b>|<b>filled_arrowhead</b>|" 539 "<b>circle</b>|<b>cross</b>|<b>x</b>|" 540 "<b>cross2</b>|<b>line</b>|<b>arrowhead</b>]" ) );
551 updateAssistantSymbol();
561 mLayer->
setName( lstNames->currentItem()->data( Qt::UserRole ).toString() );
663 void QgsSimpleMarkerSymbolLayerV2Widget::updateAssistantSymbol()
665 for (
int i = mAssistantPreviewSymbol->
symbolLayerCount() - 1 ; i >= 0; --i )
687 btnChangeColor->setAllowAlpha(
true );
688 btnChangeColor->setColorDialogTitle(
tr(
"Select fill color" ) );
689 btnChangeColor->setContext(
"symbology" );
690 btnChangeColor->setShowNoColor(
true );
691 btnChangeColor->setNoColorString(
tr(
"Transparent fill" ) );
692 btnChangeBorderColor->setAllowAlpha(
true );
693 btnChangeBorderColor->setColorDialogTitle(
tr(
"Select border color" ) );
694 btnChangeBorderColor->setContext(
"symbology" );
695 btnChangeBorderColor->setShowNoColor(
true );
696 btnChangeBorderColor->setNoColorString(
tr(
"Transparent border" ) );
698 spinOffsetX->setClearValue( 0.0 );
699 spinOffsetY->setClearValue( 0.0 );
713 if ( layer->
layerType() !=
"SimpleFill" )
720 btnChangeColor->blockSignals(
true );
722 btnChangeColor->blockSignals(
false );
723 cboFillStyle->blockSignals(
true );
725 cboFillStyle->blockSignals(
false );
726 btnChangeBorderColor->blockSignals(
true );
728 btnChangeBorderColor->blockSignals(
false );
729 cboBorderStyle->blockSignals(
true );
731 cboBorderStyle->blockSignals(
false );
732 spinBorderWidth->blockSignals(
true );
734 spinBorderWidth->blockSignals(
false );
735 cboJoinStyle->blockSignals(
true );
737 cboJoinStyle->blockSignals(
false );
738 spinOffsetX->blockSignals(
true );
740 spinOffsetX->blockSignals(
false );
741 spinOffsetY->blockSignals(
true );
743 spinOffsetY->blockSignals(
false );
745 mBorderWidthUnitWidget->blockSignals(
true );
748 mBorderWidthUnitWidget->blockSignals(
false );
749 mOffsetUnitWidget->blockSignals(
true );
752 mOffsetUnitWidget->blockSignals(
false );
835 cboGradientColorRamp->setShowGradientOnly(
true );
838 btnChangeColor->setAllowAlpha(
true );
839 btnChangeColor->setColorDialogTitle(
tr(
"Select gradient color" ) );
840 btnChangeColor->setContext(
"symbology" );
841 btnChangeColor->setShowNoColor(
true );
842 btnChangeColor->setNoColorString(
tr(
"Transparent" ) );
843 btnChangeColor2->setAllowAlpha(
true );
844 btnChangeColor2->setColorDialogTitle(
tr(
"Select gradient color" ) );
845 btnChangeColor2->setContext(
"symbology" );
846 btnChangeColor2->setShowNoColor(
true );
847 btnChangeColor2->setNoColorString(
tr(
"Transparent" ) );
849 spinOffsetX->setClearValue( 0.0 );
850 spinOffsetY->setClearValue( 0.0 );
854 connect( cboGradientColorRamp, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
applyColorRamp() ) );
856 connect( mButtonEditRamp, SIGNAL( clicked() ), cboGradientColorRamp, SLOT( editSourceRamp() ) );
873 if ( layer->
layerType() !=
"GradientFill" )
880 btnChangeColor->blockSignals(
true );
882 btnChangeColor->blockSignals(
false );
883 btnChangeColor2->blockSignals(
true );
885 btnChangeColor2->blockSignals(
false );
889 radioTwoColor->setChecked(
true );
890 cboGradientColorRamp->setEnabled(
false );
894 radioColorRamp->setChecked(
true );
895 btnChangeColor->setEnabled(
false );
896 btnChangeColor2->setEnabled(
false );
902 cboGradientColorRamp->blockSignals(
true );
904 cboGradientColorRamp->blockSignals(
false );
907 cboGradientType->blockSignals(
true );
911 cboGradientType->setCurrentIndex( 0 );
914 cboGradientType->setCurrentIndex( 1 );
917 cboGradientType->setCurrentIndex( 2 );
920 cboGradientType->blockSignals(
false );
922 cboCoordinateMode->blockSignals(
true );
926 cboCoordinateMode->setCurrentIndex( 1 );
927 checkRefPoint1Centroid->setEnabled(
false );
928 checkRefPoint2Centroid->setEnabled(
false );
932 cboCoordinateMode->setCurrentIndex( 0 );
935 cboCoordinateMode->blockSignals(
false );
937 cboGradientSpread->blockSignals(
true );
941 cboGradientSpread->setCurrentIndex( 0 );
944 cboGradientSpread->setCurrentIndex( 1 );
947 cboGradientSpread->setCurrentIndex( 2 );
950 cboGradientSpread->blockSignals(
false );
952 spinRefPoint1X->blockSignals(
true );
954 spinRefPoint1X->blockSignals(
false );
955 spinRefPoint1Y->blockSignals(
true );
957 spinRefPoint1Y->blockSignals(
false );
958 checkRefPoint1Centroid->blockSignals(
true );
962 spinRefPoint1X->setEnabled(
false );
963 spinRefPoint1Y->setEnabled(
false );
965 checkRefPoint1Centroid->blockSignals(
false );
966 spinRefPoint2X->blockSignals(
true );
968 spinRefPoint2X->blockSignals(
false );
969 spinRefPoint2Y->blockSignals(
true );
971 spinRefPoint2Y->blockSignals(
false );
972 checkRefPoint2Centroid->blockSignals(
true );
976 spinRefPoint2X->setEnabled(
false );
977 spinRefPoint2Y->setEnabled(
false );
979 checkRefPoint2Centroid->blockSignals(
false );
981 spinOffsetX->blockSignals(
true );
983 spinOffsetX->blockSignals(
false );
984 spinOffsetY->blockSignals(
true );
986 spinOffsetY->blockSignals(
false );
987 mSpinAngle->blockSignals(
true );
989 mSpinAngle->blockSignals(
false );
991 mOffsetUnitWidget->blockSignals(
true );
994 mOffsetUnitWidget->blockSignals(
false );
1029 if ( radioTwoColor->isChecked() )
1057 spinRefPoint1X->setValue( 0.5 );
1058 spinRefPoint1Y->setValue( 0 );
1059 spinRefPoint2X->setValue( 0.5 );
1060 spinRefPoint2Y->setValue( 1 );
1065 spinRefPoint1X->setValue( 0 );
1066 spinRefPoint1Y->setValue( 0 );
1067 spinRefPoint2X->setValue( 1 );
1068 spinRefPoint2Y->setValue( 1 );
1072 spinRefPoint1X->setValue( 0.5 );
1073 spinRefPoint1Y->setValue( 0.5 );
1074 spinRefPoint2X->setValue( 1 );
1075 spinRefPoint2Y->setValue( 1 );
1090 checkRefPoint1Centroid->setEnabled(
true );
1091 checkRefPoint2Centroid->setEnabled(
true );
1097 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
1098 checkRefPoint1Centroid->setEnabled(
false );
1099 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1100 checkRefPoint2Centroid->setEnabled(
false );
1167 btnChangeColor->setAllowAlpha(
true );
1168 btnChangeColor->setColorDialogTitle(
tr(
"Select gradient color" ) );
1169 btnChangeColor->setContext(
"symbology" );
1170 btnChangeColor->setShowNoColor(
true );
1171 btnChangeColor->setNoColorString(
tr(
"Transparent" ) );
1172 btnChangeColor2->setAllowAlpha(
true );
1173 btnChangeColor2->setColorDialogTitle(
tr(
"Select gradient color" ) );
1174 btnChangeColor2->setContext(
"symbology" );
1175 btnChangeColor2->setShowNoColor(
true );
1176 btnChangeColor2->setNoColorString(
tr(
"Transparent" ) );
1178 spinOffsetX->setClearValue( 0.0 );
1179 spinOffsetY->setClearValue( 0.0 );
1183 connect( cboGradientColorRamp, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
applyColorRamp() ) );
1185 connect( mButtonEditRamp, SIGNAL( clicked() ), cboGradientColorRamp, SLOT( editSourceRamp() ) );
1193 connect( mBlurSlider, SIGNAL( valueChanged(
int ) ), mSpinBlurRadius, SLOT( setValue(
int ) ) );
1194 connect( mSpinBlurRadius, SIGNAL( valueChanged(
int ) ), mBlurSlider, SLOT( setValue(
int ) ) );
1199 if ( layer->
layerType() !=
"ShapeburstFill" )
1206 btnChangeColor->blockSignals(
true );
1208 btnChangeColor->blockSignals(
false );
1209 btnChangeColor2->blockSignals(
true );
1211 btnChangeColor2->blockSignals(
false );
1215 radioTwoColor->setChecked(
true );
1216 cboGradientColorRamp->setEnabled(
false );
1220 radioColorRamp->setChecked(
true );
1221 btnChangeColor->setEnabled(
false );
1222 btnChangeColor2->setEnabled(
false );
1225 mSpinBlurRadius->blockSignals(
true );
1226 mBlurSlider->blockSignals(
true );
1229 mSpinBlurRadius->blockSignals(
false );
1230 mBlurSlider->blockSignals(
false );
1232 mSpinMaxDistance->blockSignals(
true );
1234 mSpinMaxDistance->blockSignals(
false );
1236 mRadioUseWholeShape->blockSignals(
true );
1237 mRadioUseMaxDistance->blockSignals(
true );
1240 mRadioUseWholeShape->setChecked(
true );
1241 mSpinMaxDistance->setEnabled(
false );
1242 mDistanceUnitWidget->setEnabled(
false );
1246 mRadioUseMaxDistance->setChecked(
true );
1247 mSpinMaxDistance->setEnabled(
true );
1248 mDistanceUnitWidget->setEnabled(
true );
1250 mRadioUseWholeShape->blockSignals(
false );
1251 mRadioUseMaxDistance->blockSignals(
false );
1253 mDistanceUnitWidget->blockSignals(
true );
1256 mDistanceUnitWidget->blockSignals(
false );
1258 mIgnoreRingsCheckBox->blockSignals(
true );
1259 mIgnoreRingsCheckBox->setCheckState(
mLayer->
ignoreRings() ? Qt::Checked : Qt::Unchecked );
1260 mIgnoreRingsCheckBox->blockSignals(
false );
1265 cboGradientColorRamp->blockSignals(
true );
1267 cboGradientColorRamp->blockSignals(
false );
1270 spinOffsetX->blockSignals(
true );
1272 spinOffsetX->blockSignals(
false );
1273 spinOffsetY->blockSignals(
true );
1275 spinOffsetY->blockSignals(
false );
1276 mOffsetUnitWidget->blockSignals(
true );
1279 mOffsetUnitWidget->blockSignals(
false );
1319 if ( radioTwoColor->isChecked() )
1363 mDistanceUnitWidget->setEnabled( !value );
1400 bool checked = ( state == Qt::Checked );
1417 spinOffset->setClearValue( 0.0 );
1419 connect( spinInterval, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setInterval(
double ) ) );
1421 connect( chkRotateMarker, SIGNAL( clicked() ),
this, SLOT(
setRotate() ) );
1422 connect( spinOffset, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
1433 if ( layer->
layerType() !=
"MarkerLine" )
1440 spinInterval->blockSignals(
true );
1442 spinInterval->blockSignals(
false );
1443 mSpinOffsetAlongLine->blockSignals(
true );
1445 mSpinOffsetAlongLine->blockSignals(
false );
1446 chkRotateMarker->blockSignals(
true );
1448 chkRotateMarker->blockSignals(
false );
1449 spinOffset->blockSignals(
true );
1451 spinOffset->blockSignals(
false );
1453 radInterval->setChecked(
true );
1455 radVertex->setChecked(
true );
1457 radVertexLast->setChecked(
true );
1459 radCentralPoint->setChecked(
true );
1461 radCurvePoint->setChecked(
true );
1463 radVertexFirst->setChecked(
true );
1466 mIntervalUnitWidget->blockSignals(
true );
1469 mIntervalUnitWidget->blockSignals(
false );
1470 mOffsetUnitWidget->blockSignals(
true );
1473 mOffsetUnitWidget->blockSignals(
false );
1474 mOffsetAlongLineUnitWidget->blockSignals(
true );
1477 mOffsetAlongLineUnitWidget->blockSignals(
false );
1518 bool interval = radInterval->isChecked();
1519 spinInterval->setEnabled( interval );
1520 mSpinOffsetAlongLine->setEnabled( radInterval->isChecked() || radVertexLast->isChecked() || radVertexFirst->isChecked() );
1522 if ( radInterval->isChecked() )
1524 else if ( radVertex->isChecked() )
1526 else if ( radVertexLast->isChecked() )
1528 else if ( radVertexFirst->isChecked() )
1530 else if ( radCurvePoint->isChecked() )
1580 viewGroups->setHeaderHidden(
true );
1581 mChangeColorButton->setAllowAlpha(
true );
1582 mChangeColorButton->setColorDialogTitle(
tr(
"Select fill color" ) );
1583 mChangeColorButton->setContext(
"symbology" );
1584 mChangeBorderColorButton->setAllowAlpha(
true );
1585 mChangeBorderColorButton->setColorDialogTitle(
tr(
"Select border color" ) );
1586 mChangeBorderColorButton->setContext(
"symbology" );
1588 spinOffsetX->setClearValue( 0.0 );
1589 spinOffsetY->setClearValue( 0.0 );
1595 connect( spinSize, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setSize() ) );
1596 connect( spinAngle, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setAngle() ) );
1597 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
1598 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
1599 connect(
this, SIGNAL(
changed() ),
this, SLOT( updateAssistantSymbol() ) );
1609 delete mAssistantPreviewSymbol;
1613 #include <QAbstractListModel> 1614 #include <QPixmapCache> 1620 QgsSvgGroupsModel* g =
new QgsSvgGroupsModel( viewGroups );
1621 viewGroups->setModel( g );
1623 int rows = g->rowCount( g->indexFromItem( g->invisibleRootItem() ) );
1624 for (
int i = 0; i < rows; i++ )
1626 viewGroups->setExpanded( g->indexFromItem( g->item( i ) ),
true );
1630 QgsSvgListModel* m =
new QgsSvgListModel( viewImages );
1631 viewImages->setModel( m );
1638 QgsSvgListModel* m =
new QgsSvgListModel( viewImages, path );
1639 viewImages->setModel( m );
1653 bool hasFillParam, hasFillOpacityParam, hasOutlineParam, hasOutlineWidthParam, hasOutlineOpacityParam;
1654 QColor defaultFill, defaultOutline;
1655 double defaultOutlineWidth, defaultFillOpacity, defaultOutlineOpacity;
1656 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultOutlineColor, hasDefaultOutlineWidth, hasDefaultOutlineOpacity;
1658 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
1659 hasOutlineParam, hasDefaultOutlineColor, defaultOutline,
1660 hasOutlineWidthParam, hasDefaultOutlineWidth, defaultOutlineWidth,
1661 hasOutlineOpacityParam, hasDefaultOutlineOpacity, defaultOutlineOpacity );
1662 mChangeColorButton->setEnabled( hasFillParam );
1663 mChangeColorButton->setAllowAlpha( hasFillOpacityParam );
1664 mChangeBorderColorButton->setEnabled( hasOutlineParam );
1665 mChangeBorderColorButton->setAllowAlpha( hasOutlineOpacityParam );
1666 mBorderWidthSpinBox->setEnabled( hasOutlineWidthParam );
1671 double existingOpacity = hasFillOpacityParam ? fill.
alphaF() : 1.0;
1672 if ( hasDefaultFillColor )
1676 fill.
setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : existingOpacity );
1677 mChangeColorButton->setColor( fill );
1679 if ( hasOutlineParam )
1682 double existingOpacity = hasOutlineOpacityParam ? outline.
alphaF() : 1.0;
1683 if ( hasDefaultOutlineColor )
1685 outline = defaultOutline;
1687 outline.
setAlphaF( hasDefaultOutlineOpacity ? defaultOutlineOpacity : existingOpacity );
1688 mChangeBorderColorButton->setColor( outline );
1691 mFileLineEdit->blockSignals(
true );
1692 mFileLineEdit->setText( layer->
path() );
1693 mFileLineEdit->blockSignals(
false );
1695 mBorderWidthSpinBox->blockSignals(
true );
1696 mBorderWidthSpinBox->setValue( hasDefaultOutlineWidth ? defaultOutlineWidth : layer->
outlineWidth() );
1697 mBorderWidthSpinBox->blockSignals(
false );
1700 void QgsSvgMarkerSymbolLayerV2Widget::updateAssistantSymbol()
1702 for (
int i = mAssistantPreviewSymbol->
symbolLayerCount() - 1 ; i >= 0; --i )
1720 if ( layer->
layerType() !=
"SvgMarker" )
1730 for (
int i = 0; i < m->
rowCount(); i++ )
1735 selModel->
select( idx, QItemSelectionModel::SelectCurrent );
1742 spinSize->blockSignals(
true );
1744 spinSize->blockSignals(
false );
1745 spinAngle->blockSignals(
true );
1747 spinAngle->blockSignals(
false );
1750 spinOffsetX->blockSignals(
true );
1752 spinOffsetX->blockSignals(
false );
1753 spinOffsetY->blockSignals(
true );
1755 spinOffsetY->blockSignals(
false );
1757 mSizeUnitWidget->blockSignals(
true );
1760 mSizeUnitWidget->blockSignals(
false );
1761 mBorderWidthUnitWidget->blockSignals(
true );
1764 mBorderWidthUnitWidget->blockSignals(
false );
1765 mOffsetUnitWidget->blockSignals(
true );
1768 mOffsetUnitWidget->blockSignals(
false );
1771 mHorizontalAnchorComboBox->blockSignals(
true );
1772 mVerticalAnchorComboBox->blockSignals(
true );
1775 mHorizontalAnchorComboBox->blockSignals(
false );
1776 mVerticalAnchorComboBox->blockSignals(
false );
1790 updateAssistantSymbol();
1802 mFileLineEdit->setText( name );
1830 tr(
"Select SVG file" ),
1832 tr(
"SVG files" ) +
" (*.svg)" );
1834 if ( file.
isEmpty() || !fi.exists() )
1838 mFileLineEdit->setText( file );
1840 s.
setValue(
"/UI/lastSVGMarkerDir", fi.absolutePath() );
1858 if ( !
QFileInfo( mFileLineEdit->text() ).exists() )
1860 QUrl url( mFileLineEdit->text() );
1861 if ( !url.isValid() )
1962 mSvgTreeView->setHeaderHidden(
true );
1965 mChangeColorButton->setColorDialogTitle(
tr(
"Select fill color" ) );
1966 mChangeColorButton->setContext(
"symbology" );
1967 mChangeBorderColorButton->setColorDialogTitle(
tr(
"Select border color" ) );
1968 mChangeBorderColorButton->setContext(
"symbology" );
1990 mTextureWidthSpinBox->blockSignals(
true );
1991 mTextureWidthSpinBox->setValue( width );
1992 mTextureWidthSpinBox->blockSignals(
false );
1994 mRotationSpinBox->blockSignals(
true );
1996 mRotationSpinBox->blockSignals(
false );
1997 mTextureWidthUnitWidget->blockSignals(
true );
2000 mTextureWidthUnitWidget->blockSignals(
false );
2001 mSvgOutlineWidthUnitWidget->blockSignals(
true );
2004 mSvgOutlineWidthUnitWidget->blockSignals(
false );
2005 mChangeColorButton->blockSignals(
true );
2007 mChangeColorButton->blockSignals(
false );
2008 mChangeBorderColorButton->blockSignals(
true );
2010 mChangeBorderColorButton->blockSignals(
false );
2011 mBorderWidthSpinBox->blockSignals(
true );
2013 mBorderWidthSpinBox->blockSignals(
false );
2030 void QgsSVGFillSymbolLayerWidget::on_mBrowseToolButton_clicked()
2033 if ( !filePath.
isNull() )
2035 mSVGLineEdit->setText( filePath );
2040 void QgsSVGFillSymbolLayerWidget::on_mTextureWidthSpinBox_valueChanged(
double d )
2049 void QgsSVGFillSymbolLayerWidget::on_mSVGLineEdit_textEdited(
const QString & text )
2066 void QgsSVGFillSymbolLayerWidget::on_mSVGLineEdit_editingFinished()
2076 QUrl url( mSVGLineEdit->text() );
2077 if ( !url.isValid() )
2091 void QgsSVGFillSymbolLayerWidget::setFile(
const QModelIndex& item )
2095 mSVGLineEdit->setText( file );
2103 QgsSvgGroupsModel* g =
new QgsSvgGroupsModel( mSvgTreeView );
2104 mSvgTreeView->setModel( g );
2106 int rows = g->rowCount( g->indexFromItem( g->invisibleRootItem() ) );
2107 for (
int i = 0; i < rows; i++ )
2109 mSvgTreeView->setExpanded( g->indexFromItem( g->item( i ) ),
true );
2112 QgsSvgListModel* m =
new QgsSvgListModel( mSvgListView );
2113 mSvgListView->setModel( m );
2116 void QgsSVGFillSymbolLayerWidget::populateIcons(
const QModelIndex& idx )
2120 QgsSvgListModel* m =
new QgsSvgListModel( mSvgListView, path );
2121 mSvgListView->setModel( m );
2128 void QgsSVGFillSymbolLayerWidget::on_mRotationSpinBox_valueChanged(
double d )
2140 bool hasFillParam, hasFillOpacityParam, hasOutlineParam, hasOutlineWidthParam, hasOutlineOpacityParam;
2141 QColor defaultFill, defaultOutline;
2142 double defaultOutlineWidth, defaultFillOpacity, defaultOutlineOpacity;
2143 bool hasDefaultFillColor, hasDefaultFillOpacity, hasDefaultOutlineColor, hasDefaultOutlineWidth, hasDefaultOutlineOpacity;
2145 hasFillOpacityParam, hasDefaultFillOpacity, defaultFillOpacity,
2146 hasOutlineParam, hasDefaultOutlineColor, defaultOutline,
2147 hasOutlineWidthParam, hasDefaultOutlineWidth, defaultOutlineWidth,
2148 hasOutlineOpacityParam, hasDefaultOutlineOpacity, defaultOutlineOpacity );
2151 QColor fill = mChangeColorButton->color();
2152 double newOpacity = hasFillOpacityParam ? fill.
alphaF() : 1.0;
2153 if ( hasDefaultFillColor )
2157 fill.
setAlphaF( hasDefaultFillOpacity ? defaultFillOpacity : newOpacity );
2158 mChangeColorButton->setColor( fill );
2160 mChangeColorButton->setEnabled( hasFillParam );
2161 mChangeColorButton->setAllowAlpha( hasFillOpacityParam );
2164 QColor outline = mChangeBorderColorButton->color();
2165 double newOpacity = hasOutlineOpacityParam ? outline.
alphaF() : 1.0;
2166 if ( hasDefaultOutlineColor )
2168 outline = defaultOutline;
2170 outline.
setAlphaF( hasDefaultOutlineOpacity ? defaultOutlineOpacity : newOpacity );
2171 mChangeBorderColorButton->setColor( outline );
2173 mChangeBorderColorButton->setEnabled( hasOutlineParam );
2174 mChangeBorderColorButton->setAllowAlpha( hasOutlineOpacityParam );
2175 if ( hasDefaultOutlineWidth && resetValues )
2177 mBorderWidthSpinBox->setValue( defaultOutlineWidth );
2179 mBorderWidthSpinBox->setEnabled( hasOutlineWidthParam );
2182 void QgsSVGFillSymbolLayerWidget::on_mChangeColorButton_colorChanged(
const QColor& color )
2193 void QgsSVGFillSymbolLayerWidget::on_mChangeBorderColorButton_colorChanged(
const QColor& color )
2204 void QgsSVGFillSymbolLayerWidget::on_mBorderWidthSpinBox_valueChanged(
double d )
2213 void QgsSVGFillSymbolLayerWidget::on_mTextureWidthUnitWidget_changed()
2223 void QgsSVGFillSymbolLayerWidget::on_mSvgOutlineWidthUnitWidget_changed()
2241 mOffsetSpinBox->setClearValue( 0 );
2246 if ( layer->
layerType() !=
"LinePatternFill" )
2255 mAngleSpinBox->blockSignals(
true );
2257 mAngleSpinBox->blockSignals(
false );
2258 mDistanceSpinBox->blockSignals(
true );
2260 mDistanceSpinBox->blockSignals(
false );
2261 mOffsetSpinBox->blockSignals(
true );
2263 mOffsetSpinBox->blockSignals(
false );
2266 mDistanceUnitWidget->blockSignals(
true );
2269 mDistanceUnitWidget->blockSignals(
false );
2270 mOffsetUnitWidget->blockSignals(
true );
2273 mOffsetUnitWidget->blockSignals(
false );
2285 void QgsLinePatternFillSymbolLayerWidget::on_mAngleSpinBox_valueChanged(
double d )
2294 void QgsLinePatternFillSymbolLayerWidget::on_mDistanceSpinBox_valueChanged(
double d )
2303 void QgsLinePatternFillSymbolLayerWidget::on_mOffsetSpinBox_valueChanged(
double d )
2312 void QgsLinePatternFillSymbolLayerWidget::on_mDistanceUnitWidget_changed()
2322 void QgsLinePatternFillSymbolLayerWidget::on_mOffsetUnitWidget_changed()
2347 if ( !layer || layer->
layerType() !=
"PointPatternFill" )
2353 mHorizontalDistanceSpinBox->blockSignals(
true );
2355 mHorizontalDistanceSpinBox->blockSignals(
false );
2356 mVerticalDistanceSpinBox->blockSignals(
true );
2358 mVerticalDistanceSpinBox->blockSignals(
false );
2359 mHorizontalDisplacementSpinBox->blockSignals(
true );
2361 mHorizontalDisplacementSpinBox->blockSignals(
false );
2362 mVerticalDisplacementSpinBox->blockSignals(
true );
2364 mVerticalDisplacementSpinBox->blockSignals(
false );
2366 mHorizontalDistanceUnitWidget->blockSignals(
true );
2369 mHorizontalDistanceUnitWidget->blockSignals(
false );
2370 mVerticalDistanceUnitWidget->blockSignals(
true );
2373 mVerticalDistanceUnitWidget->blockSignals(
false );
2374 mHorizontalDisplacementUnitWidget->blockSignals(
true );
2377 mHorizontalDisplacementUnitWidget->blockSignals(
false );
2378 mVerticalDisplacementUnitWidget->blockSignals(
true );
2381 mVerticalDisplacementUnitWidget->blockSignals(
false );
2394 void QgsPointPatternFillSymbolLayerWidget::on_mHorizontalDistanceSpinBox_valueChanged(
double d )
2403 void QgsPointPatternFillSymbolLayerWidget::on_mVerticalDistanceSpinBox_valueChanged(
double d )
2412 void QgsPointPatternFillSymbolLayerWidget::on_mHorizontalDisplacementSpinBox_valueChanged(
double d )
2421 void QgsPointPatternFillSymbolLayerWidget::on_mVerticalDisplacementSpinBox_valueChanged(
double d )
2430 void QgsPointPatternFillSymbolLayerWidget::on_mHorizontalDistanceUnitWidget_changed()
2440 void QgsPointPatternFillSymbolLayerWidget::on_mVerticalDistanceUnitWidget_changed()
2450 void QgsPointPatternFillSymbolLayerWidget::on_mHorizontalDisplacementUnitWidget_changed()
2460 void QgsPointPatternFillSymbolLayerWidget::on_mVerticalDisplacementUnitWidget_changed()
2483 btnColor->setAllowAlpha(
true );
2484 btnColor->setColorDialogTitle(
tr(
"Select symbol color" ) );
2485 btnColor->setContext(
"symbology" );
2487 spinOffsetX->setClearValue( 0.0 );
2488 spinOffsetY->setClearValue( 0.0 );
2497 connect( spinSize, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setSize(
double ) ) );
2499 connect( spinAngle, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setAngle(
double ) ) );
2500 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
2501 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
2503 connect(
this, SIGNAL(
changed() ),
this, SLOT( updateAssistantSymbol() ) );
2508 delete mAssistantPreviewSymbol;
2513 if ( layer->
layerType() !=
"FontMarker" )
2521 cboFont->blockSignals(
true );
2522 cboFont->setCurrentFont( layerFont );
2523 cboFont->blockSignals(
false );
2524 spinSize->blockSignals(
true );
2526 spinSize->blockSignals(
false );
2527 btnColor->blockSignals(
true );
2529 btnColor->blockSignals(
false );
2530 spinAngle->blockSignals(
true );
2532 spinAngle->blockSignals(
false );
2540 spinOffsetX->blockSignals(
true );
2542 spinOffsetX->blockSignals(
false );
2543 spinOffsetY->blockSignals(
true );
2545 spinOffsetY->blockSignals(
false );
2547 mSizeUnitWidget->blockSignals(
true );
2550 mSizeUnitWidget->blockSignals(
false );
2552 mOffsetUnitWidget->blockSignals(
true );
2555 mOffsetUnitWidget->blockSignals(
false );
2558 mHorizontalAnchorComboBox->blockSignals(
true );
2559 mVerticalAnchorComboBox->blockSignals(
true );
2562 mHorizontalAnchorComboBox->blockSignals(
false );
2563 mVerticalAnchorComboBox->blockSignals(
false );
2573 updateAssistantSymbol();
2657 void QgsFontMarkerSymbolLayerV2Widget::updateAssistantSymbol()
2659 for (
int i = mAssistantPreviewSymbol->
symbolLayerCount() - 1 ; i >= 0; --i )
2682 if ( layer->
layerType() !=
"CentroidFill" )
2689 mDrawInsideCheckBox->blockSignals(
true );
2691 mDrawInsideCheckBox->blockSignals(
false );
2699 void QgsCentroidFillSymbolLayerV2Widget::on_mDrawInsideCheckBox_stateChanged(
int state )
2716 mSpinOffsetX->setClearValue( 0.0 );
2717 mSpinOffsetY->setClearValue( 0.0 );
2719 connect( cboCoordinateMode, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT( setCoordinateMode(
int ) ) );
2720 connect( mSpinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT( offsetChanged() ) );
2721 connect( mSpinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT( offsetChanged() ) );
2731 if ( layer->
layerType() !=
"RasterFill" )
2742 mImageLineEdit->blockSignals(
true );
2744 mImageLineEdit->blockSignals(
false );
2746 cboCoordinateMode->blockSignals(
true );
2750 cboCoordinateMode->setCurrentIndex( 1 );
2754 cboCoordinateMode->setCurrentIndex( 0 );
2757 cboCoordinateMode->blockSignals(
false );
2758 mSpinTransparency->blockSignals(
true );
2759 mSpinTransparency->setValue(
mLayer->
alpha() * 100.0 );
2760 mSpinTransparency->blockSignals(
false );
2761 mSliderTransparency->blockSignals(
true );
2762 mSliderTransparency->setValue(
mLayer->
alpha() * 100.0 );
2763 mSliderTransparency->blockSignals(
false );
2764 mRotationSpinBox->blockSignals(
true );
2766 mRotationSpinBox->blockSignals(
false );
2768 mSpinOffsetX->blockSignals(
true );
2770 mSpinOffsetX->blockSignals(
false );
2771 mSpinOffsetY->blockSignals(
true );
2773 mSpinOffsetY->blockSignals(
false );
2774 mOffsetUnitWidget->blockSignals(
true );
2777 mOffsetUnitWidget->blockSignals(
false );
2779 mWidthSpinBox->blockSignals(
true );
2781 mWidthSpinBox->blockSignals(
false );
2782 mWidthUnitWidget->blockSignals(
true );
2785 mWidthUnitWidget->blockSignals(
false );
2786 updatePreviewImage();
2799 void QgsRasterFillSymbolLayerWidget::on_mBrowseToolButton_clicked()
2803 QString lineEditText = mImageLineEdit->text();
2804 if ( !lineEditText.
isEmpty() )
2806 QFileInfo openDirFileInfo( lineEditText );
2807 openDir = openDirFileInfo.
path();
2817 if ( !filePath.
isNull() )
2828 mImageLineEdit->setText( filePath );
2829 on_mImageLineEdit_editingFinished();
2833 void QgsRasterFillSymbolLayerWidget::on_mImageLineEdit_editingFinished()
2843 QUrl url( mImageLineEdit->text() );
2844 if ( !url.isValid() )
2852 updatePreviewImage();
2858 void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
2875 void QgsRasterFillSymbolLayerWidget::on_mSpinTransparency_valueChanged(
int value )
2884 updatePreviewImage();
2887 void QgsRasterFillSymbolLayerWidget::offsetChanged()
2893 void QgsRasterFillSymbolLayerWidget::on_mOffsetUnitWidget_changed()
2904 void QgsRasterFillSymbolLayerWidget::on_mRotationSpinBox_valueChanged(
double d )
2913 void QgsRasterFillSymbolLayerWidget::on_mWidthUnitWidget_changed()
2924 void QgsRasterFillSymbolLayerWidget::on_mWidthSpinBox_valueChanged(
double d )
2935 void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
2943 if ( image.isNull() )
2945 mLabelImagePreview->setPixmap(
QPixmap() );
2949 if ( image.height() > 150 || image.width() > 150 )
2951 image = image.
scaled( 150, 150, Qt::KeepAspectRatio, Qt::SmoothTransformation );
2954 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
2955 previewImage.
fill( Qt::transparent );
2956 QRect imageRect(( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
2958 p.
begin( &previewImage );
2960 uchar pixDataRGB[] = { 150, 150, 150, 150,
2965 QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
2969 p.fillRect( imageRect, checkerBrush );
2976 p.drawImage( imageRect.left(), imageRect.top(), image );
2994 int QgsSvgListModel::rowCount(
const QModelIndex& parent )
const 2997 return mSvgFiles.count();
3004 if ( role == Qt::DecorationRole )
3011 double outlineWidth, fillOpacity, outlineOpacity;
3012 bool fillParam, fillOpacityParam, outlineParam, outlineWidthParam, outlineOpacityParam;
3013 bool hasDefaultFillColor =
false, hasDefaultFillOpacity =
false, hasDefaultOutlineColor =
false,
3014 hasDefaultOutlineWidth =
false, hasDefaultOutlineOpacity =
false;
3016 fillOpacityParam, hasDefaultFillOpacity, fillOpacity,
3017 outlineParam, hasDefaultOutlineColor, outline,
3018 outlineWidthParam, hasDefaultOutlineWidth, outlineWidth,
3019 outlineOpacityParam, hasDefaultOutlineOpacity, outlineOpacity );
3022 if ( !hasDefaultFillColor )
3023 fill =
QColor( 200, 200, 200 );
3024 fill.
setAlphaF( hasDefaultFillOpacity ? fillOpacity : 1.0 );
3025 if ( !hasDefaultOutlineColor )
3026 outline = Qt::black;
3027 outline.
setAlphaF( hasDefaultOutlineOpacity ? outlineOpacity : 1.0 );
3028 if ( !hasDefaultOutlineWidth )
3039 else if ( role == Qt::UserRole || role == Qt::ToolTipRole )
3053 for (
int i = 0; i < svgPaths.
size(); i++ )
3055 QDir dir( svgPaths[i] );
3076 createTree( baseGroup );
3081 void QgsSvgGroupsModel::createTree(
QStandardItem*& parentGroup )
3084 Q_FOREACH (
const QString& item, parentDir.entryList( QDir::Dirs | QDir::NoDotAndDotDot ) )
3090 group->
setToolTip( parentDir.path() +
'/' + item );
3093 createTree( group );
3110 modificationExpressionSelector->setLayer( const_cast<QgsVectorLayer*>( vl ) );
3111 modificationExpressionSelector->loadFieldNames();
3115 connect( modificationExpressionSelector, SIGNAL( expressionParsed(
bool ) ),
this, SLOT( updateExpression() ) );
3116 connect( cbxGeometryType, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT( updateSymbolType() ) );
3126 cbxGeometryType->setCurrentIndex( cbxGeometryType->findData( mLayer->
symbolType() ) );
3134 void QgsGeometryGeneratorSymbolLayerWidget::updateExpression()
3141 void QgsGeometryGeneratorSymbolLayerWidget::updateSymbolType()
3143 mLayer->
setSymbolType( static_cast<QgsSymbolV2::SymbolType>( cbxGeometryType->itemData( cbxGeometryType->currentIndex() ).toInt() ) );
void setIntervalUnit(QgsSymbolV2::OutputUnit unit)
QColor borderColor() const
QgsSymbolV2::OutputUnit customDashPatternUnit() const
void setBorderWidthMapUnitScale(const QgsMapUnitScale &scale)
QgsVectorColorRampV2 * colorRamp()
Color ramp used for the gradient fill, only used if the gradient color type is set to ColorRamp...
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
VerticalAnchorPoint verticalAnchorPoint() const
bool ignoreRings() const
Returns whether the shapeburst fill is set to ignore polygon interior rings.
QgsSymbolV2::OutputUnit intervalUnit() const
QgsSymbolV2::OutputUnit patternWidthUnit() const
void setDistanceUnit(QgsSymbolV2::OutputUnit unit)
Sets the unit for the maximum distance to shade inside of the shape from the polygon's boundary...
void setOutlineStyle(Qt::PenStyle outlineStyle)
QgsSymbolV2::OutputUnit outlineWidthUnit() const
double borderWidth() const
void setMaxDistance(double maxDistance)
Sets the maximum distance to shape inside of the shape from the polygon's boundary.
const QgsMapUnitScale & patternWidthMapUnitScale() const
QgsVectorColorRampV2 * colorRamp()
Returns the color ramp used for the shapeburst fill.
bool deleteSymbolLayer(int index)
delete symbol layer at specified index
void setDistance(double d)
Single variable definition for use within a QgsExpressionContextScope.
double outlineWidth() const
QgsSymbolV2::OutputUnit distanceYUnit() const
virtual int rowCount(const QModelIndex &parent) const =0
void setReferencePoint1(QPointF referencePoint)
Starting point of gradient fill, in the range [0,0] - [1,1].
QgsSymbolV2::OutputUnit offsetAlongLineUnit() const
Returns the unit used for calculating the offset along line for markers.
void setSymbolType(QgsSymbolV2::SymbolType symbolType)
Set the type of symbol which should be created.
void setReferencePoint2IsCentroid(bool isCentroid)
Sets the end point of the gradient to be the feature centroid.
void setSvgOutlineWidth(double w)
const QgsMapUnitScale & displacementXMapUnitScale() const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const =0
void setIcon(const QIcon &icon)
A container class for data source field mapping or expression.
static QIcon symbolLayerPreviewIcon(QgsSymbolLayerV2 *layer, QgsSymbolV2::OutputUnit u, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale())
void setCoordinateMode(GradientCoordinateMode coordinateMode)
virtual double width() const
QgsSymbolV2::OutputUnit distanceXUnit() const
static QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
void setSvgFillColor(const QColor &c)
void setPatternWidthMapUnitScale(const QgsMapUnitScale &scale)
HorizontalAnchorPoint horizontalAnchorPoint() const
QgsSymbolV2::OutputUnit offsetUnit() const
void setDistanceYUnit(QgsSymbolV2::OutputUnit unit)
QString svgFilePath() const
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
const QgsMapUnitScale & customDashPatternMapUnitScale() const
static QgsExpressionContextScope * atlasScope(const QgsAtlasComposition *atlas)
Creates a new scope which contains variables and functions relating to a QgsAtlasComposition.
QPointF referencePoint2() const
void setOutlineColor(const QColor &c) override
Set outline color.
QString geometryExpression() const
Get the expression to generate this geometry.
void setDataDefinedSize(const QgsDataDefined &dd)
Set data defined size for whole symbol (including all symbol layers).
double displacementX() const
void setCustomDashPatternUnit(QgsSymbolV2::OutputUnit unit)
double svgOutlineWidth() const
void setPointOnSurface(bool pointOnSurface)
static QIcon getThemeIcon(const QString &theName)
Helper to get a theme icon.
bool useCustomDashPattern() const
QgsSymbolV2::SymbolType symbolType() const
Access the symbol type.
QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const
void setIgnoreRings(bool ignoreRings)
Sets whether the shapeburst fill should ignore polygon rings when calculating the buffered shading...
The output shall be in pixels.
Calculate scale by the diameter.
void setOffset(QPointF offset)
void setUseCustomDashPattern(bool b)
void setHorizontalAnchorPoint(HorizontalAnchorPoint h)
const QgsMapUnitScale & widthMapUnitScale() const
Returns the map unit scale for the image's width.
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
QVector< qreal > customDashVector() const
void setOutlineWidth(double w)
const QgsMapUnitScale & intervalMapUnitScale() const
void setPenJoinStyle(Qt::PenJoinStyle style)
bool referencePoint2IsCentroid() const
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
void setVerticalAnchorPoint(VerticalAnchorPoint v)
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
GradientCoordinateMode coordinateMode() const
Coordinate mode for gradient.
void setDistanceXMapUnitScale(const QgsMapUnitScale &scale)
int blurRadius() const
Returns the blur radius, which controls the amount of blurring applied to the fill.
QgsSymbolV2::OutputUnit sizeUnit() const
void setOutlineWidth(double w)
QColor fillColor() const override
Get fill color.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setSvgOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
void setIntervalMapUnitScale(const QgsMapUnitScale &scale)
static QStringList listSvgFilesAt(const QString &directory)
Return a list of svg files at the specified directory.
const QgsMapUnitScale & borderWidthMapUnitScale() const
void setMapUnitScale(const QgsMapUnitScale &scale) override
QString tr(const char *sourceText, const char *disambiguation, int n)
void setColorRamp(QgsVectorColorRampV2 *ramp)
Map canvas is a class for displaying all GIS data types on a canvas.
void setVariable(const QString &name, const QVariant &value)
Convenience method for setting a variable in the context scope by name and value. ...
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
Qt::PenStyle penStyle() const
void setWidthUnit(QgsSymbolV2::OutputUnit unit)
void setPatternWidth(double width)
virtual void setData(const QVariant &value, int role)
QgsSymbolV2::OutputUnit offsetUnit() const
Returns the units used for the offset of the shapeburst fill.
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
void setSvgOutlineColor(const QColor &c)
void setOffsetAlongLine(double offsetAlongLine)
Sets the the offset along the line for the marker placement.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setInterval(double interval)
The interval between individual markers.
The QgsMapSettings class contains configuration for rendering of the map.
void setDistanceUnit(QgsSymbolV2::OutputUnit unit)
void containsParams(const QString &path, bool &hasFillParam, QColor &defaultFillColor, bool &hasOutlineParam, QColor &defaultOutlineColor, bool &hasOutlineWidthParam, double &defaultOutlineWidth) const
Tests if an svg file contains parameters for fill, outline color, outline width.
static QgsSvgCache * instance()
void setDrawInsidePolygon(bool drawInsidePolygon)
void setGradientType(GradientType gradientType)
void setValue(const QString &key, const QVariant &value)
void setOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
void setRotateMarker(bool rotate)
Shall the marker be rotated.
QgsSymbolV2::OutputUnit distanceUnit() const
Returns the unit for the maximum distance to shade inside of the shape from the polygon's boundary...
const QImage & svgAsImage(const QString &file, double size, const QColor &fill, const QColor &outline, double outlineWidth, double widthScaleFactor, double rasterScaleFactor, bool &fitsInCache)
Get SVG as QImage.
const char * name() const
QgsSymbolV2::OutputUnit offsetUnit() const
QgsSimpleLineSymbolLayerV2 * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
void setLineAngle(double a)
void setImageFilePath(const QString &imagePath)
Sets the path to the raster image used for the fill.
QgsExpressionContextScope * lastScope()
Returns the last scope added to the context.
The output shall be in millimeters.
double offsetAlongLine() const
Returns the offset along the line for the marker placement.
int count(const T &value) const
void setOutlineWidthUnit(QgsSymbolV2::OutputUnit u)
A class for filling symbols with a repeated raster image.
void setOffset(QPointF offset)
Sets the offset for the shapeburst fill.
Qt::PenStyle borderStyle() const
A dialog to enter a custom dash space pattern for lines.
void setOffset(double offset)
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.
bool appendSymbolLayer(QgsSymbolLayerV2 *layer)
Append symbol layer at the end of the list Ownership will be transferred.
void setMapUnitScale(const QgsMapUnitScale &scale) override
QVariant property(const char *name) const
bool drawInsidePolygon() const
void setWidth(const double width)
Sets the width for scaling the image used in the fill.
void fill(uint pixelValue)
const QgsMapUnitScale & offsetMapUnitScale() const
Returns the map unit scale for the fill's offset.
void setPenJoinStyle(Qt::PenJoinStyle style)
void setBrushStyle(Qt::BrushStyle style)
void setReferencePoint1IsCentroid(bool isCentroid)
Sets the starting point of the gradient to be the feature centroid.
void setFontFamily(const QString &family)
void setPath(const QString &path)
void setBlurRadius(int blurRadius)
Sets the blur radius, which controls the amount of blurring applied to the fill.
bool useWholeShape() const
Returns whether the shapeburst fill is set to cover the entire shape.
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
void appendRow(const QList< QStandardItem * > &items)
static QStringList listSvgFiles()
Return a list of all available svg files.
const QgsMapUnitScale & offsetMapUnitScale() const
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
virtual void setWidth(double width)
QString fontFamily() const
static QgsStyleV2 * defaultStyle()
return default application-wide style
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the image's width.
void setFillColor(const QColor &color) override
Set fill color.
virtual void select(const QModelIndex &index, QFlags< QItemSelectionModel::SelectionFlag > command)
QPointF offset() const
Returns the offset for the shapeburst fill.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
double outlineWidth() const
const QgsMapUnitScale & distanceXMapUnitScale() const
void setAngle(double angle)
The output shall be in map unitx.
QString imageFilePath() const
The path to the raster image used for the fill.
void setSizeUnit(QgsSymbolV2::OutputUnit unit)
bool rotateMarker() const
Shall the marker be rotated.
void setOverrideCursor(const QCursor &cursor)
void setDistanceYMapUnitScale(const QgsMapUnitScale &scale)
static const QString EXPR_SYMBOL_COLOR
Inbuilt variable name for symbol color variable.
void setGeometryExpression(const QString &exp)
Set the expression to generate this geometry.
QColor svgFillColor() const
const QgsMapUnitScale & sizeMapUnitScale() const
int symbolLayerCount()
Returns total number of symbol layers contained in the symbol.
void restoreOverrideCursor()
QgsSymbolV2::OutputUnit distanceUnit() const
ShapeburstColorType colorType() const
Returns the color mode used for the shapeburst fill.
double interval() const
The interval between individual markers.
double patternWidth() const
QgsSymbolV2::OutputUnit borderWidthUnit() const
QGis::GeometryType geometryType() const
Returns point, line or polygon.
virtual QColor color() const
The fill color.
virtual QVariant data(const QModelIndex &index, int role) const =0
void setOffsetAlongLineMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale used for calculating the offset in map units along line for markers...
GradientColorType gradientColorType() const
Gradient color mode, controls how gradient color stops are created.
void setDisplacementXUnit(QgsSymbolV2::OutputUnit unit)
void setCoordinateMode(const FillCoordinateMode mode)
Set the coordinate mode for fill.
QgsSvgMarkerSymbolLayerV2 * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
void setOffsetAlongLineUnit(QgsSymbolV2::OutputUnit unit)
Sets the unit used for calculating the offset along line for markers.
Single scope for storing variables and functions for use within a QgsExpressionContext.
void setBorderWidthUnit(QgsSymbolV2::OutputUnit unit)
void setOutlineWidthMapUnitScale(const QgsMapUnitScale &scale)
void setPenCapStyle(Qt::PenCapStyle style)
void setCustomDashVector(const QVector< qreal > &vector)
void setDisplacementXMapUnitScale(const QgsMapUnitScale &scale)
void setOffset(QPointF offset)
Sets the offset for the fill.
QgsSymbolV2::ScaleMethod scaleMethod() const
void setColor2(const QColor &color2)
Sets the color for the endpoint of the shapeburst fill.
QPointF referencePoint1() const
const QgsMapUnitScale & displacementYMapUnitScale() const
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
void setColorType(ShapeburstColorType colorType)
Sets the color mode to use for the shapeburst fill.
void setDistanceXUnit(QgsSymbolV2::OutputUnit unit)
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
QColor svgOutlineColor() const
bool blockSignals(bool block)
static QString pkgDataPath()
Returns the common root path of all application data directories.
bool contains(QChar ch, Qt::CaseSensitivity cs) const
GradientSpread gradientSpread() const
Gradient spread mode.
const QgsMapUnitScale & distanceMapUnitScale() const
QColor color2() const
Returns the color used for the endpoint of the shapeburst fill.
void setOffset(QPointF offset)
Offset for gradient fill.
virtual QString layerType() const =0
Returns a string that represents this layer type.
void setBorderColor(const QColor &borderColor)
void setDisplacementY(double d)
void setOutlineWidthMapUnitScale(const QgsMapUnitScale &scale)
const double DEFAULT_POINT_SIZE
Magic number that determines the default point size for point symbols.
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
Sets the units used for the offset for the shapeburst fill.
bool pointOnSurface() const
void setOffset(QPointF offset)
void setTexture(const QPixmap &pixmap)
const QgsMapUnitScale & offsetMapUnitScale() const
void setDataDefinedWidth(const QgsDataDefined &dd)
Set data defined width for whole symbol (including all symbol layers).
QgsSymbolV2::OutputUnit outlineWidthUnit() const
A class for svg fill patterns.
QgsSymbolV2::OutputUnit offsetUnit() const
Returns the units for the fill's offset.
void setMapUnitScale(const QgsMapUnitScale &scale) override
QVariant value(const QString &key, const QVariant &defaultValue) const
void setBorderColor(const QColor &color)
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the fill's offset.
const QgsMapUnitScale & distanceMapUnitScale() const
void setGradientColorType(GradientColorType gradientColorType)
const QgsMapUnitScale & offsetMapUnitScale() const
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object...
QColor color2() const
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
QgsExpressionContextScope & expressionContextScope()
Returns a reference to the expression context scope for the map canvas.
void setPenStyle(Qt::PenStyle style)
QPointF offset() const
Returns the offset for the fill.
QgsSymbolV2::OutputUnit offsetUnit() const
QVariant data(int role) const
void setPlacement(Placement p)
The placement of the markers.
const QgsMapUnitScale & outlineWidthMapUnitScale() const
const QgsMapUnitScale & offsetMapUnitScale() const
Qt::PenStyle outlineStyle() const
const QgsMapUnitScale & widthMapUnitScale() const
FillCoordinateMode coordinateMode() const
Coordinate mode for fill.
void setDisplacementYUnit(QgsSymbolV2::OutputUnit unit)
const QgsMapUnitScale & distanceYMapUnitScale() const
QgsSymbolV2::OutputUnit displacementYUnit() const
bool referencePoint1IsCentroid() const
void setCustomDashPatternMapUnitScale(const QgsMapUnitScale &scale)
void setSvgFilePath(const QString &svgPath)
void setUseWholeShape(bool useWholeShape)
Sets whether the shapeburst fill should be drawn using the entire shape.
virtual QgsDataDefined * getDataDefinedProperty(const QString &property) const
Returns the data defined property corresponding to the specified property key.
const QChar at(int position) const
Qt::PenJoinStyle penJoinStyle() const
QPixmap * find(const QString &key)
void setColorRamp(QgsVectorColorRampV2 *ramp)
Sets the color ramp used to draw the shapeburst fill.
const QgsMapUnitScale & offsetMapUnitScale() const
StandardButton critical(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
void setDistanceY(double d)
void setDisplacementYMapUnitScale(const QgsMapUnitScale &scale)
void setAlpha(const double alpha)
Sets the opacity for the raster image used in the fill.
static QStringList svgPaths()
Returns the pathes to svg directories.
void setAlphaF(qreal alpha)
virtual void setColor(const QColor &color)
The fill color.
Placement placement() const
The placement of the markers.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user...
GradientType gradientType() const
Type of gradient, eg linear or radial.
QColor borderColor() const
void setCurrentIndex(const QModelIndex &index, QFlags< QItemSelectionModel::SelectionFlag > command)
void setDistanceX(double d)
bool setProperty(const char *name, const QVariant &value)
void setMapUnitScale(const QgsMapUnitScale &scale) override
Calculate scale by the area.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setColor2(const QColor &color2)
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFlags< QFileDialog::Option > options)
static QgsExpressionContextScope * projectScope()
Creates a new scope which contains variables and functions relating to the current QGIS project...
QgsSymbolV2::OutputUnit widthUnit() const
Returns the units for the image's width.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
void setOffset(double offset)
void setWidthUnit(const QgsSymbolV2::OutputUnit unit)
Sets the units for the image's width.
void setPatternWidthUnit(QgsSymbolV2::OutputUnit unit)
QgsSymbolV2::OutputUnit displacementXUnit() const
void setGradientSpread(GradientSpread gradientSpread)
double width() const
Returns the width used for scaling the image used in the fill.
bool insert(const QString &key, const QPixmap &pixmap)
QString absolutePath() const
QgsSymbolV2::OutputUnit offsetUnit() const
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
static const QString EXPR_GEOMETRY_PART_NUM
Inbuilt variable name for geometry part number variable.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setSize(double size)
void setAngle(double angle)
Represents a vector layer which manages a vector based data sets.
bool begin(QPaintDevice *device)
void setReferencePoint2(QPointF referencePoint)
End point of gradient fill, in the range [0,0] - [1,1].
static const QString EXPR_GEOMETRY_PART_COUNT
Inbuilt variable name for geometry part count variable.
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
const QgsMapUnitScale & offsetMapUnitScale() const
void setBorderWidth(double borderWidth)
const QgsMapUnitScale & offsetAlongLineMapUnitScale() const
Returns the map unit scale used for calculating the offset in map units along line for markers...
QgsFontMarkerSymbolLayerV2 * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
const QgsMapUnitScale & svgOutlineWidthMapUnitScale() const
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbolV2 *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbolV2 to an expression context.
void setDisplacementX(double d)
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
QColor outlineColor() const override
Get outline color.
void setCheckable(bool checkable)
QgsSimpleMarkerSymbolLayerV2 * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
const QgsMapUnitScale & outlineWidthMapUnitScale() const
double displacementY() const
virtual QVariant data(int role) const
Qt::BrushStyle brushStyle() const
void setEditable(bool editable)
QgsSymbolV2::OutputUnit widthUnit() const
void setOffsetUnit(const QgsSymbolV2::OutputUnit unit)
Sets the units for the fill's offset.
void setCharacter(QChar ch)
QImage scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
void setDistanceMapUnitScale(const QgsMapUnitScale &scale)
Qt::PenJoinStyle penJoinStyle() const
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
Units for gradient fill offset.
QgsSymbolV2::OutputUnit offsetUnit() const
Qt::PenCapStyle penCapStyle() const
double maxDistance() const
Returns the maximum distance from the shape's boundary which is shaded.
void setSvgOutlineWidthMapUnitScale(const QgsMapUnitScale &scale)
void setName(const QString &name)
double alpha() const
The opacity for the raster image used in the fill.
virtual Q_DECL_DEPRECATED void setDataDefinedProperty(const QString &property, const QString &expressionString)
Sets a data defined expression for a property.
void setBorderStyle(Qt::PenStyle borderStyle)