//
//	Copyright © 2005 Nemetschek North America 
//	All Rights Reserved.
//
// Created by Vladislav Stanev

#ifndef VECTORWORKS_LAYER_OBJECT__H
#define VECTORWORKS_LAYER_OBJECT__H

#pragma once

namespace VWFC
{
	using namespace Math;
	using namespace Tools;
	namespace VWObjects
	{
		enum ELayerVisibility {
			kLayerVisibilityInvisible			= -1,
			kLayerVisibilityNormal				= 0,
			kLayerVisibilityGrayed				= 1
		};

		enum ELayerProjection {
			kLayerProjOrthogonal				= 0,
			kLayerProjPerspective				= perspective,
			kLayerProjCavalierOblique45			= cavalierOblique45,
			kLayerProjCavalierOblique30			= cavalierOblique30,
			kLayerProjCabinetOblique45			= cabinetOblique45,
			kLayerProjCabinetOblique30			= cabinetOblique30,
			kLayerProjPlan						= plan
		};

		enum ELayerRender {
			kLayerRenderWireFrame				= renderWireFrame,
			kLayerRenderQuick					= renderQuick,
			kLayerRenderSolid					= renderSolid,
			kLayerRenderShadedSolid				= renderShadedSolid,
			kLayerRenderShadedNoLines			= renderShadedNoLines,
			kLayerRenderFinalShaded				= renderFinalShaded,
			kLayerRenderFinalHiddenLine			= renderFinalHiddenLine,
			kLayerRenderDashedHiddenLine		= renderDashedHiddenLine
		};

		// ---------------------------------------------------------------------------------
		class VWLayerObj : public VWGroupObj
		{
		public:
									VWLayerObj(const TXString& layerName);
									VWLayerObj(const TXString& layerName, ELayerType type);
									VWLayerObj(MCObjectHandle hLayer);
									VWLayerObj(const VWLayerObj& src);
			VWLayerObj&				operator=(const VWLayerObj& src);

			virtual					~VWLayerObj();

		public:
			ELayerType				GetLayerType() const;
			double_gs				GetScale() const;
			void					SetScale(double_gs scale);
			Boolean					IsAmbientLightOn() const;
			void					SetAmbientLightOn(Boolean on);
			double_gs				GetAmbientBrightness() const;
			void					SetAmbientBrightness(double_gs brightness);
			CRGBColor				GetAmbientColor() const;
			void					SetAmbientColor(const CRGBColor& rgb);
			ELayerVisibility		GetVisibility() const;
			void					SetVisibility(ELayerVisibility vis);
			VWRectangle2D			GetCropRectangle();

			ELayerProjection		GetProjection() const;
			void					SetProjection(ELayerProjection proj, Boolean bConfirmWithUser, Boolean bDoProgress);
			void					GetPerspectiveInfo(WorldCoord& perspectiveDistance, WorldCoord& clipDistance, VWRectangle2D& clipRect) const;
			ELayerRender			GetRenderMode() const;
			void					SetRenderMode(ELayerRender mode, Boolean bImmediate, Boolean bDoProgress);
			void					GetViewMatrix(VWTransformMatrix& matrix);
			void					SetViewMatrix(const VWTransformMatrix& matrix);

			SInt32					GetSheetPrintDPI() const;
			void					SetSheetPrintDPI(SInt32 dpi);
			VWPoint2D				GetSheetOrigin() const;
			void					SetSheetOrigin(const VWPoint2D& pt);

			WorldCoord				GetElevation() const;
			void					SetElevation(WorldCoord value);
			WorldCoord				GetHeight() const;
			void					SetHeight(WorldCoord height);

			TXString				GetExpandedName();

			void					SetThisLayerAsCurrent() const;

			// Tools
		public:
			// Return true if the specified object handle is layer
			static bool				IsLayerObject(MCObjectHandle hObj);

			// Get currenly layer
			static MCObjectHandle	GetCurrentLayer();

			// program variables for layers
			static Boolean			GetProgramVar_UseLayerColor();
			static void				SetProgramVar_UseLayerColor(Boolean use);
			static ELayerOptions	GetProgramVar_LayerOptions();
			static void				GetProgramVar_LayerOptions(ELayerOptions options);
		};
	}
}

#endif // VECTORWORKS_LAYER_OBJECT__H