Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

prm.h

Go to the documentation of this file.
00001 /*
00002 ** ---------------------------------------------------------------
00003 ** prm.h  -  Primitive class definition.
00004 **
00005 ** ---------------------------------------------------------------
00006 */
00007 
00008 #ifndef _PRM_H
00009 #define _PRM_H
00010 
00061 /*
00062 ** ---------------------------------------------------------------
00063 ** Used global definitions:
00064 **
00065 */
00066 #include <stdio.h>  /* FILE */
00067 
00068 class Prm
00069 {
00070  public:
00071 /*
00072 ** ---------------------------------------------------------------
00073 ** Public data type definitions, constants, and inline functions:
00074 */
00077   enum Type {
00079     PRM_UNDEF,
00081     PRM_QUAD,
00083     PRM_CIRC,
00085     NumPrmTypes
00086    };
00087 
00090   struct Coord {
00092     double    x;
00094     double    y;
00095    };
00096 
00099   static const double COORD_TOL;
00100 
00104   static const long int Prm::WHITE        = 0xFFFFFFL;  /* 255,255,255 */
00105   static const long int Prm::GRAY         = 0xC0C0C0L;  /* 192,192,192 */
00106   static const long int Prm::DARK_GRAY    = 0x808080L;  /* 128,128,128 */
00107   static const long int Prm::BLACK        = 0x000000L;  /*   0,  0,  0 */
00108   static const long int Prm::RED          = 0xFF0000L;  /* 255,  0,  0 */
00109   static const long int Prm::DARK_RED     = 0x800000L;  /* 128,  0,  0 */
00110   static const long int Prm::GREEN        = 0x00FF00L;  /*   0,255,  0 */
00111   static const long int Prm::DARK_GREEN   = 0x008000L;  /*   0,128,  0 */
00112   static const long int Prm::BLUE         = 0x0000FFL;  /*   0,  0,255 */
00113   static const long int Prm::DARK_BLUE    = 0x000080L;  /*   0,  0,128 */
00114   static const long int Prm::YELLOW       = 0xFFFF00L;  /* 255,255,  0 */
00115   static const long int Prm::DARK_YELLOW  = 0x808000L;  /* 128,128,  0 */
00116   static const long int Prm::MAGENTA      = 0xFF00FFL;  /* 255,  0,255 */
00117   static const long int Prm::DARK_MAGENTA = 0x800080L;  /* 128,  0,128 */
00118   static const long int Prm::CYAN         = 0x00FFFFL;  /*   0,255,255 */
00119   static const long int Prm::DARK_CYAN    = 0x008080L;  /*   0,128,128 */
00120 
00123   static inline double ABS( double x )
00124   {
00125    return( (x < 0.0) ? -x : x );
00126   }
00127 
00128  private:
00138   static Prm* prm_head;
00139 
00141   Prm*        next;
00142 
00144   Prm*        prev;
00145 
00146  protected:
00152   Type type;
00153 
00155   int sel;
00156 
00158   long int color;
00159 
00161   double height;
00162 
00163  public:
00164 /*
00165 ** ---------------------------------------------------------------
00166 ** Public constructor and destructor functions:
00167 **
00168 */
00169 /* --------------------------------------------------------------- */
00176   Prm( );
00177 
00178 /* --------------------------------------------------------------- */
00189   Prm( int back );
00190 
00191 /* --------------------------------------------------------------- */
00199   virtual ~Prm( );
00200 
00201  public:
00202 /*
00203 ** ---------------------------------------------------------------
00204 ** Public class functions:
00205 **
00206 */
00207 /* --------------------------------------------------------------- */
00213   static void DeleteList( void );
00214 
00215 /* --------------------------------------------------------------- */
00224   static Prm* First( void );
00225 
00226 /* --------------------------------------------------------------- */
00235   static Prm* Last( void );
00236 
00237 /* --------------------------------------------------------------- */
00243   static void SelectAll( void );
00244 
00245 /* --------------------------------------------------------------- */
00251   static void UnselectAll( void );
00252 
00253 /* --------------------------------------------------------------- */
00268   static int GetGlobalBox( double* xmin, double* xmax, 
00269                            double* ymin, double* ymax );
00270 
00271  private:
00272 /*
00273 ** ---------------------------------------------------------------
00274 ** Private general instance (object) functions
00275 ** (implemented in base class):
00276 **
00277 */
00278 /* --------------------------------------------------------------- */
00283   void Reset( void );
00284 
00285 /* --------------------------------------------------------------- */
00300   void InsertFront( void );
00301 
00302 /* --------------------------------------------------------------- */
00317   void InsertBack( void );
00318 
00319 /* --------------------------------------------------------------- */
00332   void RemoveFromList( void );
00333 
00334  public:
00335 /*
00336 ** ---------------------------------------------------------------
00337 ** Public general instance (object) functions
00338 ** (implemented in base class):
00339 **
00340 */
00341 /* --------------------------------------------------------------- */
00350   Prm* Next( void );
00351 
00352 /* --------------------------------------------------------------- */
00361   Prm* Previous( void );
00362 
00363 /* --------------------------------------------------------------- */
00371   void MoveFront( void );
00372 
00373 /* --------------------------------------------------------------- */
00380   void MoveBack( void );
00381 
00382 /* --------------------------------------------------------------- */
00390   Prm::Type GetType( void );
00391 
00392 /* --------------------------------------------------------------- */
00397   void Select( void );
00398 
00399 /* --------------------------------------------------------------- */
00404   void Unselect( void );
00405 
00406 /* --------------------------------------------------------------- */
00414   int CheckSelected( void );
00415 
00416 /* --------------------------------------------------------------- */
00424   void SetColor( long int color );
00425 
00426 /* --------------------------------------------------------------- */
00435   long int GetColor( void );
00436 
00437 /* --------------------------------------------------------------- */
00444   void SetHeight( double height );
00445 
00446 /* --------------------------------------------------------------- */
00454   double GetHeight( void );
00455 
00456 /*
00457 ** ---------------------------------------------------------------
00458 ** Public virtual instance (object) functions
00459 ** (to be implemented by derived class):
00460 **
00461 */
00462 /* --------------------------------------------------------------- */
00470   virtual void Read( FILE* fd ) = 0;
00471 
00472 /* --------------------------------------------------------------- */
00479   virtual void Write( FILE* fd ) = 0;
00480 
00481 /* --------------------------------------------------------------- */
00489   virtual int GetNPts( void ) = 0;
00490 
00491 /* --------------------------------------------------------------- */
00504   virtual void SetCoords( int id, double x, double y ) = 0;
00505 
00506 /* --------------------------------------------------------------- */
00518   virtual void GetCoords( int id, double* x, double* y ) = 0;
00519 
00520 /* --------------------------------------------------------------- */
00530   virtual void Set1stPt( double x, double y ) = 0;
00531 
00532 /* --------------------------------------------------------------- */
00542   virtual void Set2ndPt( double x, double y ) = 0;
00543 
00544 /* --------------------------------------------------------------- */
00557   virtual int PickArea( double x, double y ) = 0;
00558 
00559 /* --------------------------------------------------------------- */
00575   virtual int PickVertex( double x, double y, double tol, int* id ) = 0;
00576 
00577 /* --------------------------------------------------------------- */
00594   virtual int PickSide( double x, double y, double tol, int* id ) = 0;
00595 
00596 /* --------------------------------------------------------------- */
00604   virtual void Translate( double dx, double dy ) = 0;
00605 
00606 /* --------------------------------------------------------------- */
00618   virtual void TranslateVertex( int id, double dx, double dy ) = 0;
00619 
00620 /* --------------------------------------------------------------- */
00633   virtual void TranslateSide( int id, double dx, double dy ) = 0;
00634 
00635 /* --------------------------------------------------------------- */
00646   virtual void GetBox( double* xmin, double* xmax, 
00647                        double* ymin, double* ymax ) = 0;
00648 
00649 /* --------------------------------------------------------------- */
00657   virtual void DisplayBoundary( void ) = 0;
00658 
00659 /* --------------------------------------------------------------- */
00668   virtual void DisplayInterior( void ) = 0;
00669 
00670 /* --------------------------------------------------------------- */
00678   virtual void DisplaySolid( void ) = 0;
00679 
00680 /* --------------------------------------------------------------- */
00689   virtual void HighltSolid( void ) = 0;
00690 
00691 /* --------------------------------------------------------------- */
00698   virtual void DisplayZbuffer( void ) = 0;
00699 
00700 };
00701 
00704 #endif

Generated on Mon Jun 21 12:45:12 2010 for Trab4 by  doxygen 1.4.2-20050421