Class GeometryReshapingTool
The GeometryReshapingTool class allows for a Shape's Geometry to be modified by the user via the dragging of tool handles.
Namespace: Northwoods.Go.Tools.Extensions
Assembly: GeometryReshapingAvalonia.dll
Syntax
public class GeometryReshapingTool : Tool
Remarks
This tool does not handle Links, whose routes should be reshaped by the LinkReshapingTool. The ReshapeElementName needs to identify the named Shape within the selected Part. If the shape cannot be found or if its Geometry is not of type Path, this will not show any GeometryReshaping Adornment. At the current time this tool does not support adding or removing PathSegments to the Geometry.
Constructors
GeometryReshapingTool()
Constructs a GeometryReshapingTool and sets the handle and name of the tool.
Declaration
public GeometryReshapingTool()
Properties
AdornedShape
Gets the Shape that is being reshaped. This must be contained within the selected Part.
Declaration
public Shape AdornedShape { get; }
Property Value
Type | Description |
---|---|
Shape |
Handle
This read-only property returns the GraphObject that is the tool handle being dragged by the user.
Declaration
public GraphObject Handle { get; set; }
Property Value
Type | Description |
---|---|
GraphObject |
Remarks
This will be contained by an Adornment whose category is "GeometryReshaping". Its AdornedElement is the same as the AdornedShape.
HandleArchetype
A small GraphObject used as a reshape handle for each segment. The default GraphObject is a small blue diamond.
Declaration
public GraphObject HandleArchetype { get; set; }
Property Value
Type | Description |
---|---|
GraphObject |
IsResegmenting
Gets or sets whether this tool supports the user's addition or removal of segments in the geometry.
Declaration
public bool IsResegmenting { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
The default value is false. When the value is true, copies of the MidHandleArchetype will appear in the middle of each segment. At the current time, resegmenting is limited to straight segments, not curved ones.
MidHandleArchetype
A small GraphObject used as a reshape handle at the middle of each segment for inserting a new segment. The default GraphObject is a small blue circle.
Declaration
public GraphObject MidHandleArchetype { get; set; }
Property Value
Type | Description |
---|---|
GraphObject |
OriginalGeometry
This read-only property remembers the original value for Geometry, so that it can be restored if this tool is cancelled.
Declaration
public Geometry OriginalGeometry { get; }
Property Value
Type | Description |
---|---|
Geometry |
ResegmentingDistance
The maximum distance at which a resegmenting handle being positioned on a straight line between the adjacent points will cause one of the segments to be removed from the geometry.
Declaration
public int ResegmentingDistance { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
The default value is 3.
ReshapeElementName
The name of the GraphObject to be reshaped.
Declaration
public string ReshapeElementName { get; set; }
Property Value
Type | Description |
---|---|
string |
Remarks
The default name is "SHAPE".
Methods
CanStart()
This tool may run when there is a mouse-down event on a reshape handle.
Declaration
public override bool CanStart()
Returns
Type | Description |
---|---|
bool |
Overrides
ComputeReshape(Point)
This is called by DoMouseMove() and DoMouseUp() to limit the input point before calling Reshape(Point).
Declaration
public virtual Point ComputeReshape(Point p)
Parameters
Type | Name | Description |
---|---|---|
Point | p | the point where the handle is being dragged. |
Returns
Type | Description |
---|---|
Point |
Remarks
By default, this doesn't limit the input point.
DoActivate()
Start reshaping, if FindToolHandleAt(Point, string) finds a reshape handle at the mouse down point.
Declaration
public override void DoActivate()
Overrides
Remarks
If successful this sets Handle to be the reshape handle that it finds and AdornedShape to be the Shape being reshaped. It also remembers the original geometry in case this tool is cancelled. And it starts a transaction.
DoCancel()
Restore the shape to be the original geometry and stop this tool.
Declaration
public override void DoCancel()
Overrides
DoDeactivate()
This stops the current reshaping operation with the Shape as it is.
Declaration
public override void DoDeactivate()
Overrides
DoMouseMove()
Call Reshape(Point) with a new point determined by the mouse to change the geometry of the AdornedShape.
Declaration
public override void DoMouseMove()
Overrides
DoMouseUp()
Reshape the Shape's geometry with a point based on the most recent mouse point by calling Reshape(Point), and then stop this tool.
Declaration
public override void DoMouseUp()
Overrides
Reshape(Point)
Change the geometry of the AdornedShape by moving the point corresponding to the current Handle to be at the given Point.
Declaration
public void Reshape(Point newPoint)
Parameters
Type | Name | Description |
---|---|---|
Point | newPoint | the value of the call to ComputeReshape(Point). |
Remarks
This is called by DoMouseMove() and DoMouseUp() with the result of calling ComputeReshape(Point) to constrain the input point.
UpdateAdornments(Part)
Show an Adornment with a reshape handle at each point of the geometry.
Declaration
public override void UpdateAdornments(Part part)
Parameters
Type | Name | Description |
---|---|---|
Part | part |
Overrides
Remarks
Don't show anything if ReshapeElementName doesn't return a Shape that has a Geometry of type Path.