Re: [mkgmap-dev] More method options for is_in function

2020-02-12 Thread Arndt Röhrig


 
 
  
   Hi Ticker,
  
  
   
  
  
   mkgmap tell me:
  
  
   
  
  
   6:33:39,37 - mkgmap .\tools\mkgmap-is-in-r4446 Speiche_Fabrik
   Error in style: Error: (inc/access:73): Error: Third parameter 'all' of function is_in is not supported for this style section, valid are: [in, in_or_on, on]
   Error in style: Error: (inc/access:73): Error: Third parameter 'all' of function is_in is not supported for this style section, valid are: [in, in_or_on, on]
   Error in style: Error: (inc/access:73): Error: Third parameter 'all' of function is_in is not supported for this style section, valid are: [in, in_or_on, on]
   Error in style: Error: (inc/access:73): Error: Third parameter 'all' of function is_in is not supported for this style section, valid are: [in, in_or_on, on]
   Could not open style
  
  
   
  
  
   
  
  
   If i move the "is_in" command to the line file, mkgmap say:
  
  
   
  
  
   6:30:43,78 - mkgmap .\tools\mkgmap-is-in-r4446 Speiche_Fabrik
   java.lang.AssertionError: invoked the non-augmented instance
   at uk.me.parabola.mkgmap.osmstyle.function.IsInFunction.calcImpl(IsInFunction.java:119)
   at uk.me.parabola.mkgmap.osmstyle.function.CachedFunction.value(CachedFunction.java:61)
   at uk.me.parabola.mkgmap.osmstyle.eval.EqualsOp.eval(EqualsOp.java:33)
   at uk.me.parabola.mkgmap.osmstyle.eval.AbstractOp.eval(AbstractOp.java:123)
   at uk.me.parabola.mkgmap.osmstyle.eval.AndOp.eval(AndOp.java:45)
   at uk.me.parabola.mkgmap.osmstyle.eval.AndOp.eval(AndOp.java:45)
   at uk.me.parabola.mkgmap.osmstyle.ActionRule.resolveType(ActionRule.java:72)
   at uk.me.parabola.mkgmap.osmstyle.RuleSet.resolveType(RuleSet.java:97)
   at uk.me.parabola.mkgmap.osmstyle.StyledConverter.convertWay(StyledConverter.java:462)
   at uk.me.parabola.mkgmap.reader.osm.ElementSaver.convert(ElementSaver.java:243)
   at uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.load(OsmMapDataSource.java:161)
   at uk.me.parabola.mkgmap.main.MapMaker.loadFromFile(MapMaker.java:154)
   at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:54)
   at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:291)
   at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:287)
   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   at java.base/java.lang.Thread.run(Thread.java:834)
   java.lang.AssertionError: invoked the non-augmented instance
   at uk.me.parabola.mkgmap.osmstyle.function.IsInFunction.calcImpl(IsInFunction.java:119)
   at uk.me.parabola.mkgmap.osmstyle.function.CachedFunction.value(CachedFunction.java:61)
   at uk.me.parabola.mkgmap.osmstyle.eval.EqualsOp.eval(EqualsOp.java:33)
   at uk.me.parabola.mkgmap.osmstyle.eval.AbstractOp.eval(AbstractOp.java:123)
   at uk.me.parabola.mkgmap.osmstyle.eval.AndOp.eval(AndOp.java:45)
   at uk.me.parabola.mkgmap.osmstyle.eval.AndOp.eval(AndOp.java:45)
   at uk.me.parabola.mkgmap.osmstyle.ActionRule.resolveType(ActionRule.java:72)
   at uk.me.parabola.mkgmap.osmstyle.RuleSet.resolveType(RuleSet.java:97)
   at uk.me.parabola.mkgmap.osmstyle.StyledConverter.convertWay(StyledConverter.java:462)
   at uk.me.parabola.mkgmap.reader.osm.ElementSaver.convert(ElementSaver.java:243)
   at uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.load(OsmMapDataSource.java:161)
   at uk.me.parabola.mkgmap.main.MapMaker.loadFromFile(MapMaker.java:154)
   at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:54)
   at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:291)
   at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:287)
   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   at java.base/java.lang.Thread.run(Thread.java:834)
   java.lang.AssertionError: invoked the non-augmented instance
   at uk.me.parabola.mkgmap.osmstyle.function.IsInFunction.calcImpl(IsInFunction.java:119)
   at uk.me.parabola.mkgmap.osmstyle.function.CachedFunction.value(CachedFunction.java:61)
   at uk.me.parabola.mkgmap.osmstyle.eval.EqualsOp.eval(EqualsOp.java:33)
   at uk.me.parabola.mkgmap.osmstyle.eval.AbstractOp.eval(AbstractOp.java:123)
   at uk.me.parabola.mkgmap.osmstyle.eval.AndOp.eval(AndOp.java:45)
   at uk.me.parabola.mkgmap.osmstyle.eval.AndOp.eval(AndOp.java:45)
   at uk.me.parabola.mkgmap.osmstyle.ActionRule.resolveType(ActionRule.java:72)
   at uk.me.parabola.mkgmap.osmstyle.RuleSet.resolveType(RuleSet.java:97)
   at uk.me.parabola.mkgmap.osmstyle.StyledConverter.convertWay(StyledConverter.java:462)
   at uk.me.parabola.mkgmap.reader.osm.ElementSaver.convert(ElementSaver.java:243)
   at uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.load(OsmMapDataSource.java:161)
   at 

