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
c2af94ac
Commit
c2af94ac
authored
Apr 25, 2014
by
Lorenzo Marcantonio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworked the endpoint designator constants FLG_BEGIN and FLG_END in a
ENDPOINT_T enum type
parent
802a59dc
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
49 additions
and
48 deletions
+49
-48
solve.cpp
pcbnew/autorouter/solve.cpp
+4
-2
class_board.cpp
pcbnew/class_board.cpp
+3
-12
class_board.h
pcbnew/class_board.h
+1
-1
class_track.cpp
pcbnew/class_track.cpp
+3
-8
class_track.h
pcbnew/class_track.h
+12
-1
clean.cpp
pcbnew/clean.cpp
+15
-15
editrack.cpp
pcbnew/editrack.cpp
+2
-2
move_or_drag_track.cpp
pcbnew/move_or_drag_track.cpp
+4
-4
pcbnew.h
pcbnew/pcbnew.h
+5
-3
No files found.
pcbnew/autorouter/solve.cpp
View file @
c2af94ac
...
...
@@ -1300,12 +1300,14 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
g_CurrentTrackList
.
PushBack
(
newTrack
);
}
g_FirstTrackSegment
->
start
=
pcbframe
->
GetBoard
()
->
GetPad
(
g_FirstTrackSegment
,
FLG_START
);
g_FirstTrackSegment
->
start
=
pcbframe
->
GetBoard
()
->
GetPad
(
g_FirstTrackSegment
,
ENDPOINT_START
);
if
(
g_FirstTrackSegment
->
start
)
g_FirstTrackSegment
->
SetState
(
BEGIN_ONPAD
,
true
);
g_CurrentTrackSegment
->
end
=
pcbframe
->
GetBoard
()
->
GetPad
(
g_CurrentTrackSegment
,
FLG_END
);
g_CurrentTrackSegment
->
end
=
pcbframe
->
GetBoard
()
->
GetPad
(
g_CurrentTrackSegment
,
ENDPOINT_END
);
if
(
g_CurrentTrackSegment
->
end
)
g_CurrentTrackSegment
->
SetState
(
END_ONPAD
,
true
);
...
...
pcbnew/class_board.cpp
View file @
c2af94ac
...
...
@@ -1598,22 +1598,13 @@ D_PAD* BOARD::GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask )
}
D_PAD
*
BOARD
::
GetPad
(
TRACK
*
aTrace
,
int
aEndPoint
)
D_PAD
*
BOARD
::
GetPad
(
TRACK
*
aTrace
,
ENDPOINT_T
aEndPoint
)
{
D_PAD
*
pad
=
NULL
;
wxPoint
aPosition
;
const
wxPoint
&
aPosition
=
aTrace
->
GetEndPoint
(
aEndPoint
)
;
LAYER_MSK
aLayerMask
=
GetLayerMask
(
aTrace
->
GetLayer
()
);
if
(
aEndPoint
==
FLG_START
)
{
aPosition
=
aTrace
->
GetStart
();
}
else
{
aPosition
=
aTrace
->
GetEnd
();
}
for
(
MODULE
*
module
=
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
pad
=
module
->
GetPad
(
aPosition
,
aLayerMask
);
...
...
@@ -2195,7 +2186,7 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
aSegment
->
end
=
newTrack
;
aSegment
->
SetState
(
END_ONPAD
,
false
);
D_PAD
*
pad
=
GetPad
(
newTrack
,
FLG
_START
);
D_PAD
*
pad
=
GetPad
(
newTrack
,
ENDPOINT
_START
);
if
(
pad
)
{
...
...
pcbnew/class_board.h
View file @
c2af94ac
...
...
@@ -1392,7 +1392,7 @@ public:
* @param aEndPoint The end point of \a aTrace the hit test against.
* @return A pointer to a D_PAD object if found or NULL if not found.
*/
D_PAD
*
GetPad
(
TRACK
*
aTrace
,
int
aEndPoint
);
D_PAD
*
GetPad
(
TRACK
*
aTrace
,
ENDPOINT_T
aEndPoint
);
/**
* Function GetPadFast
...
...
pcbnew/class_track.cpp
View file @
c2af94ac
...
...
@@ -70,7 +70,7 @@ static bool ShowClearance( const TRACK* aTrack )
* return true if the dist between p1 and p2 < max_dist
* Currently in test (currently ratsnest algos work only if p1 == p2)
*/
inline
bool
IsNear
(
wxPoint
&
p1
,
wxPoint
&
p2
,
int
max_dist
)
inline
bool
IsNear
(
const
wxPoint
&
p1
,
const
wxPoint
&
p2
,
int
max_dist
)
{
#if 0 // Do not change it: does not work
int dist;
...
...
@@ -1320,21 +1320,16 @@ VIA* TRACK::GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayer
}
TRACK
*
TRACK
::
GetTrack
(
TRACK
*
aStartTrace
,
TRACK
*
aEndTrace
,
int
aEndPoint
)
TRACK
*
TRACK
::
GetTrack
(
TRACK
*
aStartTrace
,
TRACK
*
aEndTrace
,
ENDPOINT_T
aEndPoint
)
{
const
int
NEIGHTBOUR_COUNT_MAX
=
50
;
TRACK
*
previousSegment
;
TRACK
*
nextSegment
;
int
Reflayer
;
wxPoint
position
;
int
ii
;
int
max_dist
;
if
(
aEndPoint
==
FLG_START
)
position
=
m_Start
;
else
position
=
m_End
;
const
wxPoint
&
position
=
GetEndPoint
(
aEndPoint
);
Reflayer
=
GetLayerMask
();
...
...
pcbnew/class_track.h
View file @
c2af94ac
...
...
@@ -31,6 +31,7 @@
#define CLASS_TRACK_H
#include <pcbnew.h>
#include <class_board_item.h>
#include <class_board_connected_item.h>
#include <PolyLine.h>
...
...
@@ -124,6 +125,16 @@ public:
void
SetStart
(
const
wxPoint
&
aStart
)
{
m_Start
=
aStart
;
}
const
wxPoint
&
GetStart
()
const
{
return
m_Start
;
}
/// Return the selected endpoint (start or end)
const
wxPoint
&
GetEndPoint
(
ENDPOINT_T
aEndPoint
)
const
{
if
(
aEndPoint
==
ENDPOINT_START
)
return
m_Start
;
else
return
m_End
;
}
// Virtual function
const
EDA_RECT
GetBoundingBox
()
const
;
...
...
@@ -252,7 +263,7 @@ public:
* @param aEndPoint The start or end point of the segment to test against.
* @return A TRACK object pointer if found otherwise NULL.
*/
TRACK
*
GetTrack
(
TRACK
*
aStartTrace
,
TRACK
*
aEndTrace
,
int
aEndPoint
);
TRACK
*
GetTrack
(
TRACK
*
aStartTrace
,
TRACK
*
aEndTrace
,
ENDPOINT_T
aEndPoint
);
/**
* Function GetEndSegments
...
...
pcbnew/clean.cpp
View file @
c2af94ac
...
...
@@ -86,7 +86,7 @@ private:
* i.e. when they are colinear, same width, and obviously same layer
*/
TRACK
*
mergeCollinearSegmentIfPossible
(
TRACK
*
aTrackRef
,
TRACK
*
aCandidate
,
int
aEndType
);
TRACK
*
aCandidate
,
ENDPOINT_T
aEndType
);
};
/* Install the cleanup dialog frame to know what should be cleaned
...
...
@@ -304,7 +304,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
if
(
(
type_end
&
START_ON_PAD
)
==
0
)
{
TRACK
*
other
=
track
->
GetTrack
(
m_Brd
->
m_Track
,
NULL
,
FLG
_START
);
TRACK
*
other
=
track
->
GetTrack
(
m_Brd
->
m_Track
,
NULL
,
ENDPOINT
_START
);
if
(
other
==
NULL
)
// Test a connection to zones
{
...
...
@@ -341,7 +341,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
track
->
SetState
(
BUSY
,
true
);
VIA
*
via
=
(
VIA
*
)
other
;
other
=
via
->
GetTrack
(
m_Brd
->
m_Track
,
NULL
,
FLG
_START
);
other
=
via
->
GetTrack
(
m_Brd
->
m_Track
,
NULL
,
ENDPOINT
_START
);
if
(
other
==
NULL
)
{
...
...
@@ -364,7 +364,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
// test if this track end point is connected to an other track
if
(
(
type_end
&
END_ON_PAD
)
==
0
)
{
TRACK
*
other
=
track
->
GetTrack
(
m_Brd
->
m_Track
,
NULL
,
FLG
_END
);
TRACK
*
other
=
track
->
GetTrack
(
m_Brd
->
m_Track
,
NULL
,
ENDPOINT
_END
);
if
(
other
==
NULL
)
// Test a connection to zones
{
...
...
@@ -402,7 +402,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
track
->
SetState
(
BUSY
,
true
);
VIA
*
via
=
(
VIA
*
)
other
;
other
=
via
->
GetTrack
(
m_Brd
->
m_Track
,
NULL
,
FLG
_END
);
other
=
via
->
GetTrack
(
m_Brd
->
m_Track
,
NULL
,
ENDPOINT
_END
);
if
(
other
==
NULL
)
{
...
...
@@ -508,7 +508,7 @@ bool TRACKS_CLEANER::clean_segments()
// search for a possible point connected to the START point of the current segment
for
(
segStart
=
segment
->
Next
();
;
)
{
segStart
=
segment
->
GetTrack
(
segStart
,
NULL
,
FLG
_START
);
segStart
=
segment
->
GetTrack
(
segStart
,
NULL
,
ENDPOINT
_START
);
if
(
segStart
)
{
...
...
@@ -522,7 +522,7 @@ bool TRACKS_CLEANER::clean_segments()
// We must have only one segment connected
segStart
->
SetState
(
BUSY
,
true
);
other
=
segment
->
GetTrack
(
m_Brd
->
m_Track
,
NULL
,
FLG
_START
);
other
=
segment
->
GetTrack
(
m_Brd
->
m_Track
,
NULL
,
ENDPOINT
_START
);
segStart
->
SetState
(
BUSY
,
false
);
if
(
other
==
NULL
)
...
...
@@ -535,7 +535,7 @@ bool TRACKS_CLEANER::clean_segments()
if
(
flag
)
// We have the starting point of the segment is connected to an other segment
{
segDelete
=
mergeCollinearSegmentIfPossible
(
segment
,
segStart
,
FLG
_START
);
segDelete
=
mergeCollinearSegmentIfPossible
(
segment
,
segStart
,
ENDPOINT
_START
);
if
(
segDelete
)
{
...
...
@@ -548,7 +548,7 @@ bool TRACKS_CLEANER::clean_segments()
// search for a possible point connected to the END point of the current segment:
for
(
segEnd
=
segment
->
Next
();
;
)
{
segEnd
=
segment
->
GetTrack
(
segEnd
,
NULL
,
FLG
_END
);
segEnd
=
segment
->
GetTrack
(
segEnd
,
NULL
,
ENDPOINT
_END
);
if
(
segEnd
)
{
...
...
@@ -560,7 +560,7 @@ bool TRACKS_CLEANER::clean_segments()
// We must have only one segment connected
segEnd
->
SetState
(
BUSY
,
true
);
other
=
segment
->
GetTrack
(
m_Brd
->
m_Track
,
NULL
,
FLG
_END
);
other
=
segment
->
GetTrack
(
m_Brd
->
m_Track
,
NULL
,
ENDPOINT
_END
);
segEnd
->
SetState
(
BUSY
,
false
);
if
(
other
==
NULL
)
...
...
@@ -576,7 +576,7 @@ bool TRACKS_CLEANER::clean_segments()
if
(
flag
&
2
)
// We have the ending point of the segment is connected to an other segment
{
segDelete
=
mergeCollinearSegmentIfPossible
(
segment
,
segEnd
,
FLG
_END
);
segDelete
=
mergeCollinearSegmentIfPossible
(
segment
,
segEnd
,
ENDPOINT
_END
);
if
(
segDelete
)
{
...
...
@@ -607,7 +607,7 @@ bool TRACKS_CLEANER::clean_segments()
* else return NULL
*/
TRACK
*
TRACKS_CLEANER
::
mergeCollinearSegmentIfPossible
(
TRACK
*
aTrackRef
,
TRACK
*
aCandidate
,
int
aEndType
)
ENDPOINT_T
aEndType
)
{
if
(
aTrackRef
->
GetWidth
()
!=
aCandidate
->
GetWidth
()
)
return
NULL
;
...
...
@@ -667,7 +667,7 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
* (this function) is called when there is only 2 connected segments,
*and if this point is not on a pad, it can be removed and the 2 segments will be merged
*/
if
(
aEndType
==
FLG
_START
)
if
(
aEndType
==
ENDPOINT
_START
)
{
// We do not have a pad, which is a always terminal point for a track
if
(
aTrackRef
->
GetState
(
START_ON_PAD
)
)
...
...
@@ -744,7 +744,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
}
else
{
other
=
segment
->
GetTrack
(
GetBoard
()
->
m_Track
,
NULL
,
FLG
_START
);
other
=
segment
->
GetTrack
(
GetBoard
()
->
m_Track
,
NULL
,
ENDPOINT
_START
);
if
(
other
)
net_code_s
=
other
->
GetNetCode
();
...
...
@@ -762,7 +762,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
}
else
{
other
=
segment
->
GetTrack
(
GetBoard
()
->
m_Track
,
NULL
,
FLG
_END
);
other
=
segment
->
GetTrack
(
GetBoard
()
->
m_Track
,
NULL
,
ENDPOINT
_END
);
if
(
other
)
net_code_e
=
other
->
GetNetCode
();
...
...
pcbnew/editrack.cpp
View file @
c2af94ac
...
...
@@ -266,7 +266,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
newTrack
->
SetState
(
BEGIN_ONPAD
|
END_ONPAD
,
false
);
D_PAD
*
pad
=
GetBoard
()
->
GetPad
(
previousTrack
,
FLG
_END
);
D_PAD
*
pad
=
GetBoard
()
->
GetPad
(
previousTrack
,
ENDPOINT
_END
);
if
(
pad
)
{
...
...
@@ -1057,7 +1057,7 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList )
while
(
track
!=
NULL
)
{
TRACK
*
next_track
=
track
->
Next
();
LockPoint
=
pcb
->
GetPad
(
track
,
FLG
_END
);
LockPoint
=
pcb
->
GetPad
(
track
,
ENDPOINT
_END
);
if
(
LockPoint
)
{
...
...
pcbnew/move_or_drag_track.cpp
View file @
c2af94ac
...
...
@@ -709,7 +709,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
s_StartSegmentPresent
=
s_EndSegmentPresent
=
true
;
if
(
(
track
->
start
==
NULL
)
||
(
track
->
start
->
Type
()
==
PCB_TRACE_T
)
)
TrackToStartPoint
=
track
->
GetTrack
(
GetBoard
()
->
m_Track
,
NULL
,
FLG
_START
);
TrackToStartPoint
=
track
->
GetTrack
(
GetBoard
()
->
m_Track
,
NULL
,
ENDPOINT
_START
);
// Test if more than one segment is connected to this point
if
(
TrackToStartPoint
)
...
...
@@ -717,14 +717,14 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
TrackToStartPoint
->
SetState
(
BUSY
,
true
);
if
(
(
TrackToStartPoint
->
Type
()
==
PCB_VIA_T
)
||
track
->
GetTrack
(
GetBoard
()
->
m_Track
,
NULL
,
FLG
_START
)
)
||
track
->
GetTrack
(
GetBoard
()
->
m_Track
,
NULL
,
ENDPOINT
_START
)
)
error
=
true
;
TrackToStartPoint
->
SetState
(
BUSY
,
false
);
}
if
(
(
track
->
end
==
NULL
)
||
(
track
->
end
->
Type
()
==
PCB_TRACE_T
)
)
TrackToEndPoint
=
track
->
GetTrack
(
GetBoard
()
->
m_Track
,
NULL
,
FLG
_END
);
TrackToEndPoint
=
track
->
GetTrack
(
GetBoard
()
->
m_Track
,
NULL
,
ENDPOINT
_END
);
// Test if more than one segment is connected to this point
if
(
TrackToEndPoint
)
...
...
@@ -732,7 +732,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
TrackToEndPoint
->
SetState
(
BUSY
,
true
);
if
(
(
TrackToEndPoint
->
Type
()
==
PCB_VIA_T
)
||
track
->
GetTrack
(
GetBoard
()
->
m_Track
,
NULL
,
FLG
_END
)
)
||
track
->
GetTrack
(
GetBoard
()
->
m_Track
,
NULL
,
ENDPOINT
_END
)
)
error
=
true
;
TrackToEndPoint
->
SetState
(
BUSY
,
false
);
...
...
pcbnew/pcbnew.h
View file @
c2af94ac
...
...
@@ -25,9 +25,11 @@
#define MATCH_LAYER (1 << 2) ///< if module not on current layer, do not select
#define VISIBLE_ONLY (1 << 3) ///< if module not on a visible layer, do not select
#define FLG_START 0 // Flag used in locate routines
#define FLG_END 1 // Flag used in locate routines
/// Flag used in locate routines (from which endpoint work)
enum
ENDPOINT_T
{
ENDPOINT_START
=
0
,
ENDPOINT_END
=
1
};
#define DIM_ANCRE_MODULE 3 // Anchor size (footprint center)
...
...
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