Introduction

Getting Started

Programming Guides

API Reference

Additional Resources

HSnapGrid.h
1 // Copyright (c) Tech Soft 3D, Inc.
2 //
3 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
4 // and considered a trade secret as defined under civil and criminal statutes.
5 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
6 // unauthorized use or misappropriation of its trade secrets. Use of this information
7 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
8 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
9 
10 #ifndef _H_SNAPGRID__H__INCLUDED
11 #define _H_SNAPGRID__H__INCLUDED
12 
13 #ifdef H_PACK_8
14 #pragma pack(push)
15 #pragma pack(8)
16 #endif
17 
18 #include "HTools.h"
19 
20 class HBaseView;
21 
23 
31 class MVO_API HSnapGrid
32 {
33 
34 public:
35 
39  HSnapGrid(HBaseView* pHView);
40  virtual ~HSnapGrid();
41 
42  // create one - should be the first function you call
43  // return true if succeeds
67  bool Create( const HPoint& origin, const HPoint& ref1, const HPoint& ref2, int count1 = 0, int count2 = 0);
68 
75  void SetOnTop( bool true_false );
76 
80  bool GetOnTop();
81 
88  bool GetSnappedViewpointPos( HPoint& in_out );
89 
96  bool GetSnappedWorldPos( HPoint& in_out );
97 
98 
102  HC_KEY GetGridSegment(){ return m_GridSegmentKey; };
103 
107  HC_KEY GetGridGeometry(){ return m_GridGeomKey; };
108 
109  //--- There are more possible interfaces that could be added ---///
110  //bool SetOrientation( const HPlane& grid_plane, const HPoint& ref_point );
111  //void SetPlane( const float a, const float b, const float c, const float d );
112  //void SetPlane( const HPlane& grid_plane );
113  //void GetPlane( float& a, float& b, float& c, float& d);
114  //void GetPlane( HPlane& grid_plane );
115 
116  // indicates if the grid is locked with respect to the camera position changes.
117  //void SetPositionLock( bool on_off );
118  //bool GetPositionLock();
119 
120  // switches grid display on/off.
121  //void SetDisplay( bool on_off );
122  //bool GetDisplay();
123 
124  // sets grid display color
125  //void SetColor(const HPixelRGBA &rgba);
126  //void GetColor(HPixelRGBA &rgba);
127 
128  // minimum distances in x & y for which grid (lines/dots) will be displayed.
129  //void SetInterval( const float& x, const float& y);
130  //void GetInterval( float& x, float& y);
131 
132 
133  // switches snap to grid on/off. If turned all,
134  // all the mouse events will be constrained to the grid plane and also snapped to the intervals
135  //void SetSnap( bool on_off );
136  //bool GetSnap();
137 
138  // snap and display intervals for the grid. The diplay interval takes precedance if it is coarser.
139  //void SetSnapInterval( const float& x, const float& y);
140  //void GetSnapInterval( float& x, float& y);
141 
142 
143 protected:
144 
145 // functions
146 
168  bool insert_grid_geometry( const HPoint& origin, const HPoint& ref1, const HPoint& ref2, int count1, int count2);
173  bool set_default_grid_attributes();
174 
183  bool get_grid_parameters( HPlane& retGridPlane, HPoint& retOrigin, HPoint& retRef1, HPoint& retRef2 );
184 
193  bool snap_to_grid( HPoint& in_out, const HPoint& origin, const HPoint& ref1, const HPoint& ref2 );
194 
195 // members
196 
199 
202 
205 
206 };
207 
208 
209 #ifdef H_PACK_8
210 #pragma pack(pop)
211 #endif
212 
213 #endif
214 
215 
216 
HBaseView * m_pHView
Definition: HSnapGrid.h:198
HC_KEY m_GridGeomKey
Definition: HSnapGrid.h:204
#define HC_KEY
The HSnapGrid class is used to display the grid and implements snapping to the grid.
Definition: HSnapGrid.h:31
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:121
The HBaseView class defines and manages a view of model information.
Definition: HBaseView.h:332
HC_KEY GetGridSegment()
Definition: HSnapGrid.h:102
The HPlane class is the data type of a plane.
Definition: HGlobals.h:333
HC_KEY GetGridGeometry()
Definition: HSnapGrid.h:107
HC_KEY m_GridSegmentKey
Definition: HSnapGrid.h:201