~ubuntu-branches/ubuntu/wily/openwalnut/wily-proposed

« back to all changes in this revision

Viewing changes to .pc/gcc5.patch/src/core/dataHandler/WDataSetPoints.h

  • Committer: Package Import Robot
  • Author(s): Michael Terry
  • Date: 2015-08-12 13:14:55 UTC
  • Revision ID: package-import@ubuntu.com-20150812131455-cwndvoy9wwx34ya2
Tags: 1.4.0~rc1+hg3a3147463ee2-1ubuntu4
* debian/patches/gcc5.patch:
  - Work around incompatibility between boost+gcc5 and Qt4, fixing FTBFS

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//---------------------------------------------------------------------------
 
2
//
 
3
// Project: OpenWalnut ( http://www.openwalnut.org )
 
4
//
 
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
 
6
// For more information see http://www.openwalnut.org/copying
 
7
//
 
8
// This file is part of OpenWalnut.
 
9
//
 
10
// OpenWalnut is free software: you can redistribute it and/or modify
 
11
// it under the terms of the GNU Lesser General Public License as published by
 
12
// the Free Software Foundation, either version 3 of the License, or
 
13
// (at your option) any later version.
 
14
//
 
15
// OpenWalnut is distributed in the hope that it will be useful,
 
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
// GNU Lesser General Public License for more details.
 
19
//
 
20
// You should have received a copy of the GNU Lesser General Public License
 
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
 
22
//
 
23
//---------------------------------------------------------------------------
 
24
 
 
25
#ifndef WDATASETPOINTS_H
 
26
#define WDATASETPOINTS_H
 
27
 
 
28
#include <string>
 
29
#include <utility>
 
30
#include <vector>
 
31
 
 
32
#include <boost/shared_ptr.hpp>
 
33
 
 
34
#include "../common/WBoundingBox.h"
 
35
#include "WDataSet.h"
 
36
 
 
37
/**
 
38
 * Dataset to store a bunch of points without order or topology.
 
39
 */
 
40
class WDataSetPoints : public WDataSet // NOLINT
 
