Repaint your map !



Repaint your map !


 


Information2017/0522 : WARNING BUGGY PROGRAM
6 years later, I discovered a bug with point XPM symbol. Strangely, PNG file in XML format works like a charm for Emerald Island Map
Information2011/08/05 : this release should correct subtypes for polygons draw order. Also provided an XSD for file validation and an XSLT which allows to export your data to cgpsmapper format. More over, a config file for Jaxe, a free multiplatform XML editor is also available.

 

About
makeTyp compiles TYP files for Garmin GPS devices compatible with NT TYP file format.
I began this project by reading binary TYP file. After analyzing 50% of the header, my try was sped up with ati.land.cz and its very good script. Despite I do not know anything about Perl, it helped me a lot.


makeTyp for Mac is my first try with Apple tools and Mac OS X. It is also my first fully 64 bits software (Mac version) and the first time I wrote something in objective-C. These last 10 days were like a small Vietnam war : reading a plethora of unintelligible literature for a beginner, mixing C+ + with objective-C, an easy to use interface (I hope it respects Apple's canons), and finally the not so clear process to add a small help book (written originally for PC users)... Finally the app is done, I am alive and I can now walk and enjoy the spring !


makeTyp is limited to produce only NT TYP file without decompilation function. User has to write its source file in a human readable format.

makeTyp is free to use for any purpose. Despite all my attention, I cannot guarantee that the program is error free. You use it at your own risk. I decline any responsability in case of damaged device, lost data or any injury. If you disagree with this terms of use, you are not allowed to run makeTyp.

Download latest version

Click to download
From filehosting.org (high speed server)

MD5 : e83064bb75a411d447d709b78ddf5103
SHA1 : e3341f5c6fe84998720e7dbb43c7d6c97a48e122

Click to downloadFiles for Mac
From filehosting.org (high speed server)

MD5 : 1d5b9fa2a3c1744ee0d360454bfb60c7
SHA1 : 826bd4fa0814eb4bff7179c4ccd7a96a5915f42a

 



Usage


PC
makeTyp.exe [-debug] [-default] [-info] <file1.txt file2.txt ...>

Mac
Application
Launch makeTyp application, drag your text file and drop it on the "drop area". The binary TYP is put where your drag and drop started (source directory).

Command line
If you want to use makeTyp in your product build processus, call makeTyp.app/Contents/ MacOS/mkTyp
mkTyp [-debug] [-default] [-info] <file1.txt file2.txt ...>

Automator action
If you ran at least one time the application, makeTyp is also available in your Automator's library. ;-)

Normal mode
If a fatal error is detected in a source file, the corresponding TYP file is not compiled. Some minor errors are automatically corrected with default values. The result is logged on the standard error stream.

Debug mode (-debug)
If a fatal error is detected the compiled TYP file is named "filename_CORRUPTED.TYP". It may be useful for debug. Check also the standard error stream for more information.

Default draworder (-default)
If you define some draw orders for polygons, only polygons corresponding to draw orders you defined will be displayed. The option "-default" merge automatically all polygon draw orders you did not defined.

Information (-info)
Print software version...

Nota 1 :
As I do not know if a wrong file can block GPS device, it is wise to not rename and upload a file tagged "CORRUPTED".

Nota 2 :
ASCII mode (ANSI) supported only, not UTF-8.

File format


XML
The XML file format is described with an XML schema definition (TYP.xsd). Used in a XML software editor, it will transform that one into a TYP editor with automatic syntax validation. TYP.xsl exports your XML file into txt format.Here is a configuration file TYP_config.xml for Jaxe, a Java multi-platform editor.These samples may help you to understand the file formats described below.

<TYP filename="file.TYP">
filename : the name of the result TYP file

<FID val="[0-65535]"/>
val : family ID

<PRODUCT val="[0-65535]"/>
val : product code

<CODEPAGE val="[1250-1258]>
val : characters set ID

<DRAWORDER hexType="[0x00000000-0x0001FFFF]" level="[0-15]"/>
hexType : polygon type
level : priority display level, low value = low priority

<LINE hexType="[0x00000000-0x0001FFFF]"> borderWidth="[0-32]" lineWidth="[0-32]">
hexType : line type
borderWidth : a line without pattern pixels nor image is defined with borders. In this case, the key color 2 and 4 when defined are applied
lineWidth : a line without pattern pixels nor image is defined with its width. in this case, the key color 1 and 3 when defined are applied

<LABEL id="[1-4]" lang="english langage name" string="[text]"/>
id : only four labels available par map item type
lang : langage name
string : label's content

Langage values :
  • french (0x01)
  • german (0x02)
  • dutch (0x03)
  • english (0x04)
  • default (0x04)
  • italian (0x06)
  • finnish (0x07)
  • swedish (0x08)
  • spanish (0x09)
  • basque (0x09)
  • catalan (0x0a)
  • galician (0x0b)
  • welsh (0x0c)
  • gaelic (0x0d)
  • danish (0x0e)
  • norwegian (0x0f)
  • portuguese (0x10)slovak (0x11)

  • czech (0x12)
  • croatian (0x13)
  • hungarian (0x14)
  • polish (0x15)
  • turkish (0x16)
  • greek (0x17)
  • slovenian (0x18)
  • russian (0x19)
  • estonian (0x1a)
  • latvian (0x1b)
  • romanian (0x1c)
  • albanian (0x1d)
  • bosnian (0x1e)
  • lithuanian (0x1f)
  • serbian (0x20)
  • macedonian (0x21)
  • bulgarian (0x22)

 

<FONTSTYLE size="[small-normal-large-nolabel]" hexDay="[0xRRGGBB]" hexNight="[0xRRGGBB]"/>
size : fontsize
hexDay : text color in day mode
hexNight : text color in night mode

<COLORSCHEME style="1DN-2DN-1D1N-2D2N-2D1N-1D2N"/>
style : line and polygon are defined with 1 or 2 colors for day mode (D) and night mode (N)

<PATTERN (skew="[true-false]") (display="[day-night]")>
skew : for lines only, rotate pattern along line orientation
display : for points only, set day and night mode pattern

<COLOR key="[characters]" hexValue="[0xRRGGBB(AA)/None]>
key : usually one or two characters
hexValue : RGB color for lines, polygons and points or possible RGBA color for points
None/none means no color, ie code for transparent pixels in line/polygon's pattern
Special key values when no PIXELS definition :
1 : reserved for day foreground color
2 : reserved for day background/border color
3 : reserved for night foreground color (it is necessary to identify night colors)
4 : reserved for night background/border color or transparent color (it is just a convention)

<IMAGE src="[uri]" width="[1-32/254]" height="[1-32/254]" pixelWidth="[1-2]"/>
src : filename path
width : image width in pixels,
line and polygon maximal value : 32
point maximal value : 254
height : image width in pixels,
line and polygon maximal value : 32
point maximal value : 254
pixelWidth : number of characters par pixel
Instead of PIXELS definition, an image can be chosen.
Image format can be PNG, JPEG, TIFF, BMP, TGA or any format supported by FreeImage.

<PIXELS width="[1-32/254]" height="[1-32/254]" pixelWidth="[1-2]">
width : image width in pixels,
line and polygon maximal value : 32
point maximal value : 254
height : image width in pixels,
line and polygon maximal value : 32
point maximal value : 254
pixelWidth : number of characters par pixel

<ROW>[characters]</ROW>
Value : sequence of color key characters representing a line of pixels

</PIXELS>
PIXELS element needs to be ended.

</PATTERN>
PATTERN element needs to be ended.

</LINE>
LINE element needs to be ended.

<POLYGON hexType="[0x00000000-0x0001FFFF]>
Polygon's definition shares the same structure with line's definition.
Pattern's skew attribute is not meaningful for polygons.

</POLYGON>
POLYGON element needs to be ended.

<POINT hexType="[0x00000000-0x0007FFFF]>
Point's definition share mostly the same structure with line's definition.
Pattern's skew attribute is not meaningful for points.
A point can have two patterns in its definition distinguished with display attribute : "day" for day mode and "night" for night mode.

</POINT>
POINT element needs to be ended.

</TYP>
TYP root element needs to be ended.

TXT
The file format is mainly the same as the one used with cgpsmapper.
Keywords are not case sensitive.

//This is a comment, it can be placed at the end of any line
;This is a comment too

[_id]
productCode=[0-...] usually 1
FID = [0-999?]
codePage=[1250-1258] (default 1252) ;optional if below section used
[end]

[_codePage] ;optional section if codepage defined above
CP=[1250-1258] (default 1252)
[end]

[_drawOrder]
type=[0-1FFFF] Garmin code, order n°[1-8?] (inside a map, polygons are displayed according to their rank priority - like in layers on each over -, lower order means written first eg. may be hidden by higher order)
...
[end]

[_line] / [_polygon] / [_point]
type=[0-1FFFF]([0-7FFFF] for point)
rotatePattern={1, true} ;only for lines, if attribute not present, skew is used
stringStyle=[nolabel]+[small-normal-large]+[day]+[night][,#RRGGBB][,#RRGGBB] ;defines if a label is displayed in day and/or night mode and which day and night color.
string[1-4]=[0x01-0x22]/[ASCII characters], value ;language ID or language name in english, value string of maximum 255 characters. In case of wrong ID, ID set to 0x04, maximum 4 language can be defined

xpm/dayXpm="width[32] height[1-32] nb colors[2-254] nb char/pixel[1-?]"
image=filepath ;image filepath used as pattern/icon instead of colors and pixels definitions below
"[any character(s)]/[1-4] c #[000000(00)-FFFFFF(FF)]/None" ;hexadecimal value RRGGBB(AA) (red-green-blue components + alpha)
... ;line & polygon with 1 to 4 colors, points can have more than 4 colors
"[width x nb char/pixel characters]" ;pixels line (height pixels line of width x nb char/pixel)

;for points only below
nightXpm="width [32] height[1-32] nb colors[2-254] nb char/pixel[1-?]" ;nightxpm is optional for night display
image=filepath ;image filepath used as icon instead of colors and pixels definitions below
"[any character(s)] c #[000000(00)-FFFFFF(FF)]/None" ;hexadecimal value RRGGBB(AA) (red-green-blue components + alpha)
... ;points can have more than 4 colors
"[width x nb char/pixel characters]" ;pixels line (height pixels line of width x nb char/pixel)

[end]

Nota 3 : colors and attributes must always be defined before pixels/image. Remember this scheme :

[_xxx]
type
attributes (lineWidth, borderWidth, colorScheme...)
xpm header
color definitions
pixels definition or image
[end]

Any line between pixels definition and [end] can make an invalid element with undefined attribute(s).

Lines & polygons

XPM
Line and polygon XPM maximal size width x height [1-32] x [1-32]
When file image used instead of ASCII pixels array, it will be automatically resized to width and height defined in "xpm" attribute. Original ratio between width and height is preserved.

Image
You can define a binary pattern with an image file instead of xpm "ASCII art" format. Any picture will be automatically converted into a two colors black & white image.
PNG format is recommended but you can try other formats (if they can be managed and transformed in 8bits palettized image by FreeImage).
PNG and GIF manage supports transparency.
JPEG, BMP don't manage transparency.

Colors

XPM colors are described with the rules below.

Only key 'c' supported in XPM color definition
Number of colors [1-254] + transparent color (value None)

"[any character(s)]/3 c #[000000-FFFFFF]/None"

There are several color schemes available (it is also a bit messy)
You can choose a color scheme among 6 :

(D:day N:night 1:foreground color & transparent background color 2: foreground color & background color)

2DN day & night same foreground and background/border colors
2D2N day & night different foreground and background/border colors
1D2N day foreground color with transparent background and night with two colors (foreground+background/border)
2D1N day foreground with background/border color and night foreground color with transparent background color
1DN day & night foreground color and transparent background color
1D1N day night different foregorund color and transparent background color

Two methods for a color scheme definition :

"Classical" dayXpm/XPM attribute :
A small example should be useful here.
xpm="0 0 3 0"
"1 c #7f0000"
"3 c #7f3f00"
"4 c #aaaaaa"

This example means a polygon or a line defined without pattern (width=0 height=0) with scheme color 2D1N or 1D2N (number of colors=3). The last 0 is the number of character par pixel if you defined a pattern in ASCII.
The ambiguity between 2D1N and 1D2N is removed with color ID definition :

1 : reserved for day foreground color
2 : reserved for day background color
3 : reserved for night foreground color (it is necessary to identify night colors)
4 : reserved for night background color or transparent color (it is just a convention)

Other method (prefered method :
Use the attribute "colorScheme" before xpm declaration (number of colors in xpm header does not matter) :
colorScheme=[2DN-2D2N-2D1N-1D2N-1DN-1D1N] (see matrix above for color scheme definition)

Exception :
1D2N is a special case if a pattern is defined. To respect XPM format, follow these three rules :
  1. define a xpm header with 4 colors.
  2. second color must be transparent.
  3. As it is also the same definition for 2D2N, you must also use colorScheme=1D2N (should be 1st rule)

Example :
[_line]
type=0x16 ;Trail
string1=french,Sentier
string2=english,Trail
rotatePattern=1
colorScheme=1D2N ;3rd rule (if omitted => read as 2D2N colorScheme)
xpm="32 1 4 1" ;1st rule
"X c #ff0000"
". c None" ;2d rule (if omitted => pattern filled with 1st color only)
"3 c #00ff00"
"4 c #ffffff"
"XXXX....XXXX....XXXX....XXXX...."
[end]


Lines
You can define only day colors and night colors with width and height set to 0 in XPM header (ex: xpm="0 0 2 0" means a two color line without pattern)
Line admits two parameters
lineWidth=[1-?] ; width in pixels
borderWidth=[0-?] ;border's width in pixels
See colorSchemes described above for day and night styles.

Polygons
You can define only day colors and night colors with width and height set to 0 in XPM header (ex: xpm="0 0 2 0" means a day color + night color polygon without pattern)

Points
Two sprites can be available for each point : one for day mode, one for night mode.

Size
Point XPM size width x height [1-255] x [1-255]
When file image used instead of ASCII pixels array, it will be automatically resized to width and height defined in "xpm" attribute.

Image
In case of an image file, number of colors and number of character per pixel are taken from the image source. All values must be still defined in xpm attribute or a read error will happen.
PNG format is recommended but you can use another format (if managed and transformed in 8 bits palettized image by FreeImage).
PNG and GIF manage supports transparency.
JPEG, BMP don't manage transparency.

Colors
Colors are automatically mapped to Garmin palette for images.
You can define color with alpha channel [RRGGBBAA].

Pixel transparency
Only one level of transparency is available.
It might change in future with 16 levels of transparency.

Nota 4 :
Control of XPM size for both lines and polygons is made when the TYP file is read.
Control of image size is made when point icon is read.
Point icon is automatically rescaled to feet in a maximal 255x255 square or according to width and height defined by user (in xpm header).




CategoryResource
Some rights reserved
Except where otherwise noted, content on this site is licensed
under a Creative Commons Attribution - Noncommercial - No Derivative Works 3.0 License.