Issue with SVG as area pattern

Started by SwissPoPo, March 14, 2016, 22:06:46

0 Members and 1 Guest are viewing this topic.

SwissPoPo

In my theme I use SVG as area pattern.
The SVG has an original size of 580x580. The theme downscales it to 26dp.
On some devices locus draws a line at the bottom from outside of the frame. The effect seems to be pixel density dependent: seen on 160 & 320 dpi devices (not on 240 & 480).
I have created a test pattern. It has the size of 580x580. Outside of this frame I added a rectangle in red & purple (starting at coordinate -22, -22 size 624x624). I should not be visible. But it is. One line at the bottom (purple).
For SVG symbols this is not an issue. For SVG pattern this looks bad. (horizontal lines).

testpattern.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="580" width="580" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<path d="m-22.308-22.308h624.62v624.62h-624.62z" fill="#f00"/>
<path d="m0 0h580v580h-580z" fill="#0f0"/>
<path d="m22.308 22.308h535.38v535.38h-535.38z" fill="#00f"/>
<path d="m44.615 44.615h490.77v490.77h-490.77z" fill="#0f0"/>
<path fill="#c400ff" d="m-22.308 580h624.62v22.308h-624.62z" fill-rule="evenodd"/>
</svg>


testpattern.xml (theme)
<?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 ../renderTheme.xsd" locus-extended="1" fill-sea-areas="0" version="1" map-background="#e6e6e6">
  <rule e="way" k="natural|landuse" v="forest_huge|forest_large|forest_medium|forest_small|forest_tiny|forest_micro|forest_nano|forest|wood" closed="yes">
    <area src="file:/testpattern.svg" symbol-width="26dp" />
  </rule>
</rendertheme>

  •  

jusc

Is it a Locus only problem or do you see it with other Mapsforge renderer too?
I decreased your svg to 64 x 64 pix and got at least in very high zoom (18,800) a little different view
All 5 vertical and all 5 horizontal lines are diffrent on Note 2 (264ppi).
Regards J.
  •  

SwissPoPo

I have this issue only with Locus. I haven't seen it with mapsforge apps.
Your Note 2 has scale factor 1.5 (near to 240dpi), so you probably don't have any problems. But I don't know why. My 240dpi device does also work. The Idea of this testpattern was to make the drawing from outside of the frame visible. Your 64x64 has everything inside the frame.

Here a picture:

Left: What I get.
Right: What I expect.

Locus is drawing the pattern with 26x27 pixel instead of 26x26. It seems the calculation of the height does not work correctly. When I avoid this calculation with declaring the height in the theme, the problem is gone.

This works: <area src="file:/testpattern.svg" symbol-width="26dp" symbol-height="26dp"/>
It is a workaround, but I think it should be corrected in Locus.
  •