[Script] FC Highlights

Discussion for the unofficial, community-developed addons, extensions and scripts built for the Waze Map Editor.

The official index of these tools is the Community Plugins, Extensions and Tools wiki page.

Moderators: Unholy, bextein

Forum rules
Discussion for the unofficial, community-developed addons, extensions and scripts built for the Waze Map Editor.

DO NOT START a new thread unless it is about a new idea. Keep discussion of existing tools within the main thread for that tool.

The official index of these tools is the Community Plugins, Extensions and Tools wiki page.

Re: [Script] FC Highlights

Postby voludu2 » Mon Nov 17, 2014 4:44 pm

Cleaning my glasses again....
so many interfaces. so little brainpower.

Thanks

ImageState Manager - Pennsylvania
Country Manager - USA and Thailand
Wiki Master, Global Mentor
utilitas, simplicitas, retentionis
voludu2
Map Editor - Level 5
Map Editor - Level 5
 
Posts: 5152
Joined: Thu Jul 24, 2014 12:33 pm
Location: Chester County, Pennsylvania
Has thanked: 575 times
Been thanked: 906 times

Re: [Script] FC Highlights

Postby voludu2 » Mon Nov 17, 2014 4:35 pm

I am finding this quite useful. Thanks!

Would it be possible to include a checkbox or button to temporarily turn it off while investigating something else nearby? Sometimes FC hightlighter, Color Highlighter, and toolbox all want to highlight the same segment(s), and it is useful to see just one at a time, without refreshing the whole browser.

Thanks again for a useful extension.

ImageState Manager - Pennsylvania
Country Manager - USA and Thailand
Wiki Master, Global Mentor
utilitas, simplicitas, retentionis
voludu2
Map Editor - Level 5
Map Editor - Level 5
 
Posts: 5152
Joined: Thu Jul 24, 2014 12:33 pm
Location: Chester County, Pennsylvania
Has thanked: 575 times
Been thanked: 906 times

Re: [Script] FC Highlights

Postby voludu2 » Wed Aug 27, 2014 9:24 pm

Actually, I thought about this and realized I was going about it all wrong.

I took another approach that made your script work perfectly.

* I started with the bootstrap.user.js file that the original used, and modified it to call your FC Highlights file.
* I also used the manifest.json file to specify the resources used (it won't load them if they aren't in the manifest). I removed any lines I could not understand from that file, including the key.

This seems to work perfectly. None of those silly errors with Waze or W not being defined.

I attached a zip of the directory
MyExtension12345.zip
(67.59 KiB) Downloaded 29 times

ImageState Manager - Pennsylvania
Country Manager - USA and Thailand
Wiki Master, Global Mentor
utilitas, simplicitas, retentionis
voludu2
Map Editor - Level 5
Map Editor - Level 5
 
Posts: 5152
Joined: Thu Jul 24, 2014 12:33 pm
Location: Chester County, Pennsylvania
Has thanked: 575 times
Been thanked: 906 times

Re: [Script] FC Highlights

Postby voludu2 » Wed Aug 27, 2014 4:15 pm

Uncaught ReferenceError: Waze is not defined
Waze.map.events.register("zoomend", null, FChighlightSegments);


To fix this, find
// register some events...
Waze.map.events.register("zoomend", null, FChighlightSegments);


And add before that
Waze = unsafeWindow.Waze;


In the Color Highlighter, this is handled in a function, with a little care to make sure that Waze is a global.

And, yes
Colour Highlights is working for you with dummyElem.setAttribute('onclick', 'return window');

I don't know why it works in one script and not in the other. Something else must be different between them, but I don't know what it is.

ImageState Manager - Pennsylvania
Country Manager - USA and Thailand
Wiki Master, Global Mentor
utilitas, simplicitas, retentionis
voludu2
Map Editor - Level 5
Map Editor - Level 5
 
Posts: 5152
Joined: Thu Jul 24, 2014 12:33 pm
Location: Chester County, Pennsylvania
Has thanked: 575 times
Been thanked: 906 times

Re: [Script] FC Highlights

Postby voludu2 » Wed Aug 27, 2014 3:28 pm

Source of problem:
Uncaught TypeError: Property 'onclick' of object #<HTMLParagraphElement> is not a function script.js:43

fix:
find
dummyElem.setAttribute('onclick', 'return window');

and replace with
dummyElem.onclick= function(){return window;};


Dell 32-bit
Windows 7 Home
Chrome Version 33.0.1750.146

ImageState Manager - Pennsylvania
Country Manager - USA and Thailand
Wiki Master, Global Mentor
utilitas, simplicitas, retentionis
voludu2
Map Editor - Level 5
Map Editor - Level 5
 
