Skip to content

Commit 6969a1a

Browse files
committed
Fix travis errors
1 parent 7e1d142 commit 6969a1a

15 files changed

+69
-16
lines changed

python/core/qgsmaptopixelgeometrysimplifier.sip

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ class QgsMapToPixelSimplifier : QgsAbstractGeometrySimplifier
1212
Visvalingam = 2, //!< The simplification gives each point in a line an importance weighting, so that least important points are removed first
1313
};
1414

15-
QgsMapToPixelSimplifier( int simplifyFlags, double tolerance );
15+
//! Constructor
16+
QgsMapToPixelSimplifier( int simplifyFlags, double tolerance, SimplifyAlgorithm simplifyAlgorithm = Distance );
1617
virtual ~QgsMapToPixelSimplifier();
1718

1819
//! Applicable simplification flags
@@ -32,10 +33,14 @@ class QgsMapToPixelSimplifier : QgsAbstractGeometrySimplifier
3233
static bool equalSnapToGrid( double x1, double y1, double x2, double y2, double gridOriginX, double gridOriginY, float gridInverseSizeXY );
3334

3435
public:
36+
//! Gets the simplification hints of the vector layer managed
3537
int simplifyFlags() const;
38+
//! Sets the simplification hints of the vector layer managed
3639
void setSimplifyFlags( int simplifyFlags );
3740

41+
//! Gets the local simplification algorithm of the vector layer managed
3842
SimplifyAlgorithm simplifyAlgorithm() const;
43+
//! Sets the local simplification algorithm of the vector layer managed
3944
void setSimplifyAlgorithm( SimplifyAlgorithm simplifyAlgorithm );
4045

4146
//! Returns a simplified version the specified geometry

python/core/symbology-ng/qgsrendererv2.sip

+14
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,22 @@ class QgsFeatureRendererV2
403403
//! render editing vertex marker for a polygon
404404
void renderVertexMarkerPolygon( QPolygonF& pts, QList<QPolygonF>* rings, QgsRenderContext& context );
405405

406+
/**
407+
* Creates a point in screen coordinates from a wkb string in map
408+
* coordinates
409+
*/
406410
static QgsConstWkbPtr _getPoint( QPointF& pt, QgsRenderContext& context, QgsConstWkbPtr& wkb );
411+
412+
/**
413+
* Creates a line string in screen coordinates from a wkb string in map
414+
* coordinates
415+
*/
407416
static QgsConstWkbPtr _getLineString( QPolygonF& pts, QgsRenderContext& context, QgsConstWkbPtr& wkb, bool clipToExtent = true );
417+
418+
/**
419+
* Creates a polygon in screen coordinates from a wkb string in map
420+
* coordinates
421+
*/
408422
static QgsConstWkbPtr _getPolygon( QPolygonF& pts, QList<QPolygonF>& holes, QgsRenderContext& context, QgsConstWkbPtr& wkb, bool clipToExtent = true );
409423

410424
void setScaleMethodToSymbol( QgsSymbolV2* symbol, int scaleMethod );

src/core/geometry/qgswkbptr.h

+4
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ class CORE_EXPORT QgsConstWkbPtr
9696
mutable bool mEndianSwap;
9797
mutable QgsWKBTypes::Type mWkbType;
9898

99+
//! Verify bounds
99100
void verifyBound( int size ) const;
100101

