Ejemplo n.º 1
0
        /// <summary>
        /// Deletes the currently selected shape
        /// </summary>
        public void Delete()
        {
            if (selectedEntity == null)
            {
                return;
            }
            ShapeBase sh = selectedEntity as ShapeBase;

            if (sh != null)
            {
                if (sh.IsRoot)
                {
                    return;                           //cannot delete the root
                }
                //delete the node from the parent's children
                sh.parentNode.childNodes.Remove(sh);
                //delete everything underneath the node
                DeleteVisitor visitor = new DeleteVisitor(this.graphAbstract);
                visitor.OnDelete += new ShapeData(visitor_OnDelete);
                graphAbstract.DepthFirstTraversal(visitor, sh);
                DrawTree();
            }
            //Invalidate();
        }
Ejemplo n.º 2
0
		/// <summary>
		/// Deletes the currently selected shape
		/// </summary>
		public void Delete()
		{
			if(selectedEntity==null) return;
			ShapeBase sh = selectedEntity as ShapeBase;
			if(sh!=null)
			{
				if(sh.IsRoot) return; //cannot delete the root
				//delete the node from the parent's children
				sh.parentNode.childNodes.Remove(sh);
				//delete everything underneath the node 
				DeleteVisitor visitor = new DeleteVisitor(this.graphAbstract);
				visitor.OnDelete+=new ShapeData(visitor_OnDelete);
				graphAbstract.DepthFirstTraversal(visitor,sh);
				DrawTree();
			}
			//Invalidate();
				
		}