//右键单击 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); }
//羽化半径调整,当绘制面面积过小时,羽化半径不能过大 private void spinEditFeather_EditValueChanged(object sender, EventArgs e) { try { if (this.pITerrainModifier != null) { pITerrainModifier.SetFeather((double)this.spinEditFeather.Value); } } catch { MessageBox.Show("发生错误,可能原因:修整范围面积过小,羽化半径设置过大!"); } }
//右键单击 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; }