private void select(Object geoObj, SelectionType selType)
        {
            //设置web查询参数
            CLayerSelectParam mapsel = new CLayerSelectParam();
            CWebSelectParam   websel = new CWebSelectParam();

            websel.CompareRectOnly = this.vectorLayer.CompareRectOnly;
            websel.Geometry        = geoObj; //几何查询范围
            if (geoObj != null)              //几何查询图形类型
            {
                websel.GeomType = (geoObj as IWebGeometry).GetGeomType();
            }
            websel.MustInside     = this.vectorLayer.MustInside; //查询要素是否在图形里面
            websel.NearDistance   = 0;                           // this.vectorLayer.NearDistanse;//查询半径
            websel.SelectionType  = selType;                     //查询类型:几何
            mapsel.WebSelectParam = websel;                      //web查询参数对象
            mapsel.PageCount      = 0;                           //查询起始页数
            this.layer_dataView._lastSelectParam = mapsel;
            //调用矢量图层的查询方法查询
            this.vectorLayer.LayerSelectAndGetAtt(mapsel, this.layer_dataView.SelectCallback);
            if (this.HightLight.IsChecked == true)
            {//高亮显示:传入地图容器对象、查询参数、绘图层对象、矢量图层对象
                drawHighLight.AddhighLightFeatures(this.iMSMap1, mapsel, this.graphicsLayer1, this.vectorLayer);
                drawHighLight.reflash();
            }
        }
Example #2
0
        /// <summary>
        /// 地图文档查询
        /// </summary>
        /// <param name="geoObj">查询空间范围对象</param>
        /// <param name="selType">查询类型</param>
        /// <param name="page">结果记录页码</param>
        /// <param name="condition">查询条件</param>
        internal void Select(Object geoObj, SelectionType selType, int page = 0, string condition = "")
        {
            if (m_catalog.ActiveMapDoc == null)
            {
                MessageBox.Show("请选择一个活动矢量文档图层!", "提示", MessageBoxButton.OK);
                return;
            }
            dataPager1.PageIndexChanged -= new EventHandler <EventArgs>(dataPager1_PageIndexChanged);
            CMapSelectParam mapsel = new CMapSelectParam();
            CWebSelectParam websel = new CWebSelectParam();

            websel.CompareRectOnly = m_catalog.ActiveMapDoc.CompareRectOnly;
            websel.Geometry        = geoObj;
            if (geoObj != null)
            {
                websel.GeomType = (geoObj as IWebGeometry).GetGeomType();
            }
            websel.MustInside    = m_catalog.ActiveMapDoc.MustInside;
            websel.NearDistance  = m_catalog.ActiveMapDoc.NearDistanse;
            websel.SelectionType = selType;
            websel.WhereClause   = condition;
            mapsel.SelectParam   = websel;
            mapsel.PageCount     = page;
            this.SetLastSelectParam(mapsel);
            m_catalog.ActiveMapDoc.Select(mapsel, new UploadStringCompletedEventHandler(SelectCallback));
        }
Example #3
0
 /// <summary>
 /// 查询事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void select_Click(object sender, RoutedEventArgs e)
 {
     if (this.sql.Text != "")
     {
         CSetEnumLayerStatus setLayerStatus;
         setLayerStatus                = new CSetEnumLayerStatus();
         setLayerStatus.GdbIndex       = 0;
         setLayerStatus.LayerStatus    = new EnumLayerStatus[1];
         setLayerStatus.LayerStatus[0] = EnumLayerStatus.Editable;
         this.vectorLayer.SetEnumLayerStatus(setLayerStatus, onSetSingleLayerStatus);
         //设置web查询参数
         CLayerSelectParam mapsel = new CLayerSelectParam();
         CWebSelectParam   websel = new CWebSelectParam();
         websel.CompareRectOnly = this.vectorLayer.CompareRectOnly;
         websel.Geometry        = null;
         websel.MustInside      = this.vectorLayer.MustInside;   //查询要素是否在图形里面
         websel.NearDistance    = this.vectorLayer.NearDistanse; //查询半径
         websel.SelectionType   = SelectionType.Condition;       //查询类型:属性
         websel.WhereClause     = this.sql.Text;                 //查询sql语句
         mapsel.WebSelectParam  = websel;                        //web查询参数对象
         mapsel.PageCount       = 0;                             //查询起始页数
         this.layer_dataView._lastSelectParam = mapsel;
         //调用矢量图层的查询方法查询
         this.vectorLayer.LayerSelectAndGetAtt(mapsel, this.layer_dataView.SelectCallback);
         if (this.HightLight.IsChecked == true)
         {//高亮显示:传入地图容器对象、查询参数、绘图层对象、矢量图层对象
             drawHighLight.AddhighLightFeatures(this.iMSMap1, mapsel, this.graphicsLayer1, this.vectorLayer);
         }
     }
     else
     {
         MessageBox.Show("查询参数为空!");
         return;
     }
 }
        /// <summary>
        /// 选择要素
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void selFeature()
        {
            CLayerSelectParam mapsel = new CLayerSelectParam();
            CWebSelectParam   websel = new CWebSelectParam();

            websel.Geometry        = obj1;
            websel.CompareRectOnly = this.IMSCatalog.ActiveLayerObj.CompareRectOnly;
            websel.GeomType        = (obj1 as IWebGeometry).GetGeomType();

            websel.NearDistance   = this.IMSCatalog.ActiveLayerObj.NearDistanse;
            websel.SelectionType  = SelectionType.SpatialRange;
            websel.MustInside     = this.IMSCatalog.ActiveLayerObj.MustInside;
            mapsel.WebSelectParam = websel;
            mapsel.PageCount      = 0;
            this.IMSCatalog.ActiveLayerObj.LayerSelectAndGetAtt(mapsel, setFeature);
        }
