Exemple #1
0
        // Methods
        public ArrowSelector()
        {
            this.endArrow = false;
            try
            {
                base.Items.Add("нч");
                SvgDocument fadde1=new SvgDocument();
                string filename = Path.GetDirectoryName(Assembly.GetAssembly(base.GetType()).Location)+"\\symbol\\arrow.xml";
                if (File.Exists(filename)) {
                    fadde1 = SvgDocumentFactory.CreateDocumentFromFile(filename);
                } else {
                    ResourceManager manager1 = new ResourceManager(base.GetType());
                    fadde1.LoadXml(manager1.GetString("arrow"));
                }
                XmlNodeList list1 = fadde1.GetElementsByTagName("marker");
                for (int num1 = 0; num1 < list1.Count; num1++)
                {
                    XmlElement element1 = list1[num1] as XmlElement;
                    if (element1 != null)
                    {
                        base.Items.Add(new Arrow((SvgElement)element1));
                    }
                }

            }
            catch (Exception exception1)
            {
                Console.Write(exception1.Message);
            }
            this.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
            base.BorderStyle = BorderStyle.None;
            this.ItemHeight = 16;
        }
Exemple #2
0
 internal Layer(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     canSelect=true;
     islock=false;
     graphList =new SvgElementCollection();
 }
Exemple #3
0
 // Methods
 internal Marker(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     markerTransForm = new Matrix();
     brush = new SolidColor(Color.Black);
     stroke = new Stroke();
 }
 // Methods
 public SerializeDocument(SvgDocument doc)
 {
     this.svgDocument = null;
     this.flowChilds = new SvgElementCollection();
     this.filterType = typeof(SvgElement);
     this.svgDocument = doc;
 }
Exemple #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            Button button1 = sender as Button;

            ItopVector.Core.Document.SvgDocument doc = this.document;
            string filepath = string.Empty;

            if (doc == null)
            {
                filepath = Application.StartupPath + @"\symbol\symbol.xml";
                if (!File.Exists(filepath))
                {
                    filepath = string.Empty;
                    OpenFileDialog opendlg = new OpenFileDialog();
                    opendlg.Filter = "xml文件(*.xml)|*.xml";
                    if (opendlg.ShowDialog(this) == DialogResult.OK)
                    {
                        filepath = opendlg.FileName;
                    }
                }
                if (File.Exists(filepath))
                {
                    try
                    {
                        doc = ItopVector.Selector.SymbolGroup.LoadSymbol(filepath);
                    }
                    catch (Exception err)
                    {
                        MessageBox.Show(err.Message);
                    }
                }
            }
            if (doc != null)
            {
                XmlNode node = doc.SelectSingleNode("//*[@id='" + this.curElement.ID + "']");

                if (node != null)
                {
                    MessageBox.Show("已存在名为'" + this.curElement.ID + "'组或图元!", "增加图元");
                    return;
                }

                SymbolGroupDialog dlg = new SymbolGroupDialog();
                dlg.SymbolDoc       = doc;
                dlg.ToInsertElement = this.curElement;
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    if (this.symbolSelector != null)
                    {
                        this.symbolSelector.AddSymbol(this.curElement as Symbol, dlg.SelectedElement.GetAttribute("id"));
                    }
                    else
                    {
                        dlg.SelectedElement.AppendChild(this.document.ImportNode(this.curElement, true));
                    }
                    doc.Save(doc.FilePath);
//					MessageBox.Show("保存成功,需要重新启动程序才有效。");
                }
            }
        }
Exemple #6
0
 // Methods
 internal LinearGradient(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.x1 = 0f;
     this.y1 = 0f;
     this.x2 = 1f;
     this.y2 = 0f;
     this.gradientTransform = new Transf();
     this.gradientUnit = Units.ObjectBoundingBox;
     this.spreadMethod = SpreadMethods.Pad;
     this.boundsPath = new GraphicsPath();
     this.boundrect = RectangleF.Empty;
     this.stops = new SvgElementCollection();
     this.gradientstart = PointF.Empty;
     this.gradientend = PointF.Empty;
     this.rotatepoint = PointF.Empty;
     this.translatepoint = PointF.Empty;
     this.scalePoint = PointF.Empty;
     this.boundsPoints = new PointF[0];
     this.ratiomatrix = new Matrix();
     this.brush = null;
     this.coord = new Matrix();
     this.gradientpath = new GraphicsPath();
     this.pen = null;
     this.GraphMatrix = new Matrix();
 }
 public static SvgDocument CreateDocumentFromFile(string filename)
 {
     Stream stream1 = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
     SvgDocument document1 = new SvgDocument();
     XmlTextReader reader1 = new XmlTextReader(stream1, XmlNodeType.Document, document1.XmlParserContext);
     try
     {
         reader1.XmlResolver = null;
         document1.PreserveWhitespace = true;
         document1.XmlResolver = null;
         document1.FilePath = filename;
         document1.Load(reader1);
         //document1.DealLast();
         reader1.Close();
         stream1.Close();
         document1.FileName = Path.GetFileNameWithoutExtension(filename);
         document1.Update = true;
         return document1;
     }
     catch (Exception exception1)
     {
         reader1.Close();
         stream1.Close();
         MessageBox.Show("���Ϸ��ĵ���" + exception1.Message);
     }
     return null;
 }
