00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef VRS_DISABLERENDERING_H
00019 #define VRS_DISABLERENDERING_H
00020
00021 #include <vrs/monoattributepainter.h>
00022 #include <vrs/polyattributepainter.h>
00023 #include <vrs/shapepainter.h>
00024
00025 namespace VRS {
00026
00028 class DisableRendering {
00029 public:
00031 template<class T>
00032 static SO<Painter> For() { return ForImpl<T>((T*)NULL); }
00033
00034 private:
00035 template<class T>
00036 static SO<Painter> ForImpl(MonoAttribute*) { return new DisableMonoAttributePainterFor<T>(); }
00037
00038 template<class T>
00039 static SO<Painter> ForImpl(PolyAttribute*) { return new DisablePolyAttributePainterFor<T>(); }
00040
00041 template<class T>
00042 static SO<Painter> ForImpl(Shape*) { return new DisableShapePainterFor<T>(); }
00043
00044 private:
00045 template<class T>
00046 class DisableMonoAttributePainterFor : public MonoAttributePainter {
00047 public:
00048 VRS_TYPEINFO(DisableMonoAttributePainterFor, MonoAttributePainter);
00049
00050 virtual ID target() const { return T::ClassNameVRS(); }
00051 virtual bool apply(Engine* engine, const MonoAttribute* attr, bool push) { return true; }
00052 };
00053
00054 template<class T>
00055 class DisablePolyAttributePainterFor : public PolyAttributePainter {
00056 public:
00057 VRS_TYPEINFO(DisablePolyAttributePainterFor, PolyAttributePainter);
00058
00059 virtual ID target() const { return T::ClassNameVRS(); }
00060 virtual bool apply (Engine*, const PolyAttribute*, int index) { return true; }
00061 virtual bool unapply (Engine*, const PolyAttribute*, int index) { return true; }
00062 };
00063
00064 template<class T>
00065 class DisableShapePainterFor : public ShapePainter {
00066 public:
00067 VRS_TYPEINFO(DisableShapePainterFor, ShapePainter);
00068
00069 virtual ID target() const { return T::ClassNameVRS(); }
00070 virtual bool render(Engine* engine, const Shape* shape) { return true; }
00071 };
00072
00073 };
00074
00075 }
00076
00077 #endif // VRS_DISABLEPAINTERFOR_H