HIOUtilityPublish.h
1 // Copyright (c) Tech Soft 3D, Inc.
2 //
3 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
4 // and considered a trade secret as defined under civil and criminal statutes.
5 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
6 // unauthorized use or misappropriation of its trade secrets. Use of this information
7 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
8 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
9 
10 #ifndef _HIOUTILITYPUBLISH_H
11 #define _HIOUTILITYPUBLISH_H
12 
13 #ifdef H_PACK_8
14 #pragma pack(push)
15 #pragma pack(8)
16 #endif
17 
18 #include "HTools.h"
19 #include "HIOManager.h"
20 #include "vlist.h"
21 #include "varray.h"
22 
23 #ifdef HIO_PUBLISH
24 # ifdef _MSC_VER
25 # define HIO_API __declspec (dllexport)
26 # else
27 # define HIO_API __attribute__ ((visibility ("default")))
28 # endif
29 #else
30 # define HIO_API
31 #endif
32 
33 
34 enum HPDFLayoutImageType
35 {
36  HJPG = 0,
37  HPNG = 1,
38 };
39 
40 enum HPDFLayoutVisibility
41 {
42  HUnchanged = 0,
43  HVisibile = 1,
44  HInvisible = 2,
45 };
46 
47 
48 class HPDFField
49 {
50 public:
51  HPDFField()
52  {
53  m_text = 0;
54  m_name = 0;
55  m_imagename = 0;
56  m_javascript = 0;
57  m_visibility = HUnchanged;
58  }
59  ~HPDFField()
60  {
61  delete [] m_text;
62  delete [] m_name;
63  delete [] m_imagename;
64  delete [] m_javascript;
65  }
66 
67  void Set(const wchar_t *name, const wchar_t *text, const wchar_t *javascript = 0, HPDFLayoutVisibility visibility = HUnchanged)
68  {
69  if (name)
70  {
71  m_name = new wchar_t[wcslen(name)+1];
72  wcscpy(m_name, name);
73  }
74 
75  if (text)
76  {
77  m_text = new wchar_t[wcslen(text)+1];
78  wcscpy(m_text, text);
79  }
80  if (javascript)
81  {
82  m_javascript = new wchar_t[wcslen(javascript)+1];
83  wcscpy(m_javascript, javascript);
84  }
85 
86  m_visibility = visibility;
87  }
88 
89  void SetImage(const wchar_t *name,const wchar_t *imagename, HPDFLayoutImageType imagetype, int imagewidth, int imageheight)
90  {
91  if (name)
92  {
93  m_name = new wchar_t[wcslen(name)+1];
94  wcscpy(m_name, name);
95  }
96 
97  if (imagename)
98  {
99  m_imagename = new wchar_t[wcslen(imagename)+1];
100  wcscpy(m_imagename,imagename);
101  }
102 
103  m_imagetype = imagetype;
104  m_imagewidth = imagewidth;
105  m_imageheight = imageheight;
106  }
107 
108  wchar_t const *GetText() { return m_text; }
109  wchar_t const *GetImage() { return m_imagename; }
110  wchar_t const *GetName() { return m_name; }
111  wchar_t const *GetJavascript() { return m_javascript; }
112  HPDFLayoutVisibility GetVisibility() { return m_visibility; }
113  HPDFLayoutImageType GetImageType() { return m_imagetype; }
114  int GetImageWidth() { return m_imagewidth; }
115  int GetImageHeight() { return m_imageheight; }
116 
117 
118 
119 private:
120 
121  wchar_t *m_text;
122  wchar_t *m_imagename;
123 
124  wchar_t *m_name;
125  wchar_t *m_javascript;
126  HPDFLayoutVisibility m_visibility;
127  HPDFLayoutImageType m_imagetype;
128  int m_imagewidth, m_imageheight;
129 };
130 
131 
135 class HIO_API HPDFLayoutManager
136 {
137 public:
140  {
141  m_templatefile = 0;
142  m_3DFieldName = 0;
143  m_FieldList = new_vlist(malloc,free);
144 
145  }
146 
149  {
150  START_LIST_ITERATION(HPDFField, m_FieldList);
151  delete temp;
152  END_LIST_ITERATION(m_FieldList);
153  delete_vlist(m_FieldList);
154  delete [] m_templatefile;
155  delete [] m_3DFieldName;
156  }
157 
161  void SetTemplateName(const wchar_t *name)
162  {
163  if (name)
164  {
165  m_templatefile = new wchar_t[wcslen(name)+1];
166  wcscpy(m_templatefile, name);
167  }
168  }
172  void Set3DFieldName(const wchar_t *name)
173  {
174  if (name)
175  {
176  m_3DFieldName = new wchar_t[wcslen(name)+1];
177  wcscpy(m_3DFieldName, name);
178  }
179  }
180 
181 
187  void AddMiscModification(const wchar_t *name, wchar_t *javascript = 0, HPDFLayoutVisibility visibility = HUnchanged)
188  {
189  HPDFField * field = new HPDFField;
190  field->Set(name, 0, javascript, visibility);
191  vlist_add_last(m_FieldList, field);
192  }
193 
199  void AddTextModification(const wchar_t *name, const wchar_t *text)
200  {
201  HPDFField * field = new HPDFField;
202  field->Set(name, text, 0, HUnchanged);
203  vlist_add_last(m_FieldList, field);
204  }
205 
206 
214  void AddImageModification(const wchar_t *name, const wchar_t *imagename, HPDFLayoutImageType imagetype, int imagewidth, int imageheight)
215  {
216  HPDFField * field = new HPDFField;
217  field->SetImage(name, imagename, imagetype, imagewidth, imageheight);
218  vlist_add_last(m_FieldList, field);
219  }
220 
221 
224  {
225  return m_FieldList;
226  }
228  wchar_t *GetTemplateName()
229  {
230  return m_templatefile;
231  }
233  wchar_t *Get3DFieldName()
234  {
235  return m_3DFieldName;
236  }
237 
238 private:
239  wchar_t * m_templatefile;
240  wchar_t * m_3DFieldName;
241  struct vlist_s * m_FieldList;
242 
243 };
244 
245 
246 class HPublishExchangeView;
247 typedef VArray<HPublishExchangeView *> HPEViewsArray;
248 
252 class HIO_API HIOUtilityPublish: public HInputHandler, public HOutputHandler
253 {
254 
255 public:
256 
259  virtual ~HIOUtilityPublish() { ReleaseJavascript(); };
260 
265  const char * GetOutputName() { return "HIOUtilityPublish"; }
266  const char * GetInputName() { return "HIOUtilityPublish"; }
267 
269  const char * GetInputTypesString() {return ""; }
270 
271 
272 
275 
283  HFileInputResult FileInputByKey(const wchar_t * FileName, HC_KEY key, HInputHandlerOptions * options);
284 
285  HFileInputResult FileInputByKey(const char * FileName, HC_KEY key, HInputHandlerOptions * options){
286  return FileInputByKey(H_WCS(FileName).encodedText(), key, options);
287  };
288 
289  HFileInputResult FileInputByKey(const unsigned short * FileName, HC_KEY key, HInputHandlerOptions * options){
290  H_UTF16 utf16;
291  utf16.encodedText((utf16_char const*) FileName);
292  return FileInputByKey(H_WCS(utf16).encodedText(), key, options);
293  };
294 
295  HFileOutputResult FileOutputByKey(const wchar_t * filename, HC_KEY key, HOutputHandlerOptions * options);
296 
297  HFileOutputResult FileOutputByKey(const unsigned short * filename, HC_KEY key, HOutputHandlerOptions * options){
298  H_UTF16 utf16;
299  utf16.encodedText((utf16_char const*) filename);
300  return FileOutputByKey(H_WCS(utf16).encodedText(), key, options);
301  }
302 
303  HFileOutputResult FileOutputByKey(const char * filename, HC_KEY key, HOutputHandlerOptions * options){
304  return FileOutputByKey(H_WCS(filename).encodedText(), key, options);
305  }
306 
308 
315  virtual void *BuildPRCModel(HOutputHandlerOptions * options, HC_KEY key);
316 
317 
318  const char * GetOutputTypesString() {
319  return "prc;iges;step;x_t;stl;pdf;html";
320  }
321 
323  return HOutputHandlerStyleModel;
324  }
333  virtual HFileIOResult WriteSimplePDF(wchar_t const * file_name, void *PRCModel, HOutputHandlerOptions * options, wchar_t const *javascript_file, const HPEViewsArray& hoopsviews);
341  virtual HFileIOResult WritePDFFromTemplate(wchar_t const * file_name, void *PRCModel, HOutputHandlerOptions * options, HPDFLayoutManager * layoutmanager, wchar_t const *javascript_file);
342 
350  char * GenerateJavascript(HBaseView *view);
354  void ReleaseJavascript();
355 
356 private:
357  char *m_pAnimationData;
358 
359 };
360 
361 
362 
363 
364 
368 class HIO_API H3DXOptions
369 {
370 public:
372  H3DXOptions() {Reset();};
374  void Reset(){
375  m_bSaveToPDF = false;
376  m_pAsmModelFile = 0;
377  };
378 
379  bool m_bSaveToPDF;
380  void * m_pAsmModelFile;
381 };
382 
383 
384 
385 
386 #ifdef HIO_PUBLISH
387 extern "C" {
388  HIO_API void * CreateInput(HIOManager *manager);
389  HIO_API void * CreateOutput(HIOManager *manager);
390  HIO_API void * CreateConnector(void * unused);
391  HIO_API void Free(HIOUtilityPublish *);
392  }
393 
394 
395 #endif
396 
397 #ifdef H_PACK_8
398 #pragma pack(pop)
399 #endif
400 
401 #endif
Definition: HIOManager.h:1434
virtual HFileOutputResult FileOutputByKey(const char *filename, HC_KEY key, HOutputHandlerOptions *options)
~HPDFLayoutManager()
Definition: HIOUtilityPublish.h:148
virtual void RegisterInputHandlerTypes()=0
Definition: HIOUtilityPublish.h:252
vlist_s * GetFieldModificationList()
Definition: HIOUtilityPublish.h:223
Specifies an HInputHandler for model data.
Definition: HIOManager.h:226
virtual HFileInputResult FileInputByKey(const char *filename, HC_KEY key, HInputHandlerOptions *options)
HInputHandler an abstract base class for model and image input.
Definition: HIOManager.h:655
HOutputHandlerStyle
Definition: HIOManager.h:846
void AddTextModification(const wchar_t *name, const wchar_t *text)
Definition: HIOUtilityPublish.h:199
void AddMiscModification(const wchar_t *name, wchar_t *javascript=0, HPDFLayoutVisibility visibility=HUnchanged)
Definition: HIOUtilityPublish.h:187
HOutputHandler an abstract base class for model and image output.
Definition: HIOManager.h:1247
virtual void RegisterOutputHandlerTypes()=0
const char * GetInputName()
Definition: HIOUtilityPublish.h:266
HPDFLayoutManager()
Definition: HIOUtilityPublish.h:139
HOutputHandlerStyle GetOutputStyle()
Definition: HIOUtilityPublish.h:322
void AddImageModification(const wchar_t *name, const wchar_t *imagename, HPDFLayoutImageType imagetype, int imagewidth, int imageheight)
Definition: HIOUtilityPublish.h:214
void Reset()
Definition: HIOUtilityPublish.h:374
HInputHandlerStyle
Definition: HIOManager.h:225
Definition: HIOManager.h:892
The HBaseView class defines and manages a view of model information.
Definition: HBaseView.h:332
const char * GetOutputTypesString()
Definition: HIOUtilityPublish.h:318
Definition: HIOUtilityPublish.h:368
Definition: HIOUtilityPublish.h:135
const char * GetInputTypesString()
Definition: HIOUtilityPublish.h:269
void Set3DFieldName(const wchar_t *name)
Definition: HIOUtilityPublish.h:172
const char * GetOutputName()
Definition: HIOUtilityPublish.h:265
Definition: HIOManager.h:246
wchar_t * GetTemplateName()
Definition: HIOUtilityPublish.h:228
A header file containing the HIO classes for passing to HBaseView::FileInput and HBaseView::FileOutpu...
HInputHandlerStyle GetInputStyle()
Definition: HIOUtilityPublish.h:274
HFileIOResult
Definition: HGlobals.h:24
void SetTemplateName(const wchar_t *name)
Definition: HIOUtilityPublish.h:161
wchar_t * Get3DFieldName()
Definition: HIOUtilityPublish.h:233
Definition: HIOUtilityPublish.h:48
H3DXOptions()
Definition: HIOUtilityPublish.h:372