Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HSnapGrid.h
1 //
2 // Copyright (c) 2003 by Tech Soft 3D, LLC.
3 // The information contained herein is confidential and proprietary to
4 // Tech Soft 3D, LLC., and considered a trade secret as defined under
5 // civil and criminal statutes. Tech Soft 3D shall pursue its civil
6 // and criminal remedies in the event of unauthorized use or misappropriation
7 // of its trade secrets. Use of this information by anyone other than
8 // authorized employees of Tech Soft 3D, LLC. is granted only under a
9 // written non-disclosure agreement, expressly prescribing the scope and
10 // manner of such use.
11 //
12 //
13 
14 #ifndef _H_SNAPGRID__H__INCLUDED
15 #define _H_SNAPGRID__H__INCLUDED
16 
17 #ifdef H_PACK_8
18 #pragma pack(push)
19 #pragma pack(8)
20 #endif
21 
22 #include "HTools.h"
23 
24 class HBaseView;
25 
27 
35 class MVO_API HSnapGrid
36 {
37 
38 public:
39 
43  HSnapGrid(HBaseView* pHView);
44  virtual ~HSnapGrid();
45 
46  // create one - should be the first function you call
47  // return true if succeeds
71  bool Create( const HPoint& origin, const HPoint& ref1, const HPoint& ref2, int count1 = 0, int count2 = 0);
72 
79  void SetOnTop( bool true_false );
80 
84  bool GetOnTop();
85 
92  bool GetSnappedViewpointPos( HPoint& in_out );
93 
100  bool GetSnappedWorldPos( HPoint& in_out );
101 
102 
106  HC_KEY GetGridSegment(){ return m_GridSegmentKey; };
107 
111  HC_KEY GetGridGeometry(){ return m_GridGeomKey; };
112 
113  //--- There are more possible interfaces that could be added ---///
114  //bool SetOrientation( const HPlane& grid_plane, const HPoint& ref_point );
115  //void SetPlane( const float a, const float b, const float c, const float d );
116  //void SetPlane( const HPlane& grid_plane );
117  //void GetPlane( float& a, float& b, float& c, float& d);
118  //void GetPlane( HPlane& grid_plane );
119 
120  // indicates if the grid is locked with respect to the camera position changes.
121  //void SetPositionLock( bool on_off );
122  //bool GetPositionLock();
123 
124  // switches grid display on/off.
125  //void SetDisplay( bool on_off );
126  //bool GetDisplay();
127 
128  // sets grid display color
129  //void SetColor(const HPixelRGBA &rgba);
130  //void GetColor(HPixelRGBA &rgba);
131 
132  // minimum distances in x & y for which grid (lines/dots) will be displayed.
133  //void SetInterval( const float& x, const float& y);
134  //void GetInterval( float& x, float& y);
135 
136 
137  // switches snap to grid on/off. If turned all,
138  // all the mouse events will be constrained to the grid plane and also snapped to the intervals
139  //void SetSnap( bool on_off );
140  //bool GetSnap();
141 
142  // snap and display intervals for the grid. The diplay interval takes precedance if it is coarser.
143  //void SetSnapInterval( const float& x, const float& y);
144  //void GetSnapInterval( float& x, float& y);
145 
146 
147 protected:
148 
149 // functions
150 
172  bool insert_grid_geometry( const HPoint& origin, const HPoint& ref1, const HPoint& ref2, int count1, int count2);
177  bool set_default_grid_attributes();
178 
187  bool get_grid_parameters( HPlane& retGridPlane, HPoint& retOrigin, HPoint& retRef1, HPoint& retRef2 );
188 
197  bool snap_to_grid( HPoint& in_out, const HPoint& origin, const HPoint& ref1, const HPoint ref2 );
198 
199 // members
200 
203 
206 
209 
210 };
211 
212 
213 #ifdef H_PACK_8
214 #pragma pack(pop)
215 #endif
216 
217 #endif
218 
219 
220 
HBaseView * m_pHView
Definition: HSnapGrid.h:202
HC_KEY m_GridGeomKey
Definition: HSnapGrid.h:208
#define HC_KEY
The HSnapGrid class is used to display the grid and implements snapping to the grid.
Definition: HSnapGrid.h:35
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:126
The HBaseView class defines and manages a view of model information.
Definition: HBaseView.h:337
HC_KEY GetGridSegment()
Definition: HSnapGrid.h:106
The HPlane class is the data type of a plane.
Definition: HGlobals.h:339
HC_KEY GetGridGeometry()
Definition: HSnapGrid.h:111
HC_KEY m_GridSegmentKey
Definition: HSnapGrid.h:205