Ejemplo n.º 1
0
 public void AddConnectLine(ConnectLine connectelement)
 {
     if (!this.connectLines.Contains(connectelement))
     {
         this.connectLines.Add(connectelement);
     }
 }
Ejemplo n.º 2
0
 private void InitData(SvgDocument svgDocument)
 {
     if (svgDocument != null)
     {
         this.document = svgDocument;
         base.selectorGroups.Clear();
         base.currentGroup = null;
         XmlNodeList list1 = svgDocument.GetElementsByTagName("group");
         for (int num1 = 0; num1 < list1.Count; num1++)
         {
             XmlElement element1 = list1[num1] as XmlElement;
             string     text1    = element1.GetAttribute("enabled").Trim().ToLower();
             if ((element1 != null) && (text1 != "false"))
             {
                 OutlookBarItemCollection items = new OutlookBarItemCollection();
                 items.Id = element1.GetAttribute("id");
                 base.selectorGroups.Add(items);
                 XmlNodeList list2 = element1.GetElementsByTagName("symbol");
                 if (list2.Count == 0)
                 {
                     list2 = element1.GetElementsByTagName("connectline", SvgDocument.TonliNamespace);
                 }
                 for (int num2 = 0; num2 < list2.Count; num2++)
                 {
                     ItopVector.Core.Figure.Symbol fdbdec1 = list2[num2] as ItopVector.Core.Figure.Symbol;
                     if (fdbdec1 != null)
                     {
                         if (!fdbdec1.Visible)
                         {
                             //fdbdec1.Attributes.RemoveNamedItem("visibility");
                             continue;
                         }
                         items.Add(new ItopVector.Selector.Symbol(fdbdec1));
                         continue;
                     }
                     ItopVector.Core.Figure.ConnectLine fdbdec2 = list2[num2] as ItopVector.Core.Figure.ConnectLine;
                     if (fdbdec2 != null)
                     {
                         items.Add(new ItopVector.Selector.ConnectShape(fdbdec2));
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 在2个元件之间添加连接线
        /// </summary>
        /// <param name="e1"></param>
        /// <param name="e2"></param>
        /// <param name="sampleCL"></param>
        private void AddConnectline(SvgElement e1, SvgElement e2, ConnectLine sampleCL)
        {
            if (e1 == null || e2 == null)
            {
                return;
            }

            ConnectLine newConnectLine = xltDocument.CreateElement("connectline") as ConnectLine;
            newConnectLine.SetAttribute("type", "line");
            newConnectLine.IsLock = false;
            newConnectLine.SetAttribute("layer", SvgDocument.currentLayer);
            newConnectLine.SetAttribute("devguid1", e1.GetAttribute(NodeGuidTag));
            newConnectLine.SetAttribute("devguid2", e2.GetAttribute(NodeGuidTag));
            newConnectLine.SetAttribute(NodeXLDMTag, e2.GetAttribute(NodeXLDMTag));
            //AttributeFunc.SetAttributeValue(newConnectLine, "start", "#" + e1.ID + ".4");
            //AttributeFunc.SetAttributeValue(newConnectLine, "end", "#" + e2.ID + ".4");
            newConnectLine.StartGraph = e1 as IGraph;
            newConnectLine.EndGraph = e2 as IGraph;

            ConnectLine cl = GetConnectLine(e1, false);
            if (cl != null && (!cl.Visible || cl.GetAttribute(ConnectionTag) == "0"))
            {
                newConnectLine.SetAttribute(ConnectionTag, "0");
            }

            if (sampleCL != null)
            {

            }

            (xltDocument.RootElement.AppendChild(newConnectLine) as ConnectLine).CanSelect = true;
        }
Ejemplo n.º 4
0
        private double XX(SvgElement e1, SvgElement e2, ConnectLine cl)
        {
            IGraph gh1 = e1 as IGraph;
            foreach (ConnectLine connectLine in gh1.ConnectLines)
            {
                if (cl == connectLine)
                {
                    continue;
                }

                SvgElement e = null;
                if (connectLine.StartGraph == gh1)
                {
                    e = connectLine.EndGraph as SvgElement;
                }
                else if (connectLine.EndGraph == gh1)
                {
                    e = connectLine.StartGraph as SvgElement;
                }

                if (e != null && e != e1 && nodeSymbolIDList.IndexOf(GetElementDevType(e).ToString()) > -1)
                {
                    if (e == e2)
                    {
                        IGraph gh2 = e2 as IGraph;
                        if (mapView == null)
                        {
                            return 0;
                        }
                        else
                        {
                            return mapView.CountLength(gh1.CenterPoint, gh2.CenterPoint);
                        }
                    }
                    else
                    {
                        double d = XX(e, e2, connectLine);
                        if (d >= 0)
                        {
                            IGraph gh = e as IGraph;

                            if (mapView == null)
                            {
                                return 0;
                            }
                            else
                            {
                                return mapView.CountLength(gh1.CenterPoint, gh.CenterPoint) + d;
                            }
                        }
                    }
                }
            }

            return -1;
        }
Ejemplo n.º 5
0
 public void AddConnectLine(ConnectLine connectelement)
 {
     if (!this.connectLines.Contains(connectelement))
     {
         this.connectLines.Add(connectelement);
     }
 }
Ejemplo n.º 6
0
        public override XmlElement CreateElement(string prefix, string localName, string ns)
        {
            XmlElement element1;
            if (this.firstload)
            {
            //				SvgElement element2 = null;
                if (this.preelement != null)
                {
                    //                    if (this.preelement.ParentNode == null)
                    //                    {
                    //                        if (this.groups.Count > 0)
                    //                        {
                    //                            element2 = (SvgElement) this.groups[this.groups.Count - 1];
                    //                            if ((element2 is ContainerElement) && ((ContainerElement) element2).IsValidChild(this.preelement))
                    //                            {
                    //                                ((ContainerElement) element2).ChildList.Add(this.preelement);
                    //                            }
                    //                        }
                    //                        this.groups.Add(this.preelement);
                    //                    }
                    //                    else if (this.groups.Count > 0)
                    //                    {
                    //						if(this.preelement.ParentNode is ContainerElement && ((ContainerElement) this.preelement.ParentNode).IsValidChild(this.preelement))
                    //						{
                    //							((ContainerElement)this.preelement.ParentNode).ChildList.Add(this.preelement);
                    //						}
                    //
                    //                    }
                }
            }
            switch (localName)
            {
                case "clipPath":
                {
                    element1 = new ClipPath(prefix, localName, ns, this);
                    break;
                }
                case "rect":
                {
                    element1 = new RectangleElement(prefix, localName, ns, this);
                    break;
                }
                case "path":
                {
                    element1 = new GraphPath(prefix, localName, ns, this);
                    break;
                }
                case "polyline":
                {
                    element1 = new Polyline(prefix, localName, ns, this);
                    break;
                }
                case "polygon":
                {
                    element1 = new Polygon(prefix, localName, ns, this);
                    break;
                }
                case "circle":
                {
                    element1 = new Circle(prefix, localName, ns, this);
                    break;
                }
                case "ellipse":
                {
                    element1 = new Ellips(prefix, localName, ns, this);
                    break;
                }
                case "script":
                {
                    element1 = new SvgScript(prefix, localName, ns, this);
                    break;
                }
                case "line":
                {
                    element1 = new Line(prefix, localName, ns, this);
                    break;
                }
                case "connectline":
                case "connect":
                {
                    element1 = new ConnectLine(prefix, localName, ns, this);
                    break;
                }
                case "g":
                {
                    element1 = new Group(prefix, localName, ns, this);
                    break;
                }
                case "svg":
                {
                    element1 = new SVG(prefix, localName, ns, this);
                    break;
                }
                case "text":
                {
                    element1 = new Text(prefix, localName, ns, this);
                    break;
                }
                case "tspan":
                {
                    element1 = new TSpan(prefix, localName, ns, this);
                    break;
                }
                case "tref":
                {
                    element1 = new TRef(prefix, localName, ns, this);
                    break;
                }
                case "linearGradient":
                {
                    element1 = new LinearGradient(prefix, localName, ns, this);
                    break;
                }
                case "radialGradient":
                {
                    element1 = new RadialGradients(prefix, localName, ns, this);
                    break;
                }
                case "stop":
                {
                    element1 = new GradientStop(prefix, localName, ns, this);
                    break;
                }
                case "symbol":
                {
                    element1 = new ItopVector.Core.Figure.Symbol(prefix, localName, ns, this);
                    break;
                }
                case "marker":
                {
                    element1 = new ItopVector.Core.Figure.Marker(prefix, localName, ns, this);
                    break;
                }
                case "defs":
                {
                    element1 = new ItopVector.Core.Figure.Defs(prefix, localName, ns, this);
                    break;
                }
                case "image":
                {
                    element1 = new ItopVector.Core.Figure.Image(prefix, localName, ns, this);
                    break;
                }
                case "a":
                {
                    element1 = new ItopVector.Core.Figure.Link(prefix, localName, ns, this);
                    break;
                }
                case "use":
                {
                    element1 = new ItopVector.Core.Figure.Use(prefix, localName, ns, this);
                    break;
                }
                case "animate":
                {
                    element1 = new ItopVector.Core.Animate.Animate(prefix, localName, ns, this);
                    break;
                }
                case "set":
                {
                    element1 = new SetAnimate(prefix, localName, ns, this);
                    break;
                }
                case "animateColor":
                {
                    element1 = new ColorAnimate(prefix, localName, ns, this);
                    break;
                }
                case "animateMotion":
                {
                    element1 = new MotionAnimate(prefix, localName, ns, this);
                    break;
                }
                case "animateTransform":
                {
                    element1 = new TransformAnimate(prefix, localName, ns, this);
                    break;
                }
                case "pattern":
                {
                    element1 = new Pattern(prefix, localName, ns, this);
                    break;
                }
                case "audio3d":
                case "audio":
                {
                    element1 = new AudioAnimate(prefix, localName, ns, this);
                    break;
                }
                case "state"://״̬
                {
                    element1 =new State(prefix, localName, ns, this);
                    break;
                }
                case "layer":
                {
                    element1 =new Layer(prefix, localName, ns, this);
                    break;
                }
                default:
                {
                    element1 = base.CreateElement(prefix, localName, ns);
                    break;
                }
            }
            if (element1 is SvgElement)
            {
                ((SvgElement) element1).ShowParticular = this.AutoShowAnim;
            }
            if ((element1 is SvgElement) && this.firstload)
            {
                this.preelement = (SvgElement) element1;
            }
            else
            {
                this.preelement = null;
            }
            if (this.xmlreader != null)
            {
                int num3 = this.xmlreader.LineNumber;
                int num4 = this.xmlreader.LinePosition;
            }
            //			if ((element1 is SVG) && (this.DocumentType == null))
            //			{
            //				XmlDocumentType type1 = this.CreateDocumentType("svg", "-/W3C/DTD SVG 1.1/EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", null);
            //				this.AppendChild(type1);
            //				this.AppendChild(this.CreateWhitespace("\r\n"));
            //			}

            return element1;
        }