QgsClipper Class Reference
[QGIS core library]

A class to trim lines and polygons to within a rectangular region. More...

#include <qgsclipper.h>

List of all members.

Public Types

enum  Boundary { XMax, XMin, YMax, YMin }

Static Public Member Functions

static void trimFeature (std::vector< double > &x, std::vector< double > &y, bool shapeOpen)

Static Public Attributes

static const double MAX_X = 16000
static const double MIN_X = -16000
static const double MAX_Y = 16000
static const double MIN_Y = -16000

Static Private Member Functions

static void trimFeatureToBoundary (const std::vector< double > &inX, const std::vector< double > &inY, std::vector< double > &outX, std::vector< double > &outY, Boundary b, bool shapeOpen)
static bool inside (const double x, const double y, Boundary b)
static QgsPoint intersect (const double x1, const double y1, const double x2, const double y2, Boundary b)

Static Private Attributes

static const double SMALL_NUM = 1e-12


Detailed Description

A class to trim lines and polygons to within a rectangular region.

The functions in this class are likely to be called from within a render loop and hence need to as CPU efficient as possible. The main purpose of the functions in this class are to trim lines and polygons to lie within a rectangular region. This is necessary for drawing items to an X11 display which have a limit on the magnitude of the screen coordinates (+/- 32768, i.e. 16 bit integer).

Definition at line 40 of file qgsclipper.h.


Member Enumeration Documentation

Enumerator:
XMax 
XMin 
YMax 
YMin 

Definition at line 70 of file qgsclipper.h.


Member Function Documentation

void QgsClipper::trimFeature ( std::vector< double > &  x,
std::vector< double > &  y,
bool  shapeOpen 
) [inline, static]

Definition at line 116 of file qgsclipper.h.

References trimFeatureToBoundary(), XMax, XMin, YMax, and YMin.

Referenced by QgsVectorLayer::drawLineString(), and QgsVectorLayer::drawPolygon().

void QgsClipper::trimFeatureToBoundary ( const std::vector< double > &  inX,
const std::vector< double > &  inY,
std::vector< double > &  outX,
std::vector< double > &  outY,
Boundary  b,
bool  shapeOpen 
) [inline, static, private]

Definition at line 142 of file qgsclipper.h.

References inside(), intersect(), QgsPoint::x(), and QgsPoint::y().

Referenced by trimFeature().

bool QgsClipper::inside ( const double  x,
const double  y,
Boundary  b 
) [inline, static, private]

Definition at line 200 of file qgsclipper.h.

References MAX_X, MAX_Y, MIN_X, MIN_Y, XMax, XMin, YMax, and YMin.

Referenced by trimFeatureToBoundary().

QgsPoint QgsClipper::intersect ( const double  x1,
const double  y1,
const double  x2,
const double  y2,
Boundary  b 
) [inline, static, private]

Definition at line 229 of file qgsclipper.h.

References MAX_X, MAX_Y, MIN_X, MIN_Y, QgsPoint::set(), SMALL_NUM, XMax, XMin, YMax, and YMin.

Referenced by trimFeatureToBoundary().


Member Data Documentation

const double QgsClipper::MAX_X = 16000 [static]

const double QgsClipper::MIN_X = -16000 [static]

Definition at line 64 of file qgsclipper.h.

Referenced by inside(), and intersect().

const double QgsClipper::MAX_Y = 16000 [static]

const double QgsClipper::MIN_Y = -16000 [static]

Definition at line 66 of file qgsclipper.h.

Referenced by inside(), and intersect().

const double QgsClipper::SMALL_NUM = 1e-12 [static, private]

Definition at line 83 of file qgsclipper.h.

Referenced by intersect().


The documentation for this class was generated from the following files:

Generated on Sat Feb 4 19:17:24 2012 for Quantum GIS API Documentation by  doxygen 1.5.6