point_picking_event.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Point Cloud Library (PCL) - www.pointclouds.org
00005  *  Copyright (c) 2010-2011, Willow Garage, Inc.
00006  *
00007  *  All rights reserved.
00008  *
00009  *  Redistribution and use in source and binary forms, with or without
00010  *  modification, are permitted provided that the following conditions
00011  *  are met:
00012  *
00013  *   * Redistributions of source code must retain the above copyright
00014  *     notice, this list of conditions and the following disclaimer.
00015  *   * Redistributions in binary form must reproduce the above
00016  *     copyright notice, this list of conditions and the following
00017  *     disclaimer in the documentation and/or other materials provided
00018  *     with the distribution.
00019  *   * Neither the name of Willow Garage, Inc. nor the names of its
00020  *     contributors may be used to endorse or promote products derived
00021  *     from this software without specific prior written permission.
00022  *
00023  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00026  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00027  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00028  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00029  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00032  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00033  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00034  *  POSSIBILITY OF SUCH DAMAGE.
00035  *
00036  */
00037 
00038 #ifndef PCL_VISUALIZATION_POINT_PICKING_EVENT_H_
00039 #define PCL_VISUALIZATION_POINT_PICKING_EVENT_H_
00040 
00041 #include <pcl/pcl_macros.h>
00042 #include <pcl/visualization/vtk.h>
00043 
00044 namespace pcl
00045 {
00046   namespace visualization
00047   {
00048     class PCL_EXPORTS PointPickingCallback : public vtkCommand
00049     {
00050       public:
00051         static PointPickingCallback *New () 
00052         { 
00053           return (new PointPickingCallback); 
00054         }
00055 
00056         PointPickingCallback () : x_ (0), y_ (0), z_ (0), idx_ (-1), pick_first_ (false) {}
00057 
00058         virtual void
00059         Execute (vtkObject *caller, unsigned long eventid, void*);
00060 
00061         int
00062         performSinglePick (vtkRenderWindowInteractor *iren);
00063 
00064         int
00065         performSinglePick (vtkRenderWindowInteractor *iren, float &x, float &y, float &z);
00066 
00067       private:
00068         float x_, y_, z_;
00069         int idx_;
00070         bool pick_first_;
00071      };
00072 
00074     class PCL_EXPORTS PointPickingEvent
00075     {
00076       public:
00077         PointPickingEvent (int idx) : idx_ (idx), idx2_ (-1), x_ (), y_ (), z_ (), x2_ (), y2_ (), z2_ () {}
00078         PointPickingEvent (int idx, float x, float y, float z) : idx_ (idx), idx2_ (-1), x_ (x), y_ (y), z_ (z), x2_ (), y2_ (), z2_ () {}
00079 
00080         PointPickingEvent (int idx1, int idx2, float x1, float y1, float z1, float x2, float y2, float z2) :
00081           idx_ (idx1), idx2_ (idx2), x_ (x1), y_ (y1), z_ (z1), x2_ (x2), y2_ (y2), z2_ (z2) 
00082         {}
00083 
00085         inline int
00086         getPointIndex () const
00087         {
00088           return (idx_);
00089         }
00090 
00096         inline void
00097         getPoint (float &x, float &y, float &z) const
00098         {
00099           x = x_; y = y_; z = z_;
00100         }
00101 
00111         inline bool
00112         getPoints (float &x1, float &y1, float &z1, float &x2, float &y2, float &z2) const
00113         {
00114           if (idx2_ == -1)
00115             return (false);
00116           x1 = x_; y1 = y_; z1 = z_;
00117           x2 = x2_; y2 = y2_; z2 = z2_;
00118           return (true);
00119         }
00120 
00121       private:
00122         int idx_, idx2_;
00123 
00124         float x_, y_, z_;
00125         float x2_, y2_, z2_;
00126     };
00127   } //namespace visualization
00128 } //namespace pcl
00129 
00130 #endif  /* PCL_VISUALIZATION_POINT_PICKING_EVENT_H_ */
00131 


pcl
Author(s): Open Perception
autogenerated on Mon Oct 6 2014 03:17:19