Package org.robwork.sdurw_graphics
Class SceneViewer
- java.lang.Object
-
- org.robwork.sdurw_graphics.SceneViewer
-
public class SceneViewer extends java.lang.Objectinterface for viewing a scene graph.
The scene graph viewer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSceneViewer.View
-
Constructor Summary
Constructors Constructor Description SceneViewer(long cPtr, boolean cMemoryOwn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidautoZoom()Automatically fits all frames inside the viewport by moving camera in its z-axis.SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_tcreateView(java.lang.String name)Create a new view.SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_tcreateView(java.lang.String name, boolean enableBackground)Create a new view.voiddelete()voiddestroyView(SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_t view)Destroy view.static longgetCPtr(SceneViewer obj)SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_tgetCurrentView()Get the currently selected view.java.lang.StringgetLogo()get the logo that is displayed in the 3d sceneSWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_tgetMainView()Get the main view.PropertyMapgetPropertyMap()get propertymapSceneGraphPtrgetScene()get the current scene graphTransform3DgetTransform()get the current rotation of the viewSWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneCamera_tgetViewCamera()Get the view camera.Vector3DgetViewCenter()Get the view center.SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__graphics__SceneViewer__View_t_tgetViews()Get all views.GroupNodePtrgetWorldNode()Get the world node.DrawableNodePtrpickDrawable(int x, int y)picks the drawable in the scene that intersects with the ray (x,y,-1) in
camera coordinates.
DrawableNodePtrpickDrawable(SceneGraph.SceneGraphRenderInfo info, int x, int y)&,int,int)voidrenderView(SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_t view)Render a view.voidsaveBufferToFile(java.lang.String filename, int fillR, int fillG, int fillB)Saves the current 3D view to disk as either jpg, bmp or png.
If failing a std::string is thrown with a detailed description of what
when wrong.
voidselectView(SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_t view)Select a view.voidsetLogo(java.lang.String string)set the logo that is displayed in the 3d scenevoidsetTransform(Transform3D t3d)set the orientation of the view.voidsetWorkCellScene(WorkCellScenePtr wcscene)Set the WorkCell scene.voidsetWorldNode(GroupNodePtr wnode)Set the world group node.voidupdateState(State state)Set a new state.voidupdateView()Update the view.voidzoom(double amount)Move the camera along its z-axis.
-
-
-
Method Detail
-
getCPtr
public static long getCPtr(SceneViewer obj)
-
delete
public void delete()
-
getScene
public SceneGraphPtr getScene()
get the current scene graph
-
getLogo
public java.lang.String getLogo()
get the logo that is displayed in the 3d scene
-
setLogo
public void setLogo(java.lang.String string)
set the logo that is displayed in the 3d scene
-
getPropertyMap
public PropertyMap getPropertyMap()
get propertymap
-
updateView
public void updateView()
Update the view.
-
updateState
public void updateState(State state)
Set a new state.- Parameters:
state- [in] new state.
-
setWorldNode
public void setWorldNode(GroupNodePtr wnode)
Set the world group node.- Parameters:
wnode- [in] the world node.
-
setWorkCellScene
public void setWorkCellScene(WorkCellScenePtr wcscene)
Set the WorkCell scene.- Parameters:
wcscene- [in] the workcell scene.
-
getWorldNode
public GroupNodePtr getWorldNode()
Get the world node.- Returns:
- the world node.
-
saveBufferToFile
public void saveBufferToFile(java.lang.String filename, int fillR, int fillG, int fillB)Saves the current 3D view to disk as either jpg, bmp or png.
If failing a std::string is thrown with a detailed description of what
when wrong.
- Parameters:
filename- [in] Path and name of the file. The filename extension
should be either ".jpg", ".bmp" or ".png" to specify which format to use.fillR- [in] Fill color if viewport is smaller than image, red component [0,255]fillG- [in] Fill color if viewport is smaller than image, green component [0,255]fillB- [in] Fill color if viewport is smaller than image, blue component [0,255]
-
getViewCamera
public SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneCamera_t getViewCamera()
Get the view camera.- Returns:
- a scene camera.
-
getViewCenter
public Vector3D getViewCenter()
Get the view center.- Returns:
- the center.
-
pickDrawable
public DrawableNodePtr pickDrawable(int x, int y)
picks the drawable in the scene that intersects with the ray (x,y,-1) in
camera coordinates.
- Parameters:
x- [in] first camera coordinate.y- [in] second camera coordinate.- Returns:
- the picked drawable.
-
pickDrawable
public DrawableNodePtr pickDrawable(SceneGraph.SceneGraphRenderInfo info, int x, int y)
&,int,int)
-
createView
public SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_t createView(java.lang.String name, boolean enableBackground)
Create a new view.- Parameters:
name- [in] name of view.enableBackground- [in] (optional) enable the background. Default is false.- Returns:
- the new view.
-
createView
public SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_t createView(java.lang.String name)
Create a new view.- Parameters:
name- [in] name of view.
- Returns:
- the new view.
-
getMainView
public SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_t getMainView()
Get the main view.- Returns:
- main view.
-
destroyView
public void destroyView(SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_t view)
Destroy view.- Parameters:
view- [in] the view to destroy.
-
selectView
public void selectView(SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_t view)
Select a view.- Parameters:
view- [in] the view to select.
-
getCurrentView
public SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_t getCurrentView()
Get the currently selected view.- Returns:
- the view.
-
getViews
public SWIGTYPE_p_std__vectorT_rw__core__PtrT_rw__graphics__SceneViewer__View_t_t getViews()
Get all views.- Returns:
- the views.
-
renderView
public void renderView(SWIGTYPE_p_rw__core__PtrT_rw__graphics__SceneViewer__View_t view)
Render a view.- Parameters:
view- [in] the view to render
-
setTransform
public void setTransform(Transform3D t3d)
set the orientation of the view. The view will look in the
positive direction of the z-axis, with x-axis as the width and
the y-axis as the height. Origin of view is in the center of the
image.- Parameters:
t3d- [in] transform relative to world
-
getTransform
public Transform3D getTransform()
get the current rotation of the view- Returns:
- orientation of the view
-
zoom
public void zoom(double amount)
Move the camera along its z-axis.- Parameters:
amount- [in] the amount of zoom.
-
autoZoom
public void autoZoom()
Automatically fits all frames inside the viewport by moving camera in its z-axis.
-
-