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 2 commits
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
154 changes: 154 additions & 0 deletions include/ignition/gui/GuiEvents.hh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,160 @@ 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.
/// This event is used in the Transform Control plugin tool when the
/// user manually alters their snapping values.
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::MaxUser - 1);

/// \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] _modelString The model's description as a string.
public: explicit SpawnPreviewModel(std::string &_modelString)
: QEvent(kType), modelString(_modelString)
{
}

/// \brief Unique type for this event.
static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 2);

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

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

/// \brief Event called to spawn a preview resource, which takes the path
/// to s file. Used by plugins that spawn resources.
class SpawnPreviewPath : public QEvent
{
/// \brief Constructor
/// \param[in] _filePath The path to a 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::MaxUser - 3);

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

/// \brief The path of 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::MaxUser - 4);

/// \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::MaxUser - 5);

/// \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