private void NetSubmit(object sender, RoutedEventArgs e) { if (SuccessFlag == true) { if (netWindow != null) { this.netWindow.removeFlash(); ClearRoad(); this.netWindow.roadReslut.Blocks.Clear(); this.netWindow.Close(); netWindow = null; } SuccessFlag = false; CGdbInfo gdb = new CGdbInfo(); gdb.GDBName = this.GDBName; gdb.GDBSvrName = this.GDBSvrName; gdb.Password = this.Password; gdb.User = this.User; CNetAnalyse obj = new CNetAnalyse(); obj.GdbInfo = gdb; obj.NetLayerName = this.NetLayerName; obj.RequestDots = this.pathDots.Substring(0, this.pathDots.Length - 1); obj.BarrierDots = ""; obj.NearDis = 0.002; obj.FlgType = "line"; obj.NetWeight = ",Weight1,Weight1"; obj.AnalysTypeParam = AnalysType.UserMode.ToString(); _spatial = new SpacialAnalyse(this.mapDoc); _spatial.NetAnalyse(obj, new UploadStringCompletedEventHandler(OnSubmit)); } }
public void Submit() { if (CommFun.IsNumber(this.buffer.Text)) { if (VectorObj == null) { MessageBox.Show("绑定的矢量图对象为空", "提示", MessageBoxButton.OK); return; } MarkLayer.ManuallyAddMarkObj = null; CGdbInfo gdb = new CGdbInfo(); gdb.GDBName = this.GDBName; gdb.GDBSvrName = this.GDBSvrName; gdb.Password = this.Password; gdb.User = this.User; CNetAnalyse obj = new CNetAnalyse(); obj.GdbInfo = gdb; obj.NetLayerName = this.NetLayerName; obj.RequestDots = this.m_pathDots.Length > 0 ? this.m_pathDots.Substring(0, this.m_pathDots.Length - 1) : this.m_pathDots; obj.BarrierDots = this.m_barrierDots.Length > 0 ? this.m_barrierDots.Substring(0, this.m_barrierDots.Length - 1) : this.m_barrierDots; obj.NearDis = 100; //Convert.ToSingle(this.buffer.Text); obj.FlgType = "line"; obj.NetWeight = ",Weight1,Weight1"; _spatial = new SpacialAnalyse(VectorObj); _spatial.NetAnalyse(obj, new UploadStringCompletedEventHandler(OnSubmit)); } else { MessageBox.Show("请输入合法的分析半径", "提示", MessageBoxButton.OK); } }
/// <summary> /// 叠加分析 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void submit(object sender, RoutedEventArgs e) { if (this.vectorObj == null) { MessageBox.Show("没有激活的图层。"); return; } COverlayByLayer obj = new COverlayByLayer(); obj.FClsNameRtn = "overlay"; CGdbInfo gdbInfo = new CGdbInfo(); gdbInfo.GDBName = this.gdbName.SelectedValue.ToString(); gdbInfo.GDBSvrName = this.svrList.SelectedValue.ToString(); gdbInfo.User = this.username.Text; gdbInfo.Password = this.password.Text; obj.GdbInfo = gdbInfo; obj.GdbInfoOverlay = gdbInfo; bool c = Convert.ToBoolean(this.radio_no.IsChecked); if (c) { obj.IsReCalculate = c; } else { obj.IsReCalculate = Convert.ToBoolean(this.radio_yes.IsChecked); } obj.LayerName = this.layer1.SelectedItem.ToString(); obj.OverlayLayerName = this.layer2.SelectedItem.ToString(); bool t; if (t = Convert.ToBoolean(this.radioButton_bing.IsChecked)) { obj.OverlayType = 0; } if (t = Convert.ToBoolean(this.radioButton_cha.IsChecked)) { obj.OverlayType = 6; } if (t = Convert.ToBoolean(this.radioButton_jiao.IsChecked)) { obj.OverlayType = 1; } if (t = Convert.ToBoolean(this.radioButton_jian.IsChecked)) { obj.OverlayType = 2; } obj.Radius = Convert.ToDouble(this.radius.Text); obj.XClsType = this.dataType.SelectionBoxItem.ToString() == "简单要素类" ? XClsType.SFeatureCls : XClsType.FeatureCls; this._spatial = new SpacialAnalyse(this.vectorObj); _spatial.OverlayByLayer(obj, new UploadStringCompletedEventHandler(onSubmit)); this.button_submit.IsEnabled = false; }
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); } }