Page 64 of 236

Re: [Script] WME Validator 1.1.19 / 04.06.2016

PostPosted: Mon Aug 29, 2016 9:05 am
by dbcm
Hi guys, i've a request for you.

I found a problem that WME Validator is not warning us about.

In a nutshell, there is a segment with one way, pointing to a dead-end, connected are one or more segments with a red arrow to that segment.

Basically you have a blackhole and you don't want people to go in.

You can see it here:
https://www.waze.com/editor/?env=row&lo ... ,140027351

in case someone fix this, here are the screenshots.

[ img ]
[ img ]


I'm detecting this issue with this prototype code:

Code: Select all
// check if you can drive from seg1 to seg2
var hasGreenFlag = function(seg, segs) {
/*
    var x = Waze.model.nodes.get(150020468);
    var s = Waze.model.segments.get(140026991);
    var s2 = Waze.model.segments.get(140027351);
    var s3 = Waze.model.segments.get(140027352);
    x.getDirectionBetweenSegments(s, s2);
    x.getDirectionBetweenSegments(s2, s);
    x.getDirectionBetweenSegments(s, s3);
    x.getDirectionBetweenSegments(s3, s);
    s2.attributes.toConnections[140026991]
*/
           
   var att = seg.attributes;
   var segId = att.id;
   
   debugger;

   for (var i = 0; i < segs.length; i++) {
      var nodeSegId = segs[i];
      if (segId === nodeSegId)
         continue;

        var nodeSeg = Waze.model.segments.get(nodeSegId);
       
        if (nodeSeg.attributes.toConnections[segId] === true) {
            return true;
        }
        if (nodeSeg.attributes.fromConnections[segId]=== true) {
            return true;
        }
       
    }
   
    return false;

}

// fix one way segments that connects to a black hole
var fxcOneWay2BlackHole = function(seg) {
   seg = Waze.model.segments.get(140026991);

   if (document.getElementById('fxc-oneway2blackhole').checked !== true) {
      return;
   }

   var attributes = seg.attributes;
   var segRoadType = attributes.roadType;

   // only process road cars...
   if (!isDrivable(seg)) {
      return;
   }

   var segId = attributes.id;
   var segRevDir = attributes.revDirection;
   var segFwdDir = attributes.fwdDirection;
   
   
   if (segRevDir === false && segFwdDir === false) {
      return;
   }
      
   if (segRevDir === false || segFwdDir === false) {
      var fromNodeId = attributes.fromNodeID;
      var fromNode = Waze.model.nodes.get(fromNodeId);
      var toNodeId = attributes.toNodeID;
      var toNode = Waze.model.nodes.get(toNodeId);

      var toNodeSegIDs = Waze.model.nodes.objects[toNodeId].attributes.segIDs;
      var fromNodeSegIDs = Waze.model.nodes.objects[fromNodeId].attributes.segIDs;

      if ((segFwdDir === false && fromNodeSegIDs.length === 1) ||
         (segRevDir === false && toNodeSegIDs.length === 1)) {
         doLog("Oh no! One way to a black hole!!!!");

         //debugger;

         var fattr = {};
         fattr.revDirection = fattr.fwdDirection = true;
         setSegmentAttributes(seg, fattr);

         var WazeActionModifyConnection = require("Waze/Action/ModifyConnection");
         if (fromNodeSegIDs.length === 1) {
                var oneGreenFlag = hasGreenFlag(seg, toNodeSegIDs);
               
            for (var j = 0; j < toNodeSegIDs.length; j++) {
               var toNodeSegID = toNodeSegIDs[j];
               if (segId === toNodeSegID)
                  continue;

               var toNodeSeg = getSegment(toNodeSegID);
               if (isDrivable(toNodeSeg)) {
                  Waze.model.actionManager.add(new WazeActionModifyConnection(segId, toNode, toNodeSegID, true));
                        // if what you have is red flags, put them all green
                        if (!oneGreenFlag) {
                      Waze.model.actionManager.add(new WazeActionModifyConnection(toNodeSegID, toNode, segId, true));
                        }
               } else {
                  doLog("Oh LOOK, drivable connected to non-drivable!!!");
               }
            }
         }
         if (toNodeSegIDs.length === 1) {
                var oneGreenFlag = hasGreenFlag(seg, fromNodeSegIDs);
               
            for (var i = 0; i < fromNodeSegIDs.length; i++) {
               var fromNodeSegID = fromNodeSegIDs[i];
               if (segId === fromNodeSegID)
                  continue;

               var fromNodeSeg = getSegment(fromNodeSegID);
               if (isDrivable(fromNodeSeg)) {
                  //console.log(segId+" _ "+ fromNodeSegID);
                  Waze.model.actionManager.add(new WazeActionModifyConnection(segId, fromNode, fromNodeSegID, true));
                        // if what you have is red flags, put them all green
                        if (!oneGreenFlag) {   
                            Waze.model.actionManager.add(new WazeActionModifyConnection(fromNodeSegID, fromNode, segId, true));
                        }
               } else {
                  doLog("Oh LOOK, drivable connected to non-drivable!!!");
               }
            }
         }
      }
   }

}

