Skip to content
Permalink
Browse files

Fix travis errors

  • Loading branch information
ahuarte47 committed May 15, 2016
1 parent 7e1d142 commit 6969a1a4010a6d92ea6f14d60eee99387faaedfb
@@ -12,7 +12,8 @@ class QgsMapToPixelSimplifier : QgsAbstractGeometrySimplifier
Visvalingam = 2, //!< The simplification gives each point in a line an importance weighting, so that least important points are removed first
};

QgsMapToPixelSimplifier( int simplifyFlags, double tolerance );
//! Constructor
QgsMapToPixelSimplifier( int simplifyFlags, double tolerance, SimplifyAlgorithm simplifyAlgorithm = Distance );
virtual ~QgsMapToPixelSimplifier();

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

public:
//! Gets the simplification hints of the vector layer managed
int simplifyFlags() const;
//! Sets the simplification hints of the vector layer managed
void setSimplifyFlags( int simplifyFlags );

//! Gets the local simplification algorithm of the vector layer managed
SimplifyAlgorithm simplifyAlgorithm() const;
//! Sets the local simplification algorithm of the vector layer managed
void setSimplifyAlgorithm( SimplifyAlgorithm simplifyAlgorithm );

//! Returns a simplified version the specified geometry
@@ -403,8 +403,22 @@ class QgsFeatureRendererV2
//! render editing vertex marker for a polygon
void renderVertexMarkerPolygon( QPolygonF& pts, QList<QPolygonF>* rings, QgsRenderContext& context );

/**
* Creates a point in screen coordinates from a wkb string in map
* coordinates
*/
static QgsConstWkbPtr _getPoint( QPointF& pt, QgsRenderContext& context, QgsConstWkbPtr& wkb );

/**
* Creates a line string in screen coordinates from a wkb string in map
* coordinates
*/
static QgsConstWkbPtr _getLineString( QPolygonF& pts, QgsRenderContext& context, QgsConstWkbPtr& wkb, bool clipToExtent = true );

/**
* Creates a polygon in screen coordinates from a wkb string in map
* coordinates
*/
static QgsConstWkbPtr _getPolygon( QPolygonF& pts, QList<QPolygonF>& holes, QgsRenderContext& context, QgsConstWkbPtr& wkb, bool clipToExtent = true );

void setScaleMethodToSymbol( QgsSymbolV2* symbol, int scaleMethod );
@@ -96,8 +96,10 @@ class CORE_EXPORT QgsConstWkbPtr
mutable bool mEndianSwap;
mutable QgsWKBTypes::Type mWkbType;

//! Verify bounds
void verifyBound( int size ) const;

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

//! Read a point
virtual const QgsConstWkbPtr &operator>>( QPointF &point ) const;
//! Read a point array
virtual const QgsConstWkbPtr &operator>>( QPolygonF &points ) const;

inline void operator+=( int n ) { verifyBound( n ); mP += n; }
@@ -30,20 +30,31 @@ class CORE_EXPORT QgsConstWkbSimplifierPtr : public QgsConstWkbPtr
const QgsVectorSimplifyMethod& mSimplifyMethod;

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

//! Read a double
inline const QgsConstWkbPtr &operator>>( double &v ) const { return QgsConstWkbPtr::operator>>( v ); }
//! Read a float
inline const QgsConstWkbPtr &operator>>( float &r ) const { return QgsConstWkbPtr::operator>>( r ); }
//! Read a int
inline const QgsConstWkbPtr &operator>>( int &v ) const { return QgsConstWkbPtr::operator>>( v ); }
//! Read a uint
inline const QgsConstWkbPtr &operator>>( unsigned int &v ) const { return QgsConstWkbPtr::operator>>( v ); }
//! Read a char
inline const QgsConstWkbPtr &operator>>( char &v ) const { return QgsConstWkbPtr::operator>>( v ); }

//! Read a point
virtual const QgsConstWkbPtr &operator>>( QPointF &point ) const override;
//! Read a point array
virtual const QgsConstWkbPtr &operator>>( QPolygonF &points ) const override;

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

//! unsigned char * operator
inline operator const unsigned char *() const { return mP; }
};

@@ -23,8 +23,8 @@

QgsMapToPixelSimplifier::QgsMapToPixelSimplifier( int simplifyFlags, double tolerance, SimplifyAlgorithm simplifyAlgorithm )
: mSimplifyFlags( simplifyFlags )
, mTolerance( tolerance )
, mSimplifyAlgorithm( simplifyAlgorithm )
, mTolerance( tolerance )
{
}

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

//! Constructor
QgsMapToPixelSimplifier( int simplifyFlags, double tolerance, SimplifyAlgorithm simplifyAlgorithm = Distance );
virtual ~QgsMapToPixelSimplifier();

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

public:
//! Gets the simplification hints of the vector layer managed
int simplifyFlags() const { return mSimplifyFlags; }
//! Sets the simplification hints of the vector layer managed
void setSimplifyFlags( int simplifyFlags ) { mSimplifyFlags = simplifyFlags; }

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

