Search in sources :

Example 11 with ImgFileWriter

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

the class SRTFile method write.

/**
 * Write out the file.
 * This file has an unusual layout. There are several header like structures within
 * the main body of the file, with the real header being very small.
 */
public void write() {
    ImgFileWriter writer = getWriter();
    writeDescription(writer);
    // Position at the start of the writable area.
    position(header.getHeaderLength());
    SectionWriter subWriter = header.makeSectionWriter(writer);
    int header3Len = sort.getHeader3Len();
    if (header3Len == 0)
        header3Len = sort.isMulti() ? SRTHeader.HEADER3_MULTI_LEN : SRTHeader.HEADER3_LEN;
    subWriter.position(header3Len);
    writeSrt4Chars(subWriter);
    writeSrt5Expansions(subWriter);
    if (sort.isMulti()) {
        for (int i = 0; i <= sort.getMaxPage(); i++) srt8Starts.add(-1);
        writeSrt8(subWriter);
        writeSrt7(subWriter);
    }
    subWriter.close();
    // Header 2 is just after the real header
    writer.position(header.getHeaderLength());
    header.writeHeader2(writer);
    // Header 3 is after the description
    writer.position(header.getHeaderLength() + description.length() + 1 + SRTHeader.HEADER2_LEN);
    header.writeHeader3(writer);
    header.writeHeader(writer);
}
Also used : SectionWriter(uk.me.parabola.imgfmt.app.SectionWriter) ImgFileWriter(uk.me.parabola.imgfmt.app.ImgFileWriter) BufferedImgFileWriter(uk.me.parabola.imgfmt.app.BufferedImgFileWriter)

Example 12 with ImgFileWriter

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

the class TYPFile method write.

public void write() {
    ImgFileWriter writer = getWriter();
    writer.position(TYPHeader.HEADER_LEN);
    writeSection(writer, header.getPolygonData(), header.getPolygonIndex(), data.getPolygons());
    writeSection(writer, header.getLineData(), header.getLineIndex(), data.getLines());
    writeSection(writer, header.getPointData(), header.getPointIndex(), data.getPoints());
    SectionWriter subWriter = header.getShapeStacking().makeSectionWriter(writer);
    data.getStacking().write(subWriter);
    Utils.closeFile(subWriter);
    writeSection(writer, header.getIconData(), header.getIconIndex(), data.getIcons());
    writeLabels(writer);
    writeStrIndex(writer);
    writerTypeIndex(writer);
    zapZero(header.getShapeStacking(), header.getLabels(), header.getStringIndex(), header.getTypeIndex());
    log.debug("syncing TYP file");
    position(0);
    getHeader().writeHeader(getWriter());
}
Also used : SectionWriter(uk.me.parabola.imgfmt.app.SectionWriter) BufferedImgFileWriter(uk.me.parabola.imgfmt.app.BufferedImgFileWriter) ImgFileWriter(uk.me.parabola.imgfmt.app.ImgFileWriter)

Example 13 with ImgFileWriter

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

the class TypTextReaderTest method testLineTwoColours.

@Test
public void testLineTwoColours() {
    TypTextReader tr = makeTyp("[_line]\n" + "Type=0x00\n" + "UseOrientation=Y\n" + "LineWidth=2\n" + "BorderWidth=1\n" + "Xpm=\"0 0 2 0\"\n" + "\"1 c #DDDDDD\"\n" + "\"2 c #999999\"\n" + "String1=0x04,Road\n" + "String2=0x01,Route non-définie\n" + "String3=0x03,Weg\n" + "ExtendedLabels=Y\n" + "FontStyle=SmallFont\n" + "CustomColor=No\n" + "[end]");
    TypData data = tr.getData();
    TypLine line = data.getLines().get(0);
    ImgFileWriter w = new ArrayImgWriter();
    line.write(w, data.getEncoder());
}
Also used : TypData(uk.me.parabola.imgfmt.app.typ.TypData) TypLine(uk.me.parabola.imgfmt.app.typ.TypLine) ArrayImgWriter(func.lib.ArrayImgWriter) ImgFileWriter(uk.me.parabola.imgfmt.app.ImgFileWriter) Test(org.junit.Test)

Aggregations

ImgFileWriter (uk.me.parabola.imgfmt.app.ImgFileWriter)13 BufferedImgFileWriter (uk.me.parabola.imgfmt.app.BufferedImgFileWriter)11 SectionWriter (uk.me.parabola.imgfmt.app.SectionWriter)7 Section (uk.me.parabola.imgfmt.app.Section)2 ArrayImgWriter (func.lib.ArrayImgWriter)1 Test (org.junit.Test)1 FileBackedImgFileWriter (uk.me.parabola.imgfmt.app.FileBackedImgFileWriter)1 Label (uk.me.parabola.imgfmt.app.Label)1 TypData (uk.me.parabola.imgfmt.app.typ.TypData)1 TypLine (uk.me.parabola.imgfmt.app.typ.TypLine)1