Re: [mkgmap-dev] More method options for is_in function

2020-02-12 Thread Ticker Berkin
Hi Arndt

Can you try http://www.mkgmap.org.uk/download/mkgmap-is-in-r4446.zip

If the method parameter isn't understood, it lists the acceptable
method parameters for the context (points/lines/polygons).

I couldn't reproduce the problem with the previous version I had, and I
couldn't see how the include should have effected anything.

Ticker

On Tue, 2020-02-11 at 19:23 +0100, Arndt Röhrig wrote:
> Hi Ticker,
> 
> i include "access" from lines. It´s one of the first lines.
> Move the is_in command to the line file, mkgmap runs without errors.
> But is_in doesn´t work.
> With r-4428 is the result OK.
> 
> (highway~'motorway|trunk|primary|secondary|tertiary|unclassified|mino
> r|residential|living_street|cycleway|steps') {set isin=n} 
> highway=* & rad!=ja & laufen!=ja & tunnel!=* & bridge!=* & isin!=n &
> is_in(landuse,cemetery,all)=true {set isin=j} 
> ...
> ...
> isin=j {set rad=nein}
> isin=j {set highway=tobadforbike}
> 
> Greets
> Arndt
> 
> P.S.
> My complete style is here:
> https://speichenkarte.de/ "Steuerdateien;
> 
> 
> > Ticker Berkin < rwb-mkg...@jagit.co.uk> hat am 11. Februar 2020 um
> > 16:01 geschrieben:
> > 
> > 
> > Hi Arndt
> > 
> > Are you including inc/access from points?
> > 
> > Ticker
> > 
> > On Tue, 2020-02-11 at 13:54 +0100, Arndt Röhrig wrote:
> > > Hi Ticker,
> > > 
> > > i get this:
> > > 
> > > 13:40:20,54 - mkgmap .\tools\mkgmap-is-in-r4443 Speiche_Fabrik
> > > Error in style: Error: (inc/access:73): Error: Third parameter
> > > 'all'
> > > of function is_in is not supported
> > > 
> > > Reason is, the is_in command is in the access-file :)
> > > 
> > > Thank you
> > > 
> > > Arndt
> > > 
> > > 
> > > 
> > > > Ticker Berkin < rwb-mkg...@jagit.co.uk> hat am 11. Februar 2020
> > > > um
> > > > 13:02 geschrieben:
> > > > 
> > > > 
> > > > Hi
> > > > 
> > > > I've started some initial documentation for this that will go
> > > > into
> > > > the
> > > > Style Manual.
> > > > 
> > > > The attached patch lists the options, but you might find it a
> > > > bit
> > > > unreadable.
> > > > 
> > > > With the next auto-build after this is applied, the updated
> > > > manual
> > > > appear in the branches download zip. @gerd: is this how it
> > > > happens?
> > > > 
> > > > But the simple answer to your question is, for a rule in
> > > > "lines" or
> > > > "polygons", what you have written will still work.
> > > > 
> > > > Ticker
> > > > 
> > > > On Tue, 2020-02-11 at 12:32 +0100, Arndt Röhrig wrote:
> > > > > Hi Gerd,
> > > > > 
> > > > > is_in(landuse,residential,all)=true
> > > > > 
> > > > > how do you write that now?
> > > > > 
> > > > > Greets
> > > > > Arndt
> > > > > 
> > > > > > Gerd Petermann < gpetermann_muenc...@hotmail.com> hat am
> > > > > > 10.
> > > > > > Februar 2020 um 14:14 geschrieben:
> > > > > > 
> > > > > > 
> > > > > > Hi all,
> > > > > > 
> > > > > > see
> > > > > > http://www.mkgmap.org.uk/websvn/revision.php?repname=mkgmap
> > > > > > 
> > > > > > =4442
> > > > > > 
> > > > > > @Ticker:
> > > > > > I assume you are working on an alternative implementation
> > > > > > of
> > > > > > the
> > > > > > methods in IsInUtil?
> > > > > > If not I'd like to remove all the code duplication
> > > > > > introduced
> > > > > > with
> > > > > > the last patch.
> > > > > > 
> > > > > > Gerd
> > > > > > ___
> > > > > > 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_
> > > > > 
> > > > > __
> > > > 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
> > ___
> > 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
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Re: [mkgmap-dev] Work on is_in branch

