Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/cmake-all-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CMake-All-Build
name: CMake-All-Build

on:
pull_request:
Expand All @@ -20,7 +20,9 @@ jobs:
uses: actions/checkout@v3

- name: Checkout submodules
run: git submodule update --init --recursive ExternalLibrary/googletest
run: |
git submodule update --init --recursive ExternalLibrary/googletest
git submodule update --init --recursive ExternalLibrary/stb

- name: Install dependencies
run: |
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/cmake-build-on-push.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CMake-Build-On-Push
name: CMake-Build-On-Push

on:
push:
Expand All @@ -22,7 +22,9 @@ jobs:
uses: actions/checkout@v3

- name: Checkout submodules
run: git submodule update --init --recursive ExternalLibrary/googletest
run: |
git submodule update --init --recursive ExternalLibrary/googletest
git submodule update --init --recursive ExternalLibrary/stb

- name: Install dependencies
run: |
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/cmake-unit-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CMake-Unit-Test
name: CMake-Unit-Test

on:
pull_request:
Expand All @@ -17,7 +17,9 @@ jobs:
uses: actions/checkout@v3

- name: Checkout submodules
run: git submodule update --init --recursive ExternalLibrary/googletest
run: |
git submodule update --init --recursive ExternalLibrary/googletest
git submodule update --init --recursive ExternalLibrary/stb

