Skip to content

Commit 76ec56b

Browse files
author
timlinux
committed
Updates to api docs and some api consistency cleanups
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9213 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 49152d2 commit 76ec56b

16 files changed

+74
-57
lines changed

python/core/qgsgeometry.sip

+3-3
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,15 @@ class QgsGeometry
126126
* these error conditions. (Or maybe we add another method to this
127127
* object to help make the distinction?)
128128
*/
129-
bool insertVertexBefore(double x, double y, int beforeVertex);
129+
bool insertVertex(double x, double y, int beforeVertex);
130130

131131
/** Moves the vertex at the given position number,
132132
* ring and item (first number is index 0)
133133
* to the given coordinates.
134134
* Returns FALSE if atVertex does not correspond to a valid vertex
135135
* on this geometry
136136
*/
137-
bool moveVertexAt(double x, double y, int atVertex);
137+
bool moveVertex(double x, double y, int atVertex);
138138

139139
/** Deletes the vertex at the given position number,
140140
* ring and item (first number is index 0)
@@ -146,7 +146,7 @@ class QgsGeometry
146146
* these error conditions. (Or maybe we add another method to this
147147
* object to help make the distinction?)
148148
*/
149-
bool deleteVertexAt(int atVertex);
149+
bool deleteVertex(int atVertex);
150150

151151
/**
152152
* Returns coordinates of a vertex.

python/core/qgsvectordataprovider.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ class QgsVectorDataProvider : QgsDataProvider
221221
/**
222222
* Returns the index of a field name or -1 if the field does not exist
223223
*/
224-
int indexFromFieldName(const QString& fieldName) const;
224+
int fieldNameIndex(const QString& fieldName) const;
225225

226226
/**
227227
* Return list of indexes to fetch all attributes in getNextFeature()
@@ -235,6 +235,6 @@ class QgsVectorDataProvider : QgsDataProvider
235235
* Set whether provider should return also features that don't have
236236
* associated geometry. FALSE by default
237237
*/
238-
void setFetchFeaturesWithoutGeom(bool fetch);
238+
void enableGeometrylessFeatures(bool fetch);
239239

240240
};

python/core/qgsvectorlayer.sip

+3-3
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,18 @@ public:
165165
* in the given ring, item (first number is index 0), and feature
166166
* Not meaningful for Point geometries
167167
*/
168-
bool insertVertexBefore(double x, double y, int atFeatureId, int beforeVertex);
168+
bool insertVertex(double x, double y, int atFeatureId, int beforeVertex);
169169

170170
/** Moves the vertex at the given position number,
171171
* ring and item (first number is index 0), and feature
172172
* to the given coordinates
173173
*/
174-
bool moveVertexAt(double x, double y, int atFeatureId, int atVertex);
174+
bool moveVertex(double x, double y, int atFeatureId, int atVertex);
175175

176176
/** Deletes the vertex at the given position number,
177177
* ring and item (first number is index 0), and feature
178178
*/
179-
bool deleteVertexAt(int atFeatureId, int atVertex);
179+
bool deleteVertex(int atFeatureId, int atVertex);
180180

