GDexIndex.gif Previous-2.gif Next-3.gif

Modifying a camera for annotation (AnnoCamera)


Many times you might like to add non-transformable annotation or simple graphics to a view. This example illustrates one way to do this by having a non-pickable 2D camera in the view and placing the annotation or simple graphics in that camera.

Starting up

  1. 1.      Start AVS/Express and choose Single-window DataViewer with no viewer (select None as the Viewer type) from the startup dialog, from an existing AVS/Express session, start a new Single-window DataViewer with no viewer by selecting the appropriate entries from the File->New Application... dialog, or clear an existing SingleWindowApp workspace, as appropriate.
  2. Instance Uviewer

    Instance into the SingleWindowApp workspace the object Uviewer.

     

    GENERATE/FH413305.gif

    Create an object and generate field data

    We need to create a Graphics Display Kit object.

    Instance Read Geom and connect it to Uviewer's left input port.

    We're now ready to specify a data file. Select Editors->Modules to display the Read Geom user interface. Select the Browse button. A dialog box appears. Select teapot.geo, then select the OK button.

    The application renders the teapot in the view's window.

    Modify the 2D camera

    We need to modify the 2D camera so annotation and simple graphics will be non-transformable.

    Select Editors->Camera to display the camera editor's user interface.

    Select in the view's background until the 2D camera is selected.

    Toggle the Pickable control in the camera editor's user interface so that it is set off.

    This makes the camera as well as all the objects in the camera unpickable. You will be unable to directly manipulate the objects, making them effectively "non-transformable". Note however, that if the transform subobject of the object changes in some other manner, the object will still be transformed.

    Add some annotation

    We can now add some text and graphics that we want to be non-transformable to the view.

    Instance TextString and connect it to the view as shown in the diagram below.

     

    GENERATE/FH031333.gif

    The text string "Hello World" will be rendered in the middle of the view. We need to move it to the top of the view, render a different string and make the font larger.

    Change the text position.

  3. 1.      Maximize TextString.
  4. Open text.

    Scroll down to find the position subobject and open it. This position represent the XY coordinates where the string will be rendered.

    Replace the current values with -4.0 for X and 3.5 for Y. With the current string and font size, "Hello World" is rendered towards the upper left.

    Close text.

    Close TextString.

    Change the text string and the font size.

  5. 2.      Select Editors->Modules to display the modules window. Select TextString from the Modules option menu. The user interface for TextString appears.
  6. Replace "Hello World" with "Non-Transformable Annotation".

    Find the value 20 in the font specification and replace it with 30.

    We now have a title at the top of the view that is non-transformable.

    Add a legend

    We can now add a legend to the view that will also be non-transformable.

    Instance LegendHoriz and connect it to the view as shown in the diagram below.

     

    GENERATE/FH649361.gif

    Try transforming the objects in the view.

    Notice that the only objects that you can pick are Top3D and teapot. Since the text string and legend are in a camera that is not pickable, they cannot be selected.

    Clean up

    This completes the tutorial. The completed tutorial is available in Libraries.Examples.Graphics_Display.AnnoCamera.

    Delete the application.

     



    GDexIndex.gif Previous-2.gif Next-3.gif