Class GeometryReshapingTool
- Namespace
- Northwoods.Go.Tools.Extensions
- Assembly
- GeometryReshapingWinForms.dll
The GeometryReshapingTool class allows for a Shape's Geometry to be modified by the user via the dragging of tool handles.
public class GeometryReshapingTool : Tool
- Inheritance
-
GeometryReshapingTool
- Inherited Members
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.
public GeometryReshapingTool()
Properties
AdornedShape
Gets the Shape that is being reshaped. This must be contained within the selected Part.
public Shape AdornedShape { get; }
Property Value
Handle
This read-only property returns the GraphObject that is the tool handle being dragged by the user.
public GraphObject Handle { get; set; }
Property Value
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.
public GraphObject HandleArchetype { get; set; }
Property Value
IsResegmenting
Gets or sets whether this tool supports the user's addition or removal of segments in the geometry.
public bool IsResegmenting { get; set; }
Property Value
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.
public GraphObject MidHandleArchetype { get; set; }
Property Value
OriginalGeometry
This read-only property remembers the original value for Geometry, so that it can be restored if this tool is cancelled.
public Geometry OriginalGeometry { get; }
Property Value
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.
public int ResegmentingDistance { get; set; }
Property Value
Remarks
The default value is 3.
ReshapeElementName
The name of the GraphObject to be reshaped.
public string ReshapeElementName { get; set; }
Property Value
Remarks
The default name is "SHAPE".
Methods
CanStart()
This tool may run when there is a mouse-down event on a reshape handle.
public override bool CanStart()
Returns
ComputeReshape(Point)
This is called by DoMouseMove() and DoMouseUp() to limit the input point before calling Reshape(Point).
public virtual Point ComputeReshape(Point p)
Parameters
p
Pointthe point where the handle is being dragged.
Returns
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.
public override void DoActivate()
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.
public override void DoCancel()
DoDeactivate()
This stops the current reshaping operation with the Shape as it is.
public override void DoDeactivate()
DoMouseMove()
Call Reshape(Point) with a new point determined by the mouse to change the geometry of the AdornedShape.
public override void DoMouseMove()
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.
public override void DoMouseUp()
Reshape(Point)
Change the geometry of the AdornedShape by moving the point corresponding to the current Handle to be at the given Point.
public void Reshape(Point newPoint)
Parameters
newPoint
Pointthe 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.
public override void UpdateAdornments(Part part)
Parameters
part
Part
Remarks
Don't show anything if ReshapeElementName doesn't return a Shape that has a Geometry of type Path.