/* ----------------------------------------
 * Origin  : GFI INFORMATIQUE 
 * Project : CDPP Propagation Tool 
 * ----------------------------------------
 * History 
 * Version : 01/05/2015 : SCA : V2.1
 * Version : 05/05/2021 : LBE
 * DM-ID : Redmine#7059 : 05/05/2021 : get orbits between 2 dates
 * ----------------------------------------
 */
package fr.tlse.irap.server.frontServices;

import cdpp3dview.types.Frame;
import java.net.MalformedURLException;
import java.text.ParseException;
import java.util.Date;

import javax.jws.WebService;

import fr.tlse.irap.pos.IPosition;
import fr.tlse.irap.pos.Position;
import fr.tlse.irap.server.serviceDAO.ISpiceDAO;
import fr.tlse.irap.spaceElement.Instruments;
import fr.tlse.irap.spaceElement.SpaceElement;
import fr.tlse.irap.spaceElement.SpaceElementWrapper;
import java.util.ArrayList;
import javax.xml.datatype.XMLGregorianCalendar;

@WebService(endpointInterface = "fr.tlse.irap.pos.IPosition")
public class PositionImpl implements IPosition {
	
	private ISpiceDAO spiceDAO;

	public PositionImpl() throws MalformedURLException, ParseException {
	}

	public ISpiceDAO getSpiceDAO() {
		return spiceDAO;
	}

	public void setSpiceDAO(ISpiceDAO spiceDAO) {
		this.spiceDAO = spiceDAO;
	}

	//@WebMethod
        @Override
	public SpaceElementWrapper getOrbits (Date time) {
		return spiceDAO.getOrbits(time);
	}

	//@WebMethod
        @Override
	public SpaceElementWrapper getOrbitElements (SpaceElementWrapper spaceElementWrapper, Date time) {
		return spiceDAO.getOrbitElements(spaceElementWrapper, time);
	}
	
	//@WebMethod
        @Override
	public SpaceElement getPositionElement(SpaceElement spaceElement, Date time) {
		return spiceDAO.getPositionElement(spaceElement, time);
	}

	//@WebMethod
        @Override
	public SpaceElement getHEEQPositionElement(SpaceElement spaceElement, Date time) {
		return spiceDAO.getHEEQPositionElement(spaceElement, time);
	}

        
	/**
	 * Get position of a body in ECLIPJ2000 system using the new 3Dview service
	 * @param spaceElement with timeValues set for each desire position
	 * @return the space element with its real coordinates.
	 */
        //@WebMethod
        @Override
        public SpaceElement getPositionsElement(SpaceElement spaceElement) {
            return spiceDAO.getPositionsElement(spaceElement, new Frame(17,"ECLIPJ2000",null));
        }
         
	//@WebMethod
        @Override
	public SpaceElementWrapper getAvailableComets(Date startTime, Date endTime, SpaceElement spaceElement, long distance) {
		return spiceDAO.getAvailableComets(startTime, endTime, spaceElement, distance);
	}
	
	//@WebMethod
        @Override
	public Instruments getProbeInstruments(int naifId) {
		return new Instruments(spiceDAO.getProbeInstruments(naifId));
	}


}
