Skip to content
Permalink
Browse files

Store attributes and fields in vectors instead of maps

  • Loading branch information
wonder-sk committed Oct 20, 2012
1 parent 8bf9590 commit 51122d263acd27c44c8209b345e710fc8393ef9c
Showing with 805 additions and 1,134 deletions.
  1. +10 −10 python/core/qgsexpression.sip
  2. +3 −3 python/core/qgsfeature.sip
  3. +1 −1 python/core/qgsfeaturerequest.sip
  4. +3 −3 python/core/qgslabel.sip
  5. +0 −6 python/core/qgsmaplayer.sip
  6. +1 −6 python/core/qgsvectordataprovider.sip
  7. +1 −1 python/core/qgsvectorfilewriter.sip
  8. +1 −7 python/core/qgsvectorlayer.sip
  9. +1 −1 python/core/qgsvectorlayerimport.sip
  10. +5 −8 python/core/qgsvectorlayerjoinbuffer.sip
  11. +0 −6 python/core/raster/qgsrasterlayer.sip
  12. +1 −1 python/gui/qgsexpressionbuilderwidget.sip
  13. +2 −2 src/analysis/interpolation/DualEdgeTriangulation.cc
  14. +20 −20 src/analysis/vector/qgsgeometryanalyzer.cpp
  15. +12 −21 src/analysis/vector/qgsoverlayanalyzer.cpp
  16. +1 −1 src/analysis/vector/qgsoverlayanalyzer.h
  17. +7 −7 src/app/composer/qgsattributeselectiondialog.cpp
  18. +6 −3 src/app/legend/qgslegendlayer.cpp
  19. +4 −4 src/app/qgisapp.cpp
  20. +6 −8 src/app/qgsaddjoindialog.cpp
  21. +3 −3 src/app/qgsattributeactiondialog.cpp
  22. +1 −1 src/app/qgsattributeactiondialog.h
  23. +14 −19 src/app/qgsattributedialog.cpp
  24. +0 −1 src/app/qgsattributedialog.h
  25. +9 −11 src/app/qgsattributetabledialog.cpp
  26. +6 −5 src/app/qgsattributetypedialog.cpp
  27. +2 −2 src/app/qgsclipboard.cpp
  28. +2 −2 src/app/qgsclipboard.h
  29. +5 −5 src/app/qgscontinuouscolordialog.cpp
  30. +4 −5 src/app/qgsdelattrdialog.cpp
  31. +11 −17 src/app/qgsdiagramproperties.cpp
  32. +10 −10 src/app/qgsfeatureaction.cpp
  33. +8 −10 src/app/qgsfieldcalculator.cpp
  34. +5 −5 src/app/qgsgraduatedsymboldialog.cpp
  35. +14 −18 src/app/qgsidentifyresults.cpp
  36. +7 −7 src/app/qgslabeldialog.cpp
  37. +6 −7 src/app/qgslabelinggui.cpp
  38. +1 −1 src/app/qgslabelpropertydialog.cpp
  39. +3 −4 src/app/qgsmaptooloffsetcurve.cpp
  40. +7 −9 src/app/qgsmergeattributesdialog.cpp
  41. +7 −9 src/app/qgssinglesymboldialog.cpp
  42. +5 −5 src/app/qgsuniquevaluedialog.cpp
  43. +11 −12 src/app/qgsvectorlayerproperties.cpp
  44. +2 −2 src/core/composer/qgsatlascomposition.cpp
  45. +8 −10 src/core/composer/qgscomposerattributetable.cpp
  46. +4 −4 src/core/composer/qgslegendmodel.cpp
  47. +7 −7 src/core/qgsattributeaction.cpp
  48. +10 −10 src/core/qgsexpression.cpp
  49. +10 −10 src/core/qgsexpression.h
  50. +3 −3 src/core/qgsfeature.cpp
  51. +5 −4 src/core/qgsfeature.h
  52. +5 −5 src/core/qgsfeaturerequest.cpp
  53. +1 −1 src/core/qgsfeaturerequest.h
  54. +15 −13 src/core/qgslabel.cpp
  55. +5 −4 src/core/qgslabel.h
  56. +0 −6 src/core/qgsmaplayer.h
  57. +3 −4 src/core/qgsprojectfiletransform.cpp
  58. +23 −22 src/core/qgsvectordataprovider.cpp
  59. +1 −6 src/core/qgsvectordataprovider.h
  60. +13 −15 src/core/qgsvectorfilewriter.cpp
  61. +2 −2 src/core/qgsvectorfilewriter.h
  62. +106 −172 src/core/qgsvectorlayer.cpp
  63. +2 −8 src/core/qgsvectorlayer.h
  64. +5 −5 src/core/qgsvectorlayerimport.cpp
  65. +1 −1 src/core/qgsvectorlayerimport.h
  66. +24 −41 src/core/qgsvectorlayerjoinbuffer.cpp
  67. +6 −10 src/core/qgsvectorlayerjoinbuffer.h
  68. +0 −26 src/core/raster/qgsrasterlayer.cpp
  69. +0 −6 src/core/raster/qgsrasterlayer.h
  70. +4 −4 src/core/renderer/qgscontinuouscolorrenderer.cpp
  71. +3 −2 src/core/renderer/qgsgraduatedsymbolrenderer.cpp
  72. +4 −4 src/core/renderer/qgsuniquevaluerenderer.cpp
  73. +8 −4 src/core/symbology-ng/qgssymbologyv2conversion.cpp
  74. +7 −5 src/core/symbology/qgssymbol.cpp
  75. +5 −4 src/gui/attributetable/qgsattributetablemodel.cpp
  76. +3 −4 src/gui/qgsexpressionbuilderwidget.cpp
  77. +1 −1 src/gui/qgsexpressionbuilderwidget.h
  78. +3 −4 src/gui/qgsformannotationitem.cpp
  79. +4 −3 src/gui/qgsquerybuilder.cpp
  80. +5 −5 src/gui/qgssearchquerybuilder.cpp
  81. +3 −4 src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp
  82. +3 −5 src/gui/symbology-ng/qgsellipsesymbollayerv2widget.cpp
  83. +4 −5 src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
  84. +3 −4 src/gui/symbology-ng/qgspointdisplacementrendererwidget.cpp
  85. +3 −3 src/gui/symbology-ng/qgsrendererv2widget.cpp
  86. +3 −3 src/gui/symbology-ng/qgsrendererv2widget.h
  87. +2 −2 src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
  88. +3 −4 src/gui/symbology-ng/qgsvectorfieldsymbollayerwidget.cpp
  89. +7 −6 src/mapserver/qgsprojectparser.cpp
  90. +4 −4 src/mapserver/qgswfsserver.cpp
  91. +5 −3 src/mapserver/qgswfsserver.h
  92. +1 −1 src/mapserver/qgswmsserver.cpp
  93. +3 −4 src/plugins/diagram_overlay/qgsdiagramoverlay.cpp
  94. +20 −18 src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp
  95. +4 −8 src/plugins/grass/qgsgrassmodule.cpp
  96. +3 −2 src/plugins/grass/qgsgrassmodule.h
  97. +4 −6 src/plugins/heatmap/heatmapgui.cpp
  98. +3 −4 src/plugins/interpolation/qgsinterpolationdialog.cpp
  99. +4 −4 src/plugins/offline_editing/offline_editing.cpp
  100. +3 −4 src/plugins/roadgraph/linevectorlayerwidget.cpp
  101. +3 −4 src/plugins/zonal_statistics/qgszonalstatisticsdialog.cpp
  102. +11 −18 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  103. +2 −7 src/providers/delimitedtext/qgsdelimitedtextprovider.h
  104. +6 −13 src/providers/gpx/qgsgpxprovider.cpp
  105. +2 −7 src/providers/gpx/qgsgpxprovider.h
  106. +2 −2 src/providers/grass/qgsgrassfeatureiterator.cpp
  107. +6 −15 src/providers/grass/qgsgrassprovider.cpp
  108. +2 −7 src/providers/grass/qgsgrassprovider.h
  109. +1 −1 src/providers/memory/qgsmemoryfeatureiterator.cpp
  110. +2 −12 src/providers/memory/qgsmemoryprovider.cpp
  111. +2 −7 src/providers/memory/qgsmemoryprovider.h
  112. +0 −8 src/providers/mssql/qgsmssqlprovider.cpp
  113. +0 −5 src/providers/mssql/qgsmssqlprovider.h
  114. +4 −4 src/providers/ogr/qgsogrfeatureiterator.cpp
  115. +15 −22 src/providers/ogr/qgsogrprovider.cpp
  116. +3 −8 src/providers/ogr/qgsogrprovider.h
  117. +0 −6 src/providers/osm/osmprovider.cpp
  118. +0 −5 src/providers/osm/osmprovider.h
  119. +22 −14 src/providers/postgres/qgspostgresfeatureiterator.cpp
  120. +1 −0 src/providers/postgres/qgspostgresfeatureiterator.h
  121. +46 −60 src/providers/postgres/qgspostgresprovider.cpp
  122. +3 −8 src/providers/postgres/qgspostgresprovider.h
  123. +4 −4 src/providers/spatialite/qgsspatialitefeatureiterator.cpp
  124. +22 −35 src/providers/spatialite/qgsspatialiteprovider.cpp
  125. +3 −8 src/providers/spatialite/qgsspatialiteprovider.h
  126. +0 −5 src/providers/sqlanywhere/qgssqlanywhereprovider.h
  127. +0 −5 src/providers/wfs/qgswfsprovider.cpp
  128. +0 −1 src/providers/wfs/qgswfsprovider.h
  129. +2 −2 tests/src/core/regression1141.cpp
  130. +1 −1 tests/src/core/testqgsexpression.cpp
  131. +2 −2 tests/src/core/testqgsmaprenderer.cpp
  132. +2 −2 tests/src/core/testqgsvectorfilewriter.cpp
  133. +3 −3 tests/src/python/test_qgscomposerlabel.py
  134. +14 −15 tests/src/python/test_qgsmemoryprovider.py
