TextSymbol.h 3.6 KB
#pragma once
//#include<cairo/cairo.h>
#ifndef _TextSymbol_H_
#define _TextSymbol_H_
#include<string>
#ifndef _Renderer_h_
#define _Renderer_h_
#include"Renderer.h"
#endif
using namespace std;
#define GlowingSize 1
#define ShadowSize 2
namespace DmapCore_30
{

	class clsCrSurf;
	class CORE_EXPORT TextSymbol :public Renderer
	{
	public:
		TextSymbol();
		~TextSymbol();
		bool AddRef();
		bool Release();

		int RendererType();
		bool DrawData(clsCrSurf* pClsCS, DataCollection* data, bool drawSimpleData, char* pFlag = NULL);
	    bool DrawData(clsCrSurf* pClsCS, DataCollection* data, int dataIndex, char* pFlag = NULL);
		virtual bool DrawLegend(clsCrSurf* pClsCS,  shared_ptr<legendParamater> pLegendParamater, int layerType,char* pFlag = NULL);
		bool Parse(boost::property_tree::ptree &pt, AppendBuffer *f);
		virtual void ToJson(AppendBuffer *ab);
		virtual bool ParsePtree( boost::property_tree::ptree &pt);
		static bool RendererXmlParse(Renderer**pRen, const char* fileName);

		bool TryFindHeatRenderer(){ return false; }
	private:
		int m_iN;

	public:
		string  m_sFont;
		double  m_dXdis;
		double  m_dYdis;
		bool    m_bBackGround;
		bool    m_bGlowing;      //发光
		bool    m_bShadow; // 阴影
		bool    m_iAntialiasing;  //防走样
		int     m_iSlant;         //斜体
		int     m_iWeight;          //加粗
		long     m_iFontSize;       //字体大小
		unsigned int     m_iFontColor;        //字体颜色
		unsigned int     m_iBGColor;          //背景颜色
		unsigned int     m_iGlowingColor;     //发光色
		unsigned int     m_iShadowColor;      //阴影色


		const char* GetFont();
		bool    SetFont(const char* sFont);
		double  GetXdis();
		bool    SetXdis(double dXdis);
		double  GetYdis();
		bool    SetYdis(double dYdis);
		bool   GetBackGround();
		bool   SetBackGround(bool bBackGround);
		bool   GetGlowing();
		bool   SetGlowing(bool bGlowing);
		bool   GetShadow();
		bool   SetShadow(bool bShadow);
		int    GetAntialiasing();
		bool   SetAntialiasing(int iAntialiasing);

		int    GetFontSize();
		bool   SetFontSize(int iFontSize);
		int    GetSlant();
		bool   SetSlant(int  iSlant);
		int    GetWeight();
		bool   SetWeight(int iWeight);
		unsigned int    GetFontColor();
		bool   SetFontColor(unsigned int iColor);
		unsigned int    GetBGColor();
		bool   SetBGColor(unsigned int iColor);
		unsigned int    GetGlowingColor();
		bool   SetGlowingColor(unsigned int iColor);
		unsigned int    GetShadowColor();
		bool   SetShadowColor(unsigned int iColor);

		/*
		设置字体,文字大小等固定的一次性设置
		*/
		bool SetCairo(clsCrSurf* pClsCS);


	public:
		double r_font, g_font, b_font, a_font;
		double r_bg, g_bg, b_bg, a_bg;
		double r_glowing, g_glowing, b_glowing, a_glowing;
		double r_shadow, g_shadow, b_shadow, a_shadow;

		/*
		Draw部分
		*/
	public:
		bool DrawAText(clsCrSurf* pClsCS, double x, double y, char* sUTF8);
		bool DrawAText(clsCrSurf* pClsCS, double x, double y, char* sUTF8, double dAngle);  //这个地方不认为在不需要旋转的情况下,旋转角度是0,因为旋转只在点中使用,大部分情况下不需要旋转,认为旋转0度必会影响效率
		bool DrawAText(clsCrSurf* pClsCS, double x, double y, char* sUTF8,int xp,int yp);
		//clsCrSurf* m_pClsCS;  //这个是需要绘制文本的surface和cairo
		char* m_pFlag;        //这个是文字避让数组

	private:
		cairo_text_extents_t* m_pCrExtents;   //cairo定义的文本区域结构体
		/*
		这个变量使用new构造,在类构造函数中创建,在类析构中释放,传入的文本改变时,需要维护
		*/


		/*
		标签位置
		*/
	public:


	};


}

#endif