Alphabetical Class Index   Compound Members   File List  

DataLoader.h
1 // Copyright (c) 1998-2014 by 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 #if !defined(AFX_DATALOADER_H__A606F2DA_B9BD_487F_93F8_A22F5BAD1DA5__INCLUDED_)
11 #define AFX_DATALOADER_H__A606F2DA_B9BD_487F_93F8_A22F5BAD1DA5__INCLUDED_
12 
13 #if _MSC_VER > 1000
14 #pragma once
15 #endif // _MSC_VER > 1000
16 
17 #include "resource.h" // main symbols
18 #include <atlctl.h>
19 #include "HUtility.h"
20 
21 #include "HStream.h"
22 #include "HOpcodeHandler.h"
23 struct IWebBrowserApp;
24 
25 
26 #include "Vector"
27 using namespace std;
28 
29 
30 class HBaseModel;
31 class HCtrlView;
32 class HCtrlDB;
33 class HBaseOperator;
34 class CHoops3dStreamCtrl;
35 class HUtilityXMLTag;
36 class HUtilityXMLGenerator;
37 class ModelStructureObject;
38 
39 
40 
42 struct databuffer
43 {
44  unsigned char *data;
45  unsigned int length;
46 };
47 
48 
50 
56 {
57 public:
63  virtual ~CDataLoader();
64 
69  void Init(HCtrlView *view);
76  bool StartDownload(BSTR filename, bool isStreamable = true);
83  bool OnData (BYTE* pBytes, DWORD dwSize);
84 
89  bool ProcessNextChunk();
90 
94  bool GetDownloadInProgress() { return m_bDownloadInProgress; }
95 
99  bool GetDownloadComplete() { return m_bDataProcessingComplete; }
100 
104  long GetDownloadDataReceived() { return m_DataReceived; }
105 
109  long GetDownloadDataTotalSize() { return m_DataReceiveSize; }
114  void AbortDownload() {
115  if (!m_bDataProcessingComplete || m_bDownloadInProgress) {
116  m_bAbortDownload = true;
117  if (!m_bDownloadInProgress)
118  m_bDataProcessingComplete = true;
119  }
120 
121  }
126  void SetDownloadStatus(int ulProgressMax) { m_DataReceiveSize = ulProgressMax; }
127 
131  bool GetRestoreCamera() { return m_bRestoreCamera; }
132 
137  void SetRestoreCamera(bool restorecamera) { m_bRestoreCamera = restorecamera; }
138 
139 
144  void SetTreeControlXML(char *data);
145 
150  char *GetTreeControlXML() { return m_pTreeControlXML; }
151 
152 
157  struct vlist_s* GetModelStructureTypeList() { return m_ModelStructureTypesList; }
162  ModelStructureObject *GetModelStructureObjectTree() { return m_pModelStructureObjectTree; }
163 
169  int FilterIdentifier(int identifier, char *type);
177  ModelStructureObject * FindModelStructureObject(ModelStructureObject *mso, int identifier);
178 
185  void GetXMLForItemChildren(int identifier, char *(&text));
186 
194  ModelStructureObject * FindModelStructureObject(ModelStructureObject *mso, char *path);
201  void GetXMLForItemChildren(ModelStructureObject *mso, char *(&text));
208  void GetXMLForItemChildren(char *path, char *(&text));
215  void GetPathFromIdentifier(int identifier, char *path);
216 
217 
222  HCtrlView * GetView() { return m_pView; }
227  CHoops3dStreamCtrl *GetControl() { return m_pStreamControl; }
228 
229 
231 protected:
238  TK_Status ProcessData( BYTE* pBytes, DWORD dwSize);
242  void ClearCachedDataList();
243 
244 
245 
246  vector <databuffer *> m_CachedDataList;
260 private:
261  void ResetModelStructureTypes();
262 
263  FILE * m_temphandle;
264  TCHAR m_tempfilename[MAX_PATH];
265  char * m_pTreeControlXML;
266  struct vlist_s* m_ModelStructureTypesList;
267  ModelStructureObject *m_pModelStructureObjectTree;
268  CHoops3dStreamCtrl *m_pStreamControl;
269 
270 
271 };
272 
273 
274 #ifndef DOXYGEN_SHOULD_SKIP_THIS
275 
276 template <class T>
277 class CBindStatusCallback2 : public CBindStatusCallback<T>
278 {
279  typedef void (T::*ATL_PDATAAVAILABLE2)(CBindStatusCallback<T>* pbsc, BYTE* pBytes, DWORD dwSize);
280 
281 public:
282  STDMETHOD(OnProgress)(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
283  {
284 // ATLTRACE(_T("CBindStatusCallback2::OnProgress"));
285 // return m_pT->OnProgress ( ulProgress, ulProgressMax, ulStatusCode, szStatusText );
286  m_pT->GetDataLoader()->SetDownloadStatus(ulProgressMax);
287  return S_OK;
288  }
289 
290  static HRESULT Download(T* pT, ATL_PDATAAVAILABLE2 pFunc, BSTR bstrURL, IUnknown* pUnkContainer = NULL, BOOL bRelative = FALSE)
291  {
292  CComObject<CBindStatusCallback2<T> > *pbsc;
293  HRESULT hRes = CComObject<CBindStatusCallback2<T> >::CreateInstance(&pbsc);
294  if (FAILED(hRes))
295  return hRes;
296  return pbsc->StartAsyncDownload(pT, pFunc, bstrURL, pUnkContainer, bRelative);
297  }
298 };
299 
300 class ModelStructureType
301 {
302 public:
303 
304  ModelStructureType()
305  {
306  m_pName = 0;
307  m_pImage = 0;
308  m_bSelectable = false;
309 
310  }
311  ~ModelStructureType()
312  {
313  delete [] m_pName;
314  delete [] m_pImage;
315  }
316 
317  void SetName(char *name)
318  {
319  m_pName = new char[strlen(name)+1];
320  strcpy(m_pName, name);
321  }
322 
323  void SetImage(char *image)
324  {
325  m_pImage = new char[strlen(image)+1];
326  strcpy(m_pImage, image);
327  }
328 
329  char *GetName() { return m_pName; }
330  char *GetImage() { return m_pImage; }
331  bool GetSelectable() { return m_bSelectable; }
332  void SetSelectable( bool selectable ) { m_bSelectable = selectable; }
333 
334  char *m_pName;
335  char *m_pImage;
336  bool m_bSelectable;
337 
338 };
339 
340 class ModelStructureObject
341 {
342 public:
343 
344  ModelStructureObject();
345  ~ModelStructureObject();
346  void SetType(char *name)
347  {
348  m_pType = new char[strlen(name)+1];
349  strcpy(m_pType, name);
350  }
351  void SetType(ModelStructureType *type)
352  {
353  m_pTypePointer = type;
354  }
355 
356  void SetIdentifier(int identifier)
357  {
358  m_Identifier = identifier;
359  }
360  void SetParent(ModelStructureObject *parent)
361  {
362  m_pParent = parent;
363  }
364  void SetName(char *name)
365  {
366  m_pName = new char[strlen(name)+1];
367  strcpy(m_pName, name);
368  }
369 
370  char *GetType() { return m_pType; }
371  ModelStructureType *GetTypePointer() { return m_pTypePointer; }
372  void SelectAllChildItemsRecursive(HBaseView *view);
373  void Select(HBaseView *view);
374 
375 
376  void AddChild(ModelStructureObject *child);
377 
378  char *m_pType;
379  char *m_pName;
380  struct vlist_s* m_Children;
381  struct vlist_s* m_IdentifierList;
382  ModelStructureObject *m_pParent;
383  ModelStructureType *m_pTypePointer;
384  int m_Identifier;
385 
386 };
387 
388 
389 class TK_ATL_Initial_View : public HTK_Camera
390 {
391 private:
392  HCtrlView * m_pView;
393  int my_stage;
394  HTK_Camera *my_camera;
395  CDataLoader *m_pDataLoader;
396 
397 public:
398  TK_ATL_Initial_View(HCtrlView * view, CDataLoader *dataloader) : HTK_Camera(TKE_View)
399  {
400  m_pView = view;
401  m_pDataLoader = dataloader;
402  }
403 
404  TK_Status Interpret(BStreamFileToolkit &tk, ID_Key key, int variant);
405  TK_Status Execute (BStreamFileToolkit & tk);
406 };
407 
408 
409 
410 
412 class TK_ModelStructure_XML : public TK_XML
413 {
414 
415 
416 public:
417 
422  TK_ModelStructure_XML(CDataLoader * model, HStreamFileToolkit*toolkit) : TK_XML()
423  {
424  m_pDataLoader = model;
425  m_pStreamFileToolkit = toolkit;
426  }
427 
428 
430  TK_Status Execute (BStreamFileToolkit & tk);
431 
432  static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData);
433 
434 private:
435  CDataLoader * m_pDataLoader;
436  HStreamFileToolkit * m_pStreamFileToolkit;
437  struct vlist_s* m_TempObjects;
440 };
441 
442 class XML_Parsing_Object
443 {
444 public:
445  CDataLoader * m_pDataLoader;
446  char *buffer;
447  static unsigned long XMLParsingThread(LPVOID pParam);
448  struct vlist_s* m_TempObjects;
449  HUtilityXMLGenerator * m_pXmlgen;
450 
451 };
452 
453 
454 #endif
455 
456 #endif // !defined(AFX_DATALOADER_H__A606F2DA_B9BD_487F_93F8_A22F5BAD1DA5__INCLUDED_)
457 
458 
long m_DataReceived
Definition: DataLoader.h:252
void SetDownloadStatus(int ulProgressMax)
Definition: DataLoader.h:126
long GetDownloadDataReceived()
Definition: DataLoader.h:104
bool m_bDataIsStreamable
Definition: DataLoader.h:249
long m_DataReceiveSize
Definition: DataLoader.h:253
bool GetDownloadComplete()
Definition: DataLoader.h:99
A HOOPS/ATL specific implmentation of the HOOPS/MVO HDB class.
Definition: HCtrlDB.h:27
char * GetTreeControlXML()
Definition: DataLoader.h:150
void AbortDownload()
Definition: DataLoader.h:114
CDataLoader * GetDataLoader()
Definition: Hoops3dStreamCtrl.h:1607
long GetDownloadDataTotalSize()
Definition: DataLoader.h:109
struct vlist_s * GetModelStructureTypeList()
Definition: DataLoader.h:157
bool m_bDataProcessingComplete
Definition: DataLoader.h:256
bool GetRestoreCamera()
Definition: DataLoader.h:131
The CHoops3dStreamCtrl is the primary HOOPS ATL Control class.
Definition: Hoops3dStreamCtrl.h:68
bool m_bRestoreCamera
Definition: DataLoader.h:258
void SetRestoreCamera(bool restorecamera)
Definition: DataLoader.h:137
HCtrlView * m_pView
Definition: DataLoader.h:248
bool m_bAbortDownload
Definition: DataLoader.h:254
The CDataLoader class provides support for loading a file in a piecwise fashion (streaming) ...
Definition: DataLoader.h:55
A HOOPS/ActiveX specific implmentation of the HOOPS/MVO HBaseView class.
Definition: HCtrlView.h:32
TK_Status
vector< databuffer * > m_CachedDataList
Definition: DataLoader.h:246
bool GetDownloadInProgress()
Definition: DataLoader.h:94
HCtrlView * GetView()
Definition: DataLoader.h:222
! databuffer holds chunks of stream data
Definition: DataLoader.h:42
unsigned char * data
Definition: DataLoader.h:44
ModelStructureObject * GetModelStructureObjectTree()
Definition: DataLoader.h:162
CHoops3dStreamCtrl * GetControl()
Definition: DataLoader.h:227
unsigned int length
Definition: DataLoader.h:45
DWORD m_ParsingThread
Definition: DataLoader.h:230
bool m_bDownloadInProgress
Definition: DataLoader.h:251