17 #ifndef _GAZEBO_GUI_BUILDING_BUILDINGMAKER_HH_
18 #define _GAZEBO_GUI_BUILDING_BUILDINGMAKER_HH_
24 #include <ignition/math/Pose3.hh>
25 #include <ignition/math/Vector3.hh>
38 class BuildingModelManip;
42 class BuildingMakerPrivate;
58 public:
void OnEdit(
bool _checked);
62 public:
void SetModelName(
const std::string &_modelName);
65 public:
void FinishModel();
73 public: std::string AddPart(
const std::string &_type,
74 const QVector3D &_size,
const QVector3D &_pos,
double _angle);
81 public: std::string AddWall(
const QVector3D &_size,
const QVector3D &_pos,
89 public: std::string AddWindow(
const QVector3D &_size,
90 const QVector3D &_pos,
double _angle);
97 public: std::string AddDoor(
const QVector3D &_size,
const QVector3D &_pos,
106 public: std::string AddStairs(
const QVector3D &_size,
107 const QVector3D &_pos,
double _angle,
int _steps);
114 public: std::string AddFloor(
const QVector3D &_size,
115 const QVector3D &_pos,
double _angle);
119 public:
void RemovePart(
const std::string &_partName);
123 public:
void RemoveWall(
const std::string &_wallName);
128 public:
void ConnectItem(
const std::string &_partName,
136 public:
void AttachManip(
const std::string &_child,
137 const std::string &_parent);
141 public:
void DetachFromParent(
const std::string &_child);
145 public:
void DetachAllChildren(
const std::string &_parent);
150 public:
bool IsAttached(
const std::string &_child)
const;
162 public:
static ignition::math::Vector3d ConvertSize(
163 const double _width,
const double _depth,
const double _height);
174 public:
static ignition::math::Pose3d ConvertPose(
const double _x,
175 const double _y,
const double _z,
const double _roll,
176 const double _pitch,
const double _yaw);
181 public:
static double Convert(
double _value);
186 public:
static double ConvertAngle(
double _angle);
189 public:
void Reset();
192 public:
void GenerateSDF();
195 public:
void BuildingChanged();
198 private:
void CreateTheEntity();
201 private:
bool Init();
205 private: std::string CreateModel();
208 private:
void GenerateSDFWithCSG();
212 private: std::string TemplateSDFString()
const;
216 private:
static bool PointCompareY(
const QPointF &_a,
const QPointF &_b);
220 private:
static bool RectCompareX(
const QRectF &_a,
const QRectF &_b);
224 private:
static bool RectCompareY(
const QRectF &_a,
const QRectF &_b);
232 private:
void SubdivideRectSurface(
const QRectF &_surface,
233 const std::vector<QRectF> &_holes, std::vector<QRectF> &_subdivisions);
236 private:
void SaveModelFiles();
240 private:
bool OnSave();
244 private:
bool OnSaveAs();
248 private:
void OnNameChanged(
const std::string &_modelName);
251 private:
void OnNew();
254 private:
void OnExit();
259 private:
void OnChangeLevel(
int _level);
262 private:
void StopMaterialModes();
266 private:
void ResetHoverVis();
271 private:
void OnColorSelected(QColor _color);
276 private:
void OnTextureSelected(QString _texture);
303 private: std::unique_ptr<BuildingMakerPrivate> dataPtr;
Generic description of a mouse event.
Definition: MouseEvent.hh:35
Base class of an item in the editor.
Definition: EditorItem.hh:40
#define GZ_GUI_VISIBLE
Definition: system.hh:284
Generic description of a keyboard event.
Definition: KeyEvent.hh:32
GAZEBO_VISIBLE msgs::Vector3d Convert(const ignition::math::Vector3d &_v)
Convert a ignition::math::Vector3 to a msgs::Vector3d.
Create and manage 3D visuals of a building.
Definition: BuildingMaker.hh:48
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
static const double conversionScale
Conversion scale used by the Convert helper functions.
Definition: BuildingMaker.hh:299
Manipulate a 3D visual associated to a 2D editor item.
Definition: BuildingModelManip.hh:47