2020-02-12 Thread Ticker Berkin
Hi Gerd

Here is the start of it + a couple of changes to the interface of
IsInFunction to make life easier.

I won't be able to finish this tonight so I've fixed the IsInUnitTest
to run using a copied version of calcInsideness, but the start of the
'reverse' version is there, called dev_calcInsideness.

Attached patch supersedes is_in-function_v8b.patch and it would be good
if it can be applied soon so that, for instance, Arndt, could see if it
fixes his problem with context and parameters.

Ticker

On Wed, 2020-02-12 at 15:55 +, Gerd Petermann wrote:
> Hi Ticker,
> 
> I found it difficult to test the real style function, that's why I
> moved all the logic out of it.
> I am looking forward to your solution.
> 
> Gerd
> 
> 
> Von: mkgmap-dev  im Auftrag
> von Ticker Berkin 
> Gesendet: Mittwoch, 12. Februar 2020 16:47
> An: Development list for mkgmap
> Betreff: Re: [mkgmap-dev] Work on is_in branch
> 
> Hi Gerd
> 
> The re-structuring makes this difficult.
> 
> I propose a function in IsInUtilTest with the same interface as
> calcInsideness from IsInUtil that somehow drives the real function
> IsIn
> Function to collect and build the IN/ON/OUT intflag.
> 
> Ticker
> 
> On Wed, 2020-02-12 at 15:28 +, Gerd Petermann wrote:
> > Hi Ticker,
> > 
> > did you run the unit tests? This should download a newer version of
> > the samples.
> > 
> > Gerd
> > 
> > 
> > Von: mkgmap-dev  im Auftrag
> > von Ticker Berkin 
> > Gesendet: Mittwoch, 12. Februar 2020 16:23
> > An: Development list for mkgmap
> > Betreff: Re: [mkgmap-dev] Work on is_in branch
> > 
> > Hi Gerd
> > 
> > Here it is - changes are:
> > 
> > - Some restructuring with early stopping where possible.
> > 
> > - Merging polygons for POINT IN/ON test so a point on shared
> > boundary
> > becomes IN rather than ON.
> > 
> > - Not merging polygons when no need.
> > 
> > - Make the function cacheable, so that there is negligible cost to
> > the
> > second call:
> > highway=path & is_in(landuse, residential, all)=true [0xAA]
> > highway=path & is_in(landuse, residential, all)=false [0xBB]
> > 
> > - Improved the layout of documentation in the Style Manual.
> > 
> > - Fixed quite a few problems.
> > 
> > I've left quite a lot of debug in for the moment, I think there
> > will
> > still be work to do.
> > 
> > It gives correct answers to 'point-on.osm'. I haven't worked
> > through
> > is
> > -in-hook-sample-v3.osm yet because I wanted to get this revision
> > out
> > to
> > replace faults in the previous versions.
> > 
> > Ticker
> > 
> > On Tue, 2020-02-11 at 15:49 +, Gerd Petermann wrote:
> > > Hi Ticker,
> > > 
> > > whatever you plan to do. I moved the code to the lib because it
> > > is
> > > easier to write a unit test.
> > > I would not invest much time to avoid a few tests which only
> > > happen
> > > in very rare cases. Makes testing more complicated and code less
> > > readable.
> > > 
> > > Gerd
> ___
> mkgmap-dev mailing list
> mkgmap-dev@lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-devIndex: doc/styles/rules.txt
===
--- doc/styles/rules.txt	(revision 4445)
+++ doc/styles/rules.txt	(working copy)
@@ -285,19 +285,22 @@
 |is_in(tag,value,method)   | x | x  |  |
 +true+ if the element is in polygon(s) having the specified +tag+=+value+ according to the +method+, +false+ otherwise.
 The methods available depend on the Style section:
