Skip to content
This repository was archived by the owner on Aug 14, 2023. It is now read-only.

Commit

Permalink
fixes #503, #502 - defaults basemap to streets and added toggle to cr…
Browse files Browse the repository at this point in the history
…eate site form; incremented version
  • Loading branch information
lprivette committed Jul 10, 2020
1 parent 5b7c69a commit 32fd8ae
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 22 deletions.
2 changes: 1 addition & 1 deletion code.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "STNWeb",
"organization": "U.S. Geological Survey",
"description": "Data management application for the USGS Short-Term Network (STN) database",
"version": "v2.3.4",
"version": "v2.3.5",

"status": "Production",

Expand Down
12 changes: 6 additions & 6 deletions src/component/map/mapCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,18 +504,18 @@
//////////!!!need to add legend="legend" back to map directive if using this!!!!!!!!
layers: {
baselayers: {
gray: {
name: "Gray",
type: "agsBase",
layer: "Gray",
visible: false
},
streets: {
name: "Streets",
type: "agsBase",
layer: "Streets",
visible: false
},
gray: {
name: "Gray",
type: "agsBase",
layer: "Gray",
visible: false
},
topo: {
name: "World Topographic",
type: "agsBase",
Expand Down
8 changes: 7 additions & 1 deletion src/component/site/site.html
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,14 @@ <h3 class="panel-title">
</ul>
</p>
<p>Click and drag the point to relocate this site (all related fields will update).</p>
<span class="radio-inline">
<input type="radio" id="streetsbmap" name="streetsB" ng-model="bmap" ng-change="changeBasemap(this)" value="st" /> Streets
</span>
<span class="radio-inline">
<input type="radio" id="imagerybmap" name="imageryB" ng-model="bmap" ng-change="changeBasemap(this)" value="img" /> Imagery
</span>
<div class="panel panel-primary" style="height:inherit">
<leaflet lf-center="mapCenter" width="100%" height="100%" markers="mapMarkers"></leaflet>
<leaflet id="siteMap" lf-center="mapCenter" width="100%" height="100%" markers="mapMarkers"></leaflet>
</div>
</div>
<br clear="all" />
Expand Down
24 changes: 12 additions & 12 deletions src/component/site/siteMapCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

$scope.paths = {};
$scope.markers = [];

///need to watch for session event id, do new call to server when that changes
$scope.$watch(function () { return $cookies.get('SessionEventID'); }, function (newValue) {
$scope.markers = [];
Expand Down Expand Up @@ -59,7 +59,7 @@
}//end if event_id == newVal
}
//filter all sensor types
addSensors(newValue);
addSensors(newValue);
} else {
for (var noEventH = 0; noEventH < $scope.allSiteHWMs.length; noEventH++) {
var eachnoEHWM = $scope.allSiteHWMs[noEventH];
Expand All @@ -75,7 +75,7 @@
}
//filter all sensor types
addSensors(0);
}
}
});

