Ejemplo n.º 1
0
        /// <summary>
        /// LAYER construct  
        /// </summary>
        /// <param name="parentNode">is node in upper layer</param>   
        /// <param name="parentLayer">is layer whitch has parentNode</param> 
        public Layer(Node parentNode = null, Layer parentLayer = null)
        {
            if (parentNode != null)
            {
                this.id = parentNode.id;
                this.parentNode = parentNode;
            }

            this.parentLayer = parentLayer;
        }
Ejemplo n.º 2
0
        // LAYER HISTORY Buld laier history from
        public void BuildLayerHistory(int id)
        {
            layersHistory.Clear();

            this.currentLayer = this.diagram.layers.getLayer(id);

            Layer temp = this.currentLayer;
            while (temp != null)
            {
                layersHistory.Add(temp);
                temp = temp.parentLayer;
            }

            layersHistory.Reverse(0, layersHistory.Count());

            this.breadcrumbs.Update();
        }
Ejemplo n.º 3
0
        public Layer createLayer(Node parent = null)
        {
            Layer layer = getLayer((parent == null) ? 0 : parent.id);

            // create new layer if not exist
            if (layer == null)
            {
                Layer parentLayer = null;

                if (parent != null)
                {
                    parentLayer = this.getLayer(parent.layer);
                }

                layer = new Layer(parent, parentLayer);
                this.layers.Add(layer);
            }

            return layer;
        }
Ejemplo n.º 4
0
        private string lastEvent = ""; // remember last event in console (for remove duplicate events)

        #endif

        #region Constructors

        /*************************************************************************************************************************/
        // FORM Constructor
        public DiagramView(Main main, Diagram diagram, DiagramView parentView = null)
        {
            this.main = main;
            this.diagram = diagram;
            this.parentView = parentView;

            // initialize layer history
            this.currentLayer = this.diagram.layers.getLayer(0);
            this.layersHistory.Add(this.currentLayer);

            this.InitializeComponent();

            // initialize popup menu
            this.PopupMenu = new Popup(this.components, this);

            // initialize edit panel
            this.editPanel = new EditPanel(this);
            this.Controls.Add(this.editPanel);

            // initialize edit link panel
            this.editLinkPanel = new EditLinkPanel(this);
            this.Controls.Add(this.editLinkPanel);

            // initialize breadcrumbs
            this.breadcrumbs = new Breadcrumbs(this);

            // move timer
            this.animationTimer.Tick += new EventHandler(animationTimer_Tick);
            this.animationTimer.Interval = 10;
            this.animationTimer.Enabled = false;

            // move timer
            this.zoomTimer.Tick += new EventHandler(zoomTimer_Tick);
            this.zoomTimer.Interval = 10;
            this.zoomTimer.Enabled = false;

            // lineWidthForm
            this.lineWidthForm.trackbarStateChanged += this.resizeLineWidth;

            //colorPickerForm
            this.colorPickerForm.changeColor += this.changeColor;

            // custom diagram icon
            if (this.diagram.options.icon != "")
            {
                this.Icon = Media.StringToIcon(this.diagram.options.icon);
            }
        }
Ejemplo n.º 5
0
        // LAYER OUT
        public void LayerOut()
        {
            if (this.currentLayer.parentLayer != null) { //this layer is not top layer

                this.currentLayer.parentNode.layerShift.set(this.shift);

                if (this.currentLayer.nodes.Count() == 0) {
                    this.currentLayer.parentNode.haslayer = false;
                }

                this.currentLayer = this.currentLayer.parentLayer;

                layersHistory.RemoveAt(layersHistory.Count() - 1);

                if (this.currentLayer.parentNode == null)
                {
                    this.shift.set(this.firstLayereShift);
                }
                else
                {
                    this.shift.set(this.currentLayer.parentNode.layerShift);
                }

                this.SetTitle();
                this.breadcrumbs.Update();
                this.diagram.InvalidateDiagram();
            }
        }
Ejemplo n.º 6
0
        /*************************************************************************************************************************/
        // LAYER IN                                                                                    // [LAYER]
        public void LayerIn(Node node)
        {
            if (this.currentLayer.parentNode == null)
            {
                this.firstLayereShift.set(shift);
            }
            else
            {
                this.currentLayer.parentNode.layerShift.set(this.shift);
            }

            this.currentLayer = this.diagram.layers.createLayer(node);
            this.currentLayer.parentNode.haslayer = true;
            this.layersHistory.Add(this.currentLayer);
            this.shift.set(this.currentLayer.parentNode.layerShift);

            this.SetTitle();
            this.breadcrumbs.Update();
            this.diagram.InvalidateDiagram();
        }
Ejemplo n.º 7
0
 // NODE Go to node layer
 public void goToLayer(int layer = 0)
 {
     this.currentLayer = this.diagram.layers.getLayer(layer);
     this.BuildLayerHistory(layer);
 }
Ejemplo n.º 8
0
 /*************************************************************************************************************************/
 // VIEW
 // open new view on diagram
 public DiagramView openDiagramView(DiagramView parent = null, Layer layer = null)
 {
     DiagramView diagramview = new DiagramView(main, this, parent);
     diagramview.setDiagram(this);
     this.DiagramViews.Add(diagramview);
     main.addDiagramView(diagramview);
     this.SetTitle();
     diagramview.Show();
     if (layer != null)
     {
         diagramview.goToLayer(layer.id);
     }
     return diagramview;
 }