00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc. 00002 // 00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., 00004 // and considered a trade secret as defined under civil and criminal statutes. 00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of 00006 // unauthorized use or misappropriation of its trade secrets. Use of this information 00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under 00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use. 00009 00013 #ifndef _HUTILITYGEOMHANDLE_H 00014 #define _HUTILITYGEOMHANDLE_H 00015 00016 #ifdef H_PACK_8 00017 #pragma pack(push) 00018 #pragma pack(8) 00019 #endif 00020 00021 #include "HTools.h" 00022 #include "HUtilityAnnotation.h" 00023 #include "hic_types.h" 00024 00025 class HPoint; 00026 class HBaseView; 00027 00028 00032 enum HConstrainType 00033 { 00034 HConstrainNone, 00035 HConstrainToRay, 00036 HConstrainToRotationVector, 00037 HConstrainToPlane, 00038 HConstrainToViewplane, 00039 HConstrainToScale, 00040 HConstrainToOnOff 00041 }; 00042 00043 00044 00046 00054 class MVO_API HUtilityGeomHandle 00055 { 00056 public: 00057 00058 00059 virtual ~HUtilityGeomHandle() { }; 00060 00062 static void RegisterCallbacks(); 00063 00070 virtual HC_KEY Insert(HPoint position, bool edges = false, int level = 4); 00071 00075 virtual void SetupGeomHandleSegment(bool edges); 00076 00084 virtual void ConstrainToPlane(HC_KEY handlekey, HPoint p1, HPoint p2, HPoint p3,HBaseView *view = 0); 00085 00089 virtual void ConstrainToViewplane(HC_KEY handlekey,HBaseView *view = 0); 00090 00096 virtual void ConstrainToRay(HC_KEY handlekey, HPoint p1, HPoint p2, HBaseView *view = 0); 00097 00103 virtual void ConstrainToRotationVector(HC_KEY handlekey, HPoint p1, HPoint p2,HBaseView *view = 0); 00104 00110 virtual void ConstrainToScale(HC_KEY handlekey, HPoint p1, HPoint p2,HBaseView *view = 0); 00111 00115 virtual void ConstrainToOnOff(HC_KEY handlekey,HBaseView *view = 0); 00116 00123 virtual void Move(HC_KEY handlekey, HPoint newposition, HC_KEY camerakey, HBaseView *view = 0); 00124 00125 00130 virtual void ShowBasePosition(HC_KEY handlekey, HPoint &bp); 00131 00136 virtual void GetConstraintParameters(HC_KEY handlekey); 00137 00142 void Rotate(HC_KEY handlekey, float rotangle); 00143 00150 virtual float CalculatePlaneZ(HC_KEY handlekey, HPoint point); 00151 00152 00159 virtual void AdjustPositionToRay(HC_KEY handlekey, HPoint &C, HPoint A, HPoint B); 00160 00170 virtual void CalculatePositionOnPlane(HC_KEY handlekey, HPoint &p, float a, float b, float c, float d); 00171 00172 00179 void AdjustPointToRay(HC_KEY geomhandlekey, HPoint &p, HC_KEY camerasegment, HBaseView *view); 00180 00191 virtual void AdjustPositionToPlane(HC_KEY handlekey, HPoint &p, float a, float b, float c, float d, HC_KEY camerakey); 00192 00197 static HC_KEY IsGeomHandle(HC_KEY key); 00198 00199 00204 static bool ContainsGeomHandles(HC_KEY key); 00205 00206 00212 virtual void CalculateTransformedPosition(HC_KEY handlekey, HPoint &t, HBaseView *view); 00213 00218 HConstrainType GetConstraintType(HC_KEY handlekey ) { GetConstraintParameters(handlekey); return m_ConstraintType; } 00219 00224 virtual void ShowHandle(HC_KEY handlekey, float sf = 0.7f,HBaseView *view = 0); 00225 00230 virtual void ResetHandle(HC_KEY handlekey, float scale = 0.5f, HBaseView *view = 0); 00231 00238 virtual void Scale(HC_KEY handlekey, float scalex, float scaley, float scalez); 00239 00243 virtual void TurnOff(HC_KEY handlekey); 00244 00245 00250 virtual HPoint * GetRotationAxis(HC_KEY handlekey) { GetConstraintParameters(handlekey); return m_rpoint; } 00251 00255 static void ClearAllHandles(HBaseView *view); 00256 00262 static HC_KEY SelectHandle(HBaseView *view, HPoint pos); 00263 00272 static HC_KEY SelectObject(HBaseView *view, HPoint pos, HC_KEY oldkey, bool exclude, float proximity=0.3); 00273 00279 static void SetupObject(HC_KEY key, HBaseView *view, float boxzoom = 1.0f); 00280 00287 static void SetupTextObject(HC_KEY key, HBaseView *view, float boxzoom = 1.0f, float scale = 1.0f); 00288 00293 static void SetupCuttingPlane(HC_KEY key, HBaseView *view); 00294 00307 static HC_KEY SetupManipulator(HC_KEY startkey, HBaseView *view, HPoint *mp, bool AddNonUniformScale = true, bool AddScale = true, bool AddPlane = true, bool AddAxismove = true, bool AddAxisrotate = true, bool AddViewplaneMove = true); 00308 00313 static void SetupCuttingPlaneManipulator(HC_KEY startkey, HBaseView *view, HPoint *midpoint = 0, bool omit_rotate = false); 00314 00319 static HC_KEY GetMMSegment(HC_KEY handlekey); 00320 00325 static void GetCenterPoint(HC_KEY objectkey, HPoint ¢erpoint); 00331 static void SetVisibilityForAll(HC_KEY startkey, const char *visibility); 00332 00333 private: 00334 static void drawTriangleCallback (HIC_Rendition *rendition, HIC_DC_Point *p); 00335 00336 static void FindTranslation(HC_KEY handlekey, HPoint &trans); 00337 static int GetMMLevel(HC_KEY handlekey); 00338 00339 HC_KEY m_GeomHandleKey; 00340 HConstrainType m_ConstraintType; 00341 HPoint m_rpoint[3]; 00342 00343 }; 00344 00345 #ifdef H_PACK_8 00346 #pragma pack(pop) 00347 #endif 00348 00349 #endif 00350 00351 00352