//called from $watch on event change to update all the sensor types viewed from sitemap
Expand Down Expand Up @@ -238,7 +238,7 @@
icon: icons.baroIcon,
title: 'Baro Sensor',
eventID: noEbSensor.event_id
});
});
}
//met
for (var noEms = 0; noEms < $scope.allSiteMetSensors.length; noEms++) {
Expand All @@ -252,7 +252,7 @@
icon: icons.metIcon,
title: 'Met Sensor',
eventID: noEmSensor.event_id
});
});
}
//rdg
for (var noErs = 0; noErs < $scope.allSiteRDGSensors.length; noErs++) {
Expand All @@ -266,7 +266,7 @@
icon: icons.rdgIcon,
title: 'RDG Sensor',
eventID: noErSensor.event_id
});
});
}
//storm
for (var noEss = 0; noEss < $scope.allSiteStormSensors.length; noEss++) {
Expand All @@ -281,7 +281,7 @@
title: 'Stormtide Sensor',
eventID: noEsSensor.event_id
});

}
//wave
for (var noEws = 0; noEws < $scope.allSiteWaveSensors.length; noEws++) {
Expand All @@ -295,7 +295,7 @@
icon: icons.waveIcon,
title: 'Waveheight Sensor',
eventID: noEwSensor.event_id
});
});
}
//pressureTemp
for (var noEps = 0; noEps < $scope.allSitePresTempSensors.length; noEps++) {
Expand All @@ -309,7 +309,7 @@
icon: icons.pressureIcon,
title: 'PressureTemp Sensor',
eventID: noEpSensor.event_id
});
});
}
//thermometer
for (var noEts = 0; noEts < $scope.allSiteThermSensors.length; noEts++) {
Expand All @@ -323,7 +323,7 @@
icon: icons.thermIcon,
title: 'Thermometer Sensor',
eventID: noEtSensor.event_id
});
});
}
//webcam
for (var noEwebs = 0; noEwebs < $scope.allSiteWebSensors.length; noEwebs++) {
Expand All @@ -337,7 +337,7 @@
icon: icons.webcamIcon,
title: 'Webcam Sensor',
eventID: noEwebSensor.event_id
});
});
}
//raingage
for (var noErains = 0; noErains < $scope.allSiteRainSensors.length; noErains++) {
Expand Down Expand Up @@ -443,7 +443,7 @@
minZoom: 16
},
markers: $scope.markers,
markersLatLngArray: [],
markersLatLngArray: [],
layers: {
baselayers: {
topo: {
Expand Down
28 changes: 26 additions & 2 deletions src/component/site/siteModalCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

var ModalControllers = angular.module('ModalControllers');

ModalControllers.controller('siteModalCtrl', ['$scope', '$rootScope', '$cookies', '$q', '$location', '$state', '$http', '$sce', '$timeout', '$uibModal', '$uibModalInstance', '$filter', 'leafletMarkerEvents', 'allDropDownParts',
ModalControllers.controller('siteModalCtrl', ['$scope', '$rootScope', '$cookies', '$q', '$location', '$state', '$http', '$sce', '$timeout', '$uibModal', '$uibModalInstance', '$filter', 'leafletData', 'leafletMarkerEvents', 'allDropDownParts',
'fileTypes', 'agencyList', 'latlong', 'thisSiteStuff', 'allMembers', 'SITE', 'SITE_HOUSING', 'Site_Files', 'MEMBER', 'INSTRUMENT', 'INSTRUMENT_STATUS', 'LANDOWNER_CONTACT', 'GEOCODE', 'FILE_STAMP', 'FILE', 'SOURCE', 'SERVER_URL',
function ($scope, $rootScope, $cookies, $q, $location, $state, $http, $sce, $timeout, $uibModal, $uibModalInstance, $filter, leafletMarkerEvents, allDropDownParts, fileTypes, agencyList, latlong, thisSiteStuff, allMembers, SITE,
function ($scope, $rootScope, $cookies, $q, $location, $state, $http, $sce, $timeout, $uibModal, $uibModalInstance, $filter,leafletData, leafletMarkerEvents, allDropDownParts, fileTypes, agencyList, latlong, thisSiteStuff, allMembers, SITE,
SITE_HOUSING, Site_Files, MEMBER, INSTRUMENT, INSTRUMENT_STATUS, LANDOWNER_CONTACT, GEOCODE, FILE_STAMP, FILE, SOURCE, SERVER_URL) {
//dropdowns
$scope.HorizontalDatumList = allDropDownParts[0];
Expand Down Expand Up @@ -176,6 +176,7 @@
draggable: true
});
$scope.showMap = true;
document.getElementById('streetsbmap').checked = true;
$rootScope.stateIsLoading.showLoading = false;// loading..
}, function error(errorResponse) {
$rootScope.stateIsLoading.showLoading = false;// loading..
Expand Down Expand Up @@ -224,6 +225,7 @@
}

$scope.aSite.decDegORdms = 'dd';
$scope.bmap = 'st';

$scope.originalSiteHousings = [];
$scope.checked = ""; $scope.checkedName = "Not Defined"; //comparers for disabling network names if 'Not Defined' checked
Expand Down Expand Up @@ -681,6 +683,28 @@
}
};

$scope.changeBasemap = function (clicked, $event) {
console.log(clicked);
$scope.bmap = clicked.bmap;
if ($scope.bmap == "img") {
document.getElementById('streetsbmap').checked = false;
leafletData.getMap("siteMap").then(function (map) {
var imagery = new L.esri.basemapLayer('Imagery');
map.addLayer(imagery);
});
document.getElementsByClassName( 'leaflet-control-attribution' )[0].style.display = 'none';
document.getElementsByClassName( 'esri-leaflet-logo leaflet-control' )[0].style.display = 'none';
} else if ($scope.bmap == "st") {
document.getElementById('imagerybmap').checked = false;
leafletData.getMap("siteMap").then(function (map) {
var streets = new L.esri.basemapLayer('Streets');
map.addLayer(streets);
});
document.getElementsByClassName( 'leaflet-control-attribution' )[0].style.display = 'none';
document.getElementsByClassName( 'esri-leaflet-logo leaflet-control' )[0].style.display = 'none';
}
};

//networkType check event --trigger dirty
$scope.netTypeChg = function (nt) {
//store this to handle in PUT or POST
Expand Down

0 comments on commit 32fd8ae

Please sign in to comment.