File: ThresholdShader.h

package info (click to toggle)
mercator 0.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,008 kB
  • sloc: sh: 10,433; cpp: 4,482; makefile: 115
file content (111 lines) | stat: -rw-r--r-- 3,846 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// This file may be redistributed and modified only under the terms of
// the GNU General Public License (See COPYING for details).
// Copyright (C) 2003 Alistair Riddoch

#ifndef MERCATOR_FILL_THRESHOLD_SHADER_H
#define MERCATOR_FILL_THRESHOLD_SHADER_H

#include <Mercator/Shader.h>

namespace Mercator {

/// \brief Surface shader that defines the surface above a given level.
class HighShader : public Shader {
  private:
    /// The level above which the shader renders.
    float m_threshold;
  public:
    /// Key string used when specifying the threshold parameter.
    static const std::string key_threshold;

    /// Default level above which the shader renders.
    static const float default_threshold;

    /// \brief Constructor
    ///
    /// @param threshold level below which the shader renders.
    explicit HighShader(float threshold = default_threshold);
    /// \brief Constructor
    ///
    /// @param params a map of parameters for the shader.
    explicit HighShader(const Parameters & params);
    virtual ~HighShader();

    /// Accessor for level above which the shader renders.
    const float threshold() const { return m_threshold; }

    virtual bool checkIntersect(const Segment &) const;
    virtual void shade(Surface &) const;
};

/// \brief Surface shader that defines the surface below a given level.
class LowShader : public Shader {
  private:
    /// The level below which the shader renders.
    float m_threshold;
  public:
    /// Key string used when specifying the threshold parameter.
    static const std::string key_threshold;

    /// Default level below which the shader renders.
    static const float default_threshold;

    /// \brief Constructor
    ///
    /// @param threshold level below which the shader renders.
    explicit LowShader(float threshold = default_threshold);
    /// \brief Constructor
    ///
    /// @param params a map of parameters for the shader.
    explicit LowShader(const Parameters & params);
    virtual ~LowShader();

    /// Accessor for level below which the shader renders.
    const float threshold() const { return m_threshold; }

    virtual bool checkIntersect(const Segment &) const;
    virtual void shade(Surface &) const;
};

/// \brief Surface shader that defines the surface between two levels.
class BandShader : public Shader {
  private:
    /// The level above which the shader renders.
    float m_lowThreshold;
    /// The level below which the shader renders.
    float m_highThreshold;
  public:
    /// Key string used when specifying the low threshold parameter.
    static const std::string key_lowThreshold;
    /// Key string used when specifying the high threshold parameter.
    static const std::string key_highThreshold;

    /// Default level above which the shader renders.
    static const float default_lowThreshold;
    /// Default level below which the shader renders.
    static const float default_highThreshold;

    /// \brief Constructor
    ///
    /// @param low_threshold level above which the shader renders.
    /// @param high_threshold level below which the shader renders.
    explicit BandShader(float low_threshold = default_lowThreshold,
                        float high_threshold = default_highThreshold);
    /// \brief Constructor
    ///
    /// @param params a map of parameters for the shader.
    explicit BandShader(const Parameters & params);
    virtual ~BandShader();

    /// Accessor for the level above which the shader renders.
    const float lowThreshold() const { return m_lowThreshold; }
    /// Accessor for the level below which the shader renders.
    const float highThreshold() const { return m_highThreshold; }

    virtual bool checkIntersect(const Segment &) const;
    virtual void shade(Surface &) const;
};

} // namespace Mercator

#endif // MERCATOR_FILL_THRESHOLD_SHADER_H