Class SoToHTMLAction


  • public class SoToHTMLAction
    extends SoAction
    Generates an HTML image map and an image from a scene graph. This action generates an image file and an HTML file containing the image (<IMG>) and image map (<MAP>) tags. Each region of the image map will have a URL associated with it.

    With HTML, image maps allow to specify regions of an image and assign a specific action to each region (a link can be associated to each map). When the region is activated by the user, the action is executed.

    Each region of the image is determined by a subgraph which is under an SoWWWAnchor group node.

    The HTML file generated contains, in the following order:

    1. An image map tag that defines the regions (maps) corresponding to each subgraph that is under an SoWWWAnchor group node.

    For each region, the associated link is the URL defined either by the SoWWWAnchor node.

    1. An image tag that references the image generated by SoToHTMLAction.

    See Also:
    SoAction
    • Constructor Detail

      • SoToHTMLAction

        public SoToHTMLAction()
        Constructor.
    • Method Detail

      • setImageURLName

        public void setImageURLName​(java.lang.String name)
        Sets the URL name of image in the HTML file, ("image.jpg" by default). This is the first way to specify the image file name.
      • getImageURLName

        public java.lang.String getImageURLName()
        Returns the URL name of image in the HTML file.
      • openHTMLFile

        public boolean openHTMLFile​(java.lang.String filename)
        Opens named file. This returns false on error. By default, output goes to stdout .
      • getViewportRegion

        public SbViewportRegion getViewportRegion()
        Returns viewport region for the image.
      • closeHTMLFile

        public void closeHTMLFile()
        Closes the HTML output file.
      • resetHTMLBuffer

        public void resetHTMLBuffer()
        Resets buffer of the HTML output for output again. Output starts over at beginning of buffer.
      • setImageQuality

        public void setImageQuality​(float quality)
        Sets the image quality. Used for JPEG image. Quality is a value from 0. to 1., with 0 being the worst quality (maximum compression) and 1 being the best quality (minimum compression). The default is 1.
      • enableElement

        public static void enableElement​(java.lang.Class<? extends Inventor> t,
                                         int stkIndex)
      • getImageQuality

        public float getImageQuality()
        Returns the image quality.
      • setViewportRegion

        public void setViewportRegion​(SbViewportRegion region)
        Specifies viewport region for the image. Allows the user to specify the image size.
      • setMapHighlight

        public void setMapHighlight​(boolean onOff)
        Sets anchor highlighting. true by default.
      • isMapHighlight

        public boolean isMapHighlight()
        Returns anchor highlighting.
      • setImageBackgroundColor

        public void setImageBackgroundColor​(SbColor c)
        Sets the image background color. SbColor(0,0,0) by default.
      • setRegionShapeType

        public void setRegionShapeType​(SoToHTMLAction.ShapeTypes type)
        Sets the region shape type. POLYGON by default.
      • getImageBackgroundColor

        public SbColor getImageBackgroundColor()
        Returns the image background color.
      • setImageComponents

        public void setImageComponents​(SoToHTMLAction.Components components)
        Sets the components of image. RGB by default.