<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi Maxim,<br><br>please can you explain the reason for the change in ValueItem?<br><br>Gerd<br><br><div><hr id="stopSpelling">From: maxc@gmx.de<br>To: mkgmap-dev@lists.mkgmap.org.uk<br>Date: Wed, 28 Jan 2015 12:12:25 +0100<br>Subject: [mkgmap-dev] Patch: New filter "not-contained"<br><br><div style="font-family:Verdana;font-size:12.0px;"><div>Hello!<br>
<br>
I've attached a patch with a new filter that helps while processing, for example, public transport relations. The reason: there can be multiple route relations with the same ref attribute (for example, one for the forward direction, one for the return direction), combined to a route_master relation.</div>
<div>If you want a name for a way to contain the refs of all of the routes going through that way, you have a problem that some refs will be present more than once, similar to "1,1,2,2,2" (if we assume that route 1 has two instances, and route 2 - three instances).</div>
<div>The new filter helps to circumvent this. It takes 2 parameters: a delimiter (a comma in the example above) and the name of a tag containg the list. The filter works a bit like the "not-equal" filter, but it doesn't just compare two values; instead it looks if the tag's value (to which the filter is being applied) is contained in the list from the (other) given tag. If it is not the case, the value can be added to the list, otherwise the tag is considered unset.</div>
<div> </div>
<div>Simple example for relations file:</div>
<div> </div>
<div>type=route & route=bus & ref=* {<br>
apply {<br>
set route_ref='$(route_ref),${ref|not-contained:,:route_ref}' | '$(route_ref)' | '${ref}';<br>
}<br>
}</div>
<div> </div>
<div>Here, ref value is only added to route_ref if it is not already contained in that list (with separator ','). Otherwise, the value of route_ref is unchanged.<br>
<br>
Cheers!<br>
Max</div></div><br>_______________________________________________
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev</div>                                            </div></body>
</html>