SimpleLineSymbol.h 2.9 KB
#pragma once

#ifndef _SimpleLineSymbol_H_
#define _SimpleLineSymbol_H_
#include<string>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/foreach.hpp>
#include "Renderer.h"
#include "clsStruct.h"
#include "clsCrSurf.h"
#include "DataCollection.h"
//#include "clsPng.h"

using namespace std;

namespace DmapCore_30
{
	class clsCrSurf;
	class Path;
	class DataCollection;
	class CORE_EXPORT SimpleLineSymbol :public Renderer
	{
	public:

		//没有实现 captype,jointype
		SimpleLineSymbol();
		~SimpleLineSymbol();
		static SimpleLineSymbol* CreateNew();
		virtual int RendererType();
		virtual bool  Parse(boost::property_tree::ptree &pt, AppendBuffer *f);
		virtual bool ParsePtree( boost::property_tree::ptree &pt);
        virtual void ToJson(AppendBuffer *ab);
		//virtual bool RendererString(Renderer** ppRen, const char** psXML);
		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);


		//clsPng *png;

		/*
		全局变量
		*/
		int  m_iAntialiasing;
		unsigned int m_iColor;
		int m_iType;
		string m_sPNG;
		double m_dWidth;
		int m_iCapType;
		int m_iJionType;

		double r, g, b, a;

		int                      GetAntialiasing();
		bool                     SetAntialiasing(int newVal);
		unsigned int             GetColor();
		bool                     SetColor(unsigned int color);
		int                      GetType();
		bool                     SetType(int type);
		const char*              GetPNG();
		bool                     SetPNG(const char* png);
		double                   GetWidth();
		bool                     SetWidth(double width);
		int                      GetCapType();
		bool                     SetCapType(int iCapType);
		int                      GetJionType();
		bool                     SetJionType(int iJionType);


		//此处传的 geom 都是屏幕坐标
		int BytesPerLine(int nWidth, int nBitsPerPixel);




		bool TryFindHeatRenderer(){ return false; }



		//线条有点难办啊, 需要传surface宽和高,还要传 绘图 buffer指针

		bool DrawLINE(clsCrSurf* clsCS, clsStruct::LINE * pLine);
		bool DrawMLINE(clsCrSurf* clsCS, clsStruct::MLINE* pMLine);
		bool DrawLINESimple(clsCrSurf* clsCS, clsStruct::LINE* pLine);
		bool DrawLINEPNG(clsCrSurf* clsCS, clsStruct::LINE* pLine);
		bool DrawMLINESimple(clsCrSurf* clsCS, clsStruct::MLINE* pMLine);
		bool DrawMLINEPNG(clsCrSurf* clsCS, clsStruct::MLINE* pMLine);


	private:
		bool m_mustReloadPng;
		unsigned int  m_LastBGColor;
		bool TryReadPng(unsigned int colorThis);
		//clsCrSurf* m_pClsSurfBackup;
		bool TryCreatePatta(clsCrSurf * clsCS);
		bool TryCreateRendererBase();
	};

}

#endif