-"points":
+
+* points:
  +in+ - the Node is within a polygon.
  +in_or_on+ - it is within or on the edge.
  +on+ - it is on the edge.
-"lines":
- +all+ - part of the Way is within the polygon(s), none is outside; it might touch an edge. 
+
+* lines:
+ +all+ - part of the Way is within the polygon(s), none is outside; it might touch an edge.
  +all_in_or_on+ - none is outside. This is useful for the negative - is_in(...,all_in_or_on)=false - for processing a line that is outside the polgon(s).
  +on+ - it runs along the edge.
  +any+ - part is within.
  +any_in_or_on+ - part is within or in the edge.
-"polygons":
+
+* polygons:
  +all+ - all of the closed Way is within the polygon(s).
- +any" - some is within.
+ +any+ - some is within.
 
 |
 
Index: src/uk/me/parabola/mkgmap/osmstyle/function/IsInFunction.java
===
--- src/uk/me/parabola/mkgmap/osmstyle/function/IsInFunction.java	(revision 4445)
+++ src/uk/me/parabola/mkgmap/osmstyle/function/IsInFunction.java	(working copy)
@@ -22,6 +22,7 @@
 
 import uk.me.parabola.imgfmt.app.Area;
 import uk.me.parabola.imgfmt.app.Coord;
+import uk.me.parabola.log.Logger;
 import uk.me.parabola.mkgmap.reader.osm.Element;
 import uk.me.parabola.mkgmap.reader.osm.ElementSaver;
 import uk.me.parabola.mkgmap.reader.osm.FeatureKind;
@@ -37,7 +38,8 @@
  * @author Ticker Berkin
  *
  */
-public class 

Re: [mkgmap-dev] Work on is_in branch

2020-02-12 Thread Gerd Petermann
Hi Ticker,

I found it difficult to test the real style function, that's why I moved all 
the logic out of it.
I am looking forward to your solution.

Gerd


Von: mkgmap-dev  im Auftrag von Ticker 
Berkin 
Gesendet: Mittwoch, 12. Februar 2020 16:47
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] Work on is_in branch

Hi Gerd

The re-structuring makes this difficult.

