Ejemplo n.º 1
0
/*****************************************************
**
**   GenericTableWriter   ---   writeShastiamsaLords
**
******************************************************/
void GenericTableWriter::writeShastiamsaLords( const uint &i0, const TcColumnSet &set )
{
	int shast;
	Lang lang;
	ObjectPosition pos;

	const static bool k_shastiamsa_benefic[60] = {
		false, false, true, true, true, true, false, false, false, false,
		false, false, true, true, false, false, true, true, true, true,
		true, true, true, true, true, true, true, true, true, false,
		false, false, false, false, false, false, true, true, true, false,
		false, false, false, false, true, true, true, false, true, true,
		false, false, true, true, false, true, true, true, false, true,
	};

// Dignities

  table->setHeader( i0,  _( "D-60 Lords" ));
	for ( uint p = 0; p < obs.size(); p++ )
	{
		pos = getObjectPosition( obs[p], set );
		shast = (int)( a_red( pos.longitude, 30 ) * 2 );
		if ( isEvenRasi( pos.longitude )) shast = 59 - shast;
		assert( shast >= 0 && shast < 60 );
		table->setEntry( i0, p + 1, wxString::Format( wxT( "%s (%c)" ), lang.getShastiamsaName( shast ).c_str(),
			( k_shastiamsa_benefic[(int)shast] ? 'B' : 'M' )));
	}
}
Ejemplo n.º 2
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.º 3
0
/*****************************************************
**
**   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 )));
	}
}
Ejemplo n.º 4
0
/*****************************************************
**
**   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++;
	}
}
Ejemplo n.º 5
0
int ShowLanguagesDlg::OnNotify(GViewI *n, int f)
{
	switch (n->GetId())
	{
		case IDOK:
		{
			if (d->Lst)
			{
				List<Lang> All;
				d->Lst->GetAll(All);
				for (Lang *L = All.First(); L; L = All.Next())
				{
					d->App->ShowLang(L->GetLang()->Id, L->GetVal());
				}

				d->App->OnLanguagesChange(0, 0, true);
			}
		}
		case IDCANCEL:
		{
			EndModal(n->GetId() == IDOK);
			break;
		}
	}

	return false;
}
Ejemplo n.º 6
0
/*****************************************************
**
**   MainWindowStatusbar   ---   OnPlanetTimer
**
******************************************************/
void MainWindowStatusbar::OnPlanetTimer( wxTimerEvent& )
{
	wxString t0, t1;
	double mlen, asclen, dummy, nakportion;
	Lang lang;
	Calculator *calculator = CalculatorFactory().getCalculator();
	DataSet d;
	SheetFormatter fmt;

	d.setCurrentDate();
	d.setLocation( *config->defaultLocation );
	asclen = calculator->calcAscendantAya( d.getJD(), d.getLocation()->getLatitude(),
		d.getLocation()->getLongitude(), config->preferVedic );

	calculator->calcPosition( &d, OMOON, mlen, dummy, true, config->preferVedic );

	t0 << fmt.fragment2PlainText( fmt.getObjectName( OASCENDANT, TF_MEDIUM ))
	 << SPACE
	 << fmt.fragment2PlainText( fmt.getPosFormatted( asclen ));
	SetStatusText( t0, 0 );

	t1 << fmt.fragment2PlainText( fmt.getObjectName( OMOON, TF_MEDIUM ))
	 << SPACE
	 << fmt.fragment2PlainText( fmt.getPosFormatted( mlen ));
	if ( config->preferVedic )
	{
		nakportion = (int)(getNakshatraLongitude27( mlen ) * 10000 /NAKSHATRA_LEN );
		nakportion /= 100;

		t1 << SPACE << nakportion << wxT( "%" ) << SPACE
			<< lang.getNakshatra27Name( ::getNakshatra27( mlen ), TF_MEDIUM );
	}
	SetStatusText( t1, 1 );
}
Ejemplo n.º 7
0
LangType Buffer::getLangFromExt(const char *ext)
{
	NppParameters *pNppParam = NppParameters::getInstance();
	int i = pNppParam->getNbLang();
	i--;
	while (i >= 0)
	{
		Lang *l = pNppParam->getLangFromIndex(i--);

		const char *defList = l->getDefaultExtList();
		const char *userList = NULL;

		LexerStylerArray &lsa = pNppParam->getLStylerArray();
		const char *lName = l->getLangName();
		LexerStyler *pLS = lsa.getLexerStylerByName(lName);
		
		if (pLS)
			userList = pLS->getLexerUserExt();

		std::string list("");
		if (defList)
			list += defList;
		if (userList)
		{
			list += " ";
			list += userList;
		}
		if (isInList(ext, list.c_str()))
			return l->getLangID();
	}
	return L_TXT;
}
Ejemplo n.º 8
0
LangDiagram::LangDiagram(const Lang &lang)
 {
  ulen N=lang.getSyntCount();
  
  // start/stop
  {
   stop=N;
   
   start.reserve(N);
    
   lang.applyForSynts( [this] (Synt synt) { if( synt.isLang() ) start.append_fill(synt.getIndex()); } );
   
   start.shrink_extra();
  }
  
  // elements
  {
   elements.reserve(N);
   
   lang.applyForSynts( [this] (Synt synt) { elements.append_fill(synt); } );
  }

  // arrows
  {
   ArrowBuilder builder(N);
   const Element *base=elements.getPtr();
   
   lang.applyForSynts( [=,&builder] (Synt synt) { builder.add(synt,base); } );
   
   lang.applyForRules( [&builder] (Rule rule) { builder.add(rule); } );
   
   builder.finish(arrows);
  }
 }
