Commit de37bbad authored by jean-pierre charras's avatar jean-pierre charras

Gerbview: fixed an issue with some gerber files. Added Image Justify support (partial support).

parent a911720a
......@@ -151,6 +151,9 @@ void GERBER_IMAGE::ResetDefaultValues()
m_FileName.Empty();
m_ImageName = wxT( "no name" ); // Image name from the IN command
m_ImageNegative = false; // true = Negative image
m_ImageJustifyOffset = wxPoint(0,0); // Image justify Offset
m_ImageJustifyXCenter = false; // Image Justify Center on X axis (default = false)
m_ImageJustifyYCenter = false; // Image Justify Center on Y axis (default = false)
m_GerbMetric = false; // false = Inches (default), true = metric
m_Relative = false; // false = absolute Coord,
// true = relative Coord
......@@ -271,3 +274,45 @@ void GERBER_IMAGE::StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem )
}
}
}
/** Function DisplayInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Display info about Image Parameters.
*/
void GERBER_IMAGE::DisplayImageInfo( void )
{
wxString msg;
m_Parent->ClearMsgPanel();
// Display Image name
m_Parent->AppendMsgPanel( _( "Image name" ), m_ImageName, BROWN );
// Display graphic layer number
msg.Printf( wxT( "%d" ), m_GraphicLayer + 1 );
m_Parent->AppendMsgPanel( _( "Graphic layer" ), msg, BROWN );
// This next info can be see as debug info, so it can be disabled
// Display rotation
msg.Printf( wxT( "%d" ), m_ImageRotation / 10 );
m_Parent->AppendMsgPanel( _( "Rotation" ), msg, CYAN );
// Display Image justification;
msg = m_ImageJustifyXCenter ? _("Center") : _("Normal");
m_Parent->AppendMsgPanel( _( "X Justify" ), msg, DARKRED );
msg = m_ImageJustifyYCenter ? _("Center") : _("Normal");
m_Parent->AppendMsgPanel( _( "Y Justify" ), msg, DARKRED );
if( g_UserUnit == INCHES )
msg.Printf( wxT( "X=%f Y=%f" ), (double) m_ImageJustifyOffset.x/10000,
(double) m_ImageJustifyOffset.y/10000 );
else
msg.Printf( wxT( "X=%f Y=%f" ), (double) m_ImageJustifyOffset.x*2.54/1000,
(double) m_ImageJustifyOffset.y*2.54/1000 );
m_Parent->AppendMsgPanel( _( "Image Justify Offset" ), msg, CYAN );
}
......@@ -86,6 +86,9 @@ public:
wxString m_ImageName; // Image name, from IN <name>* command
int m_GraphicLayer; // Graphic layer Number
bool m_ImageNegative; // true = Negative image
bool m_ImageJustifyXCenter; // Image Justify Center on X axis (default = false)
bool m_ImageJustifyYCenter; // Image Justify Center on Y axis (default = false)
wxPoint m_ImageJustifyOffset; // Image Justify Offset on XY axis (default = 0,0)
bool m_GerbMetric; // false = Inches, true = metric
bool m_Relative; // false = absolute Coord, true = relative Coord
bool m_NoTrailingZeros; // true: remove tailing zeros.
......@@ -236,6 +239,13 @@ public:
* @param aItem = the item to repeat
*/
void StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem );
/** Function DisplayImageInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Display info about Image Parameters.
*/
void DisplayImageInfo( void );
};
......
......@@ -120,7 +120,7 @@ wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition )
* For instance: Rotation must be made after or before mirroring ?
* Note: if something is changed here, GetYXPosition must reflect changes
*/
wxPoint abPos = aXYPosition;
wxPoint abPos = aXYPosition + m_imageParams->m_ImageJustifyOffset;
if( m_swapAxis )
EXCHG( abPos.x, abPos.y );
......@@ -165,7 +165,7 @@ wxPoint GERBER_DRAW_ITEM::GetXYPosition( const wxPoint& aABPosition )
xyPos -= m_layerOffset + m_imageParams->m_ImageOffset;
if( m_swapAxis )
EXCHG( xyPos.x, xyPos.y );
return xyPos;
return xyPos - m_imageParams->m_ImageJustifyOffset;
}
......@@ -458,7 +458,7 @@ void GERBER_DRAW_ITEM::DrawGbrPoly( EDA_Rect* aClipBox,
/** Function DisplayInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Display info about the track segment only, and does not calculate the full track length
* Display info about this GERBER item
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
void GERBER_DRAW_ITEM::DisplayInfo( WinEDA_DrawFrame* frame )
......@@ -473,13 +473,6 @@ void GERBER_DRAW_ITEM::DisplayInfo( WinEDA_DrawFrame* frame )
msg.Printf( wxT( "%d" ), m_DCode );
frame->AppendMsgPanel( _( "D Code" ), msg, RED );
// Display Image name
if( m_imageParams )
{
msg = m_imageParams->m_ImageName;
frame->AppendMsgPanel( _( "Image name" ), msg, BROWN );
}
// Display graphic layer number
msg.Printf( wxT( "%d" ), GetLayer() + 1 );
frame->AppendMsgPanel( _( "Graphic layer" ), msg, BROWN );
......
......@@ -209,7 +209,7 @@ public:
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* Display info about the track segment and the full track length
* Display info about this GERBER item
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
void DisplayInfo( WinEDA_DrawFrame* frame );
......
......@@ -37,6 +37,12 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
DrawStruct = GerberGeneralLocateAndDisplay();
GetScreen()->SetCurItem( DrawStruct );
if( DrawStruct == NULL )
{
GERBER_IMAGE* gerber = g_GERBER_List[getActiveLayer() ];
if( gerber )
gerber->DisplayImageInfo( );
}
}
}
......
G04 Test image justify 1*
G04 Crosshairs should be justified to the X axis *
G04 and 0.5 inches offset from Y axis *
G04 Handcoded by Julian Lamb *
%MOIN*%
%FSLAX23Y23*%
%IJB.5*%
%ADD10C,0.050*%
G04 Crosshairs *
X-1000Y0D02*
G54D10*
X1000Y0D01*
X0Y-1000D02*
G54D10*
X0Y1000D01*
M02*
G04 Test image offset *
G04 Crosshairs should be centered on 0,0 in final rendering*
G04 Handcoded by Julian Lamb *
%MOIN*%
%FSLAX23Y23*%
%IOA-2.0B-1.0*%
%ADD10C,0.050*%
G04 Crosshairs to be on 0,0 *
X1000Y1000D02*
G54D10*
X3000Y1000D01*
X2000Y0D02*
G54D10*
X2000Y2000D01*
M02*
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment