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> /// <returns></returns> private CMapFeatureInfo GetMapFeatureInfo() { CMapFeatureInfo fInfo = new CMapFeatureInfo(); SFeature sf = new SFeature(); sf.AttValue = new string[m_attStruct.FldNumber]; for (int i = 0; i < m_attStruct.FldNumber; i++) { sf.AttValue[i] = m_textBoxArr[i].Text; switch (this.m_attStruct.FldType[i]) { case "double": case "integer": case "long": case "short": if (!CommFun.IsNumber(sf.AttValue[i])) { MessageBox.Show("字段【Fld_" + this.m_attStruct.FldName[i] + "】输入的数据格式不正确。请重新输入!", "提示", MessageBoxButton.OK); return(null); } break; } } SFeatureGeometry sfGeo = null; SFclsGeomType curFGeoType; if (m_targetGeo != null) { sfGeo = m_targetGeo as SFeatureGeometry; if (sfGeo == null) //add feature { sfGeo = new SFeatureGeometry(); switch ((m_targetGeo as IWebGeometry).GetGeomType()) { case WebGeomType.Point: sf.ftype = SFclsGeomType.Pnt; GPoint pnt = new GPoint(); pnt.Dot = m_targetGeo as Dot_2D; sfGeo.PntGeom = new GPoint[] { pnt }; break; case WebGeomType.Line: sf.ftype = SFclsGeomType.Lin; GLine line = new GLine(); line.Line = m_targetGeo as AnyLine; sfGeo.LinGeom = new GLine[] { line }; break; case WebGeomType.Polygon: sf.ftype = SFclsGeomType.Reg; GRegion polygon = new GRegion(); AnyLine circle = new AnyLine(); circle.Arcs = new Arc[1]; circle.Arcs[0] = new Arc(); circle.Arcs[0].Dots = (m_targetGeo as ZDIMS.BaseLib.Polygon).Dots; polygon.Rings = new AnyLine[] { circle }; sfGeo.RegGeom = new GRegion[] { polygon }; break; default: sfGeo = null; break; } } } curFGeoType = ActiveMapDoc.ActiveLayerGeoType; if (this.m_featureStyle == null) { this.m_featureStyle = new WebGraphicsInfo(); } this.m_style.Update(); switch (curFGeoType) { case SFclsGeomType.Pnt: this.m_featureStyle.InfoType = GInfoType.PntInfo; PointStyle newPntStyle = this.m_style as PointStyle; this.m_featureStyle.PntInfo = new CPointInfo(); if (newPntStyle.patternAngle.Text == "") { this.m_featureStyle.PntInfo.Angle = 0.0; } else { this.m_featureStyle.PntInfo.Angle = Convert.ToDouble(newPntStyle.patternAngle.Text); } if (newPntStyle.patternColor._TextBoxInput.Text.Split(':')[0] == "") { this.m_featureStyle.PntInfo.Color = 0; } else { this.m_featureStyle.PntInfo.Color = Convert.ToInt32(newPntStyle.patternColor._TextBoxInput.Text.Split(':')[0]); } if (newPntStyle.patternHeight.Text == "") { this.m_featureStyle.PntInfo.SymHeight = 0.0; } else { this.m_featureStyle.PntInfo.SymHeight = Convert.ToDouble(newPntStyle.patternHeight.Text); } if (newPntStyle.patternID._TextBoxInput.Text.Split(':')[0] == "") { this.m_featureStyle.PntInfo.SymID = 0; } else { this.m_featureStyle.PntInfo.SymID = Convert.ToInt32(newPntStyle.patternID._TextBoxInput.Text.Split(':')[0]); } if (newPntStyle.patternWidth.Text == "") { this.m_featureStyle.PntInfo.SymWidth = 0.0; } else { this.m_featureStyle.PntInfo.SymWidth = Convert.ToDouble(newPntStyle.patternWidth.Text); } break; case SFclsGeomType.Lin: this.m_featureStyle.InfoType = GInfoType.LinInfo; LineStyle newLineStyle = this.m_style as LineStyle; this.m_featureStyle.LinInfo = new CLineInfo(); if (newLineStyle.color._TextBoxInput.Text.Split(':')[0] == "") { this.m_featureStyle.LinInfo.Color = 0; } else { this.m_featureStyle.LinInfo.Color = Convert.ToInt32(newLineStyle.color._TextBoxInput.Text.Split(':')[0]); } if (newLineStyle.patternID._TextBoxInput.Text.Split(':')[0] == "") { this.m_featureStyle.LinInfo.LinStyleID = 0; } else { this.m_featureStyle.LinInfo.LinStyleID = Convert.ToInt32(newLineStyle.patternID._TextBoxInput.Text.Split(':')[0]); } if (newLineStyle.patternID2._TextBoxInput.Text.Split(':')[0] == "") { this.m_featureStyle.LinInfo.LinStyleID2 = 0; } else { this.m_featureStyle.LinInfo.LinStyleID2 = Convert.ToInt32(newLineStyle.patternID2._TextBoxInput.Text.Split(':')[0]); } if (newLineStyle.penWidth.Text == "") { this.m_featureStyle.LinInfo.LinWidth = 0.0; } else { this.m_featureStyle.LinInfo.LinWidth = Convert.ToDouble(newLineStyle.penWidth.Text); } if (newLineStyle.lineScaleX.Text == "") { this.m_featureStyle.LinInfo.Xscale = 0.0; } else { this.m_featureStyle.LinInfo.Xscale = Convert.ToDouble(newLineStyle.lineScaleX.Text); } if (newLineStyle.lineScaleY.Text == "") { this.m_featureStyle.LinInfo.Yscale = 0.0; } else { this.m_featureStyle.LinInfo.Yscale = Convert.ToDouble(newLineStyle.lineScaleY.Text); } break; case SFclsGeomType.Reg: this.m_featureStyle.InfoType = GInfoType.RegInfo; PolygonStyle newRegStyle = this.m_style as PolygonStyle; this.m_featureStyle.RegInfo = new CRegionInfo(); if (newRegStyle.fillcolor._TextBoxInput.Text.Split(':')[0] == "") { this.m_featureStyle.RegInfo.FillColor = 0; } else { this.m_featureStyle.RegInfo.FillColor = Convert.ToInt32(newRegStyle.fillcolor._TextBoxInput.Text.Split(':')[0]); } if (newRegStyle.patternColor._TextBoxInput.Text.Split(':')[0] == "") { this.m_featureStyle.RegInfo.PatColor = 0; } else { this.m_featureStyle.RegInfo.PatColor = Convert.ToInt32(newRegStyle.patternColor._TextBoxInput.Text.Split(':')[0]); } if (newRegStyle.patternHeight.Text == "") { this.m_featureStyle.RegInfo.PatHeight = 0.0; } else { this.m_featureStyle.RegInfo.PatHeight = Convert.ToDouble(newRegStyle.patternHeight.Text); } if (newRegStyle.patternID._TextBoxInput.Text.Split(':')[0] == "") { this.m_featureStyle.RegInfo.PatID = 0; } else { this.m_featureStyle.RegInfo.PatID = Convert.ToInt32(newRegStyle.patternID._TextBoxInput.Text.Split(':')[0]); } if (newRegStyle.patternPenWidth.Text == "") { this.m_featureStyle.RegInfo.OutPenWidth = 0.0; } else { this.m_featureStyle.RegInfo.OutPenWidth = Convert.ToDouble(newRegStyle.patternPenWidth.Text); } if (newRegStyle.patternWidth.Text == "") { this.m_featureStyle.RegInfo.PatWidth = 0.0; } else { this.m_featureStyle.RegInfo.PatWidth = Convert.ToDouble(newRegStyle.patternWidth.Text); } break; } sf.fGeom = sfGeo; sf.FID = m_featureID; fInfo.GInfo = this.m_featureStyle; fInfo.FSet = sf; fInfo.LayerIndex = ActiveMapDoc.ActiveLayerIndex; fInfo.MapName = new COpenMap(); fInfo.MapName.MapName = new string[] { ActiveMapDoc.MapDocName }; return(fInfo); }
private void submit(object sender, RoutedEventArgs e) { if (this.IMSMap == null) { MessageBox.Show("imsmap属性未赋值。"); return; } if ((this.ProjLat_src.Text.Length > 0 && !CommFun.IsNumber(this.ProjLat_src.Text)) || (ProjLat1_src.Text.Length > 0 && !CommFun.IsNumber(this.ProjLat1_src.Text)) || (ProjLat2_src.Text.Length > 0 && !CommFun.IsNumber(this.ProjLat2_src.Text)) || (DLon_src.Text.Length > 0 && !CommFun.IsNumber(this.DLon_src.Text)) || (DLon_des.Text.Length > 0 && !CommFun.IsNumber(this.DLon_des.Text)) || (ProjLat_des.Text.Length > 0 && !CommFun.IsNumber(this.ProjLat_des.Text)) || (ProjLat1_des.Text.Length > 0 && !CommFun.IsNumber(this.ProjLat1_des.Text)) || (ProjLat2_des.Text.Length > 0 && !CommFun.IsNumber(this.ProjLat2_des.Text))) { MessageBox.Show("请输入合法数字!"); return; } param_src = new ProjectParam(); param_des = new ProjectParam(); param_src.ProjLon = Convert.ToDouble(this.DLon_src.Text); this.ProjRate_Scale_src(param_src, 0); this.ProjType_coor_src(param_src, 0); if (param_src.ProjType != EnumType.TYPE_JWD) { this.ProjTypeID_IProjTypeId_src(param_src, 0); this.ProjZoneNO_IZone_src(param_src, 0); this.ProjZoneType_BZoneType_src(param_src, 0); } this.ProjUnit_unit_src(param_src, 0); this.SphereID_ISpheroid_src(param_src, 0); this.ProjAngleUnit_DAngUnit_src(param_src, 0); if (param_src.ProjTypeID == EnumProjType.Lambert || param_src.ProjTypeID == EnumProjType.Albers) { param_src.ProjLat = Convert.ToDouble(this.ProjLat_src.Text); param_src.ProjLat1 = Convert.ToDouble(this.ProjLat1_src.Text); param_src.ProjLat2 = Convert.ToDouble(this.ProjLat2_src.Text); } if (param_src.ProjTypeID == EnumProjType.Polyconic || param_src.ProjTypeID == EnumProjType.Transverse_Mecator) { param_src.ProjLat = Convert.ToDouble(this.ProjLat_src.Text); } param_des.ProjLon = Convert.ToDouble(this.DLon_des.Text); this.ProjRate_Scale_src(param_des, 1); this.ProjType_coor_src(param_des, 1); if (param_des.ProjType != EnumType.TYPE_JWD) { this.ProjTypeID_IProjTypeId_src(param_des, 1); this.ProjZoneNO_IZone_src(param_des, 1); this.ProjZoneType_BZoneType_src(param_des, 1); } this.ProjUnit_unit_src(param_des, 1); this.SphereID_ISpheroid_src(param_des, 1); this.ProjAngleUnit_DAngUnit_src(param_des, 1); if (param_des.ProjTypeID == EnumProjType.Lambert || param_des.ProjTypeID == EnumProjType.Albers) { param_des.ProjLat = Convert.ToDouble(this.ProjLat_des.Text); param_des.ProjLat1 = Convert.ToDouble(this.ProjLat1_des.Text); param_des.ProjLat2 = Convert.ToDouble(this.ProjLat2_des.Text); } if (param_des.ProjTypeID == EnumProjType.Polyconic || param_des.ProjTypeID == EnumProjType.Transverse_Mecator) { param_des.ProjLat = Convert.ToDouble(this.ProjLat_des.Text); } CProjectDots obj = new CProjectDots(); obj.SrcProjParam = param_src; obj.DesProjParm = param_des; Dot_2D dot = new Dot_2D(); dot.x = Convert.ToDouble(this.coorx_src.Text); dot.y = Convert.ToDouble(this.coory_src.Text); obj.InputDots = new Dot_2D[1]; obj.InputDots[0] = new Dot_2D(); obj.InputDots[0] = dot; this._spatial = new SpacialAnalyse(vectorObj); this._spatial.ProjectDots(obj, new UploadStringCompletedEventHandler(onSubmit)); }