OOFILE  1.9
oofGeos.cpp
Go to the documentation of this file.
1 // COPYRIGHT 1996 A.D. Software, All rights reserved
2 
3 // =================================================================================
4 // oofGeos.cp
5 // =================================================================================
6 
7 #include "oofpch_g.h" // for precompilation of graph files
8 
9 #ifndef H_OOFRECT
10  #include "oofRect.h"
11 #endif
12 #ifndef H_OOFGEOS
13  #include "oofGeos.h"
14 #endif
15 #ifndef H_OOFSRSET
16  #include "oofSrSet.h"
17 #endif
18 #ifndef H_OOFGRPHS
19  #include "oofGrphs.h"
20 #endif
21 #ifndef H_OOFDSTYL
22  #include "oofDStyl.h"
23 #endif
24 #ifndef H_oofSting
25  #include "oofSting.h"
26 #endif
27 #ifndef H_OOFIOS
28  #include "oofios.h"
29 #endif
30 
31 #include <assert.h>
32 #include <math.h>
33 
34 #ifdef OOF_MEM_DEBUG_LAST_INCLUDE
35  #include OOF_MEM_DEBUG_LAST_INCLUDE
36 #endif
37 
38 #ifndef OOF_NO_STDLIB
39  #ifndef std
40  using namespace std;
41  #endif
42 #endif
43 
44 // ---------------------------------------------------------------------------------
45 // oofGeo
46 // ---------------------------------------------------------------------------------
47 
48 
49 oofGeo::oofGeo(int XIdeal, int YIdeal, oofSeries* SeriesPtr, PositionState pos)
50 {
51  mXIdeal = XIdeal;
52  mYIdeal = YIdeal;
53 
54  mXDraw = 0;
55  mYDraw = 0;
56 
57  mSeriesPtr = SeriesPtr;
58 
59  mPosition = pos;
60 }
61 
63 {
64 }
65 
66 
67 oofSeries*
69 {
70  return mSeriesPtr;
71 }
72 
73 
74 void
75 oofGeo::setLocation(long inXIdeal, long inYIdeal)
76 {
77  mXIdeal = inXIdeal;
78  mYIdeal = inYIdeal;
79 }
80 
81 
82 void
84 {
85  // get a draw style
86  const oofDrawStyle* currentStyle=0;
87  if (mDrawStyle)
88  currentStyle = mDrawStyle;
89  else
90  if (mSeriesPtr)
91  currentStyle = mSeriesPtr->drawStyle();
92  else
93  currentStyle = oofGraph::currentGraph()->drawStyle();
94 
95  assert(currentStyle); // A style must have been set by this stage
96  // call the child type DrawSelf function
97  DrawSelf(currentStyle);
98 }
99 
100 
101 void
102 oofGeo::describe(ostream& os) const
103 {
104  os << endl << "geo type: " << geoType() << endl;
105  os << "mXIdeal: " << mXIdeal << "mYIdeal: " << mYIdeal << "mXDraw: " << mXDraw << "mYDraw :" << mYDraw << endl << endl ;
106 }
107 
108 
109 oofString
111 {
112  return "oofGeo";
113 }
114 
115 
116 oofRect
118 {
119  return oofRect(0,0,0,0);
120 }
121 
122 
123 /* UnJames
124 void
125 oofGeo::UpdateMargins(oofTransformationManager* inTransformationManagerPtr, oofRect& oldBounds)
126 {
127  oofRect margins = inTransformationManagerPtr->getMargins();
128  oofRect bounds = GetAlreadyTransformedBoundingRect(inTransformationManagerPtr);
129  bool changed = false;
130 
131  switch (mPosition) {
132  case posTop:
133  case posCentre: // posCentre is assumed to be top/centre
134  if (bounds.bottom > margins.top) {
135  margins.top += (bounds.bottom - oldBounds.bottom);
136  changed = true;
137  }
138  break;
139  case posToLeft:
140  if (bounds.right > margins.left) {
141  margins.left += (bounds.right - oldBounds.right);
142  changed = true;
143  }
144  break;
145  case posBelow:
146  if (bounds.height() > margins.bottom) {
147  margins.bottom += (bounds.height() - oldBounds.height());
148  changed = true;
149  }
150  break;
151  }
152 }
153 
154 
155 
156 oofRect
157 oofGeo::GetAlreadyTransformedBoundingRect(oofTransformationManager* tm)
158 {
159  oofRect r = BoundingRect(tm); // default ends up with double transform, unless they override this method
160  return r;
161 }
162  end of UnJames */
163 
164 
165 // ---------------------------------------------------------------------------------
166 // oofLabelledGeo
167 // ---------------------------------------------------------------------------------
168 
169 oofLabelledGeo::oofLabelledGeo(int XIdeal, int YIdeal, oofSeries* SeriesPtr, PositionState pos)
170  : oofGeo(XIdeal,YIdeal,SeriesPtr,pos)
171 {
172  mValueLabel = NULL;
173 }
174 
175 oofLabelledGeo::oofLabelledGeo(int XIdeal ,int /*width*/,int /*height*/, oofSeries* SeriesPtr)
176  : oofGeo(XIdeal,0,SeriesPtr,posNone)
177 {
178  mValueLabel = NULL;
179 }
180 
182 {
183  if (mValueLabel)
184  delete mValueLabel;
185 }
186 
187 void
188 oofLabelledGeo::setLabel(bool required, int value, int x, int y, int width)
189 {
190  if (!required && mValueLabel) {
191  delete mValueLabel;
192  mValueLabel = NULL;
193  }
194  mRequired = required;
195  mValue = value;
196  mXTextPos = x;
197  mYTextPos = y;
198  mTextWidth = width;
199 }
200 
201 void
203 {
204  if (mValueLabel)
205  mValueLabel->draw();
206 }
207 
208 void
210 {
211  if (mRequired) {
212  if (mValueLabel)
213  delete mValueLabel;
214 
215  // draw the quantity for the column
216  // find number of digits
217  char numberBuf[20];
218  sprintf(numberBuf, "%d", mValue);
219 
220  mValueLabel = new oofGeoText(mXTextPos, mYTextPos, mTextWidth, numberBuf, NULL, posCentre);
222 
223  // Now transform it
224  mValueLabel->Transform(inTransformationManagerPtr);
225  }
226 }
227 
228 
229 void
230 oofLabelledGeo::describe(ostream& os) const
231 {
232 
233  oofGeo::describe(os); // call the DIRECT parent, not always oofGeo
234  os << "mValueLabel : " << mValueLabel
235  << "mRequired : " << mRequired
236  << "mValue : " << mValue
237  << "mXTextPos :" << mXTextPos
238  << "mYTextPos :" << mYTextPos
239  << "mTextWidth :" << mTextWidth << endl << endl ;
240 }
241 
242 
243 oofString
245 {
246  return "oofLabelledGeo";
247 }
248 
249 
250 // ---------------------------------------------------------------------------------
251 // oofGeoColumn
252 // ---------------------------------------------------------------------------------
253 
254 
255 oofGeoColumn::oofGeoColumn(int XIdeal, int YIdeal,
256  int width,int height, oofSeries* SeriesPtr, PositionState pos)
257  : oofLabelledGeo(XIdeal,YIdeal,SeriesPtr,pos)
258 {
259  mIdealWidth = width;
260  mIdealHeight = height;
261 }
262 
263 
264 oofGeoColumn::oofGeoColumn(int XIdeal ,int width,int height, oofSeries* SeriesPtr)
265  : oofLabelledGeo(XIdeal,0,SeriesPtr,posNone)
266 {
267  mIdealWidth = width;
268  mIdealHeight = height;
269 }
270 
271 void
273 {
274  oofLabelledGeo::DrawSelf(inStyle);
275 
276 // draw AFTER label above bar, so it doesn't erase our top line
277  inStyle->useStyleColors();
278  oofRect theRect;
279 
280  theRect.set(mXDraw,
282  mXDraw + mDrawWidth,
283  mYDraw);
284 #ifdef _Macintosh
285  ::FillRect(theRect,inStyle->currentPattern());
286 // ::FrameRect(theRect);
288  // Draw pretend 3D stuff
290  PolyHandle BoxTop=::OpenPoly();
291  ::MoveTo(theRect.left,theRect.top);
292  ::Line(depth,-depth);
293  ::Line(theRect.right-theRect.left,0);
294  ::Line(-depth,depth);
295  ::Line(theRect.left-theRect.right,0);
296  ::ClosePoly();
297  PolyHandle BoxSide=::OpenPoly();
298  ::MoveTo(theRect.right,theRect.top);
299  ::Line(depth,-depth);
300  ::Line(0,theRect.bottom-theRect.top);
301  ::Line(-depth,depth);
302  ::Line(0,theRect.top-theRect.bottom);
303  ::ClosePoly();
304  if (inStyle->isMono()) {
305  ::FillPoly(BoxTop,inStyle->currentPattern());
306  ::FillPoly(BoxSide,inStyle->currentPattern());
307 // boxes AFTER the fills so they draw on top
308  ::FrameRect(theRect);
309  ::FramePoly(BoxTop);
310  ::FramePoly(BoxSide);
311  }
312  else { // colour variations on the screen
313 
314  // OK - Now paint the boxes !
315  RGBColor TopColor=inStyle->foreColor();
316  RGBColor SideColor=inStyle->foreColor();
317  // Make the top colour a bit darker and the side a lot darker
318  TopColor.red=TopColor.red*0.8;
319  TopColor.green=TopColor.green*0.8;
320  TopColor.blue=TopColor.blue*0.8;
321  ::RGBForeColor(&TopColor);
322  ::FillPoly(BoxTop,inStyle->currentPattern());
323  SideColor.red=SideColor.red*0.4;
324  SideColor.green=SideColor.green*0.4;
325  SideColor.blue=SideColor.blue*0.4;
326  ::RGBForeColor(&SideColor);
327  ::FillPoly(BoxSide,inStyle->currentPattern());
328  // Fix the colors !
329  inStyle->useStyleColors();
330  }
331  }
332 #elif defined _Windows
333  HDC hdc = oofCurrentDraw::getCurrentDC();
334  HBRUSH hOldBr = (HBRUSH)::SelectObject(hdc, (HBRUSH)inStyle->currentPattern());
335 
336  // We should already have the correct pen selected
337  ::Rectangle(hdc, theRect.left, theRect.top, theRect.right, theRect.bottom);
338  // Cleanup
339  ::SelectObject(hdc, hOldBr);
340 
341  if(oofGraph::currentGraph()->settings()->has3DEffect()) {
342  // Draw pretend 3D stuff
343  unsigned depth=(float)mDrawWidth*oofGraph::currentGraph()->settings()->the3DEffectMultiplier();
344  // fill and current drawing handles
345  HBRUSH newBrush;
346  HBRUSH oldBrush = (HBRUSH)::GetCurrentObject(hdc, OBJ_BRUSH);
347  HPEN newPen;
348  HPEN oldPen = (HPEN)::GetCurrentObject(hdc, OBJ_PEN);
349  COLORREF sideColor;
350  COLORREF foreColor = inStyle->foreColor();
351  // draw side of the box (which is one point bigger, because border is not affected
352  // when area is filled and we are using empty pen when drawing borders)
353  POINT points[4] = {
354  {theRect.left-1, theRect.top+1},
355  {theRect.left+depth+1, theRect.top-depth-1},
356  {theRect.right+depth+1, theRect.top-depth-1},
357  {theRect.right-1, theRect.top+1}
358  };
359 
360  sideColor = RGB(
361  GetRValue(foreColor) * 0.8,
362  GetGValue(foreColor) * 0.8,
363  GetBValue(foreColor) * 0.8
364  );
365 
366  newBrush = ::CreateSolidBrush(sideColor);
367  newPen = (HPEN)::GetStockObject(NULL_PEN);
368 
369  assert(newBrush != NULL);
370  assert(newPen != NULL);
371 
372  ::SelectObject(hdc, newBrush);
373  ::SelectObject(hdc, newPen);
374 
375  ::Polygon(hdc, points, 4);
376 
377  // draw top of the box
378  POINT topPoints[4] = {
379  {theRect.right-1, theRect.bottom},
380  {theRect.right+depth+1, theRect.bottom-depth-2},
381  {theRect.right+depth+1, theRect.top-depth-1},
382  {theRect.right-1, theRect.top+1}
383  };
384 
385  sideColor = RGB(
386  GetRValue(foreColor) * 0.4,
387  GetGValue(foreColor) * 0.4,
388  GetBValue(foreColor) * 0.4
389  );
390 
391  newBrush = ::CreateSolidBrush(sideColor);
392  assert(newBrush != NULL);
393  ::DeleteObject(::SelectObject(hdc, newBrush));
394 
395  ::Polygon(hdc, topPoints, 4);
396 
397  // return old drawing tools and destroy the old ones, which was selected last
398  if (oldBrush)
399  ::DeleteObject(::SelectObject(hdc, oldBrush));
400  if (oldPen)
401  ::SelectObject(hdc, oldPen); // don't delete stock object
402  // Fix the colors !
403  inStyle->useStyleColors();
404  }
405 #endif // OS
406 }
407 
408 
409 oofRect
411 {
412  oofRect r;
413 
414  r.left = mXIdeal;
415  r.right = mXIdeal + mIdealWidth;
416  if(mIdealHeight >= 0) {
417  r.bottom = mYIdeal;
418  r.top = mYIdeal + mIdealHeight;
419  }
420  else {
421  r.top = mYIdeal;
422  r.bottom = mYIdeal + mIdealHeight;
423  }
424 
425  if(oofGraph::currentGraph()->settings()->has3DEffect()){
426  unsigned depth=mIdealWidth*oofGraph::currentGraph()->settings()->the3DEffectMultiplier();
427  r.right+=depth;
428  r.top+=depth;
429  }
430  return r;
431 }
432 
433 
434 void
435 oofGeoColumn::Transform( oofTransformationManager* inTransformationManagerPtr )
436 {
437  // transform the draw start point (bottom left)
438  inTransformationManagerPtr->TransformPoint
440  // transform the column width
441  inTransformationManagerPtr->TransformHoLength
443  // transform the column height
444  inTransformationManagerPtr->TransformVeLength
446 
447  // See if we need labels
448  setLabel(oofGraph::currentGraph()->settings()->hasValuesOverColumns(),
449  mIdealHeight,
450  mXIdeal,
452  mIdealWidth );
453  oofLabelledGeo::Transform(inTransformationManagerPtr);
454 }
455 
456 
457 void
458 oofGeoColumn::describe(ostream& os) const
459 {
460  oofLabelledGeo::describe(os); // call the DIRECT parent, not always oofGeo
461  os << "mIdealWidth : " << mIdealWidth
462  << "mIdealHeight : " << mIdealHeight
463  << "mDrawWidth : " << mDrawWidth
464  << "mDrawHeight :" << mDrawHeight << endl ;
465 }
466 
467 
468 oofString
470 {
471  return "oofGeoColumn";
472 }
473 
474 
475 // ---------------------------------------------------------------------------------
476 // oofGeoPoint
477 // ---------------------------------------------------------------------------------
478 
479 
480 oofGeoPoint::oofGeoPoint(int XIdeal, int YIdeal, oofSeries* SeriesPtr, PositionState pos)
481  : oofGeo(XIdeal,YIdeal,SeriesPtr,pos)
482 {
483 }
484 
485 
486 void
488 {
489  inStyle->useStyleColors();
490  inStyle->symbol()->draw(mXDraw,mYDraw);
491 }
492 
493 
494 oofRect
496 {
497  oofRect r;
498  // return a simple point rectangle
500 
501  return r;
502 }
503 
504 
505 void
506 oofGeoPoint::Transform( oofTransformationManager* inTransformationManagerPtr )
507 {
508  // transform the draw start point (bottom left)
509  inTransformationManagerPtr->TransformPoint
511 }
512 
513 
514 void
515 oofGeoPoint::describe(ostream& os) const
516 {
517 
518  oofGeo::describe(os); // call the DIRECT parent, not always oofGeo
519  os <<endl;
520 }
521 
522 
523 oofString
525 {
526  return "oofGeoPoint";
527 }
528 
529 
530 // ---------------------------------------------------------------------------------
531 // oofGeoLine
532 // ---------------------------------------------------------------------------------
533 
534 
535 oofGeoLine::oofGeoLine(int XIdeal, int YIdeal, oofSeries* SeriesPtr, PositionState pos)
536  : oofGeoPoint(XIdeal,YIdeal,SeriesPtr,pos)
537 {
539  mSeriesPtr->setLastGeo(this);
540 }
541 
542 
543 void
545 {
546 /* The first point-line object in a linked set is a special object which causes
547 all the lines to be drawn for the series with which it is associated.
548 */
549  inStyle->useStyleColors();
550  oofGeoLine *theCurrentPoint;
551  if (mLastPoint == 0) { // if this could be the first of a set of linked points
552  theCurrentPoint=(oofGeoLine*)mSeriesPtr->lastGeo();
553  if(theCurrentPoint){
554 #ifdef _Macintosh
555  ::MoveTo(theCurrentPoint->locationX(),theCurrentPoint->locationY());
556 #elif defined _Windows
557  HDC hCurrdc = oofCurrentDraw::getCurrentDC();
558  ::MoveToEx(hCurrdc, theCurrentPoint->locationX(),theCurrentPoint->locationY(), NULL);
559 #endif // OS
560  theCurrentPoint = theCurrentPoint->lastPoint();
561  while (theCurrentPoint) { // if there are linked points
562  // draw the line
563 #ifdef _Macintosh
564  ::LineTo(theCurrentPoint->locationX(),theCurrentPoint->locationY());
565 #elif defined _Windows
566  ::LineTo(hCurrdc, theCurrentPoint->locationX(),theCurrentPoint->locationY());
567 #endif // OS
568  // reset the current point
569  theCurrentPoint = theCurrentPoint->lastPoint();
570  }
571  }
572  }
573  // draw the symbol
574  oofGeoPoint::DrawSelf(inStyle);
575 }
576 
577 
578 void
579 oofGeoLine::describe(ostream& os) const
580 {
581  oofGeoPoint::describe(os); // call the DIRECT parent, not always oofGeo
582  os << "mLastPoint : " << mLastPoint << endl ;
583 }
584 
585 
586 oofString
588 {
589  return "oofGeoLine";
590 }
591 
592 
593 // ---------------------------------------------------------------------------------
594 // oofGeoBar
595 // ---------------------------------------------------------------------------------
596 
597 
598 oofGeoBar::oofGeoBar(int XIdeal, int YIdeal,
599  int width,int height, oofSeries* SeriesPtr, PositionState pos)
600  : oofLabelledGeo(XIdeal,YIdeal,SeriesPtr,pos)
601 {
602  mIdealWidth = width;
603  mIdealHeight = height;
604 }
605 
606 oofGeoBar::oofGeoBar(int YIdeal ,int width,int height, oofSeries* SeriesPtr)
607  : oofLabelledGeo(0,YIdeal,SeriesPtr,posNone)
608 {
609  mIdealWidth = width;
610  mIdealHeight = height;
611 }
612 
613 
614 void
616 {
617  oofLabelledGeo::DrawSelf(inStyle);
618 
619  // draw AFTER label to the right of bar, so it doesn't erase our right line
620  inStyle->useStyleColors();
621  oofRect theRect(mXDraw,
622  mYDraw - mDrawWidth,
623  mXDraw + mDrawHeight,
624  mYDraw);
625 #ifdef _Macintosh
626  ::FillRect(theRect,inStyle->currentPattern());
627 // ::FrameRect(theRect);
629  // Draw pretend 3D stuff
630  unsigned depth=(float)mDrawWidth*oofGraph::currentGraph()->settings()->the3DEffectMultiplier();
631  PolyHandle BoxSide=::OpenPoly();
632  ::MoveTo(theRect.left,theRect.top);
633  ::Line(depth,-depth);
634  ::Line(theRect.right-theRect.left,0);
635  ::Line(-depth,depth);
636  ::Line(theRect.left-theRect.right,0);
637  ::ClosePoly();
638  PolyHandle BoxTop=::OpenPoly();
639  ::MoveTo(theRect.right,theRect.top);
640  ::Line(depth,-depth);
641  ::Line(0,theRect.bottom-theRect.top);
642  ::Line(-depth,depth);
643  ::Line(0,theRect.top-theRect.bottom);
644  ::ClosePoly();
645  if (inStyle->isMono()) {
646  ::FillPoly(BoxTop,inStyle->currentPattern());
647  ::FillPoly(BoxSide,inStyle->currentPattern());
648 // boxes AFTER the fills so they draw on top
649  ::FrameRect(theRect);
650  ::FramePoly(BoxTop);
651  ::FramePoly(BoxSide);
652  }
653  else { // colour variations on the screen
654 
655  // OK - Now paint the boxes !
656  RGBColor TopColor=inStyle->foreColor();
657  RGBColor SideColor=inStyle->foreColor();
658  // Make the top colour a bit darker and the side a lot darker
659  TopColor.red=TopColor.red*0.4;
660  TopColor.green=TopColor.green*0.4;
661  TopColor.blue=TopColor.blue*0.4;
662  ::RGBForeColor(&TopColor);
663  ::FillPoly(BoxTop,inStyle->currentPattern());
664  SideColor.red=SideColor.red*0.8;
665  SideColor.green=SideColor.green*0.8;
666  SideColor.blue=SideColor.blue*0.8;
667  ::RGBForeColor(&SideColor);
668  ::FillPoly(BoxSide,inStyle->currentPattern());
669  // Fix the colors !
670  inStyle->useStyleColors();
671  }
672  }
673 #elif defined _Windows
674  HDC hdc = oofCurrentDraw::getCurrentDC();
675  HBRUSH hOldBr = (HBRUSH)::SelectObject(hdc, (HBRUSH)inStyle->currentPattern());
676 
677  // We should already have the correct pen selected
678  ::Rectangle(hdc, theRect.left, theRect.top, theRect.right, theRect.bottom);
679  // Cleanup
680  ::SelectObject(hdc, hOldBr);
681 
682  if(oofGraph::currentGraph()->settings()->has3DEffect()){
683  // Draw pretend 3D stuff
684  unsigned depth=(float)mDrawWidth*oofGraph::currentGraph()->settings()->the3DEffectMultiplier();
685  // fill and current drawing handles
686  HBRUSH newBrush;
687  HBRUSH oldBrush = (HBRUSH)::GetCurrentObject(hdc, OBJ_BRUSH);
688  HPEN newPen;
689  HPEN oldPen = (HPEN)::GetCurrentObject(hdc, OBJ_PEN);
690  COLORREF sideColor;
691  COLORREF foreColor = inStyle->foreColor();
692  // draw side of the box (which is one point bigger, because border is not affected
693  // when area is filled and we are using empty pen when drawing borders)
694  POINT points[4] = {
695  {theRect.left-1, theRect.top+1},
696  {theRect.left+depth+1, theRect.top-depth-1},
697  {theRect.right+depth+1, theRect.top-depth-1},
698  {theRect.right-1, theRect.top+1}
699  };
700 
701  sideColor = RGB(
702  GetRValue(foreColor) * 0.8,
703  GetGValue(foreColor) * 0.8,
704  GetBValue(foreColor) * 0.8
705  );
706 
707  newBrush = ::CreateSolidBrush(sideColor);
708  newPen = (HPEN)::GetStockObject(NULL_PEN);
709 
710  assert(newBrush != NULL);
711  assert(newPen != NULL);
712 
713  ::SelectObject(hdc, newBrush);
714  ::SelectObject(hdc, newPen);
715 
716  ::Polygon(hdc, points, 4);
717 
718  // draw top of the box
719  POINT topPoints[4] = {
720  {theRect.right-1, theRect.bottom},
721  {theRect.right+depth+1, theRect.bottom-depth-2},
722  {theRect.right+depth+1, theRect.top-depth-1},
723  {theRect.right-1, theRect.top+1}
724  };
725 
726  sideColor = RGB(
727  GetRValue(foreColor) * 0.4,
728  GetGValue(foreColor) * 0.4,
729  GetBValue(foreColor) * 0.4
730  );
731 
732  newBrush = ::CreateSolidBrush(sideColor);
733  assert(newBrush != NULL);
734  ::DeleteObject(::SelectObject(hdc, newBrush));
735 
736  ::Polygon(hdc, topPoints, 4);
737 
738  // return old drawing tools and destroy the old ones, which was selected last
739  if (oldBrush)
740  ::DeleteObject(::SelectObject(hdc, oldBrush));
741  if (oldPen)
742  ::SelectObject(hdc, oldPen); // don't delete stock object
743  // Fix the colors !
744  inStyle->useStyleColors();
745  }
746 #endif // OS
747 }
748 
749 
750 oofRect
752 {
753  oofRect r;
754 
755  r.bottom=mYIdeal;
756  r.top=mYIdeal+mIdealWidth;
757  if(mIdealHeight>=0) {
758  r.left=mXIdeal;
759  r.right=mXIdeal+mIdealHeight;
760  } else {
761  r.right=mXIdeal;
762  r.left=mXIdeal+mIdealHeight;
763  }
764 
765  if(oofGraph::currentGraph()->settings()->has3DEffect()){
766  unsigned depth=mIdealWidth*oofGraph::currentGraph()->settings()->the3DEffectMultiplier();
767  r.right+=depth;
768  r.top+=depth;
769  }
770  return r;
771 }
772 
773 
774 void
775 oofGeoBar::Transform( oofTransformationManager* inTransformationManagerPtr )
776 {
777  // transform the draw start point (bottom left)
778  inTransformationManagerPtr->TransformPoint
780  // transform the row width
781  inTransformationManagerPtr->TransformVeLength
783  // transform the row height
784  inTransformationManagerPtr->TransformHoLength
786 
787  // See if we need labels
788  setLabel(oofGraph::currentGraph()->settings()->hasValuesNextToBars(),
789  mIdealHeight,
791  mYIdeal,
792  mIdealHeight == 0 ? 1 : ((int)log10((double)abs(mIdealHeight)) + 2));
793  oofLabelledGeo::Transform(inTransformationManagerPtr);
794 }
795 
796 
797 void
798 oofGeoBar::describe(ostream& os) const
799 {
800 
801  oofLabelledGeo::describe(os); // call the DIRECT parent, not always oofGeo
802  os << "mIdealWidth : " << mIdealWidth
803  << "mDrawWidth : " << mDrawWidth
804  << "mIdealHeight : " << mIdealHeight
805  << "mDrawHeight :" << mDrawHeight
806  << "mDrawHeight :" << mDrawHeight<< endl ;
807 }
808 
809 
810 oofString
812 {
813  return "oofGeoBar";
814 }
815 
816 
817 // ---------------------------------------------------------------------------------
818 // oofGeoSector
819 // ---------------------------------------------------------------------------------
820 
821 
822 oofGeoSector::oofGeoSector(int XIdeal, int YIdeal, int diameter,
823  int start, int arc, oofSeries* SeriesPtr , PositionState pos)
824  : oofGeo(XIdeal,YIdeal,SeriesPtr,pos)
825 {
826  mIdealDiameter = diameter;
827  mStartAngle = start;
828  mArcAngle = arc;
829 }
830 
831 
832 void
834 {
835  inStyle->useStyleColors();
836  oofRect theRect;
837 
838  theRect.bottom=mYDraw;
839  theRect.top=mYDraw-mDrawDiameter;
840  theRect.left=mXDraw;
841  theRect.right=mXDraw+mDrawDiameter;
842 
843 #ifdef _Macintosh
844  ::FillArc(theRect,mStartAngle,mArcAngle,inStyle->currentPattern());
845  ::FrameArc(theRect,mStartAngle,mArcAngle);
846 
847 // The following is just a start - it's nowhere near finished !
848 
849 /* if(oofGraph::currentGraph()->settings()->has3DEffect()){
850  // Draw pretend 3D stuff
851  //unsigned depth=(float)mDrawDiameter/100*K3DMULTIPLIER;
852  unsigned depth=20;
853  RgnHandle Side=::NewRgn();
854  ::OpenRgn();
855  ::FrameArc(theRect,mStartAngle,mArcAngle);
856  ::Line(0,depth);
857  Rect OffsetArc=theRect;
858  ::OffsetRect(&OffsetArc,0,depth);
859  ::FrameArc(&OffsetArc,mStartAngle+mArcAngle,-mArcAngle);
860  ::Line(0,-depth);
861  ::CloseRgn(Side);
862  RGBColor SideColor=inStyle->foreColor();
863  // Make the side a bit darker
864  SideColor.red=SideColor.red*0.6;
865  SideColor.green=SideColor.green*0.6;
866  SideColor.blue=SideColor.blue*0.6;
867  ::RGBForeColor(&SideColor);
868  ::FillRgn(Side,inStyle->currentPattern());
869  // Fix the colors !
870  inStyle->useStyleColors();
871  }
872 */
873 
874 #elif defined _Windows
875  HDC hdc = oofCurrentDraw::getCurrentDC();
876  HBRUSH hOldBr = (HBRUSH)::SelectObject(hdc, (HBRUSH)inStyle->currentPattern());
877  POINT ptStart, ptEnd;
878 
879  // We have to manipulate the two angles into points on the arc
880  ptStart = CalcRadialFromAngle(theRect, mStartAngle + mArcAngle);
881  // Need to convert mArcAngle into degress from vertical instead of
882  // degrees from start angle
883  ptEnd = CalcRadialFromAngle(theRect, mStartAngle);
884 
885  Pie(hdc, theRect.left,
886  theRect.top,
887  theRect.right,
888  theRect.bottom,
889  ptStart.x,
890  ptStart.y,
891  ptEnd.x,
892  ptEnd.y);
893  // Cleanup
894  ::SelectObject(hdc, hOldBr);
895 #endif // OS
896 }
897 
898 oofRect
900 {
901  // All the sectors just return the bounding rectangle of the entire pie
902  oofRect r;
903 
904  r.bottom=mYIdeal;
905  r.top=mYIdeal+mIdealDiameter;
906  r.left=mXIdeal;
907  r.right=mXIdeal+mIdealDiameter;
908 
909  return r;
910 }
911 
912 #ifdef _Windows
913 POINT
914 oofGeoSector::CalcRadialFromAngle(oofRect& rcBound, int nAngle)
915 {
916  POINT ptRet, ptCentre;
917 
918  // The passed in angle is assumed to be referenced from vertically
919  // up being angle 0. The Mac arc functions assume the first 'start'
920  // angle is referenced from there, but the second 'arc' angle is referenced
921  // from the first angle.
922  // To make this routine generic, the angle MUST be translated back to the
923  // vertical position by the calling routine.
924 
925  ptCentre.x = rcBound.left + (rcBound.right - rcBound.left)/2;
926 
927  ptCentre.y = rcBound.top + (rcBound.bottom - rcBound.top)/2;
928  nAngle = nAngle % 360;
929  if (nAngle < 0)
930  nAngle += 360;
931 
932  if (nAngle == 90) {
933  ptRet.x = rcBound.right;
934  ptRet.y = ptCentre.y;
935  }
936  else if (nAngle == 270) {
937  ptRet.x = rcBound.left;
938  ptRet.y = ptCentre.y;
939  }
940  else if (nAngle <= 45 || nAngle >= 315) {
941  ptRet.x = ptCentre.x + (ptCentre.y - rcBound.top) * tan(ConvertToRadians(nAngle));
942  ptRet.y = rcBound.top;
943  }
944  else if (45 < nAngle && nAngle < 135) {
945  ptRet.x = rcBound.right;
946  ptRet.y = ptCentre.y - ((rcBound.right - ptCentre.x) * tan(ConvertToRadians(90 - nAngle)));
947  }
948  else if (135 <= nAngle && nAngle <= 225) {
949  ptRet.x = ptCentre.x - (ptCentre.y - rcBound.top) * tan(ConvertToRadians(nAngle));
950  ptRet.y = rcBound.bottom;
951  }
952  else if (225 < nAngle && nAngle < 315) {
953  ptRet.x = rcBound.left;
954  ptRet.y = ptCentre.y + ((rcBound.right - ptCentre.x) * tan(ConvertToRadians(90 - nAngle)));
955  }
956 
957  return ptRet;
958 }
959 #endif // _Windows
960 
961 void
962 oofGeoSector::Transform( oofTransformationManager* inTransformationManagerPtr )
963 {
964  int DrawHo,DrawVe,offh=0,offv=0;
965  inTransformationManagerPtr->TransformHoLength
966  (mIdealDiameter,DrawHo);
967  inTransformationManagerPtr->TransformVeLength
968  (mIdealDiameter,DrawVe);
969  if(DrawHo>DrawVe) {
970  mDrawDiameter=DrawVe;
971  offh=(DrawHo-DrawVe)/2;
972  } else {
973  mDrawDiameter=DrawHo;
974  offv=(DrawVe-DrawHo)/2;
975  }
976  inTransformationManagerPtr->TransformPoint
978  mXDraw+=offh;
979  mYDraw-=offv;
980 }
981 
982 
983 void
984 oofGeoSector::describe(ostream& os) const
985 {
986 
987  oofGeo::describe(os); // call the DIRECT parent, not always oofGeo
988  os << "mIdealDiameter : " << mIdealDiameter
989  << "mDrawDiameter : " << mDrawDiameter
990  << "mStartAngle : " << mStartAngle
991  << "mArcAngle :" << mArcAngle << endl ;
992 }
993 
994 
995 oofString
997 {
998  return "oofGeoSector";
999 }
1000 
1001 
1002 // ---------------------------------------------------------------------------------
1003 // oofGeoText
1004 // ---------------------------------------------------------------------------------
1005 
1006 
1007 oofGeoText::oofGeoText(int XIdeal, int YIdeal, int inWidth,
1008  const char* inString, oofSeries* SeriesPtr, PositionState pos) :
1009  oofGeo (XIdeal,YIdeal,SeriesPtr,pos),
1010  mText(inString),
1011  mIdealTextSize(12),
1012  mWidthIdeal(inWidth),
1013  mDrawHeight(0),
1014  mDrawWidth(0)
1015 {
1016 }
1017 
1018 
1020 {
1021 }
1022 
1023 
1024 void
1026 {
1027  int charHeight = calcCharHeight();
1028 // ES
1029 // int descent;
1030 
1031  setFontSize();
1032  inStyle->useStyleColors();
1033  unsigned int numrows=mSizer.GetNumRows();
1034  const unsigned long * lines = mSizer.GetLineStarts();
1035  const unsigned long * lengths = mSizer.GetLineLengths();
1036  short bytes;
1037  int xmod=0;
1038  // We have to calculate the descent of the characters for positioning
1039 #ifdef _Macintosh
1040  FontInfo fi;
1041  ::GetFontInfo(&fi);
1042  int descent = fi.descent;
1043 #elif defined _Windows
1044  HDC hdc = oofCurrentDraw::getCurrentDC();
1045 // ES
1046 // TEXTMETRIC tm;
1047 // ::GetTextMetrics(hdc, &tm);
1048 // descent = tm.tmDescent;
1049  const LPCSTR pszString = mText.chars(); // Get a pointer to the string we're going to display
1050 #endif // OS
1051  for(unsigned int rownum=0; rownum < numrows; rownum++) {
1052  switch (mPosition) {
1053  case (posLeft) :
1054  xmod = 0;
1055  break;
1056 
1057  case (posCentre) :
1058  xmod = (mDrawWidth-lengths[rownum])/2;
1059  break;
1060 
1061  case (posRight) :
1062  xmod = mDrawWidth-lengths[rownum];
1063  break;
1064 
1065  default:
1066  xmod = (mDrawWidth-lengths[rownum])/2; // default to centred text
1067  break;
1068  }
1069  if(rownum==(numrows-1))
1070  bytes=mText.length()-lines[rownum];
1071  else
1072  bytes=lines[rownum+1]-lines[rownum];
1073 #ifdef _Macintosh
1074  ::MoveTo(mXDraw+xmod, mYDraw+(rownum-numrows+1)*charHeight-descent);
1075  ::DrawText(mText,lines[rownum],bytes);
1076 #elif defined _Windows
1077  ::TextOut(hdc,
1078  mXDraw+xmod,
1079  mYDraw+(rownum-numrows)*charHeight,
1080  pszString + lines[rownum],
1081  bytes);
1082 #endif // OS
1083  }
1084  // can text have a pattern?
1085 }
1086 
1087 
1088 void
1089 oofGeoText::Transform( oofTransformationManager* inTransformationManagerPtr )
1090 {
1091  int charHeight;
1092 
1093  inTransformationManagerPtr->TransformTextSize(mIdealTextSize,mDrawTextSize);
1094  inTransformationManagerPtr->TransformHoLength(mWidthIdeal,mDrawWidth);
1095 
1096  if (!(charHeight = calcCharHeight()))
1097  return;
1098  setFontSize();
1100 
1101  mDrawHeight=mSizer.GetNumRows()*charHeight;
1102  inTransformationManagerPtr->TransformPoint(mXIdeal,mYIdeal,mXDraw,mYDraw);
1103 }
1104 
1105 oofRect
1107 {
1108  // OK - This is awful - but we're going to return real pixel coords for
1109  // the moment - until I get organised and make two functions to do
1110  // this.
1111  Transform(tm);
1112 
1113  oofRect r(0, 0, mDrawWidth, mDrawHeight);
1114  return r;
1115 }
1116 
1117 
1118 void
1119 oofGeoText::describe(ostream& os) const
1120 {
1121  oofGeo::describe(os); // call the DIRECT parent, not always oofGeo
1122  os << "mText : " << mText
1123  << "mIdealTextSize : " << mIdealTextSize
1124  << "mWidthIdeal : " << mWidthIdeal
1125  << "mDrawTextSize :" << mDrawTextSize
1126  << "mDrawWidth :" << mDrawWidth
1127  << "mDrawHeight :" << mDrawHeight << endl ;
1128 }
1129 
1130 
1131 oofString
1133 {
1134  return "oofGeoText";
1135 }
1136 
1137 
1138 // ---------------------------------------------------------------------------------
1139 // oofGeoSuppressibleText
1140 // ---------------------------------------------------------------------------------
1141 
1142 
1143 oofGeoSuppressibleText::oofGeoSuppressibleText(int XIdeal, int YIdeal, int Width,
1144  const char* inString, oofSeries* SeriesPtr, PositionState pos)
1145  : oofGeoText(XIdeal,YIdeal,Width,inString,SeriesPtr,pos)
1146 {
1147 }
1148 
1149 
1150 oofGeoSuppressibleText::oofGeoSuppressibleText(int Width, const char* inString)
1151  : oofGeoText(0,0,Width,inString,0,posTop)
1152 {
1153 }
1154 
1155 
1156 void
1158 {
1159  if (ShouldDraw())
1160  oofGeoText::DrawSelf(inStyle);
1161 }
1162 
1163 
1164 oofRect
1166 {
1167  oofRect r;
1168  if (ShouldDraw())
1169  r = oofGeoText::BoundingRect(tm);
1170  else
1171  r.set(0,0,0,0);
1172  return r;
1173 }
1174 
1175 
1176 void
1178 {
1179  oofGeoText::describe(os); // call the DIRECT parent, not always oofGeo
1180  os << endl ;
1181 }
1182 
1183 
1184 oofString
1186 {
1187  return "oofGeoSuppressibleText";
1188 }
1189 
1190 
1191 // ---------------------------------------------------------------------------------
1192 // oofGeoTitle
1193 // ---------------------------------------------------------------------------------
1194 
1195 
1196 oofGeoTitle::oofGeoTitle(int XIdeal, int YIdeal, int Width,
1197  const char* inString, oofSeries* SeriesPtr, PositionState pos)
1198  : oofGeoSuppressibleText(XIdeal,YIdeal,Width,inString,SeriesPtr,pos)
1199 {
1200  mIdealTextSize = 18;
1201 }
1202 
1203 oofGeoTitle::oofGeoTitle(int Width, const char* inString)
1204  : oofGeoSuppressibleText(0,0,Width,inString,0,posTop)
1205 {
1206  mIdealTextSize = 18;
1207 }
1208 
1209 
1210 bool
1212 {
1213  bool ret = oofGraph::currentGraph()->settings()->hasTitle();
1214  return ret;
1215 }
1216 
1217 
1218 /* UnJames
1219 oofRect
1220 oofGeoTitle::GetAlreadyTransformedBoundingRect(oofTransformationManager* tm)
1221 {
1222  oofRect r;
1223  if (oofGraph::currentGraph()->settings()->hasTitle())
1224  r = oofGeoText::GetAlreadyTransformedBoundingRect(tm);
1225  else
1226  r.set(0,0,0,0);
1227  return r;
1228 }
1229 */
1230 
1231 void
1233 {
1234  if (!oofGraph::currentGraph()->settings()->hasTitle())
1235  return; // save the effort if not drawing Title
1236 
1237  int charHeight;
1239  // Text object sizes are constant
1241  inTransformationManagerPtr->TransformHoLength(mWidthIdeal,mDrawWidth);
1242  if (!(charHeight = calcCharHeight()))
1243  return;
1244  setFontSize();
1245  // Save the old sizes first
1246  int saveHeight = mDrawHeight;
1247 // UnJames oofRect saveBound = GetAlreadyTransformedBoundingRect(inTransformationManagerPtr);
1249  mDrawHeight = mSizer.GetNumRows() * charHeight;
1250  // OK - we may have changed height here !
1251  oofRect M = inTransformationManagerPtr->getMargins();
1252  if(saveHeight != mDrawHeight) {
1253  M.top += (mDrawHeight - saveHeight);
1254  inTransformationManagerPtr->setMargins(M);
1255  mYIdeal += (mDrawHeight - saveHeight);
1256  }
1257  // For now - we just lock this text to the top of the window
1258  int dx,dy, dummy;
1259  oofRect I=inTransformationManagerPtr->getIdealRect();
1260  inTransformationManagerPtr->TransformPoint(0,I.top,dx,dy);
1261  mYDraw=dy-2;
1262  //mYDraw=mYIdeal;
1263  inTransformationManagerPtr->TransformPoint(mXIdeal,mYIdeal,mXDraw,dummy);
1264 }
1265 
1266 
1267 oofString
1269 {
1270  return "oofGeoTitle";
1271 }
1272 
1273 
1274 // ---------------------------------------------------------------------------------
1275 // oofGeoXLabel
1276 // ---------------------------------------------------------------------------------
1277 
1278 
1279 oofGeoXLabel::oofGeoXLabel(int XIdeal, int YIdeal, int Width,
1280  const char* inString, oofSeries* SeriesPtr, PositionState pos)
1281  : oofGeoSuppressibleText(XIdeal,YIdeal,Width,inString, SeriesPtr, pos)
1282 {
1283 }
1284 
1285 oofGeoXLabel::oofGeoXLabel(int Width, const char* inString)
1286  : oofGeoSuppressibleText(0,0,Width,inString, 0, posBottom)
1287 {
1288 }
1289 
1290 
1291 bool
1293 {
1294  bool ret = oofGraph::currentGraph()->settings()->hasXLabel();
1295  return ret;
1296 }
1297 
1298 
1299 void
1301 {
1302  if (!oofGraph::currentGraph()->settings()->hasXLabel())
1303  return; // save the effort if not drawing
1304 
1305  int charHeight;
1306 
1307  // Text object sizes are constant
1310  inTransformationManagerPtr->TransformHoLength(mWidthIdeal,mDrawWidth);
1311  if (!(charHeight = calcCharHeight()))
1312  return;
1313  setFontSize();
1315  int saveHeight = mDrawHeight;
1316  mDrawHeight = mSizer.GetNumRows() * charHeight;
1317  oofRect M=inTransformationManagerPtr->getMargins();
1318  // OK - we may have changed height here !
1319  if(saveHeight != mDrawHeight) {
1320  // Work out what the hell to do ! - Remember - we are below the tick labels !
1321  M.bottom += (mDrawHeight - saveHeight);
1322  inTransformationManagerPtr->setMargins(M);
1323  }
1324 // For now - we just lock this text to the bottom of the window
1325  int dx,dy, dummy;
1326  oofRect I=inTransformationManagerPtr->getIdealRect();
1327  inTransformationManagerPtr->TransformPoint(0,I.bottom,dx,dy);
1328  mYDraw=dy+M.bottom-2;
1329  inTransformationManagerPtr->TransformPoint(mXIdeal,mYIdeal,mXDraw,dummy);
1330 }
1331 
1332 
1333 oofString
1335 {
1336  return "oofGeoXLabel";
1337 }
1338 
1339 
1340 // ---------------------------------------------------------------------------------
1341 // oofGeoYLabel
1342 // ---------------------------------------------------------------------------------
1343 
1344 
1345 oofGeoYLabel::oofGeoYLabel(int XIdeal, int YIdeal, int Width,
1346  const char* inString, oofSeries* SeriesPtr, PositionState pos)
1347  : oofGeoSuppressibleText(XIdeal,YIdeal,Width,inString, SeriesPtr, pos)
1348 {
1349 }
1350 
1351 
1352 oofGeoYLabel::oofGeoYLabel(const char* inString)
1353  : oofGeoSuppressibleText(0,0,0,inString, 0, posLeft)
1354 {
1355 }
1356 
1357 
1358 bool
1360 {
1361  bool ret = oofGraph::currentGraph()->settings()->hasYLabel();
1362  return ret;
1363 }
1364 
1365 
1366 void
1368 {
1369  if (!oofGraph::currentGraph()->settings()->hasYLabel())
1370  return; // save the effort if not drawing
1371 
1372  // All of this stuff has been moved from the constructor because the
1373  // MS-Windows version needs an active DC to measure the fonts & this is
1374  // not likely during object construction.
1375 
1376  // All Text Objects are constant
1379  int charHeight = calcCharHeight();
1380  setFontSize();
1381 
1384  const unsigned long* lineLengths=mSizer.GetLineLengths();
1385  unsigned short maxLen=0;
1386  int saveWidth = mDrawWidth;
1387  for(unsigned short i=0;i<mSizer.GetNumRows();i++) {
1388  if(lineLengths[i]>maxLen)
1389  maxLen=lineLengths[i];
1390  }
1391  mWidthIdeal = maxLen;
1393  mDrawHeight = mSizer.GetNumRows()*charHeight;
1394 
1395  oofRect rcMargins = inTransformationManagerPtr->getMargins();
1396  // OK - we may have changed width here !
1397  if(saveWidth != mDrawWidth) {
1398  // Work out what the hell to do ! - Remember - we are below the tick labels !
1399 // ES
1400 // rcMargins.left += (mDrawWidth - saveWidth);
1401 // ES - just a hard-coded value for now
1402  rcMargins.left += 5;
1403  inTransformationManagerPtr->setMargins(rcMargins);
1404  }
1405 // For now - we just lock this text to the left of the window
1406  int dx,dy;
1407  oofRect rcIdeal = inTransformationManagerPtr->getIdealRect();
1408  inTransformationManagerPtr->TransformPoint(rcIdeal.left,0,dx,dy);
1409  mXDraw = dx - rcMargins.left;
1410  int dummy;
1411  inTransformationManagerPtr->TransformPoint(mXIdeal,mYIdeal,dummy,mYDraw);
1412 }
1413 
1414 
1415 oofString
1417 {
1418  return "oofGeoYLabel";
1419 }
1420 
1421 
1422 // ---------------------------------------------------------------------------------
1423 // oofGeoXTickLabel
1424 // ---------------------------------------------------------------------------------
1425 
1426 
1427 oofGeoXTickLabel::oofGeoXTickLabel(int XIdeal, int YIdeal, int Width,
1428  const char* inString, oofSeries* SeriesPtr, PositionState pos)
1429  : oofGeoText(XIdeal,YIdeal,Width,inString, SeriesPtr, pos)
1430 {
1431  mIdealTextSize = 10;
1432 }
1433 
1434 
1435 oofGeoXTickLabel::oofGeoXTickLabel(int XIdeal, int Width, const char* inString)
1436  : oofGeoText(XIdeal,0,Width,inString, 0, posBelow) // No series pointer !
1437 {
1438  mIdealTextSize = 10;
1439 }
1440 
1441 
1442 void
1444 {
1445  if (oofGraph::currentGraph()->settings()->hasXTickLabels()) {
1446  oofGeoText::DrawSelf(inStyle);
1447  }
1448 }
1449 
1450 
1451 void
1453 {
1454  int charHeight;
1455 
1456  if (oofGraph::currentGraph()->settings()->hasXTickLabels()) {
1457  // All Text Object sizes are constant
1459  inTransformationManagerPtr->TransformHoLength(mWidthIdeal,mDrawWidth);
1460 
1461  if (!(charHeight = calcCharHeight()))
1462  return;
1463  setFontSize();
1465  int saveHeight = mDrawHeight;
1466  mDrawHeight = mSizer.GetNumRows() * charHeight;
1467  // OK - we may have changed height here !
1468  Point P=inTransformationManagerPtr->getTickMargins();
1469  if(saveHeight != mDrawHeight) {
1470  // Work out what the hell to do ! - Remember - we are above the axis label !
1471  if(saveHeight < mDrawHeight) {
1472  if(P.v<mDrawHeight) {
1473  P.v=mDrawHeight;
1474  inTransformationManagerPtr->setTickMargins(P);
1475  }
1476  }
1477  else {
1478  if(P.v>mDrawHeight) {
1479  P.v=mDrawHeight;
1480  inTransformationManagerPtr->setTickMargins(P);
1481  }
1482  }
1483  }
1484  // In case we didn't change height - make sure we fit !
1485  if(P.v<mDrawHeight) {
1486  P.v=mDrawHeight;
1487  inTransformationManagerPtr->setTickMargins(P);
1488  }
1489  // For now - we just lock this text to the bottom of the window
1490  int dx,dy, dummy;
1491  oofRect I=inTransformationManagerPtr->getIdealRect();
1492  inTransformationManagerPtr->TransformPoint(0,I.bottom,dx,dy);
1494  inTransformationManagerPtr->TransformPoint(mXIdeal,mYIdeal,mXDraw,dummy);
1495  }
1496 }
1497 
1498 
1499 oofString
1501 {
1502  return "oofGeoXTickLabel";
1503 }
1504 
1505 
1506 
1507 // ---------------------------------------------------------------------------------
1508 // oofGeoYTickLabel
1509 // ---------------------------------------------------------------------------------
1510 
1511 
1512 oofGeoYTickLabel::oofGeoYTickLabel(int XIdeal, int YIdeal, int Width,
1513  const char* inString, oofSeries* SeriesPtr, PositionState pos)
1514  : oofGeoText(XIdeal,YIdeal,Width,inString, SeriesPtr, pos)
1515 {
1516  mIdealTextSize = 10;
1517 }
1518 
1519 
1520 oofGeoYTickLabel::oofGeoYTickLabel(int YIdeal, int Width, const char* inString)
1521  : oofGeoText(0,YIdeal,Width,inString, 0, posBelow) // No series pointer !
1522 {
1523  mIdealTextSize = 10;
1524 }
1525 
1526 
1527 void
1529 {
1530  if (oofGraph::currentGraph()->settings()->hasYTickLabels()) {
1531  oofGeoText::DrawSelf(inStyle);
1532  }
1533 }
1534 
1535 
1536 void
1538 {
1539  int charHeight;
1540 
1541  if (oofGraph::currentGraph()->settings()->hasYTickLabels()) {
1542  // All Text Object sizes are constant
1544  if (!(charHeight = calcCharHeight()))
1545  return;
1546  setFontSize();
1548  const unsigned long* lineLengths=mSizer.GetLineLengths();
1549  unsigned short maxLen=0;
1550  for(unsigned short i=0;i<mSizer.GetNumRows();i++) {
1551  if(lineLengths[i]>maxLen)
1552  maxLen=lineLengths[i];
1553  }
1554  mWidthIdeal = maxLen;
1556  mDrawHeight = mSizer.GetNumRows() * charHeight;
1557 
1558  Point ptMargins = inTransformationManagerPtr->getTickMargins();
1559  if (ptMargins.h < mDrawWidth) {
1560  ptMargins.h = mDrawWidth;
1561  inTransformationManagerPtr->setTickMargins(ptMargins);
1562  }
1563  int dummy;
1564  int dx;
1565  oofRect rcIdeal = inTransformationManagerPtr->getIdealRect();
1566  inTransformationManagerPtr->TransformPoint(rcIdeal.left,0,dx,dummy);//dg to me does this just return 0 always?
1567  mXDraw=dx-ptMargins.h;
1568  inTransformationManagerPtr->TransformPoint(mXIdeal,mYIdeal,dummy,mYDraw);
1569  mYDraw+=mDrawHeight/2;
1570  }
1571 }
1572 
1573 
1574 oofString
1576 {
1577  return "oofGeoYTickLabel";
1578 }
1579 
1580 
1581 // ---------------------------------------------------------------------------------
1582 // oofGeoXAxis
1583 // ---------------------------------------------------------------------------------
1584 
1585 
1586 oofGeoXAxis::oofGeoXAxis(int inLength, int MaInterval, int NumDivisions,
1587  oofSeries* SeriesPtr, PositionState pos)
1588  : oofGeo(0,0,SeriesPtr,pos)
1589 {
1590  mIdealLength = inLength;
1591  mIdealMaTickMark = MaInterval;
1592  mNumDivisions = NumDivisions;
1593 }
1594 
1595 
1596 void
1597 oofGeoXAxis::DrawSelf(const oofDrawStyle* inStyle)
1598 {
1599  inStyle->useStyleColors();
1600 #ifdef _Macintosh
1601  ::MoveTo(mXDraw,mYDraw);
1602  ::Line(mDrawLength,0);
1603 #elif defined _Windows
1604  HDC hdc = oofCurrentDraw::getCurrentDC();
1605 
1606  if (hdc) {
1607  ::MoveToEx(hdc, mXDraw, mYDraw, NULL);
1608  ::LineTo(hdc, mXDraw + mDrawLength, mYDraw);
1609  }
1610 #endif // OS
1611 
1612  if (oofGraph::currentGraph()->settings()->hasXAxisTicks()) {
1613  // Let's do this in double domain to avoid rounding errors.
1614  double MaMeasure = 0.0;
1615  double MiMeasure = 0.0;
1616  if(mNumDivisions)
1617  MiMeasure = mDrawMaTickMark / (double)mNumDivisions;
1618 
1619  unsigned short minorTickSize = oofGraph::currentGraph()->settings()->minorTickSize();
1620  unsigned short majorTickSize = oofGraph::currentGraph()->settings()->majorTickSize();
1621  while (MaMeasure < mDrawLength) {
1622  int x = (int)(MaMeasure + 0.5) + mXDraw;
1623 #ifdef _Macintosh
1624  ::MoveTo(x,mYDraw);
1625  ::Line(0, majorTickSize);
1626 #elif defined _Windows
1627  if (hdc) {
1628  ::MoveToEx(hdc, x, mYDraw, NULL);
1629  ::LineTo(hdc, x, mYDraw + majorTickSize);
1630  }
1631 #endif // OS
1632  if(mNumDivisions){
1633  unsigned theNumDivisions = mNumDivisions;
1634  if((int)(MaMeasure+mDrawMaTickMark+0.5)>mDrawLength)
1635  theNumDivisions=(int)(((double)mDrawLength-MaMeasure)/MiMeasure)+1;
1636  for(unsigned i=1;i<theNumDivisions;i++) {
1637  x = (int)(MaMeasure + i * MiMeasure + 0.5) + mXDraw;
1638 #ifdef _Macintosh
1639  ::MoveTo(x,mYDraw);
1640  ::Line(0, minorTickSize);
1641 #elif defined _Windows
1642  if (hdc) {
1643  ::MoveToEx(hdc, x, mYDraw, NULL);
1644  ::LineTo(hdc, x, mYDraw + minorTickSize);
1645  }
1646 #endif // OS
1647  }
1648  }
1649  MaMeasure += mDrawMaTickMark ;//-1; // Don't ask about the -1 please :)
1650  }
1651  }
1652 }
1653 
1654 
1655 oofRect
1657 {
1658  oofRect r;
1659 
1660  int IdealMajTickSize;
1661 
1663  oofGraph::currentGraph()->settings()->majorTickSize(),
1664  IdealMajTickSize
1665  );
1666  if (!IdealMajTickSize)
1667  IdealMajTickSize = 1; // temporary
1668 
1669  r.left=mXIdeal;
1670  r.right=mXIdeal+mIdealLength;
1671 
1672  r.top=mYIdeal;
1673  r.bottom=mYIdeal-IdealMajTickSize;
1674 
1675  return r;
1676 }
1677 
1678 
1679 void
1680 oofGeoXAxis::Transform( oofTransformationManager* inTransformationManagerPtr )
1681 {
1682  inTransformationManagerPtr->TransformPoint(mXIdeal,mYIdeal,mXDraw,mYDraw);
1683  inTransformationManagerPtr->TransformHoLength(mIdealLength,mDrawLength);
1684  inTransformationManagerPtr->TransformHoLength(mIdealMaTickMark,mDrawMaTickMark);
1685 }
1686 
1687 
1688 void
1689 oofGeoXAxis::describe(ostream& os) const
1690 {
1691 
1692  oofGeo::describe(os); // call the DIRECT parent, not always oofGeo
1693  os << "mIdealLength : " << mIdealLength
1694  << "mDrawLength : " << mDrawLength
1695  << "mIdealMaTickMark : " << mIdealMaTickMark
1696  << "mNumDivisions :" << mNumDivisions
1697  << "mDrawMaTickMark :" << mDrawMaTickMark << endl ;
1698 }
1699 
1700 
1701 oofString
1703 {
1704  return "oofGeoXAxis";
1705 }
1706 
1707 
1708 // ---------------------------------------------------------------------------------
1709 // oofGeoYAxis
1710 // ---------------------------------------------------------------------------------
1711 
1712 
1713 oofGeoYAxis::oofGeoYAxis(int inLength, int MaInterval, int NumDivisions,
1714  oofSeries* SeriesPtr, PositionState pos)
1715  : oofGeo(0,0,SeriesPtr,pos)
1716 {
1717  mIdealLength = inLength;
1718  mIdealMaTickMark = MaInterval;
1719  mNumDivisions = NumDivisions;
1720 }
1721 
1722 
1723 void
1724 oofGeoYAxis::DrawSelf(const oofDrawStyle* inStyle)
1725 {
1726  inStyle->useStyleColors();
1727 #ifdef _Macintosh
1728  ::MoveTo(mXDraw,mYDraw);
1729  ::Line(0,-mDrawLength);
1730 #elif defined _Windows
1731  HDC hdc = oofCurrentDraw::getCurrentDC();
1732 
1733  if (hdc) {
1734  ::MoveToEx(hdc, mXDraw, mYDraw, NULL);
1735  ::LineTo(hdc, mXDraw, mYDraw - mDrawLength);
1736  }
1737 #endif // OS
1738 
1739  if (oofGraph::currentGraph()->settings()->hasYAxisTicks()) {
1740  // Let's do this in double domain to avoid rounding errors.
1741  double MaMeasure = 0.0;
1742  double MiMeasure = 0.0;
1743  if(mNumDivisions)
1744  MiMeasure = mDrawMaTickMark / (double)mNumDivisions;
1745 
1746  unsigned short minorTickSize = oofGraph::currentGraph()->settings()->minorTickSize();
1747  unsigned short majorTickSize = oofGraph::currentGraph()->settings()->majorTickSize();
1748  while (MaMeasure < mDrawLength) {
1749 #ifdef _Macintosh
1750  ::MoveTo(mXDraw,mYDraw-(int)(MaMeasure+0.5));
1751  ::Line(-majorTickSize,0);
1752 #elif defined _Windows
1753  if (hdc) {
1754  int y = mYDraw - (int)(MaMeasure + 0.5);
1755  ::MoveToEx(hdc, mXDraw, y, NULL);
1756  ::LineTo(hdc, mXDraw - majorTickSize, y);
1757  }
1758 #endif // OS
1759  if(mNumDivisions) {
1760  unsigned theNumDivisions=mNumDivisions;
1761  if((int)(MaMeasure+mDrawMaTickMark+0.5)>mDrawLength)
1762  theNumDivisions=(int)(((double)mDrawLength-MaMeasure)/MiMeasure)+1;
1763  for(unsigned i=1;i<theNumDivisions;i++) {
1764 #ifdef _Macintosh
1765  ::MoveTo(mXDraw,mYDraw-(int)(MaMeasure+i*MiMeasure));
1766  ::Line(-minorTickSize,0);
1767 #elif defined _Windows
1768  if (hdc) {
1769  int y = mYDraw - (int)(MaMeasure + i * MiMeasure);
1770  ::MoveToEx(hdc, mXDraw, y, NULL);
1771  ::LineTo(hdc, mXDraw - minorTickSize, y);
1772  }
1773 #endif // OS
1774  }
1775  }
1776  MaMeasure += mDrawMaTickMark ;// -1; // See XAxisobject
1777  }
1778  }
1779 }
1780 
1781 
1782 oofRect
1784 {
1785  oofRect r;
1786 
1787  int IdealMajTickSize;
1788 
1789  tm->InverseTransformHoLength(oofGraph::currentGraph()->settings()->majorTickSize(),IdealMajTickSize);
1790  if (!IdealMajTickSize)
1791  IdealMajTickSize = 1; // temporary
1792 
1793  r.left=mXIdeal-IdealMajTickSize;
1794  r.right=mXIdeal;
1795  r.top=mYIdeal+mIdealLength;
1796  r.bottom=mYIdeal;
1797 
1798  return r;
1799 }
1800 
1801 
1802 void
1803 oofGeoYAxis::Transform( oofTransformationManager* inTransformationManagerPtr )
1804 {
1805  inTransformationManagerPtr->TransformPoint(mXIdeal,mYIdeal,mXDraw,mYDraw);
1806  inTransformationManagerPtr->TransformVeLength(mIdealLength,mDrawLength);
1807  inTransformationManagerPtr->TransformVeLength(mIdealMaTickMark,mDrawMaTickMark);
1808 }
1809 
1810 
1811 void
1812 oofGeoYAxis::describe(ostream& os) const
1813 {
1814 
1815  oofGeo::describe(os); // call the DIRECT parent, not always oofGeo
1816  os << "mIdealLength : " << mIdealLength
1817  << "mDrawLength : " << mDrawLength
1818  << "mIdealMaTickMark : " << mIdealMaTickMark
1819  << "mNumDivisions :" << mNumDivisions
1820  << "mDrawMaTickMark :" << mDrawMaTickMark << endl ;
1821 }
1822 
1823 
1824 oofString
1826 {
1827  return "oofGeoYAxis";
1828 }
1829 
1830 
1831 // ---------------------------------------------------------------------------------
1832 // oofGeoLegend
1833 // ---------------------------------------------------------------------------------
1834 
1835 
1837  oofSeries *SeriesPtr, PositionState pos)
1838  : oofGeo(0,0,SeriesPtr,pos),
1839  mSeriesSet(oofSeriesSet),
1840  mSymbols(useSymbols)
1841 {
1842  // MS-Windows platform notes:
1843  // All this work in the constructor relies on the parent oofGraph
1844  // being current and the device context set as the current context.
1845  // If this class is used outside the oofGraph framework, it will crash!
1846 
1847  mSizers = new oofTextSizer[mSeriesSet->count()];
1848  int charHeight = oofTextDrawer::calcCharHeight();
1849  const unsigned long* lineLengths;
1851  unsigned short maxLen=0;
1852  unsigned int n=0;
1853  // see also DrawSelf - calculates height again in case font has changed
1854  mLegendHeight=4; // Two two pisel spacers
1855  for(oofSeriesSetItem *theItem=mSeriesSet->first();theItem;theItem=theItem->next())
1856  {
1857  mSizers[n].CalculateWrapping(
1858  theItem->item()->Name(),
1859  strlen(theItem->item()->Name()),
1861  );
1862  // accumulate legend width
1863  lineLengths=mSizers[n].GetLineLengths();
1864  for(unsigned short i=0;i<mSizers[n].GetNumRows();i++) {
1865  if(lineLengths[i]>maxLen)
1866  maxLen=lineLengths[i];
1867  }
1868  // accumulate legend height
1869  mLegendHeight+=mSizers[n].GetNumRows() * charHeight;
1870  n++;
1871  }
1872  mLegendWidth = maxLen + 8 + 6; // plus symbol width - hardwired for now & Plus three 2 pixel spacers
1873  mLegendWidth += 4; // Andy add extra 4 pixels on end to avoid being too close to end of text
1874 }
1875 
1876 
1878 {
1879  delete [] mSizers;
1880 }
1881 
1882 
1883 void
1884 oofGeoLegend::DrawSelf(const oofDrawStyle* inStyle)
1885 {
1886  if (!oofGraph::currentGraph()->settings()->hasLegend())
1887  return;
1888 
1889  inStyle->useStyleColors();
1890 
1891  // if we are required by the graph's settings to draw a legend
1892  int charHeight = oofTextDrawer::calcCharHeight();
1893  int charDescent;
1894  short YTextLoc;
1895 
1896 // draw the enclosing frame, after recalculating legend height
1897 // the problem is that the font when we construct this object is probably not the one we
1898 // draw with. Whilst we can change the font size at construction time, we don't know the
1899 // total font height. If that font has different leading to the current font then we
1900 // will have a subtle total difference in frame height, probably 1 pixel per item in the legend
1901 // NASTY HARD-CODED HACK same as in ctor
1902  mLegendHeight=4; // Two two pisel spacers. RESET height to accumulate below
1903  unsigned short numSizers = mSeriesSet->count();
1904  for(unsigned short i=0; i<numSizers; i++)
1905  {
1906  unsigned short numrows=mSizers[i].GetNumRows();
1907  unsigned short blockHeight = charHeight * numrows;
1908  mLegendHeight += blockHeight;
1909  }
1911  oofRect r(mXDraw,
1912  mYDraw - mLegendHeight / 2,
1913  mXDraw + mLegendWidth,
1914  mYDraw + mLegendHeight / 2);
1915 
1916 #ifdef _Macintosh
1917  FontInfo fi;
1918  ::GetFontInfo(&fi);
1919  charDescent = fi.descent;
1920 
1921  ::FrameRect(r);
1922 
1923  YTextLoc = mYDraw - mLegendHeight / 2 + charHeight + 2; // spacer
1924 #elif defined _Windows
1925  HDC hdc = oofCurrentDraw::getCurrentDC();
1926  HBRUSH hOldBr = (HBRUSH)::SelectObject(hdc, ::GetStockObject(NULL_BRUSH));
1927  TEXTMETRIC tm;
1928 
1929  ::GetTextMetrics(oofCurrentDraw::getCurrentDC(), &tm);
1930  charDescent = tm.tmDescent;
1931 
1932  ::Rectangle(hdc, r.left, r.top, r.right, r.bottom);
1933 
1934  YTextLoc = mYDraw - mLegendHeight / 2 + 2; // spacer
1935 #endif // OS
1936  unsigned int n=0;
1937  for(oofSeriesSetItem *theItem=mSeriesSet->first();theItem;theItem=theItem->next())
1938  {
1939  unsigned short numrows=mSizers[n].GetNumRows();
1940  unsigned short blockHeight = charHeight * numrows;
1941 
1942  // Draw the symbol or shading centred with the text !
1943  theItem->item()->drawStyle()->useStyleColors();
1944  if(theItem->item()->isSymbol())
1945  theItem->item()->drawStyle()->symbol()->draw(mXDraw+7,
1946 #ifdef _Macintosh
1947  YTextLoc+blockHeight/2- charHeight
1948 #else
1949  YTextLoc+blockHeight/2
1950 #endif // _Macintosh
1951  );
1952  else {
1953 #ifdef _Macintosh
1954  oofRect s(
1955  mXDraw + 2,
1956  YTextLoc + (blockHeight - 8) / 2 - charHeight,
1957  mXDraw + 10,
1958  YTextLoc + (blockHeight - 8) / 2 + 8 - charHeight
1959  );
1960  ::FillRect(s,theItem->item()->drawStyle()->currentPattern());
1961  if (!inStyle->isMono())
1962  ::FrameRect(s);
1963 #elif defined _Windows
1964  ::SelectObject(hdc, (HBRUSH)theItem->item()->drawStyle()->currentPattern());
1965  ::Rectangle(
1966  hdc,
1967  mXDraw + 2,
1968  YTextLoc + (blockHeight - 8) / 2,
1969  mXDraw + 10,
1970  YTextLoc + (blockHeight - 8) / 2 + 8)
1971  ;
1972 #endif // OS
1973  }
1974 
1975  // Label the legend item
1976  inStyle->useStyleColors();
1977  const unsigned long* lines = mSizers[n].GetLineStarts();
1978  const unsigned long* lengths = mSizers[n].GetLineLengths();
1979  short bytes;
1980  for(short rownum=0;rownum<numrows;rownum++) {
1981  //int loc=(mLegendWidth-11-lengths[rownum])/2+11; OLD CENTRED TITLES
1982  if(rownum==(numrows-1)) // last row length is to end
1983  bytes=strlen(theItem->item()->Name())-lines[rownum];
1984  else // row length is from start of this to start of next line
1985  bytes=lines[rownum+1]-lines[rownum];
1986 #ifdef _Macintosh
1987  ::MoveTo(mXDraw+11, YTextLoc-charDescent);
1988  ::DrawText(theItem->item()->Name(),lines[rownum],bytes);
1989 #elif defined _Windows
1990  ::TextOut(hdc,
1991  mXDraw+11,
1992  YTextLoc,
1993  theItem->item()->Name() + lines[rownum],
1994  bytes);
1995 #endif // OS
1996  YTextLoc+=charHeight;
1997  }
1998  n++;
1999  }
2000 
2001 #ifdef _Windows
2002  if (hOldBr)
2003  ::SelectObject(hdc, hOldBr);
2004 #endif // _Windows
2005 }
2006 
2007 
2008 oofRect
2010 {
2011  // OK - This is awful - but we're going to return real pixel coords for
2012  // the moment - until I get organised and make two functions to do
2013  // this.
2014  Transform(tm);
2015  oofRect r;
2016  if (oofGraph::currentGraph()->settings()->hasLegend())
2017  r.set(0,0,mLegendWidth+2+oofGraph::currentGraph()->settings()->legendOffset(),mLegendHeight);
2018  else
2019  r.set(0,0,0,0);
2020  return r;
2021 }
2022 
2023 /* UnJames
2024 oofRect
2025 oofGeoLegend::GetAlreadyTransformedBoundingRect(oofTransformationManager*)
2026 {
2027  // OK - This is awful - but we're going to return real pixel coords for
2028  // the moment - until I get organised and make two functions to do
2029  // this.
2030  oofRect r;
2031  if (oofGraph::currentGraph()->settings()->hasLegend())
2032  r.set(0,0,mLegendWidth+2,mLegendHeight);
2033  else
2034  r.set(0,0,0,0);
2035  return r;
2036 }
2037 */
2038 
2039 void
2041 {
2042  int dummy;
2043  oofRect I=inTransformationManagerPtr->getIdealRect();
2044  inTransformationManagerPtr->TransformPoint(I.right,0,mXDraw,dummy);
2046  inTransformationManagerPtr->TransformPoint(mXIdeal,mYIdeal,dummy,mYDraw);
2047 }
2048 
2049 
2050 void
2051 oofGeoLegend::describe(ostream& os) const
2052 {
2053 
2054  oofGeo::describe(os); // call the DIRECT parent, not always oofGeo
2055  os << "mSymbols : " << mSymbols
2056  << "mLegendWidth : " << mLegendWidth
2057  << "mLegendHeight : " << mLegendHeight << endl ;
2058 }
2059 
2060 
2061 oofString
2063 {
2064  return "oofGeoLegend";
2065 }
2066 
2067 
2068 // ---------------------------------------------------------------------------------
2069 // oofGeoCircle
2070 // ---------------------------------------------------------------------------------
2071 
2072 
2073 oofGeoCircle::oofGeoCircle(int XIdeal, int YIdeal,
2074  int diameter, oofSeries* SeriesPtr, PositionState pos)
2075  : oofGeo(XIdeal,YIdeal, SeriesPtr, pos)
2076 {
2077  mIdealDiameter = diameter;
2078 }
2079 
2080 
2081 void
2082 oofGeoCircle::DrawSelf(const oofDrawStyle* inStyle)
2083 {
2084  inStyle->useStyleColors();
2085  oofRect theRect(mXDraw, mYDraw, mXDraw + mDrawDiameter, mYDraw+mDrawDiameter);
2086 #ifdef _Macintosh
2087  ::FrameOval(theRect);
2088 #elif defined _Windows
2089  HDC hdc = oofCurrentDraw::getCurrentDC();
2090  HBRUSH hOldBr = (HBRUSH)::SelectObject(hdc, (HBRUSH)GetStockObject(NULL_BRUSH));
2091  ::Ellipse(hdc, theRect.left, theRect.top, theRect.right, theRect.bottom);
2092 #endif // OS
2093 }
2094 
2095 
2096 void
2098 {
2099  int DrawRight,DrawBottom;
2100  inTransformationManagerPtr->TransformPoint
2102  inTransformationManagerPtr->TransformPoint
2103  (mXIdeal+mIdealDiameter,mYIdeal+mIdealDiameter,
2104  DrawRight,DrawBottom);
2105  mDrawDiameter = DrawRight - mXDraw;
2106 }
2107 
2108 
2109 void
2110 oofGeoCircle::describe(ostream& os) const
2111 {
2112 
2113  oofGeo::describe(os); // call the DIRECT parent, not always oofGeo
2114  os << "mIdealDiameter : " << mIdealDiameter
2115  << "mDrawDiameter : " << mDrawDiameter << endl ;
2116 }
2117 
2118 
2119 oofString
2121 {
2122  return "oofGeoCircle";
2123 }
2124 
int mDrawDiameter
Definition: oofGeos.h:215
const oofDrawStyle * drawStyle() const
Definition: oofClrbl.h:60
virtual void TransformTextSize(int idealTextSize, int &drawTextSize)
Definition: oofTrMgr.cpp:325
virtual ~oofGeo()
Definition: oofGeos.cpp:62
virtual oofString geoType() const
Definition: oofGeos.cpp:244
oofSeries * mSeriesPtr
Definition: oofGeos.h:74
int red() const
Definition: oofcolor.h:209
virtual void describe(std::ostream &) const
Definition: oofGeos.cpp:458
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:775
Cross-platform way to specify rectangle with Mac-style setter.
Definition: oofRect.h:39
const char * chars() const
Primary test: oofStringTest::stringInitOneCharFromConstant ()
Definition: oofstr.h:383
oofGeoText(int XIdeal, int YIdeal, int Width, const char *inString, oofSeries *SeriesPtr=0, PositionState=posNone)
Definition: oofGeos.cpp:1007
Map ideal values to actual drawing values.
Definition: oofTrMgr.h:30
virtual void TransformHoLength(int idealLength, int &drawLength)
Definition: oofTrMgr.cpp:304
virtual oofString geoType() const
Definition: oofGeos.cpp:2120
int mYDraw
Definition: oofGeos.h:63
virtual void TransformPoint(int idealX, int idealY, int &drawX, int &drawY)
Definition: oofTrMgr.cpp:232
virtual void setMargins(oofRect &inRect)
Definition: oofTrMgr.cpp:149
virtual void describe(std::ostream &) const
Definition: oofGeos.cpp:230
virtual oofRect BoundingRect(oofTransformationManager *)
Definition: oofGeos.cpp:1165
Tries to hide the different platforms and version issues with standard IO.
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:2097
oofGeo::PositionState XLabelPos() const
Definition: oofSting.cpp:434
const oofPattern & currentPattern() const
Definition: oofDStyl.cpp:211
oofGeoBar(int XIdeal, int YIdeal, int width, int height, oofSeries *SeriesPtr=0, PositionState=posNone)
Definition: oofGeos.cpp:598
bool setFontSize(int textSize=-1)
Definition: oofGeos.h:474
virtual oofString geoType() const
Definition: oofGeos.cpp:1825
oofGeoSuppressibleText(int XIdeal, int YIdeal, int Width, const char *inString, oofSeries *SeriesPtr=0, PositionState=posNone)
Definition: oofGeos.cpp:1143
int mDrawWidth
Definition: oofGeos.h:128
virtual bool ShouldDraw() const
Definition: oofGeos.cpp:1211
virtual oofRect getMargins()
Definition: oofTrMgr.cpp:138
virtual void DrawSelf(const oofDrawStyle *)
Definition: oofGeos.cpp:1157
oofGeoSector(int XIdeal, int YIdeal, int diameter, int start, int arc, oofSeries *SeriesPtr=0, PositionState=posNone)
Definition: oofGeos.cpp:822
Manage the oofSeries containing data for an oofGraph.
Definition: oofSrSet.h:64
const oofColor & foreColor() const
Definition: oofDStyl.cpp:183
Track a single oofSeries in an oofSeriesSet.
Definition: oofSrSet.h:43
Base for element in graph which may have text label shown adjacent.
Definition: oofGeos.h:85
virtual oofRect BoundingRect(oofTransformationManager *)
Definition: oofGeos.cpp:2009
int mIdealWidth
Definition: oofGeos.h:192
bool mRequired
Definition: oofGeos.h:101
virtual void describe(std::ostream &) const
Definition: oofGeos.cpp:1812
virtual oofString geoType() const
Definition: oofGeos.cpp:996
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:506
virtual bool ShouldDraw() const
Definition: oofGeos.cpp:1292
unsigned short minorTickSize() const
Definition: oofSting.cpp:534
int mDrawTextSize
Definition: oofGeos.h:252
void setLastGeo(oofGeo *g)
Definition: oofSrSet.h:27
virtual oofString geoType() const
Definition: oofGeos.cpp:524
virtual void describe(std::ostream &) const
Definition: oofGeos.cpp:1119
virtual oofRect BoundingRect(oofTransformationManager *)
Definition: oofGeos.cpp:1783
int mTextWidth
Definition: oofGeos.h:103
double the3DEffectMultiplier() const
Definition: oofSting.cpp:614
bool hasTitle() const
Definition: oofSting.cpp:241
virtual void TransformVeLength(int idealLength, int &drawLength)
Definition: oofTrMgr.cpp:282
virtual bool ShouldDraw() const
Definition: oofGeos.cpp:1359
int mArcAngle
Definition: oofGeos.h:215
int locationY()
Definition: oofGeos.h:57
oofGeoYAxis(int inLength, int MaInterval, int NumDivisions, oofSeries *SeriesPtr=0, PositionState=posNone)
Definition: oofGeos.cpp:1713
virtual void DrawSelf(const oofDrawStyle *)
Definition: oofGeos.cpp:272
oofGeoText * mValueLabel
Definition: oofGeos.h:100
int mXDraw
Definition: oofGeos.h:63
virtual void describe(std::ostream &) const
Definition: oofGeos.cpp:102
void setLabel(bool required, int value, int x, int y, int width)
Definition: oofGeos.cpp:188
oofLabelledGeo(int XIdeal, int YIdeal, oofSeries *SeriesPtr=0, PositionState=posNone)
Definition: oofGeos.cpp:169
oofGeoXLabel(int XIdeal, int YIdeal, int Width, const char *inString, oofSeries *SeriesPtr=0, PositionState=posBottom)
Definition: oofGeos.cpp:1279
virtual void describe(std::ostream &) const
Definition: oofGeos.cpp:798
const unsigned long * GetLineStarts() const
Definition: oofdraw.h:348
Drawing primitive for data as series of points on graphs.
Definition: oofGeos.h:141
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:1367
virtual ~oofLabelledGeo()
Definition: oofGeos.cpp:181
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:435
oofGeo::PositionState titlePos() const
Definition: oofSting.cpp:414
virtual oofString geoType() const
Definition: oofGeos.cpp:110
virtual void DrawSelf(const oofDrawStyle *)
Definition: oofGeos.cpp:1025
int mIdealHeight
Definition: oofGeos.h:192
unsigned short maxLegendLen() const
Definition: oofSting.cpp:514
virtual void InverseTransformHoLength(int drawLength, int &idealLength)
Definition: oofTrMgr.cpp:411
oofGeoLine * lastPoint()
Definition: oofGeos.h:164
int mDrawWidth
Definition: oofGeos.h:192
virtual void DrawSelf(const oofDrawStyle *)
Definition: oofGeos.cpp:1528
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:1089
Text on graphs that can be suppressed based on scaling.
Definition: oofGeos.h:265
virtual void CalculateWrapping(const char *inValue, unsigned long inItemSize, unsigned long inColWidth, bool inTruncWords=true)
Produce two arrays of line start (offset of character from start of string) and line length (pixels)...
Definition: oofdraw.cpp:765
bool hasYLabel() const
Definition: oofSting.cpp:394
virtual oofString geoType() const
Definition: oofGeos.cpp:469
int mDrawHeight
Definition: oofGeos.h:128
int mStartAngle
Definition: oofGeos.h:215
int mDrawHeight
Definition: oofGeos.h:252
virtual void DrawSelf(const oofDrawStyle *)
Definition: oofGeos.cpp:487
virtual oofString geoType() const
Definition: oofGeos.cpp:587
int mXIdeal
Definition: oofGeos.h:63
static oofGraph * currentGraph()
Definition: oofGrphs.cpp:190
unsigned int mWidthIdeal
Definition: oofGeos.h:250
unsigned long length() const
Primary test: oofStringTest::emptyStringByNullInitIsLenZero()
Definition: oofstr.h:447
void draw()
Definition: oofGeos.cpp:83
virtual void describe(std::ostream &) const
Definition: oofGeos.cpp:579
virtual oofRect BoundingRect(oofTransformationManager *)
Definition: oofGeos.cpp:410
virtual void DrawSelf(const oofDrawStyle *)
Definition: oofGeos.cpp:544
virtual oofRect BoundingRect(oofTransformationManager *)
Definition: oofGeos.cpp:751
virtual Point getTickMargins()
Definition: oofTrMgr.cpp:165
virtual void describe(std::ostream &) const
Definition: oofGeos.cpp:1177
oofGeoYTickLabel(int XIdeal, int YIdeal, int Width, const char *inString, oofSeries *SeriesPtr, PositionState)
Definition: oofGeos.cpp:1512
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:2040
const unsigned long * GetLineLengths() const
Definition: oofdraw.h:355
virtual void describe(std::ostream &) const
Definition: oofGeos.cpp:984
unsigned long count()
Definition: oofSrSet.cpp:173
virtual void describe(std::ostream &) const
Definition: oofGeos.cpp:1689
virtual void setLocation(long inXIdeal, long inYIdeal)
Definition: oofGeos.cpp:75
virtual oofString geoType() const
Definition: oofGeos.cpp:811
static bool isMono()
Definition: oofDStyl.cpp:270
oofSeriesSetItem * first()
Definition: oofSrSet.cpp:159
virtual void setTickMargins(Point inPoint)
Definition: oofTrMgr.cpp:177
Drawing primitive for lines on line graphs.
Definition: oofGeos.h:161
virtual oofRect & getIdealRect()
Definition: oofTrMgr.cpp:127
virtual void DrawSelf(const oofDrawStyle *)
Definition: oofGeos.cpp:202
oofGeoTitle(int XIdeal, int YIdeal, int Width, const char *inString, oofSeries *SeriesPtr=0, PositionState=posNone)
Definition: oofGeos.cpp:1196
Graph Element Object drawn in an oofGraph.
Definition: oofGeos.h:43
PositionState mPosition
Definition: oofGeos.h:75
virtual bool ShouldDraw() const =0
int mDrawWidth
Definition: oofGeos.h:252
int mIdealWidth
Definition: oofGeos.h:128
int locationX()
Definition: oofGeos.h:56
oofString mText
Definition: oofGeos.h:249
int mDrawHeight
Definition: oofGeos.h:192
Portable highly capable string class.
Definition: oofstr.h:101
oofGeoPoint(int XIdeal, int YIdeal, oofSeries *SeriesPtr=0, PositionState=posNone)
Definition: oofGeos.cpp:480
virtual oofString geoType() const
Definition: oofGeos.cpp:1185
int mIdealDiameter
Definition: oofGeos.h:215
Specify drawing styles used in graphs.
Definition: oofDStyl.h:32
virtual oofString geoType() const
Definition: oofGeos.cpp:1575
virtual oofRect BoundingRect(oofTransformationManager *)
Definition: oofGeos.cpp:1106
static bool setFontSize(int textSize=-1)
Definition: oofdraw.cpp:293
virtual oofRect BoundingRect(oofTransformationManager *)
Definition: oofGeos.cpp:117
virtual void describe(std::ostream &) const
Definition: oofGeos.cpp:515
const oofGraphSettings * settings() const
Definition: oofGrphs.cpp:196
virtual oofRect BoundingRect(oofTransformationManager *)
Definition: oofGeos.cpp:1656
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:1537
oofSeries * SeriesPtr()
Definition: oofGeos.cpp:68
oofGeo::PositionState YLabelPos() const
Definition: oofSting.cpp:454
unsigned short majorTickSize() const
Definition: oofSting.cpp:554
Base for text on graphs drawn from data series.
Definition: oofGeos.h:233
virtual void draw(short, short)
Definition: oofDStyl.cpp:551
oofGeoYLabel(int XIdeal, int YIdeal, int Width, const char *inString, oofSeries *SeriesPtr=0, PositionState=posLeft)
Definition: oofGeos.cpp:1345
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:1452
int mIdealHeight
Definition: oofGeos.h:128
Cross-platform sizer which wraps to multiple rows.
Definition: oofdraw.h:82
virtual oofString geoType() const
Definition: oofGeos.cpp:1702
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:1300
virtual void InverseTransformVeLength(int drawLength, int &idealLength)
Definition: oofTrMgr.cpp:403
oofGeoLine * mLastPoint
Definition: oofGeos.h:169
virtual oofString geoType() const
Definition: oofGeos.cpp:1268
virtual oofString geoType() const
Definition: oofGeos.cpp:1500
oofSeriesSetItem * next()
Definition: oofSrSet.cpp:86
virtual ~oofGeoText()
Definition: oofGeos.cpp:1019
virtual void describe(std::ostream &) const
Definition: oofGeos.cpp:2051
oofGeoXAxis(int inLength, int MaInterval, int NumDivisions, oofSeries *SeriesPtr=0, PositionState=posNone)
Definition: oofGeos.cpp:1586
int calcCharHeight(int textSize=-1)
Definition: oofGeos.h:483
static int calcCharHeight(int textSize=-1)
Definition: oofdraw.cpp:378
oofGeoColumn(int XIdeal, int YIdeal, int width, int height, oofSeries *SeriesPtr=0, PositionState=posNone)
Definition: oofGeos.cpp:255
unsigned short legendOffset() const
Definition: oofSting.cpp:594
void useStyleColors() const
Definition: oofDStyl.cpp:221
unsigned short maxYLabelLen() const
Definition: oofSting.cpp:474
void setTextSize(int PointSize)
Definition: oofGeos.h:492
virtual oofString geoType() const
Definition: oofGeos.cpp:2062
virtual void DrawSelf(const oofDrawStyle *)
Definition: oofGeos.cpp:833
#define _Macintosh
This build is on Macintosh.
Definition: doxyoof.h:433
virtual void describe(std::ostream &) const
Definition: oofGeos.cpp:2110
oofSymbol * symbol() const
Definition: oofDStyl.h:54
oofGeo * lastGeo()
Definition: oofSrSet.h:28
oofGeoCircle(int XIdeal, int YIdeal, int diameter, oofSeries *SeriesPtr=0, PositionState=posNone)
Definition: oofGeos.cpp:2073
void set(int left, int top, int right, int bottom)
Definition: oofRect.cpp:80
unsigned short GetNumRows() const
Definition: oofdraw.h:360
virtual void DrawSelf(const oofDrawStyle *)
Definition: oofGeos.cpp:1443
PositionState
Definition: oofGeos.h:45
oofGeoLegend(oofSeriesSet *, bool, oofSeries *SeriesPtr=0, PositionState=posRight)
Definition: oofGeos.cpp:1836
int mYIdeal
Definition: oofGeos.h:63
oofGeoXTickLabel(int XIdeal, int YIdeal, int Width, const char *inString, oofSeries *SeriesPtr, PositionState)
Definition: oofGeos.cpp:1427
virtual oofRect BoundingRect(oofTransformationManager *)
Definition: oofGeos.cpp:899
virtual oofString geoType() const
Definition: oofGeos.cpp:1416
oofGeoLine(int XIdeal, int YIdeal, oofSeries *SeriesPtr=0, PositionState=posNone)
Definition: oofGeos.cpp:535
virtual oofRect BoundingRect(oofTransformationManager *)
Definition: oofGeos.cpp:495
virtual void DrawSelf(const oofDrawStyle *)
Definition: oofGeos.cpp:615
bool has3DEffect() const
Definition: oofSting.cpp:222
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:962
Contains series of data in a graph, eg: a single line of a graph.
Definition: oofSrSet.h:19
oofGeo(int XIdeal, int YIdeal, oofSeries *SeriesPtr=0, PositionState=posNone)
Definition: oofGeos.cpp:49
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:1680
virtual oofString geoType() const
Definition: oofGeos.cpp:1132
bool hasXLabel() const
Definition: oofSting.cpp:374
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:1232
unsigned int mIdealTextSize
Definition: oofGeos.h:250
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:209
virtual oofString geoType() const
Definition: oofGeos.cpp:1334
oofTextSizer mSizer
Definition: oofGeos.h:255
virtual void Transform(oofTransformationManager *inTransformationManagerPtr)
Definition: oofGeos.cpp:1803