GETTING STARTED (code example)

#include <PolygonLibrary.h>
using namespace PolygonLibrary;

// create a topology (a storage of geometric objects whose vertices are references to shared nodes)
Topology* pTopology = Topology::CreateTopology();

// create a polygon layer (a storage of polygons) in the topology
PolygonLayer* pPolygonLayer = pTopology->CreatePolygonLayer(true); // true means that the polygons can overlap

// create polygons in the layer
PolygonLibrary::Polygon* pFirstPolygon = pPolygonLayer->CreatePolygon();
Ring* pCurrentRing = pFirstPolygon->CreateRing();
pCurrentRing->AddNode(PolygonLibrary::Point(2524101.727461,5731099.444297));
pCurrentRing->AddNode(PolygonLibrary::Point(2524126.727461,5731099.4442977));
...
PolygonLibrary::Polygon* pSecondPolygon = pPolygonLayer->CreatePolygon();
...
pPolygonLayer->AcceptChanges(); // splits self-intersecting rings, validates polygons and adds them to the spatial index of the layer

// unite two polygons and put the result ito a new polygon layer
PolygonLayer* pResultPolygonLayer = pTopology->CreatePolygonLayer(true);
PolygonLibrary::Polygon* pPolygonsUnion = pResultPolygonLayer->CreatePolygonsUnion(pFirstPolygon, pSecondPolygon, false);  

NOTES:
- Each object excepting a Point or a Rectangle can be created and deleted only per methods of the library.
- A Topology should be deleted via the Topology::DeleteTopology(Topology*) method.
- A PolygonLayer, Polygon or Ring can be deleted via the Delete*(..) method of the corresponding parent object.
- Each Delete*(..) method deletes also all child objects of the deleted object.
 