Locus Map - forum

Content & Tools => Themes - Vector maps => Topic started by: kech61 on August 23, 2013, 16:44:49

Title: @Menion, Captions seems to render leftbound now in mapsforge
Post by: kech61 on August 23, 2013, 16:44:49
Hi Menion,

I noticed that caption are rendering left bound (at least since a couple of weeks) - in standard Mapsforge these captions render centered.
While this is usually no big issue it affects the cycle nodes which consits of a circle with the number of the node rendered into it.

This looks not very pleasing in Locus.
Is this a bug, or in other words if you changed the renderer - is there an option for the theme to render those cycle nodes as it was in earlier versions of Locus?
Title: Re: @Menion, Captions seems to render leftbound now in mapsf
Post by: jusc on August 24, 2013, 13:48:42
Thanks for this hint. Some locus versions ago was the "dx" parameter added. So you should add it to your render theme.
(I have to update my themes too  :D )


   <!-- Cycle nodes for NL/BE EXPERIMENTAL -->      
    <rule e="node" k="cycle_node" v="NLBE">    
        <rule e="node" k="cycle_node" v="*" zoom-min="12" zoom-max="14">    
            <rule e="node" k="cycle_node" v="*">
                <circle r="12" fill="#ffffff" stroke="#48D1FF" stroke-width="2.0" />
                <caption k="name" dx="-8" dy="5" font-style="bold" font-size="15" fill="#0026FF" stroke="#ffffff" stroke-width="2.0" />
            </rule>
        </rule>
        <rule e="node" k="cycle_node" v="*" zoom-min="15" zoom-max="17">    
            <rule e="node" k="cycle_node" v="*">
                <circle r="17" fill="#ffffff" stroke="#48D1FF" stroke-width="3.0" />
                <caption k="name" dx="-12" dy="8" font-style="bold" font-size="21" fill="#0026FF" stroke="#ffffff" stroke-width="2.0" />
            </rule>
        </rule>
        <rule e="node" k="cycle_node" v="*" zoom-min="18" zoom-max="20">    
            <rule e="node" k="cycle_node" v="*">
                <circle r="22" fill="#ffffff" stroke="#48D1FF" stroke-width="3.0" />
                <caption k="name" dx="-16" dy="11" font-style="bold" font-size="28" fill="#0026FF" stroke="#ffffff" stroke-width="2.0" />
            </rule>
        </rule>
    </rule>
Title: Re: @Menion, Captions seems to render leftbound now in mapsf
Post by: Menion on August 24, 2013, 15:34:52
hi guys, are you sure it was centered by default before?

I'm checking current mapsforge code for captions
http://code.google.com/p/mapsforge/sour ... me=rewrite (http://code.google.com/p/mapsforge/source/browse/mapsforge-map/src/main/java/org/mapsforge/map/rendertheme/renderinstruction/CaptionBuilder.java?name=rewrite)
- you may see there Align.LEFT

in my updated code is also set Align.LEFT

in almost year old code for mapsforge v3.0 you may on lines around 100 see also Align.LEFT
http://code.google.com/p/mapsforge/sour ... name=0.3.0 (http://code.google.com/p/mapsforge/source/browse/mapsforge-map/src/main/java/org/mapsforge/android/maps/rendertheme/renderinstruction/Caption.java?name=0.3.0)

your labels are as captions in your renderTheme?
Title: Re: @Menion, Captions seems to render leftbound now in mapsf
Post by: kech61 on August 24, 2013, 15:40:58
Quote from: "jusc"Thanks for this hint. Some locus versions ago was the "dx" parameter added. So you should add it to your render theme.
(I have to update my themes too  :D )


Hi Jusc,

Thanks a million for quick solution, just right for the update of openandromaps this evening.
Title: Re: @Menion, Captions seems to render leftbound now in mapsf
Post by: tommi on August 24, 2013, 15:48:54
Hi jusc or Menion,
what does dx="-16" mean? Shift the output by 16 pixels to the left?
Title: Re: @Menion, Captions seems to render leftbound now in mapsf
Post by: kech61 on August 24, 2013, 15:56:01
Quote from: "menion"hi guys, are you sure it was centered by default before?

Absolutely, in Apps with standard 0.3.0 implementation the captions render centered.

Quoteyour labels are as captions in your renderTheme?

Only the labes of cycle + hiking nodes (these are nodes in osm) - is there a better solution for this in the modified code of Locus?
EDIT: Cycle Nodes are a special kind of cycle navigation/guiding in the Netherlands and Belgium, the best in the world.

