Header { public EnviMapInfo getMapInfo() { String mapInfoString = headerParser.getString(EnviConstants.HEADER_KEY_MAP_INFO, null); if (mapInfoString != null) { return parseMapInfo(mapInfoString); } return null; } Header(final BufferedReader reader); ByteOrder getJavaByteOrder(); String getFileType(); int getNumSamples(); int getNumLines(); int getNumBands(); int getHeaderOffset(); int getDataType(); String getInterleave(); String getSensorType(); int getByteOrder(); EnviMapInfo getMapInfo(); EnviProjectionInfo getProjectionInfo(); String[] getBandNames(); String getDescription(); BeamProperties getBeamProperties(); String[] getWavelengths(); String[] getFWHM(); String getWavelengthsUnit(); double[] getDataOffsetValues(); double[] getDataGainValues(); Double getDataIgnoreValue(); int getNumClasses(); String[] getClassNmaes(); int[] getClassColorRGB(); static Properties loadProperties(String text); MetadataElement getAsMetadata();  }
@Test public void testParseMapInfo_UTM() throws IOException { final String mapInfoLine = "map info = {UTM, 1.000, 1.000, 691415.705, 5974743.844, 9.3500000000e+01, 9.3500000000e+01, 32, North, WGS-84, units=Meters, rotation=-86.00000000}"; final BufferedReader in = createReader(createMandatoryHeader() + mapInfoLine); final Header header = new Header(in); final EnviMapInfo mapInfo = header.getMapInfo(); assertEquals("UTM", mapInfo.getProjectionName()); assertEquals(1.0, mapInfo.getReferencePixelX(), 1e-8); assertEquals(1.0, mapInfo.getReferencePixelY(), 1e-8); assertEquals(691415.705, mapInfo.getEasting(), 1e-8); assertEquals(5974743.844, mapInfo.getNorthing(), 1e-8); assertEquals(9.3500000000e+01, mapInfo.getPixelSizeX(), 1e-8); assertEquals(9.3500000000e+01, mapInfo.getPixelSizeY(), 1e-8); assertEquals(32, mapInfo.getUtmZone()); assertEquals("North", mapInfo.getUtmHemisphere()); assertEquals("WGS-84", mapInfo.getDatum()); assertEquals("Meters", mapInfo.getUnit()); assertEquals(-86.0, mapInfo.getOrientation(), 1E-5); }
@Test public void testParseMapInfo_multipleLines() throws IOException { final String lines = "map info = {testName, 1.0000, 2.0000,\n 3.0, 4.0, 5.0, 6.0, \nWGS-62, units=micrometer}"; final BufferedReader in = createReader(createMandatoryHeader() + lines); final Header header = new Header(in); final EnviMapInfo mapInfo = header.getMapInfo(); assertEquals("testName", mapInfo.getProjectionName()); assertEquals(1.0, mapInfo.getReferencePixelX(), 1e-8); assertEquals(2.0, mapInfo.getReferencePixelY(), 1e-8); assertEquals(3.0, mapInfo.getEasting(), 1e-8); assertEquals(4.0, mapInfo.getNorthing(), 1e-8); assertEquals(5.0, mapInfo.getPixelSizeX(), 1e-8); assertEquals(6.0, mapInfo.getPixelSizeY(), 1e-8); assertEquals("WGS-62", mapInfo.getDatum()); assertEquals("micrometer", mapInfo.getUnit()); }