00001 package commandline.baseMeshGeneration.delaunaypackage; 00002 /* 00003 * AnimateControl class. Each algorithm animation has various entities 00004 * which can be displayed. This class provides the state which controls 00005 * what is being displayed. It is manipulated by AlgorithmUI and 00006 * accessed by the animation routines in each algorithm. 00007 */ 00008 class AnimateControl { 00009 TriangulationAlgorithm triAlg; 00010 static final int automatic = 0; 00011 static final int manual = 1; 00012 int animateMode = automatic; 00013 int pause = 10; 00014 static final int algorithm = 0; 00015 static final int triangles = 1; 00016 static final int points = 2; 00017 static final int circles = 3; 00018 static final int nEntities = 4; 00019 boolean run; 00020 boolean animate[]; 00021 int nPoints; 00022 00023 AnimateControl(TriangulationAlgorithm algorithm) { 00024 triAlg = algorithm; 00025 animate = new boolean[nEntities]; 00026 for (int i = 0; i < nEntities; i++) 00027 animate[i] = true; 00028 run = true; 00029 } 00030 00031 AnimateControl(TriangulationAlgorithm algorithm, int nPoints) { 00032 this(algorithm); 00033 this.nPoints = nPoints; 00034 } 00035 00036 public void setAnimate(int entity, boolean v) { 00037 animate[entity] = v; 00038 if (!v) 00039 triAlg.canvas().needToClear = true; 00040 } 00041 00042 public boolean animate(int entity) { 00043 return animate[entity]; 00044 } 00045 00046 public int mode() { 00047 return animateMode; 00048 } 00049 00050 public void setManualAnimateMode() { 00051 animateMode = manual; 00052 } 00053 00054 public void setAutomaticAnimateMode() { 00055 animateMode = automatic; 00056 } 00057 00058 public int getPause() { 00059 return pause; 00060 } 00061 00062 public void setPause(int p) { 00063 pause = p; 00064 } 00065 00066 public int getNPoints() { 00067 return nPoints; 00068 } 00069 00070 public void setNPoints(int n) { 00071 nPoints = n; 00072 } 00073 00074 public void setRun(boolean v) { 00075 run = v; 00076 } 00077 00078 public boolean getRun() { 00079 return run; 00080 } 00081 }
1.5.5