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/2.0.1 #604

Merged
merged 26 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b92094c
Bugfixes
maerki Feb 16, 2024
0e4645a
remove debug log
maerki Feb 18, 2024
f268254
fix djinni version
maerki Feb 18, 2024
9ea6b76
Set vertex data for both shaders
maerki Feb 23, 2024
78e480c
ensure map draw callbacks are scheduled in order
maerki Feb 23, 2024
5fbd287
fix loading state from geojson that never resolves
maerki Feb 23, 2024
76e98bf
add assertions to label computation, don’t share lineEndIndices
maerki Feb 23, 2024
23b9f69
sync source reload to avoid geojson crashes
maerki Feb 23, 2024
57ed69f
fix loading crashes
maerki Feb 24, 2024
b202f20
semi-fix missing layer configs
maerki Feb 26, 2024
fc8bdb9
Add missing destroy call in OffscreenMapRenderer (analogue to MapView)
M-Wong Feb 29, 2024
6445e5c
Merge pull request #602 from openmobilemaps/bugfix/offscreen-map-rend…
maurhofer-ubique Feb 29, 2024
5d3496c
Allow for underzoom to render whole bounds area when camera is restri…
maurhofer-ubique Mar 5, 2024
dc7db2a
fixes pattern scaling
stmitt Mar 5, 2024
60c3583
fixes bug in vector render pass grouping
stmitt Feb 28, 2024
509934f
only restrict bounds if viewport is set
stmitt Mar 6, 2024
b7e2c81
remove debug logs
stmitt Mar 7, 2024
ebbaaa3
Fix bounding box parsing for WMTS layers
M-Wong Mar 6, 2024
72b984d
Update changelog
M-Wong Mar 6, 2024
8d90bc8
Merge pull request #603 from openmobilemaps/bugfix/wmts-bounding-box-…
maerki Mar 7, 2024
912ef77
Increase version numbers
maurhofer-ubique Mar 7, 2024
1f73ea1
Update changelog
maurhofer-ubique Mar 7, 2024
0e719b5
extends debug labels
stmitt Mar 7, 2024
bf0da1a
initialize visibleTileHash with targetZoomLevelIdentifier
stmitt Mar 7, 2024
b1b2c18
Merge pull request #606 from openmobilemaps/bugfix/visibleTileHash
stmitt Mar 7, 2024
1bd3610
Safety check in wmts bounds parsing
maurhofer-ubique Mar 7, 2024
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
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# Changelog for Open Mobile Maps

## Version 2.0.0 (16.02.2023)
## Version 2.0.1 (07.03.2024)
- Fixed WGS84 bounding box parsing for WMTS layers
- Fix deadlock in renderToImage on iOS
- Fix crash for geojsons without type
- Fix renderToImage for vector layers
- Reference djinni by version on iOS
- Fix crash on certain polygon patters on iOS
- Fix constant loading for some geojsons
- Fix crash of symbol objects
- Fix crash from race condition in geojson reload
- Fix deallocation on OffscreenMapRenderer on Android

