00001 package commandline.NormalMeshAlgorithm; 00002 00003 import java.io.IOException; 00004 00005 import commandline.Encoder.EncoderTypeSelector; 00006 import commandline.Encoder.Iterators.MeshIteratorSelector; 00007 import commandline.ImageStuff.Topology.ConnectionCriteriumSelector; 00008 import commandline.binToFilePackage.MyDataInPutStream; 00009 import commandline.debuggingCode.Debug; 00010 00011 public class ConfigurationReader { 00012 00013 private MyDataInPutStream dataInputStream; 00014 int COMPRESSIONTYPE, ITERATORTYPE, CONNECTION_CRITERIUMTYPE, 00015 MAXRICO, SNIJPIXLESTRATEGYTYPE,WHICH_NORM_TO_USE_FOR_NEXT_REFINEMENT,WHICH_NORM_TO_USE_FOR_NEXT_TESSELATION; 00016 boolean MAKEBASEMESH; 00017 public ConfigurationReader(MyDataInPutStream inputStream) { 00018 super(); 00019 this.dataInputStream=inputStream; 00020 COMPRESSIONTYPE=-1; 00021 ITERATORTYPE=-1; 00022 CONNECTION_CRITERIUMTYPE=-1; 00023 MAKEBASEMESH=false; 00024 MAXRICO=-1; 00025 SNIJPIXLESTRATEGYTYPE=-1; 00026 WHICH_NORM_TO_USE_FOR_NEXT_REFINEMENT=-1; 00027 WHICH_NORM_TO_USE_FOR_NEXT_TESSELATION=-1; 00028 } 00029 00030 00035 public void read(){ 00036 COMPRESSIONTYPE=dataInputStream.readMyInt(); 00037 if (Debug.VERBOSE) 00038 Debug.print("reading compression type ("+ COMPRESSIONTYPE +" [ " +EncoderTypeSelector.getNameForCompressionType(COMPRESSIONTYPE) +" ]"+") to outputstream"); 00039 00040 00041 ITERATORTYPE= dataInputStream.readMyInt(); 00042 if (Debug.VERBOSE) 00043 Debug.print("reading compression type ("+ ITERATORTYPE +"["+MeshIteratorSelector.getNameForMeshIteratorType(ITERATORTYPE) +"]"+") to outputstream"); 00044 00045 00046 CONNECTION_CRITERIUMTYPE = dataInputStream.readMyInt(); 00047 if (Debug.VERBOSE) 00048 System.out 00049 .println("reading connectieCriterium ("+ CONNECTION_CRITERIUMTYPE +"["+ConnectionCriteriumSelector.getNameForConnectionCriteriumType(CONNECTION_CRITERIUMTYPE) +"]) to outputstream"); 00050 00051 00052 try { 00053 MAKEBASEMESH= dataInputStream.readBoolean(); 00054 } catch (IOException e) { 00055 // TODO Auto-generated catch block 00056 e.printStackTrace(); 00057 } 00058 if (Debug.VERBOSE) 00059 Debug.print("reading MAKEBASEMESH ("+ MAKEBASEMESH +") to outputstream"); 00060 00061 00062 MAXRICO = dataInputStream.readMyInt(); 00063 if (Debug.VERBOSE) 00064 Debug.print("reading MAXRICO ("+ MAXRICO +") to outputstream"); 00065 00066 00067 SNIJPIXLESTRATEGYTYPE= dataInputStream.readMyInt(); 00068 if (Debug.VERBOSE) 00069 System.out 00070 .println("reading SNIJPIXLESTRATEGYTYPE ("+ SNIJPIXLESTRATEGYTYPE +") to outputstream"); 00071 00072 00073 WHICH_NORM_TO_USE_FOR_NEXT_REFINEMENT= dataInputStream.readMyInt(); 00074 if (Debug.VERBOSE) 00075 System.out 00076 .println("reading WHICH_NORM_TO_USE_FOR_NEXT_REFINEMENT ("+ WHICH_NORM_TO_USE_FOR_NEXT_REFINEMENT +") to outputstream"); 00077 00078 00079 WHICH_NORM_TO_USE_FOR_NEXT_TESSELATION= dataInputStream.readMyInt(); 00080 if (Debug.VERBOSE) 00081 System.out 00082 .println("reading WHICH_NORM_TO_USE_FOR_NEXT_TESSELATION ("+ WHICH_NORM_TO_USE_FOR_NEXT_TESSELATION +") to outputstream"); 00083 00084 00085 } 00086 00087 public Configuration makeConfiguration(){ 00088 Configuration configuration=new Configuration(); 00089 configuration.setCompressionType(COMPRESSIONTYPE); 00090 00091 configuration.setIteratorType(ITERATORTYPE); 00092 configuration.setMakeBaseMesh(MAKEBASEMESH); 00093 configuration.setMaxRico(MAXRICO); 00094 configuration.setSnijPixelStrategyTYPE(SNIJPIXLESTRATEGYTYPE); 00095 configuration.setWhichNormToUseForNextRefinement(WHICH_NORM_TO_USE_FOR_NEXT_REFINEMENT); 00096 configuration.setWhichNormToUseForTesselation(WHICH_NORM_TO_USE_FOR_NEXT_TESSELATION); 00097 configuration.setConnectionCriterium(ConnectionCriteriumSelector.createCriterium(CONNECTION_CRITERIUMTYPE,WHICH_NORM_TO_USE_FOR_NEXT_TESSELATION)); 00098 return configuration; 00099 } 00100 00101 }
1.5.5