67 void QgsAbstractGeometryV2::clip(
const QgsRectangle& rect )
84 bool hasZ = subgeom->
is3D();
139 for ( ; partIt != coordinates.
constEnd(); ++partIt )
143 for ( ; ringIt != part.
constEnd(); ++ringIt )
145 nCoords += ringIt->
size();
164 if ( !static_cast<const unsigned char*>( wkbPtr ) )
205 for ( ; j < n; i = j++ )
209 double d = vi.
x() * vj.
y() - vj.
x() * vi.
y();
211 Cx += ( vi.
x() + vj.
x() ) * d;
212 Cy += ( vi.
y() + vj.
y() ) * d;
218 for (
int i = 0; i < n - 1; ++i )
224 return QgsPointV2( Cx / ( n - 1 ), Cy / ( n - 1 ) );
228 return QgsPointV2( Cx / ( 3. * A ), Cy / ( 3. * A ) );
static void endian_swap(T &value)
Swap the endianness of the specified value.
QgsWKBTypes::Type wkbType() const
Returns the WKB type of the geometry.
A rectangle specified with double values.
virtual QgsPointV2 centroid() const
Returns the centroid of the geometry.
virtual QgsAbstractGeometryV2 & operator=(const QgsAbstractGeometryV2 &geom)
bool isNull() const
test if the rectangle is null (all coordinates zero or after call to setMinimal()).
Abstract base class for all geometries.
static endian_t endian()
Returns whether this machine uses big or little endian.
QString wktTypeStr() const
Returns the WKT type string of the geometry.
int nCoordinates() const
Returns the number of nodes contained in the geometry.
static bool readWkbHeader(QgsConstWkbPtr &wkbPtr, QgsWKBTypes::Type &wkbType, bool &endianSwap, QgsWKBTypes::Type expectedType)
Reads a WKB header and tests its validity.
virtual void clear()=0
Clears the geometry, ie reset it to a null geometry.
double ANALYSIS_EXPORT max(double x, double y)
Returns the maximum of two doubles or the first argument if both are equal.
static Type flatType(Type type)
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
Utility class for identifying a unique vertex within a geometry.
bool isMeasure() const
Returns true if the geometry contains m values.
virtual QgsRectangle calculateBoundingBox() const
Calculates the minimal bounding box for the geometry.
bool isEmpty() const
Returns true if the geometry is empty.
QgsWKBTypes::Type mWkbType
void setZMTypeFromSubGeometry(const QgsAbstractGeometryV2 *subggeom, QgsWKBTypes::Type baseGeomType)
Updates the geometry type based on whether sub geometries contain z or m values.
virtual bool nextVertex(QgsVertexId &id, QgsPointV2 &vertex) const =0
Returns next vertex id and coordinates.
virtual QgsPointV2 vertexAt(const QgsVertexId &id) const =0
Returns the point corresponding to a specified vertex id.
virtual QString geometryType() const =0
Returns a unique string representing the geometry type.
virtual int vertexCount(int part=0, int ring=0) const =0
Class to store information about wkb types.
virtual void coordinateSequence(QList< QList< QList< QgsPointV2 > > > &coord) const =0
Retrieves the sequence of geometries, rings and nodes.
QgsRectangle mBoundingBox
const_iterator constEnd() const
const_iterator constBegin() const
QgsRectangle boundingBox() const
Returns the minimal bounding box for the geometry.
virtual ~QgsAbstractGeometryV2()