Commits

Ian Chen  committed 398c76a

More updates

  • Participants
  • Parent commits 4eb48bf
  • Branches ian-building

Comments (0)

Files changed (13)

File gazebo/common/MeshManager.cc

 #ifdef HAVE_GTS
 //////////////////////////////////////////////////
 void MeshManager::CreateBoolean(const std::string &_name, const Mesh *_m1,
-    const Mesh *_m2, int _operation, math::Pose _offset)
+    const Mesh *_m2, int _operation, const math::Pose &_offset)
 {
   if (this->HasMesh(_name))
     return;

File gazebo/common/MeshManager.hh

       /// \param[in] _offset _m2's pose offset from _m1
       public: void CreateBoolean(const std::string &_name, const Mesh *_m1,
           const Mesh *_m2, const int _operation,
-          math::Pose _offset = math::Pose::Zero);
+          const math::Pose &_offset = math::Pose::Zero);
 #endif
 
       /// \brief 3D mesh loader for COLLADA files

File gazebo/gui/model_editor/BuildingEditorWidget.cc

   QBrush brush(c, Qt::SolidPattern);
   this->scene->setBackgroundBrush(brush);
 
-  this->minimumWidth = 1240;
-  this->minimumHeight = 1024;
+  this->minimumWidth = 1240*2;
+  this->minimumHeight = 1024*2;
   this->scene->setSceneRect(-minimumWidth/2, -minimumHeight/2,
       minimumWidth, minimumHeight);
   QHBoxLayout *canvasLayout = new QHBoxLayout(this);

File gazebo/gui/model_editor/BuildingMaker.cc

 #endif
 
 #include "gazebo/gazebo_config.h"
-#include "gazebo/gui/model_editor/FinishModelDialog.hh"
+#include "gazebo/gui/model_editor/FinishBuildingDialog.hh"
 #include "gazebo/gui/model_editor/EditorEvents.hh"
 #include "gazebo/gui/model_editor/BuildingModelManip.hh"
 #include "gazebo/gui/model_editor/EditorItem.hh"
 
   this->buildingDefaultName = "BuildingDefaultName";
 
-  this->saveDialog = new FinishModelDialog(FinishModelDialog::MODEL_SAVE, 0);
+  this->saveDialog =
+      new FinishBuildingDialog(FinishBuildingDialog::MODEL_SAVE, 0);
   this->finishDialog =
-      new FinishModelDialog(FinishModelDialog::MODEL_FINISH, 0);
+      new FinishBuildingDialog(FinishBuildingDialog::MODEL_FINISH, 0);
 
   this->Reset();
 }
           rendering::VisualPtr wallVis = visual;
           math::Pose wallPose = wallVis->GetParent()->GetWorldPose();
           math::Vector3 wallSize = wallVis->GetScale();
-          for (unsigned int i = 0; i < buildingModelManip->GetAttachedManipCount();
-              ++i)
+          for (unsigned int i = 0; i <
+              buildingModelManip->GetAttachedManipCount(); ++i)
           {
-            BuildingModelManip *attachedObj = buildingModelManip->GetAttachedManip(i);
+            BuildingModelManip *attachedObj =
+                buildingModelManip->GetAttachedManip(i);
             std::string objName = attachedObj->GetName();
             if (objName.find("Window") != std::string::npos
                 || objName.find("Door") != std::string::npos)
             collisionNameStream.str("");
             visualElem = templateVisualElem->Clone();
             collisionElem = templateCollisionElem->Clone();
-            visualNameStream << buildingModelManip->GetName() << "_Visual_" << i;
+            visualNameStream << buildingModelManip->GetName() << "_Visual_"
+                << i;
             visualElem->GetAttribute("name")->Set(visualNameStream.str());
-            collisionNameStream << buildingModelManip->GetName() << "_Collision_" << i;
+            collisionNameStream << buildingModelManip->GetName()
+                << "_Collision_" << i;
             collisionElem->GetAttribute("name")->Set(collisionNameStream.str());
 
             math::Vector3 newSubPos =
 /////////////////////////////////////////////////
 void BuildingMaker::OnDone()
 {
-
   this->finishDialog->SetModelName(this->modelName);
   this->finishDialog->SetSaveLocation(this->saveLocation);
   if (this->finishDialog->exec() == QDialog::Accepted)

File gazebo/gui/model_editor/BuildingMaker.hh

     class EntityMaker;
     class EditorItem;
     class BuildingModelManip;
-    class FinishModelDialog;
+    class FinishBuildingDialog;
 
     /// \addtogroup gazebo_gui
     /// \{
       private: std::string buildingDefaultName;
 
       /// \brief A dialog for setting building model name and save location.
-      private: FinishModelDialog *saveDialog;
+      private: FinishBuildingDialog *saveDialog;
 
       /// \brief A dialog that prompts to confirm model completion and uploading
       /// to the server
-      private: FinishModelDialog *finishDialog;
+      private: FinishBuildingDialog *finishDialog;
     };
     /// \}
   }

