Esempio n. 1
0
/*****************************************************
**
**   DasaImpl   ---   dump
**
******************************************************/
void DasaImpl::dump(wxString &o)
{
    Formatter *f = Formatter::get();
    Writer *writer = WriterFactory().getWriter( WRITER_TEXT );

    if ( expert->isRasiDasaExpert() )
        o << writer->getSignName( lord );
    else
        o <<  writer->getObjectName( lord,TMEDIUM, true );

    o	<< wxT( " " ) << f->getDateStringFromJD( getStartJD() ) << wxT( " - " ) << f->getDateStringFromJD( getEndJD() ) << Endl;
}
/*****************************************************
**
**   DateInputField   ---   formatValue
**
******************************************************/
void DateInputField::formatValue()
{
	Formatter *formatter = Formatter::get();
	if ( Validate())
	{
		value = getDoubleValue();
		SetValue( formatter->getDateStringFromJD( value ));
	}
	else
	{
		SetValue( formatter->getDateStringFromJD( value ));
	}
}
Esempio n. 3
0
/*****************************************************
**
**   UranianConjunctionEvent   ---   write
**
******************************************************/
wxString UranianConjunctionEvent::write( Writer *writer, const bool show_date ) const
{
	Formatter *formatter = Formatter::get();
	wxString s;

	s << writer->getObjectName( p1 ) 
		<< writer->getUranianAspectSymbol( type )
		<< writer->getObjectName( p2 )
		<< wxT( " " ) << ( ! show_date &&orbis > 0 ? wxT( "-" ) : wxT( " " ));
	if ( show_date ) s << formatter->getDateStringFromJD( jd );
	else s << formatter->getDegreesFormatted( fabs( orbis ));
	return s;
}
/*****************************************************
**
**   PrintoutHelper   ---   writeBaseData
**
******************************************************/
void PrintoutHelper::writeBaseData( Table *table )
{
	wxString s;
	int line = 1;
	double thetime;
	Formatter *f = Formatter::get();

	DataSet *ds = h->getDataSet();
	Location *loc = ds->getLocation();
	JDate *date = ds->getDate();
	table->setHeader( 0,  _( "Base Data" ), false, 1 );

	table->setEntry( 0, line,  _( "Name" ));
	table->setEntry( 1, line++, h->getHName() );

	table->setEntry( 0, line,  _( "Date" ));
	s << f->getDateStringFromJD( h->getJD() + ( loc->getTimeZone() + loc->getDST() )/24 );
	table->setEntry( 1, line++, s );

	table->setEntry( 0, line,  _( "Local Time" ));
	thetime = a_red( getTimeFromJD( date->getJD()) + loc->getTimeZone() + loc->getDST(), 24 );
	table->setEntry( 1, line++, f->getTimeFormatted( thetime ));

	table->setEntry( 0, line,  _( "Location" ));
	table->setEntry( 1, line++, loc->getLocName() );

	table->setEntry( 0, line,  _( "Longitude" ));
	table->setEntry( 1, line++, f->getLongitudeFormatted( loc->getLongitude()));

	table->setEntry( 0, line,  _( "Latitude" ));
	table->setEntry( 1, line++, f->getLatitudeFormatted( loc->getLatitude()));

	table->setEntry( 0, line,  _( "Time Zone" ));
	double tz = loc->getTimeZone();
	s.Printf( wxT( "%s %c%.1f" ), _( "UT" ), ( tz >= 0 ? '+' : '-' ), tz );
	table->setEntry( 1, line++, s );

	table->setEntry( 0, line,  _( "DST" ));
	s.Printf( wxT( "%.1f" ), loc->getDST());
	table->setEntry( 1, line++, s );

	table->setEntry( 0, line,  _( "UT" ));
	table->setEntry( 1, line++, f->getTimeFormatted( getTimeFromJD( h->getJD() )));
}
/*****************************************************
**
**   DateInputField   ---   setDoubleValue
**
******************************************************/
void DateInputField::setDoubleValue( const double &v )
{
	Formatter *formatter = Formatter::get();
	value = v;
	SetValue( formatter->getDateStringFromJD( v ));
}
Esempio n. 6
0
/*****************************************************
**
**   TextHelper   ---   writeBaseData
**
******************************************************/
void TextHelper::writeBaseData()
{
	wxString s;
	double time;

	Formatter *f = Formatter::get();
	Lang lang;

	DataSet *ds = horoscope->getDataSet();
	Location *loc = ds->getLocation();
	JDate *date = ds->getDate();

	if ( show_header ) writer->writeHeader1( _( "Base Data" ));
	Table table( 2, 17 );

	int line = 0;
	table.setEntry( 0, line,  _( "Name" ));
	table.setEntry( 1, line++, horoscope->getHName() );

	table.setEntry( 0, line,  _( "Date" ));
	s << f->getDateStringFromJD( horoscope->getJD() + ( loc->getTimeZone() + loc->getDST() )/24 )
	<< wxT( " " ) << lang.getWeekdayName( ds->getWeekDay() );
	table.setEntry( 1, line++, s );

	table.setEntry( 0, line,  _( "Local Time" ));
	time = a_red( getTimeFromJD( date->getJD()) + loc->getTimeZone() + loc->getDST(), 24 );
	table.setEntry( 1, line++, f->getTimeFormatted( time ));

	table.setEntry( 0, line,  _( "Location" ));
	table.setEntry( 1, line++, loc->getLocName() );

	table.setEntry( 0, line,  _( "Longitude" ));
	table.setEntry( 1, line++, f->getLongitudeFormatted( loc->getLongitude()));

	table.setEntry( 0, line,  _( "Latitude" ));
	table.setEntry( 1, line++, f->getLatitudeFormatted( loc->getLatitude()));

	table.setEntry( 0, line,  _( "Time Zone" ));
	double tz = loc->getTimeZone();
	s.Printf( wxT( "%s %c%.1f %s" ), _( "UT" ), ( tz >= 0 ? '+' : ' ' ), tz, _( "Hours" ));
	table.setEntry( 1, line++, s );

	table.setEntry( 0, line,  _( "Daylight Saving" ));
	s.Printf( wxT( "%.1f %s" ), loc->getDST(), _( "Hours" ));
	table.setEntry( 1, line++, s );

	table.setEntry( 0, line,  _( "Universal Time" ));
	table.setEntry( 1, line++, f->getTimeFormatted( getTimeFromJD( horoscope->getJD() )));

	table.setEntry( 0, line,  _( "Sidereal Time" ));
	table.setEntry( 1, line++, f->getTimeFormatted( horoscope->getSiderealTime()));

	table.setEntry( 0, line,  _( "Julian Date" ));
	s.Printf( wxT( "%8.5f" ), horoscope->getJD());
	table.setEntry( 1, line++, s );

	table.setEntry( 0, line,  _( "Vedic Ayanamsa" ));
	table.setEntry( 1, line++, lang.getAyanamsaName( horoscope->getAyanamsaType( true ) ));

	table.setEntry( 0, line,  _( "Ayanamsa Value" ));
	table.setEntry( 1, line++, f->getDegreesFormatted( horoscope->getAyanamsa( true )));

	table.setEntry( 0, line,  _( "Western Ayanamsa" ));
	table.setEntry( 1, line++, lang.getAyanamsaName( horoscope->getAyanamsaType( false )));

	table.setEntry( 0, line,  _( "Ayanamsa Value" ));
	table.setEntry( 1, line++, f->getDegreesFormatted( horoscope->getAyanamsa( false )));

	table.setEntry( 0, line,  _( "Sunrise" ));
	if ( horoscope->getSunrise() != 0 )
		s = f->getFullDateStringFromJD( horoscope->getSunrise() + ( loc->getTimeZone() + loc->getDST() ) / 24.0 );
	else s = _( "n.a." );
	table.setEntry( 1, line++, s );

	table.setEntry( 0, line,  _( "Sunset" ));
	if ( horoscope->getSunset() != 0 )
		s = f->getFullDateStringFromJD( horoscope->getSunset() + ( loc->getTimeZone() + loc->getDST() ) / 24.0 );
	else s = _( "n.a." );
	table.setEntry( 1, line++, s );

	writer->writeTable( table );
}
Esempio n. 7
0
/*****************************************************
**
**   DasaExpert   ---   write
**
******************************************************/
void DasaExpert::write( Writer *writer, const Horoscope *horoscope, const int varga, const bool show_header )
{
    Formatter *formatter = Formatter::get();
    double startjd;
    unsigned int i;
    wxString s, lord;

    VargaExpert vexpert;
    if ( show_header )
    {
        s.Printf( wxT( "%s %s" ), getName(), _( "Dasa" ) );
        writer->writeHeader2( s );
    }

    vector<Dasa*> v = getFirstLevel( horoscope, varga );
    vector<Dasa*> w;

    for( i = 0; i < v.size(); i++ )
    {
        if ( isRasiDasaExpert()) lord = writer->getSignName( v[i]->getDasaLord(), TLARGE );
        else lord =  writer->getObjectName(v[i]->getDasaLord(), TLARGE, true );

        startjd = Max( v[i]->getStartJD(), horoscope->getJD() );
        if ( ! v[i]->getExtraText().IsEmpty())
        {
            s.Printf( wxT( "%s (%s): %s - %s" ), (const wxChar*)lord, (const wxChar*)(v[i]->getExtraText()),
                      (const wxChar*)formatter->getDateStringFromJD( startjd ),
                      (const wxChar*)formatter->getDateStringFromJD( v[i]->getEndJD() ));
        }
        else
        {
            s.Printf( wxT( "%s: %s - %s" ), (const wxChar*)lord,
                      (const wxChar*)formatter->getDateStringFromJD( startjd ),
                      (const wxChar*)formatter->getDateStringFromJD( v[i]->getEndJD() ));
        }
        writer->writeHeader3( s );
        s.Clear();

        w = getNextLevel( v[i] );
        if ( w.size() == 0 ) continue;

        startjd = Max( w[0]->getStartJD(), horoscope->getJD() );
        s << wxT( " * " ) << formatter->getDateStringFromJD( startjd ) << wxT( " " );

        for( unsigned int j = 0; j < w.size(); j++ )
        {
            if ( w[j]->getEndJD() >= horoscope->getJD())
            {
                if ( isRasiDasaExpert() )
                {
                    s << writer->getSignName(w[j]->getDasaLord(), TLARGE );
                }
                else
                {
                    s <<  writer->getObjectName(w[j]->getDasaLord(), TLARGE, true );
                }
                s	<< wxT( " " ) << formatter->getDateStringFromJD( w[j]->getEndJD() ) << wxT( " " );
            }
            delete w[j];
        }
        writer->writeLine( s );
        s.Clear();
    }
    for( i = 0; i < v.size(); i++ ) delete v[i];
}
Esempio n. 8
0
/*****************************************************
**
**   DasaExpert   ---   writeMore
**
******************************************************/
void DasaExpert::writeMore( Writer *writer, const Horoscope *horoscope, const int varga, const bool show_header )
{
    Formatter *formatter = Formatter::get();
    double startjd;
    unsigned int i;
    wxString s, s1, lord;

    VargaExpert vexpert;
    if ( show_header )
    {
        s.Printf( wxT( "%s %s" ), getName(), _( "Dasa" ) );
        writer->writeHeader1( s );
    }

    vector<Dasa*> v = getFirstLevel( horoscope, varga );
    vector<Dasa*> w;

    for( i = 0; i < v.size(); i++ )
    {
        if ( isRasiDasaExpert() ) lord = writer->getSignName( v[i]->getDasaLord(), TLARGE );
        else lord =  writer->getObjectName(v[i]->getDasaLord(), TLARGE, true );
        s.Printf( wxT( "%d. %s %s" ), i+1, _( "Mahadasa" ), (const wxChar*)lord );
        writer->writeHeader2( s );

        if ( ! v[i]->getExtraText().IsEmpty())
        {
            writer->writeLine( v[i]->getExtraText() );
        }

        startjd = Max( v[i]->getStartJD(), horoscope->getJD() );
        s.Printf( wxT( "%s: %s" ), _( "Start Date" ), (const wxChar*)formatter->getDateStringFromJD( startjd ) );
        writer->writeLine( s );
        s.Printf( wxT( "%s: %s" ), _( "End Date" ), (const wxChar*)formatter->getDateStringFromJD( v[i]->getEndJD() ) );
        writer->writeLine( s );
        getDasaDuration( s1, v[i]->getEndJD() - v[i]->getStartJD() );
        s.Printf( wxT( "%s: %s" ), _( "Duration" ), (const wxChar*)s1 );
        writer->writeLine( s );

        w = getNextLevel( v[i] );
        if ( w.size() == 0 ) continue;

        writer->writeHeader3( _( "Antardasas" ) );

        // Get the number of lines
        int lines = 1;
        for( unsigned int j = 0; j < w.size(); j++ )
        {
            if ( w[j]->getEndJD() >= horoscope->getJD()) lines++;
        }

        Table table( 4, lines );
        table.setHeader( 0, _( "Lord" ));
        table.setHeader( 1,  _( "Start Date" ));
        table.setHeader( 2,  _( "Final Date" ));
        table.setHeader( 3,  _( "Duration" ));

        int line = 1;
        for( unsigned int j = 0; j < w.size(); j++ )
        {
            if ( w[j]->getEndJD() >= horoscope->getJD())
            {
                if ( isRasiDasaExpert() ) lord = writer->getSignName(w[j]->getDasaLord(), TLARGE );
                else lord = writer->getObjectName(w[j]->getDasaLord(), TLARGE, true );
                table.setEntry( 0, line, lord );

                startjd = Max( w[j]->getStartJD(), horoscope->getJD() );
                table.setEntry( 1, line, formatter->getDateStringFromJD( startjd ) );

                table.setEntry( 2, line, formatter->getDateStringFromJD( w[j]->getEndJD() ) );

                getDasaDuration( s, w[j]->getEndJD() - w[j]->getStartJD() );
                table.setEntry( 3, line, s );
                line++;
            }
            delete w[j];
        }
        writer->writeTable( table );
    }
    for( i = 0; i < v.size(); i++ ) delete v[i];
}