41
{
 
42
public:
 
43
    // some type alias for the used arrays.
 
44
    /**
 
45
     * Pointer to dataset.
 
46
     */
 
47
    typedef boost::shared_ptr< WDataSetPoints > SPtr;
 
48
 
 
49
    /**
 
50
     * Pointer to const dataset.
 
51
     */
 
52
    typedef boost::shared_ptr< const WDataSetPoints > ConstSPtr;
 
53
 
 
54
    /**
 
55
     * List of vertex coordinates in term of components of vertices.
 
56
     */
 
57
    typedef boost::shared_ptr< std::vector< float > > VertexArray;
 
58
 
 
59
    /**
 
60
     * Colors for each vertex in VertexArray.
 
61
     */
 
62
    typedef boost::shared_ptr< std::vector< float > > ColorArray;
 
63
 
 
64
    /**
 
65
     * Constructs a new set of points. If no color is specified, white is used for all points.
 
66
     *
 
67
     * \note the number of floats in vertices must be a multiple of 3
 
68
     * \note the number of floats in colors (if not NULL) must be vertices->size() / 3  times one of 1,3, or 4
 
69
     *
 
70
     * \param vertices the vertices of the points, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme
 
71
     * \param colors the colors of each vertex. Can be NULL.. Stored as R1,G1,B1,A1, ... Rn,Gn,Bn,An
 
72
     * \param boundingBox The bounding box of the points (first minimum, second maximum).
 
73
     */
 
74
    WDataSetPoints( VertexArray vertices, ColorArray colors,
 
75
                    WBoundingBox boundingBox );
 
76
 
 
77
    /**
 
78
     * Constructs a new set of points. The bounding box is calculated during construction. If no color is specified, white is used for all
 
79
     * points.
 
80
     *
 
81
     * \note the number of floats in vertices must be a multiple of 3
 
82
     * \note the number of floats in colors (if not NULL) must be vertices->size() / 3  times one of 1,3, or 4
 
83
     *
 
84
     * \param vertices the vertices of the points, stored in x1,y1,z1,x2,y2,z2, ..., xn,yn,zn scheme
 
85
     * \param colors the colors of each vertex. Can be NULL.. Stored as R1,[G1,B1,[A1,]] ... Rn,[Gn,Bn,[An]]
 
86
     */
 
87
    WDataSetPoints( VertexArray vertices, ColorArray colors );
 
88
 
 
89
    /**
 
90
     * Constructs a new set of points. The constructed instance is empty..
 
91
     */
 
92
    WDataSetPoints();
 
93
 
 
94
    /**
 
95
     * Destructor.
 
96
     */
 
97
    virtual ~WDataSetPoints();
 
98
 
 
99
    /**
 
100
     * Get number of points in this data set.
 
101
     *
 
102
     * \return number of points
 
103
     */
 
104
    size_t size() const;
 
105
 
 
106
    /**
 
107
     * Determines whether this dataset can be used as a texture.
 
108
     *
 
109
     * \return true if usable as texture.
 
110
     */
 
111
    virtual bool isTexture() const;
 
112
 
 
113
    /**
 
114
     * Gets the name of this prototype.
 
115
     *
 
116
     * \return the name.
 
117
     */
 
118
    virtual const std::string getName() const;
 
119
 
 
120
    /**
 
121
     * Gets the description for this prototype.
 
122
     *
 
123
     * \return the description
 
124
     */
 
125
    virtual const std::string getDescription() const;
 
126
 
 
127
    /**
 
128
     * Returns a prototype instantiated with the true type of the deriving class.
 
129
     *
 
130
     * \return the prototype.
 
131
     */
 
132
    static boost::shared_ptr< WPrototyped > getPrototype();
 
133
 
 
134
    /**
 
135
     * Getter for the point vertices
 
136
     * \return The vertices
 
137
     */
 
138
    VertexArray getVertices() const;
 
139
 
 
140
    /**
 
141
     * Getter for the point colors
 
142
     * \return The colors
 
143
     */
 
144
    ColorArray getColors() const;
 
145
 
 
146
    /**
 
147
     * Get the bounding box.
 
148
     * \return The bounding box of all points.
 
149
     */
 
150
    WBoundingBox getBoundingBox() const;
 
151
 
 
152
    /**
 
153
     * Query coordinates of a given point.
 
154
     *
 
155
     * \throw WOutOfBounds if invalid index is used.
 
156
     * \param pointIdx the point index.
 
157
     *
 
158
     * \return the coordinates
 
159
     */
 
160
    WPosition operator[]( const size_t pointIdx ) const;
 
161
 
 
162
    /**
 
163
     * Query coordinates of a given point.
 
164
     *
 
165
     * \throw WOutOfBounds if invalid index is used.
 
166
     * \param pointIdx the point index.
 
167
     *
 
168
     * \return the coordinates
 
169
     */
 
170
    WPosition getPosition( const size_t pointIdx ) const;
 
171
 
 
172
    /**
 
173
     * The color of a given point.
 
174
     *
 
175
     * \throw WOutOfBounds if invalid index is used.
 
176
     * \param pointIdx the point index.
 
177
     *
 
178
     * \return the color
 
179
     */
 
180
    WColor getColor( const size_t pointIdx ) const;
 
181
 
 
182
    /**
 
183
     * Is this a valid point index?
 
184
     *
 
185
     * \param pointIdx the index to check
 
186
     *
 
187
     * \return true if yes.
 
188
     */
 
189
    bool isValidPointIdx( const size_t pointIdx ) const;
 
190
 
 
191
    /**
 
192
     * The type of colors we have for each point.
 
193
     */
 
194
    enum ColorType
 
195
    {
 
196
        GRAY = 1,
 
197
        RGB = 3,
 
198
        RGBA =4
 
199
    };
 
200
 
 
201
    /**
 
202
     * Check the type of color.
 
203
     *
 
204
     * \return the type
 
205
     */
 
206
    ColorType getColorType() const;
 
207
protected:
 
208
    /**
 
209
     * The prototype as singleton.
 
210
     */
 
211
    static boost::shared_ptr< WPrototyped > m_prototype;
 
212
 
 
213
private:
 
214
    /**
 
215
     * Point vector for all points
 
216
     */
 
217
    VertexArray m_vertices;
 
218
 
 
219
    /**
 
220
     * An array of the colors per vertex.
 
221
     */
 
222
    ColorArray m_colors;
 
223
 
 
224
    /**
 
225
     * Which colortype do we use in m_colors.
 
226
     */
 
227
    ColorType m_colorType;
 
228
 
 
229
    /**
 
230
     * Axis aligned bounding box for all point-vertices of this dataset.
 
231
     */
 
232
    WBoundingBox m_bb;
 
233
 
 
234
    /**
 
235
     * Initialize arrays and bbox if needed. Used during construction.
 
236
     *
 
237
     * \param calcBB if true, the bounding box is calculated
 
238
     */
 
239
    void init( bool calcBB = false );
 
240
};
 
241
 
 
242
#endif  // WDATASETPOINTS_H