Skip to content
Permalink
Browse files

#8725-R: move VectorSimplifyMethod to other file

  • Loading branch information
ahuarte47 authored and m-kuhn committed Jan 15, 2014
1 parent 0ec7d35 commit faebcce13aa5dace1f10f758cb9f159dd9baa4e4
@@ -130,6 +130,7 @@ SET(QGIS_CORE_SRCS
qgsvectorlayerimport.cpp
qgsvectorlayerjoinbuffer.cpp
qgsvectorlayerundocommand.cpp
qgsvectorsimplifymethod.cpp

qgsnetworkaccessmanager.cpp

@@ -4217,24 +4217,3 @@ bool QgsAttributeEditorRelation::init( QgsRelationManager* relationManager )
mRelation = relationManager->relation( mRelationId );
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;
}
@@ -32,6 +32,7 @@
#include "qgssnapper.h"
#include "qgsfield.h"
#include "qgsrelation.h"
#include "qgsvectorsimplifymethod.h"

class QPainter;
class QImage;
@@ -179,41 +180,6 @@ struct CORE_EXPORT QgsVectorJoinInfo
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
* Represents a vector layer which manages a vector based data sets.
*
@@ -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;
}
@@ -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

0 comments on commit faebcce

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