00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <algorithm>
00012 #include "PointOfInterest.h"
00013
00014 #define THIS PointOfInterest
00015
00016 void THIS::init ( int id, std::string name, PoiType type, std::string remarks, std::map< std::string, std::string > stringMap,
00017 std::map< std::string, float > floatMap, std::map< std::string, int > intMap ) {
00018 m_Id = id;
00019 m_Name = name;
00020 m_Type = type;
00021 m_Remarks = remarks;
00022 m_StringMap = stringMap;
00023 m_FloatMap = floatMap;
00024 m_IntMap = intMap;
00025 }
00026
00027 THIS::THIS( ): Pose(0, 0, 0)
00028 {
00029 init( -1 , "empty", DEFAULT, "", std::map< std::string, std::string >(), std::map< std::string, float >(), std::map< std::string, int >() );
00030 }
00031
00032 THIS::THIS( int id, const PointOfInterest* poi ): Pose(poi->x(), poi->y(), poi->theta())
00033 {
00034 if (poi) {
00035 init(id, poi->m_Name, poi->m_Type, poi->m_Remarks, poi->m_StringMap, poi->m_FloatMap, poi->m_IntMap);
00036 } else {
00037
00038 init(-1, "",DEFAULT,"",StringMapT(),FloatMapT(),IntMapT());
00039 }
00040 }
00041
00042 bool THIS::hasName( std::string name ) const
00043 {
00044
00045 std::string poiName = m_Name;
00046 transform( poiName.begin(), poiName.end(), poiName.begin(), ( int ( * ) ( int ) )toupper );
00047 transform( name.begin(), name.end(), name.begin(), ( int ( * ) ( int ) )toupper );
00048
00049 return ( poiName.compare( name ) == 0 );
00050 }
00051
00052 bool THIS::hasInName( std::string part ) const
00053 {
00054
00055 std::string poiName = m_Name;
00056 transform( poiName.begin(), poiName.end(), poiName.begin(), ( int ( * ) ( int ) )toupper );
00057 transform( part.begin(), part.end(), part.begin(), ( int ( * ) ( int ) )toupper );
00058
00059 return ( ( int )poiName.find( part ) != -1 );
00060 }
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 void THIS::printOn( std::ostream& strm ) const
00092 {
00093 strm << m_Id << ", ";
00094 strm << m_Name << ", ";
00095 strm << m_Type << ", ";
00096 strm << m_Remarks << ",";
00097 strm << "(" << m_X << "," << m_Y<< "," << m_Theta << ")";
00098 }
00099
00100 #undef THIS