Browse Source

Adiciona mapa com plotagem das Casas que foram diagnosticadas.

stable/1.0
Sesostris Vieira 12 years ago
parent
commit
3ae47541d6
  1. 5565
      docs/arquivos/COORDENADAS_SEDE_MUNICPIO-1.csv
  2. BIN
      media/images/mapmarker.png
  3. 54
      sigi/templates/diagnosticos/mapa.html
  4. 46
      sigi/templates/index.html
  5. 6
      sigi/templates/snippets/modules/charts-convenios.html
  6. 8
      sigi/urls.py

5565
docs/arquivos/COORDENADAS_SEDE_MUNICPIO-1.csv

File diff suppressed because it is too large

BIN
media/images/mapmarker.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

54
sigi/templates/diagnosticos/mapa.html

@ -0,0 +1,54 @@
{% extends "admin/index.html" %}
{% load adminmedia %}
{% block title %}SIGI{% endblock %}
{% block extrahead %}
{{ block.super }}
<script type="text/javascript" src="{% admin_media_prefix %}js/core.js"></script>
<script type="text/javascript" src="{% admin_media_prefix %}js/jquery.min.js"></script>
<script type="text/javascript" src="{% admin_media_prefix %}js/jquery.init.js"></script>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"> </script>
<script type="text/javascript">
(function($) {
$(document).ready(function($) {
var latlng = new google.maps.LatLng(-14.2350040, -51.925280);
var myOptions = {
zoom: 5,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"),
myOptions);
$.get("/sigi/diagnosticos/mundiagjson/", function(municipios) {
for (var i in municipios) {
var municipio = municipios[i];
var markData = {
map: map,
position: new google.maps.LatLng(municipio.lat, municipio.lng),
title: municipio.nome,
icon: '{{ MEDIA_URL }}images/mapmarker.png' //'/sigi/media/images/mapmarker.png'
}
var mark = new google.maps.Marker(markData);
var infoWin = new google.maps.InfoWindow({content:
'<strong>' + municipio.nome + '</strong><br/>' +
'<strong>Início da visita:</strong><br/>' + municipio.inicio + '<br/>' +
'<strong>Término da visita:</strong><br/>' + municipio.fim + '<br/>' +
'<strong>Equipe:</trong><br/>' + municipio.equipe });
linkMarkMessage(mark, infoWin, map);
}
});
function linkMarkMessage(mark, infoWin, map) {
google.maps.event.addListener(mark, 'click', function() {
infoWin.open(map, mark);});
}
})})(django.jQuery);
</script>
{% endblock %}
{% block content %}
<div id="map" style="width:100%; height: 800px; float: left;"></div>
{% endblock %}

46
sigi/templates/index.html

@ -1,6 +1,52 @@
{% extends "admin/index.html" %}
{% load adminmedia %}
{% block title %}SIGI{% endblock %}
{% block extrahead %}
{{ block.super }}
<script type="text/javascript" src="{% admin_media_prefix %}js/core.js"></script>
<script type="text/javascript" src="{% admin_media_prefix %}js/jquery.min.js"></script>
<script type="text/javascript" src="{% admin_media_prefix %}js/jquery.init.js"></script>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"> </script>
<script type="text/javascript">
(function($) {
$(document).ready(function($) {
var latlng = new google.maps.LatLng(-14.2350040, -51.925280);
var myOptions = {
zoom: 3,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
$.get("/sigi/diagnosticos/mundiagjson/", function(municipios) {
for (var i in municipios) {
var municipio = municipios[i];
var markData = {
map: map,
position: new google.maps.LatLng(municipio.lat, municipio.lng),
title: municipio.nome,
icon: '{{ MEDIA_URL }}images/mapmarker.png' //'/sigi/media/images/mapmarker.png'
}
var mark = new google.maps.Marker(markData);
var infoWin = new google.maps.InfoWindow({content:
'<strong>' + municipio.nome + '</strong><br/>' +
'<strong>Início da visita:</strong><br/>' + municipio.inicio + '<br/>' +
'<strong>Término da visita:</strong><br/>' + municipio.fim + '<br/>' +
'<strong>Equipe:</trong><br/>' + municipio.equipe });
linkMarkMessage(mark, infoWin, map);
}
});
function linkMarkMessage(mark, infoWin, map) {
google.maps.event.addListener(mark, 'click', function() {
infoWin.open(map, mark);});
}
})
})(django.jQuery);
</script>
{% endblock %}
{% block content_title %}<h1>Dashboard</h1>{% endblock %}
{% block content %}

6
sigi/templates/snippets/modules/charts-convenios.html

@ -116,13 +116,17 @@
<h2>Diagnósticos</h2>
<h3>Resumo dos diagnósticos</h3>
<table>
<table style="display: block; float: left;">
{% for data in tabela_resumo_diagnostico %}
<tr>
<th>{{ data.title }}</th>
<td style="text-align: right;">{{ data.count }}</td>
</tr>
{% endfor %}
<tr><td colspan="2"><a href="/sigi/diagnosticos/mapa/">Ver mapa ampliado</a></td></tr>
</table>
<div id="map_canvas" style="float: left; height: 80%; width: 300px;">
</div>
</div>

8
sigi/urls.py

@ -1,7 +1,7 @@
#-*- coding:utf-8 -*-
from django.conf import settings
from django.conf.urls.defaults import patterns, include, url
from django.views.generic.simple import redirect_to
from django.views.generic.simple import redirect_to, direct_to_template
import sites
# register admin filters
@ -14,6 +14,9 @@ urlpatterns = patterns(
# Diagnosticos
(r'^sigi/mobile/diagnosticos/', include('sigi.apps.diagnosticos.urls')),
(r'^sigi/diagnosticos/mapa/$', direct_to_template, {'template': 'diagnosticos/mapa.html'}),
(r'^sigi/diagnosticos/mundiagjson/$', 'sigi.apps.diagnosticos.views.municipios_diagnosticados'),
# Informacoes de uma casa legislativa
(r'^sigi/casas/casalegislativa/(?P<id>\w+)/report_complete/',
@ -86,6 +89,9 @@ urlpatterns = patterns(
'sigi.apps.diagnosticos.views.graficos'),
(r'^sigi/api/diagnosticos/$',
'sigi.apps.diagnosticos.views.grafico_api'),
# Views dos serviços SEIT
(r'^sigi/servicos/listacasas/(?P<sigla>\w+)',
'sigi.apps.servicos.views.casas_usam_servico'),
# automatic interface based on admin
#(r'^sigi/(.*)', sites.default.root),
(r'^sigi/', include(sites.default.urls)),

Loading…
Cancel
Save