forwards.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef RVIZ_SELECTION_FORWARDS_H
31 #define RVIZ_SELECTION_FORWARDS_H
32 
33 #include <vector>
34 #include <set>
35 #include <map>
36 #include <boost/unordered_map.hpp>
37 #include <OgrePixelFormat.h>
38 #include <OgreColourValue.h>
39 
40 #include <ros/console.h>
41 
42 
43 namespace rviz
44 {
45 
46 typedef uint32_t CollObjectHandle;
47 typedef std::vector<CollObjectHandle> V_CollObject;
48 typedef std::vector<V_CollObject> VV_CollObject;
49 typedef std::set<CollObjectHandle> S_CollObject;
50 
51 typedef std::set<uint64_t> S_uint64;
52 typedef std::vector<uint64_t> V_uint64;
53 
54 struct Picked
55 {
56  Picked(CollObjectHandle _handle = 0 )
57  : handle(_handle), pixel_count(1)
58  {
59  }
60 
61  CollObjectHandle handle;
63  S_uint64 extra_handles;
64 };
65 typedef boost::unordered_map<CollObjectHandle, Picked> M_Picked;
66 
67 
68 inline uint32_t colorToHandle(Ogre::PixelFormat fmt, uint32_t col)
69 {
70  uint32_t handle = 0;
71  if (fmt == Ogre::PF_A8R8G8B8 || fmt == Ogre::PF_X8R8G8B8)
72  {
73  handle = col & 0x00ffffff;
74  }
75  else if (fmt == Ogre::PF_R8G8B8A8)
76  {
77  handle = col >> 8;
78  }
79  else
80  {
81  ROS_DEBUG("Incompatible pixel format [%d]", fmt);
82  }
83 
84  return handle;
85 }
86 
87 inline CollObjectHandle colorToHandle( const Ogre::ColourValue & color )
88 {
89  return (int(color.r * 255) << 16) | (int(color.g * 255) << 8) | int(color.b * 255);
90 }
91 
92 
93 
94 }
95 
96 #endif
std::vector< uint64_t > V_uint64
Definition: forwards.h:52
boost::unordered_map< CollObjectHandle, Picked > M_Picked
Definition: forwards.h:65
S_uint64 extra_handles
Definition: forwards.h:63
CollObjectHandle handle
Definition: forwards.h:61
int pixel_count
Definition: forwards.h:62
std::vector< V_CollObject > VV_CollObject
Definition: forwards.h:48
std::vector< CollObjectHandle > V_CollObject
Definition: forwards.h:47
uint32_t colorToHandle(Ogre::PixelFormat fmt, uint32_t col)
Definition: forwards.h:68
std::set< uint64_t > S_uint64
Definition: forwards.h:51
std::set< CollObjectHandle > S_CollObject
Definition: forwards.h:49
Picked(CollObjectHandle _handle=0)
Definition: forwards.h:56
#define ROS_DEBUG(...)
uint32_t CollObjectHandle
Definition: forwards.h:46


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Sat Apr 27 2019 02:33:41