source: trunk/packages/vizservers/nanovis/ContourLineFilter.h @ 2870

Last change on this file since 2870 was 2827, checked in by ldelgass, 12 years ago

Move Vector3/4Array typdefs to the Vector3/4.h headers and remove TypeDefs?.h.
Also misc. cleanups

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