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

Migrate orthographic view controller #270

Merged
merged 13 commits into from
Jun 6, 2018
Merged
Show file tree
Hide file tree
Changes from all 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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,32 @@ class RVIZ_COMMON_PUBLIC FramePositionTrackingViewController : public ViewContro
public:
FramePositionTrackingViewController();

virtual ~FramePositionTrackingViewController();
~FramePositionTrackingViewController() override;

/// Do subclass-specific initialization.
/**
* Called by ViewController::initialize after context_, target_scene_node_,
* and camera_ are set.
* This version calls updateTargetSceneNode().
*/
virtual void onInitialize();
void onInitialize() override;

/// Called by activate().
/**
* Override to implement view-specific activation.
* This version calls updateTargetSceneNode().
*/
virtual void onActivate();
void onActivate() override;

virtual void update(float dt, float ros_dt);
void update(float dt, float ros_dt) override;

/// Configure the settings of this view controller to give a similar view as the source_view.
/**
* source_view must return a valid Ogre::Camera* from getCamera().
*
* This base class implementation does nothing.
* This implementation sets the target frame property.
*/
virtual void mimic(ViewController * source_view);
void mimic(ViewController * source_view) override;

protected Q_SLOTS:
/// Called when Target Frame property changes while view is active.
Expand Down
34 changes: 32 additions & 2 deletions rviz_common/include/rviz_common/view_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@

#include <string>

#ifndef _WIN32
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
#endif

#include <OgreVector3.h>

#ifndef _WIN32
# pragma GCC diagnostic pop
#endif

#include <QCursor> // NOLINT: cpplint is unable to handle the include order here
#include <QMap> // NOLINT: cpplint is unable to handle the include order here
#include <QString> // NOLINT: cpplint is unable to handle the include order here
Expand All @@ -48,7 +59,6 @@ namespace Ogre
{

class Camera;
class Vector3;

} // namespace Ogre

Expand All @@ -68,13 +78,31 @@ class BoolProperty;

} // namespace properties

struct FocalPointStatus
{
FocalPointStatus()
{
exists_ = false;
value_ = Ogre::Vector3(0, 0, 0);
}

FocalPointStatus(bool has_focal_point, Ogre::Vector3 focal_point)
{
exists_ = has_focal_point;
value_ = focal_point;
}

bool exists_;
Ogre::Vector3 value_;
};

class RVIZ_COMMON_PUBLIC ViewController : public properties::Property
{
Q_OBJECT

public:
ViewController();
virtual ~ViewController();
~ViewController() override;

/// Do all setup that can't be done in the constructor.
/**
Expand Down Expand Up @@ -190,6 +218,8 @@ class RVIZ_COMMON_PUBLIC ViewController : public properties::Property
/// Return a mouse cursor representing the current state.
virtual QCursor getCursor();

virtual FocalPointStatus getFocalPointStatus();

Q_SIGNALS:
void configChanged();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2012, Willow Garage, Inc.
* Copyright (c) 2017, Open Source Robotics Foundation, Inc.
* Copyright (c) 2018, Bosch Software Innovations GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -54,14 +55,14 @@ namespace rviz_common
{

FramePositionTrackingViewController::FramePositionTrackingViewController()
: target_scene_node_(NULL)
: target_scene_node_(nullptr), camera_scene_node_(nullptr)
{
target_frame_property_ = new rviz_common::properties::TfFrameProperty(
"Target Frame",
rviz_common::properties::TfFrameProperty::FIXED_FRAME_STRING,
"TF frame whose motion this view will follow.",
this,
NULL,
nullptr,
true);
}

Expand Down
Loading