Esempio n. 1
0
        public void Open(string _SvgUID)
        {
            try
            {
                //dotNetBarManager1.Bars["mainmenu"].GetItem("WJYHBut").Visible = false; //为版本用
                if (_SvgUID.Length < 20)
                {
                    JxtBar();
                    tlVectorControl1.ContextMenuStrip = null;
                }

                StringBuilder txt = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?><svg id=\"svg\" width=\"1500\" height=\"1000\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:itop=\"http://www.Itop.com/itop\" transform=\"matrix(1 0 0 1 0 1)\"><defs>");
                string svgdefs = "";
                string layertxt = "";
                StringBuilder content = new StringBuilder();

                if (string.IsNullOrEmpty(_SvgUID)) return;
                SVG_LAYER lar = new SVG_LAYER();
                lar.svgID = _SvgUID;
                lar.YearID = yearID;
                IList<SVG_LAYER> larlist = Services.BaseService.GetList<SVG_LAYER>("SelectSVG_LAYERByYearID", lar);
                foreach (SVG_LAYER _lar in larlist)
                {
                    layertxt = layertxt + "<layer id=\"" + _lar.SUID + "\" label=\"" + _lar.NAME + "\" layerType=\"" + _lar.layerType + "\" visibility=\"" + _lar.visibility + "\" ParentID=\"" + _lar.YearID + "\" IsSelect=\"" + _lar.IsSelect + "\" />";
                    content.Append(_lar.XML);
                }
                txt.Append(layertxt);

                SVG_SYMBOL sym = new SVG_SYMBOL();
                sym.svgID = _SvgUID;
                IList<SVG_SYMBOL> symlist = Services.BaseService.GetList<SVG_SYMBOL>("SelectSVG_SYMBOLBySvgID", sym);
                foreach (SVG_SYMBOL _sym in symlist)
                {
                    svgdefs = svgdefs + _sym.XML;
                }
                txt.Append(svgdefs + "</defs>");
                txt.Append(content.ToString() + "</svg>");
                SvgDocument document = new SvgDocument();
                document.LoadXml(txt.ToString());
                document.FileName = SvgName;
                document.SvgdataUid = _SvgUID;
                SVGUID = _SvgUID;

                this.Text = document.FileName;
                if (document.RootElement == null)
                {
                    tlVectorControl1.NewFile();
                    Layer.CreateNew("背景层", tlVectorControl1.SVGDocument);
                    Layer.CreateNew("城市规划层", tlVectorControl1.SVGDocument);
                    Layer.CreateNew("供电区域层", tlVectorControl1.SVGDocument);
                }
                else
                {
                    tlVectorControl1.SVGDocument = document;
                }
                tlVectorControl1.SVGDocument.SvgdataUid = SVGUID;
                tlVectorControl1.SVGDocument.FileName = this.Text;
                tlVectorControl1.DocumentbgColor = Color.White;
                tlVectorControl1.BackColor = Color.White;
                //tlVectorControl1.ForeColor = Color.White;
                CreateComboBox();
                xltProcessor = new XLTProcessor(tlVectorControl1);
                xltProcessor.MapView = mapview;
                xltProcessor.OnNewLine += new NewLineDelegate(xltProcessor_OnNewLine);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            //tlVectorControl1.SVGDocument.SvgdataUid = "";
        }