File gazebo/gui/model_editor/BuildingModelManip.cc

 }
 
 /////////////////////////////////////////////////
-void BuildingModelManip::OnSizeChanged(double _width, double _depth, double _height)
+void BuildingModelManip::OnSizeChanged(double _width, double _depth,
+    double _height)
 {
   this->size = BuildingMaker::ConvertSize(_width, _depth, _height);
   double dScaleZ = this->visual->GetScale().z - this->size.z;
 }
 
 /////////////////////////////////////////////////
-BuildingModelManip *BuildingModelManip::GetAttachedManip(unsigned int _index) const
+BuildingModelManip *BuildingModelManip::GetAttachedManip(
+    unsigned int _index) const
 {
   if (_index >= this->attachedManips.size())
     gzthrow("Index too large");
 }
 
 /////////////////////////////////////////////////
-void BuildingModelManip::OnPoseOriginTransformed(double _x, double _y, double _z,
-    double _roll, double _pitch, double _yaw)
+void BuildingModelManip::OnPoseOriginTransformed(double _x, double _y,
+    double _z, double _roll, double _pitch, double _yaw)
 {
   // Handle translations, currently used by polylines
   math::Pose trans = BuildingMaker::ConvertPose(_x, -_y, _z, _roll, _pitch,
 }
 
 /////////////////////////////////////////////////
-void BuildingModelManip::OnRotationChanged(double _roll, double _pitch, double _yaw)
+void BuildingModelManip::OnRotationChanged(double _roll, double _pitch,
+    double _yaw)
 {
   this->SetRotation(_roll, _pitch, _yaw);
 }

File gazebo/gui/model_editor/BuildingModelManip.hh

  * limitations under the License.
  *
 */
-#ifndef _MODEL_MANIP_HH_
-#define _MODEL_MANIP_HH_
+#ifndef _BUILDING_MODEL_MANIP_HH_
+#define _BUILDING_MODEL_MANIP_HH_
 
 #include <string>
 #include <vector>

File gazebo/gui/model_editor/CMakeLists.txt

   EditorEvents.cc
   EditorItem.cc
   EditorView.cc
-  FinishModelDialog.cc
+  FinishBuildingDialog.cc
   FloorItem.cc
   GrabberHandle.cc
   GridLines.cc
   DoorItem.hh
   EditorItem.hh
   EditorView.hh
-  FinishModelDialog.hh
+  FinishBuildingDialog.hh
   FloorItem.hh
   LevelInspectorDialog.hh
   LevelWidget.hh

File gazebo/gui/model_editor/EditorEvents.hh

         /// \param[in] _subscriber the subscriber to this event
         /// \return a connection
         public: template<typename T>
-            static event::ConnectionPtr ConnectDiscardBuildingModel(T _subscriber)
+            static event::ConnectionPtr
+                ConnectDiscardBuildingModel(T _subscriber)
           { return discardBuildingModel.Connect(_subscriber); }
 
         /// \brief Disconnect a boost::slot to the discard model signal

File gazebo/gui/model_editor/FinishBuildingDialog.cc

+/*
+ * Copyright 2012 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+#include "gazebo/gui/model_editor/FinishBuildingDialog.hh"
+
+using namespace gazebo;
+using namespace gui;
+
+/////////////////////////////////////////////////
+FinishBuildingDialog::FinishBuildingDialog(int _mode, QWidget *_parent)
+  : QDialog(_parent)
+{
+  this->setObjectName("finishBuildingDialog");
+
+  if (_mode == MODEL_FINISH)
+    this->setWindowTitle(tr("Finish Model"));
+  else if (_mode == MODEL_FINISH)
+    this->setWindowTitle(tr("Save Model"));
+
+  QLabel *messageLabel = new QLabel;
+  if (_mode == MODEL_FINISH)
+  {
+    messageLabel->setText(
+        tr("Before we finalize your model, please make sure that\n"
+        "the following information is correct:\n"));
+  }
+  else if (_mode == MODEL_SAVE)
+  {
+    messageLabel->setText(
+        tr("Please give your model a name:\n"));
+  }
+
+  QLabel *modelLabel = new QLabel;
+  modelLabel->setText(tr("Name"));
+  this->modelNameLineEdit = new QLineEdit;
+  this->modelNameLineEdit->setText(tr("BuildingDefaultName"));
+  QLabel *modelLocation = new QLabel;
+  modelLocation->setText(tr("Location"));
+  this->modelLocationLineEdit = new QLineEdit;
+  this->modelLocationLineEdit->setText(QDir::homePath());
+  QPushButton *browseButton = new QPushButton(tr("Browse"));
+  connect(browseButton, SIGNAL(clicked()), this, SLOT(OnBrowse()));
+
+/*  QString contributeText(
+      tr("Contribute this model to the Model Database so that\n"
+         "the entire Gazebo community can benefit!\n"
+         "[This will open up a new tab in your browser]\n"));
+  QCheckBox *contributeCheckBox = new QCheckBox(contributeText);*/
+
+  QHBoxLayout *buttonsLayout = new QHBoxLayout;
+  QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
+  connect(cancelButton, SIGNAL(clicked()), this, SLOT(OnCancel()));
+
+  std::string finishButtonText = "&Done";
+  if (_mode == MODEL_SAVE)
+      finishButtonText = "&Save";
+
+  QPushButton *finishButton = new QPushButton(tr(finishButtonText.c_str()));
+  finishButton->setDefault(true);
+  connect(finishButton, SIGNAL(clicked()), this, SLOT(OnFinish()));
+  buttonsLayout->addWidget(cancelButton);
+  buttonsLayout->addWidget(finishButton);
+  buttonsLayout->setAlignment(Qt::AlignRight);
+
+  QGridLayout *gridLayout = new QGridLayout;
+  gridLayout->addWidget(modelLabel, 0, 0);
+  gridLayout->addWidget(modelNameLineEdit, 0, 1);
+  gridLayout->addWidget(modelLocation, 1, 0);
+  gridLayout->addWidget(this->modelLocationLineEdit, 1, 1);
+  gridLayout->addWidget(browseButton, 1, 2);
+
+  QVBoxLayout *mainLayout = new QVBoxLayout;
+  mainLayout->addWidget(messageLabel);
+  mainLayout->addLayout(gridLayout);
+//  if (_mode == MODEL_FINISH)
+//    mainLayout->addWidget(contributeCheckBox);
+  mainLayout->addLayout(buttonsLayout);
+
+  this->setLayout(mainLayout);
+}
+
+/////////////////////////////////////////////////
+FinishBuildingDialog::~FinishBuildingDialog()
+{
+}
+
+/////////////////////////////////////////////////
+std::string FinishBuildingDialog::GetModelName() const
+{
+  return this->modelNameLineEdit->text().toStdString();
+}
+
+/////////////////////////////////////////////////
+std::string FinishBuildingDialog::GetSaveLocation() const
+{
+  return this->modelLocationLineEdit->text().toStdString();
+}
+
+/////////////////////////////////////////////////
+void FinishBuildingDialog::SetModelName(const std::string &_name)
+{
+  this->modelNameLineEdit->setText(tr(_name.c_str()));
+}
+
+/////////////////////////////////////////////////
+void FinishBuildingDialog::SetSaveLocation(const std::string &_location)
+{
+  this->modelLocationLineEdit->setText(tr(_location.c_str()));
+}
+
+/////////////////////////////////////////////////
+void FinishBuildingDialog::OnBrowse()
+{
+  QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
+    QDir::homePath(), QFileDialog::ShowDirsOnly
+    | QFileDialog::DontResolveSymlinks);
+  if (!dir.isEmpty())
+    this->modelLocationLineEdit->setText(dir);
+}
+
+/////////////////////////////////////////////////
+void FinishBuildingDialog::OnCancel()
+{
+  this->close();
+}
+
+/////////////////////////////////////////////////
+void FinishBuildingDialog::OnFinish()
+{
+  this->accept();
+}

