- NEXT_FORWARD
- Movie in forward direction. Step is added, if the Z coordinate is larger than maximum then display minimum, increment again until maximum, etc. This is the default.
- NEXT_BACKWARD
- Movie in backward direction. Step is subtracted, if Z coordinate is smaller than mimnimum then display maximum, decrement until minimum, etc etc
- NEXT_ROCKANDROLL
- Movie goes up and down the sequence. Step is added until the Z coordinate is larger than maximum, then step is subtracted until the Z coordinate is smaller than minimum, then step is added, and so on, and so on
- MATCH_INDEX
- Sequence is defined by writing Attribute "zIndex" with the value of the Z coordinate to WorldCanvasHolders, plus the ones from the List of AttributeBuffers. This is the default
- MATCH_WORLD
- Sequence is defined by writing Attribute "zValue"with the value of the Z coordinate to WorldCanvasHolders, plus the ones from the List of AttributeBuffers
- MATCH_LIST_ONLY
- Only the Attributes from the List of AttributeBuffers are written
- UPDATE_DIRECT
- Do change the Z coordinate before each update. Use this for 'normal movies'. This is the default.
- UPDATE_BLINK
- Do not change Z coordinate, but rely on the AttributeBuffers to change what is displayed. Use this for blinking.
First example is making a simple movie of all the channels in a data cube
// Create a PixelCanvas for X11 to draw on X11PixelCanvas(parent, xpcctbl, width, height) ; // and a World Coordinate interface for this PixelCanvas WorldCanvas wCnvs(&pixelCnvs); // Create a WorldCanvasHolder WorldCanvasHolder wCnvsHldr(&wCnvs); // Create an ImageDisplayData object of the data cube to display the // channels (assuming 3rd axis is velocity in this cube) ImageDisplayData cube(myDataSet, 0, 1, 2); // and register this with the WorldCanvasHolder wCnvsHldr.addDisplayData(&cube); // Create an Animator for the WorldCanvasHolder and register the // WorldCanvasHolder Animator animator; animator.addWorldCanvasHolder(&wCnvsHldr); // start with first channel animator.setMin(0.0); // last channel of cube (assuming it has 30 channels) animator.setMax(29.0); // go in steps of one channel animator.setStep(1.0); // only one channel at a time, so tolerance must be less than 1.0 anomator.setTolerance(0.1); // display new channel every 0.2 sec animator.setUpdateInterval(0.2); // we want a normal boring movie animator.setNextMode(animator::NEXT_FORWARD); // and we define the channel (ie index) animator.setMatchMode(Animator::MATCH_INDEX); // set the Update method animator.setUpdateMode(Animator::UPDATE_DIRECT); // and start the movie animator.startMovie(); . . . // After a while we want to change to Rock & Roll mode: animator.setMovieMode(Animator::NEXT_ROCKandROLL); . . . // and after another while we stop animator.stopMovie();Second example is that we want to blink between channel 20 of the previous cube and an optical image
// Create an ImageDataDisplay of the image and register with // the WorldCanvasHolder ImageDataDisplay image(myImage, 0, 2); wCnvsHldr.addDisplayData(&image); // Create a List to contain the AttributeBuffers List<void *> buffList; // and an iterator for this list ListIter<void *> it(&buffList); // Create AttributeBuffers and fill them AttributeBuffer atBuff1; // This is to mark the cube. The name and value of the Attribute or // Attributes that can be used is arbitrary, as long as the different // AttributeBuffers in the List select different datasets (even that is // not really necessary, but you will be blinking between the same frames // and not many people will get excited about that....) atBuff1.add("AjaxWordtKampioen", "yes"); it.addRight((void *) &attBuff1); // the buffer for the image AttributeBuffer atBuff2; atBuff2.add("AjaxWordtKampioen", "of course"); at.addRight((void *) &attBuff2); // and set this list on the Animator animator.setBlinkList(&buffList); // Set the same attributes on the DisplayDatas so the Attribute matching // mechanism between the WorldCanvasHolder and the DisplayDatas will select // the right data at the right time automatically cube.addAttribute(attBuff1); image.addAttribute(attBuff2); // Tell animator to use channel 20 animator.gotoCoord(20.0); // The Animator should write "zIndex" to select channel 20 animator.setMatchMode(Animator::MATCH_INDEX); // Because we set the UpdateMode to UPDATE_BLINK, the zIndex does // not change each time the timer goes off. animator.setUpdateMode(Animator::UPDATE_BLINK); // and the blinking can start: animator.startMovie(); . . . // After a while we want to blink between channel 19 and the optical image. // this is done by setting NextMode to NEXT_BACKWARD and invoke nextCoord(). // Of course we could also have used only animator.prevCoord(), but just // to show the principle... animator.setNextMode(Animator::NEXT_BACKWARD); animator.nextCoord(); // We can add a third data set, set "AjaxWordtKampioen" to "always" for that data, // and the blinking is between 3 datasets: // stop the blinking animator.stopMovie(); // Create DisplayData from data ImageDataDisplay image2(mySecondImage, 0, 2); // Add to WorldCanvasHolder wCnvsHldr.addDisplayData(&image2); //Setup AttributeBuffer AttributeBuffer atBuff3; atBuff3.add("AjaxWordtKampioen", "always"); // add to data image2.addAttribute(attBuff3); // and add to List at.addRight((void *) &attBuff3); // set the updated list on the animator (strictly speaking not neseccary // here, because animator already has the address of this List, but...) animator.setBlinkList(&buffList); //and go!!! animator.startMovie();The third example is to run movies, selected on world coordinates on two WorldCanvasHolders in synch:
// Create a PixelCanvas for X11 to draw on X11PixelCanvas(parent, xpcctbl, width, height) ; // and two WorldCanvases side by side on the same PixelCanvas WorldCanvas wCnvs1(&pixelCanvas, 0.0, 0.25, 0.5, 0.5); WorldCanvas wCnvs2(&pixelCanvas, 0.5, 0.25, 0.5, 0.5); // A WorldCanvasHolder for each WorldCanvas WorldCanvasHolder wCnvsHldr1(&wCnvs1); WorldCanvasHolder wCnvsHldr2(&wCnvs2); // We have an HI data cube of an object ImageDisplayData HIcube(HIdata, 0, 1, 2); // that we display on the first WorldCanvas wCnvsHldr1.addDisplayData(HIcube); // and we have a CO cube of the same object that we display on the second // WorldCanvas ImageDisplayData COcube(COdata, 0, 1, 2); wCnvsHldr2.addDisplayData(COcube); // Create an animator and register the two WorldCanvasHolders Animator animator; animator.addWorldCanvasHolder(wCnvsHldr1); animator.addWorldCanvasHolder(wCnvsHldr2); // Set the movie parameters: // Select on world coordinate (ie velocity) animator.setMatchMode(Animator::MATCH_WORLD); // start and end velocities animator.setMinAndMax(1200.0, 1400.0); // and the tolerance to 10.0 and the step to 20.0 animator.setTolerance(10.0): animator.setStep(20.0); // Set speed of movies and the mode animator.setUpdateInterval(0.2); animator.setNextMode(Animator::ROCKandROLL); // Now, on the first canvas a movie will be played of the HI data, and on // the second canvas a movie of the CO data. Because the selection is done // on world coordinate, the two movies display the data of the same // velocity (within the tolerance of 10.0), in steps of 20.0, synchronized, // regardless of the channel separation of the two datasets: animator.startMovie();
Constructor
Destrutor
Go to next Z coordinate in sequence
Go to previous Z coordinate in sequence
Go to Z coordinate zCoord
Set increment in the Z coordinate for the movie
Set the tolerance in the Z coordinate
Set the minimum and maximum Z coordinate for the movie
Set whether "zIndex", "zValue" or none of the two should be written additionally to the AttributeBuffers.
Set the way the increments are done, ie. it defines the action of nextCoord() (options NEXT_FORWARD, NEXT_BACKWARD, UPDATE_ROCKANDROLL)
Set whether an increment should be done before each update (UPDATE_DIRECT or UPDATE_BLINK)
Set update interval of movie in milliseconds
Set the list of additional Attributes that the Animator places on the WorldCanvasHolders before each update.
Remove the List with AttributeBuffers
Stop and start movie
Return the length of the movie. In UpdateMode UPDATE_DIRECT this is the number of frames that follow from the minimum and maximum Z coordiante and the step. In UPDATE_BLINK mode this is the length of the List of AttributeBuffers set on the Animator using setBlinkAttributes
Return the current position in the movie. This is really a bad thing, but needed in the interim for the viewer.
Reset the Animator. This will set the minimum coordiante to 0, the maximum to the number of elements registered with the WorldCanvasHolders, the step to 1.0 and the update mode to MATCH_INDEX
Add a WorldCanvasHolder to the list controlled by this Animator
Remove a WorldCanvasHolder from the list controlled by this Animator
Refresh event handler - just used to see if resetCoordinates was set. If so, then we should partially reset the animator.
Compute, based on the UPDATE_MODE and NEXT_MODE, the Z coordinate of the new frame to display (ie. the new currentCoord). If the updateMode == UPDATE_BLINK, nothing happens. If the updateMode == UPDATE_DIRECT, the value of currentCoord is incremented or decremented with the absolute value of movieStep, depending in whether the next_Mode is NEXT_FORWARD, NEXT_BACKWARD or NEXT_ROCKANDROLL and whether the new value goes outside the bounds set by minCoord and maxCoord.
Helper routine for computeNewCoord(). If addOrSubtract > 0, 1 is added to number, if addOrSubtract < 0, 1 is subtracted
Helper routine for computeNewCoord(). The inverse of increment(Int&, Int)
Helper routine for computeNewCoord(). If addOrSubtract > 0, movieStep is added to number, if addOrSubtract < 0, movieStep is subtracted
Helper routine for computeNewCoord(). The inverse of increment(Double&, Int)
Write the necessary Attributes to all the WorldCanvasHolders. The content of one of the registered AttributeBuffer is always written. If the updateMode == UPDATE_DIRECT the n-th AttributeBuffer is written, where n is the sequence number of the frame, based on minCoord and movieStep. If the updateMode == UPDATE_BLINK the Animator just loops through the list of AttributeBuffers based on numberInList. If MatchMode == MATCH_INDEX also an Attribute is written with name "zIndex" and with the value of currentCoord. If MatchMode == MATCH_COORD also an Attribute is written with name "zValue" and with the value of currentCoord.
Invoke refresh() on all the WorldCanvasHolders registered with the Animator
Return the number of AttributeBuffers in the List of AttributeBuffer