181181
/** Deletes the selected features
182182
* @return true in case of success and false otherwise

scripts/astyle.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ $ARTISTIC_STYLE_OPTIONS \
3232
--unpad=paren"
3333

3434
for f in "$@"; do
35-
flip -ub "$f"
35+
#flip -ub "$f"
3636
#qgsloggermig.pl "$f"
3737
astyle $ARTISTIC_STYLE_OPTIONS "$f"
3838
done

src/app/qgsmaptooladdvertex.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void QgsMapToolAddVertex::canvasReleaseEvent( QMouseEvent * e )
9898
QList<QgsSnappingResult>::iterator sr_it = mRecentSnappingResults.begin();
9999
for ( ; sr_it != mRecentSnappingResults.end(); ++sr_it )
100100
{
101-
vlayer->insertVertexBefore( snappedPointLayerCoord.x(), snappedPointLayerCoord.y(), sr_it->snappedAtGeometry, sr_it->afterVertexNr );
101+
vlayer->insertVertex( snappedPointLayerCoord.x(), snappedPointLayerCoord.y(), sr_it->snappedAtGeometry, sr_it->afterVertexNr );
102102
}
103103
}
104104
}

src/app/qgsmaptooldeletevertex.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void QgsMapToolDeleteVertex::canvasReleaseEvent( QMouseEvent * e )
8181
QList<QgsSnappingResult>::iterator sr_it = mRecentSnappingResults.begin();
8282
for ( ; sr_it != mRecentSnappingResults.end(); ++sr_it )
8383
{
84-
vlayer->deleteVertexAt( sr_it->snappedAtGeometry, sr_it->snappedVertexNr );
84+
vlayer->deleteVertex( sr_it->snappedAtGeometry, sr_it->snappedVertexNr );
8585
}
8686
}
8787

src/app/qgsmaptoolmovevertex.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void QgsMapToolMoveVertex::canvasReleaseEvent( QMouseEvent * e )
168168
QList<QgsSnappingResult>::iterator sr_it = mRecentSnappingResults.begin();
169169
for ( ; sr_it != mRecentSnappingResults.end(); ++sr_it )
170170
{
171-
if ( !vlayer->moveVertexAt( snappedPointLayerCoord.x(), snappedPointLayerCoord.y(), sr_it->snappedAtGeometry, sr_it->snappedVertexNr ) )
171+
if ( !vlayer->moveVertex( snappedPointLayerCoord.x(), snappedPointLayerCoord.y(), sr_it->snappedAtGeometry, sr_it->snappedVertexNr ) )
172172
{
173173
//error
174174
}

src/app/qgsuniquevaluedialog.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void QgsUniqueValueDialog::apply()
149149
QgsVectorDataProvider *provider = dynamic_cast<QgsVectorDataProvider *>( mVectorLayer->dataProvider() );
150150
if ( provider )
151151
{
152-
int fieldIndex = provider->indexFromFieldName( mClassificationComboBox->currentText() );
152+
int fieldIndex = provider->fieldNameIndex( mClassificationComboBox->currentText() );
153153
if ( fieldIndex != -1 )
154154
{
155155
renderer->setClassificationField( fieldIndex );
@@ -292,7 +292,7 @@ void QgsUniqueValueDialog::changeClassificationAttribute()
292292
QgsVectorDataProvider *provider = dynamic_cast<QgsVectorDataProvider *>( mVectorLayer->dataProvider() );
293293
if ( provider )
294294
{
295-
int nr = provider->indexFromFieldName( attributeName );
295+
int nr = provider->fieldNameIndex( attributeName );
296296
if ( nr == -1 )
297297
{
298298
return;

src/core/qgsgeometry.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ void QgsGeometry::adjacentVerticies( int atVertex, int& beforeVertex, int& after
11471147

11481148

11491149

1150-
bool QgsGeometry::insertVertexBefore( double x, double y,
1150+
bool QgsGeometry::insertVertex( double x, double y,
11511151
int beforeVertex,
11521152
const GEOSCoordSequence* old_sequence,
11531153
GEOSCoordSequence** new_sequence )
@@ -1199,7 +1199,7 @@ bool QgsGeometry::insertVertexBefore( double x, double y,
11991199
return inserted;
12001200
}
12011201

1202-
bool QgsGeometry::moveVertexAt( double x, double y, int atVertex )
1202+
bool QgsGeometry::moveVertex( double x, double y, int atVertex )
12031203
{
12041204
int vertexnr = atVertex;
12051205

@@ -1448,7 +1448,7 @@ bool QgsGeometry::moveVertexAt( double x, double y, int atVertex )
14481448
}
14491449
}
14501450

1451-
bool QgsGeometry::deleteVertexAt( int atVertex )
1451+
bool QgsGeometry::deleteVertex( int atVertex )
14521452
{
14531453
int vertexnr = atVertex;
14541454
bool success = false;
@@ -1775,7 +1775,7 @@ bool QgsGeometry::deleteVertexAt( int atVertex )
17751775
}
17761776
}
17771777

1778-
bool QgsGeometry::insertVertexBefore( double x, double y, int beforeVertex )
1778+
bool QgsGeometry::insertVertex( double x, double y, int beforeVertex )
17791779
{
17801780
int vertexnr = beforeVertex;
17811781
bool success = false;

src/core/qgsgeometry.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ class CORE_EXPORT QgsGeometry
164164
* these error conditions. (Or maybe we add another method to this
165165
* object to help make the distinction?)
166166
*/
167-
bool insertVertexBefore( double x, double y, int beforeVertex );
167+
bool insertVertex( double x, double y, int beforeVertex );
168168

169169
/** Moves the vertex at the given position number
170170
* and item (first number is index 0)
171171
* to the given coordinates.
172172
* Returns FALSE if atVertex does not correspond to a valid vertex
173173
* on this geometry
174174
*/
175-
bool moveVertexAt( double x, double y, int atVertex );
175+
bool moveVertex( double x, double y, int atVertex );
176176

177177
/** Deletes the vertex at the given position number and item
178178
* (first number is index 0)
@@ -184,7 +184,7 @@ class CORE_EXPORT QgsGeometry
184184
* these error conditions. (Or maybe we add another method to this
185185
* object to help make the distinction?)
186186
*/
187-
bool deleteVertexAt( int atVertex );
187+
bool deleteVertex( int atVertex );
188188

