Help with WME API to add roundabout helping

The place to get information and ask questions about everything to do with properly and successfully editing the Waze Map.

Use this forum for all general editing questions, and the sub-forums for specific types of Waze Map Editor features.

Moderators: Unholy, bextein

Re: Help with WME API to add roundabout helping

Postby zCougar » Sat Nov 24, 2012 9:45 pm

This looks cool. I also thought about implementing this but you are already there. Would like to use that as soon as possible ;-)

--
Cougar
Image
Waze 4.18.0.0: Nexus 4 | | Nexus 6P
CM@Estonia / WME beta tester / Android beta tester
PALUN LOE: Waze eestikeelne juhend wikis
zCougar
Waze Local Champs
Waze Local Champs
 
Posts: 904
Joined: Fri Mar 05, 2010 10:25 am
Location: Estonia
Has thanked: 233 times
Been thanked: 103 times

Re: Help with WME API to add roundabout helping

Postby Timbones » Fri Nov 23, 2012 7:54 pm

Good work!

via mobile
Timbones(6) • UK Coordinator • Forum Moderator • Global Wiki Moderator • Routing Expert
Extensions: WME Colour HighlightsWME Route TesterWME Geometries
Timbones
Coordinators
Coordinators
 
Posts: 6800
Joined: Wed Feb 09, 2011 10:33 am
Location: York, UK
Has thanked: 984 times
Been thanked: 2726 times

Re: Help with WME API to add roundabout helping

Postby Timbones » Fri Nov 23, 2012 1:12 pm

It could be an interesting feature (thank you for your PM), but unfortunately I don't know how add new lines to the editor. So far, I've only hacked the lines that already exist on the map.

Twister's scripts are able to add boxes on top of the map, but I think that he's using a separate canvas on top of WME.

If you want to do it properly, have a look at the OpenLayers API - this is what WME uses to draw the road data.
Timbones(6) • UK Coordinator • Forum Moderator • Global Wiki Moderator • Routing Expert
Extensions: WME Colour HighlightsWME Route TesterWME Geometries
Timbones
Coordinators
Coordinators
 
Posts: 6800
Joined: Wed Feb 09, 2011 10:33 am
Location: York, UK
Has thanked: 984 times
Been thanked: 2726 times

Re: Help with WME API to add roundabout helping

Postby Dennis_Halmstad » Mon Jan 07, 2013 12:04 pm

davipt wrote:
Dennis_Halmstad wrote:
davipt wrote:http://userscripts.org/scripts/show/152981


dont work.



Updated with your suggestion. Try now ;)

It works on Chrome (native install) and Tampermonkey.
Samsung Gt-i9300 "Galaxy S3" Stock 4.1.2, Latest Waze beta.
ImageImage
Dennis_Halmstad
 
Posts: 148
Joined: Fri Feb 18, 2011 7:10 am
Location: Sweden
Has thanked: 0 time
Been thanked: 2 times

Re: Help with WME API to add roundabout helping

Postby Dennis_Halmstad » Mon Jan 07, 2013 11:54 am

davipt wrote:
Ok I've updated the bootstrap but had time only to test it on Firefox and greasemonkey, can you check if it works with Chrome now?

http://userscripts.org/scripts/show/152981


dont work.

try uppdating ra_init() to
Code: Select all
function ra_init() {
    Waze = unsafeWindow.Waze;
    wazeModel = unsafeWindow.wazeModel;
    OpenLayers = unsafeWindow.OpenLayers;
    selectionManager = unsafeWindow.selectionManager;
    selectionManager.events.register("selectionchanged", null, raSelectionChanged);
}

giving the code access to Waze, wazeModel and OpenLayers

Then it works in both native and tampermonkey on chrome.
Samsung Gt-i9300 "Galaxy S3" Stock 4.1.2, Latest Waze beta.
ImageImage
Dennis_Halmstad
 
Posts: 148
Joined: Fri Feb 18, 2011 7:10 am
Location: Sweden
Has thanked: 0 time
Been thanked: 2 times

Re: Help with WME API to add roundabout helping

Postby Dennis_Halmstad » Sun Jan 06, 2013 7:35 pm

if u use the code described here it works in greasmonkey(firefox), chrome (native) and tampermonkey (chrome) http://www.waze.com/wiki/index.php/Comm ... _and_Tools

the difference is that u need to use unsafeWindow before the partsu need to access from WME.

