Plot functions: some enhancements in mirror mode (Pcbnew specific): boards are mirrored horizontally, and the page layout is no more mirrored, and therefore is always readable.

This commit is contained in:
jean-pierre charras
2013-12-06 19:31:15 +01:00
parent 936ffcaabc
commit 3d4fa72b51
9 changed files with 96 additions and 40 deletions
+22 -9
View File
@@ -30,7 +30,9 @@ PLOTTER::PLOTTER( )
defaultPenWidth = 0;
currentPenWidth = -1; // To-be-set marker
penState = 'Z'; // End-of-path idle
plotMirror = false; // Mirror flag
m_plotMirror = false; // Mirror flag
m_mirrorIsHorizontal = true;
m_yaxisReversed = false;
outputFile = 0;
colorMode = false; // Starts as a BW plot
negativeMode = false;
@@ -74,16 +76,27 @@ bool PLOTTER::OpenFile( const wxString& aFullFilename )
* scale factor, and offsets trace. Also convert from a wxPoint to DPOINT,
* since some output engines needs floating point coordinates.
*/
DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& pos )
DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& aCoordinate )
{
double x = (pos.x - plotOffset.x) * plotScale * iuPerDeviceUnit;
double y;
wxPoint pos = aCoordinate - plotOffset;
double x = pos.x * plotScale;
double y = ( paperSize.y - pos.y * plotScale );
if( m_plotMirror )
{
if( m_mirrorIsHorizontal )
x = ( paperSize.x - pos.x * plotScale );
else
y = pos.y * plotScale;
}
if( m_yaxisReversed )
y = paperSize.y - y;
x *= iuPerDeviceUnit;
y *= iuPerDeviceUnit;
if( plotMirror )
y = ( pos.y - plotOffset.y ) * plotScale * iuPerDeviceUnit ;
else
y = ( paperSize.y - ( pos.y - plotOffset.y )
* plotScale ) * iuPerDeviceUnit ;
return DPOINT( x, y );
}