private void RoateGeometry() { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } double num = double.Parse(this.spinEditX.EditValue.ToString()); double num2 = double.Parse(this.spinEditY.EditValue.ToString()); double num3 = double.Parse(this.spinEditZ.EditValue.ToString()); if (num == 0.0 && num2 == 0.0 && num3 == 0.0) { return; } num = 3.14 * num / 180.0; num2 = 3.14 * num2 / 180.0; num3 = 3.14 * num3 / 180.0; if (this._connInfo == null || this._oid == -1) { return; } Gvitech.CityMaker.FdeCore.IFeatureClass featureClass = null; try { featureClass = this._connInfo.GetFeatureClass(); IFeatureLayer featureLayer = this._connInfo.GetFeatureLayer(); Gvitech.CityMaker.FdeCore.IRowBuffer row = featureClass.GetRow(this._oid); int num4 = row.FieldIndex(featureLayer.GeometryFieldName); if (num4 != -1) { IGeometry geometry = row.GetValue(num4) as IGeometry; if (geometry != null) { IVector3 vector = new Vector3Class(); vector.Set(1.0, 0.0, 0.0); app.Current3DMapControl.ObjectEditor.Rotate(vector, geometry.Envelope.Center, num); vector.Set(0.0, 1.0, 0.0); app.Current3DMapControl.ObjectEditor.Rotate(vector, geometry.Envelope.Center, num2); vector.Set(0.0, 0.0, 1.0); app.Current3DMapControl.ObjectEditor.Rotate(vector, geometry.Envelope.Center, num3); } } } catch (System.Exception) { } finally { //if (featureClass != null) //{ // System.Runtime.InteropServices.Marshal.ReleaseComObject(featureClass); // featureClass = null; //} } }
private void RoateSelection() { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } double num = double.Parse(this.spinEditX.EditValue.ToString()); double num2 = double.Parse(this.spinEditY.EditValue.ToString()); double num3 = double.Parse(this.spinEditZ.EditValue.ToString()); if (num == 0.0 && num2 == 0.0 && num3 == 0.0) { return; } num = 3.14 * num / 180.0; num2 = 3.14 * num2 / 180.0; num3 = 3.14 * num3 / 180.0; System.Collections.Generic.Dictionary <DF3DFeatureClass, IRowBufferCollection> rowBuffers = this.GetRowBuffers(); if (rowBuffers.Count < 1) { return; } IEnvelope selectEnvelope = SelectCollection.Instance().GetSelectEnvelope(SelectCollection.Instance().FcRowBuffersMap); double centerX = 0.0; double centerY = 0.0; double centerZ = 0.0; if (selectEnvelope != null) { centerX = (selectEnvelope.MinX + selectEnvelope.MaxX) / 2.0; centerY = (selectEnvelope.MinY + selectEnvelope.MaxY) / 2.0; centerZ = (selectEnvelope.MinZ + selectEnvelope.MaxZ) / 2.0; } foreach (DF3DFeatureClass current in rowBuffers.Keys) { Gvitech.CityMaker.FdeCore.IFeatureClass featureClass = current.GetFeatureClass(); IFeatureLayer featureLayer = current.GetFeatureLayer(); IRowBufferCollection rowBufferCollection = rowBuffers[current]; for (int i = 0; i < rowBufferCollection.Count; i++) { Gvitech.CityMaker.FdeCore.IRowBuffer rowBuffer = rowBufferCollection.Get(i); int position = rowBuffer.FieldIndex(featureLayer.GeometryFieldName); IGeometry geometry = rowBuffer.GetValue(position) as IGeometry; ITransform transform = geometry as ITransform; if (geometry != null && transform != null) { if (this._editType == RenderEditorType.RotateCenterType) { IEnvelope envelope = geometry.Envelope; centerX = (envelope.MinX + envelope.MaxX) / 2.0; centerY = (envelope.MinY + envelope.MaxY) / 2.0; centerZ = (envelope.MinZ + envelope.MaxZ) / 2.0; } if (geometry.HasZ()) { transform.Rotate3D(1.0, 0.0, 0.0, centerX, centerY, centerZ, num); transform.Rotate3D(0.0, 1.0, 0.0, centerX, centerY, centerZ, num2); transform.Rotate3D(0.0, 0.0, 1.0, centerX, centerY, centerZ, num3); } else { transform.Rotate2D(centerX, centerY, num3); } rowBuffer.SetValue(position, transform); } } app.Current3DMapControl.FeatureManager.EditFeatures(featureClass, rowBufferCollection); //System.Runtime.InteropServices.Marshal.ReleaseComObject(featureClass); } RenderControlEditServices.Instance().SetEditorPosition(SelectCollection.Instance().FcRowBuffersMap); this.UpdateDatabase(rowBuffers); }