author | francesco-ST <francesco.abbate@st.com> | 2010年07月30日 14:04:37 +0200 |
---|---|---|
committer | francesco-ST <francesco.abbate@st.com> | 2010年07月30日 14:04:37 +0200 |
commit | 975bbb0229edfb8ca2be826994f5422a0c8d6c38 (patch) | |
tree | e9e9c6403e321597a276d7288d4c449d12d5d2c9 /agg-plot/scalable.h | |
parent | d28a8f579f2e902f5bced91cbb726f7eca32b3a1 (diff) | |
download | gsl-shell-975bbb0229edfb8ca2be826994f5422a0c8d6c38.tar.gz |
-rw-r--r-- | agg-plot/scalable.h | 41 |
diff --git a/agg-plot/scalable.h b/agg-plot/scalable.h index 30ee655d..2f0188ee 100644 --- a/agg-plot/scalable.h +++ b/agg-plot/scalable.h @@ -28,8 +28,8 @@ public: virtual ~scalable() { }; }; -/* This class is basically a wrapper around a native AGG vertex_source object - that implements the "scalable" interface. */ +/* This class is basically a wrapper around a native AGG vertex_source object. + The wrapper implements the "scalable" interface. */ template <class T, bool system_managed> class vs_proxy : public scalable { T m_base; @@ -43,7 +43,7 @@ public: virtual void approximation_scale(double as) { }; virtual bool dispose() { return (system_managed ? false : true); }; - T& get_base() { return m_base; }; + T& self() { return m_base; }; }; /* this class does work does permit to perform an AGG transformation @@ -56,6 +56,8 @@ protected: base_type* m_source; public: + typedef conv_type self_type; + vs_adapter(base_type* src): m_output(*src), m_source(src) { }; @@ -85,4 +87,37 @@ public: conv_type& self() { return m_output; }; }; +template<class conv_type> +class scalable_adapter : public vs_adapter<conv_type, scalable> { + typedef vs_adapter<conv_type, scalable> root_type; + +public: + scalable_adapter(scalable *src) : root_type(src) { }; + + template <class init_type> + scalable_adapter(scalable* src, init_type& val): root_type(src, val) {}; + + virtual void approximation_scale(double as) + { + this->m_source->approximation_scale(as); + }; +}; + +template<class conv_type> +class scalable_adapter_approx : public vs_adapter<conv_type, scalable> { + typedef vs_adapter<conv_type, scalable> root_type; + +public: + scalable_adapter_approx(scalable *src) : root_type(src) { }; + + template <class init_type> + scalable_adapter_approx(scalable* src, init_type& val): root_type(src, val) {}; + + virtual void approximation_scale(double as) + { + this->m_output.approximation_scale(as); + this->m_source->approximation_scale(as); + }; +}; + #endif |