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
2c2e506e
Commit
2c2e506e
authored
Aug 05, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bounding box for TEXTE_PCB class.
parent
096dd7a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
class_pcb_text.cpp
pcbnew/class_pcb_text.cpp
+35
-0
class_pcb_text.h
pcbnew/class_pcb_text.h
+3
-0
No files found.
pcbnew/class_pcb_text.cpp
View file @
2c2e506e
...
...
@@ -188,3 +188,38 @@ EDA_ITEM* TEXTE_PCB::Clone() const
return
new
TEXTE_PCB
(
*
this
);
}
const
BOX2I
TEXTE_PCB
::
ViewBBox
()
const
{
EDA_RECT
rect
=
GetTextBox
();
if
(
m_Orient
!=
0.0
)
{
// If the text is rotated, we need to take it into account
wxPoint
p1
=
rect
.
GetOrigin
();
wxPoint
p2
=
wxPoint
(
p1
.
x
+
rect
.
GetWidth
(),
p1
.
y
);
wxPoint
p3
=
rect
.
GetEnd
();
wxPoint
p4
=
wxPoint
(
p1
.
x
,
p1
.
y
+
rect
.
GetHeight
()
);
// Transform all the corners of the bounding box according to the rotation angle
RotatePoint
(
&
p1
,
m_Pos
,
-
m_Orient
);
RotatePoint
(
&
p2
,
m_Pos
,
-
m_Orient
);
RotatePoint
(
&
p3
,
m_Pos
,
-
m_Orient
);
RotatePoint
(
&
p4
,
m_Pos
,
-
m_Orient
);
// Find the new bounding box origin and dimensions
int
minX
=
std
::
min
(
std
::
min
(
p1
.
x
,
p2
.
x
),
std
::
min
(
p3
.
x
,
p4
.
x
)
);
int
minY
=
std
::
min
(
std
::
min
(
p1
.
y
,
p2
.
y
),
std
::
min
(
p3
.
y
,
p4
.
y
)
);
int
maxX
=
std
::
max
(
std
::
max
(
p1
.
x
,
p2
.
x
),
std
::
max
(
p3
.
x
,
p4
.
x
)
);
int
maxY
=
std
::
max
(
std
::
max
(
p1
.
y
,
p2
.
y
),
std
::
max
(
p3
.
y
,
p4
.
y
)
);
int
width
=
maxX
-
minX
;
int
height
=
maxY
-
minY
;
return
BOX2I
(
VECTOR2I
(
minX
,
minY
),
VECTOR2I
(
width
,
height
)
);
}
else
{
return
BOX2I
(
rect
.
GetOrigin
(),
rect
.
GetSize
()
);
}
}
pcbnew/class_pcb_text.h
View file @
2c2e506e
...
...
@@ -124,6 +124,9 @@ public:
#if defined(DEBUG)
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
{
ShowDummy
(
os
);
}
// override
#endif
/// @copydoc VIEW_ITEM::ViewBBox()
virtual
const
BOX2I
ViewBBox
()
const
;
};
#endif // #define CLASS_PCB_TEXT_H
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