00001
00027 #ifndef INC_LIDARLASPOINT_H
00028 #define INC_LIDARLASPOINT_H
00029
00030 #ifndef INC_MI32_LIDARPOINT32_H
00031 #include <mi32/lidarpoint32.h>
00032 #endif
00033
00034 #ifndef INC_MI32_LIDARENUMS_H
00035 #include <mi32/lidarenums.h>
00036 #endif
00037
00038 #ifndef INC_MI32_DELEGATE_H
00039 #include <mi32/delegate.h>
00040 #endif
00041
00042
00043 #ifdef RVCSYSDLL
00044 #define CLASSLIBEXPORT MI_DLLCLASSEXPORT
00045 #else
00046 #define CLASSLIBEXPORT MI_DLLCLASSIMPORT
00047 #endif
00048
00049 #ifndef GENERATING_DOXYGEN_OUTPUT
00050 struct COLOR;
00051 class FILE_RAW;
00052 #endif
00053
00054
00055 namespace LIDAR {
00056 namespace LAS {
00057
00058
00059
00061 class CLASSLIBEXPORT POINTARRAY : public POINTARRAY32 {
00062 public:
00063
00065 POINTARRAY ();
00066
00068 ~POINTARRAY ();
00069
00070 UINT8 GetFormat () const
00071 { return (m_Format); }
00072
00073 UINT16 GetOffsetColor () const
00074 { return (m_OffsetColor); }
00075
00076 UINT16 GetOffsetTime () const
00077 { return (m_OffsetTime); }
00078
00079 UINT16 GetOffsetWave () const
00080 { return (m_OffsetWave); }
00081
00083 void SetFormat (
00084 UINT8 format,
00085 UINT16 RecordSize
00086 );
00087
00088 #ifdef BYTEORDER_HiLo
00089 void SwapBytes ();
00090 #endif
00091
00092 private:
00093 #ifndef GENERATING_DOXYGEN_OUTPUT
00094 UINT16 m_OffsetColor;
00095 UINT16 m_OffsetTime;
00096 UINT16 m_OffsetWave;
00097 UINT8 m_Format;
00098 #endif
00099 };
00100
00101
00102
00104 class CLASSLIBEXPORT POINTRECORD : public POINTRECORD32 {
00105 public:
00106
00108 POINTRECORD ()
00109 { }
00110
00112 POINTRECORD (const POINTRECORD& rhs)
00113 : POINTRECORD32(rhs) { }
00114
00116 POINTRECORD (POINTARRAY& Array)
00117 : POINTRECORD32(Array) { }
00118
00120 POINTRECORD (POINTARRAY& Array, UINT32 ArrayIdx)
00121 : POINTRECORD32(Array,ArrayIdx) { }
00122
00124 ~POINTRECORD ()
00125 { }
00126
00129 void CopyFrom (
00130 const POINTRECORD& src
00131 );
00132
00136 UINT8 GetClassFull (
00137 ) const { return (GetData()[OFFSET_Classification]); }
00138
00141 UINT8 GetClassification (
00142 ) const { return (GetData()[OFFSET_Classification] & 0x1F); }
00143
00145 void GetColor (
00146 COLOR& color
00147 ) const;
00148
00150 UINT16 GetIntensity (
00151 ) const { return (*reinterpret_cast<const UINT16*>(GetData()+OFFSET_Intensity)); }
00152
00154 UINT8 GetReturnCount (
00155 ) const { return ((GetData()[OFFSET_ReturnValues] & 0x38) >> 3); }
00156
00158 UINT8 GetReturnNumber (
00159 ) const { return (GetData()[OFFSET_ReturnValues] & 0x07); }
00160
00162 POINTRETURNTYPE GetReturnType () const;
00163
00165 UINT8 GetReturnValues (
00166 ) const { return (GetData()[OFFSET_ReturnValues]); }
00167
00169 INT8 GetScanAngle (
00170 ) const { return (static_cast<INT8>(GetData()[OFFSET_ScanAngleRank])); }
00171
00173 INT8 GetScanDirection (
00174 ) const { return (((GetData()[OFFSET_ReturnValues] & 0x40) != 0) ? 1 : -1); }
00175
00177 UINT16 GetSourceID (
00178 ) const { return (*reinterpret_cast<const UINT16*>(GetData()+OFFSET_PointSourceID)); }
00179
00182 double GetTime (
00183 ) const;
00184
00186 UINT8 GetUserData (
00187 ) const { return (GetData()[OFFSET_UserData]); }
00188
00189 UINT8 GetWaveDescIdx () const;
00190
00191 UINT64 GetWaveOffset () const;
00192
00193 float GetWavePointLocation () const;
00194
00195 UINT32 GetWaveSize () const;
00196
00197 float GetWaveXt () const;
00198
00199 float GetWaveYt () const;
00200
00201 float GetWaveZt () const;
00202
00203 bool HasColor () const
00204 { return (GetOffsetColor() != 0); }
00205
00206 bool HasTime () const
00207 { return (GetOffsetTime() != 0); }
00208
00209 bool HasWave () const
00210 { return (GetOffsetWave() != 0); }
00211
00213 bool IsDeleted (
00214 ) const { return ((GetData()[OFFSET_Classification] & 0x80) != 0); }
00215
00217 bool IsEndOfSweep (
00218 ) const { return ((GetData()[OFFSET_ReturnValues] & 0x80) != 0); }
00219
00221 bool IsFirstReturn (
00222 ) const { return (GetReturnNumber() == 1); }
00223
00225 bool IsKeyPoint (
00226 ) const { return ((GetData()[OFFSET_Classification] & 0x40) != 0); }
00227
00229 bool IsLastReturn (
00230 ) const { return (GetReturnNumber() == GetReturnCount()); }
00231
00233 bool IsSynthetic (
00234 ) const { return ((GetData()[OFFSET_Classification] & 0x20) != 0); }
00235
00237 void SetClassFull (
00238 UINT8 classfull
00239 ) { GetData()[OFFSET_Classification] = classfull; }
00240
00242 void SetClassification (
00243 UINT8 classification
00244 ) { GetData()[OFFSET_Classification] = (GetData()[OFFSET_Classification] & 0xE0) | (classification & 0x1F); }
00245
00247 void SetClassification (
00248 UINT8 classification,
00249 bool IsSynthetic,
00250 bool IsKeyPoint,
00251 bool IsDeleted
00252 ) { GetData()[OFFSET_Classification] = (classification & 0x1F) | (IsSynthetic ? 0x20 : 0) | (IsKeyPoint ? 0x40 : 0) | (IsDeleted ? 0x80 : 0); }
00253
00254 void SetColor (
00255 const COLOR& color
00256 );
00257
00259 void SetDeleted (
00260 bool deleted
00261 ) { if (deleted) GetData()[OFFSET_Classification] |= 0x80; else GetData()[OFFSET_Classification] &= 0x7F; }
00262
00263 void SetIntensity (
00264 UINT16 intensity
00265 ) { *reinterpret_cast<UINT16*>(GetData() + OFFSET_Intensity) = intensity; }
00266
00268 void SetKeyPoint (
00269 bool keypoint
00270 ) { if (keypoint) GetData()[OFFSET_Classification] |= 0x40; else GetData()[OFFSET_Classification] &= 0xBF; }
00271
00272 void SetReturnValues (
00273 UINT8 ReturnNumber,
00274 UINT8 ReturnCount,
00275 bool IsScanPositive,
00276 bool IsEndOfSweep
00277 ) { GetData()[OFFSET_ReturnValues] = (ReturnNumber & 7) | ((ReturnCount & 7) << 3) | (IsScanPositive ? 0x40 : 0) | (IsEndOfSweep ? 0x80 : 0); }
00278
00279 void SetScanAngle (
00280 INT8 ScanAngle
00281 ) { GetData()[OFFSET_ScanAngleRank] = ScanAngle; }
00282
00283 void SetSourceID (
00284 UINT16 SourceID
00285 ) { *reinterpret_cast<UINT16*>(GetData() + OFFSET_PointSourceID) = SourceID; }
00286
00288 void SetSynthetic (
00289 bool synthetic
00290 ) { if (synthetic) GetData()[OFFSET_Classification] |= 0x20; else GetData()[OFFSET_Classification] &= 0xDF; }
00291
00292 void SetTime (
00293 double time
00294 );
00295
00297 void SetUserData (
00298 UINT8 userdata
00299 ) { GetData()[OFFSET_UserData] = userdata; }
00300
00301 #ifdef BYTEORDER_HiLo
00302 void SwapBytes (UINT8 *data) const;
00303 #endif
00304
00305 ERRVALUE Write (FILE_RAW& file, INT64 offset) const;
00306
00307 private:
00308 #ifndef GENERATING_DOXYGEN_OUTPUT
00309
00310 static const int OFFSET_X = 0;
00311 static const int OFFSET_Y = 4;
00312 static const int OFFSET_Z = 8;
00313 static const int OFFSET_Intensity = 12;
00314 static const int OFFSET_ReturnValues = 14;
00315 static const int OFFSET_Classification = 15;
00316 static const int OFFSET_ScanAngleRank = 16;
00317 static const int OFFSET_UserData = 17;
00318 static const int OFFSET_PointSourceID = 18;
00319
00320 UINT8 GetFormat () const
00321 { return (static_cast<const POINTARRAY&>(GetArray()).GetFormat()); }
00322 UINT16 GetOffsetColor () const
00323 { return (static_cast<const POINTARRAY&>(GetArray()).GetOffsetColor()); }
00324 UINT16 GetOffsetTime () const
00325 { return (static_cast<const POINTARRAY&>(GetArray()).GetOffsetTime()); }
00326 UINT16 GetOffsetWave () const
00327 { return (static_cast<const POINTARRAY&>(GetArray()).GetOffsetWave()); }
00328 const UINT8* GetPtrWave () const
00329 { return (GetData() + GetOffsetWave()); }
00330
00331 #endif
00332 };
00333
00334
00335
00337 typedef fastdelegate::FastDelegate<bool(const LAS::POINTRECORD&)> DELEGATE_BOOL_POINTRECORD;
00338
00339
00340
00341 }
00342 }
00343
00344 #undef CLASSLIBEXPORT
00345
00346 #endif // INC_LIDAR_POINTRECORD_H