/*****************************************************
**
**   PrintoutHelper   ---   writeVedicDefault
**
******************************************************/
void PrintoutHelper::writeVedicDefault( Table *table )
{
	int i;
	Lang lang;

	VargaHoroscope chart( h, 0 );
	VargaHoroscope nchart( h, 1 );
	JaiminiExpert jexpert( &nchart );
	jexpert.calcCharaKarakas();
	NakshatraExpert nexpert;

	table->setHeader( 2,  _( "Planet" ), false, 1 );
	table->setHeader( 4,  _( "Length" ), false, 1 );
	table->setHeader( 6,  _( "Nakshatra" ));
	table->setHeader( 7,  _( "D-9" ));
	table->setHeader( 8,  _( "Karaka" ));
	table->col_line[5] = true;
	int line = 1;

	vector<int> obs = PlanetList().getVedicObjectList( OBJECTS_INCLUDE_ASCENDANT | OBJECTS_INCLUDE_DRAGONTAIL | OBJECTS_INCLUDE_DRAGONHEAD );
	for ( unsigned int p = 0; p < obs.size(); p++ )
	{
		i = obs[p];
		writePlanetaryObject( table, 2, line, i, false, true );
		table->setEntry( 6, line, lang.getNakshatraName(::getNakshatra(h->getObjectPosition( i, true ).length, N27), N27, TLARGE ) );
		table->setEntry( 7, line, writer->getSignName(nchart.getRasi( i ), config->signPrecision ), config->useSignSymbols );
		if ( p < 8 )  table->setEntry( 8, line, lang.getKarakaName( jexpert.getCharaKarakaProperty(p)) );
		line++;
	}
}
/*****************************************************
**
**   PrintoutHelper   ---   writeVedicKp
**
******************************************************/
void PrintoutHelper::writeVedicKp( Table *table )
{
	int i;
	wxString s;
	Lang lang;

	VargaHoroscope chart( h, 0 );
	VargaHoroscope nchart( h, 1 );
	JaiminiExpert jexpert( &nchart );
	jexpert.calcCharaKarakas();
	NakshatraExpert nexpert;
	h->updateKP( 0 );

	table->setHeader( 2,  _( "Planet" ), false, 1 );
	table->setHeader( 4,  _( "Length" ), false, 1 );
	table->setHeader( 6,  _( "Naks" ));
	table->setHeader( 7,  _( "L" ));
	table->setHeader( 8,  _( "SL" ));
	table->setHeader( 9,  _( "SSL" ));

	table->setHeader( 10,  _( "Cusp" ), false, 4 );
	table->setHeader( 15,  _( "L" ));
	table->setHeader( 16,  _( "SL" ));
	table->setHeader( 17,  _( "SSL" ));
	table->col_line[9] = true;
	int line = 1;

	vector<int> obs = PlanetList().getVedicObjectList( OBJECTS_INCLUDE_ASCENDANT | OBJECTS_INCLUDE_DRAGONTAIL | OBJECTS_INCLUDE_DRAGONHEAD );
	for ( unsigned int p = 0; p < obs.size(); p++ )
	{
		i = obs[p];
		writePlanetaryObject( table, 2, line, i, false, true, true );
		table->setEntry( 6, line, lang.getNakshatraName(::getNakshatra(h->getObjectPosition( i, true ).length, N27), N27, TMEDIUM ) );

		KpData kp = h->getKPLords( i );
		table->setEntry( 7, line, writer->getObjectName( kp.lord, TSHORT, true ), config->usePlanetSymbols );
		table->setEntry( 8, line, writer->getObjectName( kp.sublord, TSHORT, true ), config->usePlanetSymbols );
		table->setEntry( 9, line, writer->getObjectName( kp.subsublord, TSHORT, true ), config->usePlanetSymbols );
		line++;
	}
	line = 1;
	for ( i = 2; i <= 12 ; i++ )
	{
		writeHouse( table, 10, line++, i, true );
	}
}
Beispiel #3
0
/*****************************************************
**
**   EphemExpert   ---   writeIngress
**
******************************************************/
int EphemExpert::writeIngress( Writer *writer )
{
	int ret = 0;
	Lang lang;
	IngressEvent *e;
	list<IngressEvent>::iterator iter;
	wxString s, buf, pname, thetime;
	TzUtil tzu;

	if ( ! cingress ) ret = calcIngress();
	writeHeaderInfo( writer );

	Table table( 4, ingressEvents.size()+1 );
	table.setHeader( 0, _( "Day" ));
	table.setHeader( 1, _( "Time" ));
	table.setHeader( 2, _( "Planet" ));
	table.setHeader( 3, chartprops->isVedic() ? _( "Sign/Nakshatra" ) : _( "Sign" ));

	int line = 1;
	for ( iter = ingressEvents.begin(); iter != ingressEvents.end(); iter++ )
	{
		e = (IngressEvent*)(&(*iter));
		if ( e->type == 0 )
			buf = writer->getSignName( e->which, TLARGE );
		else
			buf = lang.getNakshatraName( e->which, N27, TLARGE );

		pname = writer->getObjectName( e->planet, TLARGE, chartprops->isVedic() );

		TzFormattedDate fd = tzu.getDateFormatted( e->jd, isLocaltime );
		thetime = fd.timeFormatted;
		//if ( dstchange ) thetime << wxT( " " ) << fd.timezoneFormatted;

		s.Printf( wxT( "%02d %s" ), fd.dayOfMonth, fd.weekDay.c_str());
		if ( testDayIndexForCurrent( fd.dayOfMonth )) table.setHeaderEntry( 0, line, s );
		else	table.setEntry( 0, line, s );

		table.setEntry( 1, line, thetime );
		table.setEntry( 2, line, pname );
		table.setEntry( 3, line, buf );
		line++;
	}
	writer->writeTable( table );
	return ret;
}
Beispiel #4
0
/*****************************************************
**
**   EphemExpert   ---   writeDefaultEphemeris
**
******************************************************/
int EphemExpert::writeDefaultEphemeris( Writer *writer )
{
	int ret = 0;
	wxString tz_str, s, rasi_str, nak_str;
	int i, j, deg, min, numcols;
	unsigned int i1;
	double rasilen;
	bool showrasi, shownak;
	wxString d;
	Lang lang;

	if ( !clen  ) ret = calcLength();
	writeHeaderInfo( writer );
	numcols = planetdata.size() + 1;

	int line = 1;
	int nb_leaps = 0;
	for ( i = 0; i < nb_days; i++ )
	{
		if ( i > 0 && weekday[i] == 0 ) nb_leaps++;
	}
	Table table( numcols, nb_days+nb_leaps+2 );
	table.setHeader( 0, _( "Day" ));

	// Header
	int col = 1;
	for ( i1 = 0; i1 < planetdata.size(); i1++ )
	{
		table.setHeader( col, writer->getObjectName( planetdata[i1].pindex, TLARGE, chartprops->isVedic() ));
		col++;
	}
	line = 1;
	for ( i = 0; i < nb_days; i++ )
	{
		//if ( i > 0 && weekday[i] == 0 ) o << Endl; // blank line on weekend
		if ( i > 0 && weekday[i] == 0 )
		{
			for ( j = 0; j < numcols; j++ ) table.setHeaderEntry( j, line, wxEmptyString );
			line++;
		}

		s.Printf( wxT( "%02d %s" ), i+1, (const wxChar*)lang.getWeekdayName( weekday[i] ).Left(2) );

		// write TZ if change during month
		/*
		if ( dstchange )
		{
			TzFormattedDate fd = tzutil.getDateFormatted( jd[i], isLocaltime );
			s << wxT( " " ) << fd.timezoneFormatted;
		}
		*/

		if ( testDayIndexForCurrent( i+1 )) table.setHeaderEntry( 0, line, s );
		else	table.setEntry( 0, line, s );

		col = 1;
		for ( i1 = 0; i1 < planetdata.size(); i1++ )
		{
			rasilen = getRasiLen( planetdata[i1].len[i] ) + .008333333;
			deg = (int)rasilen;
			min = (int)( 60 * ( rasilen - (double)deg ));

			// symbol for retrogression
			d = wxT( " " );
			if ( planetdata[i1].retro[i] ) {
				d = writer->getRetroSymbol();
			}
			else if ( i > 1 && planetdata[i1].retro[i] != planetdata[i1].retro[i-1] )
			{
				planetdata[i1].retro[i] ? d = writer->getRetroSymbol(): d = writer->getRetroSymbol( 1 );
			}
			else if ( i == nb_days - 1 && planetdata[i1].retro[i] ) {
				d = writer->getRetroSymbol();
			}

			showrasi = shownak = true;
			rasi_str = showrasi ? writer->getSignName( planetdata[i1].rasi[i] ) : wxT( "  " );
			nak_str = shownak ? lang.getNakshatraName( planetdata[i1].nakshatra[i], N27 ) : wxT( "   " );

			// ready to print now
			if ( config->useVedicPositions )
			{
				if ( chartprops->isVedic() )
				{
					s.Printf( wxT( "%s%02d-%02d-%02d %s" ), (const wxChar*)d, planetdata[i1].rasi[i], deg, min, (const wxChar*)nak_str );
				}
				else
				{
					s.Printf( wxT( "%s%02d-%02d-%02d" ), (const wxChar*)d, planetdata[i1].rasi[i], deg, min );
				}
			}
			else
			{
				if ( chartprops->isVedic() )
				{
					s.Printf( wxT( "%s%02d%s%02d %s" ), (const wxChar*)d, deg, (const wxChar*)rasi_str, min, (const wxChar*)nak_str );
				}
				else
				{
					s.Printf( wxT( "%s%02d%s%02d" ), (const wxChar*)d, deg, (const wxChar*)rasi_str, min );
				}
			}
			table.setEntry( col, line, s );

			col++;
		}

		line++;
	}
	// Header
	table.setHeaderEntry( 0, line, _( "Day" ));
	col = 1;
	for ( i1 = 0; i1 < planetdata.size(); i1++ )
	{
		table.setHeaderEntry( col, line, writer->getObjectName( planetdata[i1].pindex, TLARGE, chartprops->isVedic() ));
		col++;
	}
	writer->writeTable( table );
	return ret;
}
/*****************************************************
**
**   TextHelper   ---   writeVedicPlanetReport
**
******************************************************/
int TextHelper::writeVedicPlanetReport()
{
	VargaExpert expert;
	int i, j;
	Lang lang;
	Calculator *calculator = CalculatorFactory().getCalculator();
	wxString s1;
	double len;
	int ret = 0;

	VargaHoroscope chart( horoscope, 0 );
	VargaHoroscope nchart( horoscope, 1 );
	JaiminiExpert jexpert( &nchart );
	jexpert.calcCharaKarakas();
	NakshatraExpert nexpert;

	if ( show_header ) writer->writeHeader1( _( "Vedic Planets" ));
	vector<int> obs = chartprops->getVedicPlanetList();
	Table table( 5, obs.size() + 1 );
	table.setHeader( 0,  _( "Planet" ));
	table.setHeader( 1,  _( "Length" ));
	table.setHeader( 2,  _( "Karaka" ));
	table.setHeader( 3,  _( "Navamsa" ));
	table.setHeader( 4,  _( "Nakshatra" ));
	table.col_alignment[0] = Align::Center;
	table.col_alignment[1] = Align::Right;
	table.col_alignment[3] = Align::Center;

	//const int inode = config->iLunarNodeMode == LUNAR_NODE_TRUE ? OTRUENODE : OMEANNODE;
	int line = 1;
	for ( unsigned int p = 0; p < obs.size(); p++ )
	{
		i = obs[p];
		len = horoscope->getVedicLength( i );
		if ( len == 0 ) ret++;
		table.setEntry( 0, line,  writer->getObjectName( i, TLARGE, true ));
		table.setEntry( 1, line,  writer->getPosFormatted( len, horoscope->isRetrograde( i )));

		if ( i <= OSATURN ) j = i;
		else if ( i == OMEANNODE || i == OTRUENODE ) j = 7;
		else j = -1;
		if ( j != -1 )  table.setEntry( 2, line, lang.getKarakaName( jexpert.getCharaKarakaProperty( j )));

		table.setEntry( 3, line, writer->getSignName(nchart.getRasi( i ), config->signPrecision ));
		table.setEntry( 4, line, lang.getNakshatraName( getNakshatra( len, N27), N27, TLARGE ) );
		line++;
	}
	writer->writeTable( table );

	writer->writeHeader2( _( "Qualities" ));
	Table t4( 2, 5 );
	t4.setHeader( 0,  _( "Quality" ));
	t4.setHeader( 1,  _( "Value" ));
	double mlen = horoscope->getVedicLength( OMOON );

	line = 1;
	t4.setEntry( 0, line, _( "Varna" ) );
	t4.setEntry( 1, line++, lang.getVarnaName( getVarna( mlen )));

	t4.setEntry( 0, line, _( "Yoni" ) );
	t4.setEntry( 1, line++, lang.getYoniName( nexpert.getYoni( mlen )));

	t4.setEntry( 0, line, _( "Gana" ) );
	t4.setEntry( 1, line++, lang.getGanaName( nexpert.getGana( mlen )));

	t4.setEntry( 0, line, _( "Nadi" ) );
	t4.setEntry( 1, line++, lang.getNadiName( nexpert.getNadi( mlen )));
	writer->writeTable( t4 );

	writer->writeHeader2( _( "Moon's Nakshatra and Pada Portions" ));
	Table t5( 3, 3 );
	t5.setHeader( 0,  _( "Quality" ));
	t5.setHeader( 1,  _( "Value" ));
	t5.setHeader( 2,  _( "Value (Percent)" ));
	t5.setEntry( 0, 1, _( "Nakshatra" ) );
	double nportion = calculator->calcNakshatraPortion( horoscope->getDataSet(), mlen, false );
	s1.Printf( wxT( "%1.6f" ), nportion );
	t5.setEntry( 1, 1, s1 );

	s1.Printf( wxT( "%01.2f%%" ), 100.0 * nportion );
	t5.setEntry( 2, 1, s1 );

	t5.setEntry( 0, 2, _( "Pada" ) );
	double pportion = calculator->calcNakshatraPortion( horoscope->getDataSet(), mlen, true );
	s1.Printf( wxT( "%1.6f" ), pportion );
	t5.setEntry( 1, 2, s1 );

	s1.Printf( wxT( "%01.2f%%" ), 100.0 * pportion );
	t5.setEntry( 2, 2, s1 );

	writer->writeTable( t5 );

	return ret;
}
/*****************************************************
**
**   TextHelper   ---   writeVedicPlanets
**
******************************************************/
int TextHelper::writeVedicPlanets()
{
#define HOUSE_QUALIFIER 1000
	wxString s;
	int pindex, rowindex = 1, shast, col = 1, p, ret = 0;
	int numcols;
	unsigned int i;
	ObjectPosition pos;
	Formatter *f = Formatter::get();
	Lang lang;

	int nakshatramode =  ( config->vNakshatraMode28 ? N28 : N27 );
	VargaHoroscope chart( horoscope, VARGA_RASI );
	VargaHoroscope bchart( horoscope, VARGA_BHAVA );
	JaiminiExpert expert( &chart );
	AshtakavargaExpert aexpert( &chart );
	Planet *planet;
	int istyle = chartprops->getVedicMainStyle();

	int extraObjects = 0;
	if ( chartprops->getVedicObjectStyle() & OBJECTS_INCLUDE_D9_LAGNA ) extraObjects |= OBJECTS_INCLUDE_D9_LAGNA;
	vector<int> obs = chartprops->getVedicPlanetList( extraObjects );

	int opt_lord, opt_dig, opt_nav, opt_kara, opt_shast, opt_nak, opt_dasa, opt_bha, opt_kp, opt_ashtaka, opt_pada,
	opt_houses, opt_declinations;

	opt_lord = opt_dig = opt_nav = opt_kara = opt_shast = opt_nak = opt_dasa = opt_bha = opt_kp = opt_ashtaka = opt_pada
	                               = opt_houses = opt_declinations = 0;

	numcols = 2;
	if ( istyle & MAIN_CHILD_SHOW_LORD        ) {
		opt_lord = true;
		numcols++;
	}
	if ( istyle & MAIN_CHILD_SHOW_DIGNITY     ) {
		opt_dig = true;
		numcols++;
	}
	if ( istyle & MAIN_CHILD_SHOW_NAVAMSA     ) {
		opt_nav = true;
		numcols++;
	}
	if ( istyle & MAIN_CHILD_SHOW_KARAKA      ) {
		opt_kara = true;
		expert.calcCharaKarakas();
		numcols++;
	}
	if ( istyle & MAIN_CHILD_SHOW_SHASTIAMSA  ) {
		opt_shast = true;
		numcols++;
	}
	if ( istyle & MAIN_CHILD_SHOW_NAKSHATRA   ) {
		opt_nak = true;
		numcols++;
	}
	if ( istyle & MAIN_CHILD_SHOW_DASAVARGA   ) {
		opt_dasa = true;
		numcols++;
	}
	if ( istyle & MAIN_CHILD_SHOW_HOUSEPOS    ) {
		opt_bha = true;
		numcols++;
	}
	if ( istyle & MAIN_CHILD_SHOW_ASHTAKA     ) {
		opt_ashtaka = true;
		aexpert.update();
		numcols += 1;
	}
	if ( istyle & MAIN_CHILD_SHOW_PADA        ) {
		opt_pada = true;
		numcols += 1;
	}
	if ( istyle & MAIN_CHILD_SHOW_KP          ) {
		opt_kp = true;
		horoscope->updateKP( 0 );
		numcols += 3;
	}
	if ( istyle & MAIN_CHILD_SHOW_DECLINATION ) {
		opt_declinations = true;
		numcols ++;
	}

	if ( istyle & MAIN_CHILD_SHOW_HOUSES )
	{
		opt_houses = true;
		for ( i = HOUSE1; i <= HOUSE12; i++ ) obs.push_back( i + HOUSE_QUALIFIER );
	}

	Table table( numcols, obs.size() + 1 );
	table.setHeader( 0,  _( "Planet" ));
	table.setHeader( 1,  _( "Length" ));
	i = 2;
	if ( opt_declinations ) table.setHeader( i++, _( "Declination" ));
	if ( opt_lord ) table.setHeader( i++, _( "Lord" ));
	if ( opt_dig ) table.setHeader( i++, _( "Dignity" ));
	if ( opt_nav ) table.setHeader( i++, _( "D-9" ));
	if ( opt_nak ) table.setHeader( i++, _( "Nakshatra" ));
	if ( opt_pada ) table.setHeader( i++, _( "Pada" ));
	if ( opt_kp )
	{
		table.setHeader( i++, _( "KP Lord" ));
		table.setHeader( i++, _( "Sublord" ));
		table.setHeader( i++, _( "Subsublord" ));
	}
	if ( opt_shast ) table.setHeader( i++, _( "Shastiamsa" ));
	if ( opt_dasa ) table.setHeader( i++, _( "Dasa Varga" ));
	if ( opt_bha ) table.setHeader( i++, _( "Bhava" ));
	if ( opt_kara ) table.setHeader( i++, _( "Karaka" ));
	if ( opt_ashtaka ) table.setHeader( i++, _( "AV" ));

	for ( i = 0; i < obs.size(); i++ )
	{
		pindex = obs[i];

		if ( pindex >= HOUSE_QUALIFIER )
		{
			pos.length = horoscope->getHouse( pindex - HOUSE_QUALIFIER, true, false );
			pos.latitude = 0;
			pos.retro = false;
		}
		else
		{
			pos = horoscope->getObjectPosition( pindex, true );

			// pos.length is 0 for unclaculated planets because Ayanamsa isn't subtracted in that case
			if ( pos.length == 0 && pindex != OARIES ) ret++;
		}

		planet = 0;
		col = 2;
		assert( (int)table.nb_rows >= rowindex );

		table.setEntry( 0, rowindex,
		                ( pindex <= LAST_ARABIC_OBJECT ? writer->getObjectName( pindex, TLARGE, true ) : lang.getBhavaName( pindex - HOUSE_QUALIFIER )));
		if ( pindex <= OSATURN ) planet = horoscope->getPlanet( pindex );

		table.setEntry( 1, rowindex, writer->getPosFormatted( pos.length, pos.retro ));

		// Declination
		if ( opt_declinations )
			table.setEntry( col++, rowindex, f->getLatitudeFormatted( pos.latitude, DEG_PRECISION_SECOND ));

		// Lord
		if ( opt_lord )
			table.setEntry( col++, rowindex, writer->getObjectName( getLord( getRasi( pos.length )), TLARGE, true ));

		// Dignity
		if ( opt_dig )
		{
			if ( pindex >= OSUN && pindex <= OSATURN && obs[i] < MAX_EPHEM_OBJECTS )
				table.setEntry( col, rowindex, lang.getDignityName( horoscope->getVargaData( pindex, VARGA_RASI )->getDignity(), TLARGE ));
			col++;
		}

		// Navamsa
		if ( opt_nav )
			table.setEntry( col++, rowindex, writer->getSignName( getRasi( pos.length * 9 ), config->signPrecision ));

		// Nakshatra
		if ( opt_nak )
			table.setEntry( col++, rowindex,
			                lang.getNakshatraName( getNakshatra( pos.length, nakshatramode ), nakshatramode, TMEDIUM ));

		// Pada
		if ( opt_pada )
		{
			s.Printf( wxT( "%d" ), (int)(getNakshatraLength( pos.length, nakshatramode ) / 3.3333333333 ) + 1 );
			table.setEntry( col++, rowindex, s );
		}

		// Krishnamurti
		if ( opt_kp )
		{
			KpData kp;
			if ( pindex <= LAST_ARABIC_OBJECT )
			{
				kp = horoscope->getKPLords( obs[i] );
			}
			else
			{
				kp = horoscope->getHouseKPLords( pindex - HOUSE_QUALIFIER );
			}
			table.setEntry( col++, rowindex, writer->getObjectName( kp.lord, TLARGE, true ));
			table.setEntry( col++, rowindex, writer->getObjectName( kp.sublord, TLARGE, true ));
			table.setEntry( col++, rowindex, writer->getObjectName( kp.subsublord, TLARGE, true ));
		}

		// Shastiamsa
		if ( opt_shast )
		{
			shast = (int)( a_red( pos.length, 30 ) * 2 );
			if ( isEvenRasi( pos.length )) shast = 59 - shast;
			assert( shast >= 0 && shast < 60 );
			s.Printf( wxT( "%s (%c)" ), (const wxChar*)lang.getShastiamsaName( shast),
			          ( k_shastiamsa_benefic[(int)shast] ? 'B' : 'M' ));
			table.setEntry( col, rowindex, s );
			col++;
		}

		// Dasavarga Dignity
		if ( opt_dasa )
		{
			if ( pindex <= OSATURN  && obs[i] < MAX_EPHEM_OBJECTS )
			{
				VargaExpert expert;
				table.setEntry( col, rowindex, lang.getVimsopakaDignityName( 2, planet->getVimsopakaBalaGoodVargas( 2 )) );
			}
			col++;
		}

		// Bhava
		if ( opt_bha  && obs[i] <= MAX_EPHEM_OBJECTS )
		{
			s.Printf( wxT( "%d" ), red12( bchart.getRasi( pindex ) - bchart.getRasi( OASCENDANT )) + 1 );
			table.setEntry( col++, rowindex, s );
		}

		// Karaka
		if ( opt_kara )
		{
			if ( pindex <= OSATURN ) p = pindex;
			else if ( pindex == OMEANNODE || pindex == OTRUENODE ) p = 7;
			else p = -1;
			if ( p >= 0 ) table.setEntry( col, rowindex, lang.getKarakaName( expert.getCharaKarakaProperty( p )) );
			col++;
		}


		// Ashtaka Varga
		if ( opt_ashtaka )
		{
			if ((( pindex >= OSUN && pindex <= OSATURN ) || pindex == OASCENDANT )  && obs[i] <= MAX_EPHEM_OBJECTS )
			{
				s.Printf( wxT( "%d" ), aexpert.getItem( REKHA, pindex, getRasi( pos.length )));
				table.setEntry( col++, rowindex, s );
			}
			col++;
		}
		rowindex++;
	}
	writer->writeTable( table );
	return ret;
}