File gazebo/gui/model_editor/FinishBuildingDialog.hh

+/*
+ * Copyright 2012 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+#ifndef _FINISH_BUILDING_DIALOG_HH_
+#define _FINISH_BUILDING_DIALOG_HH_
+
+#include <string>
+#include "gazebo/gui/qt.h"
+
+namespace gazebo
+{
+  namespace gui
+  {
+    /// \addtogroup gazebo_gui
+    /// \{
+
+    /// \class FinishBuildingDialog FinishBuildingDialog.hh
+    /// \brief Dialog for saving the building model.
+    class FinishBuildingDialog : public QDialog
+    {
+      Q_OBJECT
+
+      /// \enum FinishMode
+      /// \brief Unique identifiers for all dialog modes.
+      public: enum FinishMode {
+                /// \brief Finish mode
+                MODEL_FINISH,
+                /// \brief Save mode
+                MODEL_SAVE
+              };
+
+      /// \brief Constructor
+      /// \param[in] _mode Mode of the dialog
+      /// \param[in] _parent Parent QWidget.
+      public: FinishBuildingDialog(int _mode = 0, QWidget *_parent = 0);
+
+      /// \brief Destructor
+      public: ~FinishBuildingDialog();
+
+      /// \brief Get the building model name.
+      /// \return The model name.
+      public: std::string GetModelName() const;
+
+      /// \brief Get the save location.
+      /// \return Path of the save location.
+      public: std::string GetSaveLocation() const;
+
+      /// \brief Set the building model name.
+      /// \param[in] _name Name to set the model to.
+      public: void SetModelName(const std::string &_name);
+
+      /// \brief Set the save location.
+      /// \param[in] _location Location to save to.
+      public: void SetSaveLocation(const std::string &_location);
+
+      /// \brief Qt callback when the file directory browse button is pressed.
+      private slots: void OnBrowse();
+
+      /// \brief Qt callback when the Cancel button is pressed.
+      private slots: void OnCancel();
+
+      /// \brief Qt callback when the Done button is pressed.
+      private slots: void OnFinish();
+
+      /// \brief Editable line that holds the model name.
+      private: QLineEdit* modelNameLineEdit;
+
+      /// \brief Editable line that holds the model's save location.
+      private: QLineEdit* modelLocationLineEdit;
+    };
+    /// \}
+  }
+}
+
+#endif

File gazebo/gui/model_editor/FinishModelDialog.cc

-/*
- * Copyright 2012 Open Source Robotics Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
-*/
-
-#include "gazebo/gui/model_editor/FinishModelDialog.hh"
-
-using namespace gazebo;
-using namespace gui;
-
-/////////////////////////////////////////////////
-FinishModelDialog::FinishModelDialog(int _mode, QWidget *_parent)
-  : QDialog(_parent)
-{
-  this->setObjectName("finishModelDialog");
-
-  if (_mode == MODEL_FINISH)
-    this->setWindowTitle(tr("Finish Model"));
-  else if (_mode == MODEL_FINISH)
-    this->setWindowTitle(tr("Save Model"));
-
-  QLabel *messageLabel = new QLabel;
-  if (_mode == MODEL_FINISH)
-  {
-    messageLabel->setText(
-        tr("Before we finalize your model, please make sure that\n"
-        "the following information is correct:\n"));
-  }
-  else if (_mode == MODEL_SAVE)
-  {
-    messageLabel->setText(
-        tr("Please give your model a name:\n"));
-  }
-
-  QLabel *modelLabel = new QLabel;
-  modelLabel->setText(tr("Name"));
-  this->modelNameLineEdit = new QLineEdit;
-  this->modelNameLineEdit->setText(tr("BuildingDefaultName"));
-  QLabel *modelLocation = new QLabel;
-  modelLocation->setText(tr("Location"));
-  this->modelLocationLineEdit = new QLineEdit;
-  this->modelLocationLineEdit->setText(QDir::homePath());
-  QPushButton *browseButton = new QPushButton(tr("Browse"));
-  connect(browseButton, SIGNAL(clicked()), this, SLOT(OnBrowse()));
-
-/*  QString contributeText(
-      tr("Contribute this model to the Model Database so that\n"
-         "the entire Gazebo community can benefit!\n"
-         "[This will open up a new tab in your browser]\n"));
-  QCheckBox *contributeCheckBox = new QCheckBox(contributeText);*/
-
-  QHBoxLayout *buttonsLayout = new QHBoxLayout;
-  QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
-  connect(cancelButton, SIGNAL(clicked()), this, SLOT(OnCancel()));
-
-  std::string finishButtonText = "&Done";
-  if (_mode == MODEL_SAVE)
-      finishButtonText = "&Save";
-
-  QPushButton *finishButton = new QPushButton(tr(finishButtonText.c_str()));
-  finishButton->setDefault(true);
-  connect(finishButton, SIGNAL(clicked()), this, SLOT(OnFinish()));
-  buttonsLayout->addWidget(cancelButton);
-  buttonsLayout->addWidget(finishButton);
-  buttonsLayout->setAlignment(Qt::AlignRight);
-
-  QGridLayout *gridLayout = new QGridLayout;
-  gridLayout->addWidget(modelLabel, 0, 0);
-  gridLayout->addWidget(modelNameLineEdit, 0, 1);
-  gridLayout->addWidget(modelLocation, 1, 0);
-  gridLayout->addWidget(this->modelLocationLineEdit, 1, 1);
-  gridLayout->addWidget(browseButton, 1, 2);
-
-  QVBoxLayout *mainLayout = new QVBoxLayout;
-  mainLayout->addWidget(messageLabel);
-  mainLayout->addLayout(gridLayout);
-//  if (_mode == MODEL_FINISH)
-//    mainLayout->addWidget(contributeCheckBox);
-  mainLayout->addLayout(buttonsLayout);
-
-  this->setLayout(mainLayout);
-}
-
-/////////////////////////////////////////////////
-FinishModelDialog::~FinishModelDialog()
-{
-}
-
-/////////////////////////////////////////////////
-std::string FinishModelDialog::GetModelName() const
-{
-  return this->modelNameLineEdit->text().toStdString();
-}
-
-/////////////////////////////////////////////////
-std::string FinishModelDialog::GetSaveLocation() const
-{
-  return this->modelLocationLineEdit->text().toStdString();
-}
-
-/////////////////////////////////////////////////
-void FinishModelDialog::SetModelName(const std::string &_name)
-{
-  this->modelNameLineEdit->setText(tr(_name.c_str()));
-}
-
-/////////////////////////////////////////////////
-void FinishModelDialog::SetSaveLocation(const std::string &_location)
-{
-  this->modelLocationLineEdit->setText(tr(_location.c_str()));
-}
-
-/////////////////////////////////////////////////
-void FinishModelDialog::OnBrowse()
-{
-  QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
-    QDir::homePath(), QFileDialog::ShowDirsOnly
-    | QFileDialog::DontResolveSymlinks);
-  if (!dir.isEmpty())
-    this->modelLocationLineEdit->setText(dir);
-}
-
-/////////////////////////////////////////////////
-void FinishModelDialog::OnCancel()
-{
-  this->close();
-}
-
-/////////////////////////////////////////////////
-void FinishModelDialog::OnFinish()
-{
-  this->accept();
-}

