Cruisers Forum
 


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 25-04-2012, 06:57   #1
Registered User

Join Date: Dec 2008
Boat: Journeyman
Posts: 705
Chartsymbols - The Next Generation

OpenCPN Version 2.6 Beta Build 1624 includes the work I have done towards having a more modern and easier to work with format for chart symbology. Up to now all information regarding how to render chart symbols was stored in a file (S52RAZDS.RLE) whose format was not very user friendly.

The new way of doing things instead has an easily readable XML syntax for the configuration,and the actual bitmaps are loaded from PNG files. They can be edited in whatever modern image editor you fancy (which probably means Gimp or Photoshop). Which means that we can now use transparent bitmaps and antialiased graphics (unlike nohal's previous excellent RLE editor).

As an example, here is a blowup of the case of a port side buoy with a light and a sound in the old and new version:



Included in the beta is an initial set of symbols which is based on what was previously in the S52RAZDS file. I have updated the most common symbols to antialiased version, but quite a few remains. You can help, of course, by contributing updates to more of them.

To make life easier for us symbol editors there is a multilayered TIF file available at http://journeyman.se/opencpn/rastersymbols.tif which has the following layers:

- Text: The symbol names. Just some support so that you can check the name of the symbol you are editing. Fairly ugly auto-generated layout, but better than nothing.
- Pivot: A single pixel showing where the symbol pivot point is located.
- Symbols: The actual symbol graphic layer. This layer only should be saved as the <graphics-file> for a specific color table.
- Background: Rectangles for the definition area of each symbol. The position should confirm to the <graphics-location> and <bitmap height="" width=""> in the XML file as explained below.
- Frames: 1 pixel solid black outline OUTSIDE of the symbol definition area.
- Canvas: Just a colored background you can toggle to see the symbol against a solid color.

There is also some vector originals I used for the symbols I updated at http://journeyman.se/opencpn/symbol-vector-orig.svg

A short introduction to the new XML format:

There are five types of tags in the chartsymbols.xml file:

First color tables:
Code:
<color-table name="">
    <graphics-file name="" />
    <color name="" r="" g="" b=""/>
    ....
</color-table>
Each color table has a name. OpenCPN currently uses the following tables: DAY-BRIGHT, DUSK and NIGHT.
Each color table also has a <graphics-file name="" />, which should be the name of a PNG file in the same folder as the XML file itself. This is the file that all bitmap symbols are loaded from. It should be a PNG24 type file with alpha channel.

The colors temselves are specified as integer RGB values in the 0-255 range.

The next type is Lookups. These specify how extra graphics such as text and secondary symbols are to be placed. Normally there should be no need to edit these tags, but if you feel the need, at least they are now much more readable than in the old format. No changes to the actual data has been made.

The <line-style> tags define how various complex lines are drawn (fairways, anchor areas etc). The actual vector specs are still in HPGL format (a vector plotting format from the 80's :-) ). Unfortunately we don't have a good way of parsing SVG graphics yet, so they remain as they were.

The <pattern> tags specify how areas such as dredged areas, marshes and so on are drawn. Note that overall features such as land and depth countours do not have a pattern so they are NOT specified here. A example pattern tag looks like below. This particular pattern has both a vector and a bitmap definition. Per default the system will use a bitmap if both are present. Bitmaps are faster. If you want to use the vector as default instead, specify <prefer-bitmap>no</prefer-bitmap> as a sub-tag to the <pattern>.
Code:
        <pattern RCID="3143">
            <name>MARSHES1</name>
            <definition>V</definition>
            <filltype>S</filltype>
            <spacing>C</spacing>
            <bitmap width="40" height="40">
                <distance min="1500" max="15000" />
                <pivot x="30" y="30" />
                <origin x="0" y="0" />
                <graphics-location x="207" y="1007" />
            </bitmap>
            <vector width="400" height="393">
                <distance min="1500" max="15000" />
                <pivot x="750" y="1016" />
                <origin x="550" y="499" />
            </vector>
            <description>pattern of symbols for a marsh</description>
            <color-ref>ACHBRN</color-ref>    <HPGL>SPA;SW2;PU751,765;PD751,499;SPA;SW2;PU626,892;PD876,892;SPA;SW2;PU550,810;PD950,810;SPA;SW2;PU664,799;PD592,634;SPA;SW2;PU830,799;PD901,637;</HPGL>
        </pattern>
What potentially makes sense to edit here if you like is the color-ref for the vector version, and maybe distances etc. Note that color-ref is only used for the vector version, it has no effect on the bitmap.

For the bitmap version you specify the size of the bitmap, which is then tiled across the pattern area when displayed.

The <graphics-location x="" y="" /> points to the location in the PNG file of the currently loaded <color-table>. Locations are counted from the upper left corner as (0,0) with y positive downwards as usual. So in the above example the pattern will consist of whatever is found in the PNG file area from (207,1007) to (207+40,1007+40) and then tiled.

The last tag is the <symbol>, which looks similar to the <pattern>. Symbols also can have both vector and bitmap definition, and again bitmapis the default. Be careful not to use bitmap for symbols which appear rotated, such as TSS direction arrows etc. These symbols must have <prefer-bitmap>no</prefer-bitmap>.

A typical symbol looks like this:

Code:
        <symbol RCID="45">
            <name>BOYSPH68</name>
            <description>spherical buoy,by,full-chart</description>
            <bitmap width="19" height="15">
                <distance min="0" max="0" />
                <pivot x="9" y="11" />
                <origin x="0" y="0" />
                <graphics-location x="661" y="742" />
            </bitmap>
            <definition>R</definition>
        </symbol>
Again the symbol graphics are picked from the currently loaded PNG file, in this case starting at <graphics-location x="661" y="742" /> and having an area of 19 by 15 pixels. The <pivot x="9" y="11" /> indicates what pixel of the bitmap is to be placed at the actual point of the symbol on the chart.
JesperWe is offline   Reply With Quote
Old 26-04-2012, 01:40   #2
Registered User
 
sailorF54's Avatar

Join Date: Dec 2009
Location: Perros-Guirec, France
Boat: Jeanneau Sunshine 36
Posts: 999
Re: Chartsymbols - The Next Generation

Thanks JesperWe


If someone likes the look and feel of (French) SHOM charts
just edit the following symbols to the numeric rgb values below

LANDA 255 224 183
NODTA 225 224 222
DEPDW 255 249 245
LANDF 255 200 125
CHBRN 226 192 156
Attached Thumbnails
Click image for larger version

Name:	Image004.jpg
Views:	271
Size:	386.7 KB
ID:	40442  
sailorF54 is offline   Reply With Quote
Old 14-05-2012, 12:56   #3
Registered User

Join Date: Dec 2008
Boat: Journeyman
Posts: 705
Re: Chartsymbols - The Next Generation

The rastersymbols.tif file was just updated with all recent work. I think this is very close to what will ship in release 3.0.

For those who want to mess with color tables, I have also uploaded a handy little key, which makes it easier to find what color code a certain color is.

http://journeyman.se/opencpn/ColorTables.png
JesperWe is offline   Reply With Quote
Reply

Tags
charts

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Advertise Here


All times are GMT -7. The time now is 19:17.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.