@@ -14,7 +14,7 @@ class QgsExpression
QString parserErrorString() const;

//! Get the expression ready for evaluation - find out column indexes.
bool prepare( const QMap<int, QgsField> &fields );
bool prepare( const QgsFields &fields );

//! Get list of columns referenced by the expression
QStringList referencedColumns();
@@ -29,7 +29,7 @@ class QgsExpression

//! Evaluate the feature and return the result
//! @note this method does not expect that prepare() has been called on this instance
QVariant evaluate( QgsFeature* f, const QMap<int, QgsField>& fields );
QVariant evaluate( QgsFeature* f, const QgsFields& fields );

//! Returns true if an error occurred when evaluating last input
bool hasEvalError() const;
@@ -169,7 +169,7 @@ class QgsExpression

// abstract virtual preparation function
// errors are reported to the parent
virtual bool prepare( QgsExpression* parent, const QMap<int, QgsField> &fields ) = 0;
virtual bool prepare( QgsExpression* parent, const QgsFields &fields ) = 0;

virtual QString dump() const = 0;

@@ -224,7 +224,7 @@ class QgsExpression
QgsExpression::UnaryOperator op();
QgsExpression::Node* operand();

virtual bool prepare( QgsExpression* parent, const QMap<int, QgsField> &fields );
virtual bool prepare( QgsExpression* parent, const QgsFields &fields );
virtual QVariant eval( QgsExpression* parent, QgsFeature* f );
virtual QString dump() const;

