Greasy Fork 支持简体中文。

WME Color Errors

Adds colours to show errors

目前為 2017-03-15 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name WME Color Errors
  3. // @name:fr WME Color Errors
  4. // @version 0.35
  5. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAALuSURBVHja7Jots6swEIb7x6qiUFVVUVEoVBSqKioqU8EfqKpCRaE6FShMo5gjUCiOYebOzTXnvaKlhR44LbS9vcyQmVWdbt5nd7P5GGbr/eFjvT98jtQ+Zuv9oVzvDxiplbMTyVgBPieACWACmADeD/Bn7ABfE8D77PfYAfBUgFCt4DEKZz7H/Js5oMzDSoXPBPh6GCBSHAvSJviGkQW4it4HECmvI9IncygYY2ALcgPGgTccpD9AkQRwf4g4cQPEWYnzsDHkXRlxESTFawFixUDOkxIwIeEvLiKojFFclKPIDOJwhWWX6AWHWF35VPFrAEJeKwXHw9aUsIm8TO6GyE7S80iA3bUuCGRiUZotPKeWRR4+F0DXxBMeIrNHoUaRhhAAKCJei+htI8ocnZUGG7c+j34OQF08FTvk5xLJELJKiEICAEixWfbsRuySOSDHTtA+ED8D5Jo3nF3EA4CBqkR4p98KDd63nc4VTMNv3gga1/lwALeahCoYi6tRA5hzhFmJPFr1Kp92AADWQNHqd3cYQORX7Y1D52gZObQ3YAO7Nu86s5X7Wjb9qD/AOboihkX7SDfLhwGWm7TDu0UsLlnqDbATVR1SKGO7CEAfAqDo0m+NOvsmYjdsDXByq4wsYkkGAxDZkd1cN+YevIgbPb11IV8vuB52lz8CHhWP7QNG1foyC5CULZMWMWQfCCoRFy1+ygQBq+07yjxnJ65vLnMqELWVk82gBbvRRh24MuroOhFELQi0u+6HnYViSRuLT+gUbclAmSEOFVYeOx6nGQPzJbY6Qdb+B6RaNJoBlfFrTqNZ6DfuAIQJ6LTE0FGmGoKRRob8MHv9haY56RxkwaG0QV7am6JtkSHRCvzqokOY+Lc3slR3HJkdCuatoIIAwdmOJUWdtosMg9Dp++7EpiWad+0Bp6z9V68S6/0BgfTBvr1MOKCMwZfBs59Vfs3G/CZUvczZ6XV6ApgAJoAJYAIYM8DoP/YY9ec2fwcAaebQXj6i79wAAAAASUVORK5CYII=
  6. // @description Adds colours to show errors
  7. // @description:fr Colorisation pour afficher les erreurs
  8. // @include https://www.waze.com/editor/*
  9. // @include https://www.waze.com/*/editor/*
  10. // @include https://beta.waze.com/*
  11. // @exclude https://www.waze.com/user/*
  12. // @exclude https://www.waze.com/*/user/*
  13. // @namespace https://greasyfork.org/fr/scripts/21186-wme-color-errors
  14. // @author Sebiseba
  15. // @copyright Sebiseba 2014-2017
  16. // @grant none
  17. // ==/UserScript==
  18.  
  19. var WMECErrors={}, ColorErrors_mapLayer=[], CErrLeg, CErrSeg, CErrPoi, debug;
  20. var CErrWaze, CErrorsMap, CErrorsModel, CErrorsI18n, CErrorsOpenLayers, CErrorshandle, CErrorshandleClass, CErrorshandleClass2;
  21.  
  22. // *********************
  23. // ** HELPER FUNCTION **
  24. // *********************
  25.  
  26. function getId(node) {
  27. return document.getElementById(node);
  28. }
  29. function getElementsByClassName(classname, node) {
  30. node || (node=document.getElementsByTagName("body")[0]);
  31. for (var a=[], re=new RegExp("\\b" + classname + "\\b"), els=
  32. node.getElementsByTagName("*"), i=
  33. 0, j=
  34. els.length;i < j;i++) {
  35. re.test(els[i].className) && a.push(els[i]);
  36. }
  37. return a;
  38. }
  39. function IsJsonString(str) {
  40. try {
  41. JSON.parse(str);
  42. } catch (e) {
  43. return false;
  44. }
  45. return true;
  46. }
  47.  
  48. // *************
  49. // ** INIT **
  50. // *************
  51. function CErrors_bootstrap() {
  52. if (typeof unsafeWindow === "undefined") {
  53. unsafeWindow =( function () {
  54. var dummyElem=document.createElement('p');
  55. dummyElem.setAttribute('onclick', 'return window;');
  56. return dummyElem.onclick();
  57. }) ();
  58. }
  59. console.log("starting WME Color Errors", GM_info.script.version);
  60. CErrors_init();
  61. }
  62. function CErrors_init(){
  63. // Waze object needed
  64. CErrWaze=unsafeWindow.Waze; if(typeof(CErrWaze) === 'undefined'){ if (debug) { console.error("WME ColorErrors - CErrWaze : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  65. CErrorsMap=CErrWaze.map; if(typeof(CErrorsMap) == 'undefined'){ if (debug) { console.error("WME ColorErrors - CErrorsmap : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  66. CErrorsModel=CErrWaze.model; if(typeof(CErrorsModel) == 'undefined'){ if (debug) { console.error("WME ColorErrors - CErrorsmodel : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  67. CErrorsI18n=unsafeWindow.I18n; if(typeof (CErrorsI18n) == 'undefined') { if (debug) { console.error('WME ColorErrors - CErrorsI18n : NOK'); } setTimeout(CErrors_init, 500); return; }
  68. // OpenLayers
  69. CErrorsOpenLayers=unsafeWindow.OpenLayers; if(typeof(CErrorsOpenLayers) === 'undefined'){ if (debug) { console.error("WME ColorErrors - OpenLayers : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  70. // Waze GUI needed
  71. CErrorshandle=getId("user-info"); if(typeof(CErrorshandle) == 'undefined'){ window.setTimeout(CErrors_init, 500); return; }
  72. CErrorshandleClass=getElementsByClassName("nav-tabs", CErrorshandle)[0]; if(typeof(CErrorshandleClass) === 'undefined'){ window.setTimeout(CErrors_init, 500); return; }
  73. CErrorshandleClass2=getElementsByClassName("tab-content", CErrorshandle)[0]; if(typeof(CErrorshandleClass2) === 'undefined'){ window.setTimeout(CErrors_init, 500); return; }
  74.  
  75. // Verify localStorage. Init if empty or not correct
  76. if (typeof(localStorage.WMEColorErrors) === "undefined" || localStorage.WMEColorErrors.lenght===null || !IsJsonString(localStorage.WMEColorErrors)) {
  77. WMECErrors.opacity=0.85; // Icons Opacity on map
  78. WMECErrors.seg_Bad=false; // Bad Segments (group)
  79. WMECErrors.seg_Priv=true; // Private with bad name
  80. WMECErrors.seg_Park=true; // Parking with name (but Place / Square)
  81. WMECErrors.seg_Rail=true; // Railroad with bad name
  82. WMECErrors.seg_HW_name=true; //Highways with bad name
  83. WMECErrors.seg_Dir_name=true; // Directions but not Ramp/Freeway
  84. WMECErrors.seg_Toll=true; // Toll (but Ramp/Freeway)
  85. WMECErrors.seg_Ramp_name=true; // Ramp with 3 directions or more
  86. WMECErrors.seg_Ramp_city=true; // Ramp with city name
  87. WMECErrors.seg_RShield=true; // Wrong prefix
  88. WMECErrors.seg_RSAlt=true; //Roadshield must be in alt
  89. WMECErrors.seg_SNameAlt=true; //Road name must be in alt
  90. WMECErrors.seg_DleSpace=true; // Double space in name
  91. WMECErrors.seg_SegBadRS=true; // RoadShield but bad type
  92. // POI
  93. WMECErrors.poi_Bad=false; // Bad POI (group)
  94. WMECErrors.poi_Park_name=true; // Parking with [P]
  95. WMECErrors.poi_Address=true; // Dxxx/Nxxx in or no address
  96. WMECErrors.poi_Entry=true; // Entry Point not defined
  97. WMECErrors.poi_LandM=true; // Landmark with address (street |& city)
  98. WMECErrors.poi_DleSpace=true; // Double space in name
  99. // Low errors
  100. WMECErrors.poi_Resid=true; // Maybe a residential
  101. WMECErrors.poi_Google=true; // No link with Google
  102. WMECErrors.poi_WFeed=true; // Place created by WazeFeed
  103. WMECErrors.poi_WPark=true; // Place created by WazeParking1
  104. WMECErrors.poi_Other=true; // Place "Other"
  105. localStorage.setItem('WMEColorErrors', JSON.stringify(WMECErrors));
  106. }
  107.  
  108. // WME Layers check
  109. var layersColor=CErrorsMap.getLayersBy("uniqueName","__WME_Color_Errors"), layersIcons=CErrorsMap.getLayersBy("uniqueName","__WME_Color_Errors_Icons");
  110. var ColorErrors_style=new CErrorsOpenLayers.Style({
  111. pointRadius: 2,
  112. fontWeight: "normal",
  113. label : "${labelText}",
  114. fontFamily: "Tahoma, Courier New",
  115. labelOutlineColor: "#FFFFFF",
  116. labelOutlineWidth: 2,
  117. fontColor: '#000000',
  118. fontSize: "10px"
  119. });
  120. if (layersColor.length === 0) {
  121. ColorErrors_mapLayer=new CErrorsOpenLayers.Layer.Vector("Color Errors", {
  122. displayInLayerSwitcher: false,
  123. uniqueName: "__WME_Color_Errors",
  124. styleMap: new CErrorsOpenLayers.StyleMap(ColorErrors_style)
  125. });
  126. CErrorsI18n.translations[CErrorsI18n.locale].layers.name["__WME_Color_Errors"]="Color Errors";
  127. CErrorsMap.addLayer(ColorErrors_mapLayer);
  128. ColorErrors_mapLayer.setVisibility(true);
  129. }
  130. if (layersIcons.length === 0) {
  131. ColorErrors_mapLayerIcons=new CErrorsOpenLayers.Layer.Vector("Color Errors Icons", {
  132. displayInLayerSwitcher: false,
  133. uniqueName: "__WME_Color_Errors_Icons",
  134. styleMap: new CErrorsOpenLayers.StyleMap(ColorErrors_style)
  135. });
  136. CErrorsI18n.translations[CErrorsI18n.locale].layers.name["__WME_Color_Errors_Icons"]="Color Errors Icons";
  137. CErrorsMap.addLayer(ColorErrors_mapLayerIcons);
  138. ColorErrors_mapLayerIcons.setVisibility(true);
  139. }
  140. CErrors_Mainhtml();
  141. }
  142.  
  143. // *************
  144. // ** HTML **
  145. // *************
  146.  
  147. function CErrors_Mainhtml() {
  148. if (CErrorsI18n.locale == 'fr') {
  149. CErrSeg=new Array('Contrôle des segments',
  150. 'Mauvais segments',
  151. 'Voie privée avec mauvais nom',
  152. 'Voie de Parking nommée',
  153. 'Voie ferrée nommée ou alt',
  154. 'Types Routes avec mauvais nom',
  155. 'Bretelle avec plusieurs directions',
  156. 'Direction (sauf bretelle et Autoroute)',
  157. 'Mauvais préfixe (RoadShield)',
  158. 'Double espace dans le nom',
  159. 'Péage (sauf bretelle et Autoroute)',
  160. 'Bretelle/Autoroute avec nom de ville',
  161. 'Le RoadShield doit être en alt',
  162. 'Le nom de route doit être en alt',
  163. 'RoadShield sur mauvais type de voie'
  164. );
  165. CErrPoi=new Array('Contrôle des places',
  166. 'Mauvaises places',
  167. 'Parking mal nommé ou rien',
  168. 'Pas d\'adresse ou contenant Dxxx/Nxxx',
  169. 'Point d\'entré non défini',
  170. 'Site naturel avec adresse',
  171. 'Double espace dans le nom',
  172. 'Peut-être une place résidentielle',
  173. 'Pas de lien avec Google',
  174. 'Lieu édité par WazeFeed',
  175. 'Lieu de type "Autres"',
  176. 'Lieu édité par WazeParking1',
  177. 'Parking : type non défini'
  178. );
  179. CErrLeg=new Array('Légende',
  180. 'A corriger',
  181. 'A vérifier',
  182. 'Pour information',
  183. 'Opacité des icônes'
  184. );
  185. }
  186. else {
  187. CErrSeg=new Array('Segments Checking',
  188. 'Bad Segments',
  189. 'Private with bad name',
  190. 'Parking with name',
  191. 'Railroad with name or altname',
  192. 'Highways with bad name',
  193. 'Ramp with several directions',
  194. 'Direction (but Ramp/Freeway)',
  195. 'Wrong prefix (RoadShield)',
  196. 'Double spacing in name',
  197. 'Toll (but Ramp/Freeway)',
  198. 'Ramp/Freeway with city name',
  199. 'RoadShield must be in alt',
  200. 'Road name must be in alt',
  201. 'RoadShield but bad type',
  202. 'Parking : type undefined'
  203. );
  204. CErrPoi=new Array('Places Checking',
  205. 'Bad Places',
  206. 'Parking with bad name or null',
  207. 'No address or Dxxx/Nxxx within',
  208. 'Entry Point not defined',
  209. 'Natural features with address',
  210. 'Double spacing in name',
  211. 'Maybe a residential place',
  212. 'No link with Google',
  213. 'Place created by WazeFeed',
  214. 'Place type is "Other"',
  215. 'Place created by WazeParking1'
  216. );
  217. CErrLeg=new Array('Legend',
  218. 'To correct',
  219. 'To check',
  220. 'For information',
  221. 'Icons opacity'
  222. );
  223. }
  224. //Create content in CErrors's tab
  225. var CEnewtab=document.createElement('li');
  226. CEnewtab.innerHTML="<a href='#sidepanel-ColorErrors' data-toggle='tab'><span class='fa fa-eye' title='Color Errors'></span></a>";
  227. CErrorshandleClass.appendChild(CEnewtab);
  228.  
  229. var WMECErrors=JSON.parse(localStorage.getItem('WMEColorErrors'));
  230. var CEaddon=document.createElement('section');
  231. CEaddon.id="sidepanel-ColorErrors";
  232. var CEcontent='<div style="float:left; margin-left:5px;padding-bottom:10px;"><b><a href="https://greasyfork.org/scripts/xxx-wme-color-errors" target="_blank"><u>WME Color Errors</u></a></b> v'+ GM_info.script.version +'</div>'
  233. + '<h4 style="float:left;">'+CErrLeg[4]+'</h4><input id="errOpacity" type="range" max="1" min="0" step="0.05" style="float:left;width:240px;"><div id="opacityValue" style="float:left;font-weight:bold;padding-left:10px;"></div>'
  234. + '<br><br><h4 style="float:left;">'+CErrSeg[0]+'</h4><div style="clear:both;">'
  235. + '<input type="checkbox" id="_seg_Bad"'+(WMECErrors.seg_Bad ? ' checked' : '')+'/> '+CErrSeg[1]+'<br><div id="BadSeg" style="margin-left:5px;"><table>';
  236. CEcontent += fillHtml("seg_Priv", "seg_Bad","#ff7700","\uf256",CErrSeg[2]);
  237. CEcontent += fillHtml("seg_Park", "seg_Bad","#ff0000","\uf288",CErrSeg[3]);
  238. CEcontent += fillHtml("seg_Rail", "seg_Bad","#ff0000","\uf238",CErrSeg[4]);
  239. CEcontent += fillHtml("seg_Dir_name", "seg_Bad","#ff0000","\uf0a9",CErrSeg[6]);
  240. CEcontent += fillHtml("seg_Toll", "seg_Bad","#ff0000","\uf155",CErrSeg[10]);
  241. CEcontent += fillHtml("seg_Ramp_name","seg_Bad","#ff7700","\uf25a",CErrSeg[7]);
  242. CEcontent += fillHtml("seg_Ramp_city","seg_Bad","#ff0000","\uf015",CErrSeg[11]);
  243. CEcontent += fillHtml("seg_SNameAlt", "seg_Bad","#ff0000","\uf079",CErrSeg[13]);
  244. CEcontent += fillHtml("seg_DleSpace", "seg_Bad","#ff0000","\uf101",CErrSeg[9]);
  245. CEcontent += fillHtml("seg_HW_name", "seg_Bad","#ff0000","\uf018",CErrSeg[5]);
  246. CEcontent += fillHtml("seg_RSAlt", "seg_Bad","#ff0000","\uf074",CErrSeg[12]);
  247. CEcontent += fillHtml("seg_RShield", "seg_Bad","#ff0000","\uf152",CErrSeg[8]);
  248. CEcontent += fillHtml("seg_SegBadRS", "seg_Bad","#ff0000","\uf044",CErrSeg[14]);
  249. CEcontent += '</table></div></div><br><h4 style="float:left;">'+CErrPoi[0]+'</h4><div style="clear:both;"><tr><td><input type="checkbox" id="_poi_Bad"'+(WMECErrors.poi_Bad ? ' checked' : '')+'/> '+CErrPoi[1]+'<br><div id="BadPoi" style="margin-left:5px;"><table>';
  250. CEcontent += fillHtml("poi_Address", "poi_Bad","#ff0000","\uf2bc",CErrPoi[3]);
  251. CEcontent += fillHtml("poi_LandM", "poi_Bad","#ff0000","\uf1bb",CErrPoi[5]);
  252. CEcontent += fillHtml("poi_DleSpace", "poi_Bad","#ff0000","\uf101",CErrPoi[6]);
  253. CEcontent += fillHtml("poi_Park_name","poi_Bad","#ff0000","\uf288",CErrPoi[2]);
  254. CEcontent += fillHtml("poi_Park_type","poi_Bad","#ff0000","\uf11d",CErrPoi[12]);
  255. CEcontent += fillHtml("poi_Entry", "poi_Bad","#ff7700","\uf18e",CErrPoi[4]);
  256. CEcontent += fillHtml("poi_Resid", "poi_Bad","#ff7700","\uf015",CErrPoi[7]);
  257. CEcontent += fillHtml("poi_Google", "poi_Bad","#ff7700","\uf1a0",CErrPoi[8]);
  258. CEcontent += fillHtml("poi_Other", "poi_Bad","#ff7700","\uf29c",CErrPoi[10]);
  259. CEcontent += fillHtml("poi_WFeed", "poi_Bad","#ffcc00","\uf263",CErrPoi[9]);
  260. CEcontent += fillHtml("poi_WPark", "poi_Bad","#ffcc00","\uf263",CErrPoi[11]);
  261. CEcontent += '</table></div></div><br><h4 style="float:left;">'+CErrLeg[0]+'</h4><div style="clear:both;">';
  262. CEcontent += '<table><tr><td><div style="margin:5px;width:30px;height:2px;background-color:#ff0000;"></div></td><td>'+CErrLeg[1]+'</td></tr>';
  263. CEcontent += '<tr><td><div style="margin:5px;width:30px;height:2px;background-color:#ff7700;"></div></td><td>'+CErrLeg[2]+'</td></tr>';
  264. CEcontent += '<tr><td><div style="margin:5px;width:30px;height:2px;background-color:#ffcc00;"></div></td><td>'+CErrLeg[3]+'</td></tr></table></div>';
  265. CEaddon.innerHTML=CEcontent;
  266. CEaddon.className='tab-pane';
  267. CErrorshandleClass2.appendChild(CEaddon);
  268.  
  269. getId('errOpacity').value=WMECErrors.opacity;
  270. getId('opacityValue').innerHTML = getId('errOpacity').value;
  271.  
  272. getId('errOpacity').onmousemove = function(){
  273. getId('opacityValue').innerHTML = getId('errOpacity').value;
  274. var ls=JSON.parse(localStorage.WMEColorErrors);
  275. ls.opacity=getId('errOpacity').value;
  276. localStorage.setItem('WMEColorErrors', JSON.stringify(ls));
  277. CErrColor();
  278. };
  279. getId('_seg_Bad').onclick=(function(){
  280. var ls=JSON.parse(localStorage.WMEColorErrors);
  281. if (getId('_seg_Bad').checked === true) {
  282. for (var i=0; getElementsByClassName('_seg', BadSeg) [i]; i++) getElementsByClassName('_seg', BadSeg) [i].disabled=false;
  283. ls.seg_Bad=true;
  284. }
  285. else {
  286. for (var i=0; getElementsByClassName('_seg', BadSeg) [i]; i++) getElementsByClassName('_seg', BadSeg) [i].disabled=true;
  287. ls.seg_Bad=false;
  288. }
  289. localStorage.setItem('WMEColorErrors', JSON.stringify(ls));
  290. CErrColor();
  291. });
  292. getId('_poi_Bad').onclick=(function(){
  293. var ls=JSON.parse(localStorage.WMEColorErrors);
  294. if (getId('_poi_Bad').checked === true) {
  295. for (var i=0; getElementsByClassName('_poi', BadPoi) [i]; i++) getElementsByClassName('_poi', BadPoi) [i].disabled=false;
  296. ls.poi_Bad=true;
  297. }
  298. else {
  299. for (var i=0; getElementsByClassName('_poi', BadPoi) [i]; i++) getElementsByClassName('_poi', BadPoi) [i].disabled=true;
  300. ls.poi_Bad=false;
  301. }
  302. localStorage.setItem('WMEColorErrors', JSON.stringify(ls));
  303. CErrColor();
  304. });
  305. getId('_seg_Priv').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Priv').checked === true) ? ls.seg_Priv=true : ls.seg_Priv=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  306. getId('_seg_Park').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Park').checked === true) ? ls.seg_Park=true : ls.seg_Park=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  307. getId('_seg_Rail').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Rail').checked === true) ? ls.seg_Rail=true : ls.seg_Rail=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  308. getId('_seg_HW_name').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_HW_name').checked === true) ? ls.seg_HW_name=true : ls.seg_HW_name=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  309. getId('_seg_Dir_name').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Dir_name').checked === true) ? ls.seg_Dir_name=true : ls.seg_Dir_name=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  310. getId('_seg_Toll').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Toll').checked === true) ? ls.seg_Toll=true : ls.seg_Toll=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  311. getId('_seg_Ramp_name').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Ramp_name').checked === true) ? ls.seg_Ramp_name=true : ls.seg_Ramp_name=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  312. getId('_seg_Ramp_city').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Ramp_city').checked === true) ? ls.seg_Ramp_city=true : ls.seg_Ramp_city=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  313. getId('_seg_RShield').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_RShield').checked === true) ? ls.seg_RShield=true : ls.seg_RShield=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  314. getId('_seg_RSAlt').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_RSAlt').checked === true) ? ls.seg_RSAlt=true : ls.seg_RSAlt=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  315. getId('_seg_SNameAlt').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_SNameAlt').checked === true) ? ls.seg_SNameAlt=true : ls.seg_SNameAlt=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  316. getId('_seg_DleSpace').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_DleSpace').checked === true) ? ls.seg_DleSpace=true : ls.seg_DleSpace=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  317. getId('_seg_SegBadRS').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_SegBadRS').checked === true) ? ls.seg_SegBadRS=true : ls.seg_SegBadRS=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  318. getId('_poi_Park_name').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Park_name').checked === true) ? ls.poi_Park_name=true : ls.poi_Park_name=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  319. getId('_poi_Park_type').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Park_type').checked === true) ? ls.poi_Park_type=true : ls.poi_Park_type=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  320. getId('_poi_Address').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Address').checked === true) ? ls.poi_Address=true : ls.poi_Address=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  321. getId('_poi_Entry').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Entry').checked === true) ? ls.poi_Entry=true : ls.poi_Entry=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  322. getId('_poi_LandM').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_LandM').checked === true) ? ls.poi_LandM=true : ls.poi_LandM=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  323. getId('_poi_DleSpace').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_DleSpace').checked === true) ? ls.poi_DleSpace=true : ls.poi_DleSpace=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  324. getId('_poi_Resid').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Resid').checked === true) ? ls.poi_Resid=true : ls.poi_Resid=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  325. getId('_poi_Google').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Google').checked === true) ? ls.poi_Google=true : ls.poi_Google=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  326. getId('_poi_WFeed').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_WFeed').checked === true) ? ls.poi_WFeed=true : ls.poi_WFeed=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  327. getId('_poi_WPark').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_WPark').checked === true) ? ls.poi_WPark=true : ls.poi_WPark=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  328. getId('_poi_Other').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Other').checked === true) ? ls.poi_Other=true : ls.poi_Other=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  329.  
  330. //window.setInterval(checkClicLayer, 500);
  331. CErrWaze.selectionManager.events.register("selectionchanged", null, CErrColor);
  332. CErrorsModel.actionManager.events.register("afterclearactions", null, CErrColor);
  333. CErrorsModel.actionManager.events.register("afterundoaction", null, CErrColor);
  334. CErrorsMap.events.register("zoomend", null, CErrColor);
  335. CErrorsMap.events.register("moveend", null, CErrColor);
  336. window.setTimeout(CErrColor, 500);
  337. }
  338. function fillHtml(id,type,color,icon,text) {
  339. var WMECErrors=JSON.parse(localStorage.getItem('WMEColorErrors'));
  340. return '<tr style="line-height:14px;"><td style="width:20px;"><input type="checkbox" class="'+(type==="seg_Bad" ? '_seg' : '_poi')+'" id="_'+id+'"'+(WMECErrors[id] ? ' checked' : '')+(WMECErrors[type] ? '' : ' disabled')+'/></td><td style="width:20px;"><font style="color:'+color+';font-family:FontAwesome;">'+icon+'</font></td><td><label for="_'+id+'" style="font-weight:normal;">'+text+'</label></td></tr>';
  341. }
  342. function checkClicLayer(){
  343. var lieu=CErrorsI18n.translations[CErrorsI18n.locale].layers.name.landmarks;
  344. getId('layer-switcher-'+CErrorsMap.getLayersByName(lieu)[0].id).onclick=(function(){
  345. window.setTimeout((function() {
  346. CErrColor();
  347. }),10);
  348. });
  349. }
  350. function addIcon(icon,color,geometry,type) {
  351. var style = {
  352. fill: false,
  353. stroke: false,
  354. label: icon,
  355. labelAlign: "cb",
  356. labelXOffset: -4,
  357. labelYOffset: 8,
  358. fontColor: color,
  359. fontSize:"20px",
  360. fontOpacity: getId('errOpacity').value,
  361. fontFamily: "FontAwesome",
  362. labelOutlineWidth: 2,
  363. zIndex: 99999
  364. };
  365. if (type==="segment") {
  366. if(geometry.length==2){
  367. var midX = (((geometry[0].x + geometry[1].x) / 2) + geometry[0].x) / 2;
  368. var midY = (((geometry[0].y + geometry[1].y) / 2) + geometry[0].y) / 2;
  369. var labelPoint = new CErrorsOpenLayers.Geometry.Point(midX,midY);
  370. var imageFeature = new CErrorsOpenLayers.Feature.Vector(labelPoint, null, style);
  371. ColorErrors_mapLayer.addFeatures([imageFeature]);
  372. }
  373. else {
  374. for(i=0;i<geometry.length-1;i++){
  375. if(i%3==1){
  376. var midX = (((geometry[i].x + geometry[i+1].x) / 2) + geometry[i].x) / 2;
  377. var midY = (((geometry[i].y + geometry[i+1].y) / 2) + geometry[i].y) / 2;
  378. var labelPoint = new CErrorsOpenLayers.Geometry.Point(midX,midY);
  379. var imageFeature = new CErrorsOpenLayers.Feature.Vector(labelPoint, null, style);
  380. ColorErrors_mapLayer.addFeatures([imageFeature]);
  381. }
  382. }
  383. }
  384. }
  385. else {
  386. var midX = (((geometry.left + geometry.right) / 2) + geometry.right) / 2;
  387. var midY = (((geometry.bottom + geometry.top) / 2) + geometry.bottom) / 2;
  388. var labelPoint = new CErrorsOpenLayers.Geometry.Point(midX,midY);
  389. var imageFeature = new CErrorsOpenLayers.Feature.Vector(labelPoint, null, style);
  390. ColorErrors_mapLayer.addFeatures([imageFeature]);
  391. }
  392. }
  393. function CErrColor(){
  394. var lineFeature=[], ls=JSON.parse(localStorage.WMEColorErrors);
  395. var lieu=CErrorsI18n.translations[CErrorsI18n.locale].layers.name.landmarks;
  396.  
  397. // Initialize layer
  398. try { ColorErrors_mapLayer.destroyFeatures(); }
  399. catch(err){ log('err destroyFeatures: ',err); }
  400.  
  401. //Segments Checking
  402. if (ls.seg_Bad) {
  403. for (var seg in CErrorsModel.segments.objects) {
  404. // Get values
  405. var segment=CErrorsModel.segments.get(seg);
  406. var attributes=segment.attributes;
  407. var geometry=attributes.geometry.components;
  408. var line=getId(segment.geometry.id);
  409. if (typeof (segment)==='undefined' || line === null || segment.state === "Update" || segment.selected === true) continue;
  410. //Name
  411. var sid=attributes.primaryStreetID;
  412. var street=CErrorsModel.streets.get(sid);
  413. if (typeof (street)==='undefined') continue;
  414. //Alt Name
  415. var salt=attributes.streetIDs[0];
  416. var streetalt=CErrorsModel.streets.get(salt);
  417. if (streetalt) { var altname=streetalt.name; } else { var altname=""; }
  418. //City
  419. var streetCity = CErrorsModel.cities.get(street.cityID);
  420. if (typeof (streetCity)==='undefined') continue;
  421. streetCity = streetCity.attributes.name;
  422.  
  423. var roadType=attributes.roadType;
  424. if (attributes.primaryStreetID === null || attributes.primaryStreetID === undefined) continue;
  425. if (CErrorsModel.streets.get(attributes.primaryStreetID) === null || CErrorsModel.streets.get(attributes.primaryStreetID) === undefined) continue;
  426. var newWidth="", newColor="", newOpacity="0", gline="";
  427.  
  428. if (ls.seg_Ramp_city) { // Ramp/Freeway with city name
  429. if (streetCity && /^(3|4)$/.test(attributes.roadType)) {
  430. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf015",newColor,geometry,"segment");
  431. }
  432. }
  433. if (street.name || altname) {
  434. if (/( - )/.test(street.name)) { var trs=street.name.split(" - "); }
  435. // Segments with bad name
  436. /*if (/^(3|4|5|6|8|10|16|17|19)$/.test(attributes.roadType)===false && /^[A|C|D|N|M|R][0-9]+[a-z]?[0-9]?/.test(trs[0].replace(".",""))===false && /(^Le |^La |^Les |Allée |[ ]?Avenue[]?|Boulevard |Chemin |Cité |Clos |Côte |Cour[s]? |Domaine |Faubourg |Hameau |Impasse |Levée |Lotissement |Mail |Montée |Parc |Passage |Place |Pont |Porte |Promenade |Quai |Résidence[s]? |Route |[ ]?Rue[ ]?|Ruelle |Sente |Sentier |Square |Traverse |Villa |Voie )/.test(street.name)===false) {
  437. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  438. }*/
  439. if (ls.seg_Priv) { // Private with bad name
  440. if (attributes.roadType===17 && /^(^Le |^La |^Les |Grande |Allée |[ ]?Avenue[]?|Boulevard |Chemin |Cité |Clos |Côte |Cour[s]? |Domaine |Hameau |Impasse |Levée |Lotissement |Mail |Montée |Parc |Passage |Place |Pont |Promenade |Quai |Résidence[s]? |Route |[ ]?Rue[ ]?|Ruelle |Sente |Sentier |Square |Traverse |Venelle |Villa |Voie )/.test(street.name)===false) {
  441. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf256",newColor,geometry,"segment");
  442. }
  443. }
  444. if (ls.seg_Park && street.name) { // Parking with name (But Place / Square)
  445. if (attributes.roadType===20 && /^(Place |Square )/.test(street.name)===false) {
  446. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf288",newColor,geometry,"segment");
  447. }
  448. }
  449. if (ls.seg_Rail && street.name) { // Railroad with bad name
  450. if (attributes.roadType===18 && (altname || street.name)) { //Railroad with name
  451. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf238",newColor,geometry,"segment");
  452. }
  453. }
  454. if (ls.seg_Ramp_name && street.name) {
  455. if (/^(3|4)$/.test(attributes.roadType) && /\/.*\//.test(street.name)) { // Ramp with 3 directions or more
  456. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf25b",newColor,geometry,"segment");
  457. }
  458. else if (/^(3|4)$/.test(attributes.roadType) && /\//.test(street.name)) { // Ramp with 2 directions
  459. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf25a",newColor,geometry,"segment");
  460. }
  461. }
  462. if (ls.seg_Dir_name && street.name) { // Directions but not Ramp/Freeway/Major
  463. if (/^[^3|4|6]$/.test(attributes.roadType) && /[:|>]/.test(street.name)) {
  464. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf0a9",newColor,geometry,"segment");
  465. }
  466. }
  467. if (ls.seg_Toll) { // Toll but not Ramp/Freeway
  468. if (/^[^3|4]$/.test(attributes.roadType) && (attributes.fwdToll || attributes.revToll)) {
  469. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf155",newColor,geometry,"segment");
  470. }
  471. }
  472. if (ls.seg_RSAlt && street.name) { // RoadShield must be in alt
  473. if (attributes.roadType!=19 && trs
  474. && /^[A|C|D|N|M|R][0-9]+[a-z]?[0-9]?/.test(trs[0].replace(".",""))===true // Roadshield (1st part)
  475. && / - /.test(street.name)===true // Roadshield & street name (separator -)
  476. && /Intérieure|Extérieure/.test(trs[1])===false
  477. && streetCity // City ok
  478. ) {
  479. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf074",newColor,geometry,"segment");
  480. }
  481. }
  482. if (ls.seg_HW_name && street.name) { // Highways with bad name
  483. if (/^(3|4|6)$/.test(attributes.roadType) && (/:/.test(street.name)===true && /^[A|C|D|N|M|R][0-9]+[a-z]?[0-9]?/.test(street.name)===false) && /^>/.test(street.name)===false && /^[Sortie ]+[0-9]+/.test(street.name)===false && /^(Rocade|Périphérique)/.test(street.name)===false) {
  484. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf018",newColor,geometry,"segment");
  485. }
  486. }
  487. if (ls.seg_SegBadRS && street.name) { // RoadShield but bad type
  488. if (/^(1|8|17|20)$/.test(attributes.roadType) && (/^[A|D|N|M|R][0-9]+/.test(street.name) || /^[A|D|N|M|R]$/.test(street.name))) {
  489. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf044",newColor,geometry,"segment");
  490. }
  491. }
  492. if (ls.seg_RShield && street.name) { // Wrong prefix (RoadShield)
  493. if ((trs && attributes.roadType!=19 && /^[A|D|N|M|R][0-9]+[a-z]?[0-9]?/.test(trs[0].replace(".",""))===false && / - /.test(street.name)===true)
  494. || /^[A|D|N|M|R][0-9]+[a-z]?[0-9]? ?-[A-Za-z]/.test(street.name)===true || /^[A|D|N|M|R][0-9]+[a-z]?[0-9]?- ?[A-Za-z]/.test(street.name)===true// No space between RS and street name
  495. ) {
  496. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf152",newColor,geometry,"segment");
  497. }
  498. }
  499. if (ls.seg_SNameAlt && street.name) { // Street Name must be in alt
  500. if (attributes.roadType!=19 && trs
  501. && /^[A|C|D|N|M|R][0-9]+[a-z]?[0-9]?/.test(trs[0].replace(".",""))===true // Roadshield (1st part)
  502. && /^[E][0-9]/.test(trs[1])===false // European Roadshield (2nd part)
  503. && /Périphérique|Rocade|Duplex/.test(street.name)===false // Exception
  504. && / - /.test(street.name)===true // Roadshield & street name (separator -)
  505. && /Intérieure|Extérieure/.test(trs[1])===false
  506. && !streetCity // No city
  507. ) {
  508. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf079",newColor,geometry,"segment");
  509. }
  510. }
  511. if (ls.seg_DleSpace && street.name) { // Double spacing in name
  512. if (/ /.test(street.name)===true) {
  513. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices(); addIcon("\uf101",newColor,geometry,"segment");
  514. }
  515. }
  516. }
  517. // Highlight if error
  518. if (gline !== "") {
  519. var style={
  520. strokeWidth: newWidth,
  521. strokeColor: newColor,
  522. strokeOpacity: newOpacity
  523. };
  524. var points=[];
  525. for (var i=0; i<gline.length; i++) { points.push(new CErrorsOpenLayers.Geometry.Point(gline[i].x, gline[i].y)); }
  526. var newline=new CErrorsOpenLayers.Geometry.LineString(points);
  527. lineFeature.push(new CErrorsOpenLayers.Feature.Vector(newline, null, style));
  528. }
  529. }
  530. }
  531.  
  532. //Places Checking
  533. if (ls.poi_Bad && getId('layer-switcher-group_places').checked) {
  534. for (var poi in CErrorsModel.venues.objects) {
  535. // Get values
  536. var venue=CErrorsModel.venues.get(poi);
  537. var pattributes=venue.attributes;
  538. console.log("xxx", pattributes);
  539. var geometry=pattributes.geometry.bounds;
  540. var poly=pattributes.id;
  541. if (typeof (venue)==='undefined' || poly === null || poi.state=="Update" || poi.selected) continue;
  542. var categories=pattributes.categories;
  543. var pname=pattributes.name;
  544. var venueStreet=CErrorsModel.streets.get(pattributes.streetID);
  545. if (venueStreet) { var venueCity = CErrorsModel.cities.get(venueStreet.cityID); }
  546. var newWidth="", newColor="", newOpacity="0", gpoly="";
  547.  
  548. if (ls.poi_Resid) { // maybe a residential POI
  549. if ((/^[0-9][ ]?[a-zA-Z]/.test(pname)===true || /^(Allée |Avenue |Boulevard |Chemin |Clos |Côte |Cours |Faubourg |Hameau |Impasse |Lotissement |Mail |Passage |Porte |Promenade |Quai |Route |Rue |Ruelle |Sente |Sentier |Voie )/.test(pname)===true) && pattributes.residential===false && pattributes.categories.indexOf("PARKING_LOT")===-1) {
  550. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  551. if (venue.isPoint()) { newWidth=26; }
  552. addIcon("\uf015",newColor,geometry,"venue");
  553. }
  554. }
  555. if (ls.poi_Google) { //POI without Google link
  556. if (pattributes.externalProviderIDs.length===0 && pattributes.residential===false && /(RIVER_STREAM|CANAL|SEA_LAKE_POOL|SWAMP_MARSH|ISLAND|FOREST_GROVE|BRIDGE|SWAMP_MARSH|PARK|JUNCTION_INTERCHANGE|CEMETERY)/.test(categories)===false) {
  557. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  558. if (venue.isPoint()) { newWidth=26; }
  559. addIcon("\uf1a0",newColor,geometry,"venue");
  560. }
  561. }
  562. if (ls.poi_Other) { // Place type is "Other"
  563. if (categories.indexOf("OTHER" && pname!="Déchetterie") > -1) {
  564. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  565. if (venue.isPoint()) { newWidth=26; }
  566. addIcon("\uf29c",newColor,geometry,"venue");
  567. }
  568. }
  569. if (ls.poi_Entry) { // POI with default entryExitPoints
  570. if (/(BRIDGE|CANAL|FOREST_GROVE|ISLAND|JUNCTION_INTERCHANGE|PARK|POOL|RIVER_STREAM|SEA_LAKE_POOL|SWAMP_MARSH|TUNNEL)/.test(categories)===false && pattributes.entryExitPoints.length===0 && venue.isPoint()===false) {
  571. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  572. addIcon("\uf18e",newColor,geometry,"venue");
  573. }
  574. }
  575. if (ls.poi_Park_name && categories.indexOf("PARKING_LOT") > -1) { // Parking with bad name
  576. if (/(Allée |Avenue |Boulevard |Chemin |Clos |Côte |Cours |Faubourg |Hameau |Impasse |Lotissement |Mail |Passage |Place | Porte |Promenade |Quai |Route |Rue |Ruelle |Sente |Sentier |Voie )/.test(pname)===true && /^(?️ |Parking )/.test(pname)===true) { continue; } //If parking name is a road
  577. if (/^(?️|Parking[s]?)$/.test(pname)===true || // Only ?️ or Parkings
  578. /^(?️ |Parking )/.test(pname)===false || // Don't start by ?️ or Parking
  579. /^(?️|Parking[s]?)( de[s]?| du | le[s]? | la | pour )/.test(pname)===true // Contain bad words
  580. ) {
  581. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  582. addIcon("\uf288",newColor,geometry,"venue");
  583. }
  584. else if (pname==="") {
  585. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  586. addIcon("\uf288",newColor,geometry,"venue");
  587. }
  588. if (venue.isPoint()) newWidth=26;
  589. }
  590. if (ls.poi_Park_type && categories.indexOf("PARKING_LOT") > -1) { // Parking with type undefined
  591. if (/PUBLIC|RESTRICTED|PRIVATE/.test(pattributes.categoryAttributes.PARKING_LOT.parkingType)===false) {
  592. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  593. addIcon("\uf11d",newColor,geometry,"venue");
  594. }
  595. }
  596. if (ls.poi_Address) { // POI with bad address (Nxxx/Dxxx) or without address
  597. if (typeof (venueStreet)!='undefined' && ((/^[A|D|N|M|R][0-9]+/.test(venueStreet.name) && /[ - ]/.test(venueStreet.name)) || typeof (venueStreet.name)==='undefined')) {
  598. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  599. if (venue.isPoint()) { newWidth=26; }
  600. addIcon("\uf2bc",newColor,geometry,"venue");
  601. }
  602. }
  603. if (ls.poi_LandM) { // Landmark with road name or city name
  604. if (/(RIVER_STREAM|CANAL|SEA_LAKE_POOL|POOL|SWAMP_MARSH|ISLAND|FOREST_GROVE|BRIDGE)/.test(categories) && pname==="" && ((venueStreet && venueStreet.name) || (venueCity && venueCity.attributes.name))) {
  605. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  606. if (venue.isPoint()) { newWidth=26; }
  607. addIcon("\uf1bb",newColor,geometry,"venue");
  608. }
  609. }
  610. if (ls.poi_DleSpace) { // Double spacing in name
  611. if (venueStreet && (/ /.test(venueStreet.name)===true || / /.test(pname)===true)) {
  612. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  613. addIcon("\uf101",newColor,geometry,"venue");
  614. if (venue.isPoint()) { newWidth=26; }
  615. }
  616. }
  617. if (ls.poi_WFeed || ls.poi_WPark) { //Place updated by WazeFeed
  618. if (pattributes.updatedBy && CErrorsModel.users.get(pattributes.updatedBy)) {
  619. var updName = CErrorsModel.users.get(pattributes.updatedBy).userName;
  620. if (((ls.poi_WFeed && updName=="WazeFeed") || (ls.poi_WPark && updName=="WazeParking1")) && pattributes.residential===false) {
  621. newColor="#ffcc00"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  622. if (venue.isPoint()) { newWidth=26; newOpacity=0.75; }
  623. addIcon("\uf263",newColor,geometry,"venue");
  624. }
  625. }
  626. }
  627. // Highlight if error
  628. if (gpoly!=="") {
  629. var style={
  630. strokeWidth: newWidth,
  631. strokeColor: newColor,
  632. strokeOpacity: newOpacity,
  633. fillOpacity: 0
  634. };
  635. var points=[];
  636. for (var i=0; i<gpoly.length; i++) { points.push(new CErrorsOpenLayers.Geometry.Point(gpoly[i].x, gpoly[i].y)); }
  637. var newpoly=new CErrorsOpenLayers.Geometry.LinearRing(points);
  638. lineFeature.push(new CErrorsOpenLayers.Feature.Vector(newpoly, null, style));
  639. }
  640. }
  641. }
  642.  
  643. // Display highlighted features
  644. try{ ColorErrors_mapLayer.addFeatures(lineFeature); }
  645. catch(err){ log('err addFeatures: ',err); }
  646. }
  647. CErrors_bootstrap();