ScannerInfo.cpp
Go to the documentation of this file.
00001 //
00002 // ScannerInfo.cpp
00003 //
00004 //
00005 
00006 #include "ScannerInfo.hpp"
00007 
00008 #include "Position3D.hpp"
00009 #include "Scan.hpp"
00010 #include <cassert>
00011 #include "../tools/Time.hpp"
00012 #include "../tools/errorhandler.hpp"
00013 #include "../tools/toolbox.hpp"
00014 
00015 namespace datatypes
00016 {
00017         
00018 ScannerInfo::ScannerInfo()
00019         : m_deviceID(0)
00020         , m_scannerType(0)
00021         , m_scanNumber(0)
00022         , m_startAngle(NaN_double)
00023         , m_endAngle(NaN_double)
00024         , m_processingFlags(0)
00025         , m_scanStartTime(Time())
00026         , m_scanEndTime(Time())
00027         , m_scanFrequency(NaN_double)
00028         , m_beamTilt(0)
00029         , m_scanFlags(0)
00030         , m_mountingPosition()
00031 {
00032         m_datatype = Datatype_Scannerinfo;
00033 }
00034 
00035 ScannerInfo::~ScannerInfo()
00036 {
00037 }
00038 
00039 std::string ScannerInfo::scannerTypeToString(UINT8 st)
00040 {
00041         switch (st)
00042         {
00043                 case Scannertype_UNKNOWN:
00044                         return "UNKNOWN";
00045                         break;
00046                 case Scannertype_LMS1xx:
00047                         return "LMS1xx";
00048                         break;
00049                 default:
00050                         printError("scannerTypeToString: Unknown scanner type, code=" + ::toString((UINT16)st) + ".");
00051                         return "(error - unknown type)";
00052         }
00053 }
00054 
00055 
00056 bool ScannerInfo::operator==(const ScannerInfo& other) const
00057 {
00058         return
00059                 m_deviceID == other.m_deviceID
00060                 && m_scannerType == other.m_scannerType
00061                 && m_scanNumber == other.m_scanNumber
00062                 && (m_startAngle == other.m_startAngle || (isNaN(m_startAngle) && isNaN(other.m_startAngle)))
00063                 && (m_endAngle == other.m_endAngle || (isNaN(m_endAngle) && isNaN(other.m_endAngle)))
00064                 && m_scanStartTime == other.m_scanStartTime
00065                 && m_scanEndTime == other.m_scanEndTime
00066                 && (m_scanFrequency == other.m_scanFrequency || (isNaN(m_scanFrequency) && isNaN(other.m_scanFrequency)))
00067                 && m_beamTilt == other.m_beamTilt
00068                 && m_scanFlags == other.m_scanFlags
00069                 && m_mountingPosition == other.m_mountingPosition
00070                 ;
00071 }
00072 
00073 void ScannerInfo::setProcessingFlags(const UINT16 processingFlags)
00074 {
00075         m_processingFlags = processingFlags;
00076 }
00077 
00078 bool ScannerInfo::isRearMirrorSide()
00079 {
00080         if ((m_processingFlags & 0x0400) != 0)
00081         {
00082                 return true;
00083         }
00084 
00085         return false;
00086 }
00087 
00088 bool ScannerInfo::isFrontMirrorSide()
00089 {
00090         return !isRearMirrorSide();
00091 }
00092 
00093 
00094 void ScannerInfo::setStartAngle(double v)
00095 {
00096         assert(v >= -PI);
00097         assert(v < PI);
00098         m_startAngle = v;
00099 }
00100 
00101 void ScannerInfo::setEndAngle(double v)
00102 {
00103         assert(v >= -PI);
00104         assert(v < PI);
00105         m_endAngle = v;
00106 }
00107 
00108 void ScannerInfo::setScannerType(UINT8 v)
00109 {
00110         m_scannerType = v;
00111 }
00112 
00113 void ScannerInfo::setBeamTilt(double v)
00114 {
00115         assert(v >= -PI);
00116         assert(v < PI);
00117         m_beamTilt = v;
00118 }
00119 
00124 void ScannerInfo::setTimestamps (const Time& start,
00125                                                                  const Time& end)
00126 {
00127         assert(start < end);
00128         m_scanStartTime = start;
00129         m_scanEndTime = end;
00130 }
00131 
00136 /*
00137 void ScannerInfo::setDeviceTimestamps (const boost::posix_time::ptime& start,
00138                                                                            const boost::posix_time::ptime& end)
00139 {
00140         assert(!start.is_not_a_date_time());
00141         assert(!end.is_not_a_date_time());
00142         assert(start < end);
00143         m_scanStartDeviceTime = start;
00144         m_scanEndDeviceTime = end;
00145 }
00146 */
00147 
00148 void ScannerInfo::setScanFrequency(double freq)
00149 {
00150         assert(freq >= 0);
00151         m_scanFrequency = freq;
00152 }
00153 
00154 
00155 // bool ScannerInfo::isGroundLabeled()          const { return (m_scanFlags & Scan::FlagGroundLabeled)          != 0; }
00156 // bool ScannerInfo::isDirtLabeled()            const { return (m_scanFlags & Scan::FlagDirtLabeled )           != 0; }
00157 // bool ScannerInfo::isRainLabeled()            const { return (m_scanFlags & Scan::FlagRainLabeled)            != 0; }
00158 // bool ScannerInfo::isCoverageLabeled()        const { return (m_scanFlags & Scan::FlagCoverageLabeled)        != 0; }
00159 // bool ScannerInfo::isBackgroundLabeled()      const { return (m_scanFlags & Scan::FlagBackgroundLabeled)      != 0; }
00160 // bool ScannerInfo::isReflectorLabeled()       const { return (m_scanFlags & Scan::FlagReflectorLabeled)       != 0; }
00161 // bool ScannerInfo::isUpsideDown()             const { return (m_scanFlags & Scan::FlagUpsideDown)                     != 0; }
00162 // bool ScannerInfo::isRearMirrorSide() const { return (m_scanFlags & Scan::FlagRearMirrorSide)         != 0; }
00163 
00164 }       // namespace datatypes


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Wed Jun 14 2017 04:04:50