Exemple #8
0
 public static XmlNode GetRefNode(string refid, SvgDocument doc)
 {
     refid = refid.Trim();
     while (refid.EndsWith(";"))
     {
         refid = refid.Substring(0, refid.Length - 1);
     }
     string text1 = refid;
     if (text1.Trim().StartsWith("url"))
     {
         int num1 = text1.Trim().IndexOf("#", 0, text1.Trim().Length);
         int num2 = text1.Trim().IndexOf(")", 0, text1.Trim().Length);
         text1 = text1.Trim().Substring(num1 + 1, (num2 - num1) - 1);
     }
     if (text1.Trim().StartsWith("#"))
     {
         text1 = text1.Trim().Substring(1, text1.Trim().Length - 1);
     }
     string text2 = "//*[@id='" + text1 + "']";
     bool flag1 = doc.AcceptChanges;
     doc.AcceptChanges = false;
     XmlNode node1 = doc.SelectSingleNode(text2);
     doc.AcceptChanges = flag1;
     return node1;
 }
Exemple #9
0
        public static SvgDocument LoadSymbol(string filename)
        {
            SvgDocument fadde2;
            if (!File.Exists(filename))
            {
                return null;
            }
            SvgDocument doc = new SvgDocument();

            try
            {
                doc.XmlResolver = null;
                doc.Load(filename);
                doc.AcceptChanges=false;
                doc.FilePath = filename;
                fadde2 = doc;
            }
            catch (Exception exception1)
            {
                Console.Write(exception1.Message);
                fadde2 = null;
            }

            return fadde2;
        }
Exemple #10
0
 // Methods
 public ListViewEx()
 {
     this.endArrow = false;
     try
     {
         base.Items.Add("нч");
         SvgDocument fadde1=new SvgDocument();
         ResourceManager manager1 = new ResourceManager(base.GetType());
         string text1 = manager1.GetString("arrow");
         fadde1.LoadXml(text1);
         XmlNodeList list1 = fadde1.GetElementsByTagName("marker");
         for (int num1 = 0; num1 < list1.Count; num1++)
         {
             XmlElement element1 = list1[num1] as XmlElement;
             if (element1 != null)
             {
     //						base.Items.Add(new Arrow((SvgElement)element1));
             }
         }
         text1 = null;
     }
     catch (Exception exception1)
     {
         Console.Write(exception1.Message);
     }
     this.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
     base.BorderStyle = BorderStyle.None;
     //			this.ItemHeight = 16;
 }
Exemple #11
0
 public ItopVectorControl()
 {
     //int num1;
     this.components = null;
     this.pageSetting=new PageSettings();
     this.svgDocument = new SvgDocument();
     this.mainIcon = null;
     this.roots = new Hashtable(0x10);
     this.unnamed = string.Empty;
     this.InitializeComponent();
     this.mainIcon = this.GetIconFromResource(base.GetType(), "ItopVector.ItopVectorControl.Resource.main.ico");
     this.CreateMenu();
     this.drawArea1.OperationChanged += new EventHandler(this.ChangeOperation);
     this.drawArea1.ScaleChanged += new EventHandler(this.ChangeScale);
     this.drawArea1.OnTrackPopup += new TrackPopupEventHandler(this.TrackPopup);
     this.drawArea1.OnTipEvent += new OnTipEventHandler(this.ToolTip);
     this.drawArea1.PostBrushEvent += new PostBrushEventHandler(this.PostBrush);
     this.drawArea1.LeftClick +=new SvgElementEventHandler(drawArea1_LeftClick);
     this.drawArea1.DoubleLeftClick+=new SvgElementEventHandler(drawArea1_DoubleLeftClick);
     this.drawArea1.RightClick+=new SvgElementEventHandler(drawArea1_RightClick);
     this.drawArea1.MoveOver+=new SvgElementEventHandler(drawArea1_MoveOver);
     this.drawArea1.MoveIn+=new SvgElementEventHandler(drawArea1_MoveIn);
     this.drawArea1.MoveOut+=new SvgElementEventHandler(drawArea1_MoveOut);
     this.drawArea1.DragAndDrop+=new DragEventHandler(drawArea1_DragDrop);
     this.drawArea1.PaintMap+=new PaintMapEventHandler(drawArea1_PaintMap);
     this.drawArea1.AfterPaintPage+=new PaintMapEventHandler(drawArea1_AfterPaintPage);
     this.Disposed+=new EventHandler(DocumentControl_Disposed);
     this.UpdateProperty();
     this.unnamed = ItopVector.Resource.LayoutManager.GetLabelForName("unnamedelement").Trim();
     this.drawArea1.OnMouseUp += new MouseEventHandler(drawArea1_OnMouseUp);
 }
Exemple #12
0
 public LayerManagerDialog()
 {
     //SelectedElement= null;
     symbolDoc = null;
     nodeTable = new Hashtable();
     InitializeComponent();
 }
Exemple #13
0
 // Methods
 internal MotionAnimate(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.pointsinfo = new PointInfoCollection();
     this.Rotate = "auto";
     this.CenterPoint = PointF.Empty;
     this.OriMatrix = new Matrix();
 }
Exemple #14
0
 // Methods
 internal Image(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.refImage = null;
     this.imageurl = string.Empty;
     this.opacity = 1f;
     this.imageAttributes = null;
     this.transparent = Color.Empty;
 }
Exemple #15
0
 // Methods
 internal ClipPath(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.gp = null;
     this.cliprule = null;
     this.showClip = true;
     this.graphPath = new GraphicsPath();
     this.RefMatrix = new Matrix();
 }
Exemple #16
0
 internal ConnectLine(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.startGraph=null;
     this.endGraph=null;
     this.strEndGraph=string.Empty;
     this.strStartGraph=string.Empty;
     this.type=Enums.ConnectType.none;
     this.linepoints=new PointF[0];
 }
Exemple #17
0
 // Methods
 internal Animate(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.values = new ArrayList();
     this.keyTimes = new ArrayList();
     this.realdur = 0f;
     this.Additive = Additive.replace;
     this.Accumulate = Accumulate.none;
     this.Speed = 10;
 }
Exemple #18
0
 // Methods
 internal Use(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.x = 0f;
     this.y = 0f;
     this.width = 0f;
     this.height = 0f;
     this.graphId = null;
     this.refelement = null;
 }
Exemple #19
0
 // Methods
 internal Pattern(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.graphList = new SvgElementCollection();
     this.viewBox = null;
     this.boundsPoints = new PointF[0];
     this.ratiomatrix = new Matrix();
     this.coord = new Matrix();
     this.graidentPath = new GraphicsPath();
     this.pen = null;
 }
Exemple #20
0
 // Methods
 internal GraphPath(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.graphPath = new GraphicsPath();
     this.graphStroke = new Stroke();
     this.graphBrush = new SolidColor(Color.Empty);
     this.animpath = new GraphicsPath();
     //			this.startPoint = PointF.Empty;
     this.updateAttribute = true;
     this.graphStroke.OnStrokeBrushChanged += new EventHandler(this.ChangeStrokeBrush);
 }
 // Methods
 internal RectangleElement(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.x = 0f;
     this.y = 0f;
     this.width = 0f;
     this.height = 0f;
     this.rx = 0f;
     this.ry = 0f;
     //			this.nullrx = false;
     //			this.nullry = false;
     this.Angle = 0;
 }
Exemple #22
0
 // Methods
 internal RadialGradients(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.cx = 0.5f;
     this.cy = 0.5f;
     this.r = 0.5f;
     this.gradientpath = new GraphicsPath();
     this.gradientTransform = new Transf();
     this.bounds = RectangleF.Empty;
     this.gradientUnit = Units.ObjectBoundingBox;
     this.spreadMethod = SpreadMethods.Pad;
     this.stops = new SvgElementCollection();
     this.boundsPoints = new PointF[0];
     this.coord = new Matrix();
     this.pen = null;
 }
