TridPOVUndoable Class Reference

#include <TridPOV.h>

Inheritance diagram for TridPOVUndoable:
TridUndoable< TridPOV > TridPOV

List of all members.

Public Member Functions

void PushIfChanged ()

Detailed Description

Definition at line 60 of file TridPOV.h.


Member Function Documentation

void TridPOVUndoable::PushIfChanged (  ) 

Definition at line 7 of file TridPOV.cxx.

Referenced by TridGLFrame::HandleButton(), TridGLFrame::HandleKey(), TridGLFrame::HandleMotion(), and TridFlatGLFrame::HandleMotion().

00008 {
00009   // Don't push unless more than one thing has changed.
00010   // Otherwise, just replace the current copy.
00011   
00012   // Push if there hasn't been an update.
00013   if(fStack.size()<2) Push();
00014 
00015   // Push if we're in the undo history.
00016   if(fIndex!=0) Push();
00017 
00018   // Count the number of things that changed as nchanged.
00019   // If anything changed this time but didn't change last time, push it anyway.
00020   
00021   int nchanged = 0;
00022   if(fx     != fStack[0].fx)    { nchanged++; if(fStack[0].fx     == fStack[1].fx     ) { Push(); return; } };
00023   if(fy     != fStack[0].fy)    { nchanged++; if(fStack[0].fy     == fStack[1].fy     ) { Push(); return; } };
00024   if(fz     != fStack[0].fz)    { nchanged++; if(fStack[0].fz     == fStack[1].fz     ) { Push(); return; } };
00025   if(fDist  != fStack[0].fDist) { nchanged++; if(fStack[0].fDist  == fStack[1].fDist  ) { Push(); return; } };
00026   if(fTheta != fStack[0].fTheta){ nchanged++; if(fStack[0].fTheta == fStack[1].fTheta ) { Push(); return; } };
00027   if(fPhi   != fStack[0].fPhi)  { nchanged++; if(fStack[0].fPhi   == fStack[1].fPhi   ) { Push(); return; } };
00028 
00029   // If more than one thing changed, push it (even if those things changed last time, too)
00030 
00031   if(nchanged > 1) {
00032     Push(); 
00033     return;
00034   }
00035 
00036   Change();
00037 }


The documentation for this class was generated from the following files:

Generated on 24 Jul 2018 for loon by  doxygen 1.6.1