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;
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,
107 const QVector3D &_pos,
double _angle,
int _steps);
114 public: std::string
AddFloor(
const QVector3D &_size,
115 const QVector3D &_pos,
double _angle);
137 const std::string &_parent);
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);
202 private:
void CreateTheEntity();
205 private:
bool Init();
209 private: std::string CreateModel();
212 private:
void GenerateSDFWithCSG();
216 private: std::string TemplateSDFString()
const;
220 private:
static bool PointCompareY(
const QPointF &_a,
const QPointF &_b);
224 private:
static bool RectCompareX(
const QRectF &_a,
const QRectF &_b);
228 private:
static bool RectCompareY(
const QRectF &_a,
const QRectF &_b);
236 private:
void SubdivideRectSurface(
const QRectF &_surface,
237 const std::vector<QRectF> &_holes, std::vector<QRectF> &_subdivisions);
240 private:
void SaveModelFiles();
244 private:
bool OnSave();
248 private:
bool OnSaveAs();
252 private:
void OnNameChanged(
const std::string &_modelName);
255 private:
void OnNew();
258 private:
void OnExit();
263 private:
void OnChangeLevel(
int _level);
266 private:
void StopMaterialModes();
270 private:
void ResetHoverVis();
275 private:
void OnColorSelected(QColor _color);
280 private:
void OnTextureSelected(QString _texture);
307 private: std::unique_ptr<BuildingMakerPrivate> dataPtr;
gui
Definition KeyEventHandler.hh:29
Generic description of a keyboard event.
Definition KeyEvent.hh:33
Generic description of a mouse event.
Definition MouseEvent.hh:36
Create and manage 3D visuals of a building.
Definition BuildingMaker.hh:49
void ConnectItem(const std::string &_partName, const EditorItem *_item)
Connect the 2D editor item Qt signals to the 3D building part.
std::string AddFloor(const QVector3D &_size, const QVector3D &_pos, double _angle)
Add a floor to the model.
~BuildingMaker()
Destructor.
void Reset()
Reset the building maker and the SDF.
std::string AddWindow(const QVector3D &_size, const QVector3D &_pos, double _angle)
Add a window to the model.
void FinishModel()
Finish the model and create the entity on the gzserver.
BuildingModelManip * ManipByName(const std::string &_name)
Detach all child building parts from the given manip.
void RemoveWall(const std::string &_wallName)
Remove a wall from the model.
std::string AddStairs(const QVector3D &_size, const QVector3D &_pos, double _angle, int _steps)
Add a staircase to the model.
bool IsAttached(const std::string &_child) const
Whether the given manip is attached to another manip or not.
std::string AddPart(const std::string &_type, const QVector3D &_size, const QVector3D &_pos, double _angle)
Add a building part to the model.
static ignition::math::Pose3d ConvertPose(const double _x, const double _y, const double _z, const double _roll, const double _pitch, const double _yaw)
Helper method to convert pose from editor coordinate system to Gazebo coordinate system.
static double ConvertAngle(double _angle)
Convert an angle from editor unit to Gazebo unit.
static ignition::math::Vector3d ConvertSize(const double _width, const double _depth, const double _height)
Helper method to convert size from editor coordinate system to Gazebo coordinate system.
std::string AddDoor(const QVector3D &_size, const QVector3D &_pos, double _angle)
Add a door to the model.
void SetModelName(const std::string &_modelName)
Set the name of this building model.
static const double conversionScale
Conversion scale used by the Convert helper functions.
Definition BuildingMaker.hh:303
void RemovePart(const std::string &_partName)
Remove a building part from the model.
std::string ModelSDF() const
Get the last generated SDF as string.
void OnEdit(bool _checked)
QT callback when entering or leaving building edit mode.
void GenerateSDF()
Generate the SDF from building part visuals.
static double Convert(double _value)
void BuildingChanged()
Set save state upon a change to the building.
void AttachManip(const std::string &_child, const std::string &_parent)
Attach a building part to another, this is currently used for making holes in walls and floors.
void DetachFromParent(const std::string &_child)
Detach a child building part from its parent.
BuildingMaker()
Constructor.
std::string AddWall(const QVector3D &_size, const QVector3D &_pos, double _angle)
Add a wall to the model.
void DetachAllChildren(const std::string &_parent)
Detach all child building parts from the given manip.
Manipulate a 3D visual associated to a 2D editor item.
Definition BuildingModelManip.hh:44
Base class of an item in the editor.
Definition EditorItem.hh:43
Forward declarations for the common classes.
Definition Animation.hh:27