Skip to content
Snippets Groups Projects
Commit 1d5022d3 authored by Glenn Vorhes's avatar Glenn Vorhes
Browse files

add option to suppress get legend for esri map layer

parent e7bb769a
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@ export declare function localCacheUrl(folder: string, service: string): string;
export interface LayerEsriMapServerOptions extends LayerBaseOptions {
addPopup?: boolean;
showLayers?: Array<number>;
getLegend?: boolean;
}
/**
* esri mapserver layer
......
......@@ -88,7 +88,10 @@ var LayerEsriMapServer = (function (_super) {
options.addPopup = typeof options.addPopup == 'boolean' ? options.addPopup : false;
_this._esriFormat = new ol.format.EsriJSON();
_this._popupRequest = null;
_this.addLegendContent();
options.getLegend = typeof options.getLegend === 'boolean' ? options.getLegend : true;
if (options.getLegend) {
_this.addLegendContent();
}
if (options.addPopup) {
mapPopup_1.default.addMapServicePopup(_this);
}
......
This diff is collapsed.
......@@ -45,6 +45,7 @@ export function localCacheUrl(folder: string, service: string): string{
export interface LayerEsriMapServerOptions extends LayerBaseOptions {
addPopup?: boolean;
showLayers?: Array<number>;
getLegend?: boolean;
}
/**
......@@ -95,6 +96,7 @@ export class LayerEsriMapServer extends LayerBase {
maxResolution: this._maxResolution
});
this._olLayer.setZIndex(this._zIndex);
options.addPopup = typeof options.addPopup == 'boolean' ? options.addPopup : false;
......@@ -102,7 +104,11 @@ export class LayerEsriMapServer extends LayerBase {
this._esriFormat = new ol.format.EsriJSON();
this._popupRequest = null;
this.addLegendContent();
options.getLegend = typeof options.getLegend === 'boolean' ? options.getLegend : true;
if (options.getLegend){
this.addLegendContent();
}
if (options.addPopup) {
mapPopup.addMapServicePopup(this);
......
......@@ -14,21 +14,44 @@
</head>
<body>
<!--<ul class="project-list ">-->
<!--<li>-->
<!--<a data-siteid="143" href="/veronard/">-->
<!--<i class="fa fa-caret-right" style="color: #f8983a"></i>-->
<!--Verona Road (US 18/151) Project</a></li>-->
<!--<li><a data-siteid="145" href="/i-39-90/"><i class="fa fa-caret-right" style="color: #f8983a"></i>I-39/90 Expansion-->
<!--Project</a></li>-->
<!--<li><a data-siteid="271" href="/beltlinebridges/"><i class="fa fa-caret-right" style="color: #f8983a"></i>Madison-->
<!--Beltline (US 12/18) bridges over Yahara River</a></li>-->
<!--<li><a data-siteid="294" href="/i39wis19/"><i class="fa fa-caret-right" style="color: #f8983a"></i>I-39/90/94 - WIS-->
<!--19 and CPR Overpass</a></li>-->
<!--<li><a data-siteid="357" href="/exit3/"><i class="fa fa-caret-right" style="color: #f8983a"></i>Exit 3 (I-90/US-->
<!--53/WIS 35) Interchange Reconstruction</a></li>-->
<!--<li><a data-siteid="393" href="/us18151countyid/"><i class="fa fa-caret-right" style="color: #f8983a"></i>US 18/151-->
<!--and County ID Interchange</a></li>-->
<!--<li><a data-siteid="398" href="/i39wis33us51/"><i class="fa fa-caret-right" style="color: #f8983a"></i>I-39 (WIS 33-->
<!--to US 51)</a></li>-->
<!--<li><a data-siteid="402" href="/wis13-wisconsindells/"><i class="fa fa-caret-right" style="color: #f8983a"></i>WIS-->
<!--13 (Broadway Street)</a></li>-->
<!--</ul>-->
<div id="header">
<span>WisDOT ITS Inventory </span>
<a title="Traffic Operations and Safety Lab" href="http://www.topslab.wisc.edu/">
<img src="http://transportal.cee.wisc.edu/gis/webmapsstatic/img/tops-logo.png">
</a>
<a title="WisDOT" href="http://wisconsindot.gov/Pages/home.aspx">
<img src="http://transportal.cee.wisc.edu/gis/webmapsstatic/img/wisdot.png">
</a>
<span>WisDOT ITS Inventory </span>
<a title="Traffic Operations and Safety Lab" href="http://www.topslab.wisc.edu/">
<img src="http://transportal.cee.wisc.edu/gis/webmapsstatic/img/tops-logo.png">
</a>
<a title="WisDOT" href="http://wisconsindot.gov/Pages/home.aspx">
<img src="http://transportal.cee.wisc.edu/gis/webmapsstatic/img/wisdot.png">
</a>
</div>
<div id="container">
<div id="left">
<div id="legend-container"></div>
</div>
<div id="map"></div>
<div id="left">
<div id="legend-container"></div>
</div>
<div id="map"></div>
</div>
<script>
var glob = {};
......@@ -38,5 +61,104 @@
<script src="../lib/ol.js"></script>
<script src="../js/itsMap.js"></script>
<!--<script>-->
<!--/**-->
<!--* Priority order, list project names to appear at top in array-->
<!--* Others ordered alphabetically-->
<!--* Example: var order = ['First site', 'Second Site'];-->
<!--* Be sure to include brackets and matching single or double quotes-->
<!--*/-->
<!--var order = ['I-39/90 Expansion Project', 'Verona Road (US 18/151) Project'];-->
<!--function shortName(n) {-->
<!--return n.replace(/<.*>/, '').replace(/(\s|\n|\t)/g, '').toLowerCase()-->
<!--}-->
<!--function projectSort() {-->
<!--var ul = jQuery('.project-list');-->
<!--var lis = ul.find('li');-->
<!--var checkOrder = [];-->
<!--var sites = [];-->
<!--var non_priorities = [];-->
<!--var $refLi;-->
<!--for (var i = 0; i < order.length; i++) {-->
<!--checkOrder.push(shortName(order[i]));-->
<!--}-->
<!--for (i = 0; i < lis.length; i++) {-->
<!--var $li = jQuery(lis[i]);-->
<!--if (i === 0) {-->
<!--$refLi = $li;-->
<!--}-->
<!--var name = shortName(lis[i].getElementsByTagName('a')[0].innerHTML);-->
<!--var cont = false;-->
<!--for (let j = 0; j < checkOrder.length; j++) {-->
<!--if (name === checkOrder[j]) {-->
<!--sites.push({name: name, el: $li});-->
<!--cont = true;-->
<!--break;-->
<!--}-->
<!--}-->
<!--if (cont) {-->
<!--continue;-->
<!--}-->
<!--non_priorities.push({name: name, el: $li})-->
<!--}-->
<!--sites.sort(function (a, b) {-->
<!--let indexA = checkOrder.indexOf(a['name']);-->
<!--let indexB = checkOrder.indexOf(b['name']);-->
<!--if (indexA === indexB) {-->
<!--return 0;-->
<!--} else {-->
<!--return indexA < indexB ? -1 : 1;-->
<!--}-->
<!--});-->
<!--non_priorities.sort(function (a, b) {-->
<!--let nameA = a['name'];-->
<!--let nameB = b['name'];-->
<!--if (nameA === nameB) {-->
<!--return 0;-->
<!--} else {-->
<!--return nameA < nameB ? -1 : 1;-->
<!--}-->
<!--});-->
<!--sites.push.apply(sites, non_priorities);-->
<!--if (sites.length > 0) {-->
<!--if ($refLi !== sites[0]['el']) {-->
<!--$refLi.before(sites[0]['el']);-->
<!--$refLi = sites[0]['el'];-->
<!--}-->
<!--if (sites.length > 1){-->
<!--for (i = 1; i < sites.length; i++){-->
<!--sites[i]['el'].insertAfter($refLi);-->
<!--$refLi = sites[i]['el'];-->
<!--}-->
<!--}-->
<!--}-->
<!--}-->
<!--jQuery(function () {-->
<!--projectSort();-->
<!--});-->
<!--</script>-->
</body>
</html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment