Exemple #1
0
        public void SetDrawShape(ShapeElement select)
        {
            switch (select)
            {
            case ShapeElement.SVG_GroupPanelHeadShape:
            {
                SVG_GroupPanelHeadShape shapeModel = new SVG_GroupPanelHeadShape
                {
                    SaveToTemplate = (template, filepath) => FlowManager.Mediator.ShapeForm.LoadTemplate()
                };
                this.graphControl.selector = new CommonSelector(this.graphControl, shapeModel);
                return;
            }

            case ShapeElement.SVG_GroupPanelTextShape:
            {
                SVG_GroupPanelTextShape shapeModel = new SVG_GroupPanelTextShape
                {
                    SaveToTemplate = (template, filepath) => FlowManager.Mediator.ShapeForm.LoadTemplate()
                };
                this.graphControl.selector = new CommonSelector(this.graphControl, shapeModel);
                return;
            }

            case ShapeElement.SVG_TabPanelShape:
            {
                SVG_TabPanelShape shapeModel = new SVG_TabPanelShape
                {
                    SaveToTemplate = (template, filepath) => FlowManager.Mediator.ShapeForm.LoadTemplate()
                };
                this.graphControl.selector = new CommonSelector(this.graphControl, shapeModel);
                return;
            }

            case ShapeElement.SVG_GeneralShape:
            {
                SVG_GeneralShape shapeModel = new SVG_GeneralShape
                {
                    SaveToTemplate = (template, filepath) => FlowManager.Mediator.ShapeForm.LoadTemplate()
                };
                this.graphControl.selector = new CommonSelector(this.graphControl, shapeModel);
                return;
            }
            }
            this.graphControl.SetDrawShape(select);
        }
Exemple #2
0
 private void GetTemplateShape(Shape shape, List <Shape> shapes)
 {
     if (shape.GetType().BaseType == typeof(SVGContainer))
     {
         SVGContainer container = (SVGContainer)shape;
         for (int c = container.Shapes.Count - 1; c >= 0; c--)
         {
             Shape existShape = shapes.Find(x => x.UID == container.Shapes[c].UID);
             if (existShape != null)
             {
                 container.Shapes[c].Shape = existShape;
                 if (container.Shapes[c].Shape != null)
                 {
                     container.Shapes[c].ChangedUid();
                     container.Shapes[c].Shape.Name = "Element" + container.Shapes[c].UID;
                     GetTemplateShape(container.Shapes[c].Shape, shapes);
                 }
                 else
                 {
                     container.Shapes.RemoveAt(c);
                 }
             }
         }
     }
     else if (shape.GetType() == typeof(SVG_TabPanelShape))//tab页面
     {
         SVG_TabPanelShape container = (SVG_TabPanelShape)shape;
         for (int c = 0; c < container.TabPages.Count; c++)
         {
             for (int s = container.TabPages[c].Shapes.Count - 1; s >= 0; s--)
             {
                 Shape existShape = shapes.Find(x => x.UID == container.TabPages[c].Shapes[s].UID);
                 if (existShape != null)
                 {
                     container.TabPages[c].Shapes[s].Shape = existShape;
                     if (container.TabPages[c].Shapes[s].Shape != null)
                     {
                         container.TabPages[c].Shapes[s].ChangedUid();
                         container.TabPages[c].Shapes[s].Shape.Name = "Element" + container.TabPages[c].Shapes[s].UID;
                         GetTemplateShape(container.TabPages[c].Shapes[s].Shape, shapes);
                     }
                 }
                 else
                 {
                     container.TabPages[c].Shapes.RemoveAt(s);
                 }
             }
         }
     }
     else if (shape.GetType() == typeof(Combination))//组合体
     {
         Combination container = (Combination)shape;
         for (int c = container.Shapes.Count - 1; c >= 0; c--)
         {
             Shape existShape = shapes.Find(x => x.UID == container.Shapes[c]);
             if (existShape != null)
             {
                 existShape.UID      = "ID" + GUIDTo16.GuidToLongID().ToString();
                 existShape.Name     = "Element" + existShape.UID;
                 container.Shapes[c] = existShape.UID;
                 GetTemplateShape(existShape, shapes);
             }
             else
             {
                 container.Shapes.RemoveAt(c);
             }
         }
     }
 }