public class LabelJig : EntityJig
{
private Point3d _lastPoint;
private readonly Polyline _poly;
public LabelJig(Polyline poly, Point3d firstPoint) : base(poly)
{
_poly = poly;
_lastPoint = firstPoint;
_poly.AddVertexAt(_poly.NumberOfVertices, new Point2d(_lastPoint.X, _lastPoint.Y), 0, 0, 0);
}
protected override SamplerStatus Sampler(JigPrompts prompts)
{
JigPromptPointOptions opts = new JigPromptPointOptions("\n" + "Укажите следующую точку" + ": ")
{
BasePoint = _lastPoint,
UseBasePoint = true,
UserInputControls = UserInputControls.NoZeroResponseAccepted |
UserInputControls.NullResponseAccepted
};
PromptPointResult res = prompts.AcquirePoint(opts);
if (res.Status == PromptStatus.None)
{
return SamplerStatus.OK;
}
if (res.Status == PromptStatus.Cancel)
{
return SamplerStatus.Cancel;
}
if (_lastPoint == res.Value)
{
return SamplerStatus.NoChange;
}
_lastPoint = res.Value;
return SamplerStatus.OK;
}