00001 // 00002 // Copyright (c) 2000 by Tech Soft 3D, LLC. 00003 // The information contained herein is confidential and proprietary to 00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under 00005 // civil and criminal statutes. Tech Soft 3D shall pursue its civil 00006 // and criminal remedies in the event of unauthorized use or misappropriation 00007 // of its trade secrets. Use of this information by anyone other than 00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a 00009 // written non-disclosure agreement, expressly prescribing the scope and 00010 // manner of such use. 00011 // 00012 // $Id: 4e9d501d91100695d5879e02026d63cd7231db21 $ 00013 // 00014 00018 #ifndef _HUTILITYGEOMHANDLE_H 00019 #define _HUTILITYGEOMHANDLE_H 00020 00021 #ifdef H_PACK_8 00022 #pragma pack(push) 00023 #pragma pack(8) 00024 #endif 00025 00026 #include "HTools.h" 00027 #include "HUtilityAnnotation.h" 00028 #include "hic_types.h" 00029 00030 class HPoint; 00031 class HBaseView; 00032 00033 00037 enum HConstrainType 00038 { 00039 HConstrainNone, 00040 HConstrainToRay, 00041 HConstrainToRotationVector, 00042 HConstrainToPlane, 00043 HConstrainToViewplane, 00044 HConstrainToScale, 00045 HConstrainToOnOff 00046 }; 00047 00048 00049 00051 00059 class MVO_API HUtilityGeomHandle 00060 { 00061 public: 00062 00063 00064 virtual ~HUtilityGeomHandle() { }; 00065 00067 static void RegisterCallbacks(); 00068 00075 virtual HC_KEY Insert(HPoint position, bool edges = false, int level = 4); 00076 00080 virtual void SetupGeomHandleSegment(bool edges); 00081 00089 virtual void ConstrainToPlane(HC_KEY handlekey, HPoint p1, HPoint p2, HPoint p3,HBaseView *view = 0); 00090 00094 virtual void ConstrainToViewplane(HC_KEY handlekey,HBaseView *view = 0); 00095 00101 virtual void ConstrainToRay(HC_KEY handlekey, HPoint p1, HPoint p2, HBaseView *view = 0); 00102 00108 virtual void ConstrainToRotationVector(HC_KEY handlekey, HPoint p1, HPoint p2,HBaseView *view = 0); 00109 00115 virtual void ConstrainToScale(HC_KEY handlekey, HPoint p1, HPoint p2,HBaseView *view = 0); 00116 00120 virtual void ConstrainToOnOff(HC_KEY handlekey,HBaseView *view = 0); 00121 00128 virtual void Move(HC_KEY handlekey, HPoint newposition, HC_KEY camerakey, HBaseView *view = 0); 00129 00130 00135 virtual void ShowBasePosition(HC_KEY handlekey, HPoint &bp); 00136 00141 virtual void GetConstraintParameters(HC_KEY handlekey); 00142 00147 void Rotate(HC_KEY handlekey, float rotangle); 00148 00155 virtual float CalculatePlaneZ(HC_KEY handlekey, HPoint point); 00156 00157 00164 virtual void AdjustPositionToRay(HC_KEY handlekey, HPoint &C, HPoint A, HPoint B); 00165 00175 virtual void CalculatePositionOnPlane(HC_KEY handlekey, HPoint &p, float a, float b, float c, float d); 00176 00177 00184 void AdjustPointToRay(HC_KEY geomhandlekey, HPoint &p, HC_KEY camerasegment, HBaseView *view); 00185 00196 virtual void AdjustPositionToPlane(HC_KEY handlekey, HPoint &p, float a, float b, float c, float d, HC_KEY camerakey); 00197 00202 static HC_KEY IsGeomHandle(HC_KEY key); 00203 00204 00209 static bool ContainsGeomHandles(HC_KEY key); 00210 00211 00217 virtual void CalculateTransformedPosition(HC_KEY handlekey, HPoint &t, HBaseView *view); 00218 00223 HConstrainType GetConstraintType(HC_KEY handlekey ) { GetConstraintParameters(handlekey); return m_ConstraintType; } 00224 00229 virtual void ShowHandle(HC_KEY handlekey, float sf = 0.7f,HBaseView *view = 0); 00230 00235 virtual void ResetHandle(HC_KEY handlekey, float scale = 0.5f, HBaseView *view = 0); 00236 00243 virtual void Scale(HC_KEY handlekey, float scalex, float scaley, float scalez); 00244 00248 virtual void TurnOff(HC_KEY handlekey); 00249 00250 00255 virtual HPoint * GetRotationAxis(HC_KEY handlekey) { GetConstraintParameters(handlekey); return m_rpoint; } 00256 00260 static void ClearAllHandles(HBaseView *view); 00261 00267 static HC_KEY SelectHandle(HBaseView *view, HPoint pos); 00268 00277 static HC_KEY SelectObject(HBaseView *view, HPoint pos, HC_KEY oldkey, bool exclude, float proximity=0.3); 00278 00284 static void SetupObject(HC_KEY key, HBaseView *view, float boxzoom = 1.0f); 00285 00292 static void SetupTextObject(HC_KEY key, HBaseView *view, float boxzoom = 1.0f, float scale = 1.0f); 00293 00298 static void SetupCuttingPlane(HC_KEY key, HBaseView *view); 00299 00312 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); 00313 00318 static void SetupCuttingPlaneManipulator(HC_KEY startkey, HBaseView *view, HPoint *midpoint = 0, bool omit_rotate = false); 00319 00324 static HC_KEY GetMMSegment(HC_KEY handlekey); 00325 00330 static void GetCenterPoint(HC_KEY objectkey, HPoint ¢erpoint); 00336 static void SetVisibilityForAll(HC_KEY startkey, const char *visibility); 00337 00338 private: 00339 static void drawTriangleCallback (HIC_Rendition *rendition, HIC_DC_Point *p); 00340 00341 static void FindTranslation(HC_KEY handlekey, HPoint &trans); 00342 static int GetMMLevel(HC_KEY handlekey); 00343 00344 HC_KEY m_GeomHandleKey; 00345 HConstrainType m_ConstraintType; 00346 HPoint m_rpoint[3]; 00347 00348 }; 00349 00350 #ifdef H_PACK_8 00351 #pragma pack(pop) 00352 #endif 00353 00354 #endif 00355 00356 00357