SimpleMarkerSymbol.h 3.0 KB
#pragma once
#ifndef _SimpleMarkerSymbol_H_
#define _SimpleMarkerSymbol_H_
#include<string>
using namespace std;
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/foreach.hpp>
//#include<cairo.h>
#include"clsStruct.h"
#include"Renderer.h"

namespace DmapCore_30
{
	class clsCrSurf;
	class DataCollection;
	class CORE_EXPORT SimpleMarkerSymbol :public Renderer
	{
	public:

		//没有实现 shadow,需要实现?
		SimpleMarkerSymbol();
		~SimpleMarkerSymbol();
		static SimpleMarkerSymbol* CreateNew();
		virtual int RendererType();
		virtual bool DrawData(clsCrSurf* clsCS, DataCollection* data, bool drawSimpleData, char* pFlag = NULL);
		virtual bool DrawData(clsCrSurf* clsCS, DataCollection* data, int dataIndex, char* pFlag = NULL);
		virtual bool DrawLegend(clsCrSurf* pClsCS, shared_ptr<legendParamater> pLegendParamater, int layerType,char* pFlag = NULL);
		virtual bool Parse(boost::property_tree::ptree &pt, AppendBuffer *f);
        virtual void ToJson(AppendBuffer* ab);
		virtual bool ParsePtree( boost::property_tree::ptree &pt);
		bool TryFindHeatRenderer(){ return false; }


		int m_iAntialiasing;
		bool m_bBoundary;
		unsigned int m_iColor;
		int m_iType;
		unsigned int m_iOutline;
		string m_sPNG;
		double m_dWidth;  //边框宽度
		double m_dSize;    //大小


		double r, g, b, a;   //填充颜色
		double r1, g1, b1, a1;  //边框颜色



		int                      GetAntialiasing();
		bool                     SetAntialiasing(int bAntialiasing);
		unsigned int             GetColor();
		bool                     SetColor(unsigned int color);
		int                      GetType();
		bool                     SetType(int type);
		bool                     GetBoundary();
		bool                     SetBoundary(bool boundary);
		unsigned int             GetOutline();
		bool                     SetOutline(unsigned int outline);
		const char*              GetPNG();
		bool                     SetPNG(const char* png);
		double                   GetWidth();
		bool                     SetWidth(double width);
		double                   GetSize();
		bool                     SetSize(double Size);


		/*
		2015_12_24最新
		*/
		bool DrawPOINT(clsCrSurf* clsCS, clsStruct::POINT* pPoint);
		bool DrawMPOINT(clsCrSurf* clsCr, clsStruct::LINE* pLine);

	private:
		cairo_surface_t* surfImage = nullptr;
		//clsCrSurf* m_pImage;
		/*
		变量维护:
		1: 这个变量是 png 构造的surface 的包装类型, 初始为 NULL
		2.获取 Png surface 后,直接构造一个 m_pImage, destroy 动作交给 析构完成
		3.每次 SetPNG 时, 只要检测到字符串与当前字符串不一致, Release 前一个, 构造新一个
		4.绘制图形时,检测到有 m_pImage,并且长宽都不为0(PNG 字符串错误时, 构造 surface 完全正常, 只是长宽为0) , 必然使用PNG 绘制点
		5. 这样做有一个地方需要注意, 只要该样式中存在PNG 字符串, 想要使用其他点类型是不能实现的, 外界必须将字符串重置为""
		*/
	};

}

#endif