00001 // 00002 // FieldParameter.hpp 00003 // 00004 // Created on: 30.08.2011 00005 // Author: wahnfla 00006 // 00007 00008 #ifndef FIELDPARAMETER_HPP 00009 #define FIELDPARAMETER_HPP 00010 00011 #include "../BasicDatatypes.hpp" 00012 #include "FieldDescription.hpp" 00013 #include "Polygon2D.hpp" 00014 #include <vector> 00015 #include <stdexcept> 00016 //#include "Trace.hpp" 00017 00018 namespace datatypes 00019 { 00020 00021 // 00022 // Class that represents the structure of a field parameter of a scanner 00023 // 00024 class FieldParameter : public BasicData 00025 { 00026 public: 00027 enum CaseResult 00028 { 00029 ECR_DONT_CARE = 0, 00030 ECR_LOW = 1, 00031 ECR_HIGH = 2, 00032 ECR_DETECTING = 3 00033 }; 00034 00035 // These codes match the internal representation of the LD-MRS 00036 enum FieldTypeIntern 00037 { 00038 FieldTypeIntern_RADIAL = 0, 00039 FieldTypeIntern_RECTANGLE = 1, 00040 FieldTypeIntern_SEGMENTED = 2, 00041 FieldTypeintern_DYNAMIC = 3 00042 }; 00043 00044 FieldParameter(); 00045 virtual ~FieldParameter(); 00046 virtual const UINT32 getUsedMemory() const; 00047 UINT32 getAngleScaleFactor() const; 00048 INT32 getAngleScaleOffset() const; 00049 double getDistScaleFactor() const; 00050 double getDistScaleOffset() const; 00051 FieldDescription* getField() const; 00052 FieldTypeIntern getFieldTypeIntern() const; 00053 std::string getFieldTypeInternAsString() const; 00054 void setAngleScaleFactor(UINT32 angleScaleFactor); 00055 void setAngleScaleOffset(INT32 angleScaleOffset); 00056 void setDistScaleFactor(double distScaleFactor); 00057 void setDistScaleOffset(double distScaleOffset); 00058 void setField(FieldDescription* field); 00059 00060 void setFieldNumber(UINT16 m_fieldNumber); 00061 const UINT16 getFieldNumber() const; 00062 const bool isValid() const; 00063 00064 void setFieldTypeIntern(UINT8 fieldTypeIntern); 00065 void setFieldTypeIntern(FieldTypeIntern m_fieldTypeIntern); 00066 const std::string & getComment() const; 00067 const std::string & getFieldName() const; 00068 void setComment(const std::string& comment); 00069 void setFieldName(const std::string& fieldName); 00070 UINT8 getVersionNumber() const; 00071 void setVersionNumber(UINT8 m_versionNumber); 00072 CaseResult getLastKnownInfringementState() const; 00073 void setLastKnownInfringementState(CaseResult lastKnownInfringementState); 00074 00075 bool isLayerFilterEnabled() const; 00076 void setEnableLayerFilter(bool enableLayerFilter); 00077 UINT8 getLayerFilterBitmap() const; 00078 void setLayerFilterBitmap(UINT8 layerFilterBitmap); 00079 00080 bool empty() const 00081 { 00082 return !m_field; 00083 } 00084 00085 const Polygon2D & getPolygon() const 00086 { 00087 if (empty()) 00088 { 00089 throw std::runtime_error("FieldDescription::getPolygon(): No field available."); 00090 } 00091 return m_field->getFieldAsPolygon(); 00092 } 00093 00094 const FieldDescription::FieldType getFieldType() const; 00095 00096 00097 private: 00098 // Header data (sensor specific) 00099 double m_distScaleFactor; 00100 double m_distScaleOffset; 00101 UINT32 m_angleScaleFactor; 00102 INT32 m_angleScaleOffset; 00103 FieldTypeIntern m_fieldTypeIntern; 00104 UINT16 m_fieldNumber; 00105 UINT8 m_versionNumber; 00106 std::string m_fieldName; 00107 std::string m_comment; 00108 FieldDescription* m_field; 00109 CaseResult m_lastKnownInfringementState; 00110 bool m_enableLayerFilter; 00111 UINT8 m_layerFilterBitmap; 00112 }; 00113 00114 } // namespace datatypes 00115 00116 #endif // FIELDPARAMETER_HPP