Public Member Functions | Public Attributes

JPLimitsRestore Class Reference

Search for all occurrences

#include <interpik.h>

Inheritance diagram for JPLimitsRestore:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  JPLimitsRestore (JointParams *j)
void  Restore (int isUndo)
void  Redo ()
void  EndHold ()

Public Attributes

JointParams jp
float  umin [6]
float  umax [6]
float  uspring [6]
float  rmin [6]
float  rmax [6]
float  rspring [6]

Constructor & Destructor Documentation

JPLimitsRestore ( JointParams j ) [inline]
                                        {
            jp = j;
            for (int i=0; i<jp->dofs; i++) {
                umin[i]    = jp->min[i];
                umax[i]    = jp->max[i];
                uspring[i] = jp->spring[i];
                }
            }

Member Function Documentation

void Restore ( int  isUndo ) [inline, virtual]
Remarks:
The developer implements this method to restore the state of the database to as it was when theHold.Put() was called with this restore object.

Regardless of the value of the isUndo parameter, the method must restore the state of the scene to the one it was in when theHold.Put() was called with this restore object.

RestoreObj::Restore and RestoreObj::Redo may be called several times in a row: these methods must protect against any problems that may arise because of this, such as trying to undo multiple times in a row what has been undone already.
Parameters:
isUndo Nonzero if Restore() is being called in response to the Undo command; otherwise zero. If isUndo is nonzero, the developer needs to save whatever data they need to allow the user to redo the operation.

Implements RestoreObj.

                                 {
            if (isUndo) {
                for (int i=0; i<jp->dofs; i++) {
                    rmin[i]    = jp->min[i];
                    rmax[i]    = jp->max[i];
                    rspring[i] = jp->spring[i];
                    }
                }
            for (int i=0; i<jp->dofs; i++) {
                jp->min[i]    = umin[i];
                jp->max[i]    = umax[i];
                jp->spring[i] = uspring[i];
                }           
            }
void Redo ( ) [inline, virtual]
Remarks:
This method is called when the user selects the Redo command. The developer should restore the database to the state prior to the last Undo command.

Implements RestoreObj.

                    {
            for (int i=0; i<jp->dofs; i++) {
                jp->min[i]    = rmin[i];
                jp->max[i]    = rmax[i];
                jp->spring[i] = rspring[i];
                }           
            }
void EndHold ( ) [inline, virtual]
Remarks:
This method is called when theHold.Accept() or theHold.Cancel() is called. This means the restore object is no longer held, it was either tossed out or sent to the undo system. The developer may then call ClearAFlag(A_HELD) to indicate the restore object is no longer being held.

Reimplemented from RestoreObj.

                       {
            jp->flags &= ~JP_HELD;
            }

Member Data Documentation

float umin[6]
float umax[6]
float uspring[6]
float rmin[6]
float rmax[6]
float rspring[6]

JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore
JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore JPLimitsRestore