/*******************************************************************************
 *  Copyright 2017-2018 Centre for Development of Advanced Computing(C-DAC), Pune
 *  
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *  
 *   http://www.apache.org/licenses/LICENSE-2.0
 *  
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package cdac.medinfo.sdk.dcm30_04.templates.generaltemplates;

import cdac.medinfo.sdk.dcm30_04.baselibs.ContentSequenceItem;
import cdac.medinfo.sdk.dcm30_04.enums.EnumGraphicType;
import cdac.medinfo.sdk.dcm30_04.srtree.SRTree;
import cdac.medinfo.sdk.dcm30_04.templates.cid.LinearMeasurements_CID7470;
import cdac.medinfo.sdk.dcm30_04.templates.cid.UnitsOfLinearMeasurement_CID7460;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_LinearMeasurementTemplate;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_LinearMeasurements;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_UnitsOfLinearMeasurement;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_LinearMeasurementTemplate;

/**
 * This class represents LinearMeasurementTemplate - TID1400
 */
public class LinearMeasurementTemplate_TID1400 extends Template
{
	/**
	 * Object of UnitsOfLinearMeasurement_CID7460
	 */
	private UnitsOfLinearMeasurement_CID7460 objLinearMeasurementCID7460;

	/**
	 * Object of UnitsOfLinearMeasurement_CID7460
	 */
	private LinearMeasurements_CID7470 objLinearMeasurementsCID7470;

	/**
	 * Instantiates a new LinearMeasurementTemplate_TID1400 Template.
	 * @param objTree Object of SRTree.
	 */
	public LinearMeasurementTemplate_TID1400(SRTree objTree)
	{
		super(objTree);
	}
	
	/**
	 * Sets the value for Linear Measurements
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param arrNumericValue String array for Numeric Value.
	 * @param enumLinearMeasurements Enumerated value for Linear Measurement
	 * @param enumUnitsOfLinearMeasurement Enumerated value for Units Of Linear Measurement
	 */
	public void setLinearMeasurement(int[] arrPosition,String[] arrNumericValue,EnumCM_LinearMeasurements enumLinearMeasurements ,EnumCM_UnitsOfLinearMeasurement enumUnitsOfLinearMeasurement)
	{

		if(null== this.objLinearMeasurementsCID7470)
			this.objLinearMeasurementsCID7470 = new LinearMeasurements_CID7470();
		objLinearMeasurementsCID7470.setLinearMeasurements(enumLinearMeasurements);

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = objLinearMeasurementsCID7470.getCodeMeaning();
		String strCodeValue = objLinearMeasurementsCID7470.getCodeValue();
		String strCSD = objLinearMeasurementsCID7470.getCodingSchemeDesignator();
		//String strCSV = objLinearMeasurementsCID7470.getCodingSchemeVersion();
		String strSNMDCTID = objLinearMeasurementsCID7470.getSNOMEDCTID();

		if(null== this.objLinearMeasurementCID7460)
			this.objLinearMeasurementCID7460 = new UnitsOfLinearMeasurement_CID7460();
		objLinearMeasurementCID7460.setUnitsOfLinearMeasurement(enumUnitsOfLinearMeasurement);

		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator For Unit 
		 */
		String strCMForUnit = objLinearMeasurementCID7460.getCodeMeaning();
		String strCVForUnit = objLinearMeasurementCID7460.getCodeValue();
		String strCSDForUnit = objLinearMeasurementCID7460.getCodingSchemeDesignator();
		String strCSVForUnit = objLinearMeasurementCID7460.getCodingSchemeVersion();

		ContentSequenceItem objContentSequenceItem = getSRTree().createNumNode(arrPosition,strCodeMeaning,strCodeValue,strCSD,arrNumericValue,strCVForUnit,strCSDForUnit,strCSVForUnit,strCMForUnit,"","","","",strSNMDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Path
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param arrFlGraphicData Float array for FlGraphicData.
	 * @param enumGraphicType Enumerated value for GraphicType.
	 */
	public void setPath(int[] arrPosition, float []arrFlGraphicData, EnumGraphicType enumGraphicType)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_LinearMeasurementTemplate.PATH.getValue();
		String strCodeValue = EnumCV_LinearMeasurementTemplate.PATH_121055.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Creating a node of Value Type TEXT and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createSCOORDNode(arrPosition, strCodeMeaning, strCodeValue, strCSD, arrFlGraphicData, enumGraphicType);
		getSRTree().addChild(objContentSequenceItem);
	}

	/**
	 * Sets the value for Path Vertex
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param arrFlGraphicData Float array for FlGraphicData.
	 * @param enumGraphicType Enumerated value for GraphicType.
	 */
	public void setPathVertex(int[] arrPosition, float []arrFlGraphicData, EnumGraphicType enumGraphicType)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_LinearMeasurementTemplate.PATH_VERTEX.getValue();
		String strCodeValue = EnumCV_LinearMeasurementTemplate.PATH_VERTEX_121230.getValue();
		String strCSD = EnumCodingSchemeDesignator.DCM.getValue();

		/**
		 * Creating a node of Value Type TEXT and adding this node at specified identifier in the SR Tree.
		 */
		ContentSequenceItem objContentSequenceItem = getSRTree().createSCOORDNode(arrPosition, strCodeMeaning, strCodeValue, strCSD, arrFlGraphicData, enumGraphicType);
		getSRTree().addChild(objContentSequenceItem);
	}
}
