17 #ifndef _BUILDING_MAKER_HH_
18 #define _BUILDING_MAKER_HH_
44 class BuildingModelManip;
45 class FinishBuildingDialog;
56 private:
enum SaveState
76 public:
void OnEdit(
bool _checked);
80 public:
void SetModelName(
const std::string &_modelName);
83 public:
void FinishModel();
91 public: std::string AddPart(
const std::string &_type,
92 const QVector3D &_size,
const QVector3D &_pos,
double _angle);
99 public: std::string AddWall(
const QVector3D &_size,
const QVector3D &_pos,
107 public: std::string AddWindow(
const QVector3D &_size,
108 const QVector3D &_pos,
double _angle);
115 public: std::string AddDoor(
const QVector3D &_size,
const QVector3D &_pos,
124 public: std::string AddStairs(
const QVector3D &_size,
125 const QVector3D &_pos,
double _angle,
int _steps);
132 public: std::string AddFloor(
const QVector3D &_size,
133 const QVector3D &_pos,
double _angle);
137 public:
void RemovePart(
const std::string &_partName);
141 public:
void RemoveWall(
const std::string &_wallName);
146 public:
void ConnectItem(
const std::string &_partName,
153 public:
void AttachManip(
const std::string &_child,
154 const std::string &_parent);
159 public:
void DetachManip(
const std::string &_child,
160 const std::string &_parent);
164 public:
void DetachAllChildren(
const std::string &_manip);
170 public:
static math::Vector3 ConvertSize(
const QVector3D &_size);
178 public:
static math::Vector3 ConvertSize(
double _width,
double _depth,
186 public:
static math::Pose ConvertPose(
const QVector3D &_pos,
187 const QVector3D &_rot);
198 public:
static math::Pose ConvertPose(
double _x,
double _y,
double _z,
199 double _roll,
double _pitch,
double _yaw);
204 public:
static double Convert(
double _value);
209 public:
static double ConvertAngle(
double _angle);
213 public:
void SaveToSDF(
const std::string &_savePath);
217 public:
void SaveToConfig(
const std::string &_savePath);
220 public:
void Reset();
226 public:
virtual void Stop();
229 public:
void GenerateSDF();
232 public:
void GenerateConfig();
235 public:
virtual bool IsActive()
const;
238 public:
void BuildingChanged();
241 private:
virtual void CreateTheEntity();
244 private:
bool Init();
248 private: std::string CreateModel();
251 private:
void GenerateSDFWithCSG();
254 private: std::string GetTemplateSDFString();
257 private: std::string GetTemplateConfigString();
261 private:
static bool PointCompareY(
const QPointF &_a,
const QPointF &_b);
265 private:
static bool RectCompareX(
const QRectF &_a,
const QRectF &_b);
269 private:
static bool RectCompareY(
const QRectF &_a,
const QRectF &_b);
277 private:
void SubdivideRectSurface(
const QRectF &_surface,
278 const std::vector<QRectF> &_holes, std::vector<QRectF> &_subdivisions);
281 private:
void SaveModelFiles();
286 private:
bool OnSave(
const std::string &_saveName =
"");
291 private:
bool OnSaveAs(
const std::string &_saveName);
295 private:
void OnNameChanged(
const std::string &_modelName);
298 private:
void OnNew();
301 private:
void OnExit();
306 private:
void OnChangeLevel(
int _level);
309 private:
void StopMaterialModes();
313 private:
void ResetHoverVis();
318 private:
void OnColorSelected(QColor _color);
323 private:
void OnTextureSelected(QString _texture);
350 private: std::map<std::string, BuildingModelManip *> allItems;
353 private: sdf::SDFPtr modelSDF;
356 private: sdf::SDFPtr modelTemplateSDF;
359 private: TiXmlDocument modelConfig;
362 private: std::string modelName;
365 private:
static const std::string previewName;
371 private:
int wallCounter;
374 private:
int windowCounter;
377 private:
int doorCounter;
380 private:
int stairsCounter;
383 private:
int floorCounter;
386 private:
enum SaveState currentSaveState;
389 private: std::string defaultPath;
392 private: std::string saveLocation;
395 private: std::string authorName;
398 private: std::string authorEmail;
401 private: std::string description;
404 private: std::string version;
407 private: std::vector<event::ConnectionPtr> connections;
410 private:
static const std::string buildingDefaultName;
420 private: QColor selectedColor;
424 private: QString selectedTexture;
427 private:
int currentLevel;
Generic description of a mouse event.
Definition: MouseEvent.hh:32
Base class of an item in the editor.
Definition: EditorItem.hh:34
Encapsulates a position and rotation in three space.
Definition: Pose.hh:40
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
Generic description of a keyboard event.
Definition: KeyEvent.hh:32
GAZEBO_VISIBLE msgs::Vector3d Convert(const math::Vector3 &_v)
Convert a math::Vector3 to a msgs::Vector3d.
static double conversionScale
Conversion scale used by the Convert helper functions.
Definition: BuildingMaker.hh:346
to make an entity base class
Definition: EntityMaker.hh:41
Create and manage 3D visuals of a building.
Definition: BuildingMaker.hh:52
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
Dialog for saving the building model.
Definition: FinishBuildingDialog.hh:34
boost::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:102
boost::shared_ptr< UserCamera > UserCameraPtr
Definition: RenderTypes.hh:86
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48