![]() |
RTView®
User Guide |
|
Creating Custom Objects This tutorial will teach you how to create custom objects with SL-GMS J-Developer and add them to the Object Palette in RTView. Learn to:
Get
Started
Register for a
License Key On
Windows
Creating Customized Dynamic Graphic Objects Start SL-GMSDraw On
Windows
1. Open a UNIX terminal window. 2. In the terminal window, go to your J-Developer installation directory. 3. Initialize the
terminal window:
NOTE: Leave this initialized terminal window open, you will need to use it again later in this tutorial. 4. Start SL-GMSDraw:
You are now ready to create
a dynamic graphic object. Create a Dynamic Graphic Object
1. Select File>New 2. Click on the filled rectangle tool from the toolbar on the left of the window. As you move the cursor over the drawing window, the position of the cursor is listed in the status bar in the bottom right corner. 3. Click at approximately 5, 10 and then click again at approximately 10, 5. You should now have a blue rectangle. 4. Right-click and select Done to exit the rectangle mode. 5. If the rectangle is not selected, select it, then select Dynamics>Object Dynamic Properties. This will bring up the Object Dynamic Properties dialog in which you will enter dynamics for this object. 6. In this dialog type: * 7. Click Apply, then Close. You have now defined a dynamic that will cause the rectangle fill to move up and down according to the value of a variable called value. 8. If the rectangle is not selected, select it, then select Object>Move. The dialog should already be set up to move the object to the point 0, 0. 9. Click Apply, then Close. 10 Select File>Change Directory and change your current directory to your RTView installation directory. 11. Change your current directory again to demos (located in your RTView installation directory) and then click Close. 12. Save your file in the demos directory and name it tutorial.m1. 13. To test the dynamics before you convert the graphic to a Java class, select Dynamics>Edit Data File.
value step 0. 100. 0. 10. 14. Click Save File, then Close. You have now created a file called tutorial.dat that will simulate data changes to a variable called value, which will increment between 0 and 100. 15. If necessary, scroll the window so you can see the rectangle. 16. Select Dynamics>Preview Options and in the Preview Options dialog, click on Start. The rectangle should initially be unfilled and then the fill level will move up and down. 17. Click on Stop to end the preview. 18. Exit SL-GMSDraw. You are now ready to convert your object to a
Java class. Convert Object to Java Class In order to add your object to the RTView Object Palette you must convert it to a Java class. On
Windows 2. In the Command Prompt window, go to your RTView installation directory and type: rtv_init 3. In the initialized Command Prompt window, go from your installation directory to the demos directory and confirm that your file tutorial.m1 is in this directory. 4. In the same initialized window, type: make_rtvobject tutorial You have now created a class file called tutorial.class. You are ready to add your object to the RTView Object Palette.
On UNIX 1. Open a UNIX terminal window. 2. In the terminal window, go to your RTView installation directory. 3.
Initialize the terminal window.
NOTE: You must initialize each new terminal window you open. See the Setup section for more details about setting up your environment. 4. In the initialized terminal window, go from your installation directory to the demos directory and confirm that your file tutorial.m1 is in this directory. 5. In the same initialized window, type: make_rtvobject tutorial You have now created a class file called tutorial.class. You are ready to add your object to the RTView Object Palette.
Add an Object to the RTView Object Palette At this point you have:
Each tab in the Object Palette window is defined by an XML file. You will need to create this file and then modify the palette initialization file so that RTView will load your tab in the Object Palette. (A future version of RTView will provide an interface for modifying the Object Palette.) 1. In a text editor, such as Notepad or vi, create a new file and enter the following:
<?xml version="1.0"?>
NOTE: The object name is arbitrary, but the class must match the name of the class file you created (without the .class extension). The value will set the initial value of the fill percent to 25. 2. Save this text file in the demos directory as tutorial.rtp. 3. Copy the PALETTE.ini file from the lib directory into the demos directory. 4. In a text editor, edit the new copy of PALETTE.ini:
5. Save and close PALETTE.ini.
You are now ready to use your new object in RTView. Use Custom Object in RTView Start
the XML Data Simulator
On
Windows
The XML data simulator is ready when dots appear across the screen. On
UNIX
2. In the terminal window, go to your RTView installation directory. 3.
Initialize the terminal window:
4. In the initialized terminal window, go from your installation directory to the demos directory. 5. Start
the
XML data
simulator:
The XML data simulator runs as a background process and is ready when dots appear in the console. On
Windows
NOTE: It is possible that your system administrator may have configured another user name and password. In this case, you may also need to select a role. You are now ready to create
a display.
On
UNIX
2. Login to the Display Builder. By default, the Display
Builder
does not require a login. Login can be
enabled at setup to support role
based security. The default user name and password are:
NOTE: It is possible that your system administrator may have configured another user name and password. In this case, you may also need to select a role. You are now ready to create
a display.
Create A Display
Add
an XML Source to XML Source List
1. Select Tools>Options to open the Application Options dialog. 2. Select the XML tab and click Add to open the Add XML Source dialog. 3. In the
Add XML Source dialog:
NOTE: The update.xml source is generated by the XML data simulator. See Creating XML Sources for technical details on creating and formatting your own XML source. 4. Click OK to close the Add XML Source dialog. The XML source appears in the list of available XML Data Sources. 5. Click OK to apply and close the Application Options dialog. The XML source is now available for animating objects.
Attach Your Custom Object
to Data
1. In the Object Palette, select the Tutorial tab and add your object to the display. In the Object Properties dialog one of the available properties is value; this corresponds to the dynamic that you added to the object when you created your object in SL-GMSDraw.
2.
In the Object Properties dialog:
5.
In the
Attach to XML Data
dialog:
6.
Click
OK
to apply these values and close the Attach to XML Data
dialog.
The rectangle is now animated with real-time data updates provided by the value of the element1_load Data Key. Make Custom Palettes and Objects Available Throughout
RTView RTView looks for
PALETTE.ini
in the directory where you start the Display Builder. If it is not
there, RTView searches under
lib in your installation directory. Similarly, RTView looks for
palette XML files (.rtp) and object classes (.class) in the directory where you
start the Display Builder.
If they are not there, RTView searches in the
classpath. To add a .class file to the classpath, pack it into a
.jar file and add it to the RTV_USERPATH
environment variable. Replace the standard PALETTE.ini with your custom version 1. Go to the lib directory, located in your RTView installation directory. 2. Rename PALETTE.ini to PALETTE.ini0. This will allow you to revert to the original PALETTE.ini if necessary.
3.
Copy
your customized version of PALETTE.ini into the lib directory.
Add your palette (.rtp) files and object class (.class) files to the classpath 1. In a GMS command window, go to the demos directory and type:
2. Add RTV_HOME\demos\myclasses.jar to the RTV_USERPATH environment variable.
Your customized palette and objects are now available throughout your version of RTView.
More Information About SL-GMSDraw For more information on creating customized
dynamic graphics with SL-GMSDraw, refer the J-Developer documentation in Start-->Programs-->SL-GMS
J-Developer-->Documentation (PDF).
On Unix, open jdoc\JDEV.pdf. |
|
|
|
|
|
|