![]() |
Mapper
0.9.0
API documentation
|
Wraps some helper functions for boolean operations. More...
#include <boolean_tool.h>
Public Types | |
enum | Operation { Union, Intersection, Difference, XOr, MergeHoles } |
Types of boolean operation. More... | |
typedef std::vector< PathObject *> | PathObjects |
A list of PathObject elements. More... | |
Public Member Functions | |
BooleanTool (Operation op, Map *map) | |
Constructs a tool for the given operation and map. More... | |
bool | execute () |
Executes the operation on the selected objects in the map. More... | |
bool | executePerSymbol () |
Executes the operation per symbol on the selected objects in the map. More... | |
bool | executeForObjects (PathObject *subject, PathObjects &in_objects, PathObjects &out_objects) |
Executes the operation on particular objects. More... | |
void | executeForLine (const PathObject *area, const PathObject *line, PathObjects &out_objects) |
Executes the Intersection and Difference operation on the given line object. More... | |
Wraps some helper functions for boolean operations.
The implementation of the boolean operation tools is based on the Clipper library (aka libpolyclipping) (http://www.angusj.com/delphi/clipper.php).
Because Clipper does not support bezier curves, areas are clipped as polygonal approximations, and after clipping we try to rebuild the curves.
typedef std::vector< PathObject* > OpenOrienteering::BooleanTool::PathObjects |
A list of PathObject elements.
Constructs a tool for the given operation and map.
map must not be nullptr (for some member functions).
bool OpenOrienteering::BooleanTool::execute | ( | ) |
Executes the operation on the selected objects in the map.
The first selected object is treated special and must be a path.
void OpenOrienteering::BooleanTool::executeForLine | ( | const PathObject * | area, |
const PathObject * | line, | ||
BooleanTool::PathObjects & | out_objects | ||
) |
Executes the Intersection and Difference operation on the given line object.
area | The primary object, here defining a boundary. |
line | The line object to operate on. |
out_objects | The resulting collection of objects. |
bool OpenOrienteering::BooleanTool::executeForObjects | ( | PathObject * | subject, |
PathObjects & | in_objects, | ||
PathObjects & | out_objects | ||
) |
Executes the operation on particular objects.
This function does not (actively) change the collection of objects in the map or the selection.
subject | The primary affected object. |
in_objects | All objects to operate on. Must contain subject. |
out_objects | The resulting collection of objects. |
bool OpenOrienteering::BooleanTool::executePerSymbol | ( | ) |
Executes the operation per symbol on the selected objects in the map.
Executes the operation independently for every group of path objects which have got the same symbol. Objects which are not of type Object::Path are ignored.
Errors during the operation are ignored, too. The original objects the operation failed for remain unchanged. The operation continues for other groups of objects.