public RemoveGeometryAction(ShpPoint shapeToRemove, IShape container, LayerManager layerManager) { this.layerManager = layerManager; this.d.x = this.layerManager.GetMainControler().MapPanel.DX; this.d.y = this.layerManager.GetMainControler().MapPanel.DY; this.scale = layerManager.Scale; this.shapeToDelete = shapeToRemove; this.container = container; this.pointSize = 2; deletedPoint.x = shapeToDelete.RootX; deletedPoint.y = shapeToDelete.RootY; }
public ShpPoint addPoint(double x, double y, double scale) { ShpPoint pnt = new ShpPoint(x, y, scale); if (points.Count == 0) { _boundingBox.Left = pnt.RootX; _boundingBox.Bottom = pnt.RootY; _boundingBox.TopRight = _boundingBox.BottomLeft; } else { if (pnt.RootX < _boundingBox.Left) { _boundingBox.Left = pnt.RootX; } if (pnt.RootY < _boundingBox.Bottom) { _boundingBox.Bottom = pnt.RootY; } if (pnt.RootX > _boundingBox.Right) { _boundingBox.Right = pnt.RootX; } if (pnt.RootY > _boundingBox.Top) { _boundingBox.Top = pnt.RootY; } } points.Add(pnt); pnt.Changed += new IShape.PositionChangedDelegate(pnt_Changed); ElementAdded(pnt); return(pnt); }
public EditGeometryMenu(MainForm mainForm, IShape container, ShpPoint vertex) : base() { this.mainForm = mainForm; this.container = container; this.vertex = vertex; moveMenuItem = new MenuItem(); moveMenuItem.Text = "verschieben"; moveMenuItem.Checked = false; moveMenuItem.Click += new System.EventHandler(menuItemClick); //choosePositionMenuItem = new MenuItem(); //choosePositionMenuItem.Text = "Position eingeben"; //choosePositionMenuItem.Checked = false; //choosePositionMenuItem.Click += new System.EventHandler(menuItemClick); removeShapeMenuItem = new MenuItem(); removeShapeMenuItem.Text = "löschen"; removeShapeMenuItem.Checked = false; removeShapeMenuItem.Click += new System.EventHandler(menuItemClick); // you can not delete a point if there are less then three points in the polygon if ((container.PointCount <= 4 && (container as ShpPolygon) != null) || (container.PointCount <= 2 && (container as ShpPolyline) != null)) { removeShapeMenuItem.Enabled = false; } this.MenuItems.Add(moveMenuItem); //this.MenuItems.Add(choosePositionMenuItem); this.MenuItems.Add(removeShapeMenuItem); }