I propose a function in IsInUtilTest with the same interface as
calcInsideness from IsInUtil that somehow drives the real function IsIn
Function to collect and build the IN/ON/OUT intflag.

Ticker

On Wed, 2020-02-12 at 15:28 +, Gerd Petermann wrote:
> Hi Ticker,
>
> did you run the unit tests? This should download a newer version of
> the samples.
>
> Gerd
>
> 
> Von: mkgmap-dev  im Auftrag
> von Ticker Berkin 
> Gesendet: Mittwoch, 12. Februar 2020 16:23
> An: Development list for mkgmap
> Betreff: Re: [mkgmap-dev] Work on is_in branch
>
> Hi Gerd
>
> Here it is - changes are:
>
> - Some restructuring with early stopping where possible.
>
> - Merging polygons for POINT IN/ON test so a point on shared boundary
> becomes IN rather than ON.
>
> - Not merging polygons when no need.
>
> - Make the function cacheable, so that there is negligible cost to
> the
> second call:
> highway=path & is_in(landuse, residential, all)=true [0xAA]
> highway=path & is_in(landuse, residential, all)=false [0xBB]
>
> - Improved the layout of documentation in the Style Manual.
>
> - Fixed quite a few problems.
>
> I've left quite a lot of debug in for the moment, I think there will
> still be work to do.
>
> It gives correct answers to 'point-on.osm'. I haven't worked through
> is
> -in-hook-sample-v3.osm yet because I wanted to get this revision out
> to
> replace faults in the previous versions.
>
> Ticker
>
> On Tue, 2020-02-11 at 15:49 +, Gerd Petermann wrote:
> > Hi Ticker,
> >
> > whatever you plan to do. I moved the code to the lib because it is
> > easier to write a unit test.
> > I would not invest much time to avoid a few tests which only happen
> > in very rare cases. Makes testing more complicated and code less
> > readable.
> >
> > Gerd
___
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] Work on is_in branch

2020-02-12 Thread Ticker Berkin
Hi Gerd

The re-structuring makes this difficult.

I propose a function in IsInUtilTest with the same interface as
calcInsideness from IsInUtil that somehow drives the real function IsIn
Function to collect and build the IN/ON/OUT intflag.

Ticker

On Wed, 2020-02-12 at 15:28 +, Gerd Petermann wrote:
> Hi Ticker,
> 
> did you run the unit tests? This should download a newer version of
> the samples.
> 
> Gerd
> 
> 
> Von: mkgmap-dev  im Auftrag
> von Ticker Berkin 
> Gesendet: Mittwoch, 12. Februar 2020 16:23
> An: Development list for mkgmap
> Betreff: Re: [mkgmap-dev] Work on is_in branch
> 
> Hi Gerd
> 
> Here it is - changes are:
> 
> - Some restructuring with early stopping where possible.
> 
> - Merging polygons for POINT IN/ON test so a point on shared boundary
> becomes IN rather than ON.
> 
> - Not merging polygons when no need.
> 
> - Make the function cacheable, so that there is negligible cost to
> the
> second call:
> highway=path & is_in(landuse, residential, all)=true [0xAA]
> highway=path & is_in(landuse, residential, all)=false [0xBB]
> 
> - Improved the layout of documentation in the Style Manual.
> 
> - Fixed quite a few problems.
> 
> I've left quite a lot of debug in for the moment, I think there will
> still be work to do.
> 
> It gives correct answers to 'point-on.osm'. I haven't worked through
> is
> -in-hook-sample-v3.osm yet because I wanted to get this revision out
> to
> replace faults in the previous versions.
> 
> Ticker
> 
> On Tue, 2020-02-11 at 15:49 +, Gerd Petermann wrote:
> > Hi Ticker,
> > 
> > whatever you plan to do. I moved the code to the lib because it is
> > easier to write a unit test.
> > I would not invest much time to avoid a few tests which only happen
> > in very rare cases. Makes testing more complicated and code less
> > readable.
> > 
> > Gerd
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] Work on is_in branch

