Back to index

See source file

CDrawable.h

 
//----------------------------------------------------------------------------- 
//  $Header: CDrawable.h,v 2.1 96/10/04 08:43:11 voigt Exp $ 
// 
//  COOL Program Library   
//  Copyright (C) CERES collaboration, 1996 
// 
//  Declaration of abstract class CDrawable. 
// 
//----------------------------------------------------------------------------- 
#ifndef CDRAWABLE_H 
#define CDRAWABLE_H 
 
#include <X11/Xlib.h> 
#include "cool.h" 
//dd cool.h needs to be first here 
#include <rw/tvsrtvec.h> 
#include <vogle.h> 
 
 
const int MaxColors = 256; 
 
const int Black   = 0; 
const int Red     = 1; 
const int Green   = 2; 
const int Yellow  = 3; 
const int Blue    = 4; 
const int Magenta = 5; 
const int Cyan    = 6; 
const int White   = 7; 
const int Gray    = 8; 
 
class CDrawable { 
public: 
   CDrawable(); 
   virtual ~CDrawable(); 
 
public: 
   virtual void draw(const char*) = 0; 
   virtual const CString& getName() const = 0; 
   virtual float getLeft() const = 0; 
   virtual float getRight() const = 0; 
   virtual float getTop() const = 0; 
   virtual float getBottom() const = 0; 
   CBoolean isDrawable() const { return xdisplay&&xwindow; } 
    
public: 
   virtual void bindWindow(const char*);         // glue graphic from tk to X 
   virtual void display(const char* = 0);        // display view [calls draw()] 
   virtual void zoom();                          // zoom view (cursor operation) 
   virtual void zoomOut();                       // zoom out  
   virtual void resetZoom();                     // reset zoom to normal view, refresh display 
   virtual void locatePoint();                   // locate point in world coordinates 
   virtual void storePostScript(const char*);    // store view to file 
   virtual void printPostScript(const char*);    // print view on PostScript printer 
    
protected: 
   CBoolean   psMode;                            // flag if drawing to PS file 
   RWTValOrderedVector<int> colors;              // color-amp table; 
    
private: 
   Display    *xdisplay; 
   Window     xwindow; 
   int        width;                             // width and height in pixels  
   int        height; 
   CString    lastOptions;                       // last drawing options used 
   float      zoomFactor; 
   float      xzoom; 
   float      yzoom; 
 
private: 
   virtual void setupColors();                // create color table 
   virtual void hls2rgb(int, int, int, int&, int&, int&); 
   virtual Window createNewWindow(); 
   
private: 
   static int refCount; 
   static int vogleInitialized; 
}; 
 
#endif /* CDRAWABLE_H */ 

Back to index

See source file