コード例 #1
0
ファイル: Lang.cpp プロジェクト: akshaykinhikar/maitreya7
// 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;
}
コード例 #2
0
ファイル: Painter.cpp プロジェクト: martin-pe/maitreya8
/*****************************************************
**
**   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;
}
コード例 #3
0
/*****************************************************
**
**   VedicRasiChart   ---   paintNorth
**
******************************************************/
void VedicRasiChart::paintNorth()
{
	Lang lang;
	wxString s;
	int current, i;

	// used for sign number/symbol display
	const double rtol = xmax / 15.0;

	// used for free space in the middle of the chart (leave free for center string if required)
	const double mtol = xmax / 100.0;

	// 1/4 of the chart
	const double xi = .5 * xr;
	const double yi = .5 * yr;

	// middle square for separation of 2 charts (transit or partner mode)
	const double ri_prop = .4;
	const double xm = ri_prop * xi + ( 1 - ri_prop ) * xr;
	const double ym = ri_prop * yi + ( 1 - ri_prop ) * yr;

	// text separation from chart border
	const double text_border = xr / 30.0;

	// Rasi coordinates in single mode
	const MyRect rasi_rect[12] = {
		MyRect( xcenter - xi, ycenter - yr, xr, yr ),
		MyRect( xcenter - xr, ycenter - yr, xr, yi ),
		MyRect( xcenter - xr, ycenter - yr, xr, yr ),
		MyRect( xcenter - xr, ycenter - yi, xr, yr ),
		MyRect( xcenter - xr, ycenter, xi, yr ),
		MyRect( xcenter - xr, ycenter + yi, xr, yi ),

		MyRect( xcenter - xi, ycenter, xr, yr ),
		MyRect( xcenter, ycenter + yi, xr, yi ),
		MyRect( xcenter, ycenter, xr, yr ),
		MyRect( xcenter, ycenter - yi, xr, yr ),
		MyRect( xcenter + xi, ycenter - yr, xi, yr ),
		MyRect( xcenter, ycenter - yr, xr, yi )
	};

	// Rasi coordinates for 2nd chart (only in double mode)
	const MyRect planet1_rect[12] = {
		MyRect( xcenter - xi, ycenter - ym, xr, xm ),
		MyRect( xcenter - xm, ycenter - ym, xi, ym ),
		MyRect( xcenter - xm, ycenter - yr, xr - xm, yr ),
		MyRect( xcenter - xm, ycenter - yi, xm, yr ),
		MyRect( xcenter - xm, ycenter, xr - xm, yr ),
		MyRect( xcenter - xr, ycenter + yi, xr, ym - yi ),

		MyRect( xcenter - xi, ycenter, xr, ym ),
		MyRect( xcenter + xi / 2, ycenter + yi, xi, ym - yi ),
		MyRect( xcenter + xi, ycenter, xm - xi, yr ),
		MyRect( xcenter, ycenter - yi, xm, yr ),
		MyRect( xcenter + xi, ycenter - ym, xm - xi, ym ),
		MyRect( xcenter + xi / 2, ycenter - ym, xi, ym - xi )
	};

	// Rasi coordinates for 2nd chart (only in double mode)
	const MyRect planet2_rect[12] = {
		MyRect( xcenter - xi, ycenter - yr, xr, yr - ym ),
		MyRect( xcenter - xr, ycenter - yr, xr, yr - ym ),
		MyRect( xcenter - xr, ycenter - yr, xr - xm, yr ),
		MyRect( xcenter - xr, ycenter - yi, xr - xm, yr ),
		MyRect( xcenter - xr, ycenter, xr - xm, yr ),
		MyRect( xcenter - xr, ycenter + ym, xr, yr - ym ),

		MyRect( xcenter - xi, ycenter + ym, xr, yr  - ym ),
		MyRect( xcenter, ycenter + ym, xr, yr - ym ),
		MyRect( xcenter + xm, ycenter, xr - xm, yr ),
		MyRect( xcenter + xm, ycenter - yi, xr - xm, yr ),
		MyRect( xcenter + xm, ycenter - yr, xr - xm, yr ),
		MyRect( xcenter, ycenter - yr, xr, yr - ym )
	};

	// Rectangles for sign names resp. numbers
	const MyRect sign_rect[12] = {
		MyRect( xcenter - rtol, ycenter - rtol, 2 * rtol, rtol ),
		MyRect( xcenter - xi - rtol / 2, ycenter - yi - rtol, rtol, rtol ),
		MyRect( xcenter - xi - rtol, ycenter - yi - rtol / 2, rtol, rtol ),
		MyRect( xcenter - 2 * rtol, ycenter - rtol, 2 * rtol, rtol ),
		MyRect( xcenter - xi - rtol, ycenter + yi - rtol / 2, rtol, rtol ),
		MyRect( xcenter - xi - rtol / 2, ycenter + yi, rtol, rtol ),

		MyRect( xcenter - rtol, ycenter, 2 * rtol, rtol ),
		MyRect( xcenter + xi - rtol / 2, ycenter + yi, rtol, rtol ),
		MyRect( xcenter + xi, ycenter + yi - rtol / 2, rtol, rtol ),
		MyRect( xcenter, ycenter - rtol, 2 * rtol, rtol ),
		MyRect( xcenter + xi, ycenter - yi - rtol / 2, rtol, rtol ),
		MyRect( xcenter + xi - rtol / 2, ycenter - yi - rtol, rtol, rtol )
	};

	// Text alignment for rasis
	const int rasi_alignment[12] = {
		Align::Center,
		Align::Top + Align::HCenter,
		Align::Left + Align::VCenter,
		Align::Center,
		Align::Left + Align::VCenter,
		Align::Bottom + Align::HCenter,

		Align::Center,
		Align::Bottom + Align::HCenter,
		Align::Right + Align::VCenter,
		Align::Center,
		Align::Right + Align::VCenter,
		Align::Top + Align::HCenter
	};

	// polygon coordinates for signs
	const MyPoint rasi_polygons[][12] = {
		{ MyPoint( xcenter-xi, ycenter - yi ), MyPoint( xcenter, ycenter ), MyPoint( xcenter+xi, ycenter - yi ), MyPoint( xcenter, ycenter - yr ) },
		{ MyPoint( xcenter-xr, ycenter - yr ), MyPoint( xcenter, ycenter-yr ), MyPoint( xcenter-xi, ycenter - yi ) },
		{ MyPoint( xcenter-xr, ycenter - yr ), MyPoint( xcenter-xr, ycenter ), MyPoint( xcenter-xi, ycenter - yi ) },
		{ MyPoint( xcenter-xr, ycenter ), MyPoint( xcenter-xi, ycenter+yi ), MyPoint( xcenter, ycenter ), MyPoint( xcenter-xi, ycenter - yi ) },
		{ MyPoint( xcenter-xr, ycenter + yr ), MyPoint( xcenter-xr, ycenter ), MyPoint( xcenter-xi, ycenter + yi ) },
		{ MyPoint( xcenter-xr, ycenter + yr ), MyPoint( xcenter, ycenter+yr ), MyPoint( xcenter-xi, ycenter + yi ) },

		{ MyPoint( xcenter-xi, ycenter+yi ), MyPoint( xcenter, ycenter+yr ), MyPoint( xcenter+xi, ycenter+yi ), MyPoint( xcenter, ycenter ) },
		{ MyPoint( xcenter, ycenter + yr ), MyPoint( xcenter+xr, ycenter+yr ), MyPoint( xcenter+xi, ycenter + yi ) },
		{ MyPoint( xcenter+xr, ycenter + yr ), MyPoint( xcenter+xr, ycenter ), MyPoint( xcenter+xi, ycenter + yi ) },
		{ MyPoint( xcenter, ycenter ), MyPoint( xcenter+xi, ycenter+yi ), MyPoint( xcenter+xr, ycenter ), MyPoint( xcenter+xi, ycenter-yi ) },
		{ MyPoint( xcenter+xr, ycenter - yr ), MyPoint( xcenter+xr, ycenter ), MyPoint( xcenter+xi, ycenter - yi ) },
		{ MyPoint( xcenter, ycenter - yr ), MyPoint( xcenter+xr, ycenter-yr ), MyPoint( xcenter+xi, ycenter - yi ) },
	};

	// rectangle for separation of double charts
	const MyRect transit_rect( xcenter - xm, ycenter - ym, 2 * xm, 2 * ym );

	// draw filled polygons
  GcZodiacalSigns *signs = &vconf->signs;
	if ( signs->needsBgPaint() )
	{
		painter->setTransparentPen();
		for ( i = ARIES; i <= PISCES; i++ )
		{
			painter->setBrush( signs->getBrush(redRasi( getAscendant() + i )));
			painter->drawPolygon( i % 3 ? 3 : 4, (MyPoint*)rasi_polygons[i] );
		}
	}

	paintOuterRectangle();

	painter->setPen( defaultPen );

	// diagonal from egde to egde paint one line or two depending on chart center
	if ( ! ( chartprops->getVedicGraphicStyle().centerInfoType == VGRAPHIC_CHART_CENTER_NOTHING ))
	{
		painter->drawLine( xcenter - xr, ycenter - yr, xcenter - mtol, ycenter - mtol );
		painter->drawLine( xcenter + mtol, ycenter + mtol, xcenter + xr, ycenter + yr );

		painter->drawLine( xcenter - xr, ycenter + yr, xcenter - mtol, ycenter + mtol );
		painter->drawLine( xcenter + mtol , ycenter - mtol, xcenter + xr, ycenter - yr );
	}
	else
	{
		painter->drawLine( xcenter - xr, ycenter - yr, xcenter + xr, ycenter + yr );
		painter->drawLine( xcenter - xr, ycenter + yr, xcenter + xr, ycenter - yr );
	}

	painter->drawLine( xcenter, ycenter + yr, xcenter + xr, ycenter );
	painter->drawLine( xcenter, ycenter + yr, xcenter - xr, ycenter );
	painter->drawLine( xcenter, ycenter - yr, xcenter - xr, ycenter );
	painter->drawLine( xcenter, ycenter - yr, xcenter + xr, ycenter );

	if ( chart_count == 2 ) painter->drawRectangle( transit_rect );

	/*********************************************************
	**  draw number of houses
	*********************************************************/
	if ( ! ( chartprops->getVedicGraphicStyle().northIndianSignDisplayType == VGRAPHIC_NORTH_INDIAN_SYMBOL )) painter->setGraphicFont( textzoom );
	else painter->setSymbolFont( symbolzoom );

	for ( i = ARIES; i <= PISCES; i++ )
	{
		current = redRasi( getAscendant() + i );
		switch( chartprops->getVedicGraphicStyle().northIndianSignDisplayType )
		{
			case VGRAPHIC_NORTH_INDIAN_ASC:
				s.Printf( wxT( "%d" ),  current + 1 );
			break;
			case VGRAPHIC_NORTH_INDIAN_NUMBER:
				s.Printf( wxT( "%d" ),  current + 1 );
			break;
			case VGRAPHIC_NORTH_INDIAN_SHORT:
			{
				s = lang.getSignName( current, TSHORT );
			}
			break;
			default:
				s = lang.getSignSymbolCode( current );
			break;
		}
		painter->drawSimpleText( sign_rect[i], s );

		// leave after ascendant for style == 0
		if ( chartprops->getVedicGraphicStyle().northIndianSignDisplayType == VGRAPHIC_NORTH_INDIAN_ASC ) break;
	}
	painter->setGraphicFont( textzoom );

	/*********************************************************
	**  draw planets
	*********************************************************/
	if ( ! chartprops->isBlank() )
	{

		for ( i = ARIES; i <= PISCES; i++ )
		{
			if ( chart_count == 1 ) drawFieldText( rasi_rect[i], redRasi( i + getAscendant() ), rasi_alignment[i], 0, text_border );
			else
			{
				drawFieldText( planet1_rect[i], redRasi( i + getAscendant() ), rasi_alignment[i], 0, text_border );
				drawFieldText( planet2_rect[i], redRasi( i + getAscendant() ), rasi_alignment[i], 1, text_border );
			}
		}

		paintCenterString();
	}
	painter->setGraphicFont( textzoom );
}