Skip to content

Commit

Permalink
fixing a bug in region visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
Masoumeh committed Apr 10, 2017
1 parent 50cde7b commit cb6dd25
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
1 change: 1 addition & 0 deletions handle_marker.js
Expand Up @@ -35,6 +35,7 @@ function create_marker(feature,latlng) {
type: feature.properties.althurayyaData.top_type,
center: feature.properties.althurayyaData.visual_center,
region: feature.properties.althurayyaData.region,
// TODO: should change the region_spelled to read from properties.althurayyaData
region_spelled: feature.archive.cornuData.region_spelled,
searchTitle: feature.properties.althurayyaData.names.english.search,
arabicTitle: feature.properties.althurayyaData.names.arabic.common,
Expand Down
7 changes: 4 additions & 3 deletions handle_routes.js
Expand Up @@ -64,13 +64,14 @@ function handle_routes(feature,layer) {
* even though in the code they get gray first (in else)!
*/
if (sRegion == eRegion) {
if (route_layers[marker_properties[keys[i]].region_spelled] == undefined)
route_layers[marker_properties[keys[i]].region_spelled] = [];
route_layers[marker_properties[keys[i]].region_spelled].push(layer);
if (route_layers[marker_properties[keys[i]].region] == undefined)
route_layers[marker_properties[keys[i]].region] = [];
route_layers[marker_properties[keys[i]].region].push(layer);
//customLineStyle(layer, colorLookup[sRegion], 2, 1);
//layer.options.default_color = colorLookup[sRegion];
// new structure of places.geojson file
customLineStyle(layer, regions[sRegion]['color'], 2, 1);
//console.log(layer)
layer.options.default_color = regions[sRegion]['color'];
}
else {
Expand Down
11 changes: 2 additions & 9 deletions index.js
Expand Up @@ -251,7 +251,7 @@ function click_region(reg) {
// new structure of places.geojson file
//customLineStyle(lay,colorLookup[
// map_region_to_code[key]], 2, 1);
customLineStyle(lay,regions[map_region_to_code[key]]['color'], 2, 1);
customLineStyle(lay,regions[key]['color'], 2, 1);
});

});
Expand All @@ -269,8 +269,6 @@ function click_region(reg) {
//if (marker_properties[key].center == "yes") {
// map.panTo(markers[key].getLatLng());

//console.log(markers[key])

markers[key].setStyle({
fillColor: "red"
, color: "red"
Expand All @@ -283,17 +281,12 @@ function click_region(reg) {
all_route_layers.forEach(function(lay) {
customLineStyle(lay, "gray", 2, 0.8); /* "lightgray" */
});

if(route_layers[reg] != undefined) {
route_layers[reg].forEach(function (lay) {
customLineStyle(lay, 'red', 3, 1);
});
}
// find the region visual center from regions.js in which the
// display name is the clicked region in UI
for (var k in regions)
if (regions[k]['display'] == reg)
map.panTo(markers[regions[k]['visual_center']].getLatLng());
map.panTo(markers[regions[reg]['visual_center']].getLatLng());
}
}

Expand Down

0 comments on commit cb6dd25

Please sign in to comment.