00001 package ImageStuff; 00002 import ImageStuff.Properties.*; 00003 import ImageStuff.Topology.AbstractTesselation; 00004 import ImageStuff.Topology.ConnectieCriterium; 00005 import Norm.*; 00006 import NormalMeshAlgorithm.Configuration; 00007 import NormalMeshAlgorithm.DecoderChildPacket; 00008 import NormalMeshAlgorithm.SnijPixelStrategy; 00009 00010 import java.util.*; 00011 00018 public abstract class GeometricObject { 00019 00020 public final static GeometricObject DEFAULT_GEOM=new Triangle(null); // ipv null!! 00021 00022 private GeometricProperty geometricProperty; 00023 00024 protected HashSet<Loc> locs; 00025 private NormPakket normPakket; 00026 protected Configuration configuration; 00027 public GeometricObject(Configuration configuration) { 00028 this.configuration=configuration; 00029 locs=new HashSet<Loc>(); 00030 this.geometricProperty=DefaultGeometricProperty.getInstance(); 00031 } 00032 00033 00034 00035 public abstract float getArea(); 00041 public abstract int getAantalPunten(); 00042 public abstract float fundamentenwaardeOn(Loc loc); 00043 public abstract float getHoekInDomain(int index); 00044 public abstract GenericEdge getEdge(int i); 00045 public abstract boolean isATriangle(); 00046 public abstract boolean isAnEdge(); 00047 public abstract int getNbrOfEdges(); 00048 public abstract boolean hasChildren(); 00054 public abstract AbstractTesselation getBestEncoderTesselation(SnijPixelStrategy snijPixelStrategy,ConnectieCriterium connectieCriterium); 00055 public abstract AbstractTesselation getTesselation(SnijPixelStrategy snijPixelStrategy,String choise); 00056 00057 00062 public HashSet<Loc> getLocs(){ 00063 return this.locs; 00064 } 00065 00066 public boolean contains(Loc loc){ 00067 Iterator I=this.locs.iterator(); 00068 while(I.hasNext()){ 00069 Loc l=(Loc)(I.next()); 00070 if(l.isOn(loc)) return true; 00071 } 00072 return false; 00073 } 00074 00075 //protected abstract void VulOp(); 00076 public abstract void setChildren(ArrayList<GeometricObject> children); 00077 public abstract ArrayList<GeometricObject> getChildren(); 00078 00079 00080 public abstract float getFunctiewaardeOn(Loc l); 00081 00082 public abstract boolean hasToBeConsidered(); 00083 00089 public NormPakket getError(Image image){ 00090 if(this.normPakket!=null){return normPakket;} 00091 Iterator iter = this.getLocs().iterator(); 00092 Loc loc; 00093 NormenMaker normenmaker=new NormenMaker(); 00094 while(iter.hasNext()){ 00095 loc=(Loc)iter.next(); 00096 00097 if(image.getPuntOpEnty(loc).getZ()-this.getFunctiewaardeOn(loc)==Float.NaN){ 00098 Debug.print("functiewaarde = NAN"); 00099 Debug.print("image.functiewaarde ="+ image.getPuntOpEnty(loc).getZ()); 00100 Debug.print("this.functiewaarde = "+ this.getFunctiewaardeOn(loc)); 00101 00102 } 00103 normenmaker.add(image.getPuntOpEnty(loc).getZ()-this.getFunctiewaardeOn(loc)); 00104 } 00105 this.normPakket=normenmaker.getNormPakket(); 00106 return this.normPakket; 00107 } 00108 00109 public abstract Vertex getVertex(int i); 00110 00111 public abstract ArrayList<Vertex> getOrderedVertices(); 00112 00117 public void setGeometricProperty(GeometricProperty gp){ 00118 this.geometricProperty=gp; 00119 } 00120 00125 public GeometricProperty getGeometricProperty(){ 00126 return geometricProperty; 00127 } 00128 00129 00130 public ArrayList<GeometricObject> getAllLeaves(){ 00131 if(!this.hasChildren()){ 00132 ArrayList<GeometricObject> recurse=new ArrayList<GeometricObject>(1); 00133 recurse.add(this); 00134 return recurse; 00135 }else{ 00136 ArrayList<GeometricObject> recurse=new ArrayList<GeometricObject>(); 00137 for(GeometricObject go:getChildren()){ 00138 00139 /***begin test */ 00140 if(recurse.contains(this)){ 00141 Debug.print("faulty Type: is an edge = " + go.isAnEdge()); 00142 Object o=null; o.notify(); 00143 System.exit(-1); 00144 } 00145 00147 recurse.addAll(go.getAllLeaves()); // adding child and its leaves 00148 } 00149 return recurse; 00150 } 00151 } 00152 00153 00154 00155 }
1.5.5