Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapa de monumentos #1

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions README.md
Expand Up @@ -2,8 +2,15 @@

## O projeto

Queremos criar um mapa interativo dos equipamentos culturais em Portugal - bibliotecas, cinemas, teatros, salas de espectáculo, galerias de arte, etc.
Este projeto comunitário do Interruptor é inspirado na série "Até onde chega a cultura?".
Estamos a criar um mapa dos equipamentos culturais em Portugal.

![mapa-exemplo](./assets/screenshots/screenshot-1.png)

Este é um projeto comunitário do [Interruptor](https://interruptor.pt/) inspirado na série *[Até onde chega a cultura?](https://interruptor.pt/podcasts/interruptor)*, que explora a distribuição geográfica de diversos equipamentos no nosso território para tentar perceber o alcance da cultura. Foi iniciado durante o [Hacktoberfest 2020](https://interruptor.pt/artigos/interruptor-x-hacktoberfest).

Os contribuidores iniciais incluem membros de várias comunidades locais ligadas aos movimentos de cultura e software livres, nomeadamente: [Flutter](https://github.com/FlutterPortugal), [Python](https://python.pt/), [Ubuntu](https://ubuntu-pt.org/) e [Wikimedia](https://pt.wikimedia.org/wiki/Wikimedia_Portugal).

É possível ter acesso ao mapa por meio deste [link](https://interruptorpt.github.io/ate-onde-chega-cultura/mapa).

### O que queremos mapear?

Expand All @@ -13,7 +20,7 @@ Este projeto comunitário do Interruptor é inspirado na série "Até onde chega
- [x] [museus](https://interruptorpt.github.io/ate-onde-chega-cultura/museus)
- [x] [recintos de espectáculo](https://interruptorpt.github.io/ate-onde-chega-cultura/recintos)
- [x] [galerias de arte](https://interruptorpt.github.io/ate-onde-chega-cultura/galerias)

- [x] [monumentos](https://interruptorpt.github.io/ate-onde-chega-cultura/monumentos)

## Contribuir

Expand Down
Binary file added assets/screenshots/screenshot-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 11 additions & 9 deletions bibliotecas.html
Expand Up @@ -24,14 +24,16 @@ <h3>Lista e mapa das Bibliotecas em Portugal</h3>

<script>
var wikidataQuery = `
#Map of libraries in Portugal
SELECT ?itemLabel ?geo WHERE {
?item wdt:P31/wdt:P279* wd:Q7075;
wdt:P625 ?geo .
?item wdt:P17 wd:Q45 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "pt,en" } .
}
`
# Map of libraries in Portugal
#defaultView:Map
SELECT ?itemLabel ?geo WHERE {
?item wdt:P31/wdt:P279* wd:Q7075. # Item is an instance or subclass of Library (Q7075)
?item wdt:P625 ?geo. # Store item's geographic coordinates in the ?geo variable
?item wdt:P17 wd:Q45. # Item's country is Portugal

SERVICE wikibase:label { bd:serviceParam wikibase:language "pt,en" }.
}
`
var urlPrefix = "https://query.wikidata.org/embed.html#"
var frame = document.getElementById("wikidataframe")
frame.src = urlPrefix + encodeURI(wikidataQuery)
Expand All @@ -49,4 +51,4 @@ <h3>Lista e mapa das Bibliotecas em Portugal</h3>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous">
</script> -->
</body>
</body>
18 changes: 10 additions & 8 deletions cinemas.html
Expand Up @@ -24,14 +24,16 @@ <h3>Lista e mapa dos Cinemas em Portugal</h3>

<script>
var wikidataQuery = `
# List of cinemas in Portugal
SELECT ?itemLabel ?geo WHERE {
?item (wdt:P31/(wdt:P279*)) wd:Q41253;
wdt:P625 ?geo;
wdt:P17 wd:Q45.
SERVICE wikibase:label { bd:serviceParam wikibase:language "pt,en". }
}
`
# Map of cinemas in Portugal
#defaultView:Map
SELECT ?itemLabel ?geo WHERE {
?item wdt:P31/wdt:P279* wd:Q41253. # Item is an instance or subclass of Cinema (Q41253)
?item wdt:P625 ?geo. # Store item's geographic coordinates in the ?geo variable
?item wdt:P17 wd:Q45. # Item's country is Portugal

SERVICE wikibase:label { bd:serviceParam wikibase:language "pt,en". }
}
`
var urlPrefix = "https://query.wikidata.org/embed.html#"
var frame = document.getElementById("wikidataframe")
frame.src = urlPrefix + encodeURI(wikidataQuery)
Expand Down
18 changes: 10 additions & 8 deletions galerias.html
Expand Up @@ -24,14 +24,16 @@ <h3>Lista e mapa de Galerias de Arte em Portugal</h3>

<script>
var wikidataQuery = `
# List of art galleries in Portugal
SELECT ?itemLabel ?geo WHERE {
?item wdt:P31/wdt:P279* wd:Q1007870;
wdt:P625 ?geo .
?item wdt:P17 wd:Q45 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "pt,en" } .
}
`
# Map of art galleries in Portugal
#defaultView:Map
SELECT ?itemLabel ?geo WHERE {
?item wdt:P31/wdt:P279* wd:Q1007870. # Item is an instance or subclass of Art gallery (Q1007870)
?item wdt:P625 ?geo. # Store item's geographic coordinates in the ?geo variable
?item wdt:P17 wd:Q45. # Item's country is Portugal

SERVICE wikibase:label { bd:serviceParam wikibase:language "pt,en" }.
}
`
var urlPrefix = "https://query.wikidata.org/embed.html#"
var frame = document.getElementById("wikidataframe")
frame.src = urlPrefix + encodeURI(wikidataQuery)
Expand Down
1 change: 1 addition & 0 deletions images/filter_frames24px.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/local_library24px.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/movie24px.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/museum24px.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/theater_comedy24px.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/workspaces_filled24px.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 80 additions & 0 deletions mapa.html
@@ -0,0 +1,80 @@
<html>
<head>
<link rel="stylesheet"
href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
crossorigin=""/>
<script
src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
</head>
<body>
<style>
#mapid { height: 90vh; }
</style>
<div id="mapid"></div>

<script>
var categories = [
{ name: "Bibliotecas", icon: "local_library", subclass: "Q7075" },
{ name: "Cinemas", icon: "movie", subclass: "Q41253" },
{ name: "Galerias", icon: "filter_frames", subclass: "Q1007870" },
{ name: "Museus", icon: "museum", subclass: "Q33506" },
{ name: "Recintos", icon: "workspaces_filled", subclass: "Q18674739" },
{ name: "Teatros", icon: "theater_comedy", subclass: "Q24354" },
];

var mymap = L.map('mapid').setView([41.14961, -8.61099], 13);

L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
subdomains: ['a', 'b', 'c'],
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
}).addTo(mymap);

async function loadCategoryLayer(category) {
const url = `https://query.wikidata.org/bigdata/namespace/wdq/sparql?format=json&query=${encodeURIComponent(`
SELECT ?itemLabel ?geo WHERE {
# Item is an instance or subclass of the given category
?item wdt:P31/wdt:P279* wd:${category.subclass}.
# Store item's geographic coordinates in the ?geo variable
?item wdt:P625 ?geo.
# Item's country is Portugal
?item wdt:P17 wd:Q45.

SERVICE wikibase:label { bd:serviceParam wikibase:language "pt,en" }.
}
`)}`;

const points = await fetch(url).then(r => r.json());

var icon = L.icon({
iconUrl: `images/${category.icon}24px.svg`,
iconSize: [24, 24],
iconAnchor: [12, 12],
popupAnchor: [0, -12],
});

const layer = L.layerGroup([]);

points.results.bindings.forEach(point => {
const geo = point.geo.value;
const label = point.itemLabel.value;
const coords = /Point\((.*) (.*)\)/.exec(geo).slice(1, 3).map(a => parseFloat(a)).reverse();

layer.addLayer(L.marker(coords, { icon }).bindPopup(label));
});

layer.addTo(mymap);

return { ...category, layer };
}

Promise.all(categories.map(loadCategoryLayer)).then(cats => {
const config = Object.fromEntries(cats.map(c => [`<img src="images/${c.icon}24px.svg"> ${c.name}`, c.layer]));

L.control.layers({}, config).addTo(mymap);
});
</script>
</body>
</html>
18 changes: 18 additions & 0 deletions mobileapp/android/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
5 changes: 5 additions & 0 deletions mobileapp/lib/enum/selectedType.dart
Expand Up @@ -9,6 +9,7 @@ enum SelectedType {
MUSEUS,
RECINTOS,
TEATROS,
MONUMENTOS,
}

extension SelectedTypeExtension on SelectedType {
Expand All @@ -26,6 +27,8 @@ extension SelectedTypeExtension on SelectedType {
return 'Q18674739';
case SelectedType.TEATROS:
return 'Q24354';
case SelectedType.MONUMENTOS:
return 'Q4989906';
}
}

Expand All @@ -43,6 +46,8 @@ extension SelectedTypeExtension on SelectedType {
return Icons.workspaces_filled;
case SelectedType.TEATROS:
return Icons.theater_comedy;
case SelectedType.MONUMENTOS:
return Icons.account_balance;
}
}

Expand Down
1 change: 1 addition & 0 deletions mobileapp/lib/main.dart
Expand Up @@ -74,6 +74,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
layers: [
TileLayerOptions(
tileProvider: NetworkTileProvider(), // Needed for the map to render in Linux
urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
subdomains: ['a', 'b', 'c']),
MarkerLayerOptions(
Expand Down
1 change: 1 addition & 0 deletions mobileapp/linux/.gitignore
@@ -0,0 +1 @@
flutter/ephemeral
106 changes: 106 additions & 0 deletions mobileapp/linux/CMakeLists.txt
@@ -0,0 +1,106 @@
cmake_minimum_required(VERSION 3.10)
project(runner LANGUAGES CXX)

set(BINARY_NAME "mobileapp")
set(APPLICATION_ID "pt.interruptor.ateondechegaacultura.mobileapp")

cmake_policy(SET CMP0063 NEW)

set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")

# Configure build options.
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Debug" CACHE
STRING "Flutter build mode" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Profile" "Release")
endif()

# Compilation settings that should be applied to most targets.
function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_14)
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
endfunction()

set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")

# Flutter library and tool build rules.
add_subdirectory(${FLUTTER_MANAGED_DIR})

# System-level dependencies.
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)

add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")

# Application build
add_executable(${BINARY_NAME}
"main.cc"
"my_application.cc"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
)
apply_standard_settings(${BINARY_NAME})
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
add_dependencies(${BINARY_NAME} flutter_assemble)
# Only the install-generated bundle's copy of the executable will launch
# correctly, since the resources must in the right relative locations. To avoid
# people trying to run the unbundled copy, put it in a subdirectory instead of
# the default top-level location.
set_target_properties(${BINARY_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
)

# Generated plugin build rules, which manage building the plugins and adding
# them to the application.
include(flutter/generated_plugins.cmake)


# === Installation ===
# By default, "installing" just makes a relocatable bundle in the build
# directory.
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()

# Start with a clean build bundle directory every time.
install(CODE "
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
" COMPONENT Runtime)

set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")

install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime)

install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)

install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)

if(PLUGIN_BUNDLED_LIBRARIES)
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()

# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
install(CODE "
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
" COMPONENT Runtime)
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)

# Install the AOT library on non-Debug builds only.
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()