//! Returns a simplified version the specified geometry
@@ -20,8 +20,8 @@
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod()
: mSimplifyHints( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD > 1 ? QgsVectorSimplifyMethod::FullSimplification : QgsVectorSimplifyMethod::GeometrySimplification )
, mSimplifyAlgorithm( QgsVectorSimplifyMethod::Distance )
, mThreshold( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD )
, mTolerance( 1 )
, mThreshold( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD )
, mLocalOptimization( true )
, mMaximumScale( 1 )
{
@@ -26,7 +26,7 @@

EFFECTIVE_AREAS* initiate_effectivearea( const POINTARRAY *inpts )
{
LWDEBUG( 2, "Entered initiate_effectivearea" );
//LWDEBUG( 2, "Entered initiate_effectivearea" );
EFFECTIVE_AREAS *ea;
ea = ( EFFECTIVE_AREAS* )lwalloc( sizeof( EFFECTIVE_AREAS ) );
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 )
*/
static double triarea3d( const double *P1, const double *P2, const double *P3 )
{
LWDEBUG( 2, "Entered triarea3d" );
//LWDEBUG( 2, "Entered triarea3d" );
double ax, bx, ay, by, az, bz, cx, cy, cz, area;

ax = P1[0] - P2[0];
@@ -110,7 +110,7 @@ static int cmpfunc( const void * a, const void * b )
*/
static void down( MINHEAP *tree, areanode *arealist, int parent )
{
LWDEBUG( 2, "Entered down" );
//LWDEBUG( 2, "Entered down" );
areanode **treearray = tree->key_array;
int left = parent * 2 + 1;
int right = left + 1;
@@ -149,9 +149,11 @@ static void down( MINHEAP *tree, areanode *arealist, int parent )
*/
static void up( MINHEAP *tree, areanode *arealist, int c )
{
LWDEBUG( 2, "Entered up" );
//LWDEBUG( 2, "Entered up" );
areanode *tmp;

Q_UNUSED( arealist );

areanode **treearray = tree->key_array;
int parent = ( c - 1 ) / 2;

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

// put last value first
@@ -206,7 +208,7 @@ static void minheap_update( MINHEAP *tree, areanode *arealist, int idx )
*/
static void tune_areas( EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, double trshld )
{
LWDEBUG( 2, "Entered tune_areas" );
//LWDEBUG( 2, "Entered tune_areas" );
const double *P1;
const double *P2;
const double *P3;
@@ -226,7 +228,7 @@ static void tune_areas( EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, do
for ( i = 0; i < npoints; i++ )
{
tree.key_array[i] = ea->initial_arealist + i;
LWDEBUGF( 2, "add nr %d, with area %lf, and %lf", i, ea->initial_arealist[i].area, tree.key_array[i]->area );
//LWDEBUGF( 2, "add nr %d, with area %lf, and %lf", i, ea->initial_arealist[i].area, tree.key_array[i]->area );
}
tree.usedSize = npoints;

@@ -237,7 +239,7 @@ static void tune_areas( EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, do
for ( i = 0; i < npoints; i++ )
{
(( areanode* )tree.key_array[i] )->treeindex = i;
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 );
//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 );
}

// 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
*/
void ptarray_calc_areas( EFFECTIVE_AREAS *ea, int avoid_collaps, int set_area, double trshld )
{
LWDEBUG( 2, "Entered ptarray_calc_areas" );
//LWDEBUG( 2, "Entered ptarray_calc_areas" );
int i;
int npoints = ea->inpts->npoints;
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
else
area = triarea2d( P1, P2, P3 );

LWDEBUGF( 4, "Write area %lf to point %d on address %p", area, i, &( ea->initial_arealist[i].area ) );
//LWDEBUGF( 4, "Write area %lf to point %d on address %p", area, i, &( ea->initial_arealist[i].area ) );
ea->initial_arealist[i].area = area;
P1 = P2;
P2 = P3;
@@ -425,8 +425,22 @@ class CORE_EXPORT QgsFeatureRendererV2
//! render editing vertex marker for a polygon
void renderVertexMarkerPolygon( QPolygonF& pts, QList<QPolygonF>* rings, QgsRenderContext& context );

/**
* Creates a point in screen coordinates from a wkb string in map
* coordinates
*/
static QgsConstWkbPtr _getPoint( QPointF& pt, QgsRenderContext& context, QgsConstWkbPtr& wkb );

/**
* Creates a line string in screen coordinates from a wkb string in map
* coordinates
*/
static QgsConstWkbPtr _getLineString( QPolygonF& pts, QgsRenderContext& context, QgsConstWkbPtr& wkb, bool clipToExtent = true );

/**
* Creates a polygon in screen coordinates from a wkb string in map
* coordinates
*/
static QgsConstWkbPtr _getPolygon( QPolygonF& pts, QList<QPolygonF>& holes, QgsRenderContext& context, QgsConstWkbPtr& wkb, bool clipToExtent = true );

void setScaleMethodToSymbol( QgsSymbolV2* symbol, int scaleMethod );
@@ -156,8 +156,6 @@ def testUpdateMode(self):
self.assertTrue(caps & QgsVectorDataProvider.CreateSpatialIndex)
self.assertTrue(caps & QgsVectorDataProvider.SelectAtId)
self.assertTrue(caps & QgsVectorDataProvider.ChangeGeometries)
self.assertTrue(caps & QgsVectorDataProvider.SimplifyGeometries)
self.assertTrue(caps & QgsVectorDataProvider.SimplifyGeometriesWithTopologicalValidation)
#self.assertTrue(caps & QgsVectorDataProvider.ChangeFeatures)

# We should be really opened in read-only mode even if write capabilities are declared
@@ -162,7 +162,7 @@ def testReferenceGeometry(self):
# test geometry centroid
exp = row['centroid']
result = geom.centroid().exportToWkt()
assert compareWkt(result, exp), "Centroid {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result)
assert compareWkt(result, exp, 0.00001), "Centroid {}: mismatch Expected:\n{}\nGot:\n{}\n".format(i + 1, exp, result)

# test bounding box limits
bbox = geom.geometry().boundingBox()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 6969a1a

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