Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gepetto-viewer-corba
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gepetto
gepetto-viewer-corba
Commits
e95d503b
Commit
e95d503b
authored
7 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Homogenize calls to WindowsManager
parent
f48a5eee
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/windows-manager.cpp
+25
-63
25 additions, 63 deletions
src/windows-manager.cpp
with
25 additions
and
63 deletions
src/windows-manager.cpp
+
25
−
63
View file @
e95d503b
...
...
@@ -465,28 +465,21 @@ namespace graphics {
return
true
;
}
bool
WindowsManager
::
resizeCapsule
(
const
std
::
string
&
capsuleName
,
float
newHeight
)
throw
(
std
::
exception
){
NodePtr_t
node
=
getNode
(
capsuleName
,
true
);
try
{
LeafNodeCapsulePtr_t
cap
=
dynamic_pointer_cast
<
LeafNodeCapsule
>
(
node
);
cap
->
resize
(
newHeight
);
}
catch
(
const
std
::
exception
&
exc
)
{
std
::
cout
<<
capsuleName
<<
"isn't a capsule."
<<
std
::
endl
;
return
false
;
}
bool
WindowsManager
::
resizeCapsule
(
const
std
::
string
&
capsuleName
,
float
newHeight
)
throw
(
std
::
exception
)
{
FIND_NODE_OF_TYPE_OR_THROW
(
LeafNodeCapsule
,
cap
,
capsuleName
);
scoped_lock
lock
(
osgFrameMutex
());
cap
->
resize
(
newHeight
);
return
true
;
}
bool
WindowsManager
::
resizeArrow
(
const
std
::
string
&
arrowName
,
float
newRadius
,
float
newLength
)
throw
(
std
::
exception
){
NodePtr_t
node
=
getNode
(
arrowName
,
true
);
try
{
LeafNodeArrowPtr_t
arrow
=
dynamic_pointer_cast
<
LeafNodeArrow
>
(
node
);
arrow
->
resize
(
newRadius
,
newLength
);
}
catch
(
const
std
::
exception
&
exc
)
{
std
::
cout
<<
arrowName
<<
"isn't an arrow."
<<
std
::
endl
;
return
false
;
}
bool
WindowsManager
::
resizeArrow
(
const
std
::
string
&
arrowName
,
float
newRadius
,
float
newLength
)
throw
(
std
::
exception
)
{
FIND_NODE_OF_TYPE_OR_THROW
(
LeafNodeArrow
,
arrow
,
arrowName
);
scoped_lock
lock
(
osgFrameMutex
());
arrow
->
resize
(
newRadius
,
newLength
);
return
true
;
}
...
...
@@ -578,9 +571,7 @@ namespace graphics {
bool
WindowsManager
::
setLineStartPoint
(
const
std
::
string
&
lineName
,
const
osgVector3
&
pos1
)
{
RETURN_FALSE_IF_NODE_DOES_NOT_EXIST
(
lineName
);
LeafNodeLinePtr_t
line
=
dynamic_pointer_cast
<
LeafNodeLine
>
(
getNode
(
lineName
));
FIND_NODE_OF_TYPE_OR_THROW
(
LeafNodeLine
,
line
,
lineName
);
scoped_lock
lock
(
osgFrameMutex
());
line
->
setStartPoint
(
pos1
);
return
true
;
...
...
@@ -589,9 +580,7 @@ namespace graphics {
bool
WindowsManager
::
setLineEndPoint
(
const
std
::
string
&
lineName
,
const
osgVector3
&
pos2
)
{
RETURN_FALSE_IF_NODE_DOES_NOT_EXIST
(
lineName
);
LeafNodeLinePtr_t
line
=
dynamic_pointer_cast
<
LeafNodeLine
>
(
getNode
(
lineName
));
FIND_NODE_OF_TYPE_OR_THROW
(
LeafNodeLine
,
line
,
lineName
);
scoped_lock
lock
(
osgFrameMutex
());
line
->
setEndPoint
(
pos2
);
return
true
;
...
...
@@ -601,9 +590,7 @@ namespace graphics {
const
osgVector3
&
pos1
,
const
osgVector3
&
pos2
)
{
RETURN_FALSE_IF_NODE_DOES_NOT_EXIST
(
lineName
);
LeafNodeLinePtr_t
line
=
dynamic_pointer_cast
<
LeafNodeLine
>
(
getNode
(
lineName
));
FIND_NODE_OF_TYPE_OR_THROW
(
LeafNodeLine
,
line
,
lineName
);
scoped_lock
lock
(
osgFrameMutex
());
line
->
setStartPoint
(
pos1
);
line
->
setEndPoint
(
pos2
);
...
...
@@ -616,8 +603,7 @@ namespace graphics {
{
RETURN_FALSE_IF_NODE_EXISTS
(
curveName
);
if
(
pos
->
size
()
<
2
)
{
std
::
cout
<<
"Need at least two points"
<<
std
::
endl
;
return
false
;
throw
std
::
invalid_argument
(
"Need at least two points"
);
}
LeafNodeLinePtr_t
curve
=
LeafNodeLine
::
create
(
curveName
,
pos
,
color
);
curve
->
setMode
(
GL_LINE_STRIP
);
...
...
@@ -629,12 +615,10 @@ namespace graphics {
bool
WindowsManager
::
setCurvePoints
(
const
std
::
string
&
curveName
,
const
Vec3ArrayPtr_t
&
pos
)
{
RETURN_FALSE_IF_NODE_EXISTS
(
curveName
);
FIND_NODE_OF_TYPE_OR_THROW
(
LeafNodeLine
,
curve
,
curveName
);
if
(
pos
->
size
()
<
2
)
{
std
::
cout
<<
"Need at least two points"
<<
std
::
endl
;
return
false
;
throw
std
::
invalid_argument
(
"Need at least two points"
);
}
LeafNodeLinePtr_t
curve
=
dynamic_pointer_cast
<
LeafNodeLine
>
(
getNode
(
curveName
));
scoped_lock
lock
(
osgFrameMutex
());
curve
->
setPoints
(
pos
);
return
true
;
...
...
@@ -642,21 +626,10 @@ namespace graphics {
bool
WindowsManager
::
setCurveMode
(
const
std
::
string
&
curveName
,
const
GLenum
mode
)
{
NodePtr_t
node
=
find
(
curveName
);
if
(
!
node
)
{
std
::
cerr
<<
"Node
\"
"
<<
curveName
<<
"
\"
not found."
<<
std
::
endl
;
return
false
;
}
else
{
LeafNodeLinePtr_t
curve
(
dynamic_pointer_cast
<
LeafNodeLine
>
(
node
));
if
(
!
curve
)
{
std
::
cerr
<<
"Node
\"
"
<<
curveName
<<
"
\"
is not a curve."
<<
std
::
endl
;
return
false
;
}
scoped_lock
lock
(
osgFrameMutex
());
curve
->
setMode
(
mode
);
return
true
;
}
FIND_NODE_OF_TYPE_OR_THROW
(
LeafNodeLine
,
curve
,
curveName
);
scoped_lock
lock
(
osgFrameMutex
());
curve
->
setMode
(
mode
);
return
true
;
}
bool
WindowsManager
::
setCurvePointsSubset
(
const
std
::
string
&
curveName
,
...
...
@@ -670,12 +643,7 @@ namespace graphics {
bool
WindowsManager
::
setCurveLineWidth
(
const
std
::
string
&
curveName
,
const
float
&
width
)
{
NodePtr_t
node
=
getNode
(
curveName
,
true
);
LeafNodeLinePtr_t
curve
(
dynamic_pointer_cast
<
LeafNodeLine
>
(
node
));
if
(
!
curve
)
{
std
::
cerr
<<
"Node
\"
"
<<
curveName
<<
"
\"
is not a curve."
<<
std
::
endl
;
return
false
;
}
FIND_NODE_OF_TYPE_OR_THROW
(
LeafNodeLine
,
curve
,
curveName
);
scoped_lock
lock
(
osgFrameMutex
());
curve
->
setLineWidth
(
width
);
return
true
;
...
...
@@ -714,14 +682,8 @@ namespace graphics {
bool
WindowsManager
::
setTexture
(
const
std
::
string
&
nodeName
,
const
std
::
string
&
filename
)
{
NodePtr_t
node
(
getNode
(
nodeName
,
true
));
LeafNodeFacePtr_t
faceNode
(
dynamic_pointer_cast
<
LeafNodeFace
>
(
node
));
if
(
!
faceNode
)
{
std
::
ostringstream
oss
;
oss
<<
"Node "
<<
nodeName
<<
" is not a face"
;
throw
std
::
invalid_argument
(
oss
.
str
());
}
FIND_NODE_OF_TYPE_OR_THROW
(
LeafNodeFace
,
faceNode
,
nodeName
);
if
(
faceNode
->
nbVertices
()
!=
4
)
{
std
::
ostringstream
oss
;
oss
<<
"Face should have 4 vertices to apply texture. "
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment