public final class PointCreator extends Object implements AutoCloseable, IGeometryCreator
It reacts on
mouse move
events to position the point
mouse click
to finish creation of the point.
touch tap
to immediately create a point.
This class does not allow you to interactively choose the elevation of the point. The elevation will by default be set to 0.
Constructor and Description |
---|
PointCreator(CoordinateReference reference)
Creates a new
PointCreator . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
finalize() |
IPointConstraint |
getConstraint() |
EventResult |
onEvent(IInputEvent inputEvent,
FeatureCreateContext context)
Handles the given event, and returns if the event was handled or not.
|
void |
setConstraint(IPointConstraint constraint)
Sets the constraint to use during creation.
|
void |
start(IGeometryCreateCallback callback,
FeatureCreateContext context)
This method is called to start creation.
|
public PointCreator(@NotNull CoordinateReference reference)
PointCreator
.reference
- the reference of the created pointpublic void close()
close
in interface AutoCloseable
public void start(@NotNull IGeometryCreateCallback callback, @NotNull FeatureCreateContext context) throws NullPointerException
After this call, IGeometryCreator#onEvent
can be called.
When a IGeometryCreator
was started, it can not be started again until it has finished
. Implementations of this method are encouraged to throw an exception in that case to signal a programming error by the caller of this method.
start
in interface IGeometryCreator
callback
- the callback to signal geometry changes, and whether creation for the geometry has finished, cannot be null
.context
- the context, cannot be null
NullPointerException
- when null
is passed.@NotNull public EventResult onEvent(@NotNull IInputEvent inputEvent, @NotNull FeatureCreateContext context) throws NullPointerException
onEvent
in interface IGeometryCreator
inputEvent
- an event, cannot be null
context
- the context, cannot be null
NullPointerException
- when null
is passed.public void setConstraint(@Nullable IPointConstraint constraint)
The default is no constraint.
constraint
- the constraint. Can be null
.@Nullable public IPointConstraint getConstraint()
null
.setConstraint