1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | #ifndef _CONTOURFILTER_H_ |
---|
3 | #define _CONTOURFILTER_H_ |
---|
4 | |
---|
5 | #include "Vector3.h" |
---|
6 | #include "Vector4.h" |
---|
7 | #include "TypeDefs.h" |
---|
8 | #include <R2/graphics/R2Geometry.h> |
---|
9 | #include <list> |
---|
10 | |
---|
11 | class ContourLineFilter { |
---|
12 | public : |
---|
13 | class ContourLine { |
---|
14 | public : |
---|
15 | float _value; |
---|
16 | std::list<Vector3> _points; |
---|
17 | public : |
---|
18 | ContourLine(float value); |
---|
19 | |
---|
20 | private : |
---|
21 | bool isValueWithIn(float v1, float v2) { |
---|
22 | return ((_value >= v1 && _value <= v2) || |
---|
23 | (_value >= v2 && _value <= v1)); |
---|
24 | } |
---|
25 | void getContourPoint(int vertexIndex1, int vertexIndex2, Vector3* vertices, int width, bool top); |
---|
26 | void getContourPoint(int vertexIndex1, int vertexIndex2, Vector4* vertices, int width, bool top); |
---|
27 | public : |
---|
28 | /** |
---|
29 | * @brief |
---|
30 | * @ret Returns the number of points |
---|
31 | */ |
---|
32 | int createLine(int width, int height, Vector3* vertices, bool top); |
---|
33 | int createLine(int width, int height, Vector4* vertices, bool top); |
---|
34 | }; |
---|
35 | |
---|
36 | typedef std::list<ContourLine*> ContourLineList; |
---|
37 | |
---|
38 | private : |
---|
39 | ContourLineList _lines; |
---|
40 | Vector3Array* _colorMap; |
---|
41 | bool _top; |
---|
42 | public : |
---|
43 | ContourLineFilter(); |
---|
44 | |
---|
45 | private : |
---|
46 | void clear(); |
---|
47 | |
---|
48 | public : |
---|
49 | R2Geometry* create(float min, float max, int linecount, Vector3* vertices, int width, int height); |
---|
50 | R2Geometry* create(float min, float max, int linecount, Vector4* vertices, int width, int height); |
---|
51 | void setColorMap(Vector3Array* colorMap); |
---|
52 | |
---|
53 | void setHeightTop(bool top) |
---|
54 | { |
---|
55 | _top = top; |
---|
56 | } |
---|
57 | }; |
---|
58 | |
---|
59 | #endif |
---|