QGIS API Documentation
2.8.2-Wien
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
src
core
qgssimplifymethod.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgssimplifymethod.cpp
3
---------------------
4
begin : December 2013
5
copyright : (C) 2013 by Matthias Kuhn / Alvaro Huarte
6
email :
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 "
qgssimplifymethod.h
"
17
#include "
qgslogger.h
"
18
#include "
qgsgeometrysimplifier.h
"
19
#include "
qgsmaptopixelgeometrysimplifier.h
"
20
21
QgsSimplifyMethod::QgsSimplifyMethod
()
22
: mMethodType(
QgsSimplifyMethod
::NoSimplification )
23
, mTolerance( 1 )
24
, mForceLocalOptimization( true )
25
{
26
}
27
28
QgsSimplifyMethod::QgsSimplifyMethod
(
const
QgsSimplifyMethod
&rh )
29
{
30
operator=
( rh );
31
}
32
33
QgsSimplifyMethod
&
QgsSimplifyMethod::operator=
(
const
QgsSimplifyMethod
& rh )
34
{
35
mMethodType
= rh.
mMethodType
;
36
mTolerance
= rh.
mTolerance
;
37
mForceLocalOptimization
= rh.
mForceLocalOptimization
;
38
39
return
*
this
;
40
}
41
42
void
QgsSimplifyMethod::setMethodType
(
MethodType
methodType )
43
{
44
mMethodType
=
methodType
;
45
}
46
47
void
QgsSimplifyMethod::setTolerance
(
double
tolerance )
48
{
49
mTolerance
=
tolerance
;
50
}
51
52
void
QgsSimplifyMethod::setForceLocalOptimization
(
bool
localOptimization )
53
{
54
mForceLocalOptimization
= localOptimization;
55
}
56
57
QgsAbstractGeometrySimplifier
*
QgsSimplifyMethod::createGeometrySimplifier
(
const
QgsSimplifyMethod
& simplifyMethod )
58
{
59
QgsSimplifyMethod::MethodType
methodType
= simplifyMethod.
methodType
();
60
61
// returns a geometry simplifier according to specified method
62
if
( methodType ==
QgsSimplifyMethod::OptimizeForRendering
)
63
{
64
int
simplifyFlags =
QgsMapToPixelSimplifier::SimplifyGeometry
|
QgsMapToPixelSimplifier::SimplifyEnvelope
;
65
return
new
QgsMapToPixelSimplifier
( simplifyFlags, simplifyMethod.
tolerance
() );
66
}
67
else
if
( methodType ==
QgsSimplifyMethod::PreserveTopology
)
68
{
69
return
new
QgsTopologyPreservingSimplifier
( simplifyMethod.
tolerance
() );
70
}
71
else
72
{
73
QgsDebugMsg
( QString(
"Simplification method type (%1) is not recognised"
).arg( methodType ) );
74
return
NULL;
75
}
76
}
Generated on Sun May 10 2015 16:33:24 for QGIS API Documentation by
1.8.1.2