/*******************************************************************************
 *  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.UnitsOfVolumeMeasurement_CID7462;
import cdac.medinfo.sdk.dcm30_04.templates.cid.VolumeMeasurements_CID7472;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_UnitsOfVolumeMeasurement;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_VolumeMeasurementTemplate;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_VolumeMeasurements;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_VolumeMeasurementTemplate;

/**
 * This class represents VolumeMeasurementTemplate - TID1402
 */
public class VolumeMeasurementTemplate_TID1402 extends Template
{
	/**
	 * Object of UnitsOfVolumeMeasurement_CID7462
	 */
	private UnitsOfVolumeMeasurement_CID7462 objUnitsOfVolumeMeasurementCID7462;
	
	/**
	 * Object of VolumeMeasurements_CID7472
	 */
	private VolumeMeasurements_CID7472 objVolumeMeasurementsCID7472;
	
	/**
	  * Instantiates a new VolumeMeasurementTemplate_TID1402 Template.
	  * @param objTree Object of SRTree.
	  */
	public VolumeMeasurementTemplate_TID1402(SRTree objTree)
	{
		super(objTree);
	}
	
	/**
	 * Sets the value for Volume Measurements
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param arrNumericValue String array for Numeric Value.
	 * @param enumVolumeMeasurements Enumerated value for Volume Measurements
	 * @param enumUnitsOfVolumeMeasurement Enumerated value for Units Of Volume Measurement
	 */
	public void setAreaMeasurements(int[] arrPosition,String[] arrNumericValue,EnumCM_VolumeMeasurements enumVolumeMeasurements ,EnumCM_UnitsOfVolumeMeasurement enumUnitsOfVolumeMeasurement)
	{
		
		if(null== this.objVolumeMeasurementsCID7472)
	this.objVolumeMeasurementsCID7472 = new VolumeMeasurements_CID7472();
		objVolumeMeasurementsCID7472.setVolumeMeasurements(enumVolumeMeasurements);
		
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = objVolumeMeasurementsCID7472.getCodeMeaning();
		String strCodeValue = objVolumeMeasurementsCID7472.getCodeValue();
		String strCSD = objVolumeMeasurementsCID7472.getCodingSchemeDesignator();
		String strSNMDCTID = objVolumeMeasurementsCID7472.getSNOMEDCTID();

		//String strCSV = objVolumeMeasurementsCID7472.getCodingSchemeVersion();
		
		if(null== this.objUnitsOfVolumeMeasurementCID7462)
	this.objUnitsOfVolumeMeasurementCID7462 = new UnitsOfVolumeMeasurement_CID7462();
		objUnitsOfVolumeMeasurementCID7462.setUnitsOfVolumeMeasurement(enumUnitsOfVolumeMeasurement);
		
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator For Unit 
		 */
		String strCMForUnit = objUnitsOfVolumeMeasurementCID7462.getCodeMeaning();
		String strCVForUnit = objUnitsOfVolumeMeasurementCID7462.getCodeValue();
		String strCSDForUnit = objUnitsOfVolumeMeasurementCID7462.getCodingSchemeDesignator();
		String strCSVForUnit = objUnitsOfVolumeMeasurementCID7462.getCodingSchemeVersion();

		ContentSequenceItem objContentSequenceItem = getSRTree().createNumNode(arrPosition,strCodeMeaning,strCodeValue,strCSD,arrNumericValue,strCVForUnit,strCSDForUnit,strCSVForUnit,strCMForUnit,"","","","",strSNMDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}
	
	/**
	 * Sets the value for Perimeter Outline
	 * @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 setPerimeterOutline(int[] arrPosition, float []arrFlGraphicData, EnumGraphicType enumGraphicType)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_VolumeMeasurementTemplate.PERIMETER_OUTLINE.getValue();
		String strCodeValue = EnumCV_VolumeMeasurementTemplate.PERIMETER_OUTLINE_121057.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);
	}
}
