28 #include <QPainterPath>
30 #include <QProgressDialog>
77 #ifdef TESTPROVIDERLIB
83 const QString& qmlStyle,
84 const QString& sldStyle,
85 const QString& styleName,
86 const QString& styleDescription,
87 const QString& uiFileContent,
101 QStringList &descriptions,
115 bool loadDefaultStyleFlag )
116 :
QgsMapLayer( VectorLayer, baseName, vectorLayerPath )
117 , mUpdateThreshold( 0 )
118 , mDataProvider( NULL )
119 , mProviderKey( providerKey )
121 , mRendererV2( NULL )
124 , mLabelFontNotFoundNotified( false )
125 , mFeatureBlendMode( QPainter::CompositionMode_SourceOver )
126 , mLayerTransparency( 0 )
127 , mVertexMarkerOnlyForSelection( false )
131 , mDiagramRenderer( 0 )
132 , mDiagramLayerSettings( 0 )
133 , mValidExtent( false )
134 , mSymbolFeatureCounted( false )
135 , mCurrentRendererContext( 0 )
152 bool defaultLoadedFlag =
false;
153 if ( loadDefaultStyleFlag )
249 QString idxName =
"";
252 if ( !fldName.isEmpty() )
259 int fieldsSize = fields.
size();
261 for (
int idx = 0; idx < fields.
count(); ++idx )
263 QString fldName = fields[idx].name();
264 QgsDebugMsg(
"Checking field " + fldName +
" of " + QString::number( fieldsSize ) +
" total" );
270 if ( fldName.indexOf(
"name", 0, Qt::CaseInsensitive ) > -1 )
272 if ( idxName.isEmpty() )
277 if ( fldName.indexOf(
"descrip", 0, Qt::CaseInsensitive ) > -1 )
279 if ( idxName.isEmpty() )
284 if ( fldName.indexOf(
"id", 0, Qt::CaseInsensitive ) > -1 )
286 if ( idxId.isEmpty() )
294 if ( fieldsSize == 0 )
297 if ( idxName.length() > 0 )
303 if ( idxId.length() > 0 )
335 attributes.append( attrNum );
343 QgsDebugMsg(
"Selecting features based on view extent" );
352 .setFilterRect( rendererContext.
extent() )
353 .setSubsetOfAttributes( attributes ) );
377 QgsDebugMsg( QString(
"Total features processed %1" ).arg( featureCount ) );
396 bool vertexMarkerOnlyForSelection = settings.value(
"/qgis/digitizing/marker_only_for_selected",
false ).toBool();
410 #ifndef Q_WS_MAC //MH: disable this on Mac for now to avoid problems with resizing
419 qApp->processEvents();
421 else if ( featureCount % 1000 == 0 )
424 qApp->processEvents();
437 bool drawMarker = (
mEditBuffer && ( !vertexMarkerOnlyForSelection || sel ) );
464 QgsDebugMsg( QString(
"Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
465 .arg( fet.
id() ).arg( cse.
what() ) );
477 QgsDebugMsg( QString(
"Total features processed %1" ).arg( featureCount ) );
486 QHash< QgsSymbolV2*, QList<QgsFeature> > features;
489 bool vertexMarkerOnlyForSelection = settings.value(
"/qgis/digitizing/marker_only_for_selected",
false ).toBool();
516 if ( featureCount % 1000 == 0 )
518 qApp->processEvents();
527 if ( !features.contains( sym ) )
529 features.insert( sym, QList<QgsFeature>() );
531 features[sym].append( fet );
559 for (
int i = 0; i < symbols.count(); i++ )
565 if ( level < 0 || level >= 1000 )
568 while ( level >= levels.count() )
570 levels[level].append( item );
575 for (
int l = 0; l < levels.count(); l++ )
578 for (
int i = 0; i < level.count(); i++ )
581 if ( !features.contains( item.
symbol() ) )
586 int layer = item.
layer();
587 QList<QgsFeature>& lst = features[item.
symbol()];
588 QList<QgsFeature>::iterator fit;
592 for ( fit = lst.begin(); fit != lst.end(); ++fit )
600 if ( featureCount % 1000 == 0 )
602 qApp->processEvents();
607 bool drawMarker = (
mEditBuffer && ( !vertexMarkerOnlyForSelection || sel ) );
616 QgsDebugMsg( QString(
"Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
617 .arg( fet.
id() ).arg( cse.
what() ) );
675 attributes.append( attrNum );
676 QgsDebugMsg(
"attrs: " + attrName +
" - " + QString::number( attrNum ) );
679 bool labeling =
false;
687 .setFilterRect( rendererContext.
extent() )
688 .setSubsetOfAttributes( attributes ) );
703 p.setPen( QColor( 50, 100, 120, 200 ) );
704 p.setBrush( QColor( 200, 200, 210, 120 ) );
705 p.drawEllipse( x - m, y - m, m * 2 + 1, m * 2 + 1 );
709 p.setPen( QColor( 255, 0, 0 ) );
710 p.drawLine( x - m, y + m, x + m, y - m );
711 p.drawLine( x - m, y - m, x + m, y + m );
754 .setFilterRect( rect )
766 if ( !addToSelection )
779 if ( intersectingIds.count() > 0 )
781 QgsDebugMsg(
"Trying to select and deselect the same item at the same time. Unsure what to do. Selecting dubious items." );
837 .setFilterRect( rect )
849 deselectIds << fet.
id();
853 selectIds << fet.
id();
932 QgsDebugMsg( QString(
"Data Provider Geometry type is not recognised, is %1" ).arg( type ) );
944 QgsDebugMsg(
"WARNING: This code should never be reached. Problems may occur..." );
1004 if ( retval.
width() == 0.0 || retval.
height() == 0.0 )
1013 retval.
set( -1.0, -1.0, 1.0, 1.0 );
1054 QgsLegendSymbolList::const_iterator symbolIt = symbolList.constBegin();
1056 for ( ; symbolIt != symbolList.constEnd(); ++symbolIt )
1062 QProgressDialog progressDialog(
tr(
"Updating feature count for layer %1" ).arg(
name() ),
tr(
"Abort" ), 0, nFeatures );
1063 progressDialog.setWindowModality( Qt::WindowModal );
1064 int featuresCounted = 0;
1077 for ( QgsSymbolV2List::iterator symbolIt = featureSymbolList.begin(); symbolIt != featureSymbolList.end(); ++symbolIt )
1085 if ( featuresCounted % 50 == 0 )
1087 if ( featuresCounted > nFeatures )
1089 progressDialog.setMaximum( 0 );
1091 progressDialog.setValue( featuresCounted );
1092 if ( progressDialog.wasCanceled() )
1102 progressDialog.setValue( nFeatures );
1148 if ( it->geometry() )
1227 Q_UNUSED( alsoUpdateExtent );
1251 QgsDebugMsg( QString(
"feature %1 could not be retrieved" ).arg( f.
id() ) );
1259 QgsDebugMsg( QString(
"geometry of feature %1 could not be changed." ).arg( f.
id() ) );
1267 for (
int attr = 0; attr < fa.count(); ++attr )
1269 if ( fa[attr] != ca[attr] )
1273 QgsDebugMsg( QString(
"attribute %1 of feature %2 could not be changed." ).arg( attr ).arg( f.
id() ) );
1289 return utils.
insertVertex( x, y, atFeatureId, beforeVertex );
1299 return utils.
moveVertex( x, y, atFeatureId, atVertex );
1389 return utils.
splitFeatures( splitLine, topologicalEditing );
1397 int returnValue = 0;
1410 .setFilterRect( geomBBox )
1417 if ( ignoreFeatures.contains( f.
id() ) )
1524 QDomNode pkeyNode = layer_node.namedItem(
"provider" );
1526 if ( pkeyNode.isNull() )
1532 QDomElement pkeyElt = pkeyNode.toElement();
1556 QDomElement pkeyElem = pkeyNode.toElement();
1557 if ( !pkeyElem.isNull() )
1559 QString encodingString = pkeyElem.attribute(
"encoding" );
1560 if ( !encodingString.isEmpty() )
1576 QDomNode prevExpNode = layer_node.namedItem(
"previewExpression" );
1578 if ( prevExpNode.isNull() )
1584 QDomElement prevExpElem = prevExpNode.toElement();
1614 QgsDebugMsg(
"Instantiated the data provider plugin" );
1648 QRegExp reg(
"\"[^\"]+\"\\.\"([^\"]+)\"( \\([^)]+\\))?" );
1649 if ( reg.indexIn(
name() ) >= 0 )
1651 QStringList stuff = reg.capturedTexts();
1652 QString lName = stuff[1];
1656 QMap<QString, QgsMapLayer*>::const_iterator it;
1657 for ( it = layers.constBegin(); it != layers.constEnd() && ( *it )->name() != lName; it++ )
1660 if ( it != layers.constEnd() && stuff.size() > 2 )
1662 lName +=
"." + stuff[2].mid( 2, stuff[2].length() - 3 );
1665 if ( !lName.isEmpty() )
1679 else if ( provider ==
"ogr" )
1712 QDomDocument & document )
1716 QDomElement mapLayerNode = layer_node.toElement();
1718 if ( mapLayerNode.isNull() || (
"maplayer" != mapLayerNode.nodeName() ) )
1724 mapLayerNode.setAttribute(
"type",
"vector" );
1732 QDomElement provider = document.createElement(
"provider" );
1734 QDomText providerText = document.createTextNode(
providerType() );
1735 provider.appendChild( providerText );
1736 layer_node.appendChild( provider );
1740 QDomElement prevExpElem = document.createElement(
"previewExpression" );
1742 prevExpElem.appendChild( prevExpText );
1743 layer_node.appendChild( prevExpElem );
1755 Q_UNUSED( errorMessage );
1760 if ( !rendererElement.isNull() )
1778 QDomNode displayFieldNode = node.namedItem(
"displayfield" );
1779 if ( !displayFieldNode.isNull() )
1781 QDomElement e = displayFieldNode.toElement();
1786 QDomNode blendModeNode = node.namedItem(
"blendMode" );
1787 if ( !blendModeNode.isNull() )
1789 QDomElement e = blendModeNode.toElement();
1794 QDomNode featureBlendModeNode = node.namedItem(
"featureBlendMode" );
1795 if ( !featureBlendModeNode.isNull() )
1797 QDomElement e = featureBlendModeNode.toElement();
1802 QDomNode layerTransparencyNode = node.namedItem(
"layerTransparency" );
1803 if ( !layerTransparencyNode.isNull() )
1805 QDomElement e = layerTransparencyNode.toElement();
1810 QDomElement e = node.toElement();
1819 QDomNode labelnode = node.namedItem(
"label" );
1820 QDomElement element = labelnode.toElement();
1822 if ( hasLabelsEnabled < 1 )
1831 QDomNode labelattributesnode = node.namedItem(
"labelattributes" );
1833 if ( !labelattributesnode.isNull() )
1841 QDomElement singleCatDiagramElem = node.firstChildElement(
"SingleCategoryDiagramRenderer" );
1842 if ( !singleCatDiagramElem.isNull() )
1847 QDomElement linearDiagramElem = node.firstChildElement(
"LinearlyInterpolatedDiagramRenderer" );
1848 if ( !linearDiagramElem.isNull() )
1856 QDomElement diagramSettingsElem = node.firstChildElement(
"DiagramLayerSettings" );
1857 if ( !diagramSettingsElem.isNull() )
1869 QDomNode editTypesNode = node.namedItem(
"edittypes" );
1870 if ( !editTypesNode.isNull() )
1872 QDomNodeList editTypeNodes = editTypesNode.childNodes();
1874 for (
int i = 0; i < editTypeNodes.size(); i++ )
1876 QDomNode editTypeNode = editTypeNodes.at( i );
1877 QDomElement editTypeElement = editTypeNode.toElement();
1879 QString
name = editTypeElement.attribute(
"name" );
1886 int editable = editTypeElement.attribute(
"editable" ,
"1" ).toInt();
1889 int labelOnTop = editTypeElement.attribute(
"labelontop" ,
"0" ).toInt();
1895 if ( editTypeNode.hasChildNodes() )
1897 mValueMaps.insert( name, QMap<QString, QVariant>() );
1899 QDomNodeList valueMapNodes = editTypeNode.childNodes();
1900 for (
int j = 0; j < valueMapNodes.size(); j++ )
1902 QDomElement value = valueMapNodes.at( j ).toElement();
1903 mValueMaps[
name ].insert( value.attribute(
"key" ), value.attribute(
"value" ) );
1912 QVariant
min = editTypeElement.attribute(
"min" );
1913 QVariant
max = editTypeElement.attribute(
"max" );
1914 QVariant step = editTypeElement.attribute(
"step" );
1921 mCheckedStates[
name ] = QPair<QString, QString>( editTypeElement.attribute(
"checked" ), editTypeElement.attribute(
"unchecked" ) );
1926 QString
id = editTypeElement.attribute(
"layer" );
1927 QString key = editTypeElement.attribute(
"key" );
1928 QString value = editTypeElement.attribute(
"value" );
1929 bool allowNull = editTypeElement.attribute(
"allowNull" ) ==
"true";
1930 bool orderByValue = editTypeElement.attribute(
"orderByValue" ) ==
"true";
1931 bool allowMulti = editTypeElement.attribute(
"allowMulti",
"false" ) ==
"true";
1933 QString filterExpression;
1934 if ( editTypeElement.hasAttribute(
"filterAttributeColumn" ) &&
1935 editTypeElement.hasAttribute(
"filterAttributeValue" ) )
1937 filterExpression = QString(
"\"%1\"='%2'" )
1938 .arg( editTypeElement.attribute(
"filterAttributeColumn" ) )
1939 .arg( editTypeElement.attribute(
"filterAttributeValue" ) );
1943 filterExpression = editTypeElement.attribute(
"filterExpression", QString::null );
1956 mWidgetSize[
name ] = QSize( editTypeElement.attribute(
"widgetWidth" ).toInt(), editTypeElement.attribute(
"widgetHeight" ).toInt() );
1975 QDomNode editFormNode = node.namedItem(
"editform" );
1976 if ( !editFormNode.isNull() )
1978 QDomElement e = editFormNode.toElement();
1982 QDomNode editFormInitNode = node.namedItem(
"editforminit" );
1983 if ( !editFormInitNode.isNull() )
1988 QDomNode annotationFormNode = node.namedItem(
"annotationform" );
1989 if ( !annotationFormNode.isNull() )
1991 QDomElement e = annotationFormNode.toElement();
1996 QDomNode aliasesNode = node.namedItem(
"aliases" );
1997 if ( !aliasesNode.isNull() )
1999 QDomElement aliasElem;
2002 QDomNodeList aliasNodeList = aliasesNode.toElement().elementsByTagName(
"alias" );
2003 for (
int i = 0; i < aliasNodeList.size(); ++i )
2005 aliasElem = aliasNodeList.at( i ).toElement();
2008 if ( aliasElem.hasAttribute(
"field" ) )
2010 field = aliasElem.attribute(
"field" );
2014 int index = aliasElem.attribute(
"index" ).toInt();
2025 QDomNode editorLayoutNode = node.namedItem(
"editorlayout" );
2026 if ( editorLayoutNode.isNull() )
2032 if ( editorLayoutNode.toElement().text() ==
"uifilelayout" )
2036 else if ( editorLayoutNode.toElement().text() ==
"tablayout" )
2048 QDomNode excludeWMSNode = node.namedItem(
"excludeAttributesWMS" );
2049 if ( !excludeWMSNode.isNull() )
2051 QDomNodeList attributeNodeList = excludeWMSNode.toElement().elementsByTagName(
"attribute" );
2052 for (
int i = 0; i < attributeNodeList.size(); ++i )
2059 QDomNode excludeWFSNode = node.namedItem(
"excludeAttributesWFS" );
2060 if ( !excludeWFSNode.isNull() )
2062 QDomNodeList attributeNodeList = excludeWFSNode.toElement().elementsByTagName(
"attribute" );
2063 for (
int i = 0; i < attributeNodeList.size(); ++i )
2071 QDomNode attributeEditorFormNode = node.namedItem(
"attributeEditorForm" );
2072 QDomNodeList attributeEditorFormNodeList = attributeEditorFormNode.toElement().childNodes();
2074 for (
int i = 0; i < attributeEditorFormNodeList.size(); i++ )
2076 QDomElement elem = attributeEditorFormNodeList.at( i ).toElement();
2088 if ( elem.tagName() ==
"attributeEditorContainer" )
2092 QDomNodeList childNodeList = elem.childNodes();
2094 for (
int i = 0; i < childNodeList.size(); i++ )
2096 QDomElement childElem = childNodeList.at( i ).toElement();
2101 newElement = container;
2103 else if ( elem.tagName() ==
"attributeEditorField" )
2105 QString
name = elem.attribute(
"name" );
2115 Q_UNUSED( errorMessage );
2116 QDomElement mapLayerNode = node.toElement();
2121 node.appendChild( rendererElement );
2125 mapLayerNode.setAttribute(
"minLabelScale", QString::number(
mLabel->
minScale() ) );
2126 mapLayerNode.setAttribute(
"maxLabelScale", QString::number(
mLabel->
maxScale() ) );
2132 QDomElement blendModeElem = doc.createElement(
"blendMode" );
2134 blendModeElem.appendChild( blendModeText );
2135 node.appendChild( blendModeElem );
2138 QDomElement featureBlendModeElem = doc.createElement(
"featureBlendMode" );
2140 featureBlendModeElem.appendChild( featureBlendModeText );
2141 node.appendChild( featureBlendModeElem );
2144 QDomElement layerTransparencyElem = doc.createElement(
"layerTransparency" );
2145 QDomText layerTransparencyText = doc.createTextNode( QString::number(
layerTransparency() ) );
2146 layerTransparencyElem.appendChild( layerTransparencyText );
2147 node.appendChild( layerTransparencyElem );
2150 QDomElement dField = doc.createElement(
"displayfield" );
2151 QDomText dFieldText = doc.createTextNode(
displayField() );
2152 dField.appendChild( dFieldText );
2153 node.appendChild( dField );
2156 QDomElement labelElem = doc.createElement(
"label" );
2157 QDomText labelText = doc.createTextNode(
"" );
2161 labelText.setData(
"1" );
2165 labelText.setData(
"0" );
2167 labelElem.appendChild( labelText );
2169 node.appendChild( labelElem );
2174 if ( fieldname !=
"" )
2176 dField = doc.createElement(
"labelfield" );
2177 dFieldText = doc.createTextNode( fieldname );
2178 dField.appendChild( dFieldText );
2179 node.appendChild( dField );
2195 QDomElement editTypesElement = doc.createElement(
"edittypes" );
2197 for ( QMap<QString, EditType>::const_iterator it =
mEditTypes.begin(); it !=
mEditTypes.end(); ++it )
2199 QDomElement editTypeElement = doc.createElement(
"edittype" );
2200 editTypeElement.setAttribute(
"name", it.key() );
2201 editTypeElement.setAttribute(
"type", it.value() );
2202 editTypeElement.setAttribute(
"editable",
mFieldEditables[ it.key()] ? 1 : 0 );
2203 editTypeElement.setAttribute(
"labelontop",
mLabelOnTop[ it.key()] ? 1 : 0 );
2210 const QMap<QString, QVariant> &map =
mValueMaps[ it.key()];
2212 for ( QMap<QString, QVariant>::const_iterator vmit = map.begin(); vmit != map.end(); vmit++ )
2214 QDomElement value = doc.createElement(
"valuepair" );
2215 value.setAttribute(
"key", vmit.key() );
2216 value.setAttribute(
"value", vmit.value().toString() );
2217 editTypeElement.appendChild( value );
2225 if (
mRanges.contains( it.key() ) )
2227 editTypeElement.setAttribute(
"min",
mRanges[ it.key()].mMin.toString() );
2228 editTypeElement.setAttribute(
"max",
mRanges[ it.key()].mMax.toString() );
2229 editTypeElement.setAttribute(
"step",
mRanges[ it.key()].mStep.toString() );
2236 editTypeElement.setAttribute(
"checked",
mCheckedStates[ it.key()].first );
2237 editTypeElement.setAttribute(
"unchecked",
mCheckedStates[ it.key()].second );
2245 editTypeElement.setAttribute(
"layer", data.
mLayer );
2246 editTypeElement.setAttribute(
"key", data.
mKey );
2247 editTypeElement.setAttribute(
"value", data.
mValue );
2248 editTypeElement.setAttribute(
"allowNull", data.
mAllowNull ?
"true" :
"false" );
2249 editTypeElement.setAttribute(
"orderByValue", data.
mOrderByValue ?
"true" :
"false" );
2250 editTypeElement.setAttribute(
"allowMulti", data.
mAllowMulti ?
"true" :
"false" );
2257 editTypeElement.setAttribute(
"dateFormat",
mDateFormats[ it.key()] );
2262 editTypeElement.setAttribute(
"widgetWidth",
mWidgetSize[ it.key()].width() );
2263 editTypeElement.setAttribute(
"widgetHeight",
mWidgetSize[ it.key()].height() );
2280 editTypesElement.appendChild( editTypeElement );
2283 node.appendChild( editTypesElement );
2286 QDomElement efField = doc.createElement(
"editform" );
2288 efField.appendChild( efText );
2289 node.appendChild( efField );
2291 QDomElement efiField = doc.createElement(
"editforminit" );
2293 efiField.appendChild( efiText );
2294 node.appendChild( efiField );
2296 QDomElement afField = doc.createElement(
"annotationform" );
2298 afField.appendChild( afText );
2299 node.appendChild( afField );
2302 QDomElement editorLayoutElem = doc.createElement(
"editorlayout" );
2306 editorLayoutElem.appendChild( doc.createTextNode(
"uifilelayout" ) );
2310 editorLayoutElem.appendChild( doc.createTextNode(
"tablayout" ) );
2315 editorLayoutElem.appendChild( doc.createTextNode(
"generatedlayout" ) );
2319 node.appendChild( editorLayoutElem );
2324 QDomElement aliasElem = doc.createElement(
"aliases" );
2332 QDomElement aliasEntryElem = doc.createElement(
"alias" );
2333 aliasEntryElem.setAttribute(
"field", a_it.key() );
2334 aliasEntryElem.setAttribute(
"index", idx );
2335 aliasEntryElem.setAttribute(
"name", a_it.value() );
2336 aliasElem.appendChild( aliasEntryElem );
2338 node.appendChild( aliasElem );
2342 QDomElement excludeWMSElem = doc.createElement(
"excludeAttributesWMS" );
2346 QDomElement attrElem = doc.createElement(
"attribute" );
2347 QDomText attrText = doc.createTextNode( *attWMSIt );
2348 attrElem.appendChild( attrText );
2349 excludeWMSElem.appendChild( attrElem );
2351 node.appendChild( excludeWMSElem );
2354 QDomElement excludeWFSElem = doc.createElement(
"excludeAttributesWFS" );
2358 QDomElement attrElem = doc.createElement(
"attribute" );
2359 QDomText attrText = doc.createTextNode( *attWFSIt );
2360 attrElem.appendChild( attrText );
2361 excludeWFSElem.appendChild( attrElem );
2363 node.appendChild( excludeWFSElem );
2368 QDomElement tabsElem = doc.createElement(
"attributeEditorForm" );
2372 QDomElement attributeEditorWidgetElem = ( *it )->toDomElement( doc );
2373 tabsElem.appendChild( attributeEditorWidgetElem );
2376 node.appendChild( tabsElem );
2388 QDomElement nameElem = node.firstChildElement(
"Name" );
2389 if ( nameElem.isNull() )
2391 errorMessage =
"Warning: Name element not found within NamedLayer while it's required.";
2408 Q_UNUSED( errorMessage );
2411 QDomElement nameNode = doc.createElement(
"se:Name" );
2412 nameNode.appendChild( doc.createTextNode(
name() ) );
2413 node.appendChild( nameNode );
2438 Q_UNUSED( emitSignal );
2471 if ( attributeIndex < 0 || attributeIndex >=
pendingFields().count() )
2482 if ( displayName.isEmpty() )
2485 if ( attributeIndex >= 0 && attributeIndex < fields.
count() )
2487 displayName = fields[attributeIndex].name();
2503 bool deleted =
false;
2506 attrs = attrs.toSet().toList();
2508 qSort( attrs.begin(), attrs.end(), qGreater<int>() );
2510 foreach (
int attr, attrs )
2557 pkAttributesList << i;
2560 return pkAttributesList;
2710 for ( QgsFeatureList::iterator iter = features.begin(); iter != features.end(); ++iter )
2727 QMultiMap<double, QgsSnappingResult> snapResults;
2735 if ( snapResults.size() < 1 )
2740 QMultiMap<double, QgsSnappingResult>::const_iterator snap_it = snapResults.constBegin();
2741 point.
setX( snap_it.value().snappedVertex.x() );
2742 point.
setY( snap_it.value().snappedVertex.y() );
2748 QMultiMap<double, QgsSnappingResult>& snappingResults,
2759 QList<QgsFeature> featureList;
2760 QgsRectangle searchRect( startPoint.
x() - snappingTolerance, startPoint.
y() - snappingTolerance,
2761 startPoint.
x() + snappingTolerance, startPoint.
y() + snappingTolerance );
2762 double sqrSnappingTolerance = snappingTolerance * snappingTolerance;
2770 for ( QgsGeometryMap::iterator it = cachedGeometries.begin(); it != cachedGeometries.end() ; ++it )
2775 snapToGeometry( startPoint, it.key(), g, sqrSnappingTolerance, snappingResults, snap_to );
2785 .setFilterRect( searchRect )
2796 return n == 0 ? 2 : 0;
2802 double sqrSnappingTolerance,
2803 QMultiMap<double, QgsSnappingResult>& snappingResults,
2811 int atVertex, beforeVertex, afterVertex;
2812 double sqrDistVertexSnap, sqrDistSegmentSnap;
2819 snappedPoint = geom->
closestVertex( startPoint, atVertex, beforeVertex, afterVertex, sqrDistVertexSnap );
2820 if ( sqrDistVertexSnap < sqrSnappingTolerance )
2825 if ( beforeVertex != -1 )
2830 if ( afterVertex != -1 )
2835 snappingResultVertex.
layer =
this;
2836 snappingResults.insert( sqrt( sqrDistVertexSnap ), snappingResultVertex );
2844 sqrDistSegmentSnap = geom->
closestSegmentWithContext( startPoint, snappedPoint, afterVertex, NULL,
crs().geographicFlag() ? 1e-12 : 1e-8 );
2846 if ( sqrDistSegmentSnap < sqrSnappingTolerance )
2855 snappingResultSegment.
layer =
this;
2856 snappingResults.insert( sqrt( sqrDistSegmentSnap ), snappingResultSegment );
2872 QString markerTypeString = settings.value(
"/qgis/digitizing/marker_style",
"Cross" ).toString();
2873 if ( markerTypeString ==
"Cross" )
2877 else if ( markerTypeString ==
"SemiTransparentCircle" )
2890 return settings.value(
"/qgis/digitizing/marker_size", 3 ).toInt();
2897 QgsDebugMsg(
"----- Computing Coordinate System" );
2968 if ( idx >= 0 && idx < fields.
count() )
3012 static QMap< QString, QVariant > invalidMap;
3013 if ( idx < 0 || idx >= fields.
count() )
3015 QgsDebugMsg( QString(
"field %1 not found" ).arg( idx ) );
3018 QString fieldName = fields[idx].name();
3021 mValueMaps[fieldName] = QMap<QString, QVariant>();
3032 if ( idx < 0 || idx >= fields.
count() )
3034 QgsDebugMsg( QString(
"field %1 not found" ).arg( idx ) );
3035 return invalidRange;
3037 QString fieldName = fields[idx].name();
3039 if ( !
mRanges.contains( fieldName ) )
3049 QString fieldName = fields[idx].name();
3061 QString fieldName = fields[idx].name();
3072 if ( idx >= 0 && idx < fields.
count() )
3085 if ( idx >= 0 && idx < fields.
count() )
3086 return mLabelOnTop.value( fields[idx].name(), false );
3094 if ( idx >= 0 && idx < fields.
count() )
3101 if ( idx >= 0 && idx < fields.
count() )
3146 if ( idx >= 0 && idx < fields.
count() )
3156 return QPair<QString, QString>(
"1",
"0" );
3163 for (
int idx = 0; idx < theFields.
count(); ++idx )
3165 if ( QString::compare( theFields[idx].
name(), fieldName, Qt::CaseInsensitive ) == 0 )
3224 uniqueValues.clear();
3238 int sourceLayerIndex;
3261 .setSubsetOfAttributes( attList ) );
3264 QVariant currentValue;
3265 QHash<QString, QVariant> val;
3269 val.insert( currentValue.toString(), currentValue );
3270 if ( limit >= 0 && val.size() >= limit )
3276 uniqueValues = val.values();
3280 Q_ASSERT_X(
false,
"QgsVectorLayer::uniqueValues()",
"Unknown source of the field!" );
3298 int sourceLayerIndex;
3321 .setSubsetOfAttributes( attList ) );
3325 double currentValue = 0;
3328 currentValue = f.
attribute( index ).toDouble();
3329 if ( currentValue < minimumValue )
3331 minimumValue = currentValue;
3334 return QVariant( minimumValue );
3337 Q_ASSERT_X(
false,
"QgsVectorLayer::minimumValue()",
"Unknown source of the field!" );
3356 int sourceLayerIndex;
3382 .setSubsetOfAttributes( attList ) );
3386 double currentValue = 0;
3389 currentValue = f.
attribute( index ).toDouble();
3390 if ( currentValue > maximumValue )
3392 maximumValue = currentValue;
3395 return QVariant( maximumValue );
3398 Q_ASSERT_X(
false,
"QgsVectorLayer::maximumValue()",
"Unknown source of the field!" );
3441 QSet<int> attrIndex;
3444 QSet<int>::const_iterator attIt = attrIndex.constBegin();
3445 for ( ; attIt != attrIndex.constEnd(); ++attIt )
3447 if ( !attributes.contains( *attIt ) )
3449 attributes << *attIt;
3463 .setFilterRect( rendererContext.
extent() )
3468 int nFeatsToLabel = 0;
3491 QList<int>::const_iterator attIt = att.constBegin();
3492 for ( ; attIt != att.constEnd(); ++attIt )
3494 if ( !attributes.contains( *attIt ) )
3496 attributes << *attIt;
3520 QString myMetadata =
"<html><body>";
3524 myMetadata +=
"<p class=\"subheaderglossy\">";
3525 myMetadata +=
tr(
"General" );
3526 myMetadata +=
"</p>\n";
3531 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Layer comment" ) +
"</p>\n";
3532 myMetadata +=
"<p>";
3534 myMetadata +=
"</p>\n";
3538 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Storage type of this layer" ) +
"</p>\n";
3539 myMetadata +=
"<p>";
3541 myMetadata +=
"</p>\n";
3546 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Description of this provider" ) +
"</p>\n";
3547 myMetadata +=
"<p>";
3549 myMetadata +=
"</p>\n";
3553 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Source for this layer" ) +
"</p>\n";
3554 myMetadata +=
"<p>";
3556 myMetadata +=
"</p>\n";
3570 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Geometry type of the features in this layer" ) +
"</p>\n";
3571 myMetadata +=
"<p>";
3572 myMetadata += typeString;
3573 myMetadata +=
"</p>\n";
3577 if ( !pkAttrList.isEmpty() )
3579 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Primary key attributes" ) +
"</p>\n";
3580 myMetadata +=
"<p>";
3581 foreach (
int idx, pkAttrList )
3585 myMetadata +=
"</p>\n";
3590 myMetadata +=
"<p class=\"glossy\">" +
tr(
"The number of features in this layer" ) +
"</p>\n";
3591 myMetadata +=
"<p>";
3593 myMetadata +=
"</p>\n";
3595 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Editing capabilities of this layer" ) +
"</p>\n";
3596 myMetadata +=
"<p>";
3598 myMetadata +=
"</p>\n";
3603 myMetadata +=
"<p class=\"subheaderglossy\">";
3604 myMetadata +=
tr(
"Extents" );
3605 myMetadata +=
"</p>\n";
3608 myMetadata +=
"<p class=\"glossy\">" +
tr(
"In layer spatial reference system units" ) +
"</p>\n";
3609 myMetadata +=
"<p>";
3622 QString xMin, yMin, xMax, yMax;
3623 double changeoverValue = 99999;
3624 if ( qAbs( myExtent.
xMinimum() ) > changeoverValue )
3626 xMin = QString(
"%1" ).arg( myExtent.
xMinimum(), 0,
'f', 2 );
3630 xMin = QString(
"%1" ).arg( myExtent.
xMinimum() );
3632 if ( qAbs( myExtent.
yMinimum() ) > changeoverValue )
3634 yMin = QString(
"%1" ).arg( myExtent.
yMinimum(), 0,
'f', 2 );
3638 yMin = QString(
"%1" ).arg( myExtent.
yMinimum() );
3640 if ( qAbs( myExtent.
xMaximum() ) > changeoverValue )
3642 xMax = QString(
"%1" ).arg( myExtent.
xMaximum(), 0,
'f', 2 );
3646 xMax = QString(
"%1" ).arg( myExtent.
xMaximum() );
3648 if ( qAbs( myExtent.
yMaximum() ) > changeoverValue )
3650 yMax = QString(
"%1" ).arg( myExtent.
yMaximum(), 0,
'f', 2 );
3654 yMax = QString(
"%1" ).arg( myExtent.
yMaximum() );
3657 myMetadata +=
tr(
"xMin,yMin %1,%2 : xMax,yMax %3,%4" )
3658 .arg( xMin ).arg( yMin ).arg( xMax ).arg( yMax );
3662 myMetadata +=
tr(
"unknown extent" );
3665 myMetadata +=
"</p>\n";
3673 QgsRectangle myProjectedExtent = coordinateTransform->transformBoundingBox(
extent() );
3674 myMetadata +=
"<p class=\"glossy\">" +
tr(
"In project spatial reference system units" ) +
"</p>\n";
3675 myMetadata +=
"<p>";
3676 myMetadata +=
tr(
"xMin,yMin %1,%2 : xMax,yMax %3,%4" )
3677 .arg( myProjectedExtent.
xMinimum() )
3678 .arg( myProjectedExtent.
yMinimum() )
3679 .arg( myProjectedExtent.
xMaximum() )
3680 .arg( myProjectedExtent.
yMaximum() );
3681 myMetadata +=
"</p>\n";
3687 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Layer Spatial Reference System" ) +
"</p>\n";
3688 myMetadata +=
"<p>";
3689 myMetadata +=
crs().
toProj4().replace( QRegExp(
"\"" ),
" \"" );
3690 myMetadata +=
"</p>\n";
3698 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Project (Output) Spatial Reference System" ) +
"</p>\n";
3699 myMetadata +=
"<p>";
3700 myMetadata += coordinateTransform->destCRS().toProj4().replace( QRegExp(
"\"" ),
" \"" );
3701 myMetadata +=
"</p>\n";
3709 myMetadata +=
"<p class=\"glossy\">" +
tr(
"In project spatial reference system units" ) +
"</p>\n";
3710 myMetadata +=
"<p>";
3711 myMetadata +=
tr(
"(Invalid transformation of layer extents)" );
3712 myMetadata +=
"</p>\n";
3720 myMetadata +=
"<p class=\"glossy\">" +
tr(
"Attribute field info" ) +
"</p>\n";
3721 myMetadata +=
"<p>";
3724 myMetadata +=
"<table width=\"100%\">";
3725 myMetadata +=
"<tr><th>";
3726 myMetadata +=
tr(
"Field" );
3727 myMetadata +=
"</th>";
3728 myMetadata +=
"<th>";
3729 myMetadata +=
tr(
"Type" );
3730 myMetadata +=
"</th>";
3731 myMetadata +=
"<th>";
3732 myMetadata +=
tr(
"Length" );
3733 myMetadata +=
"</th>";
3734 myMetadata +=
"<th>";
3735 myMetadata +=
tr(
"Precision" );
3736 myMetadata +=
"</th>";
3737 myMetadata +=
"<th>";
3738 myMetadata +=
tr(
"Comment" );
3739 myMetadata +=
"</th>";
3743 for ( QgsFieldMap::const_iterator it = myFields.begin(); it != myFields.end(); ++it )
3747 myMetadata +=
"<tr><td>";
3748 myMetadata += myField.
name();
3749 myMetadata +=
"</td>";
3750 myMetadata +=
"<td>";
3752 myMetadata +=
"</td>";
3753 myMetadata +=
"<td>";
3754 myMetadata += QString(
"%1" ).arg( myField.
length() );
3755 myMetadata +=
"</td>";
3756 myMetadata +=
"<td>";
3757 myMetadata += QString(
"%1" ).arg( myField.
precision() );
3758 myMetadata +=
"</td>";
3759 myMetadata +=
"<td>";
3760 myMetadata += QString(
"%1" ).arg( myField.
comment() );
3761 myMetadata +=
"</td></tr>";
3765 myMetadata +=
"</table>";
3768 myMetadata +=
"</body></html>";
3789 if ( idx < 0 || idx >= fields.
count() )
3791 QgsDebugMsg( QString(
"field %1 not found" ).arg( idx ) );
3794 QString fieldName = fields[idx].name();
3816 QDomElement elem = doc.createElement(
"attributeEditorContainer" );
3817 elem.setAttribute(
"name",
mName );
3818 for ( QList< QgsAttributeEditorElement* >::const_iterator it =
mChildren.begin(); it !=
mChildren.end(); ++it )
3820 elem.appendChild(( *it )->toDomElement( doc ) );
3833 QDomElement elem = doc.createElement(
"attributeEditorField" );
3834 elem.setAttribute(
"name",
mName );
3835 elem.setAttribute(
"index",
mIdx );
3850 if ( !listStylesExternalMethod )
3857 return listStylesExternalMethod(
mDataSource, ids, names, descriptions, msgError );
3871 if ( !getStyleByIdMethod )
3878 return getStyleByIdMethod(
mDataSource, styleId, msgError );
3883 bool useAsDefault, QString uiFileContent, QString &msgError )
3886 QString sldStyle, qmlStyle;
3896 if ( !saveStyleExternalMethod )
3903 QDomDocument qmlDocument, sldDocument;
3905 if ( !msgError.isNull() )
3909 qmlStyle = qmlDocument.toString();
3912 if ( !msgError.isNull() )
3916 sldStyle = sldDocument.toString();
3918 saveStyleExternalMethod(
mDataSource, qmlStyle, sldStyle, name,
3919 description, uiFileContent, useAsDefault, msgError );
3932 if ( !loadFromLocalDB && !dsUri.
database().isEmpty() )
3939 if ( loadStyleExternalMethod )
3941 QString qml, errorMsg;
3942 qml = loadStyleExternalMethod(
mDataSource, errorMsg );
3943 if ( !qml.isEmpty() )
3957 QDomDocument myDocument(
"qgis" );
3958 myDocument.setContent( namedStyle );
3960 QDomElement myRoot = myDocument.firstChildElement(
"qgis" );
3962 if ( myRoot.isNull() )
3964 errorMsg =
tr(
"Error: qgis element could not be found" );
3973 QDomNode transparencyNode = myRoot.namedItem(
"transparencyLevelInt" );
3974 if ( ! transparencyNode.isNull() )
3978 QDomElement myElement = transparencyNode.toElement();
3979 setTransparency( myElement.text().toInt() );
QgsFeatureId id() const
Get the feature id for this feature.
bool deleteVertex(QgsFeatureId atFeatureId, int atVertex)
Deletes a vertex from a feature.
virtual int addDiagramLayer(QgsVectorLayer *layer, QgsDiagramLayerSettings *s)
adds a diagram layer to the labeling engine
virtual QString subsetString()
Get the string (typically sql) used to define a subset of the layer.
virtual QDomElement toDomElement(QDomDocument &doc) const
void updateFields()
Assembles mUpdatedFields considering provider fields, joined fields and added fields.
QMap< QString, QVariant > & valueMap(int idx)
access value map
const QString & name() const
Gets the name of the field.
EditorLayout mEditorLayout
Defines the default layout to use for the attribute editor (Drag and drop, UI File, Generated)
const QList< QgsVectorJoinInfo > & vectorJoins() const
int mWkbType
Geometry type as defined in enum WkbType (qgis.h)
Wrapper for iterator of features from vector data provider or vector layer.
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
void selectAll()
Select all the features.
bool intersects(const QgsRectangle &rect) const
returns true when rectangle intersects with other rectangle
QgsFeatureRendererV2 * rendererV2()
Return renderer V2.
#define RENDERER_TAG_NAME
void screenUpdateRequested()
The layer emits this signal when a screen update is requested.
virtual QString subsetString()
Returns the subset definition string (typically sql) currently in use by the layer and used by the pr...
bool fieldEditable(int idx)
is edit widget editable
virtual QString getStyleFromDatabase(QString styleId, QString &msgError)
Will return the named style corresponding to style id provided.
virtual bool willRenderFeature(QgsFeature &feat)
return whether the renderer will render a feature or not.
void setRenderingStopped(bool stopped)
A rectangle specified with double values.
Base class for all map layer types.
QSet< QString > mExcludeAttributesWFS
Attributes which are not published in WFS.
void setDiagramLayerSettings(const QgsDiagramLayerSettings &s)
bool isEmpty() const
test if rectangle is empty
int insertSegmentVerticesForSnap(const QList< QgsSnappingResult > &snapResults)
Inserts vertices to the snapped segments.
field comes from a joined layer (originIndex / 1000 = index of the join, originIndex % 1000 = index w...
void clearAttributeEditorWidgets()
Clears all the tabs for the attribute editor form.
QgsFeatureList selectedFeatures()
Get a copy of the user-selected features.
QgsVectorDataProvider * mDataProvider
Pointer to data provider derived from the abastract base class QgsDataProvider.
QgsMapLayer::LayerType type() const
Get the type of the layer.
bool addAttribute(const QgsField &field)
add an attribute field (but does not commit it) returns true if the field was added ...
void setMinimal()
Set a rectangle so that min corner is at max.
QgsSymbolV2 * symbol() const
int makeDifference(QgsGeometry *other)
Changes this geometry such that it does not intersect the other geometry.
EditorLayout editorLayout()
get the active layout for the attribute editor for this layer (added in 1.9)
virtual void saveStyleToDatabase(QString name, QString description, bool useAsDefault, QString uiFileContent, QString &msgError)
Save named and sld style of the layer to the style table in the db.
void createJoinCaches()
Calls cacheJoinLayer() for all vector joins.
static QgsMapRenderer::BlendMode getBlendModeEnum(const QPainter::CompositionMode blendMode)
Returns a BlendMode corresponding to a QPainter::CompositionMode Added in 1.9.
virtual void updateExtents()
Update the extents of the layer.
void readCustomProperties(const QDomNode &layerNode, const QString &keyStartsWith="")
Read custom properties from project file.
RangeData & range(int idx)
access range
QList< QgsSymbolV2 * > QgsSymbolV2List
void setCacheImage(QImage *thepImage)
Set the QImage used for caching render operations.
void removeJoin(const QString &joinLayerId)
Removes a vector layer join.
QString publicSource() const
void beforeRollBack()
Is emitted, before changes are rolled back.
bool addFeatures(QgsFeatureList &features)
Insert a copy of the given features into the layer (but does not commit it)
EditorLayout
The different types to layout the attribute editor.
Use exact geometry intersection (slower) instead of bounding boxes.
static QgsFeatureRendererV2 * loadSld(const QDomNode &node, QGis::GeometryType geomType, QString &errorMessage)
create a new renderer according to the information contained in the UserStyle element of a SLD style ...
void setEditFormInit(QString function)
set python function for edit form initialization (added in 1.4)
int translateFeature(QgsFeatureId featureId, double dx, double dy)
Translates feature by dx, dy.
QVariant maximumValue(int index)
Returns maximum value for an attribute column or invalid variant in case of error.
Renders the diagrams for all features with the same settings.
QString capabilitiesString() const
Returns the above in friendly format.
QColor selectionColor() const
Added in QGIS v2.0.
void setDisplayExpression(const QString displayExpression)
Set the preview expression, used to create a human readable preview string.
virtual QgsPalLayerSettings & layer(const QString &layerName)=0
returns PAL layer settings for a registered layer
int removePolygonIntersections(QgsGeometry *geom, QgsFeatureIds ignoreFeatures=QgsFeatureIds())
Changes the specified geometry such that it has no intersections with other polygon (or multipolygon)...
bool addFeature(QgsFeature &f)
Adds a feature.
virtual QString dump() const
for debugging
static QgsProviderRegistry * instance(QString pluginPath=QString::null)
means of accessing canonical single instance
field has been temporarily added in editing mode (originIndex = index in the list of added attributes...
double yMaximum() const
Get the y maximum value (top side of rectangle)
bool deleteFeature(QgsFeatureId fid)
delete a feature from the layer (but does not commit it)
The attribute value should not be changed in the attribute form.
virtual QgsCoordinateReferenceSystem crs()=0
QSet< QgsFeatureId > QgsFeatureIds
void uniqueValues(int index, QList< QVariant > &uniqueValues, int limit=-1)
Returns unique values for column.
QList< QgsFeature > QgsFeatureList
void drawLabels(QgsRenderContext &rendererContext)
Draws the layer labels using coordinate transformation.
void beginEditCommand(QString text)
Create edit command for undo/redo operations.
QList< QgsAttributeEditorElement * > mAttributeEditorElements
Stores a list of attribute editor elements (Each holding a tree structure for a tab in the attribute ...
double rendererScale() const
void drawRendererV2(QgsFeatureIterator &fit, QgsRenderContext &rendererContext, bool labeling)
Draw layer with renderer V2.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())
Query the provider for features specified in request.
virtual QDomElement save(QDomDocument &doc)
store renderer info to XML element
QgsFeatureRendererV2 * mRendererV2
Renderer object which holds the information about how to display the features.
void invertSelectionInRectangle(QgsRectangle &rect)
Invert selection of features found within the search rectangle (in layer's coordinates) ...
bool commitChanges()
Attempts to commit any changes to disk.
void setRendererV2(QgsFeatureRendererV2 *r)
Set renderer V2.
void deleteCachedGeometries()
Deletes the geometries in mCachedGeometries.
Storage and management of actions associated with Qgis layer attributes.
QgsGeometry * geometry() const
Get the geometry object associated with this feature.
virtual void setEncoding(const QString &e)
Set encoding used for accessing data from layer.
bool startEditing()
Make layer editable.
virtual void startRender(QgsRenderContext &context, const QgsVectorLayer *vlayer)
bool contains(const QgsRectangle &rect) const
return true when rectangle contains other rectangle
void setRendererScale(double scale)
VertexMarkerType
Editing vertex markers.
static QgsVectorLayer::VertexMarkerType currentVertexMarkerType()
Reads vertex marker type from settings.
double closestSegmentWithContext(const QgsPoint &point, QgsPoint &minDistPoint, int &afterVertex, double *leftOf=0, double epsilon=DEFAULT_SEGMENT_EPSILON)
Searches for the closest segment of geometry to the given point.
void select(QgsRectangle &rect, bool addToSelection)
Select features found within the search rectangle (in layer's coordinates)
friend class QgsVectorLayerFeatureIterator
int precision() const
Gets the precision of the field.
void renderLabel(QgsRenderContext &renderContext, QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes=0)
render label
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
bool deleteAttributes(QList< int > attrs)
Deletes a list of attribute fields (but does not commit it)
virtual QString loadNamedStyle(const QString theURI, bool &theResultFlag)
Retrieve a named style for this layer if one exists (either as a .qml file on disk or as a record in ...
void addAttributeAlias(int attIndex, QString aliasString)
Sets an alias (a display name) for attributes to display in dialogs.
static const char * vectorGeometryType(GeometryType type)
description strings for geometry types
QString mDisplayExpression
the preview expression used to generate a human readable preview string for features ...
QGis::GeometryType type()
Returns type of the vector.
int insertSegmentVerticesForSnap(const QList< QgsSnappingResult > &snapResults)
Inserts vertices to the snapped segments.
void readXml(const QDomNode &layer_node)
Reads joins from project file.
virtual void uniqueValues(int index, QList< QVariant > &uniqueValues, int limit=-1)
Return unique values of an attribute.
virtual bool writeXml(QDomNode &layer_node, QDomDocument &doc)
write vector layer specific state to project file Dom node.
Container of fields for a vector layer.
bool mEnableBackbuffer
Enables backbuffering for the map window.
void rollBack()
Stop editing and discard the edits.
const QgsRectangle & cachedGeometriesRect()
A geometry is the spatial representation of a feature.
void setDiagramRenderer(QgsDiagramRendererV2 *r)
Sets diagram rendering object (takes ownership)
void setLayerTransparency(int layerTransparency)
Write transparency for layer.
bool readSld(const QDomNode &node, QString &errorMessage)
QgsChangedAttributesMap mChangedAttributeValues
Changed attributes values which are not commited.
WkbType
Used for symbology operations.
QMap< QString, bool > mFieldEditables
const QgsRectangle & extent() const
QMap< int, QgsField > QgsFieldMap
void labelingFontNotFound(QgsVectorLayer *layer, const QString &fontfamily)
Emitted when the font family defined for labeling layer is not found on system.
static QPainter::CompositionMode getCompositionMode(const QgsMapRenderer::BlendMode blendMode)
Returns a QPainter::CompositionMode corresponding to a BlendMode Added in 1.9.
bool addFeature(QgsFeature &f, bool alsoUpdateExtent=true)
Adds a feature.
virtual QList< QString > usedAttributes()=0
field comes from the underlying data provider of the vector layer (originIndex = index in provider's ...
int addPart(const QList< QgsPoint > &ring, QgsFeatureId featureId)
Adds a new part polygon to a multipart feature.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
static const int EditingCapabilities
bitmask of all provider's editing capabilities
virtual ~QgsVectorLayer()
Destructor.
virtual QgsAttributeList pkAttributeIndexes()
Return list of indexes of fields that make up the primary key.
const QString displayExpression()
Get the preview expression, used to create a human readable preview string.
bool deleteVertex(QgsFeatureId atFeatureId, int atVertex)
Deletes a vertex from a feature.
void beforeCommitChanges()
Is emitted, before changes are commited to the data provider.
QStringList mCommitErrors
QgsPoint closestVertex(const QgsPoint &point, int &atVertex, int &beforeVertex, int &afterVertex, double &sqrDist)
Returns the vertex closest to the given point, the corresponding vertex index, squared distance snap ...
QgsPoint vertexAt(int atVertex)
Returns coordinates of a vertex.
void committedFeaturesRemoved(const QString &layerId, const QgsFeatureIds &deletedFeatureIds)
virtual void stopRender(QgsRenderContext &context)
void setCachedGeometriesRect(const QgsRectangle &extent)
QVariant minimumValue(int index)
Returns minimum value for an attribute column or invalid variant in case of error.
bool insertVertex(double x, double y, QgsFeatureId atFeatureId, int beforeVertex)
Insert a new vertex before the given vertex number, in the given ring, item (first number is index 0)...
void featureDeleted(QgsFeatureId fid)
QString readPath(QString filename) const
turn filename read from the project file to an absolute path
bool changeAttributeValue(QgsFeatureId fid, int field, QVariant value, bool emitSignal=true)
changed an attribute value (but does not commit it)
bool setDataProvider(QString const &provider)
bind layer to a specific data provider
virtual QString loadNamedStyle(const QString theURI, bool &theResultFlag, bool loadFromLocalDb)
Load a named style from file/local db/datasource db.
void setMaximumScale(float theMaxScale)
Accessor and mutator for the maximum scale denominator member.
BlendMode
Blending modes enum defining the available composition modes that can be used when rendering a layer...
void invertSelection()
Select not selected features and deselect selected ones.
int splitFeatures(const QList< QgsPoint > &splitLine, bool topologicalEditing=false)
Splits features cut by the given line.
static void logMessage(QString message, QString tag=QString::null, MessageLevel level=WARNING)
add a message to the instance (and create it if necessary)
virtual void updateExtents()
Update the extents for the layer.
Returns diagram settings for a feature.
QGis::WkbType wkbType() const
Returns the WKBType or WKBUnknown in case of error.
void removeSelection()
Clear selection.
Manages joined fields for a vector layer.
const QgsVectorJoinInfo * joinForFieldIndex(int index, const QgsFields &fields, int &sourceFieldIndex) const
Finds the vector join for a layer field index.
QString editForm()
get edit form (added in 1.4)
void set(const QgsPoint &p1, const QgsPoint &p2)
Set the rectangle from two QgsPoints. The rectangle is.
virtual void stopRender(QgsRenderContext &context)=0
void setEditorLayout(EditorLayout editorLayout)
set the active layout for the attribute editor for this layer (added in 1.9)
bool writeXML(QDomNode &layer_node, QDomDocument &doc) const
Writes the actions out in XML format.
QgsGeometryMap & cachedGeometries()
double ANALYSIS_EXPORT max(double x, double y)
returns the maximum of two doubles or the first argument if both are equal
bool containsJoins() const
Quick way to test if there is any join at all.
const QString & name() const
Get the display name of the layer.
virtual QgsSymbolV2List symbols()=0
for symbol levels
void checkJoinLayerRemove(QString theLayerId)
Check if there is a join with a layer that will be removed.
QgsRectangle extent()
Return the extent of the layer as a QRect.
virtual int listStylesInDatabase(QStringList &ids, QStringList &names, QStringList &descriptions, QString &msgError)
Lists all the style in db split into related to the layer and not related to.
SnappingType
Snap to vertex, to segment or both.
virtual bool renderFeature(QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
QString encoding() const
Get encoding which is used for accessing data.
virtual void writeXML(QDomElement &layerElem, QDomDocument &doc, const QgsVectorLayer *layer) const =0
void setColor(const QColor &color)
virtual QVariant maximumValue(int index)
Returns the maximum value of an attribute.
QgsFeatureRequest & setFilterFid(QgsFeatureId fid)
Set feature ID that should be fetched.
QList< QgsAttributeEditorElement * > mChildren
bool changeAttributeValue(QgsFeatureId fid, int field, QVariant value)
changed an attribute value (but does not commit it)
void geometryChanged(QgsFeatureId fid, QgsGeometry &geom)
QSize & widgetSize(int idx)
access widget size for photo and webview widget
void combineExtentWith(QgsRectangle *rect)
expand the rectangle so that covers both the original rectangle and the given rectangle ...
QPainter::CompositionMode blendMode() const
Read blend mode for layer.
virtual void reload()
Synchronises with changes in the datasource.
void deselect(const QgsFeatureId featureId)
Deselect feature by its ID.
QPainter::CompositionMode featureBlendMode() const
Read blend mode for layer.
virtual QgsLegendSymbolList legendSymbolItems()
return a list of item text / symbol
bool mLabelFontNotFoundNotified
Whether 'labeling font not found' has be shown for this layer (only show once in QgsMessageBar, on first rendering)
bool writeSld(QDomNode &node, QDomDocument &doc, QString &errorMessage) const
bool rollBack(bool deleteBuffer=true)
Stop editing and discard the edits.
QgsGeometryCache * mCache
cache for some vector layer data - currently only geometries for faster editing
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
virtual bool setSubsetString(QString subset, bool updateFeatureCount=true)
Set the subset string used to create a subset of features in the layer.
QgsDataProvider * provider(const QString &providerKey, const QString &dataSource)
Create an instance of the provider.
double xMaximum() const
Get the x maximum value (right side of rectangle)
QString attributeDisplayName(int attributeIndex) const
Convenience function that returns the attribute alias if defined or the field name else...
const QgsFeatureIds & selectedFeaturesIds() const
Return reference to identifiers of selected features.
QString capabilitiesString() const
Capabilities for this layer in a friendly format.
The attribute value should not be shown in the attribute form.
virtual QString dataComment() const
Return a short comment for the data that this provider is providing access to (e.g.
Represents the result of a snapping operation.
bool renderingStopped() const
void readXML(const QDomElement &elem, const QgsVectorLayer *layer)
virtual void onCacheImageDelete()
Is called when the cache image is being deleted.
void setCrs(const QgsCoordinateReferenceSystem &srs, bool emitSignal=true)
Sets layer's spatial reference system.
void prepareLabelingAndDiagrams(QgsRenderContext &rendererContext, QgsAttributeList &attributes, bool &labeling)
Registers label and diagram layer.
EditType editType(int idx)
get edit type
virtual int capabilities() const
Returns a bitmask containing the supported capabilities Note, some capabilities may change depending ...
int snapWithContext(const QgsPoint &startPoint, double snappingTolerance, QMultiMap< double, QgsSnappingResult > &snappingResults, QgsSnapper::SnappingType snap_to)
Snaps to segment or vertex within given tolerance.
virtual void setExtent(const QgsRectangle &rect)
Set the extent.
int addTopologicalPoints(QgsGeometry *geom)
Adds topological points for every vertex of the geometry.
void setScaleBasedVisibility(bool theVisibilityFlag)
Accessor and mutator for the scale based visilibility flag.
void committedFeaturesAdded(const QString &layerId, const QgsFeatureList &addedFeatures)
virtual QDomElement toDomElement(QDomDocument &doc) const
int addPart(const QList< QgsPoint > &ring)
Adds a new part polygon to a multipart feature.
virtual void registerDiagramFeature(QgsVectorLayer *layer, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext())
called for every diagram feature
int fieldOriginIndex(int fieldIdx) const
Get field's origin index (its meaning is specific to each type of origin)
bool deleteAttribute(int attr)
delete an attribute field (but does not commit it)
void editingStopped()
Is emitted, when edited changes successfully have been written to the data provider.
QgsGeometryMap mChangedGeometries
Changed geometries which are not commited.
int translateFeature(QgsFeatureId featureId, double dx, double dy)
Translates feature by dx, dy.
bool moveVertex(double x, double y, QgsFeatureId atFeatureId, int atVertex)
Moves the vertex at the given position number, ring and item (first number is index 0)...
virtual QString storageType() const
Returns the permanent storage type for this layer as a friendly name.
virtual long featureCount() const =0
Number of features in the layer.
QgsVectorLayer(QString path=QString::null, QString baseName=QString::null, QString providerLib=QString::null, bool loadDefaultStyleFlag=true)
Constructor - creates a vector layer.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
int pendingFeatureCount()
returns feature count after commit
QList< int > QgsAttributeList
void destroyEditCommand()
Destroy active command and reverts all changes in it.
QString & dateFormat(int idx)
access date format
const QgsAttributes & attributes() const
bool scaleBasedVisibility() const
bool mSymbolFeatureCounted
QPair< QString, QString > checkedState(int idx)
return string representing 'true' for a checkbox (added in 1.4)
virtual void registerFeature(QgsVectorLayer *layer, QgsFeature &feat, const QgsRenderContext &context=QgsRenderContext())=0
called for every feature
void writeCustomProperties(QDomNode &layerNode, QDomDocument &doc) const
Write custom properties to project file.
const QString displayField() const
Returns the primary display field name used in the identify results dialog.
int count() const
Return number of items.
bool setReadOnly(bool readonly=true)
Make layer read-only (editing disabled) or not.
bool changeGeometry(QgsFeatureId fid, QgsGeometry *geom)
change feature's geometry
virtual bool isModified() const
Returns true if the provider has been modified since the last commit.
QGis::GeometryType geometryType() const
Returns point, line or polygon.
QString labelField(int attr) const
label field
QgsFeatureIds mDeletedFeatureIds
Deleted feature IDs which are not commited.
int afterVertexNr
The index of the vertex after snappedVertex or -1 if no such vertex.
QgsDiagramRendererV2 * renderer
QgsDiagramLayerSettings * mDiagramLayerSettings
Encapsulate a field in an attribute table or data source.
void featureAdded(QgsFeatureId fid)
static QgsFeatureRendererV2 * defaultRenderer(QGis::GeometryType geomType)
return a new renderer - used by default in vector layers
QMap< QgsSymbolV2 *, long > mSymbolFeatureCountMap
virtual QGis::WkbType geometryType() const =0
Get feature type.
QString attributeAlias(int attributeIndex) const
Returns the alias of an attribute name or an empty string if there is no alias.
ValueRelationData & valueRelation(int idx)
access relations
fast access to features using their ID
void readXML(const QDomNode &node)
Reads the renderer configuration from an XML file.
QgsFeatureId snappedAtGeometry
Index of the snapped geometry.
bool mValid
Indicates if the layer is valid and can be drawn.
virtual bool readXml(const QDomNode &layer_node)
reads vector layer specific state from project file Dom node.
QMap< QString, int > fieldNameMap() const
Return a map where the key is the name of the field and the value is its index.
const QList< QgsVectorJoinInfo > & vectorJoins() const
QMap< QString, QPair< QString, QString > > mCheckedStates
void editingStarted()
Is emitted, when editing on this layer has started.
static void drawVertexMarker(double x, double y, QPainter &p, QgsVectorLayer::VertexMarkerType type, int vertexSize)
Draws a vertex symbol at (screen) coordinates x, y.
bool addFeatures(QgsFeatureList features, bool makeSelected=true)
Insert a copy of the given features into the layer (but does not commit it)
A class to represent a point geometry.
void writeXML(QDomNode &label_node, QDomDocument &document) const
Writes the contents of the renderer to a configuration file.
void removeJoin(const QString &joinLayerId)
Removes a vector layer join.
void endEditCommand()
Finish edit command and add it to undo/redo stack.
bool commitChanges(QStringList &commitErrors)
Attempts to commit any changes to disk.
int addRing(const QList< QgsPoint > &ring)
Adds a ring to polygon/multipolygon features.
QMap< QString, QString > mAttributeAliasMap
Map that stores the aliases for attributes.
bool deleteAttribute(int attr)
delete an attribute field (but does not commit it)
const QStringList & commitErrors()
virtual int prepareLayer(QgsVectorLayer *layer, QSet< int > &attrIndices, QgsRenderContext &ctx)=0
called when starting rendering of a layer
bool labelOnTop(int idx)
label widget on top
void setBlendMode(const QPainter::CompositionMode blendMode)
Write blend mode for layer.
void invalidateSymbolCountedFlag()
bool readSymbology(const QDomNode &node, QString &errorMessage)
Read the symbology for the current layer from the Dom node supplied.
QgsPoint beforeVertex
The layer coordinates of the vertex before snappedVertex.
QgsVectorLayerEditBuffer * mEditBuffer
stores information about uncommitted changes to layer
QList< QgsSymbolV2LevelItem > QgsSymbolV2Level
Class for storing the component parts of a PostgreSQL/RDBMS datasource URI.
QgsPoint afterVertex
The layer coordinates of the vertex after snappedVertex.
int addTopologicalPoints(QgsGeometry *geom)
Adds topological points for every vertex of the geometry.
bool isGeosEqual(QgsGeometry &)
compare geometries using GEOS
QMap< QString, RangeData > mRanges
int renderingPass() const
bool countSymbolFeatures(bool showProgress=true)
Count features for symbols.
A class to render labels.
A registry / canonical manager of data providers.
void setProviderEncoding(const QString &encoding)
Sets the textencoding of the data provider.
virtual bool isReadOnly() const
Returns true if the provider is in read-only mode.
QgsAttributeEditorElement * attributeEditorElementFromDomElement(QDomElement &elem, QObject *parent)
convert a saved attribute editor element into a AttributeEditor structure as it's used internally...
int layerTransparency() const
Read transparency for layer.
void drawRendererV2Levels(QgsFeatureIterator &fit, QgsRenderContext &rendererContext, bool labeling)
Draw layer with renderer V2 using symbol levels.
QLibrary * providerLibrary(const QString &providerKey) const
QMap< QString, EditType > mEditTypes
int snappedVertexNr
The vertex index of snappedVertex or -1 if no such vertex number (e.g.
uuid generator - readonly and automatically intialized
bool snapPoint(QgsPoint &point, double tolerance)
Snaps a point to the closest vertex if there is one within the snapping tolerance.
void addRequiredFields(QgsAttributeList &fields) const
add vector of required fields to existing list of fields
void setEditType(int idx, EditType edit)
set edit type
virtual void exportNamedStyle(QDomDocument &doc, QString &errorMsg)
Export the properties of this layer as named style in a QDomDocument.
bool updateFeature(QgsFeature &f)
Updates an existing feature.
void selectionChanged()
This signal is emitted when selection was changed.
bool insertVertex(double x, double y, QgsFeatureId atFeatureId, int beforeVertex)
Insert a new vertex before the given vertex number, in the given ring, item (first number is index 0)...
QString providerType() const
Return the provider type for this layer.
void stopRendererV2(QgsRenderContext &rendererContext, QgsSingleSymbolRendererV2 *selRenderer)
Add joined attributes to a feature.
QgsRectangle boundingBox()
Returns the bounding box of this feature.
QgsDiagramRendererV2 * mDiagramRenderer
bool hasGeometryType() const
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeome...
void attributeAdded(int idx)
Will be emitted, when a new attribute has been added to this vector layer.
virtual long featureCount() const
Number of features in the layer.
Contains information about the context of a rendering operation.
void setMaxScale(float theMaxScale)
Accessor and mutator for the maximum scale member.
int addRing(const QList< QgsPoint > &ring)
Adds a ring to polygon/multipolygon features.
QString mDisplayField
index of the primary label field
QMap< QString, QSize > mWidgetSize
QgsRenderContext * mCurrentRendererContext
QString getStyleById_t(const QString &uri, QString styleID, QString &errCause)
virtual const QgsFields & fields() const =0
Return a map of indexes with field names for this layer.
QSet< QString > mExcludeAttributesWMS
Attributes which are not published in WMS.
QMap< QString, ValueRelationData > mValueRelations
QString loadStyle_t(const QString &uri, QString &errCause)
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
QgsAttributeList pendingAllAttributesList()
returns list of attributes
virtual QgsRectangle extent()=0
Get the extent of the layer.
QMap< QString, QMap< QString, QVariant > > mValueMaps
void setAnnotationForm(const QString &ui)
set annotation form for layer (added in 1.5)
void setExtent(const QgsRectangle &rect)
Set the extent.
static QgsSymbolV2 * defaultSymbol(QGis::GeometryType geomType)
return new default symbol for specified geometry type
QString mDataSource
data source description string, varies by layer type
virtual QString loadDefaultStyle(bool &theResultFlag)
Retrieve the default style for this layer if one exists (either as a .qml file on disk or as a record...
bool mLabelOn
Display labels.
QgsVectorLayerJoinBuffer * mJoinBuffer
bool draw(QgsRenderContext &rendererContext)
Draws the layer.
QVector< QVariant > QgsAttributes
void setSelectedFeatures(const QgsFeatureIds &ids)
Change selection to the new set of features.
virtual QgsSymbolV2List symbolsForFeature(QgsFeature &feat)
return list of symbols used for rendering the feature.
void writeXml(QDomNode &layer_node, QDomDocument &document) const
Saves mVectorJoins to xml under the layer node.
FieldOrigin fieldOrigin(int fieldIdx) const
Get field's origin (value from an enumeration)
static QgsFeatureRendererV2 * load(QDomElement &symbologyElem)
create a renderer from XML element
const QString & typeName() const
Gets the field type.
virtual bool setSubsetString(QString subset)
Set the string (typically sql) used to define a subset of the layer.
virtual void reloadData()
Reloads the data from the source.
virtual QVariant minimumValue(int index)
Returns the minimum value of an attribute.
void setEditForm(QString ui)
set edit form (added in 1.4)
virtual bool isValid()=0
Returns true if this is a valid layer.
void snapToGeometry(const QgsPoint &startPoint, QgsFeatureId featureId, QgsGeometry *geom, double sqrSnappingTolerance, QMultiMap< double, QgsSnappingResult > &snappingResults, QgsSnapper::SnappingType snap_to) const
Snaps to a geometry and adds the result to the multimap if it is within the snapping result...
bool moveVertex(double x, double y, QgsFeatureId atFeatureId, int atVertex)
Moves the vertex at the given position number, ring and item (first number is index 0)...
void updateFields(QgsFields &fields)
Updates field map with joined attributes.
void repaintRequested()
This signal should be connected with the slot QgsMapCanvas::refresh()
void setVertexMarkerAppearance(int type, int size)
set type and size of editing vertex markers for subsequent rendering
void attributeValueChanged(QgsFeatureId fid, int idx, const QVariant &)
static QgsProject * instance()
access to canonical QgsProject instance
QgsPoint snappedVertex
The coordinates of the snapping result.
bool usingSymbolLevels() const
void setCheckedState(int idx, QString checked, QString notChecked)
set string representing 'true' for a checkbox (added in 1.4)
Class for storing a coordinate reference system (CRS)
void writeXML(QDomElement &layerElem, QDomDocument &doc, const QgsVectorLayer *layer) const
int length() const
Gets the length of the field.
friend class QgsVectorLayerEditBuffer
QgsLabel * label()
Get the label object associated with this layer.
int size() const
Return number of items.
virtual QString description() const =0
return description
bool hasLabelsEnabled() const
Label is on.
QList< QgsAttributeEditorElement * > & attributeEditorElements()
Returns a list of tabs holding groups and fields.
virtual QDomElement writeSld(QDomDocument &doc, const QgsVectorLayer &layer) const
create the SLD UserStyle element following the SLD v1.1 specs
QString mFilterExpression
QMap< QString, QString > mDateFormats
void cacheGeometry(QgsFeatureId fid, const QgsGeometry &geom)
store a geometry in the cache
virtual void readXML(const QDomElement &elem, const QgsVectorLayer *layer)=0
const QMap< QString, QgsMapLayer * > & mapLayers()
Retrieve the mapLayers collection (mainly intended for use by projection)
void recalculateExtents()
This is used to send a request that any mapcanvas using this layer update its extents.
QMap< QString, bool > mLabelOnTop
const QString & comment() const
Returns the field comment.
void setFieldEditable(int idx, bool editable)
set edit widget editable
bool deleteFeature(QgsFeatureId fid)
delete a feature from the layer (but does not commit it)
QList< QgsSymbolV2Level > QgsSymbolV2LevelOrder
void setLayerName(const QString &name)
Set the display name of the layer.
static int currentVertexMarkerSize()
Reads vertex marker size from settings.
const QgsCoordinateReferenceSystem & crs() const
Returns layer's spatial reference system.
virtual void startRender(QgsRenderContext &context, const QgsVectorLayer *vlayer)=0
allows deletion of features
int mLayerTransparency
Layer transparency.
QgsMapLayer * mapLayer(QString theLayerId)
Retrieve a pointer to a loaded layer by id.
void(*)() cast_to_fptr(void *p)
QString dataComment() const
Returns a comment for the data in the layer.
void setMinScale(float theMinScale)
Accessor and mutator for the minimum scale member.
Custom exception class for Coordinate Reference System related exceptions.
QUndoStack * undoStack()
Return pointer to layer's undo stack.
const QgsFields & pendingFields() const
returns field list in the to-be-committed state
void setLabelOnTop(int idx, bool onTop)
label widget on top
QgsSymbolLayerV2 * symbolLayer(int layer)
QgsVectorDataProvider * dataProvider()
Returns the data provider.
virtual void addChildElement(QgsAttributeEditorElement *widget)
double ANALYSIS_EXPORT min(double x, double y)
returns the minimum of two doubles or the first argument if both are equal
void normalize()
Normalize the rectangle so it has non-negative width/height.
QString editFormInit()
get python function for edit form initialization (added in 1.4)
virtual int capabilities()
returns bitwise OR-ed capabilities of the renderer
bool nextFeature(QgsFeature &f)
void setCoordinateSystem()
Setup the coordinate system tranformation for the layer.
This is the base class for vector data providers.
void attributeDeleted(int idx)
Will be emitted, when an attribute has been deleted from this vector layer.
QgsFields mUpdatedFields
field map to commit
QgsFeatureMap mAddedFeatures
New features which are not commited.
double width() const
Width of the rectangle.
int mUpdateThreshold
Update threshold for drawing features as they are read.
QgsAttributeList pendingPkAttributesList()
returns list of attribute making up the primary key
virtual bool isEditable() const
Returns true if the provider is in editing mode.
QPainter::CompositionMode mFeatureBlendMode
Blend mode for features.
static QgsFeatureRendererV2 * readOldRenderer(const QDomNode &layerNode, QGis::GeometryType geomType)
Read old renderer definition from XML and create matching new renderer.
bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage) const
Write the symbology for the layer into the docment provided.
void updateFields(QgsFields &fields)
virtual QgsRectangle extent()
Return the extent of the layer.
Represents a vector layer which manages a vector based data sets.
int fieldNameIndex(const QString &fieldName) const
Returns the index of a field name or -1 if the field does not exist.
bool addAttribute(const QgsField &field)
add an attribute field (but does not commit it) returns true if the field was added ...
bool isModified() const
Returns true if the provider has been modified since the last commit.
bool deleteSelectedFeatures()
Deletes the selected features.
QString toString(bool automaticPrecision=false) const
returns string representation of form xmin,ymin xmax,ymax
QList< QPair< QString, QgsSymbolV2 * > > QgsLegendSymbolList
virtual QgsSymbolV2 * symbolForFeature(QgsFeature &feature)=0
to be overridden
void modifySelection(QgsFeatureIds selectIds, QgsFeatureIds deselectIds)
Modifies the current selection on this layer.
int selectedFeatureCount()
The number of features that are selected in this layer.
void updatedFields()
Is emitted, whenever the fields available from this layer have been changed.
QgsFeatureRequest & setFlags(Flags flags)
Set flags that affect how features will be fetched.
double xMinimum() const
Get the x minimum value (left side of rectangle)
bool mReadOnly
Flag indicating whether the layer is in read-only mode (editing disabled) or not. ...
QgsFeatureIds mSelectedFeatureIds
Set holding the feature IDs that are activated.
const QgsVectorLayer * layer
Layer where the snap occured.
QString joinLayerId
Source layer.
void layerModified()
This signal is emitted when modifications has been done on layer.
QgsAttributeList mDeletedAttributeIds
deleted attributes fields which are not commited.
void setFeatureBlendMode(const QPainter::CompositionMode blendMode)
Write blend mode for features.
virtual bool applyNamedStyle(QString namedStyle, QString errorMsg)
bool readXML(const QDomNode &layer_node)
Reads the actions in in XML format.
bool changeGeometry(QgsFeatureId fid, QgsGeometry *geom)
change feature's geometry
int beforeVertexNr
The index of the vertex before snappedVertex or -1 if no such vertex.
void createJoinCaches()
Caches joined attributes if required (and not already done)
virtual void exportSldStyle(QDomDocument &doc, QString &errorMsg)
Export the properties of this layer as SLD style in a QDomDocument.
virtual QString dataSourceUri() const
Get the data source specification.
int splitFeatures(const QList< QgsPoint > &splitLine, bool topologicalEditing=false)
Splits features cut by the given line.
void setDisplayField(QString fldName="")
Set the primary display field to be used in the identify results dialog.
const CORE_EXPORT QString GEO_EPSG_CRS_AUTHID
Geographic coord sys from EPSG authority.
QString mProviderKey
Data provider key.
void addJoin(const QgsVectorJoinInfo &joinInfo)
Joins another vector layer to this layer.
virtual QList< int > diagramAttributes() const =0
Returns attribute indices needed for diagram rendering.
void toggleScaleBasedVisibility(bool theVisibilityFlag)
Accessor and mutator for the scale based visilibility flag.
QgsLabelingEngineInterface * labelingEngine() const
Added in QGIS v1.4.
double height() const
Height of the rectangle.
QString toProj4() const
Get the Proj Proj4 string representation of this srs.
void enableLabels(bool on)
Set labels on.
void setMinimumScale(float theMinScale)
Accessor and mutator for the minimum scale denominator member.
void addAttributeEditorWidget(QgsAttributeEditorElement *data)
Adds a tab (for the attribute editor form) holding groups and fields.
QgsRectangle boundingBoxOfSelected()
Returns the bounding box of the selected features.
bool saveStyle_t(const QString &uri, const QString &qmlStyle, const QString &sldStyle, const QString &styleName, const QString &styleDescription, const QString &uiFileContent, bool useAsDefault, QString &errCause)
QgsAttributeAction * mActions
The user-defined actions that are accessed from the Identify Results dialog box.
QString storageType() const
Returns the permanent storage type for this layer as a friendly name.
int listStyles_t(const QString &uri, QStringList &ids, QStringList &names, QStringList &descriptions, QString &errCause)
void addJoin(const QgsVectorJoinInfo &joinInfo)
Joins another vector layer to this layer.