Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@trimblemaps/trimblemaps-energy

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trimblemaps/trimblemaps-energy - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

trimblemaps-energy.d.ts

4

LICENSE.txt

@@ -1,2 +0,2 @@

Copyright (c) 2022, Trimble, Inc.
Copyright (c) 2024, Trimble, Inc.

@@ -13,3 +13,3 @@ All rights reserved.

and/or other materials provided with the distribution.
* Neither the name of Mapbox GL JS nor the names of its contributors
* Neither the name of Trimble Maps JS nor the names of its contributors
may be used to endorse or promote products derived from this software

@@ -16,0 +16,0 @@ without specific prior written permission.

{
"name": "@trimblemaps/trimblemaps-energy",
"version": "1.0.0",
"description": "Add the description of the addon here",
"version": "2.0.0",
"description": "The Energy Layers add-on control provides NTS (National Topographic System), DLS (Dominion Land Survey), PLSS (Public Land Survey System), and OTLS (Original Texas Land Survey) boundaries and labels.",
"main": "trimblemaps-energy.js",

@@ -6,0 +6,0 @@ "style": "trimblemaps-energy.css",

# @trimblemaps/trimblemaps-energy
energy Description
The Energy Layers add-on control provides NTS (National Topographic System), DLS (Dominion Land Survey), PLSS (Public Land Survey System), and OTLS (Original Texas Land Survey) boundaries and labels. It also provides point data for wells and other energy facilities.
See the [Trimble MAPS Developer Portal](https://developer.trimblemaps.com/maps-sdk/) for more information.
![Energy Addon Screenshot](https://developer.trimblemaps.com/maps-sdk/img/examples/energy-layers.png)
- [Documentation](https://developer.trimblemaps.com/maps-sdk/guide/add-ons/energy-layers/)
- [Demo](https://developer.trimblemaps.com/maps-sdk/examples/energy-layers/)
- [Release Notes](https://developer.trimblemaps.com/maps-sdk/release-notes/)
- [License](https://developer.trimblemaps.com/maps-sdk/legal/license/)
See the [Trimble Maps Developer Portal](https://developer.trimblemaps.com/maps-sdk/) for more information.

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@trimblemaps/trimblemaps-js")):"function"==typeof define&&define.amd?define(["@trimblemaps/trimblemaps-js"],t):((e="undefined"!=typeof globalThis?globalThis:e||self).TrimbleMapsControl=e.TrimbleMapsControl||{},e.TrimbleMapsControl.EnergyControl=t(e.TrimbleMaps))}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};"function"==typeof SuppressedError&&SuppressedError;var i={STYLE_URL:"https://tiles.alk.com/styles/"};var a={layerId:"energy",isVisible:!0},o=function(e){function t(t,n){var r=this,o=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0,i=t;r<i.length;r++){var a=i[r];for(var o in a)e[o]=a[o]}return e}({},a,n);return(r=e.call(this,o)||this)._urls=i,r._layerNames=[],r._map=t,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype._setServiceUrls=function(e){var t=this;Object.keys(this._urls).forEach((function(n){void 0!==e[n]&&(t._urls[n]=e[n])}))},t.prototype._getContent=function(){var e=this,t="".concat(this._urls.STYLE_URL,"v5/").concat(this._map.getRegion(),"/").concat(this._map.getStyleName(),"/").concat(this._options.layerId,"?key=").concat(n.default.APIKey||"");this._layerNames=[],fetch(t).then((function(t){return e._map.fire("energyloading"),t.json()})).then((function(t){if(t.sources){for(var n in t.sources)e._map.getSource(n)||e._map.addSource(n,t.sources[n]);t.layers.length&&(t.layers.forEach((function(t){var n;e._layerNames.push(t.id);var r=(null===(n=t.metadata)||void 0===n?void 0:n.beforeLayer)||"";e._map.getLayer(r)?e._map.addLayer(t,r):e._map.addLayer(t)})),e.setVisibility(e._options.isVisible)),e._map.fire("energylayersloaded")}else console.warn(null==t?void 0:t.name)}))},t.prototype.addTo=function(t){return this._map=t,e.prototype.addTo.call(this,t)},t.prototype.remove=function(){return e.prototype.remove.call(this)},t.prototype.isVisible=function(){return e.prototype.isVisible.call(this)},t.prototype.setVisibility=function(t){return e.prototype.setVisibility.call(this,t)},t.prototype.toggleVisibility=function(){return e.prototype.toggleVisibility.call(this)},t}(e.ContentBase),s=function(){function e(){this.mapHandlers=new Map}return e.prototype.setMap=function(e){this.map=e},e.prototype.add=function(e){if(this.map){this.map.on(e.eventName,e.listener);var t=e.eventName+Date.now();return this.mapHandlers.set(t,e),t}console.warn("Handler cannot be added. The map has not been set for this manager.")},e.prototype.remove=function(e){var t=this.mapHandlers.get(e);this.map.off(t.eventName,t.listener),this.mapHandlers.delete(e)},e.prototype.removeAll=function(){var e=this;this.mapHandlers.forEach((function(t){e.map.off(t.eventName,t.listener)})),this.mapHandlers.clear()},e}();return function(){function e(){var e=this;this._mapHandlerManager=new s,this._energyLayerList=[{id:"heading",label:"NTS",layers:[],visible:!0,minZoom:0},{id:"energy_boundary_nts",label:"Boundary",layers:["energy_boundary_nts","energy_boundary_label_left_nts","energy_boundary_label_right_nts"],visible:!0,minZoom:6},{id:"energy_landuse_label_nts",label:"Area Label",layers:["energy_landuse_label_nts"],visible:!0,minZoom:6},{id:"heading",label:"DLS, PLSS, OTLS",layers:[],visible:!0,minZoom:0},{id:"energy_boundary",label:"Boundary",layers:["energy_boundary","energy_boundary_label_left","energy_boundary_label_right"],visible:!0,minZoom:9},{id:"energy_landuse_label",label:"Area Label",layers:["energy_landuse_label"],visible:!0,minZoom:9},{id:"energy_survey_point",label:"Survey Point",layers:["energy_survey_point"],visible:!1,minZoom:14},{id:"heading",label:"Places",layers:[],visible:!0,minZoom:0},{id:"energy_poi",label:"Wells and Facilities",layers:["energy_poi"],visible:!0,minZoom:12}],this._energyLayers=new o,this._outsideClickListener=function(t){var n;e._container.contains(t.target)||null===(n=e._energyMenu)||void 0===n||n.classList.remove("trimblemaps-energy-container-open")}}return e.prototype.onAdd=function(e){var t=this;this._map=e,this._mapHandlerManager.setMap(this._map),this._map.style._loaded?this._energyLayers.addTo(this._map):this._map.once("style.load",(function(){t._energyLayers.addTo(t._map)})),this._container=document.createElement("div"),this._container.className="trimblemaps-ctrl trimblemaps-ctrl-group trimblemaps-energy-ctrl";var n=document.createElement("button");n.className="trimblemaps-ctrl-icon trimblemaps-energy-button",n.title="Energy",n.type="button",n.addEventListener("click",(function(){t._toggleLayerMenu()})),this._energyMenu=document.createElement("div"),this._energyMenu.className="trimblemaps-energy-container";var r=document.createElement("div");r.className="trimblemaps-energy-arrow",this._energyMenu.appendChild(r);var i=document.createElement("h5");i.className="trimblemaps-energy-title",i.innerHTML="Energy Layers",this._energyMenu.appendChild(i);var a=document.createElement("div");return a.className="trimblemaps-energy-list",this._energyLayerList.forEach((function(e){if("heading"===e.id){var n=document.createElement("h6");return n.className="trimblemaps-energy-heading",n.innerHTML=e.label,void a.appendChild(n)}var r=t._createSwitch(e);a.appendChild(r)})),this._energyMenu.appendChild(a),this._container.appendChild(n),this._container.appendChild(this._energyMenu),document.addEventListener("click",this._outsideClickListener),this._container},e.prototype.onRemove=function(){this._map&&(this._container.parentNode.removeChild(this._container),document.removeEventListener("click",this._outsideClickListener),this._mapHandlerManager.removeAll(),this._map=void 0)},e.prototype._createSwitch=function(e){var t=this,n=document.createElement("div");n.className="trimblemaps-menu-item trimblemaps-menu-layer-item",n.setAttribute("data-layer-id",e.id),n.setAttribute("data-layer-name",e.label),n.setAttribute("data-layer-minzoom",e.minZoom.toString()),n.innerHTML=e.label;var r=document.createElement("div");r.className="trimblemaps-energy-custom-control trimblemaps-energy-custom-switch trimblemaps-energy-custom-control-inline",document.createElement("div").className="result-info text-ellipsis flex-element";var i=document.createElement("label");i.className="trimblemaps-energy-custom-control-label",i.setAttribute("for","switch_"+e.id);var a=document.createElement("INPUT");a.className="trimblemaps-energy-custom-control-input",a.setAttribute("type","checkbox"),a.setAttribute("role","switch"),a.setAttribute("aria-label",e.label),a.setAttribute("id","switch_"+e.id),a.setAttribute("data-energy-id",e.id),a.setAttribute("data-energy-name",e.label),e.visible?a.setAttribute("checked","checked"):(a.removeAttribute("checked"),this._map.once("energylayersloaded",(function(){e.layers.forEach((function(e){t._map.setLayoutProperty(e,"visibility","none")}))}))),a.addEventListener("change",(function(n){var r=n.target.checked;e.layers.forEach((function(e){t._map.setLayoutProperty(e,"visibility",r?"visible":"none")})),t._map.fire("layervisibilitychange",{layerIds:e.layers,isSelected:r})})),r.appendChild(a),r.appendChild(i),n.appendChild(r);var o=document.createElement("div"),s=document.createElement("span");return document.querySelector(".trimblemaps-ctrl-top-left > div.trimblemaps-menu-ctrl")||document.querySelector(".trimblemaps-ctrl-bottom-left > div.trimblemaps-menu-ctrl")?o.classList.add("trimblemaps-menu-tooltip-left"):o.classList.add("trimblemaps-menu-tooltip"),s.classList.add("trimblemaps-menu-tooltiptext"),s.innerHTML="Display starts at zoom level ".concat(e.minZoom),o.appendChild(s.cloneNode(!0)),n.appendChild(o),n.addEventListener("mouseover",(function(e){e.currentTarget.querySelector(".trimblemaps-menu-tooltiptext").style.visibility="visible"})),n.addEventListener("mouseout",(function(e){e.currentTarget.querySelector(".trimblemaps-menu-tooltiptext").style.visibility="hidden"})),n},e.prototype._toggleLayerMenu=function(){var e;null===(e=this._energyMenu)||void 0===e||e.classList.toggle("trimblemaps-energy-container-open")},e.prototype._setServiceUrls=function(e){this._energyLayers._setServiceUrls(e)},e.prototype.isLayerVisible=function(){return this._energyLayers.isVisible()},e.prototype.showEnergy=function(e){this._energyLayers.setVisibility(e)},e}()}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@trimblemaps/trimblemaps-js")):"function"==typeof define&&define.amd?define(["@trimblemaps/trimblemaps-js"],t):((e="undefined"!=typeof globalThis?globalThis:e||self).TrimbleMapsControl=e.TrimbleMapsControl||{},e.TrimbleMapsControl.EnergyControl=t(e.TrimbleMaps))}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=t(e);const s={STYLE_URL:"https://tiles.alk.com/styles/"};const r={layerId:"energy",isVisible:!1};class a extends e.ContentBase{constructor(e,t){super(function(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}({},r,t)),this._layerNames=[],this._urls=s,this._map=e}_setServiceUrls(e){Object.keys(this._urls).forEach((t=>{void 0!==e[t]&&(this._urls[t]=e[t])}))}_getContent(){const e=`${this._urls.STYLE_URL}v5/${this._map.getRegion()}/${this._map.getStyleName()}/${this._options.layerId}?key=${i.default.getAPIKey()||""}`;this._layerNames=[],fetch(e).then((e=>(this._map.fire("energyloading"),e.json()))).then((e=>{if(e.sources){for(const t in e.sources)this._map.getSource(t)||this._map.addSource(t,e.sources[t]);e.layers.length&&(e.layers.forEach((e=>{var t;this._layerNames.push(e.id);const i=(null===(t=e.metadata)||void 0===t?void 0:t.beforeLayer)||"";this._map.getLayer(i)?this._map.addLayer(e,i):this._map.addLayer(e)})),this.setVisibility(this._options.isVisible)),this._map.fire("energylayersloaded")}else console.warn(null==e?void 0:e.name)}))}addTo(e){return this._map=e,super.addTo(e)}remove(){return super.remove()}isVisible(){return super.isVisible()}setVisibility(e){return super.setVisibility(e)}toggleVisibility(){return super.toggleVisibility()}}class n{constructor(){this.mapHandlers=new Map}setMap(e){this.map=e}add(e){if(!this.map)return void console.warn("Handler cannot be added. The map has not been set for this manager.");this.map.on(e.eventName,e.listener);const t=e.eventName+Date.now();return this.mapHandlers.set(t,e),t}remove(e){const t=this.mapHandlers.get(e);this.map.off(t.eventName,t.listener),this.mapHandlers.delete(e)}removeAll(){this.mapHandlers.forEach((e=>{this.map.off(e.eventName,e.listener)})),this.mapHandlers.clear()}}return class{constructor(){this._mapHandlerManager=new n,this._energyLayerList=[{id:"heading",label:"NTS",layers:[],visible:!0,minZoom:0},{id:"energy_boundary_nts",label:"Boundary",layers:["energy_boundary_nts","energy_boundary_label_left_nts","energy_boundary_label_right_nts"],visible:!0,minZoom:6},{id:"energy_landuse_label_nts",label:"Area Label",layers:["energy_landuse_label_nts"],visible:!0,minZoom:6},{id:"heading",label:"DLS, PLSS, OTLS",layers:[],visible:!0,minZoom:0},{id:"energy_boundary",label:"Boundary",layers:["energy_boundary","energy_boundary_label_left","energy_boundary_label_right"],visible:!0,minZoom:9},{id:"energy_landuse_label",label:"Area Label",layers:["energy_landuse_label"],visible:!0,minZoom:9},{id:"energy_survey_point",label:"Survey Point",layers:["energy_survey_point"],visible:!1,minZoom:14},{id:"heading",label:"Places",layers:[],visible:!0,minZoom:0},{id:"energy_poi",label:"Wells and Facilities",layers:["energy_poi"],visible:!0,minZoom:12}],this._energyLayers=new a,this._outsideClickListener=e=>{var t;this._container.contains(e.target)||null===(t=this._energyMenu)||void 0===t||t.classList.remove("trimblemaps-energy-container-open")}}onAdd(e){this._map=e,this._mapHandlerManager.setMap(this._map),this._map.style._loaded?this._energyLayers.addTo(this._map):this._map.once("style.load",(()=>{this._energyLayers.addTo(this._map)})),this._container=document.createElement("div"),this._container.className="trimblemaps-ctrl trimblemaps-ctrl-group trimblemaps-energy-ctrl";const t=document.createElement("button");t.className="trimblemaps-ctrl-icon trimblemaps-energy-button",t.title="Energy",t.type="button",t.addEventListener("click",(()=>{this._toggleLayerMenu()})),this._energyMenu=document.createElement("div"),this._energyMenu.className="trimblemaps-energy-container";const i=document.createElement("div");i.className="trimblemaps-energy-arrow",this._energyMenu.appendChild(i);const s=document.createElement("h5");s.className="trimblemaps-energy-title",s.innerHTML="Energy Layers",this._energyMenu.appendChild(s);const r=document.createElement("div");return r.className="trimblemaps-energy-list",this._energyLayerList.forEach((e=>{if("heading"===e.id){const t=document.createElement("h6");return t.className="trimblemaps-energy-heading",t.innerHTML=e.label,void r.appendChild(t)}const t=this._createSwitch(e);r.appendChild(t)})),this._energyMenu.appendChild(r),this._container.appendChild(t),this._container.appendChild(this._energyMenu),document.addEventListener("click",this._outsideClickListener),this._map.once("styledata",(()=>{this._setSelectedLayers()})),this._map.on("style.load",(()=>{this._setSelectedLayers()})),this._map.on("idle",(()=>{this._setSelectedLayers()})),this._container}_setSelectedLayers(){this._container.querySelectorAll('input[type="checkbox"]').forEach((e=>{const t=e.checked,i=e.parentElement.parentElement.getAttribute("data-layer-id");this._map.getLayer(i)&&this._map.setLayoutProperty(i,"visibility",t?"visible":"none")}))}onRemove(){this._map&&(this._container.parentNode.removeChild(this._container),document.removeEventListener("click",this._outsideClickListener),this._mapHandlerManager.removeAll(),this._map=void 0)}_createSwitch(e){const t=document.createElement("div");t.className="trimblemaps-menu-item trimblemaps-menu-layer-item",t.setAttribute("data-layer-id",e.id),t.setAttribute("data-layer-name",e.label),t.setAttribute("data-layer-minzoom",e.minZoom.toString()),t.innerHTML=e.label;const i=document.createElement("div");i.className="trimblemaps-energy-custom-control trimblemaps-energy-custom-switch trimblemaps-energy-custom-control-inline";document.createElement("div").className="result-info text-ellipsis flex-element";const s=document.createElement("label");s.className="trimblemaps-energy-custom-control-label",s.setAttribute("for","switch_"+e.id);const r=document.createElement("INPUT");r.className="trimblemaps-energy-custom-control-input",r.setAttribute("type","checkbox"),r.setAttribute("role","switch"),r.setAttribute("aria-label",e.label),r.setAttribute("id","switch_"+e.id),r.setAttribute("data-energy-id",e.id),r.setAttribute("data-energy-name",e.label),e.visible?r.setAttribute("checked","checked"):(r.removeAttribute("checked"),this._map.once("energylayersloaded",(()=>{e.layers.forEach((e=>{this._map.setLayoutProperty(e,"visibility","none")}))}))),r.addEventListener("change",(t=>{const i=t.target.checked;e.layers.forEach((e=>{this._map.setLayoutProperty(e,"visibility",i?"visible":"none")})),this._map.fire("layervisibilitychange",{layerIds:e.layers,isSelected:i})})),i.appendChild(r),i.appendChild(s),t.appendChild(i);const a=document.createElement("div"),n=document.createElement("span");return document.querySelector(".trimblemaps-ctrl-top-left > div.trimblemaps-menu-ctrl")||document.querySelector(".trimblemaps-ctrl-bottom-left > div.trimblemaps-menu-ctrl")?a.classList.add("trimblemaps-menu-tooltip-left"):a.classList.add("trimblemaps-menu-tooltip"),n.classList.add("trimblemaps-menu-tooltiptext"),n.innerHTML=`Display starts at zoom level ${e.minZoom}`,a.appendChild(n.cloneNode(!0)),t.appendChild(a),t.addEventListener("mouseover",(e=>{e.currentTarget.querySelector(".trimblemaps-menu-tooltiptext").style.visibility="visible"})),t.addEventListener("mouseout",(e=>{e.currentTarget.querySelector(".trimblemaps-menu-tooltiptext").style.visibility="hidden"})),t}_toggleLayerMenu(){var e;null===(e=this._energyMenu)||void 0===e||e.classList.toggle("trimblemaps-energy-container-open")}_setServiceUrls(e){this._energyLayers._setServiceUrls(e)}isLayerVisible(){return this._energyLayers.isVisible()}showEnergy(e){this._energyLayers.setVisibility(e)}}}));

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc