00001 package ImageStuff.Topology; 00002 00003 import java.beans.Encoder; 00004 import java.util.ArrayList; 00005 import java.util.HashSet; 00006 00007 00008 00009 import debuggingCode.Debug; 00010 00011 import CodingUtils.CodedFile; 00012 import CodingUtils.CommitDataStructure; 00013 import CodingUtils.DataStructure; 00014 import Encoder.Children_OffsetsCompoud; 00015 import Encoder.EncoderEdge; 00016 import ImageStuff.GenericEdge; 00017 import ImageStuff.GeometricObject; 00018 import ImageStuff.Image; 00019 import ImageStuff.Triangle; 00020 import NormalMeshAlgorithm.ChildMaker; 00021 import NormalMeshAlgorithm.Configuration; 00022 import NormalMeshAlgorithm.Generic_Children_Offset_Compound; 00023 00024 public abstract class EdgeTesselation extends AbstractTesselation { 00025 00026 protected GenericEdge e; 00027 protected Generic_Children_Offset_Compound children_OffsetsCompoud_edge; 00028 public EdgeTesselation(GenericEdge e, ChildMaker childMaker,Configuration configuration) { 00029 super(childMaker,configuration); 00030 this.e=e; 00031 makeTesselation(); 00032 } 00033 00034 @Override 00035 protected void makeTesselation() { 00036 builtChildren(); 00037 if(Debug.DEBUG && Debug.DEBUG_COMMIT_EDGE_TESSELATION) Debug.print("makeTesselation() "); 00038 } 00039 00040 00041 00042 00043 00044 public void commit(DataStructure dataStructure) { 00045 CodedFile tesselationFile=dataStructure.getTesselationFile(); 00046 // --> nothing to store!! tesselationFile.storeTesselation(getTesselationCode()); 00047 // saving one normal and vertical offset 00048 try{ //try if the offsetcompound is related to an EncoderEdge 00049 Children_OffsetsCompoud children_OffsetsCompoud= (Children_OffsetsCompoud) children_OffsetsCompoud_edge; 00050 if(!this.e.hasChildren()){ // indien zij nog geen kinderen zou hebben 00051 dataStructure.storeParent(e); 00052 } 00053 } 00054 catch(ClassCastException castException){ 00055 Debug.print("ClassCastException"); 00056 } 00057 commitOnlyDecodingStuff(dataStructure); // methode van superklasse oproepen 00058 00059 if(Debug.DEBUG && Debug.DEBUG_COMMIT_EDGE_TESSELATION) Debug.print("commit() "); 00060 } 00061 00062 public void commitOnlyDecodingStuff(CommitDataStructure dataStructure) { 00063 e.commit(dataStructure); 00064 if(e==children_OffsetsCompoud_edge.getBeginEdge() || e==children_OffsetsCompoud_edge.getEindEdge()){ 00065 Object o=null; o.notify(); 00066 Debug.print("System exit @ commitOnlyDecodingStuff"); 00067 System.exit(-1); 00068 } 00069 00070 e.setOffsets(children_OffsetsCompoud_edge.getNormalOffset(),children_OffsetsCompoud_edge.getVertikalOffset()); 00071 e.setChildren(children_OffsetsCompoud_edge.getBeginEdge(),children_OffsetsCompoud_edge.getEindEdge()); 00072 00073 } 00074 00075 00076 @Override 00077 protected void makeInnerEdgesAndTriangles() { 00078 // TODO Auto-generated method stub 00079 if(Debug.DEBUG && Debug.DEBUG_COMMIT_EDGE_TESSELATION) Debug.print("makeInnerEdgesAndTriangles() "); 00080 } 00081 00082 00083 00084 @Override 00085 public ArrayList<GeometricObject> getParts() { 00086 Debug.print("getParts() "); 00087 ArrayList<GeometricObject> parts=new ArrayList<GeometricObject>(2); 00088 parts.add(children_OffsetsCompoud_edge.getBeginEdge()); 00089 parts.add(children_OffsetsCompoud_edge.getEindEdge()); 00090 return parts; 00091 } 00092 00093 @Override 00094 protected void link() { 00095 // koppelen van childedges met hun driehoeken ?? 00096 if(Debug.DEBUG && Debug.DEBUG_COMMIT_EDGE_TESSELATION) Debug.print("link() "); 00097 00098 } 00099 00100 00104 public String getTesselationCode() { 00105 if(Debug.DEBUG && Debug.DEBUG_COMMIT_EDGE_TESSELATION) Debug.print("getTesselationCode() "); 00106 return ""; 00107 } 00108 00109 00113 public HashSet getAllLocs() { 00114 if(Debug.DEBUG && Debug.DEBUG_COMMIT_EDGE_TESSELATION) Debug.print("getAllLocs() "); 00115 return this.e.getLocs(); 00116 } 00117 00118 00122 public int getNbrOfGeometricObjects() { 00123 if(Debug.DEBUG && Debug.DEBUG_COMMIT_EDGE_TESSELATION) Debug.print("getNbrOfGeometricObjects() "); 00124 return 2; 00125 } 00126 00130 public float error(int WHICHNORM) { 00131 // TODO Auto-generated method stub 00132 Debug.print("error() "); 00133 EncoderEdge encoderEdge; 00134 try{encoderEdge=(EncoderEdge)e; 00135 }catch(ClassCastException castException){ 00136 if(!Debug.DISTIBUTION) Debug.print(castException.getMessage()); 00137 } 00138 return this.e.getError(Image.getInstance()).getNorm(WHICHNORM); 00139 } 00140 00141 }
1.5.5