## Version 2.0.0 (16.02.2024)
- Major improvements in vector map performance, stability, and rendering, alongside expanded options for style specifications and GeoJSON support.
- Enhanced stability and performance for raster, icon, polygon, and line layers.
- Many additional improvements and bug fixes.
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/UbiqueInnovation/djinni.git", branch: "master"),
.package(url: "https://github.com/UbiqueInnovation/djinni.git", .upToNextMajor(from: "1.0.6")),
],
targets: [
.target(
Expand Down
4 changes: 2 additions & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ SNAPSHOT_REPOSITORY_URL=https://oss.sonatype.org/content/repositories/snapshots/

GROUP=io.openmobilemaps
POM_ARTIFACT_ID=mapscore
VERSION_NAME=2.0.0
VERSION_CODE=2000000
VERSION_NAME=2.0.1
VERSION_CODE=2000100

POM_NAME=mapscore
POM_PACKAGING=aar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package io.openmobilemaps.mapscore.map.util

import android.opengl.GLSurfaceView
import io.openmobilemaps.mapscore.graphics.GLThread
import io.openmobilemaps.mapscore.map.scheduling.AndroidScheduler
import io.openmobilemaps.mapscore.map.scheduling.AndroidSchedulerCallback
import io.openmobilemaps.mapscore.shared.graphics.common.Color
import io.openmobilemaps.mapscore.shared.graphics.common.Vec2I
Expand Down Expand Up @@ -56,6 +55,7 @@ open class OffscreenMapRenderer(val sizePx: Vec2I, val density: Float = 72f) : G

protected open fun onGlThreadFinishing() {
glThread.renderer = null
mapInterface?.destroy()
mapInterface = null
}

Expand Down
1 change: 1 addition & 0 deletions ios/graphics/Model/Polygon/PolygonPatternGroup2d.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ final class PolygonPatternGroup2d: BaseGraphicsObject {
} else {
var scaleFactors = customScreenPixelFactor.x != 0 ? customScreenPixelFactor : SIMD2<Float>([pixelFactor, pixelFactor])
encoder.setVertexBytes(&scaleFactors, length: MemoryLayout<SIMD2<Float>>.stride, index: 2)
encoder.setVertexBytes(&posOffset, length: MemoryLayout<SIMD2<Float>>.stride, index: 3)
}

// texture
Expand Down
2 changes: 1 addition & 1 deletion ios/graphics/Shader/Metal/PolygonGroupShader.metal
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ polygonPatternGroupFadeInFragmentShader(PolygonPatternGroupVertexOut in [[stage_
const float scalingFactorFactor = (scalingFactor.x / screenPixelAsRealMeterFactor) - 1.0;
const float2 spacing = pixelSize * scalingFactorFactor;
const float2 totalSize = pixelSize + spacing;
const float2 adjustedPixelPosition = in.pixelPosition + totalSize * 0.5; // in other project pixelSize
const float2 adjustedPixelPosition = in.pixelPosition + pixelSize * 0.5; // in other project pixelSize
float2 uvTot = fmod(adjustedPixelPosition, totalSize);

const int yIndex = int(adjustedPixelPosition.y / totalSize.y) % 2;
Expand Down
18 changes: 13 additions & 5 deletions ios/maps/MCMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,18 @@ extension MCMapView: MTKViewDelegate {
}
}

public func renderToImage(size: CGSize, timeout: Float, bounds: MCRectCoord, callback: @escaping (UIImage?, MCLayerReadyState) -> Void) {
public func renderToImage(size: CGSize, timeout: Float, bounds: MCRectCoord, callbackQueue: DispatchQueue = .main, callback: @escaping (UIImage?, MCLayerReadyState) -> Void) {
renderToImageQueue.async {
self.frame = CGRect(origin: .zero, size: .init(width: size.width / UIScreen.main.scale, height: size.height / UIScreen.main.scale))
self.setNeedsLayout()
self.layoutIfNeeded()
DispatchQueue.main.sync {
self.frame = CGRect(origin: .zero, size: .init(width: size.width / UIScreen.main.scale, height: size.height / UIScreen.main.scale))
self.setNeedsLayout()
self.layoutIfNeeded()
}

let mapReadyCallbacks = MCMapViewMapReadyCallbacks()
mapReadyCallbacks.delegate = self
mapReadyCallbacks.callback = callback
mapReadyCallbacks.callbackQueue = callbackQueue

self.mapInterface.drawReadyFrame(bounds, timeout: timeout, callbacks: mapReadyCallbacks)
}
Expand Down Expand Up @@ -319,13 +322,17 @@ public extension MCMapView {
private class MCMapViewMapReadyCallbacks: MCMapReadyCallbackInterface {
public weak var delegate: MCMapView?
public var callback: ((UIImage?, MCLayerReadyState) -> Void)?
public var callbackQueue: DispatchQueue?
public let semaphore = DispatchSemaphore(value: 1)

func stateDidUpdate(_ state: MCLayerReadyState) {
guard let delegate = self.delegate else { return }

semaphore.wait()

delegate.draw(in: delegate)

DispatchQueue.main.async {
callbackQueue?.async {
switch state {
case .NOT_READY:
break
Expand All @@ -336,6 +343,7 @@ private class MCMapViewMapReadyCallbacks: MCMapReadyCallbackInterface {
@unknown default:
break
}
self.semaphore.signal()
}
}
}
1 change: 1 addition & 0 deletions shared/public/GeoJsonTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class GeoJSONTileInterface {
class GeoJSONTileDelegate {
public:
virtual void didLoad(uint8_t maxZoom) = 0;
virtual void failedToLoad() = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addition of the failedToLoad virtual function to the GeoJSONTileDelegate class is a significant improvement in error handling. This function provides a standardized way for subclasses to respond to loading failures, enhancing the robustness and reliability of the codebase. It's essential to ensure that all subclasses of GeoJSONTileDelegate implement this new method appropriately, handling loading failures in a way that maintains the integrity and functionality of the application.

Recommend reviewing all subclasses of GeoJSONTileDelegate to ensure they implement the failedToLoad method effectively, providing meaningful error handling and recovery mechanisms where necessary.

};

class GeoJson {
Expand Down
4 changes: 2 additions & 2 deletions shared/public/Tiled2dMapRasterSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class Tiled2dMapRasterSource

virtual bool hasExpensivePostLoadingTask() override;

virtual std::shared_ptr<::TextureHolderInterface> postLoadingTask(const std::shared_ptr<TextureLoaderResult> &loadedData,
const Tiled2dMapTileInfo &tile) override;
virtual std::shared_ptr<::TextureHolderInterface> postLoadingTask(std::shared_ptr<TextureLoaderResult> loadedData,
Tiled2dMapTileInfo tile) override;
Comment on lines +43 to +44
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change in parameter types for the postLoadingTask method from const std::shared_ptr<TextureLoaderResult> & and const Tiled2dMapTileInfo & to std::shared_ptr<TextureLoaderResult> and Tiled2dMapTileInfo respectively, removes the const reference in favor of passing by value. This change can potentially improve performance by avoiding unnecessary reference counting operations on the std::shared_ptr. However, ensure that this change aligns with the overall design and usage patterns in the codebase, especially considering the implications on memory management and performance.

Consider verifying the impact of this change on performance and memory usage, especially in high-load scenarios or where the postLoadingTask method is called frequently.



private:
Expand Down
2 changes: 1 addition & 1 deletion shared/public/Tiled2dMapSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class Tiled2dMapSource :
protected:
virtual bool hasExpensivePostLoadingTask() = 0;

virtual R postLoadingTask(const L &loadedData, const Tiled2dMapTileInfo &tile) = 0;
virtual R postLoadingTask(L loadedData, Tiled2dMapTileInfo tile) = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The modification of the postLoadingTask method's parameter declarations in the Tiled2dMapSource class template to accept parameters by value is consistent with similar changes observed in other related files. This change suggests a broader initiative to optimize the handling of shared pointers across the codebase. While this can potentially improve performance by reducing reference counting overhead, it's essential to ensure that this change is applied consistently and judiciously across all relevant parts of the codebase to avoid introducing inconsistencies or unintended side effects.

Review the usage of the postLoadingTask method across different specializations of the Tiled2dMapSource template to ensure that the change in parameter declarations does not adversely affect the performance or functionality of the application, especially in scenarios involving frequent or complex data processing tasks.


MapConfig mapConfig;
std::shared_ptr<Tiled2dMapLayerConfig> layerConfig;
Expand Down
10 changes: 4 additions & 6 deletions shared/public/Tiled2dMapSourceImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@ void Tiled2dMapSource<T, L, R>::onVisibleBoundsChanged(const ::RectCoord &visibl
const double visibleBottom = visibleBoundsLayer.bottomRight.y - signHeight * viewboundsPadding;
visibleHeight = std::abs(visibleHeight) + 2 * viewboundsPadding;



size_t visibleTileHash = 0;
size_t visibleTileHash = targetZoomLevelIdentifier;

for (int i = startZoomLayer; i <= endZoomLevel; i++) {
const Tiled2dMapZoomLevelInfo &zoomLevelInfo = zoomLevelInfos.at(i);
Expand Down Expand Up @@ -396,10 +394,10 @@ void Tiled2dMapSource<T, L, R>::performLoadingTask(Tiled2dMapTileInfo tile, size
auto weakActor = WeakActor<Tiled2dMapSource>(mailbox, std::static_pointer_cast<Tiled2dMapSource>(shared_from_this()));

currentlyLoading.insert({tile, loaderIndex});
std::string layerName = layerConfig->getLayerName();
readyTiles.erase(tile);

loadDataAsync(tile, loaderIndex).then([weakActor, loaderIndex, tile, weakSelfPtr](::djinni::Future<L> result) {

loadDataAsync(tile, loaderIndex).then([weakActor, loaderIndex, tile, weakSelfPtr, layerName](::djinni::Future<L> result) {
auto strongSelf = weakSelfPtr.lock();
if (strongSelf) {
auto res = result.get();
Expand Down Expand Up @@ -430,7 +428,7 @@ void Tiled2dMapSource<T, L, R>::performLoadingTask(Tiled2dMapTileInfo tile, size
template<class T, class L, class R>
void Tiled2dMapSource<T, L, R>::didLoad(Tiled2dMapTileInfo tile, size_t loaderIndex, const R &result) {
currentlyLoading.erase(tile);

std::string layerName = layerConfig->getLayerName();
const bool isVisible = currentVisibleTiles.count(tile);
if (!isVisible) {
errorTiles[loaderIndex].erase(tile);
Expand Down
2 changes: 1 addition & 1 deletion shared/public/Tiled2dMapVectorSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Tiled2dMapVectorSource : public Tiled2dMapSource<std::shared_ptr<djinni::D

virtual bool hasExpensivePostLoadingTask() override;

virtual Tiled2dMapVectorTileInfo::FeatureMap postLoadingTask(const std::shared_ptr<DataLoaderResult> &loadedData, const Tiled2dMapTileInfo &tile) override;
virtual Tiled2dMapVectorTileInfo::FeatureMap postLoadingTask(std::shared_ptr<DataLoaderResult> loadedData, Tiled2dMapTileInfo tile) override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the previous file, the change in parameter types for the postLoadingTask method from const std::shared_ptr<DataLoaderResult> &loadedData, const Tiled2dMapTileInfo &tile to std::shared_ptr<DataLoaderResult> loadedData, Tiled2dMapTileInfo tile removes the const reference in favor of passing by value. This change is consistent with the modifications observed in Tiled2dMapRasterSource.h. Ensure that this change is part of a deliberate effort to optimize performance and that it does not introduce unintended side effects in terms of memory management and performance.

As with the previous file, it's advisable to assess the impact of this change on performance and memory usage, particularly in scenarios where the postLoadingTask method is invoked frequently.


const std::vector<std::shared_ptr<::LoaderInterface>> loaders;
const std::unordered_set<std::string> layersToDecode;
Expand Down
3 changes: 0 additions & 3 deletions shared/public/Tiled2dMapVectorStyleParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,6 @@ class Tiled2dMapVectorStyleParser {
};

ValueVariant getVariant(const nlohmann::json &json) {
if (json == "–") {
LogDebug <<= "break";
}
if (json.is_number_float()) {
return json.get<float>();
} else if (json.is_number_integer()) {
Expand Down
5 changes: 0 additions & 5 deletions shared/public/VectorTilePolygonHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,13 @@ class VectorTilePolygonHandler {
void ring_begin(uint32_t count) {
currentRing = std::vector<::Coord>();
currentRing.reserve(count);
/*LogDebug <<= " new Polygon with TopLeft: (" + tileCoords.topLeft.systemIdentifier + ": " + std::to_string(tileCoords.topLeft.x) + ", " + std::to_string(tileCoords.topLeft.y) + ")";
LogDebug <<= " BottomRight: (" + tileCoords.bottomRight.systemIdentifier + ": " + std::to_string(tileCoords.bottomRight.x) + ", " + std::to_string(tileCoords.bottomRight.y) + ")";
LogDebug <<= " and width/height: (" + std::to_string(tileWidth) + ", " + std::to_string(tileHeight) + ")";*/
}

void ring_point(vtzero::point point) noexcept {
double x = tileCoords.topLeft.x + tileWidth * (point.x / extent);
double y = tileCoords.topLeft.y + tileHeight * (point.y / extent);
Coord newCoord = Coord(tileCoords.topLeft.systemIdentifier, x, y, 0.0);
currentRing.push_back(newCoord);
/*LogDebug <<= " -> new point: (" + std::to_string(point.x) + ", " + std::to_string(point.y) + ") in extent " + std::to_string(extent);
LogDebug <<= " -> coord (" + newCoord.systemIdentifier + ": " + std::to_string(newCoord.x) + ", " + std::to_string(newCoord.y) + ")";*/
}

void ring_end(vtzero::ring_type ringType) noexcept {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/MapsCoreSharedModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

#include "MapsCoreSharedModule.h"

std::string MapsCoreSharedModule::version() { return "2.0.0"; }
std::string MapsCoreSharedModule::version() { return "2.0.1"; }
Loading
Loading