Surface.cpp
Go to the documentation of this file.
00001 
00011 #include <interactive_world_tools/Surface.h>
00012 #include <stdexcept>
00013 
00014 using namespace std;
00015 using namespace rail::interactive_world;
00016 
00017 Surface::Surface(const string &name, const string &frame_id, const double width, const double height)
00018     : name_(name), frame_id_(frame_id)
00019 {
00020   width_ = width;
00021   height_ = height;
00022 }
00023 
00024 const string &Surface::getName() const
00025 {
00026   return name_;
00027 }
00028 
00029 void Surface::setName(const string &name)
00030 {
00031   name_ = name;
00032 }
00033 
00034 const string &Surface::getFrameID() const
00035 {
00036   return frame_id_;
00037 }
00038 
00039 void Surface::setFrameID(const string &frame_id)
00040 {
00041   frame_id_ = frame_id;
00042 }
00043 
00044 double Surface::getWidth() const
00045 {
00046   return width_;
00047 }
00048 
00049 void Surface::setWidth(const double width)
00050 {
00051   width_ = width;
00052 }
00053 
00054 double Surface::getHeight() const
00055 {
00056   return height_;
00057 }
00058 
00059 
00060 void Surface::setHeight(const double height)
00061 {
00062   height_ = height;
00063 }
00064 
00065 const vector<PlacementSurface> &Surface::getPlacementSurfaces() const
00066 {
00067   return placement_surfaces_;
00068 }
00069 
00070 size_t Surface::getNumPlacementSurfaces() const
00071 {
00072   return placement_surfaces_.size();
00073 }
00074 
00075 const PlacementSurface &Surface::getPlacementSurface(const size_t index) const
00076 {
00077   // check the index value first
00078   if (index < placement_surfaces_.size())
00079   {
00080     return placement_surfaces_[index];
00081   } else
00082   {
00083     throw std::out_of_range("Surface::getPlacementSurface : Placement surface index does not exist.");
00084   }
00085 }
00086 
00087 void Surface::addPlacementSurface(const PlacementSurface &placement_surface)
00088 {
00089   placement_surfaces_.push_back(placement_surface);
00090 }
00091 
00092 void Surface::removePlacementSurface(const size_t index)
00093 {
00094   // check the index value first
00095   if (index < placement_surfaces_.size())
00096   {
00097     placement_surfaces_.erase(placement_surfaces_.begin() + index);
00098   } else
00099   {
00100     throw std::out_of_range("Surface::removePlacementSurface : Placement surface index does not exist.");
00101   }
00102 }
00103 
00104 const std::vector<PointOfInterest> &Surface::getPointsOfInterest() const
00105 {
00106   return pois_;
00107 }
00108 
00109 size_t Surface::getNumPointsOfInterest() const
00110 {
00111   return pois_.size();
00112 }
00113 
00114 const PointOfInterest &Surface::getPointOfInterest(const size_t index) const
00115 {
00116   // check the index value first
00117   if (index < pois_.size())
00118   {
00119     return pois_[index];
00120   } else
00121   {
00122     throw std::out_of_range("Surface::getPointOfInterest : Point of interest index does not exist.");
00123   }
00124 }
00125 
00126 void Surface::addPointOfInterest(const PointOfInterest &point_of_interest)
00127 {
00128   pois_.push_back(point_of_interest);
00129 }
00130 
00131 void Surface::removePointOfInterest(const size_t index)
00132 {
00133   // check the index value first
00134   if (index < pois_.size())
00135   {
00136     pois_.erase(pois_.begin() + index);
00137   } else
00138   {
00139     throw std::out_of_range("Surface::removePointOfInterest : Point of interest index does not exist.");
00140   }
00141 }
00142 
00143 const std::vector<std::string> &Surface::getAliases() const
00144 {
00145   return aliases_;
00146 }
00147 
00148 size_t Surface::getNumAliases() const
00149 {
00150   return aliases_.size();
00151 }
00152 
00153 const std::string &Surface::getAlias(const size_t index) const
00154 {
00155   // check the index value first
00156   if (index < aliases_.size())
00157   {
00158     return aliases_[index];
00159   } else
00160   {
00161     throw std::out_of_range("Surface::getAlias : Alias index does not exist.");
00162   }
00163 }
00164 
00165 void Surface::addAlias(const std::string &alias)
00166 {
00167   aliases_.push_back(alias);
00168 }
00169 
00170 void Surface::removeAlias(const size_t index)
00171 {
00172   // check the index value first
00173   if (index < aliases_.size())
00174   {
00175     aliases_.erase(aliases_.begin() + index);
00176   } else
00177   {
00178     throw std::out_of_range("Surface::removeAlias : Alias index does not exist.");
00179   }
00180 }


interactive_world_tools
Author(s): Russell Toris
autogenerated on Thu Jun 6 2019 21:34:15