Ejemplo n.º 9
0
/*****************************************************
**
**   PrintoutHelper   ---   writeHouse
**
******************************************************/
void PrintoutHelper::writeHouse( Table *table, const int &row, const int &line, const int& house, const bool &vedic )
{
	double len;
	wxString s;
	Lang lang;
	Formatter *formatter = Formatter::get();

	if ( config->useVedicPlanetNames ) s = lang.getBhavaName( house - 1 );
	else s.Printf( wxT( "%02d" ), house );
	table->setEntry( row, line, s );

	len = h->getHouse( house - 1, vedic );
	if ( config->useVedicPositions )
		table->setEntry( row + 2, line, writer->getPosFormatted( len, false, DEG_PRECISION_SECOND ), false );
	else
	{
		table->setEntry( row + 2, line, formatter->getLenFormatted( getRasiLen( len ), DEG_PRECISION_MINUTE ));
		table->setEntry( row + 3, line, writer->getSignName( getRasi( len )), config->useSignSymbols );
	}
	if ( vedic )
	{
		KpData kp = h->getHouseKPLords( house - 1 );
		table->setEntry( row + 5, line, writer->getObjectName( kp.lord, TSHORT, true ), config->usePlanetSymbols );
		table->setEntry( row + 6, line, writer->getObjectName( kp.sublord, TSHORT, true ), config->usePlanetSymbols );
		table->setEntry( row + 7, line, writer->getObjectName( kp.subsublord, TSHORT, true ), config->usePlanetSymbols );
	}
}
Ejemplo n.º 10
0
/*****************************************************
**
**   EphemExpert   ---   writeLunar
**
******************************************************/
void EphemExpert::writeLunar( Writer *writer )
{
	if ( ! clunar ) calcLunar();
	Lang lang;
	wxString s, thetime;
	list<LunarEvent>::iterator iter;
	LunarEvent *e;
	TzUtil tzu;

	writeHeaderInfo( writer );
	Table table( 7, lunarEvents.size()+1 );
	table.setHeader( 0, _( "Day" ));
	table.setHeader( 1, _( "Time" ));
	table.setHeader( 2, _( "Sun" ));
	table.setHeader( 3, _( "Moon" ));
	table.setHeader( 4, _( "Angle" ));
	table.setHeader( 5, _( "Tithi" ));
	table.setHeader( 6, _( "Western" ));

	int line = 1;
	for ( iter = lunarEvents.begin(); iter != lunarEvents.end(); iter++ )
	{
		e = (LunarEvent*)(&(*iter));
		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, writer->getPosFormatted( e->slen, false ) );
		table.setEntry( 3, line, writer->getPosFormatted( e->mlen, false ) );

		int angle = (int)( red_deg( e->mlen - e->slen ) + .00001 );
		if ( angle >= 360 ) angle -= 360;
		s.Printf( wxT( "%d" ), angle );
		table.setEntry( 4, line, s );

		if ( ! ( angle % 12 ))
		{
			table.setEntry( 5, line, lang.getTithiName( angle / 12 ) );
		}
		if ( angle == 0 ) table.setEntry( 6, line, _( "New Moon" ));
		else if ( angle == 180 ) table.setEntry( 6, line, _( "Full Moon" ));
		else if ( angle == 60 || angle == 300 ) table.setEntry( 6, line, _( "Sextile" ));
		else if ( angle == 90 ) table.setEntry( 6, line, _( "Half Moon (Waxing)" ));
		else if ( angle == 120 || angle == 240 ) table.setEntry( 6, line, _( "Trine" ));
		else if ( angle == 270 ) table.setEntry( 6, line, _( "Half Moon (Waning)" ));

		// Semi squares
		else if (( angle == 45 || angle == 135 || angle == 225 || angle == 315 ))
			table.setEntry( 6, line, _( "Semi Square" ));
		line++;
	}
	writer->writeTable( table );
}
Ejemplo n.º 11
0
/*****************************************************
**
**   GenericTableWriter   ---   writeSignification
**
******************************************************/
void GenericTableWriter::writeSignification( const uint &i0, const TcColumnSet &set )
{
  table->setHeader( i0,  _( "Signification" ));
	Lang lang;
	for ( uint i = 0; i < obs.size(); i++ )
	{
		table->setEntry( i0, i + 1, lang.getObjectSignification( obs[i], TF_LONG, set.vedic ));
	}
}
Ejemplo n.º 12
0
/*****************************************************
**
**   EphemExpert   ---   writeHeaderInfo
**
******************************************************/
void EphemExpert::writeHeaderInfo( Writer *writer )
{
	if ( ! show_header ) return;

	Lang lang;
	wxString s;
	s.Printf( wxT ( "%s %d" ), (const wxChar*)lang.getMonthName( month-1 ), year );
	writer->writeHeader1( s );
}
Ejemplo n.º 13
0
/*****************************************************
**
**   EphemExpert   ---   writeDetails
**
******************************************************/
void EphemExpert::writeDetails( Writer *writer )
{
	int i;
	wxString s, tz_str, thetime;
	Lang lang;
	Formatter *formatter = Formatter::get();
	TzUtil tzu;

	if ( ! cdetails ) calcDetails();

	s.Printf( wxT ( "%s %d" ), (const wxChar*)lang.getMonthName( month-1 ), year );
	writer->writeHeader1( s );

	int line = 1;
	int nb_leaps = 0;
	for ( i = 0; i < nb_days; i++ )
	{
		if ( i > 0 && weekday[i] == 0 ) nb_leaps++;
	}
	Table table( 5, nb_days+1+nb_leaps );
	table.setHeader( 0, _( "Day" ));
	table.setHeader( 1, _( "Sidereal Time" ));
	table.setHeader( 2, _( "Sunrise" ));
	table.setHeader( 3, _( "Sunset" ));
	table.setHeader( 4, _( "Tithi (Sunrise)" ));

	line = 1;
	for ( i = 0; i < nb_days; i++ )
	{
		// blank line on weekend
		if ( i > 0 && weekday[i] == 0 )
		{
			for ( int j = 0; j < 5; j++ ) table.setHeaderEntry( j, line, wxEmptyString );
			line++;
		}

		s.Printf( wxT( "%02d %s" ), i+1, (const wxChar*)lang.getWeekdayName( weekday[i] ).Left(2) );
		if ( testDayIndexForCurrent( i+1 )) table.setHeaderEntry( 0, line, s );
		else	table.setEntry( 0, line, s );

		table.setEntry( 1, line, formatter->getTimeFormatted( st[i] ) );

		TzFormattedDate fd = tzu.getDateFormatted( sunrise[i], isLocaltime );
		thetime = fd.timeFormatted;
		//if ( dstchange ) thetime << wxT( " " ) << fd.timezoneFormatted;
		table.setEntry( 2, line, thetime );

		fd = tzu.getDateFormatted( sunset[i], isLocaltime );
		table.setEntry( 3, line, fd.timeFormatted );

		table.setEntry( 4, line, lang.getTithiName( tithi[i] ));
		line++;
	}
	writer->writeTable( table );
}
Ejemplo n.º 14
0
/*****************************************************
**
**   GenericTableWriter   ---   writeSignQualities
**
******************************************************/
void GenericTableWriter::writeSignQualities( const uint &i0, const TcColumnSet &set )
{
	Lang lang;
  table->setHeader( i0,  _( "Quality" ));
	ObjectPosition pos;
	for ( uint p = 0; p < obs.size(); p++ )
	{
		pos = getObjectPosition( obs[p], set );
		table->setEntry( i0, p + 1, lang.getSignQualityName( getRasi( pos.longitude )));
	}
}
Ejemplo n.º 15
0
/*****************************************************
**
**   GenericTableWriter   ---   writeDignities
**
******************************************************/
void GenericTableWriter::writeDignities( const uint &i0, const TcColumnSet& )
{
	Lang lang;
  table->setHeader( i0,  _( "Dignity" ));

	for ( uint p = 0; p < obs.size(); p++ )
	{
		if ( obs[p] >= OSUN && obs[p] <= OSATURN )
		{
			table->setEntry( i0, p + 1, lang.getDignityName( h->getVargaData( obs[p], V_RASI )->getDignity(), format ));
		}
	}
}
Ejemplo n.º 16
0
// unused
const wxString Formatter::getLenString( const double &len, const int format, const int dir )
{
	wxString s;
	Lang lang;

	s << ( dir == 1 ? 'R' : 'D' );

	double mylen = red_deg( len );
	const int sign = (int)( mylen / 30 );
	mylen -= 30 * sign;

	s << getDegMinSecFormatted( mylen, format, 0.0, 30.0 ) << lang.getSignName(sign);
	return s;
}
Ejemplo n.º 17
0
/*****************************************************
**
**   HoraExpert   ---   write
**
******************************************************/
void HoraExpert::write( Sheet *sheet, const bool isLocaltime )
{
	TzUtil tzu;
	wxString s;
	TzFormattedDate fd;
	Lang lang;
	SheetFormatter fmt;

	double corr = ( location->getTimeZone() + location->getDST()) / 24;

	Table *table = new Table( 7, 13 );
	if ( config->view->showTextViewHeaders ) table->setHeader( _( "Hora" ));

	table->setHeader( 0,  _( "Begin" ));
	table->setHeader( 1,  _( "Lord" ));
	table->setHeader( 2,  _( "End" ));
	//table->setHeader( 3,  wxEmptyString );
	table->setHeader( 4,  _( "Begin" ));
	table->setHeader( 5,  _( "Lord" ));
	table->setHeader( 6,  _( "End" ));
	int line = 1;
	int colskip = 0;
	for ( int i = 0; i < 24; i++ )
	{
		if ( i == 12 )
		{
			colskip = 4;
			line = 1;
		}

		table->setEntry( 3, line, wxEmptyString );
		fd = tzu.getDateFormatted( horaStart[i] + corr, isLocaltime );
		table->setEntry( colskip, line, fd.timeFormatted );

		table->setEntry( 1+colskip, line, fmt.getObjectName( horaLord[i], TF_LONG ));

		fd = tzu.getDateFormatted( horaStart[i+1] + corr, isLocaltime );
		table->setEntry( 2+colskip, line, fd.timeFormatted );
		line++;
	}
	sheet->addItem( table );

	sheet->addLine( wxString::Format( wxT( "%s: %s" ), _( "Lord of the day" ),
		lang.getObjectName( getDinaLord(), TF_LONG ).c_str()));
	sheet->addLine( wxString::Format( wxT( "%s: %s" ), _( "Lord of the month" ),
		lang.getObjectName( getMasaLord(), TF_LONG ).c_str()));
	sheet->addLine( wxString::Format( wxT( "%s: %s" ), _( "Lord of the year" ),
		lang.getObjectName( getVarshaLord(), TF_LONG ).c_str() ));
}
Ejemplo n.º 18
0
/*****************************************************
**
**   GenericTableWriter   ---   writeNakshatras
**
******************************************************/
void GenericTableWriter::writeNakshatras( const uint &i0, const TcColumnSet &set )
{
	Lang lang;
  //table->setHeader( i0, _( "Nakshatra" ));
  wxString header = _( "Nakshatra" );
	if ( format == TF_SHORT ) header = header.Left( 3 );
  table->setHeader( i0, header );
	assert( table->getNbRows() > obs.size() );

	for ( uint p = 0; p < obs.size(); p++ )
	{
		table->setEntry( i0, p + 1,
			lang.getNakshatra27Name( ::getNakshatra27( getObjectPosition( obs[p], set ).longitude ), format ));
	}
}
Ejemplo n.º 19
0
/*****************************************************
**
**   Painter   ---   getTextExtent
**
******************************************************/
MPoint Painter::getTextExtent( const MToken &token )
{
	const wxFont oldFont = getCurrentFont();
	wxString s;
	Lang lang;
	SheetFormatter formatter( writercfg );
	MPoint p;

	wxChar symbol = 0;
	SymbolProvider sp( writercfg );
	switch ( token.entity )
	{
		case TTSE_PLANET:
			if ( writercfg->planetSymbols ) symbol = sp.getPlanetCode( (ObjectId)token.entityId );
			if ( ! symbol ) s = formatter.getObjectNamePlain( (ObjectId)token.entityId, token.textFormat, token.vedic );
		break;
		case TTSE_SIGN:
			if ( writercfg->signSymbols ) symbol = sp.getSignCode( (Rasi)token.entityId );
			if ( ! symbol ) s = lang.getSignName( (Rasi)token.entityId, token.textFormat ); //, writercfg->vedicSignNames );
		break;
		case TTSE_ASPECT:
			symbol = SymbolProvider().getAspectCode( (ASPECT_TYPE)token.entityId );
			if ( ! symbol ) s = AspectExpert::getAspectShortDescription( (int)token.entityId );
		break;
		case TTSE_DIRECTION:
			symbol = sp.getRetroCode( (MOVING_DIRECTION)token.entityId );
			if ( ! symbol ) s = wxT( "R" );
		break;
		default:
			symbol = 0;
			s = token.text;
		break;
	}
	if ( symbol )
	{
		const int pointSize = oldFont.GetPointSize();
		setFont( *FontProvider::get()->getFontBySize( FONT_GRAPHIC_SYMBOLS, pointSize ));
		p = getTextExtent( symbol );
	}
	else
	{
		p = getTextExtent( s );
	}

	setFont( oldFont );
	return p;
}
Ejemplo n.º 20
0
/*****************************************************
**
**   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 );
	}
}
Ejemplo n.º 21
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;
}
Ejemplo n.º 22
0
/*****************************************************
**
**   TextHelper   ---   writeBhavas
**
******************************************************/
void TextHelper::writeBhavas()
{
  int i;
  Lang lang;
  wxString s;
  double len;

  if ( show_header ) writer->writeHeader1( _( "Bhavas" ));
  Table table( 3, 13 );
  table.setHeader( 0,  _( "Bhava" ));
  table.setHeader( 1,  _( "Cusp" ));
  table.setHeader( 2,  _( "Sandhi" ));

  int line = 1;
  for( i = HOUSE1; i <= HOUSE12; i++ )
  {
    table.setEntry( 0, line, lang.getBhavaName( i ));
    table.setEntry( 1, line, writer->getPosFormatted( horoscope->getHouse(i, true, false), false ));
    table.setEntry( 2, line, writer->getPosFormatted( horoscope->getHouse(i, true, true), false ));
    line++;
  }

  writer->writeTable( table );

  vector<int> obs = chartprops->getPlanetList();
  writer->writeHeader2( _( "Planets in Bhavas" ));
  Table t2( 4, obs.size() + 1 );
  t2.setHeader( 0,  _( "Planet" ));
  t2.setHeader( 1,  _( "Length" ));
  t2.setHeader( 2,  _( "Bhava" ));
  t2.setHeader( 3,  _( "Bhava#" ));
  line = 1;
  for( unsigned int p = 0; p < obs.size(); p++ )
  {
    i = obs[p];
    len = horoscope->getVedicLength( i );
    t2.setEntry( 0, line, writer->getObjectName( i, TLARGE, true ));
    t2.setEntry( 1, line, writer->getPosFormatted( len, horoscope->isRetrograde( i )));
    t2.setEntry( 2, line, lang.getBhavaName( horoscope->getHousePos( i, true )));
    t2.setEntry( 3, line, wxString() << horoscope->getHousePos( i, true )+1);
    line++;
  }
  writer->writeTable( t2 );
}
Ejemplo n.º 23
0
/*****************************************************
**
**   GenericTableWriter   ---   writeDasaVarga
**
******************************************************/
void GenericTableWriter::writeDasaVarga( const uint &i0, const TcColumnSet& )
{
	VargaExpert expert;
	Lang lang;
	VedicPlanet *planet;
	int dignity;

  table->setHeader( i0,  _( "D-10" ));
	for ( uint p = 0; p < obs.size(); p++ )
	{
		if ( obs[p] <= OSATURN )
		{
			planet = h->getPlanet( obs[p] );
			dignity = planet->getVimsopakaBalaGoodVargas( 2 );

			if ( dignity <= 1 ) table->setEntry( i0, p + 1, wxString::Format( wxT( "%d" ), dignity ));
			else table->setEntry( i0, p + 1, wxString::Format( wxT( "%s (%d)" ), lang.getVimsopakaDignityName( 2, dignity ).c_str(), dignity ));
		}
	}
}
Ejemplo n.º 24
0
/*****************************************************
**
**   PdfPainter   ---   drawSignSymbol
**
******************************************************/
void PdfPainter::drawSignSymbol( const int&x, const int &y, const int &sign, const int type, const int zoom, const double angle )
{
	Lang lang;
	double w, h;
	wxString s;

	if ( type == 2 ) s = textwriter->getSignName( sign, TSHORT );
	else s = lang.getSignSymbolCode( sign, type );
	getTextExtent( s, &w, &h );

	/*
	setTransparentBrush();
	setDefaultPen();
	drawRectangle( x-3, y-3, 6, 6 );
	drawRectangle( x-10, y-10, 20, 20 );
	*/

	double x4 = x - .5 * w * cos( .25 * PI + angle * DEG2RAD );
	double y4 = y + .5 * h * sin( .25 * PI + angle * DEG2RAD );

	pdf->RotatedText( x4, y4, s, angle );
}
Ejemplo n.º 25
0
/*****************************************************
**
**   TextHelper   ---   writeWesternPlanetReport
**
******************************************************/
int TextHelper::writeWesternPlanetReport()
{
	wxString s;
	double len;
	Lang lang;
	int ret = 0;

	if ( show_header ) writer->writeHeader1( _( "Western Planets" ));
	vector<int> obs = chartprops->getWesternPlanetList();
	Table table( 3, obs.size() + 13 );
	table.setHeader( 0,  _( "Planet" ));
	table.setHeader( 1,  _( "Length" ));
	table.setHeader( 2,  _( "House" ));
	table.col_alignment[0] = Align::Center;

	int line = 1;
	for ( unsigned int i = 0; i < obs.size(); i++ )
	{
		len = horoscope->getWesternLength( obs[i] );
		if ( len == 0 ) ret++;
		table.setEntry( 0, line, writer->getObjectName( obs[i], TLARGE, false ) );
		table.setEntry( 1, line, writer->getPosFormatted( len, horoscope->isRetrograde( obs[i] ), DEG_PRECISION_SECOND ) );
		s.Printf( wxT( "%02d" ), horoscope->getHousePos( i, false ) + 1 );
		table.setEntry( 2, line, s );
		line++;
	}
	for ( int i = 0; i < 12; i++ )
	{
		if ( config->useVedicPlanetNames ) s = lang.getBhavaName( i );
		else s.Printf( wxT( "%02d" ), i+1 );
		table.setEntry( 0, line, s );
		table.setEntry( 1, line, writer->getPosFormatted( horoscope->getHouse( i, false ), false ) );
		line++;
	}
	writer->writeTable( table );
	return ret;
}
Ejemplo n.º 26
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;
}
Ejemplo n.º 27
0
/*****************************************************
**
**   EphemExpert   ---   writeKp
**
******************************************************/
void EphemExpert::writeKp( Writer *writer, const int &dasa )
{
	Lang lang;
	KPEvent *e;
	int d, m, y, lord, wd;
	vector<KPEvent>::iterator iter;
	TzUtil tzu;
	wxString s, thetime;
	vector<wxString> v;
	Table *table = 0;
	DasaExpert *expert = DasaExpertFactory::get()->getDasaExpert( dasa );
	if ( ! expert->hasKpFeatures() || dasa == 2 )
	{
		s.Printf( _( "K.P. events not supported for %s Dasa." ), expert->getName());
		writer->writeLine( s );
		return;
	}

	Formatter *formatter = Formatter::get();
	if ( ! chartprops->isVedic() )
	{
		writer->writeLine( _( "Not supported in western mode." ));
		return;
	}
	if ( ! ckp || mydasa != dasa ) calcKP( dasa );
	writeHeaderInfo( writer );

	//s.Printf( _( "%s Dasa" ), expert->getName());
	//writer->writeParagraph( s );

	lord = -1;
	int line = 1;
	int index = -1;
	for ( iter = kpevents.begin(); iter != kpevents.end(); iter++ )
	{
		e = (KPEvent*)(&(*iter));
		if ( e->dasaindex != index )
		{
			index = e->dasaindex;
			if ( table )
			{
				if ( expert->isRasiDasaExpert()) writer->writeHeader2( writer->getSignName( lord, TLARGE ));
				else writer->writeHeader2( writer->getObjectName( lord, TLARGE ));
				writer->writeTable( *table );
				delete table;
				table = 0;
			}
			table = new Table ( 5, 10 );
			table->setHeader( 0, _( "Day" ));
			table->setHeader( 1, _( "Time" ));
			table->setHeader( 2, _( "Lord" ));
			table->setHeader( 3, _( "Sublord" ));
			table->setHeader( 4, _( "Lunar Position" ));
			line = 1;
		}
		assert( table );
		formatter->getDateIntsFromJD( e->jd, d, m, y );
		wd = ((int)(e->jd + 1.5 )) % 7;
		assert( wd >= 0 && wd < 7 );
		s.Printf( wxT( "%02d %s" ), d, (const wxChar*)wxString( (const wxChar*)lang.getWeekdayName( wd )).Left(2) );
		table->setEntry( 0, line, s );

		TzFormattedDate fd = tzu.getDateFormatted( e->jd, isLocaltime );
		thetime = fd.timeFormatted;
		//if ( dstchange ) thetime << wxT( " " ) << fd.timezoneFormatted;
		table->setEntry( 1, line, thetime );
		//table->setEntry( 1, line, formatter->getTimeFormatted( getTimeFromJD( e->jd  + tz/24 )) );

		if ( expert->isRasiDasaExpert() )
		{
			table->setEntry( 2, line, writer->getSignName( e->lord, TLARGE ));
			table->setEntry( 3, line, writer->getSignName( e->sublord, TLARGE ));
		}
		else
		{
			table->setEntry( 2, line, writer->getObjectName( e->lord, TLARGE ));
			table->setEntry( 3, line, writer->getObjectName( e->sublord, TLARGE ));
		}
		table->setEntry( 4, line, writer->getPosFormatted( e->len, false ) );

		lord = e->lord;
		line++;
	}
	if ( table )
	{
		if ( expert->isRasiDasaExpert() )	writer->writeHeader2( writer->getSignName( e->lord, TLARGE ));
		else writer->writeHeader2( writer->getObjectName( e->lord, TLARGE ));
		writer->writeTable( *table );
		delete table;
		table = 0;
	}
}
Ejemplo n.º 28
0
/*****************************************************
**
**   GenericTableWriter   ---   writeCustomDataEntry
**
******************************************************/
void GenericTableWriter::writeCustomDataEntry( const uint &col, const uint &row, const TAB_CELL_TYPE &type )
{
	assert( table->getNbCols() > col );
	assert( table->getNbRows() > row );
	Formatter *f = Formatter::get();
	DateTimeFormatter *df = DateTimeFormatter::get();
	Lang lang;
	wxString s;
	
	switch( type )
	{
		case TAB_CELL_NAME:
			table->setEntry( col, row,  _( "Name" ));
			table->setEntry( col + 1, row, h->getHName() );
		break;
		case TAB_CELL_FULL_DATE:
		{
			table->setEntry( col, row,  _( "Date" ));
			Location *loc = h->getDataSet()->getLocation();
			table->setEntry( col + 1, row, df->formatDateString( h->getJD(), loc->getTimeZone() + loc->getDST()));
		}
		break;
		case TAB_CELL_LOCAL_TIME:
		{
			table->setEntry( col, row,  _( "Local Time" ));
			Location *loc = h->getDataSet()->getLocation();
			table->setEntry( col + 1, row, f->getTimeFormatted( a_red( getTimeFromJD( h->getDataSet()->getDate()->getJD()) + loc->getTimeZone() + loc->getDST(), 24 )));
		}
		break;
		case TAB_CELL_LOCATION_NAME:
			table->setEntry( col, row,  _( "Location" ));
			table->setEntry( col + 1, row, h->getDataSet()->getLocation()->getLocName() );
		break;
		case TAB_CELL_LOCATION_LONGITUDE:
		{
			table->setEntry( col, row,  _( "Longitude" ));
			Location *loc = h->getDataSet()->getLocation();
			table->setEntry( col + 1, row, f->getLongitudeFormatted( loc->getLongitude()));
		}
		break;
		case TAB_CELL_LOCATION_LATITUDE:
		{
			table->setEntry( col, row,  _( "Latitude" ));
			Location *loc = h->getDataSet()->getLocation();
			table->setEntry( col + 1, row, f->getLatitudeFormatted( loc->getLatitude()));
		}
		break;
		case TAB_CELL_TZ_NAME:
		{
			table->setEntry( col, row,  _( "Time Zone" ));
			Location *loc = h->getDataSet()->getLocation();
			const double tz = loc->getTimeZone();
			table->setEntry( col + 1, row, wxString::Format( wxT( "%s %c%.1f" ), _( "UT" ), ( tz >= 0 ? '+' : ' ' ), tz ));
		}
		break;
		case TAB_CELL_DST:
		{
			table->setEntry( col, row,  _( "Daylight Saving" ));
			Location *loc = h->getDataSet()->getLocation();
			table->setEntry( col + 1, row, wxString::Format( wxT( "%.1f" ), loc->getDST()));
		}
		break;
		case TAB_CELL_UNIVERSAL_TIME:
			table->setEntry( col, row,  _( "Universal Time" ));
			table->setEntry( col + 1, row, f->getTimeFormatted( getTimeFromJD( h->getJD() )));
		break;
		case TAB_CELL_SIDEREAL_TIME:
			table->setEntry( col, row,  _( "Sidereal Time" ));
			table->setEntry( col + 1, row, f->getTimeFormatted( h->getSiderealTime()));
		break;
		case TAB_CELL_JULIAN_DATE:
			table->setEntry( col, row,  _( "Julian Date" ));
			table->setEntry( col + 1, row, wxString::Format( wxT( "%8.5f" ), h->getJD()));
		break;
		case TAB_CELL_SUNRISE:
		{
			table->setEntry( col, row,  _( "Sunrise" ));
			Location *loc = h->getLocation();
			if ( h->getSunrise() != 0 )
			{
				s = f->getTimeFormatted( getTimeFromJD( h->getSunrise() + ( loc->getTimeZone() + loc->getDST()) / 24.0 ));
			}
			else s = _( "n.a." );
			table->setEntry( col + 1, row, s );
		}
		break;
		case TAB_CELL_SUNSET:
		{
			table->setEntry( col, row,  _( "Sunset" ));
			Location *loc = h->getLocation();
			if ( h->getSunset() != 0 )
			{
				s = f->getTimeFormatted( getTimeFromJD( h->getSunset() + ( loc->getTimeZone() + loc->getDST()) / 24.0 ));
			}
			else s = _( "n.a." );
			table->setEntry( col + 1, row, s );
		}
		break;
		case TAB_CELL_VEDIC_AYANAMSA:
			table->setEntry( col, row,  _( "Vedic Ayanamsa" ));
			table->setEntry( col + 1, row, f->getAyanamsaNameAndValue( h->getAyanamsaType( true ), h->getAyanamsa( true )));
		break;
		case TAB_CELL_WESTERN_AYANAMSA:
			table->setEntry( col, row,  _( "Western Ayanamsa" ));
			table->setEntry( col + 1, row, f->getAyanamsaNameAndValue( h->getAyanamsaType( false ), h->getAyanamsa( false )));
		break;
		case TAB_CELL_VARNA:
			table->setEntry( col, row,  _( "Varna" ));
			table->setEntry( col + 1, row, lang.getVarnaName( getVarna( h->getVedicLongitude( OMOON ))));
		break;
		case TAB_CELL_GANA:
			table->setEntry( col, row,  _( "Gana" ));
			table->setEntry( col + 1, row, lang.getGanaName( NakshatraExpert().getGana( h->getVedicLongitude( OMOON ))));
		break;
		case TAB_CELL_YONI:
		{
			Yoni yoni = NakshatraExpert().getYoni( h->getVedicLongitude( OMOON ));
			table->setEntry( col, row,  _( "Yoni" ));
			table->setEntry( col + 1, row, yoni.name );
		}
		break;
		case TAB_CELL_NADI:
			table->setEntry( col, row,  _( "Nadi" ));
			table->setEntry( col + 1, row, lang.getNadiName( NakshatraExpert().getNadi( h->getVedicLongitude( OMOON ))));
		break;
		case TAB_CELL_RAJJU:
		{
			Rajju rajju = NakshatraExpert().getRajju( getNakshatra27( h->getVedicLongitude( OMOON )));
			table->setEntry( col, row,  _( "Rajju" ));
			table->setEntry( col + 1, row, lang.getRajjuName( rajju.aroha, rajju.type ));
		}
		break;
		case TAB_CELL_INCFLUENCE_TIME:
		{
			DasaExpert *expert = DasaExpertFactory().getDasaExpert( D_VIMSOTTARI, h );
			table->setEntry( col, row,  _( "Influence" ));
			table->setEntry( col + 1, row, expert->getDasaLordNameF( expert->getBirthMahaDasaLord(), TF_LONG ));
		}
		break;

		case TAB_CELL_LUNAR_TITHI:
		{
			double angle = red_deg( h->getVedicLongitude( OMOON ) - h->getVedicLongitude( OSUN ));
			table->setEntry( col, row,  _( "Lunar Tithi" ));
			table->setEntry( col + 1, row,  lang.getTithiName( angle / 12 ));
		}
		break;
		case TAB_CELL_WEEKDAY:
			table->setEntry( col, row,  _( "Weekday" ));
			table->setEntry( col + 1, row,  lang.getWeekdayName( h->getDataSet()->getWeekDay() ));
		break;

		case TAB_CELL_HORA_LORD:
		case TAB_CELL_DINA_LORD:
		case TAB_CELL_MASA_LORD:
		case TAB_CELL_VARSHA_LORD:
			writeHoraEntry( col, row, type );
		break;
		default:
			table->setEntry( col, row,  wxString::Format( wxT( "Error, wrong custom data entry id %d" ), (int)type ));
		break;
	};
}
Ejemplo n.º 29
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;
}
Ejemplo n.º 30
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;
}