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
3e18fa42
Commit
3e18fa42
authored
Jan 13, 2013
by
Heikki Pulkkinen
Committed by
Dick Hollenbeck
Jan 13, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
protect data in class_track.h, switch to using member accessors
parent
f8a56d44
Changes
33
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
398 additions
and
401 deletions
+398
-401
3d_draw.cpp
3d-viewer/3d_draw.cpp
+6
-6
autoplac.cpp
pcbnew/autorouter/autoplac.cpp
+1
-1
graphpcb.cpp
pcbnew/autorouter/graphpcb.cpp
+8
-8
solve.cpp
pcbnew/autorouter/solve.cpp
+35
-38
board_undo_redo.cpp
pcbnew/board_undo_redo.cpp
+8
-5
class_board.cpp
pcbnew/class_board.cpp
+23
-23
class_track.cpp
pcbnew/class_track.cpp
+2
-2
class_track.h
pcbnew/class_track.h
+4
-8
clean.cpp
pcbnew/clean.cpp
+32
-32
connect.cpp
pcbnew/connect.cpp
+4
-4
drag.h
pcbnew/drag.h
+1
-1
dragsegm.cpp
pcbnew/dragsegm.cpp
+7
-7
drc_clearance_test_functions.cpp
pcbnew/drc_clearance_test_functions.cpp
+17
-17
drc_marker_functions.cpp
pcbnew/drc_marker_functions.cpp
+6
-6
edit_track_width.cpp
pcbnew/edit_track_width.cpp
+6
-6
editrack-part2.cpp
pcbnew/editrack-part2.cpp
+9
-7
editrack.cpp
pcbnew/editrack.cpp
+75
-77
event_handlers_tracks_vias_sizes.cpp
pcbnew/event_handlers_tracks_vias_sizes.cpp
+5
-2
export_gencad.cpp
pcbnew/export_gencad.cpp
+22
-22
export_vrml.cpp
pcbnew/export_vrml.cpp
+6
-6
gendrill_Excellon_writer.cpp
pcbnew/gendrill_Excellon_writer.cpp
+1
-1
magnetic_tracks_functions.cpp
pcbnew/magnetic_tracks_functions.cpp
+21
-21
move-drag_pads.cpp
pcbnew/move-drag_pads.cpp
+4
-4
move_or_drag_track.cpp
pcbnew/move_or_drag_track.cpp
+52
-54
plot_board_layers.cpp
pcbnew/plot_board_layers.cpp
+8
-8
plot_brditems_plotter.cpp
pcbnew/plot_brditems_plotter.cpp
+2
-2
print_board_functions.cpp
pcbnew/print_board_functions.cpp
+5
-5
ratsnest.cpp
pcbnew/ratsnest.cpp
+4
-4
specctra_export.cpp
pcbnew/specctra_export.cpp
+6
-6
specctra_import.cpp
pcbnew/specctra_import.cpp
+10
-10
tr_modif.cpp
pcbnew/tr_modif.cpp
+3
-3
zones_polygons_insulated_copper_islands.cpp
pcbnew/zones_polygons_insulated_copper_islands.cpp
+2
-2
zones_polygons_test_connections.cpp
pcbnew/zones_polygons_test_connections.cpp
+3
-3
No files found.
3d-viewer/3d_draw.cpp
View file @
3e18fa42
...
...
@@ -464,8 +464,8 @@ void EDA_3D_CANVAS::Draw3D_Track( TRACK* aTrack )
SetGLColor
(
color
);
glNormal3f
(
0.0
,
0.0
,
Get3DLayer_Z_Orientation
(
layer
)
);
Draw3D_SolidSegment
(
aTrack
->
m_Start
,
aTrack
->
m_End
,
aTrack
->
m_Width
,
thickness
,
zpos
,
Draw3D_SolidSegment
(
aTrack
->
GetStart
(),
aTrack
->
GetEnd
()
,
aTrack
->
GetWidth
()
,
thickness
,
zpos
,
g_Parm_3D_Visu
.
m_BiuTo3Dunits
);
}
...
...
@@ -475,7 +475,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
int
color
;
double
biu_to_3Dunits
=
g_Parm_3D_Visu
.
m_BiuTo3Dunits
;
int
outer_radius
=
via
->
m_Width
/
2
;
int
outer_radius
=
via
->
GetWidth
()
/
2
;
int
inner_radius
=
via
->
GetDrillValue
()
/
2
;
int
thickness
=
g_Parm_3D_Visu
.
GetCopperThicknessBIU
();
...
...
@@ -504,7 +504,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
SetGLColor
(
color
);
glNormal3f
(
0.0
,
0.0
,
Get3DLayer_Z_Orientation
(
layer
)
);
Draw3D_ZaxisCylinder
(
via
->
m_Start
,
(
outer_radius
+
inner_radius
)
/
2
,
Draw3D_ZaxisCylinder
(
via
->
GetStart
()
,
(
outer_radius
+
inner_radius
)
/
2
,
thickness
,
outer_radius
-
inner_radius
,
zpos
,
biu_to_3Dunits
);
if
(
layer
>=
top_layer
)
...
...
@@ -512,13 +512,13 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via )
}
// Drawing via hole:
color
=
g_ColorsSettings
.
GetItemColor
(
VIAS_VISIBLE
+
via
->
m_Shape
);
color
=
g_ColorsSettings
.
GetItemColor
(
VIAS_VISIBLE
+
via
->
GetShape
()
);
SetGLColor
(
color
);
int
height
=
g_Parm_3D_Visu
.
GetLayerZcoordBIU
(
top_layer
)
-
g_Parm_3D_Visu
.
GetLayerZcoordBIU
(
bottom_layer
);
int
zpos
=
g_Parm_3D_Visu
.
GetLayerZcoordBIU
(
bottom_layer
)
+
thickness
/
2
;
Draw3D_ZaxisCylinder
(
via
->
m_Start
,
inner_radius
+
thickness
/
2
,
height
,
Draw3D_ZaxisCylinder
(
via
->
GetStart
()
,
inner_radius
+
thickness
/
2
,
height
,
thickness
,
zpos
,
biu_to_3Dunits
);
}
...
...
pcbnew/autorouter/autoplac.cpp
View file @
3e18fa42
...
...
@@ -462,7 +462,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
TmpSegm
.
SetLayer
(
-
1
);
TmpSegm
.
SetNet
(
-
1
);
TmpSegm
.
m_Width
=
RoutingMatrix
.
m_GridRouting
/
2
;
TmpSegm
.
SetWidth
(
RoutingMatrix
.
m_GridRouting
/
2
)
;
EDA_ITEM
*
PtStruct
=
GetBoard
()
->
m_Drawings
;
...
...
pcbnew/autorouter/graphpcb.cpp
View file @
3e18fa42
...
...
@@ -262,13 +262,13 @@ void TraceSegmentPcb( TRACK* pt_segm, int color, int marge, int op_logic )
int
half_width
;
int
ux0
,
uy0
,
ux1
,
uy1
;
half_width
=
(
pt_segm
->
m_Width
/
2
)
+
marge
;
half_width
=
(
pt_segm
->
GetWidth
()
/
2
)
+
marge
;
// Calculate the bounding rectangle of the segment (if H, V or Via)
ux0
=
pt_segm
->
m_Start
.
x
-
RoutingMatrix
.
GetBrdCoordOrigin
().
x
;
uy0
=
pt_segm
->
m_Start
.
y
-
RoutingMatrix
.
GetBrdCoordOrigin
().
y
;
ux1
=
pt_segm
->
m_End
.
x
-
RoutingMatrix
.
GetBrdCoordOrigin
().
x
;
uy1
=
pt_segm
->
m_End
.
y
-
RoutingMatrix
.
GetBrdCoordOrigin
().
y
;
ux0
=
pt_segm
->
GetStart
()
.
x
-
RoutingMatrix
.
GetBrdCoordOrigin
().
x
;
uy0
=
pt_segm
->
GetStart
()
.
y
-
RoutingMatrix
.
GetBrdCoordOrigin
().
y
;
ux1
=
pt_segm
->
GetEnd
()
.
x
-
RoutingMatrix
.
GetBrdCoordOrigin
().
x
;
uy1
=
pt_segm
->
GetEnd
()
.
y
-
RoutingMatrix
.
GetBrdCoordOrigin
().
y
;
// Test if VIA (filled circle was drawn)
if
(
pt_segm
->
Type
()
==
PCB_VIA_T
)
...
...
@@ -290,7 +290,7 @@ void TraceSegmentPcb( TRACK* pt_segm, int color, int marge, int op_logic )
mask_layer
=
-
1
;
if
(
mask_layer
)
TraceFilledCircle
(
pt_segm
->
m_Start
.
x
,
pt_segm
->
m_Start
.
y
,
TraceFilledCircle
(
pt_segm
->
GetStart
().
x
,
pt_segm
->
GetStart
()
.
y
,
half_width
,
mask_layer
,
color
,
op_logic
);
return
;
}
...
...
@@ -301,13 +301,13 @@ void TraceSegmentPcb( TRACK* pt_segm, int color, int marge, int op_logic )
layer
=
-
1
;
// The segment is here a straight line or a circle or an arc.:
if
(
pt_segm
->
m_Shape
==
S_CIRCLE
)
if
(
pt_segm
->
GetShape
()
==
S_CIRCLE
)
{
TraceCircle
(
ux0
,
uy0
,
ux1
,
uy1
,
half_width
,
layer
,
color
,
op_logic
);
return
;
}
if
(
pt_segm
->
m_Shape
==
S_ARC
)
if
(
pt_segm
->
GetShape
()
==
S_ARC
)
{
TraceArc
(
ux0
,
uy0
,
ux1
,
uy1
,
pt_segm
->
m_Param
,
half_width
,
layer
,
color
,
op_logic
);
return
;
...
...
pcbnew/autorouter/solve.cpp
View file @
3e18fa42
...
...
@@ -1169,16 +1169,14 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackSegment
->
SetState
(
TRACK_AR
,
ON
);
g_CurrentTrackSegment
->
SetLayer
(
0x0F
);
g_CurrentTrackSegment
->
m_Start
.
x
=
g_CurrentTrackSegment
->
m_End
.
x
=
pcb
->
GetBoundingBox
().
GetX
()
+
(
RoutingMatrix
.
m_GridRouting
*
row
);
g_CurrentTrackSegment
->
SetStart
(
wxPoint
(
pcb
->
GetBoundingBox
().
GetX
()
+
(
RoutingMatrix
.
m_GridRouting
*
row
),
pcb
->
GetBoundingBox
().
GetY
()
+
(
RoutingMatrix
.
m_GridRouting
*
col
)));
g_CurrentTrackSegment
->
SetEnd
(
g_CurrentTrackSegment
->
GetStart
()
);
g_CurrentTrackSegment
->
m_Start
.
y
=
g_CurrentTrackSegment
->
m_End
.
y
=
pcb
->
GetBoundingBox
().
GetY
()
+
(
RoutingMatrix
.
m_GridRouting
*
col
);
g_CurrentTrackSegment
->
m_Width
=
pcb
->
GetCurrentViaSize
();
g_CurrentTrackSegment
->
m_Shape
=
pcb
->
GetDesignSettings
().
m_CurrentViaType
;
g_CurrentTrackSegment
->
SetWidth
(
pcb
->
GetCurrentViaSize
()
);
g_CurrentTrackSegment
->
SetShape
(
pcb
->
GetDesignSettings
().
m_CurrentViaType
);
g_CurrentTrackSegment
->
SetNet
(
current_net_code
);
}
...
...
@@ -1194,35 +1192,34 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackSegment
->
SetLayer
(
Route_Layer_TOP
);
g_CurrentTrackSegment
->
SetState
(
TRACK_AR
,
ON
);
g_CurrentTrackSegment
->
m_End
.
x
=
pcb
->
GetBoundingBox
().
GetX
()
+
(
RoutingMatrix
.
m_GridRouting
*
row
)
;
g_CurrentTrackSegment
->
m_End
.
y
=
pcb
->
GetBoundingBox
().
GetY
()
+
(
RoutingMatrix
.
m_GridRouting
*
col
);
g_CurrentTrackSegment
->
SetEnd
(
wxPoint
(
pcb
->
GetBoundingBox
().
GetX
()
+
(
RoutingMatrix
.
m_GridRouting
*
row
)
,
pcb
->
GetBoundingBox
().
GetY
()
+
(
RoutingMatrix
.
m_GridRouting
*
col
)
))
;
g_CurrentTrackSegment
->
SetNet
(
current_net_code
);
if
(
g_CurrentTrackSegment
->
Back
()
==
NULL
)
/* Start trace. */
{
g_CurrentTrackSegment
->
m_Start
.
x
=
segm_fX
;
g_CurrentTrackSegment
->
m_Start
.
y
=
segm_fY
;
g_CurrentTrackSegment
->
SetStart
(
wxPoint
(
segm_fX
,
segm_fY
)
);
/* Placement on the center of the pad if outside grid. */
dx1
=
g_CurrentTrackSegment
->
m_End
.
x
-
g_CurrentTrackSegment
->
m_Start
.
x
;
dy1
=
g_CurrentTrackSegment
->
m_End
.
y
-
g_CurrentTrackSegment
->
m_Start
.
y
;
dx1
=
g_CurrentTrackSegment
->
GetEnd
().
x
-
g_CurrentTrackSegment
->
GetStart
()
.
x
;
dy1
=
g_CurrentTrackSegment
->
GetEnd
().
y
-
g_CurrentTrackSegment
->
GetStart
()
.
y
;
dx0
=
pt_cur_ch
->
m_PadEnd
->
GetPosition
().
x
-
g_CurrentTrackSegment
->
m_Start
.
x
;
dy0
=
pt_cur_ch
->
m_PadEnd
->
GetPosition
().
y
-
g_CurrentTrackSegment
->
m_Start
.
y
;
dx0
=
pt_cur_ch
->
m_PadEnd
->
GetPosition
().
x
-
g_CurrentTrackSegment
->
GetStart
()
.
x
;
dy0
=
pt_cur_ch
->
m_PadEnd
->
GetPosition
().
y
-
g_CurrentTrackSegment
->
GetStart
()
.
y
;
/* If aligned, change the origin point. */
if
(
abs
(
dx0
*
dy1
)
==
abs
(
dx1
*
dy0
)
)
{
g_CurrentTrackSegment
->
m_Start
=
pt_cur_ch
->
m_PadEnd
->
GetPosition
(
);
g_CurrentTrackSegment
->
SetStart
(
pt_cur_ch
->
m_PadEnd
->
GetPosition
()
);
}
else
// Creation of a supplemental segment
{
g_CurrentTrackSegment
->
m_Start
=
pt_cur_ch
->
m_PadEnd
->
GetPosition
(
);
g_CurrentTrackSegment
->
SetStart
(
pt_cur_ch
->
m_PadEnd
->
GetPosition
()
);
newTrack
=
(
TRACK
*
)
g_CurrentTrackSegment
->
Clone
();
newTrack
->
m_Start
=
g_CurrentTrackSegment
->
m_End
;
newTrack
->
SetStart
(
g_CurrentTrackSegment
->
GetEnd
())
;
g_CurrentTrackList
.
PushBack
(
newTrack
);
}
...
...
@@ -1231,28 +1228,28 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
{
if
(
g_CurrentTrackSegment
->
Back
()
)
{
g_CurrentTrackSegment
->
m_Start
=
g_CurrentTrackSegment
->
Back
()
->
m_End
;
g_CurrentTrackSegment
->
SetStart
(
g_CurrentTrackSegment
->
Back
()
->
GetEnd
()
)
;
}
}
g_CurrentTrackSegment
->
m_Width
=
pcb
->
GetCurrentTrackWidth
(
);
g_CurrentTrackSegment
->
SetWidth
(
pcb
->
GetCurrentTrackWidth
()
);
if
(
g_CurrentTrackSegment
->
m_Start
!=
g_CurrentTrackSegment
->
m_End
)
if
(
g_CurrentTrackSegment
->
GetStart
()
!=
g_CurrentTrackSegment
->
GetEnd
()
)
{
/* Reduce aligned segments by one. */
TRACK
*
oldTrack
=
g_CurrentTrackSegment
->
Back
();
if
(
oldTrack
&&
oldTrack
->
Type
()
!=
PCB_VIA_T
)
{
dx1
=
g_CurrentTrackSegment
->
m_End
.
x
-
g_CurrentTrackSegment
->
m_Start
.
x
;
dy1
=
g_CurrentTrackSegment
->
m_End
.
y
-
g_CurrentTrackSegment
->
m_Start
.
y
;
dx1
=
g_CurrentTrackSegment
->
GetEnd
().
x
-
g_CurrentTrackSegment
->
GetStart
()
.
x
;
dy1
=
g_CurrentTrackSegment
->
GetEnd
().
y
-
g_CurrentTrackSegment
->
GetStart
()
.
y
;
dx0
=
oldTrack
->
m_End
.
x
-
oldTrack
->
m_Start
.
x
;
dy0
=
oldTrack
->
m_End
.
y
-
oldTrack
->
m_Start
.
y
;
dx0
=
oldTrack
->
GetEnd
().
x
-
oldTrack
->
GetStart
()
.
x
;
dy0
=
oldTrack
->
GetEnd
().
y
-
oldTrack
->
GetStart
()
.
y
;
if
(
abs
(
dx0
*
dy1
)
==
abs
(
dx1
*
dy0
)
)
{
oldTrack
->
m_End
=
g_CurrentTrackSegment
->
m_End
;
oldTrack
->
SetEnd
(
g_CurrentTrackSegment
->
GetEnd
()
)
;
delete
g_CurrentTrackList
.
PopBack
();
}
...
...
@@ -1280,24 +1277,24 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
marge
=
s_Clearance
+
(
pcbframe
->
GetBoard
()
->
GetCurrentTrackWidth
()
/
2
);
via_marge
=
s_Clearance
+
(
pcbframe
->
GetBoard
()
->
GetCurrentViaSize
()
/
2
);
dx1
=
g_CurrentTrackSegment
->
m_End
.
x
-
g_CurrentTrackSegment
->
m_Start
.
x
;
dy1
=
g_CurrentTrackSegment
->
m_End
.
y
-
g_CurrentTrackSegment
->
m_Start
.
y
;
dx1
=
g_CurrentTrackSegment
->
GetEnd
().
x
-
g_CurrentTrackSegment
->
GetStart
()
.
x
;
dy1
=
g_CurrentTrackSegment
->
GetEnd
().
y
-
g_CurrentTrackSegment
->
GetStart
()
.
y
;
/* Place on center of pad if off grid. */
dx0
=
pt_cur_ch
->
m_PadStart
->
GetPosition
().
x
-
g_CurrentTrackSegment
->
m_Start
.
x
;
dy0
=
pt_cur_ch
->
m_PadStart
->
GetPosition
().
y
-
g_CurrentTrackSegment
->
m_Start
.
y
;
dx0
=
pt_cur_ch
->
m_PadStart
->
GetPosition
().
x
-
g_CurrentTrackSegment
->
GetStart
()
.
x
;
dy0
=
pt_cur_ch
->
m_PadStart
->
GetPosition
().
y
-
g_CurrentTrackSegment
->
GetStart
()
.
y
;
/* If aligned, change the origin point. */
if
(
abs
(
dx0
*
dy1
)
==
abs
(
dx1
*
dy0
)
)
{
g_CurrentTrackSegment
->
m_End
=
pt_cur_ch
->
m_PadStart
->
GetPosition
(
);
g_CurrentTrackSegment
->
SetEnd
(
pt_cur_ch
->
m_PadStart
->
GetPosition
()
);
}
else
{
TRACK
*
newTrack
=
(
TRACK
*
)
g_CurrentTrackSegment
->
Clone
();
newTrack
->
m_End
=
pt_cur_ch
->
m_PadStart
->
GetPosition
(
);
newTrack
->
m_Start
=
g_CurrentTrackSegment
->
m_End
;
newTrack
->
SetEnd
(
pt_cur_ch
->
m_PadStart
->
GetPosition
()
);
newTrack
->
SetStart
(
g_CurrentTrackSegment
->
GetEnd
()
)
;
g_CurrentTrackList
.
PushBack
(
newTrack
);
}
...
...
pcbnew/board_undo_redo.cpp
View file @
3e18fa42
...
...
@@ -245,11 +245,14 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
{
TRACK
*
track
=
(
TRACK
*
)
aItem
;
TRACK
*
image
=
(
TRACK
*
)
aImage
;
EXCHG
(
track
->
m_Start
,
image
->
m_Start
);
EXCHG
(
track
->
m_End
,
image
->
m_End
);
EXCHG
(
track
->
m_Width
,
image
->
m_Width
);
EXCHG
(
track
->
m_Shape
,
image
->
m_Shape
);
int
atmp
=
track
->
GetDrillValue
();
// swap start, end, width and shape for track and image.
wxPoint
exchp
=
track
->
GetStart
();
track
->
SetStart
(
image
->
GetStart
()
);
image
->
SetStart
(
exchp
);
exchp
=
track
->
GetEnd
();
track
->
SetEnd
(
image
->
GetEnd
()
);
image
->
SetEnd
(
exchp
);
int
atmp
=
track
->
GetWidth
();
track
->
SetWidth
(
image
->
GetWidth
()
);
image
->
SetWidth
(
atmp
);
atmp
=
track
->
GetShape
();
track
->
SetShape
(
image
->
GetShape
()
);
image
->
SetShape
(
atmp
);
atmp
=
track
->
GetDrillValue
();
if
(
track
->
IsDrillDefault
()
)
atmp
=
-
1
;
...
...
pcbnew/class_board.cpp
View file @
3e18fa42
...
...
@@ -214,13 +214,13 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS*
*/
aLayerMask
=
candidate
->
ReturnMaskLayer
();
if
(
aPosition
==
candidate
->
m_Start
)
if
(
aPosition
==
candidate
->
GetStart
()
)
{
aPosition
=
candidate
->
m_End
;
aPosition
=
candidate
->
GetEnd
()
;
}
else
{
aPosition
=
candidate
->
m_Start
;
aPosition
=
candidate
->
GetStart
()
;
}
segment
=
m_Track
;
/* restart list of tracks to analyze */
...
...
@@ -1586,7 +1586,7 @@ TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, int aLayerMask )
if
(
track
->
Type
()
!=
PCB_VIA_T
)
continue
;
if
(
track
->
m_Start
!=
aPosition
)
if
(
track
->
GetStart
()
!=
aPosition
)
continue
;
if
(
track
->
GetState
(
BUSY
|
IS_DELETED
)
)
...
...
@@ -1628,11 +1628,11 @@ D_PAD* BOARD::GetPad( TRACK* aTrace, int aEndPoint )
if
(
aEndPoint
==
FLG_START
)
{
aPosition
=
aTrace
->
m_Start
;
aPosition
=
aTrace
->
GetStart
()
;
}
else
{
aPosition
=
aTrace
->
m_End
;
aPosition
=
aTrace
->
GetEnd
()
;
}
for
(
MODULE
*
module
=
m_Modules
;
module
;
module
=
module
->
Next
()
)
...
...
@@ -1852,16 +1852,16 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
if
(
aTrace
->
Type
()
==
PCB_VIA_T
)
{
TRACK
*
Segm1
,
*
Segm2
=
NULL
,
*
Segm3
=
NULL
;
Segm1
=
::
GetTrace
(
m_Track
,
NULL
,
aTrace
->
m_Start
,
layerMask
);
Segm1
=
::
GetTrace
(
m_Track
,
NULL
,
aTrace
->
GetStart
()
,
layerMask
);
if
(
Segm1
)
{
Segm2
=
::
GetTrace
(
Segm1
->
Next
(),
NULL
,
aTrace
->
m_Start
,
layerMask
);
Segm2
=
::
GetTrace
(
Segm1
->
Next
(),
NULL
,
aTrace
->
GetStart
()
,
layerMask
);
}
if
(
Segm2
)
{
Segm3
=
::
GetTrace
(
Segm2
->
Next
(),
NULL
,
aTrace
->
m_Start
,
layerMask
);
Segm3
=
::
GetTrace
(
Segm2
->
Next
(),
NULL
,
aTrace
->
GetStart
()
,
layerMask
);
}
if
(
Segm3
)
// More than 2 segments are connected to this via. the track" is only this via
...
...
@@ -1875,19 +1875,19 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
if
(
Segm1
)
// search for others segments connected to the initial segment start point
{
layerMask
=
Segm1
->
ReturnMaskLayer
();
chainMarkedSegments
(
aTrace
->
m_Start
,
layerMask
,
&
trackList
);
chainMarkedSegments
(
aTrace
->
GetStart
()
,
layerMask
,
&
trackList
);
}
if
(
Segm2
)
// search for others segments connected to the initial segment end point
{
layerMask
=
Segm2
->
ReturnMaskLayer
();
chainMarkedSegments
(
aTrace
->
m_Start
,
layerMask
,
&
trackList
);
chainMarkedSegments
(
aTrace
->
GetStart
()
,
layerMask
,
&
trackList
);
}
}
else
// mark the chain using both ends of the initial segment
{
chainMarkedSegments
(
aTrace
->
m_Start
,
layerMask
,
&
trackList
);
chainMarkedSegments
(
aTrace
->
m_End
,
layerMask
,
&
trackList
);
chainMarkedSegments
(
aTrace
->
GetStart
()
,
layerMask
,
&
trackList
);
chainMarkedSegments
(
aTrace
->
GetEnd
()
,
layerMask
,
&
trackList
);
}
// Now examine selected vias and flag them if they are on the track
...
...
@@ -1909,7 +1909,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
layerMask
=
via
->
ReturnMaskLayer
();
TRACK
*
track
=
::
GetTrace
(
m_Track
,
NULL
,
via
->
m_Start
,
layerMask
);
TRACK
*
track
=
::
GetTrace
(
m_Track
,
NULL
,
via
->
GetStart
()
,
layerMask
);
// GetTrace does not consider tracks flagged BUSY.
// So if no connected track found, this via is on the current track
...
...
@@ -1931,7 +1931,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
*/
int
layer
=
track
->
GetLayer
();
while
(
(
track
=
::
GetTrace
(
track
->
Next
(),
NULL
,
via
->
m_Start
,
layerMask
)
)
!=
NULL
)
while
(
(
track
=
::
GetTrace
(
track
->
Next
(),
NULL
,
via
->
GetStart
()
,
layerMask
)
)
!=
NULL
)
{
if
(
layer
!=
track
->
GetLayer
()
)
{
...
...
@@ -2159,21 +2159,21 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
* The new segment starts from aPosition and ends at the end point of
* aSegment. The original segment now ends at aPosition.
*/
if
(
aSegment
->
m_Start
==
aPosition
||
aSegment
->
m_End
==
aPosition
)
if
(
aSegment
->
GetStart
()
==
aPosition
||
aSegment
->
GetEnd
()
==
aPosition
)
return
NULL
;
/* A via is a good lock point */
if
(
aSegment
->
Type
()
==
PCB_VIA_T
)
{
aPosition
=
aSegment
->
m_Start
;
aPosition
=
aSegment
->
GetStart
()
;
return
aSegment
;
}
// Calculation coordinate of intermediate point relative to the start point of aSegment
wxPoint
delta
=
aSegment
->
m_End
-
aSegment
->
m_Start
;
wxPoint
delta
=
aSegment
->
GetEnd
()
-
aSegment
->
GetStart
()
;
// calculate coordinates of aPosition relative to aSegment->
m_Start
wxPoint
lockPoint
=
aPosition
-
aSegment
->
m_Start
;
// calculate coordinates of aPosition relative to aSegment->
GetStart()
wxPoint
lockPoint
=
aPosition
-
aSegment
->
GetStart
()
;
// lockPoint must be on aSegment:
// Ensure lockPoint.y/lockPoint.y = delta.y/delta.x
...
...
@@ -2185,11 +2185,11 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
/* Create the intermediate point (that is to say creation of a new
* segment, beginning at the intermediate point.
*/
lockPoint
+=
aSegment
->
m_Start
;
lockPoint
+=
aSegment
->
GetStart
()
;
TRACK
*
newTrack
=
(
TRACK
*
)
aSegment
->
Clone
();
// The new segment begins at the new point,
newTrack
->
m_Start
=
lockPoint
;
newTrack
->
SetStart
(
lockPoint
)
;
newTrack
->
start
=
aSegment
;
newTrack
->
SetState
(
BEGIN_ONPAD
,
OFF
);
...
...
@@ -2211,7 +2211,7 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
}
// Old track segment now ends at new point.
aSegment
->
m_End
=
lockPoint
;
aSegment
->
SetEnd
(
lockPoint
)
;
aSegment
->
end
=
newTrack
;
aSegment
->
SetState
(
END_ONPAD
,
OFF
);
...
...
pcbnew/class_track.cpp
View file @
3e18fa42
...
...
@@ -98,13 +98,13 @@ TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition,
{
if
(
PtSegm
->
GetState
(
IS_DELETED
|
BUSY
)
==
0
)
{
if
(
aPosition
==
PtSegm
->
m_Start
)
if
(
aPosition
==
PtSegm
->
GetStart
()
)
{
if
(
aLayerMask
&
PtSegm
->
ReturnMaskLayer
()
)
return
PtSegm
;
}
if
(
aPosition
==
PtSegm
->
m_End
)
if
(
aPosition
==
PtSegm
->
GetEnd
()
)
{
if
(
aLayerMask
&
PtSegm
->
ReturnMaskLayer
()
)
return
PtSegm
;
...
...
pcbnew/class_track.h
View file @
3e18fa42
...
...
@@ -79,14 +79,12 @@ private:
void
SetNext
(
EDA_ITEM
*
aNext
)
{
Pnext
=
aNext
;
}
void
SetBack
(
EDA_ITEM
*
aBack
)
{
Pback
=
aBack
;
}
public
:
protected
:
int
m_Width
;
// Thickness of track, or via diameter
wxPoint
m_Start
;
// Line start point
wxPoint
m_End
;
// Line end point
int
m_Shape
;
// vias: shape and type, Track = shape..
protected
:
int
m_Drill
;
// for vias: via drill (- 1 for default value)
public
:
...
...
@@ -95,7 +93,6 @@ public:
double
m_Param
;
// Auxiliary variable ( used in some computations )
public
:
TRACK
(
BOARD_ITEM
*
aParent
,
KICAD_T
idtype
=
PCB_TRACE_T
);
// Do not create a copy constructor. The one generated by the compiler is adequate.
...
...
@@ -125,6 +122,9 @@ public:
void
SetStart
(
const
wxPoint
&
aStart
)
{
m_Start
=
aStart
;
}
const
wxPoint
&
GetStart
()
const
{
return
m_Start
;
}
int
GetShape
()
const
{
return
m_Shape
;
}
void
SetShape
(
int
aShape
)
{
m_Shape
=
aShape
;
}
EDA_RECT
GetBoundingBox
()
const
;
/**
...
...
@@ -164,10 +164,6 @@ public:
void
Draw
(
EDA_DRAW_PANEL
*
panel
,
wxDC
*
DC
,
GR_DRAWMODE
aDrawMode
,
const
wxPoint
&
aOffset
=
ZeroOffset
);
/* divers */
int
GetShape
()
const
{
return
m_Shape
&
0xFF
;
}
void
SetShape
(
int
aShape
)
{
m_Shape
=
aShape
;
}
/**
* Function TransformShapeWithClearanceToPolygon
* Convert the track shape to a closed polygon
...
...
pcbnew/clean.cpp
View file @
3e18fa42
...
...
@@ -218,8 +218,8 @@ bool TRACKS_CLEANER::clean_vias()
// Correct via m_End defects (if any)
if
(
track
->
Type
()
==
PCB_VIA_T
)
{
if
(
track
->
m_Start
!=
track
->
m_End
)
track
->
m_End
=
track
->
m_Start
;
if
(
track
->
GetStart
()
!=
track
->
GetEnd
()
)
track
->
SetEnd
(
track
->
GetStart
()
)
;
}
if
(
track
->
GetShape
()
!=
VIA_THROUGH
)
...
...
@@ -232,10 +232,10 @@ bool TRACKS_CLEANER::clean_vias()
{
next_track
=
alt_track
->
Next
();
if
(
alt_track
->
m_Shape
!=
VIA_THROUGH
)
if
(
alt_track
->
GetShape
()
!=
VIA_THROUGH
)
continue
;
if
(
alt_track
->
m_Start
!=
track
->
m_Start
)
if
(
alt_track
->
GetStart
()
!=
track
->
GetStart
()
)
continue
;
// delete via
...
...
@@ -250,7 +250,7 @@ bool TRACKS_CLEANER::clean_vias()
{
next_track
=
track
->
Next
();
if
(
track
->
m_Shape
!=
VIA_THROUGH
)
if
(
track
->
GetShape
()
!=
VIA_THROUGH
)
continue
;
// Examine the list of connected pads:
...
...
@@ -319,13 +319,13 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
{
if
(
track
->
Type
()
!=
PCB_VIA_T
)
{
zone
=
m_Brd
->
HitTestForAnyFilledArea
(
track
->
m_Start
,
zone
=
m_Brd
->
HitTestForAnyFilledArea
(
track
->
GetStart
()
,
track
->
GetLayer
()
);
}
else
{
((
SEGVIA
*
)
track
)
->
ReturnLayerPair
(
&
top_layer
,
&
bottom_layer
);
zone
=
m_Brd
->
HitTestForAnyFilledArea
(
track
->
m_Start
,
zone
=
m_Brd
->
HitTestForAnyFilledArea
(
track
->
GetStart
()
,
top_layer
,
bottom_layer
);
}
}
...
...
@@ -352,7 +352,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
if
(
other
==
NULL
)
{
via
->
ReturnLayerPair
(
&
top_layer
,
&
bottom_layer
);
zone
=
m_Brd
->
HitTestForAnyFilledArea
(
via
->
m_Start
,
zone
=
m_Brd
->
HitTestForAnyFilledArea
(
via
->
GetStart
()
,
bottom_layer
,
top_layer
);
}
...
...
@@ -374,13 +374,13 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
{
if
(
track
->
Type
()
!=
PCB_VIA_T
)
{
zone
=
m_Brd
->
HitTestForAnyFilledArea
(
track
->
m_End
,
zone
=
m_Brd
->
HitTestForAnyFilledArea
(
track
->
GetEnd
()
,
track
->
GetLayer
()
);
}
else
{
((
SEGVIA
*
)
track
)
->
ReturnLayerPair
(
&
top_layer
,
&
bottom_layer
);
zone
=
m_Brd
->
HitTestForAnyFilledArea
(
track
->
m_End
,
zone
=
m_Brd
->
HitTestForAnyFilledArea
(
track
->
GetEnd
()
,
top_layer
,
bottom_layer
);
}
}
...
...
@@ -408,7 +408,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
if
(
other
==
NULL
)
{
via
->
ReturnLayerPair
(
&
top_layer
,
&
bottom_layer
);
zone
=
m_Brd
->
HitTestForAnyFilledArea
(
via
->
m_End
,
zone
=
m_Brd
->
HitTestForAnyFilledArea
(
via
->
GetEnd
()
,
bottom_layer
,
top_layer
);
}
...
...
@@ -472,12 +472,12 @@ bool TRACKS_CLEANER::clean_segments()
if
(
segment
->
GetNet
()
!=
other
->
GetNet
()
)
break
;
if
(
(
segment
->
m_Start
==
other
->
m_Start
)
&&
(
segment
->
m_End
==
other
->
m_End
)
)
if
(
(
segment
->
GetStart
()
==
other
->
GetStart
()
)
&&
(
segment
->
GetEnd
()
==
other
->
GetEnd
()
)
)
erase
=
true
;
if
(
(
segment
->
m_Start
==
other
->
m_End
)
&&
(
segment
->
m_End
==
other
->
m_Start
)
)
if
(
(
segment
->
GetStart
()
==
other
->
GetEnd
()
)
&&
(
segment
->
GetEnd
()
==
other
->
GetStart
()
)
)
erase
=
true
;
// Delete redundant point
...
...
@@ -511,7 +511,7 @@ bool TRACKS_CLEANER::clean_segments()
if
(
segStart
)
{
// the two segments must have the same width
if
(
segment
->
m_Width
!=
segStart
->
m_Width
)
if
(
segment
->
GetWidth
()
!=
segStart
->
GetWidth
()
)
break
;
// it cannot be a via
...
...
@@ -550,7 +550,7 @@ bool TRACKS_CLEANER::clean_segments()
if
(
segEnd
)
{
if
(
segment
->
m_Width
!=
segEnd
->
m_Width
)
if
(
segment
->
GetWidth
()
!=
segEnd
->
GetWidth
()
)
break
;
if
(
segEnd
->
Type
()
!=
PCB_TRACE_T
)
...
...
@@ -607,7 +607,7 @@ bool TRACKS_CLEANER::clean_segments()
TRACK
*
TRACKS_CLEANER
::
mergeCollinearSegmentIfPossible
(
TRACK
*
aTrackRef
,
TRACK
*
aCandidate
,
int
aEndType
)
{
if
(
aTrackRef
->
m_Width
!=
aCandidate
->
m_Width
)
if
(
aTrackRef
->
GetWidth
()
!=
aCandidate
->
GetWidth
()
)
return
NULL
;
bool
is_colinear
=
false
;
...
...
@@ -615,20 +615,20 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
// Trivial case: superimposed tracks ( tracks, not vias ):
if
(
aTrackRef
->
Type
()
==
PCB_TRACE_T
&&
aCandidate
->
Type
()
==
PCB_TRACE_T
)
{
if
(
(
aTrackRef
->
m_Start
==
aCandidate
->
m_Start
)
&&
(
aTrackRef
->
m_End
==
aCandidate
->
m_End
)
)
if
(
(
aTrackRef
->
GetStart
()
==
aCandidate
->
GetStart
()
)
&&
(
aTrackRef
->
GetEnd
()
==
aCandidate
->
GetEnd
()
)
)
return
aCandidate
;
if
(
(
aTrackRef
->
m_Start
==
aCandidate
->
m_End
)
&&
(
aTrackRef
->
m_End
==
aCandidate
->
m_Start
)
)
if
(
(
aTrackRef
->
GetStart
()
==
aCandidate
->
GetEnd
()
)
&&
(
aTrackRef
->
GetEnd
()
==
aCandidate
->
GetStart
()
)
)
return
aCandidate
;
}
int
refdx
=
aTrackRef
->
m_End
.
x
-
aTrackRef
->
m_Start
.
x
;
int
refdy
=
aTrackRef
->
m_End
.
y
-
aTrackRef
->
m_Start
.
y
;
int
refdx
=
aTrackRef
->
GetEnd
().
x
-
aTrackRef
->
GetStart
()
.
x
;
int
refdy
=
aTrackRef
->
GetEnd
().
y
-
aTrackRef
->
GetStart
()
.
y
;
int
segmdx
=
aCandidate
->
m_End
.
x
-
aCandidate
->
m_Start
.
x
;
int
segmdy
=
aCandidate
->
m_End
.
y
-
aCandidate
->
m_Start
.
y
;
int
segmdx
=
aCandidate
->
GetEnd
().
x
-
aCandidate
->
GetStart
()
.
x
;
int
segmdy
=
aCandidate
->
GetEnd
().
y
-
aCandidate
->
GetStart
()
.
y
;
// test for vertical alignment (easy to handle)
if
(
refdx
==
0
)
...
...
@@ -673,16 +673,16 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
/* change the common point coordinate of pt_segm to use the other point
* of pt_segm (pt_segm will be removed later) */
if
(
aTrackRef
->
m_Start
==
aCandidate
->
m_Start
)
if
(
aTrackRef
->
GetStart
()
==
aCandidate
->
GetStart
()
)
{
aTrackRef
->
m_Start
=
aCandidate
->
m_End
;
aTrackRef
->
SetStart
(
aCandidate
->
GetEnd
())
;
aTrackRef
->
start
=
aCandidate
->
end
;
aTrackRef
->
SetState
(
START_ON_PAD
,
aCandidate
->
GetState
(
END_ON_PAD
)
);
return
aCandidate
;
}
else
{
aTrackRef
->
m_Start
=
aCandidate
->
m_Start
;
aTrackRef
->
SetStart
(
aCandidate
->
GetStart
()
)
;
aTrackRef
->
start
=
aCandidate
->
start
;
aTrackRef
->
SetState
(
START_ON_PAD
,
aCandidate
->
GetState
(
START_ON_PAD
)
);
return
aCandidate
;
...
...
@@ -696,16 +696,16 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
/* change the common point coordinate of pt_segm to use the other point
* of pt_segm (pt_segm will be removed later) */
if
(
aTrackRef
->
m_End
==
aCandidate
->
m_Start
)
if
(
aTrackRef
->
GetEnd
()
==
aCandidate
->
GetStart
()
)
{
aTrackRef
->
m_End
=
aCandidate
->
m_End
;
aTrackRef
->
SetEnd
(
aCandidate
->
GetEnd
()
)
;
aTrackRef
->
end
=
aCandidate
->
end
;
aTrackRef
->
SetState
(
END_ON_PAD
,
aCandidate
->
GetState
(
END_ON_PAD
)
);
return
aCandidate
;
}
else
{
aTrackRef
->
m_End
=
aCandidate
->
m_Start
;
aTrackRef
->
SetEnd
(
aCandidate
->
GetStart
()
)
;
aTrackRef
->
end
=
aCandidate
->
start
;
aTrackRef
->
SetState
(
END_ON_PAD
,
aCandidate
->
GetState
(
START_ON_PAD
)
);
return
aCandidate
;
...
...
pcbnew/connect.cpp
View file @
3e18fa42
...
...
@@ -264,11 +264,11 @@ void CONNECTIONS::BuildTracksCandidatesList( TRACK * aBegin, TRACK * aEnd)
m_candidates
.
reserve
(
ii
);
for
(
TRACK
*
track
=
aBegin
;
track
;
track
=
track
->
Next
()
)
{
CONNECTED_POINT
candidate
(
track
,
track
->
m_Start
);
CONNECTED_POINT
candidate
(
track
,
track
->
GetStart
()
);
m_candidates
.
push_back
(
candidate
);
if
(
track
->
Type
()
!=
PCB_VIA_T
)
{
CONNECTED_POINT
candidate2
(
track
,
track
->
m_End
);
CONNECTED_POINT
candidate2
(
track
,
track
->
GetEnd
()
);
m_candidates
.
push_back
(
candidate2
);
}
...
...
@@ -304,7 +304,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
int
dist_max
=
aTrack
->
GetWidth
()
/
2
;
static
std
::
vector
<
CONNECTED_POINT
*>
tracks_candidates
;
#endif
wxPoint
position
=
aTrack
->
m_Start
;
wxPoint
position
=
aTrack
->
GetStart
()
;
for
(
int
kk
=
0
;
kk
<
2
;
kk
++
)
{
#ifndef USE_EXTENDED_SEARCH
...
...
@@ -361,7 +361,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack )
if
(
aTrack
->
Type
()
==
PCB_VIA_T
)
break
;
position
=
aTrack
->
m_End
;
position
=
aTrack
->
GetEnd
()
;
}
return
count
;
...
...
pcbnew/drag.h
View file @
3e18fa42
...
...
@@ -176,7 +176,7 @@ void EraseDragList();
* @param aNetCode = the net code to consider
* @param aMaxDist = max distance from aRefPos to a track end candidate to collect the track
*/
void
Collect_TrackSegmentsToDrag
(
BOARD
*
aPcb
,
wxPoint
&
aRefPos
,
int
aLayerMask
,
void
Collect_TrackSegmentsToDrag
(
BOARD
*
aPcb
,
const
wxPoint
&
aRefPos
,
int
aLayerMask
,
int
aNetCode
,
int
aMaxDist
);
/* Add aTrack to the drag list
...
...
pcbnew/dragsegm.cpp
View file @
3e18fa42
...
...
@@ -51,8 +51,8 @@ std::vector<DRAG_SEGM_PICKER> g_DragSegmentList;
DRAG_SEGM_PICKER
::
DRAG_SEGM_PICKER
(
TRACK
*
aTrack
)
{
m_Track
=
aTrack
;
m_startInitialValue
=
m_Track
->
m_Start
;
m_endInitialValue
=
m_Track
->
m_End
;
m_startInitialValue
=
m_Track
->
GetStart
()
;
m_endInitialValue
=
m_Track
->
GetEnd
()
;
m_Pad_Start
=
m_Track
->
GetState
(
START_ON_PAD
)
?
(
D_PAD
*
)
m_Track
->
start
:
NULL
;
m_Pad_End
=
m_Track
->
GetState
(
END_ON_PAD
)
?
(
D_PAD
*
)
m_Track
->
end
:
NULL
;
m_Flag
=
0
;
...
...
@@ -133,7 +133,7 @@ void DRAG_SEGM_PICKER::SetTrackEndsCoordinates(wxPoint aOffset)
if
(
flip
)
NEGATE
(
padoffset
.
y
);
m_Track
->
m_Start
=
m_Pad_Start
->
GetPosition
()
-
aOffset
+
padoffset
;
m_Track
->
SetStart
(
m_Pad_Start
->
GetPosition
()
-
aOffset
+
padoffset
)
;
}
if
(
m_Pad_End
)
...
...
@@ -146,7 +146,7 @@ void DRAG_SEGM_PICKER::SetTrackEndsCoordinates(wxPoint aOffset)
if
(
flip
)
NEGATE
(
padoffset
.
y
);
m_Track
->
m_End
=
m_Pad_End
->
GetPosition
()
-
aOffset
+
padoffset
;
m_Track
->
SetEnd
(
m_Pad_End
->
GetPosition
()
-
aOffset
+
padoffset
)
;
}
}
...
...
@@ -349,7 +349,7 @@ void AddSegmentToDragList( int flag, TRACK* aTrack )
* aNetCode = the net code to consider
* aMaxDist = max distance from aRefPos to a track end candidate to collect the track
*/
void
Collect_TrackSegmentsToDrag
(
BOARD
*
aPcb
,
wxPoint
&
aRefPos
,
int
aLayerMask
,
void
Collect_TrackSegmentsToDrag
(
BOARD
*
aPcb
,
const
wxPoint
&
aRefPos
,
int
aLayerMask
,
int
aNetCode
,
int
aMaxDist
)
{
TRACK
*
track
=
aPcb
->
m_Track
->
GetStartNetCode
(
aNetCode
);
...
...
@@ -370,7 +370,7 @@ void Collect_TrackSegmentsToDrag( BOARD* aPcb, wxPoint& aRefPos, int aLayerMask,
if
(
(
track
->
GetFlags
()
&
STARTPOINT
)
==
0
)
{
wxPoint
delta
=
track
->
m_Start
-
aRefPos
;
wxPoint
delta
=
track
->
GetStart
()
-
aRefPos
;
if
(
std
::
abs
(
delta
.
x
)
<=
maxdist
&&
std
::
abs
(
delta
.
y
)
<=
maxdist
)
{
int
dist
=
(
int
)
hypot
(
(
double
)
delta
.
x
,
(
double
)
delta
.
y
);
...
...
@@ -385,7 +385,7 @@ void Collect_TrackSegmentsToDrag( BOARD* aPcb, wxPoint& aRefPos, int aLayerMask,
if
(
(
track
->
GetFlags
()
&
ENDPOINT
)
==
0
)
{
wxPoint
delta
=
track
->
m_End
-
aRefPos
;
wxPoint
delta
=
track
->
GetEnd
()
-
aRefPos
;
if
(
std
::
abs
(
delta
.
x
)
<=
maxdist
&&
std
::
abs
(
delta
.
y
)
<=
maxdist
)
{
int
dist
=
(
int
)
hypot
(
(
double
)
delta
.
x
,
(
double
)
delta
.
y
);
...
...
pcbnew/drc_clearance_test_functions.cpp
View file @
3e18fa42
...
...
@@ -165,9 +165,9 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
/* In order to make some calculations more easier or faster,
* pads and tracks coordinates will be made relative to the reference segment origin
*/
wxPoint
origin
=
aRefSeg
->
m_Start
;
// origin will be the origin of other coordinates
wxPoint
origin
=
aRefSeg
->
GetStart
()
;
// origin will be the origin of other coordinates
m_segmEnd
=
delta
=
aRefSeg
->
m_End
-
origin
;
m_segmEnd
=
delta
=
aRefSeg
->
GetEnd
()
-
origin
;
m_segmAngle
=
0
;
layerMask
=
aRefSeg
->
ReturnMaskLayer
();
...
...
@@ -179,7 +179,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// test if the via size is smaller than minimum
if
(
aRefSeg
->
GetShape
()
==
VIA_MICROVIA
)
{
if
(
aRefSeg
->
m_Width
<
netclass
->
GetuViaMinDiameter
()
)
if
(
aRefSeg
->
GetWidth
()
<
netclass
->
GetuViaMinDiameter
()
)
{
m_currentMarker
=
fillMarker
(
aRefSeg
,
NULL
,
DRCE_TOO_SMALL_MICROVIA
,
m_currentMarker
);
...
...
@@ -188,7 +188,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
}
else
{
if
(
aRefSeg
->
m_Width
<
netclass
->
GetViaMinDiameter
()
)
if
(
aRefSeg
->
GetWidth
()
<
netclass
->
GetViaMinDiameter
()
)
{
m_currentMarker
=
fillMarker
(
aRefSeg
,
NULL
,
DRCE_TOO_SMALL_VIA
,
m_currentMarker
);
...
...
@@ -199,7 +199,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// test if via's hole is bigger than its diameter
// This test is necessary since the via hole size and width can be modified
// and a default via hole can be bigger than some vias sizes
if
(
aRefSeg
->
GetDrillValue
()
>
aRefSeg
->
m_Width
)
if
(
aRefSeg
->
GetDrillValue
()
>
aRefSeg
->
GetWidth
()
)
{
m_currentMarker
=
fillMarker
(
aRefSeg
,
NULL
,
DRCE_VIA_HOLE_BIGGER
,
m_currentMarker
);
...
...
@@ -237,7 +237,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
}
else
// This is a track segment
{
if
(
aRefSeg
->
m_Width
<
netclass
->
GetTrackMinWidth
()
)
if
(
aRefSeg
->
GetWidth
()
<
netclass
->
GetTrackMinWidth
()
)
{
m_currentMarker
=
fillMarker
(
aRefSeg
,
NULL
,
DRCE_TOO_SMALL_TRACK_WIDTH
,
m_currentMarker
);
...
...
@@ -303,7 +303,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
m_padToTestPos
=
dummypad
.
GetPosition
()
-
origin
;
if
(
!
checkClearanceSegmToPad
(
&
dummypad
,
aRefSeg
->
m_Width
,
if
(
!
checkClearanceSegmToPad
(
&
dummypad
,
aRefSeg
->
GetWidth
()
,
netclass
->
GetClearance
()
)
)
{
m_currentMarker
=
fillMarker
(
aRefSeg
,
pad
,
...
...
@@ -324,7 +324,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
shape_pos
=
pad
->
ReturnShapePos
();
m_padToTestPos
=
shape_pos
-
origin
;
if
(
!
checkClearanceSegmToPad
(
pad
,
aRefSeg
->
m_Width
,
aRefSeg
->
GetClearance
(
pad
)
)
)
if
(
!
checkClearanceSegmToPad
(
pad
,
aRefSeg
->
GetWidth
()
,
aRefSeg
->
GetClearance
(
pad
)
)
)
{
m_currentMarker
=
fillMarker
(
aRefSeg
,
pad
,
DRCE_TRACK_NEAR_PAD
,
m_currentMarker
);
...
...
@@ -355,15 +355,15 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// the minimum distance = clearance plus half the reference track
// width plus half the other track's width
int
w_dist
=
aRefSeg
->
GetClearance
(
track
);
w_dist
+=
(
aRefSeg
->
m_Width
+
track
->
m_Width
)
/
2
;
w_dist
+=
(
aRefSeg
->
GetWidth
()
+
track
->
GetWidth
()
)
/
2
;
// If the reference segment is a via, we test it here
if
(
aRefSeg
->
Type
()
==
PCB_VIA_T
)
{
int
angle
=
0
;
// angle du segment a tester;
delta
=
track
->
m_End
-
track
->
m_Start
;
segStartPoint
=
aRefSeg
->
m_Start
-
track
->
m_Start
;
delta
=
track
->
GetEnd
()
-
track
->
GetStart
()
;
segStartPoint
=
aRefSeg
->
GetStart
()
-
track
->
GetStart
()
;
if
(
track
->
Type
()
==
PCB_VIA_T
)
{
...
...
@@ -399,8 +399,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
* the segment to test in the new axis : the new X axis is the
* reference segment. We must translate and rotate the segment to test
*/
segStartPoint
=
track
->
m_Start
-
origin
;
segEndPoint
=
track
->
m_End
-
origin
;
segStartPoint
=
track
->
GetStart
()
-
origin
;
segEndPoint
=
track
->
GetEnd
()
-
origin
;
RotatePoint
(
&
segStartPoint
,
m_segmAngle
);
RotatePoint
(
&
segEndPoint
,
m_segmAngle
);
if
(
track
->
Type
()
==
PCB_VIA_T
)
...
...
@@ -529,8 +529,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
else
// The drc error is due to the starting or the ending point of the reference segment
{
// Test the starting and the ending point
segStartPoint
=
track
->
m_Start
;
segEndPoint
=
track
->
m_End
;
segStartPoint
=
track
->
GetStart
()
;
segEndPoint
=
track
->
GetEnd
()
;
delta
=
segEndPoint
-
segStartPoint
;
/* Compute the segment orientation (angle) en 0,1 degre */
...
...
@@ -542,8 +542,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
/* Comute the reference segment coordinates relatives to a
* X axis = current tested segment
*/
wxPoint
relStartPos
=
aRefSeg
->
m_Start
-
segStartPoint
;
wxPoint
relEndPos
=
aRefSeg
->
m_End
-
segStartPoint
;
wxPoint
relStartPos
=
aRefSeg
->
GetStart
()
-
segStartPoint
;
wxPoint
relEndPos
=
aRefSeg
->
GetEnd
()
-
segStartPoint
;
RotatePoint
(
&
relStartPos
,
angle
);
RotatePoint
(
&
relEndPos
,
angle
);
...
...
pcbnew/drc_marker_functions.cpp
View file @
3e18fa42
...
...
@@ -70,17 +70,17 @@ MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, M
posB
=
track
->
GetPosition
();
wxPoint
endPos
=
track
->
m_End
;
wxPoint
endPos
=
track
->
GetEnd
()
;
// either of aItem's start or end will be used for the marker position
// first assume start, then switch at end if needed. decision made on
// distance from end of aTrack.
position
=
track
->
m_Start
;
position
=
track
->
GetStart
()
;
double
dToEnd
=
hypot
(
endPos
.
x
-
aTrack
->
m_End
.
x
,
endPos
.
y
-
aTrack
->
m_End
.
y
);
double
dToStart
=
hypot
(
position
.
x
-
aTrack
->
m_End
.
x
,
position
.
y
-
aTrack
->
m_End
.
y
);
double
dToEnd
=
hypot
(
endPos
.
x
-
aTrack
->
GetEnd
()
.
x
,
endPos
.
y
-
aTrack
->
GetEnd
()
.
y
);
double
dToStart
=
hypot
(
position
.
x
-
aTrack
->
GetEnd
()
.
x
,
position
.
y
-
aTrack
->
GetEnd
()
.
y
);
if
(
dToEnd
<
dToStart
)
position
=
endPos
;
...
...
pcbnew/edit_track_width.cpp
View file @
3e18fa42
...
...
@@ -38,7 +38,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
if
(
aUseNetclassValue
)
net
=
GetBoard
()
->
FindNet
(
aTrackItem
->
GetNet
()
);
initial_width
=
aTrackItem
->
m_Width
;
initial_width
=
aTrackItem
->
GetWidth
()
;
if
(
net
)
new_width
=
net
->
GetTrackWidth
();
...
...
@@ -60,7 +60,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
new_drill
=
GetBoard
()
->
GetCurrentViaDrill
();
}
if
(
aTrackItem
->
m_Shape
==
VIA_MICROVIA
)
if
(
aTrackItem
->
GetShape
()
==
VIA_MICROVIA
)
{
if
(
net
)
new_width
=
net
->
GetViaSize
();
...
...
@@ -69,7 +69,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
}
}
aTrackItem
->
m_Width
=
new_width
;
aTrackItem
->
SetWidth
(
new_width
)
;
// make a DRC test because the new size is bigger than the old size
if
(
initial_width
<
new_width
)
...
...
@@ -98,11 +98,11 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
if
(
aItemsListPicker
)
{
aTrackItem
->
m_Width
=
initial_width
;
aTrackItem
->
SetWidth
(
initial_width
)
;
ITEM_PICKER
picker
(
aTrackItem
,
UR_CHANGED
);
picker
.
SetLink
(
aTrackItem
->
Clone
()
);
aItemsListPicker
->
PushItem
(
picker
);
aTrackItem
->
m_Width
=
new_width
;
aTrackItem
->
SetWidth
(
new_width
)
;
if
(
aTrackItem
->
Type
()
==
PCB_VIA_T
)
{
...
...
@@ -116,7 +116,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
}
else
{
aTrackItem
->
m_Width
=
initial_width
;
aTrackItem
->
SetWidth
(
initial_width
)
;
}
return
change_ok
;
...
...
pcbnew/editrack-part2.cpp
View file @
3e18fa42
...
...
@@ -62,13 +62,13 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
}
// Avoid more than one via on the current location:
if
(
GetBoard
()
->
GetViaByPosition
(
g_CurrentTrackSegment
->
m_End
,
if
(
GetBoard
()
->
GetViaByPosition
(
g_CurrentTrackSegment
->
GetEnd
()
,
g_CurrentTrackSegment
->
GetLayer
()
)
)
return
false
;
for
(
TRACK
*
segm
=
g_FirstTrackSegment
;
segm
;
segm
=
segm
->
Next
()
)
{
if
(
segm
->
Type
()
==
PCB_VIA_T
&&
g_CurrentTrackSegment
->
m_End
==
segm
->
m_Start
)
if
(
segm
->
Type
()
==
PCB_VIA_T
&&
g_CurrentTrackSegment
->
GetEnd
()
==
segm
->
GetStart
()
)
return
false
;
}
...
...
@@ -98,10 +98,11 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
// create the via
SEGVIA
*
via
=
new
SEGVIA
(
GetBoard
()
);
via
->
SetFlags
(
IS_NEW
);
via
->
m_Shape
=
GetDesignSettings
().
m_CurrentViaType
;
via
->
m_Width
=
GetBoard
()
->
GetCurrentViaSize
(
);
via
->
SetShape
(
GetDesignSettings
().
m_CurrentViaType
)
;
via
->
SetWidth
(
GetBoard
()
->
GetCurrentViaSize
()
);
via
->
SetNet
(
GetBoard
()
->
GetHighLightNetCode
()
);
via
->
m_Start
=
via
->
m_End
=
g_CurrentTrackSegment
->
m_End
;
via
->
SetEnd
(
g_CurrentTrackSegment
->
GetEnd
()
);
via
->
SetStart
(
g_CurrentTrackSegment
->
GetEnd
()
);
// Usual via is from copper to component.
// layer pair is LAYER_N_BACK and LAYER_N_FRONT.
...
...
@@ -140,7 +141,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
via
->
SetLayerPair
(
first_layer
,
last_layer
);
{
NETINFO_ITEM
*
net
=
GetBoard
()
->
FindNet
(
via
->
GetNet
()
);
via
->
m_Width
=
net
->
GetMicroViaSize
(
);
via
->
SetWidth
(
net
->
GetMicroViaSize
()
);
}
}
break
;
...
...
@@ -198,7 +199,8 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
/* the start point is the via position and the end point is the cursor
* which also is on the via (will change when moving mouse)
*/
track
->
m_Start
=
track
->
m_End
=
via
->
m_Start
;
track
->
SetEnd
(
via
->
GetStart
()
);
track
->
SetStart
(
via
->
GetStart
()
);
g_CurrentTrackList
.
PushBack
(
track
);
...
...
pcbnew/editrack.cpp
View file @
3e18fa42
...
...
@@ -153,11 +153,11 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
GetBoard
()
->
SetHighLightNet
(
zone
->
GetNet
()
);
}
D
(
g_CurrentTrackList
.
VerifyListIntegrity
()
;
);
D
(
g_CurrentTrackList
.
VerifyListIntegrity
()
);
BuildAirWiresTargetsList
(
LockPoint
,
wxPoint
(
0
,
0
),
true
);
D
(
g_CurrentTrackList
.
VerifyListIntegrity
()
;
);
D
(
g_CurrentTrackList
.
VerifyListIntegrity
()
);
GetBoard
()
->
HighLightON
();
GetBoard
()
->
DrawHighLight
(
m_canvas
,
aDC
,
GetBoard
()
->
GetHighLightNetCode
()
);
...
...
@@ -167,16 +167,16 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
GetBoard
()
->
SetCurrentNetClass
(
g_CurrentTrackSegment
->
GetNetClassName
()
);
g_CurrentTrackSegment
->
SetLayer
(
GetScreen
()
->
m_Active_Layer
);
g_CurrentTrackSegment
->
m_Width
=
GetBoard
()
->
GetCurrentTrackWidth
(
);
g_CurrentTrackSegment
->
SetWidth
(
GetBoard
()
->
GetCurrentTrackWidth
()
);
if
(
GetBoard
()
->
GetDesignSettings
().
m_UseConnectedTrackWidth
)
{
if
(
TrackOnStartPoint
&&
TrackOnStartPoint
->
Type
()
==
PCB_TRACE_T
)
g_CurrentTrackSegment
->
m_Width
=
TrackOnStartPoint
->
m_Width
;
g_CurrentTrackSegment
->
SetWidth
(
TrackOnStartPoint
->
GetWidth
())
;
}
g_CurrentTrackSegment
->
m_Start
=
pos
;
g_CurrentTrackSegment
->
m_End
=
pos
;
g_CurrentTrackSegment
->
SetStart
(
pos
)
;
g_CurrentTrackSegment
->
SetEnd
(
pos
)
;
if
(
pad
)
{
...
...
@@ -275,12 +275,12 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
D
(
g_CurrentTrackList
.
VerifyListIntegrity
();
);
newTrack
->
m_Start
=
newTrack
->
m_End
;
newTrack
->
SetStart
(
newTrack
->
GetEnd
()
)
;
newTrack
->
SetLayer
(
GetScreen
()
->
m_Active_Layer
);
if
(
!
GetBoard
()
->
GetDesignSettings
().
m_UseConnectedTrackWidth
)
newTrack
->
m_Width
=
GetBoard
()
->
GetCurrentTrackWidth
(
);
newTrack
->
SetWidth
(
GetBoard
()
->
GetCurrentTrackWidth
()
);
D
(
g_CurrentTrackList
.
VerifyListIntegrity
();
);
...
...
@@ -312,15 +312,15 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC )
int
segm_step_45
=
KiROUND
(
GetScreen
()
->
GetGridSize
().
x
/
2
);
if
(
segm_step_45
<
(
curTrack
->
m_Width
*
2
)
)
segm_step_45
=
curTrack
->
m_Width
*
2
;
if
(
segm_step_45
<
(
curTrack
->
GetWidth
()
*
2
)
)
segm_step_45
=
curTrack
->
GetWidth
()
*
2
;
// Test if the segments are horizontal or vertical.
dx0
=
prevTrack
->
m_End
.
x
-
prevTrack
->
m_Start
.
x
;
dy0
=
prevTrack
->
m_End
.
y
-
prevTrack
->
m_Start
.
y
;
dx0
=
prevTrack
->
GetEnd
().
x
-
prevTrack
->
GetStart
()
.
x
;
dy0
=
prevTrack
->
GetEnd
().
y
-
prevTrack
->
GetStart
()
.
y
;
dx1
=
curTrack
->
m_End
.
x
-
curTrack
->
m_Start
.
x
;
dy1
=
curTrack
->
m_End
.
y
-
curTrack
->
m_Start
.
y
;
dx1
=
curTrack
->
GetEnd
().
x
-
curTrack
->
GetStart
()
.
x
;
dy1
=
curTrack
->
GetEnd
().
y
-
curTrack
->
GetStart
()
.
y
;
// Segments should have a min length.
if
(
std
::
max
(
abs
(
dx0
),
abs
(
dy0
)
)
<
(
segm_step_45
*
2
)
)
...
...
@@ -332,8 +332,8 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC )
// Create a new segment and connect it with the previous 2 segments.
TRACK
*
newTrack
=
(
TRACK
*
)
curTrack
->
Clone
();
newTrack
->
m_Start
=
prevTrack
->
m_End
;
newTrack
->
m_End
=
curTrack
->
m_Start
;
newTrack
->
SetStart
(
prevTrack
->
GetEnd
()
)
;
newTrack
->
SetEnd
(
curTrack
->
GetStart
()
)
;
if
(
dx0
==
0
)
// Previous segment is Vertical
{
...
...
@@ -348,14 +348,14 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC )
* horizontal segment.
*/
if
(
dy0
>
0
)
newTrack
->
m_Start
.
y
-=
segm_step_45
;
newTrack
->
SetStart
(
wxPoint
(
newTrack
->
GetStart
().
x
,
newTrack
->
GetStart
().
y
-
segm_step_45
)
)
;
else
newTrack
->
m_Start
.
y
+=
segm_step_45
;
newTrack
->
SetStart
(
wxPoint
(
newTrack
->
GetStart
().
x
,
newTrack
->
GetStart
().
y
+
segm_step_45
)
)
;
if
(
dx1
>
0
)
newTrack
->
m_End
.
x
+=
segm_step_45
;
newTrack
->
SetEnd
(
wxPoint
(
newTrack
->
GetEnd
().
x
+
segm_step_45
,
newTrack
->
GetEnd
().
y
)
)
;
else
newTrack
->
m_End
.
x
-=
segm_step_45
;
newTrack
->
SetEnd
(
wxPoint
(
newTrack
->
GetEnd
().
x
-
segm_step_45
,
newTrack
->
GetEnd
().
y
)
)
;
if
(
Drc_On
&&
BAD_DRC
==
m_drc
->
Drc
(
curTrack
,
GetBoard
()
->
m_Track
)
)
{
...
...
@@ -363,8 +363,8 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC )
return
false
;
}
prevTrack
->
m_End
=
newTrack
->
m_Start
;
curTrack
->
m_Start
=
newTrack
->
m_End
;
prevTrack
->
SetEnd
(
newTrack
->
GetStart
())
;
curTrack
->
SetStart
(
newTrack
->
GetEnd
())
;
g_CurrentTrackList
.
Insert
(
newTrack
,
curTrack
);
return
true
;
...
...
@@ -383,14 +383,14 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC )
* (horizontal) and segment 2 (vertical)
*/
if
(
dx0
>
0
)
newTrack
->
m_Start
.
x
-=
segm_step_45
;
newTrack
->
SetStart
(
wxPoint
(
newTrack
->
GetStart
().
x
-
segm_step_45
,
newTrack
->
GetStart
().
y
))
;
else
newTrack
->
m_Start
.
x
+=
segm_step_45
;
newTrack
->
SetStart
(
wxPoint
(
newTrack
->
GetStart
().
x
+
segm_step_45
,
newTrack
->
GetStart
().
y
)
)
;
if
(
dy1
>
0
)
newTrack
->
m_End
.
y
+=
segm_step_45
;
newTrack
->
SetEnd
(
wxPoint
(
newTrack
->
GetEnd
().
x
,
newTrack
->
GetEnd
().
y
+
segm_step_45
)
)
;
else
newTrack
->
m_End
.
y
-=
segm_step_45
;
newTrack
->
SetEnd
(
wxPoint
(
newTrack
->
GetEnd
().
x
,
newTrack
->
GetEnd
().
y
-
segm_step_45
)
)
;
if
(
Drc_On
&&
BAD_DRC
==
m_drc
->
Drc
(
newTrack
,
GetBoard
()
->
m_Track
)
)
{
...
...
@@ -398,8 +398,8 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC )
return
false
;
}
prevTrack
->
m_End
=
newTrack
->
m_Start
;
curTrack
->
m_Start
=
newTrack
->
m_End
;
prevTrack
->
SetEnd
(
newTrack
->
GetStart
())
;
curTrack
->
SetStart
(
newTrack
->
GetEnd
())
;
g_CurrentTrackList
.
Insert
(
newTrack
,
curTrack
);
return
true
;
...
...
@@ -420,7 +420,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
return
false
;
// Saving the coordinate of end point of the trace
wxPoint
pos
=
g_CurrentTrackSegment
->
m_End
;
wxPoint
pos
=
g_CurrentTrackSegment
->
GetEnd
()
;
D
(
g_CurrentTrackList
.
VerifyListIntegrity
();
);
...
...
@@ -460,9 +460,9 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
// creates a lock point if not exists
{
// Creates a lock point, if not already exists:
LockPoint
=
GetBoard
()
->
CreateLockPoint
(
g_CurrentTrackSegment
->
m_End
,
(
TRACK
*
)
LockPoint
,
&
s_ItemsListPicker
);
wxPoint
hp
=
g_CurrentTrackSegment
->
GetEnd
();
LockPoint
=
GetBoard
()
->
CreateLockPoint
(
hp
,
(
TRACK
*
)
LockPoint
,
&
s_ItemsListPicker
);
g_CurrentTrackSegment
->
SetEnd
(
hp
);
}
}
...
...
@@ -538,7 +538,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
TRACK
*
LocateIntrusion
(
TRACK
*
listStart
,
TRACK
*
aTrack
,
int
aLayer
,
const
wxPoint
&
aRef
)
{
int
net
=
aTrack
->
GetNet
();
int
width
=
aTrack
->
m_Width
;
int
width
=
aTrack
->
GetWidth
()
;
TRACK
*
found
=
NULL
;
...
...
@@ -556,16 +556,16 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoi
continue
;
// TRACK::HitTest
int
dist
=
(
width
+
track
->
m_Width
)
/
2
+
aTrack
->
GetClearance
(
track
);
int
dist
=
(
width
+
track
->
GetWidth
()
)
/
2
+
aTrack
->
GetClearance
(
track
);
if
(
!
TestSegmentHit
(
aRef
,
track
->
m_Start
,
track
->
m_End
,
dist
)
)
if
(
!
TestSegmentHit
(
aRef
,
track
->
GetStart
(),
track
->
GetEnd
()
,
dist
)
)
continue
;
found
=
track
;
// prefer intrusions from the side, not the end
wxPoint
pos
=
aRef
-
track
->
m_Start
;
wxPoint
vec
=
track
->
m_End
-
track
->
m_Start
;
wxPoint
pos
=
aRef
-
track
->
GetStart
()
;
wxPoint
vec
=
track
->
GetEnd
()
-
track
->
GetStart
()
;
double
tmp
=
(
double
)
pos
.
x
*
vec
.
x
+
(
double
)
pos
.
y
*
vec
.
y
;
if
(
tmp
>=
0
&&
tmp
<=
(
double
)
vec
.
x
*
vec
.
x
+
(
double
)
vec
.
y
*
vec
.
y
)
...
...
@@ -614,8 +614,8 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
if
(
other
->
GetNet
()
==
track
->
GetNet
()
)
return
;
cv
=
cursor
-
other
->
m_Start
;
vec
=
other
->
m_End
-
other
->
m_Start
;
cv
=
cursor
-
other
->
GetStart
()
;
vec
=
other
->
GetEnd
()
-
other
->
GetStart
()
;
det
=
(
double
)
cv
.
x
*
vec
.
y
-
(
double
)
cv
.
y
*
vec
.
x
;
...
...
@@ -623,7 +623,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
if
(
!
det
)
return
;
dist
=
(
track
->
m_Width
+
1
)
/
2
+
(
other
->
m_Width
+
1
)
/
2
+
track
->
GetClearance
(
other
)
+
2
;
dist
=
(
track
->
GetWidth
()
+
1
)
/
2
+
(
other
->
GetWidth
()
+
1
)
/
2
+
track
->
GetClearance
(
other
)
+
2
;
/*
* DRC wants >, so +1.
...
...
@@ -646,8 +646,9 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
n
.
x
=
KiROUND
(
f
*
n
.
x
);
n
.
y
=
KiROUND
(
f
*
n
.
y
);
Project
(
&
track
->
m_End
,
cursor
,
other
);
track
->
m_End
+=
n
;
wxPoint
hp
=
track
->
GetEnd
();
Project
(
&
hp
,
cursor
,
other
);
track
->
SetEnd
(
hp
+
n
);
}
...
...
@@ -702,7 +703,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
if
(
showTrackClearanceMode
>=
SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS
)
{
EDA_COLOR_T
color
=
g_ColorsSettings
.
GetLayerColor
(
g_CurrentTrackSegment
->
GetLayer
()
);
DrawViaCirclesWhenEditingNewTrack
(
panelClipBox
,
aDC
,
g_CurrentTrackSegment
->
m_End
,
DrawViaCirclesWhenEditingNewTrack
(
panelClipBox
,
aDC
,
g_CurrentTrackSegment
->
GetEnd
()
,
boardViaRadius
,
viaRadiusWithClearence
,
color
);
}
}
...
...
@@ -715,7 +716,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
g_CurrentTrackSegment
->
SetLayer
(
screen
->
m_Active_Layer
);
if
(
!
frame
->
GetBoard
()
->
GetDesignSettings
().
m_UseConnectedTrackWidth
)
g_CurrentTrackSegment
->
m_Width
=
frame
->
GetBoard
()
->
GetCurrentTrackWidth
(
);
g_CurrentTrackSegment
->
SetWidth
(
frame
->
GetBoard
()
->
GetCurrentTrackWidth
()
);
if
(
g_TwoSegmentTrackBuild
)
{
...
...
@@ -726,7 +727,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
previous_track
->
SetLayer
(
screen
->
m_Active_Layer
);
if
(
!
frame
->
GetBoard
()
->
GetDesignSettings
().
m_UseConnectedTrackWidth
)
previous_track
->
m_Width
=
frame
->
GetBoard
()
->
GetCurrentTrackWidth
(
);
previous_track
->
SetWidth
(
frame
->
GetBoard
()
->
GetCurrentTrackWidth
()
);
}
}
...
...
@@ -734,30 +735,32 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
{
if
(
g_TwoSegmentTrackBuild
)
{
g_CurrentTrackSegment
->
m_End
=
screen
->
GetCrossHairPosition
(
);
g_CurrentTrackSegment
->
SetEnd
(
screen
->
GetCrossHairPosition
()
);
if
(
Drc_On
)
PushTrack
(
aPanel
);
ComputeBreakPoint
(
g_CurrentTrackSegment
,
g_CurrentTrackList
.
GetCount
(),
g_CurrentTrackSegment
->
m_End
);
g_CurrentTrackSegment
->
GetEnd
()
);
}
else
{
/* Calculate of the end of the path for the permitted directions:
* horizontal, vertical or 45 degrees.
*/
wxPoint
hp
=
g_CurrentTrackSegment
->
GetEnd
();
CalculateSegmentEndPoint
(
screen
->
GetCrossHairPosition
(),
g_CurrentTrackSegment
->
m_Start
.
x
,
g_CurrentTrackSegment
->
m_Start
.
y
,
&
g_CurrentTrackSegment
->
m_End
.
x
,
&
g_CurrentTrackSegment
->
m_End
.
y
);
g_CurrentTrackSegment
->
GetStart
().
x
,
g_CurrentTrackSegment
->
GetStart
().
y
,
&
hp
.
x
,
&
hp
.
y
);
g_CurrentTrackSegment
->
SetEnd
(
hp
);
}
}
else
// Here the angle is arbitrary
{
g_CurrentTrackSegment
->
m_End
=
screen
->
GetCrossHairPosition
(
);
g_CurrentTrackSegment
->
SetEnd
(
screen
->
GetCrossHairPosition
()
);
}
// Redraw the new track
...
...
@@ -769,7 +772,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
EDA_COLOR_T
color
=
g_ColorsSettings
.
GetLayerColor
(
g_CurrentTrackSegment
->
GetLayer
());
//Via diameter must have taken what we are using, rather than netclass value.
DrawViaCirclesWhenEditingNewTrack
(
panelClipBox
,
aDC
,
g_CurrentTrackSegment
->
m_End
,
DrawViaCirclesWhenEditingNewTrack
(
panelClipBox
,
aDC
,
g_CurrentTrackSegment
->
GetEnd
()
,
boardViaRadius
,
viaRadiusWithClearence
,
color
);
}
...
...
@@ -821,7 +824,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
DisplayOpt
.
ShowTrackClearanceMode
=
showTrackClearanceMode
;
DisplayOpt
.
DisplayPcbTrackFill
=
Track_fill_copy
;
frame
->
BuildAirWiresTargetsList
(
NULL
,
g_CurrentTrackSegment
->
m_End
,
false
);
frame
->
BuildAirWiresTargetsList
(
NULL
,
g_CurrentTrackSegment
->
GetEnd
()
,
false
);
frame
->
TraceAirWiresToTargets
(
aDC
);
}
...
...
@@ -908,8 +911,8 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
if
(
track
)
{
iDx
=
end
.
x
-
track
->
m_Start
.
x
;
iDy
=
end
.
y
-
track
->
m_Start
.
y
;
iDx
=
end
.
x
-
track
->
GetStart
()
.
x
;
iDy
=
end
.
y
-
track
->
GetStart
()
.
y
;
iDx
=
abs
(
iDx
);
iDy
=
abs
(
iDy
);
...
...
@@ -919,8 +922,8 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
if
(
lastTrack
)
{
if
((
(
lastTrack
->
m_End
.
x
==
lastTrack
->
m_Start
.
x
)
||
(
lastTrack
->
m_End
.
y
==
lastTrack
->
m_Start
.
y
)
)
if
((
(
lastTrack
->
GetEnd
().
x
==
lastTrack
->
GetStart
()
.
x
)
||
(
lastTrack
->
GetEnd
().
y
==
lastTrack
->
GetStart
()
.
y
)
)
&&
!
g_Alternate_Track_Posture
)
{
iAngle
=
45
;
...
...
@@ -951,12 +954,10 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
break
;
case
0
:
if
(
(
end
.
x
-
track
->
m_Start
.
x
)
<
0
)
track
->
m_End
.
x
=
end
.
x
+
iDy
;
if
(
(
end
.
x
-
track
->
GetStart
()
.
x
)
<
0
)
track
->
SetEnd
(
wxPoint
(
end
.
x
+
iDy
,
track
->
GetStart
().
y
))
;
else
track
->
m_End
.
x
=
end
.
x
-
iDy
;
track
->
m_End
.
y
=
track
->
m_Start
.
y
;
track
->
SetEnd
(
wxPoint
(
end
.
x
-
iDy
,
track
->
GetStart
().
y
));
break
;
case
45
:
...
...
@@ -964,35 +965,32 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
iDy
=
iDx
;
// Recalculate the signs for deltax and deltaY.
if
(
(
end
.
x
-
track
->
m_Start
.
x
)
<
0
)
if
(
(
end
.
x
-
track
->
GetStart
()
.
x
)
<
0
)
iDx
=
-
iDx
;
if
(
(
end
.
y
-
track
->
m_Start
.
y
)
<
0
)
if
(
(
end
.
y
-
track
->
GetStart
()
.
y
)
<
0
)
iDy
=
-
iDy
;
track
->
m_End
.
x
=
track
->
m_Start
.
x
+
iDx
;
track
->
m_End
.
y
=
track
->
m_Start
.
y
+
iDy
;
track
->
SetEnd
(
wxPoint
(
track
->
GetStart
().
x
+
iDx
,
track
->
GetStart
().
y
+
iDy
));
break
;
case
90
:
if
(
(
end
.
y
-
track
->
m_Start
.
y
)
<
0
)
track
->
m_End
.
y
=
end
.
y
+
iDx
;
if
(
(
end
.
y
-
track
->
GetStart
()
.
y
)
<
0
)
track
->
SetEnd
(
wxPoint
(
track
->
GetStart
().
x
,
end
.
y
+
iDx
))
;
else
track
->
m_End
.
y
=
end
.
y
-
iDx
;
track
->
m_End
.
x
=
track
->
m_Start
.
x
;
track
->
SetEnd
(
wxPoint
(
track
->
GetStart
().
x
,
end
.
y
-
iDx
));
break
;
}
if
(
track
)
{
if
(
track
->
IsNull
()
)
track
->
m_End
=
end
;
track
->
SetEnd
(
end
)
;
newTrack
->
m_Start
=
track
->
m_End
;
newTrack
->
SetStart
(
track
->
GetEnd
()
)
;
}
newTrack
->
m_End
=
end
;
newTrack
->
SetEnd
(
end
)
;
}
...
...
@@ -1081,7 +1079,7 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList )
*/
void
EnsureEndTrackOnPad
(
D_PAD
*
aPad
)
{
if
(
g_CurrentTrackSegment
->
m_End
==
aPad
->
GetPosition
()
)
// Ok !
if
(
g_CurrentTrackSegment
->
GetEnd
()
==
aPad
->
GetPosition
()
)
// Ok !
{
g_CurrentTrackSegment
->
end
=
aPad
;
g_CurrentTrackSegment
->
SetState
(
END_ONPAD
,
ON
);
...
...
@@ -1098,7 +1096,7 @@ void EnsureEndTrackOnPad( D_PAD* aPad )
lasttrack
->
end
=
g_CurrentTrackSegment
;
}
g_CurrentTrackSegment
->
m_End
=
aPad
->
GetPosition
(
);
g_CurrentTrackSegment
->
SetEnd
(
aPad
->
GetPosition
()
);
g_CurrentTrackSegment
->
SetState
(
END_ONPAD
,
OFF
);
g_CurrentTrackSegment
->
end
=
aPad
;
...
...
pcbnew/event_handlers_tracks_vias_sizes.cpp
View file @
3e18fa42
...
...
@@ -111,9 +111,12 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
// Refresh track in progress, if any, by forcing a mouse event,
// to call the current function attached to the mouse
if
(
m_canvas
->
IsMouseCaptured
()
)
/*
if( m_canvas->IsMouseCaptured() )
{
wxMouseEvent event(wxEVT_MOTION);
wxPostEvent( m_canvas, event );
}
}*/
//+hp
//Refresh canvas, that we can see changes instantly. I use this because it dont,t throw mouse up-left corner.
m_canvas
->
Refresh
();
}
pcbnew/export_gencad.cpp
View file @
3e18fa42
...
...
@@ -225,8 +225,8 @@ static int ViaSort( const void* aRefptr, const void* aObjptr )
TRACK
*
padref
=
*
(
TRACK
**
)
aRefptr
;
TRACK
*
padcmp
=
*
(
TRACK
**
)
aObjptr
;
if
(
padref
->
m_Width
!=
padcmp
->
m_Width
)
return
padref
->
m_Width
-
padcmp
->
m_Width
;
if
(
padref
->
GetWidth
()
!=
padcmp
->
GetWidth
()
)
return
padref
->
GetWidth
()
-
padcmp
->
GetWidth
()
;
if
(
padref
->
GetDrillValue
()
!=
padcmp
->
GetDrillValue
()
)
return
padref
->
GetDrillValue
()
-
padcmp
->
GetDrillValue
();
...
...
@@ -292,10 +292,10 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
old_via
=
via
;
viastacks
.
push_back
(
via
);
fprintf
(
aFile
,
"PAD V%d.%d.%X ROUND %g
\n
CIRCLE 0 0 %g
\n
"
,
via
->
m_Width
,
via
->
GetDrillValue
(),
via
->
GetWidth
()
,
via
->
GetDrillValue
(),
via
->
ReturnMaskLayer
(),
via
->
GetDrillValue
()
/
SCALE_FACTOR
,
via
->
m_Width
/
(
SCALE_FACTOR
*
2
)
);
via
->
GetWidth
()
/
(
SCALE_FACTOR
*
2
)
);
}
// Emit component pads
...
...
@@ -436,7 +436,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
TRACK
*
via
=
viastacks
[
i
];
unsigned
mask
=
via
->
ReturnMaskLayer
()
&
master_layermask
;
fprintf
(
aFile
,
"PADSTACK VIA%d.%d.%X %g
\n
"
,
via
->
m_Width
,
via
->
GetDrillValue
(),
mask
,
via
->
GetWidth
()
,
via
->
GetDrillValue
(),
mask
,
via
->
GetDrillValue
()
/
SCALE_FACTOR
);
for
(
int
layer
=
0
;
layer
<
32
;
layer
++
)
...
...
@@ -444,7 +444,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb )
if
(
mask
&
(
1
<<
layer
)
)
{
fprintf
(
aFile
,
"PAD V%d.%d.%X %s 0 0
\n
"
,
via
->
m_Width
,
via
->
GetDrillValue
(),
via
->
GetWidth
()
,
via
->
GetDrillValue
(),
mask
,
TO_UTF8
(
GenCADLayerName
[
layer
]
)
);
}
...
...
@@ -736,7 +736,7 @@ static int TrackListSortByNetcode( const void* refptr, const void* objptr )
if
(
(
diff
=
ref
->
GetNet
()
-
cmp
->
GetNet
()
)
)
return
diff
;
if
(
(
diff
=
ref
->
m_Width
-
cmp
->
m_Width
)
)
if
(
(
diff
=
ref
->
GetWidth
()
-
cmp
->
GetWidth
()
)
)
return
diff
;
if
(
(
diff
=
ref
->
GetLayer
()
-
cmp
->
GetLayer
()
)
)
...
...
@@ -814,10 +814,10 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb )
fprintf
(
aFile
,
"ROUTE %s
\n
"
,
TO_UTF8
(
netname
)
);
}
if
(
old_width
!=
track
->
m_Width
)
if
(
old_width
!=
track
->
GetWidth
()
)
{
old_width
=
track
->
m_Width
;
fprintf
(
aFile
,
"TRACK TRACK%d
\n
"
,
track
->
m_Width
);
old_width
=
track
->
GetWidth
()
;
fprintf
(
aFile
,
"TRACK TRACK%d
\n
"
,
track
->
GetWidth
()
);
}
if
(
(
track
->
Type
()
==
PCB_TRACE_T
)
||
(
track
->
Type
()
==
PCB_ZONE_T
)
)
...
...
@@ -830,15 +830,15 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb )
}
fprintf
(
aFile
,
"LINE %g %g %g %g
\n
"
,
MapXTo
(
track
->
m_Start
.
x
),
MapYTo
(
track
->
m_Start
.
y
),
MapXTo
(
track
->
m_End
.
x
),
MapYTo
(
track
->
m_End
.
y
)
);
MapXTo
(
track
->
GetStart
().
x
),
MapYTo
(
track
->
GetStart
()
.
y
),
MapXTo
(
track
->
GetEnd
().
x
),
MapYTo
(
track
->
GetEnd
()
.
y
)
);
}
if
(
track
->
Type
()
==
PCB_VIA_T
)
{
fprintf
(
aFile
,
"VIA VIA%d.%d.%X %g %g ALL %g via%d
\n
"
,
track
->
m_Width
,
track
->
GetDrillValue
(),
track
->
GetWidth
()
,
track
->
GetDrillValue
(),
track
->
ReturnMaskLayer
()
&
master_layermask
,
MapXTo
(
track
->
m_Start
.
x
),
MapYTo
(
track
->
m_Start
.
y
),
MapXTo
(
track
->
GetStart
().
x
),
MapYTo
(
track
->
GetStart
()
.
y
),
track
->
GetDrillValue
()
/
SCALE_FACTOR
,
vianum
++
);
}
}
...
...
@@ -931,35 +931,35 @@ static void CreateTracksInfoData( FILE* aFile, BOARD* aPcb )
for
(
track
=
aPcb
->
m_Track
;
track
!=
NULL
;
track
=
track
->
Next
()
)
{
if
(
last_width
!=
track
->
m_Width
)
// Find a thickness already used.
if
(
last_width
!=
track
->
GetWidth
()
)
// Find a thickness already used.
{
for
(
ii
=
0
;
ii
<
trackinfo
.
size
();
ii
++
)
{
if
(
trackinfo
[
ii
]
==
track
->
m_Width
)
if
(
trackinfo
[
ii
]
==
track
->
GetWidth
()
)
break
;
}
if
(
ii
==
trackinfo
.
size
()
)
// not found
trackinfo
.
push_back
(
track
->
m_Width
);
trackinfo
.
push_back
(
track
->
GetWidth
()
);
last_width
=
track
->
m_Width
;
last_width
=
track
->
GetWidth
()
;
}
}
for
(
track
=
aPcb
->
m_Zone
;
track
!=
NULL
;
track
=
track
->
Next
()
)
{
if
(
last_width
!=
track
->
m_Width
)
// Find a thickness already used.
if
(
last_width
!=
track
->
GetWidth
()
)
// Find a thickness already used.
{
for
(
ii
=
0
;
ii
<
trackinfo
.
size
();
ii
++
)
{
if
(
trackinfo
[
ii
]
==
track
->
m_Width
)
if
(
trackinfo
[
ii
]
==
track
->
GetWidth
()
)
break
;
}
if
(
ii
==
trackinfo
.
size
()
)
// not found
trackinfo
.
push_back
(
track
->
m_Width
);
trackinfo
.
push_back
(
track
->
GetWidth
()
);
last_width
=
track
->
m_Width
;
last_width
=
track
->
GetWidth
()
;
}
}
...
...
pcbnew/export_vrml.cpp
View file @
3e18fa42
...
...
@@ -825,17 +825,17 @@ static void export_vrml_via( BOARD* pcb, SEGVIA* via ) //{{{
double
x
,
y
,
r
,
hole
;
int
top_layer
,
bottom_layer
;
r
=
via
->
m_Width
/
2
;
r
=
via
->
GetWidth
()
/
2
;
hole
=
via
->
GetDrillValue
()
/
2
;
x
=
via
->
m_Start
.
x
;
y
=
via
->
m_Start
.
y
;
x
=
via
->
GetStart
()
.
x
;
y
=
via
->
GetStart
()
.
y
;
via
->
ReturnLayerPair
(
&
top_layer
,
&
bottom_layer
);
// Export the via padstack
export_round_padstack
(
pcb
,
x
,
y
,
r
,
bottom_layer
,
top_layer
);
// Drill a hole
export_vrml_hole
(
via_triangles
[
via
->
m_Shape
],
top_layer
,
bottom_layer
,
x
,
y
,
hole
);
export_vrml_hole
(
via_triangles
[
via
->
GetShape
()
],
top_layer
,
bottom_layer
,
x
,
y
,
hole
);
}
...
...
@@ -846,8 +846,8 @@ static void export_vrml_tracks( BOARD* pcb ) //{{{
if
(
track
->
Type
()
==
PCB_VIA_T
)
export_vrml_via
(
pcb
,
(
SEGVIA
*
)
track
);
else
export_vrml_line
(
track
->
GetLayer
(),
track
->
m_Start
.
x
,
track
->
m_Start
.
y
,
track
->
m_End
.
x
,
track
->
m_End
.
y
,
track
->
m_Width
,
4
);
export_vrml_line
(
track
->
GetLayer
(),
track
->
GetStart
().
x
,
track
->
GetStart
()
.
y
,
track
->
GetEnd
().
x
,
track
->
GetEnd
().
y
,
track
->
GetWidth
()
,
4
);
}
}
...
...
pcbnew/gendrill_Excellon_writer.cpp
View file @
3e18fa42
...
...
@@ -480,7 +480,7 @@ void EXCELLON_WRITER::BuildHolesList( int aFirstLayer,
new_hole
.
m_Hole_Size
.
x
=
new_hole
.
m_Hole_Size
.
y
=
new_hole
.
m_Hole_Diameter
;
new_hole
.
m_Hole_Shape
=
0
;
// hole shape: round
new_hole
.
m_Hole_Pos
=
via
->
m_Start
;
new_hole
.
m_Hole_Pos
=
via
->
GetStart
()
;
via
->
ReturnLayerPair
(
&
new_hole
.
m_Hole_Top_Layer
,
&
new_hole
.
m_Hole_Bottom_Layer
);
// ReturnLayerPair return params with m_Hole_Bottom_Layer < m_Hole_Top_Layer
...
...
pcbnew/magnetic_tracks_functions.cpp
View file @
3e18fa42
...
...
@@ -74,19 +74,19 @@ static bool Join( wxPoint* aIntersectPoint, wxPoint a0, wxPoint a1, wxPoint b0,
*/
bool
Project
(
wxPoint
*
aNearPos
,
wxPoint
on_grid
,
const
TRACK
*
track
)
{
if
(
track
->
m_Start
==
track
->
m_End
)
if
(
track
->
GetStart
()
==
track
->
GetEnd
()
)
return
false
;
wxPoint
vec
=
track
->
m_End
-
track
->
m_Start
;
wxPoint
vec
=
track
->
GetEnd
()
-
track
->
GetStart
()
;
double
t
=
double
(
on_grid
.
x
-
track
->
m_Start
.
x
)
*
vec
.
x
+
double
(
on_grid
.
y
-
track
->
m_Start
.
y
)
*
vec
.
y
;
double
t
=
double
(
on_grid
.
x
-
track
->
GetStart
()
.
x
)
*
vec
.
x
+
double
(
on_grid
.
y
-
track
->
GetStart
()
.
y
)
*
vec
.
y
;
t
/=
(
double
)
vec
.
x
*
vec
.
x
+
(
double
)
vec
.
y
*
vec
.
y
;
t
=
std
::
min
(
std
::
max
(
t
,
0.0
),
1.0
);
aNearPos
->
x
=
KiROUND
(
track
->
m_Start
.
x
+
t
*
vec
.
x
);
aNearPos
->
y
=
KiROUND
(
track
->
m_Start
.
y
+
t
*
vec
.
y
);
aNearPos
->
x
=
KiROUND
(
track
->
GetStart
()
.
x
+
t
*
vec
.
x
);
aNearPos
->
y
=
KiROUND
(
track
->
GetStart
()
.
y
+
t
*
vec
.
y
);
return
true
;
}
...
...
@@ -183,7 +183,7 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
{
if
(
!
doCheckNet
||
!
currTrack
||
currTrack
->
GetNet
()
==
via
->
GetNet
()
)
{
*
curpos
=
via
->
m_Start
;
*
curpos
=
via
->
GetStart
()
;
// D(printf("via hit\n");)
return
true
;
}
...
...
@@ -210,10 +210,10 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
* In two segment mode, ignore the final segment if it's inside a grid square.
*/
if
(
!
amMovingVia
&&
currTrack
&&
g_TwoSegmentTrackBuild
&&
currTrack
->
Back
()
&&
currTrack
->
m_Start
.
x
-
aGridSize
.
x
<
currTrack
->
m_End
.
x
&&
currTrack
->
m_Start
.
x
+
aGridSize
.
x
>
currTrack
->
m_End
.
x
&&
currTrack
->
m_Start
.
y
-
aGridSize
.
y
<
currTrack
->
m_End
.
y
&&
currTrack
->
m_Start
.
y
+
aGridSize
.
y
>
currTrack
->
m_End
.
y
)
&&
currTrack
->
GetStart
().
x
-
aGridSize
.
x
<
currTrack
->
GetEnd
()
.
x
&&
currTrack
->
GetStart
().
x
+
aGridSize
.
x
>
currTrack
->
GetEnd
()
.
x
&&
currTrack
->
GetStart
().
y
-
aGridSize
.
y
<
currTrack
->
GetEnd
()
.
y
&&
currTrack
->
GetStart
().
y
+
aGridSize
.
y
>
currTrack
->
GetEnd
()
.
y
)
{
currTrack
=
currTrack
->
Back
();
}
...
...
@@ -239,7 +239,7 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
// D(printf( "have track prospect\n");)
if
(
Join
(
curpos
,
track
->
m_Start
,
track
->
m_End
,
currTrack
->
m_Start
,
currTrack
->
m_End
)
)
if
(
Join
(
curpos
,
track
->
GetStart
(),
track
->
GetEnd
(),
currTrack
->
GetStart
(),
currTrack
->
GetEnd
()
)
)
{
// D(printf( "join currTrack->Type()=%d\n", currTrack->Type() );)
return
true
;
...
...
@@ -251,27 +251,27 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
// a new track and that new track is parallel to the track the
// mouse is on. Find the nearest end point of the track under mouse
// to the mouse and return that.
double
distStart
=
hypot
(
double
(
curpos
->
x
-
track
->
m_Start
.
x
),
double
(
curpos
->
y
-
track
->
m_Start
.
y
));
double
distStart
=
hypot
(
double
(
curpos
->
x
-
track
->
GetStart
()
.
x
),
double
(
curpos
->
y
-
track
->
GetStart
()
.
y
));
double
distEnd
=
hypot
(
double
(
curpos
->
x
-
track
->
m_End
.
x
),
double
(
curpos
->
y
-
track
->
m_End
.
y
));
double
distEnd
=
hypot
(
double
(
curpos
->
x
-
track
->
GetEnd
()
.
x
),
double
(
curpos
->
y
-
track
->
GetEnd
()
.
y
));
// if track not via, or if its a via dragging but not with its adjacent track
if
(
currTrack
->
Type
()
!=
PCB_VIA_T
||
(
currTrack
->
m_Start
!=
track
->
m_Start
&&
currTrack
->
m_Start
!=
track
->
m_End
))
||
(
currTrack
->
GetStart
()
!=
track
->
GetStart
()
&&
currTrack
->
GetStart
()
!=
track
->
GetEnd
()
))
{
if
(
distStart
<=
currTrack
->
m_Width
/
2
)
if
(
distStart
<=
currTrack
->
GetWidth
()
/
2
)
{
// D(printf("nearest end is start\n");)
*
curpos
=
track
->
m_Start
;
*
curpos
=
track
->
GetStart
()
;
return
true
;
}
if
(
distEnd
<=
currTrack
->
m_Width
/
2
)
if
(
distEnd
<=
currTrack
->
GetWidth
()
/
2
)
{
// D(printf("nearest end is end\n");)
*
curpos
=
track
->
m_End
;
*
curpos
=
track
->
GetEnd
()
;
return
true
;
}
...
...
pcbnew/move-drag_pads.cpp
View file @
3e18fa42
...
...
@@ -139,10 +139,10 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* aPad, wxDC* DC )
// Set the old state
if
(
g_DragSegmentList
[
ii
].
m_Pad_Start
)
Track
->
m_Start
=
Pad_OldPos
;
Track
->
SetStart
(
Pad_OldPos
)
;
if
(
g_DragSegmentList
[
ii
].
m_Pad_End
)
Track
->
m_End
=
Pad_OldPos
;
Track
->
SetEnd
(
Pad_OldPos
)
;
picker
.
SetItem
(
Track
);
pickList
.
PushItem
(
picker
);
...
...
@@ -172,10 +172,10 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* aPad, wxDC* DC )
// Set the new state
if
(
g_DragSegmentList
[
ii
].
m_Pad_Start
)
Track
->
m_Start
=
aPad
->
GetPosition
(
);
Track
->
SetStart
(
aPad
->
GetPosition
()
);
if
(
g_DragSegmentList
[
ii
].
m_Pad_End
)
Track
->
m_End
=
aPad
->
GetPosition
(
);
Track
->
SetEnd
(
aPad
->
GetPosition
()
);
Track
->
SetState
(
IN_EDIT
,
OFF
);
...
...
pcbnew/move_or_drag_track.cpp
View file @
3e18fa42
...
...
@@ -134,13 +134,13 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
track
->
Draw
(
aPanel
,
aDC
,
draw_mode
);
if
(
track
->
GetFlags
()
&
STARTPOINT
)
track
->
m_Start
+=
moveVector
;
track
->
SetStart
(
track
->
GetStart
()
+
moveVector
)
;
if
(
track
->
GetFlags
()
&
ENDPOINT
)
track
->
m_End
+=
moveVector
;
track
->
SetEnd
(
track
->
GetEnd
()
+
moveVector
)
;
if
(
track
->
Type
()
==
PCB_VIA_T
)
track
->
m_End
=
track
->
m_Start
;
track
->
SetEnd
(
track
->
GetStart
()
)
;
track
->
Draw
(
aPanel
,
aDC
,
draw_mode
);
}
...
...
@@ -265,10 +265,10 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
dy
=
Pos
.
y
-
s_LastPos
.
y
;
//move the line by dx and dy
tx1
=
(
double
)
(
Track
->
m_Start
.
x
+
dx
);
ty1
=
(
double
)
(
Track
->
m_Start
.
y
+
dy
);
tx2
=
(
double
)
(
Track
->
m_End
.
x
+
dx
);
ty2
=
(
double
)
(
Track
->
m_End
.
y
+
dy
);
tx1
=
(
double
)
(
Track
->
GetStart
()
.
x
+
dx
);
ty1
=
(
double
)
(
Track
->
GetStart
()
.
y
+
dy
);
tx2
=
(
double
)
(
Track
->
GetEnd
()
.
x
+
dx
);
ty2
=
(
double
)
(
Track
->
GetEnd
()
.
y
+
dy
);
// recalculate the segments new parameters and intersection points
// only the intercept will change, segment slopes does not change
...
...
@@ -393,25 +393,23 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
if
(
update
)
{
s_LastPos
=
Pos
;
Track
->
m_Start
.
x
=
KiROUND
(
xi1
);
Track
->
m_Start
.
y
=
KiROUND
(
yi1
);
Track
->
m_End
.
x
=
KiROUND
(
xi2
);
Track
->
m_End
.
y
=
KiROUND
(
yi2
);
Track
->
SetStart
(
wxPoint
(
KiROUND
(
xi1
),
KiROUND
(
yi1
)
)
);
Track
->
SetEnd
(
wxPoint
(
KiROUND
(
xi2
),
KiROUND
(
yi2
)
)
);
if
(
tSegmentToEnd
)
{
if
(
tSegmentToEnd
->
GetFlags
()
&
STARTPOINT
)
tSegmentToEnd
->
m_Start
=
Track
->
m_End
;
tSegmentToEnd
->
SetStart
(
Track
->
GetEnd
()
)
;
else
tSegmentToEnd
->
m_End
=
Track
->
m_End
;
tSegmentToEnd
->
SetEnd
(
Track
->
GetEnd
()
)
;
}
if
(
tSegmentToStart
)
{
if
(
tSegmentToStart
->
GetFlags
()
&
STARTPOINT
)
tSegmentToStart
->
m_Start
=
Track
->
m_Start
;
tSegmentToStart
->
SetStart
(
Track
->
GetStart
()
)
;
else
tSegmentToStart
->
m_End
=
Track
->
m_Start
;
tSegmentToStart
->
SetEnd
(
Track
->
GetStart
()
)
;
}
}
...
...
@@ -489,25 +487,25 @@ bool InitialiseDragParameters()
{
if
(
tSegmentToStart
->
GetFlags
()
&
ENDPOINT
)
{
tx1
=
(
double
)
tSegmentToStart
->
m_Start
.
x
;
ty1
=
(
double
)
tSegmentToStart
->
m_Start
.
y
;
tx2
=
(
double
)
tSegmentToStart
->
m_End
.
x
;
ty2
=
(
double
)
tSegmentToStart
->
m_End
.
y
;
tx1
=
(
double
)
tSegmentToStart
->
GetStart
()
.
x
;
ty1
=
(
double
)
tSegmentToStart
->
GetStart
()
.
y
;
tx2
=
(
double
)
tSegmentToStart
->
GetEnd
()
.
x
;
ty2
=
(
double
)
tSegmentToStart
->
GetEnd
()
.
y
;
}
else
{
tx1
=
(
double
)
tSegmentToStart
->
m_End
.
x
;
ty1
=
(
double
)
tSegmentToStart
->
m_End
.
y
;
tx2
=
(
double
)
tSegmentToStart
->
m_Start
.
x
;
ty2
=
(
double
)
tSegmentToStart
->
m_Start
.
y
;
tx1
=
(
double
)
tSegmentToStart
->
GetEnd
()
.
x
;
ty1
=
(
double
)
tSegmentToStart
->
GetEnd
()
.
y
;
tx2
=
(
double
)
tSegmentToStart
->
GetStart
()
.
x
;
ty2
=
(
double
)
tSegmentToStart
->
GetStart
()
.
y
;
}
}
else
// move the start point on a line starting at Track->
m_Start
, and perpendicular to Track
else
// move the start point on a line starting at Track->
GetStart()
, and perpendicular to Track
{
tx1
=
(
double
)
Track
->
m_Start
.
x
;
ty1
=
(
double
)
Track
->
m_Start
.
y
;
tx2
=
(
double
)
Track
->
m_End
.
x
;
ty2
=
(
double
)
Track
->
m_End
.
y
;
tx1
=
(
double
)
Track
->
GetStart
()
.
x
;
ty1
=
(
double
)
Track
->
GetStart
()
.
y
;
tx2
=
(
double
)
Track
->
GetEnd
()
.
x
;
ty2
=
(
double
)
Track
->
GetEnd
()
.
y
;
RotatePoint
(
&
tx2
,
&
ty2
,
tx1
,
ty1
,
900
);
}
...
...
@@ -532,25 +530,25 @@ bool InitialiseDragParameters()
//check if second line is vertical
if
(
tSegmentToEnd
->
GetFlags
()
&
STARTPOINT
)
{
tx1
=
(
double
)
tSegmentToEnd
->
m_Start
.
x
;
ty1
=
(
double
)
tSegmentToEnd
->
m_Start
.
y
;
tx2
=
(
double
)
tSegmentToEnd
->
m_End
.
x
;
ty2
=
(
double
)
tSegmentToEnd
->
m_End
.
y
;
tx1
=
(
double
)
tSegmentToEnd
->
GetStart
()
.
x
;
ty1
=
(
double
)
tSegmentToEnd
->
GetStart
()
.
y
;
tx2
=
(
double
)
tSegmentToEnd
->
GetEnd
()
.
x
;
ty2
=
(
double
)
tSegmentToEnd
->
GetEnd
()
.
y
;
}
else
{
tx1
=
(
double
)
tSegmentToEnd
->
m_End
.
x
;
ty1
=
(
double
)
tSegmentToEnd
->
m_End
.
y
;
tx2
=
(
double
)
tSegmentToEnd
->
m_Start
.
x
;
ty2
=
(
double
)
tSegmentToEnd
->
m_Start
.
y
;
tx1
=
(
double
)
tSegmentToEnd
->
GetEnd
()
.
x
;
ty1
=
(
double
)
tSegmentToEnd
->
GetEnd
()
.
y
;
tx2
=
(
double
)
tSegmentToEnd
->
GetStart
()
.
x
;
ty2
=
(
double
)
tSegmentToEnd
->
GetStart
()
.
y
;
}
}
else
// move the start point on a line starting at Track->
m_End
, and perpendicular to Track
else
// move the start point on a line starting at Track->
GetEnd()
, and perpendicular to Track
{
tx1
=
(
double
)
Track
->
m_End
.
x
;
ty1
=
(
double
)
Track
->
m_End
.
y
;
tx2
=
(
double
)
Track
->
m_Start
.
x
;
ty2
=
(
double
)
Track
->
m_Start
.
y
;
tx1
=
(
double
)
Track
->
GetEnd
()
.
x
;
ty1
=
(
double
)
Track
->
GetEnd
()
.
y
;
tx2
=
(
double
)
Track
->
GetStart
()
.
x
;
ty2
=
(
double
)
Track
->
GetStart
()
.
y
;
RotatePoint
(
&
tx2
,
&
ty2
,
tx1
,
ty1
,
-
900
);
}
...
...
@@ -570,10 +568,10 @@ bool InitialiseDragParameters()
}
// Init parameters for the moved segment
tx1
=
(
double
)
Track
->
m_Start
.
x
;
ty1
=
(
double
)
Track
->
m_Start
.
y
;
tx2
=
(
double
)
Track
->
m_End
.
x
;
ty2
=
(
double
)
Track
->
m_End
.
y
;
tx1
=
(
double
)
Track
->
GetStart
()
.
x
;
ty1
=
(
double
)
Track
->
GetStart
()
.
y
;
tx2
=
(
double
)
Track
->
GetEnd
()
.
x
;
ty2
=
(
double
)
Track
->
GetEnd
()
.
y
;
if
(
tx2
!=
tx1
)
{
...
...
@@ -630,12 +628,12 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
if
(
aCommand
!=
ID_POPUP_PCB_MOVE_TRACK_SEGMENT
)
{
Collect_TrackSegmentsToDrag
(
GetBoard
(),
aTrack
->
m_Start
,
Collect_TrackSegmentsToDrag
(
GetBoard
(),
aTrack
->
GetStart
()
,
aTrack
->
ReturnMaskLayer
(),
aTrack
->
GetNet
(),
aTrack
->
GetWidth
()
/
2
);
}
PosInit
=
aTrack
->
m_Start
;
PosInit
=
aTrack
->
GetStart
()
;
}
else
{
...
...
@@ -650,17 +648,17 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
break
;
case
ID_POPUP_PCB_DRAG_TRACK_SEGMENT
:
// drag a segment
pos
=
aTrack
->
m_Start
;
pos
=
aTrack
->
GetStart
()
;
Collect_TrackSegmentsToDrag
(
GetBoard
(),
pos
,
aTrack
->
ReturnMaskLayer
(),
aTrack
->
GetNet
(),
aTrack
->
GetWidth
()
/
2
);
pos
=
aTrack
->
m_End
;
pos
=
aTrack
->
GetEnd
()
;
aTrack
->
SetFlags
(
IS_DRAGGED
|
ENDPOINT
|
STARTPOINT
);
Collect_TrackSegmentsToDrag
(
GetBoard
(),
pos
,
aTrack
->
ReturnMaskLayer
(),
aTrack
->
GetNet
(),
aTrack
->
GetWidth
()
/
2
);
break
;
case
ID_POPUP_PCB_MOVE_TRACK_NODE
:
// Drag via or move node
pos
=
(
diag
&
STARTPOINT
)
?
aTrack
->
m_Start
:
aTrack
->
m_End
;
pos
=
(
diag
&
STARTPOINT
)
?
aTrack
->
GetStart
()
:
aTrack
->
GetEnd
()
;
Collect_TrackSegmentsToDrag
(
GetBoard
(),
pos
,
aTrack
->
ReturnMaskLayer
(),
aTrack
->
GetNet
(),
aTrack
->
GetWidth
()
/
2
);
PosInit
=
pos
;
...
...
@@ -770,7 +768,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
{
int
flag
=
STARTPOINT
;
if
(
track
->
m_Start
!=
TrackToStartPoint
->
m_Start
)
if
(
track
->
GetStart
()
!=
TrackToStartPoint
->
GetStart
()
)
flag
=
ENDPOINT
;
AddSegmentToDragList
(
flag
,
TrackToStartPoint
);
...
...
@@ -781,7 +779,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
{
int
flag
=
STARTPOINT
;
if
(
track
->
m_End
!=
TrackToEndPoint
->
m_Start
)
if
(
track
->
GetEnd
()
!=
TrackToEndPoint
->
GetStart
()
)
flag
=
ENDPOINT
;
AddSegmentToDragList
(
flag
,
TrackToEndPoint
);
...
...
@@ -868,14 +866,14 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
* (only pad connection must be tested, track connection will be
* tested by TestNetConnection() ) */
int
layerMask
=
GetLayerMask
(
Track
->
GetLayer
()
);
Track
->
start
=
GetBoard
()
->
GetPadFast
(
Track
->
m_Start
,
layerMask
);
Track
->
start
=
GetBoard
()
->
GetPadFast
(
Track
->
GetStart
()
,
layerMask
);
if
(
Track
->
start
)
Track
->
SetState
(
BEGIN_ONPAD
,
ON
);
else
Track
->
SetState
(
BEGIN_ONPAD
,
OFF
);
Track
->
end
=
GetBoard
()
->
GetPadFast
(
Track
->
m_End
,
layerMask
);
Track
->
end
=
GetBoard
()
->
GetPadFast
(
Track
->
GetEnd
()
,
layerMask
);
if
(
Track
->
end
)
Track
->
SetState
(
END_ONPAD
,
ON
);
...
...
pcbnew/plot_board_layers.cpp
View file @
3e18fa42
...
...
@@ -137,7 +137,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask,
if
(
(
(
1
<<
seg
->
GetLayer
()
)
&
aLayerMask
)
==
0
)
continue
;
aPlotter
->
ThickSegment
(
seg
->
m_Start
,
seg
->
m_End
,
seg
->
m_Width
,
aPlotter
->
ThickSegment
(
seg
->
GetStart
(),
seg
->
GetEnd
(),
seg
->
GetWidth
()
,
itemplotter
.
GetMode
()
);
}
}
...
...
@@ -392,17 +392,17 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
if
(
aLayerMask
&
ALL_CU_LAYERS
)
width_adj
=
itemplotter
.
getFineWidthAdj
();
int
diameter
=
Via
->
m_Width
+
2
*
via_margin
+
width_adj
;
int
diameter
=
Via
->
GetWidth
()
+
2
*
via_margin
+
width_adj
;
// Don't draw a null size item :
if
(
diameter
<=
0
)
continue
;
EDA_COLOR_T
color
=
aBoard
->
GetVisibleElementColor
(
VIAS_VISIBLE
+
Via
->
m_Shape
);
EDA_COLOR_T
color
=
aBoard
->
GetVisibleElementColor
(
VIAS_VISIBLE
+
Via
->
GetShape
()
);
// Set plot color (change WHITE to LIGHTGRAY because
// the white items are not seen on a white paper or screen
aPlotter
->
SetColor
(
color
!=
WHITE
?
color
:
LIGHTGRAY
);
aPlotter
->
FlashPadCircle
(
Via
->
m_Start
,
diameter
,
plotMode
);
aPlotter
->
FlashPadCircle
(
Via
->
GetStart
()
,
diameter
,
plotMode
);
}
// Plot tracks (not vias) :
...
...
@@ -414,9 +414,9 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
if
(
(
GetLayerMask
(
track
->
GetLayer
()
)
&
aLayerMask
)
==
0
)
continue
;
int
width
=
track
->
m_Width
+
itemplotter
.
getFineWidthAdj
();
int
width
=
track
->
GetWidth
()
+
itemplotter
.
getFineWidthAdj
();
aPlotter
->
SetColor
(
itemplotter
.
getColor
(
track
->
GetLayer
()
)
);
aPlotter
->
ThickSegment
(
track
->
m_Start
,
track
->
m_End
,
width
,
plotMode
);
aPlotter
->
ThickSegment
(
track
->
GetStart
(),
track
->
GetEnd
()
,
width
,
plotMode
);
}
// Plot zones (outdated, for old boards compatibility):
...
...
@@ -425,9 +425,9 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
if
(
(
GetLayerMask
(
track
->
GetLayer
()
)
&
aLayerMask
)
==
0
)
continue
;
int
width
=
track
->
m_Width
+
itemplotter
.
getFineWidthAdj
();
int
width
=
track
->
GetWidth
()
+
itemplotter
.
getFineWidthAdj
();
aPlotter
->
SetColor
(
itemplotter
.
getColor
(
track
->
GetLayer
()
)
);
aPlotter
->
ThickSegment
(
track
->
m_Start
,
track
->
m_End
,
width
,
plotMode
);
aPlotter
->
ThickSegment
(
track
->
GetStart
(),
track
->
GetEnd
()
,
width
,
plotMode
);
}
// Plot filled ares
...
...
pcbnew/plot_brditems_plotter.cpp
View file @
3e18fa42
...
...
@@ -711,8 +711,8 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
continue
;
plotOneDrillMark
(
PAD_CIRCLE
,
pts
->
m_Start
,
wxSize
(
pts
->
GetDrillValue
(),
0
),
wxSize
(
pts
->
m_Width
,
0
),
0
,
small_drill
);
pts
->
GetStart
()
,
wxSize
(
pts
->
GetDrillValue
(),
0
),
wxSize
(
pts
->
GetWidth
()
,
0
),
0
,
small_drill
);
}
for
(
MODULE
*
Module
=
m_board
->
m_Modules
;
Module
!=
NULL
;
Module
=
Module
->
Next
()
)
...
...
pcbnew/print_board_functions.cpp
View file @
3e18fa42
...
...
@@ -231,12 +231,12 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
if
(
pt_trace
->
Type
()
==
PCB_VIA_T
)
// VIA encountered.
{
int
radius
=
pt_trace
->
m_Width
>>
1
;
EDA_COLOR_T
color
=
g_ColorsSettings
.
GetItemColor
(
VIAS_VISIBLE
+
pt_trace
->
m_Shape
);
int
radius
=
pt_trace
->
GetWidth
()
>>
1
;
EDA_COLOR_T
color
=
g_ColorsSettings
.
GetItemColor
(
VIAS_VISIBLE
+
pt_trace
->
GetShape
()
);
GRSetDrawMode
(
aDC
,
drawmode
);
GRFilledCircle
(
m_canvas
->
GetClipBox
(),
aDC
,
pt_trace
->
m_Start
.
x
,
pt_trace
->
m_Start
.
y
,
pt_trace
->
GetStart
()
.
x
,
pt_trace
->
GetStart
()
.
y
,
radius
,
0
,
color
,
color
);
}
...
...
@@ -305,7 +305,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
diameter
=
pt_trace
->
GetDrillValue
();
GRFilledCircle
(
m_canvas
->
GetClipBox
(),
aDC
,
pt_trace
->
m_Start
.
x
,
pt_trace
->
m_Start
.
y
,
pt_trace
->
GetStart
().
x
,
pt_trace
->
GetStart
()
.
y
,
diameter
/
2
,
0
,
color
,
color
);
}
...
...
pcbnew/ratsnest.cpp
View file @
3e18fa42
...
...
@@ -847,10 +847,10 @@ void PCB_BASE_FRAME::BuildAirWiresTargetsList( BOARD_CONNECTED_ITEM* aItemRef,
if
(
!
track
->
GetSubNet
()
||
(
track
->
GetSubNet
()
!=
subnet
)
)
{
if
(
aPosition
!=
track
->
m_Start
)
s_TargetsLocations
.
push_back
(
track
->
m_Start
);
if
(
aPosition
!=
track
->
m_End
&&
track
->
m_Start
!=
track
->
m_End
)
s_TargetsLocations
.
push_back
(
track
->
m_End
);
if
(
aPosition
!=
track
->
GetStart
()
)
s_TargetsLocations
.
push_back
(
track
->
GetStart
()
);
if
(
aPosition
!=
track
->
GetEnd
()
&&
track
->
GetStart
()
!=
track
->
GetEnd
()
)
s_TargetsLocations
.
push_back
(
track
->
GetEnd
()
);
}
}
...
...
pcbnew/specctra_export.cpp
View file @
3e18fa42
...
...
@@ -761,7 +761,7 @@ PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia )
if
(
topLayer
>
botLayer
)
EXCHG
(
topLayer
,
botLayer
);
return
makeVia
(
aVia
->
m_Width
,
aVia
->
GetDrillValue
(),
topLayer
,
botLayer
);
return
makeVia
(
aVia
->
GetWidth
()
,
aVia
->
GetDrillValue
(),
topLayer
,
botLayer
);
}
...
...
@@ -1493,12 +1493,12 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
continue
;
if
(
old_netcode
!=
netcode
||
old_width
!=
track
->
m_Width
||
old_width
!=
track
->
GetWidth
()
||
old_layer
!=
track
->
GetLayer
()
||
(
path
&&
path
->
points
.
back
()
!=
mapPt
(
track
->
m_Start
)
)
||
(
path
&&
path
->
points
.
back
()
!=
mapPt
(
track
->
GetStart
()
)
)
)
{
old_width
=
track
->
m_Width
;
old_width
=
track
->
GetWidth
()
;
old_layer
=
track
->
GetLayer
();
if
(
old_netcode
!=
netcode
)
...
...
@@ -1524,10 +1524,10 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
path
->
layer_id
=
layerIds
[
pcbLayer
];
path
->
aperture_width
=
scale
(
old_width
);
path
->
AppendPoint
(
mapPt
(
track
->
m_Start
)
);
path
->
AppendPoint
(
mapPt
(
track
->
GetStart
()
)
);
}
path
->
AppendPoint
(
mapPt
(
track
->
m_End
)
);
path
->
AppendPoint
(
mapPt
(
track
->
GetEnd
()
)
);
}
}
...
...
pcbnew/specctra_import.cpp
View file @
3e18fa42
...
...
@@ -235,10 +235,10 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) thro
TRACK
*
track
=
new
TRACK
(
sessionBoard
);
track
->
m_Start
=
mapPt
(
aPath
->
points
[
aPointIndex
+
0
],
routeResolution
);
track
->
m_End
=
mapPt
(
aPath
->
points
[
aPointIndex
+
1
],
routeResolution
);
track
->
SetStart
(
mapPt
(
aPath
->
points
[
aPointIndex
+
0
],
routeResolution
)
);
track
->
SetEnd
(
mapPt
(
aPath
->
points
[
aPointIndex
+
1
],
routeResolution
)
);
track
->
SetLayer
(
pcbLayer2kicad
[
layerNdx
]
);
track
->
m_Width
=
scale
(
aPath
->
aperture_width
,
routeResolution
);
track
->
SetWidth
(
scale
(
aPath
->
aperture_width
,
routeResolution
)
);
track
->
SetNet
(
aNetcode
);
return
track
;
...
...
@@ -295,8 +295,8 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
via
=
new
SEGVIA
(
sessionBoard
);
via
->
SetPosition
(
mapPt
(
aPoint
,
routeResolution
)
);
via
->
SetDrill
(
drillDiam
);
via
->
m_Shape
=
VIA_THROUGH
;
via
->
m_Width
=
viaDiam
;
via
->
SetShape
(
VIA_THROUGH
)
;
via
->
SetWidth
(
viaDiam
)
;
via
->
SetLayerPair
(
LAYER_N_FRONT
,
LAYER_N_BACK
);
}
else
if
(
shapeCount
==
copperLayerCount
)
...
...
@@ -313,8 +313,8 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
via
=
new
SEGVIA
(
sessionBoard
);
via
->
SetPosition
(
mapPt
(
aPoint
,
routeResolution
)
);
via
->
SetDrill
(
drillDiam
);
via
->
m_Shape
=
VIA_THROUGH
;
via
->
m_Width
=
viaDiam
;
via
->
SetShape
(
VIA_THROUGH
)
;
via
->
SetWidth
(
viaDiam
)
;
via
->
SetLayerPair
(
LAYER_N_FRONT
,
LAYER_N_BACK
);
}
else
// VIA_MICROVIA or VIA_BLIND_BURIED
...
...
@@ -357,11 +357,11 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
if
(
(
topLayerNdx
==
0
&&
botLayerNdx
==
1
)
||
(
topLayerNdx
==
copperLayerCount
-
2
&&
botLayerNdx
==
copperLayerCount
-
1
))
via
->
m_Shape
=
VIA_MICROVIA
;
via
->
SetShape
(
VIA_MICROVIA
)
;
else
via
->
m_Shape
=
VIA_BLIND_BURIED
;
via
->
SetShape
(
VIA_BLIND_BURIED
)
;
via
->
m_Width
=
viaDiam
;
via
->
SetWidth
(
viaDiam
)
;
topLayerNdx
=
pcbLayer2kicad
[
topLayerNdx
];
botLayerNdx
=
pcbLayer2kicad
[
botLayerNdx
];
...
...
pcbnew/tr_modif.cpp
View file @
3e18fa42
...
...
@@ -126,8 +126,8 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
if
(
(
StartTrack
==
NULL
)
||
(
EndTrack
==
NULL
)
)
return
0
;
start
=
StartTrack
->
m_Start
;
end
=
EndTrack
->
m_End
;
start
=
StartTrack
->
GetStart
()
;
end
=
EndTrack
->
GetEnd
()
;
// The start and end points cannot be the same.
if
(
start
==
end
)
...
...
@@ -248,7 +248,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
if
(
pt_segm
->
GetState
(
BUSY
)
==
0
)
break
;
if
(
pt_segm
->
m_Start
==
start
||
pt_segm
->
m_End
==
start
)
if
(
pt_segm
->
GetStart
()
==
start
||
pt_segm
->
GetEnd
()
==
start
)
{
// Marked track can be erased.
TRACK
*
NextS
;
...
...
pcbnew/zones_polygons_insulated_copper_islands.cpp
View file @
3e18fa42
...
...
@@ -74,10 +74,10 @@ void ZONE_CONTAINER::Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD
if
(
track
->
GetNet
()
!=
GetNet
()
)
continue
;
listPointsCandidates
.
push_back
(
track
->
m_Start
);
listPointsCandidates
.
push_back
(
track
->
GetStart
()
);
if
(
track
->
Type
()
!=
PCB_VIA_T
)
listPointsCandidates
.
push_back
(
track
->
m_End
);
listPointsCandidates
.
push_back
(
track
->
GetEnd
()
);
}
// test if a point is inside
...
...
pcbnew/zones_polygons_test_connections.cpp
View file @
3e18fa42
...
...
@@ -169,12 +169,12 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
}
else
if
(
item
->
Type
()
==
PCB_VIA_T
)
{
pos1
=
pos2
=
(
(
SEGVIA
*
)
item
)
->
m_Start
;
pos1
=
pos2
=
(
(
SEGVIA
*
)
item
)
->
GetStart
()
;
}
else
if
(
item
->
Type
()
==
PCB_TRACE_T
)
{
pos1
=
(
(
TRACK
*
)
item
)
->
m_Start
;
pos2
=
(
(
TRACK
*
)
item
)
->
m_End
;
pos1
=
(
(
TRACK
*
)
item
)
->
GetStart
()
;
pos2
=
(
(
TRACK
*
)
item
)
->
GetEnd
()
;
}
else
{
...
...
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