Program Listing for File point_cloud_transformer.hpp

Return to documentation for file (/tmp/ws/src/rviz/rviz_default_plugins/include/rviz_default_plugins/displays/pointcloud/point_cloud_transformer.hpp)

/*
 * Copyright (c) 2010, Willow Garage, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the Willow Garage, Inc. nor the names of its
 *       contributors may be used to endorse or promote products derived from
 *       this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef RVIZ_DEFAULT_PLUGINS__DISPLAYS__POINTCLOUD__POINT_CLOUD_TRANSFORMER_HPP_
#define RVIZ_DEFAULT_PLUGINS__DISPLAYS__POINTCLOUD__POINT_CLOUD_TRANSFORMER_HPP_

#include <vector>

#include <QObject>  // NOLINT

#ifndef Q_MOC_RUN
#include <OgreVector3.h>
#include <OgreColourValue.h>

#include "sensor_msgs/msg/point_cloud2.hpp"

#include "rviz_rendering/objects/point_cloud.hpp"

#include "rviz_default_plugins/visibility_control.hpp"
#endif

namespace Ogre
{
class Matrix4;
}

namespace rviz_common
{
namespace properties
{

class Property;

}  // namespace properties
}  // namespace rviz_common

namespace rviz_default_plugins
{

typedef std::vector<rviz_rendering::PointCloud::Point> V_PointCloudPoint;

class RVIZ_DEFAULT_PLUGINS_PUBLIC PointCloudTransformer : public QObject
{
  Q_OBJECT

public:
  virtual void init() {}

  enum SupportLevel
  {
    Support_None = 0,
    Support_XYZ = 1 << 1,
    Support_Color = 1 << 2,
    Support_Both = Support_XYZ | Support_Color,
  };

  virtual uint8_t supports(const sensor_msgs::msg::PointCloud2::ConstSharedPtr & cloud) = 0;
  virtual bool transform(
    const sensor_msgs::msg::PointCloud2::ConstSharedPtr & cloud,
    uint32_t mask,
    const Ogre::Matrix4 & transform,
    V_PointCloudPoint & out) = 0;

  virtual uint8_t score(const sensor_msgs::msg::PointCloud2::ConstSharedPtr & cloud)
  {
    (void) cloud;
    return 0;
  }

  virtual void createProperties(
    rviz_common::properties::Property * parent_property,
    uint32_t mask,
    QList<rviz_common::properties::Property *> & out_props)
  {
    (void) parent_property;
    (void) mask;
    (void) out_props;
  }

  virtual void hideUnusedProperties() {}

  // class_id and description are required to be used with rviz_common::PluginlibFactory
  QString getClassId() const {return class_id_;}
  QString getDescription() const {return description_;}
  void setClassId(const QString & class_id) {class_id_ = class_id;}
  void setDescription(const QString & description) {description_ = description;}

Q_SIGNALS:
  void needRetransform();

protected:
  // class_id and description are required to be used with rviz_common::PluginlibFactory
  QString class_id_;
  QString description_;
};

}  // namespace rviz_default_plugins

#endif  // RVIZ_DEFAULT_PLUGINS__DISPLAYS__POINTCLOUD__POINT_CLOUD_TRANSFORMER_HPP_