189189
/**
190190
* Returns coordinates of a vertex.
@@ -362,7 +362,7 @@ class CORE_EXPORT QgsGeometry
362362
* Returns FALSE if beforeVertex does not correspond to a valid vertex number
363363
* on the Coordinate Sequence.
364364
*/
365-
bool insertVertexBefore( double x, double y,
365+
bool insertVertex( double x, double y,
366366
int beforeVertex,
367367
const GEOSCoordSequence* old_sequence,
368368
GEOSCoordSequence** new_sequence );

src/core/qgsvectordataprovider.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ QString QgsVectorDataProvider::capabilitiesString() const
218218
}
219219

220220

221-
int QgsVectorDataProvider::indexFromFieldName( const QString& fieldName ) const
221+
int QgsVectorDataProvider::fieldNameIndex( const QString& fieldName ) const
222222
{
223223
const QgsFieldMap &theFields = fields();
224224

@@ -243,7 +243,7 @@ QgsAttributeList QgsVectorDataProvider::allAttributesList()
243243
return list;
244244
}
245245

246-
void QgsVectorDataProvider::setFetchFeaturesWithoutGeom( bool fetch )
246+
void QgsVectorDataProvider::enableGeometrylessFeatures( bool fetch )
247247
{
248248
mFetchFeaturesWithoutGeom = fetch;
249249
}

src/core/qgsvectordataprovider.h

+21-13
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ class QTextCodec;
3232
typedef QMap<QString, QString> QgsNewAttributesMap;
3333
typedef QMap<QString, QVariant::Type> QgsNativeTypeMap;
3434

