00001 #pragma ident "$Id: PSImageBase.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_PSIMAGEBASE_H
00029 #define VDRAW_PSIMAGEBASE_H
00030
00031 #include <string>
00032 #include <iostream>
00033 #include <fstream>
00034
00035 #include "VDrawException.hpp"
00036 #include "VGImage.hpp"
00037 #include "StrokeStyle.hpp"
00038
00039 namespace vdraw
00040 {
00043
00048 class PSImageBase : public VGImage {
00049
00050 public:
00051
00059 PSImageBase(std::ostream& stream,
00060 double width=US_LETTER_WIDTH_PTS,
00061 double height=US_LETTER_HEIGHT_PTS,
00062 ORIGIN_LOCATION iloc=LOWER_LEFT);
00063
00071 PSImageBase(const char* fname,
00072 double width=US_LETTER_WIDTH_PTS,
00073 double height=US_LETTER_HEIGHT_PTS,
00074 ORIGIN_LOCATION iloc=LOWER_LEFT);
00075
00077 ~PSImageBase(void);
00078
00079 void setMarker( const Marker& newMarker )
00080 {VGImage::setMarker(newMarker);defineMarker(newMarker,"dflt");}
00081
00082 void comment(const Comment& comment);
00083
00084 using VGImage::comment;
00085
00086 void line(const Line& line);
00087
00088 using VGImage::line;
00089
00090 void rectangle (const Rectangle& rect);
00091
00092 void circle (const Circle& circle);
00093
00094 void polygon (const Polygon& polygon);
00095
00096 void bitmap(const Bitmap& bitmap);
00097
00098 void text (const Text& text);
00099
00100 protected:
00101
00103 std::ofstream myfstream;
00104
00106 std::ostream& ostr;
00107
00109 std::string filename;
00110
00115 StrokeStyle lastUsedStrokeStyle;
00116
00118 TextStyle lastUsedTextStyle;
00119
00120 using VGImage::StyleType;
00121 using VGImage::getCorrectStrokeStyle;
00122 using VGImage::getCorrectMarker;
00123 using VGImage::getCorrectTextStyle;
00124 using VGImage::getCorrectFillColor;
00125
00126 private:
00127
00129 void updateStrokeStyle(StrokeStyle& ss);
00130
00132 void printStrokeStyle(void);
00133
00135 void printTextStyle(const TextStyle& ts);
00136
00138 void printStrokeStyle(const StrokeStyle& style);
00139
00141 void outputPath(const Path& path);
00142
00144 std::string fillWithColor(const Color& color) const;
00145
00147 static const bool extraComments=true;
00148
00152 void defineMarker(const Marker& mark, const char * markername=0);
00153
00154 void markPath(const Path& path, const char * name="mark");
00155
00156
00157
00158 bool markerDefined;
00159
00160
00161 Marker lastMarker;
00162
00167
00168 bool strokeStylePrinted;
00169
00171 bool textStylePrinted;
00172
00179
00180 bool centerDefined;
00181
00183 bool rightDefined;
00184
00185
00186 };
00187
00189
00190 }
00191 #endif //VDRAW_PSIMAGEBASE_H
00192