-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/EsriDE/urban-heat-risk-index
- Loading branch information
Showing
22 changed files
with
970 additions
and
6 deletions.
There are no files selected for viewing
Binary file added
BIN
+6.54 KB
...e-apps/urban-heat-analyzer/UrbanHeatAnalyzer/Android/res/drawable-hdpi/icon.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 added
BIN
+3.72 KB
...e-apps/urban-heat-analyzer/UrbanHeatAnalyzer/Android/res/drawable-ldpi/icon.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 added
BIN
+4.58 KB
...e-apps/urban-heat-analyzer/UrbanHeatAnalyzer/Android/res/drawable-mdpi/icon.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 added
BIN
+17.4 KB
...-apps/urban-heat-analyzer/UrbanHeatAnalyzer/Android/res/drawable-xhdpi/icon.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 added
BIN
+45.6 KB
...apps/urban-heat-analyzer/UrbanHeatAnalyzer/Android/res/drawable-xxhdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
126 changes: 126 additions & 0 deletions
126
native-apps/urban-heat-analyzer/UrbanHeatAnalyzer/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
#------------------------------------------------- | ||
# Copyright 2024 ESRI | ||
# | ||
# All rights reserved under the copyright laws of the United States | ||
# and applicable international laws, treaties, and conventions. | ||
# | ||
# You may freely redistribute and use this sample code, with or | ||
# without modification, provided you include the original copyright | ||
# notice and use restrictions. | ||
# | ||
# See the Sample code usage restrictions document for further information. | ||
#------------------------------------------------- | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
project(UrbanHeatAnalyzer LANGUAGES CXX) | ||
|
||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) | ||
|
||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
||
set(CMAKE_AUTOUIC OFF) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
if(IOS) | ||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) | ||
set(CMAKE_OSX_DEPLOYMENT_TARGET "16.0" CACHE STRING "Minimum iOS deployment version" FORCE) | ||
elseif(APPLE) | ||
set(CMAKE_OSX_DEPLOYMENT_TARGET "13.0" CACHE STRING "Minimum macOS deployment version" FORCE) | ||
endif() | ||
|
||
find_package(Qt6 COMPONENTS REQUIRED Core Quick Multimedia Positioning Sensors WebSockets) | ||
if (Qt6Core_VERSION VERSION_LESS 6.5.6) | ||
message(FATAL_ERROR "This version of the ArcGIS Maps SDK for Qt requires at least Qt 6.5.6") | ||
endif() | ||
if(ANDROID OR IOS) | ||
find_package(Qt6 COMPONENTS REQUIRED Bluetooth) | ||
endif() | ||
find_package(ArcGISRuntime 200.5.0 COMPONENTS REQUIRED Cpp) | ||
|
||
set(SOURCE_FILES | ||
main.cpp | ||
UrbanHeatAnalyzer.cpp | ||
UrbanHeatAnalyzer.h | ||
HeatRiskListModel.cpp | ||
HeatRiskListModel.h | ||
qml/qml.qrc | ||
Resources/Resources.qrc | ||
$<$<BOOL:${WIN32}>:Win/Resources.rc> | ||
$<$<BOOL:${APPLE}>:Mac/AppIcon.icns>) | ||
|
||
if(ANDROID) | ||
qt_add_executable(${PROJECT_NAME} ${SOURCE_FILES}) | ||
else() | ||
qt_add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${SOURCE_FILES}) | ||
# IOS uses static Runtimecore Framework | ||
if(IOS) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH @executable_path/Frameworks | ||
XCODE_EMBED_FRAMEWORKS ${ArcGISRuntime_runtimecore_LIB} | ||
XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY TRUE) | ||
endif() | ||
# On MacOSX add icon to app bundle. | ||
set(MACOSX_BUNDLE_ICON_FILE AppIcon.icns) | ||
set_source_files_properties(Mac/AppIcon.icns | ||
PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") | ||
|
||
# Copy required dynamic libraries to the build folder as a post-build step. | ||
if(DEFINED ArcGISRuntime_LIBRARIES) | ||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy_if_different | ||
${ArcGISRuntime_LIBRARIES} | ||
$<TARGET_FILE_DIR:${PROJECT_NAME}>) | ||
endif() | ||
endif() | ||
|
||
target_compile_definitions(${PROJECT_NAME} | ||
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) | ||
|
||
target_link_libraries(${PROJECT_NAME} PRIVATE | ||
Qt6::Core | ||
Qt6::Quick | ||
Qt6::Multimedia | ||
Qt6::Positioning | ||
Qt6::Sensors | ||
Qt6::WebSockets | ||
ArcGISRuntime::Cpp) | ||
|
||
# To integrate the toolkit, copy the `toolkitcpp` subdirectory from the toolkit | ||
# into your project's directory. Then uncomment the following lines to add it to your project. | ||
# See https://github.com/Esri/arcgis-maps-sdk-toolkit-qt for details | ||
# add_subdirectory(toolkitcpp) | ||
# target_link_libraries(${PROJECT_NAME} PRIVATE libtoolkitcpp) | ||
|
||
if(ANDROID OR IOS) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Bluetooth) | ||
endif() | ||
|
||
if(ANDROID) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt::CorePrivate) | ||
|
||
set(PROJECT_DEPLOYABLE_LIBS | ||
${ArcGISRuntime_LIBRARIES}) | ||
|
||
list(JOIN PROJECT_DEPLOYABLE_LIBS , PROJECT_DEPLOYABLE_LIBS_STRING) | ||
|
||
# Setup openssl by cloning the repo https://github.com/KDAB/android_openssl More info at https://doc.qt.io/qt-6/android-openssl-support.html | ||
# QtCreator can also be used to install openssl https://doc.qt.io/qtcreator/creator-developing-android.html#specifying-android-device-settings | ||
# Uncomment line below and point to your openssl path. | ||
|
||
#include(<your_path_to_android_openssl>/CMakeLists.txt) | ||
|
||
# QtCreator supports the following variables for Android, which are identical | ||
# to qmake Android variables. | ||
# Check http://doc.qt.io/qt-6/deployment-android.html for more information. | ||
# Setting this property changed at Qt6 see doc below. | ||
# https://doc.qt.io/qt-6/cmake-target-property-qt-android-extra-libs.html | ||
|
||
set_property(TARGET ${PROJECT_NAME} PROPERTY QT_ANDROID_EXTRA_LIBS ${PROJECT_DEPLOYABLE_LIBS_STRING} ${ANDROID_EXTRA_LIBS}) | ||
get_property(EXTRA_LIBS TARGET ${PROJECT_NAME} PROPERTY QT_ANDROID_EXTRA_LIBS) | ||
if(NOT EXTRA_LIBS MATCHES "libssl" OR NOT EXTRA_LIBS MATCHES "libcrypto") | ||
message(WARNING "openssl libraries are missing, check the project CMakeLists.txt and set up openssl environment") | ||
endif() | ||
endif() |
89 changes: 89 additions & 0 deletions
89
native-apps/urban-heat-analyzer/UrbanHeatAnalyzer/HeatRiskListModel.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// "Urban Heat Analyzer" | ||
// Copyright (C) 2024 Esri Deutschland GmbH | ||
// Jan Tschada (j.tschada@esri.de) | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
// | ||
// Additional permission under GNU GPL version 3 section 7 | ||
// | ||
// If you modify this Program, or any covered work, by linking or combining | ||
// it with ArcGIS Maps SDK for Qt (or a modified version of that library), | ||
// containing parts covered by the terms of ArcGIS Maps SDK for Qt, | ||
// the licensors of this Program grant you additional permission to convey the resulting work. | ||
// See <https://developers.arcgis.com/qt/> for further information. | ||
|
||
#include "HeatRiskListModel.h" | ||
|
||
#include "AttributeListModel.h" | ||
#include "Feature.h" | ||
|
||
using namespace Esri::ArcGISRuntime; | ||
|
||
|
||
HeatRiskAnalysisGroup::HeatRiskAnalysisGroup(double heatRiskIndex) | ||
: m_heatRiskIndex(heatRiskIndex) | ||
{ | ||
|
||
} | ||
|
||
QString HeatRiskAnalysisGroup::name() const | ||
{ | ||
if (m_heatRiskFeatures.empty()) | ||
{ | ||
return "Unknown"; | ||
} | ||
|
||
auto heatRiskFeatureAttributes = m_heatRiskFeatures.first()->attributes(); | ||
return heatRiskFeatureAttributes->attributeValue("GRID_ID").toString(); | ||
} | ||
|
||
double HeatRiskAnalysisGroup::heatRiskIndex() const | ||
{ | ||
return m_heatRiskIndex; | ||
} | ||
|
||
void HeatRiskAnalysisGroup::addFeature(Feature *heatRiskFeature) | ||
{ | ||
m_heatRiskFeatures.append(heatRiskFeature); | ||
} | ||
|
||
|
||
HeatRiskListModel::HeatRiskListModel(QObject *parent) | ||
: QAbstractListModel{parent} | ||
{ | ||
|
||
} | ||
|
||
void HeatRiskListModel::loadAnalysisGroups(const QList<HeatRiskAnalysisGroup> &analysisGroups) | ||
{ | ||
beginResetModel(); | ||
m_analysisGroups = analysisGroups; | ||
endResetModel(); | ||
|
||
// Emit that the full data has changed | ||
emit dataChanged(index(0,0), index(rowCount() - 1)); | ||
} | ||
|
||
int HeatRiskListModel::rowCount(const QModelIndex & parent) const { | ||
Q_UNUSED(parent); | ||
return m_analysisGroups.count(); | ||
} | ||
|
||
QVariant HeatRiskListModel::data(const QModelIndex & index, int role) const { | ||
if (index.row() < 0 || index.row() >= m_analysisGroups.count()) | ||
return QVariant(); | ||
|
||
const HeatRiskAnalysisGroup &analysisGroup = m_analysisGroups[index.row()]; | ||
if (role == NameRole) | ||
return analysisGroup.name(); | ||
else if (role == RiskRole) | ||
return analysisGroup.heatRiskIndex(); | ||
return QVariant(); | ||
} | ||
|
||
QHash<int, QByteArray> HeatRiskListModel::roleNames() const { | ||
QHash<int, QByteArray> roles; | ||
roles[NameRole] = "name"; | ||
roles[RiskRole] = "risk"; | ||
return roles; | ||
} |
65 changes: 65 additions & 0 deletions
65
native-apps/urban-heat-analyzer/UrbanHeatAnalyzer/HeatRiskListModel.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// "Urban Heat Analyzer" | ||
// Copyright (C) 2024 Esri Deutschland GmbH | ||
// Jan Tschada (j.tschada@esri.de) | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
// | ||
// Additional permission under GNU GPL version 3 section 7 | ||
// | ||
// If you modify this Program, or any covered work, by linking or combining | ||
// it with ArcGIS Maps SDK for Qt (or a modified version of that library), | ||
// containing parts covered by the terms of ArcGIS Maps SDK for Qt, | ||
// the licensors of this Program grant you additional permission to convey the resulting work. | ||
// See <https://developers.arcgis.com/qt/> for further information. | ||
|
||
#ifndef HEATRISKLISTMODEL_H | ||
#define HEATRISKLISTMODEL_H | ||
|
||
#include <QAbstractListModel> | ||
#include <QObject> | ||
|
||
namespace Esri::ArcGISRuntime { | ||
class Feature; | ||
} // namespace Esri::ArcGISRuntime | ||
|
||
|
||
class HeatRiskAnalysisGroup | ||
{ | ||
public: | ||
HeatRiskAnalysisGroup(double heatRiskIndex); | ||
|
||
QString name() const; | ||
double heatRiskIndex() const; | ||
|
||
void addFeature(Esri::ArcGISRuntime::Feature *heatRiskFeature); | ||
|
||
private: | ||
double m_heatRiskIndex; | ||
QList<Esri::ArcGISRuntime::Feature*> m_heatRiskFeatures; | ||
}; | ||
|
||
|
||
class HeatRiskListModel : public QAbstractListModel | ||
{ | ||
Q_OBJECT | ||
public: | ||
enum HeatRiskRoles { | ||
NameRole = Qt::UserRole + 1, | ||
RiskRole | ||
}; | ||
|
||
explicit HeatRiskListModel(QObject *parent = nullptr); | ||
|
||
void loadAnalysisGroups(const QList<HeatRiskAnalysisGroup> &analysisGroups); | ||
|
||
int rowCount(const QModelIndex & parent = QModelIndex()) const; | ||
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; | ||
|
||
protected: | ||
QHash<int, QByteArray> roleNames() const; | ||
|
||
private: | ||
QList<HeatRiskAnalysisGroup> m_analysisGroups; | ||
}; | ||
|
||
#endif // HEATRISKLISTMODEL_H |
Binary file not shown.
Binary file added
BIN
+47.5 KB
native-apps/urban-heat-analyzer/UrbanHeatAnalyzer/Resources/AppIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
native-apps/urban-heat-analyzer/UrbanHeatAnalyzer/Resources/Resources.qrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<RCC> | ||
<qresource prefix="/Resources"> | ||
<file>AppIcon.png</file> | ||
</qresource> | ||
</RCC> |
Oops, something went wrong.