Re: [mkgmap-dev] Background in polish format reader

2020-03-13 Thread Andrzej Popowski

Hi Gerd,

thanks for updating mkgmap.

I think the idea behind background is to provide an arbitrary shape for 
trimming tile area. CGPSmapper doesn't execute trim on mp files, so the 
meaning of background is lost.


--
Best regards,
Andrzej
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] Background in polish format reader

2020-03-13 Thread Gerd Petermann
Hi Andrzej,

thanks, committed with r4466. I wonder why Background=Y is needed. In most 
mkgmap sources a polygon with type 0x4b is a synomym for background.

Gerd


Von: mkgmap-dev  im Auftrag von Andrzej 
Popowski 
Gesendet: Freitag, 13. März 2020 12:35
An: mkgmap-dev@lists.mkgmap.org.uk
Betreff: Re: [mkgmap-dev] Background in polish format reader

Hi Gerd,

yes, when I compile my map, I get only object 4b at layer 0. I use
simple definition of background:

[POLYGON]
Type=0x4b
Background=Y
Data0=...
[END]

This works for cGPSmapper, but not for mkgmap. I could add EndLevel=5 to
all my sources, but it was easier to recompile mkgmap, to make it a bit
more compatible with cGPSmapper.

--
Best regards,
Andrzej
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] Background in polish format reader

2020-03-13 Thread Andrzej Popowski

Hi Gerd,

yes, when I compile my map, I get only object 4b at layer 0. I use 
simple definition of background:


[POLYGON]
Type=0x4b
Background=Y
Data0=...
[END]

This works for cGPSmapper, but not for mkgmap. I could add EndLevel=5 to 
all my sources, but it was easier to recompile mkgmap, to make it a bit 
more compatible with cGPSmapper.


--
Best regards,
Andrzej
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] Background in polish format reader

2020-03-13 Thread Gerd Petermann
Hi Andrzej,

please describe the problem that is solved with this patch. Does it mean that 
the background polygon is not added to all levels without the patch?

Gerd


Von: mkgmap-dev  im Auftrag von Andrzej 
Popowski 
Gesendet: Donnerstag, 12. März 2020 16:25
An: mkgmap-dev@lists.mkgmap.org.uk
Betreff: [mkgmap-dev] Background in polish format reader

Hi,

the following quote from cGPSmapper describes peculiarities of command
"Background=Y":

If there is only one object set as the background, then the
EndLevel is automatically set to 9.
If there is no background object, or more than one, then the
EndLevel is not changed.

As I understand, background is a special object for cGPSmapper. If there
is only single background in a source, then compiler can modify EndLevel
value.

Mkgmap doesn't change EndLevel. I prepared a patch, that simply extends
EndLevel for any background object, which contains only "Data0=" layer.
I hope this should work for most cases.

Proper solution would be to count all background objects and
conditionally modify single background after reading an entire source file.

--
Best regards,
Andrzej
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] Background in polish format reader

2020-03-12 Thread Andrzej Popowski

Hi,

the following quote from cGPSmapper describes peculiarities of command 
"Background=Y":


If there is only one object set as the background, then the
EndLevel is automatically set to 9.
If there is no background object, or more than one, then the
EndLevel is not changed.

As I understand, background is a special object for cGPSmapper. If there 
is only single background in a source, then compiler can modify EndLevel 
value.


Mkgmap doesn't change EndLevel. I prepared a patch, that simply extends 
EndLevel for any background object, which contains only "Data0=" layer. 
I hope this should work for most cases.


Proper solution would be to count all background objects and 
conditionally modify single background after reading an entire source file.


--
Best regards,
Andrzej
Index: src/uk/me/parabola/mkgmap/reader/polish/PolishMapDataSource.java
===
--- src/uk/me/parabola/mkgmap/reader/polish/PolishMapDataSource.java
(revision 4465)
+++ src/uk/me/parabola/mkgmap/reader/polish/PolishMapDataSource.java
(working copy)
@@ -104,6 +104,8 @@
private int endLevel;
private char elevUnits;
private int currentLevel;
+   private boolean dataHighLevel;
+   private boolean background;
private int poiDispFlag;
private String defaultCountry;
private String defaultRegion;
@@ -306,6 +308,8 @@
if (!lineStringMap.isEmpty()) {
if (extraAttributes != null && 
shape.hasExtendedType())

shape.setExtTypeAttributes(makeExtTypeAttributes());
+   if (background && !dataHighLevel)
+   endLevel = levels.length -1;
for (Map.Entry>> 
entry : lineStringMap.entrySet()) {
setResolution(shape, entry.getKey());
addShapesFromPattern(entry.getValue());
@@ -329,6 +333,8 @@
endLevel = 0;
lineStringMap.clear();
currentLevel = 0;
+   dataHighLevel = false;
+   background = false;
}
 
private void addShapesFromPattern(List> pointsLists) {
@@ -595,6 +601,9 @@
} else if (name.startsWith("Data")) {
extractResolution(name);
addLineString(value, true);
+   } else if (name.equals("Background")) {
+   if ("Y".equals(value))
+   background = true;
}
else {
if(extraAttributes == null)
@@ -765,6 +774,8 @@
 */
private int extractResolution(String name) {
currentLevel = Integer.parseInt(name.substring(name.charAt(0) 
== 'O'? 6: 4));
+   if (currentLevel > 0)
+   dataHighLevel = true;
return extractResolution(currentLevel);
}
 
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev