1 #ifndef HW2DREADERCOMMON_H 2 #define HW2DREADERCOMMON_H 8 #include "tempfile_utils.h" 12 #include "dwf/whiptk/fileext.h" 13 #include "dwf/package/GlobalSection.h" 14 #include "dwf/package/EPlotSection.h" 17 #define TWO_PI 6.283185307179586476925286766559 20 #define HK_Two_Pi TWO_PI 22 #define DWFIO_EPSILON 1e-05 // Define your own tolerance 23 #define DWFIO_FLOAT_EQ(x,v) (((v - DWFIO_EPSILON) < x) && (x <( v + DWFIO_EPSILON))) 37 std::map<int, H_FORMAT_TEXT> lay_num_map;
48 DWFInputStream * rW2DStream,
53 CoordinateMode coord_mode = recentered_coords);
57 DWFToolkit::DWFResource * pResource,
62 CoordinateMode coord_mode = recentered_coords);
66 DWFToolkit::DWFResource * pResource,
67 DWFToolkit::DWFSection * pSection,
73 CoordinateMode coord_mode = recentered_coords);
80 static WT_Result _processPolyMarker(WT_Polymarker & polymarker, WT_File & file);
81 static WT_Result _processPolytriangle(WT_Polytriangle & polytriangle, WT_File & file);
82 static WT_Result _processText(WT_Text & text, WT_File & file);
83 static WT_Result _processContourNode(WT_Contour_Set & contour_set, WT_File & file);
84 static WT_Result _processEllipse(WT_Outline_Ellipse & e, WT_File & file);
85 static WT_Result _processPolyline(WT_Polyline & polyline, WT_File & file );
86 static WT_Result _processPolygon(WT_Polygon & polygon, WT_File & file);
87 static WT_Result _processImage(WT_Image & image, WT_File & file);
88 static WT_Result _processPNG_Group4_Image(WT_PNG_Group4_Image & image, WT_File & file);
91 static WT_Result _processColorMap(WT_Color_Map & color_map, WT_File & file);
92 static WT_Result _processURL(WT_URL & named_url, WT_File & file);
93 static WT_Result _processLineWeight(WT_Line_Weight & lw, WT_File & file);
94 static WT_Result _processFill(WT_Fill & rFill, WT_File & file);
95 static WT_Result _processColor(WT_Color & rColor, WT_File & file);
96 static WT_Result _processViewport(WT_Viewport & viewport, WT_File & file);
97 static WT_Result _processView(WT_View & view, WT_File & file);
98 static WT_Result _processFont(WT_Font & font, WT_File & file);
99 static WT_Result _processVisibility(WT_Visibility & visibility, WT_File & file);
100 static WT_Result _processBackground(WT_Background & background, WT_File & file);
101 static WT_Result _processHAlignment(WT_Text_HAlign & hAln, WT_File & file);
102 static WT_Result _processObjectNode(WT_Object_Node & object_node, WT_File & file);
103 static WT_Result _processPlotInfo(WT_Plot_Info & plot_info, WT_File & file);
104 static WT_Result _processInkedArea(WT_Inked_Area & inked_area, WT_File & file);
105 static WT_Result _processNamedView(WT_Named_View & named_view, WT_File & file);
106 static WT_Result _processLayer(WT_Layer & layer, WT_File & file);
107 static WT_Result _processUnits(WT_Units & units, WT_File & file);
109 bool compute_extents(DWFInputStream & input_stream);
110 WT_Result read(
double z_separation,
double depth_range_separation);
111 int incrementImageCount();
112 void setFillMode(
bool val);
113 bool fillMode() {
return m_bFill; }
115 WT_Result process_stream_close() {
return WT_Result::Success; }
116 WT_Result process_stream_end_seek(){
return WT_Result::Success; }
117 WT_Result process_stream_open();
118 WT_Result process_stream_read(
int desired_bytes,
int & bytes_read,
void * buffer);
119 WT_Result process_stream_seek(
int distance,
int & amount_seeked);
120 WT_Result process_stream_tell(
unsigned long * current_file_pointer_position);
121 WT_Result process_stream_write(
int size,
void const * buffer) {
return WT_Result::Toolkit_Usage_Error; }
124 WT_Result _importPolytriangle (WT_Polytriangle & polytriangle);
125 WT_Result _importText(WT_Text & text);
126 bool is_this_face_really_a_hole(
int point_count,
HPoint const * points);
127 WT_Result _importContourNode(WT_Contour_Set & contour_set);
128 WT_Result _importEllipse(WT_Outline_Ellipse & e);
129 WT_Result _importPolyline(WT_Polyline & polyline);
130 WT_Result _importPolygon(WT_Polygon & polygon);
131 WT_Result _importImage(WT_Image & image);
132 WT_Result _importPNG_Group4_Image(WT_PNG_Group4_Image & image);
135 WT_Result import_line_weight (WT_Line_Weight & lw);
136 WT_Result _importLineWeight (WT_Line_Weight & lw) {
return import_line_weight(lw); }
137 WT_Result _importFill (WT_Fill & rFill);
138 void apply_object_attrs(HC_KEY key);
139 WT_Result _importColor(WT_Color & rColor);
140 WT_Result _importViewport(WT_Viewport & viewport);
141 WT_Result _importLayer(WT_Layer & layer);
142 WT_Result _importColorMap(WT_Color_Map & color_map);
143 WT_Result _importObjectNode(WT_Object_Node & object_node);
144 WT_Result _importPlotInfo(WT_Plot_Info & plot_info, WT_File & file);
145 WT_Result _importInkedArea(WT_Inked_Area & inked_area, WT_File & file) {
return WT_Result::Success; }
146 WT_Result _importNamedView(WT_Named_View & named_view);
147 WT_Result _importFont(WT_Font & font);
148 WT_Result _importVisibility(WT_Visibility & visibility);
149 WT_Result _importHAlignment(WT_Text_HAlign & hAln);
150 WT_Result _importUnits(WT_Units & units);
151 WT_Result _importURL(WT_URL & named_url);
152 WT_Result _importView(WT_View & view);
153 WT_Result _importBackground(WT_Background & background);
157 void resort_finish();
160 void resort_segment();
167 ViewportInfo(WT_String vName, WT_String vUnits,
double scale)
168 : measurementScalingFactor(scale)
171 strcpy(viewportName, vName.ascii());
173 strcpy(viewportName, H_FORMAT_TEXT(
"viewport_%d", anonymousViewportCount++));
176 strcpy(viewportMeasuringUnits, vUnits.ascii());
178 strcpy(viewportMeasuringUnits,
"no_units");
181 char viewportName[MVO_BUFFER_SIZE];
182 char viewportMeasuringUnits[MVO_BUFFER_SIZE];
183 double measurementScalingFactor;
186 ViewportInfo * m_currentViewport;
187 bool m_bisViewportOpen;
188 static int anonymousViewportCount;
190 std::set<HC_KEY> m_viewportSegments;
192 size_t m_nBytesAvailable;
193 DWFString m_zContent;
194 DWFInputStream * m_rW2DStream;
195 bool m_bFreeInputStream;
196 bool m_bColorMapExist;
198 WT_File * m_pWT_File;
199 DWFToolkit::DWFResource * m_pResource;
200 DWFToolkit::DWFSection * m_pSection;
202 WT_Result import_image(
int size,
const WT_Byte * image_data,
const char * type,
203 WT_Logical_Point
const & min_corner, WT_Logical_Point
const & max_corner);
204 WT_Result import_Other_Formats(WT_Image & image);
205 WT_Result insert_Image_Mesh(
char * image_name, WT_Logical_Point
const & min_corner, WT_Logical_Point
const & max_corner);
212 static inline float unwind_loops(
float arc_angle)
214 if( arc_angle <= HK_Two_Pi )
217 float fmod_arc_angle = fmod(arc_angle, (
float) HK_Two_Pi);
218 if( (arc_angle >= HK_Two_Pi) && DWFIO_FLOAT_EQ(0.0f, fmod_arc_angle) )
220 return (
float) HK_Two_Pi;
222 return fmod_arc_angle;
226 H_FORMAT_TEXT m_layerName;
227 bool m_layer_visibility;
229 double m_z_separation;
230 double m_use_depth_range;
231 double m_depth_range;
233 CoordinateMode m_CoordMode;
234 WT_Units* m_pWhipUnits;
238 bool m_unmark_detector;
239 H_UTF8 m_current_url;
244 char m_font[MVO_BUFFER_SIZE];
245 char m_fontName[100];
246 char m_backupFont[100];
247 char m_fontStyle[100];
248 char m_fontHeight[100];
249 char m_fontScale[100];
250 char m_fontOblique[100];
251 double m_line_edge_weight;
253 char m_hAlignment[4];
256 char m_object_id[MVO_BUFFER_SIZE];
257 bool m_bDisableDWFDrawOrder;
259 bool m_bImportThumbnail;
272 static int m_image_count;
281 #endif //HW2DREADERCOMMON_H
Definition: HW2DReaderCommon.h:25
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:121
A header file containing the HIO classes for passing to HBaseView::FileInput and HBaseView::FileOutpu...
Definition: HW2DReaderCommon.h:33