/*******************************************************************************
 *  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.AreaMeasurements_CID7471;
import cdac.medinfo.sdk.dcm30_04.templates.cid.UnitsOfAreaMeasurement_CID7461;
import cdac.medinfo.sdk.dcm30_04.templates.enums.EnumCodingSchemeDesignator;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_AreaMeasurementTemplate;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_AreaMeasurements;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cm.EnumCM_UnitsOfAreaMeasurement;
import cdac.medinfo.sdk.dcm30_04.templates.enums.cv.EnumCV_AreaMeasurementTemplate;

/**
 * This class represents AreaMeasurementTemplate - TID1401
 */
public class AreaMeasurementTemplate_TID1401 extends Template
{
	/**
	 * Object of UnitsOfAreaMeasurement_CID7461
	 */
	private UnitsOfAreaMeasurement_CID7461 objUnitsOfAreaMeasurementCID7461;
	
	/**
	 * Object of AreaMeasurements_CID7471
	 */
	private AreaMeasurements_CID7471 objAreaMeasurementsCID7471;
	
	/**
	  * Instantiates a new AreaMeasurementTemplate_TID1401 Template.
	  * @param objTree Object of SRTree.
	  */
	public AreaMeasurementTemplate_TID1401(SRTree objTree)
	{
		super(objTree);
	}
	
	/**
	 * Sets the value for Area Measurements
	 * @param arrPosition Identifier which shows the position of the node in the SR Tree.
	 * @param arrNumericValue String array for Numeric Value.
	 * @param enumAreaMeasurements Enumerated value for Area Measurements
	 * @param enumUnitsOfAreaMeasurement Enumerated value for Units Of Area Measurement
	 */
	public void setAreaMeasurements(int[] arrPosition,String[] arrNumericValue,EnumCM_AreaMeasurements enumAreaMeasurements ,EnumCM_UnitsOfAreaMeasurement enumUnitsOfAreaMeasurement)
	{
		
		if(null== this.objAreaMeasurementsCID7471)
	this.objAreaMeasurementsCID7471 = new AreaMeasurements_CID7471();
		objAreaMeasurementsCID7471.setAreaMeasurements(enumAreaMeasurements);
		
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = objAreaMeasurementsCID7471.getCodeMeaning();
		String strCodeValue = objAreaMeasurementsCID7471.getCodeValue();
		String strCSD = objAreaMeasurementsCID7471.getCodingSchemeDesignator();
		String strSNMDCTID = objAreaMeasurementsCID7471.getSNOMEDCTID();

		//String strCSV = objAreaMeasurementsCID7471.getCodingSchemeVersion();
		
		if(null== this.objUnitsOfAreaMeasurementCID7461)
	this.objUnitsOfAreaMeasurementCID7461 = new UnitsOfAreaMeasurement_CID7461();
		objUnitsOfAreaMeasurementCID7461.setUnitsOfAreaMeasurement(enumUnitsOfAreaMeasurement);
		
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator For Unit 
		 */
		String strCMForUnit = objUnitsOfAreaMeasurementCID7461.getCodeMeaning();
		String strCVForUnit = objUnitsOfAreaMeasurementCID7461.getCodeValue();
		String strCSDForUnit = objUnitsOfAreaMeasurementCID7461.getCodingSchemeDesignator();
		String strCSVForUnit = objUnitsOfAreaMeasurementCID7461.getCodingSchemeVersion();
		
		ContentSequenceItem objContentSequenceItem = getSRTree().createNumNode(arrPosition,strCodeMeaning,strCodeValue,strCSD,arrNumericValue,strCVForUnit,strCSDForUnit,strCSVForUnit,strCMForUnit,"","","","",strSNMDCTID);
		getSRTree().addChild(objContentSequenceItem);
	}
	
	/**
	 * Sets the value for Area 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 setAreaOutline(int[] arrPosition, float []arrFlGraphicData, EnumGraphicType enumGraphicType)
	{
		/**
		 * Retrieves the corresponding values of CodeMeaning,CodeValue and CodingSchemeDesignator.
		 */
		String strCodeMeaning = EnumCM_AreaMeasurementTemplate.AREA_OUTLINE.getValue();
		String strCodeValue = EnumCV_AreaMeasurementTemplate.AREA_OUTLINE_121056.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);
	}
}
