private void getClipResult(object sender, UploadStringCompletedEventArgs e)
        {
            string rltName = this._spatial.OnGetAnalyseResult(e);//获取裁剪结果名称

            if (rltName == null || rltName == "")
            {
                return;
            }
            if (rltName == "*#*")
            {
                timerCnt = 0;
                MessageBox.Show("裁剪失败");
                return;
            }
            else
            {
                cancle(null, null);
                MessageBoxResult result = MessageBox.Show("裁剪分析成功。是否需要查看结果图层属性记录?", "提示", MessageBoxButton.OKCancel);
                if (result == MessageBoxResult.OK)
                {
                    ShowResult(rltName);
                    this._clipLayerAcsInfo = null;
                    this.Close();
                }
                else
                {
                    return;
                }
            }
        }
        /**
         * 多边形裁剪处理事件
         * @param e
         *
         */
        public void clipLayer()
        {
            if (this.IMSCatalog.ActiveLayerObj == null || this.IMSCatalog.ActiveLayerObj.ActiveLayerAccessInfo == null)
            {
                return;
            }

            GRegion region = new GRegion();

            region.Rings                 = new AnyLine[1];
            region.Rings[0]              = new AnyLine();
            region.Rings[0].Arcs         = new Arc[1];
            region.Rings[0].Arcs[0]      = new Arc();
            region.Rings[0].Arcs[0].Dots = dot;
            this.setClipRegion(region);
            this.Show();
            CLayerAccessInfo layerAccessInfo = new CLayerAccessInfo();

            layerAccessInfo.GdbInfo       = this.IMSCatalog.ActiveLayerObj.ActiveLayerAccessInfo.GdbInfo;
            layerAccessInfo.LayerInfoList = new CLayerInfo[1];
            int idx = this.IMSCatalog.ActiveLayerObj.ActiveLayerIndex;

            layerAccessInfo.LayerInfoList[0] = this.IMSCatalog.ActiveLayerObj.ActiveLayerAccessInfo.LayerInfoList[idx];
            this._clipLayerAcsInfo           = layerAccessInfo;
            this._serverAddr = this.IMSCatalog.ActiveLayerObj.ServerAddress;
            this._spatial    = new SpacialAnalyse(this.IMSCatalog.ActiveLayerObj);
        }
 //缓冲分析后的图层显示函数
 private void showBufferInfo(string layerName, XClsType layerType, string svrAddr = "127.0.0.1", string gdbSvr = "MapGisLocal", string gdbName = "IMSWebGISGDB", string usr = "", string psw = "")
 {
     if (this.successFlag == false)
     {
         //图层访问信息类
         CLayerAccessInfo layerAccessInfo = new CLayerAccessInfo();
         //gdb信息类
         layerAccessInfo.GdbInfo            = new CGdbInfo();
         layerAccessInfo.GdbInfo.GDBName    = gdbName;
         layerAccessInfo.GdbInfo.GDBSvrName = gdbSvr;
         layerAccessInfo.GdbInfo.User       = usr;
         layerAccessInfo.GdbInfo.Password   = psw;
         //图层信息类
         CLayerInfo layerInfo = new CLayerInfo();
         layerInfo.LayerDataName          = layerName;
         layerInfo.LayerType              = layerType;
         layerInfo.GeomType               = SFclsGeomType.Reg;
         layerAccessInfo.LayerInfoList    = new CLayerInfo[1];
         layerAccessInfo.LayerInfoList[0] = layerInfo;
         //设置要叠加打开的图层信息
         COpenLayer openLayer = new COpenLayer();
         openLayer.LayerAccessInfo    = new CLayerAccessInfo[1];
         openLayer.LayerAccessInfo[0] = layerAccessInfo;
         //实例化矢量图层
         this._vLayer = new VectorLayer();
         this.iMSMap1.AddChild(this._vLayer);
         this._vLayer.ServerAddress = svrAddr;
         this._vLayer.LayerObj      = openLayer;
         //加载缓冲分析后的图层
         this._vLayer.LoadLayer(openLayer, new UploadStringCompletedEventHandler(onSingleLayerLoad));
     }
 }
