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);
}
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());
}
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());
}
Aggregations