OOFILE  1.9
oofGrphs.h
Go to the documentation of this file.
1 // COPYRIGHT 1996 A.D. Software, All rights reserved
2 
3 #ifndef H_OOFGRPHS
4 #define H_OOFGRPHS
5 // =================================================================================
6 // oofGrphs.h
7 // =================================================================================
8 
13 #define OOFVERS_GRAPH 0x01400000 // Version 1.4.0
14 
15 /*
16 index to version defines
17 Note that you will may lack some files depending on your package
18 
19 file: VERSION IDENTIFIER
20 ==== ==================
21 oof0.h OOFVERS_CORE core version
22 oofrep.h OOFVERS_REP report writer
23 oofGrphs.h OOFVERS_GRAPH graphing engine
24 oofgui.h OOFVERS_GUI generic GUI classes used by PP, MFC and other framework integrations
25 oofpp.h OOFVERS_PP PowerPlant framework (Metrowerks CodeWarrior, on Mac)
26 oofmfc.h OOFVERS_MFC MFC GUI framework
27 
28 */
29 
43 #ifndef H_OOFSRSET
44  #include "oofSrSet.h"
45 #endif
46 #ifndef H_OOFPLBIT
47  #include "oofPlBit.h"
48 #endif
49 #ifndef H_oofSting
50  #include "oofSting.h" // so people can just include oofGrphs and make settings
51 #endif
52 #ifndef H_OOFbool
53  #include "oofbool.h"
54 #endif
55 #ifdef _Windows
56  #ifndef H_OOFDRAW
57  #include "oofdraw.h"
58  #endif
59 #endif
60 
61 class oofDrawStyle;
62 class dbView;
63 
72 public:
73  oofGraph(oofGraphSettings* adoptedSettings = 0);
74  oofGraph(const oofGraph& rhs); // copy ctor
75  virtual ~oofGraph();
76 
77  virtual oofGraph* clone() const=0;
78  virtual void finishConstruction(dbView*, const char* theTitle, unsigned long yAxisHeight)=0;
79  virtual void finishConstructionWithPresets();
80 
81  void draw();
82  void describe(std::ostream& os) const;
83  void setView(dbView*);
84  dbView *getView();
85  void setTitle(const char*);
86  const char * getTitle();
87  const char * getType();
88 #ifdef _Windows
89  typedef RECT Rect;
90 #endif
91  void setPaneRect(Rect inRect);
92  void setPaneRect(oofRect inRect);
94  { mPlotBits.clearTransform(); };
95  void setDrawStyles(oofDrawStyleSet&);
96  void setDrawStyles(oofDrawStyleArray&);
97  void setStyleToMono();
98  void setStyleToColor();
99  bool drawStylesWereSet() const;
100  static oofGraph* currentGraph();
101  const oofGraphSettings* settings() const;
102  oofGraphSettings* getLocalSettings();
103  static oofGraphSettings* defaultSettings();
104 
105 #ifdef _Windows
106  // This MUST be set by the view before calling the draw
107  // This relies the same way as sCurrentGraph for serialized access
108  void setCurrentDC(HDC hdc);
109  const HDC getCurrentDC(); // ES
110 #endif // _Windows
111 
112 protected:
113  virtual void DrawSelf();
114  virtual void DescribeSelf(std::ostream& os) const;
115 
116  void becomeCurrent();
117 
120  bool mIsMono;
124  dbView* mView; // owned copy
127 // static oofGraphSettings *sDefaultSettings;
128 };
129 
130 
140 public:
141  OOF_mixOverlayableGraph(unsigned long numOverlaid=0);
142  virtual ~OOF_mixOverlayableGraph();
143 
144 // AD 990602 the inconsistency in using getXX and setXX here vs other XX() overloads
145 // will be resolved at a future date - this is what happens when you don't code review
146 // junior programmers with a will of iron!
147  void setOverlaid(unsigned long numOverlaid);
148  void setOverlayView(dbView* clonedView);
149  void setOverlayView(const dbView& clonedView);
150  dbView* getOverlayView() const;
151  unsigned long getNumOverlaid() const;
152 
153 protected:
154  unsigned long mNumOverlaid;
156 };
157 
158 
164 public:
165  // Bold Assumption follows:
166  // These are bar constants for the ideal space only - the have little bearing
167  // on the final view - EXCEPT for the ratios between them !
168  enum { ColumnWidth = 20 };
169  enum { Spacing = 2 };
170  enum { SeriesSpacing = 10 };
171  oofColumnGraph(dbView* clonedView=0);
172  // uses default copy ctor, dtor
173 
174  virtual oofGraph* clone() const;
175  virtual void finishConstruction(dbView*, const char* theTitle, unsigned long yAxisHeight);
176 };
177 
178 
185 public:
186  // Bold Assumption follows:
187  // These are point constants for the ideal space only - the have little bearing
188  // on the final view - EXCEPT for the ratios between them !
189  // Because the physical font size is used to ratio against this value, we need
190  // to have adjustments for the ratio of physical font size in co-ordinate space
191  // for the various platforms.
192 #ifdef _Macintosh
193  enum { PointWidth = 20 };
194 #elif defined _Windows
195  enum { PointWidth = 80 };
196 #endif
197  oofPointGraph(dbView* clonedView=0);
198  // uses default copy ctor, dtor
199 
200  virtual oofGraph* clone() const;
201  virtual void finishConstruction(dbView*, const char* theTitle, unsigned long yAxisHeight);
202 };
203 
204 
210 public:
211  // Bold Assumption follows:
212  // These are point constants for the ideal space only - the have little bearing
213  // on the final view - EXCEPT for the ratios between them !
214  // Because the physical font size is used to ratio against this value, we need
215  // to have adjustments for the ratio of physical font size in co-ordinate space
216  // for the various platforms.
217 #ifdef _Macintosh
218  enum { PointWidth = 20 };
219 #elif defined _Windows
220  enum { PointWidth = 80 };
221 #endif
222  oofLineGraph(dbView* clonedView=0);
223  // uses default copy ctor, dtor
224 
225  virtual oofGraph* clone() const;
226  virtual void finishConstruction(dbView*, const char* theTitle, unsigned long yAxisHeight);
227 };
228 
229 
235 public:
236  // Bold Assumption follows:
237  // These are point constants for the ideal space only - the have little bearing
238  // on the final view - EXCEPT for the ratios between them !
239  // Because the physical font size is used to ratio against this value, we need
240  // to have adjustments for the ratio of physical font size in co-ordinate space
241  // for the various platforms.
242 #ifdef _Macintosh
243  enum { PointWidth = 20 };
244 #elif defined _Windows
245  enum { PointWidth = 80 };
246 #endif
247  oofXYGraph(dbView* clonedView=0);
248  // uses default copy ctor, dtor
249 
250  virtual oofGraph* clone() const;
251  virtual void finishConstruction(dbView*, const char* theTitle, unsigned long yAxisHeight);
252 };
253 
254 
260 public:
261  // Bold Assumption follows:
262  // These are bar constants for the ideal space only - the have little bearing
263  // on the final view - EXCEPT for the ratios between them !
264  enum { BarWidth = 20 };
265  enum { Spacing = 2 };
266  enum { SeriesSpacing = 10 };
267  oofBarGraph(dbView* clonedView=0);
268  // uses default copy ctor, dtor
269 
270  virtual oofGraph* clone() const;
271  virtual void finishConstruction(dbView*, const char* theTitle, unsigned long yAxisHeight);
272 };
273 
274 
283 public:
284  // Bold Assumption follows:
285  // These are bar constants for the ideal space only - the have little bearing
286  // on the final view - EXCEPT for the ratios between them !
287  enum { BarWidth = 20 };
288  enum { Spacing = 4 };
289  enum { SeriesSpacing = 10 };
290 
291  oofStackedBarGraph(dbView* clonedView=0, unsigned long numOverlaid=0);
292  // uses default copy ctor, dtor
293 
294  virtual oofGraph* clone() const;
295  virtual void finishConstruction(dbView*, const char* theTitle, unsigned long yAxisHeight);
296  };
297 
298 
306 public:
307  // Bold Assumption follows:
308  // These are bar constants for the ideal space only - the have little bearing
309  // on the final view - EXCEPT for the ratios between them !
310  enum { BarWidth = 20 };
311  enum { Spacing = 4 };
312  enum { SeriesSpacing = 10 };
313 
314  oofOrdinalStackedBarGraph(dbView* clonedView=0);
315  // uses default copy ctor, dtor
316 
317  virtual oofGraph* clone() const;
318  virtual void finishConstruction(dbView*, const char* theTitle, unsigned long yAxisHeight);
319 };
320 
326 public:
327  // Bold Assumption follows:
328  // These are bar constants for the ideal space only - the have little bearing
329  // on the final view - EXCEPT for the ratios between them !
330  enum { ChartDiameter = 1000 };
331  oofPieGraph(dbView* clonedView=0);
332  // uses default copy ctor, dtor
333 
334  virtual oofGraph* clone() const;
335  virtual void finishConstruction(dbView*, const char* theTitle, unsigned long meaningless=0);
336 };
337 
338 
339 // Graph Scale sizing class
340 
348 public:
349  enum { kMinDivs=5 };
350  enum { kMaxDivs=10 }; // Must be double (for now)
351 
352  oofScaleSizer(double Max);
354 
355  double Max() { return mMax;};
356  double Div() { return mDiv;};
357  double NumDivs() { return mNumDivs;};
358  long NumMinorTicks() { return mNumMinorTicks;};
359 
360 private:
361  double mMax;
362  double mDiv;
363  double mNumDivs;
364  long mNumMinorTicks;
365 };
366 
367 
368 // ---------------------------------------------------------------------------------
369 // o o f G r a p h
370 // ---------------------------------------------------------------------------------
371 
372 inline bool
374 {
375  return mDrawStylesWereSet;
376 }
377 
378 
379 #ifdef _Windows
380 inline const HDC
381 oofGraph::getCurrentDC()
382 {
383  return oofCurrentDraw::getCurrentDC();
384 }
385 
386 
387 inline void
388 oofGraph::setCurrentDC(HDC hdc)
389 {
390  oofCurrentDraw::setCurrentDC(hdc);
391 }
392 #endif
393 
394 
395 // ---------------------------------------------------------------------------------
396 // O O F _ m i x O v e r l a y a b l e G r a p h
397 // ---------------------------------------------------------------------------------
398 inline dbView*
400 {
401  return mOverlayView;
402 }
403 
404 
405 inline unsigned long
407 {
408  return mNumOverlaid;
409 }
410 
411 
412 #endif
413 
OOF_String mTitle
Definition: oofGrphs.h:125
Base for anything that can be drawn in color.
Definition: oofClrbl.h:15
Cross-platform way to specify rectangle with Mac-style setter.
Definition: oofRect.h:39
Graph of oofGeoPoint arbitrary points from XY data, no assumptions of order.
Definition: oofGrphs.h:234
Circular graph of oofGeoSector wedge-like pieces.
Definition: oofGrphs.h:325
double Div()
Definition: oofGrphs.h:356
oofGraphSettings * mSettings
Definition: oofGrphs.h:122
Graph of oofGeoBar horizontal bars where each series is percentage of one bar, all same length...
Definition: oofGrphs.h:305
static oofGraph * sCurrentGraph
Definition: oofGrphs.h:121
Graph of oofGeoBar horizontal bars where each point in series is percentage of one bar...
Definition: oofGrphs.h:282
Manage the oofSeries containing data for an oofGraph.
Definition: oofSrSet.h:64
Graph of oofGeoBar horizontal bars.
Definition: oofGrphs.h:259
Collection of oofGEO to draw for an oofGraph.
Definition: oofPlBit.h:41
long NumMinorTicks()
Definition: oofGrphs.h:358
Temporarily used to calculate axis divisions based on length.
Definition: oofGrphs.h:347
Macintosh structure for a rectangle.
bool drawStylesWereSet() const
Definition: oofGrphs.h:373
Settings object for overriding behaviours of an instance of oofGraph.
Definition: oofSting.h:24
Graph of oofGeoColumn vertical bars.
Definition: oofGrphs.h:163
double NumDivs()
Definition: oofGrphs.h:357
Graph class subclassed to draw different graph types.
Definition: oofGrphs.h:71
unsigned long getNumOverlaid() const
Definition: oofGrphs.h:406
Graph of oofGeoPoint individual points.
Definition: oofGrphs.h:184
oofSeriesSet mSeriesSet
Definition: oofGrphs.h:119
virtual oofGraph * clone() const =0
void clearTransform()
Definition: oofGrphs.h:93
Provide an iterable set of fields.
Definition: oofview.h:26
oofPlotBits mPlotBits
Definition: oofGrphs.h:118
double Max()
Definition: oofGrphs.h:355
virtual void finishConstruction(dbView *, const char *theTitle, unsigned long yAxisHeight)=0
#define OOFGRAPH_EXPORT
Prefix for graph classes to enable optional DLL linking.
Definition: oof0.h:188
Graph of oofGeoLine connected points.
Definition: oofGrphs.h:209
OOF_String mType
Definition: oofGrphs.h:126
Virtual base for generator class returning sequence of oofDrawStyle.
Definition: oofDStyl.h:113
Attempts to define 'bool' regardless of compiler and whether it implements true bools.
Mixin base for oofGraph's that draw lines as overlays on original bars.
Definition: oofGrphs.h:139
Portable highly capable string class.
Definition: oofstr.h:101
Specify drawing styles used in graphs.
Definition: oofDStyl.h:32
Array of owned oofDrawStyle's adopting them for correct lifetime management.
Definition: oofDStyl.h:86
bool mIsMono
Definition: oofGrphs.h:120
bool mDrawStylesWereSet
Definition: oofGrphs.h:123
dbView * mOverlayView
OWNED Allow for adding another view (long) with an overlay in it.
Definition: oofGrphs.h:155
unsigned long mNumOverlaid
Allow for items in the main view to be overlaid.
Definition: oofGrphs.h:154
dbView * getOverlayView() const
Definition: oofGrphs.h:399
dbView * mView
Definition: oofGrphs.h:124