Class WorkCellScene


  • public class WorkCellScene
    extends java.lang.Object
    class for wrapping the SceneGraph interface such that it extends the scene-graph
    functionality to work on frames and workcells.

    The scene graph is composed of nodes which are related to Frames. Each frame
    can have several Drawables attached which can be considered as leafs. Beside keeping track
    of the mapping from frames to scenenodes, this class also adds settings such as highlighted,
    adding of frameaxis(per Frame), visibility and so on.
    • Constructor Detail

      • WorkCellScene

        public WorkCellScene​(long cPtr,
                             boolean cMemoryOwn)
      • WorkCellScene

        public WorkCellScene​(SceneGraphPtr scene)
        constructor - creates a workcell with a current SceneGraph
        Parameters:
        scene - [in] scene graph to use.
    • Method Detail

      • delete

        public void delete()
      • draw

        public void draw​(SceneGraph.SceneGraphRenderInfo info)
        renders the complete scene using the settings in info.

        This basically forwards the call to SceneGraph::draw

        Parameters:
        info - [in] render settings
      • setWorkCell

        public void setWorkCell​(WorkCellPtr wc)
        set the workcell to render
        Parameters:
        wc - [in] the workcell that is to be rendered
      • getWorkCell

        public WorkCellPtr getWorkCell()
        get the workcell that is currently being rendered.
      • setState

        public void setState​(State state)
        state changes are updated by calling this method. That includes
        transformations between frames, joints and stuff.
        Parameters:
        state - [in] the new state that is to be rendered
      • getWorldNode

        public GroupNodePtr getWorldNode()
        gets the node of the scene graph that maps to the world frame
        of the workcell.
        Returns:
        scene node
      • updateSceneGraph

        public void updateSceneGraph​(State state)
        updates the state of the scenegraph to that of state
        Parameters:
        state -
      • clearCache

        public void clearCache()
        any cached drawables or scene nodes are deleted
      • setVisible

        public void setVisible​(boolean visible,
                               FramePtr f)
        sets the visibility of a frame and its drawables.
        Parameters:
        f - [in] the frame.
        visible - [in] true if frame should be visible, false otherwise
      • isVisible

        public boolean isVisible​(FramePtr f)
        test if a frame is visible or not
        Parameters:
        f - [in] the frame
        Returns:
        true if frame is visible, false if not
      • setHighlighted

        public void setHighlighted​(boolean highlighted,
                                   FramePtr f)
        sets a frame to be highlighted or not.
        Parameters:
        f - [in] the frame.
        highlighted - [in] true if frame should be highlighted, false otherwise
      • isHighlighted

        public boolean isHighlighted​(FramePtr f)
        test if a frame is highlighted or not
        Parameters:
        f - [in] the frame
        Returns:
        true if frame is highlighted, false if not
      • setFrameAxisVisible

        public void setFrameAxisVisible​(boolean visible,
                                        FramePtr f,
                                        double size)
        enables the drawing of the frame-axis of a frame.
        Parameters:
        visible - [in] true if frame axis should be drawn, false otherwise
        f - [in] the frame
        size - [in] size of the frame-axis (default = 0.25)
      • setFrameAxisVisible

        public void setFrameAxisVisible​(boolean visible,
                                        FramePtr f)
        enables the drawing of the frame-axis of a frame.
        Parameters:
        visible - [in] true if frame axis should be drawn, false otherwise
        f - [in] the frame
      • isFrameAxisVisible

        public boolean isFrameAxisVisible​(FramePtr f)
        test if frame-axis is visible
        Parameters:
        f - [in] the frame
        Returns:
        true if frame axis of frame is set to be drawn, false otherwise
      • setFrameLabelVisible

        public void setFrameLabelVisible​(boolean visible,
                                         FramePtr f)
        enables the drawing of the frame label of a frame.
        Parameters:
        visible - [in] true if frame label should be drawn, false otherwise
        f - [in] the frame
      • isFrameLabelVisible

        public boolean isFrameLabelVisible​(FramePtr f)
        test if frame-label is visible
        Parameters:
        f - [in] the frame
        Returns:
        true if frame label of frame is set to be drawn, false otherwise
      • setDrawType

        public void setDrawType​(DrawableNode.DrawType type,
                                FramePtr f)
        set how drawables of a specific frame should be rendered
        Parameters:
        type - [in] the drawtype
        f - [in] the Frame
      • getDrawType

        public DrawableNode.DrawType getDrawType​(FramePtr f)
        get how drawables of a specific frame is to be rendered
        Parameters:
        f - [in] the Frame
        Returns:
        the drawtype
      • setDrawMask

        public void setDrawMask​(long mask,
                                FramePtr f)
        set the draw mask of the drawables of a specific frame
        Parameters:
        mask - [in] draw mask
        f - [in] the frame
      • getDrawMask

        public long getDrawMask​(FramePtr f)
        get the draw mask of the drawables of a specific frame
        Parameters:
        f - [in] the frame
        Returns:
        the drawmask
      • setTransparency

        public void setTransparency​(double alpha,
                                    FramePtr f)
        set drawables of a frame to be translusent
        Parameters:
        alpha - [in] range [0-1] where 1 is fully opaque and 0 is folly transparent
        f - [in] frame
      • addLines

        public DrawableGeometryNodePtr addLines​(java.lang.String name,
                                                VectorLine lines,
                                                FramePtr frame,
                                                int dmask)
        create and add a drawable geometry node of line geometry to the scene
        Parameters:
        name - [in] name of drawable node
        lines - [in] the line geometry
        frame - [in] the frame where the drawable is to be placed
        dmask - [in] the drawable mask
        Returns:
        the drawable node geometry
      • addLines

        public DrawableGeometryNodePtr addLines​(java.lang.String name,
                                                VectorLine lines,
                                                FramePtr frame)
        create and add a drawable geometry node of line geometry to the scene
        Parameters:
        name - [in] name of drawable node
        lines - [in] the line geometry
        frame - [in] the frame where the drawable is to be placed

        Returns:
        the drawable node geometry
      • addGeometry

        public DrawableGeometryNodePtr addGeometry​(java.lang.String name,
                                                   GeometryPtr geom,
                                                   FramePtr frame,
                                                   int dmask)
        create and add a drawable geometry node of any type of geometry to the scene
        Parameters:
        name - [in] name of drawable node
        geom - [in] the geometry
        frame - [in] the frame where the drawable is to be placed
        dmask - [in] the drawable mask
        Returns:
        the drawable node geometry
      • addGeometry

        public DrawableGeometryNodePtr addGeometry​(java.lang.String name,
                                                   GeometryPtr geom,
                                                   FramePtr frame)
        create and add a drawable geometry node of any type of geometry to the scene
        Parameters:
        name - [in] name of drawable node
        geom - [in] the geometry
        frame - [in] the frame where the drawable is to be placed

        Returns:
        the drawable node geometry
      • addFrameAxis

        public DrawableNodePtr addFrameAxis​(java.lang.String name,
                                            double size,
                                            FramePtr frame,
                                            int dmask)
        create and add a drawable node of a frame axis to the scene
        Parameters:
        name - [in] name of drawable node
        size - [in] the length of the axis arrows in meters
        frame - [in] the frame where the drawable is to be placed
        dmask - [in] the drawable mask
        Returns:
        the drawable node geometry
      • addFrameAxis

        public DrawableNodePtr addFrameAxis​(java.lang.String name,
                                            double size,
                                            FramePtr frame)
        create and add a drawable node of a frame axis to the scene
        Parameters:
        name - [in] name of drawable node
        size - [in] the length of the axis arrows in meters
        frame - [in] the frame where the drawable is to be placed

        Returns:
        the drawable node geometry
      • addModel3D

        public DrawableNodePtr addModel3D​(java.lang.String name,
                                          Model3DPtr model,
                                          FramePtr frame,
                                          int dmask)
        create and add a drawable node of a model3d to the scene
        Parameters:
        name - [in] name of drawable node
        model - [in] the model3d
        frame - [in] the frame where the drawable is to be placed
        dmask - [in] the drawable mask
        Returns:
        the drawable node geometry
      • addModel3D

        public DrawableNodePtr addModel3D​(java.lang.String name,
                                          Model3DPtr model,
                                          FramePtr frame)
        create and add a drawable node of a model3d to the scene
        Parameters:
        name - [in] name of drawable node
        model - [in] the model3d
        frame - [in] the frame where the drawable is to be placed

        Returns:
        the drawable node geometry
      • addImage

        public DrawableNodePtr addImage​(java.lang.String name,
                                        Image img,
                                        FramePtr frame,
                                        int dmask)
        create and add a drawable node of an image to the scene
        Parameters:
        name - [in] name of drawable node
        img - [in] the image
        frame - [in] the frame where the drawable is to be placed
        dmask - [in] the drawable mask
        Returns:
        the drawable node geometry
        Note: the size of the image in the scene will be pixel/cm. To change this please use
        scale.
      • addImage

        public DrawableNodePtr addImage​(java.lang.String name,
                                        Image img,
                                        FramePtr frame)
        create and add a drawable node of an image to the scene
        Parameters:
        name - [in] name of drawable node
        img - [in] the image
        frame - [in] the frame where the drawable is to be placed

        Returns:
        the drawable node geometry
        Note: the size of the image in the scene will be pixel/cm. To change this please use
        scale.
      • addScan

        public DrawableNodePtr addScan​(java.lang.String name,
                                       PointCloud scan,
                                       FramePtr frame,
                                       int dmask)
        create and add a drawable node of a scan to the scene
        Parameters:
        name - [in] name of drawable node
        scan - [in] the scan
        frame - [in] the frame where the drawable is to be placed
        dmask - [in] the drawable mask
        Returns:
        the drawable node
      • addScan

        public DrawableNodePtr addScan​(java.lang.String name,
                                       PointCloud scan,
                                       FramePtr frame)
        create and add a drawable node of a scan to the scene
        Parameters:
        name - [in] name of drawable node
        scan - [in] the scan
        frame - [in] the frame where the drawable is to be placed

        Returns:
        the drawable node
      • addText

        public DrawableNodePtr addText​(java.lang.String name,
                                       java.lang.String text,
                                       FramePtr frame,
                                       int dmask)
        create and add a drawable node of a textlabel
        Parameters:
        name - [in] name of drawable node
        text - [in] the label text
        frame - [in] the frame where the drawable is to be placed
        dmask - [in] the drawable mask
        Returns:
        the drawable node
      • addText

        public DrawableNodePtr addText​(java.lang.String name,
                                       java.lang.String text,
                                       FramePtr frame)
        create and add a drawable node of a textlabel
        Parameters:
        name - [in] name of drawable node
        text - [in] the label text
        frame - [in] the frame where the drawable is to be placed

        Returns:
        the drawable node
      • addRender

        public DrawableNodePtr addRender​(java.lang.String name,
                                         RenderPtr render,
                                         FramePtr frame,
                                         int dmask)
        create and add a drawable node of a render, to the scene
        Parameters:
        name - [in] name of drawable node
        render - [in] the render
        frame - [in] the frame where the drawable is to be placed
        dmask - [in] the drawable mask
        Returns:
        the drawable node
      • addRender

        public DrawableNodePtr addRender​(java.lang.String name,
                                         RenderPtr render,
                                         FramePtr frame)
        create and add a drawable node of a render, to the scene
        Parameters:
        name - [in] name of drawable node
        render - [in] the render
        frame - [in] the frame where the drawable is to be placed

        Returns:
        the drawable node
      • addDrawable

        public DrawableNodePtr addDrawable​(java.lang.String filename,
                                           FramePtr frame,
                                           int dmask)
        create and add a drawable node from a filename to the scene
        Parameters:
        filename - [in] name of drawable node
        frame - [in] the frame where the drawable is to be placed
        dmask - [in] the drawable mask
        Returns:
        the drawable node
      • addDrawable

        public DrawableNodePtr addDrawable​(java.lang.String filename,
                                           FramePtr frame)
        create and add a drawable node from a filename to the scene
        Parameters:
        filename - [in] name of drawable node
        frame - [in] the frame where the drawable is to be placed

        Returns:
        the drawable node
      • addDrawable

        public void addDrawable​(DrawableNodePtr drawable,
                                FramePtr frame)
        add a drawable node to the scene
        Parameters:
        drawable - [in] the drawable
        frame - [in] the frame where the drawable is to be placed
      • findDrawable

        public DrawableNodePtr findDrawable​(java.lang.String name)
        find a drawable by name name.
        Parameters:
        name - [in] the name of the drawable
        Returns:
        a drawable with name name or NULL if no such drawable exist in the scene
      • findDrawable

        public DrawableNodePtr findDrawable​(java.lang.String name,
                                            FramePtr frame)
        find a drawable by name name that is attached to frame frame
        Parameters:
        name - [in] the name of the drawable
        frame - [in] search only the subtree beginning from this frame.
        Returns:
        a drawable with name name or NULL if no such drawable exist in the scene
      • removeDrawables

        public boolean removeDrawables​(FramePtr f)
        remove all drawables on a frame
        Parameters:
        f - [in] the frame
        Returns:
        true if successfull
      • removeDrawables

        public boolean removeDrawables​(java.lang.String name)
        remove all drawables with name
        name
        Parameters:
        name - [in] the name
        Returns:
        true if successfull
      • removeDrawable

        public boolean removeDrawable​(DrawableNodePtr drawable)
        remove a drawable from the scene
        Parameters:
        drawable - [in] the drawable
        Returns:
        true if successfull
      • removeDrawable

        public boolean removeDrawable​(DrawableNodePtr drawable,
                                      FramePtr f)
        remove a drawable from a specific frame
        Parameters:
        drawable - [in] the drawable
        f - [in] the frame
        Returns:
        true if successfull
      • removeDrawable

        public boolean removeDrawable​(java.lang.String name)
        remove first drawable by name name
        Parameters:
        name - [in] the name
        Returns:
        true if successfull
      • removeDrawable

        public boolean removeDrawable​(java.lang.String name,
                                      FramePtr f)
        remove drawable by name
        and which is attached to frame f
        Parameters:
        name - [in] name of drawable
        f - [in] the frame
        Returns:
        true if successfull
      • getFrame

        public Frame getFrame​(DrawableNodePtr d)
        get the frame that a specific drawable d is associated to
        Parameters:
        d - [in] the drawable
        Returns:
        the first frame that the drawable is associated to, or NULL if there are no
        associations
      • getNode

        public GroupNodePtr getNode​(FramePtr frame)
        Get the GroupNode corresponding to the given frame.
        Parameters:
        frame - [in] the frame.
        Returns:
        group node.