bool sgworld_OnRButtonDown(int Flags, int X, int Y) { if (LClickCount <= 2) { MessageBox.Show("绘制三个以上点构造面!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.SgWorld.Creator.DeleteObject(pITerrainPolygon.ID); pITerrainPolygon = null; return(true); } if (pbhander == "modify" && pITerrainPolygon != null && this.earth != 0) { string Volum = "填挖方分析" + System.Guid.NewGuid().ToString().Substring(0, 6); IGeometry pIGeometry = pITerrainPolygon.Geometry; // ABhigh = pITerrainPolygon.Position.Altitude; pITerrainModifier = this.SgWorld.Creator.CreateTerrainModifier(pIGeometry, ElevationBehaviorMode.EB_REPLACE, true, 0, 0, Volum); pITerrainModifier.Position.AltitudeType = AltitudeTypeCode.ATC_TERRAIN_RELATIVE; pITerrainModifier.Position.Altitude = this.earth; this.SgWorld.Creator.DeleteObject(pITerrainPolygon.ID); pITerrainPolygon = null; String[] cVerticesArray = null; int pobjitemid = this.SgWorld.ProjectTree.FindItem(Volum); String pObjid = this.SgWorld.ProjectTree.GetTerraObjectID(pobjitemid); cVerticesArray = new String[] { pObjid }; IVolumeAnalysisInfo61 pIVolumeAnalysisInfo = this.SgWorld.Analysis.CalculateVolume(cVerticesArray, 0.5); this.label1.Text = "【土方】增加:" + Math.Round(pIVolumeAnalysisInfo.AddedCubicMeters, 3).ToString() + "立方米" + "||减少:" + Math.Round(pIVolumeAnalysisInfo.RemovedCubicMeters, 3).ToString() + "立方米"; } pbhander = ""; return(true); }
//右键单击 bool sgworld_OnRButtonDown(int Flags, int X, int Y) { try { if (LClickCount < 3) { DialogResult dr = MessageBox.Show("请绘制三个以上点,是否重新绘制?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.OK) { //重新绘制 if (this.pITerrainPolyline.NumOfVertices != 0) { for (int i = 0; i < this.pITerrainPolyline.NumOfVertices; i++) { this.pITerrainPolyline.DeleteVertex(i); } this.LClickCount = 0; ListVerticsArray.Clear(); (this.TerraExplorer as IRender5).SetMouseInputMode(MouseInputMode.MI_COM_CLIENT); pbhander = "modify"; } } return(true); } else { if (this.pITerrainPolygon != null) { pbhander = ""; (this.SgWorld as _ISGWorld61Events_Event).OnLButtonDown -= new _ISGWorld61Events_OnLButtonDownEventHandler(sgworld_OnLButtonDown); (this.SgWorld as _ISGWorld61Events_Event).OnRButtonDown -= new _ISGWorld61Events_OnRButtonDownEventHandler(sgworld_OnRButtonDown); (this.TerraExplorer as IRender5).SetMouseInputMode(MouseInputMode.MI_FREE_FLIGHT); string Volum = "TerrainModifier" + System.Guid.NewGuid().ToString().Substring(0, 6); pITerrainModifier = this.SgWorld.Creator.CreateTerrainModifier(this.pITerrainPolygon.Geometry, ElevationBehaviorMode.EB_REPLACE, true, 0, GroupID, Volum); pITerrainModifier.Position.AltitudeType = AltitudeTypeCode.ATC_TERRAIN_RELATIVE; pITerrainModifier.Position.Altitude = (double)this.spinEditAlti.Value; pITerrainModifier.SetFeather((double)this.spinEditFeather.Value); pITerrainModifier.SaveInFlyFile = true; this.SgWorld.ProjectTree.DeleteItem(pITerrainPolygon.TreeItem.ItemID); this.simpleButtonCancel.Enabled = true; } } } catch { MessageBox.Show("地形调整失败!"); } return(true); }
bool sgworld_OnRButtonDown(int Flags, int X, int Y) { if (LClickCount<=2) { MessageBox.Show("绘制三个以上点构造面!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information); this.SgWorld.Creator.DeleteObject(pITerrainPolygon.ID); pITerrainPolygon = null; return true; } if (pbhander == "modify" && pITerrainPolygon != null && this.earth != 0 ) { string Volum = "填挖方分析" + System.Guid.NewGuid().ToString().Substring(0, 6); IGeometry pIGeometry = pITerrainPolygon.Geometry; // ABhigh = pITerrainPolygon.Position.Altitude; pITerrainModifier = this.SgWorld.Creator.CreateTerrainModifier(pIGeometry, ElevationBehaviorMode.EB_REPLACE, true, 0, 0, Volum); pITerrainModifier.Position.AltitudeType = AltitudeTypeCode.ATC_TERRAIN_RELATIVE; pITerrainModifier.Position.Altitude = this.earth; this.SgWorld.Creator.DeleteObject(pITerrainPolygon.ID); pITerrainPolygon = null; String[] cVerticesArray = null; int pobjitemid = this.SgWorld.ProjectTree.FindItem(Volum); String pObjid = this.SgWorld.ProjectTree.GetTerraObjectID(pobjitemid); cVerticesArray = new String[] { pObjid }; IVolumeAnalysisInfo61 pIVolumeAnalysisInfo = this.SgWorld.Analysis.CalculateVolume(cVerticesArray, 0.5); this.label1.Text = "【土方】增加:" + Math.Round(pIVolumeAnalysisInfo.AddedCubicMeters,3).ToString() + "立方米" + "||减少:" + Math.Round(pIVolumeAnalysisInfo.RemovedCubicMeters,3).ToString() + "立方米"; } pbhander = ""; return true; }
//右键单击 bool sgworld_OnRButtonDown(int Flags, int X, int Y) { try { if (LClickCount < 3) { DialogResult dr = MessageBox.Show("请绘制三个以上点,是否重新绘制?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.OK) { //重新绘制 if (this.pITerrainPolyline.NumOfVertices != 0) { for (int i = 0; i < this.pITerrainPolyline.NumOfVertices; i++) this.pITerrainPolyline.DeleteVertex(i); this.LClickCount = 0; ListVerticsArray.Clear(); (this.TerraExplorer as IRender5).SetMouseInputMode(MouseInputMode.MI_COM_CLIENT); pbhander = "modify"; } } return true; } else { if (this.pITerrainPolygon != null) { pbhander = ""; (this.SgWorld as _ISGWorld61Events_Event).OnLButtonDown -= new _ISGWorld61Events_OnLButtonDownEventHandler(sgworld_OnLButtonDown); (this.SgWorld as _ISGWorld61Events_Event).OnRButtonDown -= new _ISGWorld61Events_OnRButtonDownEventHandler(sgworld_OnRButtonDown); (this.TerraExplorer as IRender5).SetMouseInputMode(MouseInputMode.MI_FREE_FLIGHT); string Volum = "TerrainModifier" + System.Guid.NewGuid().ToString().Substring(0, 6); pITerrainModifier = this.SgWorld.Creator.CreateTerrainModifier(this.pITerrainPolygon.Geometry, ElevationBehaviorMode.EB_REPLACE, true, 0, GroupID, Volum); pITerrainModifier.Position.AltitudeType = AltitudeTypeCode.ATC_TERRAIN_RELATIVE; pITerrainModifier.Position.Altitude = (double)this.spinEditAlti.Value; pITerrainModifier.SetFeather((double)this.spinEditFeather.Value); pITerrainModifier.SaveInFlyFile = true; this.SgWorld.ProjectTree.DeleteItem(pITerrainPolygon.TreeItem.ItemID); this.simpleButtonCancel.Enabled = true; } } } catch { MessageBox.Show("地形调整失败!"); } return true; }