Skip to content

Commit

Permalink
Merge branch 'feature/result_visualization' into feature/layers-in-re…
Browse files Browse the repository at this point in the history
…sults
  • Loading branch information
4lm committed May 23, 2019
2 parents ef62cd8 + f22a9c8 commit fe12669
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
category = app
name = 'StEmp-Tool Anhalt-Bitterfeld-Wittenberg'
icon = 'img/Anhalt_map_website_small.png'
icon = 'img/app_stemp_abw_icon_beta.png'
2 changes: 1 addition & 1 deletion config/layers_region.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
geom_type = poly
show = 0
# Test, replace with real source IDs and remove this comment
sources = 1,2,3
sources = 0
[[[style]]]
fillColor = '#969696'
weight = 1
Expand Down
Binary file added static/stemp_abw/img/Anhalt_map_website_beta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed static/stemp_abw/img/Anhalt_map_website_small.png
Binary file not shown.
10 changes: 6 additions & 4 deletions static/stemp_abw/js/map_functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ function execClickAction(e) {
var layer = e.target;
layer.setStyle(style);

// center map to clicked entity
layer._map.panTo(e.latlng, {duration: 1});

// load popup content from detail view
var url = "../popup/" + layer.feature.properties.name + "/"
+ String(layer.feature.id) + "/"
Expand All @@ -83,7 +80,12 @@ function execClickAction(e) {
}
});


// center map to clicked location, consider viewport size and panel area
var new_center = layer._map.project(e.latlng);
var map_size = layer._map.getSize();
new_center.y -= map_size.y/4; // find the height of the popup container, divide by 2, subtract from the Y axis of marker location
new_center.x -= map_size.x/8;
layer._map.panTo(layer._map.unproject(new_center), {duration: 1.5}); // pan to new center
}

// feature: mousover style
Expand Down
2 changes: 1 addition & 1 deletion templates/stemp_abw/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1 class="hp-hero__header">Regionaler Energiebalancekreis Anhalt-Bitterfeld-Wit
<h2 class="hp-hero__subheader">Szenarien unter dem Aspekt einer abgestimmten Flächennutzung</h2>
</div>
<div class="cell u-text--center hp-hero__img">
<img src="{% static 'stemp_abw/img/Anhalt_map_website.png' %}" alt="Anhalt Karte als Bild">
<img src="{% static 'stemp_abw/img/Anhalt_map_website_beta.png' %}" alt="Anhalt Karte als Bild">
</div>
<div class="cell u-text--center hp-hero__btn">
<a href="{% url 'stemp_abw:map' %}" class="btn btn-cta">
Expand Down
3 changes: 3 additions & 0 deletions templates/stemp_abw/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<li><a class="anchor-text--light" href="{% url 'stemp_abw:index' %}">Startseite</a></li>
</ul>
</div>
<div class="top-bar-left">
(Beta-Version)
</div>
<div class="top-bar-right">
<ul class="dropdown menu" id="nav-list-vertical" data-dropdown-menu>
<li><a class="anchor-text--light" href="{% url 'stemp_abw:privacy_policy' %}" style="font-weight: 300; padding-right: 1.5rem">Datenschutz</a></li>
Expand Down
12 changes: 11 additions & 1 deletion views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,17 @@ def __init__(self):

def get_context_data(self, **kwargs):
context = super(MapView, self).get_context_data(**kwargs)
context.update(io.prepare_layer_data())

# prepare layer data and move result layers to separate context var
layer_data = io.prepare_layer_data()
layer_data['layer_list'] = {layer: data
for layer, data in layer_data['layer_list'].items()
if data['cat'] != 'results'}
layer_data['layer_list_results'] = {layer: data
for layer, data in layer_data['layer_list'].items()
if data['cat'] == 'results'}
context.update(layer_data)

context.update(io.prepare_component_data())
context.update(io.prepare_scenario_data())
context.update(io.prepare_label_data())
Expand Down

0 comments on commit fe12669

Please sign in to comment.