00001 // 00002 // Copyright (c) 2003 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 // 00013 00014 #ifndef _H_SNAPGRID__H__INCLUDED 00015 #define _H_SNAPGRID__H__INCLUDED 00016 00017 #ifdef H_PACK_8 00018 #pragma pack(push) 00019 #pragma pack(8) 00020 #endif 00021 00022 #include "HTools.h" 00023 00024 class HBaseView; 00025 00027 00035 class MVO_API HSnapGrid 00036 { 00037 00038 public: 00039 00043 HSnapGrid(HBaseView* pHView); 00044 virtual ~HSnapGrid(); 00045 00046 // create one - should be the first function you call 00047 // return true if succeeds 00071 bool Create( const HPoint& origin, const HPoint& ref1, const HPoint& ref2, int count1 = 0, int count2 = 0); 00072 00079 void SetOnTop( bool true_false ); 00080 00084 bool GetOnTop(); 00085 00092 bool GetSnappedViewpointPos( HPoint& in_out ); 00093 00100 bool GetSnappedWorldPos( HPoint& in_out ); 00101 00102 00106 HC_KEY GetGridSegment(){ return m_GridSegmentKey; }; 00107 00111 HC_KEY GetGridGeometry(){ return m_GridGeomKey; }; 00112 00113 //--- There are more possible interfaces that could be added ---/// 00114 //bool SetOrientation( const HPlane& grid_plane, const HPoint& ref_point ); 00115 //void SetPlane( const float a, const float b, const float c, const float d ); 00116 //void SetPlane( const HPlane& grid_plane ); 00117 //void GetPlane( float& a, float& b, float& c, float& d); 00118 //void GetPlane( HPlane& grid_plane ); 00119 00120 // indicates if the grid is locked with respect to the camera position changes. 00121 //void SetPositionLock( bool on_off ); 00122 //bool GetPositionLock(); 00123 00124 // switches grid display on/off. 00125 //void SetDisplay( bool on_off ); 00126 //bool GetDisplay(); 00127 00128 // sets grid display color 00129 //void SetColor(const HPixelRGBA &rgba); 00130 //void GetColor(HPixelRGBA &rgba); 00131 00132 // minimum distances in x & y for which grid (lines/dots) will be displayed. 00133 //void SetInterval( const float& x, const float& y); 00134 //void GetInterval( float& x, float& y); 00135 00136 00137 // switches snap to grid on/off. If turned all, 00138 // all the mouse events will be constrained to the grid plane and also snapped to the intervals 00139 //void SetSnap( bool on_off ); 00140 //bool GetSnap(); 00141 00142 // snap and display intervals for the grid. The diplay interval takes precedance if it is coarser. 00143 //void SetSnapInterval( const float& x, const float& y); 00144 //void GetSnapInterval( float& x, float& y); 00145 00146 00147 protected: 00148 00149 // functions 00150 00172 bool insert_grid_geometry( const HPoint& origin, const HPoint& ref1, const HPoint& ref2, int count1, int count2); 00177 bool set_default_grid_attributes(); 00178 00187 bool get_grid_parameters( HPlane& retGridPlane, HPoint& retOrigin, HPoint& retRef1, HPoint& retRef2 ); 00188 00197 bool snap_to_grid( HPoint& in_out, const HPoint& origin, const HPoint& ref1, const HPoint& ref2 ); 00198 00199 // members 00200 00202 HBaseView * m_pHView; 00203 00205 HC_KEY m_GridSegmentKey; 00206 00208 HC_KEY m_GridGeomKey; 00209 00210 }; 00211 00212 00213 #ifdef H_PACK_8 00214 #pragma pack(pop) 00215 #endif 00216 00217 #endif 00218 00219 00220