/// <summary> /// 旋转选中的部件 /// </summary> private void RotateSelectedObject() { string newRotation = null; SceneSceneEditor.RotateSelectedObject(ref newRotation); if (newRotation != null) // 已经改变朝向 { string[] rotations = newRotation.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); int entityCount = -1; SceneSceneEditor.GetSelectedEntityCount(ref entityCount); _AtlObjInfo[] objinfos = new _AtlObjInfo[entityCount]; for (int i = 0; i < entityCount; i++) { int iLogicObjPtr = 0; string objTypeName = string.Empty; m_doc.DocLogical.GetSelectedLogicObjPtr(i, ref iLogicObjPtr, ref objTypeName); _AtlObjInfo atlinfo = new _AtlObjInfo(); atlinfo.bChanged = 1; atlinfo.iLogicObjPtr = iLogicObjPtr; //_AtlObjInfo中要储存iLogicObjPtr entityPtr,方便C#对话框保存时 直接exchange去docLogical, //再用iLogicObjPtr之逻辑更新entityPtr指向的表现。 m_doc.DocLogical.GetSetObjInfo(objTypeName, ref atlinfo, iLogicObjPtr, 1); objinfos[i] = atlinfo; // 写入新的旋转角度信息 for (int j = 0; j < atlinfo.iFieldsCount; j++) { if (atlinfo.strFields[j] == "vRotation") { atlinfo.strValues[j] = newRotation; } else if (atlinfo.strFields[j] == "nFaceDirection") { atlinfo.strValues[j] = ConvertRotationToDirection(rotations[i]); } } // 更新对象数据 m_doc.DocLogical.GetSetObjInfo(atlinfo.strType, ref atlinfo, atlinfo.iLogicObjPtr, 0); m_doc.DocLogical.UpdateObjRepresentByLogicObj(ref atlinfo, atlinfo.iLogicObjPtr); } } }