Locus Map - forum

Content & Tools => Themes - Vector maps => Topic started by: john_percy on October 11, 2016, 19:27:23

Title: Scaling of dy displacement with zoom
Post by: john_percy on October 11, 2016, 19:27:23
In a a pair of lines like
Code: [Select]
<line stroke="#B3A18F" stroke-width="0.6dp" dy="2dp" stroke-dasharray="1,8" stroke-linecap="butt" />
<line stroke="#B3A18F" stroke-width="0.1dp" stroke-linecap="butt" />
the stroke-width scales up and down with the zoom but the dy displacement does not change in the same way.

This code is intended to produce a line with ticks off to one side. As far as I can see, ideally it ought to be:
Code: [Select]
<line stroke="#B3A18F" stroke-width="0.6dp" dy="0.3dp" stroke-dasharray="1,8" stroke-linecap="butt" />
<line stroke="#B3A18F" stroke-width="0.1dp" stroke-linecap="butt" />
with teh displacement and the width scaling exactly the same way.
Title: Re: Scaling of dy displacement with zoom
Post by: Tobias on October 12, 2016, 10:30:27
+1

There was a similar issues in standard mapsforge 0.5 which was fixed in 0.5.1, discussion and issue here:
https://groups.google.com/d/msg/mapsforge-dev/xQHb-CNxlag/UxiDgFXyyLMJ
https://github.com/mapsforge/mapsforge/issues/580

The problem is that stroke width is scaled for zoom levels >12 with a base 1.5, so strokes get wider, but everything defined by dy keeps the same distance, so it looks like it moves relative to another object which hasn't the same dy value.
Title: Re: Scaling of dy displacement with zoom
Post by: Menion on October 12, 2016, 12:12:31
Hello John, Tobias,
thanks for a feedback. I'll enable this improvement to next BETA version, so there will be some time to test it.
Title: Re: Scaling of dy displacement with zoom
Post by: Tobias on November 12, 2016, 16:05:07
Hello John, Tobias,
thanks for a feedback. I'll enable this improvement to next BETA version, so there will be some time to test it.
After checking with the last beta versions, still same behavior - probably planning for beta version 3.21 instead 3.20.x?
Title: Re: Scaling of dy displacement with zoom
Post by: john_percy on December 05, 2016, 10:48:28
@menion: Is this still on track?
Title: Re: Scaling of dy displacement with zoom
Post by: Menion on December 07, 2016, 10:03:04
Ah sorry guys!
I've included this change into one of previous versions, but @voldapet stopped me because he had some troubles in compatibility with Locus internal themes. And then I've forget on this topic, sorry.

As I think about it, best should be add extra parameter to keep current system compatible with old and new themes.

So in next version of Locus Map will themes support parameter "scale-line-dy-by-zoom" in header of themes. So will be able to add aditional argument scale-line-dy-by-zoom="1" , which enable this required scaling. Possible? Let me know how it works in next Beta version (probably tomorrow ).

So example of such locus internal theme header:

Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<rendertheme xmlns="http://mapsforge.org/renderTheme"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://mapsforge.org/renderTheme https://raw.githubusercontent.com/mapsforge/mapsforge/dev/resources/renderTheme.xsd"
  version="1"
  locus-extended="1"
  fill-sea-areas="0"
  map-background="#ebeade"
  scale-line-dy-by-zoom="1">
Title: Re: Scaling of dy displacement with zoom
Post by: john_percy on December 07, 2016, 11:12:10
That sounds like the best solution. I await the next beta. :)
Title: Re: Scaling of dy displacement with zoom
Post by: Tobias on December 19, 2016, 14:05:17
I finally came around to test it, works great for me in the latest beta. No more "moving" ways.
Thanks menion!
Title: Re: Scaling of dy displacement with zoom
Post by: Menion on December 19, 2016, 15:49:06
Glad to hear it. Current solution is usable for you without any issue right? Our internal themes stay unaffected, other themes as well ... hmm I see no problem, perfect. I'm just preparing new version, release will be probably tomorrow.
Title: Re: Scaling of dy displacement with zoom
Post by: john_percy on December 19, 2016, 17:00:30
It works fine for me too. Many thanks.