@Menion, Captions seems to render leftbound now in mapsforge

Started by kech61, August 23, 2013, 16:44:49

0 Members and 1 Guest are viewing this topic.

kech61

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?
Best regards/ Grüsse
Christian
www.openandromaps.org
  •  

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 )


   <!-- 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>
Regards J.
  •  

Menion

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
- 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

your labels are as captions in your renderTheme?
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

kech61

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.
Best regards/ Grüsse
Christian
www.openandromaps.org
  •  

tommi

Hi jusc or Menion,
what does dx="-16" mean? Shift the output by 16 pixels to the left?
  •  

kech61

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.
Best regards/ Grüsse
Christian
www.openandromaps.org
  •  

jusc

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.
Regards J.
  •  

Menion

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
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

kech61

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!
Best regards/ Grüsse
Christian
www.openandromaps.org
  •  

jusc

@kech61
you can the dx parameter remove again from your themes. With new test version there is no longer need for it.
Regards J.
  •  

john_percy

Voluntary and Velocity themes - https://voluntary.nichesite.org
  •  

jusc

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. :))

Regards J.
  •  

kech61

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
Best regards/ Grüsse
Christian
www.openandromaps.org
  •  

jusc

@kech61,

What is a mountain pass? Example?
Thanks in advance.
Regards J.
  •  

kech61

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.
Best regards/ Grüsse
Christian
www.openandromaps.org
  •