2020-02-12 Thread Gerd Petermann
Hi Ticker,

did you run the unit tests? This should download a newer version of the samples.

Gerd


Von: mkgmap-dev  im Auftrag von Ticker 
Berkin 
Gesendet: Mittwoch, 12. Februar 2020 16:23
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] Work on is_in branch

Hi Gerd

Here it is - changes are:

- Some restructuring with early stopping where possible.

- Merging polygons for POINT IN/ON test so a point on shared boundary
becomes IN rather than ON.

- Not merging polygons when no need.

- Make the function cacheable, so that there is negligible cost to the
second call:
highway=path & is_in(landuse, residential, all)=true [0xAA]
highway=path & is_in(landuse, residential, all)=false [0xBB]

- Improved the layout of documentation in the Style Manual.

- Fixed quite a few problems.

I've left quite a lot of debug in for the moment, I think there will
still be work to do.

It gives correct answers to 'point-on.osm'. I haven't worked through is
-in-hook-sample-v3.osm yet because I wanted to get this revision out to
replace faults in the previous versions.

Ticker

On Tue, 2020-02-11 at 15:49 +, Gerd Petermann wrote:
> Hi Ticker,
>
> whatever you plan to do. I moved the code to the lib because it is easier to 
> write a unit test.
> I would not invest much time to avoid a few tests which only happen in very 
> rare cases. Makes testing more complicated and code less readable.
>
> Gerd
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] Work on is_in branch

2020-02-12 Thread Ticker Berkin
Hi Gerd

Here it is - changes are:

- Some restructuring with early stopping where possible.

- Merging polygons for POINT IN/ON test so a point on shared boundary
becomes IN rather than ON.

- Not merging polygons when no need.

- Make the function cacheable, so that there is negligible cost to the
second call:
highway=path & is_in(landuse, residential, all)=true [0xAA]
highway=path & is_in(landuse, residential, all)=false [0xBB]

- Improved the layout of documentation in the Style Manual.

- Fixed quite a few problems.

I've left quite a lot of debug in for the moment, I think there will
still be work to do.

It gives correct answers to 'point-on.osm'. I haven't worked through is
-in-hook-sample-v3.osm yet because I wanted to get this revision out to
replace faults in the previous versions.

Ticker
 
On Tue, 2020-02-11 at 15:49 +, Gerd Petermann wrote:
> Hi Ticker,
> 
> whatever you plan to do. I moved the code to the lib because it is easier to 
> write a unit test.
> I would not invest much time to avoid a few tests which only happen in very 
> rare cases. Makes testing more complicated and code less readable.
> 
> Gerd
Index: doc/styles/rules.txt
===
--- doc/styles/rules.txt	(revision 4445)
+++ doc/styles/rules.txt	(working copy)
@@ -285,19 +285,22 @@
 |is_in(tag,value,method)   | x | x  |  |
 +true+ if the element is in polygon(s) having the specified +tag+=+value+ according to the +method+, +false+ otherwise.
 The methods available depend on the Style section:
-"points":
+
+* points:
  +in+ - the Node is within a polygon.
  +in_or_on+ - it is within or on the edge.
  +on+ - it is on the edge.
-"lines":
- +all+ - part of the Way is within the polygon(s), none is outside; it might touch an edge. 
+
+* lines:
+ +all+ - part of the Way is within the polygon(s), none is outside; it might touch an edge.
  +all_in_or_on+ - none is outside. This is useful for the negative - is_in(...,all_in_or_on)=false - for processing a line that is outside the polgon(s).
  +on+ - it runs along the edge.
  +any+ - part is within.
  +any_in_or_on+ - part is within or in the edge.
-"polygons":
+
+* polygons:
  +all+ - all of the closed Way is within the polygon(s).
- +any" - some is within.
+ +any+ - some is within.
 
 |
 