eg if u want to use selectionManager u can reach it via
Code: Select all
unsafeWindow.selectionManager
or
Code: Select all
var selectionManager = unsafeWindow.selectionManager

and u dont need to change ur code other than the starting code. (exept adding other vars with parts u need from wme, Waze, OpenLayers eg)
Samsung Gt-i9300 "Galaxy S3" Stock 4.1.2, Latest Waze beta.
ImageImage
Dennis_Halmstad
 
Posts: 148
Joined: Fri Feb 18, 2011 7:10 am
Location: Sweden
Has thanked: 0 time
Been thanked: 2 times

Sv: Re: Help with WME API to add roundabout helping

Postby Dennis_Halmstad » Sun Jan 06, 2013 7:14 pm

davipt wrote:
Dennis_Halmstad wrote:Its a gr8 start.

It seams that it dont work if u use tampermonkey in chrome.
Its the way this script get acces to WME that causes problems. Other scripts with unsafeWindow works.


I've just copied verbatim what the other scripts were doing. I don't use chrome (I hate a browser that consumes 300MB every other week of my limited disk space) but I'll have a look at it when I can. I've tested it without any tampermonkey extension, and it was working out of the box.


It works gr8 when installed directly into chrome. But tampermonkey gives the same functionality as greasmonkey with updates and other functionality. With tampermonkey its a hole lot easier to install scripts from userscripts.org.


Skickat från min GT-I9300 via Tapatalk 2
Samsung Gt-i9300 "Galaxy S3" Stock 4.1.2, Latest Waze beta.
ImageImage
Dennis_Halmstad
 
Posts: 148
Joined: Fri Feb 18, 2011 7:10 am
Location: Sweden
Has thanked: 0 time
Been thanked: 2 times

Re: Help with WME API to add roundabout helping

Postby Dennis_Halmstad » Sun Jan 06, 2013 5:40 pm

Its a gr8 start.

It seams that it dont work if u use tampermonkey in chrome.
Its the way this script get acces to WME that causes problems. Other scripts with unsafeWindow works.
Samsung Gt-i9300 "Galaxy S3" Stock 4.1.2, Latest Waze beta.
ImageImage
Dennis_Halmstad
 
Posts: 148
Joined: Fri Feb 18, 2011 7:10 am
Location: Sweden
Has thanked: 0 time
Been thanked: 2 times

Re: Help with WME API to add roundabout helping

Postby davipt » Mon Jan 07, 2013 11:58 am

Dennis_Halmstad wrote:
davipt wrote:http://userscripts.org/scripts/show/152981


dont work.



Updated with your suggestion. Try now ;)
Bruno D. Rodrigues | Global Champ & Coordinator for Portugal | iPhone Beta
Forum PT | Wiki PT | Facebook PT | Twitter PT
davipt
Waze Global Champs
Waze Global Champs
 
Posts: 2795
Joined: Tue Nov 02, 2010 8:51 am
Location: Oeiras, Portugal
Has thanked: 282 times
Been thanked: 608 times

Re: Help with WME API to add roundabout helping

Postby davipt » Mon Jan 07, 2013 11:19 am

Dennis_Halmstad wrote:if u use the code described here it works in greasmonkey(firefox), chrome (native) and tampermonkey (chrome) http://www.waze.com/wiki/index.php/Comm ... _and_Tools

the difference is that u need to use unsafeWindow before the partsu need to access from WME.

eg if u want to use selectionManager u can reach it via
Code: Select all
unsafeWindow.selectionManager
or
Code: Select all
var selectionManager = unsafeWindow.selectionManager

and u dont need to change ur code other than the starting code. (exept adding other vars with parts u need from wme, Waze, OpenLayers eg)


Ok I've updated the bootstrap but had time only to test it on Firefox and greasemonkey, can you check if it works with Chrome now?

http://userscripts.org/scripts/show/152981
Bruno D. Rodrigues | Global Champ & Coordinator for Portugal | iPhone Beta
Forum PT | Wiki PT | Facebook PT | Twitter PT
davipt
Waze Global Champs
Waze Global Champs
 
Posts: 2795
Joined: Tue Nov 02, 2010 8:51 am
Location: Oeiras, Portugal
Has thanked: 282 times
Been thanked: 608 times

Next

Return to Waze Map Editor

Who is online

Users browsing this forum: JacobMarquis1