Hi Gerd

Attached is a patch for the function args + minor fix/tidy-up to
StyledConverter that stops it doing extra work for wayRules

I need to think about the rest, but I imagine all the special cases
where a node of a line/polygon touches a node of maybe many polygons is
about impossible to decipher!

Also major difficulties if there are overlapping polygons that match
the tagKey/Value
 
Ticker

On Wed, 2020-01-08 at 13:12 +0000, Gerd Petermann wrote:
> Hi Ticker,
> 
> regarding the shapes my current approch is to combine them before
> running insideness tests. So, the two residential areas around w18
> are combined to one,
> but the two shapes near w30 are kept separate.
> 
> I think the needed checks for ways are more or less the same as in
> the code for MultipolygonRelation.contains(WayAndLazyPolygon
> polygon1, JoinedWay polygon2)
> Maybe I'll use that code, but up to now I don't understand all of it,
> esp. the part with the 3x3 matrix starting in line 1546.
> 
> For a point I can use a variant of the wn_PnPoly() algorithm
> published here:
> http://geomalgorithms.com/a03-_inclusion.html
> 
> For segment-segment intersections we have an algorithm. It finds when
> a segment crosses or touches another segment.
> When a segment a-b is touching the boundary in b there are several
> possible cases.
> I did not find a standard solution for the question if two line
> strings a-b-c and x-b-y are crossing in b, or just touching, or if
> they are overlapping.
> That's what I am still working on. See w9, w11, w16, and w17 which
> 
> Note that most standard intersection algorithms assume that a
> crossing at the end of two line segments is a very special case. In
> OSM, this is the normal case.
> If you have an idea how to solve the problem with all the special
> cases shown in my sample file please try to code it.
> 
> My current work-in-progress solution doesn't work for w9, w11, w21*,
> w27*, b5, b6, and b18. (w21 and w27 give different results when I
> reverse the way points before testing).
> 
> If you have an idea how to implement the tests I'd be happy to get a
> patch for this as well. The current code in the branch can be used as
> sample for "what you should not do" ;)
> 
> Attached is a patch with my current work-in-progress version, lots of
> duplicated code.
> 
> Gerd
> 
> ________________________________________
> Von: mkgmap-dev <[email protected]> im Auftrag
> von Ticker Berkin <[email protected]>
> Gesendet: Mittwoch, 8. Januar 2020 12:12
> An: [email protected]
> Betreff: Re: [mkgmap-dev] Allow blanks in function parameters
> 
> Hi Gerd
> 
> I'll do patch for the function parameters shortly.
> 
> Are you trying to trying to check if a way/polygon is in all nearby
> polygons simultaneously, or just checking one-by-one until you get
> 'true'?
> 
> If one-by-one, the moment any line crosses then you can stop, with
> IN/ON/OUT all being true (unless the line/polygon folds back on
> itself). If no crossing, then need to take any point that wasn't ON
> and see if that is IN; presumably using the same logic as for POINT
> is
> -in.
> 
> The problem with the one-by-one is that multi-polygon processing
> might
> have split the target polygon and so the this simplistic method can
> give the wrong answer.
> 
> Considering all targets simultaneously looks much more complicated,
> but
> I guess you need to make a list of all crossing points and cancel out
> ones at the same position.
> 
> For POINT is-in, I guess you just cut the polygon(s) through the
> point
> and count the cuts on one side, even>OUT, odd>IN. true>ON
> 
> Ticker
> 
> On Wed, 2020-01-08 at 10:14 +0000, Gerd Petermann wrote:
> > Hi Ticker,
> > 
> > I am still struggling with the insideness tests.
> > 
> > I noticed that the scanner doesn't accept a blank in the functions
> > parameters, e.g.  these two rules are not accepted:
> > building=* & building!=no & is_in(landuse,residential, any)=false
> > [0x13 resolution 24]
> > building=* & building!=no & is_in(landuse, residential,any)=false
> > [0x13 resolution 24]
> > 
> > I'd prefer to allow this as well. Maybe you can have a look at
> > this?
> > 
> > Gerd
> _______________________________________________
> mkgmap-dev mailing list
> [email protected]
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Index: src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
===================================================================
--- src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java	(revision 4403)
+++ src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java	(working copy)
@@ -695,16 +695,13 @@
 	}
 	
 	/**
-	 * Invoked a the raw OSM data has been read and hooks run, but before any of the convertXxx() calls
-         * this is called with the ElementSaver so...
+	 * Invoked after the raw OSM data has been read and hooks run, but before any of the convertXxx() calls
 	 *
 	 * @param elementSaver Gives access to the pre-converted OSM data
 	 */
 	public void augmentWith(uk.me.parabola.mkgmap.reader.osm.ElementSaver elementSaver) {
-	    // %%%RWB
-		log.warn("elementSaver pcrl: Nodes:", elementSaver.getNodes().size(), "Ways:", elementSaver.getWays().size(), "Rels:", elementSaver.getRelations().size());
-		// %%% abd process the rles
-		wayRules.augmentWith(elementSaver);
+		// wayRules doesn't need to be done (or must be done first) because is concat. of line & polygon rules
+		//wayRules.augmentWith(elementSaver);
 		nodeRules.augmentWith(elementSaver);
 		lineRules.augmentWith(elementSaver);
 		polygonRules.augmentWith(elementSaver);
@@ -731,7 +728,6 @@
 	 * @param bbox The bounding area, must not be null.
 	 */
 	public void setBoundingBox(Area bbox) {
-		    
 		this.clipper = new AreaClipper(bbox);
 		this.bbox = bbox;
 
Index: src/uk/me/parabola/mkgmap/osmstyle/eval/ExpressionReader.java
===================================================================
--- src/uk/me/parabola/mkgmap/osmstyle/eval/ExpressionReader.java	(revision 4403)
+++ src/uk/me/parabola/mkgmap/osmstyle/eval/ExpressionReader.java	(working copy)
@@ -92,6 +92,7 @@
 				scanner.validateNext("(");
 				List<String> funcParams = new ArrayList<>();
 				do {
+					scanner.skipSpace();    
 					Token tok = scanner.peekToken();
 					if (tok.getType() != TokType.TEXT &&
 					    (tok.getType() != TokType.SYMBOL ||
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to