Beispiel #4
0
        //将分析后的图层叠加显示到地图上
        private void showClipInfo(string layerName, XClsType layerType, string svrAddr = "192.168.17.53:6163", string gdbSvr = "MapGisLocal", string gdbName = "IMSWebGISGDB", string usr = "", string psw = "")
        {
            this.iMSMap1.SetErrorText("");
            //设置图层访问信息
            CLayerAccessInfo layerAccessInfo = new CLayerAccessInfo();

            layerAccessInfo.GdbInfo            = new CGdbInfo();
            layerAccessInfo.GdbInfo.GDBName    = gdbName;
            layerAccessInfo.GdbInfo.GDBSvrName = gdbSvr;
            layerAccessInfo.GdbInfo.User       = usr;
            layerAccessInfo.GdbInfo.Password   = psw;
            //设置图层信息
            CLayerInfo layerInfo = new CLayerInfo();

            layerInfo.LayerDataName          = layerName;
            layerInfo.LayerType              = layerType;
            layerInfo.GeomType               = SFclsGeomType.Reg;
            layerAccessInfo.LayerInfoList    = new CLayerInfo[1];
            layerAccessInfo.LayerInfoList[0] = layerInfo;
            //设置要叠加打开的图层信息
            COpenLayer openLayer = new COpenLayer();

            openLayer.LayerAccessInfo    = new CLayerAccessInfo[1];
            openLayer.LayerAccessInfo[0] = layerAccessInfo;
            this._vLayer = new VectorLayer();
            this.iMSMap1.AddChild(this._vLayer);
            this._vLayer.ServerAddress = svrAddr;
            this._vLayer.LayerObj      = openLayer;
            //加载裁剪分析后的图层
            this._vLayer.LoadLayer(openLayer, new UploadStringCompletedEventHandler(onSingleLayerLoad));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="layerName"></param>
        /// <param name="layerType"></param>
        /// <param name="svrAddr"></param>
        /// <param name="gdbSvr"></param>
        /// <param name="gdbName"></param>
        /// <param name="usr"></param>
        /// <param name="psw"></param>
        public void ShowLayerAttRecord(string layerName, XClsType layerType, string svrAddr = "127.0.0.1", string gdbSvr = "MapGisLocal", string gdbName = "IMSWebGISGDB", string usr = "", string psw = "")
        {
            CLayerAccessInfo layerAccessInfo = new CLayerAccessInfo();

            layerAccessInfo.GdbInfo            = new CGdbInfo();
            layerAccessInfo.GdbInfo.GDBName    = gdbName;
            layerAccessInfo.GdbInfo.GDBSvrName = gdbSvr;
            layerAccessInfo.GdbInfo.User       = usr;
            layerAccessInfo.GdbInfo.Password   = psw;
            CLayerInfo layerInfo = new CLayerInfo();

            layerInfo.LayerDataName          = layerName;
            layerInfo.LayerType              = layerType;
            layerInfo.GeomType               = SFclsGeomType.Reg;
            layerAccessInfo.LayerInfoList    = new CLayerInfo[1];
            layerAccessInfo.LayerInfoList[0] = layerInfo;
            COpenLayer openLayer = new COpenLayer();

            openLayer.LayerAccessInfo    = new CLayerAccessInfo[1];
            openLayer.LayerAccessInfo[0] = layerAccessInfo;
            this._vLayer = new VectorLayer();
            this._vLayer.ServerAddress = svrAddr;
            this._vLayer.LayerObj      = openLayer;
            m_catalog.MapContainer.AddChild(this._vLayer);
            // this._vLayer.AddedToMapContainerCallback += new AddedToMapContainerDelegate(AddToContainer);
            this._vLayer.LayerOpenSuccEvent += new LayerOpenSuccEventHandler(_vLayer_LayerOpenSuccEvent);
        }
        private void submit(object sender, RoutedEventArgs e)
        {
            if (this._clipLayerAcsInfo == null)
            {
                MessageBox.Show("请激活需要裁剪的图层后重新运行。");
                return;
            }
            if (this.clipRadius.Text == "")
            {
                MessageBox.Show("请输入裁剪分析半径。");
                return;
            }
            if (this._clipRegion == null)
            {
                MessageBox.Show("还未设置裁剪范围。");
                return;
            }
            CClipByPolygon clip = new CClipByPolygon();

            clip.Region = this._clipRegion;
            CLayerAccessInfo clipLayer = this._clipLayerAcsInfo;

            clip.GdbInfo     = clipLayer.GdbInfo;
            clip.LayerName   = clipLayer.LayerInfoList[0].LayerDataName;
            clip.XClsType    = clipLayer.LayerInfoList[0].LayerType;
            clip.FClsNameRtn = "clip" + clip.LayerName;
            clip.Radius      = Convert.ToDouble(this.clipRadius.Text);
            clip.Username    = "";
            clip.UserIP      = "";
            bool check = false;

            if (check = Convert.ToBoolean(this.radio_in.IsChecked) && this.radio_in.Content.ToString() == "内裁")
            {
                clip.ClipFlg = 3;
            }
            else
            {
                clip.ClipFlg = 4;
            }
            if (check = Convert.ToBoolean(this.radio_no.IsChecked) && this.radio_no.Content.ToString() == "否")
            {
                clip.IsReCalculate = false;
            }
            else
            {
                clip.IsReCalculate = true;
            }
            this._spatial.ClipByPolygon(clip, new UploadStringCompletedEventHandler(onSubmit));
            this.button_submit.IsEnabled = false;
        }
Beispiel #7
0
 //设置裁剪分析的参数
 private void CircleClip()
 {
     if (this.iMSCatalog1.ActiveMapDoc != null)
     {
         //删除绘制的图形
         this.m_gpLayer.RemoveAll();
         //GRegion多区
         GRegion region = new GRegion();
         //AnyLine任意线
         region.Rings                 = new AnyLine[1];
         region.Rings[0]              = new AnyLine();
         region.Rings[0].Arcs         = new Arc[1];
         region.Rings[0].Arcs[0]      = new Arc();
         region.Rings[0].Arcs[0].Dots = new Dot_2D[dot.Length];
         region.Rings[0].Arcs[0].Dots = dot;
         //将圆形区域上的所有的边界点赋值给多区的对象
         this._clipRegion = region;
         // 设置图层的访问信息
         this._clipLayerAcsInfo = new CLayerAccessInfo();
         this._clipLayerAcsInfo = this.iMSCatalog1.ActiveMapDoc.ActiveLayerAccessInfo;
         this._serverAddr       = this.iMSCatalog1.ActiveMapDoc.ServerAddress;
         //设置裁剪分析参数
         CClipByPolygon clip = new CClipByPolygon();
         //设置要裁剪的区
         clip.Region = this._clipRegion;
         CLayerAccessInfo clipLayer = this._clipLayerAcsInfo;
         clip.GdbInfo       = clipLayer.GdbInfo;
         clip.LayerName     = clipLayer.LayerInfoList[0].LayerDataName;
         clip.XClsType      = clipLayer.LayerInfoList[0].LayerType;
         clip.FClsNameRtn   = "clip" + clip.LayerName;
         clip.Radius        = 0.0001;
         clip.Username      = "";
         clip.UserIP        = "";
         clip.ClipFlg       = 3;
         clip.IsReCalculate = false;
         //空间分析类
         this._spatial = new SpacialAnalyse(this.iMSCatalog1.ActiveMapDoc);
         //裁剪分析
         this._spatial.ClipByPolygon(clip, new UploadStringCompletedEventHandler(onSubmit));
     }
     else
     {
         MessageBox.Show("矢量文档中没有激活的图层!");
     }
 }
        /// <summary>
        /// 圆裁剪地图文档
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public void clipDoc()
        {
            if (this.IMSCatalog.ActiveMapDoc.ActiveLayerIndex == -1)
            {
                MessageBox.Show("矢量文档中没有激活的图层!");
                return;
            }
            GRegion region = new GRegion();

            region.Rings                 = new AnyLine[1];
            region.Rings[0]              = new AnyLine();
            region.Rings[0].Arcs         = new Arc[1];
            region.Rings[0].Arcs[0]      = new Arc();
            region.Rings[0].Arcs[0].Dots = new Dot_2D[dot.Length];
            region.Rings[0].Arcs[0].Dots = dot;
            this.setClipRegion(region);
            this.Show();
            this._clipLayerAcsInfo = this.IMSCatalog.ActiveMapDoc.ActiveLayerAccessInfo;
            this._serverAddr       = this.IMSCatalog.ActiveMapDoc.ServerAddress;
            this._spatial          = new SpacialAnalyse(this.IMSCatalog.ActiveMapDoc);
        }
 public void close(object sender, RoutedEventArgs e)
 {
     this.Close();
     this._clipLayerAcsInfo = null;
 }