28 #include <QPainterPath>
30 #include <QProgressDialog>
87 #ifdef TESTPROVIDERLIB
93 const QString& qmlStyle,
94 const QString& sldStyle,
95 const QString& styleName,
96 const QString& styleDescription,
97 const QString& uiFileContent,
111 QStringList &descriptions,
124 bool loadDefaultStyleFlag )
125 :
QgsMapLayer( VectorLayer, baseName, vectorLayerPath )
126 , mDataProvider( NULL )
127 , mProviderKey( providerKey )
129 , mWkbType(
QGis::WKBUnknown )
130 , mRendererV2( NULL )
133 , mLabelFontNotFoundNotified( false )
134 , mFeatureBlendMode( QPainter::CompositionMode_SourceOver )
135 , mLayerTransparency( 0 )
136 , mVertexMarkerOnlyForSelection( false )
137 , mEditorLayout( GeneratedLayout )
138 , mFeatureFormSuppress( SuppressDefault )
142 , mExpressionFieldBuffer( 0 )
143 , mDiagramRenderer( 0 )
144 , mDiagramLayerSettings( 0 )
145 , mValidExtent( false )
146 , mLazyExtent( true )
147 , mSymbolFeatureCounted( false )
152 if ( ! mProviderKey.isEmpty() )
154 setDataProvider( mProviderKey );
163 bool defaultLoadedFlag =
false;
164 if ( loadDefaultStyleFlag )
183 connect(
QgsProject::instance()->relationManager(), SIGNAL( relationsLoaded() ),
this, SLOT( onRelationsLoaded() ) );
187 mSimplifyMethod.
setSimplifyHints(( QgsVectorSimplifyMethod::SimplifyHints ) settings.value(
"/qgis/simplifyDrawingHints", (
int ) mSimplifyMethod.
simplifyHints() ).toInt() );
188 mSimplifyMethod.
setThreshold( settings.value(
"/qgis/simplifyDrawingTol", mSimplifyMethod.
threshold() ).toFloat() );
203 delete mDataProvider;
206 delete mExpressionFieldBuffer;
209 delete mDiagramLayerSettings;
263 QString idxName =
"";
266 if ( !fldName.isEmpty() )
268 mDisplayField = fldName;
273 int fieldsSize = fields.
size();
275 for (
int idx = 0; idx < fields.
count(); ++idx )
277 QString fldName = fields[idx].name();
278 QgsDebugMsg(
"Checking field " + fldName +
" of " + QString::number( fieldsSize ) +
" total" );
284 if ( fldName.indexOf(
"name", 0, Qt::CaseInsensitive ) > -1 )
286 if ( idxName.isEmpty() )
291 if ( fldName.indexOf(
"descrip", 0, Qt::CaseInsensitive ) > -1 )
293 if ( idxName.isEmpty() )
298 if ( fldName.indexOf(
"id", 0, Qt::CaseInsensitive ) > -1 )
300 if ( idxId.isEmpty() )
308 if ( fieldsSize == 0 )
311 if ( idxName.length() > 0 )
313 mDisplayField = idxName;
317 if ( idxId.length() > 0 )
319 mDisplayField = idxId;
323 mDisplayField = fields[0].name();
340 if ( mRendererV2 && mLabelOn && mLabel &&
349 attributes.append( attrNum );
357 QgsDebugMsg(
"Selecting features based on view extent" );
366 .setFilterRect( rendererContext.
extent() )
367 .setSubsetOfAttributes( attributes ) );
374 bool sel = mSelectedFeatureIds.contains( fet.id() );
375 mLabel->
renderLabel( rendererContext, fet, sel, 0 );
391 QgsDebugMsg( QString(
"Total features processed %1" ).arg( featureCount ) );
418 p.setPen( QColor( 50, 100, 120, 200 ) );
419 p.setBrush( QColor( 200, 200, 210, 120 ) );
420 p.drawEllipse( x - m, y - m, m * 2 + 1, m * 2 + 1 );
424 p.setPen( QColor( 255, 0, 0 ) );
425 p.drawLine( x - m, y + m, x + m, y - m );
426 p.drawLine( x - m, y - m, x + m, y + m );
432 mSelectedFeatureIds.insert( fid );
439 mSelectedFeatureIds.unite( featureIds );
446 mSelectedFeatureIds.remove( fid );
453 mSelectedFeatureIds.subtract( featureIds );
465 .setFilterRect( rect )
477 if ( !addToSelection )
490 if ( intersectingIds.count() > 0 )
492 QgsDebugMsg(
"Trying to select and deselect the same item at the same time. Unsure what to do. Selecting dubious items." );
495 mSelectedFeatureIds -= deselectIds;
496 mSelectedFeatureIds += selectIds;
504 ids.subtract( mSelectedFeatureIds );
536 .setFilterRect( rect )
546 if ( mSelectedFeatureIds.contains( fet.
id() ) )
548 deselectIds << fet.
id();
552 selectIds << fet.
id();
561 if ( mSelectedFeatureIds.size() == 0 )
569 return mDataProvider;
574 return mDataProvider;
579 if ( mDataProvider && mDataProvider->
encoding() != encoding )
588 delete mDiagramRenderer;
589 mDiagramRenderer = r;
626 QgsDebugMsg( QString(
"Data Provider Geometry type is not recognised, is %1" ).arg( type ) );
638 QgsDebugMsg(
"WARNING: This code should never be reached. Problems may occur..." );
656 if ( mSelectedFeatureIds.size() == 0 )
687 if ( mSelectedFeatureIds.contains( fet.
id() ) )
698 if ( retval.
width() == 0.0 || retval.
height() == 0.0 )
707 retval.
set( -1.0, -1.0, 1.0, 1.0 );
716 if ( !mDataProvider )
727 if ( !mSymbolFeatureCounted )
return -1;
728 return mSymbolFeatureCountMap.value( symbol );
733 if ( mSymbolFeatureCounted )
return true;
734 mSymbolFeatureCountMap.clear();
736 if ( !mDataProvider )
748 QgsLegendSymbolList::const_iterator symbolIt = symbolList.constBegin();
750 for ( ; symbolIt != symbolList.constEnd(); ++symbolIt )
752 mSymbolFeatureCountMap.insert( symbolIt->second, 0 );
756 QProgressDialog progressDialog(
tr(
"Updating feature count for layer %1" ).arg(
name() ),
tr(
"Abort" ), 0, nFeatures );
757 progressDialog.setWindowModality( Qt::WindowModal );
758 int featuresCounted = 0;
771 for ( QgsSymbolV2List::iterator symbolIt = featureSymbolList.begin(); symbolIt != featureSymbolList.end(); ++symbolIt )
773 mSymbolFeatureCountMap[*symbolIt] += 1;
779 if ( featuresCounted % 50 == 0 )
781 if ( featuresCounted > nFeatures )
783 progressDialog.setMaximum( 0 );
785 progressDialog.setValue( featuresCounted );
786 if ( progressDialog.wasCanceled() )
788 mSymbolFeatureCountMap.clear();
796 progressDialog.setValue( nFeatures );
797 mSymbolFeatureCounted =
true;
803 mValidExtent =
false;
820 if ( !mValidExtent && mLazyExtent && mDataProvider )
838 if ( !mDataProvider )
857 if ( it->geometry() )
896 if ( ! mDataProvider )
906 if ( ! mDataProvider )
928 double maximumSimplificationScale = mSimplifyMethod.
maximumScale();
931 if ( maximumSimplificationScale > 1 && renderContext.
rendererScale() <= maximumSimplificationScale )
941 if ( !mDataProvider )
950 Q_UNUSED( alsoUpdateExtent );
951 if ( !mEditBuffer || !mDataProvider )
974 QgsDebugMsg( QString(
"feature %1 could not be retrieved" ).arg( f.
id() ) );
982 QgsDebugMsg( QString(
"geometry of feature %1 could not be changed." ).arg( f.
id() ) );
990 for (
int attr = 0; attr < fa.count(); ++attr )
992 if ( fa[attr] != ca[attr] )
996 QgsDebugMsg( QString(
"attribute %1 of feature %2 could not be changed." ).arg( attr ).arg( f.
id() ) );
1008 if ( !mEditBuffer || !mDataProvider )
1012 return utils.
insertVertex( x, y, atFeatureId, beforeVertex );
1018 if ( !mEditBuffer || !mDataProvider )
1022 return utils.
moveVertex( x, y, atFeatureId, atVertex );
1028 if ( !mEditBuffer || !mDataProvider )
1049 int count = mSelectedFeatureIds.size();
1062 *deletedCount = deleted;
1065 return deleted == count;
1070 if ( !mEditBuffer || !mDataProvider )
1079 if ( !mEditBuffer || !mDataProvider )
1084 if ( mSelectedFeatureIds.size() < 1 )
1089 else if ( mSelectedFeatureIds.size() > 1 )
1096 return utils.
addPart( points, *mSelectedFeatureIds.constBegin() );
1102 if ( !mEditBuffer || !mDataProvider )
1111 if ( !mEditBuffer || !mDataProvider )
1115 return utils.
splitParts( splitLine, topologicalEditing );
1120 if ( !mEditBuffer || !mDataProvider )
1124 return utils.
splitFeatures( splitLine, topologicalEditing );
1132 int returnValue = 0;
1145 .setFilterRect( geomBBox )
1152 if ( ignoreFeatures.contains( f.
id() ) )
1173 if ( !mEditBuffer || !mDataProvider )
1182 if ( !mEditBuffer || !mDataProvider )
1211 if ( !mDataProvider )
1279 QDomNode pkeyNode = layer_node.namedItem(
"provider" );
1281 if ( pkeyNode.isNull() )
1287 QDomElement pkeyElt = pkeyNode.toElement();
1288 mProviderKey = pkeyElt.text();
1292 if ( ! mProviderKey.isNull() )
1299 mProviderKey =
"postgres";
1303 mProviderKey =
"ogr";
1306 if ( ! setDataProvider( mProviderKey ) )
1311 QDomElement pkeyElem = pkeyNode.toElement();
1312 if ( !pkeyElem.isNull() )
1314 QString encodingString = pkeyElem.attribute(
"encoding" );
1315 if ( !encodingString.isEmpty() )
1325 connect( mJoinBuffer, SIGNAL( joinedFieldsChanged() ),
this, SLOT( onJoinedFieldsChanged() ) );
1327 mJoinBuffer->
readXml( layer_node );
1329 if ( !mExpressionFieldBuffer )
1331 mExpressionFieldBuffer->
readXml( layer_node );
1336 QDomNode prevExpNode = layer_node.namedItem(
"previewExpression" );
1338 if ( prevExpNode.isNull() )
1340 mDisplayExpression =
"";
1344 QDomElement prevExpElem = prevExpNode.toElement();
1345 mDisplayExpression = prevExpElem.text();
1363 bool QgsVectorLayer::setDataProvider( QString
const & provider )
1368 mProviderKey = provider;
1376 if ( mDataProvider )
1378 QgsDebugMsg(
"Instantiated the data provider plugin" );
1384 connect( mDataProvider, SIGNAL( fullExtentCalculated() ),
this, SLOT(
updateExtents() ) );
1390 connect( mJoinBuffer, SIGNAL( joinedFieldsChanged() ),
this, SLOT( onJoinedFieldsChanged() ) );
1398 if ( mProviderKey ==
"postgres" )
1403 QRegExp reg(
"\"[^\"]+\"\\.\"([^\"]+)\"( \\([^)]+\\))?" );
1404 if ( reg.indexIn(
name() ) >= 0 )
1406 QStringList stuff = reg.capturedTexts();
1407 QString lName = stuff[1];
1411 QMap<QString, QgsMapLayer*>::const_iterator it;
1412 for ( it = layers.constBegin(); it != layers.constEnd() && ( *it )->name() != lName; ++it )
1415 if ( it != layers.constEnd() && stuff.size() > 2 )
1417 lName +=
"." + stuff[2].mid( 2, stuff[2].length() - 3 );
1420 if ( !lName.isEmpty() )
1429 else if ( mProviderKey ==
"osm" )
1434 else if ( provider ==
"ogr" )
1467 QDomDocument & document )
1471 QDomElement mapLayerNode = layer_node.toElement();
1473 if ( mapLayerNode.isNull() || (
"maplayer" != mapLayerNode.nodeName() ) )
1479 mapLayerNode.setAttribute(
"type",
"vector" );
1485 if ( mDataProvider )
1487 QDomElement provider = document.createElement(
"provider" );
1488 provider.setAttribute(
"encoding", mDataProvider->
encoding() );
1489 QDomText providerText = document.createTextNode(
providerType() );
1490 provider.appendChild( providerText );
1491 layer_node.appendChild( provider );
1495 QDomElement prevExpElem = document.createElement(
"previewExpression" );
1496 QDomText prevExpText = document.createTextNode( mDisplayExpression );
1497 prevExpElem.appendChild( prevExpText );
1498 layer_node.appendChild( prevExpElem );
1501 mJoinBuffer->
writeXml( layer_node, document );
1504 mExpressionFieldBuffer->
writeXml( layer_node, document );
1521 if ( !rendererElement.isNull() )
1539 QDomNode displayFieldNode = node.namedItem(
"displayfield" );
1540 if ( !displayFieldNode.isNull() )
1542 QDomElement e = displayFieldNode.toElement();
1547 QDomNode blendModeNode = node.namedItem(
"blendMode" );
1548 if ( !blendModeNode.isNull() )
1550 QDomElement e = blendModeNode.toElement();
1555 QDomNode featureBlendModeNode = node.namedItem(
"featureBlendMode" );
1556 if ( !featureBlendModeNode.isNull() )
1558 QDomElement e = featureBlendModeNode.toElement();
1563 QDomNode layerTransparencyNode = node.namedItem(
"layerTransparency" );
1564 if ( !layerTransparencyNode.isNull() )
1566 QDomElement e = layerTransparencyNode.toElement();
1571 QDomElement e = node.toElement();
1575 mLabel->
setMinScale( e.attribute(
"minLabelScale",
"1" ).toFloat() );
1576 mLabel->
setMaxScale( e.attribute(
"maxLabelScale",
"100000000" ).toFloat() );
1580 mSimplifyMethod.
setSimplifyHints(( QgsVectorSimplifyMethod::SimplifyHints ) e.attribute(
"simplifyDrawingHints",
"1" ).toInt() );
1581 mSimplifyMethod.
setThreshold( e.attribute(
"simplifyDrawingTol",
"1" ).toFloat() );
1583 mSimplifyMethod.
setMaximumScale( e.attribute(
"simplifyMaxScale",
"1" ).toFloat() );
1589 QDomNode labelnode = node.namedItem(
"label" );
1590 QDomElement element = labelnode.toElement();
1592 if ( hasLabelsEnabled < 1 )
1601 QDomNode labelattributesnode = node.namedItem(
"labelattributes" );
1603 if ( !labelattributesnode.isNull() && mLabel )
1606 mLabel->
readXML( labelattributesnode );
1610 delete mDiagramRenderer; mDiagramRenderer = 0;
1611 QDomElement singleCatDiagramElem = node.firstChildElement(
"SingleCategoryDiagramRenderer" );
1612 if ( !singleCatDiagramElem.isNull() )
1615 mDiagramRenderer->
readXML( singleCatDiagramElem,
this );
1617 QDomElement linearDiagramElem = node.firstChildElement(
"LinearlyInterpolatedDiagramRenderer" );
1618 if ( !linearDiagramElem.isNull() )
1621 mDiagramRenderer->
readXML( linearDiagramElem,
this );
1624 if ( mDiagramRenderer )
1626 QDomElement diagramSettingsElem = node.firstChildElement(
"DiagramLayerSettings" );
1627 if ( !diagramSettingsElem.isNull() )
1630 mDiagramLayerSettings->
readXML( diagramSettingsElem,
this );
1639 QDomNode editFormNode = node.namedItem(
"editform" );
1640 if ( !editFormNode.isNull() )
1642 QDomElement e = editFormNode.toElement();
1646 QDomNode editFormInitNode = node.namedItem(
"editforminit" );
1647 if ( !editFormInitNode.isNull() )
1649 mEditFormInit = editFormInitNode.toElement().text();
1652 QDomNode fFSuppNode = node.namedItem(
"featformsuppress" );
1653 if ( fFSuppNode.isNull() )
1659 QDomElement e = fFSuppNode.toElement();
1663 QDomNode annotationFormNode = node.namedItem(
"annotationform" );
1664 if ( !annotationFormNode.isNull() )
1666 QDomElement e = annotationFormNode.toElement();
1670 mAttributeAliasMap.clear();
1671 QDomNode aliasesNode = node.namedItem(
"aliases" );
1672 if ( !aliasesNode.isNull() )
1674 QDomElement aliasElem;
1676 QDomNodeList aliasNodeList = aliasesNode.toElement().elementsByTagName(
"alias" );
1677 for (
int i = 0; i < aliasNodeList.size(); ++i )
1679 aliasElem = aliasNodeList.at( i ).toElement();
1682 if ( aliasElem.hasAttribute(
"field" ) )
1684 field = aliasElem.attribute(
"field" );
1688 int index = aliasElem.attribute(
"index" ).toInt();
1694 mAttributeAliasMap.insert( field, aliasElem.attribute(
"name" ) );
1699 QDomNode editorLayoutNode = node.namedItem(
"editorlayout" );
1700 if ( editorLayoutNode.isNull() )
1706 if ( editorLayoutNode.toElement().text() ==
"uifilelayout" )
1710 else if ( editorLayoutNode.toElement().text() ==
"tablayout" )
1721 mExcludeAttributesWMS.clear();
1722 QDomNode excludeWMSNode = node.namedItem(
"excludeAttributesWMS" );
1723 if ( !excludeWMSNode.isNull() )
1725 QDomNodeList attributeNodeList = excludeWMSNode.toElement().elementsByTagName(
"attribute" );
1726 for (
int i = 0; i < attributeNodeList.size(); ++i )
1728 mExcludeAttributesWMS.insert( attributeNodeList.at( i ).toElement().text() );
1732 mExcludeAttributesWFS.clear();
1733 QDomNode excludeWFSNode = node.namedItem(
"excludeAttributesWFS" );
1734 if ( !excludeWFSNode.isNull() )
1736 QDomNodeList attributeNodeList = excludeWFSNode.toElement().elementsByTagName(
"attribute" );
1737 for (
int i = 0; i < attributeNodeList.size(); ++i )
1739 mExcludeAttributesWFS.insert( attributeNodeList.at( i ).toElement().text() );
1744 mAttributeEditorElements.clear();
1745 QDomNode attributeEditorFormNode = node.namedItem(
"attributeEditorForm" );
1746 QDomNodeList attributeEditorFormNodeList = attributeEditorFormNode.toElement().childNodes();
1748 for (
int i = 0; i < attributeEditorFormNodeList.size(); i++ )
1750 QDomElement elem = attributeEditorFormNodeList.at( i ).toElement();
1753 mAttributeEditorElements.append( attributeEditorWidget );
1763 if ( elem.tagName() ==
"attributeEditorContainer" )
1767 QDomNodeList childNodeList = elem.childNodes();
1769 for (
int i = 0; i < childNodeList.size(); i++ )
1771 QDomElement childElem = childNodeList.at( i ).toElement();
1777 newElement = container;
1779 else if ( elem.tagName() ==
"attributeEditorField" )
1781 QString
name = elem.attribute(
"name" );
1785 else if ( elem.tagName() ==
"attributeEditorRelation" )
1789 QString
name = elem.attribute(
"name" );
1797 QDomElement mapLayerNode = node.toElement();
1803 QDomElement rendererElement = mRendererV2->
save( doc );
1804 node.appendChild( rendererElement );
1809 mapLayerNode.setAttribute(
"scaleBasedLabelVisibilityFlag", mLabel->
scaleBasedVisibility() ? 1 : 0 );
1810 mapLayerNode.setAttribute(
"minLabelScale", QString::number( mLabel->
minScale() ) );
1811 mapLayerNode.setAttribute(
"maxLabelScale", QString::number( mLabel->
maxScale() ) );
1815 mapLayerNode.setAttribute(
"simplifyDrawingHints", QString::number( mSimplifyMethod.
simplifyHints() ) );
1816 mapLayerNode.setAttribute(
"simplifyDrawingTol", QString::number( mSimplifyMethod.
threshold() ) );
1818 mapLayerNode.setAttribute(
"simplifyMaxScale", QString::number( mSimplifyMethod.
maximumScale() ) );
1824 QDomElement blendModeElem = doc.createElement(
"blendMode" );
1826 blendModeElem.appendChild( blendModeText );
1827 node.appendChild( blendModeElem );
1830 QDomElement featureBlendModeElem = doc.createElement(
"featureBlendMode" );
1832 featureBlendModeElem.appendChild( featureBlendModeText );
1833 node.appendChild( featureBlendModeElem );
1836 QDomElement layerTransparencyElem = doc.createElement(
"layerTransparency" );
1837 QDomText layerTransparencyText = doc.createTextNode( QString::number(
layerTransparency() ) );
1838 layerTransparencyElem.appendChild( layerTransparencyText );
1839 node.appendChild( layerTransparencyElem );
1842 QDomElement dField = doc.createElement(
"displayfield" );
1843 QDomText dFieldText = doc.createTextNode(
displayField() );
1844 dField.appendChild( dFieldText );
1845 node.appendChild( dField );
1848 QDomElement labelElem = doc.createElement(
"label" );
1849 QDomText labelText = doc.createTextNode(
"" );
1853 labelText.setData(
"1" );
1857 labelText.setData(
"0" );
1859 labelElem.appendChild( labelText );
1861 node.appendChild( labelElem );
1868 if ( fieldname !=
"" )
1870 dField = doc.createElement(
"labelfield" );
1871 dFieldText = doc.createTextNode( fieldname );
1872 dField.appendChild( dFieldText );
1873 node.appendChild( dField );
1879 if ( mDiagramRenderer )
1881 mDiagramRenderer->
writeXML( mapLayerNode, doc,
this );
1882 if ( mDiagramLayerSettings )
1883 mDiagramLayerSettings->
writeXML( mapLayerNode, doc,
this );
1894 QDomElement efField = doc.createElement(
"editform" );
1896 efField.appendChild( efText );
1897 node.appendChild( efField );
1899 QDomElement efiField = doc.createElement(
"editforminit" );
1900 if ( !mEditFormInit.isEmpty() )
1901 efiField.appendChild( doc.createTextNode( mEditFormInit ) );
1902 node.appendChild( efiField );
1904 QDomElement fFSuppElem = doc.createElement(
"featformsuppress" );
1906 fFSuppElem.appendChild( fFSuppText );
1907 node.appendChild( fFSuppElem );
1909 QDomElement afField = doc.createElement(
"annotationform" );
1911 afField.appendChild( afText );
1912 node.appendChild( afField );
1915 QDomElement editorLayoutElem = doc.createElement(
"editorlayout" );
1916 switch ( mEditorLayout )
1919 editorLayoutElem.appendChild( doc.createTextNode(
"uifilelayout" ) );
1923 editorLayoutElem.appendChild( doc.createTextNode(
"tablayout" ) );
1928 editorLayoutElem.appendChild( doc.createTextNode(
"generatedlayout" ) );
1932 node.appendChild( editorLayoutElem );
1935 if ( mAttributeAliasMap.size() > 0 )
1937 QDomElement aliasElem = doc.createElement(
"aliases" );
1938 QMap<QString, QString>::const_iterator a_it = mAttributeAliasMap.constBegin();
1939 for ( ; a_it != mAttributeAliasMap.constEnd(); ++a_it )
1945 QDomElement aliasEntryElem = doc.createElement(
"alias" );
1946 aliasEntryElem.setAttribute(
"field", a_it.key() );
1947 aliasEntryElem.setAttribute(
"index", idx );
1948 aliasEntryElem.setAttribute(
"name", a_it.value() );
1949 aliasElem.appendChild( aliasEntryElem );
1951 node.appendChild( aliasElem );
1955 QDomElement excludeWMSElem = doc.createElement(
"excludeAttributesWMS" );
1956 QSet<QString>::const_iterator attWMSIt = mExcludeAttributesWMS.constBegin();
1957 for ( ; attWMSIt != mExcludeAttributesWMS.constEnd(); ++attWMSIt )
1959 QDomElement attrElem = doc.createElement(
"attribute" );
1960 QDomText attrText = doc.createTextNode( *attWMSIt );
1961 attrElem.appendChild( attrText );
1962 excludeWMSElem.appendChild( attrElem );
1964 node.appendChild( excludeWMSElem );
1967 QDomElement excludeWFSElem = doc.createElement(
"excludeAttributesWFS" );
1968 QSet<QString>::const_iterator attWFSIt = mExcludeAttributesWFS.constBegin();
1969 for ( ; attWFSIt != mExcludeAttributesWFS.constEnd(); ++attWFSIt )
1971 QDomElement attrElem = doc.createElement(
"attribute" );
1972 QDomText attrText = doc.createTextNode( *attWFSIt );
1973 attrElem.appendChild( attrText );
1974 excludeWFSElem.appendChild( attrElem );
1976 node.appendChild( excludeWFSElem );
1979 if ( mAttributeEditorElements.size() > 0 )
1981 QDomElement tabsElem = doc.createElement(
"attributeEditorForm" );
1983 for ( QList< QgsAttributeEditorElement* >::const_iterator it = mAttributeEditorElements.begin(); it != mAttributeEditorElements.end(); ++it )
1985 QDomElement attributeEditorWidgetElem = ( *it )->toDomElement( doc );
1986 tabsElem.appendChild( attributeEditorWidgetElem );
1989 node.appendChild( tabsElem );
2001 QDomElement nameElem = node.firstChildElement(
"Name" );
2002 if ( nameElem.isNull() )
2004 errorMessage =
"Warning: Name element not found within NamedLayer while it's required.";
2016 readSldLabeling( node );
2024 Q_UNUSED( errorMessage );
2027 QDomElement nameNode = doc.createElement(
"se:Name" );
2028 nameNode.appendChild( doc.createTextNode(
name() ) );
2029 node.appendChild( nameNode );
2033 node.appendChild( mRendererV2->
writeSld( doc,
name() ) );
2041 if ( !mEditBuffer || !mDataProvider )
2054 Q_UNUSED( emitSignal );
2060 if ( !mEditBuffer || !mDataProvider )
2068 if ( !mEditBuffer || !mDataProvider )
2080 if ( mAttributeAliasMap.contains( name ) )
2082 mAttributeAliasMap.remove( name );
2094 mAttributeAliasMap.insert( name, aliasString );
2100 mAttributeEditorElements.append( data );
2105 if ( fieldIdx < 0 || fieldIdx >= mUpdatedFields.
count() )
2108 return mEditorWidgetV2Types.value( mUpdatedFields[fieldIdx].
name(),
"TextEdit" );
2113 return mEditorWidgetV2Types.value( fieldName,
"TextEdit" );
2118 return mEditorWidgetV2Configs.value( mUpdatedFields[fieldIdx].
name() );
2123 return mEditorWidgetV2Configs.value( fieldName );
2128 if ( attributeIndex < 0 || attributeIndex >=
pendingFields().count() )
2133 return mAttributeAliasMap.value( name,
"" );
2139 if ( displayName.isEmpty() )
2142 if ( attributeIndex >= 0 && attributeIndex < fields.
count() )
2144 displayName = fields[attributeIndex].name();
2161 if ( !mEditBuffer || !mDataProvider )
2169 bool deleted =
false;
2172 attrs = attrs.toSet().toList();
2174 qSort( attrs.begin(), attrs.end(), qGreater<int>() );
2176 Q_FOREACH (
int attr, attrs )
2194 mSelectedFeatureIds.remove( fid );
2203 return mUpdatedFields;
2216 for (
int i = 0; i < mUpdatedFields.
count(); ++i )
2220 pkAttributesList << i;
2223 return pkAttributesList;
2234 mCommitErrors.clear();
2236 if ( !mDataProvider )
2238 mCommitErrors <<
tr(
"ERROR: no provider" );
2244 mCommitErrors <<
tr(
"ERROR: layer not editable" );
2279 return mCommitErrors;
2321 QgsFeatureIds deselectedFeatures = mSelectedFeatureIds - ids;
2323 mSelectedFeatureIds = ids;
2330 return mSelectedFeatureIds.size();
2335 return mSelectedFeatureIds;
2343 if ( mSelectedFeatureIds.count() <= 8 )
2347 foreach (
int fid, mSelectedFeatureIds )
2359 features.push_back( f );
2368 if ( mSelectedFeatureIds.count() == 0 )
2374 if ( mSelectedFeatureIds.count() == 1 )
2375 request.
setFilterFid( *mSelectedFeatureIds.constBegin() );
2384 if ( !mEditBuffer || !mDataProvider )
2393 for ( QgsFeatureList::iterator iter = features.begin(); iter != features.end(); ++iter )
2410 QMultiMap<double, QgsSnappingResult> snapResults;
2418 if ( snapResults.size() < 1 )
2423 QMultiMap<double, QgsSnappingResult>::const_iterator snap_it = snapResults.constBegin();
2424 point.
setX( snap_it.value().snappedVertex.x() );
2425 point.
setY( snap_it.value().snappedVertex.y() );
2431 QMultiMap<double, QgsSnappingResult>& snappingResults,
2437 if ( snappingTolerance <= 0 || !mDataProvider )
2442 QList<QgsFeature> featureList;
2443 QgsRectangle searchRect( startPoint.
x() - snappingTolerance, startPoint.
y() - snappingTolerance,
2444 startPoint.
x() + snappingTolerance, startPoint.
y() + snappingTolerance );
2445 double sqrSnappingTolerance = snappingTolerance * snappingTolerance;
2453 for ( QgsGeometryMap::iterator it = cachedGeometries.begin(); it != cachedGeometries.end() ; ++it )
2458 snapToGeometry( startPoint, it.key(), g, sqrSnappingTolerance, snappingResults, snap_to );
2468 .setFilterRect( searchRect )
2474 snapToGeometry( startPoint, f.
id(), f.
geometry(), sqrSnappingTolerance, snappingResults, snap_to );
2479 return n == 0 ? 2 : 0;
2482 void QgsVectorLayer::snapToGeometry(
const QgsPoint& startPoint,
2485 double sqrSnappingTolerance,
2486 QMultiMap<double, QgsSnappingResult>& snappingResults,
2494 int atVertex, beforeVertex, afterVertex;
2495 double sqrDistVertexSnap, sqrDistSegmentSnap;
2502 snappedPoint = geom->
closestVertex( startPoint, atVertex, beforeVertex, afterVertex, sqrDistVertexSnap );
2503 if ( sqrDistVertexSnap < sqrSnappingTolerance )
2508 if ( beforeVertex != -1 )
2513 if ( afterVertex != -1 )
2518 snappingResultVertex.
layer =
this;
2519 snappingResults.insert( sqrt( sqrDistVertexSnap ), snappingResultVertex );
2527 sqrDistSegmentSnap = geom->
closestSegmentWithContext( startPoint, snappedPoint, afterVertex, NULL,
crs().geographicFlag() ? 1e-12 : 1e-8 );
2529 if ( sqrDistSegmentSnap < sqrSnappingTolerance )
2538 snappingResultSegment.
layer =
this;
2539 snappingResults.insert( sqrt( sqrDistSegmentSnap ), snappingResultSegment );
2554 QgsDebugMsg(
"----- Computing Coordinate System" );
2575 return mDisplayField;
2585 return mDisplayExpression;
2590 return ( mEditBuffer && mDataProvider );
2601 if ( readonly && mEditBuffer )
2604 mReadOnly = readonly;
2611 return mEditBuffer && mEditBuffer->
isModified();
2635 return mEditorLayout;
2645 mEditorWidgetV2Types[ mUpdatedFields[ attrIdx ].name()] = widgetType;
2650 mEditorWidgetV2Configs[ mUpdatedFields[ attrIdx ].name()] = config;
2660 if ( ui.isEmpty() || ui.isNull() )
2673 mAnnotationForm = ui;
2678 return mEditFormInit;
2683 mEditFormInit =
function;
2709 return QSize( cfg.value(
"Width" ).toInt(), cfg.value(
"Height" ).toInt() );
2715 if ( idx >= 0 && idx < fields.
count() )
2720 return mFieldEditables.value( fields[idx].
name(),
true );
2729 if ( idx >= 0 && idx < fields.
count() )
2730 return mLabelOnTop.value( fields[idx].name(), false );
2738 if ( idx >= 0 && idx < fields.
count() )
2739 mFieldEditables[ fields[idx].
name()] = editable;
2745 if ( idx >= 0 && idx < fields.
count() )
2746 mLabelOnTop[ fields[idx].
name()] = onTop;
2759 if ( r != mRendererV2 )
2763 mSymbolFeatureCounted =
false;
2764 mSymbolFeatureCountMap.clear();
2774 if ( !mDataProvider )
2787 if ( !mDataProvider )
2800 if ( !mDataProvider )
2816 cfg[
"CheckedState"] = checked;
2817 cfg[
"UncheckedState"] = unchecked;
2828 return mJoinBuffer->
addJoin( joinInfo );
2864 if ( !mDataProvider )
2869 mUpdatedFields = mDataProvider->
fields();
2879 if ( mExpressionFieldBuffer )
2880 mExpressionFieldBuffer->
updateFields( mUpdatedFields );
2882 if ( oldFields != mUpdatedFields )
2897 uniqueValues.clear();
2898 if ( !mDataProvider )
2907 mDataProvider->
uniqueValues( index, uniqueValues, limit );
2912 Q_FOREACH (
const QVariant& v, uniqueValues )
2914 vals << v.toString();
2918 while ( it.hasNext() && ( limit < 0 || uniqueValues.count() < limit ) )
2921 QVariant v = it.value().value( index );
2924 QString vs = v.toString();
2925 if ( !vals.contains( vs ) )
2938 int sourceLayerIndex;
2954 mDataProvider->
uniqueValues( index, uniqueValues, limit );
2964 .setSubsetOfAttributes( attList ) );
2967 QVariant currentValue;
2968 QHash<QString, QVariant> val;
2972 val.insert( currentValue.toString(), currentValue );
2973 if ( limit >= 0 && val.size() >= limit )
2979 uniqueValues = val.values();
2983 Q_ASSERT_X(
false,
"QgsVectorLayer::uniqueValues()",
"Unknown source of the field!" );
2988 if ( !mDataProvider )
3001 int sourceLayerIndex;
3028 .setSubsetOfAttributes( attList ) );
3032 double currentValue = 0;
3035 currentValue = f.
attribute( index ).toDouble();
3036 if ( currentValue < minimumValue )
3038 minimumValue = currentValue;
3041 return QVariant( minimumValue );
3044 Q_ASSERT_X(
false,
"QgsVectorLayer::minimumValue()",
"Unknown source of the field!" );
3050 if ( !mDataProvider )
3063 int sourceLayerIndex;
3090 .setSubsetOfAttributes( attList ) );
3094 double currentValue = 0;
3097 currentValue = f.
attribute( index ).toDouble();
3098 if ( currentValue > maximumValue )
3100 maximumValue = currentValue;
3103 return QVariant( maximumValue );
3106 Q_ASSERT_X(
false,
"QgsVectorLayer::maximumValue()",
"Unknown source of the field!" );
3120 return mFeatureBlendMode;
3133 return mLayerTransparency;
3138 void QgsVectorLayer::readSldLabeling(
const QDomNode& node )
3140 QDomElement element = node.toElement();
3141 if ( element.isNull() )
3144 QDomElement userStyleElem = element.firstChildElement(
"UserStyle" );
3145 if ( userStyleElem.isNull() )
3147 QgsDebugMsg(
"Info: UserStyle element not found." );
3151 QDomElement featureTypeStyleElem = userStyleElem.firstChildElement(
"FeatureTypeStyle" );
3152 if ( featureTypeStyleElem.isNull() )
3154 QgsDebugMsg(
"Info: FeatureTypeStyle element not found." );
3159 QDomElement ruleElem = featureTypeStyleElem.lastChildElement(
"Rule" );
3160 if ( ruleElem.isNull() )
3167 QDomElement textSymbolizerElem = ruleElem.lastChildElement(
"TextSymbolizer" );
3168 if ( textSymbolizerElem.isNull() )
3170 QgsDebugMsg(
"Info: TextSymbolizer element not found." );
3176 QDomElement labelElem = textSymbolizerElem.firstChildElement(
"Label" );
3177 if ( !labelElem.isNull() )
3179 QDomElement propertyNameElem = labelElem.firstChildElement(
"PropertyName" );
3180 if ( !propertyNameElem.isNull() )
3211 QString labelAttribute = propertyNameElem.text();
3216 if ( fieldIndex == -1 )
3220 if ( !exp.hasEvalError() )
3226 QgsDebugMsg(
"SLD label attribute error: " + exp.evalErrorString() );
3232 QgsDebugMsg(
"Info: PropertyName element not found." );
3243 QDomElement fontElem = textSymbolizerElem.firstChildElement(
"Font" );
3244 if ( !fontElem.isNull() )
3248 QDomElement cssElem = fontElem.firstChildElement(
"CssParameter" );
3249 while ( !cssElem.isNull() )
3251 cssName = cssElem.attribute(
"name",
"not_found" );
3252 if ( cssName !=
"not_found" )
3254 elemText = cssElem.text();
3255 if ( cssName ==
"font-family" )
3259 else if ( cssName ==
"font-style" )
3261 setCustomProperty(
"labeling/fontItalic", ( elemText ==
"italic" ) || ( elemText ==
"Italic" ) );
3263 else if ( cssName ==
"font-size" )
3266 int fontSize = elemText.toInt( &ok );
3272 else if ( cssName ==
"font-weight" )
3274 setCustomProperty(
"labeling/fontBold", ( elemText ==
"bold" ) || ( elemText ==
"Bold" ) );
3276 else if ( cssName ==
"font-underline" )
3278 setCustomProperty(
"labeling/fontUnderline", ( elemText ==
"underline" ) || ( elemText ==
"Underline" ) );
3282 cssElem = cssElem.nextSiblingElement(
"CssParameter" );
3288 if ( textColor.isValid() )
3293 setCustomProperty(
"labeling/textTransp", 100 - (
int )( 100 * textColor.alphaF() ) );
3297 QDomElement haloElem = textSymbolizerElem.firstChildElement(
"Halo" );
3298 if ( !haloElem.isNull() )
3303 QDomElement radiusElem = haloElem.firstChildElement(
"Radius" );
3304 if ( !radiusElem.isNull() )
3307 double bufferSize = radiusElem.text().toDouble( &ok );
3315 if ( bufferColor.isValid() )
3320 setCustomProperty(
"labeling/bufferTransp", 100 - (
int )( 100 * bufferColor.alphaF() ) );
3325 QDomElement labelPlacementElem = textSymbolizerElem.firstChildElement(
"LabelPlacement" );
3326 if ( !labelPlacementElem.isNull() )
3329 QDomElement pointPlacementElem = labelPlacementElem.firstChildElement(
"PointPlacement" );
3330 if ( !pointPlacementElem.isNull() )
3334 QDomElement displacementElem = pointPlacementElem.firstChildElement(
"Displacement" );
3335 if ( !displacementElem.isNull() )
3337 QDomElement displacementXElem = displacementElem.firstChildElement(
"DisplacementX" );
3338 if ( !displacementXElem.isNull() )
3341 double xOffset = displacementXElem.text().toDouble( &ok );
3347 QDomElement displacementYElem = displacementElem.firstChildElement(
"DisplacementY" );
3348 if ( !displacementYElem.isNull() )
3351 double yOffset = displacementYElem.text().toDouble( &ok );
3359 QDomElement rotationElem = pointPlacementElem.firstChildElement(
"Rotation" );
3360 if ( !rotationElem.isNull() )
3363 double rotation = rotationElem.text().toDouble( &ok );
3375 if ( !mDiagramLayerSettings )
3377 *mDiagramLayerSettings = s;
3382 QString myMetadata =
"<html><body>";
3386 myMetadata +=
"<p class=\"subheaderglossy\">";
3387 myMetadata +=
tr(
"General" );
3388 myMetadata +=
"</p>\n";
3393 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Layer comment" ) +
"</p>\n";
3394 myMetadata +=
"<p>";
3396 myMetadata +=
"</p>\n";
3400 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Storage type of this layer" ) +
"</p>\n";
3401 myMetadata +=
"<p>";
3403 myMetadata +=
"</p>\n";
3408 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Description of this provider" ) +
"</p>\n";
3409 myMetadata +=
"<p>";
3411 myMetadata +=
"</p>\n";
3415 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Source for this layer" ) +
"</p>\n";
3416 myMetadata +=
"<p>";
3418 myMetadata +=
"</p>\n";
3432 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Geometry type of the features in this layer" ) +
"</p>\n";
3433 myMetadata +=
"<p>";
3434 myMetadata += typeString;
3435 myMetadata +=
"</p>\n";
3439 if ( !pkAttrList.isEmpty() )
3441 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Primary key attributes" ) +
"</p>\n";
3442 myMetadata +=
"<p>";
3443 foreach (
int idx, pkAttrList )
3447 myMetadata +=
"</p>\n";
3452 myMetadata +=
"<p class=\"glossy\">" +
tr(
"The number of features in this layer" ) +
"</p>\n";
3453 myMetadata +=
"<p>";
3455 myMetadata +=
"</p>\n";
3457 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Editing capabilities of this layer" ) +
"</p>\n";
3458 myMetadata +=
"<p>";
3460 myMetadata +=
"</p>\n";
3465 myMetadata +=
"<p class=\"subheaderglossy\">";
3466 myMetadata +=
tr(
"Extents" );
3467 myMetadata +=
"</p>\n";
3470 myMetadata +=
"<p class=\"glossy\">" +
tr(
"In layer spatial reference system units" ) +
"</p>\n";
3471 myMetadata +=
"<p>";
3484 QString xMin, yMin, xMax, yMax;
3485 double changeoverValue = 99999;
3486 if ( qAbs( myExtent.
xMinimum() ) > changeoverValue )
3488 xMin = QString(
"%1" ).arg( myExtent.
xMinimum(), 0,
'f', 2 );
3492 xMin = QString(
"%1" ).arg( myExtent.
xMinimum() );
3494 if ( qAbs( myExtent.
yMinimum() ) > changeoverValue )
3496 yMin = QString(
"%1" ).arg( myExtent.
yMinimum(), 0,
'f', 2 );
3500 yMin = QString(
"%1" ).arg( myExtent.
yMinimum() );
3502 if ( qAbs( myExtent.
xMaximum() ) > changeoverValue )
3504 xMax = QString(
"%1" ).arg( myExtent.
xMaximum(), 0,
'f', 2 );
3508 xMax = QString(
"%1" ).arg( myExtent.
xMaximum() );
3510 if ( qAbs( myExtent.
yMaximum() ) > changeoverValue )
3512 yMax = QString(
"%1" ).arg( myExtent.
yMaximum(), 0,
'f', 2 );
3516 yMax = QString(
"%1" ).arg( myExtent.
yMaximum() );
3519 myMetadata +=
tr(
"xMin,yMin %1,%2 : xMax,yMax %3,%4" )
3520 .arg( xMin ).arg( yMin ).arg( xMax ).arg( yMax );
3524 myMetadata +=
tr(
"unknown extent" );
3527 myMetadata +=
"</p>\n";
3535 QgsRectangle myProjectedExtent = coordinateTransform->transformBoundingBox(
extent() );
3536 myMetadata +=
"<p class=\"glossy\">" +
tr(
"In project spatial reference system units" ) +
"</p>\n";
3537 myMetadata +=
"<p>";
3538 myMetadata +=
tr(
"xMin,yMin %1,%2 : xMax,yMax %3,%4" )
3539 .arg( myProjectedExtent.
xMinimum() )
3540 .arg( myProjectedExtent.
yMinimum() )
3541 .arg( myProjectedExtent.
xMaximum() )
3542 .arg( myProjectedExtent.
yMaximum() );
3543 myMetadata +=
"</p>\n";
3549 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Layer Spatial Reference System" ) +
"</p>\n";
3550 myMetadata +=
"<p>";
3551 myMetadata +=
crs().
toProj4().replace( QRegExp(
"\"" ),
" \"" );
3552 myMetadata +=
"</p>\n";
3560 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Project (Output) Spatial Reference System" ) +
"</p>\n";
3561 myMetadata +=
"<p>";
3562 myMetadata += coordinateTransform->destCRS().toProj4().replace( QRegExp(
"\"" ),
" \"" );
3563 myMetadata +=
"</p>\n";
3571 myMetadata +=
"<p class=\"glossy\">" +
tr(
"In project spatial reference system units" ) +
"</p>\n";
3572 myMetadata +=
"<p>";
3573 myMetadata +=
tr(
"(Invalid transformation of layer extents)" );
3574 myMetadata +=
"</p>\n";
3582 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Attribute field info" ) +
"</p>\n";
3583 myMetadata +=
"<p>";
3586 myMetadata +=
"<table width=\"100%\">";
3587 myMetadata +=
"<tr><th>";
3588 myMetadata +=
tr(
"Field" );
3589 myMetadata +=
"</th>";
3590 myMetadata +=
"<th>";
3591 myMetadata +=
tr(
"Type" );
3592 myMetadata +=
"</th>";
3593 myMetadata +=
"<th>";
3594 myMetadata +=
tr(
"Length" );
3595 myMetadata +=
"</th>";
3596 myMetadata +=
"<th>";
3597 myMetadata +=
tr(
"Precision" );
3598 myMetadata +=
"</th>";
3599 myMetadata +=
"<th>";
3600 myMetadata +=
tr(
"Comment" );
3601 myMetadata +=
"</th>";
3605 for (
int i = 0, n = myFields.
size(); i < n; ++i )
3607 const QgsField& myField = fields[i];
3609 myMetadata +=
"<tr><td>";
3610 myMetadata += myField.
name();
3611 myMetadata +=
"</td>";
3612 myMetadata +=
"<td>";
3614 myMetadata +=
"</td>";
3615 myMetadata +=
"<td>";
3616 myMetadata += QString(
"%1" ).arg( myField.
length() );
3617 myMetadata +=
"</td>";
3618 myMetadata +=
"<td>";
3619 myMetadata += QString(
"%1" ).arg( myField.
precision() );
3620 myMetadata +=
"</td>";
3621 myMetadata +=
"<td>";
3622 myMetadata += QString(
"%1" ).arg( myField.
comment() );
3623 myMetadata +=
"</td></tr>";
3627 myMetadata +=
"</table>";
3630 myMetadata +=
"</body></html>";
3636 mSymbolFeatureCounted =
false;
3639 void QgsVectorLayer::onRelationsLoaded()
3662 void QgsVectorLayer::onJoinedFieldsChanged()
3675 cfg.value(
"Key" ).toString(),
3676 cfg.value(
"Value" ).toString(),
3677 cfg.value(
"AllowNull" ).toBool(),
3678 cfg.value(
"OrderByValue" ).toBool(),
3679 cfg.value(
"AllowMulti" ).toBool(),
3680 cfg.value(
"FilterExpression" ).toString()
3696 return mAttributeEditorElements;
3701 mAttributeEditorElements.clear();
3706 QDomElement elem = doc.createElement(
"attributeEditorContainer" );
3707 elem.setAttribute(
"name",
mName );
3718 mChildren.append( widget );
3723 QList<QgsAttributeEditorElement*> results;
3729 results.append( elem );
3745 QDomElement elem = doc.createElement(
"attributeEditorField" );
3746 elem.setAttribute(
"name",
mName );
3747 elem.setAttribute(
"index", mIdx );
3757 msgError =
QObject::tr(
"Unable to load %1 provider" ).arg( mProviderKey );
3762 if ( !listStylesExternalMethod )
3765 msgError =
QObject::tr(
"Provider %1 has no %2 method" ).arg( mProviderKey ).arg(
"listStyles" );
3769 return listStylesExternalMethod(
mDataSource, ids, names, descriptions, msgError );
3778 msgError =
QObject::tr(
"Unable to load %1 provider" ).arg( mProviderKey );
3783 if ( !getStyleByIdMethod )
3786 msgError =
QObject::tr(
"Provider %1 has no %2 method" ).arg( mProviderKey ).arg(
"getStyleById" );
3790 return getStyleByIdMethod(
mDataSource, styleId, msgError );
3795 bool useAsDefault, QString uiFileContent, QString &msgError )
3798 QString sldStyle, qmlStyle;
3803 msgError =
QObject::tr(
"Unable to load %1 provider" ).arg( mProviderKey );
3808 if ( !saveStyleExternalMethod )
3811 msgError =
QObject::tr(
"Provider %1 has no %2 method" ).arg( mProviderKey ).arg(
"saveStyle" );
3815 QDomDocument qmlDocument, sldDocument;
3817 if ( !msgError.isNull() )
3821 qmlStyle = qmlDocument.toString();
3824 if ( !msgError.isNull() )
3828 sldStyle = sldDocument.toString();
3830 saveStyleExternalMethod(
mDataSource, qmlStyle, sldStyle, name,
3831 description, uiFileContent, useAsDefault, msgError );
3844 if ( !loadFromLocalDB && !dsUri.
database().isEmpty() )
3851 if ( loadStyleExternalMethod )
3853 QString qml, errorMsg;
3854 qml = loadStyleExternalMethod(
mDataSource, errorMsg );
3855 if ( !qml.isEmpty() )
3869 QDomDocument myDocument(
"qgis" );
3870 myDocument.setContent( namedStyle );
3878 QDomElement elem = doc.createElement(
"attributeEditorRelation" );
3879 elem.setAttribute(
"name",
mName );
3880 elem.setAttribute(
"relation", mRelation.
id() );
3886 mRelation = relationManager->
relation( mRelationId );