owlps/owlps-positioning/area.hh

156 lines
2.4 KiB
C++
Raw Normal View History

#ifndef _OWLPS_POSITIONING_AREA_HH_
#define _OWLPS_POSITIONING_AREA_HH_
class Building ;
#include "point3d.hh"
#include <string>
#include <ostream>
class Area
{
protected:
Building *building ;
std::string name ;
Point3D p_min ;
Point3D p_max ;
public:
Area(const Building *_building, const std::string &_name = "Unnamed area",
const float &_x1 = 0, const float &_y1 = 0, const float &_z1 = 0,
const float &_x2 = 0, const float &_y2 = 0, const float &_z2 = 0) ;
Area(const Area &a) ;
~Area() {}
Building* get_building(void) const ;
std::string get_name(void) const ;
Point3D get_p_min(void) const ;
Point3D get_p_max(void) const ;
void set_building(const Building *_building) ;
void set_name(const std::string &_name) ;
void set_x_min(const float &v) ;
void set_y_min(const float &v) ;
void set_z_min(const float &v) ;
void set_x_max(const float &v) ;
void set_y_max(const float &v) ;
void set_z_max(const float &v) ;
void set_p_min(const Point3D &p) ;
void set_p_max(const Point3D &p) ;
bool contains_point(const Point3D &p) const ;
bool operator==(const Area &a) const ;
bool operator!=(const Area &a) const ;
friend std::ostream &operator<<(std::ostream &os, const Area &a) ;
} ;
/*** Accesseurs lecture ***/
inline Building* Area::get_building() const
{
return building ;
}
inline std::string Area::get_name() const
{
return name ;
}
inline Point3D Area::get_p_min() const
{
return p_min ;
}
inline Point3D Area::get_p_max() const
{
return p_max ;
}
/*** Accesseurs écriture ***/
inline void Area::set_building(const Building *_building)
{
building = (Building *) _building ;
}
inline void Area::set_name(const std::string &_name)
{
name = _name ;
}
inline void Area::set_x_min(const float &v)
{
p_min.set_x(v) ;
}
inline void Area::set_y_min(const float &v)
{
p_min.set_y(v) ;
}
inline void Area::set_z_min(const float &v)
{
p_min.set_z(v) ;
}
inline void Area::set_x_max(const float &v)
{
p_max.set_x(v) ;
}
inline void Area::set_y_max(const float &v)
{
p_max.set_y(v) ;
}
inline void Area::set_z_max(const float &v)
{
p_max.set_z(v) ;
}
inline void Area::set_p_min(const Point3D &p)
{
p_min = p ;
}
inline void Area::set_p_max(const Point3D &p)
{
p_max = p ;
}
/*** Opérateurs ***/
inline bool Area::operator!=(const Area &a) const
{
return !(*this == a) ;
}
#endif // _OWLPS_POSITIONING_AREA_HH_