Exemple #23
0
 public static bool AddEvent(SvgDocument doc, string eventname)
 {
     int num1 = CodeFunc.GetIndexOfString(doc.OuterXml, "function", eventname);
     if (num1 >= 0)
     {
         return false;
     }
     XmlNode node1 = doc.DocumentElement.SelectSingleNode("*[name()='script']");
     XmlElement element1 = doc.CreateElement(doc.Prefix, "script", doc.NamespaceURI);
     if (node1 is XmlElement)
     {
         element1 = (XmlElement) node1;
     }
     element1.SetAttribute("type", doc.NamespaceURI, "text/ecmascript");
     string text1 = string.Empty + "\n\tfunction " + eventname + "\n\t{\n\t\t\n\t}\n\t";
     XmlNode node2 = element1.FirstChild;
     XmlCDataSection section1 = null;
     Label_0092:
     if (node2 is XmlCDataSection)
     {
         section1 = (XmlCDataSection) node2;
     }
     else if (node2 != null)
     {
         node2 = node2.NextSibling;
         goto Label_0092;
     }
     if (section1 == null)
     {
         section1 = doc.CreateCDataSection(text1);
         element1.AppendChild(doc.CreateWhitespace("\n\t"));
         element1.AppendChild(section1);
         element1.AppendChild(doc.CreateWhitespace("\n\t"));
     }
     else
     {
         XmlNode node3 = section1.LastChild;
         section1.Value = section1.Value + text1;
     }
     if (element1.ParentNode == null)
     {
         doc.DocumentElement.PrependChild(element1);
     }
     return true;
 }
Exemple #24
0
 // Methods
 internal AudioAnimate(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.m_objFilterGraph = null;
     this.m_objBasicAudio = null;
     this.m_objMediaEvent = null;
     this.m_objMediaEventEx = null;
     this.m_objMediaPosition = null;
     this.m_objMediaControl = null;
     this.fillColor = Color.Khaki;
     this.fileName = string.Empty;
     this.m_CurrentStatus = MediaStatus.None;
     this.timer = new Timer();
     this.oldtime = 0f;
     this.timertime = 0f;
     this.timer.Interval = 100;
     this.timer.Tick += new EventHandler(this.TimerTick);
 }
 public static SvgDocument CreateDocument(SizeF size)
 {
     SvgDocument document1 = new SvgDocument();
     string[] textArray1 = new string[9];
     textArray1[0] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
     //            textArray1[1] = "\n<!--"+ItopVector.Core.Config.Config.GetLabelForName("createdstr")+"-->";
     textArray1[2] = "\n<svg id=\"svg\" width=\"";
     int num1 = (int) size.Width;
     textArray1[3] = num1.ToString();
     textArray1[4] = "\" height=\"";
     int num2 = (int) size.Height;
     textArray1[5] = num2.ToString();
     textArray1[6] = "\" xmlns:xlink=\""+SvgDocument.XLinkNamespace;
     textArray1[7] = "\" xmlns:tonli=\""+SvgDocument.TonliNamespace;
     textArray1[8] = "\" >\n</svg>";//xml:space=\"preserve\"
     string text1 = string.Concat(textArray1);
     document1.PreserveWhitespace = true;
     document1.LoadXml(text1);
     return document1;
 }
Exemple #26
0
        public static string CreateString(SvgDocument doc, string key)
        {
            //            int num1 = 0;
            Regex regex1 = new Regex("[A-Za-z]*");
            Match match1 = regex1.Match(key);
            if (match1.Success)
            {
                key = match1.Groups[0].Value;
            }
            while (true)
            {
            //				num1=random.Next(0,99999);
                string text1 = key + Guid.NewGuid().ToString().Substring(24);

            //				if (NodeFunc.GetRefNode(text1, doc) == null)
                {
                    return text1;
                }
            }
        }
Exemple #27
0
 // Methods
 internal Text(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.fontName = "Arial";
     this.size = 10f;
     this.x = 0f;
     this.y = 0f;
     this.dx = 0f;
     this.dy = 0f;
     this.textLength = 0f;
     this.rotate = 0f;
     this.currentPostion = PointF.Empty;
     this.doalign = true;
     this.editMode = false;
     this.chars = new ArrayList(0x10);
     this.old = false;
     //			this.oldPath = null;
     this.graphPath = new GraphicsPath();
     this.textString=string.Empty;
     this.lines =new string[0];
 }
