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

#ifndef VW_PARAMETRIC_OBJECT__H
#define VW_PARAMETRIC_OBJECT__H

#pragma once

namespace VWFC
{
	using namespace Tools;
	
	namespace VWObjects
	{
		class VWParametricObj : public VWGroupObj
		{
		public:
								VWParametricObj(MCObjectHandle hParametric);
								VWParametricObj(const TXString& parametricName, const VWPoint2D& location, double angle = 0);
								VWParametricObj(const TXString& parametricName, MCObjectHandle hPathObject);
								VWParametricObj(const VWParametricObj& src);
			virtual				~VWParametricObj();

			VWParametricObj&	operator=(const VWParametricObj& src);
	
		public:
			void				GetObjectToWorldTransform(VWTransformMatrix& out) const;
			TXString			GetParametricName() const;
			MCObjectHandle		GetObjectPath() const;
			void				SetObjectPath(MCObjectHandle hPathGroup);
			MCObjectHandle		GetObjectProfileGroup() const;
			void				SetObjectProfileGroup(MCObjectHandle hProfileGroup);
			VWRecordFormatObj	GetRecordFormat() const;

			VWPoint2D			GetPointObjectPos() const;
			void				SetPointObjectPos(const VWPoint2D& pt);
			void				GetLinearObjectPos(VWPoint2D& outA, VWPoint2D& outB) const;
			void				SetLinearObjectPos(const VWPoint2D& a, VWPoint2D& b);
	
		// parameters
		public:
			size_t				GetParamsCount() const;
			TXString			GetParamName(size_t paramIndex) const;
			TXString			GetParamLocalizedName(size_t paramIndex) const;
			// returns ((size_t) -1) if not found
			size_t				GetParamIndex(const TXString& paramName) const;
			EFieldStyle			GetParamStyle(size_t paramIndex) const;
			TXString			GetParamValue(size_t paramIndex) const;
			void				SetParamValue(size_t paramIndex, const TXString& value);

			void				EnableParameter(size_t paramIndex, bool bEnabled);
			void				SetParameterVisibility(size_t paramIndex, bool bVisible);
			void				SetControlPtVisibility(size_t ctrlPtIndex, bool bVisible);

			long				GetParamLong(size_t paramIndex) const;
			void				SetParamLong(size_t paramIndex, long value);
			bool				GetParamBool(size_t paramIndex) const;
			void				SetParamBool(size_t paramIndex, bool value);
			double				GetParamReal(size_t paramIndex) const;
			void				SetParamReal(size_t paramIndex, double value);
			TXString			GetParamString(size_t paramIndex) const;
			void				SetParamString(size_t paramIndex, const TXString& value);

			bool				GetParamChoices(size_t paramIndex, TXStringSTLArray& outArray) const;
			bool				GetParamLocalizedChoices(size_t paramIndex, TXStringSTLArray& outArray) const;
	
		// object math
		public:
			double				Get2DRotation180() const;
			double				Get2DRotation360() const;

		// Tools
		public:
			// Return true if the specified object handle is layer
			static bool				IsParametricObject(MCObjectHandle hObj);
			static bool				IsParametricObject(MCObjectHandle hObj, const char* szName);
			static MCObjectHandle	DefineCustomObject(const char* szName, bool bShowPrefs);

		protected:
			void				SetParametricHandle(MCObjectHandle hParametric);

		protected:
			RecordHandle		fhParamRecord;
			FormatHandle		fhParamFormat;

		};
	}
}

#endif // VW_PARAMETRIC_OBJECT__H