00001 package commandline.baseMeshGeneration.delaunaypackage;
00002 import java.awt.Canvas;
00003 import java.awt.Graphics;
00004 import java.awt.Insets;
00005
00006
00007
00008
00009 class TriangulationCanvas extends Canvas {
00010 Triangulation t;
00011 RealWindowGraphics rWG;
00012 boolean needToClear = false;
00013 boolean newPoints = false;
00014 TriangulationAlgorithm alg;
00015
00016 TriangulationCanvas(Triangulation t,
00017 RealWindow w,
00018 TriangulationAlgorithm alg) {
00019 this.t = t;
00020 rWG = new RealWindowGraphics(w);
00021 this.alg = alg;
00022 }
00023
00024 public Insets insets() {
00025 return new Insets(2,10,2,15);
00026 }
00027
00028 public void paint(Graphics g) {
00029 if (needToClear) {
00030 g.clearRect(0, 0,this.getWidth(), this.getHeight());
00031
00032 needToClear = false;
00033 }
00034 g.drawRect(0, 0, this.getWidth()-1, this.getHeight()-1);
00035 rWG.setGraphics(g);
00036 rWG.setViewport(getSize());
00037 alg.draw(rWG, t);
00038 }
00039
00040 public void update(Graphics g) {
00041 paint(g);
00042 }
00043 }