File gazebo/gui/model_editor/FinishModelDialog.hh

-/*
- * Copyright 2012 Open Source Robotics Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
-*/
-
-#ifndef _FINISH_MODEL_DIALOG_HH_
-#define _FINISH_MODEL_DIALOG_HH_
-
-#include <string>
-#include "gazebo/gui/qt.h"
-
-namespace gazebo
-{
-  namespace gui
-  {
-    /// \addtogroup gazebo_gui
-    /// \{
-
-    /// \class FinishModelDialog FinishModelDialog.hh
-    /// \brief Dialog for saving the building model.
-    class FinishModelDialog : public QDialog
-    {
-      Q_OBJECT
-
-      /// \enum FinishMode
-      /// \brief Unique identifiers for all dialog modes.
-      public: enum FinishMode {
-                /// \brief Finish mode
-                MODEL_FINISH,
-                /// \brief Save mode
-                MODEL_SAVE
-              };
-
-      /// \brief Constructor
-      /// \param[in] _mode Mode of the dialog
-      /// \param[in] _parent Parent QWidget.
-      public: FinishModelDialog(int _mode = 0, QWidget *_parent = 0);
-
-      /// \brief Destructor
-      public: ~FinishModelDialog();
-
-      /// \brief Get the model name.
-      /// \return The model name.
-      public: std::string GetModelName() const;
-
-      /// \brief Get the save location.
-      /// \return Path of the save location.
-      public: std::string GetSaveLocation() const;
-
-      /// \brief Set the model name.
-      /// \param[in] _name Name to set the model to.
-      public: void SetModelName(const std::string &_name);
-
-      /// \brief Set the save location.
-      /// \param[in] _location Location to save to.
-      public: void SetSaveLocation(const std::string &_location);
-
-      /// \brief Qt callback when the file directory browse button is pressed.
-      private slots: void OnBrowse();
-
-      /// \brief Qt callback when the Cancel button is pressed.
-      private slots: void OnCancel();
-
-      /// \brief Qt callback when the Done button is pressed.
-      private slots: void OnFinish();
-
-      /// \brief Editable line that holds the model name.
-      private: QLineEdit* modelNameLineEdit;
-
-      /// \brief Editable line that holds the model's save location.
-      private: QLineEdit* modelLocationLineEdit;
-    };
-    /// \}
-  }
-}
-
-#endif