HW2DBoundReader.h
1 #ifndef HW2DBOUNDREADER_H
2 #define HW2DBOUNDREADER_H
3 
4 #include "dwf/whiptk/fileext.h"
5 #include "dwf/whiptk/whiperrs.h"
6 #include "dwfcore/InputStream.h"
7 #include "dwf/package/Resource.h"
8 #include "dwf/package/Section.h"
9 #include "dwf/dwfx/Constants.h"
10 #include "dwf/package/EPlotSection.h"
11 #include "dwf/package/Paper.h"
12 
13 #include "Access.h"
14 
15 // A class which reads through 2D DWF and only computes the bounding box
16 class HW2DBoundReader : public WT_FileExt
17 {
18 public:
19  HW2DBoundReader(DWFInputStream & rW2DStream);
20  virtual ~HW2DBoundReader() {}
21 
22  WT_Result read();
23  WT_Result process_stream_close() { return WT_Result::Success; }
24  WT_Result process_stream_end_seek() { return WT_Result::Success; }
25  WT_Result process_stream_open();
26  WT_Result process_stream_read(int desired_bytes, int & bytes_read, void * buffer);
27  WT_Result process_stream_seek(int distance, int & amount_seeked);
28  WT_Result process_stream_tell(unsigned long * current_file_pointer_position);
29  WT_Result process_stream_write(int /*size*/, void const * /*buffer*/) { return WT_Result::Toolkit_Usage_Error; }
30 
31  static WT_Result _processPolyMarker(WT_Polymarker & /*polymarker*/, WT_File & /*file*/) { return WT_Result::Success; }
32  static WT_Result _processPolytriangle(WT_Polytriangle & polytriangle, WT_File & file);
33  static WT_Result _processText(WT_Text & text, WT_File & file);
34  static WT_Result _processEllipse(WT_Outline_Ellipse & wt_oellipse, WT_File & file);
35  static WT_Result _processPolyline(WT_Polyline & polyline, WT_File & file);
36  static WT_Result _processPolygon(WT_Polygon & polygon, WT_File & file);
37  static WT_Result _processImage(WT_Image & image, WT_File & file);
38  static WT_Result _processPNG_Group4_Image(WT_PNG_Group4_Image & image, WT_File & file);
39  static WT_Result _processVisibility(WT_Visibility & visibility, WT_File & file);
40 
41  WT_Logical_Box m_wtModelBoundingBox;
42 
43 private:
44  size_t m_nBytesAvailable;
45  DWFString m_zContent;
46  DWFInputStream & m_rW2DStream;
47 };
48 
49 #ifndef DWFIO_SUPPORT_ONLY_LEGACY_VERSIONS
50 #include "dwf/XAML/XamlFile.h"
51 
52 class HW2DBoundReaderXaml : public WT_XAML_File //WT_FileExt
53 {
54 public:
55  HW2DBoundReaderXaml(DWFToolkit::DWFResource * pResource, DWFToolkit::DWFSection * pSection);
56  virtual ~HW2DBoundReaderXaml();
57 
58  WT_Result read();
59  WT_Result process_stream_close() { return WT_Result::Success; }
60  WT_Result process_stream_end_seek() { return WT_Result::Success; }
61  WT_Result process_stream_open();
62  WT_Result process_stream_read(int desired_bytes, int & bytes_read, void * buffer);
63  WT_Result process_stream_seek(int distance, int & amount_seeked);
64  WT_Result process_stream_tell(unsigned long * current_file_pointer_position);
65  WT_Result process_stream_write(int /*size*/, void const * /*buffer*/) { return WT_Result::Toolkit_Usage_Error; }
66 
67  static WT_Result _processPolyMarker(WT_Polymarker & /*polymarker*/, WT_File & /*file*/) { return WT_Result::Success; }
68  static WT_Result _processPolytriangle(WT_Polytriangle & polytriangle, WT_File & file);
69  static WT_Result _processText(WT_Text & text, WT_File & file);
70  static WT_Result _processEllipse(WT_Outline_Ellipse & wt_oellipse, WT_File & file);
71  static WT_Result _processPolyline(WT_Polyline & polyline, WT_File & file);
72  static WT_Result _processPolygon(WT_Polygon & polygon, WT_File & file);
73  static WT_Result _processImage(WT_Image & image, WT_File & file);
74  static WT_Result _processPNG_Group4_Image(WT_PNG_Group4_Image & image, WT_File & file);
75  static WT_Result _processVisibility(WT_Visibility & visibility, WT_File & file);
76 
77  WT_Logical_Box m_wtModelBoundingBox;
78 
79 private:
80  size_t m_nBytesAvailable;
81  DWFString m_zContent;
82  DWFInputStream * m_rW2DStream;
83  Access * m_pAccess;
84 };
85 #endif
86 
87 #endif //HW2DBOUNDREADER_H
Definition: Access.h:10
Definition: HW2DBoundReader.h:52
Definition: HW2DBoundReader.h:16