CreateTool Class
Implements a tool with which the user can create new features.
NuGet/Assembly: Carmenta.Engine.5.16.2.nupkg (in the CECore assembly)
Syntax
public class CreateTool : Tool
Remarks
The CreateTool allows the user to create new point, line and polygon features using mouse interactions. The tool inserts the new features into a MemoryDataSet specified by the application through the DataSet property and the type of feature to create is specified by the CreateMode property.
The tool by itself does not provide any visual feedback, it is up to the application to add the dataset to a layer with the proper visualizations.
A new feature is created and inserted into the dataset as soon as the user starts a new create operation. The new feature inherits the attributes specified by the Attributes properties.
When the user completes the feature, the tool fires a FeatureCreated event. The application can add a handler for this event and, for example, activate a StandardTool so the user can pan/zoom in the map again.
Supported Interactions
Creating Simple Geometries
Choose which one of these geometries are created by modifying CreateMode.
Point
Click to place the point.
Line
Click to place the first point.
Continue clicking to place more points.
Double-click to place the last point and finish the line.
LineSegment
Click to place the first point.
Click to place the second point.
LineSegmentDrag
Click and hold the button to place the first point.
Move the mouse and then release to place the second point.
Polygon
Click to place the first point.
Continue clicking to place more points.
Double-click to place the last point and finish the polygon.
Creating Ellipses
Set CreateMode to Ellipse. Ellipses are created using EllipseOperator and to be able to create and edit them you need to set it up according to the documentation in Interacting with Ellipses.
To alter the settings you also need to set CreateToolParameters to an instance of EllipseCreateToolParameters. These parameters are used to control how the ellipse is created and to set up the attribute names used to control the EllipseOperator.
Initial Attributes
By setting attributes in the Attributes you can skip manual steps in the creation of the ellipse. This can be useful for example when you want to place a sector representing a field of view. If it represents equipment, the radius and angle width may not change. By setting these as initial attributes, the tool only needs the user to place the center and then a point indicating the direction.
For the following steps, if all of the attributes that a step is setting are already set as initial attributes, that step will be skipped.
Ellipse
Click to place the center.
Move the mouse and then click to place a point deciding the radius and direction.
The ellipse will be created with a ratio of 0.5 unless the ratio is set as an initial attribute. It can later be edited with the StandardTool.
Circle
Click to place the center.
Move the mouse and then click to place a point deciding the radius and direction.
If EllipseCreateToolParameters.HasInnerRadius is enabled, move the mouse to place a point indicating the inner radius.
Sector
The sector is placed differently based on the EllipseCreateToolParameters.SectorDefinition.
Using StartClockwiseToFinish:
Click to place the center.
Move the mouse and then click to place a point deciding the radius and start angle.
Move the mouse and then click to place a point deciding the end angle. If EllipseCreateToolParameters.HasInnerRadius is enabled, the inner radius is also set.
Using StartClockwiseByWidth:
Click to place the center.
Move the mouse and then click to place a point deciding the radius and start angle.
Move the mouse and then click to place a point deciding the width angle. If EllipseCreateToolParameters.HasInnerRadius is enabled, the inner radius is also set.
Using MiddleAndWidth:
Click to place the center.
Move the mouse and then click to place a point deciding the radius and middle angle.
Move the mouse and then click to place a point deciding the width angle. If EllipseCreateToolParameters.HasInnerRadius is enabled, the inner radius is also set.
Inheritance Hierarchy
System.Object (not available in C#)
EngineObject
Tool
CreateTool
Platforms
Windows, Linux, Android
CreateTool Members
The CreateTool type has the following members.
Constructors
Name | Description |
---|---|
CreateTool | Initializes a new instance of the CreateTool class. |
Properties
Name | Description |
---|---|
Attributes | Gets the set of attributes that will be set in the new Feature. |
CreateMode | Gets or sets a value indicating what type of features the user can create with the tool. |
DataSet | Gets or sets the dataset in which the tool inserts new features. |
IsDisposed | Gets a value that tells whether the current CreateTool has been disposed. Inherited from EngineObject |
MouseWheelZoomEnabled | Gets or sets a flag indicating if the user may zoom the view with the mouse wheel. |
MouseWheelZoomSpeed | Gets or sets a value controlling the amount the view is zoomed in response to mouse wheel events. |
NativeHandle | Gets the native Carmenta Engine kernel object the current CreateTool represents. Inherited from EngineObject |
Parameters | Gets or sets additional parameters for the CreateTool to use when it creates new features. |
Methods
Name | Description |
---|---|
Clone | Creates a copy of an object. Inherited from EngineObject |
Dispose | Releases the reference to the native Carmenta Engine kernel instance the EngineObject represents. Inherited from EngineObject |
Equals | Determines whether this instance is equal to another. Inherited from EngineObject |
ITool.IsActive | Indicates if the tool is active with a user interaction. Inherited from ITool |
ITool.OnConnect | Called when a tool is connected to the map control. Inherited from ITool |
ITool.OnDisconnect | Called when the tool is disconnected from the map control. Inherited from ITool |
ITool.OnKeyDown | Called when a key is pressed. Inherited from ITool |
ITool.OnKeyUp | Called when a key is released. Inherited from ITool |
ITool.OnMouseDoubleClick | Called when a mouse button is double clicked. Inherited from ITool |
ITool.OnMouseDown | Called when a mouse button is pressed. Inherited from ITool |
ITool.OnMouseMove | Called when the mouse is moved. Inherited from ITool |
ITool.OnMouseUp | Called when a mouse button is released. Inherited from ITool |
ITool.OnMouseWheel | Called when the mouse wheel is moved. Inherited from ITool |
Events
Name | Description |
---|---|
FeatureCreated | Occurs when user has completed creating a new feature. |