- name: Install dependencies
run: |
Expand Down
14 changes: 9 additions & 5 deletions Library/PAX_GRAPHICA/InputFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,13 @@ namespace paxg {
void splitStod(const char delimiter, double* const result, const std::size_t size) const {
paxs::StringExtensions::splitStod(pline, delimiter, result, size);
}
// 区切り文字で分割する (SlopeDegF64ToU0To250)
void splitSlopeDegF64ToU0To250(const char delimiter, unsigned char* const result, const std::size_t size) const {
paxs::StringExtensions::splitSlopeDegF64ToU0To250(pline, delimiter, result, size);
// 区切り文字で分割する (SlopeDegU8)
void splitSlopeDegU8(const char delimiter, unsigned char* const result, const std::size_t size) const {
paxs::StringExtensions::splitSlopeDegU8(pline, delimiter, result, size);
}
// 区切り文字で分割する (ElevationS16)
void splitElevationS16(const char delimiter, std::int_least16_t* const result, const std::size_t size) const {
paxs::StringExtensions::splitElevationS16(pline, delimiter, result, size);
}
// 区切り文字で分割する
std::unordered_map<std::string, std::size_t> splitHashMap(const char delimiter) const {
Expand All @@ -165,8 +169,8 @@ namespace paxg {
return pline;
}

// バイナリ分割 (SlopeDegF64ToU0To250)
std::size_t splitSlopeDegF64ToU0To250Binary(char* const result, const std::size_t size) {
// バイナリ分割
std::size_t splitBinary(char* const result, const std::size_t size) {
pifs.seekg(0, std::ios::end);
const std::size_t read_max_size = static_cast<std::size_t>(pifs.tellg()); // 最大サイズ
pifs.seekg(0);
Expand Down
279 changes: 176 additions & 103 deletions Library/PAX_MAHOROBA/XYZTiles.hpp

Large diffs are not rendered by default.

67 changes: 43 additions & 24 deletions Library/PAX_MAHOROBA/XYZTilesList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace paxs {
const int draw_max_z = -1
) {
XYZTile xyz_tile(
path + map_file_path,
&path, "", map_file_path,
("{z}/{n}_{z}_{x}_{y}"));
if (map_url.size() != 0) xyz_tile.setMapURL(map_url);
if (map_name.size() != 0) xyz_tile.setMapName(map_name);
Expand All @@ -61,29 +61,29 @@ namespace paxs {
// 使用するマップの XYZ タイルの情報を定義

// mapMapInitOne(xyz_tile_list, path, map_view,
// "map_base", "","", "Data/Map/XYZTile/Standard/Image/Land/2023/", -1, 7, -1, 7);
// "map_base", nullptr,nullptr, "Data/Map/XYZTile/Standard/Image/Land/2023/", -1, 7, -1, 7);
{
XYZTile xyz_tile(
path + "Data/Map/XYZTile/Standard/Image/Land/2023/",
&path , "", "Data/Map/XYZTile/Standard/Image/Land/2023/",
("{z}/{n}_{z}_{x}_{y}"));
xyz_tile.setMapURL("");
xyz_tile.setMapName("");
xyz_tile.setMaxZ(7);
xyz_tile.setDrawMaxZ(7);
// xyz_tile_base->setMapFilePath(path + "Data/Map/XYZTile/LandAndSea/Image/GreenAndAlphaBinary/2023/");
// xyz_tile_base->setMapFilePath(&path , "", "Data/Map/XYZTile/LandAndSea/Image/GreenAndAlphaBinary/2023/");

xyz_tile_list.emplace(MurMur3::calcHash("map_base"), xyz_tile);
}
{
XYZTile xyz_tile(
path + "Data/Map/XYZTile/LandAndWater/Image/GreenAndAlphaBinary/1868/",
&path , "", "Data/Map/XYZTile/LandAndWater/Image/GreenAndAlphaBinary/1868/",
("{z}/{n}_{z}_{x}_{y}"));
xyz_tile.setMapURL("");
xyz_tile.setMapName("gbank");
xyz_tile.setMinZ(8);
xyz_tile.setMaxZ(10);
xyz_tile.setDrawMinZ(8);
// xyz_tile.setMapFilePath(path + "Data/Map/XYZTile/LandAndWater/Image/BlackAndWhiteBinary/1868/");
// xyz_tile.setMapFilePath(&path , "", "Data/Map/XYZTile/LandAndWater/Image/BlackAndWhiteBinary/1868/");
// xyz_tile.setMapFilePath("./SavedMap/gbank_noblank_reclaimed_land/");
xyz_tile_list.emplace(MurMur3::calcHash("map_land_and_water"), xyz_tile);
}
Expand All @@ -95,7 +95,7 @@ namespace paxs {
// xyz_tile_gmaps->setMapName("map");
// // xyz_tile_gmaps->setDefaultZ(12);
// // xyz_tile_gmaps->setDrawMinZ(11);
// xyz_tile_gmaps->setMapFilePath(path + "Data/Map/XYZTile/GoogleMaps/");
// xyz_tile_gmaps->setMapFilePath(&path , "", "Data/Map/XYZTile/GoogleMaps/");

// xyz_tile_list.emplace(MurMur3::calcHash("map_gmaps", *xyz_tile_gmaps);
//}
Expand Down Expand Up @@ -124,7 +124,7 @@ namespace paxs {
// xyz_tile_kuni->setMapName("ColorCodingByProvincesOfJapanWithLakes");
// xyz_tile_kuni->setDefaultZ(10);
// xyz_tile_kuni->setDrawMinZ(9);
// xyz_tile_kuni->setMapFilePath(path + "Data/Map/XYZTile/ColorCodingByProvincesOfJapan/");
// xyz_tile_kuni->setMapFilePath(&path , "", "Data/Map/XYZTile/ColorCodingByProvincesOfJapan/");

// xyz_tile_list.emplace(MurMur3::calcHash("map_ryosei_country", *xyz_tile_kuni);
//}
Expand All @@ -136,7 +136,7 @@ namespace paxs {
// xyz_tile_kuni_line->setMinZ(5);
// xyz_tile_kuni_line->setMaxZ(9);
// xyz_tile_kuni_line->setDrawMinZ(5);
// xyz_tile_kuni_line->setMapFilePath(path + "Data/Map/XYZTile/RyoseikokuLine/");
// xyz_tile_kuni_line->setMapFilePath(&path , "", "Data/Map/XYZTile/RyoseikokuLine/");

// xyz_tile_list.emplace(MurMur3::calcHash("map_ryosei_line", *xyz_tile_kuni_line);
//}
Expand All @@ -150,7 +150,7 @@ namespace paxs {
// xyz_tile_kuni_korean_line->setDrawMinZ(6);
// xyz_tile_kuni_korean_line->setMinDate(1872272); // J 414-01-01
// xyz_tile_kuni_korean_line->setMaxDate(1915370); // J 532-01-01 - 1
// xyz_tile_kuni_korean_line->setMapFilePath(path + "Data/Map/XYZTile/KoreanLine/");
// xyz_tile_kuni_korean_line->setMapFilePath(&path , "", "Data/Map/XYZTile/KoreanLine/");

// xyz_tile_list.emplace(MurMur3::calcHash("map_korean_line", *xyz_tile_kuni_korean_line);
//}
Expand All @@ -164,7 +164,7 @@ namespace paxs {
// xyz_tile_kuni_balhae_line->setDrawMinZ(3);
// xyz_tile_kuni_balhae_line->setMinDate(1976003); // J 698-01-01
// xyz_tile_kuni_balhae_line->setMaxDate(2059279); // J 926-01-01 - 1
// xyz_tile_kuni_balhae_line->setMapFilePath(path + "Data/Map/XYZTile/BalhaeLine/");
// xyz_tile_kuni_balhae_line->setMapFilePath(&path , "", "Data/Map/XYZTile/BalhaeLine/");

// xyz_tile_list.emplace(MurMur3::calcHash("map_balhae_line", *xyz_tile_kuni_balhae_line);
//}
Expand All @@ -178,13 +178,13 @@ namespace paxs {
// xyz_tile_kuni_silla_line->setDrawMinZ(3);
// xyz_tile_kuni_silla_line->setMinDate(1915371); // J 532-01-01
// xyz_tile_kuni_silla_line->setMaxDate(2059279); // J 926-01-01 - 1 // 暫定の値
// xyz_tile_kuni_silla_line->setMapFilePath(path + "Data/Map/XYZTile/SillaLine/");
// xyz_tile_kuni_silla_line->setMapFilePath(&path , "", "Data/Map/XYZTile/SillaLine/");

// xyz_tile_list.emplace(MurMur3::calcHash("map_silla_line", *xyz_tile_kuni_silla_line);
//}
{
XYZTile xyz_tile(
path + "Data/Map/XYZTile/Gokishichido/",
&path , "", "Data/Map/XYZTile/Gokishichido/",
("{z}/{n}_{z}_{x}_{y}"));
xyz_tile.setMapURL("");
xyz_tile.setMapName("zxy");
Expand All @@ -196,7 +196,7 @@ namespace paxs {
}
{
XYZTile xyz_tile(
path + "Data/Map/XYZTile/Kinai/",
&path , "", "Data/Map/XYZTile/Kinai/",
("{z}/{n}_{z}_{x}_{y}"));
xyz_tile.setMapURL("");
xyz_tile.setMapName("zxy");
Expand All @@ -207,7 +207,7 @@ namespace paxs {
}
{
XYZTile xyz_tile(
path + "Data/Map/XYZTile/Heijokyo/",
&path , "", "Data/Map/XYZTile/Heijokyo/",
("{z}/{n}_{z}_{x}_{y}"));
xyz_tile.setMapURL("");
xyz_tile.setMapName("zxy");
Expand All @@ -218,7 +218,7 @@ namespace paxs {
}
{
XYZTile xyz_tile(
path + "Data/Map/XYZTile/Soil/Image/Soil/2023/",
&path , "", "Data/Map/XYZTile/Soil/Image/Soil/2023/",
("{z}/{n}_{z}_{x}_{y}"));
xyz_tile.setMapURL("");
xyz_tile.setMapName("soil");
Expand All @@ -236,16 +236,29 @@ namespace paxs {
// // xyz_tile_slope->setDefaultZ(8);
// xyz_tile_slope->setMaxZ(8);
// // xyz_tile_slope->setDrawMinZ(3);
// // xyz_tile_slope->setMapFilePath(path + "Data/Map/XYZTile/Slope/Image/Slope/2023/");
// xyz_tile_slope->setMapFilePath(path + "Data/Map/XYZTile/Slope/Image/Slope/2010/");
// // xyz_tile_slope->setMapFilePath(&path , "", "Data/Map/XYZTile/Slope/Image/Slope/2023/");
// xyz_tile_slope->setMapFilePath(&path , "", "Data/Map/XYZTile/Slope/Image/Slope/2010/");

// xyz_tile_list.emplace(MurMur3::calcHash("map_slope", *xyz_tile_slope);
// }
mapMapInitOne(xyz_tile_list, path, map_view,
MurMur3::calcHash("map_slope"), "", "slope_pale", "Data/Map/XYZTile/Slope/Image/SlopePale20230920/2010/", -1, 8, -1, -1);
{
XYZTile xyz_tile(
path + "Data/Map/XYZTile/RiversAndLakes/Image/RiversAndLakes/2023/",
&path,
"Data/Map/XYZTile/Slope/Data/SlopeData20231029/2010/",
"Data/Map/XYZTile/Slope/Image/SlopePale20231029/2010/",
("{z}/{n}_{z}_{x}_{y}"));
xyz_tile.setMapURL("");
xyz_tile.setMapName("zxy");
//xyz_tile.setMaxZ(8);

xyz_tile_list.emplace(MurMur3::calcHash("map_slope_bin"), xyz_tile);
}

{
XYZTile xyz_tile(
&path , "", "Data/Map/XYZTile/RiversAndLakes/Image/RiversAndLakes/2023/",
("{z}/{n}_{z}_{x}_{y}"));
xyz_tile.setMapURL("");
xyz_tile.setMapName("water");
Expand All @@ -256,7 +269,7 @@ namespace paxs {
}
{
XYZTile xyz_tile(
path + "Data/Map/XYZTile/RiversAndLakes/Image/RiversAndLakesBW/2023/",
&path , "", "Data/Map/XYZTile/RiversAndLakes/Image/RiversAndLakesBW/2023/",
("{z}/{n}_{z}_{x}_{y}"));
xyz_tile.setMapURL("");
xyz_tile.setMapName("water");
Expand All @@ -267,7 +280,7 @@ namespace paxs {
}
{
XYZTile xyz_tile(
path + "Data/Map/XYZTile/Temperature/Image/SoilTemperature/2023/",
&path , "", "Data/Map/XYZTile/Temperature/Image/SoilTemperature/2023/",
("{z}/{n}_{z}_{x}_{y}"));
xyz_tile.setMapURL("");
xyz_tile.setMapName("soil-tem");
Expand All @@ -277,19 +290,19 @@ namespace paxs {
}
{
XYZTile xyz_tile(
"",
nullptr, "", "",
("{z}/{n}_{z}_{x}_{y}"));
xyz_tile_list.emplace(MurMur3::calcHash("map_line2"), xyz_tile);
}
{
XYZTile xyz_tile(
"",
nullptr, "", "",
("{z}/{n}_{z}_{x}_{y}"));
xyz_tile_list.emplace(MurMur3::calcHash("map_line3"), xyz_tile);
}
{
XYZTile xyz_tile(
"",
nullptr, "", "",
("{z}/{n}_{z}_{x}_{y}"));
xyz_tile.setDefaultZ(18);
xyz_tile_list.emplace(MurMur3::calcHash("map_line4"), xyz_tile);
Expand Down Expand Up @@ -352,6 +365,9 @@ namespace paxs {
if (menu_bar.cgetPulldown(MurMur3::calcHash("map")).getIsItemsKey(MurMur3::calcHash("menu_bar_map_slope"))) {
xyz_tile_list[MurMur3::calcHash("map_slope")].update(map_view_width, map_view_height, map_view_center_x, map_view_center_y);
}
if (menu_bar.cgetPulldown(MurMur3::calcHash("map")).getIsItemsKey(MurMur3::calcHash("menu_bar_map_slope"))) {
xyz_tile_list[MurMur3::calcHash("map_slope_bin")].update(map_view_width, map_view_height, map_view_center_x, map_view_center_y);
}
if (menu_bar.cgetPulldown(MurMur3::calcHash("map")).getIsItemsKey(MurMur3::calcHash("menu_bar_map_slope"))) {
xyz_tile_list[MurMur3::calcHash("map_gmaps")].update(map_view_width, map_view_height, map_view_center_x, map_view_center_y);
}
Expand Down Expand Up @@ -399,6 +415,9 @@ namespace paxs {
if (menu_bar.cgetPulldown(MurMur3::calcHash("map")).getIsItemsKey(MurMur3::calcHash("menu_bar_map_slope"))) {
if (xyz_tile_list.find(MurMur3::calcHash("map_slope")) != xyz_tile_list.end()) xyz_tile_list.at(MurMur3::calcHash("map_slope")).draw(map_view_width, map_view_height, map_view_center_x, map_view_center_y, date);
}
if (menu_bar.cgetPulldown(MurMur3::calcHash("map")).getIsItemsKey(MurMur3::calcHash("menu_bar_map_slope"))) {
if (xyz_tile_list.find(MurMur3::calcHash("map_slope_bin")) != xyz_tile_list.end()) xyz_tile_list.at(MurMur3::calcHash("map_slope_bin")).draw(map_view_width, map_view_height, map_view_center_x, map_view_center_y, date);
}
if (menu_bar.cgetPulldown(MurMur3::calcHash("map")).getIsItemsKey(MurMur3::calcHash("menu_bar_map_slope"))) {
if (xyz_tile_list.find(MurMur3::calcHash("map_gmaps")) != xyz_tile_list.end()) xyz_tile_list.at(MurMur3::calcHash("map_gmaps")).draw(map_view_width, map_view_height, map_view_center_x, map_view_center_y, date);
}
Expand Down
80 changes: 80 additions & 0 deletions Library/PAX_SAPIENTICA/GeographicInformation/ConvertToInt.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*##########################################################################################

PAX SAPIENTICA Library 💀🌿🌏

[Planning] 2023 As Project
[Production] 2023 As Project
[Contact Us] [email protected] https://github.com/AsPJT/PAX_SAPIENTICA
[License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/

##########################################################################################*/

#ifndef PAX_SAPIENTICA_GEOGRAPHIC_INFORMATION_CONVERT_TO_INT_HPP
#define PAX_SAPIENTICA_GEOGRAPHIC_INFORMATION_CONVERT_TO_INT_HPP

/*##########################################################################################

##########################################################################################*/

#include <cmath>
#include <cstdint>
#include <limits>

namespace paxs {

constexpr double u8_max_p_log2_slope_max = 38.4154715724661; // 250 / log2(91)

// 傾斜を uint8 (0-250) から double (度)へ変換
double slopeDegLog2U8ToF64(const unsigned char char_value_) {
return (char_value_ >= 251u) ? std::numeric_limits<double>::quiet_NaN() : // 251 以上は NaN
std::pow(2, char_value_ / u8_max_p_log2_slope_max) - 1.0; // 250 以下は値を変換
}

// 傾斜(度)を double から uint8 (0-250) へ変換
unsigned char slopeDegF64ToLog2U8(const double float_value_) {
// NaN は 251
if (float_value_ == std::numeric_limits<double>::quiet_NaN()) {
return 251u;
}
// 90 度以上は 250
else if (float_value_ >= 90.0) {
return 250u;
}
// 0 度以下は 0
else if (float_value_ <= 0.0) {
return 0u;
}
return static_cast<unsigned char>(std::ceil(std::log2(float_value_ + 1.0) * u8_max_p_log2_slope_max));
}

constexpr double s16_max_p_log2_elevation_max = 2440.16038278159; // 32760 / log2(11000 + 1)

// 標高を int16 から double (m) へ変換
double elevationLog2S16ToF64(const std::int_least16_t char_value_) {
return (char_value_ >= 32761) ? std::numeric_limits<double>::quiet_NaN() : // 32761 以上は NaN
((char_value_ < 0) ? -std::pow(2, -char_value_ / s16_max_p_log2_elevation_max) + 1.0 : // 32760 以下は値を変換
std::pow(2, char_value_ / s16_max_p_log2_elevation_max) - 1.0); // 32760 以下は値を変換
}

// 標高 (m) を double から int16 へ変換
std::int_least16_t elevationF64ToLog2S16(const double float_value_) {
// NaN は 32761
if (float_value_ == std::numeric_limits<double>::quiet_NaN()) {
return 32761;
}
// 11,000 m 以上は 32760
else if (float_value_ >= 11000.0) {
return 32760;
}
// -11,000 m 以下は -32760
else if (float_value_ <= -11000.0) {
return -32760;
}
return (float_value_ < 0) ?
static_cast<std::int_least16_t>(-std::ceil(std::log2(-float_value_ + 1.0) * s16_max_p_log2_elevation_max)) :
static_cast<std::int_least16_t>(std::ceil(std::log2(float_value_ + 1.0) * s16_max_p_log2_elevation_max));
}

}

#endif // !PAX_SAPIENTICA_GEOGRAPHIC_INFORMATION_CONVERT_TO_INT_HPP
Loading