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

Release 3.0.0-rc.2 #168

Merged
merged 2 commits into from
Oct 29, 2024
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,6 @@ DerivedData/
!default.perspectivev3

## Gcc Patch
/*.gcno
/*.gcno

Package.resolved
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Open Swiss Maps SDK

## Version 3.0.0
- Update [mapscore to 3.0.0-rc.2](https://github.com/openmobilemaps/maps-core/releases/tag/3.0.0-rc.2)
- Update [gps-layer to 3.0.0-rc.2](https://github.com/openmobilemaps/layer-gps/releases/tag/3.0.0-rc.2)

## Version 2.6.2
- Update [mapscore to 2.6.2](https://github.com/openmobilemaps/maps-core/releases/tag/2.6.2)
- Update [gps-layer to 2.6.2](https://github.com/openmobilemaps/layer-gps/releases/tag/2.6.2)
Expand Down
43 changes: 0 additions & 43 deletions Package.resolved

This file was deleted.

4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/openmobilemaps/maps-core.git", from: "2.6.2"),
.package(url: "https://github.com/openmobilemaps/layer-gps.git", from: "2.6.2")
.package(url: "https://github.com/openmobilemaps/maps-core", from: .init(stringLiteral: "3.0.0-rc.2")),
.package(url: "https://github.com/openmobilemaps/layer-gps.git", from: .init(stringLiteral: "3.0.0-rc.2"))
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
To add the OpenSwissMaps SDK to your Android project, add the following line to your build.gradle
```
dependencies {
implementation 'ch.admin.geo.openswissmaps:openswissmaps-sdk:2.6.2'
implementation 'ch.admin.geo.openswissmaps:openswissmaps-sdk:3.0.0-rc.2'
}
```
Make sure you have mavenCentral() listed in your project repositories.
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"

api "io.openmobilemaps:mapscore:2.6.2"
api "io.openmobilemaps:layer-gps:2.6.2"
implementation "ch.ubique.android:djinni-support-lib:1.0.7"
api "io.openmobilemaps:mapscore:3.0.0-rc.2"
api "io.openmobilemaps:layer-gps:3.0.0-rc.2"
implementation "ch.ubique.android:djinni-support-lib:1.0.9"

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
Expand Down
4 changes: 2 additions & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ android.enableR8.fullMode=false
GROUP=ch.admin.geo.openswissmaps
POM_ARTIFACT_ID=openswissmaps-sdk

VERSION_NAME=2.6.2
VERSION_CODE=2060200
VERSION_NAME=3.0.0-rc.2
VERSION_CODE=3000000

PUBLISH_VARIANT=release

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ abstract class SwisstopoTiledLayerConfigFactory {

@JvmStatic
external fun createRasterTiledLayerConfigFromMetadata(configuration: io.openmobilemaps.mapscore.shared.map.layers.tiled.raster.wmts.WmtsLayerDescription, maxZoom: Int, zoomInfo: io.openmobilemaps.mapscore.shared.map.layers.tiled.Tiled2dMapZoomInfo): io.openmobilemaps.mapscore.shared.map.layers.tiled.Tiled2dMapLayerConfig

@JvmStatic
external fun createZoomLevelInfos(): ArrayList<io.openmobilemaps.mapscore.shared.map.layers.tiled.Tiled2dMapZoomLevelInfo>
}

private class CppProxy : SwisstopoTiledLayerConfigFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "NativeSwisstopoLayerType.h"
#include "NativeTiled2dMapLayerConfig.h"
#include "NativeTiled2dMapZoomInfo.h"
#include "NativeTiled2dMapZoomLevelInfo.h"
#include "NativeWmtsLayerDescription.h"

namespace djinni_generated {
Expand Down Expand Up @@ -59,4 +60,12 @@ CJNIEXPORT ::djinni_generated::NativeTiled2dMapLayerConfig::JniType JNICALL Java
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}

CJNIEXPORT jobject JNICALL Java_ch_admin_geo_openswissmaps_shared_layers_config_SwisstopoTiledLayerConfigFactory_createZoomLevelInfos(JNIEnv* jniEnv, jobject /*this*/)
{
try {
auto r = ::SwisstopoTiledLayerConfigFactory::createZoomLevelInfos();
return ::djinni::release(::djinni::List<::djinni_generated::NativeTiled2dMapZoomLevelInfo>::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}

} // namespace djinni_generated
2 changes: 2 additions & 0 deletions bridging/ios/STSDKSwisstopoLayerType+Private.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from layer_configs.djinni
#ifdef __cplusplus
#ifndef __OBJC__

#include "SwisstopoLayerType.h"
#import "DJIMarshal+Private.h"

#endif
#endif
8 changes: 8 additions & 0 deletions bridging/ios/STSDKSwisstopoTiledLayerConfigFactory+Private.mm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#import "DJIMarshal+Private.h"
#import "MCTiled2dMapLayerConfig+Private.h"
#import "MCTiled2dMapZoomInfo+Private.h"
#import "MCTiled2dMapZoomLevelInfo+Private.h"
#import "MCWmtsLayerDescription+Private.h"
#import "STSDKSwisstopoLayerType+Private.h"
#include <exception>
Expand Down Expand Up @@ -72,6 +73,13 @@ - (id)initWithCpp:(const std::shared_ptr<::SwisstopoTiledLayerConfigFactory>&)cp
} DJINNI_TRANSLATE_EXCEPTIONS()
}

