Exemple #1
0
        void frmlar_OnClickLayer(object sender, Layer lar)
        {
            //tlVectorControl1.SVGDocument.SelectCollection.Clear();
            ArrayList a = tlVectorControl1.SVGDocument.getLayerList();
            SvgDocument.currentLayer = lar.ID;
            //tlVectorControl1.SVGDocument.CurrentElement = null;

            string larid = lar.ID;

            if (!ChangeLayerList.Contains(larid)) {
                ChangeLayerList.Add(larid);
            }

            if (lar.GetAttribute("layerType") == progtype) {
                tlVectorControl1.CanEdit = true;
                if (progtype == "地理信息层") {
                    DlBarVisible(true);
                }
                if (progtype == "城市规划层") {
                    DkBarVisible(true);
                }
                if (progtype == "电网规划层") {
                    DwBarVisible(true);
                }
            } else {
                tlVectorControl1.CanEdit = false;
                if (progtype == "地理信息层") {
                    DlBarVisible(false);
                }
                if (progtype == "城市规划层") {
                    DkBarVisible(false);
                }
                if (progtype == "电网规划层") {
                    DwBarVisible(false);
                }
            }
            if (lar.GetAttribute("layerType") == "所内接线图") {
                JxtBar();
                return;
            }
        }
        //private void simpleButton5_Click(object sender, EventArgs e)
        //{
        //    int index = this.checkedListBox1.SelectedIndex;
        //    if (index>0)
        //    {
        //        Layer layer = this.checkedListBox1.Items[index] as Layer;
        //        LayerFile temp = new LayerFile();
        //        temp.SvgDataUid = this.symbolDoc.SvgdataUid;
        //        IList lList = Services.BaseService.GetList("SelectLayerFileBySvgDataUid", temp);
        //        foreach (LayerFile lay in lList)
        //        {
        //            if (lay.LayerFileName==layer.Label)
        //            {
        //                MessageBox.Show("�ĵ����Ѿ�����ͬ��ͼ��,���޸�ͼ�����ƺ󵼳���", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
        //                return;
        //            }
        //        }
        //        string strsvgData = this.symbolDoc.SelectNodesToString("svg/*[@layer='" + layer.ID + "']|svg/defs");
        //        LayerFile layerFile = new LayerFile();
        //        layerFile.SUID = Guid.NewGuid().ToString();
        //        layerFile.LayerID = layer.ID;
        //        layerFile.LayerFileName = layer.Label;
        //        layerFile.SvgDataUid = this.symbolDoc.SvgdataUid;
        //        layerFile.LayerOuterXml = strsvgData;
        //        Services.BaseService.Create<LayerFile>(layerFile);
        //        DeleteLayer(layer);
        //    }
        //    //StreamWriter sw = new StreamWriter("c:\\1.xml");
        //    //sw.Write(str1);
        //    //sw.Close();
        //    //sw = new StreamWriter("c:\\2.txt");
        //    //sw.Write(str2);
        //    //sw.Close();
        //    //sw = new StreamWriter("c:\\3.xml");
        //    //sw.Write(str3);
        //    //sw.Close();
        //    //sw = new StreamWriter("c:\\4.txt");
        //    //sw.Write(str4);
        //    //sw.Close();
        //    //sw = new StreamWriter("c:\\5.xml");
        //    //sw.Write(newOutXml);
        //    //sw.Close();
        //    //string str2 = this.SymbolDoc.SvgdataUid;
        //    //SVGFILE svg = new SVGFILE();
        //    //svg = (SVGFILE)svglist[0];
        //    //svg.SVGDATA = this.SymbolDoc.OuterXml;
        //    //Services.BaseService.Update<SVGFILE>(svg);
        //}
        private Layer CopyLayer(Layer layer)
        {
            Layer layer2 = Layer.CreateNew(layer.Label + " ����", this.SymbolDoc);
            layer2.SetAttribute("ParentID", layer.GetAttribute("ParentID"));
            //foreach (SvgElement g in layer.GraphList)
            //{
            //    layer2.GraphList.Add(g);
            //}
            SVG_LAYER la = new SVG_LAYER();
            la.SUID = layer.ID;
            la.svgID = symbolDoc.SvgdataUid;
            la = (SVG_LAYER)Services.BaseService.GetObject("SelectSVG_LAYERByKey", la);
            if (la != null) {
                la.SUID = layer2.ID;
                la.NAME = layer2.Label;
                Services.BaseService.Create<SVG_LAYER>(la);
                DataTable dt = treeList1.DataSource as DataTable;
                dt.Rows.Add(Itop.Common.DataConverter.ObjectToRow(la, dt.NewRow()));
            }
            this.SymbolDoc.NumberOfUndoOperations = (2 * layer2.GraphList.Count) + 200;
            SvgElementCollection sc = layer.GraphList;
            for (int i = layer.GraphList.Count - 1; i >= 0; i--) {
                SvgElement element = sc[i] as SvgElement;
                SvgElement temp = element.Clone() as SvgElement;
                //if (temp.Name=="use"){
                if (temp.GetAttribute("CopyOf") == "") {
                    temp.SetAttribute("CopyOf", temp.ID);
                }
                //else
                //{
                //    temp.SetAttribute("CopyOf", temp.ID);
                //}
                //}
                IGraph graph = (IGraph)layer2.AddElement(temp);
                graph.Layer = layer2;

                //LineInfo _line = new LineInfo();
                //_line.EleID = element.ID;
                //_line.SvgUID = this.SymbolDoc.SvgdataUid;
                //IList lineInfoList = Services.BaseService.GetList("SelectLineInfoByEleID", _line);
                /*  PSPDEV _line = new PSPDEV();
                  _line.EleID = element.ID;
                  _line.SvgUID = this.SymbolDoc.SvgdataUid;
                  IList lineInfoList = Services.BaseService.GetList("SelectPSPDEVBySvgUIDandEleID", _line);

                  foreach (PSPDEV line in lineInfoList)
                  {
                      line.SUID = Guid.NewGuid().ToString();
                      line.LayerID = layer2.ID;
                      line.EleID = temp.ID;
                      line.Type = "05";
                      Services.BaseService.Create<PSPDEV>(line);
                  }
                  glebeProperty gle = new glebeProperty();
                  gle.EleID = element.ID;
                  gle.SvgUID = this.SymbolDoc.SvgdataUid;
                  IList gleProList=Services.BaseService.GetList("SelectglebePropertyByEleID", gle);
                  foreach (glebeProperty gleP  in gleProList)
                  {
                      gleP.UID = Guid.NewGuid().ToString();
                      gleP.LayerID = layer2.ID;
                      gleP.EleID = temp.ID;
                      Services.BaseService.Create<glebeProperty>(gleP);
                  }
                  PSP_Substation_Info _sub = new PSP_Substation_Info();
                  _sub.EleID = element.ID;
                  _sub.AreaID = this.SymbolDoc.SvgdataUid;
                  IList substationList = Services.BaseService.GetList("SelectPSP_Substation_InfoListByEleID", _sub);
                  foreach (PSP_Substation_Info sub in substationList)
                  {
                      sub.UID = Guid.NewGuid().ToString();
                      sub.LayerID = layer2.ID;
                      sub.EleID = temp.ID;
                      Services.BaseService.Create<PSP_Substation_Info>(sub);
                  }
                 */
            }
            this.SymbolDoc.NotifyUndo();
            return layer2;
        }
        private Layer CopyLayer(Layer layer)
        {
            Layer layer2 = Layer.CreateNew(layer.Label + " ����", this.SymbolDoc);
            layer2.SetAttribute("ParentID", layer.GetAttribute("ParentID"));
            //foreach (SvgElement g in layer.GraphList)
            //{
            //    layer2.GraphList.Add(g);
            //}
            SVG_LAYER la = new SVG_LAYER();
            la.SUID = layer.ID;
            la.svgID = symbolDoc.SvgdataUid;
            la = (SVG_LAYER)Services.BaseService.GetObject("SelectSVG_LAYERByKey", la);
            if (la != null)
            {
                la.SUID = layer2.ID;
                la.NAME = layer2.Label;
                Services.BaseService.Create<SVG_LAYER>(la);
            }
            this.SymbolDoc.NumberOfUndoOperations = (2 * layer2.GraphList.Count) + 200;
            SvgElementCollection sc = layer.GraphList;
            for (int i = layer.GraphList.Count - 1; i >= 0; i--)
            {
                SvgElement element = sc[i] as SvgElement;
                SvgElement temp = element.Clone() as SvgElement;
                //if (temp.Name=="use"){
                if (temp.GetAttribute("CopyOf") == "")
                {
                    temp.SetAttribute("CopyOf", temp.ID);
                }
                //else
                //{
                //    temp.SetAttribute("CopyOf", temp.ID);
                //}
                //}
                IGraph graph = (IGraph)layer2.AddElement(temp);
                graph.Layer = layer2;

               /* LineInfo _line = new LineInfo();
                _line.EleID = element.ID;
                _line.SvgUID = this.SymbolDoc.SvgdataUid;
                IList lineInfoList = Services.BaseService.GetList("SelectLineInfoByEleID", _line);
                foreach (LineInfo line in lineInfoList)
                {
                    line.UID = Guid.NewGuid().ToString();
                    line.LayerID = layer2.ID;
                    line.EleID = temp.ID;
                    Services.BaseService.Create<LineInfo>(line);
                }
                glebeProperty gle = new glebeProperty();
                gle.EleID = element.ID;
                gle.SvgUID = this.SymbolDoc.SvgdataUid;
                IList gleProList = Services.BaseService.GetList("SelectglebePropertyByEleID", gle);
                foreach (glebeProperty gleP in gleProList)
                {
                    gleP.UID = Guid.NewGuid().ToString();
                    gleP.LayerID = layer2.ID;
                    gleP.EleID = temp.ID;
                    Services.BaseService.Create<glebeProperty>(gleP);
                }
                substation _sub = new substation();
                _sub.EleID = element.ID;
                _sub.SvgUID = this.SymbolDoc.SvgdataUid;
                IList substationList = Services.BaseService.GetList("SelectsubstationByEleID", _sub);
                foreach (substation sub in substationList)
                {
                    sub.UID = Guid.NewGuid().ToString();
                    sub.LayerID = layer2.ID;
                    sub.EleID = temp.ID;
                    Services.BaseService.Create<substation>(sub);
                }*/
            }
            this.SymbolDoc.NotifyUndo();
            return layer2;
        }
 private bool CkRight(Layer lar)
 {
     if (lar == null) return false;
     if (lar.Label == "������0"  /*|| lar.Label=="�滮��" || lar.Label=="ͳ�Ʋ�"*/) {
         return false;
     }
     #if(!CITY)
     if (progtype == "�����滮��") {
         string ltype = lar.GetAttribute("layerType");
         if (ltype == "������Ϣ��" || ltype == "���й滮��")
             return false;
     }
     #endif
     return true;
 }
Exemple #5
0
        void frmlar_OnClickLayer(object sender, Layer lar)
        {
            ArrayList a = tlVectorControl2.SVGDocument.getLayerList();
            SvgDocument.currentLayer = lar.ID;

            if (lar.GetAttribute("layerType") == progtype) {
                tlVectorControl2.CanEdit = true;
                if (progtype == "地理信息层") {
                    DlBarVisible(true);
                }
                if (progtype == "城市规划层") {
                    DkBarVisible(true);
                }
                if (progtype == "电网规划层") {
                    DwBarVisible(true);
                }
            } else {
                tlVectorControl2.CanEdit = false;
                if (progtype == "地理信息层") {
                    DlBarVisible(false);
                }
                if (progtype == "城市规划层") {
                    DkBarVisible(false);
                }
                if (progtype == "电网规划层") {
                    DwBarVisible(false);
                }
            }
            if (lar.GetAttribute("layerType") == "所内接线图") {
                JxtBar();
                return;
            }
        }