I'v provided samples of Locus and standard:
You see that the captions of peaks in locus are leftbound (it was centered a few versions bevore), standard 0.3.0 is centered.
Title: Re: AW: @Menion, Captions seems to render leftbound now in m
Post by: jusc on August 24, 2013, 20:36:43
Quote from: "tommi"Hi jusc or Menion,
what does dx="-16" mean? Shift the output by 16 pixels to the left?
I'm not sure, if it are pixels, but indeed with dx="" and dy="" you can move such things as description or caption around the original position of a poi.
Title: Re: @Menion, Captions seems to render leftbound now in mapsf
Post by: Menion on August 25, 2013, 18:55:22
hmm maybe I found a problem. I was working on a labeling system (not much success) and fixed there some issues. And this was maybe one of them. In mapsforge is set labeling to Align.LEFT but in the end, all labels was center. I probably fixed this by accident, so this started to work correctly :)

Anyway, hope you do not work on updating of themes a lot. if there is such a problem, it's always better to fix it on my side then on yours. In next version (also a test version), this should be fixed so let me know if there will be any more problems (or needs for additional improvements)

and yes, dx and dy values are currently in pixels. There is anyway possibility (if anyone interested) to use also DPI units (units that scale with devices resolution) for lines. "stroke-width" and "border-width" parameters now may contain pixels, or "10dp" (dots per inch). Value 10 means, 10 mixels on MDPI devices, 2.0 x 10 = 20.0 pixels on XHDPI devices, like Note 2 etc ... I should write more if will be anyone interested or add support for DPI for mode values in styles. It's quite essential for new huge devices with 1920x1xxx resolution
Title: Re: @Menion, Captions seems to render leftbound now in mapsf
Post by: kech61 on August 25, 2013, 20:08:22
Quote from: "menion"...In mapsforge is set labeling to Align.LEFT but in the end, all labels was center. I probably fixed this by accident, so this started to work correctly :) ....

 :mrgreen:  :mrgreen:  :mrgreen:

Thanks for information!
Title: Re: @Menion, Captions seems to render leftbound now in mapsforge
Post by: jusc on August 27, 2013, 12:45:54
@kech61
you can the dx parameter remove again from your themes. With new test version there is no longer need for it.
Title: Re: @Menion, Captions seems to render leftbound now in mapsforge
Post by: john_percy on August 27, 2013, 18:11:59
Which items of text are now centred?
Title: Re: @Menion, Captions seems to render leftbound now in mapsforge
Post by: jusc on August 27, 2013, 20:10:32
It's only in the Netherlands map of OpenAndroMaps with a cycling theme. The refs within the blue circles are a bit moved to the right. It's already fixed in test version. There is nothing to do but to wait for next Locus update. :))

Title: Re: @Menion, Captions seems to render leftbound now in mapsforge
Post by: kech61 on August 27, 2013, 20:14:52
Quote from: jusc on August 27, 2013, 12:45:54
@kech61
you can the dx parameter remove again from your themes. With new test version there is no longer need for it.

Thanks, done
+ added mountain_pass

Best regards
Christian
www.openandromaps.org
Title: Re: @Menion, Captions seems to render leftbound now in mapsforge
Post by: jusc on August 27, 2013, 21:05:13
@kech61,

What is a mountain pass? Example?
Thanks in advance.
Title: Re: @Menion, Captions seems to render leftbound now in mapsforge
Post by: kech61 on August 28, 2013, 13:02:39
Quote from: jusc on August 27, 2013, 21:05:13
What is a mountain pass? Example?
Thanks in advance.

Passhöhe, Sattel tagged as node for roads and paths too.
http://www.openstreetmap.org/#map=15/47.6250/14.3146
However its not rendered in Mapnik.
Title: Re: @Menion, Captions seems to render leftbound now in mapsforge
Post by: john_percy on September 06, 2013, 15:49:06
Quote from: john_percy on August 27, 2013, 18:11:59
Which items of text are now centred?
@Menion: If only Netherlands cycle nodes have been centred, can you please look at the default alignment of captions generally.
The attachments (I can't get them to show inline on this new forum) show text alignment on Locus default theme compared to an OSM rendering.
OSM centres the caption and puts it under the icon. Locus left aligns the text and starts it centrally under the icon which loses some of the text of the caption. OSM is better.

Edit: Found how to add images to the post!
(http://s17.postimg.org/nwfeoqwm3/2013_09_06_14_27_44.jpg) (http://postimg.org/image/nwfeoqwm3/) (http://s11.postimg.org/suxq76i67/2013_09_06_14_29_06.jpg) (http://postimg.org/image/suxq76i67/)
Title: Re: @Menion, Captions seems to render leftbound now in mapsforge
Post by: Menion on September 10, 2013, 17:42:08
thanks, so another try in next version. I'll rather check new fix twice ...
Title: Re: @Menion, Captions seems to render leftbound now in mapsforge
Post by: john_percy on September 16, 2013, 10:05:54
 :) And now working for me. Thanks