@@ -246,7 +246,7 @@ class QgsExpression
QgsExpression::Node* opLeft();
QgsExpression::Node* opRight();

virtual bool prepare( QgsExpression* parent, const QMap<int, QgsField> &fields );
virtual bool prepare( QgsExpression* parent, const QgsFields &fields );
virtual QVariant eval( QgsExpression* parent, QgsFeature* f );
virtual QString dump() const;

@@ -268,7 +268,7 @@ class QgsExpression
bool isNotIn();
QgsExpression::NodeList* list();

virtual bool prepare( QgsExpression* parent, const QMap<int, QgsField> &fields );
virtual bool prepare( QgsExpression* parent, const QgsFields &fields );
virtual QVariant eval( QgsExpression* parent, QgsFeature* f );
virtual QString dump() const;

@@ -289,7 +289,7 @@ class QgsExpression
int fnIndex();
QgsExpression::NodeList* args();

virtual bool prepare( QgsExpression* parent, const QMap<int, QgsField> &fields );
virtual bool prepare( QgsExpression* parent, const QgsFields &fields );
virtual QVariant eval( QgsExpression* parent, QgsFeature* f );
virtual QString dump() const;

@@ -308,7 +308,7 @@ class QgsExpression

QVariant value();

virtual bool prepare( QgsExpression* parent, const QMap<int, QgsField> &fields );
virtual bool prepare( QgsExpression* parent, const QgsFields &fields );
virtual QVariant eval( QgsExpression* parent, QgsFeature* f );
virtual QString dump() const;

@@ -327,7 +327,7 @@ class QgsExpression

QString name();

virtual bool prepare( QgsExpression* parent, const QMap<int, QgsField> &fields );
virtual bool prepare( QgsExpression* parent, const QgsFields &fields );
virtual QVariant eval( QgsExpression* parent, QgsFeature* f );
virtual QString dump() const;

