WME Melbourne Australia Overlay

Creates polygons for MapRaid groups in a WME "Melbourne Australia Groups" layer

  1. // ==UserScript==
  2. // @name WME Melbourne Australia Overlay
  3. // @namespace https://gf.qytechs.cn/users/5252
  4. // @description Creates polygons for MapRaid groups in a WME "Melbourne Australia Groups" layer
  5. // @include https://www.waze.com/editor/*
  6. // @include https://www.waze.com/*/editor/*
  7. // @include https://editor-beta.waze.com/*
  8. // @version 2.3
  9. // @grant none
  10. // @copyright 2014 davielde
  11. // ==/UserScript==
  12.  
  13.  
  14. //---------------------------------------------------------------------------------------
  15.  
  16.  
  17. //generated by rickzabel's overlay generator
  18.  
  19. //RZ RaidName will be replaced by the name of the layer in your KML file
  20. //RZ RaidNameNoSpaces will be replaced by the name of the layer in your KML file
  21. //RZ AreaPoints will be replaced by the names, colors, and area points from your KML file
  22.  
  23. setTimeout(InitMapRaidOverlay, 1000);
  24.  
  25. function AddRaidPolygon(raidLayer,groupPoints,groupColor,groupNumber){
  26. var mro_Map = Waze.map;
  27. var mro_OL = OpenLayers;
  28. var raidGroupLabel = 'Raid Group ' + groupNumber;
  29. var groupName = 'RaidGroup' + groupNumber;
  30. var style = {
  31. strokeColor: groupColor,
  32. strokeOpacity: .8,
  33. strokeWidth: 3,
  34. fillColor: groupColor,
  35. fillOpacity: 0.15,
  36. label: raidGroupLabel,
  37. labelOutlineColor: "black",
  38. labelOutlineWidth: 3,
  39. fontSize: 14,
  40. fontColor: groupColor,
  41. fontOpacity: .85,
  42. fontWeight: "bold"
  43. };
  44. var attributes = {
  45. name: groupName,
  46. number: groupNumber
  47. };
  48. var pnt= [];
  49. for(i=0;i<groupPoints.length;i++){
  50. convPoint = new OpenLayers.Geometry.Point(groupPoints[i].lon,groupPoints[i].lat).transform(new OpenLayers.Projection("EPSG:4326"), mro_Map.getProjectionObject());
  51. //console.log('MapRaid: ' + JSON.stringify(groupPoints[i]) + ', ' + groupPoints[i].lon + ', ' + groupPoints[i].lat);
  52. pnt.push(convPoint);
  53. }
  54. var ring = new mro_OL.Geometry.LinearRing(pnt);
  55. var polygon = new mro_OL.Geometry.Polygon([ring]);
  56. var feature = new mro_OL.Feature.Vector(polygon,attributes,style);
  57. raidLayer.addFeatures([feature]);
  58.  
  59. }
  60.  
  61. function CurrentRaidLocation(raid_mapLayer){
  62. var mro_Map = Waze.map;
  63.  
  64. for(i=0;i<raid_mapLayer.features.length;i++){
  65. var raidMapCenter = mro_Map.getCenter();
  66. var raidCenterPoint = new OpenLayers.Geometry.Point(raidMapCenter.lon,raidMapCenter.lat);
  67. var raidCenterCheck = raid_mapLayer.features[i].geometry.components[0].containsPoint(raidCenterPoint);
  68. var holes = raid_mapLayer.features[i].attributes.holes
  69. if(raidCenterCheck === true){
  70.  
  71. //var str = $('#topbar-container > div > div.location-info-region > div').text();
  72. var str = $('#topbar-container > div > div.topbar > div.location-info-region > div.location-info').text();
  73. var n2 = str.indexOf(" - ");
  74. if(n2 > 0){
  75. var n = str.length;
  76. var res = str.substring(n2+2, n);
  77. var rescount = res.indexOf(" - ");
  78. if(rescount>0){
  79. var n3 = res.length;
  80. var res2 = res.substring(rescount+2, n3);
  81. }
  82. var raidLocationLabel = 'County - ' + raid_mapLayer.features[i].attributes.number + ' - ' + res2;
  83.  
  84. } else {
  85. //var raidLocationLabel = 'County - ' + raid_mapLayer.features[i].attributes.number + ' - ' + $('#topbar-container > div > div.location-info-region > div').text();
  86. var raidLocationLabel = 'County - ' + raid_mapLayer.features[i].attributes.number + ' - ' + $('#topbar-container > div > div.topbar > div.location-info-region > div.location-info').text();
  87. }
  88. //setTimeout(function(){$('#topbar-container > div > div.location-info-region > div').text(raidLocationLabel);},200);
  89. setTimeout(function(){$('#topbar-container > div > div.topbar > div.location-info-region > div.location-info').text(raidLocationLabel);},200);
  90. if (holes === "false") { break; }
  91. }
  92. }
  93. }
  94.  
  95.  
  96. function InitMapRaidOverlay(){
  97.  
  98. var mro_Map = Waze.map;
  99. var mro_OL = OpenLayers;
  100.  
  101. //if (!mro_Map) return;
  102. //if (!mro_OL) return;
  103.  
  104. var mro_mapLayers = mro_Map.getLayersBy("uniqueName","__MelbourneAustralia");
  105. var raid_mapLayer = new mro_OL.Layer.Vector("Melbourne Australia", {
  106. displayInLayerSwitcher: true,
  107. uniqueName: "__MelbourneAustralia"
  108. });
  109. I18n.translations.en.layers.name["__MelbourneAustralia"] = "Melbourne Australia";
  110. mro_Map.addLayer(raid_mapLayer);
  111. raid_mapLayer.setVisibility(true);
  112.  
  113. var VGroup1 = [{lon:'144.087969',lat:'-38.45902160000001'},{lon:'144.634443',lat:'-38.3176954'},{lon:'144.7950905',lat:'-38.1968961'},{lon:'144.684427',lat:'-38.0754777'},{lon:'144.6892995',lat:'-38.0076958'},{lon:'144.1831543',lat:'-38.0276586'},{lon:'144.087969',lat:'-38.45902160000001'}];
  114. AddRaidPolygon(raid_mapLayer, VGroup1,"#7C3592","Group 1");
  115.  
  116. var VGroup2 = [{lon:'144.1831543',lat:'-38.0276586'},{lon:'144.6892995',lat:'-38.0076958'},{lon:'144.8029873',lat:'-37.92974'},{lon:'144.812209',lat:'-37.8929083'},{lon:'144.8427255',lat:'-37.5134365'},{lon:'144.3376918',lat:'-37.5581871'},{lon:'144.1831543',lat:'-38.0276586'}];
  117. AddRaidPolygon(raid_mapLayer, VGroup2,"#DB4436","Group 2");
  118.  
  119. var VGroup3 = [{lon:'144.8427255',lat:'-37.5134365'},{lon:'144.812209',lat:'-37.8929083'},{lon:'144.9086417',lat:'-37.8943262'},{lon:'145.0346751',lat:'-38.00501980000001'},{lon:'145.0964749',lat:'-38.0288265'},{lon:'145.1005931',lat:'-37.9974447'},{lon:'145.088882',lat:'-37.51517270000001'},{lon:'144.8427255',lat:'-37.5134365'}];
  120. AddRaidPolygon(raid_mapLayer, VGroup3,"#7C3592","Group 3");
  121.  
  122. var VGroup4 = [{lon:'145.088882',lat:'-37.51517270000001'},{lon:'145.1005931',lat:'-37.9974447'},{lon:'145.6457516',lat:'-37.72999600000001'},{lon:'145.39238',lat:'-37.5497493'},{lon:'145.088882',lat:'-37.51517270000001'}];
  123. AddRaidPolygon(raid_mapLayer, VGroup4,"#DB4436","Group 4");
  124.  
  125. var VGroup5 = [{lon:'145.6938496',lat:'-38.0770229'},{lon:'145.6457516',lat:'-37.72999600000001'},{lon:'145.1005931',lat:'-37.9974447'},{lon:'145.09098',lat:'-38.0764032'},{lon:'145.0847116',lat:'-38.143926'},{lon:'145.4743071',lat:'-38.2850472'},{lon:'145.6938496',lat:'-38.0770229'}];
  126. AddRaidPolygon(raid_mapLayer, VGroup5,"#7C3592","Group 5");
  127.  
  128. var VGroup6 = [{lon:'144.6518379',lat:'-38.309359099999995'},{lon:'144.89973720000003',lat:'-38.5475709'},{lon:'145.4374831',lat:'-38.5768044'},{lon:'145.4743071',lat:'-38.2850472'},{lon:'145.0847116',lat:'-38.143926'},{lon:'144.9570981',lat:'-38.2521889'},{lon:'144.7946782',lat:'-38.304867'},{lon:'144.6980981',lat:'-38.295963500000006'},{lon:'144.6518379',lat:'-38.309359099999995'}];
  129. AddRaidPolygon(raid_mapLayer, VGroup6,"#DB4436","Group 6");
  130.  
  131.  
  132. setTimeout(function(){CurrentRaidLocation(raid_mapLayer);},3000);
  133. mro_Map.events.register("moveend", Waze.map, function(){ setTimeout(function(){CurrentRaidLocation(raid_mapLayer);},1500);});
  134. mro_Map.events.register("zoomend", Waze.map, function(){ setTimeout(function(){CurrentRaidLocation(raid_mapLayer);},1500);});
  135. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址