Posts: 5152
Joined: Thu Jul 24, 2014 12:33 pm
Location: Chester County, Pennsylvania
Has thanked: 575 times
Been thanked: 906 times

Re: [Script] FC Highlights

Postby voludu2 » Tue Aug 26, 2014 11:55 pm

I just installed this in Chrome, started a new Chrome window -- and don't see any sort of Highlights tab.
What have I done wrong?

I did try installing Timbones' color highlighter. That seems to work just fine. Then I disabled it and re-enabled the FC highlighter -- nothing.

It seems like a very good idea, and I'd like to help with the testing.

ImageState Manager - Pennsylvania
Country Manager - USA and Thailand
Wiki Master, Global Mentor
utilitas, simplicitas, retentionis
voludu2
Map Editor - Level 5
Map Editor - Level 5
 
Posts: 5152
Joined: Thu Jul 24, 2014 12:33 pm
Location: Chester County, Pennsylvania
Has thanked: 575 times
Been thanked: 906 times

Re: [Script] FC Highlights

Postby tonestertm » Sun Aug 03, 2014 9:26 am

AdreNalinGuY wrote:How is the work going folks? Anything ready for beta testing or not? :D
There's a (mostly) unwritten rule in Developer forums that the best way to ask about progress is to not. :)

Sometimes it is considered acceptable to post something like, "Really looking forward to this" or some such. Remember, this is all volunteer labor. ;)
tonestertm
US Waze Champs
US Waze Champs
 
Posts: 2433
Joined: Wed Nov 14, 2012 12:02 pm
Location: City of...um, Angels, CA, USA
Has thanked: 498 times
Been thanked: 813 times

Re: [Script] FC Highlights

Postby Timbones » Tue Aug 05, 2014 7:20 pm

Actually, the highlights stay when the road layer is turned off, as it's only the images that disappear. You can still select and edit the segments...
Timbones(6) • UK Coordinator • Forum Moderator • Global Wiki Moderator • Routing Expert
Extensions: WME Colour HighlightsWME Route TesterWME Geometries
Timbones
Coordinators
Coordinators
 
Posts: 11210
Joined: Wed Feb 09, 2011 10:33 am
Location: York, UK
Has thanked: 991 times
Been thanked: 2712 times

Re: [Script] FC Highlights

Postby Timbones » Tue Aug 05, 2014 11:02 am

There's no licence on my code, so you're free make a copy of it if you wish (as many other people have).

However, the way my script adds the colour is rather hacky and out-dated, as it modifies existing invisible line objects that WME created for hovering and selecting. The better (proper) method would be to create a completely new layer (which appears in the layer selection panel), and draw new line objects for all of your roads. This is how Validator highlights roads, which is much neater than my hacky method. (I looked at changing WMECH to use it's own layer, but it was too much work).

Have a look at my Route Checker script for some simple code that adds line objects to a layer.
There's a lot to do to make this script work for FC though:

  • Create a new OL.Layer.Vector during initialisation
  • Iterate through Waze.segments.objects and extract the geometry.components from each
  • Figure out the appropriate segment colour for the segment by reading attributes.roadType
  • Create a new OL.Geometry.LineString and add it to the layer
  • Add listeners for mergeend and zoomend events and add new segments to the layer
  • Add labels to some of the segments, but not all of them. Maybe based on length and zoom
Tip: explore the properties of an object by selecting something in the editor, and typing this line into the developer console. You'll want to look at the attributes and the geometry:

Code: Select all
Waze.selectionManager.selectedItems[0]

Hope that helps, somehow... :geek:
Timbones(6) • UK Coordinator • Forum Moderator • Global Wiki Moderator • Routing Expert
Extensions: WME Colour HighlightsWME Route TesterWME Geometries
Timbones
Coordinators
Coordinators
 
Posts: 11210
Joined: Wed Feb 09, 2011 10:33 am
Location: York, UK
Has thanked: 991 times
Been thanked: 2712 times

Re: [Script] FC Highlights

Postby Timbones » Tue Aug 05, 2014 12:56 am

The ideal solution would be to turn off the road layer, and draw your own using the FC colors. All the streets. And add street labels.

I don't know why Waze don't do this already...
Timbones(6) • UK Coordinator • Forum Moderator • Global Wiki Moderator • Routing Expert
Extensions: WME Colour HighlightsWME Route TesterWME Geometries
Timbones
Coordinators
Coordinators
 
Posts: 11210
Joined: Wed Feb 09, 2011 10:33 am
Location: York, UK
Has thanked: 991 times
Been thanked: 2712 times

Next

Return to Addons, Extensions, and Scripts

Who is online

Users browsing this forum: KuniaKid, MapOMatic