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 _HIOUTILITYPOINTCLOUD_H 00011 #define _HIOUTILITYPOINTCLOUD_H 00012 00013 #ifdef H_PACK_8 00014 #pragma pack(push) 00015 #pragma pack(8) 00016 #endif 00017 00022 #include "HIOManager.h" 00023 #include <stdint.h> 00024 00025 class MVO_API HPointCloudOptions { 00026 public: 00030 HPointCloudOptions () { Defaults(); } 00031 ~HPointCloudOptions () {} 00032 00036 void Defaults () { 00037 m_numBuckets = 512; 00038 m_lowIntensityValue = 0; 00039 m_highIntensityValue = 0; 00040 m_maxShellSize = 10000; 00041 m_minShellSize = 2000; 00042 } 00043 00048 unsigned int m_numBuckets; 00053 int m_lowIntensityValue; 00058 int m_highIntensityValue; 00062 int m_maxShellSize; 00066 int m_minShellSize; 00067 }; 00068 00069 #include "vbsp.h" 00070 00071 class PCPoint; 00072 class RGBColor; 00073 class BSPData; 00074 class HBaseView; 00075 typedef DefaultBSPNodeItemContainer<PCPoint *> PCPointContainer; 00076 00092 enum PointCloudFileType { 00093 NONE, 00094 UNKNOWN, 00095 PTS, 00096 PTX, 00097 XYZ 00098 }; 00099 00100 class MVO_API HIOUtilityPointCloud : public HInputHandler 00101 { 00102 public: 00103 HIOUtilityPointCloud (); 00104 ~HIOUtilityPointCloud (); 00105 00113 HFileInputResult FileInputByKey ( const __wchar_t * filename, HC_KEY key, HInputHandlerOptions * options ); 00114 HFileInputResult FileInputByKey ( const unsigned short * filename, HC_KEY key, HInputHandlerOptions * options ){ 00115 H_UTF16 utf16; 00116 utf16.encodedText(filename); 00117 return FileInputByKey(H_WCS(utf16).encodedText(), key, options); 00118 }; 00119 HFileInputResult FileInputByKey ( const char * filename, HC_KEY key, HInputHandlerOptions * options ) { 00120 return FileInputByKey(H_WCS(filename).encodedText(), key, options); 00121 }; 00122 00125 const char * GetInputName() { return "HIOUtilityPointCloud"; } 00126 00130 const char * GetInputTypesString (); 00131 HInputHandlerStyle GetInputStyle () { return HInputHandlerStyleModel; }; 00135 void RegisterInputHandlerTypes (); 00136 00137 private: 00138 bool Initialize ( const __wchar_t * filename ); 00139 HFileInputResult SpatiallySortPointCloud ( HC_KEY seg_key ); 00140 00141 float GetScaledIntensity ( PCPoint * cpt ); 00142 00143 // functions when walking the hash 00144 static void DeleteBSPs ( VBSP<PCPoint *> * bsp, int bucket, const void * const user_data ); 00145 static void WriteShellsToFile ( VBSP<PCPoint *> * bsp, int bucket, const void * const user_data ); 00146 00147 // function when walking the BSP 00148 static VBSPStatus GetShellsFromBSP ( PCPointContainer * container, void * user_data ); 00149 00150 bool InsertShells ( BSPData * bsp_data ); 00151 00152 FILE * m_file; 00153 int64_t m_file_size; 00154 wchar_t m_bin_file_name[MVO_BUFFER_SIZE]; 00155 FILE * m_bin_file; 00156 00157 PointCloudFileType m_point_cloud_file_type; 00158 unsigned long m_num_points; 00159 float m_std_bbox[6]; 00160 float m_matrix[16]; 00161 int m_min_intensity; 00162 int m_max_intensity; 00163 00164 HBaseView * m_pHView; 00165 HPointCloudOptions * m_point_cloud_options; 00166 }; 00167 00168 00169 #ifdef H_PACK_8 00170 #pragma pack(pop) 00171 #endif 00172 00173 #endif