@@ -358,7 +358,7 @@ class QgsExpression
~NodeCondition();

virtual QVariant eval( QgsExpression* parent, QgsFeature* f );
virtual bool prepare( QgsExpression* parent, const QMap<int, QgsField> &fields );
virtual bool prepare( QgsExpression* parent, const QgsFields &fields );
virtual QString dump() const;

virtual void toOgcFilter( QDomDocument &doc, QDomElement &element ) const;
@@ -17,7 +17,7 @@ typedef QMap<int, QString> QgsFieldNameMap;
typedef QList<QgsFeature> QgsFeatureList;

typedef QMap<int, QgsField> QgsFieldMap;

typedef QVector<QgsField> QgsFields;

class QgsFeature
{
@@ -159,12 +159,12 @@ class QgsFeature
/** Assign a field map with the feature to allow attribute access by attribute name
* @note added in 2.0
*/
void setFieldMap( const QgsFieldMap* fields );
void setFields( const QgsFields* fields );

/** Get associated field map. may be NULL
* @note added in 2.0
*/
const QgsFieldMap* fieldMap() const;
const QgsFields* fields() const;

/** Insert a value into attribute. Returns false if attribute name could not be converted to index.
* Field map must be associated to make this work.
@@ -45,6 +45,6 @@ class QgsFeatureRequest
const QgsAttributeList& subsetOfAttributes() const;

//! Set a subset of attributes by names that will be fetched
QgsFeatureRequest& setSubsetOfAttributes( const QStringList& attrNames, const QgsFieldMap& fields );
QgsFeatureRequest& setSubsetOfAttributes( const QStringList& attrNames, const QgsFields& fields );

};
@@ -7,7 +7,7 @@ class QgsLabel
%End

public:
QgsLabel( const QMap<int, QgsField> & fields );
QgsLabel( const QgsFields & fields );

~QgsLabel();

@@ -85,10 +85,10 @@ class QgsLabel
void addRequiredFields( QList<int> & fields ) const;

//! Set available fields
void setFields( const QMap<int, QgsField> & fields );
void setFields( const QgsFields & fields );

//! Available vector fields
QMap<int, QgsField> & fields();
const QgsFields & fields();

/** Pointer to default attributes.
* @deprecated in version 2 as it is badly named. Rather use attributes.
@@ -181,12 +181,6 @@ class QgsMapLayer : QObject
* @note Added in v1.4 */
void removeCustomProperty( const QString& key );

/** Copies the symbology settings from another layer. Returns true in case of success */
virtual bool copySymbologySettings( const QgsMapLayer& other ) = 0;

/** Returns true if this layer can be in the same symbology group with another layer */
virtual bool hasCompatibleSymbology( const QgsMapLayer& other ) const = 0;

/** Accessor for transparency level. */
unsigned int getTransparency();

@@ -78,17 +78,12 @@ class QgsVectorDataProvider : QgsDataProvider
*/
virtual long featureCount() const = 0;

/**
* Number of attribute fields for a feature in the layer
*/
virtual uint fieldCount() const = 0;

/**
* Return a map of indexes with field names for this layer
* @return map of fields
* @see QgsFieldMap
*/
virtual const QMap<int, QgsField> &fields() const = 0;
virtual const QgsFields &fields() const = 0;

/**
* Return a short comment for the data that this provider is
@@ -57,7 +57,7 @@ class QgsVectorFileWriter
/** create shapefile and initialize it */
QgsVectorFileWriter( const QString& vectorFileName,
const QString& fileEncoding,
const QMap<int, QgsField>& fields,
const QgsFields& fields,
QGis::WkbType geometryType,
const QgsCoordinateReferenceSystem* srs,
const QString& driverName = "ESRI Shapefile",
@@ -180,12 +180,6 @@ class QgsVectorLayer : QgsMapLayer
/** Returns the bounding box of the selected features. If there is no selection, QgsRectangle(0,0,0,0) is returned */
QgsRectangle boundingBoxOfSelected();

/** Copies the symbology settings from another layer. Returns true in case of success */
bool copySymbologySettings( const QgsMapLayer& other );

/** Returns true if this layer can be in the same symbology group with another layer */
bool hasCompatibleSymbology( const QgsMapLayer& other ) const;

/** Returns a pointer to the renderer */
const QgsRenderer* renderer() const;

@@ -476,7 +470,7 @@ class QgsVectorLayer : QgsMapLayer
QgsRectangle extent();

/** returns field list in the to-be-committed state */
const QMap<int, QgsField> &pendingFields() const;
const QgsFields &pendingFields() const;

/** returns list of attributes */
QList<int> pendingAllAttributesList();
@@ -43,7 +43,7 @@ class QgsVectorLayerImport
/** create a empty layer and add fields to it */
QgsVectorLayerImport( const QString &uri,
const QString &provider,
const QMap<int, QgsField> &fields,
const QgsFields &fields,
QGis::WkbType geometryType,
const QgsCoordinateReferenceSystem* crs,
bool overwrite = false,
@@ -16,15 +16,15 @@ class QgsVectorLayerJoinBuffer

/**Creates QgsVectorLayerJoinBuffer for the joins containing attributes to fetch*/
void select( const QgsAttributeList& fetchAttributes,
QgsAttributeList& sourceJoinFields, int maxProviderIndex );
QgsAttributeList& sourceJoinFields, int providerFieldCount );

/**Updates field map with joined attributes
@param fields map to append joined attributes
@param maxIndex in/out: maximum attribute index*/
void updateFieldMap( QMap<int, QgsField> &fields, int& maxIndex );
*/
void updateFields( QgsFields& fields );

/**Update feature with uncommited attribute updates and joined attributes*/
void updateFeatureAttributes( QgsFeature &f, int maxProviderIndex, bool all = false );
void updateFeatureAttributes( QgsFeature &f, int providerFieldCount, bool all = false );

/**Calls cacheJoinLayer() for all vector joins*/
void createJoinCaches();
@@ -47,9 +47,6 @@ class QgsVectorLayerJoinBuffer
@param maxProviderIndex maximum attribute index of the vectorlayer provider
@param indexOffset out: offset between layer index and original provider index
@return pointer to the join if the index belongs to a joined field, otherwise 0 (possibily provider field or added field)*/
const QgsVectorJoinInfo* joinForFieldIndex( int index, int maxProviderIndex, int& indexOffset ) const;
const QgsVectorJoinInfo* joinForFieldIndex( int index, int providerFieldCount, int& indexOffset ) const;

/** Helper function to find out the maximum index of a field map
@return true in case of success, otherwise false (e.g. empty map)*/
static bool maximumIndex( const QMap<int, QgsField> &fMap, int& index );
};
@@ -267,9 +267,6 @@ class QgsRasterLayer : QgsMapLayer

const QgsContrastEnhancement* constContrastEnhancement( unsigned int theBand ) const;

/**Copies the symbology settings from another layer. Returns true in case of success*/
bool copySymbologySettings( const QgsMapLayer& theOther );

/** \brief Get a pointer to the color table */
QList<QgsColorRampShader::ColorRampItem> colorTable( int theBandNoInt );

@@ -301,9 +298,6 @@ class QgsRasterLayer : QgsMapLayer
* */
QString drawingStyleAsString() const;

/** \brief Checks if symbology is the same as another layers */
bool hasCompatibleSymbology( const QgsMapLayer& theOther ) const;

/** \brief Identify raster value(s) found on the point position */
bool identify( const QgsPoint & point, QMap<QString, QString>& results /Out/ );

@@ -82,7 +82,7 @@ class QgsExpressionBuilderWidget : QWidget
*/
void loadFieldNames();

void loadFieldNames( QMap<int, QgsField> fields );
void loadFieldNames( const QgsFields& fields );

/** Gets the expression string that has been set in the expression area.
* @returns The expression as a string. */
@@ -3083,8 +3083,8 @@ bool DualEdgeTriangulation::saveAsShapefile( const QString& fileName ) const
{
QString shapeFileName = fileName;

QgsFieldMap fields;
fields.insert( 0, QgsField( "type", QVariant::String, "String" ) );
QgsFields fields;
fields.append( QgsField( "type", QVariant::String, "String" ) );

// add the extension if not present
if ( shapeFileName.indexOf( ".shp" ) == -1 )
@@ -47,7 +47,7 @@ bool QgsGeometryAnalyzer::simplify( QgsVectorLayer* layer,
QGis::WkbType outputType = dp->geometryType();
const QgsCoordinateReferenceSystem crs = layer->crs();

QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), dp->fields(), outputType, &crs );
QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), layer->pendingFields(), outputType, &crs );
QgsFeature currentFeature;