Re: [Script] WME Validator 1.1.20 / 03.11.2016

PostPosted: Mon Feb 13, 2017 9:44 am
by dbcm
In the case you are using WME Validator through Tampermonkey, here is a fix.

https://github.com/dbcm/waze#valfix-tm-plugin

Re: [Script] WME Validator 1.1.20 / 03.11.2016

PostPosted: Mon Feb 13, 2017 7:27 pm
by dbcm
Glodenox wrote:I've been able to get this to work consistently in Firefox after a couple of changes to the code of dbcm. The if statement around the proxy for require was unnecessary and I had to use window.require instead of just require to get it to work with GreaseMonkey. I've uploaded my version to GreasyFork, but I'd gladly take it down again if dbcm adjusts his version so it works on Firefox as well. I've checked with TamperMonkey and this new version works there as well.


In case you want to merge the code, do a pull request.
https://github.com/dbcm/waze/pulls

Double check that works also in Chrome with Tampermonkey

Re: [Script] WME Validator 1.1.20 / 03.11.2016

PostPosted: Mon Feb 13, 2017 8:41 pm
by dbcm
Glodenox wrote:...



Teamwork is awesome sauce

Re: [Script] WME Validator 1.1.20 / 03.11.2016

PostPosted: Wed Mar 15, 2017 3:38 pm
by dbcm
valFix 1.0.3 is out
https://dbcm.github.com/waze/valfix/valfix.user.js

Also adds Validator to layer menu.


Thanks to justins83

Re: [Script] WME Validator 1.1.20 / 03.11.2016

PostPosted: Wed Mar 15, 2017 4:21 pm
by dbcm
valFix 1.0.4 is out to enforce layer menu

https://dbcm.github.io/waze/valfix/valfix.user.js

it will appear after 5 seconds, ±

Re: [Script] WME Validator 1.1.20 / 03.11.2016

PostPosted: Sat Jul 01, 2017 6:48 am
by dbcm
Let him die, they say. LET. HIM. DIE™.

Something new is coming. soon™

[ img ]

Re: [Script] WME Validator \ CONST ZN

PostPosted: Thu Jan 30, 2014 8:24 am
by dbraughlr
I request additional options:
  • Exclude any segment with name containing "CONST ZN".
  • Flag any segments with name containing "CONST ZN".

Re: [Script] WME Validator 0.5.8 (BETA) / 31.01.2014

PostPosted: Sun Feb 02, 2014 9:23 am
by dbraughlr

Re: [Script] WME Validator 0.5.8 (BETA) / 31.01.2014

PostPosted: Sun Feb 02, 2014 9:13 pm
by dbraughlr
berestovskyy wrote:So I remove all exceptions but the "to" for the ramps, right?

For the first word of any street name, yes. Not every connector is a ramp, so road type is not a factor. If the first word is "to", it should be lowercase.

There exists a street (deKoven Dr, Middletown, CT) which starts with two lowercase letters on the BGS. This is a name, not a word, and isn't going to appear on a list; rather it is detectable by the pattern that that it matches 'de' followed immediately by a capital letter (not a space). This is the only example so far I have seen for the entire USA of a street name that is not capitalized. Some might described it as a quirk, oddity, or affectation.