Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
de37bbad
Commit
de37bbad
authored
Oct 17, 2010
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gerbview: fixed an issue with some gerber files. Added Image Justify support (partial support).
parent
a911720a
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
263 additions
and
64 deletions
+263
-64
class_GERBER.cpp
gerbview/class_GERBER.cpp
+45
-0
class_GERBER.h
gerbview/class_GERBER.h
+10
-0
class_gerber_draw_item.cpp
gerbview/class_gerber_draw_item.cpp
+3
-10
class_gerber_draw_item.h
gerbview/class_gerber_draw_item.h
+1
-1
edit.cpp
gerbview/edit.cpp
+6
-0
test-image-justify-with-offset.gbr
...view/gerber_test_files/test-image-justify-with-offset.gbr
+19
-0
test-image-offset.gbr
gerbview/gerber_test_files/test-image-offset.gbr
+18
-0
rs274x.cpp
gerbview/rs274x.cpp
+161
-53
No files found.
gerbview/class_GERBER.cpp
View file @
de37bbad
...
...
@@ -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
);
}
gerbview/class_GERBER.h
View file @
de37bbad
...
...
@@ -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
);
};
...
...
gerbview/class_gerber_draw_item.cpp
View file @
de37bbad
...
...
@@ -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 th
e track segment only, and does not calculate the full track length
* Display info about th
is 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
);
...
...
gerbview/class_gerber_draw_item.h
View file @
de37bbad
...
...
@@ -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 th
e track segment and the full track length
* Display info about th
is GERBER item
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
void
DisplayInfo
(
WinEDA_DrawFrame
*
frame
);
...
...
gerbview/edit.cpp
View file @
de37bbad
...
...
@@ -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
(
);
}
}
}
...
...
gerbview/gerber_test_files/test-image-justify-with-offset.gbr
0 → 100644
View file @
de37bbad
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*
gerbview/gerber_test_files/test-image-offset.gbr
0 → 100644
View file @
de37bbad
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*
gerbview/rs274x.cpp
View file @
de37bbad
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment