|
LuciadCPillar 2025.0.11
|
This class can create (2D) polyline ring instances. More...
#include <luciad/create/geometries/PolylineRingCreator.h>
Public Member Functions | |
| PolylineRingCreator (std::shared_ptr< CoordinateReference > reference) | |
| Creates a new polyline ring creator instance. | |
| ~PolylineRingCreator () override | |
| std::shared_ptr< IPolylineRingConstraint > | getConstraint () const |
| Returns the constraint that is used during creation. | |
| LineCreationMode | getLineCreationMode () const |
| Returns the line creation mode that is used. | |
| LineInterpolationType | getLineInterpolationType () |
| Returns the line interpolation that is used for the geometry. | |
| size_t | getMaxPointCount () const |
| Returns the maximum amount of points a polyline ring can have. | |
| size_t | getMinPointCount () const |
| Returns the minimum amount of points a polyline ring can have. | |
| EventResult | onEvent (const std::shared_ptr< IInputEvent > &inputEvent, const std::shared_ptr< FeatureCreateContext > &context) override |
| Handles the given event, and returns if the event was handled or not. | |
| void | setConstraint (std::shared_ptr< IPolylineRingConstraint > constraint) |
| Sets the constraint that is used during creation. | |
| void | setLineCreationMode (LineCreationMode mode) |
| Sets the line creation mode that is used. | |
| void | setLineInterpolationType (LineInterpolationType lineInterpolationType) |
| Sets the line interpolation that is used for the geometry. | |
| void | setMaxPointCount (size_t maxPointCount) |
| Sets the maximum amount of points a polyline ring can have. | |
| void | setMinPointCount (size_t minPointCount) |
| Sets the minimum amount of points a polyline ring can have. | |
| void | start (std::shared_ptr< IGeometryCreateCallback > callback, const std::shared_ptr< FeatureCreateContext > &context) override |
| This method is called to start creation. | |
| Public Member Functions inherited from luciad::IGeometryCreator | |
| virtual | ~IGeometryCreator ()=default |
This class can create (2D) polyline ring instances.
It reacts to input events to create polyline rings. The event handling behavior can be restricted based on the currently set line creation mode.
The events handled in Click mode are:
Click events to append one point, and start inserting a new one. This results in changes that are luciad::ChangeStatus::InProgressKeyPoint, or luciad::ChangeStatus::Finished when reaching the maximum point count.Mouse move events to position the next individual point. This results in changes that are luciad::ChangeStatus::InProgress.Double click or long touch press events to append a point, and finish creation. Long touch press events are only reacted upon if points were previously added via touch tap. This results in changes that are luciad::ChangeStatus::Finished, or luciad::ChangeStatus::InProgressKeyPoint when the maximum point count is not reached yet.The events handled in Freehand mode are:
Drag events to continuously add points. Creation starts, with points being added as long as the drag event is ongoing, and creation is finished when dragging stops. Points are not added on every Drag event, indeed a heuristic is used to only add a point when the distance to the previous point or the curvature is high enough.changes that are luciad::ChangeStatus::InProgressKeyPoint if a new point is added, luciad::ChangeStatus::InProgress if the drag move does not trigger a new point (i.e. the wannabee point is too close to the previous one), or luciad::ChangeStatus::Finished when the drag ends.In Automatic mode (the default creation mode), the first event since creation is started determines how polyline points are added. If the first event is a mouse click or touch tap, events are added in Click mode. If a drag event is initiated, points are added in Freehand mode.
It is possible to constrain polyline creation using:
minimum point countmaximum point countconstraintThis class does not allow you to interactively choose the elevation of the points. The elevation will by default be set to 0.
|
explicit |
Creates a new polyline ring creator instance.
| reference | the reference of the created polyline ring |
|
override |
| std::shared_ptr< IPolylineRingConstraint > luciad::PolylineRingCreator::getConstraint | ( | ) | const |
Returns the constraint that is used during creation.
Can be nullptr.
| LineCreationMode luciad::PolylineRingCreator::getLineCreationMode | ( | ) | const |
Returns the line creation mode that is used.
| LineInterpolationType luciad::PolylineRingCreator::getLineInterpolationType | ( | ) |
Returns the line interpolation that is used for the geometry.
| size_t luciad::PolylineRingCreator::getMaxPointCount | ( | ) | const |
Returns the maximum amount of points a polyline ring can have.
| size_t luciad::PolylineRingCreator::getMinPointCount | ( | ) | const |
Returns the minimum amount of points a polyline ring can have.
|
overridevirtual |
Handles the given event, and returns if the event was handled or not.
| context | the context, cannot be nullptr |
| inputEvent | an event, cannot be nullptr |
| NullArgumentException | when nullptr is passed. |
Implements luciad::IGeometryCreator.
| void luciad::PolylineRingCreator::setConstraint | ( | std::shared_ptr< IPolylineRingConstraint > | constraint | ) |
Sets the constraint that is used during creation.
The default is no constraint.
The constraint behavior is as follows:
PolylineChange.point insert.Constraints are not allowed to change the point count during creation. Doing this will result in an exception.
| constraint | the constraint. Can be nullptr. |
| void luciad::PolylineRingCreator::setLineCreationMode | ( | LineCreationMode | mode | ) |
Sets the line creation mode that is used.
The line creation mode is Automatic by default.
| mode | the creation mode that is used. |
| void luciad::PolylineRingCreator::setLineInterpolationType | ( | LineInterpolationType | lineInterpolationType | ) |
Sets the line interpolation that is used for the geometry.
The default is LineInterpolationType::Geodesic.
| lineInterpolationType | the line interpolation to use |
| void luciad::PolylineRingCreator::setMaxPointCount | ( | size_t | maxPointCount | ) |
Sets the maximum amount of points a polyline ring can have.
The creator automatically finishes creation when the polyline ring reaches this maximum point count.
By default, this value is the maximum value of size_t, which realistically corresponds to "no maximum".
| maxPointCount | the maximum number of points allowed. |
| InvalidArgumentException | if maxPointCount is lower than the current min point count. |
| void luciad::PolylineRingCreator::setMinPointCount | ( | size_t | minPointCount | ) |
Sets the minimum amount of points a polyline ring can have.
The creator cannot finish creation before the created polyline ring has at least this minimum point count.
By default, this value is 3.
If the creation mode is LineCreationMode::Freehand, the feature creation is always finished when when the final DragEvent is received. If not enough point were generated prior to it, the created polylinering is filled with the needed amount of points at the last received location.
| minPointCount | the minimum number of points allowed. |
| InvalidArgumentException | if minPointCount is lower than 3, or higher than the current max point count. |
|
overridevirtual |
This method is called to start creation.
After this call, IGeometryCreator::onEvent can be called.
When an IGeometryCreator has already started, it cannot be started again until it has finished. Before that time, it is recommended that implementations of this method throw an exception to signal a programming error by the caller of this method.
| context | the context, cannot be nullptr |
| callback | the callback to signal geometry changes, and whether creation for the geometry has finished, cannot be nullptr. |
| NullArgumentException | when nullptr is passed. |
Implements luciad::IGeometryCreator.