/// <summary> /// 闪烁查询到要素 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void flashFeature(object sender, UploadStringCompletedEventArgs e) { geoObj = this.IMSCatalog.ActiveLayerObj.OnGetGeomByFID(e); if (geoObj == null) { return; } List <Point> pntArr = new List <Point>(); for (int i = 0; i < geoObj.RegGeom[0].Rings.Length; i++) { for (int j = 0; j < geoObj.RegGeom[0].Rings[i].Arcs.Length; j++) { for (int k = 0; k < geoObj.RegGeom[0].Rings[i].Arcs[j].Dots.Length; k++) { pntArr.Add(new Point(geoObj.RegGeom[0].Rings[i].Arcs[j].Dots[k].x, geoObj.RegGeom[0].Rings[i].Arcs[j].Dots[k].y)); } } } if (pntArr[0].X <this.IMSCatalog.ActiveLayerObj.MapContainer.WinViewBound.XMin || pntArr[0].X> this.IMSCatalog.ActiveLayerObj.MapContainer.WinViewBound.XMax || pntArr[0].Y <this.IMSCatalog.ActiveLayerObj.MapContainer.WinViewBound.YMin || pntArr[0].Y> this.IMSCatalog.ActiveLayerObj.MapContainer.WinViewBound.YMax) { this.IMSCatalog.ActiveLayerObj.MapContainer.PanTo(pntArr[0].X, pntArr[0].Y); } m_graphics = new IMSPolygon(CoordinateType.Logic) { Points = pntArr }; m_graphicsLayer.AddGraphics(m_graphics); m_graphics.FlickerOverCallback = new GraphicsFlickerOverDelegate(FlickerOverCallback); m_graphics.Draw(); m_graphics.Flicker(); }
public LayerTopAnalyse() { InitializeComponent(); _firstFeature = null; _secondFeature = null; geoObj = null; this.radioButton1.Content = "获取第一个区要素(未选取)"; this.radioButton2.Content = "获取第二个区要素(未选取)"; this.myDialog.OnClose += close; }
private void onGetFeatureByID(object sender, UploadStringCompletedEventArgs e) { SFeature sf = m_catalog.ActiveMapDoc.OnGetFeatureByID(e); CAttDataRow[] drArr = new CAttDataRow[1]; drArr[0] = new CAttDataRow(); drArr[0].Values = sf.AttValue; this.m_bufferControl.setTargetattRows(drArr); SFeatureGeometry[] sfGeoArr = new SFeatureGeometry[1]; sfGeoArr[0] = sf.fGeom; this.m_bufferControl.setTargetsfGeometry(sfGeoArr); this.m_bufferControl.Show(); }
//拓扑分析结果 private void onSubmit(object sender, UploadStringCompletedEventArgs e) { string data = this._spatial.OnRegionRelationAnalyse(e).ToString(); switch (data) { case "Unknown": data = "未知类型"; break; case "Intersect": data = "相交"; break; case "Disjoin": data = "相离"; break; case "Include": data = "包含"; break; case "Adjacent": data = "相邻"; break; default: data = "未知类型"; break; } //地图跳转到某个位置 if (this.TFlag == 1) { this.iMSMap1.PanTo(114.24202324169921, 30.63291477441406); } else if (this.TFlag == 2) { this.iMSMap1.PanTo(114.2513662524414, 30.4964335390625); } else if (this.TFlag == 3) { this.iMSMap1.PanTo(114.25081666357421, 30.56174301611328); } _firstFeature = null; _secondFeature = null; this.topResult.Content = data; }
/// <summary> /// 闪烁完毕回调 /// </summary> /// <param name="g"></param> private void FlickerOverCallback(GraphicsBase g) { m_graphicsLayer.RemoveGraphics(m_graphics); m_graphics = null; if (MessageBox.Show("查询成功。是否添加该要素?", "查询并闪烁成功", MessageBoxButton.OKCancel) == MessageBoxResult.OK)//"提示",Alert.YES|Alert.NO , this , onAlert , null , Alert.NO); { if (set == 0) { this._firstFeature = geoObj; this.radioButton1.Content = "获取第一个区要素(已获取)"; } if (set == 1) { this._secondFeature = geoObj; this.radioButton2.Content = "获取第二个区要素(已获取)"; } } }
//获取第二个要素回调函数 public void SelectgetGemos(object sender, UploadStringCompletedEventArgs e) { SFeatureGeometry SelectresutltGemo = this.mapDoc.OnGetGeomByID(e); if (SelectresutltGemo != null) { this._secondFeature = SelectresutltGemo; //显示拓扑分析的第二个要素 this._secondPoly = drawGetFeature(SelectresutltGemo); //拓扑分析 onTopSpanalyse(); } else { MessageBox.Show("获取第二个要素失败!"); return; } }
private void updateLayerStatus(object sender, UploadStringCompletedEventArgs e) { //实例化第一个拓扑分析的要素 _firstFeature = new SFeatureGeometry(); //实例化第二个拓扑分析的要素 _secondFeature = new SFeatureGeometry(); //实例化第一个拓扑分析要素的显示区的对象 _firstPoly = new IMSPolygon(); //实例化第二个拓扑分析要素的县市区的对象 _secondPoly = new IMSPolygon(); //根据要素id获取需要的数据 CGetObjByID targetObj = new CGetObjByID(); //设置第一个要素的id targetObj.FeatureID = firstFeatID; //设置第一个要素所在的图层号 targetObj.LayerIndex = 1; //获取第一个要素空间信息 this.mapDoc.GetGeomByID(targetObj, FirstgetGemos); }
public IMSPolygon drawGetFeature(SFeatureGeometry sfeatureTemp) { GRegion reg = sfeatureTemp.RegGeom[0]; AnyLine arcLine = reg.Rings[0]; Arc arc = arcLine.Arcs[0]; //获取要素边界的点 Dot_2D[] Arcpnts = arc.Dots; int arcpntNum = Arcpnts.Length; //绘制多边形 IMSPolygon poly = new IMSPolygon(CoordinateType.Logic); m_gpLayer.AddGraphics(poly); for (int i = 0; i < arcpntNum; i++) { poly.Points.Add(new Point(arc.Dots[i].x, arc.Dots[i].y)); } poly.Draw(); return(poly); }
/// <summary> /// 获取拓扑分析结果 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void onSubmit(object sender, UploadStringCompletedEventArgs e) { string data = this._spatial.OnRegionRelationAnalyse(e).ToString(); switch (data) { case "Unknown": data = "未知类型"; break; case "Intersect": data = "相交"; break; case "Disjoin": data = "相离"; break; case "Include": data = "包含"; break; case "Adjacent": data = "相邻"; break; default: data = "未知类型"; break; } this.topRlt.Content = data; _firstFeature = null; _secondFeature = null; radioButton1.IsChecked = false; radioButton2.IsChecked = false; this.radioButton1.Content = "获取第一个区要素(未选取)"; this.radioButton2.Content = "获取第二个区要素(未选取)"; }
public void FirstgetGemos(object sender, UploadStringCompletedEventArgs e) { SFeatureGeometry FirstResultFeature = this.mapDoc.OnGetGeomByID(e); if (FirstResultFeature != null) { this._firstFeature = FirstResultFeature; this._firstPoly = drawGetFeature(FirstResultFeature); //获取第二个要素的空间信息 CGetObjByID targetObj2 = new CGetObjByID(); //设置拓扑分析的第二个要素的id targetObj2.FeatureID = this.secondFeatID; //设置第二个要素所在的图层号 targetObj2.LayerIndex = 1; //获取第二个要素空间信息 this.mapDoc.GetGeomByID(targetObj2, SelectgetGemos); } else { MessageBox.Show("获取第一个要素失败!"); return; } }
/// <summary> /// 闪烁图形 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FlashFeature(object sender, UploadStringCompletedEventArgs e) { try { m_featureGeo = activeMapDoc.OnGetGeomByID(e); } catch (Exception ex) { MessageBox.Show("获取该要素空间信息失败!" + ex.Message); return; } bool flg = false; if (m_featureGeo.LinGeom != null && m_featureGeo.LinGeom.Length > 0) { List <Point> pntArr = new List <Point>(); for (int i = 0; i < m_featureGeo.LinGeom.Length; i++) { for (int j = 0; j < m_featureGeo.LinGeom[i].Line.Arcs.Length; j++) { for (int k = 0; k < m_featureGeo.LinGeom[i].Line.Arcs[j].Dots.Length; k++) { pntArr.Add(new Point(m_featureGeo.LinGeom[i].Line.Arcs[j].Dots[k].x, m_featureGeo.LinGeom[i].Line.Arcs[j].Dots[k].y)); } } } if (pntArr[0].X <activeMapDoc.MapContainer.WinViewBound.XMin || pntArr[0].X> activeMapDoc.MapContainer.WinViewBound.XMax || pntArr[0].Y <activeMapDoc.MapContainer.WinViewBound.YMin || pntArr[0].Y> activeMapDoc.MapContainer.WinViewBound.YMax) { activeMapDoc.MapContainer.PanTo(pntArr[0].X, pntArr[0].Y); } m_graphics = new IMSPolyline(CoordinateType.Logic) { Points = pntArr, StrokeThickness = 4 }; flg = true; } if (m_featureGeo.PntGeom != null && m_featureGeo.PntGeom.Length > 0) { if (m_featureGeo.PntGeom[0].Dot.x <activeMapDoc.MapContainer.WinViewBound.XMin || m_featureGeo.PntGeom[0].Dot.x> activeMapDoc.MapContainer.WinViewBound.XMax || m_featureGeo.PntGeom[0].Dot.y <activeMapDoc.MapContainer.WinViewBound.YMin || m_featureGeo.PntGeom[0].Dot.y> activeMapDoc.MapContainer.WinViewBound.YMax) { activeMapDoc.MapContainer.PanTo(m_featureGeo.PntGeom[0].Dot.x, m_featureGeo.PntGeom[0].Dot.y); } m_graphics = new IMSCircle(CoordinateType.Logic) { CenX = m_featureGeo.PntGeom[0].Dot.x, CenY = m_featureGeo.PntGeom[0].Dot.y, RadiusEx = 6 }; flg = true; } if (m_featureGeo.RegGeom != null && m_featureGeo.RegGeom.Length > 0) { List <Point> pntArr = new List <Point>(); for (int i = 0; i < m_featureGeo.RegGeom[0].Rings.Length; i++) { for (int j = 0; j < m_featureGeo.RegGeom[0].Rings[i].Arcs.Length; j++) { for (int k = 0; k < m_featureGeo.RegGeom[0].Rings[i].Arcs[j].Dots.Length; k++) { pntArr.Add(new Point(m_featureGeo.RegGeom[0].Rings[i].Arcs[j].Dots[k].x, m_featureGeo.RegGeom[0].Rings[i].Arcs[j].Dots[k].y)); } } } if (pntArr[0].X <activeMapDoc.MapContainer.WinViewBound.XMin || pntArr[0].X> activeMapDoc.MapContainer.WinViewBound.XMax || pntArr[0].Y <activeMapDoc.MapContainer.WinViewBound.YMin || pntArr[0].Y> activeMapDoc.MapContainer.WinViewBound.YMax) { activeMapDoc.MapContainer.PanTo(pntArr[0].X, pntArr[0].Y); } m_graphics = new IMSPolygon(CoordinateType.Logic) { Points = pntArr }; flg = true; } if (flg) { m_graphicsLayer.AddGraphics(m_graphics); m_graphics.FlickerOverCallback = new GraphicsFlickerOverDelegate(FlickerOverCallback); m_graphics.Draw(); m_graphics.Flicker(); } }
/// <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 SubmitForEdit(object sender, RoutedEventArgs e) { if (GraphicsLayer != null && m_graphics != null) { SFeatureGeometry geoObj = m_targetGeo as SFeatureGeometry; int n = 0; if (geoObj != null) { if (geoObj.LinGeom != null && geoObj.LinGeom.Length > 0) { List <Point> pntArr = new List <Point>(); for (int i = 0; i < geoObj.LinGeom.Length; i++) { for (int j = 0; j < geoObj.LinGeom[i].Line.Arcs.Length; j++) { for (int k = 0; k < geoObj.LinGeom[i].Line.Arcs[j].Dots.Length; k++) { geoObj.LinGeom[i].Line.Arcs[j].Dots[k].x = m_graphics.Points[n].X; geoObj.LinGeom[i].Line.Arcs[j].Dots[k].y = m_graphics.Points[n++].Y; } } } } if (geoObj.PntGeom != null && geoObj.PntGeom.Length > 0) { geoObj.PntGeom[0].Dot.x = m_graphics.Points[0].X; geoObj.PntGeom[0].Dot.y = m_graphics.Points[0].Y; } if (geoObj.RegGeom != null && geoObj.RegGeom.Length > 0) { List <Point> pntArr = new List <Point>(); for (int i = 0; i < geoObj.RegGeom[0].Rings.Length; i++) { for (int j = 0; j < geoObj.RegGeom[0].Rings[i].Arcs.Length; j++) { for (int k = 0; k < geoObj.RegGeom[0].Rings[i].Arcs[j].Dots.Length; k++) { geoObj.RegGeom[0].Rings[i].Arcs[j].Dots[k].x = m_graphics.Points[n].X; geoObj.RegGeom[0].Rings[i].Arcs[j].Dots[k].y = m_graphics.Points[n++].Y; } } } } } GraphicsLayer.RemoveGraphics(m_graphics); m_graphics = null; } CMapFeatureInfo fIno = GetMapFeatureInfo(); if (fIno == null) { return; } ActiveMapDoc.UpdateFeature(fIno, new UploadStringCompletedEventHandler((s, evt) => { if (m_mapDocDataViewer != null) { m_mapDocDataViewer.UpdateRecord(fIno.FSet.AttValue); } GetEditOperResult(s, evt); })); }
private void DrawFeature(object sender, UploadStringCompletedEventArgs e) { SFeatureGeometry geoObj = null; try { geoObj = ActiveMapDoc.OnGetGeomByID(e); } catch (Exception ex) { MessageBox.Show("获取该要素空间信息失败!" + ex.Message); return; } m_targetGeo = geoObj; bool flg = false; if (geoObj.LinGeom != null && geoObj.LinGeom.Length > 0) { List <Point> pntArr = new List <Point>(); for (int i = 0; i < geoObj.LinGeom.Length; i++) { for (int j = 0; j < geoObj.LinGeom[i].Line.Arcs.Length; j++) { for (int k = 0; k < geoObj.LinGeom[i].Line.Arcs[j].Dots.Length; k++) { pntArr.Add(new Point(geoObj.LinGeom[i].Line.Arcs[j].Dots[k].x, geoObj.LinGeom[i].Line.Arcs[j].Dots[k].y)); } } } if (pntArr[0].X <ActiveMapDoc.MapContainer.WinViewBound.XMin || pntArr[0].X> ActiveMapDoc.MapContainer.WinViewBound.XMax || pntArr[0].Y <ActiveMapDoc.MapContainer.WinViewBound.YMin || pntArr[0].Y> ActiveMapDoc.MapContainer.WinViewBound.YMax) { ActiveMapDoc.MapContainer.PanTo(pntArr[0].X, pntArr[0].Y); } m_graphics = new IMSPolyline(CoordinateType.Logic) { Points = pntArr, StrokeThickness = 4 }; flg = true; } if (geoObj.PntGeom != null && geoObj.PntGeom.Length > 0) { if (geoObj.PntGeom[0].Dot.x <ActiveMapDoc.MapContainer.WinViewBound.XMin || geoObj.PntGeom[0].Dot.x> ActiveMapDoc.MapContainer.WinViewBound.XMax || geoObj.PntGeom[0].Dot.y <ActiveMapDoc.MapContainer.WinViewBound.YMin || geoObj.PntGeom[0].Dot.y> ActiveMapDoc.MapContainer.WinViewBound.YMax) { ActiveMapDoc.MapContainer.PanTo(geoObj.PntGeom[0].Dot.x, geoObj.PntGeom[0].Dot.y); } m_graphics = new IMSCircle(CoordinateType.Logic) { CenX = geoObj.PntGeom[0].Dot.x, CenY = geoObj.PntGeom[0].Dot.y, RadiusEx = 6 }; flg = true; } if (geoObj.RegGeom != null && geoObj.RegGeom.Length > 0) { List <Point> pntArr = new List <Point>(); for (int i = 0; i < geoObj.RegGeom[0].Rings.Length; i++) { for (int j = 0; j < geoObj.RegGeom[0].Rings[i].Arcs.Length; j++) { for (int k = 0; k < geoObj.RegGeom[0].Rings[i].Arcs[j].Dots.Length; k++) { pntArr.Add(new Point(geoObj.RegGeom[0].Rings[i].Arcs[j].Dots[k].x, geoObj.RegGeom[0].Rings[i].Arcs[j].Dots[k].y)); } } } if (pntArr[0].X <ActiveMapDoc.MapContainer.WinViewBound.XMin || pntArr[0].X> ActiveMapDoc.MapContainer.WinViewBound.XMax || pntArr[0].Y <ActiveMapDoc.MapContainer.WinViewBound.YMin || pntArr[0].Y> ActiveMapDoc.MapContainer.WinViewBound.YMax) { ActiveMapDoc.MapContainer.PanTo(pntArr[0].X, pntArr[0].Y); } m_graphics = new IMSPolygon(CoordinateType.Logic) { Points = pntArr }; flg = true; } if (flg) { GraphicsLayer.AddGraphics(m_graphics); m_graphics.EnableEdit = true; m_graphics.EnableEditMark2 = false; m_graphics.Draw(); } }
private void DrawFeature(object sender, UploadStringCompletedEventArgs e) { SFeatureGeometry geoObj = ActiveLayerObj.OnGetGeomByFID(e); m_targetGeo = geoObj; bool flg = false; //RectBound rect = new RectBound(double.MaxValue, double.MaxValue, double.MinValue, double.MinValue); if (geoObj.LinGeom != null && geoObj.LinGeom.Length > 0) { List <Point> pntArr = new List <Point>(); for (int i = 0; i < geoObj.LinGeom.Length; i++) { for (int j = 0; j < geoObj.LinGeom[i].Line.Arcs.Length; j++) { for (int k = 0; k < geoObj.LinGeom[i].Line.Arcs[j].Dots.Length; k++) { pntArr.Add(new Point(geoObj.LinGeom[i].Line.Arcs[j].Dots[k].x, geoObj.LinGeom[i].Line.Arcs[j].Dots[k].y)); } } } if (pntArr[0].X <ActiveLayerObj.MapContainer.WinViewBound.XMin || pntArr[0].X> ActiveLayerObj.MapContainer.WinViewBound.XMax || pntArr[0].Y <ActiveLayerObj.MapContainer.WinViewBound.YMin || pntArr[0].Y> ActiveLayerObj.MapContainer.WinViewBound.YMax) { ActiveLayerObj.MapContainer.PanTo(pntArr[0].X, pntArr[0].Y); } //(ActiveLayerObj.MapContainer as IMSMap).JumpByRectBound( m_graphics = new IMSPolyline(CoordinateType.Logic) { Points = pntArr, StrokeThickness = 4 }; flg = true; } if (geoObj.PntGeom != null && geoObj.PntGeom.Length > 0) { if (geoObj.PntGeom[0].Dot.x <ActiveLayerObj.MapContainer.WinViewBound.XMin || geoObj.PntGeom[0].Dot.x> ActiveLayerObj.MapContainer.WinViewBound.XMax || geoObj.PntGeom[0].Dot.y <ActiveLayerObj.MapContainer.WinViewBound.YMin || geoObj.PntGeom[0].Dot.y> ActiveLayerObj.MapContainer.WinViewBound.YMax) { ActiveLayerObj.MapContainer.PanTo(geoObj.PntGeom[0].Dot.x, geoObj.PntGeom[0].Dot.y); } m_graphics = new IMSCircle(CoordinateType.Logic) { CenX = geoObj.PntGeom[0].Dot.x, CenY = geoObj.PntGeom[0].Dot.y, RadiusEx = 6 }; flg = true; } if (geoObj.RegGeom != null && geoObj.RegGeom.Length > 0) { List <Point> pntArr = new List <Point>(); for (int i = 0; i < geoObj.RegGeom[0].Rings.Length; i++) { for (int j = 0; j < geoObj.RegGeom[0].Rings[i].Arcs.Length; j++) { for (int k = 0; k < geoObj.RegGeom[0].Rings[i].Arcs[j].Dots.Length; k++) { pntArr.Add(new Point(geoObj.RegGeom[0].Rings[i].Arcs[j].Dots[k].x, geoObj.RegGeom[0].Rings[i].Arcs[j].Dots[k].y)); } } } if (pntArr[0].X <ActiveLayerObj.MapContainer.WinViewBound.XMin || pntArr[0].X> ActiveLayerObj.MapContainer.WinViewBound.XMax || pntArr[0].Y <ActiveLayerObj.MapContainer.WinViewBound.YMin || pntArr[0].Y> ActiveLayerObj.MapContainer.WinViewBound.YMax) { ActiveLayerObj.MapContainer.PanTo(pntArr[0].X, pntArr[0].Y); } m_graphics = new IMSPolygon(CoordinateType.Logic) { Points = pntArr }; flg = true; } if (flg) { GraphicsLayer.AddGraphics(m_graphics); m_graphics.EnableEdit = true; m_graphics.EnableEditMark2 = false; m_graphics.Draw(); } }