#8725-R: move VectorSimplifyMethod to other file

This commit is contained in:
ahuarte47 2013-12-24 12:03:06 +01:00 committed by Matthias Kuhn
parent 0ec7d359c7
commit faebcce13a
5 changed files with 94 additions and 56 deletions

View File

@ -130,6 +130,7 @@ SET(QGIS_CORE_SRCS
qgsvectorlayerimport.cpp qgsvectorlayerimport.cpp
qgsvectorlayerjoinbuffer.cpp qgsvectorlayerjoinbuffer.cpp
qgsvectorlayerundocommand.cpp qgsvectorlayerundocommand.cpp
qgsvectorsimplifymethod.cpp
qgsnetworkaccessmanager.cpp qgsnetworkaccessmanager.cpp

View File

@ -4217,24 +4217,3 @@ bool QgsAttributeEditorRelation::init( QgsRelationManager* relationManager )
mRelation = relationManager->relation( mRelationId ); mRelation = relationManager->relation( mRelationId );
return mRelation.isValid(); return mRelation.isValid();
} }
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod()
: mSimplifyHints( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD > 1 ? QgsVectorLayer::FullSimplification : QgsVectorLayer::GeometrySimplification )
, mThreshold( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD )
, mLocalOptimization( true )
{
}
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod( const QgsVectorSimplifyMethod &rh )
{
operator=( rh );
}
QgsVectorSimplifyMethod& QgsVectorSimplifyMethod::operator=( const QgsVectorSimplifyMethod &rh )
{
mSimplifyHints = rh.mSimplifyHints;
mThreshold = rh.mThreshold;
mLocalOptimization = rh.mLocalOptimization;
return *this;
}

View File

@ -32,6 +32,7 @@
#include "qgssnapper.h" #include "qgssnapper.h"
#include "qgsfield.h" #include "qgsfield.h"
#include "qgsrelation.h" #include "qgsrelation.h"
#include "qgsvectorsimplifymethod.h"
class QPainter; class QPainter;
class QImage; class QImage;
@ -179,41 +180,6 @@ struct CORE_EXPORT QgsVectorJoinInfo
int joinFieldIndex; int joinFieldIndex;
}; };
/** This class contains information how to simplify geometries fetched from a vector layer */
class CORE_EXPORT QgsVectorSimplifyMethod
{
public:
//! construct a default object
QgsVectorSimplifyMethod();
//! copy constructor
QgsVectorSimplifyMethod( const QgsVectorSimplifyMethod& rh );
//! assignment operator
QgsVectorSimplifyMethod& operator=( const QgsVectorSimplifyMethod& rh );
/** Sets the simplification hints of the vector layer managed */
void setSimplifyHints( int simplifyHints ) { mSimplifyHints = simplifyHints; }
/** Gets the simplification hints of the vector layer managed */
inline int simplifyHints() const { return mSimplifyHints; }
/** Sets the simplification threshold of the vector layer managed */
void setThreshold( float threshold ) { mThreshold = threshold; }
/** Gets the simplification threshold of the vector layer managed */
inline float threshold() const { return mThreshold; }
/** Sets where the simplification executes, after fetch the geometries from provider, or when supported, in provider before fetch the geometries */
void setForceLocalOptimization( bool localOptimization ) { mLocalOptimization = localOptimization; }
/** Gets where the simplification executes, after fetch the geometries from provider, or when supported, in provider before fetch the geometries */
inline bool forceLocalOptimization() const { return mLocalOptimization; }
private:
/** Simplification hints for fast rendering of features of the vector layer managed */
int mSimplifyHints;
/** Simplification threshold */
float mThreshold;
/** Simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries */
bool mLocalOptimization;
};
/** \ingroup core /** \ingroup core
* Represents a vector layer which manages a vector based data sets. * Represents a vector layer which manages a vector based data sets.
* *

View File

@ -0,0 +1,38 @@
/***************************************************************************
qgsvectorsimplifymethod.cpp
---------------------
begin : December 2013
copyright : (C) 2013 by Alvaro Huarte
email : http://wiki.osgeo.org/wiki/Alvaro_Huarte
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgis.h"
#include "qgsvectorsimplifymethod.h"
#include "qgsvectorlayer.h"
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod()
: mSimplifyHints( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD > 1 ? QgsVectorLayer::FullSimplification : QgsVectorLayer::GeometrySimplification )
, mThreshold( QGis::DEFAULT_MAPTOPIXEL_THRESHOLD )
, mLocalOptimization( true )
{
}
QgsVectorSimplifyMethod::QgsVectorSimplifyMethod( const QgsVectorSimplifyMethod &rh )
{
operator=( rh );
}
QgsVectorSimplifyMethod& QgsVectorSimplifyMethod::operator=( const QgsVectorSimplifyMethod &rh )
{
mSimplifyHints = rh.mSimplifyHints;
mThreshold = rh.mThreshold;
mLocalOptimization = rh.mLocalOptimization;
return *this;
}

View File

@ -0,0 +1,54 @@
/***************************************************************************
qgsvectorsimplifymethod.h
---------------------
begin : December 2013
copyright : (C) 2013 by Alvaro Huarte
email : http://wiki.osgeo.org/wiki/Alvaro_Huarte
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSVECTORSIMPLIFYMETHOD_H
#define QGSVECTORSIMPLIFYMETHOD_H
/** This class contains information how to simplify geometries fetched from a vector layer */
class CORE_EXPORT QgsVectorSimplifyMethod
{
public:
//! construct a default object
QgsVectorSimplifyMethod();
//! copy constructor
QgsVectorSimplifyMethod( const QgsVectorSimplifyMethod& rh );
//! assignment operator
QgsVectorSimplifyMethod& operator=( const QgsVectorSimplifyMethod& rh );
/** Sets the simplification hints of the vector layer managed */
void setSimplifyHints( int simplifyHints ) { mSimplifyHints = simplifyHints; }
/** Gets the simplification hints of the vector layer managed */
inline int simplifyHints() const { return mSimplifyHints; }
/** Sets the simplification threshold of the vector layer managed */
void setThreshold( float threshold ) { mThreshold = threshold; }
/** Gets the simplification threshold of the vector layer managed */
inline float threshold() const { return mThreshold; }
/** Sets where the simplification executes, after fetch the geometries from provider, or when supported, in provider before fetch the geometries */
void setForceLocalOptimization( bool localOptimization ) { mLocalOptimization = localOptimization; }
/** Gets where the simplification executes, after fetch the geometries from provider, or when supported, in provider before fetch the geometries */
inline bool forceLocalOptimization() const { return mLocalOptimization; }
private:
/** Simplification hints for fast rendering of features of the vector layer managed */
int mSimplifyHints;
/** Simplification threshold */
float mThreshold;
/** Simplification executes after fetch the geometries from provider, otherwise it executes, when supported, in provider before fetch the geometries */
bool mLocalOptimization;
};
#endif // QGSVECTORSIMPLIFYMETHOD_H