102+
//! Read a value
101103
template<typename T> void read( T& v ) const
102104
{
103105
verifyBound( sizeof v );
@@ -117,7 +119,9 @@ class CORE_EXPORT QgsConstWkbPtr
117119
inline const QgsConstWkbPtr &operator>>( unsigned int &v ) const { read( v ); return *this; }
118120
inline const QgsConstWkbPtr &operator>>( char &v ) const { read( v ); return *this; }
119121

122+
//! Read a point
120123
virtual const QgsConstWkbPtr &operator>>( QPointF &point ) const;
124+
//! Read a point array
121125
virtual const QgsConstWkbPtr &operator>>( QPolygonF &points ) const;
122126

123127
inline void operator+=( int n ) { verifyBound( n ); mP += n; }

src/core/geometry/qgswkbsimplifierptr.h

+11
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,31 @@ class CORE_EXPORT QgsConstWkbSimplifierPtr : public QgsConstWkbPtr
3030
const QgsVectorSimplifyMethod& mSimplifyMethod;
3131

3232
public:
33+
//! Constructor
3334
QgsConstWkbSimplifierPtr( const unsigned char *p, int size, const QgsVectorSimplifyMethod &simplifyMethod );
3435

36+
//! Read a double
3537
inline const QgsConstWkbPtr &operator>>( double &v ) const { return QgsConstWkbPtr::operator>>( v ); }
38+
//! Read a float
3639
inline const QgsConstWkbPtr &operator>>( float &r ) const { return QgsConstWkbPtr::operator>>( r ); }
40+
//! Read a int
3741
inline const QgsConstWkbPtr &operator>>( int &v ) const { return QgsConstWkbPtr::operator>>( v ); }
42+
//! Read a uint
3843
inline const QgsConstWkbPtr &operator>>( unsigned int &v ) const { return QgsConstWkbPtr::operator>>( v ); }
44+
//! Read a char
3945
inline const QgsConstWkbPtr &operator>>( char &v ) const { return QgsConstWkbPtr::operator>>( v ); }
4046

47+
//! Read a point
4148
virtual const QgsConstWkbPtr &operator>>( QPointF &point ) const override;
49+
//! Read a point array
4250
virtual const QgsConstWkbPtr &operator>>( QPolygonF &points ) const override;
4351

52+
//! Move position forward
4453
inline void operator+=( int n ) { QgsConstWkbPtr::operator+=( n ); }
54+
//! Move position backward
4555
inline void operator-=( int n ) { QgsConstWkbPtr::operator-=( n ); }
4656

57+
//! unsigned char * operator
4758
inline operator const unsigned char *() const { return mP; }
4859
};
4960

src/core/qgsmaptopixelgeometrysimplifier.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424
QgsMapToPixelSimplifier::QgsMapToPixelSimplifier( int simplifyFlags, double tolerance, SimplifyAlgorithm simplifyAlgorithm )
2525
: mSimplifyFlags( simplifyFlags )
26-
, mTolerance( tolerance )
2726
, mSimplifyAlgorithm( simplifyAlgorithm )
27+
, mTolerance( tolerance )
2828
{
2929
}
3030

src/core/qgsmaptopixelgeometrysimplifier.h

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class CORE_EXPORT QgsMapToPixelSimplifier : public QgsAbstractGeometrySimplifier
4040
Visvalingam = 2, //!< The simplification gives each point in a line an importance weighting, so that least important points are removed first
4141
};
4242

43+
//! Constructor
4344
QgsMapToPixelSimplifier( int simplifyFlags, double tolerance, SimplifyAlgorithm simplifyAlgorithm = Distance );
4445
virtual ~QgsMapToPixelSimplifier();
4546

@@ -72,10 +73,14 @@ class CORE_EXPORT QgsMapToPixelSimplifier : public QgsAbstractGeometrySimplifier
7273
static bool equalSnapToGrid( double x1, double y1, double x2, double y2, double gridOriginX, double gridOriginY, float gridInverseSizeXY );
7374

7475
public:
76+
//! Gets the simplification hints of the vector layer managed
7577
int simplifyFlags() const { return mSimplifyFlags; }
78+
//! Sets the simplification hints of the vector layer managed
7679
void setSimplifyFlags( int simplifyFlags ) { mSimplifyFlags = simplifyFlags; }
7780

81+
//! Gets the local simplification algorithm of the vector layer managed
7882
SimplifyAlgorithm simplifyAlgorithm() const { return mSimplifyAlgorithm; }
83+
//! Sets the local simplification algorithm of the vector layer managed
7984
void setSimplifyAlgorithm( SimplifyAlgorithm simplifyAlgorithm ) { mSimplifyAlgorithm = simplifyAlgorithm; }
8085

8186
//! Returns a simplified version the specified geometry

