Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gazebo gui events #148

Merged
merged 3 commits into from
Dec 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 152 additions & 0 deletions include/ignition/gui/GuiEvents.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,158 @@ namespace ignition
/// \brief Unique type for this event.
static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser);
};

/// \brief The class for sending and receiving custom snap value events.
class SnapIntervals : public QEvent
{
/// \brief Constructor
/// \param[in] _xyz XYZ snapping values.
/// \param[in] _rpy RPY snapping values.
/// \param[in] _scale Scale snapping values.
public: SnapIntervals(
const math::Vector3d &_xyz,
const math::Vector3d &_rpy,
const math::Vector3d &_scale)
: QEvent(kType), xyz(_xyz), rpy(_rpy), scale(_scale)
{
}

/// \brief Get the XYZ snapping values.
/// \return The XYZ snapping values.
public: math::Vector3d XYZ() const
{
return this->xyz;
}

/// \brief Get the RPY snapping values.
/// \return The RPY snapping values.
public: math::Vector3d RPY() const
{
return this->rpy;
}

/// \brief Get the scale snapping values.
/// \return The scale snapping values.
public: math::Vector3d Scale() const
{
return this->scale;
}

/// \brief The QEvent representing a snap event occurrence.
static const QEvent::Type kType = QEvent::Type(QEvent::User);

/// \brief XYZ snapping values in meters, these values must be positive.
private: math::Vector3d xyz;

/// \brief RPY snapping values in degrees, these values must be positive.
private: math::Vector3d rpy;

/// \brief Scale snapping values - a multiplier of the current size,
/// these values must be positive.
private: math::Vector3d scale;
};

/// \brief Event called to spawn a preview model.
/// Used by plugins that spawn models.
class SpawnPreviewModel : public QEvent
{
/// \brief Constructor
/// \param[in] _modelSdfString The model's SDF file as a string.
public: explicit SpawnPreviewModel(std::string &_modelSdfString)
: QEvent(kType), modelSdfString(_modelSdfString)
{
}

/// \brief Unique type for this event.
static const QEvent::Type kType = QEvent::Type(QEvent::User + 4);

/// \brief Get the sdf string of the model.
/// \return The model sdf string
public: std::string ModelSdfString() const
{
return this->modelSdfString;
}

/// \brief The sdf string of the model to be previewed.
std::string modelSdfString;
};

/// \brief Event called to spawn a preview resource, which takes the path
/// to the SDF file. Used by plugins that spawn resources.
class SpawnPreviewPath : public QEvent
{
/// \brief Constructor
/// \param[in] _filePath The path to an SDF file.
public: explicit SpawnPreviewPath(const std::string &_filePath)
: QEvent(kType), filePath(_filePath)
{
}

/// \brief Unique type for this event.
static const QEvent::Type kType = QEvent::Type(QEvent::User + 5);

/// \brief Get the path of the SDF file.
/// \return The file path.
public: std::string FilePath() const
{
return this->filePath;
}

/// \brief The path of SDF file to be previewed.
std::string filePath;
};

/// \brief Event which is called to broadcast the 3D coordinates of a user's
/// mouse hover within the scene.
class HoverToScene : public QEvent
{
/// \brief Constructor
/// \param[in] _point The point at which the mouse is hovering within the
/// scene
public: explicit HoverToScene(const math::Vector3d &_point)
: QEvent(kType), point(_point)
{
}

/// \brief Unique type for this event.
static const QEvent::Type kType = QEvent::Type(QEvent::User + 6);

/// \brief Get the point within the scene over which the user is hovering.
/// \return The 3D point
public: math::Vector3d Point() const
{
return this->point;
}

/// \brief The 3D point over which the user is hovering.
private: math::Vector3d point;
};

/// \brief Event which is called to broadcast the 3D coordinates of a user's
/// left click within the scene.
class LeftClickToScene : public QEvent
{
/// \brief Constructor
/// \param[in] _point The point which the user has left clicked within the
/// scene
public: explicit LeftClickToScene(const math::Vector3d &_point)
: QEvent(kType), point(_point)
{
}

/// \brief Unique type for this event.
static const QEvent::Type kType = QEvent::Type(QEvent::User + 7);

/// \brief Get the point within the scene that the user clicked.
/// \return The 3D point.
public: math::Vector3d Point() const
{
return this->point;
}

/// \brief The 3D point that the user clicked within the scene.
private: math::Vector3d point;
};
}
}
}
Expand Down