59 void QgsAbstractGeometryV2::clip(
const QgsRectangle& rect )
90 bool hasZ = subgeom->
is3D();
183 for ( ; j < n; i = j++ )
187 double d = vi.
x() * vj.
y() - vj.
x() * vi.
y();
189 Cx += ( vi.
x() + vj.
x() ) * d;
190 Cy += ( vi.
y() + vj.
y() ) * d;
196 for (
int i = 0; i < n - 1; ++i )
202 return QgsPointV2( Cx / ( n - 1 ), Cy / ( n - 1 ) );
206 return QgsPointV2( Cx / ( 3. * A ), Cy / ( 3. * A ) );
QgsWKBTypes::Type wkbType() const
Returns the WKB type of the geometry.
A rectangle specified with double values.
virtual bool dropMValue()=0
Drops any measure values which exist in the geometry.
virtual QgsPointV2 centroid() const
Returns the centroid of the geometry.
virtual QgsCoordinateSequenceV2 coordinateSequence() const =0
Retrieves the sequence of geometries, rings and nodes.
virtual QgsAbstractGeometryV2 & operator=(const QgsAbstractGeometryV2 &geom)
double x() const
Returns the point's x-coordinate.
static Type addZ(Type type)
Adds the z dimension to a WKB type and returns the new type.
static bool hasM(Type type)
Tests whether a WKB type contains m values.
Abstract base class for all geometries.
virtual bool dropZValue()=0
Drops any z-dimensions which exist in the geometry.
static bool hasZ(Type type)
Tests whether a WKB type contains the z-dimension.
QString wktTypeStr() const
Returns the WKT type string of the geometry.
int nCoordinates() const
Returns the number of nodes contained in the geometry.
virtual bool addMValue(double mValue=0)=0
Adds a measure to the geometry, initialized to a preset value.
double y() const
Returns the point's y-coordinate.
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.
bool is3D() const
Returns true if the geometry is 3D and contains a z-value.
static Type addM(Type type)
Adds the m dimension to a WKB type and returns the new type.
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
Default calculator for the minimal bounding box for the geometry.
bool isEmpty() const
Returns true if the geometry is empty.
Point geometry type, with support for z-dimension and m-values.
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 addZValue(double zValue=0)=0
Adds a z-dimension to the geometry, initialized to a preset value.
virtual bool nextVertex(QgsVertexId &id, QgsPointV2 &vertex) const =0
Returns next vertex id and coordinates.
virtual QString geometryType() const =0
Returns a unique string representing the geometry type.
virtual bool convertTo(QgsWKBTypes::Type type)
Converts the geometry to a specified type.
virtual int vertexCount(int part=0, int ring=0) const =0
Handles storage of information regarding WKB types and their properties.
static Type flatType(Type type)
Returns the flat type for a WKB type.
virtual ~QgsAbstractGeometryV2()
virtual QgsPointV2 vertexAt(QgsVertexId id) const =0
Returns the point corresponding to a specified vertex id.