Skip to content

Commit faebcce

Browse files
ahuarte47m-kuhn
authored andcommittedJan 15, 2014
#8725-R: move VectorSimplifyMethod to other file
1 parent 0ec7d35 commit faebcce

File tree

5 files changed

+94
-56
lines changed

5 files changed

+94
-56
lines changed
 

‎src/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ SET(QGIS_CORE_SRCS
130130
qgsvectorlayerimport.cpp
131131
qgsvectorlayerjoinbuffer.cpp
132132
qgsvectorlayerundocommand.cpp
133+
qgsvectorsimplifymethod.cpp
133134

134135
qgsnetworkaccessmanager.cpp
135136

‎src/core/qgsvectorlayer.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4217,24 +4217,3 @@ bool QgsAttributeEditorRelation::init( QgsRelationManager* relationManager )
42174217
mRelation = relationManager->relation( mRelationId );
42184218
return mRelation.isValid();
42194219
}
4220-
4221-
4222-
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod()
4223-
: mSimplifyHints( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD > 1 ? QgsVectorLayer::FullSimplification : QgsVectorLayer::GeometrySimplification )
4224-
, mThreshold( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD )
4225-
, mLocalOptimization( true )
4226-
{
4227-
}
4228-
4229-
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod( const QgsVectorSimplifyMethod &rh )
4230-
{
4231-
operator=( rh );
4232-
}
4233-
4234-
QgsVectorSimplifyMethod& QgsVectorSimplifyMethod::operator=( const QgsVectorSimplifyMethod &rh )
4235-
{
4236-
mSimplifyHints = rh.mSimplifyHints;
4237-
mThreshold = rh.mThreshold;
4238-
mLocalOptimization = rh.mLocalOptimization;
4239-
return *this;
4240-
}

‎src/core/qgsvectorlayer.h

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "qgssnapper.h"
3333
#include "qgsfield.h"
3434
#include "qgsrelation.h"
35+
#include "qgsvectorsimplifymethod.h"
3536

3637
class QPainter;
3738
class QImage;
@@ -179,41 +180,6 @@ struct CORE_EXPORT QgsVectorJoinInfo
179180
int joinFieldIndex;
180181
};
181182

182-
/** This class contains information how to simplify geometries fetched from a vector layer */
183-
class CORE_EXPORT QgsVectorSimplifyMethod
184-
{
185-
public:
186-
//! construct a default object
187-
QgsVectorSimplifyMethod();
188-
//! copy constructor
189-
QgsVectorSimplifyMethod( const QgsVectorSimplifyMethod& rh );
190-
//! assignment operator
191-
QgsVectorSimplifyMethod& operator=( const QgsVectorSimplifyMethod& rh );
192-
193-
/** Sets the simplification hints of the vector layer managed */
194-
void setSimplifyHints( int simplifyHints ) { mSimplifyHints = simplifyHints; }
195-
/** Gets the simplification hints of the vector layer managed */
196-
inline int simplifyHints() const { return mSimplifyHints; }
197-
198-
/** Sets the simplification threshold of the vector layer managed */
199-
void setThreshold( float threshold ) { mThreshold = threshold; }
200-
/** Gets the simplification threshold of the vector layer managed */
201-
inline float threshold() const { return mThreshold; }
202-
203-
/** Sets where the simplification executes, after fetch the geometries from provider, or when supported, in provider before fetch the geometries */
204-
void setForceLocalOptimization( bool localOptimization ) { mLocalOptimization = localOptimization; }
205-
/** Gets where the simplification executes, after fetch the geometries from provider, or when supported, in provider before fetch the geometries */
206-
inline bool forceLocalOptimization() const { return mLocalOptimization; }
207-
208-
private:
209-
/** Simplification hints for fast rendering of features of the vector layer managed */
210-
int mSimplifyHints;
211-
/** Simplification threshold */
212-
float mThreshold;
213-
/** Simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries */
214-
bool mLocalOptimization;
215-
};
216-
217183
/** \ingroup core
218184
* Represents a vector layer which manages a vector based data sets.
219185
*

‎src/core/qgsvectorsimplifymethod.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/***************************************************************************
2+
qgsvectorsimplifymethod.cpp
3+
---------------------
4+
begin : December 2013
5+
copyright : (C) 2013 by Alvaro Huarte
6+
email : http://wiki.osgeo.org/wiki/Alvaro_Huarte
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
16+
#include "qgis.h"
17+
#include "qgsvectorsimplifymethod.h"
18+
#include "qgsvectorlayer.h"
19+
20+
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod()
21+
: mSimplifyHints( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD > 1 ? QgsVectorLayer::FullSimplification : QgsVectorLayer::GeometrySimplification )
22+
, mThreshold( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD )
23+
, mLocalOptimization( true )
24+
{
25+
}
26+
27+
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod( const QgsVectorSimplifyMethod &rh )
28+
{
29+
operator=( rh );
30+
}
31+
32+
QgsVectorSimplifyMethod& QgsVectorSimplifyMethod::operator=( const QgsVectorSimplifyMethod &rh )
33+
{
34+
mSimplifyHints = rh.mSimplifyHints;
35+
mThreshold = rh.mThreshold;
36+
mLocalOptimization = rh.mLocalOptimization;
37+
return *this;
38+
}

‎src/core/qgsvectorsimplifymethod.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/***************************************************************************
2+
qgsvectorsimplifymethod.h
3+
---------------------
4+
begin : December 2013
5+
copyright : (C) 2013 by Alvaro Huarte
6+
email : http://wiki.osgeo.org/wiki/Alvaro_Huarte
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
16+
#ifndef QGSVECTORSIMPLIFYMETHOD_H
17+
#define QGSVECTORSIMPLIFYMETHOD_H
18+
19+
/** This class contains information how to simplify geometries fetched from a vector layer */
20+
class CORE_EXPORT QgsVectorSimplifyMethod
21+
{
22+
public:
23+
//! construct a default object
24+
QgsVectorSimplifyMethod();
25+
//! copy constructor
26+
QgsVectorSimplifyMethod( const QgsVectorSimplifyMethod& rh );
27+
//! assignment operator
28+
QgsVectorSimplifyMethod& operator=( const QgsVectorSimplifyMethod& rh );
29+
30+
/** Sets the simplification hints of the vector layer managed */
31+
void setSimplifyHints( int simplifyHints ) { mSimplifyHints = simplifyHints; }
32+
/** Gets the simplification hints of the vector layer managed */
33+
inline int simplifyHints() const { return mSimplifyHints; }
34+
35+
/** Sets the simplification threshold of the vector layer managed */
36+
void setThreshold( float threshold ) { mThreshold = threshold; }
37+
/** Gets the simplification threshold of the vector layer managed */
38+
inline float threshold() const { return mThreshold; }
39+
40+
/** Sets where the simplification executes, after fetch the geometries from provider, or when supported, in provider before fetch the geometries */
41+
void setForceLocalOptimization( bool localOptimization ) { mLocalOptimization = localOptimization; }
42+
/** Gets where the simplification executes, after fetch the geometries from provider, or when supported, in provider before fetch the geometries */
43+
inline bool forceLocalOptimization() const { return mLocalOptimization; }
44+
45+
private:
46+
/** Simplification hints for fast rendering of features of the vector layer managed */
47+
int mSimplifyHints;
48+
/** Simplification threshold */
49+
float mThreshold;
50+
/** Simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries */
51+
bool mLocalOptimization;
52+
};
53+
54+
#endif // QGSVECTORSIMPLIFYMETHOD_H

0 commit comments

Comments
 (0)
Please sign in to comment.