00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc. 00002 // 00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., 00004 // and considered a trade secret as defined under civil and criminal statutes. 00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of 00006 // unauthorized use or misappropriation of its trade secrets. Use of this information 00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under 00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use. 00009 00010 #ifndef _HIO_UTILITY_DWG_H 00011 #define _HIO_UTILITY_DWG_H 00012 00013 #ifdef H_PACK_8 00014 #pragma pack(push) 00015 #pragma pack(8) 00016 #endif 00017 00018 #include "HTools.h" 00019 #include "HIOManager.h" 00020 00021 #ifdef HIO_DWG 00022 #define HIO_API __declspec (dllexport) 00023 #else 00024 #define HIO_API 00025 #endif 00026 00027 00028 class DWGException 00029 { 00030 public: 00031 DWGException(const char* msg); 00032 ~DWGException(); 00033 char* what() 00034 { 00035 return m_message; 00036 } 00037 private: 00038 char* m_message; 00039 }; 00040 00041 00046 class HIO_API HIOUtilityDWG: public HInputHandler 00047 { 00048 00049 public: 00050 00052 HIOUtilityDWG() { 00053 SetInputOps(HInputOpFileInputByKey); 00054 }; 00055 virtual ~HIOUtilityDWG() {;}; 00056 00058 void RegisterInputHandlerTypes() { 00059 HIORegisterInputType("dwg",this); 00060 HIORegisterInputType("dxf",this); 00061 }; 00064 const char * GetOutputName() { return "HIOUtilityDWG"; } 00065 const char * GetInputName() { return "HIOUtilityDWG"; } 00066 00068 const char * GetInputTypesString() {return "dwg;dxf";}; 00069 00071 HInputHandlerStyle GetInputStyle() {return HInputHandlerStyleModel;}; 00072 00080 HFileInputResult FileInputByKey(const char * FileName, HC_KEY key, HInputHandlerOptions * options); 00081 00082 HFileInputResult FileInputByKey(const wchar_t * FileName, HC_KEY key, HInputHandlerOptions * options); 00083 00091 HFileInputResult FileInputByKey(const unsigned short * FileName, HC_KEY key, HInputHandlerOptions * options); 00092 00100 HFileInputResult DatabaseInputByKey(AcDbDatabase* pAcDbDatabase, 00101 HC_KEY key, HInputHandlerOptions * options); 00102 00106 static bool InitRealDWG(); 00107 00111 static bool ShutDownRealDWG(); 00112 00113 }; 00114 00115 00116 class AcDbDatabase; 00117 00120 class HIO_API HIOConnectorDWG : public HIOConnector 00121 { 00122 00123 public: 00125 HIOConnectorDWG() : m_pAcDbDatabase(0) {;}; 00126 ~HIOConnectorDWG(); 00127 00131 void SetDatabase(AcDbDatabase * pAcDbDatabase) 00132 { 00133 // database needs to me alive for DWG pointers to be valid 00134 m_pAcDbDatabase = pAcDbDatabase; 00135 } 00136 00137 protected: 00138 00140 AcDbDatabase * m_pAcDbDatabase; 00141 }; 00142 00143 00144 #ifdef HIO_DWG 00145 extern "C" { 00146 HIO_API void * CreateInput(HIOManager *manager); 00147 HIO_API void * CreateOutput(HIOManager *manager); 00148 HIO_API void * CreateConnector(void * unused); 00149 HIO_API void Free(HIOUtilityDWG *); 00150 HIO_API void FreeConnector(HIOConnectorDWG *connector); 00151 } 00152 #endif 00153 00154 00155 00156 #ifdef H_PACK_8 00157 #pragma pack(pop) 00158 #endif 00159 00160 #endif 00161 00162 00163 00164 00165 00166