/*****************************************************
**
**   GenericTableWriter   ---   writeCharaKarakas
**
******************************************************/
void GenericTableWriter::writeCharaKarakas( const uint &i0, const TcColumnSet &set )
{
  table->setHeader( i0,  _( "Karaka" ));
	if ( set.listcontext != TAB_LC_PLANETS || ! set.vedic ) return;

	Lang lang;
	ObjectId p;
	const bool cmode = config->vedicCalculation->charaKarakaMode; // 0: Parasara, 1: Raman

	JaiminiExpert jexpert( h, V_RASI );
	jexpert.calcCharaKarakas();

	for ( uint i = 0; i < obs.size(); i++ )
	{
		assert( table->getNbRows() > i );

		// map planet id to karaka index - quite ugly
		p = obs[i];
		if ( cmode ) // Raman
		{
			if ( p > OSATURN ) continue;
		}
		else // Parasara
		{
			if ( p == OURANUS ) continue;
			if ( p == OMEANNODE || p == OTRUENODE ) p = (ObjectId)7;
			if ( p > 7 ) continue;
		}
		table->setEntry( i0, i + 1, lang.getKarakaName( jexpert.getCharaKarakaProperty( p )));
	}
}
/*****************************************************
**
**   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 );
	}
}
示例#4
0
/*****************************************************
**
**   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;
}
示例#5
0
/*****************************************************
**
**   TextHelper   ---   writeTextAnalysis
**
******************************************************/
int TextHelper::writeTextAnalysis( const int &mode, const int varga, const int dasa )
{
	int ret = 0;
	switch ( mode )
	{
	case TEXT_MODE_BASE:
		writeBaseData();
		break;

	case TEXT_MODE_WESTERN_PLANETS:
		ret = writeWesternPlanetReport();
		break;

	case TEXT_MODE_VEDIC_PLANETS:
		ret = writeVedicPlanetReport();
		break;

	case TEXT_MODE_NAKSHATRA:
	{
		NakshatraExpert( horoscope ).write( writer, chartprops, show_header );
	}
	break;

	case TEXT_MODE_ASHTAKAVARGA:
	{
		VargaHoroscope chart( horoscope, varga );
		AshtakavargaExpert aexpert( &chart );
		aexpert.update();
		aexpert.write( writer, show_header );
	}
	break;
	case TEXT_MODE_KP:
		ret = writeKp( dasa );
		break;

	case TEXT_MODE_BHAVA:
		writeBhavas();
		break;

	case TEXT_MODE_ARABICPARTS:
	{
		ArabicPartsExpert( horoscope ).write( writer, chartprops->isVedic(), show_header );
	}
	break;

	case TEXT_MODE_VEDIC_ASPECTARIUM:
	{
		AspectExpert aspexpert( horoscope );
		aspexpert.writeVedicAspectarium( horoscope, writer, chartprops, show_header );
	}
	break;

	case TEXT_MODE_WESTERN_ASPECTARIUM:
	{
		AspectExpert aspexpert( horoscope );
		aspexpert.update( horoscope, chartprops );
		if ( show_header ) writer->writeHeader1( _( "Aspectarium" ));
		aspexpert.writeWesternAspectarium( writer, chartprops );
		aspexpert.writeWesternAspectList( writer, chartprops );
	}
	break;

	case TEXT_MODE_WESTERN_ASPECTARIUM_PLAIN:
	{
		AspectExpert aspexpert( horoscope );
		aspexpert.update( horoscope, chartprops );
		aspexpert.writeWesternAspectarium( writer, chartprops );
	}
	break;

	case TEXT_MODE_ASTRONOMICAL:
		ret = writeAstronomicalData();
		break;

	case TEXT_MODE_VARGA:
	{
		VargaExpert vexpert( horoscope );
		vexpert.write( writer, chartprops->getVedicObjectStyle(), show_header );
	}
	break;

	case TEXT_MODE_DASA:
		assert( dasa >= 0 && dasa < (int)DasaExpertFactory::MAX_DASAEXPERTS );
		DasaExpertFactory::get()->getDasaExpert( dasa )->write( writer, horoscope, varga, show_header );
		break;

	case TEXT_MODE_DASACOMPACT:
		assert( dasa >= 0 && dasa < (int)DasaExpertFactory::MAX_DASAEXPERTS );
		DasaExpertFactory::get()->getDasaExpert( dasa )->writeCompact( writer, horoscope, varga, show_header );
		break;

	case TEXT_MODE_DASALONG:
		assert( dasa >= 0 && dasa < (int)DasaExpertFactory::MAX_DASAEXPERTS );
		DasaExpertFactory::get()->getDasaExpert( dasa )->writeMore( writer, horoscope, varga, show_header );
		break;

	case TEXT_MODE_JAIMINI:
	{
		VargaHoroscope chart( horoscope, varga );
		JaiminiExpert jexpert( &chart );
		jexpert.update();
		jexpert.write( writer, show_header );
	}
	break;

	case TEXT_MODE_MAIN_VIEW:
		ret = writePlanets();
		break;

	default:
		assert( false );
		break;
	}
	if ( ret ) printf( "Warn: %d objects couldn't be calculated\n", ret );
	return ret;
}