/* $Header: https://oberon.oapd.inaf.it/shins/trunk/shins/src/iif/Interface/Ltcs/Iif/IifStar.h 374 2018-01-11 11:43:51Z depa $
*/

#pragma once

#include <sstream>
/* LbtoIIFInterface.h was autogenerated with slice from the asssociated .ice in src/Interface
*/
#include <LbtoIIFInterface.h>
#include <Nice/Map.h>

/*!\struct position2
* IIF layout of star information of LbtoIIFInterface.h
* See 481s011w

\var    position2::type
object type Planet names, "FILE", "DIFFERENTIAL" etc

\var    position2::coord1
RA or AZ (radian).

\var    position2::coord2
DEC or ALT (radian)

\var    position2::system
"RADEC" or "AZALT"

\var    position2::epoch
epoch (year)

\var    position2::equinox
"J2000"

\var    position2::pmcoord1
proper motion dRa/dt cos(DEC) radian/yr .

\var    position2::pmcoord2
proper otion dDEC/dt (radian/yr)

\var    position2::apparentMagnitude
magnitude

\var    position2::filter
filter name , "U", "V", "B", "R", "I"

\var    position2::color
color index

\var    position2::colorType
color type, "U_B", "B_V", "H_K" etc or "NONE"

\var    position2::wavelength
wavelength (microns)

\var    position2::file
non-sidereal ephemeris file name

\var    position2::time
differential MJD (UT days)

\var    position2::RARate
differential dRA/dt *cos(DEC) (radian/day)

\var    position2::DECRate
differential dDEC/dt (radian/day)
*/


namespace Ltcs
{

/*!*******************
* @brief A IifStar object is a single sky object with location, brightness ect.
* @since 2017-01-18
* @author R. J. Mathar
*/
class IifStar : public lbto::position2
{
public:
    IifStar() ;
    IifStar(const lbto::position2 & star) ;
    IifStar(const Nice::DMS & ra, const Nice::DMS & dec) ;
    IifStar(const std::string & str, const std::string & typ) ;
    operator Nice::SkyPoint() const ;
    double distance(const IifStar & oth) const ;
    std::string toLbtoLoc() const ;
    std::string toPosition2Py() const ;
    std::string object() const ;
    IifStar propMot(const Nice::Date & t) const ;
    IifStar propMot() const ;
    IifStar precess(const Nice::Date & t) const ;
    IifStar precess() const ;

    static Nice::DMS getGST(const Nice::Date & t = Nice::Date::now()) ;

    static Nice::DMS getLST(const Nice::Date & t = Nice::Date::now(),
                            const Nice::GeoLocation & geosite = Nice::GeoLocation()) ;

    Nice::DMS getPang(const Nice::Date & t = Nice::Date::now(),
                      const Nice::GeoLocation & geosite = Nice::GeoLocation()) const ;

    Nice::SkyPoint getHoriz(const Nice::Date & t = Nice::Date::now(),
                            const Nice::GeoLocation & geosite = Nice::GeoLocation()) const ;

    Nice::DMS getPangDot(const Nice::Date & t = Nice::Date::now(),
                         const Nice::GeoLocation & geosite = Nice::GeoLocation()) ;

    Nice::DMS derotStartAng(const Nice::Date t, const double lowLim, const double hiLim,
                            const float dirScale, const int durat=12*3600,
                            const Nice::GeoLocation & geosite = Nice::GeoLocation()) const ;

    Nice::DMS derotStartAng(const Nice::Date t, const Nice::Point & travelrange,
                            const Nice::Point & transDegree, const float cfgDirection,
                            const int durat=12*3600, const Nice::GeoLocation & geosite = Nice::GeoLocation()) const ;

#if 0
    Nice::Time derotResidTime(Nice::Date t, const double lowLim,
                              const double hiLim, const double mang0, const float dirScale,
                              const Nice::GeoLocation & geosite= Nice::GeoLocation()) const ;

    Nice::Time derotResidTime( Nice::Date t, const double mang0,
                               const Nice::Point & travelrange,
                               const Nice::Point & transDegree, const float cfgDirection,
                               const Nice::GeoLocation & geosite = Nice::GeoLocation()) const ;
#endif
    bool apparentMagnitudeIsGreater(double _mag) const {
        return apparentMagnitude > _mag;
    }

    void aladin() const ;

protected:
private:
} ;

bool operator< ( const IifStar & first, const IifStar & secnd) ;

typedef std::vector<IifStar> SeqIifStar;

std::ostream &operator<< ( std::ostream &out, const Ltcs::IifStar & _star );
std::istream &operator>> ( std::istream &in, Ltcs::IifStar & _star );


}

namespace lbto
{
std::ostream &operator<< ( std::ostream &out, const position2 & _star );
std::istream &operator>> ( std::istream &in, position2 & _star );
}