Index: src/uk/me/parabola/mkgmap/osmstyle/function/IsInFunction.java
===
--- src/uk/me/parabola/mkgmap/osmstyle/function/IsInFunction.java	(revision 4445)
+++ src/uk/me/parabola/mkgmap/osmstyle/function/IsInFunction.java	(working copy)
@@ -22,6 +22,7 @@
 
 import uk.me.parabola.imgfmt.app.Area;
 import uk.me.parabola.imgfmt.app.Coord;
+import uk.me.parabola.log.Logger;
 import uk.me.parabola.mkgmap.reader.osm.Element;
 import uk.me.parabola.mkgmap.reader.osm.ElementSaver;
 import uk.me.parabola.mkgmap.reader.osm.FeatureKind;
@@ -37,7 +38,8 @@
  * @author Ticker Berkin
  *
  */
-public class IsInFunction extends StyleFunction {
+public class IsInFunction extends CachedFunction { // StyleFunction
+	private static final Logger log = Logger.getLogger(IsInFunction.class);
 
 	private enum MethodArg {
 
@@ -91,10 +93,10 @@
 	private class CanStopProcessing extends RuntimeException {};
 
 	private MethodArg method;
-	private boolean hasIn = false;
-	private boolean hasOn = false;
-	private boolean hasOut = false;
-	private ElementQuadTree qt;
+	private boolean hasIn;
+	private boolean hasOn;
+	private boolean hasOut;
+	private ElementQuadTree qt = null;
 
 	public IsInFunction() {
 		super(null);
@@ -102,10 +104,22 @@
 		// 1: polygon tagName
 		// 2: value for above tag
 		// 3: method keyword, see above
+		log.info("isInFunction", System.identityHashCode(this));
 	}
 
+	private void resetHasFlags() {
+		// the instance is per unique call in rules, then applied repeatedly to each point/line/polygon
+		hasIn = false;
+		hasOn = false;
+		hasOut = false;
+	}
+
 	protected String calcImpl(Element el) {
-		if (qt == null || qt.isEmpty())
+		log.info("calcImpl", System.identityHashCode(this), kind, params, el);
+		assert qt != null : "invoked the non-augmented instance";
+		resetHasFlags();
+
+		if (qt.isEmpty())
 			return String.valueOf(false);
 		try {
 			switch (kind) {
@@ -120,17 +134,21 @@
 break;
 			}
 		} catch (CanStopProcessing e) {}
+		log.info("done", hasIn, hasOn, hasOut);
 		return String.valueOf(mapHasFlagsAnswer());
 	}
 
+/* don't have this for CachedFunction
 	@Override
 	public String value(Element el) {
 		return calcImpl(el);
 	}
-	
+*/
+
 	@Override
 	public void setParams(List params, FeatureKind kind) {
 		super.setParams(params, kind);
+		log.info("setParams", System.identityHashCode(this), kind, params);
 		String methodStr = params.get(2);
 		boolean knownMethod = false;
 		List methodsForKind = new ArrayList<>();
@@ -150,22 +168,34 @@
 	}
 
 	private void setIn() {
+		log.info("setIn", hasIn, hasOn, hasOut);
 		hasIn = true;
-		if 

Re: [mkgmap-dev] rounding hyper-accurate elevations ${ele}

2020-02-12 Thread ael
On Wed, Feb 12, 2020 at 01:42:51PM +0100, J J wrote:
> I was slightly surprised when I discovered the altitude "241.934997558594"
> on my map. This is actually the hyper-accurate information from the
> database: https://www.openstreetmap.org/node/32969675 (there's any more
> such examples). Since I do not know the reason for this value, I don't want
> to change the database.

Did you see the note? That may explain the high precision.

ael

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


Re: [mkgmap-dev] rounding hyper-accurate elevations ${ele}

2020-02-12 Thread Gerd Petermann
Hi J J
The default style uses this rule:

natural=peak {name '${name|def:}${ele|height:m=>ft|def:}'} [0x6616 resolution 
24]

AFAIK it works fine?

Gerd


Von: mkgmap-dev  im Auftrag von Gerd 
Petermann 
Gesendet: Mittwoch, 12. Februar 2020 14:09
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] rounding hyper-accurate elevations ${ele}

Hi,

I think the conv filter does what you want.

Gerd


Von: mkgmap-dev  im Auftrag von J J 

Gesendet: Mittwoch, 12. Februar 2020 13:42
An: Development list for mkgmap
Betreff: [mkgmap-dev] rounding hyper-accurate elevations ${ele}

I was slightly surprised when I discovered the altitude "241.934997558594" on 
my map. This is actually the hyper-accurate information from the database: 
https://www.openstreetmap.org/node/32969675 (there's any more such examples). 
Since I do not know the reason for this value, I don't want to change the 
database.
Does mkgmap provide a function similar to Math.round() or should I simply use 
${ele|part:".:1"} to skip the decimals?
___
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] rounding hyper-accurate elevations ${ele}

2020-02-12 Thread Gerd Petermann
Hi,

I think the conv filter does what you want.

Gerd


Von: mkgmap-dev  im Auftrag von J J 

Gesendet: Mittwoch, 12. Februar 2020 13:42
An: Development list for mkgmap
Betreff: [mkgmap-dev] rounding hyper-accurate elevations ${ele}

I was slightly surprised when I discovered the altitude "241.934997558594" on 
my map. This is actually the hyper-accurate information from the database: 
https://www.openstreetmap.org/node/32969675 (there's any more such examples). 
Since I do not know the reason for this value, I don't want to change the 
database.
Does mkgmap provide a function similar to Math.round() or should I simply use 
${ele|part:".:1"} to skip the decimals?
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] rounding hyper-accurate elevations ${ele}

