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
2d761f30
Commit
2d761f30
authored
Sep 23, 2011
by
Marco Mattila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix drawsegment bounding box and hittest issues in pcbnew.
parent
8db19bbd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
14 deletions
+17
-14
class_board.cpp
pcbnew/class_board.cpp
+1
-1
class_drawsegment.cpp
pcbnew/class_drawsegment.cpp
+16
-13
No files found.
pcbnew/class_board.cpp
View file @
2d761f30
...
...
@@ -856,7 +856,7 @@ bool BOARD::ComputeBoundingBox( bool aBoardEdgesOnly )
// Check segments, dimensions, texts, and fiducials
for
(
BOARD_ITEM
*
item
=
m_Drawings
;
item
!=
NULL
;
item
=
item
->
Next
()
)
{
if
(
aBoardEdgesOnly
&&
item
->
Type
()
!=
TYPE_DRAWSEGMENT
&&
item
->
GetLayer
()
!=
EDGE_N
)
if
(
aBoardEdgesOnly
&&
(
item
->
Type
()
!=
TYPE_DRAWSEGMENT
||
item
->
GetLayer
()
!=
EDGE_N
)
)
continue
;
if
(
!
hasItems
)
...
...
pcbnew/class_drawsegment.cpp
View file @
2d761f30
...
...
@@ -290,7 +290,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
StAngle
=
(
int
)
ArcTangente
(
dy
-
uy0
,
dx
-
ux0
);
EndAngle
=
StAngle
+
m_Angle
;
if
(
!
panel
->
m_PrintIsMirrored
)
if
(
!
panel
->
m_PrintIsMirrored
)
{
if
(
StAngle
>
EndAngle
)
EXCHG
(
StAngle
,
EndAngle
);
...
...
@@ -435,7 +435,10 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const
case
S_ARC
:
{
bbox
.
Inflate
(
GetRadius
()
+
1
);
bbox
.
Merge
(
m_End
);
wxPoint
end
=
m_End
;
RotatePoint
(
&
end
,
m_Start
,
-
m_Angle
);
bbox
.
Merge
(
end
);
}
break
;
...
...
@@ -463,7 +466,7 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const
p_end
.
y
=
MAX
(
p_end
.
y
,
pt
.
y
);
}
bbox
.
SetEnd
(
p_end
);
bbox
.
SetEnd
(
p_end
);
bbox
.
Inflate
(
1
);
break
;
}
...
...
@@ -492,18 +495,18 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aRefPos )
if
(
m_Shape
==
S_CIRCLE
)
return
true
;
int
mouseAngle
=
ArcTangente
(
relPos
.
y
,
relPos
.
x
);
int
stAngle
=
ArcTangente
(
m_End
.
y
-
m_Start
.
y
,
m_End
.
x
-
m_Start
.
x
)
;
int
endAngle
=
stAngle
+
m_Angle
;
wxPoint
startVec
=
wxPoint
(
m_End
.
x
-
m_Start
.
x
,
m_End
.
y
-
m_Start
.
y
);
wxPoint
endVec
=
m_End
-
m_Start
;
RotatePoint
(
&
endVec
,
-
m_Angle
)
;
if
(
endAngle
>
3600
)
{
stAngle
-=
3600
;
endAngle
-=
3600
;
}
// Check dot products
if
(
(
long
long
)
relPos
.
x
*
startVec
.
x
+
(
long
long
)
relPos
.
y
*
startVec
.
y
<
0
)
return
false
;
if
(
mouseAngle
>=
stAngle
&&
mouseAngle
<=
endAngle
)
return
true
;
if
(
(
long
long
)
relPos
.
x
*
endVec
.
x
+
(
long
long
)
relPos
.
y
*
endVec
.
y
<
0
)
return
false
;
return
true
;
}
}
break
;
...
...
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