Esempio n. 2
0
        /*  public void Open(string _SvgUID)
           {
               try
               {

                   if (_SvgUID.Length < 20)
                   {
                       JxtBar();
                       tlVectorControl1.ContextMenuStrip = null;
                   }
                   SVGFILE svgFile = new SVGFILE();
                   svgFile.SUID = _SvgUID;
                   SvgDocument document = CtrlSvgView.CashSvgDocument;
                   if (document == null)
                   {
                       IList svgList = Services.BaseService.GetList("SelectSVGFILEByKey", svgFile);
                       if (svgList.Count > 0)
                       {
                           svgFile = (SVGFILE)svgList[0];
                       }

                       document = new SvgDocument();
                       if (!string.IsNullOrEmpty(svgFile.SVGDATA))
                       {
                           document.LoadXml(svgFile.SVGDATA);
                       }

                       document.FileName = svgFile.FILENAME;
                       document.SvgdataUid = svgFile.SUID;
                   }
                   SVGUID = document.SvgdataUid;

                   img = document.SelectSingleNode("//*[@TLGH=\"1\"]");
                   if (img != null)
                   {
                       ((XmlElement)img).SetAttribute("xlink:href", " ");
                   }
                   this.Text = document.FileName;
                   if (document.RootElement == null)
                   {
                       tlVectorControl1.NewFile();
                       Layer.CreateNew("背景层", tlVectorControl1.SVGDocument);
                       Layer.CreateNew("城市规划层", tlVectorControl1.SVGDocument);
                       Layer.CreateNew("供电区域层", tlVectorControl1.SVGDocument);
                   }
                   else
                   {
                       tlVectorControl1.SVGDocument = document;
                   }
                   tlVectorControl1.SVGDocument.SvgdataUid = SVGUID;
                   tlVectorControl1.SVGDocument.FileName = this.Text;
                   tlVectorControl1.DocumentbgColor = Color.White;
                   tlVectorControl1.BackColor = Color.White;
                   //tlVectorControl1.ForeColor = Color.White;
                   CreateComboBox();
                   xltProcessor = new XLTProcessor(tlVectorControl1);
                   xltProcessor.MapView = mapview;
                   xltProcessor.OnNewLine += new NewLineDelegate(xltProcessor_OnNewLine);
               }
               catch (Exception e)
               {
                   MessageBox.Show(e.Message);
               }
           }*/
        public void Open2(string _SvgUID)
        {
            StringBuilder txt = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\"?><svg id=\"svg\" width=\"1500\" height=\"1000\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:itop=\"http://www.Itop.com/itop\" transform=\"matrix(1 0 0 1 0 1)\"><defs>");
            string svgdefs = "";
            string layertxt = "";
            StringBuilder content = new StringBuilder();
            string where = "";
            if (string.IsNullOrEmpty(_SvgUID)) return;
            try {
                if (progtype == "城市规划层") {
                    where = " (layerType = '城市规划层') OR (layerType = '地理信息层') ";
                } else {
                    where = " (layerType = '地理信息层') ";
                }
                SVGFILE svgFile = new SVGFILE();
                svgFile.SUID = _SvgUID;
                svgFile = (SVGFILE)Services.BaseService.GetObject("SelectSVGFILEByKey", svgFile);
                //SvgDocument document = CashSvgDocument;
                //if (document == null) {
                SVG_LAYER lar = new SVG_LAYER();
                lar.svgID = _SvgUID;
                lar.YearID = where;
                IList<SVG_LAYER> larlist = Services.BaseService.GetList<SVG_LAYER>("SelectSVG_LAYERByWhere", lar);
                foreach (SVG_LAYER _lar in larlist) {
                    layertxt = layertxt + "<layer id=\"" + _lar.SUID + "\" label=\"" + _lar.NAME + "\" layerType=\"" + _lar.layerType + "\" visibility=\"" + _lar.visibility + "\" ParentID=\"" + _lar.YearID + "\" IsSelect=\"" + _lar.IsSelect + "\" />";
                    content.Append(_lar.XML);
                }
                txt.Append(layertxt);

                SVG_SYMBOL sym = new SVG_SYMBOL();
                sym.svgID = _SvgUID;
                IList<SVG_SYMBOL> symlist = Services.BaseService.GetList<SVG_SYMBOL>("SelectSVG_SYMBOLBySvgID", sym);
                foreach (SVG_SYMBOL _sym in symlist) {
                    svgdefs = svgdefs + _sym.XML;
                }

                txt.Append(svgdefs + "</defs>");
                txt.Append(content.ToString() + "</svg>");

                SvgDocument document = new SvgDocument();
                document.LoadXml(txt.ToString());
                document.FileName = SvgName;
                document.SvgdataUid = _SvgUID;
                SVGUID = _SvgUID;

                this.Text = document.FileName;
                if (document.RootElement == null) {
                    tlVectorControl1.NewFile();
                    Layer.CreateNew("背景层", tlVectorControl1.SVGDocument);
                    Layer.CreateNew("城市规划层", tlVectorControl1.SVGDocument);
                    Layer.CreateNew("供电区域层", tlVectorControl1.SVGDocument);
                } else {
                    tlVectorControl1.SVGDocument = document;
                }
                tlVectorControl1.SVGDocument.SvgdataUid = _SvgUID;
                tlVectorControl1.SVGDocument.FileName = this.Text;
                tlVectorControl1.DocumentbgColor = Color.White;
                tlVectorControl1.BackColor = Color.White;
                //tlVectorControl1.ForeColor = Color.White;
                CreateComboBox();
                xltProcessor = new XLTProcessor(tlVectorControl1);
                xltProcessor.MapView = mapview;
                xltProcessor.OnNewLine += new NewLineDelegate(xltProcessor_OnNewLine);
            } catch (Exception e) {
                MessageBox.Show(e.Message);
            }
        }
Esempio n. 3
0
        public void Open(string _SvgUID)
        {
            try {

                if (_SvgUID.Length < 20) {
                    JxtBar();
                    tlVectorControl2.ContextMenuStrip = null;
                }
                SVGFILE svgFile = new SVGFILE();
                svgFile.SUID = _SvgUID;
                SvgDocument document =CtrlSvgView.CashSvgDocument;
                if (document == null) {
                    IList svgList = Services.BaseService.GetList("SelectSVGFILEByKey", svgFile);
                    if (svgList.Count > 0) {
                        svgFile = (SVGFILE)svgList[0];
                    }

                    document = new SvgDocument();
                    if (!string.IsNullOrEmpty(svgFile.SVGDATA)) {
                        document.LoadXml(svgFile.SVGDATA);
                    }

                    document.FileName = svgFile.FILENAME;
                    document.SvgdataUid = svgFile.SUID;
                }
                SVGUID = document.SvgdataUid;

                img = document.SelectSingleNode("//*[@TLGH=\"1\"]");
                if (img != null) {
                    ((XmlElement)img).SetAttribute("xlink:href", " ");
                }
                this.Text = document.FileName;
                if (document.RootElement == null) {
                    tlVectorControl2.NewFile();
                    Layer.CreateNew("背景层", tlVectorControl2.SVGDocument);
                    Layer.CreateNew("城市规划层", tlVectorControl2.SVGDocument);
                    Layer.CreateNew("供电区域层", tlVectorControl2.SVGDocument);
                } else {
                    tlVectorControl2.SVGDocument = document;
                }
                tlVectorControl2.SVGDocument.SvgdataUid = SVGUID;
                tlVectorControl2.SVGDocument.FileName = this.Text;
                tlVectorControl2.DocumentbgColor = Color.White;
                tlVectorControl2.BackColor = Color.White;
                //tlVectorControl1.ForeColor = Color.White;
                CreateComboBox();
                xltProcessor = new XLTProcessor(tlVectorControl2);
                xltProcessor.MapView = mapview;
                xltProcessor.OnNewLine += new NewLineDelegate(xltProcessor_OnNewLine);
            } catch (Exception e) {
                MessageBox.Show(e.Message);
            }
        }