Verified Commit 4ab8b81c authored by Martin Raifer's avatar Martin Raifer
Browse files

convert public fields to class methods

which is what they actually were to begin with.
parent 959e0951
......@@ -36,7 +36,7 @@ class TrialsMap {
* Init map component using leaflet and timedimension
* and set the map overlays
*/
initMap = () => {
initMap() {
let mapOptions = this.buildMapOptions()
this.map = L.map(this.mapEl, mapOptions)
L.tileLayer(this.tileServiceUrl, { attribution: this.mapAttribution, subdomains: ['a', 'b', 'c'] }).addTo(this.map)
......@@ -60,7 +60,7 @@ class TrialsMap {
* Build map options object
* @returns {*} options
*/
buildMapOptions = () => {
buildMapOptions() {
var currentDate = new Date().toISOString().split('T')[0]
let mapOptions = {
zoom: 2,
......@@ -82,7 +82,7 @@ class TrialsMap {
* by creating the studyCategoryColors and
* studyTypeColors props
*/
setTaxonomiesColors = () => {
setTaxonomiesColors() {
this.studyCategoryColors = {
drugs : '#7FC97F',
vaccine: '#BEAED4',
......@@ -105,7 +105,7 @@ class TrialsMap {
* if the layers already exist, remove them
* and add again, refreshing the data
*/
setMapOverlayers = () => {
setMapOverlayers() {
// add legend
if (this.loadByTaxonomy=== "types") {
this.addLegendStudyType();
......@@ -135,7 +135,7 @@ class TrialsMap {
/**
* Add the study type legend overlayer
*/
addLegendStudyType = () => {
addLegendStudyType() {
// If it was already loaded before, remove before loading again
if (this.legendByType) {
this.map.removeControl(legendByType)
......@@ -149,7 +149,7 @@ class TrialsMap {
* Build types legend html fragment
* @returns {DocumentFragment} fragment
*/
buildStudyTypesFragment = () => {
buildStudyTypesFragment() {
var typesFragment = L.DomUtil.create('div', 'info legend')
typesFragment.innerHTML += 'Study types (click to hide/show)<br><br>'
let fragment = new DocumentFragment()
......@@ -182,7 +182,7 @@ class TrialsMap {
* Add study cateogires legend overlayer
* with toggle cagetegory visibility function
*/
addLegendStudyCategory = () => {
addLegendStudyCategory() {
// If it was already loaded before, remove before loading again
if (this.legendByCategory) {
this.map.removeControl(this.legendByCategory)
......@@ -196,7 +196,7 @@ class TrialsMap {
* Build categories legend html fragment
* @returns {DocumentFragment} fragment
*/
buildCategoriesLegendFragment = () => {
buildCategoriesLegendFragment() {
var categoriesFragment = L.DomUtil.create('div', 'info legend')
categoriesFragment.innerHTML += 'Study categories (click to hide/show)<br><br>'
let fragment = new DocumentFragment();
......@@ -234,7 +234,7 @@ class TrialsMap {
* in order to update the given category overlay status (visible or not)
* @param {String} category
*/
toggleCategoryVisibility = (category) => {
toggleCategoryVisibility(category) {
let catIndex = this.timeDimension_layer.disabledTaxonomies.indexOf(category)
if (catIndex > -1) {
this.timeDimension_layer.disabledTaxonomies.splice(catIndex, 1)
......@@ -251,7 +251,7 @@ class TrialsMap {
* @param {*} feature
* @return {*} style
*/
getStyleStudyType = (feature) => {
getStyleStudyType(feature) {
let type = feature.properties.study_type
let style = { fillColor: 'grey', color: 'black', radius: 7, fillOpacity: 0.5, weight: 1, opacity: 1 }
......@@ -267,7 +267,7 @@ class TrialsMap {
* @param {*} feature
* @return {*} style
*/
getStyleStudyCategory = (feature) => {
getStyleStudyCategory(feature) {
let category = feature.properties.classification
let style = { fillColor: '#666666', color: 'grey', radius: 7, fillOpacity: 0.5, weight: 1, opacity: .7, }
......@@ -281,7 +281,7 @@ class TrialsMap {
/**
* Add the geojson layer after loading the geojson data from projectCentroidsUrl
*/
addGeojsonLayer = () => {
addGeojsonLayer() {
var geojsonData = $.ajax({ url: this.projectCentroidsUrl, dataType: "json" })
// Specify that this code should run once the county data request is complete
......@@ -313,7 +313,7 @@ class TrialsMap {
* @param {*} jsonData
* @returns {*} layer
*/
buidGeojsonLayer = (jsonData) => {
buidGeojsonLayer(jsonData) {
let layer
// create geojson layer
if (this.loadByTaxonomy=== "categories") {
......@@ -344,7 +344,7 @@ class TrialsMap {
* and show the popup for the given study
* @param event
*/
circleMarkerClick = (event) => {
circleMarkerClick(event) {
let properties = event.target.feature.properties
let geometry = event.target.feature.geometry
var popup = new L.Popup()
......@@ -371,7 +371,7 @@ class TrialsMap {
* @param {*} geojsonData
* @param {String} tableEl
*/
populateDataTable = (geojsonData, tableEl) => {
populateDataTable(geojsonData, tableEl) {
var tableRef = document.getElementById(tableEl).getElementsByTagName('tbody')[0]
geojsonData.features.forEach(function (element) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment