Search in sources :

Example 1 with TREFileReader

use of uk.me.parabola.imgfmt.app.trergn.TREFileReader in project mkgmap by openstreetmap.

the class StructureTest method init.

/**
 * Read in the file and open all the sections, leave references to them
 * in fields so that the other tests can check things.
 */
@BeforeClass
public static void init() throws FileNotFoundException {
    TestUtils.deleteOutputFiles();
    Main.mainNoSystemExit(Args.TEST_STYLE_ARG, Args.TEST_RESOURCE_OSM + "uk-test-1.osm.gz");
    fs = ImgFS.openFs(Args.DEF_MAP_FILENAME);
    ImgChannel tre = fs.open(Args.DEF_MAP_ID + ".TRE", "r");
    treFile = new TREFileReader(tre);
    ImgChannel lbl = fs.open(Args.DEF_MAP_ID + ".LBL", "r");
    lblFile = new LBLFileReader(lbl);
    ImgChannel rgn = fs.open(Args.DEF_MAP_ID + ".RGN", "r");
    rgnFile = new RGNFileReader(rgn);
}
Also used : ImgChannel(uk.me.parabola.imgfmt.fs.ImgChannel) TREFileReader(uk.me.parabola.imgfmt.app.trergn.TREFileReader) RGNFileReader(uk.me.parabola.imgfmt.app.trergn.RGNFileReader) LBLFileReader(uk.me.parabola.imgfmt.app.lbl.LBLFileReader) BeforeClass(org.junit.BeforeClass)

Example 2 with TREFileReader

use of uk.me.parabola.imgfmt.app.trergn.TREFileReader in project mkgmap by openstreetmap.

the class ArgsTest method testDisplayPriority.

@Test
public void testDisplayPriority() throws FileNotFoundException {
    TestUtils.registerFile("osmmap.img");
    int pri = 42;
    Outputs op = TestUtils.run("--draw-priority=" + pri, Args.TEST_RESOURCE_OSM + "uk-test-1.osm.gz");
    op.checkNoError();
    FileSystem fs = openFs(Args.DEF_MAP_FILENAME);
    ImgChannel chan = fs.open(Args.DEF_MAP_ID + ".TRE", "r");
    TREFileReader treFile = new TREFileReader(chan);
    assertEquals("display priority", pri, ((TREHeader) treFile.getHeader()).getDisplayPriority());
}
Also used : ImgChannel(uk.me.parabola.imgfmt.fs.ImgChannel) FileSystem(uk.me.parabola.imgfmt.fs.FileSystem) Outputs(func.lib.Outputs) TREFileReader(uk.me.parabola.imgfmt.app.trergn.TREFileReader) Test(org.junit.Test)

Example 3 with TREFileReader

use of uk.me.parabola.imgfmt.app.trergn.TREFileReader in project mkgmap by openstreetmap.

the class FileInfo method treInfo.

/**
 * Obtain the information that we need from the TRE section.
 * @param imgFs The filesystem
 * @param ent The filename within the filesystem of the TRE file.
 * @param info This is where the information will be saved.
 * @throws FileNotFoundException If the file is not found in the filesystem.
 */
private static void treInfo(FileSystem imgFs, DirectoryEntry ent, FileInfo info) throws FileNotFoundException {
    try (ImgChannel treChan = imgFs.open(ent.getFullName(), "r");
        TREFileReader treFile = new TREFileReader(treChan)) {
        info.setBounds(treFile.getBounds());
        info.setLicenceInfo(treFile.getMapInfo(info.getCodePage()));
        info.setHexname(((TREHeader) treFile.getHeader()).getMapId());
    } catch (FileNotFoundException e) {
        throw e;
    } catch (IOException e) {
        throw new FileNotFoundException();
    }
}
Also used : FileImgChannel(uk.me.parabola.imgfmt.sys.FileImgChannel) ImgChannel(uk.me.parabola.imgfmt.fs.ImgChannel) TREFileReader(uk.me.parabola.imgfmt.app.trergn.TREFileReader) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException)

Aggregations

TREFileReader (uk.me.parabola.imgfmt.app.trergn.TREFileReader)3 ImgChannel (uk.me.parabola.imgfmt.fs.ImgChannel)3 Outputs (func.lib.Outputs)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1 LBLFileReader (uk.me.parabola.imgfmt.app.lbl.LBLFileReader)1 RGNFileReader (uk.me.parabola.imgfmt.app.trergn.RGNFileReader)1 FileSystem (uk.me.parabola.imgfmt.fs.FileSystem)1 FileImgChannel (uk.me.parabola.imgfmt.sys.FileImgChannel)1