/// <summary>
        /// Reconstructs the bounding geometry cue from the given region
        /// </summary>
        public void ConstructFrom(Rectangle region)
        {
            if (Items == null)
            {
                Items = new GeometryItem[4];
                // top
                GeometryPoint gp1 = new GeometryPoint(region.Location, GeometryPointType.ResizableNWSE);
                GeometryPoint gp2 = new GeometryPoint(new Point(region.Right, region.Top), GeometryPointType.ResizableNESW);
                Items[0] = new GeometryItem(gp1, gp2, GeometryItemType.Selection);

                // right
                GeometryPoint gp3 = new GeometryPoint(new Point(region.Right, region.Bottom), GeometryPointType.ResizableNWSE);
                Items[1] = new GeometryItem(gp2, gp3, GeometryItemType.Selection);

                // bottom
                GeometryPoint gp4 = new GeometryPoint(new Point(region.Left, region.Bottom), GeometryPointType.ResizableNESW);
                Items[2] = new GeometryItem(gp4, gp3, GeometryItemType.Selection);

                // left
                Items[3] = new GeometryItem(gp1, gp4, GeometryItemType.Selection);

                Visible = visible;
            }
            else
            {
                Items[0].Points[0].Move(region.Location);
                Items[1].Points[0].Move(new Point(region.Right, region.Top));
                Items[2].Points[1].Move(new Point(region.Right, region.Bottom));
                Items[3].Points[1].Move(new Point(region.Left, region.Bottom));
            }
        }
示例#2
0
        public override void ConstructFrom(Rectangle region)
        {
            Point midTop, midBottom, midLeft, midRight;
            MidpointGeometryConstructor.Points(out midTop, out midBottom, out midLeft, out midRight, region);

            if (Edges == null)
            {
                Edges = new GeometryItem[4];

                Edges[0] = new GeometryItem(new GeometryPoint(midTop, GeometryPointType.Movable),
                    new GeometryPoint(midRight, GeometryPointType.Movable),
                    GeometryItemType.Cue);

                Edges[1] = new GeometryItem(Edges[0].Points[1],
                    new GeometryPoint(midBottom, GeometryPointType.Movable),
                    GeometryItemType.Cue);

                Edges[2] = new GeometryItem(Edges[1].Points[1],
                    new GeometryPoint(midLeft, GeometryPointType.Movable),
                    GeometryItemType.Cue);

                Edges[3] = new GeometryItem(Edges[2].Points[1], Edges[0].Points[0],
                    GeometryItemType.Cue);
            }
        }
示例#3
0
        public Circle(Point center, int radius, ShapeStyle style)
            : base(new Rectangle(center.X - radius, center.Y - radius, 2 * radius, 2 * radius),
                  0, style, "Layer - Circle", true)
        {
            RadiusGeometry = new GeometryItem(
                new GeometryPoint(center, GeometryPointType.Movable),
                new GeometryPoint(new Point(center.X + radius, center.Y), GeometryPointType.Movable),
                GeometryItemType.Cue);

            EditablegeometryCue.Add(RadiusGeometry);
        }
示例#4
0
        public override void ConstructFrom(Rectangle region)
        {
            Point midTop, midBottom, midLeft, midRight;
            MidpointGeometryConstructor.Points(out midTop, out midBottom, out midLeft, out midRight, region);

            if (Axes == null)
            {
                Axes = new GeometryItem[2];

                Axes[0] = new GeometryItem(new GeometryPoint(midTop, GeometryPointType.ResizableNS),
                    new GeometryPoint(midBottom, GeometryPointType.ResizableNS),
                    GeometryItemType.Cue);

                Axes[1] = new GeometryItem(new GeometryPoint(midLeft, GeometryPointType.ResizableWE),
                    new GeometryPoint(midRight, GeometryPointType.ResizableWE),
                    GeometryItemType.Cue);
            }
        }
 public void AddRange(GeometryItem[] items)
 {
     Items.AddRange(items);
     Visible = visible;
 }
 public void Add(GeometryItem item)
 {
     Items.Add(item);
     Visible = visible;
 }