2020-02-12 Thread J J
I was slightly surprised when I discovered the altitude "241.934997558594"
on my map. This is actually the hyper-accurate information from the
database: https://www.openstreetmap.org/node/32969675 (there's any more
such examples). Since I do not know the reason for this value, I don't want
to change the database.
Does mkgmap provide a function similar to Math.round() or should I simply
use ${ele|part:".:1"} to skip the decimals?
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

[mkgmap-dev] Minor documentation update

2020-02-12 Thread Mike Baggaley
Hi Gerd, now that my previous documentation patch has been committed, I have
noticed a couple of errors in it that I didn't notice because I didn't have
the means to compile it into the web pages. Please find attached a small
patch that corrects these errors and adds some information on the input
files, primarily to describe typ file compilation. I have also slightly
tweaked the code for generating the options file from options.txt, but as
the previous version does not appear to be in SVN, this has come across as a
complete file, rather than the change (which is just the deletion of the
hyphen character in 'if (line.startsWith(";-")) {').

Regards,
Mike


doc-minor.patch
Description: Binary data
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Re: [mkgmap-dev] Garmin Lines Visibility

2020-02-12 Thread jan meisters
Hi Steph,

looks like we have the same workflow - with a mistake in mine.
So I remembered the Header size option of TypViewer, which is always defaulted 
to 91: switched to 110 (or higher) the problem is gone.

Jan

> Am 11.02.2020 um 16:49 schrieb Steph :
> 
> Hi Jan,
> 
> I use a .txt type file from TypViewer.
> In my points file, I got "amenity=taxi [0x13703 resolution 24]".
> No problem to process with mkgmap and this .txt. If I load the generated .typ 
> in TypViewer, all seems correct.
> 
> Regards.
> 
> Steph
> 
> Le 11/02/2020 à 14:35, jan meisters a écrit :
>> I played with 3-digit points and found mkgmap not being able to compile a 
>> Typ file containing these.
>> E.g. points with code 0x137/00-0x137/09 appear in the compiled typ as points 
>> with the same code 0x001/00 for all of them.
>> My input file is a txt-file prepared with TypViewer, with which I can save 
>> such a file as Typ correctly.
>> I never stumbled upon this before, but it might be known to others.
>> Is there a workaround, or a mistake by me?
>> Jan
> ___
> 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