Exemple #28
0
 // Methods
 public UnDoOperation(SvgDocument doc, XmlNode changeelement, XmlNode oldparent, XmlNode newparent, XmlNodeChangedAction action, SvgElement changeparent)
 {
     this.oldvalue = string.Empty;
     this.newvalue = string.Empty;
     this.changeParent = changeparent;
     this.document = doc;
     this.changeAction = action;
     this.oldParent = oldparent;
     this.newParent = newparent;
     this.changeElement = changeelement;
     this.nextSibling = this.changeElement.NextSibling;
     this.preSibling = this.changeElement.PreviousSibling;
     if (this.changeElement is SvgElement)
     {
         while (this.nextSibling != null)
         {
             if (this.nextSibling is SvgElement)
             {
                 break;
             }
             this.nextSibling = this.nextSibling.NextSibling;
         }
         while (this.preSibling != null)
         {
             if (this.preSibling is SvgElement)
             {
                 break;
             }
             this.preSibling = this.preSibling.PreviousSibling;
         }
     }
     if (this.changeElement != null)
     {
         this.newvalue = this.changeElement.Value;
     }
     if (this.changeParent != null)
     {
         this.oldvalue = this.changeParent.BeforeChangeValueStr;
     }
 }
Exemple #29
0
 // Methods
 public Viewer()
 {
     this.components = null;
     this.svgDocument = null;
     this.onlyDrawCurrent = false;
     this.margin = new SizeF(500f, 500f);
     this.virtualTop = 0f;
     this.virtualLeft = 0f;
     this.scale = 1f;
     this.selectpath = new GraphicsPath();
     this.selectMatrix = new Matrix();
     this.elementList = new SvgElementCollection();
     this.selectChanged = false;
     this.changeelements = new SvgElementCollection();
     this.drawArea = null;
     this.oldselectPoint = PointF.Empty;
     this.Bouns = new PointF[8];
     this.InitializeComponent();
     //            base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint), true);
     base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | (ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint)), true);
     //			this.BackColor = Color.Red;
 }
Exemple #30
0
 // Methods
 internal Graph(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     //			this.transform = new Transf();
     this.visible = true;
     this.showBound = false;
     this.graphTransform = new Transf();
     this.tempOpacity = 1f;
     this.tempFillOpacity = 1f;
     this.tempStrokeOpacity = 1f;
     this.boundColor = Color.Empty;
     this.isLock = false;
     this.drawVisible = true;
     this.pointsinfo = new PointInfoCollection();
     this.pointsinfo.OwerGraph = this;
     this.IsClip = false;
     this.Changed = true;
     this.connectPoints = new PointF[0];
     this.connectLines = new SvgElementCollection();
     this.canSelect=true;
     this.limitSize =false;
 }
Exemple #31
0
 // Methods
 internal SvgElement(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.timeLineVisible = true;
     KeyInfo[] infoArray1 = new KeyInfo[1] { new KeyInfo(0, 0) } ;
     this.infoList = new ArrayList(infoArray1);
     this.showParticular = false;
     this.inKey = false;
     this.animatelist = new SvgElementCollection();
     this.svgAttributes = new Hashtable(0x10);
     this.svgAnimAttributes = new Hashtable(0x10);
     this.svgStyleAttributes = new Hashtable(0x10);
     this.beforeChangeValueStr = string.Empty;
     this.showchild = true;
     this.pretime = -1;
     this.AnimateNameValues = new Hashtable(0x10);
     this.AttributePos = new Hashtable();
     this.FormatOutXml = true;
     this.UseElement = null;
     this.CreateParse = true;
     this.ownerDocument = doc;
     this.FormatElement = false;
     this.AllowRename = true;
 }
Exemple #32
0
 // Methods
 internal Group(string prefix, string localname, string ns, SvgDocument doc)
     : base(prefix, localname, ns, doc)
 {
     this.graphList = new SvgElementCollection();
     this.graphPath = new GraphicsPath();
     this.graphTransform = new Transf();
     this.graphBrush = new SolidColor(Color.Empty);
     this.graphStroke = new Stroke();
     this.connectPoints = new PointF[0];
     this.visible = true;
     this.showBound = false;
     this.tempOpacity = 1f;
     this.tempFillOpacity = 1f;
     this.tempStrokeOpacity = 1f;
     this.boundColor = Color.Empty;
     this.isLock = false;
     this.drawVisible = true;
     this.updateattribute = true;
     this.Changed = true;
     this.connectLines = new ItopVector.Core.SvgElementCollection();
     this.graphStroke.OnStrokeBrushChanged += new EventHandler(this.ChangeStrokeBrush);
     canSelect=true;
     this.limitSize =false;
 }
Exemple #33
0
 public frmLayerManagerYear(SvgDocument symbold, string prog)
 {
     symbolDoc = symbold;
     progtype  = prog;
     InitializeComponent();
 }