nextuppreviouscontents
Next:Example DefinitionUp:Animation ViewsPrevious:Animation ViewsContents




This section is a copy of [1] , which is available at:
http://www.cc.gatech.edu/gvu/softviz/parviz/polkastuff/polkadoc-lite.ps.
The POLKA document is copyrighted by John T. Stasko, College of Computing, Georgia Institute of Technology, Atlanta, GA 30332-0280, and is available for noncommercial use.

Entry Points

void
View::SetDebug(int d)
This routine sets the debugging output level (0-off, 1-on). The default is off. It's sometimes a good idea to have it set as you first develop an animation.
 
 
 
void
View::SetCoord(double lx, double by, double rx, double ty)
This routine is used to change the coordinates of a View that are visible. It can be called before or after the View::Create routine is called. It can be used to smoothly pan or zoom the window by making repeated, incremental calls to the routine. Note, however, that this call does not synchronize with the animation loop. The two are independent. To get panning or zooming that are synched with the animation refresh cycle, use the ALTER_LL and ALTER_UR Polka Actions.
 
 
 
void
View::SetBgColor(const char *)
This routine changes the background color of the View. Any valid X color name can be passed to the routine and the background color will immediately change. This routine should only be called after View::Create has been called, but it can be before any animation frames have been generated.
 
 
 
int
View::Create (const char *title="Polka", RefreshMode rm=CoordStretch, 
              int width=0, int height=0)
This is the routine that puts up the X window housing the animation view. It MUST be the first routine called for the view, except for SetDebug or SetCoord which can precede the Create call. If a string is passed in as the first parameter, that string will be displayed in the window manager's title bar (if there is one) for the View. If none is passed in, the word "Polka" will appear there. The second argument should take on the value CoordStretch (the default) or ConstantAspect. This parameter specifies how the View contents will be displayed when the viewer manually resizes the window containing the View. If CoordStretch is chosen, then four corner window coordinates of the View always stay the same on a resize. This effectively stretches or shrinks the AnimObjects inside the View window. If ConstantAspect is chosen, the lower left coordinate stays the same, but the upper right coordinate is changed to keep the same exact pixels-to-coordinates aspect ratio that was in place before the resize. The final two arguments specify the width and height of the View in pixels at start-up. Note that the default values 0 are used just to make the value be taken from a Polka resource file. Even if no resource file exists, the default value of a $512 X 512$ View will be used. The routine returns 0 if it was not able to create the window successfully.
 
 
 
int
View::CheckInput()
This routine goes to the X event loop and processes any user input events pending for the window. It is useful at the very end of a program's execution to allow the Polka View to stay mapped and visible to the user. That is, place a call to SendAlgoEvt in a while(1) loop at the end of your program, where the response to the AlgoEvt is simply a call to this routine. (Note that this routine is automatically called by Polka as it generates animation frames. There is no need to call it during normal execution.) The routine always returns 0.
 
 
 
int 
View::Animate(int start, int len)
This routine generates a set of animation frames, those starting with time= start and proceeding for len frames. In the particular animation scenes, you should have programmed AnimObjects to have certain desired behaviors during the frames being generated. This function is a convenience function for the following sequence of calls for each frame from start to start+len: EraseAll; UpdateAll; DrawAll; NextFrame. The routine returns the time subsequent to the animation action (i.e. , start + len).

Note that it is undefined what will happen if you try to animate at a time in the past, that is, prior to a time to which you have already animated. For example, if you call Animate(3,1) then call Animate(1,1), weird things may happen on the second call. Note that if an AnimObject has been programmed to change at time $i$, and then you animate to time $i-1$ and then skip to time $i+1$, no extra animation frames will be generated (there won't be an $i$th frame) but the changes to the object that should have occurred at time $i$ will be batched into the changes at the next subsequent frame, i.e., $i+1$ here.


nextuppreviouscontents
Next:Example DefinitionUp:Animation ViewsPrevious:Animation ViewsContents
Ha Hoai Phuong

2002-11-11