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
5bf50ee9
Commit
5bf50ee9
authored
May 14, 2014
by
Tomasz Włostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VIEW: added CalculateExtents() method
parent
922bf1dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
view.cpp
common/view/view.cpp
+35
-0
view.h
include/view/view.h
+4
-0
No files found.
common/view/view.cpp
View file @
5bf50ee9
...
...
@@ -1019,3 +1019,38 @@ void VIEW::UpdateItems()
m_needsUpdate
.
clear
();
}
struct
VIEW
::
extentsVisitor
{
BOX2I
extents
;
bool
first
;
extentsVisitor
()
{
first
=
true
;
}
bool
operator
()(
VIEW_ITEM
*
aItem
)
{
if
(
first
)
extents
=
aItem
->
ViewBBox
();
else
extents
.
Merge
(
aItem
->
ViewBBox
()
);
return
false
;
}
};
const
BOX2I
VIEW
::
CalculateExtents
()
{
extentsVisitor
v
;
BOX2I
fullScene
;
fullScene
.
SetMaximum
();
BOOST_FOREACH
(
VIEW_LAYER
*
l
,
m_orderedLayers
)
{
l
->
items
->
Query
(
fullScene
,
v
);
}
return
v
.
extents
;
}
include/view/view.h
View file @
5bf50ee9
...
...
@@ -507,6 +507,8 @@ public:
*/
void
UpdateItems
();
const
BOX2I
CalculateExtents
()
;
static
const
int
VIEW_MAX_LAYERS
=
128
;
///< maximum number of layers that may be shown
private
:
...
...
@@ -534,6 +536,8 @@ private:
struct
unlinkItem
;
struct
updateItemsColor
;
struct
changeItemsDepth
;
struct
extentsVisitor
;
///* Redraws contents within rect aRect
void
redrawRect
(
const
BOX2I
&
aRect
);
...
...
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