Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HSnapGrid.h
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 
00010 #ifndef _H_SNAPGRID__H__INCLUDED
00011 #define _H_SNAPGRID__H__INCLUDED
00012 
00013 #ifdef H_PACK_8
00014 #pragma pack(push)
00015 #pragma pack(8)
00016 #endif
00017 
00018 #include "HTools.h"
00019 
00020 class HBaseView;
00021 
00023 
00031 class MVO_API HSnapGrid
00032 {
00033 
00034 public:
00035 
00039     HSnapGrid(HBaseView* pHView);
00040     virtual ~HSnapGrid();
00041 
00042     // create one - should be the first function you call
00043     // return true if succeeds
00067     bool Create( const HPoint& origin, const HPoint& ref1, const HPoint& ref2, int count1 = 0, int count2 = 0);
00068 
00075     void SetOnTop( bool true_false );
00076 
00080     bool GetOnTop();
00081 
00088     bool GetSnappedViewpointPos( HPoint& in_out );
00089 
00096     bool GetSnappedWorldPos( HPoint& in_out );
00097 
00098 
00102     HC_KEY GetGridSegment(){ return m_GridSegmentKey; };
00103 
00107     HC_KEY GetGridGeometry(){ return m_GridGeomKey; };
00108 
00109     //--- There are more possible interfaces that could be added ---///
00110     //bool SetOrientation( const HPlane& grid_plane, const HPoint& ref_point );
00111     //void SetPlane( const float a, const float b, const float c, const float d );
00112     //void SetPlane( const HPlane& grid_plane );
00113     //void GetPlane( float& a, float& b, float& c, float& d);
00114     //void GetPlane( HPlane& grid_plane );
00115 
00116     // indicates if the grid is locked with respect to the camera position changes.
00117     //void SetPositionLock( bool on_off );
00118     //bool GetPositionLock();
00119 
00120     // switches grid display on/off.
00121     //void SetDisplay( bool on_off );
00122     //bool GetDisplay();
00123 
00124     // sets grid display color
00125     //void SetColor(const HPixelRGBA &rgba);
00126     //void GetColor(HPixelRGBA &rgba);
00127 
00128     // minimum distances in x & y for which grid (lines/dots) will be displayed.
00129     //void SetInterval( const float& x, const float& y);
00130     //void GetInterval( float& x, float& y);
00131 
00132 
00133     // switches snap to grid on/off. If turned all, 
00134     // all the mouse events will be constrained to the grid plane and also snapped to the intervals
00135     //void SetSnap( bool on_off );
00136     //bool GetSnap();
00137 
00138     // snap and display intervals for the grid. The diplay interval takes precedance if it is coarser.
00139     //void SetSnapInterval( const float& x, const float& y);
00140     //void GetSnapInterval( float& x, float& y);
00141 
00142 
00143 protected:
00144 
00145 // functions
00146     
00168     bool insert_grid_geometry( const HPoint& origin, const HPoint& ref1, const HPoint& ref2, int count1, int count2);
00173     bool set_default_grid_attributes();
00174 
00183     bool get_grid_parameters( HPlane& retGridPlane, HPoint& retOrigin, HPoint& retRef1, HPoint& retRef2 );
00184     
00193     bool snap_to_grid( HPoint& in_out, const HPoint& origin, const HPoint& ref1, const HPoint& ref2 );
00194 
00195 // members
00196 
00198     HBaseView * m_pHView;
00199 
00201     HC_KEY m_GridSegmentKey;
00202 
00204     HC_KEY m_GridGeomKey;
00205 
00206 };
00207 
00208 
00209 #ifdef H_PACK_8
00210 #pragma pack(pop)
00211 #endif
00212 
00213 #endif
00214 
00215 
00216