public Shape AddNode(BasicShapeTypes shapeType, string label) { return AddBasicNode(shapeType, label, Center); }
public Shape AddNode(BasicShapeTypes shapeType, string label, PointF position) { return AddBasicNode(shapeType, label, position); }
private Shape AddBasicNode(BasicShapeTypes shapeType, string nodeLabel, PointF position) { string key =string.Empty; Shape sob = null; switch(shapeType) { case BasicShapeTypes.BasicNode: key = "8ED1469D-90B2-43ab-B000-4FF5C682F530"; break; case BasicShapeTypes.SimpelNode: key = "57AF94BA-4129-45dc-B8FD-F82CA3B4433E"; break; case BasicShapeTypes.TextLabel: key = "4F878611-3196-4d12-BA36-705F502C8A6B"; break; } sob= GetShapeInstance(key); if(sob != null) { this.AddShape(sob,position); sob.Text=nodeLabel; #if NAFEnabled sob.Root=this.root; #endif if(OnShapeAdded !=null) { OnShapeAdded(this,sob); } } return sob; // shapeObject = new BasicNode(this); // // if (shapeObject != null) // { // shapeObject.Invalidate(); // RectangleF r = shapeObject.Rectangle; // // shapeObject.Rectangle = new RectangleF(position.X, position.Y, r.Width, r.Height); // // shapeObject.Invalidate(); // // extract.Insert(shapeObject); // ((BasicNode) shapeObject).ShowProps +=new ShowPropsDelegate(CanvasControl_ShowProps); // if (NodeLabel==null) // { // ((BasicNode) shapeObject).Label="Node " + BasicNodeCounter.ToString(); // BasicNodeCounter++; //just a way to label newly created nodes // } // else // ((BasicNode) shapeObject).Label=NodeLabel; // // shapeObject = null; // // } }