+ (nonnull NSArray<MCTiled2dMapZoomLevelInfo *> *)createZoomLevelInfos {
try {
auto objcpp_result_ = ::SwisstopoTiledLayerConfigFactory::createZoomLevelInfos();
return ::djinni::List<::djinni_generated::Tiled2dMapZoomLevelInfo>::fromCpp(objcpp_result_);
} DJINNI_TRANSLATE_EXCEPTIONS()
}

namespace djinni_generated {

auto SwisstopoTiledLayerConfigFactory::toCpp(ObjcType objc) -> CppType
Expand Down
3 changes: 3 additions & 0 deletions bridging/ios/STSDKSwisstopoTiledLayerConfigFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#import "MCTiled2dMapLayerConfig.h"
#import "MCTiled2dMapZoomInfo.h"
#import "MCTiled2dMapZoomLevelInfo.h"
#import "MCWmtsLayerDescription.h"
#import "STSDKSwisstopoLayerType.h"
#import <Foundation/Foundation.h>
Expand All @@ -23,4 +24,6 @@
maxZoom:(int32_t)maxZoom
zoomInfo:(nonnull MCTiled2dMapZoomInfo *)zoomInfo;

+ (nonnull NSArray<MCTiled2dMapZoomLevelInfo *> *)createZoomLevelInfos;

@end
3 changes: 3 additions & 0 deletions djinni/layers/config/layer_configs.djinni
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@extern "../../../../maps-core/djinni/yaml/tiled_2d_map_layer_config.yaml"
@extern "../../../../maps-core/djinni/yaml/wmts_layer_description.yaml"
@extern "../../../../maps-core/djinni/yaml/tiled_2d_map_zoom_info.yaml"
@extern "../../../../maps-core/djinni/yaml/tiled_2d_map_zoom_level_info.yaml"

swisstopo_layer_type = enum
{
Expand Down Expand Up @@ -43,4 +44,6 @@ swisstopo_tiled_layer_config_factory = interface +c {
static create_raster_tile_layer_config_with_base_url(layer_type: swisstopo_layer_type, zoomInfo: optional<tiled_2d_map_zoom_info>, base_url: optional<string>) : tiled_2d_map_layer_config;

static create_raster_tiled_layer_config_from_metadata(configuration: wmts_layer_description, maxZoom: i32, zoomInfo: tiled_2d_map_zoom_info) : tiled_2d_map_layer_config;

static create_zoom_level_infos(): list<tiled_2d_map_zoom_level_info>;
}
2 changes: 1 addition & 1 deletion ios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Once you have your Swift package set up, adding Open Mobile Maps as a dependency

```swift
dependencies: [
.package(url: "https://github.com/geoadmin/lib-open-swiss-maps-sdk.git", .upToNextMajor(from: "2.6.2"))
.package(url: "https://github.com/geoadmin/lib-open-swiss-maps-sdk.git", .upToNextMajor(from: "3.0.0-rc.2"))
]
```

Expand Down
4 changes: 4 additions & 0 deletions shared/public/SwisstopoTiledLayerConfigFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

#include "Tiled2dMapLayerConfig.h"
#include "Tiled2dMapZoomInfo.h"
#include "Tiled2dMapZoomLevelInfo.h"
#include "WmtsLayerDescription.h"
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <vector>

enum class SwisstopoLayerType;

Expand All @@ -24,4 +26,6 @@ class SwisstopoTiledLayerConfigFactory {
static /*not-null*/ std::shared_ptr<::Tiled2dMapLayerConfig> createRasterTileLayerConfigWithBaseUrl(SwisstopoLayerType layerType, const std::optional<::Tiled2dMapZoomInfo> & zoomInfo, const std::optional<std::string> & baseUrl);

static /*not-null*/ std::shared_ptr<::Tiled2dMapLayerConfig> createRasterTiledLayerConfigFromMetadata(const ::WmtsLayerDescription & configuration, int32_t maxZoom, const ::Tiled2dMapZoomInfo & zoomInfo);

static std::vector<::Tiled2dMapZoomLevelInfo> createZoomLevelInfos();
};
9 changes: 8 additions & 1 deletion shared/public/SwisstopoTiledLayerConfigHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,12 @@ class SwisstopoTiledLayerConfigHelper {
public:
static std::vector<Tiled2dMapZoomLevelInfo> getZoomLevelInfos();

static RectCoord getBounds();
static const RectCoord bounds;

static Tiled2dMapZoomLevelInfo getZoomLevelInfo(double zoom_,
float tileWidthLayerSystemUnits_,
int32_t numTilesX_,
int32_t numTilesY_,
int32_t numTilesT_,
int32_t zoomLevelIdentifier_);
};
8 changes: 6 additions & 2 deletions shared/src/layers/config/SwisstopoTiledLayerConfigFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ SwisstopoTiledLayerConfigFactory::createRasterTileLayerConfigWithBaseUrl(Swissto

std::string url = baseUrl.has_value() ? *baseUrl : "https://wmts.geo.admin.ch/1.0.0/";
auto dimensions = { WmtsLayerDimension("Time", time, {}) };
auto configuration = WmtsLayerDescription(identifier, "", "", dimensions, SwisstopoTiledLayerConfigHelper::getBounds(), "2056", url + identifier +
auto configuration = WmtsLayerDescription(identifier, "", "", dimensions, SwisstopoTiledLayerConfigHelper::bounds, "2056", url + identifier +
"/default/{Time}/2056/{TileMatrix}/{TileCol}/{TileRow}." + extension, "image/"+extension);

auto finalZoomInfo = zoomInfo.has_value() ? *zoomInfo : Tiled2dMapZoomInfo(0.65, numDrawPreviousLayers, 0, true, false, true, true);
Expand All @@ -189,5 +189,9 @@ std::shared_ptr<::Tiled2dMapLayerConfig> SwisstopoTiledLayerConfigFactory::creat
std::vector<Tiled2dMapZoomLevelInfo> subvector = {zoomLevels.begin(), itMax };
zoomLevels = subvector;

return WmtsTiled2dMapLayerConfigFactory::create(description, zoomLevels, zoomInfo, SwisstopoTiledLayerConfigHelper::getBounds().topLeft.systemIdentifier, "");
return WmtsTiled2dMapLayerConfigFactory::create(description, zoomLevels, zoomInfo, SwisstopoTiledLayerConfigHelper::bounds.topLeft.systemIdentifier, "");
}

std::vector<::Tiled2dMapZoomLevelInfo> SwisstopoTiledLayerConfigFactory::createZoomLevelInfos() {
return SwisstopoTiledLayerConfigHelper::getZoomLevelInfos();
}
75 changes: 43 additions & 32 deletions shared/src/layers/config/SwisstopoTiledLayerConfigHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,52 @@
#include "WmtsTiled2dMapLayerConfigFactory.h"
#include <vector>

const RectCoord SwisstopoTiledLayerConfigHelper::bounds = RectCoord(Coord(CoordinateSystemIdentifiers::EPSG2056(), 2420000, 1350000, 0),
Coord(CoordinateSystemIdentifiers::EPSG2056(), 2900000, 1030000, 0));

// taken from https://wmts.geo.admin.ch/1.0.0/WMTSCapabilities.xml,layer=ch.bafu.wasser-leitungen
std::vector<Tiled2dMapZoomLevelInfo> SwisstopoTiledLayerConfigHelper::getZoomLevelInfos() {
return {
Tiled2dMapZoomLevelInfo(14285714.2857, 1024000, 1, 1, 1, 0,getBounds()),
Tiled2dMapZoomLevelInfo(13392857.1429, 960000, 1, 1, 1, 1,getBounds()),
Tiled2dMapZoomLevelInfo(12500000.0, 896000, 1, 1, 1, 2,getBounds()),
Tiled2dMapZoomLevelInfo(11607142.8571, 832000, 1, 1, 1, 3,getBounds()),
Tiled2dMapZoomLevelInfo(10714285.7143, 768000, 1, 1, 1, 4,getBounds()),
Tiled2dMapZoomLevelInfo(9821428.57143, 704000, 1, 1, 1, 5,getBounds()),
Tiled2dMapZoomLevelInfo(8928571.42857, 640000, 1, 1, 1, 6,getBounds()),
Tiled2dMapZoomLevelInfo(8035714.28571, 576000, 1, 1, 1, 7,getBounds()),
Tiled2dMapZoomLevelInfo(7142857.14286, 512000, 1, 1, 1, 8,getBounds()),
Tiled2dMapZoomLevelInfo(6250000.0, 448000, 2, 1, 1, 9,getBounds()),
Tiled2dMapZoomLevelInfo(5357142.85714, 384000, 2, 1, 1, 10,getBounds()),
Tiled2dMapZoomLevelInfo(4464285.71429, 320000, 2, 1, 1, 11,getBounds()),
Tiled2dMapZoomLevelInfo(3571428.57143, 256000, 2, 2, 1, 12, getBounds()),
Tiled2dMapZoomLevelInfo(2678571.42857, 192000, 3, 2, 1, 13, getBounds()),
Tiled2dMapZoomLevelInfo(2321428.57143, 166400, 3, 2, 1, 14, getBounds()),
Tiled2dMapZoomLevelInfo(1785714.28571, 128000, 4, 3, 1, 15, getBounds()),
Tiled2dMapZoomLevelInfo(892857.142857, 64000, 8, 5, 1, 16, getBounds()),
Tiled2dMapZoomLevelInfo(357142.857143, 25600, 19, 13, 1, 17, getBounds()),
Tiled2dMapZoomLevelInfo(178571.428571, 12800, 38, 25, 1, 18, getBounds()),
Tiled2dMapZoomLevelInfo(71428.5714286, 5120, 94, 63, 1, 19, getBounds()),
Tiled2dMapZoomLevelInfo(35714.2857143, 2560, 188, 125, 1, 20, getBounds()),
Tiled2dMapZoomLevelInfo(17857.1428571, 1280, 375, 250, 1, 21, getBounds()),
Tiled2dMapZoomLevelInfo(8928.57142857, 640, 750, 500, 1, 22, getBounds()),
Tiled2dMapZoomLevelInfo(7142.85714286, 512, 938, 625, 1, 23, getBounds()),
Tiled2dMapZoomLevelInfo(5357.14285714, 384, 1250, 834, 1, 24, getBounds()),
Tiled2dMapZoomLevelInfo(3571.42857143, 256, 1875, 1250, 1, 25, getBounds()),
Tiled2dMapZoomLevelInfo(1785.71428571, 128, 3750, 2500, 1, 26, getBounds()),
Tiled2dMapZoomLevelInfo(892.857142857, 64, 7500, 5000, 1, 27, getBounds()),
Tiled2dMapZoomLevelInfo(357.142857143, 25.6, 18750, 12500, 1, 28, getBounds())};
getZoomLevelInfo(14285714.2857, 1024000, 1, 1, 1, 0),
getZoomLevelInfo(13392857.1429, 960000, 1, 1, 1, 1),
getZoomLevelInfo(12500000.0, 896000, 1, 1, 1, 2),
getZoomLevelInfo(11607142.8571, 832000, 1, 1, 1, 3),
getZoomLevelInfo(10714285.7143, 768000, 1, 1, 1, 4),
getZoomLevelInfo(9821428.57143, 704000, 1, 1, 1, 5),
getZoomLevelInfo(8928571.42857, 640000, 1, 1, 1, 6),
getZoomLevelInfo(8035714.28571, 576000, 1, 1, 1, 7),
getZoomLevelInfo(7142857.14286, 512000, 1, 1, 1, 8),
getZoomLevelInfo(6250000.0, 448000, 2, 1, 1, 9),
getZoomLevelInfo(5357142.85714, 384000, 2, 1, 1, 10),
getZoomLevelInfo(4464285.71429, 320000, 2, 1, 1, 11),
getZoomLevelInfo(3571428.57143, 256000, 2, 2, 1, 12),
getZoomLevelInfo(2678571.42857, 192000, 3, 2, 1, 13),
getZoomLevelInfo(2321428.57143, 166400, 3, 2, 1, 14),
getZoomLevelInfo(1785714.28571, 128000, 4, 3, 1, 15),
getZoomLevelInfo(892857.142857, 64000, 8, 5, 1, 16),
getZoomLevelInfo(357142.857143, 25600, 19, 13, 1, 17),
getZoomLevelInfo(178571.428571, 12800, 38, 25, 1, 18),
getZoomLevelInfo(71428.5714286, 5120, 94, 63, 1, 19),
getZoomLevelInfo(35714.2857143, 2560, 188, 125, 1, 20),
getZoomLevelInfo(17857.1428571, 1280, 375, 250, 1, 21),
getZoomLevelInfo(8928.57142857, 640, 750, 500, 1, 22),
getZoomLevelInfo(7142.85714286, 512, 938, 625, 1, 23),
getZoomLevelInfo(5357.14285714, 384, 1250, 834, 1, 24),
getZoomLevelInfo(3571.42857143, 256, 1875, 1250, 1, 25),
getZoomLevelInfo(1785.71428571, 128, 3750, 2500, 1, 26),
getZoomLevelInfo(892.857142857, 64, 7500, 5000, 1, 27),
getZoomLevelInfo(357.142857143, 25.6, 18750, 12500, 1, 28)};
}

RectCoord SwisstopoTiledLayerConfigHelper::getBounds() {
return RectCoord(Coord(CoordinateSystemIdentifiers::EPSG2056(), 2420000, 1350000, 0),
Coord(CoordinateSystemIdentifiers::EPSG2056(), 2900000, 1030000, 0));

Tiled2dMapZoomLevelInfo SwisstopoTiledLayerConfigHelper::getZoomLevelInfo(double zoom,
float tileWidthLayerSystemUnits,
int32_t numTilesX,
int32_t numTilesY,
int32_t numTilesT,
int32_t zoomLevelIdentifier) {
const auto bounds = RectCoord(SwisstopoTiledLayerConfigHelper::bounds.topLeft,
Coord(CoordinateSystemIdentifiers::EPSG2056(), SwisstopoTiledLayerConfigHelper::bounds.topLeft.x + tileWidthLayerSystemUnits * numTilesX, SwisstopoTiledLayerConfigHelper::bounds.topLeft.y - tileWidthLayerSystemUnits * numTilesY, 0));

return Tiled2dMapZoomLevelInfo(zoom,tileWidthLayerSystemUnits, numTilesX, numTilesY, numTilesT, zoomLevelIdentifier, bounds);
}
Loading