Alphabetical Class Index   Compound Members   File List  

DataLoader.h
1 //
2 // Copyright (c) 2002 by Tech Soft 3D, LLC.
3 // The information contained herein is confidential and proprietary to
4 // Tech Soft 3D, LLC., and considered a trade secret as defined under
5 // civil and criminal statutes. Tech Soft 3D shall pursue its civil
6 // and criminal remedies in the event of unauthorized use or misappropriation
7 // of its trade secrets. Use of this information by anyone other than
8 // authorized employees of Tech Soft 3D, LLC. is granted only under a
9 // written non-disclosure agreement, expressly prescribing the scope and
10 // manner of such use.
11 //
12 // $Id: 76f0c1f2b3e79cf985615530175028903ada2667 $
13 //
14 
15 
16 #if !defined(AFX_DATALOADER_H__A606F2DA_B9BD_487F_93F8_A22F5BAD1DA5__INCLUDED_)
17 #define AFX_DATALOADER_H__A606F2DA_B9BD_487F_93F8_A22F5BAD1DA5__INCLUDED_
18 
19 #if _MSC_VER > 1000
20 #pragma once
21 #endif // _MSC_VER > 1000
22 
23 #include "resource.h" // main symbols
24 #include <atlctl.h>
25 #include "HUtility.h"
26 
27 #include "HStream.h"
28 #include "HOpcodeHandler.h"
29 struct IWebBrowserApp;
30 
31 
32 #include "Vector"
33 using namespace std;
34 
35 
36 class HBaseModel;
37 class HCtrlView;
38 class HCtrlDB;
39 class HBaseOperator;
40 class CHoops3dStreamCtrl;
41 class HUtilityXMLTag;
42 class HUtilityXMLGenerator;
43 class ModelStructureObject;
44 
45 
46 
48 struct databuffer
49 {
50  unsigned char *data;
51  unsigned int length;
52 };
53 
54 
56 
62 {
63 public:
69  virtual ~CDataLoader();
70 
75  void Init(HCtrlView *view);
82  bool StartDownload(BSTR filename, bool isStreamable = true);
89  bool OnData (BYTE* pBytes, DWORD dwSize);
90 
95  bool ProcessNextChunk();
96 
100  bool GetDownloadInProgress() { return m_bDownloadInProgress; }
101 
105  bool GetDownloadComplete() { return m_bDataProcessingComplete; }
106 
110  long GetDownloadDataReceived() { return m_DataReceived; }
111 
115  long GetDownloadDataTotalSize() { return m_DataReceiveSize; }
120  void AbortDownload() {
121  if (!m_bDataProcessingComplete || m_bDownloadInProgress) {
122  m_bAbortDownload = true;
123  if (!m_bDownloadInProgress)
124  m_bDataProcessingComplete = true;
125  }
126 
127  }
132  void SetDownloadStatus(int ulProgressMax) { m_DataReceiveSize = ulProgressMax; }
133 
137  bool GetRestoreCamera() { return m_bRestoreCamera; }
138 
143  void SetRestoreCamera(bool restorecamera) { m_bRestoreCamera = restorecamera; }
144 
145 
150  void SetTreeControlXML(char *data);
151 
156  char *GetTreeControlXML() { return m_pTreeControlXML; }
157 
158 
163  struct vlist_s* GetModelStructureTypeList() { return m_ModelStructureTypesList; }
168  ModelStructureObject *GetModelStructureObjectTree() { return m_pModelStructureObjectTree; }
169 
175  int FilterIdentifier(int identifier, char *type);
183  ModelStructureObject * FindModelStructureObject(ModelStructureObject *mso, int identifier);
184 
191  void GetXMLForItemChildren(int identifier, char *(&text));
192 
200  ModelStructureObject * FindModelStructureObject(ModelStructureObject *mso, char *path);
207  void GetXMLForItemChildren(ModelStructureObject *mso, char *(&text));
214  void GetXMLForItemChildren(char *path, char *(&text));
221  void GetPathFromIdentifier(int identifier, char *path);
222 
223 
228  HCtrlView * GetView() { return m_pView; }
233  CHoops3dStreamCtrl *GetControl() { return m_pStreamControl; }
234 
235 
237 protected:
244  TK_Status ProcessData( BYTE* pBytes, DWORD dwSize);
248  void ClearCachedDataList();
249 
250 
251 
252  vector <databuffer *> m_CachedDataList;
266 private:
267  void ResetModelStructureTypes();
268 
269  FILE * m_temphandle;
270  TCHAR m_tempfilename[MAX_PATH];
271  char * m_pTreeControlXML;
272  struct vlist_s* m_ModelStructureTypesList;
273  ModelStructureObject *m_pModelStructureObjectTree;
274  CHoops3dStreamCtrl *m_pStreamControl;
275 
276 
277 };
278 
279 
280 #ifndef DOXYGEN_SHOULD_SKIP_THIS
281 
282 template <class T>
283 class CBindStatusCallback2 : public CBindStatusCallback<T>
284 {
285  typedef void (T::*ATL_PDATAAVAILABLE2)(CBindStatusCallback<T>* pbsc, BYTE* pBytes, DWORD dwSize);
286 
287 public:
288  STDMETHOD(OnProgress)(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
289  {
290 // ATLTRACE(_T("CBindStatusCallback2::OnProgress"));
291 // return m_pT->OnProgress ( ulProgress, ulProgressMax, ulStatusCode, szStatusText );
292  m_pT->GetDataLoader()->SetDownloadStatus(ulProgressMax);
293  return S_OK;
294  }
295 
296  static HRESULT Download(T* pT, ATL_PDATAAVAILABLE2 pFunc, BSTR bstrURL, IUnknown* pUnkContainer = NULL, BOOL bRelative = FALSE)
297  {
298  CComObject<CBindStatusCallback2<T> > *pbsc;
299  HRESULT hRes = CComObject<CBindStatusCallback2<T> >::CreateInstance(&pbsc);
300  if (FAILED(hRes))
301  return hRes;
302  return pbsc->StartAsyncDownload(pT, pFunc, bstrURL, pUnkContainer, bRelative);
303  }
304 };
305 
306 class ModelStructureType
307 {
308 public:
309 
310  ModelStructureType()
311  {
312  m_pName = 0;
313  m_pImage = 0;
314  m_bSelectable = false;
315 
316  }
317  ~ModelStructureType()
318  {
319  delete [] m_pName;
320  delete [] m_pImage;
321  }
322 
323  void SetName(char *name)
324  {
325  m_pName = new char[strlen(name)+1];
326  strcpy(m_pName, name);
327  }
328 
329  void SetImage(char *image)
330  {
331  m_pImage = new char[strlen(image)+1];
332  strcpy(m_pImage, image);
333  }
334 
335  char *GetName() { return m_pName; }
336  char *GetImage() { return m_pImage; }
337  bool GetSelectable() { return m_bSelectable; }
338  void SetSelectable( bool selectable ) { m_bSelectable = selectable; }
339 
340  char *m_pName;
341  char *m_pImage;
342  bool m_bSelectable;
343 
344 };
345 
346 class ModelStructureObject
347 {
348 public:
349 
350  ModelStructureObject();
351  ~ModelStructureObject();
352  void SetType(char *name)
353  {
354  m_pType = new char[strlen(name)+1];
355  strcpy(m_pType, name);
356  }
357  void SetType(ModelStructureType *type)
358  {
359  m_pTypePointer = type;
360  }
361 
362  void SetIdentifier(int identifier)
363  {
364  m_Identifier = identifier;
365  }
366  void SetParent(ModelStructureObject *parent)
367  {
368  m_pParent = parent;
369  }
370  void SetName(char *name)
371  {
372  m_pName = new char[strlen(name)+1];
373  strcpy(m_pName, name);
374  }
375 
376  char *GetType() { return m_pType; }
377  ModelStructureType *GetTypePointer() { return m_pTypePointer; }
378  void SelectAllChildItemsRecursive(HBaseView *view);
379  void Select(HBaseView *view);
380 
381 
382  void AddChild(ModelStructureObject *child);
383 
384  char *m_pType;
385  char *m_pName;
386  struct vlist_s* m_Children;
387  struct vlist_s* m_IdentifierList;
388  ModelStructureObject *m_pParent;
389  ModelStructureType *m_pTypePointer;
390  int m_Identifier;
391 
392 };
393 
394 
395 class TK_ATL_Initial_View : public HTK_Camera
396 {
397 private:
398  HCtrlView * m_pView;
399  int my_stage;
400  HTK_Camera *my_camera;
401  CDataLoader *m_pDataLoader;
402 
403 public:
404  TK_ATL_Initial_View(HCtrlView * view, CDataLoader *dataloader) : HTK_Camera(TKE_View)
405  {
406  m_pView = view;
407  m_pDataLoader = dataloader;
408  }
409 
410  TK_Status Interpret(BStreamFileToolkit &tk, ID_Key key, int variant) alter;
411  TK_Status Execute (BStreamFileToolkit & tk) alter;
412 };
413 
414 
415 
416 
418 class TK_ModelStructure_XML : public TK_XML
419 {
420 
421 
422 public:
423 
428  TK_ModelStructure_XML(CDataLoader * model, HStreamFileToolkit*toolkit) : TK_XML()
429  {
430  m_pDataLoader = model;
431  m_pStreamFileToolkit = toolkit;
432  }
433 
434 
436  TK_Status Execute (BStreamFileToolkit & tk) alter;
437 
438  static void *XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData);
439 
440 private:
441  CDataLoader * m_pDataLoader;
442  HStreamFileToolkit * m_pStreamFileToolkit;
443  struct vlist_s* m_TempObjects;
446 };
447 
448 class XML_Parsing_Object
449 {
450 public:
451  CDataLoader * m_pDataLoader;
452  char *buffer;
453  static unsigned long XMLParsingThread(LPVOID pParam);
454  struct vlist_s* m_TempObjects;
455  HUtilityXMLGenerator * m_pXmlgen;
456 
457 };
458 
459 
460 #endif
461 
462 #endif // !defined(AFX_DATALOADER_H__A606F2DA_B9BD_487F_93F8_A22F5BAD1DA5__INCLUDED_)
463 
464 
long m_DataReceived
Definition: DataLoader.h:258
#define alter
void SetDownloadStatus(int ulProgressMax)
Definition: DataLoader.h:132
long GetDownloadDataReceived()
Definition: DataLoader.h:110
bool m_bDataIsStreamable
Definition: DataLoader.h:255
long m_DataReceiveSize
Definition: DataLoader.h:259
bool GetDownloadComplete()
Definition: DataLoader.h:105
A HOOPS/ATL specific implmentation of the HOOPS/MVO HDB class.
Definition: HCtrlDB.h:32
char * GetTreeControlXML()
Definition: DataLoader.h:156
void AbortDownload()
Definition: DataLoader.h:120
CDataLoader * GetDataLoader()
Definition: Hoops3dStreamCtrl.h:1612
long GetDownloadDataTotalSize()
Definition: DataLoader.h:115
struct vlist_s * GetModelStructureTypeList()
Definition: DataLoader.h:163
bool m_bDataProcessingComplete
Definition: DataLoader.h:262
bool GetRestoreCamera()
Definition: DataLoader.h:137
The CHoops3dStreamCtrl is the primary HOOPS ATL Control class.
Definition: Hoops3dStreamCtrl.h:73
bool m_bRestoreCamera
Definition: DataLoader.h:264
void SetRestoreCamera(bool restorecamera)
Definition: DataLoader.h:143
HCtrlView * m_pView
Definition: DataLoader.h:254
bool m_bAbortDownload
Definition: DataLoader.h:260
The CDataLoader class provides support for loading a file in a piecwise fashion (streaming) ...
Definition: DataLoader.h:61
A HOOPS/ActiveX specific implmentation of the HOOPS/MVO HBaseView class.
Definition: HCtrlView.h:37
TK_Status
vector< databuffer * > m_CachedDataList
Definition: DataLoader.h:252
bool GetDownloadInProgress()
Definition: DataLoader.h:100
HCtrlView * GetView()
Definition: DataLoader.h:228
! databuffer holds chunks of stream data
Definition: DataLoader.h:48
unsigned char * data
Definition: DataLoader.h:50
ModelStructureObject * GetModelStructureObjectTree()
Definition: DataLoader.h:168
CHoops3dStreamCtrl * GetControl()
Definition: DataLoader.h:233
unsigned int length
Definition: DataLoader.h:51
DWORD m_ParsingThread
Definition: DataLoader.h:236
bool m_bDownloadInProgress
Definition: DataLoader.h:257