您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Creates polygons for MapRaid groups in a WME "MAPRAID BILBAO Groups" layer
// ==UserScript== // @name WME MAPRAID BILBAO Overlay // @namespace https://greasyfork.org/users/5252 // @description Creates polygons for MapRaid groups in a WME "MAPRAID BILBAO Groups" layer // @include https://www.waze.com/editor/* // @include https://www.waze.com/*/editor/* // @include https://editor-beta.waze.com/* // @version 1.8 // @grant none // @copyright 2014 davielde // ==/UserScript== //--------------------------------------------------------------------------------------- //generated by rickzabel's overlay generator //RZ RaidName will be replaced by the name of the layer in your KML file //RZ RaidNameNoSpaces will be replaced by the name of the layer in your KML file //RZ AreaPoints will be replaced by the names, colors, and area points from your KML file setTimeout(InitMapRaidOverlay, 1000); function AddRaidPolygon(raidLayer,groupPoints,groupColor,groupNumber){ var mro_Map = Waze.map; var mro_OL = OpenLayers; var raidGroupLabel = 'Raid Group ' + groupNumber; var groupName = 'RaidGroup' + groupNumber; var style = { strokeColor: groupColor, strokeOpacity: .8, strokeWidth: 3, fillColor: groupColor, fillOpacity: 0.15, label: raidGroupLabel, labelOutlineColor: "black", labelOutlineWidth: 3, fontSize: 14, fontColor: groupColor, fontOpacity: .85, fontWeight: "bold" }; var attributes = { name: groupName, number: groupNumber }; var pnt= []; for(i=0;i<groupPoints.length;i++){ convPoint = new OpenLayers.Geometry.Point(groupPoints[i].lon,groupPoints[i].lat).transform(new OpenLayers.Projection("EPSG:4326"), mro_Map.getProjectionObject()); //console.log('MapRaid: ' + JSON.stringify(groupPoints[i]) + ', ' + groupPoints[i].lon + ', ' + groupPoints[i].lat); pnt.push(convPoint); } var ring = new mro_OL.Geometry.LinearRing(pnt); var polygon = new mro_OL.Geometry.Polygon([ring]); var feature = new mro_OL.Feature.Vector(polygon,attributes,style); raidLayer.addFeatures([feature]); } function CurrentRaidLocation(raid_mapLayer){ var mro_Map = Waze.map; for(i=0;i<raid_mapLayer.features.length;i++){ var raidMapCenter = mro_Map.getCenter(); var raidCenterPoint = new OpenLayers.Geometry.Point(raidMapCenter.lon,raidMapCenter.lat); var raidCenterCheck = raid_mapLayer.features[i].geometry.components[0].containsPoint(raidCenterPoint); //console.log('MapRaid: ' + raid_mapLayer.features[i].attributes.number + ': ' + raidCenterCheck); if(raidCenterCheck === true){ var raidLocationLabel = 'Raid Group ' + raid_mapLayer.features[i].attributes.number + ' - ' + $('.WazeControlLocationInfo').text(); //setTimeout(function(){$('.WazeControlLocationInfo').text(raidLocationLabel);},200); setTimeout(function(){$('.WazeControlLocationInfo').text(raidLocationLabel);},50); var str = $('.WazeControlLocationInfo').text(); var n2 = str.indexOf(" - "); if(n2 > 0){ var n = str.length; var res = str.substring(n2+2, n); var rescount = res.indexOf(" - "); if(rescount>0){ var n3 = res.length; var res2 = res.substring(rescount+2, n3); } var raidLocationLabel = 'Raid Group ' + raid_mapLayer.features[i].attributes.number + ' - ' + res2; } else { var raidLocationLabel = 'Raid Group ' + raid_mapLayer.features[i].attributes.number + ' - ' + $('.WazeControlLocationInfo').text(); } setTimeout(function(){$('.WazeControlLocationInfo').text(raidLocationLabel);},200); } } } function InitMapRaidOverlay(){ var mro_Map = Waze.map; var mro_OL = OpenLayers; //if (!mro_Map) return; //if (!mro_OL) return; var mro_mapLayers = mro_Map.getLayersBy("uniqueName","__MAPRAIDBILBAO"); var raid_mapLayer = new mro_OL.Layer.Vector("MAPRAID BILBAO", { displayInLayerSwitcher: true, uniqueName: "__MAPRAIDBILBAO" }); I18n.translations.en.layers.name["__MAPRAIDBILBAO"] = "MAPRAID BILBAO"; mro_Map.addLayer(raid_mapLayer); raid_mapLayer.setVisibility(true); var VROJO = [{lon:'-3.0844331',lat:'43.3818462'},{lon:'-3.1607062',lat:'43.36071869999999'},{lon:'-3.0085373',lat:'43.2654563'},{lon:'-2.9728317000000004',lat:'43.2919509'},{lon:'-2.9826296',lat:'43.3105793'},{lon:'-3.0109406',lat:'43.3201823'},{lon:'-3.018247',lat:'43.32433970000001'},{lon:'-3.0258939',lat:'43.3336439'},{lon:'-3.0312469',lat:'43.35037820000001'},{lon:'-3.0406297',lat:'43.3612214'},{lon:'-3.0844331',lat:'43.3818462'}]; AddRaidPolygon(raid_mapLayer, VROJO,"#A61B4A","ROJO"); var VVERDE = [{lon:'-3.0844331',lat:'43.3818462'},{lon:'-3.0406297',lat:'43.3612214'},{lon:'-3.0312469',lat:'43.35037820000001'},{lon:'-3.0258939',lat:'43.3336439'},{lon:'-3.0208969',lat:'43.326426500000004'},{lon:'-3.0130965',lat:'43.321051'},{lon:'-2.9826296',lat:'43.3105793'},{lon:'-2.9728317000000004',lat:'43.2919509'},{lon:'-2.8993606000000005',lat:'43.3472772'},{lon:'-2.9979736',lat:'43.406628899999994'},{lon:'-3.0844331',lat:'43.3818462'}]; AddRaidPolygon(raid_mapLayer, VVERDE,"#7C3592","VERDE"); var VAMARILLO = [{lon:'-3.0085373',lat:'43.2654563'},{lon:'-2.9004717',lat:'43.1972555'},{lon:'-2.8219414',lat:'43.2258649'},{lon:'-2.8200833999999997',lat:'43.22727280000001'},{lon:'-2.819495200000001',lat:'43.2280694'},{lon:'-2.819409399999999',lat:'43.2291638'},{lon:'-2.8199673',lat:'43.2301644'},{lon:'-2.8212976999999997',lat:'43.231239'},{lon:'-2.824139100000001',lat:'43.2313983'},{lon:'-2.8277507999999996',lat:'43.2317052'},{lon:'-2.8312968999999995',lat:'43.2303521'},{lon:'-2.834887699999999',lat:'43.2284392'},{lon:'-2.8380152000000005',lat:'43.2265749'},{lon:'-2.8448582',lat:'43.22428569999999'},{lon:'-2.8465515',lat:'43.2243689'},{lon:'-2.8482087',lat:'43.225662199999995'},{lon:'-2.8494500999999994',lat:'43.2295078'},{lon:'-2.8501428',lat:'43.2306934'},{lon:'-2.851338399999999',lat:'43.2314777'},{lon:'-2.8522964000000006',lat:'43.2317651'},{lon:'-2.8544712',lat:'43.2309149'},{lon:'-2.8579659000000004',lat:'43.2301236'},{lon:'-2.8617756',lat:'43.23015550000001'},{lon:'-2.8669603000000015',lat:'43.23117740000001'},{lon:'-2.8686761999999995',lat:'43.2323532'},{lon:'-2.870779',lat:'43.235010900000006'},{lon:'-2.8717524',lat:'43.2374333'},{lon:'-2.8726164',lat:'43.2381822'},{lon:'-2.8751134999999994',lat:'43.239044'},{lon:'-2.8764583',lat:'43.23998609999999'},{lon:'-2.8765017000000004',lat:'43.2420771'},{lon:'-2.8771305',lat:'43.2427956'},{lon:'-2.8795767',lat:'43.2440148'},{lon:'-2.882838200000001',lat:'43.2451089'},{lon:'-2.8848124000000013',lat:'43.24545280000002'},{lon:'-2.8875926',lat:'43.244840999999994'},{lon:'-2.8915554',lat:'43.243243500000005'},{lon:'-2.8948212999999994',lat:'43.2402615'},{lon:'-2.8962278',lat:'43.2399507'},{lon:'-2.8978157000000007',lat:'43.2400445'},{lon:'-2.8994465',lat:'43.24032580000001'},{lon:'-2.9005034000000003',lat:'43.24069749999999'},{lon:'-2.9015165',lat:'43.2415776'},{lon:'-2.9018729',lat:'43.2427523'},{lon:'-2.9018068000000006',lat:'43.2435459'},{lon:'-2.901044499999999',lat:'43.24447269999999'},{lon:'-2.8977139',lat:'43.2457999'},{lon:'-2.8958638',lat:'43.2468614'},{lon:'-2.89464',lat:'43.2479536'},{lon:'-2.892453200000001',lat:'43.249437500000006'},{lon:'-2.8902332',lat:'43.2518105'},{lon:'-2.8904614',lat:'43.2527241'},{lon:'-2.891161700000001',lat:'43.2534501'},{lon:'-2.8925622',lat:'43.2537445'},{lon:'-2.8939627999999993',lat:'43.2536637'},{lon:'-2.8962488000000004',lat:'43.252502'},{lon:'-2.8994472000000004',lat:'43.248928000000014'},{lon:'-2.904253',lat:'43.2455778'},{lon:'-2.906266700000001',lat:'43.2451956'},{lon:'-2.913711',lat:'43.2457578'},{lon:'-2.9150793',lat:'43.2454502'},{lon:'-2.9182677',lat:'43.2430415'},{lon:'-2.9202013',lat:'43.242393199999995'},{lon:'-2.9224424',lat:'43.2427698'},{lon:'-2.9231008',lat:'43.244288'},{lon:'-2.921059',lat:'43.24602409999999'},{lon:'-2.9207544',lat:'43.2473294'},{lon:'-2.9218037',lat:'43.251068'},{lon:'-2.9225501',lat:'43.2517488'},{lon:'-2.9227053',lat:'43.2544332'},{lon:'-2.9247504',lat:'43.2553515'},{lon:'-2.9266826',lat:'43.25711719999999'},{lon:'-2.9271866',lat:'43.2583592'},{lon:'-2.923794',lat:'43.2621401'},{lon:'-2.9242307000000007',lat:'43.2636435'},{lon:'-2.9322719000000004',lat:'43.2694875'},{lon:'-2.9387018000000005',lat:'43.2697942'},{lon:'-2.9405357999999997',lat:'43.2695137'},{lon:'-2.947096999999999',lat:'43.26738239999999'},{lon:'-2.9513784000000003',lat:'43.2674232'},{lon:'-2.9561653',lat:'43.268066700000006'},{lon:'-2.9611066000000004',lat:'43.27116529999999'},{lon:'-2.9728317000000004',lat:'43.2919509'},{lon:'-3.0085373',lat:'43.2654563'}]; AddRaidPolygon(raid_mapLayer, VAMARILLO,"#7C3592","AMARILLO"); var VAZUL = [{lon:'-2.9728317000000004',lat:'43.2919509'},{lon:'-2.9611066000000004',lat:'43.27116529999999'},{lon:'-2.9561653',lat:'43.268066700000006'},{lon:'-2.9513784000000003',lat:'43.2674232'},{lon:'-2.9470969999999994',lat:'43.267382399999995'},{lon:'-2.9405357999999997',lat:'43.2695137'},{lon:'-2.9387018000000005',lat:'43.2697942'},{lon:'-2.9322719000000004',lat:'43.2694875'},{lon:'-2.9242307000000003',lat:'43.2636435'},{lon:'-2.923794',lat:'43.2621401'},{lon:'-2.9271866',lat:'43.2583592'},{lon:'-2.9266826',lat:'43.257117199999996'},{lon:'-2.9247504',lat:'43.2553515'},{lon:'-2.9227053',lat:'43.2544332'},{lon:'-2.9225501',lat:'43.2517488'},{lon:'-2.9218037',lat:'43.251068'},{lon:'-2.9207544',lat:'43.2473294'},{lon:'-2.921059',lat:'43.24602409999999'},{lon:'-2.9231008',lat:'43.244288'},{lon:'-2.9224424',lat:'43.2427698'},{lon:'-2.9202013',lat:'43.242393199999995'},{lon:'-2.9182677',lat:'43.2430415'},{lon:'-2.9150793',lat:'43.2454502'},{lon:'-2.913711',lat:'43.2457578'},{lon:'-2.9062667000000006',lat:'43.2451956'},{lon:'-2.904253',lat:'43.2455778'},{lon:'-2.8994472000000004',lat:'43.24892800000001'},{lon:'-2.8962488000000004',lat:'43.252502'},{lon:'-2.8939627999999997',lat:'43.2536637'},{lon:'-2.8925622',lat:'43.2537445'},{lon:'-2.8911617000000005',lat:'43.2534501'},{lon:'-2.8904614',lat:'43.2527241'},{lon:'-2.8902332',lat:'43.2518105'},{lon:'-2.8924532000000007',lat:'43.249437500000006'},{lon:'-2.89464',lat:'43.2479536'},{lon:'-2.8958638',lat:'43.2468614'},{lon:'-2.8977139',lat:'43.2457999'},{lon:'-2.9010444999999994',lat:'43.244472699999996'},{lon:'-2.9018068000000006',lat:'43.2435459'},{lon:'-2.9018729',lat:'43.2427523'},{lon:'-2.9015165',lat:'43.2415776'},{lon:'-2.9005034000000003',lat:'43.240697499999996'},{lon:'-2.8994465',lat:'43.24032580000001'},{lon:'-2.8978157000000007',lat:'43.2400445'},{lon:'-2.8962278',lat:'43.2399507'},{lon:'-2.8948212999999994',lat:'43.2402615'},{lon:'-2.8915554',lat:'43.243243500000005'},{lon:'-2.8875926',lat:'43.244840999999994'},{lon:'-2.884812400000001',lat:'43.24545280000001'},{lon:'-2.8828382000000006',lat:'43.2451089'},{lon:'-2.8795767',lat:'43.2440148'},{lon:'-2.8771305',lat:'43.2427956'},{lon:'-2.8765017000000004',lat:'43.2420771'},{lon:'-2.8764583',lat:'43.239986099999996'},{lon:'-2.8751134999999994',lat:'43.239044'},{lon:'-2.8726164',lat:'43.2381822'},{lon:'-2.8717524',lat:'43.2374333'},{lon:'-2.8708240000000003',lat:'43.2347929'},{lon:'-2.8686761999999995',lat:'43.2323532'},{lon:'-2.8669603000000006',lat:'43.23117740000001'},{lon:'-2.8617756',lat:'43.23015550000001'},{lon:'-2.8579659000000004',lat:'43.2301236'},{lon:'-2.8544712',lat:'43.2309149'},{lon:'-2.8522964000000006',lat:'43.2317651'},{lon:'-2.8513383999999995',lat:'43.2314777'},{lon:'-2.8501428',lat:'43.2306934'},{lon:'-2.8494500999999994',lat:'43.2295078'},{lon:'-2.8482087',lat:'43.225662199999995'},{lon:'-2.8465515',lat:'43.2243689'},{lon:'-2.8448582',lat:'43.224285699999996'},{lon:'-2.8380152000000005',lat:'43.2265749'},{lon:'-2.8315644999999994',lat:'43.23023609999999'},{lon:'-2.8277507999999996',lat:'43.2317052'},{lon:'-2.8212976999999997',lat:'43.231239'},{lon:'-2.8199673',lat:'43.2301644'},{lon:'-2.8194093999999996',lat:'43.2291638'},{lon:'-2.8194952000000004',lat:'43.2280694'},{lon:'-2.8200833999999997',lat:'43.22727280000001'},{lon:'-2.8219414',lat:'43.2258649'},{lon:'-2.7452920000000005',lat:'43.25379220000001'},{lon:'-2.8993606000000005',lat:'43.3472772'},{lon:'-2.9728317000000004',lat:'43.2919509'}]; AddRaidPolygon(raid_mapLayer, VAZUL,"#A61B4A","AZUL"); setTimeout(function(){CurrentRaidLocation(raid_mapLayer);},3000); mro_Map.events.register("moveend", Waze.map, function(){CurrentRaidLocation(raid_mapLayer);}); mro_Map.events.register("zoomend", Waze.map, function(){CurrentRaidLocation(raid_mapLayer);}); }