00001
00002
00003
00004
00005
00006 #ifndef __XYGRAPH_H
00007 #define __XYGRAPH_H
00008
00009 #ifndef NOIUP
00010 #include <iup.h>
00011 #endif
00012 #include <cd.h>
00013 #include <cdiup.h>
00014 #include <cdimage.h>
00015 #include <wd.h>
00016 #include "xysl.h"
00017 #include "xyar.h"
00018 #include "xyleg.h"
00019
00020 class XYObject;
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 class XYGraph : public XYObject
00031 {
00032 public:
00033
00034
00035 #ifndef NOIUP
00036
00037 XYGraph (
00038 Ihandle* canvas,
00039
00040
00041 XYCoordinate x,
00042 XYCoordinate y,
00043 double width,
00044 double height,
00045 xybool visible = xytrue);
00046 #endif
00047
00048
00049 XYGraph (
00050 cdCanvas* cdcanvas,
00051
00052
00053 XYCoordinate x,
00054 XYCoordinate y,
00055 double width,
00056 double height,
00057 xybool visible = xytrue);
00058
00059
00060 virtual ~XYGraph (void);
00061
00062
00063
00064 virtual void position (double x, double y);
00065 virtual void position (int xp, int yp);
00066
00067 virtual void position (double* x, double* y) const;
00068 virtual void position (int* xp, int* yp) const;
00069 virtual XYCoordinate* position (void);
00070
00071
00072 virtual void setCdCanvas (cdCanvas* c);
00073
00074 virtual cdCanvas* getCdCanvas (void) const;
00075
00076
00077 virtual cdCanvas* canvasImage (cdCanvas*);
00078
00079 virtual cdCanvas* canvasImage (void);
00080
00081
00082 virtual void createImage (int w, int h);
00083
00084
00085 virtual void insert (XYText* text);
00086
00087 virtual void insert (XYAxis* axis);
00088
00089 virtual void insert (XYMask* mask);
00090
00091 virtual void insert (XYMarker* marker);
00092
00093 virtual void insert (XYSlice* slice);
00094
00095 virtual void insert (XYArea* area);
00096
00097 virtual void insert (XYObject* object);
00098
00099
00100 virtual void remove (XYText* text);
00101
00102 virtual void remove (XYAxis* axis);
00103
00104 virtual void remove (XYMask* mask);
00105
00106 virtual void remove (XYMarker* marker);
00107
00108 virtual void remove (XYSlice* slice);
00109
00110 virtual void remove (XYArea* area);
00111
00112 virtual void remove (XYObject* object);
00113
00114
00115 virtual XYList<XYText>& text (void);
00116
00117 virtual XYList<XYAxis>& axis (void);
00118
00119 virtual XYList<XYMask>& mask (void);
00120
00121 virtual XYList<XYMarker>& marker (void);
00122
00123 virtual XYList<XYSlice>& slice (void);
00124
00125 virtual XYList<XYObject>& decorator (void);
00126
00127 virtual XYList<XYArea>& area (void);
00128
00129
00130 virtual XYMask& mask(unsigned m);
00131
00132
00133 virtual void legend (XYLegend* leg);
00134
00135 virtual XYLegend* legend (void) const;
00136
00137
00138 virtual XYObject* markerCreate(int x0, int y0, const XYAxis* master) = 0;
00139
00140
00141 virtual void backgroundColor(long color);
00142
00143 virtual long backgroundColor(void) const;
00144
00145
00146 virtual void width (double w);
00147
00148 virtual double width (void) const;
00149
00150
00151 virtual void height (double h);
00152
00153 virtual double height (void) const;
00154
00155
00156 virtual void distortion (xybool d);
00157
00158 virtual xybool distortion (void) const;
00159
00160
00161 virtual xybool doubleBuffering (xybool on);
00162
00163 virtual xybool doubleBuffering (void) const;
00164
00165
00166
00167 virtual void maskAreaColor(long color);
00168
00169 virtual long maskAreaColor(void) const;
00170
00171
00172 virtual void setMaskArea (double xmin, double ymin, double xmax,
00173 double ymax);
00174
00175 virtual void getMaskArea (double& xmn, double& ymn, double& xmx,
00176 double& ymx) const;
00177 virtual void getMaskArea (int& xmn, int& ymn, int& xmx, int& ymx) const;
00178
00179
00180 virtual void calcMaskArea (void) = 0;
00181
00182
00183
00184 virtual xybool contains(const XYObject* obj);
00185
00186
00187 virtual XYObject* pick (int x, int y);
00188
00189
00190 virtual XYText* pickText (int x, int y);
00191
00192 virtual XYAxis* pickAxis (int x, int y);
00193
00194 virtual XYMask* pickMask (int x, int y);
00195
00196 virtual XYMarker* pickMarker (int x, int y);
00197
00198 virtual XYSlice* pickSlice (int x, int y);
00199
00200 virtual XYArea* pickArea (int x, int y);
00201
00202 virtual XYLegend* pickLegend (int x, int y);
00203
00204
00205 virtual XYList<XYObject>* fence (int x0, int y0, int x1, int y1);
00206
00207
00208
00209 virtual void print (void);
00210
00211
00212 virtual void flush (void) const;
00213
00214
00215 virtual void scroll (int dx, int dy);
00216
00217
00218 virtual void clear (void);
00219
00220 virtual void clear (int xmin, int ymin, int xmax, int ymax) const;
00221
00222 virtual void maskAreaClear (void) const;
00223
00224
00225 virtual void draw (void);
00226
00227 virtual void draw (int xmin, int ymin, int xmax, int ymax) const;
00228
00229
00230 virtual void drawMaskArea (void) const = 0;
00231 virtual void drawMaskArea (int xmin, int ymin, int xmax, int ymax) const;
00232
00233
00234 virtual int activateCanvas (void) const;
00235
00236
00237
00238 virtual void boundingBox (int& , int& , int& ,
00239 int& ) const {};
00240
00241 protected:
00242
00243
00244
00245 virtual void propagateViewport (void) const;
00246
00247
00248 virtual void defineViewport (void);
00249
00250 #ifndef NOIUP
00251 Ihandle* _canvas;
00252 #else
00253 void* _canvas;
00254 #endif
00255 cdCanvas* _cdcanvas;
00256 cdCanvas* _cvimage;
00257 void* _image;
00258 int _image_w;
00259 int _image_h;
00260 XYList<XYText> _titles;
00261 XYList<XYAxis> _axes;
00262 XYList<XYMask> _masks;
00263 XYList<XYMarker> _markers;
00264 XYList<XYSlice> _slices;
00265 XYList<XYArea> _areas;
00266 XYList<XYObject> _decorators;
00267 XYLegend* _legend;
00268 long _color;
00269 long _ma_color;
00270 double _width;
00271 double _height;
00272 double _ma_xmin, _ma_xmax,
00273 _ma_ymin, _ma_ymax;
00274 xybool _distortion;
00275 xybool _doublebuffering;
00276
00277 private:
00278
00279 xybool _dont_destroy_cdcanvas;
00280 XYList<XYSlice> _aux_slices;
00281 };
00282
00283 #endif
00284