src/core/qgsvectorsimplifymethod.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod()
2121
: mSimplifyHints( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD > 1 ? QgsVectorSimplifyMethod::FullSimplification : QgsVectorSimplifyMethod::GeometrySimplification )
2222
, mSimplifyAlgorithm( QgsVectorSimplifyMethod::Distance )
23-
, mThreshold( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD )
2423
, mTolerance( 1 )
24+
, mThreshold( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD )
2525
, mLocalOptimization( true )
2626
, mMaximumScale( 1 )
2727
{

src/core/simplify/effectivearea.c

+12-10
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
EFFECTIVE_AREAS* initiate_effectivearea( const POINTARRAY *inpts )
2828
{
29-
LWDEBUG( 2, "Entered initiate_effectivearea" );
29+
//LWDEBUG( 2, "Entered initiate_effectivearea" );
3030
EFFECTIVE_AREAS *ea;
3131
ea = ( EFFECTIVE_AREAS* )lwalloc( sizeof( EFFECTIVE_AREAS ) );
3232
ea->initial_arealist = ( areanode* )lwalloc( inpts->npoints * sizeof( areanode ) );
@@ -69,7 +69,7 @@ static double triarea2d( const double *P1, const double *P2, const double *P3 )
6969
*/
7070
static double triarea3d( const double *P1, const double *P2, const double *P3 )
7171
{
72-
LWDEBUG( 2, "Entered triarea3d" );
72+
//LWDEBUG( 2, "Entered triarea3d" );
7373
double ax, bx, ay, by, az, bz, cx, cy, cz, area;
7474

7575
ax = P1[0] - P2[0];
@@ -110,7 +110,7 @@ static int cmpfunc( const void * a, const void * b )
110110
*/
111111
static void down( MINHEAP *tree, areanode *arealist, int parent )
112112
{
113-
LWDEBUG( 2, "Entered down" );
113+
//LWDEBUG( 2, "Entered down" );
114114
areanode **treearray = tree->key_array;
115115
int left = parent * 2 + 1;
116116
int right = left + 1;
@@ -149,9 +149,11 @@ static void down( MINHEAP *tree, areanode *arealist, int parent )
149149
*/
150150
static void up( MINHEAP *tree, areanode *arealist, int c )
151151
{
152-
LWDEBUG( 2, "Entered up" );
152+
//LWDEBUG( 2, "Entered up" );
153153
areanode *tmp;
154154

155+
Q_UNUSED( arealist );
156+
155157
areanode **treearray = tree->key_array;
156158
int parent = ( c - 1 ) / 2;
157159

@@ -175,7 +177,7 @@ static void up( MINHEAP *tree, areanode *arealist, int c )
175177
*/
176178
static areanode* minheap_pop( MINHEAP *tree, areanode *arealist )
177179
{
178-
LWDEBUG( 2, "Entered minheap_pop" );
180+
//LWDEBUG( 2, "Entered minheap_pop" );
179181
areanode *res = tree->key_array[0];
180182

181183
// put last value first
@@ -206,7 +208,7 @@ static void minheap_update( MINHEAP *tree, areanode *arealist, int idx )
206208
*/
207209
static void tune_areas( EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, double trshld )
208210
{
209-
LWDEBUG( 2, "Entered tune_areas" );
211+
//LWDEBUG( 2, "Entered tune_areas" );
210212
const double *P1;
211213
const double *P2;
212214
const double *P3;
@@ -226,7 +228,7 @@ static void tune_areas( EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, do
226228
for ( i = 0; i < npoints; i++ )
227229
{
228230
tree.key_array[i] = ea->initial_arealist + i;
229-
LWDEBUGF( 2, "add nr %d, with area %lf, and %lf", i, ea->initial_arealist[i].area, tree.key_array[i]->area );
231+
//LWDEBUGF( 2, "add nr %d, with area %lf, and %lf", i, ea->initial_arealist[i].area, tree.key_array[i]->area );
230232
}
231233
tree.usedSize = npoints;
232234

@@ -237,7 +239,7 @@ static void tune_areas( EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, do
237239
for ( i = 0; i < npoints; i++ )
238240
{
239241
(( areanode* )tree.key_array[i] )->treeindex = i;
240-
LWDEBUGF( 4, "Check ordering qsort gives, area=%lf and belong to point %d", (( areanode* )tree.key_array[i] )->area, tree.key_array[i] - ea->initial_arealist );
242+
//LWDEBUGF( 4, "Check ordering qsort gives, area=%lf and belong to point %d", (( areanode* )tree.key_array[i] )->area, tree.key_array[i] - ea->initial_arealist );
241243
}
242244

243245
// Ok, now we have a minHeap, just need to keep it
@@ -313,7 +315,7 @@ static void tune_areas( EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, do
313315
*/
314316
void ptarray_calc_areas( EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, double trshld )
315317
{
316-
LWDEBUG( 2, "Entered ptarray_calc_areas" );
318+
//LWDEBUG( 2, "Entered ptarray_calc_areas" );
317319
int i;
318320
int npoints = ea->inpts->npoints;
319321
int is3d = FLAGS_GET_Z( ea->inpts->flags );
@@ -343,7 +345,7 @@ void ptarray_calc_areas( EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, d
343345
else
344346
area = triarea2d( P1, P2, P3 );
345347

346-
LWDEBUGF( 4, "Write area %lf to point %d on address %p", area, i, &( ea->initial_arealist[i].area ) );
348+
//LWDEBUGF( 4, "Write area %lf to point %d on address %p", area, i, &( ea->initial_arealist[i].area ) );
347349
ea->initial_arealist[i].area = area;
348350
P1 = P2;
349351
P2 = P3;

src/core/symbology-ng/qgsrendererv2.h

+14
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,22 @@ class CORE_EXPORT QgsFeatureRendererV2
425425
//! render editing vertex marker for a polygon
426426
void renderVertexMarkerPolygon( QPolygonF& pts, QList<QPolygonF>* rings, QgsRenderContext& context );
427427

428+
/**
429+
* Creates a point in screen coordinates from a wkb string in map
430+
* coordinates
431+
*/
428432
static QgsConstWkbPtr _getPoint( QPointF& pt, QgsRenderContext& context, QgsConstWkbPtr& wkb );
433+
434+
/**
435+
* Creates a line string in screen coordinates from a wkb string in map
436+
* coordinates
437+
*/
429438
static QgsConstWkbPtr _getLineString( QPolygonF& pts, QgsRenderContext& context, QgsConstWkbPtr& wkb, bool clipToExtent = true );
439+
440+
/**
441+
* Creates a polygon in screen coordinates from a wkb string in map
442+
* coordinates
443+
*/
430444
static QgsConstWkbPtr _getPolygon( QPolygonF& pts, QList<QPolygonF>& holes, QgsRenderContext& context, QgsConstWkbPtr& wkb, bool clipToExtent = true );
431445

432446
void setScaleMethodToSymbol( QgsSymbolV2* symbol, int scaleMethod );

tests/src/python/test_provider_shapefile.py

-2
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ def testUpdateMode(self):
156156
self.assertTrue(caps & QgsVectorDataProvider.CreateSpatialIndex)
157157
self.assertTrue(caps & QgsVectorDataProvider.SelectAtId)
158158
self.assertTrue(caps & QgsVectorDataProvider.ChangeGeometries)
159-
self.assertTrue(caps & QgsVectorDataProvider.SimplifyGeometries)
160-
self.assertTrue(caps & QgsVectorDataProvider.SimplifyGeometriesWithTopologicalValidation)
161159
#self.assertTrue(caps & QgsVectorDataProvider.ChangeFeatures)
162160

163161
# We should be really opened in read-only mode even if write capabilities are declared

tests/src/python/test_qgsgeometry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def testReferenceGeometry(self):
162162
# test geometry centroid
163163
exp = row['centroid']
164164
result = geom.centroid().exportToWkt()
165-
assert compareWkt(result, exp), "Centroid {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result)
165+
assert compareWkt(result, exp, 0.00001), "Centroid {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result)
166166

167167
# test bounding box limits
168168
bbox = geom.geometry().boundingBox()

0 commit comments

Comments
 (0)