//take only selection
@@ -163,7 +163,7 @@ bool QgsGeometryAnalyzer::centroids( QgsVectorLayer* layer, const QString& shape
QGis::WkbType outputType = QGis::WKBPoint;
const QgsCoordinateReferenceSystem crs = layer->crs();

QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), dp->fields(), outputType, &crs );
QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), layer->pendingFields(), outputType, &crs );
QgsFeature currentFeature;

//take only selection
@@ -279,17 +279,17 @@ bool QgsGeometryAnalyzer::extent( QgsVectorLayer* layer,
QGis::WkbType outputType = QGis::WKBPolygon;
const QgsCoordinateReferenceSystem crs = layer->crs();

QgsFieldMap fields;
fields.insert( 0 , QgsField( QString( "MINX" ), QVariant::Double ) );
fields.insert( 1 , QgsField( QString( "MINY" ), QVariant::Double ) );
fields.insert( 2 , QgsField( QString( "MAXX" ), QVariant::Double ) );
fields.insert( 3 , QgsField( QString( "MAXY" ), QVariant::Double ) );
fields.insert( 4 , QgsField( QString( "CNTX" ), QVariant::Double ) );
fields.insert( 5 , QgsField( QString( "CNTY" ), QVariant::Double ) );
fields.insert( 6 , QgsField( QString( "AREA" ), QVariant::Double ) );
fields.insert( 7 , QgsField( QString( "PERIM" ), QVariant::Double ) );
fields.insert( 8 , QgsField( QString( "HEIGHT" ), QVariant::Double ) );
fields.insert( 9 , QgsField( QString( "WIDTH" ), QVariant::Double ) );
QgsFields fields;
fields.append( QgsField( QString( "MINX" ), QVariant::Double ) );
fields.append( QgsField( QString( "MINY" ), QVariant::Double ) );
fields.append( QgsField( QString( "MAXX" ), QVariant::Double ) );
fields.append( QgsField( QString( "MAXY" ), QVariant::Double ) );
fields.append( QgsField( QString( "CNTX" ), QVariant::Double ) );
fields.append( QgsField( QString( "CNTY" ), QVariant::Double ) );
fields.append( QgsField( QString( "AREA" ), QVariant::Double ) );
fields.append( QgsField( QString( "PERIM" ), QVariant::Double ) );
fields.append( QgsField( QString( "HEIGHT" ), QVariant::Double ) );
fields.append( QgsField( QString( "WIDTH" ), QVariant::Double ) );

QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), fields, outputType, &crs );

