Exemplo n.º 1
0
/*****************************************************
**
**   GenericTableWriter   ---   writeSignLords
**
******************************************************/
void GenericTableWriter::writeSignLords( const uint &i0, const TcColumnSet &set )
{
	ObjectPosition pos;
	SheetFormatter fmt;

  table->setHeader( i0,  _( "Lord" ));
	for ( uint p = 0; p < obs.size(); p++ )
	{
		pos = getObjectPosition( obs[p], set );
		table->setEntry( i0, p + 1, fmt.getObjectName( getLord( getRasi( pos.longitude ), set.vedic ), format, set.vedic ));
	}
}
Exemplo n.º 2
0
double getNavamsaPortion( const double &len, const ObjectId &pindex, const bool &retro )
{
	double navamsavastha = 0;
	double nav_portion;
	int start_nav;

	assert(( pindex <= OSATURN ) && ( pindex >= 0 ));

	if ( ! retro )
	{
		nav_portion = a_red( len, 30 ) / 3.3333333333;
		start_nav = red12( getRasi( len ) * 9 );
	}
	else
	{
		nav_portion = ( 30 - a_red( len, 30 )) / 3.3333333333;
		start_nav = red12( getRasi( len ) * 9 + 8 );
	}

	int inav_portion = (int)nav_portion;
	Rasi nav_rasi;
	double portion;
	navamsavastha = 0;

	for ( int i = 0; i <= inav_portion; i++ )
	{
		if ( i < inav_portion ) portion = 1;
		else portion = nav_portion - (int)nav_portion;

		if ( ! retro )
		{
			nav_rasi = (Rasi)red12( start_nav + i );
		}
		else
		{
			nav_rasi = (Rasi)red12( start_nav - i );
		}

		if ( hasExaltationRasi( pindex, nav_rasi ))
		{
			navamsavastha += 2 * portion;
		}
		else if ( getLord( nav_rasi ) == pindex )
		{
			navamsavastha += 2 * portion;
		}
		else if ( hasDebilationRasi( pindex, nav_rasi ))
		{
			navamsavastha -= portion;
		}
		else if ( isPlanetaryEnemy( pindex, getLord( nav_rasi )))
		{
			navamsavastha -= portion;
		}
		else
		{
			navamsavastha += portion;
		}
	}
	if ( navamsavastha  < 0 ) navamsavastha = 0;
	return navamsavastha;
}
Exemplo n.º 3
0
/*****************************************************
**
**   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;
}
Exemplo n.º 4
0
/*****************************************************
**
**   TextHelper   ---   writeKp
**
******************************************************/
int TextHelper::writeKp( const int &dasaindex )
{
	wxString s;
	Lang lang;
	int p, ret = 0;
	double len, hlen;
	DasaExpert *expert = DasaExpertFactory::get()->getDasaExpert( dasaindex );
	KpData kp;

	if ( ! expert->hasKpFeatures() ) // Not supported by all (e.g. Jaimini)
	{
		writer->writeLine( _( "Not supported" ) );
		return 0;
	}
	horoscope->updateKP( dasaindex );

	if ( show_header )
	{
		writer->writeHeader1( _( "Krishnamurti Paddhati" ));
		s.Printf( wxT( "%s: %s" ), _( "Dasa"), expert->getName());
		writer->writeParagraph( s );
	}

	int kpstyle =  chartprops->getVedicObjectStyle();
	if ( chartprops->getVedicObjectStyle() & OBJECTS_INCLUDE_ASCENDANT ) kpstyle -= OBJECTS_INCLUDE_ASCENDANT;
	if ( chartprops->getVedicObjectStyle() & OBJECTS_INCLUDE_MERIDIAN ) kpstyle -= OBJECTS_INCLUDE_MERIDIAN;
	vector<int> obs = PlanetList().getVedicObjectList( kpstyle );

	Table table( 7, obs.size()+13 );
	table.setHeader( 0,  _( "Planet" ));
	table.setHeader( 1,  _( "Length" ));
	table.setHeader( 2,  _( "Sign Lord" ));
	table.setHeader( 3,  _( "Bhava" ));
	table.setHeader( 4,  _( "KP Lord" ));
	table.setHeader( 5,  _( "Sublord" ));
	table.setHeader( 6,  _( "Subsublord" ));
	for( int i = 0; i < 7; i++ ) table.col_alignment[i] = Align::Center;

	int line = 1;
	for ( unsigned int i1 = 0; i1 < obs.size(); i1++ )
	{
		p = obs[i1];
		len = horoscope->getVedicLength( p );
		if ( len == 0 ) ret++;
		table.setEntry( 0, line, writer->getObjectName( p, TLARGE, true ) );
		table.setEntry( 1, line, writer->getPosFormatted( len, horoscope->isRetrograde( p )));
		table.setEntry( 2, line, writer->getObjectName( getLord( getRasi( len )), TLARGE, true ) );
		s.Printf( wxT( "%02d" ), horoscope->getHousePos( p, true ) + 1 );
		table.setEntry( 3, line, s );

		kp = horoscope->getKPLords( p );
		if ( expert->isRasiDasaExpert() )
		{
			table.setEntry( 4, line, writer->getSignName( kp.lord, TLARGE ) );
			table.setEntry( 5, line, writer->getSignName( kp.sublord, TLARGE ) );
			table.setEntry( 6, line, writer->getSignName( kp.subsublord, TLARGE ) );
		}
		else
		{
			table.setEntry( 4, line, writer->getObjectName( kp.lord, TLARGE, true ) );
			table.setEntry( 5, line, writer->getObjectName( kp.sublord, TLARGE, true ) );
			table.setEntry( 6, line, writer->getObjectName( kp.subsublord, TLARGE, true ) );
		}
		line++;
	}
	for ( p = HOUSE1; p <= HOUSE12; p++ )
	{
		hlen = horoscope->getHouse( p, true, false );
		table.setEntry( 0, line, lang.getBhavaName( p ));
		table.setEntry( 1, line, writer->getPosFormatted( hlen, false ) );
		table.setEntry( 2, line, writer->getObjectName( getLord(getRasi( hlen )), TLARGE, true ) );

		kp = horoscope->getHouseKPLords( p );
		if ( expert->isRasiDasaExpert() )
		{
			table.setEntry( 4, line, writer->getSignName( kp.lord, TLARGE ) );
			table.setEntry( 5, line, writer->getSignName( kp.sublord, TLARGE ) );
			table.setEntry( 6, line, writer->getSignName( kp.subsublord, TLARGE ) );
		}
		else
		{
			table.setEntry( 4, line, writer->getObjectName( kp.lord, TLARGE, true ) );
			table.setEntry( 5, line, writer->getObjectName( kp.sublord, TLARGE, true ) );
			table.setEntry( 6, line, writer->getObjectName( kp.subsublord, TLARGE, true ) );
		}
		line++;
	}
	writer->writeTable( table );
	return ret;
}
Exemplo n.º 5
0
Arquivo: player.cpp Projeto: q4a/attal
QPixmap * Player::getLordSmallPixmapByNum( int num )
{
	return ImageTheme.getLordSmallPixmap( getLord( num )->getId() );
}