Search in sources :

Example 6 with TypData

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

the class TypTextReaderTest method testPolygon.

@Test
public void testPolygon() {
    tr = makeTyp("[_polygon]\n" + "Type=0x2\n" + "String1=0x04,Parking\n" + "String2=0x03,Parkeergarage\n" + "Xpm=\"0 0 2 0\"\n" + "\"1 c #7BCAD5\"\n" + "\"2 c #00008B\"\n" + "[End]\n");
    TypData data = tr.getData();
    List<TypPolygon> polygons = data.getPolygons();
    TypPolygon p = polygons.get(0);
    assertEquals(2, p.getType());
}
Also used : TypPolygon(uk.me.parabola.imgfmt.app.typ.TypPolygon) TypData(uk.me.parabola.imgfmt.app.typ.TypData) Test(org.junit.Test)

Example 7 with TypData

use of uk.me.parabola.imgfmt.app.typ.TypData 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)

Example 8 with TypData

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

the class TypTextReaderTest method testPointWithAlpha.

@Test
public void testPointWithAlpha() {
    TestUtils.registerFile("hello");
    TypTextReader tr = makeTyp("[_point]\n" + "Type=0x12\n" + "SubType=0x01\n" + ";23E6\n" + ";size: 45\n" + "String1=0x4,Mini round\n" + "String2=0x1,Mini rond-point\n" + "ExtendedLabels=N\n" + "DayXpm=\"9 9 10 1\"\n" + "\"$  c none\"\n" + "\"%  c #808080\"  alpha=14\n" + "\"&  c #808080\"\n" + "\"'  c #808080\"  alpha=15\n" + "\"(  c #808080\"  alpha=8\n" + "\")  c #F0F7FF\"\n" + "\"*  c #808080\"  alpha=4\n" + "\"+  c #808080\"  alpha=11\n" + "\",  c #808080\"  alpha=12\n" + "\"-  c #808080\"  alpha=13\n" + "\"$%&&&&&'$\"\n" + "\"(&&&)&&&*\"\n" + "\"&&)))))&&\"\n" + "\"&&)&&&)&&\"\n" + "\"&))&)&))&\"\n" + "\"&&)&&&)&&\"\n" + "\"&&)))))&&\"\n" + "\"+&&&)&&&,\"\n" + "\"$-&&&&&-$\"\n" + "[end]");
    TypData data = tr.getData();
    TypPoint point = data.getPoints().get(0);
    ArrayImgWriter w = new ArrayImgWriter();
    point.write(w, data.getEncoder());
    System.out.println("size " + w.getSize());
    try (OutputStream os = new FileOutputStream("hello")) {
        os.write(w.getBytes());
    } catch (IOException e) {
        e.printStackTrace();
    }
    assertEquals(115, w.getBytes().length);
}
Also used : TypData(uk.me.parabola.imgfmt.app.typ.TypData) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) FileOutputStream(java.io.FileOutputStream) TypPoint(uk.me.parabola.imgfmt.app.typ.TypPoint) ArrayImgWriter(func.lib.ArrayImgWriter) IOException(java.io.IOException) Test(org.junit.Test)

Example 9 with TypData

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

the class TypTextReaderTest method testPolygonWithBitmap.

@Test
public void testPolygonWithBitmap() {
    tr = makeTyp("[_polygon]\n" + "Xpm=\"32 32 4 1\"\n" + "\"! c #FFCC99\"\n" + "\"  c none\"\n" + "\"3 c #000000\"\n" + "\"4 c none\"\n" + "\"!     !!!     !!!     !!!     !!\"\n" + "\"     !!!     !!!     !!!     !!!\"\n" + "\"    !!!     !!!     !!!     !!! \"\n" + "\"   !!!     !!!     !!!     !!!  \"\n" + "\"  !!!     !!!     !!!     !!!   \"\n" + "\" !!!     !!!     !!!     !!!    \"\n" + "\"!!!     !!!     !!!     !!!     \"\n" + "\"!!      !!      !!      !!      \"\n" + "\"!     !!!     !!!     !!!     !!\"\n" + "\"     !!!     !!!     !!!     !!!\"\n" + "\"    !!!     !!!     !!!     !!! \"\n" + "\"   !!!     !!!     !!!     !!!  \"\n" + "\"  !!!     !!!     !!!     !!!   \"\n" + "\" !!!     !!!     !!!     !!!    \"\n" + "\"!!!     !!!     !!!     !!!     \"\n" + "\"!!      !!      !!      !!      \"\n" + "\"!     !!!     !!!     !!!     !!\"\n" + "\"     !!!     !!!     !!!     !!!\"\n" + "\"    !!!     !!!     !!!     !!! \"\n" + "\"   !!!     !!!     !!!     !!!  \"\n" + "\"  !!!     !!!     !!!     !!!   \"\n" + "\" !!!     !!!     !!!     !!!    \"\n" + "\"!!!     !!!     !!!     !!!     \"\n" + "\"!!      !!      !!      !!      \"\n" + "\"!     !!!     !!!     !!!     !!\"\n" + "\"     !!!     !!!     !!!     !!!\"\n" + "\"    !!!     !!!     !!!     !!! \"\n" + "\"   !!!     !!!     !!!     !!!  \"\n" + "\"  !!!     !!!     !!!     !!!   \"\n" + "\" !!!     !!!     !!!     !!!    \"\n" + "\"!!!     !!!     !!!     !!!     \"\n" + "\"!!      !!      !!      !!      \"\n" + "[End]\n");
    TypData data = tr.getData();
    List<TypPolygon> polygons = data.getPolygons();
    TypPolygon p = polygons.get(0);
    ArrayImgWriter out = new ArrayImgWriter();
    p.write(out, data.getEncoder());
    byte[] bytes = out.getBytes();
    assertEquals(135, bytes.length);
}
Also used : TypPolygon(uk.me.parabola.imgfmt.app.typ.TypPolygon) TypData(uk.me.parabola.imgfmt.app.typ.TypData) ArrayImgWriter(func.lib.ArrayImgWriter) Test(org.junit.Test)

Aggregations

TypData (uk.me.parabola.imgfmt.app.typ.TypData)9 Test (org.junit.Test)6 ArrayImgWriter (func.lib.ArrayImgWriter)4 IOException (java.io.IOException)3 MapFailedException (uk.me.parabola.imgfmt.MapFailedException)3 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 TYPFile (uk.me.parabola.imgfmt.app.typ.TYPFile)2 TypPoint (uk.me.parabola.imgfmt.app.typ.TypPoint)2 TypPolygon (uk.me.parabola.imgfmt.app.typ.TypPolygon)2 SyntaxException (uk.me.parabola.mkgmap.scan.SyntaxException)2 BufferedReader (java.io.BufferedReader)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 InputStreamReader (java.io.InputStreamReader)1 OutputStream (java.io.OutputStream)1 Reader (java.io.Reader)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ImgFileWriter (uk.me.parabola.imgfmt.app.ImgFileWriter)1 TypLabelException (uk.me.parabola.imgfmt.app.typ.TypLabelException)1