Tools: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
=== Tool Properties === | === Tool Properties === | ||
Here is a list of the properties of the tool. | |||
{| class="wikitable" | {| class="wikitable" | ||
!width="26%"| Name | !width="26%"| Name | ||
Line 21: | Line 23: | ||
| '''Positions''' | | '''Positions''' | ||
| Returns a list of all the positions defined by the distance tool legs. Can also be used to set the positions of the measuring line. | | Returns a list of all the positions defined by the distance tool legs. Can also be used to set the positions of the measuring line. | ||
|- | |||
| '''SelectedInstance''' | |||
| The selected measuring line instance. | |||
|- | |- | ||
| '''SelectedIndex''' | | '''SelectedIndex''' | ||
| The selected vertex/position of the active measuring line instance. | | The selected vertex/position of the active measuring line instance. | ||
|- | |- | ||
| '''SnapsToPoint''' | | '''SnapsToPoint''' | ||
Line 42: | Line 44: | ||
=== Tool Style Properties === | === Tool Style Properties === | ||
Here is a list of the properties used to style the appearance of the tool. | |||
{| class="wikitable" | {| class="wikitable" | ||
!width="26%"| Name | !width="26%"| Name | ||
!width="73%"| Description | !width="73%"| Description | ||
|- | |- | ||
| ''' | | '''LineThickness''' | ||
| The | | The line thickness. | ||
|- | |||
| '''LineColor''' | |||
| The line color. | |||
|- | |- | ||
| ''' | | '''LineDashStyle''' | ||
| The | | The line dash style. | ||
|- | |- | ||
| ''' | | '''SelectedLineColor''' | ||
| The line | | The selected line color. | ||
|- | |- | ||
| '''OutlineThickness''' | | '''OutlineThickness''' | ||
| The outline thickness of the line. | | The outline thickness of the line. | ||
|- | |- | ||
| ''' | | '''OutlineColor''' | ||
| The | | The outline color of the line. | ||
|- | |- | ||
| '''OutlineDashStyle''' | | '''OutlineDashStyle''' | ||
| The outline dash style of the line. | | The outline dash style of the line. | ||
|- | |- | ||
| ''' | | '''VertexLineThickness''' | ||
| The outline color | | The vertex line thickness. | ||
|- | |||
| '''VertexLineColor''' | |||
| The vertex line color. | |||
|- | |||
| '''VertexOutlineThickness''' | |||
| The vertex outline thickness. | |||
|- | |||
| '''VertexOutlineColor''' | |||
| The vertex outline color. | |||
|- | |||
| '''VertexFillColor''' | |||
| The vertex fill color. | |||
|- | |||
| '''VertexSize''' | |||
| The vertex radius. | |||
|- | |- | ||
| ''' | | '''HighlightColor''' | ||
| The | | The highlight distance vertex color. | ||
|- | |- | ||
| '''SelectedVertexLineColor''' | | '''SelectedVertexLineColor''' | ||
| The selected vertex line color. | | The selected vertex line color. | ||
|- | |- | ||
| '''InsertVertexLineColor''' | | '''InsertVertexLineColor''' | ||
Line 84: | Line 100: | ||
| '''InsertVertexOutlineColor''' | | '''InsertVertexOutlineColor''' | ||
| The insert vertex outline color. | | The insert vertex outline color. | ||
|- | |- | ||
| '''InsertVertexFillColor''' | | '''InsertVertexFillColor''' | ||
Line 114: | Line 121: | ||
| '''FontSize''' | | '''FontSize''' | ||
| The text size. | | The text size. | ||
|} | |} | ||
=== Overriding The Vertex Rendering === | |||
To override how the vertices are rendered, create a class that implements the IDistanceToolOverrideRenderer interface and assign an instance of the class to the OverrideVertexRenderer property. | |||
<source lang="c#"> | |||
/// <summary> | |||
/// Interface for renderer for overriding how distance line vertices are rendered. | |||
/// </summary> | |||
public interface IDistanceToolOverrideRenderer | |||
{ | |||
/// <summary> | |||
/// Render vertex. | |||
/// </summary> | |||
/// <param name="dc">The drawing context instance.</param> | |||
/// <param name="p">The vertex point.</param> | |||
/// <param name="isSelected">The selected state of the point.</param> | |||
void RenderVertex(DrawingContext dc, Point p, bool isSelected); | |||
/// <summary> | |||
/// Render snap to vertex. | |||
/// </summary> | |||
/// <param name="dc">The drawing context instance.</param> | |||
/// <param name="p">The vertex point.</param> | |||
void RenderSnapToVertex(DrawingContext dc, Point p); | |||
/// <summary> | |||
/// Render insert vertex. | |||
/// </summary> | |||
/// <param name="dc">The drawing context instance.</param> | |||
/// <param name="p">The vertex point.</param> | |||
void RenderInsertVertex(DrawingContext dc, Point p); | |||
/// <summary> | |||
/// Render add start or end vertex. | |||
/// </summary> | |||
/// <param name="dc">The drawing context instance.</param> | |||
/// <param name="p">The vertex point.</param> | |||
void RenderAddVertex(DrawingContext dc, Point p); | |||
/// <summary> | |||
/// Render highlight distance vertex. | |||
/// </summary> | |||
/// <param name="dc">The drawing context instance.</param> | |||
/// <param name="p">The vertex point.</param> | |||
void RenderHighlightDistance(DrawingContext dc, Point p); | |||
} | |||
</source> |
Revision as of 12:33, 15 May 2024
Distance Tool
With the DistanceTool the user can create one or more measuring lines with multiple positions. A measuring line can be edited, e.g. add, insert, remove or move positions.
Tool Properties
Here is a list of the properties of the tool.
Name | Description |
---|---|
IsPannningEnabled | Set if map can be panned when not adding or editing a distance line. When true the IsAddInstanceEnabled property must be set to true before a new distance line can be drawn. |
IsInsertPointEnabled | Enable or disable if inserting a vertex is allowed. |
IsAddPointEnabled | Enable or disable if adding a vertex at start or end is allowed. |
IsMultiLine | Set if tool supports multiple lines. |
Positions | Returns a list of all the positions defined by the distance tool legs. Can also be used to set the positions of the measuring line. |
SelectedInstance | The selected measuring line instance. |
SelectedIndex | The selected vertex/position of the active measuring line instance. |
SnapsToPoint | When set the tool snaps to track or draw object points. |
SnapsToPointDistance | The distance in pixels when the tool snaps to a point. |
CalculationPath | Set how the measure line is calculated: Geodesics or Loxodrome. |
OverrideVertexRenderer | Renderer for overriding how distance line vertices are rendered. |
Tool Style Properties
Here is a list of the properties used to style the appearance of the tool.
Name | Description |
---|---|
LineThickness | The line thickness. |
LineColor | The line color. |
LineDashStyle | The line dash style. |
SelectedLineColor | The selected line color. |
OutlineThickness | The outline thickness of the line. |
OutlineColor | The outline color of the line. |
OutlineDashStyle | The outline dash style of the line. |
VertexLineThickness | The vertex line thickness. |
VertexLineColor | The vertex line color. |
VertexOutlineThickness | The vertex outline thickness. |
VertexOutlineColor | The vertex outline color. |
VertexFillColor | The vertex fill color. |
VertexSize | The vertex radius. |
HighlightColor | The highlight distance vertex color. |
SelectedVertexLineColor | The selected vertex line color. |
InsertVertexLineColor | The insert vertex line color. |
InsertVertexOutlineColor | The insert vertex outline color. |
InsertVertexFillColor | The insert vertex fill color. |
AreaFillColor | The area fill color. |
ForegroundColor | The text foreground color. |
BackgroundColor | The text background color. |
OutlineFontColor | The outline font color. |
FontTypeface | The text typeface. |
FontSize | The text size. |
Overriding The Vertex Rendering
To override how the vertices are rendered, create a class that implements the IDistanceToolOverrideRenderer interface and assign an instance of the class to the OverrideVertexRenderer property.
/// <summary>
/// Interface for renderer for overriding how distance line vertices are rendered.
/// </summary>
public interface IDistanceToolOverrideRenderer
{
/// <summary>
/// Render vertex.
/// </summary>
/// <param name="dc">The drawing context instance.</param>
/// <param name="p">The vertex point.</param>
/// <param name="isSelected">The selected state of the point.</param>
void RenderVertex(DrawingContext dc, Point p, bool isSelected);
/// <summary>
/// Render snap to vertex.
/// </summary>
/// <param name="dc">The drawing context instance.</param>
/// <param name="p">The vertex point.</param>
void RenderSnapToVertex(DrawingContext dc, Point p);
/// <summary>
/// Render insert vertex.
/// </summary>
/// <param name="dc">The drawing context instance.</param>
/// <param name="p">The vertex point.</param>
void RenderInsertVertex(DrawingContext dc, Point p);
/// <summary>
/// Render add start or end vertex.
/// </summary>
/// <param name="dc">The drawing context instance.</param>
/// <param name="p">The vertex point.</param>
void RenderAddVertex(DrawingContext dc, Point p);
/// <summary>
/// Render highlight distance vertex.
/// </summary>
/// <param name="dc">The drawing context instance.</param>
/// <param name="p">The vertex point.</param>
void RenderHighlightDistance(DrawingContext dc, Point p);
}