Table of Contents

Class SnapLinkReshapingTool

Namespace
Northwoods.Go.Tools.Extensions
Assembly
SnapLinkReshapingWinForms.dll

The SnapLinkReshapingTool class lets the user snap link reshaping handles to the nearest grid point.

public class SnapLinkReshapingTool : LinkReshapingTool
Inheritance
SnapLinkReshapingTool
Inherited Members

Remarks

If AvoidsNodes is true and the link is orthogonal, it also avoids reshaping the link so that any adjacent segments cross over any avoidable nodes.

Properties

AvoidsNodes

Gets or sets whether a reshape handle's position should only be dragged where the adjacent segments do not cross over any nodes. This affects the behavior of ComputeReshape(Point).

public bool AvoidsNodes { get; set; }

Property Value

bool

Remarks

The default value is true.

GridCellSize

Gets or sets the Size of each grid cell to which link points will be snapped.

public Size GridCellSize { get; set; }

Property Value

Size

Remarks

The default value is NaNxNaN, which means use the Grid's GridCellSize.

GridOrigin

Gets or sets the Point origin for the grid to which link points will be snapped.

public Point GridOrigin { get; set; }

Property Value

Point

Remarks

The default value is NaNxNaN, which means use the Grid's GridOrigin.

IsGridSnapEnabled

Gets or sets whether a reshape handle's position should be snapped to a grid point. This affects the behavior of ComputeReshape(Point).

public bool IsGridSnapEnabled { get; set; }

Property Value

bool

Remarks

The default value is true.

Methods

ComputeReshape(Point)

Pretend while dragging a reshape handle the mouse point is at the nearest grid point, if IsGridSnapEnabled is true.

public override Point ComputeReshape(Point p)

Parameters

p Point

Returns

Point

Remarks

This uses GridCellSize and GridOrigin, unless those are not real values, in which case this uses the Grid"s GridCellSize and GridOrigin.

If AvoidsNodes is true and the adorned Link is IsOrthogonal, this method also avoids returning a Point that causes the adjacent segments, both before and after the current handle's index, to cross over any Nodes that are Avoidable.

DoActivate()

This override records information about the original point of the handle being dragged, if the AdornedLink is Orthogonal and if AvoidsNodes is true.

public override void DoActivate()