38 const double QgsClipper::SMALL_NUM = 1e-12;
44 unsigned int wkbType, nPoints;
46 wkbPtr >> wkbType >> nPoints;
50 double p0x, p0y, p1x = 0.0, p1y = 0.0;
52 double lastClipX = 0.0, lastClipY = 0.0;
57 for (
unsigned int i = 0; i < nPoints; ++i )
63 wkbPtr +=
sizeof( double );
74 wkbPtr +=
sizeof( double );
76 p1x_c = p1x; p1y_c = p1y;
78 p0x, p0y, p1x_c, p1y_c ) )
80 bool newLine = line.
size() > 0 && ( p0x != lastClipX || p0y != lastClipY );
84 connectSeparatedLines( lastClipX, lastClipY, p0x, p0y, clipExtent, line );
86 if ( line.
size() < 1 || newLine )
93 lastClipX = p1x_c; lastClipY = p1y_c;
94 line <<
QPointF( p1x_c, p1y_c );
101 void QgsClipper::connectSeparatedLines(
double x0,
double y0,
double x1,
double y1,
static const double MAX_Y
A rectangle specified with double values.
double yMaximum() const
Get the y maximum value (top side of rectangle)
static const unsigned char * clippedLineWKB(const unsigned char *wkb, const QgsRectangle &clipExtent, QPolygonF &line)
Reads a polyline from WKB and clips it to clipExtent.
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
static const double MIN_X
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
double xMaximum() const
Get the x maximum value (right side of rectangle)
static const double MIN_Y
static const double MAX_X
double xMinimum() const
Get the x minimum value (left side of rectangle)