00001 // 00002 // Copyright (c) 2000 by Tech Soft 3D, LLC. 00003 // The information contained herein is confidential and proprietary to 00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under 00005 // civil and criminal statutes. Tech Soft 3D shall pursue its civil 00006 // and criminal remedies in the event of unauthorized use or misappropriation 00007 // of its trade secrets. Use of this information by anyone other than 00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a 00009 // written non-disclosure agreement, expressly prescribing the scope and 00010 // manner of such use. 00011 // 00012 // $Id$ 00013 // 00014 #ifndef _HIO_UTILITY_DWG_H 00015 #define _HIO_UTILITY_DWG_H 00016 00017 #ifdef H_PACK_8 00018 #pragma pack(push) 00019 #pragma pack(8) 00020 #endif 00021 00022 #include "HTools.h" 00023 #include "HIOManager.h" 00024 00025 #ifdef HIO_DWG 00026 #define HIO_API __declspec (dllexport) 00027 #else 00028 #define HIO_API 00029 #endif 00030 00031 00032 class DWGException 00033 { 00034 public: 00035 DWGException(const char* msg); 00036 ~DWGException(); 00037 char* what() 00038 { 00039 return m_message; 00040 } 00041 private: 00042 char* m_message; 00043 }; 00044 00045 00050 class HIO_API HIOUtilityDWG: public HInputHandler 00051 { 00052 00053 public: 00054 00056 HIOUtilityDWG() { 00057 SetInputOps(HInputOpFileInputByKey); 00058 }; 00059 virtual ~HIOUtilityDWG() {;}; 00060 00062 void RegisterInputHandlerTypes() { 00063 HIORegisterInputType("dwg",this); 00064 HIORegisterInputType("dxf",this); 00065 }; 00068 const char * GetOutputName() { return "HIOUtilityDWG"; } 00069 const char * GetInputName() { return "HIOUtilityDWG"; } 00070 00072 const char * GetInputTypesString() {return "dwg;dxf";}; 00073 00075 HInputHandlerStyle GetInputStyle() {return HInputHandlerStyleModel;}; 00076 00084 HFileInputResult FileInputByKey(const char * FileName, HC_KEY key, HInputHandlerOptions * options); 00085 00086 HFileInputResult FileInputByKey(const wchar_t * FileName, HC_KEY key, HInputHandlerOptions * options); 00087 00095 HFileInputResult FileInputByKey(const unsigned short * FileName, HC_KEY key, HInputHandlerOptions * options); 00096 00104 HFileInputResult DatabaseInputByKey(AcDbDatabase* pAcDbDatabase, 00105 HC_KEY key, HInputHandlerOptions * options); 00106 00110 static bool InitRealDWG(); 00111 00115 static bool ShutDownRealDWG(); 00116 00117 }; 00118 00119 00120 class AcDbDatabase; 00121 00124 class HIO_API HIOConnectorDWG : public HIOConnector 00125 { 00126 00127 public: 00129 HIOConnectorDWG() : m_pAcDbDatabase(0) {;}; 00130 ~HIOConnectorDWG(); 00131 00135 void SetDatabase(AcDbDatabase * pAcDbDatabase) 00136 { 00137 // database needs to me alive for DWG pointers to be valid 00138 m_pAcDbDatabase = pAcDbDatabase; 00139 } 00140 00141 protected: 00142 00144 AcDbDatabase * m_pAcDbDatabase; 00145 }; 00146 00147 00148 #ifdef HIO_DWG 00149 extern "C" { 00150 HIO_API void * CreateInput(HIOManager *manager); 00151 HIO_API void * CreateOutput(HIOManager *manager); 00152 HIO_API void * CreateConnector(void * unused); 00153 HIO_API void Free(HIOUtilityDWG *); 00154 HIO_API void FreeConnector(HIOConnectorDWG *connector); 00155 } 00156 #endif 00157 00158 00159 00160 #ifdef H_PACK_8 00161 #pragma pack(pop) 00162 #endif 00163 00164 #endif 00165 00166 00167 00168 00169 00170