00001 #pragma ident "$Id: VGImage.hpp 1644 2009-01-27 19:26:14Z ckiesch $"
00002
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef VDRAW_VGIMAGE_H
00029 #define VDRAW_VGIMAGE_H
00030
00031 #include <string>
00032 #include <stdarg.h>
00033
00034 #include "Canvas.hpp"
00035 #include "VDrawException.hpp"
00036
00040 namespace vdraw
00041 {
00044
00052 class VGImage : public Canvas
00053 {
00054 public:
00055
00057 static const double PTS_PER_INCH;
00058
00060 static const double PTS_PER_CM;
00061
00063 static const double US_LETTER_WIDTH_PTS;
00065 static const double US_LETTER_HEIGHT_PTS;
00066
00067
00069 static const double A3_WIDTH_PTS;
00071 static const double A3_HEIGHT_PTS;
00072
00073
00075 static const double A4_WIDTH_PTS;
00077 static const double A4_HEIGHT_PTS;
00078
00080 static const double A5_WIDTH_PTS;
00082 static const double A5_HEIGHT_PTS;
00083
00085 enum ORIGIN_LOCATION {
00087 LOWER_LEFT,
00089 UPPER_LEFT
00090 };
00091
00102 VGImage(double width=US_LETTER_WIDTH_PTS,
00103 double height=US_LETTER_HEIGHT_PTS,
00104 ORIGIN_LOCATION iloc=LOWER_LEFT):
00105 Canvas(),
00106 canvasWidth(width),
00107 canvasHeight(height),
00108 footerHasBeenWritten(false),
00109 ll(iloc==LOWER_LEFT)
00110 {
00111
00112 }
00113
00115 virtual ~VGImage() {}
00116
00118 inline double getWidth(void) const
00119 {
00120 return canvasWidth;
00121 }
00122
00124 inline double getHeight(void) const
00125 {
00126 return canvasHeight;
00127 }
00128
00129 bool isLL() { return ll; }
00130
00134 virtual void view(void) throw (VDrawException)
00135 { throw VDrawException("No appropriate viewer has been defined.");}
00136
00137 protected:
00138
00142 void rectangles(const Bitmap &bitmap);
00143
00147 enum StyleType {
00149 NONE,
00151 CLEAR,
00153 DEFAULT,
00155 SHAPE
00156 };
00157
00165 StyleType getCorrectMarker(Marker *m, const Markable& mark);
00166
00174 StyleType getCorrectStrokeStyle(StrokeStyle *s, const BasicShape& shape);
00175
00183 StyleType getCorrectFillColor(Color *c, const Fillable& shape);
00184
00192 StyleType getCorrectTextStyle(TextStyle *s, const Text& text);
00193
00198 virtual void outputFooter(void) {}
00199
00201 double canvasWidth;
00202
00204 double canvasHeight;
00205
00207 bool footerHasBeenWritten;
00208
00214 bool ll;
00215
00216 private:
00217
00218
00219 };
00220
00222
00223 }
00224
00225 #endif //VDRAW_VGIMAGE_H
00226