//缓冲分析后的图层显示函数 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)); } }
//将分析后的图层叠加显示到地图上 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 onPlug(object sender, UploadStringCompletedEventArgs e) { //设置两个矩形不可见 this.IMSRect.Visibility = Visibility.Collapsed; this.IMSRect2.Visibility = Visibility.Collapsed; //获取调用插件的请求结果,得到分析成功后的url地址 String getOverLayerUrl = plug.OnGetPluginList(sender, e) as String; //判断是否成功 if (getOverLayerUrl != "" && getOverLayerUrl != null) { if (this.layerDataViewer != null) { this.layerDataViewer.removeLayer(); this.layerDataViewer.Close(); layerDataViewer = null; } if (this.layerDataViewer == null) { layerDataViewer = new LayerDataViewer(); layerDataViewer.IMSCatalog = this.iMSCatalog1; } int loc1 = getOverLayerUrl.IndexOf("sfcls") + 6; int loc3 = getOverLayerUrl.Length - 1; int loc4 = loc3 - loc1; //截取字符串,获取叠加分析成功后的图层名称 String loc2 = getOverLayerUrl.Substring(loc1, loc4); XClsType layerType = XClsType.SFeatureCls; String SAddress = this.mapDoc.ServerAddress; this.layerDataViewer.IMSCatalog = this.iMSCatalog1; this.layerDataViewer.GraphicsLayer = g_GraphicsLayer; this.layerDataViewer.Show(); this.layerDataViewer.ShowLayerAttRecord(loc2, layerType, SAddress); ISSuccess = true; Overflag = true; this.layerDataViewer.Margin = new Thickness(0, 120, 0, 0); this.layerDataViewer.HorizontalAlignment = HorizontalAlignment.Right; this.layerDataViewer.Visibility = Visibility.Visible; } else { MessageBox.Show("分析失败,重新点击分析!"); ISSuccess = true; }; }
// 获取栅格数据的id和name public void getRasterData(XClsType type, int FdsID) { List <int> rdsIDs = null; rdsIDs = GDB.GetXclses(type, FdsID); if (rdsIDs == null) { return; } int count = rdsIDs.Count; for (int i = 0; i < count; i++) { string name = GDB.GetXclsName(type, rdsIDs[i]); selectRasterCmb.Items.Add(name); } }
/// <summary> /// 返回叠加结果图层的数据 /// </summary> /// <param name="rltName"></param> private void onShow(string rltLayerName) { if (layerDataViewer == null) { layerDataViewer = new LayerDataViewer() { IsPopup = true } } ; layerDataViewer.IMSCatalog = this.IMSCatalog1; if (this.layerDataViewer == null) { MessageBox.Show("layerDataViewer属性为空!请创建LayerDataViewer控件!"); } this.layerDataViewer.GraphicsLayer = GraphicsLayerObj; XClsType layerType = this.dataType.SelectionBoxItem.ToString() == "简单要素类" ? XClsType.SFeatureCls : XClsType.FeatureCls; this.layerDataViewer.ShowLayerAttRecord(rltLayerName, layerType, this.vectorObj.ServerAddress); }