WME Utils - NavigationPoint

NavigationPoint class necessary for creating an entryExitPoint in code. Instantiate the class and pass the OL.Geometry.Point in the constructor then add the NavigationPoint object to the entryExitPoints array.

Dette scriptet burde ikke installeres direkte. Det er et bibliotek for andre script å inkludere med det nye metadirektivet // @require https://update.greatest.deepsurf.us/scripts/38421/1291464/WME%20Utils%20-%20NavigationPoint.js

  1. // ==UserScript==
  2. // @name WME Utils - NavigationPoint
  3. // @namespace WazeDev
  4. // @version 2023.12.05.01
  5. // @description NavigationPoint class necessary for creating an entryExitPoint in code. Instantiate the class and pass the OL.Geometry.Point in the constructor then add the NavigationPoint object to the entryExitPoints array.
  6. // @author JustinS83
  7. // @license GNU GPLv3
  8. // ==/UserScript==
  9.  
  10. class NavigationPoint
  11. {
  12. constructor(point){
  13. this._point = structuredClone(point);
  14. this._entry = true;
  15. this._exit = true;
  16. this._isPrimary = true;
  17. this._name = "";
  18. }
  19.  
  20. with(){
  21. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  22. if(e.point == null)
  23. e.point = this.toJSON().point;
  24. return new this.constructor((this.toJSON().point, e.point));
  25. }
  26.  
  27. getPoint(){
  28. return structuredClone(this._point);
  29. }
  30.  
  31. getEntry(){
  32. return this._entry;
  33. }
  34.  
  35. getExit(){
  36. return this._exit;
  37. }
  38.  
  39. getName(){
  40. return this._name;
  41. }
  42.  
  43. isPrimary(){
  44. return this._isPrimary;
  45. }
  46.  
  47. toJSON(){
  48. return {
  49. point: this._point,
  50. entry: this._entry,
  51. exit: this._exit,
  52. primary: this._isPrimary,
  53. name: this._name
  54. };
  55. }
  56.  
  57. clone(){
  58. return this.with();
  59. }
  60. }