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
aa51131b
Commit
aa51131b
authored
Mar 05, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BoundingBox
parent
10f1040b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
class_track.cpp
pcbnew/class_track.cpp
+45
-0
class_track.h
pcbnew/class_track.h
+7
-0
No files found.
pcbnew/class_track.cpp
View file @
aa51131b
...
...
@@ -205,6 +205,26 @@ int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist )
}
EDA_Rect
TRACK
::
GetBoundingBox
()
const
{
int
radius
=
m_Width
/
2
;
// end of track is round, this is its radius
int
ymax
=
MAX
(
m_Start
.
y
,
m_End
.
y
);
int
xmax
=
MAX
(
m_Start
.
x
,
m_End
.
x
);
int
ymin
=
MIN
(
m_Start
.
y
,
m_End
.
y
);
int
xmin
=
MIN
(
m_Start
.
x
,
m_End
.
x
);
ymax
+=
radius
;
xmax
+=
radius
;
ymin
-=
radius
;
xmin
-=
radius
;
return
EDA_Rect
(
wxPoint
(
xmin
,
ymin
),
wxSize
(
xmax
-
xmin
,
ymax
-
ymin
)
);
}
// see class_track.h
// SEGVIA and SEGZONE inherit this version
SEARCH_RESULT
TRACK
::
Visit
(
INSPECTOR
*
inspector
,
const
void
*
testData
,
...
...
@@ -868,6 +888,7 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame )
*/
bool
TRACK
::
HitTest
(
const
wxPoint
&
ref_pos
)
{
#if 0
int l_piste; /* demi-largeur de la piste */
int dx, dy, spot_cX, spot_cY;
int ux0, uy0;
...
...
@@ -898,6 +919,30 @@ bool TRACK::HitTest( const wxPoint& ref_pos )
if( DistanceTest( l_piste, dx, dy, spot_cX, spot_cY ) )
return true;
}
#else
int
radius
=
m_Width
>>
1
;
// (dx, dy) is a vector from m_Start to m_End (an origin of m_Start)
int
dx
=
m_End
.
x
-
m_Start
.
x
;
int
dy
=
m_End
.
y
-
m_Start
.
y
;
// (spot_cX, spot_cY) is a vector from m_Start to ref_pos (an origin of m_Start)
int
spot_cX
=
ref_pos
.
x
-
m_Start
.
x
;
int
spot_cY
=
ref_pos
.
y
-
m_Start
.
y
;
if
(
Type
()
==
TYPEVIA
)
/* VIA rencontree */
{
return
(
double
)
spot_cX
*
spot_cX
+
(
double
)
spot_cY
*
spot_cY
<=
(
double
)
radius
*
radius
;
}
else
{
if
(
DistanceTest
(
radius
,
dx
,
dy
,
spot_cX
,
spot_cY
)
)
return
true
;
}
#endif
return
false
;
}
...
...
pcbnew/class_track.h
View file @
aa51131b
...
...
@@ -68,6 +68,13 @@ public:
}
/**
* Function GetBoundingBox
* returns the bounding box of this TRACK
*/
EDA_Rect
GetBoundingBox
()
const
;
/* supprime du chainage la structure Struct */
void
UnLink
();
...
...
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