// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool Xbim.CodeGeneration 
//  
//     Changes to this file may cause incorrect behaviour and will be lost if
//     the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

using Xbim.Ifc4.Interfaces;
using System.Collections.Generic;
using System.Linq;
using Xbim.Common;

//## Custom using statements
//##

// ReSharper disable once CheckNamespace
namespace Xbim.Ifc4x3.PresentationAppearanceResource
{
	public partial class @IfcCurveStyle : IIfcCurveStyle
	{

		[CrossSchemaAttribute(typeof(IIfcCurveStyle), 2)]
		IIfcCurveFontOrScaledCurveFontSelect IIfcCurveStyle.CurveFont 
		{ 
			get
			{
				if (CurveFont == null) return null;
				var ifccurvestylefontandscaling = CurveFont as IfcCurveStyleFontAndScaling;
				if (ifccurvestylefontandscaling != null) 
					return ifccurvestylefontandscaling;
				var ifccurvestylefont = CurveFont as IfcCurveStyleFont;
				if (ifccurvestylefont != null) 
					return ifccurvestylefont;
				var ifcpredefinedcurvefont = CurveFont as IfcPreDefinedCurveFont;
				if (ifcpredefinedcurvefont != null) 
					return ifcpredefinedcurvefont;
				return null;
			} 
			set
			{
				if (value == null)
				{
					CurveFont = null;
					return;
				}	
				var ifccurvestylefont = value as IfcCurveStyleFont;
				if (ifccurvestylefont != null) 
				{
					CurveFont = ifccurvestylefont;
					return;
				}
				var ifccurvestylefontandscaling = value as IfcCurveStyleFontAndScaling;
				if (ifccurvestylefontandscaling != null) 
				{
					CurveFont = ifccurvestylefontandscaling;
					return;
				}
				var ifcpredefinedcurvefont = value as IfcPreDefinedCurveFont;
				if (ifcpredefinedcurvefont != null) 
				{
					CurveFont = ifcpredefinedcurvefont;
					return;
				}
				
			}
		}

		[CrossSchemaAttribute(typeof(IIfcCurveStyle), 3)]
		IIfcSizeSelect IIfcCurveStyle.CurveWidth 
		{ 
			get
			{
				if (CurveWidth == null) return null;
				if (CurveWidth is MeasureResource.IfcDescriptiveMeasure) 
					return new Ifc4.MeasureResource.IfcDescriptiveMeasure((MeasureResource.IfcDescriptiveMeasure)CurveWidth);
				if (CurveWidth is MeasureResource.IfcLengthMeasure) 
					return new Ifc4.MeasureResource.IfcLengthMeasure((MeasureResource.IfcLengthMeasure)CurveWidth);
				if (CurveWidth is MeasureResource.IfcNormalisedRatioMeasure) 
					return new Ifc4.MeasureResource.IfcNormalisedRatioMeasure((MeasureResource.IfcNormalisedRatioMeasure)CurveWidth);
				if (CurveWidth is MeasureResource.IfcPositiveLengthMeasure) 
					return new Ifc4.MeasureResource.IfcPositiveLengthMeasure((MeasureResource.IfcPositiveLengthMeasure)CurveWidth);
				if (CurveWidth is MeasureResource.IfcPositiveRatioMeasure) 
					return new Ifc4.MeasureResource.IfcPositiveRatioMeasure((MeasureResource.IfcPositiveRatioMeasure)CurveWidth);
				if (CurveWidth is MeasureResource.IfcRatioMeasure) 
					return new Ifc4.MeasureResource.IfcRatioMeasure((MeasureResource.IfcRatioMeasure)CurveWidth);
				return null;
			} 
			set
			{
				if (value == null)
				{
					CurveWidth = null;
					return;
				}	
				if (value is Ifc4.MeasureResource.IfcDescriptiveMeasure) 
				{
					CurveWidth = new MeasureResource.IfcDescriptiveMeasure((Ifc4.MeasureResource.IfcDescriptiveMeasure)value);
					return;
				}
				if (value is Ifc4.MeasureResource.IfcLengthMeasure) 
				{
					CurveWidth = new MeasureResource.IfcLengthMeasure((Ifc4.MeasureResource.IfcLengthMeasure)value);
					return;
				}
				if (value is Ifc4.MeasureResource.IfcNormalisedRatioMeasure) 
				{
					CurveWidth = new MeasureResource.IfcNormalisedRatioMeasure((Ifc4.MeasureResource.IfcNormalisedRatioMeasure)value);
					return;
				}
				if (value is Ifc4.MeasureResource.IfcPositiveLengthMeasure) 
				{
					CurveWidth = new MeasureResource.IfcPositiveLengthMeasure((Ifc4.MeasureResource.IfcPositiveLengthMeasure)value);
					return;
				}
				if (value is Ifc4.MeasureResource.IfcPositiveRatioMeasure) 
				{
					CurveWidth = new MeasureResource.IfcPositiveRatioMeasure((Ifc4.MeasureResource.IfcPositiveRatioMeasure)value);
					return;
				}
				if (value is Ifc4.MeasureResource.IfcRatioMeasure) 
				{
					CurveWidth = new MeasureResource.IfcRatioMeasure((Ifc4.MeasureResource.IfcRatioMeasure)value);
					return;
				}
				
			}
		}

		[CrossSchemaAttribute(typeof(IIfcCurveStyle), 4)]
		IIfcColour IIfcCurveStyle.CurveColour 
		{ 
			get
			{
				if (CurveColour == null) return null;
				var ifccolourspecification = CurveColour as IfcColourSpecification;
				if (ifccolourspecification != null) 
					return ifccolourspecification;
				var ifcpredefinedcolour = CurveColour as IfcPreDefinedColour;
				if (ifcpredefinedcolour != null) 
					return ifcpredefinedcolour;
				return null;
			} 
			set
			{
				if (value == null)
				{
					CurveColour = null;
					return;
				}	
				var ifccolourspecification = value as IfcColourSpecification;
				if (ifccolourspecification != null) 
				{
					CurveColour = ifccolourspecification;
					return;
				}
				var ifcpredefinedcolour = value as IfcPreDefinedColour;
				if (ifcpredefinedcolour != null) 
				{
					CurveColour = ifcpredefinedcolour;
					return;
				}
				
			}
		}

		[CrossSchemaAttribute(typeof(IIfcCurveStyle), 5)]
		Ifc4.MeasureResource.IfcBoolean? IIfcCurveStyle.ModelOrDraughting 
		{ 
			get
			{
				if (!ModelOrDraughting.HasValue) return null;
				return new Ifc4.MeasureResource.IfcBoolean(ModelOrDraughting.Value);
			} 
			set
			{
				ModelOrDraughting = value.HasValue ? 
					new MeasureResource.IfcBoolean(value.Value) :  
					 new MeasureResource.IfcBoolean?() ;
				
			}
		}
	//## Custom code
	//##
	}
}