@@ -404,10 +404,10 @@ bool QgsGeometryAnalyzer::convexHull( QgsVectorLayer* layer, const QString& shap
{
useField = true;
}
QgsFieldMap fields;
fields.insert( 0 , QgsField( QString( "UID" ), QVariant::String ) );
fields.insert( 1 , QgsField( QString( "AREA" ), QVariant::Double ) );
fields.insert( 2 , QgsField( QString( "PERIM" ), QVariant::Double ) );
QgsFields fields;
fields.append( QgsField( QString( "UID" ), QVariant::String ) );
fields.append( QgsField( QString( "AREA" ), QVariant::Double ) );
fields.append( QgsField( QString( "PERIM" ), QVariant::Double ) );

QGis::WkbType outputType = QGis::WKBPolygon;
const QgsCoordinateReferenceSystem crs = layer->crs();
@@ -618,7 +618,7 @@ bool QgsGeometryAnalyzer::dissolve( QgsVectorLayer* layer, const QString& shapef
QGis::WkbType outputType = dp->geometryType();
const QgsCoordinateReferenceSystem crs = layer->crs();

QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), dp->fields(), outputType, &crs );
QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), layer->pendingFields(), outputType, &crs );
QgsFeature currentFeature;
QMultiMap<QString, QgsFeatureId> map;

@@ -771,7 +771,7 @@ bool QgsGeometryAnalyzer::buffer( QgsVectorLayer* layer, const QString& shapefil
}
const QgsCoordinateReferenceSystem crs = layer->crs();

QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), dp->fields(), outputType, &crs );
QgsVectorFileWriter vWriter( shapefileName, dp->encoding(), layer->pendingFields(), outputType, &crs );
QgsFeature currentFeature;
QgsGeometry *dissolveGeometry = 0; //dissolve geometry (if dissolve enabled)

@@ -951,7 +951,7 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer*
}
else
{
memoryProvider->addAttributes( eventLayer->pendingFields().values() );
memoryProvider->addAttributes( eventLayer->pendingFields().toList() );
}

//iterate over eventLayer and write new features to output file or layer

0 comments on commit 51122d2

Please sign in to comment.
You can’t perform that action at this time.