00001
00002
00003
00004
00005
00006 #ifndef __XYOBJECT_H
00007 #define __XYOBJECT_H
00008
00009 #include <stdio.h>
00010
00011 #ifdef WIN32
00012 #pragma warning(disable:4237)
00013 #endif
00014
00015 #include <cd.h>
00016 #include <wd.h>
00017
00018 #include "xypos.h"
00019 #include "xybool.h"
00020
00021
00022 #define XY_RED 0xFF0000L // 255, 0, 0
00023 #define XY_DARK_RED 0x800000L // 128, 0, 0
00024 #define XY_GREEN 0x00FF00L // 0, 255, 0
00025 #define XY_DARK_GREEN 0x008000L // 0, 128, 0
00026 #define XY_BLUE 0x0000FFL // 0, 0, 255
00027 #define XY_DARK_BLUE 0x000080L // 0, 0, 128
00028 #define XY_YELLOW 0xFFFF00L // 255, 255, 0
00029 #define XY_DARK_YELLOW 0x808000L // 128, 128, 0
00030 #define XY_MAGENTA 0xFF00FFL // 255, 0, 255
00031 #define XY_DARK_MAGENTA 0x800080L // 128, 0, 128
00032 #define XY_CYAN 0x00FFFFL // 0, 255, 255
00033 #define XY_DARK_CYAN 0x008080L // 0, 128, 128
00034 #define XY_WHITE 0xFFFFFFL // 255, 255, 255
00035 #define XY_BLACK 0x000000L // 0, 0, 0
00036 #define XY_DARK_GRAY 0x808080L // 128, 128, 128
00037 #define XY_GRAY 0xC0C0C0L // 192, 192, 192
00038
00039 extern FILE *logfile;
00040
00041
00042
00043
00044
00045
00046 class XYObject
00047 {
00048 public:
00049
00050
00051
00052 enum LineStyle {
00053 continuous,
00054 dashed,
00055 dotted,
00056 dashDot,
00057 dashDotDot
00058 };
00059
00060
00061
00062 XYObject (
00063 XYCoordinate x,
00064 XYCoordinate y,
00065 xybool visible = xytrue);
00066
00067
00068 virtual ~XYObject (void);
00069
00070
00071
00072 virtual void visible (xybool v);
00073
00074 virtual xybool visible (void) const;
00075
00076
00077 virtual void position (double x, double y);
00078 virtual void position (int xp, int yp);
00079
00080
00081 virtual void position (double* x, double* y) const;
00082 virtual void position (int* xp, int* yp) const;
00083 virtual XYCoordinate* position (void);
00084
00085
00086
00087 virtual void setHandle (void* h);
00088
00089 virtual void* getHandle (void) const;
00090
00091
00092
00093 virtual void setWindow (double xmin = 0.0, double xmax = 1.0,
00094 double ymin = 0.0, double ymax = 1.0) const;
00095
00096
00097 virtual void setViewport (int xmin, int xmax, int ymin, int ymax);
00098 virtual void setViewport (void) const;
00099
00100
00101 virtual void getViewport (int& xmin, int& xmax, int& ymin, int& ymax) const;
00102
00103
00104
00105 virtual void draw (void) = 0;
00106
00107 virtual void draw (int xmin, int ymin, int xmax, int ymax) const = 0;
00108
00109
00110
00111 virtual void boundingBox (int& bxmin, int& bymin, int& bxmax, int& bymax) const = 0;
00112
00113 protected:
00114
00115 xybool _visible;
00116 XYPosition _p;
00117 void* _handle;
00118 int _xmin, _xmax,
00119 _ymin, _ymax;
00120 };
00121
00122 #endif
00123