Package org.robwork.sdurw_graphics
Class SceneGraphPtr
- java.lang.Object
-
- org.robwork.sdurw_graphics.SceneGraphPtr
-
public class SceneGraphPtr extends java.lang.Object
Ptr stores a pointer and optionally takes ownership of the value.
-
-
Constructor Summary
Constructors Constructor Description SceneGraphPtr()
Default constructor yielding a NULL-pointer.SceneGraphPtr(long cPtr, boolean cMemoryOwn)
SceneGraphPtr(SceneGraph ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SceneGraph
__ref__()
Dereferencing operator.void
addCameraGroup(SWIGTYPE_p_rw__core__PtrT_rw__graphics__CameraGroup_t cgroup)
Add a camera group.void
addChild(SceneNodePtr child, GroupNodePtr parent)
add a drawable to a nodevoid
clear()
Clear the scene graph.SceneGraphCPtr
cptr()
void
delete()
SceneGraph
deref()
The pointer stored in the object.void
draw(SceneGraph.SceneGraphRenderInfo info)
draws the scene, using the specified render informationboolean
equals(SceneGraph p)
SWIGTYPE_p_rw__core__PtrT_rw__graphics__CameraGroup_t
findCameraGroup(java.lang.String name)
Find a camera group.DrawableNodePtr
findDrawable(java.lang.String name)
Find a drawable node in the scene graph.DrawableNodePtr
findDrawable(java.lang.String name, SceneNodePtr node)
std::string&)SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__graphics__DrawableNode_t_t
findDrawables(java.lang.String name)
Find multiple drawable nodes in the scene graph.SWIGTYPE_p_std__listT_rw__core__PtrT_rw__graphics__CameraGroup_t_t
getCameraGroups()
Get all camera groups.static long
getCPtr(SceneGraphPtr obj)
SceneGraph
getDeref()
Member access operator.SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__graphics__DrawableNode_t_t
getDrawables()
get all drawables in the scene.SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__graphics__DrawableNode_t_t
getDrawables(SceneNodePtr node)
get a vector of drawables attached to a nodeSWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__graphics__DrawableNode_t_t
getDrawablesRec(SceneNodePtr node)
get all drawable nodes in the subtree of node.GroupNodePtr
getRoot()
Get the root of the scene graph.boolean
isNull()
checks if the pointer is nullboolean
isShared()
check if this Ptr has shared ownership or none
ownershipSWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneCamera_t
makeCamera(java.lang.String name)
Create a new scene camera.SWIGTYPE_p_rw__core__PtrT_rw__graphics__CameraGroup_t
makeCameraGroup(java.lang.String name)
Create a camera group.DrawableNodePtr
makeDrawable(java.lang.String filename)
Create a drawable node from a file.DrawableNodePtr
makeDrawable(java.lang.String filename, int dmask)
Create a drawable node from a file.DrawableNodePtr
makeDrawable(java.lang.String name, java.lang.String text, FramePtr labelFrame)
Create a drawable node for a text label.DrawableNodePtr
makeDrawable(java.lang.String name, java.lang.String text, FramePtr labelFrame, int dmask)
Create a drawable node for a text label.DrawableGeometryNodePtr
makeDrawable(java.lang.String name, GeometryPtr geom)
Create a drawable node for a geometry.DrawableGeometryNodePtr
makeDrawable(java.lang.String name, GeometryPtr geom, int dmask)
Create a drawable node for a geometry.DrawableNodePtr
makeDrawable(java.lang.String name, Model3DPtr model)
Create a drawable node for a 3d model.DrawableNodePtr
makeDrawable(java.lang.String name, Model3DPtr model, int dmask)
Create a drawable node for a 3d model.DrawableNodePtr
makeDrawable(java.lang.String name, PointCloud scan)
Create a drawable node for a point cloud.DrawableNodePtr
makeDrawable(java.lang.String name, PointCloud scan, int dmask)
Create a drawable node for a point cloud.DrawableGeometryNodePtr
makeDrawable(java.lang.String name, VectorLine lines)
Create a drawable node for lines.DrawableGeometryNodePtr
makeDrawable(java.lang.String name, VectorLine lines, int dmask)
Create a drawable node for lines.DrawableNodePtr
makeDrawable(java.lang.String name, RenderPtr render)
Create a drawable node for a render.DrawableNodePtr
makeDrawable(java.lang.String name, RenderPtr render, int dmask)
Create a drawable node for a render.DrawableNodePtr
makeDrawable(java.lang.String name, Image img)
Create a drawable node for an image.DrawableNodePtr
makeDrawable(java.lang.String name, Image img, int dmask)
Create a drawable node for an image.DrawableGeometryNodePtr
makeDrawableFrameAxis(java.lang.String name, double size)
Create a drawable node for a frame axis coordinate system.DrawableGeometryNodePtr
makeDrawableFrameAxis(java.lang.String name, double size, int dmask)
Create a drawable node for a frame axis coordinate system.GroupNodePtr
makeGroupNode(java.lang.String name)
Make a group node.DrawableNodePtr
pickDrawable(SceneGraph.SceneGraphRenderInfo info, int x, int y)
picks the drawable in the scene that intersects with the ray (x,y,-1) in
camera coordinates.
Vector3D
project(SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneCamera_t camera, double x, double y, double z)
this method projects a 3D coordinate to 2D screen coordinates from the last draw'n
scene.
Note: this method relies on a previously drawn scene, eg.void
removeCameraGroup(java.lang.String name)
Remove a camera group.void
removeCameraGroup(SWIGTYPE_p_rw__core__PtrT_rw__graphics__CameraGroup_t cgroup)
Remove a camera group.boolean
removeChild(java.lang.String name, GroupNodePtr node)
Removes child with the specified name from the node.
boolean
removeDrawable(java.lang.String name)
Remove a specific drawable with a given name.boolean
removeDrawable(DrawableNodePtr drawable)
Remove a specific drawable.boolean
removeDrawable(DrawableNodePtr drawable, SceneNodePtr node)
Remove a specific drawable.boolean
removeDrawables(java.lang.String name)
Remove all drawables with a given name.boolean
removeDrawables(GroupNodePtr node)
Remove a node.void
setRoot(GroupNodePtr node)
Set the root of the scene graph.Vector3D
unproject(SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneCamera_t camera, int x, int y)
this method unprojects a 2D screen coordinate to 3D coordinates from the last
draw'n scene.void
update()
should be called after the structure of the scene
has been changed
-
-
-
Constructor Detail
-
SceneGraphPtr
public SceneGraphPtr(long cPtr, boolean cMemoryOwn)
-
SceneGraphPtr
public SceneGraphPtr()
Default constructor yielding a NULL-pointer.
-
SceneGraphPtr
public SceneGraphPtr(SceneGraph ptr)
Do not take ownership of ptr.
ptr can be null.
The constructor is implicit on purpose.
-
-
Method Detail
-
getCPtr
public static long getCPtr(SceneGraphPtr obj)
-
delete
public void delete()
-
deref
public SceneGraph deref()
The pointer stored in the object.
-
__ref__
public SceneGraph __ref__()
Dereferencing operator.
-
getDeref
public SceneGraph getDeref()
Member access operator.
-
equals
public boolean equals(SceneGraph p)
-
isShared
public boolean isShared()
check if this Ptr has shared ownership or none
ownership- Returns:
- true if Ptr has shared ownership, false if it has no ownership.
-
isNull
public boolean isNull()
checks if the pointer is null- Returns:
- Returns true if the pointer is null
-
cptr
public SceneGraphCPtr cptr()
-
draw
public void draw(SceneGraph.SceneGraphRenderInfo info)
draws the scene, using the specified render information- Parameters:
info
- documentation missing !
-
pickDrawable
public DrawableNodePtr pickDrawable(SceneGraph.SceneGraphRenderInfo info, int x, int y)
picks the drawable in the scene that intersects with the ray (x,y,-1) in
camera coordinates.
- Parameters:
info
- [in] rendering information.x
- [in] first camera coordinate.y
- [in] second camera coordinate.- Returns:
- the picked drawable.
-
unproject
public Vector3D unproject(SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneCamera_t camera, int x, int y)
this method unprojects a 2D screen coordinate to 3D coordinates from the last
draw'n scene. Which is the closest 3d point from the intersection of the ray (x,y,-1) and
the objects drawn in the scene.
Note: this method relies on a previously drawn scene, eg. call to draw(). Any thing drawn
in the scene can be "picked" by this method.
(0,0) is located in the upper left corner, with x-axis increasing to the right and y-axis
increasing to the bottom. The negative z-axis points into the scene-- Parameters:
camera
- [in] the scene camera.x
- [in] x coordinate [0;viewport.width]y
- [in] y coordinate [0;viewport.height]- Returns:
- the 3D point,
-
project
public Vector3D project(SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneCamera_t camera, double x, double y, double z)
this method projects a 3D coordinate to 2D screen coordinates from the last draw'n
scene.
Note: this method relies on a previously drawn scene, eg. call to draw(). Any thing drawn
in the scene can be "picked" by this method.
(0,0) is located in the upper left corner, with x-axis increasing to the right and y-axis
increasing to the bottom. The negative z-axis points into the scene-- Parameters:
camera
- [in] the SceneCamera.x
- [in] x coordinate [0;viewport.width]y
- [in] y coordinate [0;viewport.height]z
- [in] z coordinate- Returns:
- the 2D point,
-
update
public void update()
should be called after the structure of the scene
has been changed
-
clear
public void clear()
Clear the scene graph.
-
makeDrawableFrameAxis
public DrawableGeometryNodePtr makeDrawableFrameAxis(java.lang.String name, double size, int dmask)
Create a drawable node for a frame axis coordinate system.- Parameters:
name
- [in] name of the drawable.size
- [in] size of the axis.dmask
- [in] (optional) the type of drawable. Default is DrawableNode::Physical.- Returns:
- a drawable geometry node.
-
makeDrawableFrameAxis
public DrawableGeometryNodePtr makeDrawableFrameAxis(java.lang.String name, double size)
Create a drawable node for a frame axis coordinate system.- Parameters:
name
- [in] name of the drawable.size
- [in] size of the axis.
- Returns:
- a drawable geometry node.
-
makeDrawable
public DrawableGeometryNodePtr makeDrawable(java.lang.String name, GeometryPtr geom, int dmask)
Create a drawable node for a geometry.- Parameters:
name
- [in] name of the drawable.geom
- [in] the geometry to draw.dmask
- [in] (optional) the type of drawable. Default is DrawableNode::Physical.- Returns:
- a drawable geometry node.
-
makeDrawable
public DrawableGeometryNodePtr makeDrawable(java.lang.String name, GeometryPtr geom)
Create a drawable node for a geometry.- Parameters:
name
- [in] name of the drawable.geom
- [in] the geometry to draw.
- Returns:
- a drawable geometry node.
-
makeDrawable
public DrawableGeometryNodePtr makeDrawable(java.lang.String name, VectorLine lines, int dmask)
Create a drawable node for lines.- Parameters:
name
- [in] name of the drawable.lines
- [in] the lines to draw.dmask
- [in] (optional) the type of drawable. Default is DrawableNode::Physical.- Returns:
- a drawable geometry node.
-
makeDrawable
public DrawableGeometryNodePtr makeDrawable(java.lang.String name, VectorLine lines)
Create a drawable node for lines.- Parameters:
name
- [in] name of the drawable.lines
- [in] the lines to draw.
- Returns:
- a drawable geometry node.
-
makeDrawable
public DrawableNodePtr makeDrawable(java.lang.String name, Image img, int dmask)
Create a drawable node for an image.- Parameters:
name
- [in] name of the drawable.img
- [in] the image to draw.dmask
- [in] (optional) the type of drawable. Default is DrawableNode::Physical.- Returns:
- a drawable node.
-
makeDrawable
public DrawableNodePtr makeDrawable(java.lang.String name, Image img)
Create a drawable node for an image.- Parameters:
name
- [in] name of the drawable.img
- [in] the image to draw.
- Returns:
- a drawable node.
-
makeDrawable
public DrawableNodePtr makeDrawable(java.lang.String name, PointCloud scan, int dmask)
Create a drawable node for a point cloud.- Parameters:
name
- [in] name of the drawable.scan
- [in] the point cloud to draw.dmask
- [in] (optional) the type of drawable. Default is DrawableNode::Physical.- Returns:
- a drawable node.
-
makeDrawable
public DrawableNodePtr makeDrawable(java.lang.String name, PointCloud scan)
Create a drawable node for a point cloud.- Parameters:
name
- [in] name of the drawable.scan
- [in] the point cloud to draw.
- Returns:
- a drawable node.
-
makeDrawable
public DrawableNodePtr makeDrawable(java.lang.String name, Model3DPtr model, int dmask)
Create a drawable node for a 3d model.- Parameters:
name
- [in] name of the drawable.model
- [in] the 3d model to draw.dmask
- [in] (optional) the type of drawable. Default is DrawableNode::Physical.- Returns:
- a drawable node.
-
makeDrawable
public DrawableNodePtr makeDrawable(java.lang.String name, Model3DPtr model)
Create a drawable node for a 3d model.- Parameters:
name
- [in] name of the drawable.model
- [in] the 3d model to draw.
- Returns:
- a drawable node.
-
makeDrawable
public DrawableNodePtr makeDrawable(java.lang.String name, java.lang.String text, FramePtr labelFrame, int dmask)
Create a drawable node for a text label.- Parameters:
name
- [in] name of the drawable.text
- [in] the text to draw.labelFrame
- [in] the frame the label belongs to.dmask
- [in] (optional) the type of drawable. Default is DrawableNode::Virtual.- Returns:
- a drawable node.
-
makeDrawable
public DrawableNodePtr makeDrawable(java.lang.String name, java.lang.String text, FramePtr labelFrame)
Create a drawable node for a text label.- Parameters:
name
- [in] name of the drawable.text
- [in] the text to draw.labelFrame
- [in] the frame the label belongs to.
- Returns:
- a drawable node.
-
makeDrawable
public DrawableNodePtr makeDrawable(java.lang.String name, RenderPtr render, int dmask)
Create a drawable node for a render.- Parameters:
name
- [in] name of the drawable.render
- [in] the render to draw.dmask
- [in] (optional) the type of drawable. Default is DrawableNode::Physical.- Returns:
- a drawable node.
-
makeDrawable
public DrawableNodePtr makeDrawable(java.lang.String name, RenderPtr render)
Create a drawable node for a render.- Parameters:
name
- [in] name of the drawable.render
- [in] the render to draw.
- Returns:
- a drawable node.
-
makeDrawable
public DrawableNodePtr makeDrawable(java.lang.String filename, int dmask)
Create a drawable node from a file.- Parameters:
filename
- [in] a filename (alternatively a string for a geometric primitive).dmask
- [in] (optional) the type of drawable. Default is DrawableNode::Physical.- Returns:
- a drawable node.
-
makeDrawable
public DrawableNodePtr makeDrawable(java.lang.String filename)
Create a drawable node from a file.- Parameters:
filename
- [in] a filename (alternatively a string for a geometric primitive).
- Returns:
- a drawable node.
-
makeCamera
public SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneCamera_t makeCamera(java.lang.String name)
Create a new scene camera.- Parameters:
name
- [in] name of the camera.- Returns:
- the new scene camera.
-
makeGroupNode
public GroupNodePtr makeGroupNode(java.lang.String name)
Make a group node.- Parameters:
name
- [in] name of the node.- Returns:
- new group node.
-
makeCameraGroup
public SWIGTYPE_p_rw__core__PtrT_rw__graphics__CameraGroup_t makeCameraGroup(java.lang.String name)
Create a camera group.- Parameters:
name
- [in] name of the group.- Returns:
- a new camera group.
-
findCameraGroup
public SWIGTYPE_p_rw__core__PtrT_rw__graphics__CameraGroup_t findCameraGroup(java.lang.String name)
Find a camera group.- Parameters:
name
- [in] name of the group.- Returns:
- the camera group if found, else NULL.
-
addCameraGroup
public void addCameraGroup(SWIGTYPE_p_rw__core__PtrT_rw__graphics__CameraGroup_t cgroup)
Add a camera group.- Parameters:
cgroup
- [in] the group to add.
-
removeCameraGroup
public void removeCameraGroup(SWIGTYPE_p_rw__core__PtrT_rw__graphics__CameraGroup_t cgroup)
Remove a camera group.- Parameters:
cgroup
- [in] the group to remove.
-
removeCameraGroup
public void removeCameraGroup(java.lang.String name)
Remove a camera group.- Parameters:
name
- [in] the name of the group.
-
getCameraGroups
public SWIGTYPE_p_std__listT_rw__core__PtrT_rw__graphics__CameraGroup_t_t getCameraGroups()
Get all camera groups.- Returns:
- a list of camera groups.
-
setRoot
public void setRoot(GroupNodePtr node)
Set the root of the scene graph.- Parameters:
node
- [in] the root node.
-
getRoot
public GroupNodePtr getRoot()
Get the root of the scene graph.- Returns:
- the root group node.
-
addChild
public void addChild(SceneNodePtr child, GroupNodePtr parent)
add a drawable to a node
-
getDrawables
public SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__graphics__DrawableNode_t_t getDrawables()
get all drawables in the scene.- Returns:
-
getDrawables
public SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__graphics__DrawableNode_t_t getDrawables(SceneNodePtr node)
get a vector of drawables attached to a node- Parameters:
node
-- Returns:
-
getDrawablesRec
public SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__graphics__DrawableNode_t_t getDrawablesRec(SceneNodePtr node)
get all drawable nodes in the subtree of node. nodes of type camera will
not be traversed- Parameters:
node
- [in]- Returns:
-
findDrawable
public DrawableNodePtr findDrawable(java.lang.String name)
Find a drawable node in the scene graph.- Parameters:
name
- [in] the name of the drawable node.- Returns:
- the node if found, NULL otherwise.
-
findDrawable
public DrawableNodePtr findDrawable(java.lang.String name, SceneNodePtr node)
std::string&)- Parameters:
node
- [in] search only this node and all children recursively.
-
findDrawables
public SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__graphics__DrawableNode_t_t findDrawables(java.lang.String name)
Find multiple drawable nodes in the scene graph.- Parameters:
name
- [in] the name of the drawable node(s).- Returns:
- a vector of all nodes with the given name.
-
removeDrawables
public boolean removeDrawables(GroupNodePtr node)
Remove a node.- Parameters:
node
- [in] the group node to remove.- Returns:
- true if removed, false otherwise.
-
removeDrawables
public boolean removeDrawables(java.lang.String name)
Remove all drawables with a given name.- Parameters:
name
- [in] the name.- Returns:
- true if removed, false otherwise.
-
removeDrawable
public boolean removeDrawable(DrawableNodePtr drawable)
Remove a specific drawable.- Parameters:
drawable
- [in] the drawable.- Returns:
- true if removed, false otherwise.
-
removeDrawable
public boolean removeDrawable(DrawableNodePtr drawable, SceneNodePtr node)
Remove a specific drawable.- Parameters:
drawable
- [in] the drawable.node
- [in] only search this node and children recursively.- Returns:
- true if removed, false otherwise.
-
removeDrawable
public boolean removeDrawable(java.lang.String name)
Remove a specific drawable with a given name.- Parameters:
name
- [in] the name.- Returns:
- true if removed, false otherwise.
-
removeChild
public boolean removeChild(java.lang.String name, GroupNodePtr node)
Removes child with the specified name from the node.
- Parameters:
name
- [in] Name of child to removenode
- [in] Node to remove from- Returns:
- true if found and successfully removed.
-
-