Example #5
0
        private void OverLayerAnalyseSubmit(object sender, RoutedEventArgs e)
        {
            if (ISSuccess == true)
            {
                //   if (layerDataViewer == null)
                //    {
                //         layerDataViewer = new LayerDataViewer();
                //         layerDataViewer.IMSCatalog = this.iMSCatalog1;
                //     }
                //    if (this.layerDataViewer == null)
                //  {
                //       MessageBox.Show("layerDataViewer属性为空!请创建LayerDataViewer控件!");
                //     }

                //叠加参数操作类
                OverlayBySelectParam param = new OverlayBySelectParam();
                //设置第一个查询参数类
                CWebSelectParam selectParam = new CWebSelectParam();
                //设置查询类型为矩形查询
                selectParam.GeomType = WebGeomType.Rect;
                //设置知查询的矩形范围
                MemoryStream ms1 = new MemoryStream();
                DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(ZDIMS.BaseLib.Rect));
                ser1.WriteObject(ms1, rect1);
                byte[] json1 = ms1.ToArray();
                ms1.Close();
                string jsonString1 = Encoding.UTF8.GetString(json1, 0, json1.Length);//序列化得到的字符串
                selectParam.Geometry = jsonString1;
                //设置搜索半径
                selectParam.NearDistance = 0.1;
                //设置查询类型为简单查询
                selectParam.SelectionType = SelectionType.SpatialRange;
                //设置查询对象是否必须完全包含在输入的空间的范围内
                selectParam.MustInside = true;
                //设置第二个CWebSelectParam查询参数类
                CWebSelectParam selectParam2 = new CWebSelectParam();
                //设置查询类型为矩形查询
                selectParam2.GeomType = WebGeomType.Rect;
                MemoryStream ms2 = new MemoryStream();
                DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(ZDIMS.BaseLib.Rect));
                ser1.WriteObject(ms2, rect2);
                byte[] json2 = ms2.ToArray();
                ms1.Close();
                string jsonString2 = Encoding.UTF8.GetString(json2, 0, json2.Length);//序列化得到的字符串
                //设置查询的矩形范围
                selectParam2.Geometry = jsonString2;
                //设置搜索半径
                selectParam2.NearDistance = 0.1;
                //设置查询类型为简单查询
                selectParam2.SelectionType = SelectionType.SpatialRange;
                //CGdbInfo gdb信息类
                CGdbInfo gdbInfo = new CGdbInfo();
                gdbInfo.GDBSvrName = "mapgislocal";
                gdbInfo.GDBName    = "world";
                //叠加的图层名称
                param.LayerName1 = "城市植被";
                //叠加分析第一个图层的查询参数
                param.SelectParam1 = selectParam;
                //被叠加的图层名称
                param.LayerName2 = "行政区.WP";
                //叠加分析第二个图层的查询参数
                param.SelectParam2 = selectParam2;
                param.Radius       = 0.001;
                //设置叠加分析的类型   1为相交分析
                param.OverlayType = 1;
                //是否重算面积
                param.IsReCalculate = false;
                param.GdbInfo1      = gdbInfo;
                param.GdbInfo2      = gdbInfo;
                //设置图层类型为简单要素类
                param.ClsType = XClsType.SFeatureCls;
                MemoryStream ms = new MemoryStream();
                DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(OverlayBySelectParam));
                ser.WriteObject(ms, param);
                byte[] json = ms.ToArray();
                ms.Close();
                string jsonString = Encoding.UTF8.GetString(json, 0, json.Length);//序列化得到的字符串
                //var postData:String =JSON.encode(param) as String;
                //实例化插件对象
                plug = new Plugin();
                plug.ServerAddress = this.mapDoc.ServerAddress;
                ISSuccess          = false;
                plug.CallPlugin("OverlayAnalysisExtend", "OverlayAnalysisClass", "OverlayBySelect", "inputFormat=JSON&outputFormat=JSON", jsonString, onPlug);
            }
        }