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;
        }
示例#2
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("矢量文档中没有激活的图层!");
     }
 }