Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TREGIONPROP_H
Toshihiro Shimizu 890ddd
#define TREGIONPROP_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tgeometry.h"
Toshihiro Shimizu 890ddd
#include "tregionoutline.h"
Toshihiro Shimizu 890ddd
#include "tsimplecolorstyles.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef TVRENDER_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//============================================================================//
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//forward declarations
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TColorStyle;
Toshihiro Shimizu 890ddd
class TRegion;
Toshihiro Shimizu 890ddd
class TVectorRenderData;
Toshihiro Shimizu 890ddd
class TInputStreamInterface;
Toshihiro Shimizu 890ddd
class TOutputStreamInterface;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TFlash;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class t=""></class>
Toshihiro Shimizu 890ddd
class TRasterPT;
Toshihiro Shimizu 890ddd
class TPixelRGBM32;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef TPixelRGBM32 TPixel32;
Toshihiro Shimizu 890ddd
typedef TRasterPT<tpixel32> TRaster32P;</tpixel32>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//============================================================================//
Toshihiro Shimizu 890ddd
//                                TRegionProp                                   //
Toshihiro Shimizu 890ddd
//============================================================================//
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TRegionProp
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	const TRegion *const m_region;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Toshihiro Shimizu 890ddd
	bool m_regionChanged;
Toshihiro Shimizu 890ddd
	int m_styleVersionNumber;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TRegionProp(const TRegion *region);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual ~TRegionProp() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Note: update internal data if isRegionChanged()
Toshihiro Shimizu 890ddd
	virtual void draw(const TVectorRenderData &rd) = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void draw(TFlash &){};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	const TRegion *getRegion() const { return m_region; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual const TColorStyle *getColorStyle() const = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual void notifyRegionChange() { m_regionChanged = true; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	virtual TRegionProp *clone(const TRegion *region) const = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Toshihiro Shimizu 890ddd
	// not implemented
Toshihiro Shimizu 890ddd
	TRegionProp(const TRegionProp &);
Toshihiro Shimizu 890ddd
	TRegionProp &operator=(const TRegionProp &);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class OutlineRegionProp : public TRegionProp
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	double m_pixelSize;
Toshihiro Shimizu 890ddd
	TOutlineStyleP m_colorStyle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRegionOutline m_outline;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//-------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void computeRegionOutline();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	OutlineRegionProp(const TRegion *region, const TOutlineStyleP regionStyle);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void draw(const TVectorRenderData &rd);
Toshihiro Shimizu 890ddd
	void draw(TFlash &rd);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	const TColorStyle *getColorStyle() const;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRegionProp *clone(const TRegion *region) const;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif