38#include <QDomDocument>
39#include <QRegularExpression>
77 Q_UNUSED( newVersion )
78 bool returnValue =
false;
111 if ( !mDom.isNull() )
115 if ( transformer.to >= mCurrentVersion && ( transformer.from == mCurrentVersion || transformer.from.
isNull() ) )
118 ( *( transformer.transformFunc ) )( this );
119 mCurrentVersion = transformer.to;
129 QgsDebugMsg( QStringLiteral(
"Current project file version is %1.%2.%3" )
135 std::cout << mDom.toString( 2 ).toLatin1().constData();
146 if ( ! pft->
dom().isNull() )
150 QDomElement mapCanvas;
153 QDomNode qgis = pft->
dom().firstChildElement( QStringLiteral(
"qgis" ) );
154 if ( ! qgis.isNull() )
156 QgsDebugMsg( QStringLiteral(
"Populating new mapcanvas" ) );
159 mapCanvas = pft->
dom().createElement( QStringLiteral(
"mapcanvas" ) );
161 qgis.appendChild( mapCanvas );
163 mapCanvas.appendChild( qgis.namedItem( QStringLiteral(
"units" ) ) );
165 mapCanvas.appendChild( qgis.namedItem( QStringLiteral(
"extent" ) ) );
169 const QDomElement properties = qgis.firstChildElement( QStringLiteral(
"properties" ) );
170 const QDomElement spatial = properties.firstChildElement( QStringLiteral(
"SpatialRefSys" ) );
171 const QDomElement hasCrsTransformEnabled = spatial.firstChildElement( QStringLiteral(
"ProjectionsEnabled" ) );
174 QDomElement projection = pft->
dom().createElement( QStringLiteral(
"projections" ) );
175 QgsDebugMsg( QStringLiteral(
"Projection flag: " ) + hasCrsTransformEnabled.text() );
177 projection.appendChild( pft->
dom().createTextNode( hasCrsTransformEnabled.text() ) );
179 mapCanvas.appendChild( projection );
186 const QDomNodeList mapLayers = pft->
dom().elementsByTagName( QStringLiteral(
"maplayer" ) );
187 bool doneDestination =
false;
188 for (
int i = 0; i < mapLayers.count(); i++ )
190 QDomNode mapLayer = mapLayers.item( i );
192 const QDomNode coordinateTransform = mapLayer.namedItem( QStringLiteral(
"coordinatetransform" ) );
194 const QDomNode sourceCrs = coordinateTransform.namedItem( QStringLiteral(
"sourcesrs" ) );
196 sourceCrs.toElement().setTagName( QStringLiteral(
"srs" ) );
198 mapLayer.appendChild( sourceCrs );
201 if ( ! doneDestination )
204 const QDomNode destinationCRS = coordinateTransform.namedItem( QStringLiteral(
"destinationsrs" ) );
207 mapCanvas.appendChild( destinationCRS );
209 doneDestination =
true;
211 mapLayer.removeChild( coordinateTransform );
218 const QDomNodeList legendLayerFiles = pft->
dom().elementsByTagName( QStringLiteral(
"legendlayerfile" ) );
219 QgsDebugMsg( QStringLiteral(
"Legend layer file entries: " ) + QString::number( legendLayerFiles.count() ) );
220 for (
int i = 0; i < mapLayers.count(); i++ )
223 const QDomElement mapLayer = mapLayers.item( i ).toElement();
225 const QString
id = mapLayer.firstChildElement( QStringLiteral(
"id" ) ).text();
226 QgsDebugMsg( QStringLiteral(
"Handling layer %1" ).arg(
id ) );
228 for (
int j = 0; j < legendLayerFiles.count(); j++ )
230 QDomElement legendLayerFile = legendLayerFiles.item( j ).toElement();
231 if (
id == legendLayerFile.attribute( QStringLiteral(
"layerid" ) ) )
234 QgsDebugMsg( QStringLiteral(
"Found matching id" ) );
237 legendLayerFile.setAttribute( QStringLiteral(
"visible" ), mapLayer.attribute( QStringLiteral(
"visible" ) ) );
240 legendLayerFile.setAttribute( QStringLiteral(
"isInOverview" ), mapLayer.attribute( QStringLiteral(
"showInOverviewFlag" ) ) );
249 if ( ! pft->
dom().isNull() )
252 const QDomNodeList rasterPropertyList = pft->
dom().elementsByTagName( QStringLiteral(
"rasterproperties" ) );
253 QgsDebugMsg( QStringLiteral(
"Raster properties file entries: " ) + QString::number( rasterPropertyList.count() ) );
254 for (
int i = 0; i < rasterPropertyList.count(); i++ )
257 const QDomNode rasterProperty = rasterPropertyList.item( i );
260 rasterProperty.namedItem( QStringLiteral(
"stdDevsToPlotDouble" ) ).toElement().setTagName( QStringLiteral(
"mStandardDeviations" ) );
262 rasterProperty.namedItem( QStringLiteral(
"invertHistogramFlag" ) ).toElement().setTagName( QStringLiteral(
"mInvertPixelsFlag" ) );
263 rasterProperty.namedItem( QStringLiteral(
"showDebugOverLayFlag" ) ).toElement().setTagName( QStringLiteral(
"mDebugOverLayFlag" ) );
265 rasterProperty.namedItem( QStringLiteral(
"redBandNameQString" ) ).toElement().setTagName( QStringLiteral(
"mRedBandName" ) );
266 rasterProperty.namedItem( QStringLiteral(
"blueBandNameQString" ) ).toElement().setTagName( QStringLiteral(
"mBlueBandName" ) );
267 rasterProperty.namedItem( QStringLiteral(
"greenBandNameQString" ) ).toElement().setTagName( QStringLiteral(
"mGreenBandName" ) );
268 rasterProperty.namedItem( QStringLiteral(
"grayBandNameQString" ) ).toElement().setTagName( QStringLiteral(
"mGrayBandName" ) );
272 const QDomNodeList symbolPropertyList = pft->
dom().elementsByTagName( QStringLiteral(
"symbol" ) );
273 for (
int i = 0; i < symbolPropertyList.count(); i++ )
276 QDomNode symbolProperty = symbolPropertyList.item( i );
278 const QDomElement pointSymbol = symbolProperty.firstChildElement( QStringLiteral(
"pointsymbol" ) );
279 if ( pointSymbol.text().startsWith( QLatin1String(
"hard:" ) ) )
282 const int lineWidth = symbolProperty.firstChildElement( QStringLiteral(
"outlinewidth" ) ).text().toInt();
283 int pointSize = symbolProperty.firstChildElement( QStringLiteral(
"pointsize" ) ).text().toInt();
285 if ( pointSize != 0 )
290 pointSize = pointSize + 2 + 2 * lineWidth;
291 QgsDebugMsg( QStringLiteral(
"Setting point size to %1" ).arg( pointSize ) );
292 QDomElement newPointSizeProperty = pft->
dom().createElement( QStringLiteral(
"pointsize" ) );
293 const QDomText newPointSizeTxt = pft->
dom().createTextNode( QString::number( pointSize ) );
294 newPointSizeProperty.appendChild( newPointSizeTxt );
295 symbolProperty.replaceChild( newPointSizeProperty, pointSymbol );
305 if ( ! pft->
dom().isNull() )
309 const QPrinter myPrinter( QPrinter::ScreenResolution );
310 const int screenDpi = myPrinter.resolution();
311 const double widthScaleFactor = 25.4 / screenDpi;
313 const QDomNodeList outlineWidthList = pft->
dom().elementsByTagName( QStringLiteral(
"outlinewidth" ) );
314 for (
int i = 0; i < outlineWidthList.size(); ++i )
317 QDomElement currentOutlineElem = outlineWidthList.at( i ).toElement();
318 double outlineWidth = currentOutlineElem.text().toDouble();
319 outlineWidth *= widthScaleFactor;
322 const QDomNode outlineTextNode = currentOutlineElem.firstChild();
323 const QDomText newOutlineText = pft->
dom().createTextNode( QString::number( outlineWidth ) );
324 currentOutlineElem.replaceChild( newOutlineText, outlineTextNode );
329 const QDomNodeList pointSizeList = pft->
dom().elementsByTagName( QStringLiteral(
"pointsize" ) );
330 for (
int i = 0; i < pointSizeList.size(); ++i )
333 QDomElement currentPointSizeElem = pointSizeList.at( i ).toElement();
334 double pointSize = currentPointSizeElem.text().toDouble();
335 pointSize *= widthScaleFactor;
338 const QDomNode pointSizeTextNode = currentPointSizeElem.firstChild();
339 const QDomText newPointSizeText = pft->
dom().createTextNode( QString::number(
static_cast< int >( pointSize ) ) );
340 currentPointSizeElem.replaceChild( newPointSizeText, pointSizeTextNode );
348 if ( ! pft->
dom().isNull() )
350 const QDomNodeList layerList = pft->
dom().elementsByTagName( QStringLiteral(
"maplayer" ) );
351 for (
int i = 0; i < layerList.size(); ++i )
353 const QDomElement layerElem = layerList.at( i ).toElement();
354 const QString typeString = layerElem.attribute( QStringLiteral(
"type" ) );
355 if ( typeString != QLatin1String(
"vector" ) )
361 const QDomNode dataSourceNode = layerElem.namedItem( QStringLiteral(
"datasource" ) );
362 if ( dataSourceNode.isNull() )
366 const QString dataSource = dataSourceNode.toElement().text();
369 const QDomNode providerNode = layerElem.namedItem( QStringLiteral(
"provider" ) );
370 if ( providerNode.isNull() )
374 const QString providerKey = providerNode.toElement().text();
378 options.loadDefaultStyle =
false;
394 const QDomNodeList classificationFieldList = layerElem.elementsByTagName( QStringLiteral(
"classificationfield" ) );
395 for (
int j = 0; j < classificationFieldList.size(); ++j )
397 QDomElement classificationFieldElem = classificationFieldList.
at( j ).toElement();
398 const int fieldNumber = classificationFieldElem.text().toInt();
399 if ( fieldNumber >= 0 && fieldNumber < fields.
count() )
401 const QDomText fieldName = pft->
dom().createTextNode( fields.
at( fieldNumber ).
name() );
402 const QDomNode nameNode = classificationFieldElem.firstChild();
403 classificationFieldElem.replaceChild( fieldName, nameNode );
414 if ( pft->
dom().isNull() )
417 const QDomNode qgis = pft->
dom().firstChildElement( QStringLiteral(
"qgis" ) );
421 const QDomElement properties = qgis.firstChildElement( QStringLiteral(
"properties" ) );
422 if ( properties.isNull() )
425 QDomElement digitizing = properties.firstChildElement( QStringLiteral(
"Digitizing" ) );
426 if ( digitizing.isNull() )
429 const QDomElement tolList = digitizing.firstChildElement( QStringLiteral(
"LayerSnappingToleranceList" ) );
430 if ( tolList.isNull() )
433 const QDomElement tolUnitList = digitizing.firstChildElement( QStringLiteral(
"LayerSnappingToleranceUnitList" ) );
434 if ( !tolUnitList.isNull() )
438 for (
int i = 0; i < tolList.childNodes().count(); i++ )
439 units << QStringLiteral(
"0" );
442 value.
writeXml( QStringLiteral(
"LayerSnappingToleranceUnitList" ), digitizing, pft->
dom() );
448 if ( pft->
dom().isNull() )
453 const QDomNodeList layerItemList = pft->
dom().elementsByTagName( QStringLiteral(
"LayerItem" ) );
454 QDomElement currentLayerItemElem;
455 QString currentLayerId;
457 for (
int i = 0; i < layerItemList.size(); ++i )
459 currentLayerItemElem = layerItemList.at( i ).toElement();
460 if ( currentLayerItemElem.isNull() )
464 currentLayerId = currentLayerItemElem.attribute( QStringLiteral(
"layerId" ) );
466 const QDomNodeList vectorClassificationList = currentLayerItemElem.elementsByTagName( QStringLiteral(
"VectorClassificationItem" ) );
467 QDomElement currentClassificationElem;
468 for (
int j = 0; j < vectorClassificationList.size(); ++j )
470 currentClassificationElem = vectorClassificationList.at( j ).toElement();
471 if ( !currentClassificationElem.isNull() )
473 currentClassificationElem.setAttribute( QStringLiteral(
"layerId" ), currentLayerId );
478 const QDomNodeList textItemList = currentLayerItemElem.elementsByTagName( QStringLiteral(
"TextItem" ) );
479 QDomElement currentTextItem;
481 for (
int j = 0; j < textItemList.size(); ++j )
483 currentTextItem = textItemList.at( j ).toElement();
484 if ( currentTextItem.isNull() )
489 QDomElement classificationElement;
490 if ( !vectorClassificationList.isEmpty() )
492 classificationElement = pft->
dom().createElement( QStringLiteral(
"VectorClassificationItem" ) );
496 classificationElement = pft->
dom().createElement( QStringLiteral(
"RasterClassificationItem" ) );
499 classificationElement.setAttribute( QStringLiteral(
"layerId" ), currentLayerId );
500 classificationElement.setAttribute( QStringLiteral(
"text" ), currentTextItem.attribute( QStringLiteral(
"text" ) ) );
501 currentLayerItemElem.replaceChild( classificationElement, currentTextItem );
508 if ( pft->
dom().isNull() )
516 const QDomNodeList layerItemList = pft->
dom().elementsByTagName( QStringLiteral(
"rasterproperties" ) );
517 for (
int i = 0; i < layerItemList.size(); ++i )
519 QDomElement rasterPropertiesElem = layerItemList.at( i ).toElement();
520 QDomNode layerNode = rasterPropertiesElem.parentNode();
521 const QDomElement dataSourceElem = layerNode.firstChildElement( QStringLiteral(
"datasource" ) );
522 const QDomElement layerNameElem = layerNode.firstChildElement( QStringLiteral(
"layername" ) );
526 rasterLayer.
readLayerXml( layerNode.toElement(), context );
532 const QDomNodeList composerMapList = pft->
dom().elementsByTagName( QStringLiteral(
"ComposerMap" ) );
533 for (
int i = 0; i < composerMapList.size(); ++i )
535 const QDomNodeList gridList = composerMapList.at( i ).toElement().elementsByTagName( QStringLiteral(
"Grid" ) );
536 for (
int j = 0; j < gridList.size(); ++j )
538 const QDomNodeList annotationList = gridList.at( j ).toElement().elementsByTagName( QStringLiteral(
"Annotation" ) );
539 for (
int k = 0; k < annotationList.size(); ++k )
541 QDomElement annotationElem = annotationList.at( k ).toElement();
544 if ( annotationElem.hasAttribute( QStringLiteral(
"position" ) ) )
546 const int pos = annotationElem.attribute( QStringLiteral(
"position" ) ).toInt();
547 annotationElem.setAttribute( QStringLiteral(
"leftPosition" ), pos );
548 annotationElem.setAttribute( QStringLiteral(
"rightPosition" ), pos );
549 annotationElem.setAttribute( QStringLiteral(
"topPosition" ), pos );
550 annotationElem.setAttribute( QStringLiteral(
"bottomPosition" ), pos );
551 annotationElem.removeAttribute( QStringLiteral(
"position" ) );
555 if ( annotationElem.hasAttribute( QStringLiteral(
"direction" ) ) )
557 const int dir = annotationElem.attribute( QStringLiteral(
"direction" ) ).toInt();
560 annotationElem.setAttribute( QStringLiteral(
"leftDirection" ), 0 );
561 annotationElem.setAttribute( QStringLiteral(
"rightDirection" ), 0 );
562 annotationElem.setAttribute( QStringLiteral(
"topDirection" ), 1 );
563 annotationElem.setAttribute( QStringLiteral(
"bottomDirection" ), 1 );
567 annotationElem.setAttribute( QStringLiteral(
"leftDirection" ), 1 );
568 annotationElem.setAttribute( QStringLiteral(
"rightDirection" ), 1 );
569 annotationElem.setAttribute( QStringLiteral(
"topDirection" ), 0 );
570 annotationElem.setAttribute( QStringLiteral(
"bottomDirection" ), 0 );
574 annotationElem.setAttribute( QStringLiteral(
"leftDirection" ), dir );
575 annotationElem.setAttribute( QStringLiteral(
"rightDirection" ), dir );
576 annotationElem.setAttribute( QStringLiteral(
"topDirection" ), dir );
577 annotationElem.setAttribute( QStringLiteral(
"bottomDirection" ), dir );
579 annotationElem.removeAttribute( QStringLiteral(
"direction" ) );
586 const QDomNodeList composerList = pft->
dom().elementsByTagName( QStringLiteral(
"Composer" ) );
587 for (
int i = 0; i < composerList.size(); ++i )
589 QDomElement composerElem = composerList.at( i ).toElement();
592 QDomElement compositionElem = composerElem.firstChildElement( QStringLiteral(
"Composition" ) );
593 if ( compositionElem.isNull() )
598 const QDomNodeList composerChildren = composerElem.childNodes();
600 if ( composerChildren.size() < 1 )
605 for (
int j = composerChildren.size() - 1; j >= 0; --j )
607 const QDomElement childElem = composerChildren.at( j ).toElement();
608 if ( childElem.tagName() == QLatin1String(
"Composition" ) )
613 composerElem.removeChild( childElem );
614 compositionElem.appendChild( childElem );
622 const QDomNodeList rendererList = pft->
dom().elementsByTagName( QStringLiteral(
"renderer-v2" ) );
623 for (
int i = 0; i < rendererList.size(); ++i )
625 const QDomNodeList layerList = rendererList.at( i ).toElement().elementsByTagName( QStringLiteral(
"layer" ) );
626 for (
int j = 0; j < layerList.size(); ++j )
628 const QDomElement layerElem = layerList.at( j ).toElement();
629 if ( layerElem.attribute( QStringLiteral(
"class" ) ) == QLatin1String(
"SimpleFill" ) )
631 const QDomNodeList propList = layerElem.elementsByTagName( QStringLiteral(
"prop" ) );
632 for (
int k = 0; k < propList.size(); ++k )
634 QDomElement propElem = propList.at( k ).toElement();
635 if ( propElem.attribute( QStringLiteral(
"k" ) ) == QLatin1String(
"color" ) || propElem.attribute( QStringLiteral(
"k" ) ) == QLatin1String(
"color_border" ) )
637 propElem.setAttribute( QStringLiteral(
"v" ), propElem.attribute( QStringLiteral(
"v" ) ).section(
',', 0, 2 ) +
",255" );
650 const QDomNodeList composerPictureList = pft->
dom().elementsByTagName( QStringLiteral(
"ComposerPicture" ) );
651 for (
int i = 0; i < composerPictureList.size(); ++i )
653 QDomElement picture = composerPictureList.at( i ).toElement();
654 picture.setAttribute( QStringLiteral(
"anchorPoint" ), QString::number( 4 ) );
661 QDomElement propsElem = pft->
dom().firstChildElement( QStringLiteral(
"qgis" ) ).toElement().firstChildElement( QStringLiteral(
"properties" ) );
662 if ( !propsElem.isNull() )
664 const QDomNodeList srsNodes = propsElem.elementsByTagName( QStringLiteral(
"SpatialRefSys" ) );
666 QDomElement projElem;
667 if ( srsNodes.count() > 0 )
669 srsElem = srsNodes.at( 0 ).toElement();
670 const QDomNodeList projNodes = srsElem.elementsByTagName( QStringLiteral(
"ProjectionsEnabled" ) );
671 if ( projNodes.count() == 0 )
673 projElem = pft->
dom().createElement( QStringLiteral(
"ProjectionsEnabled" ) );
674 projElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"int" ) );
675 const QDomText projText = pft->
dom().createTextNode( QStringLiteral(
"0" ) );
676 projElem.appendChild( projText );
677 srsElem.appendChild( projElem );
682 srsElem = pft->
dom().createElement( QStringLiteral(
"SpatialRefSys" ) );
683 projElem = pft->
dom().createElement( QStringLiteral(
"ProjectionsEnabled" ) );
684 projElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"int" ) );
685 const QDomText projText = pft->
dom().createTextNode( QStringLiteral(
"0" ) );
686 projElem.appendChild( projText );
687 srsElem.appendChild( projElem );
688 propsElem.appendChild( srsElem );
694 const QDomNodeList canvasNodes = pft->
dom().elementsByTagName( QStringLiteral(
"mapcanvas" ) );
695 if ( canvasNodes.count() > 0 )
697 const QDomElement canvasElem = canvasNodes.at( 0 ).toElement();
698 const QDomNodeList canvasSrsNodes = canvasElem.elementsByTagName( QStringLiteral(
"spatialrefsys" ) );
699 if ( canvasSrsNodes.count() > 0 )
701 const QDomElement canvasSrsElem = canvasSrsNodes.at( 0 ).toElement();
706 const QDomNodeList proj4Nodes = canvasSrsElem.elementsByTagName( QStringLiteral(
"proj4" ) );
707 if ( proj4Nodes.count() > 0 )
709 const QDomElement proj4Node = proj4Nodes.at( 0 ).toElement();
710 proj = proj4Node.text();
712 const QDomNodeList authidNodes = canvasSrsElem.elementsByTagName( QStringLiteral(
"authid" ) );
713 if ( authidNodes.count() > 0 )
715 const QDomElement authidNode = authidNodes.at( 0 ).toElement();
716 authid = authidNode.text();
718 const QDomNodeList srsidNodes = canvasSrsElem.elementsByTagName( QStringLiteral(
"srsid" ) );
719 if ( srsidNodes.count() > 0 )
721 const QDomElement srsidNode = srsidNodes.at( 0 ).toElement();
722 srsid = srsidNode.text();
726 const QDomNodeList oldProjectProj4Nodes = srsElem.elementsByTagName( QStringLiteral(
"ProjectCRSProj4String" ) );
727 for (
int i = oldProjectProj4Nodes.count(); i >= 0; --i )
729 srsElem.removeChild( oldProjectProj4Nodes.at( i ) );
731 const QDomNodeList oldProjectCrsNodes = srsElem.elementsByTagName( QStringLiteral(
"ProjectCrs" ) );
732 for (
int i = oldProjectCrsNodes.count(); i >= 0; --i )
734 srsElem.removeChild( oldProjectCrsNodes.at( i ) );
736 const QDomNodeList oldProjectCrsIdNodes = srsElem.elementsByTagName( QStringLiteral(
"ProjectCRSID" ) );
737 for (
int i = oldProjectCrsIdNodes.count(); i >= 0; --i )
739 srsElem.removeChild( oldProjectCrsIdNodes.at( i ) );
741 const QDomNodeList projectionsEnabledNodes = srsElem.elementsByTagName( QStringLiteral(
"ProjectionsEnabled" ) );
742 for (
int i = projectionsEnabledNodes.count(); i >= 0; --i )
744 srsElem.removeChild( projectionsEnabledNodes.at( i ) );
747 QDomElement proj4Elem = pft->
dom().createElement( QStringLiteral(
"ProjectCRSProj4String" ) );
748 proj4Elem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"QString" ) );
749 const QDomText proj4Text = pft->
dom().createTextNode( proj );
750 proj4Elem.appendChild( proj4Text );
751 QDomElement projectCrsElem = pft->
dom().createElement( QStringLiteral(
"ProjectCrs" ) );
752 projectCrsElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"QString" ) );
753 const QDomText projectCrsText = pft->
dom().createTextNode( authid );
754 projectCrsElem.appendChild( projectCrsText );
755 QDomElement projectCrsIdElem = pft->
dom().createElement( QStringLiteral(
"ProjectCRSID" ) );
756 projectCrsIdElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"int" ) );
757 const QDomText srsidText = pft->
dom().createTextNode( srsid );
758 projectCrsIdElem.appendChild( srsidText );
759 QDomElement projectionsEnabledElem = pft->
dom().createElement( QStringLiteral(
"ProjectionsEnabled" ) );
760 projectionsEnabledElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"int" ) );
761 const QDomText projectionsEnabledText = pft->
dom().createTextNode( QStringLiteral(
"1" ) );
762 projectionsEnabledElem.appendChild( projectionsEnabledText );
763 srsElem.appendChild( proj4Elem );
764 srsElem.appendChild( projectCrsElem );
765 srsElem.appendChild( projectCrsIdElem );
766 srsElem.appendChild( projectionsEnabledElem );
768 const QDomNodeList srsNodes = propsElem.elementsByTagName( QStringLiteral(
"SpatialRefSys" ) );
769 for (
int i = srsNodes.count(); i >= 0; --i )
771 propsElem.removeChild( srsNodes.at( i ) );
773 propsElem.appendChild( srsElem );
779 const QDomNodeList mapLayers = pft->
dom().elementsByTagName( QStringLiteral(
"maplayer" ) );
781 for (
int mapLayerIndex = 0; mapLayerIndex < mapLayers.count(); ++mapLayerIndex )
783 QDomElement layerElem = mapLayers.at( mapLayerIndex ).toElement();
786 QDomElement fieldConfigurationElement = pft->
dom().createElement( QStringLiteral(
"fieldConfiguration" ) );
787 layerElem.appendChild( fieldConfigurationElement );
789 const QDomNodeList editTypeNodes = layerElem.namedItem( QStringLiteral(
"edittypes" ) ).childNodes();
790 QDomElement constraintExpressionsElem = pft->
dom().createElement( QStringLiteral(
"constraintExpressions" ) );
791 layerElem.appendChild( constraintExpressionsElem );
793 for (
int i = 0; i < editTypeNodes.size(); ++i )
795 const QDomNode editTypeNode = editTypeNodes.at( i );
796 const QDomElement editTypeElement = editTypeNode.toElement();
798 QDomElement fieldElement = pft->
dom().createElement( QStringLiteral(
"field" ) );
799 fieldConfigurationElement.appendChild( fieldElement );
801 const QString name = editTypeElement.attribute( QStringLiteral(
"name" ) );
802 fieldElement.setAttribute( QStringLiteral(
"name" ), name );
803 QDomElement constraintExpressionElem = pft->
dom().createElement( QStringLiteral(
"constraint" ) );
804 constraintExpressionElem.setAttribute( QStringLiteral(
"field" ), name );
805 constraintExpressionsElem.appendChild( constraintExpressionElem );
807 QDomElement editWidgetElement = pft->
dom().createElement( QStringLiteral(
"editWidget" ) );
808 fieldElement.appendChild( editWidgetElement );
810 const QString ewv2Type = editTypeElement.attribute( QStringLiteral(
"widgetv2type" ) );
811 editWidgetElement.setAttribute( QStringLiteral(
"type" ), ewv2Type );
813 const QDomElement ewv2CfgElem = editTypeElement.namedItem( QStringLiteral(
"widgetv2config" ) ).toElement();
815 if ( !ewv2CfgElem.isNull() )
817 QDomElement editWidgetConfigElement = pft->
dom().createElement( QStringLiteral(
"config" ) );
818 editWidgetElement.appendChild( editWidgetConfigElement );
820 QVariantMap editWidgetConfiguration;
822 const QDomNamedNodeMap configAttrs = ewv2CfgElem.attributes();
823 for (
int configIndex = 0; configIndex < configAttrs.count(); ++configIndex )
825 const QDomAttr configAttr = configAttrs.item( configIndex ).toAttr();
826 if ( configAttr.name() == QLatin1String(
"fieldEditable" ) )
828 editWidgetConfigElement.setAttribute( QStringLiteral(
"fieldEditable" ), configAttr.value() );
830 else if ( configAttr.name() == QLatin1String(
"labelOnTop" ) )
832 editWidgetConfigElement.setAttribute( QStringLiteral(
"labelOnTop" ), configAttr.value() );
834 else if ( configAttr.name() == QLatin1String(
"notNull" ) )
836 editWidgetConfigElement.setAttribute( QStringLiteral(
"notNull" ), configAttr.value() );
838 else if ( configAttr.name() == QLatin1String(
"constraint" ) )
840 constraintExpressionElem.setAttribute( QStringLiteral(
"exp" ), configAttr.value() );
842 else if ( configAttr.name() == QLatin1String(
"constraintDescription" ) )
844 constraintExpressionElem.setAttribute( QStringLiteral(
"desc" ), configAttr.value() );
848 editWidgetConfiguration.insert( configAttr.name(), configAttr.value() );
852 if ( ewv2Type == QLatin1String(
"ValueMap" ) )
854 const QDomNodeList configElements = ewv2CfgElem.childNodes();
856 for (
int configIndex = 0; configIndex < configElements.count(); ++configIndex )
858 const QDomElement configElem = configElements.at( configIndex ).toElement();
859 map.insert( configElem.attribute( QStringLiteral(
"key" ) ), configElem.attribute( QStringLiteral(
"value" ) ) );
861 editWidgetConfiguration.insert( QStringLiteral(
"map" ), map );
863 else if ( ewv2Type == QLatin1String(
"Photo" ) )
865 editWidgetElement.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"ExternalResource" ) );
867 editWidgetConfiguration.insert( QStringLiteral(
"DocumentViewer" ), 1 );
868 editWidgetConfiguration.insert( QStringLiteral(
"DocumentViewerHeight" ), editWidgetConfiguration.value( QStringLiteral(
"Height" ) ) );
869 editWidgetConfiguration.insert( QStringLiteral(
"DocumentViewerWidth" ), editWidgetConfiguration.value( QStringLiteral(
"Width" ) ) );
870 editWidgetConfiguration.insert( QStringLiteral(
"RelativeStorage" ), 1 );
872 else if ( ewv2Type == QLatin1String(
"FileName" ) )
874 editWidgetElement.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"ExternalResource" ) );
876 editWidgetConfiguration.insert( QStringLiteral(
"RelativeStorage" ), 1 );
878 else if ( ewv2Type == QLatin1String(
"WebView" ) )
880 editWidgetElement.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"ExternalResource" ) );
882 editWidgetConfiguration.insert( QStringLiteral(
"DocumentViewerHeight" ), editWidgetConfiguration.value( QStringLiteral(
"Height" ) ) );
883 editWidgetConfiguration.insert( QStringLiteral(
"DocumentViewerWidth" ), editWidgetConfiguration.value( QStringLiteral(
"Width" ) ) );
884 editWidgetConfiguration.insert( QStringLiteral(
"RelativeStorage" ), 1 );
898 const QDomNode noDataNode = rasterPropertiesElem.namedItem( QStringLiteral(
"mNoDataValue" ) );
899 const QDomElement noDataElement = noDataNode.toElement();
900 if ( !noDataElement.text().isEmpty() )
902 QgsDebugMsg(
"mNoDataValue = " + noDataElement.text() );
903 QDomElement noDataElem = doc.createElement( QStringLiteral(
"noData" ) );
905 QDomElement noDataRangeList = doc.createElement( QStringLiteral(
"noDataRangeList" ) );
906 noDataRangeList.setAttribute( QStringLiteral(
"bandNo" ), 1 );
908 QDomElement noDataRange = doc.createElement( QStringLiteral(
"noDataRange" ) );
909 noDataRange.setAttribute( QStringLiteral(
"min" ), noDataElement.text() );
910 noDataRange.setAttribute( QStringLiteral(
"max" ), noDataElement.text() );
911 noDataRangeList.appendChild( noDataRange );
913 noDataElem.appendChild( noDataRangeList );
915 parentNode.appendChild( noDataElem );
918 QDomElement rasterRendererElem = doc.createElement( QStringLiteral(
"rasterrenderer" ) );
922 rasterRendererElem.setAttribute( QStringLiteral(
"invertColor" ), QStringLiteral(
"0" ) );
923 const QDomElement invertColorElem = rasterPropertiesElem.firstChildElement( QStringLiteral(
"mInvertColor" ) );
924 if ( !invertColorElem.isNull() )
926 if ( invertColorElem.text() == QLatin1String(
"true" ) )
928 rasterRendererElem.setAttribute( QStringLiteral(
"invertColor" ), QStringLiteral(
"1" ) );
933 rasterRendererElem.setAttribute( QStringLiteral(
"opacity" ), QStringLiteral(
"1" ) );
934 const QDomElement transparencyElem = parentNode.firstChildElement( QStringLiteral(
"transparencyLevelInt" ) );
935 if ( !transparencyElem.isNull() )
937 const double transparency = transparencyElem.text().toInt();
938 rasterRendererElem.setAttribute( QStringLiteral(
"opacity" ), QString::number( transparency / 255.0 ) );
942 rasterRendererElem.setAttribute( QStringLiteral(
"alphaBand" ), -1 );
945 const int grayBand =
rasterBandNumber( rasterPropertiesElem, QStringLiteral(
"mGrayBandName" ), rlayer );
948 QString drawingStyle = rasterPropertiesElem.firstChildElement( QStringLiteral(
"mDrawingStyle" ) ).text();
955 if ( drawingStyle == QLatin1String(
"PalettedColor" ) )
957 const QDomElement customColorRampElem = rasterPropertiesElem.firstChildElement( QStringLiteral(
"customColorRamp" ) );
958 const QDomNodeList colorRampEntryList = customColorRampElem.elementsByTagName( QStringLiteral(
"colorRampEntry" ) );
960 for (
int i = 0; i < colorRampEntryList.size(); ++i )
962 const QDomElement colorRampEntryElem = colorRampEntryList.at( i ).toElement();
963 const QString strValue = colorRampEntryElem.attribute( QStringLiteral(
"value" ) );
964 const double value = strValue.toDouble();
965 if ( value < 0 || value > 10000 || !
qgsDoubleNear( value,
static_cast< int >( value ) ) )
967 QgsDebugMsg( QStringLiteral(
"forcing SingleBandPseudoColor value = %1" ).arg( value ) );
968 drawingStyle = QStringLiteral(
"SingleBandPseudoColor" );
974 if ( drawingStyle == QLatin1String(
"SingleBandGray" ) )
976 rasterRendererElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"singlebandgray" ) );
977 rasterRendererElem.setAttribute( QStringLiteral(
"grayBand" ), grayBand );
980 else if ( drawingStyle == QLatin1String(
"SingleBandPseudoColor" ) )
982 rasterRendererElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"singlebandpseudocolor" ) );
983 rasterRendererElem.setAttribute( QStringLiteral(
"band" ), grayBand );
984 QDomElement newRasterShaderElem = doc.createElement( QStringLiteral(
"rastershader" ) );
985 QDomElement newColorRampShaderElem = doc.createElement( QStringLiteral(
"colorrampshader" ) );
986 newRasterShaderElem.appendChild( newColorRampShaderElem );
987 rasterRendererElem.appendChild( newRasterShaderElem );
990 const QString colorShadingAlgorithm = rasterPropertiesElem.firstChildElement( QStringLiteral(
"mColorShadingAlgorithm" ) ).text();
991 if ( colorShadingAlgorithm == QLatin1String(
"PseudoColorShader" ) || colorShadingAlgorithm == QLatin1String(
"FreakOutShader" ) )
993 newColorRampShaderElem.setAttribute( QStringLiteral(
"colorRampType" ), QStringLiteral(
"INTERPOLATED" ) );
999 const double breakSize = ( maxValue - minValue ) / 3;
1001 QStringList colorList;
1002 if ( colorShadingAlgorithm == QLatin1String(
"FreakOutShader" ) )
1004 colorList << QStringLiteral(
"#ff00ff" ) << QStringLiteral(
"#00ffff" ) << QStringLiteral(
"#ff0000" ) << QStringLiteral(
"#00ff00" );
1008 colorList << QStringLiteral(
"#0000ff" ) << QStringLiteral(
"#00ffff" ) << QStringLiteral(
"#ffff00" ) << QStringLiteral(
"#ff0000" );
1010 QStringList::const_iterator colorIt = colorList.constBegin();
1011 double boundValue = minValue;
1012 for ( ; colorIt != colorList.constEnd(); ++colorIt )
1014 QDomElement newItemElem = doc.createElement( QStringLiteral(
"item" ) );
1015 newItemElem.setAttribute( QStringLiteral(
"value" ), QString::number( boundValue ) );
1016 newItemElem.setAttribute( QStringLiteral(
"label" ), QString::number( boundValue ) );
1017 newItemElem.setAttribute( QStringLiteral(
"color" ), *colorIt );
1018 newColorRampShaderElem.appendChild( newItemElem );
1019 boundValue += breakSize;
1022 else if ( colorShadingAlgorithm == QLatin1String(
"ColorRampShader" ) )
1024 const QDomElement customColorRampElem = rasterPropertiesElem.firstChildElement( QStringLiteral(
"customColorRamp" ) );
1025 const QString type = customColorRampElem.firstChildElement( QStringLiteral(
"colorRampType" ) ).text();
1026 newColorRampShaderElem.setAttribute( QStringLiteral(
"colorRampType" ), type );
1027 const QDomNodeList colorNodeList = customColorRampElem.elementsByTagName( QStringLiteral(
"colorRampEntry" ) );
1029 QString value, label;
1031 int red, green, blue;
1032 QDomElement currentItemElem;
1033 for (
int i = 0; i < colorNodeList.size(); ++i )
1035 currentItemElem = colorNodeList.at( i ).toElement();
1036 value = currentItemElem.attribute( QStringLiteral(
"value" ) );
1037 label = currentItemElem.attribute( QStringLiteral(
"label" ) );
1038 red = currentItemElem.attribute( QStringLiteral(
"red" ) ).toInt();
1039 green = currentItemElem.attribute( QStringLiteral(
"green" ) ).toInt();
1040 blue = currentItemElem.attribute( QStringLiteral(
"blue" ) ).toInt();
1041 newColor = QColor( red, green, blue );
1042 QDomElement newItemElem = doc.createElement( QStringLiteral(
"item" ) );
1043 newItemElem.setAttribute( QStringLiteral(
"value" ), value );
1044 newItemElem.setAttribute( QStringLiteral(
"label" ), label );
1045 newItemElem.setAttribute( QStringLiteral(
"color" ), newColor.name() );
1046 newColorRampShaderElem.appendChild( newItemElem );
1050 else if ( drawingStyle == QLatin1String(
"PalettedColor" ) )
1052 rasterRendererElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"paletted" ) );
1053 rasterRendererElem.setAttribute( QStringLiteral(
"band" ), grayBand );
1054 const QDomElement customColorRampElem = rasterPropertiesElem.firstChildElement( QStringLiteral(
"customColorRamp" ) );
1055 const QDomNodeList colorRampEntryList = customColorRampElem.elementsByTagName( QStringLiteral(
"colorRampEntry" ) );
1056 QDomElement newColorPaletteElem = doc.createElement( QStringLiteral(
"colorPalette" ) );
1062 QDomElement colorRampEntryElem;
1063 for (
int i = 0; i < colorRampEntryList.size(); ++i )
1065 colorRampEntryElem = colorRampEntryList.at( i ).toElement();
1066 QDomElement newPaletteElem = doc.createElement( QStringLiteral(
"paletteEntry" ) );
1067 value =
static_cast< int >( colorRampEntryElem.attribute( QStringLiteral(
"value" ) ).toDouble() );
1068 newPaletteElem.setAttribute( QStringLiteral(
"value" ), value );
1069 red = colorRampEntryElem.attribute( QStringLiteral(
"red" ) ).toInt();
1070 green = colorRampEntryElem.attribute( QStringLiteral(
"green" ) ).toInt();
1071 blue = colorRampEntryElem.attribute( QStringLiteral(
"blue" ) ).toInt();
1072 newPaletteElem.setAttribute( QStringLiteral(
"color" ), QColor( red, green, blue ).name() );
1073 const QString label = colorRampEntryElem.attribute( QStringLiteral(
"label" ) );
1074 if ( !label.isEmpty() )
1076 newPaletteElem.setAttribute( QStringLiteral(
"label" ), label );
1078 newColorPaletteElem.appendChild( newPaletteElem );
1080 rasterRendererElem.appendChild( newColorPaletteElem );
1082 else if ( drawingStyle == QLatin1String(
"MultiBandColor" ) )
1084 rasterRendererElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"multibandcolor" ) );
1087 const int redBand =
rasterBandNumber( rasterPropertiesElem, QStringLiteral(
"mRedBandName" ), rlayer );
1088 const int greenBand =
rasterBandNumber( rasterPropertiesElem, QStringLiteral(
"mGreenBandName" ), rlayer );
1089 const int blueBand =
rasterBandNumber( rasterPropertiesElem, QStringLiteral(
"mBlueBandName" ), rlayer );
1090 rasterRendererElem.setAttribute( QStringLiteral(
"redBand" ), redBand );
1091 rasterRendererElem.setAttribute( QStringLiteral(
"greenBand" ), greenBand );
1092 rasterRendererElem.setAttribute( QStringLiteral(
"blueBand" ), blueBand );
1102 if ( !parentNode.isNull() )
1104 parentNode.replaceChild( rasterRendererElem, rasterPropertiesElem );
1115 return mCurrentVersion;
1125 const int band = -1;
1126 const QDomElement rasterBandElem = rasterPropertiesElem.firstChildElement( bandName );
1127 if ( !rasterBandElem.isNull() )
1129 const thread_local QRegularExpression re(
"(\\d+)" );
1130 const QRegularExpressionMatch match = re.match( rasterBandElem.text() );
1131 if ( match.hasMatch() )
1133 return match.captured( 1 ).toInt();
1141 if ( rasterproperties.isNull() || rendererElem.isNull() )
1146 double minimumValue = 0;
1147 double maximumValue = 0;
1148 const QDomElement contrastMinMaxElem = rasterproperties.firstChildElement( QStringLiteral(
"contrastEnhancementMinMaxValues" ) );
1149 if ( contrastMinMaxElem.isNull() )
1154 const QDomElement contrastEnhancementAlgorithmElem = rasterproperties.firstChildElement( QStringLiteral(
"mContrastEnhancementAlgorithm" ) );
1155 if ( contrastEnhancementAlgorithmElem.isNull() )
1161 int algorithmEnum = 0;
1162 const QString algorithmString = contrastEnhancementAlgorithmElem.text();
1163 if ( algorithmString == QLatin1String(
"StretchToMinimumMaximum" ) )
1167 else if ( algorithmString == QLatin1String(
"StretchAndClipToMinimumMaximum" ) )
1171 else if ( algorithmString == QLatin1String(
"ClipToMinimumMaximum" ) )
1175 else if ( algorithmString == QLatin1String(
"UserDefinedEnhancement" ) )
1180 const QDomNodeList minMaxEntryList = contrastMinMaxElem.elementsByTagName( QStringLiteral(
"minMaxEntry" ) );
1181 QStringList enhancementNameList;
1182 if ( minMaxEntryList.size() == 1 )
1184 enhancementNameList << QStringLiteral(
"contrastEnhancement" );
1186 if ( minMaxEntryList.size() == 3 )
1188 enhancementNameList << QStringLiteral(
"redContrastEnhancement" ) << QStringLiteral(
"greenContrastEnhancement" ) << QStringLiteral(
"blueContrastEnhancement" );
1190 if ( minMaxEntryList.size() > enhancementNameList.size() )
1195 QDomElement minMaxEntryElem;
1196 for (
int i = 0; i < minMaxEntryList.size(); ++i )
1198 minMaxEntryElem = minMaxEntryList.at( i ).toElement();
1199 const QDomElement minElem = minMaxEntryElem.firstChildElement( QStringLiteral(
"min" ) );
1200 if ( minElem.isNull() )
1204 minimumValue = minElem.text().toDouble();
1206 const QDomElement maxElem = minMaxEntryElem.firstChildElement( QStringLiteral(
"max" ) );
1207 if ( maxElem.isNull() )
1211 maximumValue = maxElem.text().toDouble();
1213 QDomElement newContrastEnhancementElem = doc.createElement( enhancementNameList.at( i ) );
1214 QDomElement newMinValElem = doc.createElement( QStringLiteral(
"minValue" ) );
1215 const QDomText minText = doc.createTextNode( QString::number( minimumValue ) );
1216 newMinValElem.appendChild( minText );
1217 newContrastEnhancementElem.appendChild( newMinValElem );
1218 QDomElement newMaxValElem = doc.createElement( QStringLiteral(
"maxValue" ) );
1219 const QDomText maxText = doc.createTextNode( QString::number( maximumValue ) );
1220 newMaxValElem.appendChild( maxText );
1221 newContrastEnhancementElem.appendChild( newMaxValElem );
1223 QDomElement newAlgorithmElem = doc.createElement( QStringLiteral(
"algorithm" ) );
1224 const QDomText newAlgorithmText = doc.createTextNode( QString::number( algorithmEnum ) );
1225 newAlgorithmElem.appendChild( newAlgorithmText );
1226 newContrastEnhancementElem.appendChild( newAlgorithmElem );
1228 rendererElem.appendChild( newContrastEnhancementElem );
1240 auto migrateOldReferences = [&mapLayers](
const QList<QgsSymbolLayerReference> &slRefs )
1242 QList<QgsSymbolLayerReference> newRefs;
1245 const QgsVectorLayer *vlRef = qobject_cast<QgsVectorLayer *>( mapLayers[ slRef.layerId() ] );
1249 renderer, QSet<QgsSymbolLayerId>() << slRef.symbolLayerId() ) : QSet<const QgsSymbolLayer *>();
1251 const QString slId = symbolLayers.isEmpty() ? QString() : ( *symbolLayers.constBegin() )->
id();
1260 const QStringList subProviders = labeling->subProviders();
1261 for (
const QString &provider : subProviders )
1265 QList<QgsSymbolLayerReference> newMaskedSymbolLayers = migrateOldReferences( format.
mask().
maskedSymbolLayers() );
1283 void visitSymbol(
const QgsSymbol *symbol )
1292 visitSymbol( subSymbol );
1295 maskSymbolLayers << maskLayer;
1304 if ( symbolEntity->symbol() )
1305 visitSymbol( symbolEntity->symbol() );
1310 QList<const QgsMaskMarkerSymbolLayer *> maskSymbolLayers;
1313 SymbolLayerVisitor visitor;
1314 renderer->accept( &visitor );
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
Contains information about the context in which a coordinate transform is executed.
Container of fields for a vector layer.
int count() const
Returns number of items.
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
Base class for all map layer types.
bool readLayerXml(const QDomElement &layerElement, QgsReadWriteContext &context, QgsMapLayer::ReadFlags flags=QgsMapLayer::ReadFlags())
Sets state from DOM document.
Special symbol layer that uses its sub symbol as a selective mask.
void setMasks(const QList< QgsSymbolLayerReference > &maskedLayers)
Sets the symbol layers that will be masked by the sub symbol's shape.
Contains settings for how a map layer will be labeled.
void setFormat(const QgsTextFormat &format)
Sets the label text formatting settings, e.g., font settings, buffer settings, etc.
const QgsTextFormat & format() const
Returns the label text formatting settings, e.g., font settings, buffer settings, etc.
Project property value node, contains a QgsProjectPropertyKey's value.
bool writeXml(const QString &nodeName, QDomElement &element, QDomDocument &document) override
Writes the property hierarchy to a specified DOM element.
A class to describe the version of a project.
int subVersion() const
Returns the sub version number.
int majorVersion() const
Returns the major version number.
int minorVersion() const
Returns the minor version number.
bool isNull() const
Returns true if this is a NULL project version.
static QgsProject * instance()
Returns the QgsProject singleton instance.
The RasterBandStats struct is a container for statistics about a single raster band.
double minimumValue
The minimum cell value in the raster band.
double maximumValue
The maximum cell value in the raster band.
virtual QgsRasterBandStats bandStatistics(int bandNo, int stats=QgsRasterBandStats::All, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0, QgsRasterBlockFeedback *feedback=nullptr)
Returns the band statistics.
Represents a raster layer.
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
The class is used as a container of context for various read/write operations on other objects.
void setPathResolver(const QgsPathResolver &resolver)
Sets up path resolver for conversion between relative and absolute paths.
virtual QgsStyle::StyleEntity type() const =0
Returns the type of style entity.
An interface for classes which can visit style entity (e.g.
@ SymbolRule
Rule based symbology or label child rule.
A symbol entity for QgsStyle databases.
Type used to refer to a specific symbol layer in a symbol of a layer.
static Q_DECL_DEPRECATED QSet< const QgsSymbolLayer * > toSymbolLayerPointers(const QgsFeatureRenderer *renderer, const QSet< QgsSymbolLayerId > &symbolLayerIds)
Converts a set of symbol layer id to a set of pointers to actual symbol layers carried by the feature...
Abstract base class for all rendered symbols.
QgsSymbolLayer * symbolLayer(int layer)
Returns the symbol layer at the specified index.
int symbolLayerCount() const
Returns the total number of symbol layers contained in the symbol.
Container for all settings relating to text rendering.
QgsTextMaskSettings & mask()
Returns a reference to the masking settings.
void setMaskedSymbolLayers(const QList< QgsSymbolLayerReference > &maskedLayers)
Sets the symbol layers that will be masked by this buffer.
QList< QgsSymbolLayerReference > maskedSymbolLayers() const
Returns a list of references to symbol layers that are masked by this buffer.
This is the base class for vector data providers.
QgsFields fields() const override=0
Returns the fields associated with this data provider.
Represents a vector layer which manages a vector based data sets.
const QgsAbstractVectorLayerLabeling * labeling() const
Access to const labeling configuration.
QgsFeatureRenderer * renderer()
Returns the feature renderer used for rendering the features in the layer in 2D map views.
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be nullptr.
static QDomElement writeVariant(const QVariant &value, QDomDocument &doc)
Write a QVariant to a QDomElement.
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
#define QgsDebugMsgLevel(str, level)
Contains information relating to a node (i.e.
QgsStyleEntityVisitorInterface::NodeType type
Node type.
Contains information relating to the style entity currently being visited.
const QgsStyleEntityInterface * entity
Reference to style entity being visited.
Setting options for loading vector layers.