Ejemplo n.º 1
0
/*****************************************************
**
**   TextHelper   ---   writeAstronomicalData
**
******************************************************/
int TextHelper::writeAstronomicalData()
{
	wxString pname;
	int p, ret = 0;

	Calculator *calculator = CalculatorFactory().getCalculator();
	Formatter *f = Formatter::get();
	Lang lang;

	vector<int> obs1 = chartprops->getPlanetList();
	vector<int> obs;
	for ( unsigned int i = 0; i < obs1.size(); i++ )
	{
		if ( obs1[i] < MAX_EPHEM_OBJECTS ) obs.push_back( obs1[i] );
	}

	if ( show_header ) writer->writeHeader1( _( "Astronomical Positions" ));
	Table table( 4, obs.size() + 1 );
	table.setHeader( 0,  _( "Planet" ));
	table.setHeader( 1,  _( "Longitude" ));
	table.setHeader( 2,  _( "Latitute" ));
	table.setHeader( 3,  _( "Speed (deg/day)" ));
	table.col_line[0] = true;
	table.col_alignment[0] = Align::Right;
	table.col_alignment[1] = Align::Right;

	int line = 1;
	for ( unsigned int i = 0; i < obs.size(); i++ )
	{
		p = obs[i];
		if ( horoscope->getTropicalLength( p ) == 0 ) ret++;
		pname = writer->getObjectName( p, TLARGE);
		table.setEntry( 0, line, pname );
		table.setEntry( 1, line, writer->getPosFormatted( horoscope->getTropicalLength( p ), horoscope->isRetrograde( p ), DEG_PRECISION_MORE ));

		if ( p != OASCENDANT && p != OMERIDIAN )
		{
			table.setEntry( 2, line, f->getLatitudeFormatted( horoscope->getLatitude( p ), DEG_PRECISION_MORE ));
			table.setEntry( 3, line, f->getLenFormatted( horoscope->getSpeed( p ), DEG_PRECISION_MORE ));
		}
		line++;
	}
	writer->writeTable( table );

	Table t2( 2, 5 );
	t2.setHeader( 0,  _( "Name" ));
	t2.setHeader( 1,  _( "Value" ));
	writer->writeHeader2( _( "Ayanamsa" ));
	line = 1;
	for ( int i = 0; i < NB_AYANAMSAS; i++ )
	{
		t2.setEntry( 0, line, lang.getAyanamsaName( i+1 ));
		t2.setEntry( 1, line, f->getDegreesFormatted( calculator->calcAyanamsa( horoscope->getJD(), i+1 ), DEG_PRECISION_MORE ));
		line++;
	}
	t2.setEntry( 0, 4, _( "Custom" ) );
	t2.setEntry( 1, 4, f->getDegreesFormatted( calculator->calcAyanamsa( horoscope->getJD(), 4 ), DEG_PRECISION_MORE ));
	writer->writeTable( t2 );
	return ret;
}
Ejemplo n.º 2
0
/*****************************************************
**
**   DegMinSecInputField   ---   formatValue
**
******************************************************/
void DegMinSecInputField::formatValue()
{
	Formatter *formatter = Formatter::get();
	if ( Validate())
	{
		value = getDoubleValue();
		SetValue( formatter->getDegreesFormatted( value, format ));
	}
	else
	{
		SetValue( formatter->getDegreesFormatted( value, format ));
	}
}
Ejemplo 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;
}
Ejemplo n.º 4
0
/*****************************************************
**
**   DegMinSecInputField   ---   setDoubleValue
**
******************************************************/
void DegMinSecInputField::setDoubleValue( const double &v )
{
	Formatter *formatter = Formatter::get();
	value = v;
	SetValue( formatter->getDegreesFormatted( v, format ));
}
Ejemplo n.º 5
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 );
}