#include "qgsgeometry.h" #includeint main(){ QgsGeometry geom(QgsWkbTypes::Point); std::cout << "Is empty: " << std::boolalpha << geom.isEmpty() << std::endl; // Output: Is empty: true return 0; }
#include "qgsgeometry.h" #includeThis example creates a linestring geometry and adds two points to it using the addPoint() function. Since the geometry is no longer empty, the output will be false. The QgsGeometry class is part of the QGIS C++ API library, which is included with the QGIS package.int main(){ QgsGeometry geom(QgsWkbTypes::LineString); QgsPoint point1(0, 0); QgsPoint point2(1, 1); geom.addPoint(point1); geom.addPoint(point2); std::cout << "Is empty: " << std::boolalpha << geom.isEmpty() << std::endl; // Output: Is empty: false return 0; }