Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
Generating HTML

Introduction

Rectangle image map

Circle image map

Polygon image map

shape.

Figure 13.6. Polygon image map

Step 6: Enable/Disable image map highlighting mechanism (Optional)

This allows your browser to keep track of the pointer location in the image map and highlight a particular region whenever you enter it. By default, highlighting is on and can be disabled if necessary.

C++ :

myAction->setMapHighlight( FALSE );

C# :

myAction.SetMapHighlight( false );

Java :

myAction.setMapHighlight( false );

The current highlighting value can be retrieved by:

C++ :

SbBool highlight = myAction->isMapHighlight();

C# :

bool highlight = myAction.IsMapHighlight();

Java :

boolean highlight = myAction.isMapHighlight();

Step 7: Create the HTML file and the image map

The apply() method is inherited from the SoAction base class. Apply the action to the group where you want traversal to start. If you want to generate an image map of the whole scene graph, apply the action to the root of the scene graph.

C++ :

myAction->apply( mySceneRoot );

C# :

myAction.Apply( mySceneRoot );

Java :

myAction.apply( mySceneRoot );

Applying the action will automatically generate the “.html” file and the image file. The “.html” file will include the MAP tag with definitions of the regions and the IMG tag with the URL of the image file. For example, the previous figure showing a RECTANGLE border shape could have the following HTML file:

Example : HTML file and image map

<HTML>
<BODY>
<MAP NAME="title1">
<AREA SHAPE="RECT" COORDS="152,155,239,242" HREF="sphere.htm">
<AREA SHAPE="RECT" COORDS="38,122,144,229" HREF="cube.htm">
<AREA SHAPE="RECT" COORDS="153,10,256,126" HREF="cylinder.htm">
<AREA SHAPE="RECT" COORDS="51,18,128,107" HREF="cone.htm">
</MAP>
<CENTER>
<IMG SRC="image1.jpg"
USEMAP="#title1"
BORDER 0>
</CENTER>
</BODY>
</HTML>

Step 8: Close the HTML file

City of Toronto with HTML image maps

the openHTMLFile() method:

C++ :

myAction->closeHTMLFile();

C# :

myAction.CloseHTMLFile();

Java :

myAction.closeHTMLFile();

The example:$OIVHOME/src/Inventor/examples/Features/IvToHTMLAction/IvToHTMLAction.cxx puts into practice the previously described steps.