2 * Software License Agreement (BSD License)
4 * Point Cloud Library (PCL) - www.pointclouds.org
5 * Copyright (c) 2012, Jeremie Papon.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials provided
18 * with the distribution.
19 * * Neither the name of Willow Garage, Inc. nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
40 #include <pcl/apps/cloud_composer/point_selectors/interactor_style_switch.h>
42 #include <vtkInteractorStyleTrackballActor.h>
46 namespace cloud_composer
49 class ClickTrackballStyleInteractor : public vtkInteractorStyleTrackballActor
52 static ClickTrackballStyleInteractor* New();
53 vtkTypeMacro(ClickTrackballStyleInteractor,vtkInteractorStyleTrackballActor);
55 ClickTrackballStyleInteractor ();
57 ~ClickTrackballStyleInteractor ();
59 /** \brief Pass a pointer to the actor map
60 * \param[in] actors the actor map that will be used with this style
63 setCloudActorMap (const pcl::visualization::CloudActorMapPtr &actors) { actors_ = actors; }
65 /** \brief Get the cloud actor map pointer. */
66 inline pcl::visualization::CloudActorMapPtr
67 getCloudActorMap () const { return (actors_); }
69 /** \brief Pass a set of renderers to the interactor style.
70 * \param[in] rens the vtkRendererCollection to use
73 setRendererCollection (vtkSmartPointer<vtkRendererCollection> &rens) { renderers_ = rens; }
75 /** \brief Function called on left mouse button release, ie, end of rectangular drag */
77 OnLeftButtonDown () override;
79 /** \brief Function called on left mouse button release, ie, end of rectangular drag */
81 OnLeftButtonUp () override;
84 OnRightButtonDown () override;
87 OnRightButtonUp () override;
89 /** \brief Event emitted once a valid selection has been made */
90 int manipulation_complete_event_;
93 setProjectModel (ProjectModel* model) { model_ = model; }
97 /** \brief Actor map stored internally. */
98 pcl::visualization::CloudActorMapPtr actors_;
100 /** \brief Collection of vtkRenderers stored internally. */
101 vtkSmartPointer<vtkRendererCollection> renderers_;
103 /** \brief Internal Pointer to Project Model */
104 ProjectModel* model_;
106 vtkSmartPointer<vtkMatrix4x4> start_matrix_;
107 vtkSmartPointer<vtkMatrix4x4> end_matrix_;
109 vtkSmartPointer<vtkTransform> transform_;