38 #include <QAbstractButton> 39 #include <QColorDialog> 42 #include <QFileDialog> 45 #include <QStandardItemModel> 46 #include <QSvgRenderer> 47 #include <QMessageBox> 53 button->setProperty(
"propertyName", propertyName );
61 const QString propertyName( button->property(
"propertyName" ).toString() );
71 QString label = entryName;
72 if ( entryName ==
"size" )
81 label +=
" (" +
tr(
"area" ) +
")";
84 label +=
" (" +
tr(
"diameter" ) +
")";
98 mPenWidthUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
99 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
100 mDashPatternUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
102 btnChangeColor->setAllowAlpha(
true );
103 btnChangeColor->setColorDialogTitle(
tr(
"Select line color" ) );
104 btnChangeColor->setContext(
"symbology" );
106 spinOffset->setClearValue( 0.0 );
111 mDrawInsideCheckBox->hide();
114 connect( spinWidth, SIGNAL( valueChanged(
double ) ),
this, SLOT(
penWidthChanged() ) );
116 connect( cboPenStyle, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
penStyleChanged() ) );
117 connect( spinOffset, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
118 connect( cboCapStyle, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
penStyleChanged() ) );
119 connect( cboJoinStyle, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
penStyleChanged() ) );
126 if ( !layer || layer->
layerType() !=
"SimpleLine" )
133 mPenWidthUnitWidget->blockSignals(
true );
136 mPenWidthUnitWidget->blockSignals(
false );
137 mOffsetUnitWidget->blockSignals(
true );
140 mOffsetUnitWidget->blockSignals(
false );
141 mDashPatternUnitWidget->blockSignals(
true );
145 mDashPatternUnitWidget->blockSignals(
false );
148 spinWidth->blockSignals(
true );
150 spinWidth->blockSignals(
false );
151 btnChangeColor->blockSignals(
true );
153 btnChangeColor->blockSignals(
false );
154 spinOffset->blockSignals(
true );
156 spinOffset->blockSignals(
false );
157 cboPenStyle->blockSignals(
true );
158 cboJoinStyle->blockSignals(
true );
159 cboCapStyle->blockSignals(
true );
163 cboPenStyle->blockSignals(
false );
164 cboJoinStyle->blockSignals(
false );
165 cboCapStyle->blockSignals(
false );
169 mChangePatternButton->setEnabled( useCustomDashPattern );
170 label_3->setEnabled( !useCustomDashPattern );
171 cboPenStyle->setEnabled( !useCustomDashPattern );
172 mCustomCheckBox->blockSignals(
true );
173 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
174 mCustomCheckBox->blockSignals(
false );
178 mDrawInsideCheckBox->blockSignals(
true );
179 mDrawInsideCheckBox->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
180 mDrawInsideCheckBox->blockSignals(
false );
229 bool checked = ( state == Qt::Checked );
230 mChangePatternButton->setEnabled( checked );
231 label_3->setEnabled( !checked );
232 cboPenStyle->setEnabled( !checked );
241 if ( d.exec() == QDialog::Accepted )
284 bool checked = ( state == Qt::Checked );
303 mChangePatternButton->setIcon( buttonIcon );
317 mSizeUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
318 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
319 mOutlineWidthUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
321 btnChangeColorFill->setAllowAlpha(
true );
322 btnChangeColorFill->setColorDialogTitle(
tr(
"Select fill color" ) );
323 btnChangeColorFill->setContext(
"symbology" );
324 btnChangeColorFill->setShowNoColor(
true );
325 btnChangeColorFill->setNoColorString(
tr(
"Transparent fill" ) );
326 btnChangeColorBorder->setAllowAlpha(
true );
327 btnChangeColorBorder->setColorDialogTitle(
tr(
"Select border color" ) );
328 btnChangeColorBorder->setContext(
"symbology" );
329 btnChangeColorBorder->setShowNoColor(
true );
330 btnChangeColorBorder->setNoColorString(
tr(
"Transparent border" ) );
332 spinOffsetX->setClearValue( 0.0 );
333 spinOffsetY->setClearValue( 0.0 );
335 QSize size = lstNames->iconSize();
337 names <<
"circle" <<
"rectangle" <<
"diamond" <<
"pentagon" <<
"cross" <<
"cross2" <<
"triangle" 338 <<
"equilateral_triangle" <<
"star" <<
"regular_star" <<
"arrow" <<
"line" <<
"arrowhead" <<
"filled_arrowhead";
340 for (
int i = 0; i < names.count(); ++i )
344 QListWidgetItem* item =
new QListWidgetItem( icon, QString(), lstNames );
345 item->setData( Qt::UserRole, names[i] );
349 connect( lstNames, SIGNAL( currentRowChanged(
int ) ),
this, SLOT(
setName() ) );
350 connect( btnChangeColorBorder, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColorBorder(
const QColor& ) ) );
351 connect( btnChangeColorFill, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColorFill(
const QColor& ) ) );
352 connect( spinSize, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setSize() ) );
353 connect( spinAngle, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setAngle() ) );
354 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
355 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
360 if ( layer->
layerType() !=
"SimpleMarker" )
368 for (
int i = 0; i < lstNames->count(); ++i )
370 if ( lstNames->item( i )->data( Qt::UserRole ).toString() == name )
372 lstNames->setCurrentRow( i );
376 btnChangeColorBorder->blockSignals(
true );
378 btnChangeColorBorder->blockSignals(
false );
379 btnChangeColorFill->blockSignals(
true );
381 btnChangeColorFill->blockSignals(
false );
382 spinSize->blockSignals(
true );
384 spinSize->blockSignals(
false );
385 spinAngle->blockSignals(
true );
387 spinAngle->blockSignals(
false );
388 mOutlineStyleComboBox->blockSignals(
true );
390 mOutlineStyleComboBox->blockSignals(
false );
391 mOutlineWidthSpinBox->blockSignals(
true );
393 mOutlineWidthSpinBox->blockSignals(
false );
396 spinOffsetX->blockSignals(
true );
398 spinOffsetX->blockSignals(
false );
399 spinOffsetY->blockSignals(
true );
401 spinOffsetY->blockSignals(
false );
403 mSizeUnitWidget->blockSignals(
true );
406 mSizeUnitWidget->blockSignals(
false );
407 mOffsetUnitWidget->blockSignals(
true );
410 mOffsetUnitWidget->blockSignals(
false );
411 mOutlineWidthUnitWidget->blockSignals(
true );
414 mOutlineWidthUnitWidget->blockSignals(
false );
417 mHorizontalAnchorComboBox->blockSignals(
true );
418 mVerticalAnchorComboBox->blockSignals(
true );
421 mHorizontalAnchorComboBox->blockSignals(
false );
422 mVerticalAnchorComboBox->blockSignals(
false );
425 "<b>pentagon</b>|<b>triangle</b>|<b>equilateral_triangle</b>|" 426 "<b>star</b>|<b>regular_star</b>|<b>arrow</b>|<b>filled_arrowhead</b>|" 427 "<b>circle</b>|<b>cross</b>|<b>x</b>|" 428 "<b>cross2</b>|<b>line</b>|<b>arrowhead</b>]" ) );
447 mLayer->
setName( lstNames->currentItem()->data( Qt::UserRole ).toString() );
477 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
561 mBorderWidthUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
562 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
564 btnChangeColor->setAllowAlpha(
true );
565 btnChangeColor->setColorDialogTitle(
tr(
"Select fill color" ) );
566 btnChangeColor->setContext(
"symbology" );
567 btnChangeColor->setShowNoColor(
true );
568 btnChangeColor->setNoColorString(
tr(
"Transparent fill" ) );
569 btnChangeBorderColor->setAllowAlpha(
true );
570 btnChangeBorderColor->setColorDialogTitle(
tr(
"Select border color" ) );
571 btnChangeBorderColor->setContext(
"symbology" );
572 btnChangeBorderColor->setShowNoColor(
true );
573 btnChangeBorderColor->setNoColorString(
tr(
"Transparent border" ) );
575 spinOffsetX->setClearValue( 0.0 );
576 spinOffsetY->setClearValue( 0.0 );
578 connect( btnChangeColor, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColor(
const QColor& ) ) );
579 connect( cboFillStyle, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
setBrushStyle() ) );
580 connect( btnChangeBorderColor, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setBorderColor(
const QColor& ) ) );
581 connect( spinBorderWidth, SIGNAL( valueChanged(
double ) ),
this, SLOT(
borderWidthChanged() ) );
582 connect( cboBorderStyle, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
borderStyleChanged() ) );
583 connect( cboJoinStyle, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
borderStyleChanged() ) );
584 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
585 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
590 if ( layer->
layerType() !=
"SimpleFill" )
597 btnChangeColor->blockSignals(
true );
599 btnChangeColor->blockSignals(
false );
600 cboFillStyle->blockSignals(
true );
602 cboFillStyle->blockSignals(
false );
603 btnChangeBorderColor->blockSignals(
true );
605 btnChangeBorderColor->blockSignals(
false );
606 cboBorderStyle->blockSignals(
true );
608 cboBorderStyle->blockSignals(
false );
609 spinBorderWidth->blockSignals(
true );
611 spinBorderWidth->blockSignals(
false );
612 cboJoinStyle->blockSignals(
true );
614 cboJoinStyle->blockSignals(
false );
615 spinOffsetX->blockSignals(
true );
617 spinOffsetX->blockSignals(
false );
618 spinOffsetY->blockSignals(
true );
620 spinOffsetY->blockSignals(
false );
622 mBorderWidthUnitWidget->blockSignals(
true );
625 mBorderWidthUnitWidget->blockSignals(
false );
626 mOffsetUnitWidget->blockSignals(
true );
629 mOffsetUnitWidget->blockSignals(
false );
678 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
712 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
714 cboGradientColorRamp->setShowGradientOnly(
true );
717 btnChangeColor->setAllowAlpha(
true );
718 btnChangeColor->setColorDialogTitle(
tr(
"Select gradient color" ) );
719 btnChangeColor->setContext(
"symbology" );
720 btnChangeColor->setShowNoColor(
true );
721 btnChangeColor->setNoColorString(
tr(
"Transparent" ) );
722 btnChangeColor2->setAllowAlpha(
true );
723 btnChangeColor2->setColorDialogTitle(
tr(
"Select gradient color" ) );
724 btnChangeColor2->setContext(
"symbology" );
725 btnChangeColor2->setShowNoColor(
true );
726 btnChangeColor2->setNoColorString(
tr(
"Transparent" ) );
728 spinOffsetX->setClearValue( 0.0 );
729 spinOffsetY->setClearValue( 0.0 );
731 connect( btnChangeColor, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColor(
const QColor& ) ) );
732 connect( btnChangeColor2, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColor2(
const QColor& ) ) );
733 connect( cboGradientColorRamp, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
applyColorRamp() ) );
734 connect( cboGradientType, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
setGradientType(
int ) ) );
735 connect( cboCoordinateMode, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
setCoordinateMode(
int ) ) );
736 connect( cboGradientSpread, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
setGradientSpread(
int ) ) );
737 connect( radioTwoColor, SIGNAL( toggled(
bool ) ),
this, SLOT(
colorModeChanged() ) );
738 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
739 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
750 if ( layer->
layerType() !=
"GradientFill" )
757 btnChangeColor->blockSignals(
true );
759 btnChangeColor->blockSignals(
false );
760 btnChangeColor2->blockSignals(
true );
762 btnChangeColor2->blockSignals(
false );
766 radioTwoColor->setChecked(
true );
767 cboGradientColorRamp->setEnabled(
false );
771 radioColorRamp->setChecked(
true );
772 btnChangeColor->setEnabled(
false );
773 btnChangeColor2->setEnabled(
false );
779 cboGradientColorRamp->blockSignals(
true );
781 cboGradientColorRamp->blockSignals(
false );
784 cboGradientType->blockSignals(
true );
788 cboGradientType->setCurrentIndex( 0 );
791 cboGradientType->setCurrentIndex( 1 );
794 cboGradientType->setCurrentIndex( 2 );
797 cboGradientType->blockSignals(
false );
799 cboCoordinateMode->blockSignals(
true );
803 cboCoordinateMode->setCurrentIndex( 1 );
804 checkRefPoint1Centroid->setEnabled(
false );
805 checkRefPoint2Centroid->setEnabled(
false );
809 cboCoordinateMode->setCurrentIndex( 0 );
812 cboCoordinateMode->blockSignals(
false );
814 cboGradientSpread->blockSignals(
true );
818 cboGradientSpread->setCurrentIndex( 0 );
821 cboGradientSpread->setCurrentIndex( 1 );
824 cboGradientSpread->setCurrentIndex( 2 );
827 cboGradientSpread->blockSignals(
false );
829 spinRefPoint1X->blockSignals(
true );
831 spinRefPoint1X->blockSignals(
false );
832 spinRefPoint1Y->blockSignals(
true );
834 spinRefPoint1Y->blockSignals(
false );
835 checkRefPoint1Centroid->blockSignals(
true );
839 spinRefPoint1X->setEnabled(
false );
840 spinRefPoint1Y->setEnabled(
false );
842 checkRefPoint1Centroid->blockSignals(
false );
843 spinRefPoint2X->blockSignals(
true );
845 spinRefPoint2X->blockSignals(
false );
846 spinRefPoint2Y->blockSignals(
true );
848 spinRefPoint2Y->blockSignals(
false );
849 checkRefPoint2Centroid->blockSignals(
true );
853 spinRefPoint2X->setEnabled(
false );
854 spinRefPoint2Y->setEnabled(
false );
856 checkRefPoint2Centroid->blockSignals(
false );
858 spinOffsetX->blockSignals(
true );
860 spinOffsetX->blockSignals(
false );
861 spinOffsetY->blockSignals(
true );
863 spinOffsetY->blockSignals(
false );
864 mSpinAngle->blockSignals(
true );
866 mSpinAngle->blockSignals(
false );
868 mOffsetUnitWidget->blockSignals(
true );
871 mOffsetUnitWidget->blockSignals(
false );
906 if ( radioTwoColor->isChecked() )
935 if ( dlg.exec() && gradRamp )
938 cboGradientColorRamp->blockSignals(
true );
940 cboGradientColorRamp->blockSignals(
false );
957 spinRefPoint1X->setValue( 0.5 );
958 spinRefPoint1Y->setValue( 0 );
959 spinRefPoint2X->setValue( 0.5 );
960 spinRefPoint2Y->setValue( 1 );
965 spinRefPoint1X->setValue( 0 );
966 spinRefPoint1Y->setValue( 0 );
967 spinRefPoint2X->setValue( 1 );
968 spinRefPoint2Y->setValue( 1 );
972 spinRefPoint1X->setValue( 0.5 );
973 spinRefPoint1Y->setValue( 0.5 );
974 spinRefPoint2X->setValue( 1 );
975 spinRefPoint2Y->setValue( 1 );
990 checkRefPoint1Centroid->setEnabled(
true );
991 checkRefPoint2Centroid->setEnabled(
true );
997 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
998 checkRefPoint1Centroid->setEnabled(
false );
999 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1000 checkRefPoint2Centroid->setEnabled(
false );
1027 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1065 mDistanceUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1066 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1068 btnChangeColor->setAllowAlpha(
true );
1069 btnChangeColor->setColorDialogTitle(
tr(
"Select gradient color" ) );
1070 btnChangeColor->setContext(
"symbology" );
1071 btnChangeColor->setShowNoColor(
true );
1072 btnChangeColor->setNoColorString(
tr(
"Transparent" ) );
1073 btnChangeColor2->setAllowAlpha(
true );
1074 btnChangeColor2->setColorDialogTitle(
tr(
"Select gradient color" ) );
1075 btnChangeColor2->setContext(
"symbology" );
1076 btnChangeColor2->setShowNoColor(
true );
1077 btnChangeColor2->setNoColorString(
tr(
"Transparent" ) );
1079 spinOffsetX->setClearValue( 0.0 );
1080 spinOffsetY->setClearValue( 0.0 );
1082 cboGradientColorRamp->setShowGradientOnly(
true );
1085 connect( cboGradientColorRamp, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
applyColorRamp() ) );
1086 connect( btnChangeColor, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColor(
const QColor& ) ) );
1087 connect( btnChangeColor2, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColor2(
const QColor& ) ) );
1088 connect( radioTwoColor, SIGNAL( toggled(
bool ) ),
this, SLOT(
colorModeChanged() ) );
1089 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
1090 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
1092 connect( mBlurSlider, SIGNAL( valueChanged(
int ) ), mSpinBlurRadius, SLOT( setValue(
int ) ) );
1093 connect( mSpinBlurRadius, SIGNAL( valueChanged(
int ) ), mBlurSlider, SLOT( setValue(
int ) ) );
1098 if ( layer->
layerType() !=
"ShapeburstFill" )
1105 btnChangeColor->blockSignals(
true );
1107 btnChangeColor->blockSignals(
false );
1108 btnChangeColor2->blockSignals(
true );
1110 btnChangeColor2->blockSignals(
false );
1114 radioTwoColor->setChecked(
true );
1115 cboGradientColorRamp->setEnabled(
false );
1119 radioColorRamp->setChecked(
true );
1120 btnChangeColor->setEnabled(
false );
1121 btnChangeColor2->setEnabled(
false );
1124 mSpinBlurRadius->blockSignals(
true );
1125 mBlurSlider->blockSignals(
true );
1128 mSpinBlurRadius->blockSignals(
false );
1129 mBlurSlider->blockSignals(
false );
1131 mSpinMaxDistance->blockSignals(
true );
1133 mSpinMaxDistance->blockSignals(
false );
1135 mRadioUseWholeShape->blockSignals(
true );
1136 mRadioUseMaxDistance->blockSignals(
true );
1139 mRadioUseWholeShape->setChecked(
true );
1140 mSpinMaxDistance->setEnabled(
false );
1141 mDistanceUnitWidget->setEnabled(
false );
1145 mRadioUseMaxDistance->setChecked(
true );
1146 mSpinMaxDistance->setEnabled(
true );
1147 mDistanceUnitWidget->setEnabled(
true );
1149 mRadioUseWholeShape->blockSignals(
false );
1150 mRadioUseMaxDistance->blockSignals(
false );
1152 mDistanceUnitWidget->blockSignals(
true );
1155 mDistanceUnitWidget->blockSignals(
false );
1157 mIgnoreRingsCheckBox->blockSignals(
true );
1158 mIgnoreRingsCheckBox->setCheckState(
mLayer->
ignoreRings() ? Qt::Checked : Qt::Unchecked );
1159 mIgnoreRingsCheckBox->blockSignals(
false );
1164 cboGradientColorRamp->blockSignals(
true );
1166 cboGradientColorRamp->blockSignals(
false );
1169 spinOffsetX->blockSignals(
true );
1171 spinOffsetX->blockSignals(
false );
1172 spinOffsetY->blockSignals(
true );
1174 spinOffsetY->blockSignals(
false );
1175 mOffsetUnitWidget->blockSignals(
true );
1178 mOffsetUnitWidget->blockSignals(
false );
1218 if ( radioTwoColor->isChecked() )
1263 mDistanceUnitWidget->setEnabled( !value );
1286 if ( dlg.exec() && gradRamp )
1289 cboGradientColorRamp->blockSignals(
true );
1291 cboGradientColorRamp->blockSignals(
false );
1305 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1324 bool checked = ( state == Qt::Checked );
1337 mIntervalUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1338 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1339 mOffsetAlongLineUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1341 spinOffset->setClearValue( 0.0 );
1343 connect( spinInterval, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setInterval(
double ) ) );
1344 connect( mSpinOffsetAlongLine, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffsetAlongLine(
double ) ) );
1345 connect( chkRotateMarker, SIGNAL( clicked() ),
this, SLOT(
setRotate() ) );
1346 connect( spinOffset, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
1347 connect( radInterval, SIGNAL( clicked() ),
this, SLOT(
setPlacement() ) );
1348 connect( radVertex, SIGNAL( clicked() ),
this, SLOT(
setPlacement() ) );
1349 connect( radVertexLast, SIGNAL( clicked() ),
this, SLOT(
setPlacement() ) );
1350 connect( radVertexFirst, SIGNAL( clicked() ),
this, SLOT(
setPlacement() ) );
1351 connect( radCentralPoint, SIGNAL( clicked() ),
this, SLOT(
setPlacement() ) );
1356 if ( layer->
layerType() !=
"MarkerLine" )
1363 spinInterval->blockSignals(
true );
1365 spinInterval->blockSignals(
false );
1366 mSpinOffsetAlongLine->blockSignals(
true );
1368 mSpinOffsetAlongLine->blockSignals(
false );
1369 chkRotateMarker->blockSignals(
true );
1371 chkRotateMarker->blockSignals(
false );
1372 spinOffset->blockSignals(
true );
1374 spinOffset->blockSignals(
false );
1376 radInterval->setChecked(
true );
1378 radVertex->setChecked(
true );
1380 radVertexLast->setChecked(
true );
1382 radCentralPoint->setChecked(
true );
1384 radVertexFirst->setChecked(
true );
1387 mIntervalUnitWidget->blockSignals(
true );
1390 mIntervalUnitWidget->blockSignals(
false );
1391 mOffsetUnitWidget->blockSignals(
true );
1394 mOffsetUnitWidget->blockSignals(
false );
1395 mOffsetAlongLineUnitWidget->blockSignals(
true );
1398 mOffsetAlongLineUnitWidget->blockSignals(
false );
1439 bool interval = radInterval->isChecked();
1440 spinInterval->setEnabled( interval );
1441 mSpinOffsetAlongLine->setEnabled( radInterval->isChecked() || radVertexLast->isChecked() || radVertexFirst->isChecked() );
1443 if ( radInterval->isChecked() )
1445 else if ( radVertex->isChecked() )
1447 else if ( radVertexLast->isChecked() )
1449 else if ( radVertexFirst->isChecked() )
1499 mSizeUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1500 mBorderWidthUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1501 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1502 viewGroups->setHeaderHidden(
true );
1504 mChangeColorButton->setColorDialogTitle(
tr(
"Select fill color" ) );
1505 mChangeColorButton->setContext(
"symbology" );
1506 mChangeBorderColorButton->setColorDialogTitle(
tr(
"Select border color" ) );
1507 mChangeColorButton->setContext(
"symbology" );
1509 spinOffsetX->setClearValue( 0.0 );
1510 spinOffsetY->setClearValue( 0.0 );
1514 connect( viewImages->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
this, SLOT(
setName(
const QModelIndex& ) ) );
1515 connect( viewGroups->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
this, SLOT(
populateIcons(
const QModelIndex& ) ) );
1516 connect( spinSize, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setSize() ) );
1517 connect( spinAngle, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setAngle() ) );
1518 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
1519 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
1523 #include <QAbstractListModel> 1524 #include <QPixmapCache> 1541 int rowCount(
const QModelIndex & parent = QModelIndex() )
const override 1544 return mSvgFiles.count();
1547 QVariant
data(
const QModelIndex &
index,
int role = Qt::DisplayRole )
const override 1549 QString entry = mSvgFiles.at( index.row() );
1551 if ( role == Qt::DecorationRole )
1554 if ( !QPixmapCache::find( entry, pixmap ) )
1557 QColor fill, outline;
1558 double outlineWidth;
1559 bool fillParam, outlineParam, outlineWidthParam;
1564 pixmap = QPixmap::fromImage( img );
1565 QPixmapCache::insert( entry, pixmap );
1570 else if ( role == Qt::UserRole || role == Qt::ToolTipRole )
1588 QStandardItem *parentItem = invisibleRootItem();
1590 for (
int i = 0; i < svgPaths.size(); i++ )
1592 QDir dir( svgPaths[i] );
1593 QStandardItem *baseGroup;
1597 baseGroup =
new QStandardItem( QString(
"App Symbols" ) );
1601 baseGroup =
new QStandardItem( QString(
"User Symbols" ) );
1605 baseGroup =
new QStandardItem( dir.dirName() );
1607 baseGroup->setData( QVariant( svgPaths[i] ) );
1608 baseGroup->setEditable(
false );
1609 baseGroup->setCheckable(
false );
1610 baseGroup->setIcon( QgsApplication::style()->standardIcon( QStyle::SP_DirIcon ) );
1611 baseGroup->setToolTip( dir.path() );
1612 parentItem->appendRow( baseGroup );
1613 createTree( baseGroup );
1614 QgsDebugMsg( QString(
"SVG base path %1: %2" ).arg( i ).arg( baseGroup->data().toString() ) );
1618 void createTree( QStandardItem* &parentGroup )
1620 QDir parentDir( parentGroup->data().toString() );
1621 foreach ( QString item, parentDir.entryList( QDir::Dirs | QDir::NoDotAndDotDot ) )
1623 QStandardItem* group =
new QStandardItem( item );
1624 group->setData( QVariant( parentDir.path() +
"/" + item ) );
1625 group->setEditable(
false );
1626 group->setCheckable(
false );
1627 group->setToolTip( parentDir.path() +
"/" + item );
1628 group->setIcon( QgsApplication::style()->standardIcon( QStyle::SP_DirIcon ) );
1629 parentGroup->appendRow( group );
1630 createTree( group );
1638 viewGroups->setModel( g );
1640 int rows = g->rowCount( g->indexFromItem( g->invisibleRootItem() ) );
1641 for (
int i = 0; i < rows; i++ )
1643 viewGroups->setExpanded( g->indexFromItem( g->item( i ) ),
true );
1648 viewImages->setModel( m );
1653 QString path = idx.data( Qt::UserRole + 1 ).toString();
1656 viewImages->setModel( m );
1658 connect( viewImages->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
this, SLOT(
setName(
const QModelIndex& ) ) );
1670 bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
1671 QColor defaultFill, defaultOutline;
1672 double defaultOutlineWidth;
1674 mChangeColorButton->setEnabled( hasFillParam );
1675 mChangeBorderColorButton->setEnabled( hasOutlineParam );
1676 mBorderWidthSpinBox->setEnabled( hasOutlineWidthParam );
1682 mChangeColorButton->setColor( layer->
fillColor() );
1686 mChangeColorButton->setColor( defaultFill );
1689 if ( hasOutlineParam )
1693 mChangeBorderColorButton->setColor( layer->
outlineColor() );
1697 mChangeBorderColorButton->setColor( defaultOutline );
1701 mFileLineEdit->blockSignals(
true );
1702 mFileLineEdit->setText( layer->
path() );
1703 mFileLineEdit->blockSignals(
false );
1705 mBorderWidthSpinBox->blockSignals(
true );
1706 mBorderWidthSpinBox->setValue( layer->
outlineWidth() );
1707 mBorderWidthSpinBox->blockSignals(
false );
1718 if ( layer->
layerType() !=
"SvgMarker" )
1726 QAbstractItemModel* m = viewImages->model();
1727 QItemSelectionModel* selModel = viewImages->selectionModel();
1728 for (
int i = 0; i < m->rowCount(); i++ )
1730 QModelIndex idx( m->index( i, 0 ) );
1731 if ( m->data( idx ).toString() ==
mLayer->
path() )
1733 selModel->select( idx, QItemSelectionModel::SelectCurrent );
1734 selModel->setCurrentIndex( idx, QItemSelectionModel::SelectCurrent );
1740 spinSize->blockSignals(
true );
1742 spinSize->blockSignals(
false );
1743 spinAngle->blockSignals(
true );
1745 spinAngle->blockSignals(
false );
1748 spinOffsetX->blockSignals(
true );
1750 spinOffsetX->blockSignals(
false );
1751 spinOffsetY->blockSignals(
true );
1753 spinOffsetY->blockSignals(
false );
1755 mSizeUnitWidget->blockSignals(
true );
1758 mSizeUnitWidget->blockSignals(
false );
1759 mBorderWidthUnitWidget->blockSignals(
true );
1762 mBorderWidthUnitWidget->blockSignals(
false );
1763 mOffsetUnitWidget->blockSignals(
true );
1766 mOffsetUnitWidget->blockSignals(
false );
1769 mHorizontalAnchorComboBox->blockSignals(
true );
1770 mVerticalAnchorComboBox->blockSignals(
true );
1773 mHorizontalAnchorComboBox->blockSignals(
false );
1774 mVerticalAnchorComboBox->blockSignals(
false );
1796 QString name = idx.data( Qt::UserRole ).toString();
1798 mFileLineEdit->setText( name );
1818 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1825 QString file = QFileDialog::getOpenFileName( 0,
1826 tr(
"Select SVG file" ),
1827 s.value(
"/UI/lastSVGMarkerDir" ).toString(),
1828 tr(
"SVG files" ) +
" (*.svg)" );
1829 QFileInfo fi( file );
1830 if ( file.isEmpty() || !fi.exists() )
1834 mFileLineEdit->setText( file );
1836 s.setValue(
"/UI/lastSVGMarkerDir", fi.absolutePath() );
1842 if ( !QFileInfo( text ).exists() )
1853 if ( !QFileInfo( mFileLineEdit->text() ).exists() )
1855 QUrl url( mFileLineEdit->text() );
1856 if ( !url.isValid() )
1862 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
1864 QApplication::restoreOverrideCursor();
1954 #include <QFileDialog> 1960 mTextureWidthUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1961 mSvgOutlineWidthUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
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" );
1970 connect( mSvgListView->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
this, SLOT( setFile(
const QModelIndex& ) ) );
1971 connect( mSvgTreeView->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
this, SLOT( populateIcons(
const QModelIndex& ) ) );
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()
2032 QString filePath = QFileDialog::getOpenFileName( 0,
tr(
"Select SVG texture file" ), QString(),
tr(
"SVG file" ) +
" (*.svg);;" +
tr(
"All files" ) +
" (*.*)" );
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 )
2056 QFileInfo fi( text );
2066 void QgsSVGFillSymbolLayerWidget::on_mSVGLineEdit_editingFinished()
2073 QFileInfo fi( mSVGLineEdit->text() );
2076 QUrl url( mSVGLineEdit->text() );
2077 if ( !url.isValid() )
2083 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
2085 QApplication::restoreOverrideCursor();
2091 void QgsSVGFillSymbolLayerWidget::setFile(
const QModelIndex& item )
2093 QString file = item.data( Qt::UserRole ).toString();
2095 mSVGLineEdit->setText( file );
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 );
2113 mSvgListView->setModel( m );
2116 void QgsSVGFillSymbolLayerWidget::populateIcons(
const QModelIndex& idx )
2118 QString path = idx.data( Qt::UserRole + 1 ).toString();
2121 mSvgListView->setModel( m );
2123 connect( mSvgListView->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
this, SLOT( setFile(
const QModelIndex& ) ) );
2128 void QgsSVGFillSymbolLayerWidget::on_mRotationSpinBox_valueChanged(
double d )
2140 bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
2141 QColor defaultFill, defaultOutline;
2142 double defaultOutlineWidth;
2144 if ( hasFillParam && resetValues )
2146 mChangeColorButton->setColor( defaultFill );
2148 mChangeColorButton->setEnabled( hasFillParam );
2149 if ( hasOutlineParam && resetValues )
2151 mChangeBorderColorButton->setColor( defaultOutline );
2153 mChangeBorderColorButton->setEnabled( hasOutlineParam );
2154 if ( hasOutlineWidthParam && resetValues )
2156 mBorderWidthSpinBox->setValue( defaultOutlineWidth );
2158 mBorderWidthSpinBox->setEnabled( hasOutlineWidthParam );
2161 void QgsSVGFillSymbolLayerWidget::on_mChangeColorButton_colorChanged(
const QColor& color )
2172 void QgsSVGFillSymbolLayerWidget::on_mChangeBorderColorButton_colorChanged(
const QColor& color )
2183 void QgsSVGFillSymbolLayerWidget::on_mBorderWidthSpinBox_valueChanged(
double d )
2192 void QgsSVGFillSymbolLayerWidget::on_mTextureWidthUnitWidget_changed()
2203 void QgsSVGFillSymbolLayerWidget::on_mSvgOutlineWidthUnitWidget_changed()
2220 mDistanceUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2221 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2226 if ( layer->
layerType() !=
"LinePatternFill" )
2235 mAngleSpinBox->blockSignals(
true );
2237 mAngleSpinBox->blockSignals(
false );
2238 mDistanceSpinBox->blockSignals(
true );
2240 mDistanceSpinBox->blockSignals(
false );
2241 mOffsetSpinBox->blockSignals(
true );
2243 mOffsetSpinBox->blockSignals(
false );
2246 mDistanceUnitWidget->blockSignals(
true );
2249 mDistanceUnitWidget->blockSignals(
false );
2250 mOffsetUnitWidget->blockSignals(
true );
2253 mOffsetUnitWidget->blockSignals(
false );
2265 void QgsLinePatternFillSymbolLayerWidget::on_mAngleSpinBox_valueChanged(
double d )
2274 void QgsLinePatternFillSymbolLayerWidget::on_mDistanceSpinBox_valueChanged(
double d )
2283 void QgsLinePatternFillSymbolLayerWidget::on_mOffsetSpinBox_valueChanged(
double d )
2292 void QgsLinePatternFillSymbolLayerWidget::on_mDistanceUnitWidget_changed()
2303 void QgsLinePatternFillSymbolLayerWidget::on_mOffsetUnitWidget_changed()
2320 mHorizontalDistanceUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2321 mVerticalDistanceUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2322 mHorizontalDisplacementUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2323 mVerticalDisplacementUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2329 if ( !layer || layer->
layerType() !=
"PointPatternFill" )
2335 mHorizontalDistanceSpinBox->blockSignals(
true );
2337 mHorizontalDistanceSpinBox->blockSignals(
false );
2338 mVerticalDistanceSpinBox->blockSignals(
true );
2340 mVerticalDistanceSpinBox->blockSignals(
false );
2341 mHorizontalDisplacementSpinBox->blockSignals(
true );
2343 mHorizontalDisplacementSpinBox->blockSignals(
false );
2344 mVerticalDisplacementSpinBox->blockSignals(
true );
2346 mVerticalDisplacementSpinBox->blockSignals(
false );
2348 mHorizontalDistanceUnitWidget->blockSignals(
true );
2351 mHorizontalDistanceUnitWidget->blockSignals(
false );
2352 mVerticalDistanceUnitWidget->blockSignals(
true );
2355 mVerticalDistanceUnitWidget->blockSignals(
false );
2356 mHorizontalDisplacementUnitWidget->blockSignals(
true );
2359 mHorizontalDisplacementUnitWidget->blockSignals(
false );
2360 mVerticalDisplacementUnitWidget->blockSignals(
true );
2363 mVerticalDisplacementUnitWidget->blockSignals(
false );
2376 void QgsPointPatternFillSymbolLayerWidget::on_mHorizontalDistanceSpinBox_valueChanged(
double d )
2385 void QgsPointPatternFillSymbolLayerWidget::on_mVerticalDistanceSpinBox_valueChanged(
double d )
2394 void QgsPointPatternFillSymbolLayerWidget::on_mHorizontalDisplacementSpinBox_valueChanged(
double d )
2403 void QgsPointPatternFillSymbolLayerWidget::on_mVerticalDisplacementSpinBox_valueChanged(
double d )
2412 void QgsPointPatternFillSymbolLayerWidget::on_mHorizontalDistanceUnitWidget_changed()
2423 void QgsPointPatternFillSymbolLayerWidget::on_mVerticalDistanceUnitWidget_changed()
2434 void QgsPointPatternFillSymbolLayerWidget::on_mHorizontalDisplacementUnitWidget_changed()
2445 void QgsPointPatternFillSymbolLayerWidget::on_mVerticalDisplacementUnitWidget_changed()
2464 mSizeUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2465 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2469 btnColor->setAllowAlpha(
true );
2470 btnColor->setColorDialogTitle(
tr(
"Select symbol color" ) );
2471 btnColor->setContext(
"symbology" );
2473 spinOffsetX->setClearValue( 0.0 );
2474 spinOffsetY->setClearValue( 0.0 );
2476 connect( cboFont, SIGNAL( currentFontChanged(
const QFont & ) ),
this, SLOT(
setFontFamily(
const QFont& ) ) );
2477 connect( spinSize, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setSize(
double ) ) );
2478 connect( btnColor, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColor(
const QColor& ) ) );
2479 connect( spinAngle, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setAngle(
double ) ) );
2480 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
2481 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
2482 connect(
widgetChar, SIGNAL( characterSelected(
const QChar & ) ),
this, SLOT(
setCharacter(
const QChar & ) ) );
2488 if ( layer->
layerType() !=
"FontMarker" )
2496 cboFont->blockSignals(
true );
2497 cboFont->setCurrentFont( layerFont );
2498 cboFont->blockSignals(
false );
2499 spinSize->blockSignals(
true );
2501 spinSize->blockSignals(
false );
2502 btnColor->blockSignals(
true );
2504 btnColor->blockSignals(
false );
2505 spinAngle->blockSignals(
true );
2507 spinAngle->blockSignals(
false );
2515 spinOffsetX->blockSignals(
true );
2517 spinOffsetX->blockSignals(
false );
2518 spinOffsetY->blockSignals(
true );
2520 spinOffsetY->blockSignals(
false );
2522 mSizeUnitWidget->blockSignals(
true );
2525 mSizeUnitWidget->blockSignals(
false );
2527 mOffsetUnitWidget->blockSignals(
true );
2530 mOffsetUnitWidget->blockSignals(
false );
2533 mHorizontalAnchorComboBox->blockSignals(
true );
2534 mVerticalAnchorComboBox->blockSignals(
true );
2537 mHorizontalAnchorComboBox->blockSignals(
false );
2538 mVerticalAnchorComboBox->blockSignals(
false );
2580 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2638 if ( layer->
layerType() !=
"CentroidFill" )
2645 mDrawInsideCheckBox->blockSignals(
true );
2647 mDrawInsideCheckBox->blockSignals(
false );
2669 mWidthUnitWidget->setUnits( QStringList() <<
tr(
"Pixels" ) <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2670 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2672 mSpinOffsetX->setClearValue( 0.0 );
2673 mSpinOffsetY->setClearValue( 0.0 );
2675 connect( cboCoordinateMode, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT( setCoordinateMode(
int ) ) );
2676 connect( mSpinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT( offsetChanged() ) );
2677 connect( mSpinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT( offsetChanged() ) );
2687 if ( layer->
layerType() !=
"RasterFill" )
2698 mImageLineEdit->blockSignals(
true );
2700 mImageLineEdit->blockSignals(
false );
2702 cboCoordinateMode->blockSignals(
true );
2706 cboCoordinateMode->setCurrentIndex( 1 );
2710 cboCoordinateMode->setCurrentIndex( 0 );
2713 cboCoordinateMode->blockSignals(
false );
2714 mSpinTransparency->blockSignals(
true );
2715 mSpinTransparency->setValue(
mLayer->
alpha() * 100.0 );
2716 mSpinTransparency->blockSignals(
false );
2717 mSliderTransparency->blockSignals(
true );
2718 mSliderTransparency->setValue(
mLayer->
alpha() * 100.0 );
2719 mSliderTransparency->blockSignals(
false );
2720 mRotationSpinBox->blockSignals(
true );
2722 mRotationSpinBox->blockSignals(
false );
2724 mSpinOffsetX->blockSignals(
true );
2726 mSpinOffsetX->blockSignals(
false );
2727 mSpinOffsetY->blockSignals(
true );
2729 mSpinOffsetY->blockSignals(
false );
2730 mOffsetUnitWidget->blockSignals(
true );
2733 mOffsetUnitWidget->blockSignals(
false );
2735 mWidthSpinBox->blockSignals(
true );
2737 mWidthSpinBox->blockSignals(
false );
2738 mWidthUnitWidget->blockSignals(
true );
2742 mWidthUnitWidget->setUnit( 1 );
2745 mWidthUnitWidget->setUnit( 2 );
2749 mWidthUnitWidget->setUnit( 0 );
2753 mWidthUnitWidget->blockSignals(
false );
2754 updatePreviewImage();
2767 void QgsRasterFillSymbolLayerWidget::on_mBrowseToolButton_clicked()
2771 QString lineEditText = mImageLineEdit->text();
2772 if ( !lineEditText.isEmpty() )
2774 QFileInfo openDirFileInfo( lineEditText );
2775 openDir = openDirFileInfo.path();
2778 if ( openDir.isEmpty() )
2780 openDir = s.value(
"/UI/lastRasterFillImageDir",
"" ).toString();
2784 QString filePath = QFileDialog::getOpenFileName( 0,
tr(
"Select image file" ), openDir );
2785 if ( !filePath.isNull() )
2788 QFileInfo fileInfo( filePath );
2789 if ( !fileInfo.exists() || !fileInfo.isReadable() )
2791 QMessageBox::critical( 0,
"Invalid file",
"Error, file does not exist or is not readable" );
2795 s.setValue(
"/UI/lastRasterFillImageDir", fileInfo.absolutePath() );
2796 mImageLineEdit->setText( filePath );
2797 on_mImageLineEdit_editingFinished();
2801 void QgsRasterFillSymbolLayerWidget::on_mImageLineEdit_editingFinished()
2808 QFileInfo fi( mImageLineEdit->text() );
2811 QUrl url( mImageLineEdit->text() );
2812 if ( !url.isValid() )
2818 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
2820 updatePreviewImage();
2821 QApplication::restoreOverrideCursor();
2826 void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
2843 void QgsRasterFillSymbolLayerWidget::on_mSpinTransparency_valueChanged(
int value )
2852 updatePreviewImage();
2855 void QgsRasterFillSymbolLayerWidget::offsetChanged()
2857 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
2861 void QgsRasterFillSymbolLayerWidget::on_mOffsetUnitWidget_changed()
2873 void QgsRasterFillSymbolLayerWidget::on_mRotationSpinBox_valueChanged(
double d )
2882 void QgsRasterFillSymbolLayerWidget::on_mWidthUnitWidget_changed()
2889 switch ( mWidthUnitWidget->getUnit() )
2908 void QgsRasterFillSymbolLayerWidget::on_mWidthSpinBox_valueChanged(
double d )
2919 void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
2927 if ( image.isNull() )
2929 mLabelImagePreview->setPixmap( QPixmap() );
2933 if ( image.height() > 150 || image.width() > 150 )
2935 image = image.scaled( 150, 150, Qt::KeepAspectRatio, Qt::SmoothTransformation );
2938 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
2939 previewImage.fill( Qt::transparent );
2940 QRect imageRect(( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
2942 p.begin( &previewImage );
2944 uchar pixDataRGB[] = { 150, 150, 150, 150,
2949 QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
2950 QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
2951 QBrush checkerBrush;
2952 checkerBrush.setTexture( pix );
2953 p.fillRect( imageRect, checkerBrush );
2960 p.drawImage( imageRect.left(), imageRect.top(), image );
2962 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );
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...
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
static const QString pkgDataPath()
Returns the common root path of all application data directories.
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.
void setDistance(double d)
double outlineWidth() const
QgsSymbolV2::OutputUnit distanceYUnit() const
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 setReferencePoint2IsCentroid(bool isCentroid)
Sets the end point of the gradient to be the feature centroid.
void setSvgOutlineWidth(double w)
const QgsMapUnitScale & displacementXMapUnitScale() const
A container class for data source field mapping or expression.
virtual QString type() const =0
static QIcon symbolLayerPreviewIcon(QgsSymbolLayerV2 *layer, QgsSymbolV2::OutputUnit u, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale())
void setCoordinateMode(GradientCoordinateMode coordinateMode)
virtual double width() const
int rowCount(const QModelIndex &parent=QModelIndex()) const override
QgsSymbolV2::OutputUnit distanceXUnit() const
void setSvgFillColor(const QColor &c)
void setPatternWidthMapUnitScale(const QgsMapUnitScale &scale)
HorizontalAnchorPoint horizontalAnchorPoint() const
static const QStringList svgPaths()
Returns the pathes to svg directories.
QgsSymbolV2::OutputUnit offsetUnit() const
void setDistanceYUnit(QgsSymbolV2::OutputUnit unit)
QString svgFilePath() const
void setOffsetUnit(QgsSymbolV2::OutputUnit unit)
const QgsMapUnitScale & customDashPatternMapUnitScale() const
QPointF referencePoint2() const
void setOutlineColor(const QColor &c) override
Set outline color.
double displacementX() const
void setCustomDashPatternUnit(QgsSymbolV2::OutputUnit unit)
double svgOutlineWidth() const
void setPointOnSurface(bool pointOnSurface)
bool useCustomDashPattern() const
QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const
void setIgnoreRings(bool ignoreRings)
Sets whether the shapeburst fill should ignore polygon rings when calculating the buffered shading...
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)
void setColor2(QColor color2)
Sets the color for the endpoint of the shapeburst fill.
QVector< qreal > customDashVector() const
void setOutlineWidth(double w)
const QgsMapUnitScale & intervalMapUnitScale() const
void setPenJoinStyle(Qt::PenJoinStyle style)
bool referencePoint2IsCentroid() const
void setVerticalAnchorPoint(VerticalAnchorPoint v)
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 setBorderColor(QColor borderColor)
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setSvgOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
void setIntervalMapUnitScale(const QgsMapUnitScale &scale)
const QgsMapUnitScale & borderWidthMapUnitScale() const
void setMapUnitScale(const QgsMapUnitScale &scale) override
static const QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
virtual void removeDataDefinedProperty(const QString &property)
void setColorRamp(QgsVectorColorRampV2 *ramp)
Qt::PenStyle penStyle() const
void setWidthUnit(QgsSymbolV2::OutputUnit unit)
void setPatternWidth(double width)
void setFontFamily(QString family)
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)
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 setOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
void setRotateMarker(bool rotate)
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.
QgsSymbolV2::OutputUnit offsetUnit() const
QgsSymbolLayerV2 * clone() const override
void setLineAngle(double a)
void setImageFilePath(const QString &imagePath)
Sets the path to the raster image used for the fill.
double offsetAlongLine() const
Returns the offset along the line for the marker placement.
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)
void setMapUnitScale(const QgsMapUnitScale &scale) override
bool drawInsidePolygon() const
void setWidth(const double width)
Sets the width for scaling the image used in the fill.
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 setBlurRadius(int blurRadius)
Sets the blur radius, which controls the amount of blurring applied to the fill.
virtual QgsVectorColorRampV2 * clone() const =0
bool useWholeShape() const
Returns whether the shapeburst fill is set to cover the entire shape.
void setWidthMapUnitScale(const QgsMapUnitScale &scale)
static QStringList listSvgFiles()
Return a list of all available svg files.
QgsSvgListModel(QObject *parent, QString path)
const QgsMapUnitScale & offsetMapUnitScale() const
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.
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)
QString imageFilePath() const
The path to the raster image used for the fill.
void setSizeUnit(QgsSymbolV2::OutputUnit unit)
bool rotateMarker() const
void setDistanceYMapUnitScale(const QgsMapUnitScale &scale)
void setPath(QString path)
QColor svgFillColor() const
const QgsMapUnitScale & sizeMapUnitScale() const
QgsSymbolV2::OutputUnit distanceUnit() const
ShapeburstColorType colorType() const
Returns the color mode used for the shapeburst fill.
double patternWidth() const
QgsSymbolV2::OutputUnit borderWidthUnit() const
QGis::GeometryType geometryType() const
Returns point, line or polygon.
virtual QColor color() const
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.
void setOffsetAlongLineUnit(QgsSymbolV2::OutputUnit unit)
Sets the unit used for calculating the offset along line for markers.
static QStringList listSvgFilesAt(QString directory)
Return a list of svg files at the specified directory.
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)
QgsSymbolV2::ScaleMethod scaleMethod() const
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
GradientSpread gradientSpread() const
Gradient spread mode.
const QgsMapUnitScale & distanceMapUnitScale() const
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
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
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)
const QgsMapUnitScale & offsetMapUnitScale() const
QgsSymbolV2::OutputUnit outlineWidthUnit() const
QgsSvgListModel(QObject *parent)
A class for svg fill patterns.
QgsSymbolV2::OutputUnit offsetUnit() const
Returns the units for the fill's offset.
void setMapUnitScale(const QgsMapUnitScale &scale) override
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
QColor color2() const
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
void setPenStyle(Qt::PenStyle style)
QPointF offset() const
Returns the offset for the fill.
QgsSymbolV2::OutputUnit offsetUnit() const
void setPlacement(Placement p)
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.
Qt::PenJoinStyle penJoinStyle() const
void setColorRamp(QgsVectorColorRampV2 *ramp)
Sets the color ramp used to draw the shapeburst fill.
void setOffset(const QPointF &offset)
Sets the offset for the fill.
const QgsMapUnitScale & offsetMapUnitScale() const
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.
void setName(QString name)
virtual void setColor(const QColor &color)
Placement placement() const
GradientType gradientType() const
Type of gradient, eg linear or radial.
QColor borderColor() const
QgsSvgGroupsModel(QObject *parent)
void setDistanceX(double d)
void setBorderColor(QColor color)
void setMapUnitScale(const QgsMapUnitScale &scale) override
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
QgsSymbolV2::OutputUnit widthUnit() const
Returns the units for the image's width.
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.
QgsSymbolV2::OutputUnit offsetUnit() const
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
void setSize(double size)
void setAngle(double angle)
Represents a vector layer which manages a vector based data sets.
void setReferencePoint2(QPointF referencePoint)
End point of gradient fill, in the range [0,0] - [1,1].
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...
const QgsMapUnitScale & svgOutlineWidthMapUnitScale() const
void setDisplacementX(double d)
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
QColor outlineColor() const override
Get outline color.
const QgsMapUnitScale & outlineWidthMapUnitScale() const
double displacementY() const
Qt::BrushStyle brushStyle() const
QgsSymbolV2::OutputUnit widthUnit() const
void setOffsetUnit(const QgsSymbolV2::OutputUnit unit)
Sets the units for the fill's offset.
void setCharacter(QChar ch)
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)
double alpha() const
The opacity for the raster image used in the fill.
virtual void setDataDefinedProperty(const QString &property, const QString &expressionString)
void setColor2(QColor color2)
void setBorderStyle(Qt::PenStyle borderStyle)