Class SceneGraphPtr


  • public class SceneGraphPtr
    extends java.lang.Object
    Ptr stores a pointer and optionally takes ownership of the value.
    • 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

      • 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
      • 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.
      • makeGroupNode

        public GroupNodePtr makeGroupNode​(java.lang.String name)
        Make a group node.
        Parameters:
        name - [in] name of the node.
        Returns:
        new group node.
      • removeCameraGroup

        public void removeCameraGroup​(java.lang.String name)
        Remove a camera group.
        Parameters:
        name - [in] the name of the group.
      • 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.
      • 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.
      • 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 remove
        node - [in] Node to remove from
        Returns:
        true if found and successfully removed.