00001
00002
00003
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
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #ifndef INC_PDF_H
00053 #define INC_PDF_H
00054
00055 #ifndef INC_GRE_BASE_H
00056 #include <gre/base.h>
00057 #endif
00058
00059 #ifndef INC_FILEPATH_H
00060 #include <mi32/filepath.h>
00061 #endif
00062
00063 #ifndef INC_MI32_ELEMSTYL_H
00064 #include <mi32/elemstyl.h>
00065 #endif
00066
00067 #ifndef INC_MI32_ELEMTYPE_H
00068 #include <mi32/elemtype.h>
00069 #endif
00070
00071 #ifndef INC_MI32_STRUTF8_H
00072 #include <mi32/strutf8.h>
00073 #endif
00074
00075 #ifndef INC_MI32_POINT_H
00076 #include <mi32/point.h>
00077 #endif
00078
00079
00080 #ifndef GENERATING_DOXYGEN_OUTPUT
00081
00082 class XMLNODE;
00083 namespace MGD {
00084 class DEVICE_PDF;
00085 class DEVICE_PDF2;
00086 }
00087 namespace RVC {
00088 class OBJITEM;
00089 }
00090 #endif
00091
00092
00093 class PDF {
00094 public:
00095
00096
00097 PDF () :
00098 m_zoom(1.0),
00099 m_bZoomDefined(false),
00100 m_bUsingFirstView(false),
00101 m_bSuppressResultTime(false),
00102 m_bViewCenterSet(false),
00103 m_JPEGQuality(100),
00104 m_Color(255*255,255*255,255*255),
00105 m_Margin(0,0),
00106 m_compress(9),
00107 m_bEmbedFonts(false),
00108 m_bSubstituteCourier(true),
00109 m_bRenderFonts(false),
00110 m_bScaleZeroWidth(false),
00111 m_width(8.5),
00112 m_height(0),
00113 m_dpi(0),
00114 m_accuracy(0),
00115 m_reference(0),
00116 m_bIsCreated(false)
00117 { }
00118
00119
00120 PDF (
00121 const GRE::LAYOUT& layout
00122 );
00123
00124
00125
00126
00127 PDF (
00128 const PDF&
00129 );
00130
00131 ~PDF ();
00132
00133 void Clear();
00134
00135 ERRVALUE CreateStyle (
00136 const XMLNODE* node,
00137 POINTSTYLE& pointstyle,
00138 POLYSTYLE& polygonstyle,
00139 LINESTYLE& linestyle
00140 );
00141
00142 ERRVALUE Create ();
00143
00144 void Finish();
00145
00146 int GetResolution (
00147 ) { return m_dpi; }
00148
00149 void SetHighlightColor (
00150 const COLOR& color
00151 ) { m_HighlightColor = color;}
00152
00153 void GetHighlightColor (
00154 COLOR& color
00155 ) {
00156 color = m_Color;
00157 }
00158
00159 void SetBackgroundColor (
00160 COLOR color
00161 ) { m_Color = color; }
00162
00163 void SetResolution (
00164 int dpi
00165 ) { m_dpi = dpi; }
00166
00167 void SetAccuracy (
00168 double accuracy
00169 ) { m_accuracy = accuracy; }
00170
00171 void SetSupressResultTime (
00172 bool suppress
00173 ) {m_bSuppressResultTime = suppress; }
00174
00175
00176 ERRVALUE Read (
00177 const FILEPATH& filepath
00178 );
00179 ERRVALUE Read (
00180 const MIUNICODE* filename
00181 ) {
00182 return (Read(FILEPATH(filename)));
00183 }
00184
00185 void SetCenter (
00186 const DPOINT2D center
00187 ) {
00188 m_centerpoint = center;
00189 m_bViewCenterSet = true;
00190 }
00191
00192 void SetHeight (
00193 DOUBLE height
00194 ) { m_height = height; }
00195
00196
00197 DOUBLE GetHeight (
00198 ) { return(m_height); }
00199
00200 void SetPosn (
00201 const DPOINT2D& CenterPoint,
00202 double zoom
00203 ) {
00204 m_bViewCenterSet = true;
00205 m_centerpoint = CenterPoint;
00206 m_zoom = zoom;
00207 }
00208
00209 void SetPath (
00210 FILEPATH* name
00211 ) { if (name != 0) m_target = *name; else m_target.Clear(); }
00212
00213 void GetPath (
00214 FILEPATH& filepath
00215 ) { filepath = m_target; }
00216
00217 void SetUsingFirstView (
00218 bool useview
00219 ) {
00220 m_bUsingFirstView = useview;
00221 }
00222
00223 bool GetUsingFirstView (
00224 ) {
00225 return(m_bUsingFirstView);
00226 }
00227
00228 void SetViewIndex (
00229 int viewnum
00230 ) {
00231 m_reference = viewnum;
00232 }
00233
00234
00235 void SetWidth (
00236 DOUBLE width
00237 ) { m_width = width; }
00238
00239 DOUBLE GetWidth (
00240 ) { return(m_width); }
00241
00242 void SetZoom (
00243 DPOINT2D zoom
00244 ) { m_zoom = MIN(zoom.x,zoom.y) ; }
00245
00246 void SetZoom (
00247 DOUBLE zoom
00248 ) { m_zoom = zoom; }
00249
00250 void SetTitle (
00251 const MISTRING* name
00252 ) { if (name != 0) m_title = *name; else m_title.Clear(); }
00253
00254 void GetTitle (
00255 MISTRING& name
00256 ) { name = m_title; }
00257
00258 void GetMargin (
00259 DPOINT2D& margin
00260 ) {
00261 margin = m_Margin; }
00262
00263 void EmbedFonts (
00264 bool embed = true
00265 ) {
00266 m_bEmbedFonts = embed;
00267 m_bRenderFonts = false;
00268 }
00269
00270 void SubstituteCourier (
00271 bool subcourier
00272 ) {
00273 m_bSubstituteCourier = subcourier;
00274 }
00275
00276 void SetScaleZeroWidth (
00277 bool scalezero
00278 ) {
00279 m_bScaleZeroWidth = scalezero;
00280 }
00281
00282 void RenderFonts (
00283 bool render = true
00284 ) {
00285 m_bRenderFonts = render;
00286 m_bEmbedFonts = false;
00287 }
00288
00289 ERRVALUE Compare(
00290 const STRUTF8& str,
00291 const FILEPATH& file
00292 );
00293
00294
00295
00296 ERRVALUE Write (
00297 FILEPATH* filepath
00298 );
00299
00300 ERRVALUE WriteToFile(
00301 const FILEPATH& filepath,
00302 const STRUTF8& str
00303 );
00304
00305 ERRVALUE WriteToFile(
00306 const FILEPATH& filepath,
00307 STRUTF8 *str
00308 );
00309
00310 ERRVALUE Write (
00311 );
00312
00313 ERRVALUE Write (
00314 const MIUNICODE* filename
00315 ) {
00316 FILEPATH path(filename);
00317 return (Write(&path));
00318 }
00319
00320
00321 ERRVALUE WriteFrom (
00322 GRE::LAYOUT *layout
00323 );
00324
00325 ERRVALUE CreateFromLayoutObject (
00326 const RVC::OBJITEM& ObjItem
00327 );
00328
00329 ERRVALUE RenderGroup (
00330 GRE::GROUP *group
00331 );
00332
00333 ERRVALUE WriteFrom (
00334 GRE::GROUP *group
00335 );
00336
00337 ERRVALUE MatchExtents (
00338 const DRECT2D extents
00339 );
00340
00341 ERRVALUE MatchView(
00342 const GRE::VIEW *view,
00343 const GRE::GROUP *GeoRefGroup
00344 );
00345
00346 void SetSourceLayout (
00347 GRE::LAYOUT *layout
00348 ) { m_Layout = layout; }
00349
00350 void SetReferenceViewIndex (
00351 int index
00352 ) { m_reference = index; }
00353
00354 void SetIncludeLayerVisibility(
00355 bool include
00356 ) {
00357 m_bIncludeLayerVisibility = include;
00358 }
00359
00360 void SetCompression(
00361 int val = 9
00362 ) { m_compress = val; }
00363
00364 int GetCompression(
00365 ) { return(m_compress); }
00366
00367 private:
00368 #ifndef GENERATING_DOXYGEN_OUTPUT
00369
00370 MISTRING m_title;
00371 MGD::DEVICE_PDF2* m_DevicePDF;
00372 MGD::DEVICE* Device;
00373 DOUBLE m_height, m_width;
00374 int m_dpi;
00375 DOUBLE m_accuracy;
00376 FILEPATH m_path;
00377 int m_JPEGQuality;
00378
00379
00380 FILEPATH m_src;
00381 int m_reference;
00382 int m_compress;
00383 double m_zoom;
00384 DPOINT2D m_centerpoint, m_zoomfactor;
00385 DPOINT2D m_Margin;
00386 GRE::LAYOUT *m_Layout;
00387
00388
00389 FILEPATH m_target;
00390 bool m_bZoomDefined;
00391 bool m_bIncludeLayerVisibility;
00392 bool m_bSuppressResultTime;
00393 bool m_bPosnSet;
00394 bool m_bUsingLayoutObject;
00395 bool m_bUsingFirstView;
00396 bool m_bViewCenterSet;
00397 bool m_bUsingLayoutInode;
00398 bool m_bUsingLayoutPath;
00399 bool m_bEmbedFonts;
00400 bool m_bRenderFonts;
00401 bool m_bSubstituteCourier;
00402 bool m_bScaleZeroWidth;
00403 bool m_bIsCreated;
00404
00405
00406 COLOR m_Color;
00407 COLOR m_HighlightColor;
00408
00409 ERRVALUE CreateFromLayoutText (
00410 const FILEPATH& filepath
00411 );
00412
00413 #endif // GENERATING_DOXYGEN_OUTPUT
00414 };
00415
00416
00417 #endif