84 lines
1.5 KiB
C++
84 lines
1.5 KiB
C++
#ifndef _OWLPS_POSITIONING_WAYPOINT_HH_
|
|
#define _OWLPS_POSITIONING_WAYPOINT_HH_
|
|
|
|
class Building ;
|
|
|
|
#include "point3d.hh"
|
|
|
|
#include <ostream>
|
|
#include <vector>
|
|
#include <stdexcept>
|
|
|
|
class Waypoint: public Point3D
|
|
{
|
|
protected:
|
|
std::vector<Building*> buildings ;
|
|
|
|
public:
|
|
Waypoint(const Building *_b, const Point3D &p) ;
|
|
Waypoint(const Building *_b, const float &_x = 0, const float &_y = 0,
|
|
const float &_z = 0) ;
|
|
Waypoint(const Point3D &p): Point3D(p) {}
|
|
Waypoint(const Waypoint &wp): Point3D(wp), buildings(wp.buildings) {}
|
|
|
|
~Waypoint(void) ;
|
|
|
|
Building* get_1st_building(void) const ;
|
|
const std::vector<Building*>& get_buildings(void) const ;
|
|
|
|
void add_building(const Building *_b) ;
|
|
|
|
const Waypoint& operator=(const Waypoint &wp) ;
|
|
bool operator==(const Waypoint &wp) const ;
|
|
bool operator!=(const Waypoint &wp) const ;
|
|
|
|
friend std::ostream& operator<<(std::ostream &os, const Waypoint &wp) ;
|
|
} ;
|
|
|
|
|
|
|
|
/*** Accesseurs lecture ***/
|
|
|
|
|
|
inline Building* Waypoint::get_1st_building() const
|
|
{
|
|
try
|
|
{
|
|
return buildings.at(0) ;
|
|
}
|
|
catch (std::out_of_range &e)
|
|
{
|
|
return NULL ;
|
|
}
|
|
}
|
|
|
|
|
|
inline const std::vector<Building*>& Waypoint::get_buildings() const
|
|
{
|
|
return buildings ;
|
|
}
|
|
|
|
|
|
|
|
/*** Accesseurs écriture ***/
|
|
|
|
|
|
inline void Waypoint::add_building(const Building *_b)
|
|
{
|
|
buildings.push_back((Building *) _b) ;
|
|
}
|
|
|
|
|
|
|
|
/*** Opérateurs ***/
|
|
|
|
|
|
inline bool Waypoint::operator!=(const Waypoint &wp) const
|
|
{
|
|
return !(*this == wp) ;
|
|
}
|
|
|
|
|
|
|
|
#endif // _OWLPS_POSITIONING_WAYPOINT_HH_
|