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