35-
/** Base class for vector data providers
35+
/** \ingroup core
36+
* This is the base class for vector data providers.
37+
*
38+
* Data providers abstract the retrieval and writing (where supported)
39+
* of feature and attrubute information from a spatial datasource.
40+
*
41+
*
3642
*/
3743
class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
3844
{
@@ -95,9 +101,9 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
95101

96102
/**
97103
* Gets the feature at the given feature ID.
98-
* @param featureId id of the feature
99-
* @param feature feature which will receive the data
100-
* @param fetchGeoemtry if true, geometry will be fetched from the provider
104+
* @param featureId of the feature to be returned
105+
* @param feature which will receive the data
106+
* @param fetchGeometry flag which if true, will cause the geometry to be fetched from the provider
101107
* @param fetchAttributes a list containing the indexes of the attribute fields to copy
102108
* @return True when feature was found, otherwise false
103109
*
@@ -138,6 +144,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
138144
/**
139145
* Return a map of indexes with field names for this layer
140146
* @return map of fields
147+
* @see QgsFieldMap
141148
*/
142149
virtual const QgsFieldMap &fields() const = 0;
143150

@@ -151,7 +158,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
151158
virtual void reset() = 0;
152159

153160
/**
154-
* Returns the minimum value of an attributs
161+
* Returns the minimum value of an attribute
155162
* @param index the index of the attribute
156163
*
157164
* Default implementation walks all numeric attributes and caches minimal
@@ -161,7 +168,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
161168
virtual QVariant minimumValue( int index );
162169

163170
/**
164-
* Returns the maximum value of an attributs
171+
* Returns the maximum value of an attribute
165172
* @param index the index of the attribute
166173
*
167174
* Default implementation walks all numeric attributes and caches minimal
@@ -186,7 +193,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
186193
virtual bool addFeatures( QgsFeatureList &flist );
187194

188195
/**
189-
* Deletes a feature
196+
* Deletes one or more features
190197
* @param id list containing feature ids to delete
191198
* @return true in case of success and false in case of failure
192199
*/
@@ -220,9 +227,10 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
220227

221228
/**
222229
* Changes geometries of existing features
223-
* @param geometry_map A std::map containing the feature IDs to change the geometries of.
224-
* the second map parameter being the new geometries themselves
225-
* @return true in case of success and false in case of failure
230+
* @param geometry_map A QgsGeometryMap whose index contains the feature IDs
231+
* that will have their geometries changed.
232+
* The second map parameter being the new geometries themselves
233+
* @return True in case of success and false in case of failure
226234
*/
227235
virtual bool changeGeometryValues( QgsGeometryMap & geometry_map );
228236

@@ -257,7 +265,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
257265
/**
258266
* Returns the index of a field name or -1 if the field does not exist
259267
*/
260-
int indexFromFieldName( const QString& fieldName ) const;
268+
int fieldNameIndex( const QString& fieldName ) const;
261269

262270
/**
263271
* Return list of indexes to fetch all attributes in getNextFeature()
@@ -268,10 +276,10 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
268276
const QgsNativeTypeMap &supportedNativeTypes() const;
269277

270278
/**
271-
* Set whether provider should return also features that don't have
279+
* Set whether provider should also return features that don't have
272280
* associated geometry. FALSE by default
273281
*/
274-
void setFetchFeaturesWithoutGeom( bool fetch );
282+
void enableGeometrylessFeatures( bool fetch );
275283

276284
protected:
277285
QVariant convertValue( QVariant::Type type, QString value );

src/core/qgsvectorfilewriter.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ typedef void *OGRGeometryH;
2929

3030
class QTextCodec;
3131

32-
/**
32+
/** \ingroup core
33+
* A convenience class for writing vector files to disk.
3334
There are two possibilities how to use this class:
3435
1. static call to QgsVectorFileWriter::writeAsShapefile(...) which saves the whole vector layer
3536
2. create an instance of the class and issue calls to addFeature(...)

src/core/qgsvectorlayer.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ bool QgsVectorLayer::addFeature( QgsFeature& f, bool alsoUpdateExtent )
14331433
}
14341434

14351435

1436-
bool QgsVectorLayer::insertVertexBefore( double x, double y, int atFeatureId, int beforeVertex )
1436+
bool QgsVectorLayer::insertVertex( double x, double y, int atFeatureId, int beforeVertex )
14371437
{
14381438
if ( !mEditable )
14391439
{
@@ -1453,7 +1453,7 @@ bool QgsVectorLayer::insertVertexBefore( double x, double y, int atFeatureId, in
14531453
mChangedGeometries[atFeatureId] = mCachedGeometries[atFeatureId];
14541454
}
14551455

1456-
mChangedGeometries[atFeatureId].insertVertexBefore( x, y, beforeVertex );
1456+
mChangedGeometries[atFeatureId].insertVertex( x, y, beforeVertex );
14571457

14581458
setModified( true, true ); // only geometry was changed
14591459

@@ -1463,7 +1463,7 @@ bool QgsVectorLayer::insertVertexBefore( double x, double y, int atFeatureId, in
14631463
}
14641464

14651465

1466-
bool QgsVectorLayer::moveVertexAt( double x, double y, int atFeatureId, int atVertex )
1466+
bool QgsVectorLayer::moveVertex( double x, double y, int atFeatureId, int atVertex )
14671467
{
14681468
if ( !mEditable )
14691469
{
@@ -1482,7 +1482,7 @@ bool QgsVectorLayer::moveVertexAt( double x, double y, int atFeatureId, int atVe
14821482
mChangedGeometries[atFeatureId] = mCachedGeometries[atFeatureId];
14831483
}
14841484

1485-
mChangedGeometries[atFeatureId].moveVertexAt( x, y, atVertex );
1485+
mChangedGeometries[atFeatureId].moveVertex( x, y, atVertex );
14861486

14871487
setModified( true, true ); // only geometry was changed
14881488

@@ -1492,7 +1492,7 @@ bool QgsVectorLayer::moveVertexAt( double x, double y, int atFeatureId, int atVe
14921492
}
14931493

14941494

1495-
bool QgsVectorLayer::deleteVertexAt( int atFeatureId, int atVertex )
1495+
bool QgsVectorLayer::deleteVertex( int atFeatureId, int atVertex )
14961496
{
14971497
if ( !mEditable )
14981498
{
@@ -1511,7 +1511,7 @@ bool QgsVectorLayer::deleteVertexAt( int atFeatureId, int atVertex )
15111511
mChangedGeometries[atFeatureId] = mCachedGeometries[atFeatureId];
15121512
}
15131513

1514-
mChangedGeometries[atFeatureId].deleteVertexAt( atVertex );
1514+
mChangedGeometries[atFeatureId].deleteVertex( atVertex );
15151515

15161516
setModified( true, true ); // only geometry was changed
15171517

@@ -3167,7 +3167,7 @@ int QgsVectorLayer::insertSegmentVerticesForSnap( const QList<QgsSnappingResult>
31673167
if ( it->snappedVertexNr == -1 ) // segment snap
31683168
{
31693169
layerPoint = it->snappedVertex;
3170-
if ( !insertVertexBefore( layerPoint.x(), layerPoint.y(), it->snappedAtGeometry, it->afterVertexNr ) )
3170+
if ( !insertVertex( layerPoint.x(), layerPoint.y(), it->snappedAtGeometry, it->afterVertexNr ) )
31713171
{
31723172
returnval = 3;
31733173
}

0 commit comments

Comments
 (0)