diff --git a/WhirlyGlobe.podspec b/WhirlyGlobe.podspec index 08fb21f4f6..c85790eed5 100644 --- a/WhirlyGlobe.podspec +++ b/WhirlyGlobe.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.author = { "Steve Gifford" => "contact@mousebirdconsulting.com" } s.social_media_url = 'https://twitter.com/@mousebirdc' - s.platform = :ios, '9.0' + s.platform = :ios, '12.0' s.requires_arc = true s.source = { :git => 'https://github.com/mousebird/WhirlyGlobe.git', :branch => 'develop' } diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/AnimatedBaseMapTestCase.java b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/AnimatedBaseMapTestCase.java index ab8f353a65..9911da7d91 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/AnimatedBaseMapTestCase.java +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/AnimatedBaseMapTestCase.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/22/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/AnimationDelegateTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/AnimationDelegateTestCase.kt index 2d4efd13d3..96ce6d9e86 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/AnimationDelegateTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/AnimationDelegateTestCase.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Tim Sylvester on 9 Feb 2021. - * Copyright 2021 mousebird consulting + * Copyright 2021-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/BillboardAdapter.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/BillboardAdapter.kt index b7a41dbc41..964129f59a 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/BillboardAdapter.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/BillboardAdapter.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/BillboardTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/BillboardTestCase.kt index ebca6857c9..b1d01d572d 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/BillboardTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/BillboardTestCase.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/CartoTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/CartoTestCase.kt index c24c796672..9c4df6cc88 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/CartoTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/CartoTestCase.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -102,12 +102,12 @@ class CartoTestCase(activity: Activity) : // Generate the fetch request for the chunk of data we want override fun fetchInfoForTile(tileID: TileID?, flipY: Boolean): Any { - val bbox = theLoader?.geoBoundsForTile(tileID) + val bbox = tileID?.let { theLoader?.geoBoundsForTile(it) } ?: Mbr() // Construct the query string val fetchInfo = RemoteTileFetchInfo() val toDeg = 180.0/ PI - val query = String.format(search,bbox!!.ll.x*toDeg,bbox.ll.y*toDeg,bbox.ur.x*toDeg,bbox.ur.y*toDeg) + val query = String.format(search,bbox.ll.x*toDeg,bbox.ll.y*toDeg,bbox.ur.x*toDeg,bbox.ur.y*toDeg) val encodeQuery = URLEncoder.encode(query,"utf-8") val fullURLStr = String.format("https://pluto.cartodb.com/api/v2/sql?format=GeoJSON&q=%s",encodeQuery) fetchInfo.urlReq = Request.Builder().url(URL(fullURLStr)).build() @@ -135,5 +135,11 @@ class CartoTestCase(activity: Activity) : loadReturn.addComponentObject(vc.addVector(vecObj,vecInfoFill,ThreadMode.ThreadCurrent)) loadReturn.addComponentObject(vc.addVector(vecObj,vecInfoOutline,ThreadMode.ThreadCurrent)) } + + /** + * Some tiles were just removed. + */ + override fun tilesUnloaded(ids: Array) { + } } } \ No newline at end of file diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ClusteredMarkersTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ClusteredMarkersTestCase.kt index 60255aa96d..fe9c594e0b 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ClusteredMarkersTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ClusteredMarkersTestCase.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ComponentObjectLeakTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ComponentObjectLeakTestCase.kt index 2a085f60e8..530e509029 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ComponentObjectLeakTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ComponentObjectLeakTestCase.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/CustomBNGCoordAdapter.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/CustomBNGCoordAdapter.kt index a32fb2185f..121fd977a4 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/CustomBNGCoordAdapter.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/CustomBNGCoordAdapter.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/13/16. - * Copyright 2016-2021 mousebird consulting + * Copyright 2016-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/CustomBNGTileSource.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/CustomBNGTileSource.kt index 04e09a8964..5222b60638 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/CustomBNGTileSource.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/CustomBNGTileSource.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/13/16. - * Copyright 2016-2021 mousebird consulting + * Copyright 2016-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ImageReloadTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ImageReloadTestCase.kt index fa19b0ee36..75d503e726 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ImageReloadTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ImageReloadTestCase.kt @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg -* Copyright 2011-2019 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/LightingAdapter.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/LightingAdapter.kt index a957137ef6..c0f7e8ddaa 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/LightingAdapter.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/LightingAdapter.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/LightingTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/LightingTestCase.kt index 5595743429..325e47dc4b 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/LightingTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/LightingTestCase.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/MaplyStarModelTestCase.java b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/MaplyStarModelTestCase.java index c7755672a2..e08c003fc7 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/MaplyStarModelTestCase.java +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/MaplyStarModelTestCase.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/MovingScreenMarkersTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/MovingScreenMarkersTestCase.kt index 6b87d6e5a0..af49e3a159 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/MovingScreenMarkersTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/MovingScreenMarkersTestCase.kt @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Tim Sylvester on 9 Feb 2021. - * Copyright 2021 mousebird consulting + * Copyright 2021-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ package com.mousebirdconsulting.autotester.TestCases import android.app.Activity import android.graphics.BitmapFactory +import android.graphics.Color import android.os.Handler import com.mousebird.maply.* import com.mousebirdconsulting.autotester.Framework.MaplyTestCase @@ -56,8 +57,8 @@ class MovingScreenMarkersTestCase(activity: Activity) : controller.addTexture(icon1, null, threadCurrent)!!) timerRunnable = Runnable { - clearMarkers() - markerObj = makeMarkers() + clear() + objs.addAll(makeMarkers()) timerRunnable?.let { timerHandler.postDelayed(it, (1000 * duration).toLong()) } @@ -72,25 +73,24 @@ class MovingScreenMarkersTestCase(activity: Activity) : timerHandler.removeCallbacks(it) } + clear() + baseCase.shutdown() super.shutdown() } - private fun clearMarkers() { - markerObj?.also { - controller.removeObject(it, threadCurrent) - markerObj = null - } + private fun clear() { + controller.removeObjects(objs, threadCurrent) + objs.clear() } - private fun makeMarkers(): ComponentObject? { + private fun makeMarkers(): Collection { val pts = arrayOf( Point2d.FromDegrees(0.0, 0.0), Point2d.FromDegrees(10.0, 10.0), Point2d.FromDegrees(0.0, 20.0), Point2d.FromDegrees(-10.0, 10.0) ) - val markers = pts.indices.map { ScreenMovingMarker().apply { duration = this@MovingScreenMarkersTestCase.duration @@ -102,9 +102,27 @@ class MovingScreenMarkersTestCase(activity: Activity) : layoutImportance = Float.MAX_VALUE } } - return controller.addScreenMovingMarkers(markers, MarkerInfo(), threadCurrent) + val labels = pts.indices.map { + ScreenMovingLabel().apply { + duration = this@MovingScreenMarkersTestCase.duration + //period = this@MovingScreenMarkersTestCase.duration / 2 + loc = pts[it] + endLoc = pts[(it + 1) % pts.size] + layoutImportance = Float.MAX_VALUE + offset = Point2d(20.0, -10.0) + text = "<==" + } + } + val labelInfo = LabelInfo().apply { + textColor = Color.RED + fontSize = 20.0f + } + return listOfNotNull( + controller.addScreenMovingMarkers(markers, MarkerInfo(), threadCurrent), + controller.addScreenMovingLabels(labels, labelInfo, threadCurrent) + ) } - + private val threadCurrent = ThreadMode.ThreadCurrent private var baseCase = VectorsTestCase(activity) @@ -114,5 +132,5 @@ class MovingScreenMarkersTestCase(activity: Activity) : private val timerHandler = Handler() private var textures: Array? = null - private var markerObj: ComponentObject? = null + private val objs = ArrayList() } diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/PagingLayerTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/PagingLayerTestCase.kt index 0c52b1dfee..cf2f1914c5 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/PagingLayerTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/PagingLayerTestCase.kt @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/SLDTestCase.java b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/SLDTestCase.java index 44c1266016..3fab7221c6 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/SLDTestCase.java +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/SLDTestCase.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by rghosh on 2017-03-14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ShapesTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ShapesTestCase.kt index b317536560..645a39a64d 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ShapesTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/ShapesTestCase.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/SimpleStyleTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/SimpleStyleTestCase.kt index b5815f9fcd..99063b6007 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/SimpleStyleTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/SimpleStyleTestCase.kt @@ -41,8 +41,7 @@ class SimpleStyleTestCase(activity: Activity) : MaplyTestCase(activity, "Simple super.userDidSelect(mapControl, selObjs, loc, screenLoc) selObjs?.forEach { so -> (so.selObj as? VectorObject)?.let { obj -> - val json = obj.attributes.getString("json") - val x = json + val json = obj.attributes?.getString("json") } } } @@ -88,12 +87,10 @@ class SimpleStyleTestCase(activity: Activity) : MaplyTestCase(activity, "Simple obj.selectable = true if (obj.attributes == null) { // has no effect if the vector object has no shapes - obj.attributes = AttrDictionary() + obj.setAttributes(AttrDictionary()) } - if (obj.attributes != null) { - obj.attributes.setString("json", json); - } - + obj.attributes?.setString("json", json); + if (obj.fromGeoJSON(json)) { styleMan.addFeatures(obj, threadAny) } else { diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/StamenRemoteTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/StamenRemoteTestCase.kt index 96472d0fe6..d109de354e 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/StamenRemoteTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/StamenRemoteTestCase.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/22/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/StartupShutdownTestCase.java b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/StartupShutdownTestCase.java index 84157cd190..bba8f9aa65 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/StartupShutdownTestCase.java +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/StartupShutdownTestCase.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/StickersTestCase.java b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/StickersTestCase.java index 250ea995f2..8c87bde5b8 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/StickersTestCase.java +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/StickersTestCase.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/TextureVectorTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/TextureVectorTestCase.kt index a22d695f5c..a2b1aaf28a 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/TextureVectorTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/TextureVectorTestCase.kt @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,8 +78,8 @@ class TextureVectorTestCase(activity: Activity) : MaplyTestCase(activity, "Textu // Center of the texture application val center = loopObj.center() val attrs = loopObj.attributes - attrs.setDouble("veccenterx", center.x) - attrs.setDouble("veccentery", center.y) + attrs?.setDouble("veccenterx", center.x) + attrs?.setDouble("veccentery", center.y) var thisClipGridLon = ClipGridSize if (isGlobe) { diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorHoleTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorHoleTestCase.kt index 236d422a0b..a5566b90be 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorHoleTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorHoleTestCase.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorMBTilesTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorMBTilesTestCase.kt index 4bdbc54f3f..1f7c1d0759 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorMBTilesTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorMBTilesTestCase.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorStyleTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorStyleTestCase.kt index 922258e212..fcfe39ef06 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorStyleTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorStyleTestCase.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorsTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorsTestCase.kt index 25177e310c..b0d1616bde 100644 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorsTestCase.kt +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/VectorsTestCase.kt @@ -12,24 +12,29 @@ import okio.source import java.util.* class VectorsTestCase(activity: Activity?) : - MaplyTestCase(activity, "Vectors Test", TestExecutionImplementation.Both) { + MaplyTestCase(activity, "Vectors", TestExecutionImplementation.Both) { private val compObjs = ArrayList() @Throws(Exception::class) private fun overlayCountries(baseVC: BaseController) { - val vectorInfo = WideVectorInfo().apply { - setColor(Color.RED) - setLineWidth(4f) + val vectorInfo = VectorInfo().apply { + color = Color.RED + drawPriority = RenderController.VectorDrawPriorityDefault+1 + } + val wideInfo = WideVectorInfo().apply { + color = Color.WHITE + drawPriority = RenderController.VectorDrawPriorityDefault + lineWidth = 5f } val assetMgr = activity.assets - val jsons = assetMgr.list("country_json_50m")!! var loaded = 0 var msg: Toast? = null - for (path in jsons) { + val paths = assetMgr.list("country_json_50m") + paths?.forEach { path -> val txt = "Loading %s : %.1f%%".format( path.removeSuffix(".geojson"), - ++loaded * 100.0 / jsons.size) + ++loaded * 100.0 / paths.size) activity.runOnUiThread { msg?.cancel() msg = Toast.makeText(activity.applicationContext, txt, Toast.LENGTH_SHORT) @@ -44,7 +49,7 @@ class VectorsTestCase(activity: Activity?) : } Log.d("Maply", "Loading $path") if (!baseVC.isRunning || canceled) { - break + return@forEach } VectorObject.createFromGeoJSON(json)?.apply { selectable = true @@ -52,10 +57,11 @@ class VectorsTestCase(activity: Activity?) : vectors.add(vec) // We use ThreadAny here so that it's handled correctly if the map is shut // down while we're running. - baseVC.addWideVector(vec, vectorInfo, ThreadMode.ThreadAny)?.let { co -> - compObjs.add(co) - onVectorLoaded?.invoke(vec,co) - } + val cos = listOfNotNull( + baseVC.addVector(vec, vectorInfo, ThreadMode.ThreadAny), + baseVC.addWideVector(vec, wideInfo, ThreadMode.ThreadAny)) + compObjs.addAll(cos) + onVectorLoaded?.invoke(vec,cos) } } activity.runOnUiThread { msg?.cancel() } @@ -69,8 +75,8 @@ class VectorsTestCase(activity: Activity?) : // Then change to white val newVectorInfo = WideVectorInfo().apply { - setColor(Color.WHITE) - setLineWidth(4f) + color = Color.WHITE + lineWidth = 4f } // todo: doesn't work yet for (compObj in compObjs) { @@ -79,7 +85,7 @@ class VectorsTestCase(activity: Activity?) : } var onVectorsLoaded: ((Collection)->Unit)? = null - var onVectorLoaded: ((VectorObject,ComponentObject)->Unit)? = null + var onVectorLoaded: ((VectorObject,Collection)->Unit)? = null @Throws(Exception::class) override fun setUpWithMap(mapVC: MapController): Boolean { @@ -128,10 +134,10 @@ class VectorsTestCase(activity: Activity?) : val s = selObjs.mapNotNull { it.selObj as? VectorObject } .mapNotNull { val center = it.centroid() ?: it.center() ?: return@mapNotNull null - val name = it.attributes.getString("NAME_FORMA") ?: - it.attributes.getString("NAME") ?: - it.attributes.getString("ADMIN") ?: - it.attributes.getString("title") ?: "?" + val name = it.attributes?.getString("NAME_FORMA") ?: + it.attributes?.getString("NAME") ?: + it.attributes?.getString("ADMIN") ?: + it.attributes?.getString("title") ?: "?" mapController?.animatePositionGeo(center, mapController.height, mapController.heading, 1.0) globeController?.animatePositionGeo(center, globeController.height, globeController.heading, 1.0) String.format("$name (%.5f,%.5f)", diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/WideVectorsTestCase.java b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/WideVectorsTestCase.java deleted file mode 100644 index 6c6570b4cc..0000000000 --- a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/WideVectorsTestCase.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.mousebirdconsulting.autotester.TestCases; - -import android.app.Activity; -import android.graphics.Bitmap; -import android.graphics.Color; -import android.util.Log; - -import com.mousebird.maply.ComponentObject; -import com.mousebird.maply.GlobeController; -import com.mousebird.maply.LinearTextureBuilder; -import com.mousebird.maply.MapController; -import com.mousebird.maply.BaseController; -import com.mousebird.maply.MaplyTexture; -import com.mousebird.maply.Point2d; -import com.mousebird.maply.RenderController; -import com.mousebird.maply.VectorInfo; -import com.mousebird.maply.VectorObject; -import com.mousebird.maply.WideVectorInfo; -import com.mousebirdconsulting.autotester.Framework.MaplyTestCase; - -import org.jetbrains.annotations.NotNull; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -import okio.Okio; - -public class WideVectorsTestCase extends MaplyTestCase { - public WideVectorsTestCase(Activity activity) { - super(activity, "Wide Vectors Test", TestExecutionImplementation.Both); - setDelay(4); - } - - @NotNull - private ArrayList addGeoJSON( - @NotNull BaseController baseController, @NotNull String name, - float width, int drawPriority, int color, - boolean usePattern, double edge) { - MaplyTexture tex = null; - if (usePattern) { - // Build a dashed pattern - LinearTextureBuilder texBuild = new LinearTextureBuilder(); - int[] pattern = new int[2]; - pattern[0] = 4; - pattern[1] = 4; - texBuild.setPattern(pattern); - Bitmap patternImage = texBuild.makeImage(); - RenderController.TextureSettings texSet = new RenderController.TextureSettings(); - texSet.wrapU = true; - texSet.wrapV = true; - tex = baseController.addTexture(patternImage, texSet, RenderController.ThreadMode.ThreadCurrent); - } - - final WideVectorInfo wideVecInfo = new WideVectorInfo(); - wideVecInfo.setColor(color); - wideVecInfo.setLineWidth(width); - wideVecInfo.setDrawPriority(drawPriority); - if (tex != null) { - wideVecInfo.setTexture(tex); - wideVecInfo.setTextureRepeatLength(8.0); - } - - wideVecInfo.setEdgeFalloff(edge); - - final VectorInfo vecInfo = new VectorInfo(); - vecInfo.setLineWidth(4.0f); - vecInfo.setColor(Color.BLACK); - - ArrayList compObjs = new ArrayList<>(); - try { - InputStream stream = getActivity().getAssets().open("wide_vecs/" + name); - String json = Okio.buffer(Okio.source(stream)).readUtf8(); - - VectorObject vecObj = VectorObject.createFromGeoJSON(json); - if (vecObj != null) { - vecObj = vecObj.subdivideToGlobeGreatCircle(0.0001f); - } - if (vecObj != null) { - final ComponentObject compObj = baseController.addVector( - vecObj, vecInfo, RenderController.ThreadMode.ThreadCurrent); - final ComponentObject compObj2 = baseController.addWideVector( - vecObj, wideVecInfo, RenderController.ThreadMode.ThreadCurrent); - - if (compObj != null) { - compObjs.add(compObj); - } - if (compObj2 != null) { - compObjs.add(compObj2); - } - } - } catch (Exception e) { - Log.e(getClass().getSimpleName(), "Failed", e); - } - return compObjs; - } - - private void wideVecTest(@NotNull BaseController baseController) { - componentObjects.addAll(addGeoJSON(baseController, "mowing-lawn.geojson", 20.0f, VectorInfo.VectorPriorityDefault, Color.BLUE, true, 1)); - componentObjects.addAll(addGeoJSON(baseController, "spiral.geojson", 20.0f, VectorInfo.VectorPriorityDefault, Color.BLUE, true, 1)); - componentObjects.addAll(addGeoJSON(baseController, "square.geojson", 20.0f, VectorInfo.VectorPriorityDefault, Color.BLUE, true, 1)); - componentObjects.addAll(addGeoJSON(baseController, "line.geojson", 100.0f, VectorInfo.VectorPriorityDefault, Color.BLUE, true, 1)); - componentObjects.addAll(addGeoJSON(baseController, "line.geojson", 60.0f, VectorInfo.VectorPriorityDefault+10, Color.RED, true, 1)); - componentObjects.addAll(addGeoJSON(baseController, "track.geojson", 20.0f, VectorInfo.VectorPriorityDefault, Color.BLUE, true, 1)); - componentObjects.addAll(addGeoJSON(baseController, "uturn2.geojson", 20.0f, VectorInfo.VectorPriorityDefault, Color.BLUE, true, 1)); - componentObjects.addAll(addGeoJSON(baseController, "testJson.geojson", 20.0f, VectorInfo.VectorPriorityDefault, Color.BLUE, true, 1)); - componentObjects.addAll(addGeoJSON(baseController, "sawtooth.geojson", 50.0f, VectorInfo.VectorPriorityDefault, Color.RED, false,20)); - } - - @Override - public boolean setUpWithMap(MapController mapVC) { - CartoLightTestCase baseTestCase = new CartoLightTestCase(getActivity()); - baseTestCase.setUpWithMap(mapVC); - wideVecTest(mapVC); - mapVC.animatePositionGeo(Point2d.FromDegrees(-100,40),0.5,0.0,1.0); - return true; - } - - @Override - public boolean setUpWithGlobe(GlobeController globeVC) { - CartoLightTestCase baseTestCase = new CartoLightTestCase(getActivity()); - baseTestCase.setUpWithGlobe(globeVC); - wideVecTest(globeVC); - globeVC.animatePositionGeo(Point2d.FromDegrees(-100,40),0.5,0.0,1.0); - return true; - } - - @Override - public void shutdown() { - controller.removeObjects(componentObjects, RenderController.ThreadMode.ThreadCurrent); - componentObjects.clear(); - baseTestCase.shutdown(); - super.shutdown(); - } - - private final CartoLightTestCase baseTestCase = new CartoLightTestCase(getActivity()); - private final List componentObjects = new ArrayList<>(); -} \ No newline at end of file diff --git a/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/WideVectorsTestCase.kt b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/WideVectorsTestCase.kt new file mode 100644 index 0000000000..6d41f6ba8e --- /dev/null +++ b/android/apps/AutoTesterAndroid/app/src/main/java/com/mousebirdconsulting/autotester/TestCases/WideVectorsTestCase.kt @@ -0,0 +1,159 @@ +package com.mousebirdconsulting.autotester.TestCases + +import okio.source +import okio.buffer +import android.app.Activity +import com.mousebirdconsulting.autotester.Framework.MaplyTestCase +import android.graphics.Color +import android.util.Log +import com.mousebird.maply.* +import com.mousebird.maply.RenderControllerInterface.TextureSettings +import java.lang.Exception +import java.util.ArrayList + +class WideVectorsTestCase(activity: Activity?) : + MaplyTestCase(activity, "Wide Vectors", TestExecutionImplementation.Both) { + + init { + setDelay(4) + } + + private fun addGeoJSON( + baseController: BaseController, name: String, + width: Float, drawPriority: Int, color: Int, + usePattern: Boolean, edge: Double + ): Collection { + val tex = if (usePattern) { + // Build a dashed pattern + val patternImage = LinearTextureBuilder().run { + setPattern(intArrayOf(4, 4)) + makeImage() + } + val texSet = TextureSettings().apply { + wrapU = true + wrapV = true + } + baseController.addTexture(patternImage, texSet, ThreadMode.ThreadCurrent) + } else null + + val wideVecInfo = WideVectorInfo().also { + it.color = color + it.lineWidth = width + it.drawPriority = drawPriority + if (tex != null) { + it.setTexture(tex) + it.setTextureRepeatLength(8.0) + } + it.edgeFalloff = edge + } + val vecInfo = VectorInfo().apply { + lineWidth = 4.0f + setColor(Color.BLACK) + } + + try { + val stream = activity.assets.open("wide_vecs/$name") + VectorObject.createFromGeoJSON(stream.source().buffer().readUtf8()) + ?.subdivideToGlobeGreatCircle(0.0001)?.let { + return listOfNotNull( + baseController.addVector(it, vecInfo, ThreadMode.ThreadCurrent), + baseController.addWideVector(it, wideVecInfo, ThreadMode.ThreadCurrent)) + } + } catch (e: Exception) { + Log.e(javaClass.simpleName, "Failed", e) + } + return emptyList() + } + + private fun wideVecTest(baseController: BaseController) { + val pri = VectorInfo.VectorPriorityDefault + componentObjects.addAll(addGeoJSON(baseController, "mowing-lawn.geojson", 20.0f, pri, Color.BLUE, true, 1.0)) + componentObjects.addAll(addGeoJSON(baseController, "spiral.geojson", 20.0f, pri, Color.BLUE, true, 1.0)) + componentObjects.addAll(addGeoJSON(baseController, "square.geojson", 20.0f, pri, Color.BLUE, true, 1.0)) + componentObjects.addAll(addGeoJSON(baseController, "line.geojson", 100.0f, pri, Color.BLUE, true, 1.0)) + componentObjects.addAll(addGeoJSON(baseController, "line.geojson", 60.0f, pri + 10, Color.RED, true, 1.0)) + componentObjects.addAll(addGeoJSON(baseController, "track.geojson", 20.0f, pri, Color.BLUE, true, 1.0)) + componentObjects.addAll(addGeoJSON(baseController, "uturn2.geojson", 20.0f, pri, Color.BLUE, true, 1.0)) + componentObjects.addAll(addGeoJSON(baseController, "testJson.geojson", 20.0f, pri, Color.BLUE, true, 1.0)) + componentObjects.addAll(addGeoJSON(baseController, "sawtooth.geojson", 50.0f, pri, Color.RED, false, 20.0)) + componentObjects.addAll(offsetTests(baseController)) + } + + private fun offsetTests(vc: BaseController): Collection { + val rsep = 1.5 // separation for when/if performance implementation is supported + val csep = 1.2 + val cs = 0.1 + return (0..1).flatMap { k -> + (0..1).flatMap { j -> + (0..4).flatMap { i -> + val lat = 40 - (k * rsep) + val lon = j * csep - 90 + val coords = arrayOf( + Point2d.FromDegrees((-11*cs + i*1*cs + lon), lat + 13*cs), + Point2d.FromDegrees(( -7*cs + i*2*cs + lon), lat + 11*cs), + Point2d.FromDegrees(( 0*cs - i*2*cs + lon), lat + 0*cs), + Point2d.FromDegrees((-13*cs + i*1*cs + lon), lat + 13*cs), + ) + + val wideInfo = WideVectorInfo().also { + if (j == 0) it.setColor(0.0f, 0.0f, 1.0f, 0.75f) + else it.setColor(1.0f, 0.0f, 0.0f, 0.75f) + it.enable = true + it.setFade(0.0) + it.drawPriority = VectorInfo.VectorPriorityDefault + it.edgeFalloff = i.toDouble() + it.joinType = if (k == 0) WideVectorInfo.JoinType.BevelJoin else WideVectorInfo.JoinType.MiterJoin + it.offset = (2 * i).toDouble() + it.mitreLimit = 90.0 + it.lineWidth = 20.0f + //it.wideVecImpl = if (j == 0) perf : default + } + val info = VectorInfo().also { + it.setColor(1.0f, 0.0f, 1.0f, 0.5f) + it.enable = true + it.drawPriority = wideInfo.drawPriority + 10 + } + + val vecAttrs = AttrDictionary() + val clAttrs = AttrDictionary() + if (k > 0) { + val cc = 50 * i; + vecAttrs.setInt("color", Color.argb(129, 0,cc,255 - cc)); + clAttrs.setInt("color", Color.argb(192,0,255 - cc,cc)); + } + val vecObj = VectorObject.createLineString(coords, vecAttrs)?.subdivideToGlobe(0.0001) + val clObj = VectorObject.createLineString(coords, clAttrs)?.subdivideToGlobe(0.0001) + + listOfNotNull( + vc.addVector(clObj, info, ThreadMode.ThreadCurrent), + vc.addWideVector(vecObj, wideInfo, ThreadMode.ThreadCurrent) + ) + } + } + } + } + + override fun setUpWithMap(mapVC: MapController): Boolean { + baseTestCase.setUpWithMap(mapVC) + wideVecTest(mapVC) + mapVC.animatePositionGeo(Point2d.FromDegrees(-100.0, 40.0), 0.5, 0.0, 1.0) + return true + } + + override fun setUpWithGlobe(globeVC: GlobeController): Boolean { + baseTestCase.setUpWithGlobe(globeVC) + wideVecTest(globeVC) + globeVC.animatePositionGeo(Point2d.FromDegrees(-100.0, 40.0), 0.5, 0.0, 1.0) + return true + } + + override fun shutdown() { + controller.removeObjects(componentObjects, ThreadMode.ThreadCurrent) + componentObjects.clear() + baseTestCase.shutdown() + super.shutdown() + } + + private val baseTestCase = CartoLightTestCase(getActivity()) + private val componentObjects: MutableList = ArrayList() +} \ No newline at end of file diff --git a/android/library/maply/WhirlyGlobeLib/include/ComponentManager_Android.h b/android/library/maply/WhirlyGlobeLib/include/ComponentManager_Android.h index e376bdca91..3f43db8956 100644 --- a/android/library/maply/WhirlyGlobeLib/include/ComponentManager_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/ComponentManager_Android.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/4/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/include/Dictionary_Android.h b/android/library/maply/WhirlyGlobeLib/include/Dictionary_Android.h index 5901b688fe..8573a2de93 100644 --- a/android/library/maply/WhirlyGlobeLib/include/Dictionary_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/Dictionary_Android.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/16/13. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/include/FontTextureManager_Android.h b/android/library/maply/WhirlyGlobeLib/include/FontTextureManager_Android.h index 0f529febdd..e5bfaa0877 100644 --- a/android/library/maply/WhirlyGlobeLib/include/FontTextureManager_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/FontTextureManager_Android.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,45 +30,51 @@ class LabelInfoAndroid; class FontTextureManager_Android : public FontTextureManager { public: - FontTextureManager_Android(PlatformThreadInfo *,SceneRenderer *sceneRender,Scene *scene,jobject charRenderObj); - ~FontTextureManager_Android(); + FontTextureManager_Android(PlatformThreadInfo *,SceneRenderer *sceneRender,Scene *scene,jobject charRenderObj); + virtual ~FontTextureManager_Android(); // Wrapper for FontManager. - class FontManager_Android : public FontManager + struct FontManager_Android : public FontManager { - public: - FontManager_Android(PlatformThreadInfo *inst,jobject typefaceObj); - FontManager_Android(); + FontManager_Android() = default; + FontManager_Android(PlatformThreadInfo *inst,jobject typefaceObj); virtual ~FontManager_Android(); - virtual bool operator <(const FontManager &that) const override - { - return false; // todo: this isn't really ok - } + virtual bool operator <(const FontManager &that) const override; // Clear out global refs to Java objects we may be sitting on virtual void teardown(PlatformThreadInfo*) override; - jobject typefaceObj; + jobject typefaceObj = nullptr; }; typedef std::shared_ptr FontManager_AndroidRef; /// Add the given string. Caller is responsible for deleting the DrawableString - DrawableString *addString(PlatformThreadInfo *threadInfo,const std::vector &codePoints,const LabelInfoAndroid *,ChangeSet &changes); + std::unique_ptr addString(PlatformThreadInfo *, + const std::vector &codePoints, + const LabelInfoAndroid *, + ChangeSet &); - virtual void teardown(PlatformThreadInfo*) override; + virtual void teardown(PlatformThreadInfo *) override; protected: // Find the appropriate font manager - FontManager_AndroidRef findFontManagerForFont(PlatformInfo_Android *threadInfo,jobject typefaceObj,const LabelInfo &labelInfo); - - // Render the glyph with the given font manager -// RawDataRef renderGlyph(WKGlyph glyph,FontManageriOS *fm,Point2f &size,Point2f &glyphSize,Point2f &offset,Point2f &textureOffset); + FontManager_AndroidRef findFontManagerForFont(PlatformInfo_Android *,jobject typefaceObj,const LabelInfo &); // Java object that can do the character rendering for us - jobject charRenderObj; - jmethodID renderMethodID; - jfieldID bitmapID,sizeXID,sizeYID,glyphSizeXID,glyphSizeYID,offsetXID,offsetYID,textureOffsetXID,textureOffsetYID; + jobject charRenderObj = nullptr; + jobject glyphClassRef = nullptr; + jmethodID renderMethodID = nullptr; + jfieldID bitmapID = nullptr; + jfieldID sizeXID = nullptr; + jfieldID sizeYID = nullptr; + jfieldID glyphSizeXID = nullptr; + jfieldID glyphSizeYID = nullptr; + jfieldID offsetXID = nullptr; + jfieldID offsetYID = nullptr; + jfieldID textureOffsetXID = nullptr; + jfieldID textureOffsetYID = nullptr; + jfieldID baselineID = nullptr; }; typedef std::shared_ptr FontTextureManager_AndroidRef; diff --git a/android/library/maply/WhirlyGlobeLib/include/GreatCircle_Android.h b/android/library/maply/WhirlyGlobeLib/include/GreatCircle_Android.h index ecf5cf5657..3b0b8c1c66 100644 --- a/android/library/maply/WhirlyGlobeLib/include/GreatCircle_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/GreatCircle_Android.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/15/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/include/ImageTile_Android.h b/android/library/maply/WhirlyGlobeLib/include/ImageTile_Android.h index 2148523051..31554204ac 100644 --- a/android/library/maply/WhirlyGlobeLib/include/ImageTile_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/ImageTile_Android.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/include/ImageWrapper.h b/android/library/maply/WhirlyGlobeLib/include/ImageWrapper.h index a017d6d2e4..1c02ff80b0 100644 --- a/android/library/maply/WhirlyGlobeLib/include/ImageWrapper.h +++ b/android/library/maply/WhirlyGlobeLib/include/ImageWrapper.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 8/21/15. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/include/LabelInfo_Android.h b/android/library/maply/WhirlyGlobeLib/include/LabelInfo_Android.h index d831308b4a..c85453dcda 100644 --- a/android/library/maply/WhirlyGlobeLib/include/LabelInfo_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/LabelInfo_Android.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/include/MapboxVectorStyleSet_Android.h b/android/library/maply/WhirlyGlobeLib/include/MapboxVectorStyleSet_Android.h index 917b2b0a28..aac24419ea 100644 --- a/android/library/maply/WhirlyGlobeLib/include/MapboxVectorStyleSet_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/MapboxVectorStyleSet_Android.h @@ -1,9 +1,8 @@ -/* - * MapboxVectorTileParser_Android.h +/* MapboxVectorTileParser_Android.h * WhirlyGlobeLib * * Created by Steve Gifford on 4/12/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import @@ -47,7 +45,10 @@ class MapboxVectorStyleSetImpl_Android : public MapboxVectorStyleSetImpl virtual SimpleIdentity makeLineTexture(PlatformThreadInfo *inst,const std::vector &dashComponents) override; /// Create a local platform LabelInfo (since fonts are local) - virtual LabelInfoRef makeLabelInfo(PlatformThreadInfo *inst,const std::vector &fontName,float fontSize) override; + virtual LabelInfoRef makeLabelInfo(PlatformThreadInfo *, + const std::vector &fontName, + float fontSize, + bool mergedLabel) override; /// Create a local platform label (fonts are local, and other stuff) virtual SingleLabelRef makeSingleLabel(PlatformThreadInfo *inst,const std::string &text) override; diff --git a/android/library/maply/WhirlyGlobeLib/include/ParticleBatch_Android.h b/android/library/maply/WhirlyGlobeLib/include/ParticleBatch_Android.h index 3c54cf4f27..cdd73730ce 100644 --- a/android/library/maply/WhirlyGlobeLib/include/ParticleBatch_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/ParticleBatch_Android.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/13/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/include/QuadImageFrameLoader_Android.h b/android/library/maply/WhirlyGlobeLib/include/QuadImageFrameLoader_Android.h index 3cb1861f7a..2d7f8a1cbe 100644 --- a/android/library/maply/WhirlyGlobeLib/include/QuadImageFrameLoader_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/QuadImageFrameLoader_Android.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/22/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/include/QuadSamplingController_Android.h b/android/library/maply/WhirlyGlobeLib/include/QuadSamplingController_Android.h index 2c4d67c6c3..b360384978 100644 --- a/android/library/maply/WhirlyGlobeLib/include/QuadSamplingController_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/QuadSamplingController_Android.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/28/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/include/SceneRenderer_Android.h b/android/library/maply/WhirlyGlobeLib/include/SceneRenderer_Android.h index 3520f7d982..c62f2ac32b 100644 --- a/android/library/maply/WhirlyGlobeLib/include/SceneRenderer_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/SceneRenderer_Android.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/include/ScopedEnv_Android.h b/android/library/maply/WhirlyGlobeLib/include/ScopedEnv_Android.h index 0fcde57184..ffb4f45398 100644 --- a/android/library/maply/WhirlyGlobeLib/include/ScopedEnv_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/ScopedEnv_Android.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Tim Sylvester on 3/4/2021 - * Copyright 2021-2021 mousebird consulting + * Copyright 2021-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/include/Shader_Android.h b/android/library/maply/WhirlyGlobeLib/include/Shader_Android.h index d7ce27daae..dd5c7a4b74 100644 --- a/android/library/maply/WhirlyGlobeLib/include/Shader_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/Shader_Android.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/include/SingleLabel_Android.h b/android/library/maply/WhirlyGlobeLib/include/SingleLabel_Android.h index 9d7dbb0e32..e1bbf10496 100644 --- a/android/library/maply/WhirlyGlobeLib/include/SingleLabel_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/SingleLabel_Android.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,14 @@ namespace WhirlyKit * The platform specific single label for Android. * This knows how to render itself on Android devices. */ -class SingleLabelAndroid : public SingleLabel +struct SingleLabelAndroid : public SingleLabel { -public: - std::vector generateDrawableStrings(PlatformThreadInfo *threadInfo,const LabelInfo *inLabelInfo,const FontTextureManagerRef &fontTexManager,float &lineHeight,ChangeSet &changes); + std::vector> generateDrawableStrings( + PlatformThreadInfo *, + const LabelInfo *, + const FontTextureManagerRef &, + float &lineHeight, + ChangeSet &); // Sometimes rather than strings, we pass around the code points std::vector> codePointsLines; diff --git a/android/library/maply/WhirlyGlobeLib/include/VectorStyleSet_Android.h b/android/library/maply/WhirlyGlobeLib/include/VectorStyleSet_Android.h index d4f7e6302e..ed4cdc2f3e 100644 --- a/android/library/maply/WhirlyGlobeLib/include/VectorStyleSet_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/VectorStyleSet_Android.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 8/10/20. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/include/WhirlyGlobe_Android.h b/android/library/maply/WhirlyGlobeLib/include/WhirlyGlobe_Android.h index b68c85a758..a467ee0cfa 100644 --- a/android/library/maply/WhirlyGlobeLib/include/WhirlyGlobe_Android.h +++ b/android/library/maply/WhirlyGlobeLib/include/WhirlyGlobe_Android.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/ComponentManager_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/ComponentManager_Android.cpp index 0bc93d6eb9..acbf658567 100644 --- a/android/library/maply/WhirlyGlobeLib/src/ComponentManager_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/ComponentManager_Android.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/4/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/Dictionary_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/Dictionary_Android.cpp index b47f095f65..b35c536741 100644 --- a/android/library/maply/WhirlyGlobeLib/src/Dictionary_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/Dictionary_Android.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/16/13. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/FontTextureManager_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/FontTextureManager_Android.cpp index 41a8f39b7f..8e40595a4f 100644 --- a/android/library/maply/WhirlyGlobeLib/src/FontTextureManager_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/FontTextureManager_Android.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,13 +29,14 @@ namespace WhirlyKit // There's a constant on the Java side correspond go this as well static const float BogusFontScale = 1.0f; -FontTextureManager_Android::FontManager_Android::FontManager_Android(PlatformThreadInfo *inst,jobject inTypefaceObj) : - typefaceObj(((PlatformInfo_Android*)inst)->env->NewGlobalRef(inTypefaceObj)) +bool FontTextureManager_Android::FontManager_Android::operator <(const FontManager &that) const { + wkLogLevel(Warn, "FontManager_Android::operator < not implemented"); + return false; // todo: this isn't really ok } -FontTextureManager_Android::FontManager_Android::FontManager_Android() : - typefaceObj(nullptr) +FontTextureManager_Android::FontManager_Android::FontManager_Android(PlatformThreadInfo *inst,jobject inTypefaceObj) : + typefaceObj(((PlatformInfo_Android*)inst)->env->NewGlobalRef(inTypefaceObj)) { } @@ -43,7 +44,8 @@ FontTextureManager_Android::FontManager_Android::~FontManager_Android() { // should have been cleaned up by now through teardown. // We can't clean it up for lack of a JNIEnv, so it'll leak. - if (typefaceObj) { + if (typefaceObj) + { wkLogLevel(Warn, "FontManager_Android not cleaned up"); } } @@ -57,22 +59,32 @@ void FontTextureManager_Android::FontManager_Android::teardown(PlatformThreadInf } } -FontTextureManager_Android::FontTextureManager_Android(PlatformThreadInfo *inst,SceneRenderer *sceneRender,Scene *scene,jobject inCharRenderObj) : +FontTextureManager_Android::FontTextureManager_Android(PlatformThreadInfo *inst, + SceneRenderer *sceneRender, + Scene *scene, + jobject inCharRenderObj) : FontTextureManager(sceneRender,scene) { const auto env = ((PlatformInfo_Android*)inst)->env; charRenderObj = env->NewGlobalRef(inCharRenderObj); + if (!charRenderObj) + { + return; + } - if (const jclass charRenderClass = env->GetObjectClass(charRenderObj)) + if (jclass charRenderClass = env->GetObjectClass(charRenderObj)) { renderMethodID = env->GetMethodID(charRenderClass, "renderChar", "(ILcom/mousebird/maply/LabelInfo;F)Lcom/mousebird/maply/CharRenderer$Glyph;"); env->DeleteLocalRef(charRenderClass); } - if (const jclass glyphClass = env->FindClass("com/mousebird/maply/CharRenderer$Glyph")) + if (jclass glyphClass = env->FindClass("com/mousebird/maply/CharRenderer$Glyph")) { + // Make sure the glyph class doesn't get unloaded + // (todo: can an inner class be unloaded while an instance of its outer exists?) + glyphClassRef = env->NewGlobalRef(glyphClass); bitmapID = env->GetFieldID(glyphClass, "bitmap", "Landroid/graphics/Bitmap;"); sizeXID = env->GetFieldID(glyphClass, "sizeX", "F"); sizeYID = env->GetFieldID(glyphClass, "sizeY", "F"); @@ -82,13 +94,15 @@ FontTextureManager_Android::FontTextureManager_Android(PlatformThreadInfo *inst, offsetYID = env->GetFieldID(glyphClass, "offsetY", "F"); textureOffsetXID = env->GetFieldID(glyphClass, "textureOffsetX", "F"); textureOffsetYID = env->GetFieldID(glyphClass, "textureOffsetY", "F"); + logAndClearJVMException(env); env->DeleteLocalRef(glyphClass); } } FontTextureManager_Android::~FontTextureManager_Android() { - if (charRenderObj) { + if (charRenderObj) + { wkLogLevel(Warn, "FontTextureManager_Android not cleaned up"); } } @@ -112,17 +126,25 @@ void FontTextureManager_Android::teardown(PlatformThreadInfo* threadInfo) if (charRenderObj) { env->DeleteGlobalRef(charRenderObj); - charRenderObj = nullptr; } + if (glyphClassRef) + { + env->DeleteGlobalRef(glyphClassRef); + } + + charRenderObj = nullptr; + renderMethodID = nullptr; + glyphClassRef = nullptr; } -DrawableString *FontTextureManager_Android::addString( +std::unique_ptr FontTextureManager_Android::addString( PlatformThreadInfo *inThreadInfo, const std::vector &codePoints, const LabelInfoAndroid *labelInfo, ChangeSet &changes) { - auto threadInfo = (PlatformInfo_Android *)inThreadInfo; + const auto threadInfo = (PlatformInfo_Android *)inThreadInfo; + const auto env = threadInfo->env; // Could be more granular if this slows things down std::lock_guard guardLock(lock); @@ -135,8 +157,8 @@ DrawableString *FontTextureManager_Android::addString( // If not initialized, set up texture atlas and such init(); - auto drawString = new DrawableString(); - auto drawStringRep = new DrawStringRep(drawString->getId()); + auto drawString = std::make_unique(); + auto drawStringRep = std::make_unique(drawString->getId()); // Look for the font manager that manages the typeface/attribute combo we need auto fm = findFontManagerForFont(threadInfo,labelInfo->typefaceObj,*labelInfo); @@ -146,108 +168,109 @@ DrawableString *FontTextureManager_Android::addString( float offsetX = 0.0; for (const int glyph : codePoints) { - // Look for an existing glyph - auto glyphInfo = fm->findGlyph(glyph); - if (!glyphInfo) - { - // Call the renderer - const jobject glyphObj = threadInfo->env->CallObjectMethod(charRenderObj,renderMethodID,glyph,labelInfo->labelInfoObj,labelInfo->fontSize); - if (!glyphObj) - { - wkLogLevel(Warn,"Glyph render failed from FontTextureManager_Android: %d",glyph); - logAndClearJVMException(threadInfo->env, "addString"); - continue; - } - - jobject bitmapObj = threadInfo->env->GetObjectField(glyphObj,bitmapID); - if (!bitmapObj) - { - wkLogLevel(Error, "Glyph render produced no output"); - logAndClearJVMException(threadInfo->env, "addString"); - continue; - } - - try - { - // Got a bitmap, so merge that in with our texture atlas - AndroidBitmapInfo info; - const auto getInfoRes = AndroidBitmap_getInfo(threadInfo->env, bitmapObj, &info); - if (getInfoRes == ANDROID_BITMAP_RESULT_SUCCESS) - { + // Look for an existing glyph + auto glyphInfo = fm->findGlyph(glyph); + if (!glyphInfo) + { + // Call the renderer + jobject glyphObj = env->CallObjectMethod(charRenderObj,renderMethodID,glyph, + labelInfo->labelInfoObj,labelInfo->fontSize); + if (!glyphObj) + { + wkLogLevel(Warn,"Glyph render failed from FontTextureManager_Android: %d",glyph); + logAndClearJVMException(env, "addString"); + continue; + } + + jobject bitmapObj = env->GetObjectField(glyphObj,bitmapID); + if (!bitmapObj) + { + wkLogLevel(Error, "Glyph render produced no output"); + logAndClearJVMException(threadInfo->env, "addString"); + continue; + } + + try + { + // Got a bitmap, so merge that in with our texture atlas + AndroidBitmapInfo info; + const auto getInfoRes = AndroidBitmap_getInfo(threadInfo->env, bitmapObj, &info); + if (getInfoRes == ANDROID_BITMAP_RESULT_SUCCESS) + { Point2f texSize,glyphSize; Point2f offset,textureOffset; // Pull these values from the glyph - texSize.x() = threadInfo->env->GetFloatField(glyphObj,sizeXID); - texSize.y() = threadInfo->env->GetFloatField(glyphObj,sizeYID); - glyphSize.x() = threadInfo->env->GetFloatField(glyphObj,glyphSizeXID); - glyphSize.y() = threadInfo->env->GetFloatField(glyphObj,glyphSizeYID); - offset.x() = threadInfo->env->GetFloatField(glyphObj,offsetXID); - offset.y() = threadInfo->env->GetFloatField(glyphObj,offsetYID); - textureOffset.x() = threadInfo->env->GetFloatField(glyphObj,textureOffsetXID); - textureOffset.y() = threadInfo->env->GetFloatField(glyphObj,textureOffsetYID); + texSize.x() = env->GetFloatField(glyphObj,sizeXID); + texSize.y() = env->GetFloatField(glyphObj,sizeYID); + glyphSize.x() = env->GetFloatField(glyphObj,glyphSizeXID); + glyphSize.y() = env->GetFloatField(glyphObj,glyphSizeYID); + offset.x() = env->GetFloatField(glyphObj,offsetXID); + offset.y() = env->GetFloatField(glyphObj,offsetYID); + textureOffset.x() = env->GetFloatField(glyphObj,textureOffsetXID); + textureOffset.y() = env->GetFloatField(glyphObj,textureOffsetYID); // Create a texture - void* bitmapPixels = nullptr; - const auto lockRes = AndroidBitmap_lockPixels(threadInfo->env, bitmapObj, &bitmapPixels); - if (lockRes != ANDROID_BITMAP_RESULT_SUCCESS) - { - throw std::runtime_error("Unable to lock bitmap pixels"); - } - try - { - assert(info.width * 4 == info.stride); - - auto rawData = new MutableRawData(bitmapPixels, info.height * info.width * 4); - TextureGLES tex("FontTextureManager"); - tex.setRawData(rawData, info.width, info.height); - - // Add it to the texture atlas - SubTexture subTex; - const Point2f realSize(glyphSize.x() + 2 * textureOffset.x(), - glyphSize.y() + 2 * textureOffset.y()); - std::vector texs{&tex}; - if (texAtlas->addTexture(sceneRender, texs, -1, &realSize, nullptr, subTex, - changes, 0, 1, nullptr)) - { - glyphInfo = fm->addGlyph(glyph, subTex, - Point2f(glyphSize.x(), glyphSize.y()), - Point2f(offset.x(), offset.y()), - Point2f(textureOffset.x(), textureOffset.y())); - } - else - { - wkLogLevel(Error, "Failed to add glyph texture for %d/%c in %s", glyph, glyph, fm->fontName.c_str()); - } -// wkLogLevel(Info,"Glyph added: fm = %d, glyph = %d",(int)fm->getId(),(int)glyph); - } - catch (...) - { - // finally... - AndroidBitmap_unlockPixels(threadInfo->env, bitmapObj); - throw; - } + void* bitmapPixels = nullptr; + const auto lockRes = AndroidBitmap_lockPixels(threadInfo->env, bitmapObj, &bitmapPixels); + if (lockRes != ANDROID_BITMAP_RESULT_SUCCESS) + { + throw std::runtime_error("Unable to lock bitmap pixels"); + } + try + { + assert(info.width * 4 == info.stride); + + auto rawData = new MutableRawData(bitmapPixels, info.height * info.width * 4); + TextureGLES tex("FontTextureManager"); + tex.setRawData(rawData, info.width, info.height); + + // Add it to the texture atlas + SubTexture subTex; + const Point2f realSize(glyphSize.x() + 2 * textureOffset.x(), + glyphSize.y() + 2 * textureOffset.y()); + std::vector texs{&tex}; + if (texAtlas->addTexture(sceneRender, texs, -1, &realSize, nullptr, subTex, + changes, 0, 1, nullptr)) + { + glyphInfo = fm->addGlyph(glyph, subTex, + Point2f(glyphSize.x(), glyphSize.y()), + Point2f(offset.x(), offset.y()), + Point2f(textureOffset.x(), textureOffset.y())); + } + else + { + wkLogLevel(Error, "Failed to add glyph texture for %d/%c in %s", glyph, glyph, fm->fontName.c_str()); + } + //wkLogLevel(Info,"Glyph added: fm = %d, glyph = %d",(int)fm->getId(),(int)glyph); + } + catch (...) + { + // finally... + AndroidBitmap_unlockPixels(threadInfo->env, bitmapObj); + throw; + } AndroidBitmap_unlockPixels(threadInfo->env, bitmapObj); - } - else - { - wkLogLevel(Error, "Glyph AndroidBitmap_getInfo failed (%d)", getInfoRes); - } - } - catch (...) - { - // Just don't add the glyph, for now - wkLogLevel(Error, "Exception in addString %d/%c/%s", glyph, glyph, fm->fontName.c_str()); - } + } + else + { + wkLogLevel(Error, "Glyph AndroidBitmap_getInfo failed (%d)", getInfoRes); + } + } + catch (...) + { + // Just don't add the glyph, for now + wkLogLevel(Error, "Exception in addString %d/%c/%s", glyph, glyph, fm->fontName.c_str()); + } threadInfo->env->DeleteLocalRef(glyphObj); - } + } if (glyphInfo) { // Now we make a rectangle that covers the glyph in its texture atlas DrawableString::Rect rect; - const float scale = 1.0f/BogusFontScale; + const float scale = 1.0f/BogusFontScale; const Point2f offset(offsetX,-glyphInfo->offset.y()*scale); // Note: was -1,-1 @@ -274,14 +297,12 @@ DrawableString *FontTextureManager_Android::addString( // If it didn't produce anything, just delete it now if (drawString->glyphPolys.empty()) { - delete drawString; - delete drawStringRep; return nullptr; } else { // We need to track the glyphs we're using - drawStringReps.insert(drawStringRep); + drawStringReps.insert(drawStringRep.release()); return drawString; } } diff --git a/android/library/maply/WhirlyGlobeLib/src/GreatCircle_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/GreatCircle_Android.cpp index e4ee83f5de..a1f6624a39 100644 --- a/android/library/maply/WhirlyGlobeLib/src/GreatCircle_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/GreatCircle_Android.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/ImageTile_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/ImageTile_Android.cpp index 24f601913b..cc985d62bb 100644 --- a/android/library/maply/WhirlyGlobeLib/src/ImageTile_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/ImageTile_Android.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/ImageWrapper.cpp b/android/library/maply/WhirlyGlobeLib/src/ImageWrapper.cpp index 7957cacf9a..2dd027d376 100644 --- a/android/library/maply/WhirlyGlobeLib/src/ImageWrapper.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/ImageWrapper.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 8/21/15. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/LabelInfo_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/LabelInfo_Android.cpp index 43afcc4c0a..df39025143 100644 --- a/android/library/maply/WhirlyGlobeLib/src/LabelInfo_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/LabelInfo_Android.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/MapboxVectorStyleSet_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/MapboxVectorStyleSet_Android.cpp index 59fae08612..9eff7bec2d 100644 --- a/android/library/maply/WhirlyGlobeLib/src/MapboxVectorStyleSet_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/MapboxVectorStyleSet_Android.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/29/20. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -134,7 +134,10 @@ SimpleIdentity MapboxVectorStyleSetImpl_Android::makeLineTexture(PlatformThreadI return EmptyIdentity; } -LabelInfoRef MapboxVectorStyleSetImpl_Android::makeLabelInfo(PlatformThreadInfo *inInst,const std::vector &fontNames,float fontSize) +LabelInfoRef MapboxVectorStyleSetImpl_Android::makeLabelInfo(PlatformThreadInfo *inInst, + const std::vector &fontNames, + float fontSize, + bool mergedLabel) { auto inst = (PlatformInfo_Android *)inInst; diff --git a/android/library/maply/WhirlyGlobeLib/src/ParticleBatch_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/ParticleBatch_Android.cpp index f47c55f712..1f5cfd5c3f 100644 --- a/android/library/maply/WhirlyGlobeLib/src/ParticleBatch_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/ParticleBatch_Android.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/13/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/QuadImageFrameLoader_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/QuadImageFrameLoader_Android.cpp index 2f289ae424..7642df3460 100644 --- a/android/library/maply/WhirlyGlobeLib/src/QuadImageFrameLoader_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/QuadImageFrameLoader_Android.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/22/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/QuadSamplingController_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/QuadSamplingController_Android.cpp index de7252579a..a48f639cac 100644 --- a/android/library/maply/WhirlyGlobeLib/src/QuadSamplingController_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/QuadSamplingController_Android.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/28/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/SceneRenderer_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/SceneRenderer_Android.cpp index 3650cb2755..424994f331 100644 --- a/android/library/maply/WhirlyGlobeLib/src/SceneRenderer_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/SceneRenderer_Android.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/27/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/Shader_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/Shader_Android.cpp index 7ae31e0ef6..431790347f 100644 --- a/android/library/maply/WhirlyGlobeLib/src/Shader_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/Shader_Android.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/SingleLabel_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/SingleLabel_Android.cpp index 15e8e49fde..b172fd709b 100644 --- a/android/library/maply/WhirlyGlobeLib/src/SingleLabel_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/SingleLabel_Android.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ namespace WhirlyKit { -std::vector SingleLabelAndroid::generateDrawableStrings( +std::vector> SingleLabelAndroid::generateDrawableStrings( PlatformThreadInfo *inThreadInfo, const LabelInfo *inLabelInfo, const FontTextureManagerRef &inFontTexManager, @@ -42,24 +42,21 @@ std::vector SingleLabelAndroid::generateDrawableStrings( // May need the line height for multi-line labels lineHeight = labelInfo->lineHeight; - std::vector drawStrs; + std::vector> drawStrs; drawStrs.reserve(codePointsLines.size()); - int whichLine = 0; + float offset = 0.0f; for (const auto &codePoints : codePointsLines) { if (auto drawStr = fontTexManager->addString(threadInfo,codePoints,labelInfo,changes)) { - drawStrs.push_back(drawStr); - // Modify the MBR if this is a multi-line label - if (whichLine > 0) - { - drawStr->mbr.ll().y() += lineHeight * whichLine; - drawStr->mbr.ur().y() += lineHeight * whichLine; - } + drawStr->mbr.ll().y() += offset; + drawStr->mbr.ur().y() += offset; + + drawStrs.push_back(std::move(drawStr)); } - whichLine++; + offset += lineHeight; } return drawStrs; diff --git a/android/library/maply/WhirlyGlobeLib/src/VectorStyleSet_Android.cpp b/android/library/maply/WhirlyGlobeLib/src/VectorStyleSet_Android.cpp index a26db02336..a90004b883 100644 --- a/android/library/maply/WhirlyGlobeLib/src/VectorStyleSet_Android.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/VectorStyleSet_Android.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 8/10/20. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/WhirlyKitLog.cpp b/android/library/maply/WhirlyGlobeLib/src/WhirlyKitLog.cpp index 24ae6967eb..1930f9a941 100644 --- a/android/library/maply/WhirlyGlobeLib/src/WhirlyKitLog.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/WhirlyKitLog.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/WhirlyGlobeLib/src/platform.cpp b/android/library/maply/WhirlyGlobeLib/src/platform.cpp index a6922f63b5..13c9ca6470 100644 --- a/android/library/maply/WhirlyGlobeLib/src/platform.cpp +++ b/android/library/maply/WhirlyGlobeLib/src/platform.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/18/13. - * Copyright 2011-2013 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Astronomy_jni.h b/android/library/maply/jni/include/classInfo/Astronomy_jni.h index 3b3b229118..3ff7ef8e61 100644 --- a/android/library/maply/jni/include/classInfo/Astronomy_jni.h +++ b/android/library/maply/jni/include/classInfo/Astronomy_jni.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Base_jni.h b/android/library/maply/jni/include/classInfo/Base_jni.h index ebc7e9e135..1d5fd8804f 100644 --- a/android/library/maply/jni/include/classInfo/Base_jni.h +++ b/android/library/maply/jni/include/classInfo/Base_jni.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Billboard_jni.h b/android/library/maply/jni/include/classInfo/Billboard_jni.h index 317bdf96df..9a3aec4d46 100644 --- a/android/library/maply/jni/include/classInfo/Billboard_jni.h +++ b/android/library/maply/jni/include/classInfo/Billboard_jni.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/11/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Components_jni.h b/android/library/maply/jni/include/classInfo/Components_jni.h index 4bcd0f52fc..78f76ed64a 100644 --- a/android/library/maply/jni/include/classInfo/Components_jni.h +++ b/android/library/maply/jni/include/classInfo/Components_jni.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/19/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/CoordSystem_jni.h b/android/library/maply/jni/include/classInfo/CoordSystem_jni.h index 8dd55dd817..f2924be154 100644 --- a/android/library/maply/jni/include/classInfo/CoordSystem_jni.h +++ b/android/library/maply/jni/include/classInfo/CoordSystem_jni.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Exceptions_jni.h b/android/library/maply/jni/include/classInfo/Exceptions_jni.h index e883b5ee8f..0cd74fe5b3 100644 --- a/android/library/maply/jni/include/classInfo/Exceptions_jni.h +++ b/android/library/maply/jni/include/classInfo/Exceptions_jni.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Tim Sylvester on 3/8/2021 - * Copyright 2021-2021 mousebird consulting + * Copyright 2021-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Formats_jni.h b/android/library/maply/jni/include/classInfo/Formats_jni.h index b5ac8f82d1..724878afd1 100644 --- a/android/library/maply/jni/include/classInfo/Formats_jni.h +++ b/android/library/maply/jni/include/classInfo/Formats_jni.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/GeometryManager_jni.h b/android/library/maply/jni/include/classInfo/GeometryManager_jni.h index 45cf0b1e57..bf37080aba 100644 --- a/android/library/maply/jni/include/classInfo/GeometryManager_jni.h +++ b/android/library/maply/jni/include/classInfo/GeometryManager_jni.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Geometry_jni.h b/android/library/maply/jni/include/classInfo/Geometry_jni.h index e015ca28ad..5917bb28b1 100644 --- a/android/library/maply/jni/include/classInfo/Geometry_jni.h +++ b/android/library/maply/jni/include/classInfo/Geometry_jni.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/LabelsAndMarkers_jni.h b/android/library/maply/jni/include/classInfo/LabelsAndMarkers_jni.h index d754362cf2..a2b65f3a88 100644 --- a/android/library/maply/jni/include/classInfo/LabelsAndMarkers_jni.h +++ b/android/library/maply/jni/include/classInfo/LabelsAndMarkers_jni.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/11/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/LayoutSelection_jni.h b/android/library/maply/jni/include/classInfo/LayoutSelection_jni.h index 71435eb207..378458de39 100644 --- a/android/library/maply/jni/include/classInfo/LayoutSelection_jni.h +++ b/android/library/maply/jni/include/classInfo/LayoutSelection_jni.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/13/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Maply_jni.h b/android/library/maply/jni/include/classInfo/Maply_jni.h index a201f17c11..0210fa497d 100644 --- a/android/library/maply/jni/include/classInfo/Maply_jni.h +++ b/android/library/maply/jni/include/classInfo/Maply_jni.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -330,7 +330,7 @@ class JavaHashMapInfo public: // Create a new hash map - jobject makeHashMap(JNIEnv *env) { return env->NewObject(mapClass, mapInitMethodID, 1); } + jobject makeHashMap(JNIEnv *env) const { return env->NewObject(mapClass, mapInitMethodID, 1); } static jobject make(JNIEnv *env) { return getClassInfo(env)->makeHashMap(env); } void teardown(JNIEnv *env) { @@ -432,6 +432,7 @@ struct JavaString operator bool() const { return cStr != nullptr; } const char *getCString() const { return cStr; } + std::string getString() const { return cStr ? cStr : std::string(); } private: const char *cStr; @@ -566,6 +567,11 @@ void ConvertIntArray(JNIEnv *env,jintArray &intArray,std::vector &intVec); void ConvertLongLongArray(JNIEnv *env,jlongArray &longArray,std::vector &longVec); // Convert a Java float array into a std::vector of floats void ConvertFloatArray(JNIEnv *env,jfloatArray &floatArray,std::vector &floatVec); + +/// Convert a Java array of Float (not float) to native floats, using the default for null or invalid entries +void ConvertFloatObjArray(JNIEnv *,jobjectArray,std::vector &, float defVal); +std::vector ConvertFloatObjArray(JNIEnv *, jobjectArray, float defVal); + // Convert a Java double array into a std::vector of doubles void ConvertDoubleArray(JNIEnv *env,jdoubleArray &doubleArray,std::vector &doubleVec); // Convert a Java boolean array into a std::vector of bools @@ -584,6 +590,7 @@ void ConvertLongArrayToSet(JNIEnv *env,const jlongArray &longArray,std::set &intSet); // Convert a Java String object array into a std::vector of std::strings void ConvertStringArray(JNIEnv *env,jobjectArray &objArray,std::vector &strVec); +std::vector ConvertStringArray(JNIEnv *env,jobjectArray &objArray); // Return a Java long array jlongArray BuildLongArray(JNIEnv *env,const std::vector &longVec); diff --git a/android/library/maply/jni/include/classInfo/Particles_jni.h b/android/library/maply/jni/include/classInfo/Particles_jni.h index 34e49ae134..77356caca5 100644 --- a/android/library/maply/jni/include/classInfo/Particles_jni.h +++ b/android/library/maply/jni/include/classInfo/Particles_jni.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/13/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/QuadLoading_jni.h b/android/library/maply/jni/include/classInfo/QuadLoading_jni.h index 378851f211..e0ac2fa7ff 100644 --- a/android/library/maply/jni/include/classInfo/QuadLoading_jni.h +++ b/android/library/maply/jni/include/classInfo/QuadLoading_jni.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/20/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Renderer_jni.h b/android/library/maply/jni/include/classInfo/Renderer_jni.h index dd3a759315..91c998291b 100644 --- a/android/library/maply/jni/include/classInfo/Renderer_jni.h +++ b/android/library/maply/jni/include/classInfo/Renderer_jni.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Scene_jni.h b/android/library/maply/jni/include/classInfo/Scene_jni.h index 0c9444eb92..a354330b09 100644 --- a/android/library/maply/jni/include/classInfo/Scene_jni.h +++ b/android/library/maply/jni/include/classInfo/Scene_jni.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Selection_jni.h b/android/library/maply/jni/include/classInfo/Selection_jni.h index 8c89ec0ee4..68b289ae83 100644 --- a/android/library/maply/jni/include/classInfo/Selection_jni.h +++ b/android/library/maply/jni/include/classInfo/Selection_jni.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Shapes_jni.h b/android/library/maply/jni/include/classInfo/Shapes_jni.h index c0c4f9fc20..a735262fa6 100644 --- a/android/library/maply/jni/include/classInfo/Shapes_jni.h +++ b/android/library/maply/jni/include/classInfo/Shapes_jni.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/15/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Stickers_jni.h b/android/library/maply/jni/include/classInfo/Stickers_jni.h index a933525736..38340887db 100644 --- a/android/library/maply/jni/include/classInfo/Stickers_jni.h +++ b/android/library/maply/jni/include/classInfo/Stickers_jni.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/15/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/Vectors_jni.h b/android/library/maply/jni/include/classInfo/Vectors_jni.h index 2e3bbb1a01..bd3d8a306a 100644 --- a/android/library/maply/jni/include/classInfo/Vectors_jni.h +++ b/android/library/maply/jni/include/classInfo/Vectors_jni.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/classInfo/View_jni.h b/android/library/maply/jni/include/classInfo/View_jni.h index 7e1d617836..a093d47bec 100644 --- a/android/library/maply/jni/include/classInfo/View_jni.h +++ b/android/library/maply/jni/include/classInfo/View_jni.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/include/generated/com_mousebird_maply_VectorObject.h b/android/library/maply/jni/include/generated/com_mousebird_maply_VectorObject.h index 33ce5ff169..20fddedb0a 100644 --- a/android/library/maply/jni/include/generated/com_mousebird_maply_VectorObject.h +++ b/android/library/maply/jni/include/generated/com_mousebird_maply_VectorObject.h @@ -60,7 +60,7 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_setAttributes * Method: addPoint * Signature: (Lcom/mousebird/maply/Point2d;)V */ -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_addPoint +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_addPoint (JNIEnv *, jobject, jobject); /* @@ -68,7 +68,7 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_addPoint * Method: addLinear * Signature: ([Lcom/mousebird/maply/Point2d;)V */ -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_addLinear +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_addLinear (JNIEnv *, jobject, jobjectArray); /* @@ -76,7 +76,7 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_addLinear * Method: addAreal * Signature: ([Lcom/mousebird/maply/Point2d;)V */ -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_addAreal___3Lcom_mousebird_maply_Point2d_2 +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_addAreal___3Lcom_mousebird_maply_Point2d_2 (JNIEnv *, jobject, jobjectArray); /* @@ -84,7 +84,7 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_addAreal___3Lcom_mo * Method: addAreal * Signature: ([Lcom/mousebird/maply/Point2d;[[Lcom/mousebird/maply/Point2d;)V */ -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_addAreal___3Lcom_mousebird_maply_Point2d_2_3_3Lcom_mousebird_maply_Point2d_2 +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_addAreal___3Lcom_mousebird_maply_Point2d_2_3_3Lcom_mousebird_maply_Point2d_2 (JNIEnv *, jobject, jobjectArray, jobjectArray); /* diff --git a/android/library/maply/jni/src/astronomy/Moon_jni.cpp b/android/library/maply/jni/src/astronomy/Moon_jni.cpp index 2c8d6354fa..3f3933af1e 100644 --- a/android/library/maply/jni/src/astronomy/Moon_jni.cpp +++ b/android/library/maply/jni/src/astronomy/Moon_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/astronomy/Sun_jni.cpp b/android/library/maply/jni/src/astronomy/Sun_jni.cpp index 2f931cc5a2..d2586d9e48 100644 --- a/android/library/maply/jni/src/astronomy/Sun_jni.cpp +++ b/android/library/maply/jni/src/astronomy/Sun_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/28/16. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/base/BaseInfo_jni.cpp b/android/library/maply/jni/src/base/BaseInfo_jni.cpp index ded3023681..99f126f0d0 100644 --- a/android/library/maply/jni/src/base/BaseInfo_jni.cpp +++ b/android/library/maply/jni/src/base/BaseInfo_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 11/16/15. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/base/Identifiable_jni.cpp b/android/library/maply/jni/src/base/Identifiable_jni.cpp index 772fceb396..1738bb5d3b 100644 --- a/android/library/maply/jni/src/base/Identifiable_jni.cpp +++ b/android/library/maply/jni/src/base/Identifiable_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/base/VertexAttribute_jni.cpp b/android/library/maply/jni/src/base/VertexAttribute_jni.cpp index b02835f4f4..5299c11640 100644 --- a/android/library/maply/jni/src/base/VertexAttribute_jni.cpp +++ b/android/library/maply/jni/src/base/VertexAttribute_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/17/16. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/billboard/BillboardInfo_jni.cpp b/android/library/maply/jni/src/billboard/BillboardInfo_jni.cpp index 1dcccc8a5c..ae3be09d4d 100644 --- a/android/library/maply/jni/src/billboard/BillboardInfo_jni.cpp +++ b/android/library/maply/jni/src/billboard/BillboardInfo_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/billboard/BillboardManager_jni.cpp b/android/library/maply/jni/src/billboard/BillboardManager_jni.cpp index 043de09868..c69f395283 100644 --- a/android/library/maply/jni/src/billboard/BillboardManager_jni.cpp +++ b/android/library/maply/jni/src/billboard/BillboardManager_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/billboard/Billboard_jni.cpp b/android/library/maply/jni/src/billboard/Billboard_jni.cpp index eecaaf7655..5715c62bb0 100644 --- a/android/library/maply/jni/src/billboard/Billboard_jni.cpp +++ b/android/library/maply/jni/src/billboard/Billboard_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/billboard/ScreenObject_jni.cpp b/android/library/maply/jni/src/billboard/ScreenObject_jni.cpp index 2e32238757..4240d76675 100644 --- a/android/library/maply/jni/src/billboard/ScreenObject_jni.cpp +++ b/android/library/maply/jni/src/billboard/ScreenObject_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/billboard/SimplePoly_jni.cpp b/android/library/maply/jni/src/billboard/SimplePoly_jni.cpp index 4934d1e9fe..6a26a169a3 100644 --- a/android/library/maply/jni/src/billboard/SimplePoly_jni.cpp +++ b/android/library/maply/jni/src/billboard/SimplePoly_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/billboard/StringWrapper_jni.cpp b/android/library/maply/jni/src/billboard/StringWrapper_jni.cpp index 9c266d555c..923103799c 100644 --- a/android/library/maply/jni/src/billboard/StringWrapper_jni.cpp +++ b/android/library/maply/jni/src/billboard/StringWrapper_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/components/ComponentManager_jni.cpp b/android/library/maply/jni/src/components/ComponentManager_jni.cpp index 526a0e6f98..c6b5e61f11 100644 --- a/android/library/maply/jni/src/components/ComponentManager_jni.cpp +++ b/android/library/maply/jni/src/components/ComponentManager_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/19/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,8 +67,8 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_ComponentManager_dispose { (*compManager)->clearJNI(env); delete compManager; + classInfo->clearHandle(env,obj); } - classInfo->clearHandle(env,obj); } MAPLY_STD_JNI_CATCH() } @@ -212,3 +212,22 @@ JNIEXPORT jobjectArray JNICALL Java_com_mousebird_maply_ComponentManager_findVec return nullptr; } +extern "C" +JNIEXPORT void JNICALL Java_com_mousebird_maply_ComponentManager_setRepresentation + (JNIEnv *env, jobject obj, + jstring repNameStr, jstring fallbackStr, + jobjectArray uuidArr, jobject changeSetObj) +{ + try + { + if (const auto compManager = ComponentManagerClassInfo::get(env,obj)) + if (const auto changeSet = ChangeSetClassInfo::get(env,changeSetObj)) + { + const JavaString repName(env, repNameStr); + const JavaString fallbackRepName(env, fallbackStr); + const auto uuids = ConvertStringArray(env, uuidArr); + (*compManager)->setRepresentation(repName.getString(), fallbackRepName.getString(), uuids, **changeSet); + } + } + MAPLY_STD_JNI_CATCH() +} diff --git a/android/library/maply/jni/src/components/ComponentObject_jni.cpp b/android/library/maply/jni/src/components/ComponentObject_jni.cpp index 38cfe26eae..3fe65d12c9 100644 --- a/android/library/maply/jni/src/components/ComponentObject_jni.cpp +++ b/android/library/maply/jni/src/components/ComponentObject_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/19/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/coordSystem/CoordSystemDisplayAdapter_jni.cpp b/android/library/maply/jni/src/coordSystem/CoordSystemDisplayAdapter_jni.cpp index 2a984ada4e..f33abd8aea 100644 --- a/android/library/maply/jni/src/coordSystem/CoordSystemDisplayAdapter_jni.cpp +++ b/android/library/maply/jni/src/coordSystem/CoordSystemDisplayAdapter_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/coordSystem/CoordSystem_jni.cpp b/android/library/maply/jni/src/coordSystem/CoordSystem_jni.cpp index 09bc56f152..2c24fe3107 100644 --- a/android/library/maply/jni/src/coordSystem/CoordSystem_jni.cpp +++ b/android/library/maply/jni/src/coordSystem/CoordSystem_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/coordSystem/FakeGeocentricDisplayAdapter_jni.cpp b/android/library/maply/jni/src/coordSystem/FakeGeocentricDisplayAdapter_jni.cpp index 62b7fdd5b8..810b7644e4 100644 --- a/android/library/maply/jni/src/coordSystem/FakeGeocentricDisplayAdapter_jni.cpp +++ b/android/library/maply/jni/src/coordSystem/FakeGeocentricDisplayAdapter_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/18/15. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/coordSystem/GeneralDisplayAdapter_jni.cpp b/android/library/maply/jni/src/coordSystem/GeneralDisplayAdapter_jni.cpp index fb255d8528..f06fe0462a 100644 --- a/android/library/maply/jni/src/coordSystem/GeneralDisplayAdapter_jni.cpp +++ b/android/library/maply/jni/src/coordSystem/GeneralDisplayAdapter_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/13/16. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/coordSystem/GeoCoordSystem_jni.cpp b/android/library/maply/jni/src/coordSystem/GeoCoordSystem_jni.cpp index 3ba9737e4e..4e465ecd96 100644 --- a/android/library/maply/jni/src/coordSystem/GeoCoordSystem_jni.cpp +++ b/android/library/maply/jni/src/coordSystem/GeoCoordSystem_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/18/15. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/coordSystem/PassThroughCoordSystem_jni.cpp b/android/library/maply/jni/src/coordSystem/PassThroughCoordSystem_jni.cpp index 3d8671faa8..fbcdee7809 100644 --- a/android/library/maply/jni/src/coordSystem/PassThroughCoordSystem_jni.cpp +++ b/android/library/maply/jni/src/coordSystem/PassThroughCoordSystem_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/19/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/coordSystem/PlateCarreeCoordSystem_jni.cpp b/android/library/maply/jni/src/coordSystem/PlateCarreeCoordSystem_jni.cpp index 30c412f42e..f277d89e42 100644 --- a/android/library/maply/jni/src/coordSystem/PlateCarreeCoordSystem_jni.cpp +++ b/android/library/maply/jni/src/coordSystem/PlateCarreeCoordSystem_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/coordSystem/Proj4CoordSystem_jni.cpp b/android/library/maply/jni/src/coordSystem/Proj4CoordSystem_jni.cpp index 2cb6319573..0ab1d76a15 100644 --- a/android/library/maply/jni/src/coordSystem/Proj4CoordSystem_jni.cpp +++ b/android/library/maply/jni/src/coordSystem/Proj4CoordSystem_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/13/16. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/coordSystem/SphericalMercatorCoordSystem_jni.cpp b/android/library/maply/jni/src/coordSystem/SphericalMercatorCoordSystem_jni.cpp index ca1798b22a..5ed93ee484 100644 --- a/android/library/maply/jni/src/coordSystem/SphericalMercatorCoordSystem_jni.cpp +++ b/android/library/maply/jni/src/coordSystem/SphericalMercatorCoordSystem_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/formats/MapboxVectorStyleSet_jni.cpp b/android/library/maply/jni/src/formats/MapboxVectorStyleSet_jni.cpp index 595067ad43..1f700aaf0d 100644 --- a/android/library/maply/jni/src/formats/MapboxVectorStyleSet_jni.cpp +++ b/android/library/maply/jni/src/formats/MapboxVectorStyleSet_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -315,7 +315,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_mousebird_maply_MapboxVectorStyleSet_get extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_MapboxVectorStyleSet_setLayerVisible - (JNIEnv *env, jobject obj, jstring layerNameJava, jboolean visible) + (JNIEnv *env, jobject obj, jstring layerNameJava, jboolean visible) { try { @@ -334,6 +334,48 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_MapboxVectorStyleSet_setLayerVis MAPLY_STD_JNI_CATCH() } +extern "C" +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_MapboxVectorStyleSet_addRepsNative( + JNIEnv *env, jobject obj, jstring uuidAttrStr, + jobjectArray srcArr, jobjectArray repArr, + jobjectArray sizeArr, jobjectArray colorArr) +{ + try + { + if (const auto styleSetRef = MapboxVectorStyleSetClassInfo::get(env,obj)) + { + const JavaString uuidAttr(env, uuidAttrStr); + const auto sources = ConvertStringArray(env, srcArr); + const auto reps = ConvertStringArray(env, repArr); + const auto sizes = ConvertFloatObjArray(env, sizeArr, -1.0f); + const auto colors = ConvertStringArray(env, colorArr); + if (reps.size() == sizes.size() && sizes.size() == colors.size()) + { + PlatformInfo_Android inst(env); + return (*styleSetRef)->addRepresentations(&inst, uuidAttr.getCString(), + sources, reps, sizes, colors); + } + } + } + MAPLY_STD_JNI_CATCH() + return false; +} + +extern "C" +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_MapboxVectorStyleSet_hasRepresentations( + JNIEnv *env, jobject obj) +{ + try + { + if (const auto styleSetRef = MapboxVectorStyleSetClassInfo::get(env,obj)) + { + return (*styleSetRef)->hasRepresentations(); + } + } + MAPLY_STD_JNI_CATCH() + return false; +} + extern "C" JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_MapboxVectorStyleSet_addSpritesNative (JNIEnv *env, jobject obj, jstring assetJSONJava, jlong texID, int width, int height) diff --git a/android/library/maply/jni/src/formats/MapboxVectorTileParser_jni.cpp b/android/library/maply/jni/src/formats/MapboxVectorTileParser_jni.cpp index dd730562db..e23d064a06 100644 --- a/android/library/maply/jni/src/formats/MapboxVectorTileParser_jni.cpp +++ b/android/library/maply/jni/src/formats/MapboxVectorTileParser_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/formats/VectorStyleSettings_jni.cpp b/android/library/maply/jni/src/formats/VectorStyleSettings_jni.cpp index 67700de504..2106c582bb 100644 --- a/android/library/maply/jni/src/formats/VectorStyleSettings_jni.cpp +++ b/android/library/maply/jni/src/formats/VectorStyleSettings_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/formats/VectorStyleWrapper_jni.cpp b/android/library/maply/jni/src/formats/VectorStyleWrapper_jni.cpp index 3c9a2cc57c..80dc7c8990 100644 --- a/android/library/maply/jni/src/formats/VectorStyleWrapper_jni.cpp +++ b/android/library/maply/jni/src/formats/VectorStyleWrapper_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2020 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/formats/VectorTileData_jni.cpp b/android/library/maply/jni/src/formats/VectorTileData_jni.cpp index ece49a47b4..3bce71524b 100644 --- a/android/library/maply/jni/src/formats/VectorTileData_jni.cpp +++ b/android/library/maply/jni/src/formats/VectorTileData_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/geometryManager/GeometryInfo_jni.cpp b/android/library/maply/jni/src/geometryManager/GeometryInfo_jni.cpp index 5fa3012bcc..0162e1e647 100644 --- a/android/library/maply/jni/src/geometryManager/GeometryInfo_jni.cpp +++ b/android/library/maply/jni/src/geometryManager/GeometryInfo_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/geometryManager/GeometryInstance_jni.cpp b/android/library/maply/jni/src/geometryManager/GeometryInstance_jni.cpp index 536d726acf..382099ed81 100644 --- a/android/library/maply/jni/src/geometryManager/GeometryInstance_jni.cpp +++ b/android/library/maply/jni/src/geometryManager/GeometryInstance_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/geometryManager/GeometryManager_jni.cpp b/android/library/maply/jni/src/geometryManager/GeometryManager_jni.cpp index e5a12e4b7a..3e5381c107 100644 --- a/android/library/maply/jni/src/geometryManager/GeometryManager_jni.cpp +++ b/android/library/maply/jni/src/geometryManager/GeometryManager_jni.cpp @@ -1,9 +1,8 @@ -/* - * GeometryManager_jni.cpp +/* GeometryManager_jni.cpp * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "GeometryManager_jni.h" #import "Geometry_jni.h" @@ -26,52 +24,53 @@ using namespace Eigen; using namespace WhirlyKit; using namespace Maply; -template<> GeometryManagerClassInfo *GeometryManagerClassInfo::classInfoObj = NULL; +template<> GeometryManagerClassInfo *GeometryManagerClassInfo::classInfoObj = nullptr; +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_GeometryManager_nativeInit -(JNIEnv *env, jclass cls) + (JNIEnv *env, jclass cls) { GeometryManagerClassInfo::getClassInfo(env, cls); } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_GeometryManager_initialise -(JNIEnv *env, jobject obj, jobject sceneObj) + (JNIEnv *env, jobject obj, jobject sceneObj) { try { - Scene *scene = SceneClassInfo::getClassInfo()->getObject(env, sceneObj); - if (!scene) - return; - GeometryManagerRef geomManager = std::dynamic_pointer_cast(scene->getManager(kWKGeometryManager)); - GeometryManagerClassInfo::getClassInfo()->setHandle(env,obj,new GeometryManagerRef(geomManager)); - } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in GeometryManager::initialise()"); + if (Scene *scene = SceneClassInfo::get(env, sceneObj)) + { + auto geomManager = scene->getManager(kWKGeometryManager); + GeometryManagerClassInfo::getClassInfo()->setHandle(env, obj, new GeometryManagerRef(geomManager)); + } } + MAPLY_STD_JNI_CATCH() } static std::mutex disposeMutex; +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_GeometryManager_dispose -(JNIEnv *env, jobject obj) + (JNIEnv *env, jobject obj) { try { GeometryManagerClassInfo *classInfo = GeometryManagerClassInfo::getClassInfo(); - GeometryManagerRef *geomManager = GeometryManagerClassInfo::getClassInfo()->getObject(env, obj); - if (geomManager) + std::lock_guard guard(disposeMutex); + if (GeometryManagerRef *geomManager = classInfo->getObject(env, obj)) + { delete geomManager; - classInfo->clearHandle(env, obj); - } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in GeometryManager::dispose()"); + classInfo->clearHandle(env, obj); + } } + MAPLY_STD_JNI_CATCH() } +extern "C" JNIEXPORT jlong JNICALL Java_com_mousebird_maply_GeometryManager_addGeometry -(JNIEnv *env, jobject obj, jobjectArray rawGeomArr, jobjectArray modelInstArr, jobject geomInfoObj, jobject changeSetObj) + (JNIEnv *env, jobject obj, jobjectArray rawGeomArr, + jobjectArray modelInstArr, jobject geomInfoObj, jobject changeSetObj) { try { @@ -80,7 +79,7 @@ JNIEXPORT jlong JNICALL Java_com_mousebird_maply_GeometryManager_addGeometry GeometryInfoRef *geomInfo = GeometryInfoClassInfo::getClassInfo()->getObject(env,geomInfoObj); if (!geomManager || !changeSet || !geomInfo) { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "One of the inputs was null in GeometryManager::addGeometry()"); + __android_log_print(ANDROID_LOG_WARN, "Maply", "One of the inputs was null in GeometryManager::addGeometry()"); return EmptyIdentity; } @@ -115,16 +114,13 @@ JNIEXPORT jlong JNICALL Java_com_mousebird_maply_GeometryManager_addGeometry return (*geomManager)->addGeometry(geoms,geomInsts,*(*geomInfo),*(changeSet->get())); } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in GeometryManager::addGeometry()"); - } - + MAPLY_STD_JNI_CATCH() return EmptyIdentity; } +extern "C" JNIEXPORT jlong JNICALL Java_com_mousebird_maply_GeometryManager_addBaseGeometry -(JNIEnv *env, jobject obj, jobjectArray rawGeomArr, jobject changeSetObj) + (JNIEnv *env, jobject obj, jobjectArray rawGeomArr, jobject changeSetObj) { try { @@ -150,16 +146,13 @@ JNIEXPORT jlong JNICALL Java_com_mousebird_maply_GeometryManager_addBaseGeometry GeometryInfo geomInfo; return (*geomManager)->addBaseGeometry(geoms,geomInfo,*(changeSet->get())); } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in GeometryManager::addBaseGeometry()"); - } - + MAPLY_STD_JNI_CATCH() return EmptyIdentity; } +extern "C" JNIEXPORT jlong JNICALL Java_com_mousebird_maply_GeometryManager_addGeometryInstances -(JNIEnv *env, jobject obj, jlong baseGeomID, jobjectArray modelInstArr, jobject geomInfoObj, jobject changeSetObj) + (JNIEnv *env, jobject obj, jlong baseGeomID, jobjectArray modelInstArr, jobject geomInfoObj, jobject changeSetObj) { try { @@ -184,16 +177,13 @@ JNIEXPORT jlong JNICALL Java_com_mousebird_maply_GeometryManager_addGeometryInst return (*geomManager)->addGeometryInstances(baseGeomID,geomInsts,*(*geomInfo),*(changeSet->get())); } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in GeometryManager::addGeometryInstances()"); - } - + MAPLY_STD_JNI_CATCH() return EmptyIdentity; } +extern "C" JNIEXPORT jlong JNICALL Java_com_mousebird_maply_GeometryManager_addGeometryPoints -(JNIEnv *env, jobject obj, jobject pointsObj, jobject matObj, jobject geomInfoObj, jobject changeSetObj) + (JNIEnv *env, jobject obj, jobject pointsObj, jobject matObj, jobject geomInfoObj, jobject changeSetObj) { try { @@ -212,16 +202,13 @@ JNIEXPORT jlong JNICALL Java_com_mousebird_maply_GeometryManager_addGeometryPoin return (*geomManager)->addGeometryPoints(*rawPoints,*mat,*(*geomInfo),*(changeSet->get())); } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in GeometryManager::addGeometryPoints()"); - } - + MAPLY_STD_JNI_CATCH() return EmptyIdentity; } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_GeometryManager_enableGeometry -(JNIEnv *env, jobject obj, jlongArray geomIDs, jboolean enable, jobject changeSetObj) + (JNIEnv *env, jobject obj, jlongArray geomIDs, jboolean enable, jobject changeSetObj) { try { @@ -236,14 +223,12 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_GeometryManager_enableGeometry (*geomManager)->enableGeometry(idSet,enable,*(changeSet->get())); } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in GeometryManager::enableGeometry()"); - } + MAPLY_STD_JNI_CATCH() } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_GeometryManager_removeGeometry -(JNIEnv *env, jobject obj, jlongArray geomIDs, jobject changeSetObj) + (JNIEnv *env, jobject obj, jlongArray geomIDs, jobject changeSetObj) { try { @@ -258,8 +243,5 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_GeometryManager_removeGeometry (*geomManager)->removeGeometry(idSet,*(changeSet->get())); } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in GeometryManager::removeGeometry()"); - } + MAPLY_STD_JNI_CATCH() } diff --git a/android/library/maply/jni/src/geometryManager/GeometryRawPoints_jni.cpp b/android/library/maply/jni/src/geometryManager/GeometryRawPoints_jni.cpp index 15505b84cd..f9f40aa378 100644 --- a/android/library/maply/jni/src/geometryManager/GeometryRawPoints_jni.cpp +++ b/android/library/maply/jni/src/geometryManager/GeometryRawPoints_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/geometryManager/GeometryRaw_jni.cpp b/android/library/maply/jni/src/geometryManager/GeometryRaw_jni.cpp index 33d37436ad..a69a0c2a92 100644 --- a/android/library/maply/jni/src/geometryManager/GeometryRaw_jni.cpp +++ b/android/library/maply/jni/src/geometryManager/GeometryRaw_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/jni_util/Exceptions_jni.cpp b/android/library/maply/jni/src/jni_util/Exceptions_jni.cpp index f0a2e7aef1..fbd3fc7c74 100644 --- a/android/library/maply/jni/src/jni_util/Exceptions_jni.cpp +++ b/android/library/maply/jni/src/jni_util/Exceptions_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Tim Sylvester on 3/8/2021 - * Copyright 2021-2021 mousebird consulting + * Copyright 2021-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/jni_util/Maply_jni.cpp b/android/library/maply/jni/src/jni_util/Maply_jni.cpp index 714242ed8a..e262c86374 100644 --- a/android/library/maply/jni/src/jni_util/Maply_jni.cpp +++ b/android/library/maply/jni/src/jni_util/Maply_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,6 +98,46 @@ void ConvertFloatArray(JNIEnv *env,jfloatArray &floatArray,std::vector &f } } +static jclass clsFloatObj = nullptr; +jmethodID floatValueId = nullptr; + +void ConvertFloatObjArray(JNIEnv *env,jobjectArray objArray,std::vector &vec, float defVal) +{ + if (!clsFloatObj) + { + // Init once. We assume built-in classes are never unloaded. + clsFloatObj = (jclass)env->NewGlobalRef(env->FindClass("java/lang/Float")); + floatValueId = env->GetMethodID(clsFloatObj, "floatValue", "()F"); + } + + const jsize count = env->GetArrayLength(objArray); + vec.reserve(vec.size()); + for (unsigned int ii=0;iiGetObjectArrayElement(objArray,ii)) + { + if (env->IsSameObject(env->GetObjectClass(obj), clsFloatObj)) + { + val = env->CallFloatMethod(obj, floatValueId); + } + else + { + wkLogLevel(Error, "Invalid object passed to ConvertFloatObjArray"); + } + } + vec.emplace_back(val); + } +} + + +std::vector ConvertFloatObjArray(JNIEnv *env, jobjectArray objArray, float defVal) +{ + std::vector arr; + ConvertFloatObjArray(env, objArray, arr, defVal); + return arr; +} + void ConvertDoubleArray(JNIEnv *env,jdoubleArray &doubleArray,std::vector &doubleVec) { if (const int len = env->GetArrayLength(doubleArray)) @@ -129,6 +169,13 @@ void ConvertStringArray(JNIEnv *env,jobjectArray &objArray,std::vector ConvertStringArray(JNIEnv *env,jobjectArray &objArray) +{ + std::vector arr; + ConvertStringArray(env, objArray, arr); + return arr; +} + void ConvertFloat2fArray(JNIEnv *env,jfloatArray &floatArray,Point2fVector &ptVec) { if (const int len = env->GetArrayLength(floatArray) / 2) diff --git a/android/library/maply/jni/src/labelsMarkers/InternalLabel_jni.cpp b/android/library/maply/jni/src/labelsMarkers/InternalLabel_jni.cpp index ccc1601b24..a3ecfe7f6b 100644 --- a/android/library/maply/jni/src/labelsMarkers/InternalLabel_jni.cpp +++ b/android/library/maply/jni/src/labelsMarkers/InternalLabel_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,29 +26,28 @@ typedef JavaClassInfo LabelClassInfo; template<> LabelClassInfo *LabelClassInfo::classInfoObj = nullptr; extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_nativeInit(JNIEnv *env, jclass cls) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_nativeInit + (JNIEnv *env, jclass cls) { LabelClassInfo::getClassInfo(env,cls); } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_initialise(JNIEnv *env, jobject obj) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_initialise + (JNIEnv *env, jobject obj) { try { - SingleLabelAndroid *label = new SingleLabelAndroid(); - LabelClassInfo::getClassInfo()->setHandle(env,obj,label); - } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::initialise()"); + LabelClassInfo::set(env,obj,new SingleLabelAndroid()); } + MAPLY_STD_JNI_CATCH() } static std::mutex disposeMutex; extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_dispose(JNIEnv *env, jobject obj) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_dispose + (JNIEnv *env, jobject obj) { try { @@ -60,14 +59,12 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_dispose(JNIEnv *en classInfo->clearHandle(env, obj); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::dispose()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setSelectID(JNIEnv *env, jobject obj, jlong newID) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setSelectID + (JNIEnv *env, jobject obj, jlong newID) { try { @@ -76,14 +73,12 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setSelectID(JNIEnv label->selectID = newID; } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::setSelectID()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLoc(JNIEnv *env, jobject obj, jobject ptObj) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLoc + (JNIEnv *env, jobject obj, jobject ptObj) { try { @@ -96,14 +91,12 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLoc(JNIEnv *env } } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::setLoc()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setEndLoc(JNIEnv *env, jobject obj, jobject ptObj) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setEndLoc + (JNIEnv *env, jobject obj, jobject ptObj) { try { @@ -116,14 +109,12 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setEndLoc(JNIEnv * } } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::setEndLoc()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setAnimationRange(JNIEnv *env, jobject obj, jdouble startTime, jdouble endTime) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setAnimationRange + (JNIEnv *env, jobject obj, jdouble startTime, jdouble endTime) { try { @@ -131,16 +122,15 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setAnimationRange( { label->startTime = startTime; label->endTime = endTime; + label->hasMotion = (endTime > startTime); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::setAnimationRange()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setRotation(JNIEnv *env, jobject obj, jdouble rot) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setRotation + (JNIEnv *env, jobject obj, jdouble rot) { try { @@ -149,14 +139,12 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setRotation(JNIEnv label->rotation = rot; } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::setRotation()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLockRotation(JNIEnv *env, jobject obj, jboolean lockRotation) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLockRotation + (JNIEnv *env, jobject obj, jboolean lockRotation) { try { @@ -165,14 +153,12 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLockRotation(JN label->keepUpright = !lockRotation; } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::setLockRotation()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_addText(JNIEnv *env, jobject obj, jintArray textArray, jint len) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_addText + (JNIEnv *env, jobject obj, jintArray textArray, jint len) { try { @@ -188,14 +174,12 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_addText(JNIEnv *en label->codePointsLines.push_back(codePoints); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::addText()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setOffset(JNIEnv *env, jobject obj, jobject ptObj) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setOffset + (JNIEnv *env, jobject obj, jobject ptObj) { try { @@ -208,14 +192,12 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setOffset(JNIEnv * } } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::setOffset()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLayoutPlacement(JNIEnv *env, jobject obj, jint layoutPlacement) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLayoutPlacement + (JNIEnv *env, jobject obj, jint layoutPlacement) { try { @@ -224,14 +206,12 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLayoutPlacement label->layoutPlacement = layoutPlacement; } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::setLayoutPlacement()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLayoutImportance(JNIEnv *env, jobject obj, jfloat layoutImportance) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLayoutImportance + (JNIEnv *env, jobject obj, jfloat layoutImportance) { try { @@ -244,14 +224,12 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLayoutImportanc } } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::setLayoutImportance()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLayoutSize(JNIEnv *env, jobject obj, jdouble sizeX, jdouble sizeY) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLayoutSize + (JNIEnv *env, jobject obj, jdouble sizeX, jdouble sizeY) { try { @@ -260,14 +238,12 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setLayoutSize(JNIE label->layoutSize = Point2d(sizeX,sizeY); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::setLayoutSize()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setUniqueID(JNIEnv *env, jobject obj, jstring uniqueStr) +JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setUniqueID + (JNIEnv *env, jobject obj, jstring uniqueStr) { try { @@ -277,8 +253,5 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_InternalLabel_setUniqueID(JNIEnv label->uniqueID = jStr.getCString(); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in InternalLabel::setUniqueID()"); - } + MAPLY_STD_JNI_CATCH() } diff --git a/android/library/maply/jni/src/labelsMarkers/InternalMarker_jni.cpp b/android/library/maply/jni/src/labelsMarkers/InternalMarker_jni.cpp index aea3a66726..5c5ee19e66 100644 --- a/android/library/maply/jni/src/labelsMarkers/InternalMarker_jni.cpp +++ b/android/library/maply/jni/src/labelsMarkers/InternalMarker_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/labelsMarkers/LabelInfo_jni.cpp b/android/library/maply/jni/src/labelsMarkers/LabelInfo_jni.cpp index 116d7d876e..5066db53f4 100644 --- a/android/library/maply/jni/src/labelsMarkers/LabelInfo_jni.cpp +++ b/android/library/maply/jni/src/labelsMarkers/LabelInfo_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/labelsMarkers/LabelManager_jni.cpp b/android/library/maply/jni/src/labelsMarkers/LabelManager_jni.cpp index d09fb1cfb4..1adedc7316 100644 --- a/android/library/maply/jni/src/labelsMarkers/LabelManager_jni.cpp +++ b/android/library/maply/jni/src/labelsMarkers/LabelManager_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/labelsMarkers/MarkerInfo_jni.cpp b/android/library/maply/jni/src/labelsMarkers/MarkerInfo_jni.cpp index b4c5233d02..67e4228cd4 100644 --- a/android/library/maply/jni/src/labelsMarkers/MarkerInfo_jni.cpp +++ b/android/library/maply/jni/src/labelsMarkers/MarkerInfo_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/labelsMarkers/MarkerManager_jni.cpp b/android/library/maply/jni/src/labelsMarkers/MarkerManager_jni.cpp index 0907125da0..dc47d3b397 100644 --- a/android/library/maply/jni/src/labelsMarkers/MarkerManager_jni.cpp +++ b/android/library/maply/jni/src/labelsMarkers/MarkerManager_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/layoutSelection/LayoutManager_jni.cpp b/android/library/maply/jni/src/layoutSelection/LayoutManager_jni.cpp index 7ee115975b..8b6faa1438 100644 --- a/android/library/maply/jni/src/layoutSelection/LayoutManager_jni.cpp +++ b/android/library/maply/jni/src/layoutSelection/LayoutManager_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/layoutSelection/SelectedObject_jni.cpp b/android/library/maply/jni/src/layoutSelection/SelectedObject_jni.cpp index b3ccf46e93..9904a44d34 100644 --- a/android/library/maply/jni/src/layoutSelection/SelectedObject_jni.cpp +++ b/android/library/maply/jni/src/layoutSelection/SelectedObject_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/17/16. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/layoutSelection/SelectionManager_jni.cpp b/android/library/maply/jni/src/layoutSelection/SelectionManager_jni.cpp index 0b4d3fea5b..d5e6fc5f07 100644 --- a/android/library/maply/jni/src/layoutSelection/SelectionManager_jni.cpp +++ b/android/library/maply/jni/src/layoutSelection/SelectionManager_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/math/AngleAxis_jni.cpp b/android/library/maply/jni/src/math/AngleAxis_jni.cpp index fdee101a68..1491dcccbd 100644 --- a/android/library/maply/jni/src/math/AngleAxis_jni.cpp +++ b/android/library/maply/jni/src/math/AngleAxis_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/20/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/math/Matrix3d_jni.cpp b/android/library/maply/jni/src/math/Matrix3d_jni.cpp index 6418178506..a42a2e8f44 100644 --- a/android/library/maply/jni/src/math/Matrix3d_jni.cpp +++ b/android/library/maply/jni/src/math/Matrix3d_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/math/Matrix4d_jni.cpp b/android/library/maply/jni/src/math/Matrix4d_jni.cpp index ea13d5f9c5..edfd775871 100644 --- a/android/library/maply/jni/src/math/Matrix4d_jni.cpp +++ b/android/library/maply/jni/src/math/Matrix4d_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/math/Point2d_jni.cpp b/android/library/maply/jni/src/math/Point2d_jni.cpp index 6bdd4daae8..7aa1dfef2e 100644 --- a/android/library/maply/jni/src/math/Point2d_jni.cpp +++ b/android/library/maply/jni/src/math/Point2d_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/math/Point3d_jni.cpp b/android/library/maply/jni/src/math/Point3d_jni.cpp index 30b4150c76..ee51e9eaa6 100644 --- a/android/library/maply/jni/src/math/Point3d_jni.cpp +++ b/android/library/maply/jni/src/math/Point3d_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/math/Point4d_jni.cpp b/android/library/maply/jni/src/math/Point4d_jni.cpp index cb3fa5c1fa..f1fdf7e12a 100644 --- a/android/library/maply/jni/src/math/Point4d_jni.cpp +++ b/android/library/maply/jni/src/math/Point4d_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/21/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/math/Quaternion_jni.cpp b/android/library/maply/jni/src/math/Quaternion_jni.cpp index 787bf720cb..cde7a487ae 100644 --- a/android/library/maply/jni/src/math/Quaternion_jni.cpp +++ b/android/library/maply/jni/src/math/Quaternion_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/18/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/particles/ParticleBatch_jni.cpp b/android/library/maply/jni/src/particles/ParticleBatch_jni.cpp index bf0df051c1..e3aa3a60b0 100644 --- a/android/library/maply/jni/src/particles/ParticleBatch_jni.cpp +++ b/android/library/maply/jni/src/particles/ParticleBatch_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 23/1/16. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/particles/ParticleSystemManager_jni.cpp b/android/library/maply/jni/src/particles/ParticleSystemManager_jni.cpp index 673d47a23f..fda719d4a4 100644 --- a/android/library/maply/jni/src/particles/ParticleSystemManager_jni.cpp +++ b/android/library/maply/jni/src/particles/ParticleSystemManager_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 23/1/16. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/particles/ParticleSystem_jni.cpp b/android/library/maply/jni/src/particles/ParticleSystem_jni.cpp index f58490cb96..b19a7955ef 100644 --- a/android/library/maply/jni/src/particles/ParticleSystem_jni.cpp +++ b/android/library/maply/jni/src/particles/ParticleSystem_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 23/1/16. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/quadLoading/ImageLoaderReturn_jni.cpp b/android/library/maply/jni/src/quadLoading/ImageLoaderReturn_jni.cpp index 0b1f672363..434bfb390d 100644 --- a/android/library/maply/jni/src/quadLoading/ImageLoaderReturn_jni.cpp +++ b/android/library/maply/jni/src/quadLoading/ImageLoaderReturn_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg on 3/20/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/quadLoading/ImageTile_jni.cpp b/android/library/maply/jni/src/quadLoading/ImageTile_jni.cpp index 28a4de499b..58ced56cac 100644 --- a/android/library/maply/jni/src/quadLoading/ImageTile_jni.cpp +++ b/android/library/maply/jni/src/quadLoading/ImageTile_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg on 3/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/quadLoading/LoaderReturn_jni.cpp b/android/library/maply/jni/src/quadLoading/LoaderReturn_jni.cpp index 338016be25..6d8a1e7855 100644 --- a/android/library/maply/jni/src/quadLoading/LoaderReturn_jni.cpp +++ b/android/library/maply/jni/src/quadLoading/LoaderReturn_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg on 3/20/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/quadLoading/ObjectLoaderReturn_jni.cpp b/android/library/maply/jni/src/quadLoading/ObjectLoaderReturn_jni.cpp index 751cf77dfc..ca3f3cf3e4 100644 --- a/android/library/maply/jni/src/quadLoading/ObjectLoaderReturn_jni.cpp +++ b/android/library/maply/jni/src/quadLoading/ObjectLoaderReturn_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg on 3/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/quadLoading/QIFBatchOps_jni.cpp b/android/library/maply/jni/src/quadLoading/QIFBatchOps_jni.cpp index a540fddab4..5682ffe85f 100644 --- a/android/library/maply/jni/src/quadLoading/QIFBatchOps_jni.cpp +++ b/android/library/maply/jni/src/quadLoading/QIFBatchOps_jni.cpp @@ -1,9 +1,8 @@ -/* - * QIFBatchOps_jni.cpp +/* QIFBatchOps_jni.cpp * WhirlyGlobeLib * * Created by sjg on 3/25/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,58 +14,103 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "QuadLoading_jni.h" #import "com_mousebird_maply_QIFBatchOps.h" +#import "WhirlyKitLog.h" using namespace WhirlyKit; -template<> QIFBatchOpsClassInfo *QIFBatchOpsClassInfo::classInfoObj = NULL; +template<> QIFBatchOpsClassInfo *QIFBatchOpsClassInfo::classInfoObj = nullptr; + +static jclass tileIDRef = nullptr; +static jmethodID tileIDCtor = nullptr; +static jclass initBatchOps(JNIEnv *env) +{ + if (tileIDRef) + { + if (jclass tileIDClass = (jclass)env->NewLocalRef(tileIDRef)) + { + return tileIDClass; + } + } + if (jclass tileIDClass = env->FindClass("com/mousebird/maply/TileID")) + { + tileIDRef = (jclass)env->NewWeakGlobalRef(tileIDClass); + tileIDCtor = env->GetMethodID(tileIDClass,"","(III)V"); + return tileIDClass; + } + return nullptr; +} +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_QIFBatchOps_nativeInit (JNIEnv *env, jclass cls) { QIFBatchOpsClassInfo::getClassInfo(env, cls); } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_QIFBatchOps_initialise (JNIEnv *env, jobject obj) { - try { + try + { QIFBatchOpsClassInfo *info = QIFBatchOpsClassInfo::getClassInfo(); PlatformInfo_Android platformInfo(env); - QIFBatchOps_Android *batchOps = new QIFBatchOps_Android(&platformInfo); + auto *batchOps = new QIFBatchOps_Android(&platformInfo); batchOps->batchOpsObj = obj; info->setHandle(env, obj, batchOps); - } catch (...) { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in QIFBatchOps::initialise()"); } + MAPLY_STD_JNI_CATCH() } static std::mutex disposeMutex; +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_QIFBatchOps_dispose (JNIEnv *env,jobject obj) { - try { + try + { QIFBatchOpsClassInfo *info = QIFBatchOpsClassInfo::getClassInfo(); + + std::lock_guard lock(disposeMutex); + //QIFBatchOps_Android *batchOps = info->getObject(env,obj); + // We don't actually delete the batch ops here. They're deleted the in the same method they're created + //delete batchOps; + + info->clearHandle(env, obj); + } + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jobjectArray JNICALL Java_com_mousebird_maply_QIFBatchOps_getDeletes + (JNIEnv *env, jobject obj) +{ + try + { + if (jclass tileIDCls = initBatchOps(env)) + if (auto batchOps = QIFBatchOpsClassInfo::get(env, obj)) { - std::lock_guard lock(disposeMutex); - //QIFBatchOps_Android *batchOps = info->getObject(env,obj); - // We don't actually delete the batch ops here. They're deleted the in the same method they're created -// if (!batchOps) -// return; -// delete batchOps; + std::vector objs; + objs.reserve(batchOps->deletes.size()); - info->clearHandle(env, obj); + for (const auto &item : batchOps->deletes) + { + if (jobject id = env->NewObject(tileIDCls, tileIDCtor, item.x, item.y, item.level)) + { + objs.push_back(id); + } + } + return BuildObjectArray(env,tileIDCls,objs); } - - } catch (...) { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in QIFBatchOps::dispose()"); } + MAPLY_STD_JNI_CATCH() + return nullptr; } jobject MakeQIFBatchOps(JNIEnv *env,QIFBatchOps_Android *batchOps) diff --git a/android/library/maply/jni/src/quadLoading/QIFFrameAsset_jni.cpp b/android/library/maply/jni/src/quadLoading/QIFFrameAsset_jni.cpp index 630aefbeb7..a76eda6fb7 100644 --- a/android/library/maply/jni/src/quadLoading/QIFFrameAsset_jni.cpp +++ b/android/library/maply/jni/src/quadLoading/QIFFrameAsset_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg on 3/29/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/quadLoading/QuadImageFrameLoader_jni.cpp b/android/library/maply/jni/src/quadLoading/QuadImageFrameLoader_jni.cpp index ba5fe33a79..0df90d0726 100644 --- a/android/library/maply/jni/src/quadLoading/QuadImageFrameLoader_jni.cpp +++ b/android/library/maply/jni/src/quadLoading/QuadImageFrameLoader_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/8/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/quadLoading/QuadImageLoaderBase_jni.cpp b/android/library/maply/jni/src/quadLoading/QuadImageLoaderBase_jni.cpp index 239aa7e4dd..c75031a959 100644 --- a/android/library/maply/jni/src/quadLoading/QuadImageLoaderBase_jni.cpp +++ b/android/library/maply/jni/src/quadLoading/QuadImageLoaderBase_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg on 3/25/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/quadLoading/QuadLoaderBase_jni.cpp b/android/library/maply/jni/src/quadLoading/QuadLoaderBase_jni.cpp index 6815eb622b..ba1f501788 100644 --- a/android/library/maply/jni/src/quadLoading/QuadLoaderBase_jni.cpp +++ b/android/library/maply/jni/src/quadLoading/QuadLoaderBase_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg on 3/25/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/quadLoading/QuadSamplingLayer_jni.cpp b/android/library/maply/jni/src/quadLoading/QuadSamplingLayer_jni.cpp index 8ee394da19..90c4751195 100644 --- a/android/library/maply/jni/src/quadLoading/QuadSamplingLayer_jni.cpp +++ b/android/library/maply/jni/src/quadLoading/QuadSamplingLayer_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg on 3/28/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/quadLoading/RawPNGImageLoaderInterpreter_jni.cpp b/android/library/maply/jni/src/quadLoading/RawPNGImageLoaderInterpreter_jni.cpp index 87bd71c9e2..83a21465cf 100644 --- a/android/library/maply/jni/src/quadLoading/RawPNGImageLoaderInterpreter_jni.cpp +++ b/android/library/maply/jni/src/quadLoading/RawPNGImageLoaderInterpreter_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg on 3/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/quadLoading/SamplingParams_jni.cpp b/android/library/maply/jni/src/quadLoading/SamplingParams_jni.cpp index 49adee8db3..f4e10f5c2d 100644 --- a/android/library/maply/jni/src/quadLoading/SamplingParams_jni.cpp +++ b/android/library/maply/jni/src/quadLoading/SamplingParams_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg on 3/20/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/renderer/RenderController_jni.cpp b/android/library/maply/jni/src/renderer/RenderController_jni.cpp index cfccccacd4..e22ff42c85 100644 --- a/android/library/maply/jni/src/renderer/RenderController_jni.cpp +++ b/android/library/maply/jni/src/renderer/RenderController_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -170,12 +170,20 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_RenderController_setScene(JNIEnv { try { - SceneRendererGLES_Android *renderer = SceneRendererInfo::getClassInfo()->getObject(env,obj); - Scene *scene = SceneClassInfo::getClassInfo()->getObject(env,sceneObj); - if (!renderer || !scene) - return; - - renderer->setScene(scene); + if (SceneRendererGLES_Android *renderer = SceneRendererInfo::getClassInfo()->getObject(env,obj)) + { + if (sceneObj) + { + if (Scene *scene = SceneClassInfo::getClassInfo()->getObject(env, sceneObj)) + { + renderer->setScene(scene); + } + } + else + { + renderer->setScene(nullptr); + } + } } catch (...) { diff --git a/android/library/maply/jni/src/scene/ChangeSet_jni.cpp b/android/library/maply/jni/src/scene/ChangeSet_jni.cpp index 6d41124044..bccdc0b259 100644 --- a/android/library/maply/jni/src/scene/ChangeSet_jni.cpp +++ b/android/library/maply/jni/src/scene/ChangeSet_jni.cpp @@ -1,9 +1,8 @@ -/* - * ChangeSet_jni.cpp +/* ChangeSet_jni.cpp * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import @@ -25,8 +23,9 @@ using namespace WhirlyKit; -template<> ChangeSetClassInfo *ChangeSetClassInfo::classInfoObj = NULL; +template<> ChangeSetClassInfo *ChangeSetClassInfo::classInfoObj = nullptr; +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_ChangeSet_nativeInit (JNIEnv *env, jclass cls) { @@ -36,100 +35,98 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_ChangeSet_nativeInit JNIEXPORT jobject JNICALL MakeChangeSet(JNIEnv *env,const ChangeSet &changeSet) { ChangeSetClassInfo *classInfo = ChangeSetClassInfo::getClassInfo(env,"com/mousebird/maply/ChangeSet"); - jobject newObj = classInfo->makeWrapperObject(env,NULL); + jobject newObj = classInfo->makeWrapperObject(env,nullptr); WhirlyKit::ChangeSetRef *inst = classInfo->getObject(env,newObj); (*inst)->insert((*inst)->end(),changeSet.begin(),changeSet.end()); - return newObj; } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_ChangeSet_initialise (JNIEnv *env, jobject obj) { try { - ChangeSetRef *changeSet = new ChangeSetRef(new ChangeSet()); - ChangeSetClassInfo::getClassInfo()->setHandle(env,obj,changeSet); - } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in ChangeSet::initialise()"); + ChangeSetClassInfo::set(env, obj, new ChangeSetRef(std::make_shared())); } + MAPLY_STD_JNI_CATCH() } static std::mutex disposeMutex; +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_ChangeSet_dispose (JNIEnv *env, jobject obj) { try { ChangeSetClassInfo *classInfo = ChangeSetClassInfo::getClassInfo(); - { - std::lock_guard lock(disposeMutex); - ChangeSetRef *changeSet = classInfo->getObject(env,obj); - if (!changeSet) - return; - - // Be sure to delete the contents - for (unsigned int ii = 0;ii<(*changeSet)->size();ii++) - delete (*changeSet)->at(ii); - - delete changeSet; - - classInfo->clearHandle(env,obj); - } - } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in ChangeSet::dispose()"); + std::lock_guard lock(disposeMutex); + if (const auto changeSet = classInfo->getObject(env,obj)) + { + // Be sure to delete the contents + for (auto &change : **changeSet) + { + delete change; + change = nullptr; + } + delete changeSet; + } + classInfo->clearHandle(env,obj); } + MAPLY_STD_JNI_CATCH() } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_ChangeSet_merge (JNIEnv *env, jobject obj, jobject otherObj) { try { ChangeSetClassInfo *classInfo = ChangeSetClassInfo::getClassInfo(); - ChangeSetRef *changeSet = classInfo->getObject(env,obj); - ChangeSetRef *otherChangeSet = classInfo->getObject(env,otherObj); - if (!changeSet || !otherChangeSet) - return; - (*changeSet)->insert((*changeSet)->end(),(*otherChangeSet)->begin(),(*otherChangeSet)->end()); - (*otherChangeSet)->clear(); - } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in ChangeSet::merge()"); + if (const auto changeSet = classInfo->getObject(env,obj)) + if (const auto otherSet = classInfo->getObject(env,otherObj)) + if (!(*otherSet)->empty()) + { + (*changeSet)->reserve((*changeSet)->size() + (*otherSet)->size()); + (*changeSet)->insert((*changeSet)->end(),(*otherSet)->begin(),(*otherSet)->end()); + (*otherSet)->clear(); + } } + MAPLY_STD_JNI_CATCH() } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_ChangeSet_process (JNIEnv *env, jobject obj, jobject renderControlObj, jobject sceneObj) { try { - ChangeSetRef *changes = ChangeSetClassInfo::getClassInfo()->getObject(env,obj); - SceneRendererGLES_Android *sceneRender = SceneRendererInfo::getClassInfo()->getObject(env,renderControlObj); - Scene *scene = SceneClassInfo::getClassInfo()->getObject(env,sceneObj); + ChangeSetRef *changes = ChangeSetClassInfo::get(env,obj); + SceneRendererGLES_Android *sceneRender = SceneRendererInfo::get(env,renderControlObj); + Scene *scene = SceneClassInfo::get(env,sceneObj); if (!changes || !sceneRender || !scene) + { return; + } bool requiresFlush = false; // Set up anything that needs to be set up ChangeSet changesToAdd; - for (unsigned int ii = 0;ii<(*changes)->size();ii++) + changesToAdd.reserve((*changes)->size()); + for (auto change : **changes) { - ChangeRequest *change = (*changes)->at(ii); if (change) { requiresFlush |= change->needsFlush(); change->setupForRenderer(sceneRender->getRenderSetupInfo(),scene); changesToAdd.push_back(change); - } else - // A NULL change request is just a flush request + } + else + { + // A NULL change request is a flush request requiresFlush = true; + } } // If anything needed a flush after that, let's do it @@ -138,81 +135,82 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_ChangeSet_process glFlush(); } -// __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Processed %d changes",changesToAdd.size()); - scene->addChangeRequests(changesToAdd); (*changes)->clear(); } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in ChangeSet::process()"); - } + MAPLY_STD_JNI_CATCH() + } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_ChangeSet_addTexture (JNIEnv *env, jobject obj, jobject texObj, jobject sceneObj, jint filterType) { try { - ChangeSetClassInfo *classInfo = ChangeSetClassInfo::getClassInfo(); - ChangeSetRef *changeSet = classInfo->getObject(env,obj); - Texture *texture = TextureClassInfo::getClassInfo()->getObject(env,texObj); - Scene *scene = SceneClassInfo::getClassInfo()->getObject(env,sceneObj); + ChangeSetRef *changeSet = ChangeSetClassInfo::get(env,obj); + Texture *texture = TextureClassInfo::get(env,texObj); + Scene *scene = SceneClassInfo::get(env,sceneObj); if (!changeSet || !texture || !scene) + { return; + } // We take control of the Texture * as soon as it goes into the change set TextureClassInfo::getClassInfo()->clearHandle(env,texObj); switch (filterType) { - case 0: - texture->setInterpType(TexInterpNearest); - break; - default: - case 1: - texture->setInterpType(TexInterpLinear); - break; + case 0: texture->setInterpType(TexInterpNearest); break; + default: + case 1: texture->setInterpType(TexInterpLinear); break; } (*changeSet)->push_back(new AddTextureReq(texture)); } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in ChangeSet::addTexture()"); - } + MAPLY_STD_JNI_CATCH() + } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_ChangeSet_removeTexture (JNIEnv *env, jobject obj, jlong texID) { try { - ChangeSetRef *changeSet = ChangeSetClassInfo::getClassInfo()->getObject(env,obj); - if (!changeSet) - return; - - (*changeSet)->push_back(new RemTextureReq(texID)); - } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in ChangeSet::removeTexture()"); + if (const auto changeSet = ChangeSetClassInfo::get(env,obj)) + { + (*changeSet)->push_back(new RemTextureReq(texID)); + } } + MAPLY_STD_JNI_CATCH() + } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_ChangeSet_clearRenderTarget (JNIEnv *env, jobject obj, jlong renderTargetID) { try { - ChangeSetRef *changeSet = ChangeSetClassInfo::getClassInfo()->getObject(env,obj); - if (!changeSet) - return; - - (*changeSet)->push_back(new ClearRenderTargetReq(renderTargetID)); + if (const auto changeSet = ChangeSetClassInfo::get(env,obj)) + { + (*changeSet)->push_back(new ClearRenderTargetReq(renderTargetID)); + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jint JNICALL Java_com_mousebird_maply_ChangeSet_count + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in ChangeSet::removeTexture()"); + if (const auto changeSet = ChangeSetClassInfo::get(env,obj)) + { + return (jint)(*changeSet)->size(); + } } - + MAPLY_STD_JNI_CATCH() + return 0; } diff --git a/android/library/maply/jni/src/scene/DirectionalLight_jni.cpp b/android/library/maply/jni/src/scene/DirectionalLight_jni.cpp index c17b35fef0..0719a31262 100644 --- a/android/library/maply/jni/src/scene/DirectionalLight_jni.cpp +++ b/android/library/maply/jni/src/scene/DirectionalLight_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/scene/Material_jni.cpp b/android/library/maply/jni/src/scene/Material_jni.cpp index 866b880f19..3b806e37e5 100644 --- a/android/library/maply/jni/src/scene/Material_jni.cpp +++ b/android/library/maply/jni/src/scene/Material_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/scene/Scene_jni.cpp b/android/library/maply/jni/src/scene/Scene_jni.cpp index 7bb6fc5e94..bd8e107ac0 100644 --- a/android/library/maply/jni/src/scene/Scene_jni.cpp +++ b/android/library/maply/jni/src/scene/Scene_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/17/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,21 +33,23 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_Scene_nativeInit(JNIEnv *env, jc extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_Scene_initialise - (JNIEnv *env, jobject obj, jobject coordAdapterObj, jobject renderControlObj, jobject charRendererObj) + (JNIEnv *env, jobject obj, jobject coordAdapterObj, + jobject renderControlObj, jobject charRendererObj) { try { - CoordSystemDisplayAdapter *coordAdapter = CoordSystemDisplayAdapterInfo::getClassInfo()->getObject(env,coordAdapterObj); - SceneGLES *scene = new SceneGLES(coordAdapter); - SceneRendererGLES_Android *sceneRender = SceneRendererInfo::getClassInfo()->getObject(env,renderControlObj); + CoordSystemDisplayAdapter *coordAdapter = CoordSystemDisplayAdapterInfo::get(env,coordAdapterObj); + SceneRendererGLES_Android *sceneRender = SceneRendererInfo::get(env,renderControlObj); + + auto scene = std::make_unique(coordAdapter); + PlatformInfo_Android inst(env); - scene->setFontTextureManager(std::make_shared(&inst,sceneRender,scene,charRendererObj)); - SceneClassInfo::getClassInfo()->setHandle(env,obj,scene); - } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in GlobeScene::initialise()"); + auto mgr = std::make_shared(&inst,sceneRender,scene.get(),charRendererObj); + scene->setFontTextureManager(std::move(mgr)); + + SceneClassInfo::set(env,obj,scene.release()); } + MAPLY_STD_JNI_CATCH() } static std::mutex disposeMutex; @@ -59,16 +61,23 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_Scene_dispose(JNIEnv *env, jobje { SceneClassInfo *classInfo = SceneClassInfo::getClassInfo(); std::lock_guard lock(disposeMutex); - if (Scene *inst = classInfo->getObject(env,obj)) + if (Scene *scene = classInfo->getObject(env, obj)) { - delete inst; + // This should already have been done, but this is our last chance to do anything with + // a JNI environment, so do it again just in case. + if (scene->getRenderer()) + { + wkLogLevel(Warn, "Scene disposed without teardown"); + } + + PlatformInfo_Android inst(env); + scene->teardown(&inst); + + delete scene; classInfo->clearHandle(env,obj); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in Scene::dispose()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" @@ -86,10 +95,7 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_Scene_addChangesNative(JNIEnv *e } } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in Scene::addChanges()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" @@ -97,20 +103,13 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_Scene_addShaderProgram(JNIEnv *e { try { - SceneClassInfo *classInfo = SceneClassInfo::getClassInfo(); - Scene *scene = classInfo->getObject(env,obj); - ShaderClassInfo *shaderClassInfo = ShaderClassInfo::getClassInfo(); - Shader_AndroidRef *shader = shaderClassInfo->getObject(env,shaderObj); - - if (scene && shader) + if (Scene *scene = SceneClassInfo::get(env,obj)) + if (Shader_AndroidRef *shader = ShaderClassInfo::get(env,shaderObj)) { scene->addProgram((*shader)->prog); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in Scene::addShaderProgram()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" @@ -118,16 +117,12 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_Scene_removeShaderProgram(JNIEnv { try { - SceneClassInfo *classInfo = SceneClassInfo::getClassInfo(); - if (Scene *scene = classInfo->getObject(env,obj)) + if (Scene *scene = SceneClassInfo::get(env,obj)) { - scene->removeProgram(shaderID,NULL); + scene->removeProgram(shaderID, nullptr); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in Scene::removeShaderProgram()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" @@ -135,17 +130,13 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_Scene_teardownGL(JNIEnv *env, jo { try { - SceneClassInfo *classInfo = SceneClassInfo::getClassInfo(); - if (Scene *scene = classInfo->getObject(env,obj)) + if (Scene *scene = SceneClassInfo::get(env,obj)) { PlatformInfo_Android platformInfo(env); scene->teardown(&platformInfo); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in Scene::teardownGL()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" @@ -155,8 +146,7 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_Scene_addRenderTargetNative { try { - SceneClassInfo *classInfo = SceneClassInfo::getClassInfo(); - if (Scene *scene = classInfo->getObject(env,obj)) + if (Scene *scene = SceneClassInfo::get(env,obj)) { ChangeSet changes; const RGBAColor color(r * 255.0, g * 255.0, b * 255.0, a * 255.0); @@ -167,10 +157,7 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_Scene_addRenderTargetNative scene->addChangeRequests(changes); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in Scene::addRenderTargetNative()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" @@ -178,18 +165,13 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_Scene_changeRenderTarget(JNIEnv { try { - SceneClassInfo *classInfo = SceneClassInfo::getClassInfo(); - if (Scene *scene = classInfo->getObject(env,obj)) + if (Scene *scene = SceneClassInfo::get(env,obj)) { - ChangeSet changes; - changes.push_back(new ChangeRenderTargetReq(renderTargetID, texID)); + ChangeSet changes = { new ChangeRenderTargetReq(renderTargetID, texID) }; scene->addChangeRequests(changes); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in Scene::changeRenderTarget()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" @@ -197,18 +179,13 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_Scene_removeRenderTargetNative(J { try { - SceneClassInfo *classInfo = SceneClassInfo::getClassInfo(); - if (Scene *scene = classInfo->getObject(env,obj)) + if (Scene *scene = SceneClassInfo::get(env,obj)) { - ChangeSet changes; - changes.push_back(new RemRenderTargetReq(targetID)); + ChangeSet changes = { new RemRenderTargetReq(targetID) }; scene->addChangeRequests(changes); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in Scene::removeRenderTargetNative()"); - } + MAPLY_STD_JNI_CATCH() } extern "C" @@ -216,16 +193,12 @@ JNIEXPORT float JNICALL Java_com_mousebird_maply_Scene_getZoomSlotValue(JNIEnv * { try { - SceneClassInfo *classInfo = SceneClassInfo::getClassInfo(); - if (Scene *scene = classInfo->getObject(env,obj)) + if (Scene *scene = SceneClassInfo::get(env,obj)) { return scene->getZoomSlotValue(slot); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in Scene::getZoomSlotValue()"); - } + MAPLY_STD_JNI_CATCH() return 0.0; } @@ -234,15 +207,11 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_Scene_copyZoomSlots(JNIEnv *env, { try { - SceneClassInfo *classInfo = SceneClassInfo::getClassInfo(); - if (Scene *thisScene = classInfo->getObject(env,obj)) - if (Scene *otherScene = classInfo->getObject(env,otherObj)) + if (Scene *thisScene = SceneClassInfo::get(env,obj)) + if (Scene *otherScene = SceneClassInfo::get(env,otherObj)) { thisScene->copyZoomSlotsFrom(otherScene, offset); } } - catch (...) - { - __android_log_print(ANDROID_LOG_ERROR, "Maply", "Crash in Scene::copyZoomSlots()"); - } + MAPLY_STD_JNI_CATCH() } diff --git a/android/library/maply/jni/src/scene/Shader_jni.cpp b/android/library/maply/jni/src/scene/Shader_jni.cpp index 0c3bf67d8d..984b6eaebc 100644 --- a/android/library/maply/jni/src/scene/Shader_jni.cpp +++ b/android/library/maply/jni/src/scene/Shader_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 8/216/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/scene/Texture_jni.cpp b/android/library/maply/jni/src/scene/Texture_jni.cpp index d5a9473878..807e098cec 100644 --- a/android/library/maply/jni/src/scene/Texture_jni.cpp +++ b/android/library/maply/jni/src/scene/Texture_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/shapes/ShapeCircle_jni.cpp b/android/library/maply/jni/src/shapes/ShapeCircle_jni.cpp index 3ba111b0c1..3a50d2d9f4 100644 --- a/android/library/maply/jni/src/shapes/ShapeCircle_jni.cpp +++ b/android/library/maply/jni/src/shapes/ShapeCircle_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/shapes/ShapeCylinder_jni.cpp b/android/library/maply/jni/src/shapes/ShapeCylinder_jni.cpp index f952e3ed5f..dd176f1e6b 100644 --- a/android/library/maply/jni/src/shapes/ShapeCylinder_jni.cpp +++ b/android/library/maply/jni/src/shapes/ShapeCylinder_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/shapes/ShapeExtruded_jni.cpp b/android/library/maply/jni/src/shapes/ShapeExtruded_jni.cpp index a1e8d71653..7219dc61c9 100644 --- a/android/library/maply/jni/src/shapes/ShapeExtruded_jni.cpp +++ b/android/library/maply/jni/src/shapes/ShapeExtruded_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/shapes/ShapeGreatCircle_jni.cpp b/android/library/maply/jni/src/shapes/ShapeGreatCircle_jni.cpp index 55b45b20c8..5c23ee0228 100644 --- a/android/library/maply/jni/src/shapes/ShapeGreatCircle_jni.cpp +++ b/android/library/maply/jni/src/shapes/ShapeGreatCircle_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/shapes/ShapeInfo_jni.cpp b/android/library/maply/jni/src/shapes/ShapeInfo_jni.cpp index 764182d2fa..53ad582a10 100644 --- a/android/library/maply/jni/src/shapes/ShapeInfo_jni.cpp +++ b/android/library/maply/jni/src/shapes/ShapeInfo_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/shapes/ShapeLinear_jni.cpp b/android/library/maply/jni/src/shapes/ShapeLinear_jni.cpp index f9829d2053..16a9da59b3 100644 --- a/android/library/maply/jni/src/shapes/ShapeLinear_jni.cpp +++ b/android/library/maply/jni/src/shapes/ShapeLinear_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/shapes/ShapeManager_jni.cpp b/android/library/maply/jni/src/shapes/ShapeManager_jni.cpp index 4ef0352a19..110b375e48 100644 --- a/android/library/maply/jni/src/shapes/ShapeManager_jni.cpp +++ b/android/library/maply/jni/src/shapes/ShapeManager_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/shapes/ShapeRectangle_jni.cpp b/android/library/maply/jni/src/shapes/ShapeRectangle_jni.cpp index fda951a238..f95e934736 100644 --- a/android/library/maply/jni/src/shapes/ShapeRectangle_jni.cpp +++ b/android/library/maply/jni/src/shapes/ShapeRectangle_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/shapes/ShapeSphere_jni.cpp b/android/library/maply/jni/src/shapes/ShapeSphere_jni.cpp index ba0b2a4078..3a933f20e9 100644 --- a/android/library/maply/jni/src/shapes/ShapeSphere_jni.cpp +++ b/android/library/maply/jni/src/shapes/ShapeSphere_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/shapes/Shape_jni.cpp b/android/library/maply/jni/src/shapes/Shape_jni.cpp index 0dc03aadd9..255aaac4c7 100644 --- a/android/library/maply/jni/src/shapes/Shape_jni.cpp +++ b/android/library/maply/jni/src/shapes/Shape_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/stickers/StickerInfo_jni.cpp b/android/library/maply/jni/src/stickers/StickerInfo_jni.cpp index 30998d337d..aee8f4356e 100644 --- a/android/library/maply/jni/src/stickers/StickerInfo_jni.cpp +++ b/android/library/maply/jni/src/stickers/StickerInfo_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 11/16/15. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/stickers/StickerManager_jni.cpp b/android/library/maply/jni/src/stickers/StickerManager_jni.cpp index 6bb69deb22..7791fedef3 100644 --- a/android/library/maply/jni/src/stickers/StickerManager_jni.cpp +++ b/android/library/maply/jni/src/stickers/StickerManager_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 11/18/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/stickers/Sticker_jni.cpp b/android/library/maply/jni/src/stickers/Sticker_jni.cpp index 0cf6e5fceb..cb757ef59a 100644 --- a/android/library/maply/jni/src/stickers/Sticker_jni.cpp +++ b/android/library/maply/jni/src/stickers/Sticker_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 11/16/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/vectors/AttrDictionaryEntry_jni.cpp b/android/library/maply/jni/src/vectors/AttrDictionaryEntry_jni.cpp index ff1d478e81..513a3d4161 100644 --- a/android/library/maply/jni/src/vectors/AttrDictionaryEntry_jni.cpp +++ b/android/library/maply/jni/src/vectors/AttrDictionaryEntry_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/vectors/AttrDictionary_jni.cpp b/android/library/maply/jni/src/vectors/AttrDictionary_jni.cpp index 0d20034647..f7ce3d81ae 100644 --- a/android/library/maply/jni/src/vectors/AttrDictionary_jni.cpp +++ b/android/library/maply/jni/src/vectors/AttrDictionary_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/vectors/LoftedPolyInfo_jni.cpp b/android/library/maply/jni/src/vectors/LoftedPolyInfo_jni.cpp index a4ef02361f..780002d82e 100644 --- a/android/library/maply/jni/src/vectors/LoftedPolyInfo_jni.cpp +++ b/android/library/maply/jni/src/vectors/LoftedPolyInfo_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/vectors/LoftedPolyManager_jni.cpp b/android/library/maply/jni/src/vectors/LoftedPolyManager_jni.cpp index 4bcdf8ce69..8a0b97591a 100644 --- a/android/library/maply/jni/src/vectors/LoftedPolyManager_jni.cpp +++ b/android/library/maply/jni/src/vectors/LoftedPolyManager_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/4/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/vectors/VectorInfo_jni.cpp b/android/library/maply/jni/src/vectors/VectorInfo_jni.cpp index 5d23793c8f..d31fa12144 100644 --- a/android/library/maply/jni/src/vectors/VectorInfo_jni.cpp +++ b/android/library/maply/jni/src/vectors/VectorInfo_jni.cpp @@ -1,9 +1,8 @@ -/* - * VectorInfo_jni.cpp +/* VectorInfo_jni.cpp * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "Vectors_jni.h" @@ -24,243 +22,443 @@ using namespace Eigen; using namespace WhirlyKit; -template<> VectorInfoClassInfo *VectorInfoClassInfo::classInfoObj = NULL; +template<> VectorInfoClassInfo *VectorInfoClassInfo::classInfoObj = nullptr; +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_nativeInit (JNIEnv *env, jclass cls) { VectorInfoClassInfo::getClassInfo(env,cls); } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_initialise (JNIEnv *env, jobject obj) { try { - VectorInfoRef *vecInfo = new VectorInfoRef(new VectorInfo()); - VectorInfoClassInfo::getClassInfo()->setHandle(env,obj,vecInfo); - } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in VectorInfo::initialise()"); + VectorInfoClassInfo::set(env, obj, new VectorInfoRef(std::make_shared())); } + MAPLY_STD_JNI_CATCH() } static std::mutex disposeMutex; +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_dispose (JNIEnv *env, jobject obj) { try { VectorInfoClassInfo *classInfo = VectorInfoClassInfo::getClassInfo(); - { - std::lock_guard lock(disposeMutex); - VectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - delete vecInfo; - - classInfo->clearHandle(env,obj); - } - } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in VectorInfo::dispose()"); + std::lock_guard lock(disposeMutex); + delete classInfo->getObject(env,obj); + classInfo->clearHandle(env,obj); } + MAPLY_STD_JNI_CATCH() } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setFilled (JNIEnv *env, jobject obj, jboolean bVal) { try { - VectorInfoClassInfo *classInfo = VectorInfoClassInfo::getClassInfo(); - VectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->filled = bVal; + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->filled = bVal; + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorInfo_getFilled + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in VectorInfo::setFilled()"); + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->filled; + } } + MAPLY_STD_JNI_CATCH() + return false; } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setSampleEpsilon (JNIEnv *env, jobject obj, jdouble sample) { try { - VectorInfoClassInfo *classInfo = VectorInfoClassInfo::getClassInfo(); - VectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->sample = sample; + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->sample = sample; + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jdouble JNICALL Java_com_mousebird_maply_VectorInfo_getSampleEpsilon + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in VectorInfo::setSampleEpsilon()"); + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->sample; + } } + MAPLY_STD_JNI_CATCH() + return 0.0; } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setTextureID (JNIEnv *env, jobject obj, jlong texID) { try { - VectorInfoClassInfo *classInfo = VectorInfoClassInfo::getClassInfo(); - VectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->texId = texID; + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->texId = texID; + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jlong JNICALL Java_com_mousebird_maply_VectorInfo_getTextureID + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in VectorInfo::setTextureID()"); + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->texId; + } } + MAPLY_STD_JNI_CATCH() + return EmptyIdentity; } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setTexScale (JNIEnv *env, jobject obj, jdouble s, jdouble t) { try { - VectorInfoClassInfo *classInfo = VectorInfoClassInfo::getClassInfo(); - VectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->texScale.x() = s; - (*vecInfo)->texScale.y() = t; + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->texScale = {s,t}; + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jfloat JNICALL Java_com_mousebird_maply_VectorInfo_getTexScaleX + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in VectorInfo::setTexScale()"); + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->texScale.x(); + } } + MAPLY_STD_JNI_CATCH() + return 0.0; } +extern "C" +JNIEXPORT jfloat JNICALL Java_com_mousebird_maply_VectorInfo_getTexScaleY + (JNIEnv *env, jobject obj) +{ + try + { + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->texScale.y(); + } + } + MAPLY_STD_JNI_CATCH() + return 0.0; +} + +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setSubdivEps (JNIEnv *env, jobject obj, jdouble subdiv) { try { - VectorInfoClassInfo *classInfo = VectorInfoClassInfo::getClassInfo(); - VectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->subdivEps = subdiv; - (*vecInfo)->gridSubdiv = true; + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->subdivEps = subdiv; + (*vecInfo)->gridSubdiv = true; + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jdouble JNICALL Java_com_mousebird_maply_VectorInfo_getSubdivEps + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in VectorInfo::setSubdivEps()"); + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->subdivEps; + } } + MAPLY_STD_JNI_CATCH() + return 0.0; } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setTextureProjectionNative -(JNIEnv *env, jobject obj, jint texProj) + (JNIEnv *env, jobject obj, jint texProj) { try { - VectorInfoClassInfo *classInfo = VectorInfoClassInfo::getClassInfo(); - VectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->texProj = (TextureProjections)texProj; - } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in VectorInfo::setTextureProjectionNative()"); + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->texProj = (TextureProjections)texProj; + } } + MAPLY_STD_JNI_CATCH() } -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setColor - (JNIEnv *env, jobject obj, jfloat r, jfloat g, jfloat b, jfloat a) +extern "C" +JNIEXPORT jint JNICALL Java_com_mousebird_maply_VectorInfo_getTextureProjectionNative + (JNIEnv *env, jobject obj) { try { - VectorInfoClassInfo *classInfo = VectorInfoClassInfo::getClassInfo(); - VectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->color = RGBAColor(r*255.0,g*255.0,b*255.0,a*255.0); + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->texProj; + } + } + MAPLY_STD_JNI_CATCH() + return 0; +} + + +extern "C" +JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setColorInt + (JNIEnv *env, jobject obj, jint r, jint g, jint b, jint a) +{ + try + { + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->color = RGBAColor(r,g,b,a); + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setColor + (JNIEnv *env, jobject obj, jfloat r, jfloat g, jfloat b, jfloat a) +{ + Java_com_mousebird_maply_VectorInfo_setColorInt(env, obj, + (jint)(r*255.0f),(jint)(g*255.0f),(jint)(b*255.0f),(jint)(a*255.0f)); +} + +extern "C" +JNIEXPORT jint JNICALL Java_com_mousebird_maply_VectorInfo_getColor + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in VectorInfo::setColor()"); + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->color.asARGBInt(); + } } + MAPLY_STD_JNI_CATCH() + return 0; } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setLineWidth (JNIEnv *env, jobject obj, jfloat val) { try { - VectorInfoClassInfo *classInfo = VectorInfoClassInfo::getClassInfo(); - VectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->lineWidth = val; + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->lineWidth = val; + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jfloat JNICALL Java_com_mousebird_maply_VectorInfo_getLineWidth + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in VectorInfo::setLineWidth()"); + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->lineWidth; + } } + MAPLY_STD_JNI_CATCH() + return 0.0f; } -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setUseCenter - (JNIEnv *env, jobject obj) +extern "C" +JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setUseCenterNative + (JNIEnv *env, jobject obj, jboolean use) { try { - VectorInfoClassInfo *classInfo = VectorInfoClassInfo::getClassInfo(); - VectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->centered = true; + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->centered = use; + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorInfo_getUseCenter + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in VectorInfo::setUseCenter()"); + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->centered; + } } + MAPLY_STD_JNI_CATCH() + return false; } +extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setVecCenterNative -(JNIEnv *env, jobject obj, jdouble centerX, jdouble centerY) + (JNIEnv *env, jobject obj, jdouble centerX, jdouble centerY) { try { - VectorInfoClassInfo *classInfo = VectorInfoClassInfo::getClassInfo(); - VectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->centered = true; - (*vecInfo)->vecCenterSet = true; - (*vecInfo)->vecCenter = Point2f(centerX,centerY); - } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in VectorInfo::setVecCenterNative()"); + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->centered = true; + (*vecInfo)->vecCenterSet = true; + (*vecInfo)->vecCenter = Point2f(centerX, centerY); + } } + MAPLY_STD_JNI_CATCH() } +extern "C" +JNIEXPORT jdouble JNICALL Java_com_mousebird_maply_VectorInfo_getVecCenterX + (JNIEnv *env, jobject obj) +{ + try + { + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->vecCenter.x(); + } + } + MAPLY_STD_JNI_CATCH() + return 0.0; +} + +extern "C" +JNIEXPORT jdouble JNICALL Java_com_mousebird_maply_VectorInfo_getVecCenterY + (JNIEnv *env, jobject obj) +{ + try + { + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->vecCenter.y(); + } + } + MAPLY_STD_JNI_CATCH() + return 0.0; +} + +extern "C" +JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setSelectable + (JNIEnv *env, jobject obj, jboolean enable) +{ + try + { + if (const auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->selectable = enable; + } + } + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorInfo_getSelectable + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->selectable; + } + } + MAPLY_STD_JNI_CATCH() + return false; +} + +extern "C" +JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorInfo_setCloseAreals + (JNIEnv *env, jobject obj, jboolean close) +{ + try + { + if (const auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->closeAreals = close; + } + } + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorInfo_getCloseAreals + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->closeAreals; + } + } + MAPLY_STD_JNI_CATCH() + return false; +} + +extern "C" JNIEXPORT jstring JNICALL Java_com_mousebird_maply_VectorInfo_toString -(JNIEnv *env, jobject obj) + (JNIEnv *env, jobject obj) { try { - VectorInfoClassInfo *classInfo = VectorInfoClassInfo::getClassInfo(); - VectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return NULL; - - std::string outStr = (*vecInfo)->toString(); - return env->NewStringUTF(outStr.c_str()); + if (auto vecInfo = VectorInfoClassInfo::get(env,obj)) + { + return env->NewStringUTF((*vecInfo)->toString().c_str()); + } } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in VectorInfo::toString()"); - } - - return NULL; + MAPLY_STD_JNI_CATCH() + return nullptr; } diff --git a/android/library/maply/jni/src/vectors/VectorIterator_jni.cpp b/android/library/maply/jni/src/vectors/VectorIterator_jni.cpp index 52c155acc3..1fb6487c87 100644 --- a/android/library/maply/jni/src/vectors/VectorIterator_jni.cpp +++ b/android/library/maply/jni/src/vectors/VectorIterator_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/vectors/VectorManager_jni.cpp b/android/library/maply/jni/src/vectors/VectorManager_jni.cpp index 28c3800b5a..933333ccc6 100644 --- a/android/library/maply/jni/src/vectors/VectorManager_jni.cpp +++ b/android/library/maply/jni/src/vectors/VectorManager_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/vectors/VectorObject_jni.cpp b/android/library/maply/jni/src/vectors/VectorObject_jni.cpp index 820e933061..495357250f 100644 --- a/android/library/maply/jni/src/vectors/VectorObject_jni.cpp +++ b/android/library/maply/jni/src/vectors/VectorObject_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,35 +27,38 @@ using namespace WhirlyKit; template<> VectorObjectClassInfo *VectorObjectClassInfo::classInfoObj = nullptr; extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_nativeInit(JNIEnv *env, jclass cls) +JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_nativeInit + (JNIEnv *env, jclass cls) { VectorObjectClassInfo::getClassInfo(env,cls); } JNIEXPORT jobject JNICALL MakeVectorObject(JNIEnv *env,const VectorObjectRef &vec) { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(env,"com/mousebird/maply/VectorObject"); + auto classInfo = VectorObjectClassInfo::getClassInfo(env,"com/mousebird/maply/VectorObject"); return MakeVectorObjectWrapper(env,classInfo,vec); } JNIEXPORT jobject JNICALL MakeVectorObjectWrapper(JNIEnv *env,VectorObjectClassInfo *classInfo,const VectorObjectRef &vec) { - jobject newObj = classInfo->makeWrapperObject(env); - VectorObjectRef *oldRef = classInfo->getObject(env,newObj); - vec->setId((*oldRef)->getId()); - classInfo->setHandle(env,newObj,new VectorObjectRef(vec)); - delete oldRef; - return newObj; + if (jobject newObj = classInfo->makeWrapperObject(env)) + if (VectorObjectRef *oldRef = classInfo->getObject(env,newObj)) + { + vec->setId((*oldRef)->getId()); + classInfo->setHandle(env, newObj, new VectorObjectRef(vec)); + delete oldRef; + return newObj; + } + return nullptr; } extern "C" -void Java_com_mousebird_maply_VectorObject_initialise(JNIEnv *env, jobject obj, jlong ident) +void Java_com_mousebird_maply_VectorObject_initialise + (JNIEnv *env, jobject obj, jlong ident) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - auto inst = new VectorObjectRef(new VectorObject(ident)); - classInfo->setHandle(env,obj,inst); + VectorObjectClassInfo::set(env, obj, new VectorObjectRef(std::make_shared(ident))); } MAPLY_STD_JNI_CATCH() } @@ -63,63 +66,59 @@ void Java_com_mousebird_maply_VectorObject_initialise(JNIEnv *env, jobject obj, static std::mutex disposeMutex; extern "C" -void Java_com_mousebird_maply_VectorObject_dispose(JNIEnv *env, jobject obj) +void Java_com_mousebird_maply_VectorObject_dispose + (JNIEnv *env, jobject obj) { try { VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - { - std::lock_guard lock(disposeMutex); - VectorObjectRef *inst = classInfo->getObject(env,obj); - if (!inst) - return; - delete inst; - - classInfo->clearHandle(env,obj); - } + std::lock_guard lock(disposeMutex); + VectorObjectRef *inst = classInfo->getObject(env,obj); + delete inst; + classInfo->clearHandle(env,obj); } MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT jint JNICALL Java_com_mousebird_maply_VectorObject_getVectorTypeNative(JNIEnv *env, jobject obj) +JNIEXPORT jint JNICALL Java_com_mousebird_maply_VectorObject_getVectorTypeNative + (JNIEnv *env, jobject obj) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - if (!vecObj) - return VectorNoneType; - return (*vecObj)->getVectorType(); + if (auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + return (*vecObj)->getVectorType(); + } } MAPLY_STD_JNI_CATCH() return VectorNoneType; } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_setSelectable(JNIEnv *env, jobject obj, jboolean newVal) +JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_setSelectable + (JNIEnv *env, jobject obj, jboolean newVal) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - if (!vecObj) - return; - (*vecObj)->selectable = newVal; + if (auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + (*vecObj)->selectable = newVal; + } } MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_getSelectable(JNIEnv *env, jobject obj) +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_getSelectable + (JNIEnv *env, jobject obj) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - if (!vecObj) - return false; - return (*vecObj)->selectable; + if (auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + return (*vecObj)->selectable; + } } MAPLY_STD_JNI_CATCH() return false; @@ -163,12 +162,13 @@ JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_getAttributesRef } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_setAttributes(JNIEnv *env, jobject obj, jobject attrObj) +JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_setAttributes + (JNIEnv *env, jobject obj, jobject attrObj) { try { if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) - if (auto dict = AttrDictClassInfo::get(env,attrObj)) + if (const auto dict = AttrDictClassInfo::get(env,attrObj)) { (*vecObj)->setAttributes(*dict); } @@ -177,152 +177,176 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_setAttributes(JNIEn } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_addPoint(JNIEnv *env, jobject obj, jobject ptObj) +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_addPoint + (JNIEnv *env, jobject obj, jobject ptObj) { try { - VectorObjectRef *vecObj = VectorObjectClassInfo::getClassInfo()->getObject(env,obj); - Point2d *pt = Point2dClassInfo::getClassInfo()->getObject(env,ptObj); - if (!vecObj) - return; - - VectorPointsRef pts = VectorPoints::createPoints(); - pts->pts.push_back(GeoCoord(pt->x(),pt->y())); - pts->initGeoMbr(); - (*vecObj)->shapes.insert(pts); + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto pt = Point2dClassInfo::get(env, ptObj)) + { + VectorPointsRef pts = VectorPoints::createPoints(); + pts->pts.push_back(GeoCoord(pt->x(), pt->y())); + pts->initGeoMbr(); + (*vecObj)->shapes.insert(pts); + return true; + } } MAPLY_STD_JNI_CATCH() + return false; } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_addLinear(JNIEnv *env, jobject obj, jobjectArray ptsObj) +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_addLinear + (JNIEnv *env, jobject obj, jobjectArray ptsObj) { try { - VectorObjectRef *vecObj = VectorObjectClassInfo::getClassInfo()->getObject(env,obj); - if (!vecObj) - return; - - VectorLinearRef lin = VectorLinear::createLinear(); - JavaObjectArrayHelper ptsHelp(env,ptsObj); - while (jobject ptObj = ptsHelp.getNextObject()) { - Point2d *pt = Point2dClassInfo::getClassInfo()->getObject(env,ptObj); - lin->pts.push_back(GeoCoord(pt->x(),pt->y())); - } - lin->initGeoMbr(); - (*vecObj)->shapes.insert(lin); + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + const auto ptClassInfo = Point2dClassInfo::getClassInfo(); + + VectorLinearRef lin = VectorLinear::createLinear(); + + JavaObjectArrayHelper ptsHelp(env, ptsObj); + lin->pts.reserve(ptsHelp.numObjects()); + + while (jobject ptObj = ptsHelp.getNextObject()) + { + const Point2d *pt = ptClassInfo->getObject(env, ptObj); + lin->pts.emplace_back(pt->x(), pt->y()); + } + lin->initGeoMbr(); + (*vecObj)->shapes.insert(lin); + return true; + } } MAPLY_STD_JNI_CATCH() + return false; } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_addAreal___3Lcom_mousebird_maply_Point2d_2(JNIEnv *env, jobject obj, jobjectArray ptsObj) +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_addAreal___3Lcom_mousebird_maply_Point2d_2 + (JNIEnv *env, jobject obj, jobjectArray ptsObj) { try { - VectorObjectRef *vecObj = VectorObjectClassInfo::getClassInfo()->getObject(env,obj); - if (!vecObj) - return; - - VectorArealRef ar = VectorAreal::createAreal(); - ar->loops.resize(1); - - JavaObjectArrayHelper ptsHelp(env,ptsObj); - while (jobject ptObj = ptsHelp.getNextObject()) { - Point2d *pt = Point2dClassInfo::getClassInfo()->getObject(env,ptObj); - ar->loops[0].push_back(GeoCoord(pt->x(),pt->y())); - } - ar->initGeoMbr(); - (*vecObj)->shapes.insert(ar); + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + const auto ptClassInfo = Point2dClassInfo::getClassInfo(); + + VectorArealRef ar = VectorAreal::createAreal(); + ar->loops.resize(1); + auto &loop = ar->loops[0]; + + JavaObjectArrayHelper ptsHelp(env, ptsObj); + loop.reserve(ptsHelp.numObjects()); + + while (jobject ptObj = ptsHelp.getNextObject()) + { + const Point2d *pt = ptClassInfo->getObject(env, ptObj); + ar->loops[0].emplace_back(pt->x(), pt->y()); + } + ar->initGeoMbr(); + (*vecObj)->shapes.insert(ar); + return true; + } } MAPLY_STD_JNI_CATCH() + return false; } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_addAreal___3Lcom_mousebird_maply_Point2d_2_3_3Lcom_mousebird_maply_Point2d_2 - (JNIEnv *env, jobject obj, jobjectArray outerLoopObj, jobjectArray holesArray) +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_addAreal___3Lcom_mousebird_maply_Point2d_2_3_3Lcom_mousebird_maply_Point2d_2 + (JNIEnv *env, jobject obj, jobjectArray outerLoopObj, jobjectArray holesArray) { try { - VectorObjectRef *vecObj = VectorObjectClassInfo::getClassInfo()->getObject(env,obj); - if (!vecObj) - return; - Point2dClassInfo *point2dClassInfo = Point2dClassInfo::getClassInfo(); + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + const auto point2dClassInfo = Point2dClassInfo::getClassInfo(); - VectorArealRef ar = VectorAreal::createAreal(); - ar->loops.resize(1+env->GetArrayLength(holesArray)); + VectorArealRef ar = VectorAreal::createAreal(); + ar->loops.resize(1 + env->GetArrayLength(holesArray)); - for (int loop=0;looploops.size();loop++) - { - jobjectArray ptsObj = loop == 0 ? outerLoopObj : (jobjectArray)env->GetObjectArrayElement(holesArray,loop-1); + for (int loop = 0; loop < ar->loops.size(); loop++) + { + jobjectArray ptsObj = + (loop == 0) ? outerLoopObj : + (jobjectArray) env->GetObjectArrayElement(holesArray, loop - 1); + + JavaObjectArrayHelper ptsHelp(env, ptsObj); + ar->loops[loop].reserve(ptsHelp.numObjects()); + + while (jobject ptObj = ptsHelp.getNextObject()) + { + Point2d *pt = point2dClassInfo->getObject(env, ptObj); + ar->loops[loop].emplace_back(pt->x(), pt->y()); + } - JavaObjectArrayHelper ptsHelp(env,ptsObj); - while (jobject ptObj = ptsHelp.getNextObject()) { - Point2d *pt = point2dClassInfo->getObject(env,ptObj); - ar->loops[loop].push_back(GeoCoord(pt->x(),pt->y())); + if (loop > 0) + { + env->DeleteLocalRef(ptsObj); + } } - if (loop > 0) - env->DeleteLocalRef(ptsObj); + ar->initGeoMbr(); + (*vecObj)->shapes.insert(ar); + return true; } - - ar->initGeoMbr(); - (*vecObj)->shapes.insert(ar); } MAPLY_STD_JNI_CATCH() + return false; } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_mergeVectorsFrom(JNIEnv *env, jobject obj, jobject otherObj) +JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_mergeVectorsFrom + (JNIEnv *env, jobject obj, jobject otherObj) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - VectorObjectRef *otherVecObj = classInfo->getObject(env,otherObj); - if (!vecObj || !otherVecObj) - return; - - (*vecObj)->mergeVectorsFrom(*(*otherVecObj).get()); + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto otherVec = VectorObjectClassInfo::get(env,otherObj)) + { + (*vecObj)->mergeVectorsFrom(**otherVec); + } } MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_center(JNIEnv *env, jobject obj) +JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_center + (JNIEnv *env, jobject obj) { try { - VectorObjectRef *vecObj = VectorObjectClassInfo::getClassInfo()->getObject(env,obj); - if (!vecObj) - return nullptr; - - Point2d center; - if ((*vecObj)->center(center)) - { - return MakePoint2d(env,center); - } else - return nullptr; + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + Point2d center; + if ((*vecObj)->center(center)) + { + return MakePoint2d(env, center); + } + } } MAPLY_STD_JNI_CATCH() return nullptr; } extern "C" -JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_centroid(JNIEnv *env, jobject obj) +JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_centroid + (JNIEnv *env, jobject obj) { try { - VectorObjectRef *vecObj = VectorObjectClassInfo::getClassInfo()->getObject(env,obj); - if (!vecObj) - return nullptr; - - Point2d center; - if ((*vecObj)->centroid(center)) - { - return MakePoint2d(env,center); - } else - return nullptr; + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + Point2d center; + if ((*vecObj)->centroid(center)) + { + return MakePoint2d(env, center); + } + } } MAPLY_STD_JNI_CATCH() return nullptr; @@ -330,25 +354,19 @@ JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_centroid(JNIEnv extern "C" JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_largestLoopCenter - (JNIEnv *env, jobject obj, jobject llObj, jobject urObj) + (JNIEnv *env, jobject obj, jobject llObj, jobject urObj) { try { - Point2dClassInfo *pt2dClassInfo = Point2dClassInfo::getClassInfo(); - VectorObjectRef *vecObj = VectorObjectClassInfo::getClassInfo()->getObject(env,obj); - Point2d *ll = pt2dClassInfo->getObject(env,llObj); - Point2d *ur = pt2dClassInfo->getObject(env,urObj); - if (!vecObj || !ll || !ur) - return nullptr; - - Point2d center; - if ((*vecObj)->largestLoopCenter(center,*ll,*ur)) - { - return MakePoint2d(env,center); - } - else + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto ll = Point2dClassInfo::get(env, llObj)) + if (const auto ur = Point2dClassInfo::get(env, urObj)) { - return nullptr; + Point2d center; + if ((*vecObj)->largestLoopCenter(center, *ll, *ur)) + { + return MakePoint2d(env, center); + } } } MAPLY_STD_JNI_CATCH() @@ -356,172 +374,303 @@ JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_largestLoopCente } extern "C" -JNIEXPORT jdouble JNICALL Java_com_mousebird_maply_VectorObject_linearMiddle__Lcom_mousebird_maply_Point2d_2(JNIEnv *env, jobject obj, jobject midObj) +JNIEXPORT jdouble JNICALL Java_com_mousebird_maply_VectorObject_linearMiddle__Lcom_mousebird_maply_Point2d_2 + (JNIEnv *env, jobject obj, jobject midObj) { try { - Point2dClassInfo *pt2dClassInfo = Point2dClassInfo::getClassInfo(); - VectorObjectRef *vecObj = VectorObjectClassInfo::getClassInfo()->getObject(env,obj); - Point2d *mid = pt2dClassInfo->getObject(env,midObj); - if (!vecObj || !mid) - return 0.0; - - double rot; - if ((*vecObj)->linearMiddle(*mid,rot)) - { - return rot; - } else - return 0.0; + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto mid = Point2dClassInfo::get(env,midObj)) + { + double rot; + if ((*vecObj)->linearMiddle(*mid, rot)) + { + return rot; + } + } } MAPLY_STD_JNI_CATCH() return 0.0; } -/* - * Class: com_mousebird_maply_VectorObject - * Method: linearMiddle - * Signature: (Lcom/mousebird/maply/Point2d;Lcom/mousebird/maply/CoordSystem;)D - */ extern "C" JNIEXPORT jdouble JNICALL Java_com_mousebird_maply_VectorObject_linearMiddle__Lcom_mousebird_maply_Point2d_2Lcom_mousebird_maply_CoordSystem_2 (JNIEnv *env, jobject obj, jobject midObj, jobject coordSysObj) { try { - Point2dClassInfo *pt2dClassInfo = Point2dClassInfo::getClassInfo(); - VectorObjectRef *vecObj = VectorObjectClassInfo::getClassInfo()->getObject(env,obj); - Point2d *mid = pt2dClassInfo->getObject(env,midObj); - CoordSystemRef *coordSys = CoordSystemRefClassInfo::getClassInfo()->getObject(env,coordSysObj); - if (!vecObj || !mid || !coordSys) - return 0.0; - - double rot; - if ((*vecObj)->linearMiddle(*mid,rot,coordSys->get())) + const auto pt2dClassInfo = Point2dClassInfo::getClassInfo(); + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto mid = pt2dClassInfo->getObject(env,midObj)) + if (const auto coordSys = CoordSystemRefClassInfo::get(env,coordSysObj)) { - return rot; - } else - return 0.0; + double rot; + if ((*vecObj)->linearMiddle(*mid,rot,coordSys->get())) + { + return rot; + } + } } MAPLY_STD_JNI_CATCH() return 0.0; } extern "C" -JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_middleCoordinate(JNIEnv *env, jobject obj, jobject midObj) +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_middleCoordinate + (JNIEnv *env, jobject obj, jobject midObj) { try { if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto mid = Point2dClassInfo::get(env,midObj)) { - if (const auto mid = Point2dClassInfo::get(env,midObj)) - { - return (*vecObj)->middleCoordinate(*mid); - } - } + return (*vecObj)->middleCoordinate(*mid); + } } MAPLY_STD_JNI_CATCH() return false; } extern "C" -JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_pointInside(JNIEnv *env, jobject obj, jobject ptObj) +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_pointInside + (JNIEnv *env, jobject obj, jobject ptObj) { try { - Point2dClassInfo *pt2dClassInfo = Point2dClassInfo::getClassInfo(); - VectorObjectRef *vecObj = VectorObjectClassInfo::getClassInfo()->getObject(env,obj); - Point2d *pt = pt2dClassInfo->getObject(env,ptObj); - if (!vecObj || !pt) - return false; - - return (*vecObj)->pointInside(*pt); + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto pt = Point2dClassInfo::get(env,ptObj)) + { + return (*vecObj)->pointInside(*pt); + } } MAPLY_STD_JNI_CATCH() return false; } extern "C" -JNIEXPORT jdouble JNICALL Java_com_mousebird_maply_VectorObject_areaOfOuterLoops(JNIEnv *env, jobject obj) +JNIEXPORT jdouble JNICALL Java_com_mousebird_maply_VectorObject_areaOfOuterLoops + (JNIEnv *env, jobject obj) { try { - VectorObjectRef *vecObj = VectorObjectClassInfo::getClassInfo()->getObject(env,obj); - if (!vecObj) - return 0.0; - - return (*vecObj)->areaOfOuterLoops(); + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + return (*vecObj)->areaOfOuterLoops(); + } } MAPLY_STD_JNI_CATCH() return 0.0; } extern "C" -JNIEXPORT jint JNICALL Java_com_mousebird_maply_VectorObject_countPoints(JNIEnv *env, jobject obj) +JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_reverseAreals + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + (*vecObj)->reverseAreals(); + } + } + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_reversedAreals + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + if ((*vecObj)->countAreals() == 0) + { + return obj; + } + if (auto newObj = (*vecObj)->reversedAreals()) + { + return MakeVectorObjectWrapper(env, VectorObjectClassInfo::getClassInfo(), newObj); + } + } + } + MAPLY_STD_JNI_CATCH() + return nullptr; +} + +extern "C" +JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_closeLoops + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + (*vecObj)->closeLoops(); + } + } + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_closedLoops + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + if ((*vecObj)->countUnClosedLoops() == 0) + { + // No un-closed loops, don't create a new object + return obj; + } + if (auto newObj = (*vecObj)->closedLoops()) + { + return MakeVectorObjectWrapper(env, VectorObjectClassInfo::getClassInfo(), newObj); + } + } + } + MAPLY_STD_JNI_CATCH() + return nullptr; +} + +extern "C" +JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_unCloseLoops + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + (*vecObj)->unCloseLoops(); + } + } + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_unClosedLoops + (JNIEnv *env, jobject obj) { try { - //Point2dClassInfo *pt2dClassInfo = Point2dClassInfo::getClassInfo(); - VectorObjectRef *vecObj = VectorObjectClassInfo::getClassInfo()->getObject(env,obj); - if (!vecObj) - return 0; + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + if ((*vecObj)->countClosedLoops() == 0) + { + // No closed loops, don't create a new object + return obj; + } + if (auto newObj = (*vecObj)->unClosedLoops()) + { + return MakeVectorObjectWrapper(env, VectorObjectClassInfo::getClassInfo(), newObj); + } + } + } + MAPLY_STD_JNI_CATCH() + return nullptr; +} - int numPts = 0; - for (const auto &shape : (*vecObj)->shapes) +extern "C" +JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_clone + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) { - if (const auto linear = dynamic_cast(shape.get())) + if (auto newObj = (*vecObj)->deepCopy()) { - numPts += linear->pts.size(); - //} else if(const auto vec3d = dynamic_cast(shape.get())) { - } else if(const auto ar = dynamic_cast(shape.get())) { - for (auto & loop : ar->loops) + return MakeVectorObjectWrapper(env, VectorObjectClassInfo::getClassInfo(), newObj); + } + } + } + MAPLY_STD_JNI_CATCH() + return nullptr; +} + +extern "C" +JNIEXPORT jint JNICALL Java_com_mousebird_maply_VectorObject_countPoints + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + int numPts = 0; + for (const auto &shape : (*vecObj)->shapes) + { + if (const auto linear = dynamic_cast(shape.get())) + { + numPts += linear->pts.size(); + } + //} else if(const auto vec3d = dynamic_cast(shape.get())) { + else if(const auto ar = dynamic_cast(shape.get())) + { + for (auto & loop : ar->loops) + { + numPts += loop.size(); + } + } + else if (const auto points = dynamic_cast(shape.get())) { - numPts += loop.size(); + numPts += points->pts.size(); } - } else if (const auto points = dynamic_cast(shape.get())) { - numPts += points->pts.size(); } + + return numPts; } + } + MAPLY_STD_JNI_CATCH() + return 0; +} - return numPts; +extern "C" +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_anyIntersections + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + { + return (*vecObj)->anyIntersections(); + } } MAPLY_STD_JNI_CATCH() return false; } extern "C" -JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_boundingBox(JNIEnv *env, jobject obj, jobject llObj, jobject urObj) +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_boundingBox + (JNIEnv *env, jobject obj, jobject llObj, jobject urObj) { try { - Point2dClassInfo *pt2dClassInfo = Point2dClassInfo::getClassInfo(); - VectorObjectRef *vecObj = VectorObjectClassInfo::getClassInfo()->getObject(env,obj); - Point2d *ll = pt2dClassInfo->getObject(env,llObj); - Point2d *ur = pt2dClassInfo->getObject(env,urObj); - if (!vecObj || !ll || !ur) - return 0.0; - - return (*vecObj)->boundingBox(*ll,*ur); + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto ll = Point2dClassInfo::get(env,llObj)) + if (const auto ur = Point2dClassInfo::get(env,urObj)) + { + return (*vecObj)->boundingBox(*ll,*ur); + } } MAPLY_STD_JNI_CATCH() - return 0.0; + return false; } extern "C" JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_subdivideToGlobeNative - (JNIEnv *env, jobject obj, jobject retObj, jdouble epsilon) + (JNIEnv *env, jobject obj, jobject retObj, jdouble epsilon) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - VectorObjectRef *retVecObj = classInfo->getObject(env,retObj); - if (!vecObj || !retVecObj) - return false; - - *retVecObj = *vecObj; - (*retVecObj)->subdivideToGlobe(epsilon); - - return true; + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto retVec = VectorObjectClassInfo::get(env,retObj)) + { + *retVec = *vecObj; + (*retVec)->subdivideToGlobe(epsilon); + return true; + } } MAPLY_STD_JNI_CATCH() return false; @@ -529,19 +678,16 @@ JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_subdivideToGlob extern "C" JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_subdivideToGlobeGreatCircleNative - (JNIEnv *env, jobject obj, jobject retObj, jdouble epsilon) + (JNIEnv *env, jobject obj, jobject retObj, jdouble epsilon) { try { - const auto classInfo = VectorObjectClassInfo::getClassInfo(); - if (const auto vecObj = classInfo->getObject(env,obj)) + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto retVecObj = VectorObjectClassInfo::get(env, retObj)) { - if (const auto retVecObj = classInfo->getObject(env, retObj)) - { - *retVecObj = *vecObj; - (*retVecObj)->subdivideToGlobeGreatCircle(epsilon); - return true; - } + *retVecObj = *vecObj; + (*retVecObj)->subdivideToGlobeGreatCircle(epsilon); + return true; } } MAPLY_STD_JNI_CATCH() @@ -550,19 +696,16 @@ JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_subdivideToGlob extern "C" JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_subdivideToFlatGreatCircleNative - (JNIEnv *env, jobject obj, jobject retObj, jdouble epsilon) + (JNIEnv *env, jobject obj, jobject retObj, jdouble epsilon) { try { - const auto classInfo = VectorObjectClassInfo::getClassInfo(); - if (const auto vecObj = classInfo->getObject(env,obj)) + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto retVecObj = VectorObjectClassInfo::get(env, retObj)) { - if (const auto retVecObj = classInfo->getObject(env, retObj)) - { - *retVecObj = *vecObj; - (*retVecObj)->subdivideToFlatGreatCircle(epsilon); - return true; - } + *retVecObj = *vecObj; + (*retVecObj)->subdivideToFlatGreatCircle(epsilon); + return true; } } MAPLY_STD_JNI_CATCH() @@ -571,19 +714,16 @@ JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_subdivideToFlat extern "C" JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_subdivideToGlobeGreatCirclePreciseNative - (JNIEnv *env, jobject obj, jobject retObj, jdouble epsilon) + (JNIEnv *env, jobject obj, jobject retObj, jdouble epsilon) { try { - const auto classInfo = VectorObjectClassInfo::getClassInfo(); - if (const auto vecObj = classInfo->getObject(env,obj)) + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto retVecObj = VectorObjectClassInfo::get(env, retObj)) { - if (const auto retVecObj = classInfo->getObject(env, retObj)) - { - *retVecObj = *vecObj; - (*retVecObj)->subdivideToGlobeGreatCirclePrecise(epsilon); - return true; - } + *retVecObj = *vecObj; + (*retVecObj)->subdivideToGlobeGreatCirclePrecise(epsilon); + return true; } } MAPLY_STD_JNI_CATCH() @@ -592,19 +732,16 @@ JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_subdivideToGlob extern "C" JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_subdivideToFlatGreatCirclePreciseNative - (JNIEnv *env, jobject obj, jobject retObj, jdouble epsilon) + (JNIEnv *env, jobject obj, jobject retObj, jdouble epsilon) { try { - const auto classInfo = VectorObjectClassInfo::getClassInfo(); - if (const auto vecObj = classInfo->getObject(env,obj)) + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto retVecObj = VectorObjectClassInfo::get(env, retObj)) { - if (const auto retVecObj = classInfo->getObject(env, retObj)) - { - *retVecObj = *vecObj; - (*retVecObj)->subdivideToFlatGreatCirclePrecise(epsilon); - return true; - } + *retVecObj = *vecObj; + (*retVecObj)->subdivideToFlatGreatCirclePrecise(epsilon); + return true; } } MAPLY_STD_JNI_CATCH() @@ -613,20 +750,17 @@ JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_subdivideToFlat extern "C" JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_tesselateNative - (JNIEnv *env, jobject obj, jobject retObj) + (JNIEnv *env, jobject obj, jobject retObj) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - VectorObjectRef *retVecObj = classInfo->getObject(env,retObj); - if (!vecObj || !retVecObj) - return false; - - VectorObjectRef newVecObj = (*vecObj)->tesselate(); - *retVecObj = newVecObj; - - return true; + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto retVecObj = VectorObjectClassInfo::get(env, retObj)) + { + VectorObjectRef newVecObj = (*vecObj)->tesselate(); + *retVecObj = newVecObj; + return true; + } } MAPLY_STD_JNI_CATCH() return false; @@ -634,20 +768,17 @@ JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_tesselateNative extern "C" JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_clipToGridNative - (JNIEnv *env, jobject obj, jobject retObj, jdouble sizeX, jdouble sizeY) + (JNIEnv *env, jobject obj, jobject retObj, jdouble sizeX, jdouble sizeY) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - VectorObjectRef *retVecObj = classInfo->getObject(env,retObj); - if (!vecObj || !retVecObj) - return false; - - VectorObjectRef newVecObj = (*vecObj)->clipToGrid(Point2d(sizeX,sizeY)); - *retVecObj = newVecObj; - - return true; + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto retVecObj = VectorObjectClassInfo::get(env, retObj)) + { + VectorObjectRef newVecObj = (*vecObj)->clipToGrid(Point2d(sizeX, sizeY)); + *retVecObj = newVecObj; + return true; + } } MAPLY_STD_JNI_CATCH() return false; @@ -655,21 +786,17 @@ JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_clipToGridNativ extern "C" JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_clipToMbrNative - (JNIEnv *env, jobject obj, jobject retObj, jdouble llX, jdouble llY, jdouble urX, jdouble urY) + (JNIEnv *env, jobject obj, jobject retObj, jdouble llX, jdouble llY, jdouble urX, jdouble urY) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - VectorObjectRef *retVecObj = classInfo->getObject(env,retObj); - if (!vecObj || !retVecObj) - return false; - - Point2d ll(llX,llY),ur(urX,urY); - VectorObjectRef newVecObj = (*vecObj)->clipToMbr(ll,ur); - *retVecObj = newVecObj; - - return true; + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto retVecObj = VectorObjectClassInfo::get(env, retObj)) + { + VectorObjectRef newVecObj = (*vecObj)->clipToMbr({llX,llY}, {urX,urY}); + *retVecObj = newVecObj; + return true; + } } MAPLY_STD_JNI_CATCH() return false; @@ -677,24 +804,20 @@ JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_clipToMbrNative extern "C" JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_reprojectNative - (JNIEnv *env, jobject obj, jobject retObj, jobject srcSystemObj, jdouble scale, jobject destSystemObj) + (JNIEnv *env, jobject obj, jobject retObj, jobject srcSystemObj, jdouble scale, jobject destSystemObj) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - VectorObjectRef *retVecObj = classInfo->getObject(env,retObj); - CoordSystemRefClassInfo *coordSystemInfo = CoordSystemRefClassInfo::getClassInfo(); - CoordSystemRef *srcSystem = coordSystemInfo->getObject(env,srcSystemObj); - CoordSystemRef *destSystem = coordSystemInfo->getObject(env,destSystemObj); - if (!vecObj || !retVecObj || !srcSystem || !destSystem) - return false; - - VectorObjectRef newVecObj = (*vecObj)->deepCopy(); - newVecObj->reproject(srcSystem->get(),scale,destSystem->get()); - *retVecObj = newVecObj; - - return true; + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto retVecObj = VectorObjectClassInfo::get(env, retObj)) + if (const auto srcSystem = CoordSystemRefClassInfo::get(env,srcSystemObj)) + if (const auto destSystem = CoordSystemRefClassInfo::get(env,destSystemObj)) + { + VectorObjectRef newVecObj = (*vecObj)->deepCopy(); + newVecObj->reproject(srcSystem->get(), scale, destSystem->get()); + *retVecObj = newVecObj; + return true; + } } MAPLY_STD_JNI_CATCH() return false; @@ -702,20 +825,17 @@ JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_reprojectNative extern "C" JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_filterClippedEdgesNative - (JNIEnv *env, jobject obj, jobject retObj) + (JNIEnv *env, jobject obj, jobject retObj) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - VectorObjectRef *retVecObj = classInfo->getObject(env,retObj); - if (!vecObj || !retVecObj) - return false; - - VectorObjectRef newVecObj = (*vecObj)->filterClippedEdges(); - *retVecObj = newVecObj; - - return true; + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto retVecObj = VectorObjectClassInfo::get(env, retObj)) + { + VectorObjectRef newVecObj = (*vecObj)->filterClippedEdges(); + *retVecObj = newVecObj; + return true; + } } MAPLY_STD_JNI_CATCH() return false; @@ -723,20 +843,17 @@ JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_filterClippedEd extern "C" JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_linearsToArealsNative - (JNIEnv *env, jobject obj, jobject retObj) + (JNIEnv *env, jobject obj, jobject retObj) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - VectorObjectRef *retVecObj = classInfo->getObject(env,retObj); - if (!vecObj || !retVecObj) - return false; - - VectorObjectRef newVecObj = (*vecObj)->linearsToAreals(); - *retVecObj = newVecObj; - - return true; + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto retVecObj = VectorObjectClassInfo::get(env, retObj)) + { + VectorObjectRef newVecObj = (*vecObj)->linearsToAreals(); + *retVecObj = newVecObj; + return true; + } } MAPLY_STD_JNI_CATCH() return false; @@ -744,79 +861,113 @@ JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_linearsToAreals extern "C" JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_arealsToLinearsNative - (JNIEnv *env, jobject obj, jobject retObj) + (JNIEnv *env, jobject obj, jobject retObj) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - VectorObjectRef *retVecObj = classInfo->getObject(env,retObj); - if (!vecObj || !retVecObj) - return false; - - VectorObjectRef newVecObj = (*vecObj)->arealsToLinears(); - *retVecObj = newVecObj; - - return true; + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto retVecObj = VectorObjectClassInfo::get(env, retObj)) + { + VectorObjectRef newVecObj = (*vecObj)->arealsToLinears(); + *retVecObj = newVecObj; + return true; + } } MAPLY_STD_JNI_CATCH() return false; } extern "C" -jboolean Java_com_mousebird_maply_VectorObject_fromGeoJSON(JNIEnv *env, jobject obj, jstring jstr) +jboolean Java_com_mousebird_maply_VectorObject_fromGeoJSON + (JNIEnv *env, jobject obj, jstring jstr) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - if (!vecObj) - return false; - - const char *cStr = env->GetStringUTFChars(jstr,nullptr); - if (!cStr) - return false; - std::string jsonStr(cStr); - env->ReleaseStringUTFChars(jstr, cStr); - - std::string crs; - return (*vecObj)->fromGeoJSON(jsonStr,crs); + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const char *cStr = env->GetStringUTFChars(jstr, nullptr)) + { + std::string jsonStr(cStr); + env->ReleaseStringUTFChars(jstr, cStr); + + std::string crs; + return (*vecObj)->fromGeoJSON(jsonStr, crs); + } } MAPLY_STD_JNI_CATCH() return false; } extern "C" -JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_fromShapeFile(JNIEnv *env, jobject obj, jstring jstr) +JNIEXPORT jobject Java_com_mousebird_maply_VectorObject_createLineString + (JNIEnv* env, jclass, jobjectArray ptsObjs, jobject attrObj) +{ + try + { + if (auto obj = MakeVectorObject(env, std::make_shared())) + { + if (Java_com_mousebird_maply_VectorObject_addLinear(env, obj, ptsObjs)) + { + if (attrObj) + { + Java_com_mousebird_maply_VectorObject_setAttributes(env, obj, attrObj); + } + return obj; + } + } + } + MAPLY_STD_JNI_CATCH() + return nullptr; +} + +extern "C" +JNIEXPORT jobject Java_com_mousebird_maply_VectorObject_createAreal + (JNIEnv* env, jclass, jobjectArray ptsObjs, jobject attrObj) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - if (!vecObj) - return false; + if (auto obj = MakeVectorObject(env, std::make_shared())) + { + if (Java_com_mousebird_maply_VectorObject_addAreal___3Lcom_mousebird_maply_Point2d_2(env, obj, ptsObjs)) + { + if (attrObj) + { + Java_com_mousebird_maply_VectorObject_setAttributes(env, obj, attrObj); + } + return obj; + } + } + } + MAPLY_STD_JNI_CATCH() + return nullptr; +} - const char *cStr = env->GetStringUTFChars(jstr,nullptr); - if (!cStr) - return false; - std::string jsonStr(cStr); - env->ReleaseStringUTFChars(jstr, cStr); +extern "C" +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_fromShapeFile + (JNIEnv *env, jobject obj, jstring jstr) +{ + try + { + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const char *cStr = env->GetStringUTFChars(jstr, nullptr)) + { + std::string jsonStr(cStr); + env->ReleaseStringUTFChars(jstr, cStr); - return (*vecObj)->fromShapeFile(jsonStr); + return (*vecObj)->fromShapeFile(jsonStr); + } } MAPLY_STD_JNI_CATCH() return false; } -/* - * Class: com_mousebird_maply_VectorObject - * Method: canSplit - * Signature: ()Z - */ extern "C" -JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_canSplit(JNIEnv *env, jobject obj) { - try { - if (auto vecObjPtr = VectorObjectClassInfo::getClassInfo()->getObject(env,obj)) { +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_canSplit + (JNIEnv *env, jobject obj) +{ + try + { + if (auto vecObjPtr = VectorObjectClassInfo::get(env,obj)) + { return ((*vecObjPtr)->shapes.size() > 1); } } @@ -826,47 +977,47 @@ JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_VectorObject_canSplit(JNIEnv extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_VectorObject_deepCopyNative - (JNIEnv *env, jobject obj, jobject destObj) + (JNIEnv *env, jobject obj, jobject destObj) { try { - VectorObjectClassInfo *classInfo = VectorObjectClassInfo::getClassInfo(); - VectorObjectRef *vecObj = classInfo->getObject(env,obj); - VectorObjectRef *destVecObj = classInfo->getObject(env,destObj); - if (!vecObj || !destVecObj) - return; - - VectorObjectRef newVecObj = (*vecObj)->deepCopy(); - *destVecObj = newVecObj; + if (const auto vecObj = VectorObjectClassInfo::get(env,obj)) + if (const auto destVecObj = VectorObjectClassInfo::get(env, destObj)) + { + VectorObjectRef newVecObj = (*vecObj)->deepCopy(); + *destVecObj = newVecObj; + } } MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_FromGeoJSONAssembly(JNIEnv *env, jclass /*vecObjClass*/, jstring jstr) +JNIEXPORT jobject JNICALL Java_com_mousebird_maply_VectorObject_FromGeoJSONAssembly + (JNIEnv *env, jclass /*vecObjClass*/, jstring jstr) { try { - const char *cStr = env->GetStringUTFChars(jstr,nullptr); - if (!cStr) - return nullptr; - std::string jsonStr(cStr); - env->ReleaseStringUTFChars(jstr, cStr); - - std::map vecData; - if (VectorObject::FromGeoJSONAssembly(jsonStr,vecData)) + if (const char *cStr = env->GetStringUTFChars(jstr,nullptr)) { - JavaHashMapInfo *hashMapClassInfo = JavaHashMapInfo::getClassInfo(env); - jobject hashMap = hashMapClassInfo->makeHashMap(env); - for (const auto &kvp : vecData) - { - jstring key = env->NewStringUTF(kvp.first.c_str()); - jobject vecObj = MakeVectorObject(env,VectorObjectRef(kvp.second)); - hashMapClassInfo->addObject(env, hashMap, key, vecObj); - } - - return hashMap; - } + std::string jsonStr(cStr); + env->ReleaseStringUTFChars(jstr, cStr); + + std::map vecData; + if (VectorObject::FromGeoJSONAssembly(jsonStr, vecData)) + { + JavaHashMapInfo *hashMapClassInfo = JavaHashMapInfo::getClassInfo(env); + jobject hashMap = hashMapClassInfo->makeHashMap(env); + for (const auto &kvp : vecData) + { + if (jstring key = env->NewStringUTF(kvp.first.c_str())) + if (jobject vecObj = MakeVectorObject(env, kvp.second)) + { + hashMapClassInfo->addObject(env, hashMap, key, vecObj); + } + } + return hashMap; + } + } } MAPLY_STD_JNI_CATCH() return nullptr; diff --git a/android/library/maply/jni/src/vectors/WideVectorInfo_jni.cpp b/android/library/maply/jni/src/vectors/WideVectorInfo_jni.cpp index 12d369b273..04ac1220c3 100644 --- a/android/library/maply/jni/src/vectors/WideVectorInfo_jni.cpp +++ b/android/library/maply/jni/src/vectors/WideVectorInfo_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/8/17. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ template<> WideVectorInfoClassInfo *WideVectorInfoClassInfo::classInfoObj = null extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_nativeInit -(JNIEnv *env, jclass cls) + (JNIEnv *env, jclass cls) { WideVectorInfoClassInfo::getClassInfo(env,cls); } @@ -38,163 +38,321 @@ JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_initialise { try { - WideVectorInfoRef *vecInfo = new WideVectorInfoRef(new WideVectorInfo()); - WideVectorInfoClassInfo::getClassInfo()->setHandle(env,obj,vecInfo); - } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in WideVectorInfo::initialise()"); + WideVectorInfoClassInfo::set(env, obj, new WideVectorInfoRef(std::make_shared())); } + MAPLY_STD_JNI_CATCH() } static std::mutex disposeMutex; extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_dispose -(JNIEnv *env, jobject obj) + (JNIEnv *env, jobject obj) { try { WideVectorInfoClassInfo *classInfo = WideVectorInfoClassInfo::getClassInfo(); - { - std::lock_guard lock(disposeMutex); - WideVectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - delete vecInfo; - - classInfo->clearHandle(env,obj); - } - } - catch (...) - { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in WideVectorInfo::dispose()"); + std::lock_guard lock(disposeMutex); + delete classInfo->getObject(env,obj); + classInfo->clearHandle(env,obj); } + MAPLY_STD_JNI_CATCH() } extern "C" -JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_setColor -(JNIEnv *env, jobject obj, jfloat r, jfloat g, jfloat b, jfloat a) +JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_setColorInt + (JNIEnv *env, jobject obj, jint r, jint g, jint b, jint a) { try { - WideVectorInfoClassInfo *classInfo = WideVectorInfoClassInfo::getClassInfo(); - WideVectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->color = RGBAColor(r*255.0,g*255.0,b*255.0,a*255.0); + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->color = RGBAColor(r,g,b,a); + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jint JNICALL Java_com_mousebird_maply_WideVectorInfo_getColor + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in WideVectorInfo::setColor()"); + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->color.asARGBInt(); + } } + MAPLY_STD_JNI_CATCH() + return 0; +} + +extern "C" +JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_setColor + (JNIEnv *env, jobject obj, jfloat r, jfloat g, jfloat b, jfloat a) +{ + Java_com_mousebird_maply_WideVectorInfo_setColorInt(env, obj, + (jint)(r*255.0f),(jint)(g*255.0f),(jint)(b*255.0f),(jint)(a*255.0f)); } extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_setLineWidth -(JNIEnv *env, jobject obj, jfloat val) + (JNIEnv *env, jobject obj, jfloat val) { try { - WideVectorInfoClassInfo *classInfo = WideVectorInfoClassInfo::getClassInfo(); - WideVectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->width = val; + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->width = val; + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jfloat JNICALL Java_com_mousebird_maply_WideVectorInfo_getLineWidth + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in WideVectorInfo::setLineWidth()"); + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->width; + } } + MAPLY_STD_JNI_CATCH() + return 0.0f; } extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_setTextureRepeatLength -(JNIEnv *env, jobject obj, jdouble repeatLen) + (JNIEnv *env, jobject obj, jdouble repeatLen) { try { - WideVectorInfoClassInfo *classInfo = WideVectorInfoClassInfo::getClassInfo(); - WideVectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->repeatSize = repeatLen; + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->repeatSize = repeatLen; + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jdouble JNICALL Java_com_mousebird_maply_WideVectorInfo_getTextureRepeatLength + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in WideVectorInfo::setTextureRepeatLength()"); + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->repeatSize; + } } + MAPLY_STD_JNI_CATCH() + return 0.0; } extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_setEdgeFalloff -(JNIEnv *env, jobject obj, jdouble edgeFalloff) + (JNIEnv *env, jobject obj, jdouble edgeFalloff) { try { - WideVectorInfoClassInfo *classInfo = WideVectorInfoClassInfo::getClassInfo(); - WideVectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->edgeSize = edgeFalloff; + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->edgeSize = edgeFalloff; + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jdouble JNICALL Java_com_mousebird_maply_WideVectorInfo_getEdgeFalloff + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in WideVectorInfo::setEdgeFalloff()"); + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->edgeSize; + } } + MAPLY_STD_JNI_CATCH() + return 0.0; } extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_setJoinTypeNative -(JNIEnv *env, jobject obj, jint joinType) + (JNIEnv *env, jobject obj, jint joinType) { try { - WideVectorInfoClassInfo *classInfo = WideVectorInfoClassInfo::getClassInfo(); - WideVectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->joinType = (WideVectorLineJoinType)joinType; + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->joinType = (WideVectorLineJoinType)joinType; + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jint JNICALL Java_com_mousebird_maply_WideVectorInfo_getJoinTypeNative + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in WideVectorInfo::setJoinTypeNative()"); + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->joinType; + } } + MAPLY_STD_JNI_CATCH() + return 0; } extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_setMitreLimit -(JNIEnv *env, jobject obj, jdouble mitreLimit) + (JNIEnv *env, jobject obj, jdouble mitreLimit) { try { - WideVectorInfoClassInfo *classInfo = WideVectorInfoClassInfo::getClassInfo(); - WideVectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->miterLimit = mitreLimit; + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->miterLimit = mitreLimit; + } } - catch (...) + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jdouble JNICALL Java_com_mousebird_maply_WideVectorInfo_getMitreLimit + (JNIEnv *env, jobject obj) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in WideVectorInfo::setMitreLimit()"); + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->miterLimit; + } } + MAPLY_STD_JNI_CATCH() + return 0.0; } extern "C" JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_setTexID -(JNIEnv *env, jobject obj, jlong texID) + (JNIEnv *env, jobject obj, jlong texID) { try { - WideVectorInfoClassInfo *classInfo = WideVectorInfoClassInfo::getClassInfo(); - WideVectorInfoRef *vecInfo = classInfo->getObject(env,obj); - if (!vecInfo) - return; - (*vecInfo)->texID = texID; + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->texID = texID; + } + } + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jlong JNICALL Java_com_mousebird_maply_WideVectorInfo_getTexID + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->texID; + } + } + MAPLY_STD_JNI_CATCH() + return EmptyIdentity; +} + +extern "C" +JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_setSelectable + (JNIEnv *env, jobject obj, jboolean enable) +{ + try + { + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->selectable = enable; + } + } + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_WideVectorInfo_getSelectable + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->selectable; + } + } + MAPLY_STD_JNI_CATCH() + return false; +} + +extern "C" +JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_setOffset + (JNIEnv *env, jobject obj, jdouble offset) +{ + try + { + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->offset = offset; + } + } + MAPLY_STD_JNI_CATCH() +} + +extern "C" +JNIEXPORT jdouble JNICALL Java_com_mousebird_maply_WideVectorInfo_getOffset + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->offset; + } } - catch (...) + MAPLY_STD_JNI_CATCH() + return 0.0; +} + +extern "C" +JNIEXPORT void JNICALL Java_com_mousebird_maply_WideVectorInfo_setCloseAreals + (JNIEnv *env, jobject obj, jboolean close) +{ + try { - __android_log_print(ANDROID_LOG_VERBOSE, "Maply", "Crash in WideVectorInfo::setTexId()"); + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + (*vecInfo)->closeAreals = close; + } } + MAPLY_STD_JNI_CATCH() } +extern "C" +JNIEXPORT jboolean JNICALL Java_com_mousebird_maply_WideVectorInfo_getCloseAreals + (JNIEnv *env, jobject obj) +{ + try + { + if (const auto vecInfo = WideVectorInfoClassInfo::get(env,obj)) + { + return (*vecInfo)->closeAreals; + } + } + MAPLY_STD_JNI_CATCH() + return false; +} diff --git a/android/library/maply/jni/src/vectors/WideVectorManager_jni.cpp b/android/library/maply/jni/src/vectors/WideVectorManager_jni.cpp index 776a3708f5..4f8973b41b 100644 --- a/android/library/maply/jni/src/vectors/WideVectorManager_jni.cpp +++ b/android/library/maply/jni/src/vectors/WideVectorManager_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/8/17. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/view/FlatView_jni.cpp b/android/library/maply/jni/src/view/FlatView_jni.cpp index 29baa63fb7..db0ac2d18b 100644 --- a/android/library/maply/jni/src/view/FlatView_jni.cpp +++ b/android/library/maply/jni/src/view/FlatView_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/19/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/view/GlobeViewState_jni.cpp b/android/library/maply/jni/src/view/GlobeViewState_jni.cpp index c72f9b6c60..ea3727a71f 100644 --- a/android/library/maply/jni/src/view/GlobeViewState_jni.cpp +++ b/android/library/maply/jni/src/view/GlobeViewState_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/17/15. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/view/GlobeView_jni.cpp b/android/library/maply/jni/src/view/GlobeView_jni.cpp index bd09d3d3f7..aa69ae16e3 100644 --- a/android/library/maply/jni/src/view/GlobeView_jni.cpp +++ b/android/library/maply/jni/src/view/GlobeView_jni.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/17/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/view/MapViewState_jni.cpp b/android/library/maply/jni/src/view/MapViewState_jni.cpp index c8a99ea2ba..75ffe001d3 100644 --- a/android/library/maply/jni/src/view/MapViewState_jni.cpp +++ b/android/library/maply/jni/src/view/MapViewState_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/17/15. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/view/MapView_jni.cpp b/android/library/maply/jni/src/view/MapView_jni.cpp index 3bd1f5c23b..fccafad9b6 100644 --- a/android/library/maply/jni/src/view/MapView_jni.cpp +++ b/android/library/maply/jni/src/view/MapView_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/view/ViewState_jni.cpp b/android/library/maply/jni/src/view/ViewState_jni.cpp index f2e77f1969..d41ec69fe3 100644 --- a/android/library/maply/jni/src/view/ViewState_jni.cpp +++ b/android/library/maply/jni/src/view/ViewState_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/jni/src/view/View_jni.cpp b/android/library/maply/jni/src/view/View_jni.cpp index 1082185335..159f5bb974 100644 --- a/android/library/maply/jni/src/view/View_jni.cpp +++ b/android/library/maply/jni/src/view/View_jni.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/17/15. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ActiveObject.java b/android/library/maply/src/main/java/com/mousebird/maply/ActiveObject.java index 3d5df4189c..556c755507 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ActiveObject.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ActiveObject.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/20/15. - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/AngleAxis.java b/android/library/maply/src/main/java/com/mousebird/maply/AngleAxis.java index c5195c8d4b..2fffaf0c77 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/AngleAxis.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/AngleAxis.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/20/15. - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Atmosphere.java b/android/library/maply/src/main/java/com/mousebird/maply/Atmosphere.java index 7ef6b310d4..66e6781c91 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Atmosphere.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Atmosphere.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/AttrDictionary.java b/android/library/maply/src/main/java/com/mousebird/maply/AttrDictionary.java index 9681436e63..f293dcb273 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/AttrDictionary.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/AttrDictionary.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/AttrDictionaryEntry.java b/android/library/maply/src/main/java/com/mousebird/maply/AttrDictionaryEntry.java index ea3a9e3707..69a6761d59 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/AttrDictionaryEntry.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/AttrDictionaryEntry.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/BaseController.java b/android/library/maply/src/main/java/com/mousebird/maply/BaseController.java index c553c5ba2b..bd24cc79dc 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/BaseController.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/BaseController.java @@ -1141,6 +1141,45 @@ public void setClearColor(int color) renderControl.setClearColor(color); } + /** + * Set the representation for a set of unique features + * @param repName The representation name to set + * @param uuids Unique identifiers of the elements to update + */ + public void setRepresentation(String repName, String[] uuids) { + setRepresentation(repName, null, uuids, ThreadMode.ThreadCurrent); + } + + /** + * Set the representation for a set of unique features + * @param repName The representation name to set + * @param uuids Unique identifiers of the elements to update + * @param mode The thread mode to use + */ + public void setRepresentation(String repName, String[] uuids, RenderController.ThreadMode mode) { + setRepresentation(repName, null, uuids, mode); + } + + /** + * Set the representation for a set of unique features + * @param repName The representation name to set + * @param fallbackName The representation to show when no others match (typically blank/null) + * @param uuids Unique identifiers of the elements to update + * @param mode The thread mode to use + */ + public void setRepresentation(final String repName, final String fallbackName, + final String[] uuids, final RenderController.ThreadMode mode) + { + addTask(() -> { + final ComponentManager compMan = renderControl.componentManager; + if (compMan != null && uuids != null && uuids.length > 0) { + final ChangeSet changes = new ChangeSet(); + compMan.setRepresentation(repName, fallbackName, uuids, changes); + processChangeSet(changes); + } + }, mode); + } + /** * Set the viewport the user is allowed to move within. * These are lat/lon coordinates in radians. @@ -1167,6 +1206,26 @@ public void setViewExtents(final Point2d ll,final Point2d ur) } } + /** + * Return the extents of the current view + */ + public Mbr getCurrentViewExtents() { + final com.mousebird.maply.View view = this.view; + RenderController rc = renderControl; + if (view != null && rc != null) { + CoordSystemDisplayAdapter coordAdapter = view.getCoordAdapter(); + if (coordAdapter != null) { + final CoordSystem coordSys = coordAdapter.getCoordSystem(); + if (coordSys != null) { + final Point2d ll = new Point2d(0, rc.frameSize.getY()); + final Point2d ur = new Point2d(rc.frameSize.getX(), 0); + return new Mbr(geoPointFromScreen(ll), geoPointFromScreen(ur)); + } + } + } + return new Mbr(); + } + /** * Batch version of the screenPointFromGeo method. This version is here for users to * convert a whole group of coordinates all at once. Doing it individually is just @@ -1283,11 +1342,12 @@ public interface ZoomAnimationEasing { /** Set the function used for animating zoom heights */ - public void setZoomAnimationEasing(ZoomAnimationEasing easing) { + public void setZoomAnimationEasing(@Nullable ZoomAnimationEasing easing) { zoomAnimationEasing = easing; } /** Get the function used for animating zoom heights */ + @Nullable public ZoomAnimationEasing getZoomAnimationEasing() { return zoomAnimationEasing; } @@ -1342,7 +1402,8 @@ public QuadSamplingLayer findSamplingLayer(SamplingParams params,final QuadSampl QuadSamplingLayer theLayer = null; for (QuadSamplingLayer layer : samplingLayers) { - if (layer.params.equals(params)) { + // Layers being shut down should already be removed, but check anyway. + if (layer.params.equals(params) && !layer.isShuttingDown) { theLayer = layer; break; } @@ -1353,7 +1414,7 @@ public QuadSamplingLayer findSamplingLayer(SamplingParams params,final QuadSampl theLayer = new QuadSamplingLayer(this,params); // On its own layer thread - LayerThread layerThread = makeLayerThread(true); + final LayerThread layerThread = makeLayerThread(true); if (layerThread == null) { return null; } @@ -1380,26 +1441,31 @@ public void releaseSamplingLayer(final QuadSamplingLayer samplingLayer,final Qua if (!samplingLayers.contains(samplingLayer)) return; - // Do the remove client on the layer thread + // If we're the last client, we expect to remove the sampling layer after disconnecting, + // but we have to do thread transitions during which a `findSamplingLayer` call could queue + // up an `addClient` call, causing us to delete the layer after being connected, cancelling + // any activity in that new client. + // To prevent that, remove it from the list of available sampling layers now. + final int remainingClients = samplingLayer.getNumClients() - 1; + if (remainingClients == 0) { + samplingLayers.remove(samplingLayer); + } + + // Do the remove client on the layer thread itself samplingLayer.layerThread.addTask(() -> { samplingLayer.removeClient(user); - // Get rid of the sampling layer too - if (samplingLayer.getNumClients() == 0) { - // But that has to be done on the main thread - BaseController control = samplingLayer.control.get(); - if (control != null) { - Activity activity = control.getActivity(); - Looper looper = (activity != null) ? activity.getMainLooper() : null; - Handler handler = new Handler((looper != null) ? looper : Looper.getMainLooper()); - handler.post(() -> { - // Someone maybe started using it - if (samplingLayer.getNumClients() == 0) { - removeLayerThread(samplingLayer.layerThread); - samplingLayers.remove(samplingLayer); - } - }); - } + // If we were the last client, switch back to the main thread to remove the layer + if (remainingClients == 0) { + newMainLooperHandler().post(() -> { + // It shouldn't be possible to add clients, but check one more time, just in case + if (samplingLayer.getNumClients() == 0) { + removeLayerThread(samplingLayer.layerThread); + } else { + Log.w("Maply", "Unexpected sampling layer attach"); + samplingLayers.add(samplingLayer); + } + }); } }); } @@ -2515,9 +2581,10 @@ public int[] getFrameBufferSize() { return renderControl.getFrameBufferSize(); } - public void processChangeSet(ChangeSet changes) - { - changes.process(renderControl, scene); + public void processChangeSet(ChangeSet changes) { + if (scene != null) { + changes.process(renderControl, scene); + } changes.dispose(); } diff --git a/android/library/maply/src/main/java/com/mousebird/maply/BaseInfo.java b/android/library/maply/src/main/java/com/mousebird/maply/BaseInfo.java index 9824dfb035..b559507982 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/BaseInfo.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/BaseInfo.java @@ -93,7 +93,7 @@ public void setMaxVis(double maxVis) /** * @return The Z offset for geometry. Rarely used anymore. */ - public native double getDrawOffset(); + public native float getDrawOffset(); /** * Set the drawPriority for the geometry. Draw priority controls the order diff --git a/android/library/maply/src/main/java/com/mousebird/maply/BasicClusterGenerator.java b/android/library/maply/src/main/java/com/mousebird/maply/BasicClusterGenerator.java index 6e577ac7e4..27dcdc83c5 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/BasicClusterGenerator.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/BasicClusterGenerator.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Billboard.java b/android/library/maply/src/main/java/com/mousebird/maply/Billboard.java index 8f5698b724..8b118ec8c8 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Billboard.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Billboard.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/BillboardInfo.java b/android/library/maply/src/main/java/com/mousebird/maply/BillboardInfo.java index d9dcc8971f..a96f44dd49 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/BillboardInfo.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/BillboardInfo.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/BillboardManager.java b/android/library/maply/src/main/java/com/mousebird/maply/BillboardManager.java index 4cf806c002..78b75b9524 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/BillboardManager.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/BillboardManager.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ChangeSet.java b/android/library/maply/src/main/java/com/mousebird/maply/ChangeSet.java index a6abdd203d..72c3970171 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ChangeSet.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ChangeSet.java @@ -1,9 +1,8 @@ -/* - * ChangeSet.java +/* ChangeSet.java * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package com.mousebird.maply; @@ -25,12 +23,10 @@ * track visual changes in the map or globe. Most of the action * takes place behind the scenes and users of the Maply API should * not be manipulating these. - * */ public class ChangeSet { - public ChangeSet() - { + public ChangeSet() { initialise(); } @@ -50,17 +46,19 @@ public ChangeSet() // Create whatever objects want to be created. // We're assuming a valid EGL context is in place public native void process(RenderController renderControl,Scene scene); - - static - { + + public native int count(); + public boolean any() { return count() > 0; } + + static { nativeInit(); } private static native void nativeInit(); - public void finalize() - { + public void finalize() { dispose(); } native void initialise(); - native void dispose(); - private long nativeHandle; + native void dispose(); + @SuppressWarnings("unused") // Used by JNI + private long nativeHandle; } diff --git a/android/library/maply/src/main/java/com/mousebird/maply/CharRenderer.java b/android/library/maply/src/main/java/com/mousebird/maply/CharRenderer.java index 03c6087a94..49750f95be 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/CharRenderer.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/CharRenderer.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ClusterGenerator.java b/android/library/maply/src/main/java/com/mousebird/maply/ClusterGenerator.java index 56bf79df7f..70477d58f9 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ClusterGenerator.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ClusterGenerator.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ClusterGroup.java b/android/library/maply/src/main/java/com/mousebird/maply/ClusterGroup.java index aa832e6b70..5366b2636c 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ClusterGroup.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ClusterGroup.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ClusterInfo.java b/android/library/maply/src/main/java/com/mousebird/maply/ClusterInfo.java index badd2a1e40..4236eff3e6 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ClusterInfo.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ClusterInfo.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ComponentManager.java b/android/library/maply/src/main/java/com/mousebird/maply/ComponentManager.java index 1e95de1660..2d5d37da9e 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ComponentManager.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ComponentManager.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/18/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import com.mousebirdconsulting.whirlyglobemaply.BuildConfig; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -154,6 +155,11 @@ public SelectedObject[] findVectors(Point2d geoPt, double maxDist, ViewState vie public native SelectedObject[] findVectors(Point2d geoPt, double maxDist, ViewState viewState, Point2d frameSize, int limit); + /** + * Set the representation for a set of unique features + */ + public native void setRepresentation(String repName, String fallbackName, String[] uuids, ChangeSet changes); + static { nativeInit(); } diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ComponentObject.java b/android/library/maply/src/main/java/com/mousebird/maply/ComponentObject.java index 06203d34a6..959f906d12 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ComponentObject.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ComponentObject.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/CoordSystem.java b/android/library/maply/src/main/java/com/mousebird/maply/CoordSystem.java index 463c3be561..f6dfcbddd1 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/CoordSystem.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/CoordSystem.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/CoordSystemDisplayAdapter.java b/android/library/maply/src/main/java/com/mousebird/maply/CoordSystemDisplayAdapter.java index 57f94076ae..71d6c049ba 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/CoordSystemDisplayAdapter.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/CoordSystemDisplayAdapter.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/DebugImageLoaderInterpreter.java b/android/library/maply/src/main/java/com/mousebird/maply/DebugImageLoaderInterpreter.java index 9fbdaa8dbb..3ff1982e76 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/DebugImageLoaderInterpreter.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/DebugImageLoaderInterpreter.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 3/20/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/DirectionalLight.java b/android/library/maply/src/main/java/com/mousebird/maply/DirectionalLight.java index 4494db47b7..873d738adf 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/DirectionalLight.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/DirectionalLight.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/FakeGeocentricDisplayAdapter.java b/android/library/maply/src/main/java/com/mousebird/maply/FakeGeocentricDisplayAdapter.java index 696ee94de8..5d78e2a681 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/FakeGeocentricDisplayAdapter.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/FakeGeocentricDisplayAdapter.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/18/15. - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/FlatView.java b/android/library/maply/src/main/java/com/mousebird/maply/FlatView.java index ff2d268034..5889933870 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/FlatView.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/FlatView.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/19/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/GeoCoordSystem.java b/android/library/maply/src/main/java/com/mousebird/maply/GeoCoordSystem.java index 10e4875304..ad8b280ac6 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/GeoCoordSystem.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/GeoCoordSystem.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/18/15. - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/GeoJSONSource.java b/android/library/maply/src/main/java/com/mousebird/maply/GeoJSONSource.java index cda6e4ecfd..9d98f20b7e 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/GeoJSONSource.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/GeoJSONSource.java @@ -2,7 +2,7 @@ * GeoJSONSource.java * WhirlyGlobeLib * - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/GeometryUtils.java b/android/library/maply/src/main/java/com/mousebird/maply/GeometryUtils.java index e4aa2eafe7..048e44e8fd 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/GeometryUtils.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/GeometryUtils.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/GlobeAnimateMomentum.java b/android/library/maply/src/main/java/com/mousebird/maply/GlobeAnimateMomentum.java index 0aea2bfe91..19c6b9f6f9 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/GlobeAnimateMomentum.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/GlobeAnimateMomentum.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/20/15. - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/GlobeAnimateRotation.java b/android/library/maply/src/main/java/com/mousebird/maply/GlobeAnimateRotation.java index 5de8efd25f..3240f54944 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/GlobeAnimateRotation.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/GlobeAnimateRotation.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/21/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/GlobeController.java b/android/library/maply/src/main/java/com/mousebird/maply/GlobeController.java index 2cb5417618..df2475c8fd 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/GlobeController.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/GlobeController.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/17/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/GlobeGestureHandler.java b/android/library/maply/src/main/java/com/mousebird/maply/GlobeGestureHandler.java index ecb1a17857..6cbe5e98e5 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/GlobeGestureHandler.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/GlobeGestureHandler.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/17/15. - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/GlobeView.java b/android/library/maply/src/main/java/com/mousebird/maply/GlobeView.java index f8b3625c56..93aec27d17 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/GlobeView.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/GlobeView.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/13/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/GlobeViewState.java b/android/library/maply/src/main/java/com/mousebird/maply/GlobeViewState.java index e1f4c7308c..255a1aa1dc 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/GlobeViewState.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/GlobeViewState.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/17/15. - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Identifiable.java b/android/library/maply/src/main/java/com/mousebird/maply/Identifiable.java index 04e60a20cc..d684d0f6a2 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Identifiable.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Identifiable.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/22/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ImageLoaderInterpreter.java b/android/library/maply/src/main/java/com/mousebird/maply/ImageLoaderInterpreter.java index 388acda356..a66b443e20 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ImageLoaderInterpreter.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ImageLoaderInterpreter.java @@ -1,9 +1,8 @@ -/* - * ImageLoaderInterpreter.java +/* ImageLoaderInterpreter.java * WhirlyGlobeLib * * Created by jmnavarro on 3/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package com.mousebird.maply; @@ -24,10 +22,12 @@ import android.graphics.BitmapFactory; import android.os.Build; +import androidx.annotation.NonNull; + import java.lang.reflect.Field; /** - * Image loader intrepreter turns data objects into ImageTiles. + * Image loader interpreter turns data objects into ImageTiles. * * This is the default interpreter used by the QuadImageLoader. */ @@ -68,7 +68,7 @@ public void dataForTile(LoaderReturn inLoadReturn,QuadLoaderBase loader) ImageLoaderReturn loadReturn = (ImageLoaderReturn)inLoadReturn; BitmapFactory.Options options = new BitmapFactory.Options(); -// options.inScaled = false; + //options.inScaled = false; if (hasPremultiplyOption && usePremultiply) options.inPremultiplied = false; @@ -85,4 +85,10 @@ public void dataForTile(LoaderReturn inLoadReturn,QuadLoaderBase loader) } } + /** + * Some tiles were just removed. + */ + @Override + public void tilesUnloaded(@NonNull TileID[] ids) { + } } diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ImageLoaderReturn.java b/android/library/maply/src/main/java/com/mousebird/maply/ImageLoaderReturn.java index 2bd31b8fce..911c3ca9ca 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ImageLoaderReturn.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ImageLoaderReturn.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ImageTile.java b/android/library/maply/src/main/java/com/mousebird/maply/ImageTile.java index 816b1dc7cc..f984845431 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ImageTile.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ImageTile.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/InternalLabel.java b/android/library/maply/src/main/java/com/mousebird/maply/InternalLabel.java index 5571d616fd..000835d91d 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/InternalLabel.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/InternalLabel.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/InternalMarker.java b/android/library/maply/src/main/java/com/mousebird/maply/InternalMarker.java index 8f487a00a6..297af1243d 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/InternalMarker.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/InternalMarker.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/LabelInfo.java b/android/library/maply/src/main/java/com/mousebird/maply/LabelInfo.java index 46d5b4df80..54c1fdd892 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/LabelInfo.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/LabelInfo.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/LabelManager.java b/android/library/maply/src/main/java/com/mousebird/maply/LabelManager.java index 37296dd04f..b6eb3632b7 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/LabelManager.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/LabelManager.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Layer.java b/android/library/maply/src/main/java/com/mousebird/maply/Layer.java index 2ce7765786..93d847d1a9 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Layer.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Layer.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/LayerThread.java b/android/library/maply/src/main/java/com/mousebird/maply/LayerThread.java index 5fc9d1d896..a7dd4092ca 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/LayerThread.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/LayerThread.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,8 @@ import com.mousebirdconsulting.whirlyglobemaply.BuildConfig; +import org.jetbrains.annotations.NotNull; + import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; @@ -90,6 +92,11 @@ public interface ViewWatcherInterface * How long the layer can go without a viewUpdated() call. */ float getMaxLagTime(); + + /** + * Some tiles were just removed + */ + void tilesUnloaded(@NotNull TileID[] ids); } // If set, this is a full layer thread. If not, it just has the context diff --git a/android/library/maply/src/main/java/com/mousebird/maply/LayoutLayer.java b/android/library/maply/src/main/java/com/mousebird/maply/LayoutLayer.java index 74fdf47218..0736d84b3e 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/LayoutLayer.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/LayoutLayer.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,8 @@ import android.os.Handler; +import androidx.annotation.NonNull; + import java.lang.ref.WeakReference; /** @@ -100,6 +102,13 @@ public float getMaxLagTime() { return 1.0f; } + /** + * Some tiles were just removed + */ + @Override + public void tilesUnloaded(@NonNull TileID[] ids) { + } + public void addClusterGenerator(ClusterGenerator generator) { final Point2d clusterSize = generator.clusterLayoutSize(); synchronized (this) { diff --git a/android/library/maply/src/main/java/com/mousebird/maply/LayoutManager.java b/android/library/maply/src/main/java/com/mousebird/maply/LayoutManager.java index cb81ca1fc5..03cd147924 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/LayoutManager.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/LayoutManager.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Light.java b/android/library/maply/src/main/java/com/mousebird/maply/Light.java index 2ddd4b777d..15c0ca7faa 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Light.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Light.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/LoaderInterpreter.java b/android/library/maply/src/main/java/com/mousebird/maply/LoaderInterpreter.java index 9f4d012635..d2acfb5443 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/LoaderInterpreter.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/LoaderInterpreter.java @@ -1,9 +1,8 @@ -/* - * LoaderInterpreter +/* LoaderInterpreter * WhirlyGlobeLib * * Created by Steve Gifford on 3/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +14,10 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package com.mousebird.maply; +import org.jetbrains.annotations.NotNull; /** * Loader Interpreter converts raw data into images and objects. @@ -33,7 +32,7 @@ public interface LoaderInterpreter * * If you need to tweak loader settings, do it here. */ - public void setLoader(QuadLoaderBase loader); + void setLoader(QuadLoaderBase loader); /** * Parse the data coming back from a remote request and turn it into something we can use. @@ -41,5 +40,10 @@ public interface LoaderInterpreter * Convert the data passed in to image and component objects (e.g. add stuff to the visuals). * Everything added should be disabled to start. */ - public void dataForTile(LoaderReturn loadReturn,QuadLoaderBase loader); + void dataForTile(LoaderReturn loadReturn,QuadLoaderBase loader); + + /** + * Some tiles were just removed. + */ + void tilesUnloaded(@NotNull TileID[] ids); } diff --git a/android/library/maply/src/main/java/com/mousebird/maply/LoaderReturn.java b/android/library/maply/src/main/java/com/mousebird/maply/LoaderReturn.java index fe5bfe6ee3..0ef245c4d7 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/LoaderReturn.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/LoaderReturn.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/LocationSimulatorDelegate.kt b/android/library/maply/src/main/java/com/mousebird/maply/LocationSimulatorDelegate.kt index e66e4e4ef5..4cf3acf7fa 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/LocationSimulatorDelegate.kt +++ b/android/library/maply/src/main/java/com/mousebird/maply/LocationSimulatorDelegate.kt @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Tim Sylvester - * Copyright 2021 mousebird consulting + * Copyright 2021-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/LocationTracker.kt b/android/library/maply/src/main/java/com/mousebird/maply/LocationTracker.kt index bdfe7dfc36..9ac2db2d1f 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/LocationTracker.kt +++ b/android/library/maply/src/main/java/com/mousebird/maply/LocationTracker.kt @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Tim Sylvester - * Copyright 2021 mousebird consulting + * Copyright 2021-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/LocationTrackerDelegate.kt b/android/library/maply/src/main/java/com/mousebird/maply/LocationTrackerDelegate.kt index 3952575078..f2d4bf3676 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/LocationTrackerDelegate.kt +++ b/android/library/maply/src/main/java/com/mousebird/maply/LocationTrackerDelegate.kt @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Tim Sylvester - * Copyright 2021 mousebird consulting + * Copyright 2021-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/LocationTrackerPoint.kt b/android/library/maply/src/main/java/com/mousebird/maply/LocationTrackerPoint.kt index c5e58128d9..145641f71f 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/LocationTrackerPoint.kt +++ b/android/library/maply/src/main/java/com/mousebird/maply/LocationTrackerPoint.kt @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Tim Sylvester - * Copyright 2021 mousebird consulting + * Copyright 2021-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/LoftedPolyManager.java b/android/library/maply/src/main/java/com/mousebird/maply/LoftedPolyManager.java index e45d9510ac..52fff4ce97 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/LoftedPolyManager.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/LoftedPolyManager.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/4/19. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MBTileFetcher.java b/android/library/maply/src/main/java/com/mousebird/maply/MBTileFetcher.java index fc3fa8a59a..c16acbdbfe 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MBTileFetcher.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MBTileFetcher.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 3/21/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MBTiles.java b/android/library/maply/src/main/java/com/mousebird/maply/MBTiles.java index 83ae0543d8..754dc110e0 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MBTiles.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MBTiles.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/11/16. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MapAnimateTranslate.java b/android/library/maply/src/main/java/com/mousebird/maply/MapAnimateTranslate.java index fb97c82203..3e2685faa2 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MapAnimateTranslate.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MapAnimateTranslate.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MapAnimateTranslateMomentum.java b/android/library/maply/src/main/java/com/mousebird/maply/MapAnimateTranslateMomentum.java index 0dd1b3db1b..8da2444217 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MapAnimateTranslateMomentum.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MapAnimateTranslateMomentum.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MapController.java b/android/library/maply/src/main/java/com/mousebird/maply/MapController.java index 69aab0c200..d9698fcd92 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MapController.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MapController.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MapGestureHandler.java b/android/library/maply/src/main/java/com/mousebird/maply/MapGestureHandler.java index 73a628e29f..b403e55b0a 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MapGestureHandler.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MapGestureHandler.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MapView.java b/android/library/maply/src/main/java/com/mousebird/maply/MapView.java index ec8558bf9c..189646c5cb 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MapView.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MapView.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MapViewState.java b/android/library/maply/src/main/java/com/mousebird/maply/MapViewState.java index de3368c04d..de0e2586da 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MapViewState.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MapViewState.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/16/15. - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MapboxKindaMap.kt b/android/library/maply/src/main/java/com/mousebird/maply/MapboxKindaMap.kt index 37be9634bc..46c8be1b70 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MapboxKindaMap.kt +++ b/android/library/maply/src/main/java/com/mousebird/maply/MapboxKindaMap.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/27/2020. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MapboxVectorInterpreter.java b/android/library/maply/src/main/java/com/mousebird/maply/MapboxVectorInterpreter.java index d0f754d1f0..1a6537eece 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MapboxVectorInterpreter.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MapboxVectorInterpreter.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,8 @@ import android.graphics.BitmapFactory; import android.util.Log; +import androidx.annotation.NonNull; + import org.jetbrains.annotations.NotNull; import java.io.ByteArrayInputStream; @@ -417,6 +419,13 @@ public void dataForTile(LoaderReturn loadReturn,QuadLoaderBase loader) } } + /** + * Some tiles were just removed. + */ + @Override + public void tilesUnloaded(@NonNull TileID[] ids) { + } + private Bitmap lastBackground = null; private int lastBackgroundColor = -1; private final Object backgroundLock = new Object(); diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MapboxVectorStyleSet.kt b/android/library/maply/src/main/java/com/mousebird/maply/MapboxVectorStyleSet.kt index d8f4a7ec04..1360cdbddf 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MapboxVectorStyleSet.kt +++ b/android/library/maply/src/main/java/com/mousebird/maply/MapboxVectorStyleSet.kt @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ package com.mousebird.maply import android.graphics.* import android.util.* import androidx.annotation.ColorInt +import androidx.annotation.Keep import androidx.core.util.component1 import androidx.core.util.component2 import com.mousebird.maply.RenderController.EmptyIdentity @@ -30,11 +31,13 @@ import java.util.concurrent.ConcurrentMap import java.util.concurrent.ConcurrentSkipListMap import java.util.regex.Pattern import kotlin.math.ceil +import kotlin.math.round /** * Mapbox Vector Style Set. * This parses a Mapbox style sheet and interfaces with the vector parser */ +@Suppress("MemberVisibilityCanBePrivate") class MapboxVectorStyleSet : VectorStyleInterface { constructor( @@ -77,6 +80,7 @@ class MapboxVectorStyleSet : VectorStyleInterface { fun mapTypefaceName(name: String?): String? } + @Suppress("unused") fun setTypefaceDelegate(delegate: TypefaceDelegate?) { typefaceDelegate = delegate } @@ -116,6 +120,7 @@ class MapboxVectorStyleSet : VectorStyleInterface { * Set this to override the regular fill shader. * Useful if you're going to mix something else into the polygons. */ + @Suppress("unused") fun setArealShader(shader: Shader) { setArealShaderNative(shader.id) } @@ -241,7 +246,7 @@ class MapboxVectorStyleSet : VectorStyleInterface { if (size == 0) return EmptyIdentity - val width = 1 + val width = round(1 * scale).toInt() val bitmap = Bitmap.createBitmap(width, size, Bitmap.Config.ARGB_8888) val canvas = Canvas(bitmap) bitmap.eraseColor(Color.TRANSPARENT) @@ -256,7 +261,7 @@ class MapboxVectorStyleSet : VectorStyleInterface { comp.forEach { val eleLen = it.toInt() if (onOrOff) { - for (jj in 0..(eleLen-1)) { + for (jj in 0 until eleLen) { val startY = (curY+jj)/eleSum.toFloat() * size.toFloat() canvas.drawLine(0.0f, startY, width.toFloat(), startY+1.0f, paint) } @@ -276,7 +281,12 @@ class MapboxVectorStyleSet : VectorStyleInterface { return tex?.texID ?: EmptyIdentity } + /** The color used for borders on legend bitmaps + */ @ColorInt var legendBorderColor = Color.BLACK + + /** The pixel size of borders on legend bitmaps + */ var legendBorderSize = 1 /** @@ -438,7 +448,7 @@ class MapboxVectorStyleSet : VectorStyleInterface { addSpritesNative(spriteJSON, spriteTex.texID, spriteSheet.width, spriteSheet.height) } - fun getSprite(name: String): Bitmap? { + private fun getSprite(name: String): Bitmap? { val xywh = intArrayOf(0,0,0,0) val src = spriteSheet if (src == null || !getSpriteInfoNative(name, xywh)) { @@ -454,17 +464,44 @@ class MapboxVectorStyleSet : VectorStyleInterface { // Set a named layer visible or invisible external fun setLayerVisible(layerName: String, visible: Boolean) + data class RepLayer( + val name: String, + val size: Float?, + val color: String?) + + /** Add layers to the style set for alternate representations. + * + * Layers with matching sources are copied, with the specified suffix appended + * to their identifiers, and configured to use the specified attribute for UUIDs. + */ + @Suppress("unused") + fun addRepresentationLayers(uuidAttr: String, + sources: Collection, + layers: Collection): Boolean = + addRepsNative(uuidAttr, sources.toTypedArray(), + layers.map { it.name }.toTypedArray(), + layers.map { it.size }.toTypedArray(), + layers.map { it.color }.toTypedArray()) + + private external fun addRepsNative( + uuidAttr: String, + sources: Array, + repNames: Array, + sizes: Array, + colors: Array): Boolean + + external fun hasRepresentations(): Boolean + enum class SourceType { Vector, Raster } // Source for vector tile (or raster) data inner class Source internal constructor( - // Name as it appears in the file - var name: String, - styleEntry: AttrDictionary, - val styleSet: MapboxVectorStyleSet? - ) { + var name: String, // Name as it appears in the file + styleEntry: AttrDictionary, + val styleSet: MapboxVectorStyleSet?) { + // Either vector or raster at present var type: SourceType? = null @@ -479,12 +516,10 @@ class MapboxVectorStyleSet : VectorStyleInterface { init { val typeStr = styleEntry.getString("type") - type = if (typeStr == "vector") { - SourceType.Vector - } else if (typeStr == "raster") { - SourceType.Raster - } else { - throw IllegalArgumentException("Unexpected type string in Mapbox Source") + type = when (typeStr) { + "vector" -> SourceType.Vector + "raster" -> SourceType.Raster + else -> throw IllegalArgumentException("Unexpected type '$typeStr' in Mapbox Source") } url = styleEntry.getString("url") tileSpec = styleEntry.getArray("tiles") @@ -546,12 +581,12 @@ class MapboxVectorStyleSet : VectorStyleInterface { } } - var sources = ArrayList() + val sources = ArrayList() // If there's a sprite sheet, where it's at - var spriteURL: String? = null + var spriteURL: String? = null; private set - var settings: VectorStyleSettings? = null + var settings: VectorStyleSettings? = null; private set private var displayMetrics: DisplayMetrics? = null @@ -587,5 +622,7 @@ class MapboxVectorStyleSet : VectorStyleInterface { ) external fun dispose() - protected var nativeHandle: Long = 0 + + @Keep @Suppress("unused") // Used by JNI + private var nativeHandle: Long = 0 } diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MapboxVectorTileParser.java b/android/library/maply/src/main/java/com/mousebird/maply/MapboxVectorTileParser.java index 8b12e9ca1a..5185740068 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MapboxVectorTileParser.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MapboxVectorTileParser.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/24/16. - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MaplyStarModel.java b/android/library/maply/src/main/java/com/mousebird/maply/MaplyStarModel.java index 6a3e8fdbad..e5fb71b42c 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MaplyStarModel.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MaplyStarModel.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MaplyTexture.java b/android/library/maply/src/main/java/com/mousebird/maply/MaplyTexture.java index 6d11e80e6f..3b8592518f 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MaplyTexture.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MaplyTexture.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 9/17/15. - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MarkerInfo.java b/android/library/maply/src/main/java/com/mousebird/maply/MarkerInfo.java index da5ccfa218..aa8e3c03ed 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MarkerInfo.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MarkerInfo.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MarkerManager.java b/android/library/maply/src/main/java/com/mousebird/maply/MarkerManager.java index fd3742ed2a..a05106236b 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MarkerManager.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MarkerManager.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Material.java b/android/library/maply/src/main/java/com/mousebird/maply/Material.java index 651d4d4c02..9cc660067f 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Material.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Material.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Matrix3d.java b/android/library/maply/src/main/java/com/mousebird/maply/Matrix3d.java index 75fce2f43f..020eb64969 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Matrix3d.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Matrix3d.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Matrix4d.java b/android/library/maply/src/main/java/com/mousebird/maply/Matrix4d.java index 73b810376c..59dcf29916 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Matrix4d.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Matrix4d.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Mbr.java b/android/library/maply/src/main/java/com/mousebird/maply/Mbr.java index a8941a93f7..5ff07dcf3b 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Mbr.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Mbr.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import org.jetbrains.annotations.NotNull; import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.util.Objects; @@ -88,6 +89,14 @@ public Mbr(Mbr other) { this((other != null) ? other.ll : null, (other != null) ? other.ur : null); } + /** + * Construct from a collection of points + */ + public Mbr(@NotNull Collection pts) { + for (Point2d p : pts) { + addPoint(p); + } + } @NotNull public String toString() { @@ -227,8 +236,7 @@ protected boolean oneWayOverlap(Mbr that) { /** * Return a list of points corresponding to the corners of the MBR. */ - public List asPoints() - { + public List asPoints() { return isValid() ? Arrays.asList(ll, new Point2d(ur.getX(),ll.getY()), ur, new Point2d(ll.getX(),ur.getY())) : @@ -241,4 +249,18 @@ ur, new Point2d(ll.getX(),ur.getY())) : public boolean isValid() { return ll != null && ur != null; } + + /** + * True if the bounding box is empty + */ + public boolean isEmpty() { + return ll.getX() == ur.getX() || ll.getY() == ur.getY(); + } + + /** + * True if the bounding box is not empty + */ + public boolean isNotEmpty() { + return ll.getX() != ur.getX() || ll.getY() < ur.getY(); + } } diff --git a/android/library/maply/src/main/java/com/mousebird/maply/MetroThread.java b/android/library/maply/src/main/java/com/mousebird/maply/MetroThread.java index 8e9a49814b..ac5c943a7b 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/MetroThread.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/MetroThread.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/21/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Moon.java b/android/library/maply/src/main/java/com/mousebird/maply/Moon.java index 13f1ab34ff..5a5729365e 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Moon.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Moon.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ObjectLoaderReturn.java b/android/library/maply/src/main/java/com/mousebird/maply/ObjectLoaderReturn.java index 0b5b76e76b..bc343aff93 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ObjectLoaderReturn.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ObjectLoaderReturn.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/OvlDebugImageLoaderInterpreter.java b/android/library/maply/src/main/java/com/mousebird/maply/OvlDebugImageLoaderInterpreter.java index 9588255834..ee5f2d2fff 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/OvlDebugImageLoaderInterpreter.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/OvlDebugImageLoaderInterpreter.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 3/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ParticleBatch.java b/android/library/maply/src/main/java/com/mousebird/maply/ParticleBatch.java index 34a5e262bd..179cad83bc 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ParticleBatch.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ParticleBatch.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 21/1/16. - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ParticleSystem.java b/android/library/maply/src/main/java/com/mousebird/maply/ParticleSystem.java index 6f529e9d14..3df420ec62 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ParticleSystem.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ParticleSystem.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 18/1/16 - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ParticleSystemManager.java b/android/library/maply/src/main/java/com/mousebird/maply/ParticleSystemManager.java index aa9881b2ed..8f4d0604d9 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ParticleSystemManager.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ParticleSystemManager.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 18/1/16 - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/PassThroughCoordSystem.java b/android/library/maply/src/main/java/com/mousebird/maply/PassThroughCoordSystem.java index a19b1d9e74..d53dbf65d6 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/PassThroughCoordSystem.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/PassThroughCoordSystem.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/19/19. - * Copyright 2011-2010 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/PlateCarreeCoordSystem.java b/android/library/maply/src/main/java/com/mousebird/maply/PlateCarreeCoordSystem.java index 42f8d8ad3b..a43cdc48b7 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/PlateCarreeCoordSystem.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/PlateCarreeCoordSystem.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Point2d.java b/android/library/maply/src/main/java/com/mousebird/maply/Point2d.java index ef04e0e7e1..f27625fd2d 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Point2d.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Point2d.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Point3d.java b/android/library/maply/src/main/java/com/mousebird/maply/Point3d.java index 77280a2ba8..e817db122b 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Point3d.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Point3d.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Point4d.java b/android/library/maply/src/main/java/com/mousebird/maply/Point4d.java index 3bc26081cd..9e210b24b1 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Point4d.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Point4d.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/20/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/QIFBatchOps.java b/android/library/maply/src/main/java/com/mousebird/maply/QIFBatchOps.java index 4db647dbbe..1953d1955b 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/QIFBatchOps.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/QIFBatchOps.java @@ -1,9 +1,8 @@ -/* - * QIFBatchOps.java +/* QIFBatchOps.java * WhirlyGlobeLib * * Created by Steve Gifford on 3/28/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +14,11 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ - package com.mousebird.maply; - +import androidx.annotation.Nullable; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; /** @@ -30,41 +28,37 @@ */ class QIFBatchOps { - ArrayList toCancel = new ArrayList(); - ArrayList toStart = new ArrayList(); + ArrayList toCancel = new ArrayList<>(); + ArrayList toStart = new ArrayList<>(); - QIFBatchOps() - {} + @SuppressWarnings("unused") // Referenced by JNI + QIFBatchOps() { + } /** * Add a fetch request to cancel. */ - void addToCancel(TileFetchRequest request) - { + void addToCancel(@NotNull TileFetchRequest request) { toCancel.add(request); } /** * Add a fetch request to start. */ - void addToStart(TileFetchRequest request) - { + void addToStart(@NotNull TileFetchRequest request) { toStart.add(request); } /** * Process the outstanding starts and cancels we gathered. */ - void process(TileFetcher fetcher) - { + void process(@Nullable TileFetcher fetcher) { // Just run the logic ourselves if (fetcher == null) { // Don't do anything for cancel - for (TileFetchRequest request: toStart) { request.callback.success(request, null); } - return; } @@ -81,16 +75,22 @@ void process(TileFetcher fetcher) dispose(); } - public void finalize() - { + // Get the tiles to be removed from the native object + public native @Nullable TileID[] getDeletes(); + + public void finalize() { dispose(); } - static - { + native void dispose(); + + static { nativeInit(); } private static native void nativeInit(); + + @SuppressWarnings("unused") // Referenced by JNI native void initialise(); - native void dispose(); + + @SuppressWarnings("unused") // Referenced by JNI private long nativeHandle; } diff --git a/android/library/maply/src/main/java/com/mousebird/maply/QIFFrameAsset.java b/android/library/maply/src/main/java/com/mousebird/maply/QIFFrameAsset.java index ab64d3ca2c..8c2fd99805 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/QIFFrameAsset.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/QIFFrameAsset.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/29/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/QuadImageFrameAnimator.java b/android/library/maply/src/main/java/com/mousebird/maply/QuadImageFrameAnimator.java index d9cd1b86e8..0cf587df4c 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/QuadImageFrameAnimator.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/QuadImageFrameAnimator.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/QuadImageLoader.java b/android/library/maply/src/main/java/com/mousebird/maply/QuadImageLoader.java index 10a175782a..4b8604ba6e 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/QuadImageLoader.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/QuadImageLoader.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/22/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/QuadImageLoaderBase.java b/android/library/maply/src/main/java/com/mousebird/maply/QuadImageLoaderBase.java index dbf39247e6..645a0967eb 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/QuadImageLoaderBase.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/QuadImageLoaderBase.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/22/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,18 +60,27 @@ protected QuadImageLoaderBase(BaseController control,SamplingParams params,int n // We want them to be able to modify settings before it starts public void delayedInit(final SamplingParams params) { - if (tileFetcher == null) { - tileFetcher = getController().addTileFetcher("Image Fetcher"); + final BaseController controller = getController(); + if (controller != null && tileFetcher == null) { + tileFetcher = controller.addTileFetcher("Image Fetcher"); } if (loadInterp == null) { loadInterp = new ImageLoaderInterpreter(); } - samplingLayer = new WeakReference<>(getController().findSamplingLayer(params,this)); + if (controller != null) { + samplingLayer = new WeakReference<>(controller.findSamplingLayer(params, this)); + } + loadInterp.setLoader(this); - delayedInitNative(getController().getScene()); + if (controller != null) { + final Scene scene = controller.getScene(); + if (scene != null) { + delayedInitNative(scene); + } + } } protected native void delayedInitNative(Scene scene); diff --git a/android/library/maply/src/main/java/com/mousebird/maply/QuadLoaderBase.java b/android/library/maply/src/main/java/com/mousebird/maply/QuadLoaderBase.java index 26d8ede095..9c568ffb86 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/QuadLoaderBase.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/QuadLoaderBase.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/22/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,13 @@ */ package com.mousebird.maply; - import android.os.AsyncTask; import android.os.Handler; import android.os.Looper; import android.util.Log; +import org.jetbrains.annotations.NotNull; + import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.HashSet; @@ -38,13 +39,11 @@ protected QuadLoaderBase() { } protected WeakReference samplingLayer; - protected QuadLoaderBase(BaseController inControl) - { + protected QuadLoaderBase(BaseController inControl) { control = new WeakReference<>(inControl); } - protected QuadLoaderBase(BaseController inControl,SamplingParams params,int numFrames,Mode mode) - { + protected QuadLoaderBase(BaseController inControl,SamplingParams params,int numFrames,Mode mode) { control = new WeakReference<>(inControl); initialise(params,numFrames,mode.ordinal()); } @@ -107,7 +106,7 @@ public QuadSamplingLayer getSamplingLayer() { * @return The lower left and upper right corner of the tile in geographic coordinates. * Returns null in case of error. */ - public Mbr geoBoundsForTile(TileID tileID) + public @NotNull Mbr geoBoundsForTile(@NotNull TileID tileID) { Mbr mbr = new Mbr(new Point2d(),new Point2d()); geoBoundsForTileNative(tileID.x,tileID.y,tileID.level,mbr.ll,mbr.ur); @@ -213,11 +212,13 @@ protected LoaderReturn makeLoaderReturn() * Attach a LoaderReturn to the frame assets. * Required for cancellation to be notated on the loader return. */ + @SuppressWarnings("unused") // Used by JNI public native void setLoadReturn(LoaderReturn loadReturn); /** * Detach a LoaderReturn from the frame assets */ + @SuppressWarnings("unused") // Used by JNI public native void clearLoadReturn(LoaderReturn loadReturn); /** @@ -239,7 +240,7 @@ public void shutdown() isShuttingDown = true; loadInterp = null; - QuadSamplingLayer layer = getSamplingLayer(); + final QuadSamplingLayer layer = getSamplingLayer(); if (layer == null || control == null || getController() == null) { return; } @@ -247,32 +248,33 @@ public void shutdown() layer.removeClient(this); final QuadLoaderBase loaderBase = this; - // Do all the shutdown on the layer thread - layer.layerThread.addTask(() -> { + // Do all the shutdown on the layer thread. + final Runnable cleanupTask = () -> { // Clean things up - ChangeSet changes = new ChangeSet(); + final ChangeSet changes = new ChangeSet(); cleanupNative(changes); - QuadSamplingLayer layerInner = getSamplingLayer(); + final QuadSamplingLayer layerInner = getSamplingLayer(); if (layerInner != null) { layerInner.layerThread.addChanges(changes); } // Back to the main thread for the sampling layer stuff - Handler handler = new Handler(Looper.getMainLooper()); + final Handler handler = new Handler(Looper.getMainLooper()); handler.post(() -> { - BaseController ctrl = getController(); + final BaseController ctrl = getController(); if (ctrl != null) { - QuadSamplingLayer layerInner2 = getSamplingLayer(); + final QuadSamplingLayer layerInner2 = getSamplingLayer(); ctrl.releaseSamplingLayer(layerInner2, loaderBase); } clear(samplingLayer); -// clear(control); - tileFetcher = null; }); - }); + }; + // Do not run it as a unit-of-work, because that will likely be canceled because we are + // shutting down, leading to native cleanup not being run, potentially leaking resources. + layer.layerThread.addTask(cleanupTask, false, false); } private static void clear(WeakReference weakRef) { @@ -310,12 +312,26 @@ public enum Mode {SingleFrame,MultiFrame,Object} @SuppressWarnings({"unused", "RedundantSuppression"}) // Called from C++ public void processBatchOps(QIFBatchOps batchOps) { + final TileID[] deletes = batchOps.getDeletes(); + batchOps.process(tileFetcher); + + if (deletes != null && deletes.length > 0) { + QuadSamplingLayer layer = getSamplingLayer(); + if (layer != null) { + layer.tilesUnloaded(deletes); + } + LoaderInterpreter li = loadInterp; + if (li != null) { + li.tilesUnloaded(deletes); + } + } } // Frame assets are used C++ side, but we have to hold a reference to them // or they disappear at inopportune times. We don't look inside them here. - HashSet frameAssets = new HashSet<>(); + @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") + private final HashSet frameAssets = new HashSet<>(); // Stop tracking a frame asset public void clearFrameAsset(QIFFrameAsset frameAsset) @@ -381,7 +397,8 @@ public void failure(TileFetchRequest fetchRequest, String errorStr) { } } - private void fetchSuccess(TileFetchRequest fetchRequest, TileID tileID, int frame, long frameID, byte[] data) { + private void fetchSuccess(@SuppressWarnings("unused") TileFetchRequest fetchRequest, + TileID tileID, int frame, long frameID, byte[] data) { final LoaderInterpreter theLoadInterp = loadInterp; final QuadSamplingLayer layer = getSamplingLayer(); @@ -462,7 +479,8 @@ private void fetchSuccess(TileFetchRequest fetchRequest, TileID tileID, int fram } } - private void fetchFailed(TileFetchRequest fetchRequest, String errorMessage) { + private void fetchFailed(@SuppressWarnings("unused") TileFetchRequest fetchRequest, + @SuppressWarnings("unused") String errorMessage) { final QuadSamplingLayer layer = getSamplingLayer(); if (layer != null && !layer.isShuttingDown) { layer.layerThread.addTask(() -> { diff --git a/android/library/maply/src/main/java/com/mousebird/maply/QuadSamplingLayer.java b/android/library/maply/src/main/java/com/mousebird/maply/QuadSamplingLayer.java index 929c8dfaa5..a95d72afae 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/QuadSamplingLayer.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/QuadSamplingLayer.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/28/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,8 @@ import androidx.annotation.CallSuper; +import org.jetbrains.annotations.NotNull; + import java.lang.ref.WeakReference; import java.util.ArrayList; @@ -154,6 +156,9 @@ public void viewUpdated(final ViewState viewState) } } + public void tilesUnloaded(@NotNull TileID[] ids) { + } + // Called no more often than 1/10 of a second public float getMinTime() { diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Quaternion.java b/android/library/maply/src/main/java/com/mousebird/maply/Quaternion.java index da42d38d16..e164f549c8 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Quaternion.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Quaternion.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/18/15. - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/RawPNGImageLoaderInterpreter.java b/android/library/maply/src/main/java/com/mousebird/maply/RawPNGImageLoaderInterpreter.java index 9e5288406d..31791c899c 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/RawPNGImageLoaderInterpreter.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/RawPNGImageLoaderInterpreter.java @@ -1,5 +1,7 @@ package com.mousebird.maply; +import androidx.annotation.NonNull; + /** * This loader interpreter treats input image data objects as PNGs containing raw data. * The difference is we'll use a direct PNG reader to tease it out, rather than Bitmap. @@ -27,6 +29,13 @@ public void dataForTile(LoaderReturn loadReturn,QuadLoaderBase loader) { } } + /** + * Some tiles were just removed. + */ + @Override + public void tilesUnloaded(@NonNull TileID[] ids) { + } + /** * In some cases we just want to pick values out of the input. */ diff --git a/android/library/maply/src/main/java/com/mousebird/maply/RemoteTileFetchInfo.java b/android/library/maply/src/main/java/com/mousebird/maply/RemoteTileFetchInfo.java index 60407cbbdb..d077aa1045 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/RemoteTileFetchInfo.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/RemoteTileFetchInfo.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 3/21/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/RemoteTileFetcher.java b/android/library/maply/src/main/java/com/mousebird/maply/RemoteTileFetcher.java index 3b48521c47..a9a92eb65e 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/RemoteTileFetcher.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/RemoteTileFetcher.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 3/21/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/RemoteTileInfoNew.java b/android/library/maply/src/main/java/com/mousebird/maply/RemoteTileInfoNew.java index 8bdb1536d5..5552ea4f46 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/RemoteTileInfoNew.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/RemoteTileInfoNew.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 3/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/RenderController.java b/android/library/maply/src/main/java/com/mousebird/maply/RenderController.java index 6ea4b5512a..581ab89b11 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/RenderController.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/RenderController.java @@ -2,7 +2,7 @@ * AutoTesterAndroid.maply * * Created by Tim Sylvester on 24/03/2021 - * Copyright © 2021 mousebird consulting, inc. + * Copyright © 2022 mousebird consulting, inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this * file except in compliance with the License. You may obtain a copy of the License at @@ -33,6 +33,9 @@ import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLDisplay; +import androidx.annotation.Nullable; +import org.jetbrains.annotations.NotNull; + import static javax.microedition.khronos.egl.EGL10.EGL_DRAW; import static javax.microedition.khronos.egl.EGL10.EGL_NO_CONTEXT; import static javax.microedition.khronos.egl.EGL10.EGL_READ; @@ -421,35 +424,50 @@ public synchronized void shutdown() if (vecManager != null) vecManager.dispose(); + vecManager = null; + if (loftManager != null) loftManager.dispose(); + loftManager = null; + if (wideVecManager != null) wideVecManager.dispose(); + wideVecManager = null; + + if (markerManager != null) + markerManager.dispose(); + markerManager = null; + if (stickerManager != null) stickerManager.dispose(); + stickerManager = null; + + if (labelManager != null) + labelManager.dispose(); + labelManager = null; + if (selectionManager != null) selectionManager.dispose(); + selectionManager = null; + if (componentManager != null) componentManager.dispose(); - if (labelManager != null) - labelManager.dispose(); + componentManager = null; + if (layoutManager != null) layoutManager.dispose(); + layoutManager = null; + if (particleSystemManager != null) particleSystemManager.dispose(); - - vecManager = null; - loftManager = null; - wideVecManager = null; - markerManager = null; - stickerManager = null; - labelManager = null; - selectionManager = null; - componentManager = null; - layoutManager = null; particleSystemManager = null; - layoutLayer = null; + + if (shapeManager != null) + shapeManager.dispose(); shapeManager = null; + + if (billboardManager != null) + billboardManager.dispose(); billboardManager = null; texManager = null; @@ -935,9 +953,8 @@ public ComponentObject addScreenMovingLabels(final Collection } /** - * Add vectors to the MaplyController to display. Vectors are linear or areal - * features with line width, filled style, color and so forth defined by the - * VectorInfo class. + * Add vectors to the MaplyController to display. Vectors are linear or areal features with + * line width, filled style, color and so forth defined by the VectorInfo class. * * @param vecs A list of VectorObject's created by the user or read in from various sources. * @param vecInfo A description of how the vectors should look. @@ -945,8 +962,9 @@ public ComponentObject addScreenMovingLabels(final Collection * @return The ComponentObject representing the vectors. This is necessary for modifying * or deleting the vectors once created. */ - public ComponentObject addVectors(final Collection vecs,final VectorInfo vecInfo, - RenderController.ThreadMode mode) + public @Nullable ComponentObject addVectors(@NotNull final Collection vecs, + @NotNull final VectorInfo vecInfo, + RenderController.ThreadMode mode) { final ComponentObject compObj = componentManager.makeComponentObject(); @@ -957,31 +975,28 @@ public ComponentObject addVectors(final Collection vecs,final Vect } // Vectors are simple enough to just add - ChangeSet changes = new ChangeSet(); - long vecId = vecManager.addVectors(vecs.toArray(new VectorObject[0]), vecInfo, changes); + final ChangeSet changes = new ChangeSet(); + final long vecId = vecManager.addVectors(vecs.toArray(new VectorObject[0]), vecInfo, changes); + if (vecId == EmptyIdentity && !changes.any()) { + // Something went wrong, don't add selectable objects, etc. + // Note that the caller will still get a CO, it just doesn't represent anything. + return; + } // Track the vector ID for later use - if (vecId != EmptyIdentity) - compObj.addVectorID(vecId); + compObj.addVectorID(vecId); - // Keep track of this one for selection - for (VectorObject vecObj : vecs) - { + final boolean sel = vecInfo.getSelectable(); + for (VectorObject vecObj : vecs) { if (!running) { - return; + break; } - - if (vecObj.getSelectable()) { + // Keep track of this one for selection? + if (sel && vecObj.getSelectable()) { compObj.addVector(vecObj); componentManager.addSelectableObject(vecObj.ident, vecObj, compObj); - } - } - - if (vecInfo.disposeAfterUse || disposeAfterRemoval) { - for (VectorObject vecObj : vecs) { - if (!vecObj.getSelectable()) { - vecObj.dispose(); - } + } else if (vecInfo.disposeAfterUse || disposeAfterRemoval) { + vecObj.dispose(); } } @@ -989,6 +1004,14 @@ public ComponentObject addVectors(final Collection vecs,final Vect processChangeSet(changes); }, mode); + // In current-thread mode, we already know whether it worked or not. + if (mode == ThreadMode.ThreadCurrent) { + final long[] ids = compObj.getVectorIDs(); + if (ids == null || ids.length == 0) { + return null; + } + } + return compObj; } @@ -1059,8 +1082,8 @@ public void changeVector(final ComponentObject vecObj,final VectorInfo vecInfo,T // Do the actual work on the layer thread taskMan.addTask(() -> { // Vectors are simple enough to just add - ChangeSet changes = new ChangeSet(); - long[] vecIDs = vecObj.getVectorIDs(); + final ChangeSet changes = new ChangeSet(); + final long[] vecIDs = vecObj.getVectorIDs(); if (vecIDs != null) { vecManager.changeVectors(vecIDs, vecInfo, changes); processChangeSet(changes); @@ -1082,8 +1105,8 @@ public void changeWideVector(final ComponentObject vecObj,final WideVectorInfo v // Do the actual work on the layer thread taskMan.addTask(() -> { // Vectors are simple enough to just add - ChangeSet changes = new ChangeSet(); - long[] vecIDs = vecObj.getVectorIDs(); + final ChangeSet changes = new ChangeSet(); + final long[] vecIDs = vecObj.getVectorIDs(); if (vecIDs != null) { // todo: implement this //vecManager.changeWideVectors(vecIDs, vecInfo, changes); @@ -1111,8 +1134,8 @@ public ComponentObject instanceVectors(final ComponentObject vecObj, final Vecto } // Vectors are simple enough to just add - ChangeSet changes = new ChangeSet(); - long[] vecIDs = vecObj.getVectorIDs(); + final ChangeSet changes = new ChangeSet(); + final long[] vecIDs = vecObj.getVectorIDs(); if (vecIDs != null) { for (long vecID : vecIDs) { long newID = vecManager.instanceVectors(vecID, vecInfo, changes); @@ -1129,9 +1152,8 @@ public ComponentObject instanceVectors(final ComponentObject vecObj, final Vecto } /** - * Add wide vectors to the MaplyController to display. Vectors are linear or areal - * features with line width, filled style, color and so forth defined by the - * WideVectorInfo class. + * Add wide vectors to the MaplyController to display. Vectors are linear or areal features + * with line width, filled style, color and so forth defined by the WideVectorInfo class. *
* Wide vectors differ from regular lines in that they're implemented with a more * complicated shader. They can be arbitrarily large, have textures, and have a transparent @@ -1143,9 +1165,9 @@ public ComponentObject instanceVectors(final ComponentObject vecObj, final Vecto * @return The ComponentObject representing the vectors. This is necessary for modifying * or deleting the vectors once created. */ - public ComponentObject addWideVectors(final Collection vecs, - final WideVectorInfo wideVecInfo, - ThreadMode mode) + public @Nullable ComponentObject addWideVectors(@NotNull final Collection vecs, + @NotNull final WideVectorInfo wideVecInfo, + ThreadMode mode) { final ComponentObject compObj = componentManager.makeComponentObject(); @@ -1156,19 +1178,24 @@ public ComponentObject addWideVectors(final Collection vecs, } // Vectors are simple enough to just add - ChangeSet changes = new ChangeSet(); - long vecId = wideVecManager.addVectors(vecs.toArray(new VectorObject[0]), wideVecInfo, changes); - - // Track the vector ID for later use - if (vecId != EmptyIdentity) { - compObj.addWideVectorID(vecId); + final ChangeSet changes = new ChangeSet(); + final long vecId = wideVecManager.addVectors(vecs.toArray(new VectorObject[0]), wideVecInfo, changes); + if (vecId == EmptyIdentity && !changes.any()) { + // Something went wrong, don't add selectable objects, etc. + // Note that the caller will still get a CO, it just doesn't represent anything. + return; } - // todo: should we still produce a component object and add it as selectable if addVectors returned zero? + // Track the vector ID for later use + compObj.addWideVectorID(vecId); + final boolean sel = wideVecInfo.getSelectable(); for (VectorObject vecObj : vecs) { - if (vecObj.getSelectable()) { - // Keep track of this one for selection + if (!running) { + break; + } + // Keep track of this one for selection? + if (sel && vecObj.getSelectable()) { compObj.addVector(vecObj); componentManager.addSelectableObject(vecObj.ident,vecObj,compObj); } else if (wideVecInfo.disposeAfterUse || disposeAfterRemoval) { @@ -1181,6 +1208,14 @@ public ComponentObject addWideVectors(final Collection vecs, processChangeSet(changes); }, mode); + // In current-thread mode, we already know whether it worked or not. + if (mode == ThreadMode.ThreadCurrent) { + final long[] ids = compObj.getWideVectorIDs(); + if (ids == null || ids.length == 0) { + return null; + } + } + return compObj; } @@ -1211,15 +1246,18 @@ public ComponentObject instanceWideVectors(final ComponentObject inCompObj, // Vectors are simple enough to just add ChangeSet changes = new ChangeSet(); - for (long vecID : inCompObj.getWideVectorIDs()) { - if (!running) { - return; - } + final long[] ids = inCompObj.getWideVectorIDs(); + if (ids != null) { + for (long vecID : ids) { + if (!running) { + return; + } - long instID = wideVecManager.instanceVectors(vecID,wideVecInfo,changes); + long instID = wideVecManager.instanceVectors(vecID, wideVecInfo, changes); - if (instID != EmptyIdentity) - compObj.addWideVectorID(instID); + if (instID != EmptyIdentity) + compObj.addWideVectorID(instID); + } } componentManager.addComponentObject(compObj, changes); @@ -1333,7 +1371,7 @@ public ComponentObject changeSticker(final ComponentObject stickerObj, taskMan.addTask(() -> { ChangeSet changes = new ChangeSet(); - long[] stickerIDs = stickerObj.getStickerIDs(); + final long[] stickerIDs = stickerObj.getStickerIDs(); if (stickerIDs != null && stickerIDs.length > 0) { for (long stickerID : stickerIDs) { if (!running) { diff --git a/android/library/maply/src/main/java/com/mousebird/maply/RendererWrapper.java b/android/library/maply/src/main/java/com/mousebird/maply/RendererWrapper.java index 5ff368fb89..e0f68ae680 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/RendererWrapper.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/RendererWrapper.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/SamplingParams.java b/android/library/maply/src/main/java/com/mousebird/maply/SamplingParams.java index 839fe4d853..f05ee5092e 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/SamplingParams.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/SamplingParams.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Scene.java b/android/library/maply/src/main/java/com/mousebird/maply/Scene.java index e19e5fdd06..41faa4bf85 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Scene.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Scene.java @@ -1,5 +1,7 @@ package com.mousebird.maply; +import androidx.annotation.Keep; + /** * Base class for Scene. Use either a MapScene or a GlobeScene instead. * @@ -64,6 +66,7 @@ public void finalize() { native void addChangesNative(ChangeSet changes); native void dispose(); + @Keep @SuppressWarnings("unused") protected long nativeHandle; } diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ScreenLabel.java b/android/library/maply/src/main/java/com/mousebird/maply/ScreenLabel.java index 38146be216..45a39f3e54 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ScreenLabel.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ScreenLabel.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ScreenMarker.java b/android/library/maply/src/main/java/com/mousebird/maply/ScreenMarker.java index 0df6ebd133..a5324dfd0e 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ScreenMarker.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ScreenMarker.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ScreenMovingLabel.java b/android/library/maply/src/main/java/com/mousebird/maply/ScreenMovingLabel.java index 4cc377f9ac..85272bdb8e 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ScreenMovingLabel.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ScreenMovingLabel.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ScreenMovingMarker.java b/android/library/maply/src/main/java/com/mousebird/maply/ScreenMovingMarker.java index 81a0c2d3bc..50835712c5 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ScreenMovingMarker.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ScreenMovingMarker.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/12/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ScreenObject.java b/android/library/maply/src/main/java/com/mousebird/maply/ScreenObject.java index 8bd1cc906f..0e98576fab 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ScreenObject.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ScreenObject.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Shader.java b/android/library/maply/src/main/java/com/mousebird/maply/Shader.java index 3f5af4514f..658e61af38 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Shader.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Shader.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 8/26/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Shape.java b/android/library/maply/src/main/java/com/mousebird/maply/Shape.java index 0889a8e93e..9a9efcde3d 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Shape.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Shape.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ShapeCircle.java b/android/library/maply/src/main/java/com/mousebird/maply/ShapeCircle.java index f428ecd862..6f91806c63 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ShapeCircle.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ShapeCircle.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ShapeCylinder.java b/android/library/maply/src/main/java/com/mousebird/maply/ShapeCylinder.java index aeba8f9c0a..3164583a61 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ShapeCylinder.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ShapeCylinder.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ShapeExtruded.java b/android/library/maply/src/main/java/com/mousebird/maply/ShapeExtruded.java index 24c39000bc..4701cc01c8 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ShapeExtruded.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ShapeExtruded.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ShapeGreatCircle.java b/android/library/maply/src/main/java/com/mousebird/maply/ShapeGreatCircle.java index 9ebc3253fb..c15c1a0a9b 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ShapeGreatCircle.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ShapeGreatCircle.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ShapeInfo.java b/android/library/maply/src/main/java/com/mousebird/maply/ShapeInfo.java index a49209a2f3..912b91fe30 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ShapeInfo.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ShapeInfo.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ShapeLinear.java b/android/library/maply/src/main/java/com/mousebird/maply/ShapeLinear.java index e854a0d151..7eef529ba2 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ShapeLinear.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ShapeLinear.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by sjg - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ShapeManager.java b/android/library/maply/src/main/java/com/mousebird/maply/ShapeManager.java index 7d97b3ce2a..7305efbeaa 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ShapeManager.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ShapeManager.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ShapeRectangle.java b/android/library/maply/src/main/java/com/mousebird/maply/ShapeRectangle.java index 1474849b9d..6f39890a69 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ShapeRectangle.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ShapeRectangle.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ShapeSphere.java b/android/library/maply/src/main/java/com/mousebird/maply/ShapeSphere.java index 083c52e2e8..fc28a5fde5 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ShapeSphere.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ShapeSphere.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/SimplePoly.java b/android/library/maply/src/main/java/com/mousebird/maply/SimplePoly.java index 1308f2da2a..0e1abc119f 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/SimplePoly.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/SimplePoly.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/SimpleStyleManager.kt b/android/library/maply/src/main/java/com/mousebird/maply/SimpleStyleManager.kt index 2f44a897b3..0535dce66f 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/SimpleStyleManager.kt +++ b/android/library/maply/src/main/java/com/mousebird/maply/SimpleStyleManager.kt @@ -30,6 +30,7 @@ import java.util.* import kotlin.math.ceil import kotlin.math.min +@Suppress("MemberVisibilityCanBePrivate", "unused") class SimpleStyleManager(context: Context, vc: RenderControllerInterface, assetManager: AssetManager? = null) { var smallSize = Point2d(16.0, 16.0) @@ -49,7 +50,7 @@ class SimpleStyleManager(context: Context, vc: RenderControllerInterface, assetM var sharedCacheSize: Int get() { return Shared.cacheSize } set(value) { Shared.cacheSize = value } - + interface StyleObjectLocator { fun locate(name: String): Collection } @@ -227,18 +228,26 @@ class SimpleStyleManager(context: Context, vc: RenderControllerInterface, assetM } /** - * Call when done with all the generated objects. + * Clear out the image texture cache. + * Any references to the textures should already be removed. */ - fun shutdown() { + fun clearCache() { synchronized(textureCache) { vc.get()?.removeTextures(textureCache.elements().toList(), threadCurrent) textureCache.clear() } } + + /** + * Call when done with all the generated objects. + */ + fun shutdown() { + clearCache() + } private fun addFeaturesInternal(obj: VectorObject, optStyle: SimpleStyle? = null, mode: ThreadMode = threadCurrent): Sequence { val vc = this.vc.get() ?: return sequenceOf() - val style = optStyle ?: makeStyle(obj.attributes) + val style = optStyle ?: obj.attributes?.let(this::makeStyle) ?: SimpleStyle() when (obj.vectorType) { VectorObject.MaplyVectorObjectType.MaplyVectorPointType -> { var markerObj: ComponentObject? = null @@ -506,7 +515,7 @@ class SimpleStyleManager(context: Context, vc: RenderControllerInterface, assetM private fun parseBool(s: String?): Boolean? { if (s == null || s.isEmpty()) return null - return (s == "1" || s.toLowerCase(Locale.ROOT) == "true") + return (s == "1" || s.lowercase(Locale.ROOT) == "true") } companion object { diff --git a/android/library/maply/src/main/java/com/mousebird/maply/SimpleTileFetcher.java b/android/library/maply/src/main/java/com/mousebird/maply/SimpleTileFetcher.java index 691578d080..6f544a4498 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/SimpleTileFetcher.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/SimpleTileFetcher.java @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/4/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/SphericalMercatorCoordSystem.java b/android/library/maply/src/main/java/com/mousebird/maply/SphericalMercatorCoordSystem.java index 1739fe84e8..66d1a67fee 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/SphericalMercatorCoordSystem.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/SphericalMercatorCoordSystem.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/StringWrapper.java b/android/library/maply/src/main/java/com/mousebird/maply/StringWrapper.java index 878dde44cc..8e88c024d3 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/StringWrapper.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/StringWrapper.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/SunUpdater.java b/android/library/maply/src/main/java/com/mousebird/maply/SunUpdater.java index efc858a30e..9ae6b0e970 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/SunUpdater.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/SunUpdater.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/TestTileFetcher.kt b/android/library/maply/src/main/java/com/mousebird/maply/TestTileFetcher.kt index 5f2749567b..8cb1cbc401 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/TestTileFetcher.kt +++ b/android/library/maply/src/main/java/com/mousebird/maply/TestTileFetcher.kt @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Tim Sylvester on 4/20/2021. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/Texture.java b/android/library/maply/src/main/java/com/mousebird/maply/Texture.java index ae6977af0e..58a35663e0 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/Texture.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/Texture.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/TextureManager.java b/android/library/maply/src/main/java/com/mousebird/maply/TextureManager.java index 8aa80de8bd..41b7a91f07 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/TextureManager.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/TextureManager.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +56,7 @@ public int compareTo(TextureWrapper that) if (hash1 < hash2) return -1; return 1; - } + } }; TreeSet textures = new TreeSet(); diff --git a/android/library/maply/src/main/java/com/mousebird/maply/TileFetchRequest.java b/android/library/maply/src/main/java/com/mousebird/maply/TileFetchRequest.java index bdd6113614..6c6f2fb9b1 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/TileFetchRequest.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/TileFetchRequest.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 3/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,8 @@ */ public class TileFetchRequest implements Comparable { + private long id = Identifiable.genID(); + /** * Priority before importance. Less is more important */ @@ -111,6 +113,7 @@ public int compareTo(TileFetchRequest other) { if (res == 0) res = -Float.compare(importance, other.importance); if (res == 0) res = group - other.group; if (res == 0) res = (int)(tileSource - other.tileSource); + if (res == 0) res = (int)(id - other.id); return res; } @@ -118,23 +121,19 @@ public int compareTo(TileFetchRequest other) { public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TileFetchRequest)) return false; - TileFetchRequest that = (TileFetchRequest)o; - return priority == that.priority && - Float.compare(that.importance, importance) == 0 && - group == that.group && - tileSource == that.tileSource; + return id == ((TileFetchRequest)o).id; } @Override public int hashCode() { - return Objects.hash(priority, importance, group, tileSource, fetchInfo); + return Objects.hash(id, priority, importance, group, tileSource, fetchInfo); } @NotNull @SuppressLint("DefaultLocale") @Override public String toString() { - return String.format("TileFetchRequest{%d,%f,%d,%d,%s}", + return String.format("TileFetchRequest{id=%d,pri=%d,imp=%f,grp=%d,src=%d,info=%s}",id, priority, importance, group, tileSource, (fetchInfo != null) ? fetchInfo.toString() : "null"); } diff --git a/android/library/maply/src/main/java/com/mousebird/maply/TileFetcher.java b/android/library/maply/src/main/java/com/mousebird/maply/TileFetcher.java index aad51a1fbe..c706dbff2a 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/TileFetcher.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/TileFetcher.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 3/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/TileID.java b/android/library/maply/src/main/java/com/mousebird/maply/TileID.java index fae2243edc..b010e2258c 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/TileID.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/TileID.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/TileInfoNew.java b/android/library/maply/src/main/java/com/mousebird/maply/TileInfoNew.java index 720ea113a2..8d6c9a9ef9 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/TileInfoNew.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/TileInfoNew.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro on 3/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/UpdateLayer.java b/android/library/maply/src/main/java/com/mousebird/maply/UpdateLayer.java index 3912d5770c..8a25d8eea2 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/UpdateLayer.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/UpdateLayer.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 9/15/20. - * Copyright 2011-2020 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,10 @@ import android.os.Handler; +import androidx.annotation.NonNull; + +import org.jetbrains.annotations.NotNull; + import java.lang.ref.WeakReference; /** @@ -57,12 +61,12 @@ public interface Delegate { */ void teardown(UpdateLayer layer); } - public Delegate delegate = null; + public Delegate delegate; - WeakReference maplyControl = null; + private final @NotNull WeakReference maplyControl; public UpdateLayer(float moveDist, float minTime, Delegate delegate, BaseController inMaplyControl) { - maplyControl = new WeakReference(inMaplyControl); + maplyControl = new WeakReference<>(inMaplyControl); this.delegate = delegate; this.moveDist = moveDist; @@ -75,10 +79,12 @@ public void startLayer(LayerThread inLayerThread) { delegate.start(this); scheduleUpdate(); - if (maplyControl != null) { - LayerThread layerThread = maplyControl.get().getLayerThread(); - if (layerThread != null) - maplyControl.get().getLayerThread().addWatcher(this); + final BaseController control = maplyControl.get(); + if (control != null) { + final LayerThread layerThread = control.getLayerThread(); + if (layerThread != null) { + layerThread.addWatcher(this); + } } } @@ -91,8 +97,8 @@ public void shutdown() ViewState viewState = null; - public float moveDist = 0.0f; - public float minTime = 0.2f; + public float moveDist; + public float minTime; public float maxLag = 0.0f; // Set if we've got an update in the queue @@ -106,16 +112,13 @@ void scheduleUpdate() { if (updateHandle == null) { - updateRun = new Runnable() - { - @Override - public void run() - { - runUpdate(); + updateRun = this::runUpdate; + final BaseController control = maplyControl.get(); + if (control != null) { + final LayerThread thread = control.getLayerThread(); + if (thread != null) { + updateHandle = thread.addDelayedTask(updateRun, 200); } - }; - if (maplyControl != null && maplyControl.get().getLayerThread() != null) { - updateHandle = maplyControl.get().getLayerThread().addDelayedTask(updateRun, 200); } } } @@ -172,4 +175,11 @@ public float getMinTime() { public float getMaxLagTime() { return maxLag; } + + /** + * Some tiles were just removed + */ + @Override + public void tilesUnloaded(@NonNull TileID[] ids) { + } } diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VariableTarget.java b/android/library/maply/src/main/java/com/mousebird/maply/VariableTarget.java index d704365b67..6322f2475a 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VariableTarget.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VariableTarget.java @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/24/18. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VectorInfo.java b/android/library/maply/src/main/java/com/mousebird/maply/VectorInfo.java index baea332541..1f9f1fd4e7 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VectorInfo.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VectorInfo.java @@ -1,9 +1,8 @@ -/* - * VectorInfo.java +/* VectorInfo.java * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,19 +14,20 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package com.mousebird.maply; import android.graphics.Color; +import androidx.annotation.ColorInt; + /** * The Vector Info class holds visual information related to groups of vectors. * For efficiency's sake we put visual info in this class, rather than on * attributes in the vectors themselves. There may be attributes that can * override these, however. - * */ +@SuppressWarnings("unused") public class VectorInfo extends BaseInfo { /** @@ -39,8 +39,7 @@ public class VectorInfo extends BaseInfo * Construct the vector info empty with default values. At the very least * a vector will be white and visible all the time. */ - public VectorInfo() - { + public VectorInfo() { initialise(); setFilled(false); setColor(1.f,1.f,1.f,1.f); @@ -48,16 +47,16 @@ public VectorInfo() setDrawPriority(VectorPriorityDefault); } - public void finalize() - { + public void finalize() { dispose(); } /** - * Set whether or not areal features are tesselated and draw as filled. - * Default is fault. + * Set whether or not areal features are tessellated and draw as filled. + * Default is not. */ public native void setFilled(boolean filled); + public native boolean getFilled(); /** * Vectors can be subdivided to follow a globe. @@ -65,20 +64,21 @@ public void finalize() * a subdivision. */ public native void setSampleEpsilon(double eps); + public native double getSampleEpsilon(); /** * If set and filled is set, we will apply the given texture across any areal features. * How the texture is applied can be controlled by the textScale, textureProjection, and vecCenter. */ - public void setTexture(MaplyTexture tex) - { + public void setTexture(MaplyTexture tex) { setTextureID(tex.texID); } /** * Set the texture to use on a vector by ID. */ - native void setTextureID(long texID); + public native void setTextureID(long texID); + public native long getTextureID(); /** * These control the scale of the texture application. We'll multiply by these numbers before @@ -93,28 +93,32 @@ public void setTexture(MaplyTexture tex) * trigger for more subdivision. */ public native void setSubdivEps(double eps); + public native double getSubdivEps(); /** * When using textures on areal features, you can project the texture a couple of different ways. * Using TangentPlane works well for the globe and Screen works well in 2D. */ - public enum TextureProjection {None,TangentPlane,Screen}; + public enum TextureProjection {None,TangentPlane,Screen} - public void setTextureProjection(TextureProjection texProjection) - { + public void setTextureProjection(TextureProjection texProjection) { setTextureProjectionNative(texProjection.ordinal()); } + public TextureProjection getTextureProjection() { + return TextureProjection.values()[getTextureProjectionNative()]; + } native void setTextureProjectionNative(int texProjection); + native int getTextureProjectionNative(); /** * Set the color used by the geometry. * @param color Color in Android format, including alpha. */ - public void setColor(int color) - { - setColor(Color.red(color)/255.f,Color.green(color)/255.f,Color.blue(color)/255.f,Color.alpha(color)/255.f); + public void setColor(int color) { + setColorInt(Color.red(color),Color.green(color),Color.blue(color),Color.alpha(color)); } + public native @ColorInt int getColor(); /** * Set the color used by the geometry. Color values range from 0 to 1.0. @@ -126,34 +130,55 @@ public void setColor(int color) */ public native void setColor(float r,float g,float b,float a); + public native void setColorInt(int r,int g,int b,int a); + /** * This is the line width for vector features. By default this is 1.0. */ public native void setLineWidth(float lineWidth); + public native float getLineWidth(); /** * If set, we'll calculate a center for the vector geometry and * use that in building the visual geometry. This is set on * by default when we pass in a center as well. */ - native public void setUseCenter(); + public void setUseCenter() { setUseCenterNative(true); } + public void setUseCenter(boolean use) { setUseCenterNative(use); } + + public native void setUseCenterNative(boolean use); + public native boolean getUseCenter(); /** * These control the center of a texture application. If not set we'll use the areal's centroid. * If set, we'll use these instead. They should be in local coordinates (probably geographic radians). */ - public void setVecCenter(Point2d center) - { + public void setVecCenter(Point2d center) { setVecCenterNative(center.getX(),center.getY()); } + public Point2d getVecCenter() { return new Point2d(getVecCenterX(), getVecCenterY()); } + + native double getVecCenterX(); + native double getVecCenterY(); native void setVecCenterNative(double x,double y); + /** + * Whether the items are selectable + */ + public native void setSelectable(boolean enable); + public native boolean getSelectable(); + + /** + * Close any un-closed areal features when drawing lines for them + */ + public native void setCloseAreals(boolean close); + public native boolean getCloseAreals(); + // Convert to a string for debugging public native String toString(); - static - { + static { nativeInit(); } private static native void nativeInit(); diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VectorIterator.java b/android/library/maply/src/main/java/com/mousebird/maply/VectorIterator.java index c45aecf2ec..416e149664 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VectorIterator.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VectorIterator.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VectorManager.java b/android/library/maply/src/main/java/com/mousebird/maply/VectorManager.java index b9048cd7ae..1ce65202b1 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VectorManager.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VectorManager.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2014 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VectorObject.java b/android/library/maply/src/main/java/com/mousebird/maply/VectorObject.java index 681dc5b327..3e91cda4f4 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VectorObject.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VectorObject.java @@ -1,9 +1,8 @@ -/* - * VectorObject +/* VectorObject * com.mousebirdconsulting.maply * * Created by Steve Gifford on 12/30/13. - * Copyright 2013-2014 mousebird consulting + * Copyright 2013-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package com.mousebird.maply; @@ -24,10 +22,7 @@ import org.jetbrains.annotations.NotNull; -import java.util.ArrayList; -import java.util.Collection; import java.util.Map; -import java.util.Vector; /** * The Maply VectorObject represents a group of vector features. There can be a single point in here, @@ -43,13 +38,13 @@ * @author sjg * */ +@SuppressWarnings("unused") public class VectorObject implements Iterable { /** * Construct empty. */ - public VectorObject() - { + public VectorObject() { initialise(ident); } @@ -59,32 +54,33 @@ public VectorObject() long ident = Identifiable.genID(); public enum MaplyVectorObjectType { - MaplyVectorNoneType(0), MaplyVectorPointType(1), MaplyVectorLinearType(2), MaplyVectorLinear3dType(3), MaplyVectorArealType(4), MaplyVectorMultiType(5); + MaplyVectorNoneType(0), + MaplyVectorPointType(1), + MaplyVectorLinearType(2), + MaplyVectorLinear3dType(3), + MaplyVectorArealType(4), + MaplyVectorMultiType(5); private final int objType; - MaplyVectorObjectType(int objType) {this.objType = objType;} - public int getValue() { return objType;} - }; + MaplyVectorObjectType(int objType) { + this.objType = objType; + } + public int getValue() { + return objType; + } + } /** * The vector type is one of point, linear, linear3d, areal, or a combination. */ public MaplyVectorObjectType getVectorType() { - int vectorType = getVectorTypeNative(); - if (vectorType == MaplyVectorObjectType.MaplyVectorNoneType.getValue()) - return MaplyVectorObjectType.MaplyVectorNoneType; - else if (vectorType == MaplyVectorObjectType.MaplyVectorPointType.getValue()) - return MaplyVectorObjectType.MaplyVectorPointType; - else if (vectorType == MaplyVectorObjectType.MaplyVectorLinearType.getValue()) - return MaplyVectorObjectType.MaplyVectorLinearType; - else if (vectorType == MaplyVectorObjectType.MaplyVectorLinear3dType.getValue()) - return MaplyVectorObjectType.MaplyVectorLinear3dType; - else if (vectorType == MaplyVectorObjectType.MaplyVectorArealType.getValue()) - return MaplyVectorObjectType.MaplyVectorArealType; - else if (vectorType == MaplyVectorObjectType.MaplyVectorMultiType.getValue()) - return MaplyVectorObjectType.MaplyVectorMultiType; - else - return MaplyVectorObjectType.MaplyVectorNoneType; + final int vectorType = getVectorTypeNative(); + for (MaplyVectorObjectType value : MaplyVectorObjectType.values()) { + if (value.getValue() == vectorType) { + return value; + } + } + return MaplyVectorObjectType.MaplyVectorNoneType; } private native int getVectorTypeNative(); @@ -104,6 +100,7 @@ else if (vectorType == MaplyVectorObjectType.MaplyVectorMultiType.getValue()) * If there are multiple features, we get the first one. * May return a copy of the internal attribute dictionary. */ + @Nullable public native AttrDictionary getAttributes(); /** @@ -122,22 +119,22 @@ else if (vectorType == MaplyVectorObjectType.MaplyVectorMultiType.getValue()) /** * Add a single point */ - public native void addPoint(Point2d pt); + public native boolean addPoint(Point2d pt); /** * Add a linear feature */ - public native void addLinear(Point2d pts[]); + public native boolean addLinear(Point2d[] pts); /** * Add an areal feature with one external loop. */ - public native void addAreal(Point2d pts[]); + public native boolean addAreal(Point2d[] pts); /** * Add an areal feature with a single exterior loop and one or more interior loops. */ - public native void addAreal(Point2d ext[],Point2d holes[][]); + public native boolean addAreal(Point2d[] ext, Point2d[][] holes); /** * Merge the vectors from the other vector object into this one. @@ -149,8 +146,7 @@ else if (vectorType == MaplyVectorObjectType.MaplyVectorMultiType.getValue()) * each of this individually, this iterator will handle that efficiently. */ @Override - public VectorIterator iterator() - { + public VectorIterator iterator() { return new VectorIterator(this); } @@ -211,11 +207,44 @@ public VectorIterator iterator() */ public native double areaOfOuterLoops(); + /** + * Reverse the direction of areal loops in this object + */ + public native void reverseAreals(); + + /** + * Create a copy with reversed areal loops + */ + public native VectorObject reversedAreals(); + + /** + * Ensure that areal loops are closed + */ + public native void closeLoops(); + /** + * Produce a new objet with closed loops + */ + public native VectorObject closedLoops(); + + /** + * Ensure that areal loops are not closed + */ + public native void unCloseLoops(); + /** + * Produce a new objet with un-closed loops + */ + public native VectorObject unClosedLoops(); + /** * Returns the total number of points in a feature. Used for assessing size. */ public native int countPoints(); + /** + * Returns true if any of the segments of lines or areas intersect any others + */ + public native boolean anyIntersections(); + /** * Bounding box of all the various features together */ @@ -228,13 +257,9 @@ public VectorIterator iterator() The epsilon is in display coordinates (radius = 1.0). This routine breaks this up along geographic boundaries. */ - public VectorObject subdivideToGlobe(double epsilon) - { - VectorObject retVecObj = new VectorObject(); - if (!subdivideToGlobeNative(retVecObj,epsilon)) - return null; - - return retVecObj; + public VectorObject subdivideToGlobe(double epsilon) { + final VectorObject retVecObj = new VectorObject(); + return subdivideToGlobeNative(retVecObj,epsilon) ? retVecObj : null; } private native boolean subdivideToGlobeNative(VectorObject retVecObj,double epsilon); @@ -244,13 +269,9 @@ public VectorObject subdivideToGlobe(double epsilon) This will break up long edges in a vector until they lie flat on a globe to a given epsilon using a great circle route. The epsilon is in display coordinates (radius = 1.0). */ - public VectorObject subdivideToGlobeGreatCircle(double epsilon) - { - VectorObject retVecObj = new VectorObject(); - if (!subdivideToGlobeGreatCircleNative(retVecObj,epsilon)) - return null; - - return retVecObj; + public VectorObject subdivideToGlobeGreatCircle(double epsilon) { + final VectorObject retVecObj = new VectorObject(); + return subdivideToGlobeGreatCircleNative(retVecObj,epsilon) ? retVecObj : null; } private native boolean subdivideToGlobeGreatCircleNative(VectorObject retVecObj,double epsilon); @@ -260,13 +281,9 @@ public VectorObject subdivideToGlobeGreatCircle(double epsilon) This version samples a great circle to display on a flat map. */ - public VectorObject subdivideToFlatGreatCircle(double epsilon) - { - VectorObject retVecObj = new VectorObject(); - if (!subdivideToFlatGreatCircleNative(retVecObj,epsilon)) - return null; - - return retVecObj; + public VectorObject subdivideToFlatGreatCircle(double epsilon) { + final VectorObject retVecObj = new VectorObject(); + return subdivideToFlatGreatCircleNative(retVecObj,epsilon) ? retVecObj : null; } private native boolean subdivideToFlatGreatCircleNative(VectorObject retVecObj,double epsilon); @@ -277,13 +294,9 @@ public VectorObject subdivideToFlatGreatCircle(double epsilon) This will break up long edges in a vector until they lie flat on a globe to a given epsilon using a great circle route. The epsilon is in display coordinates (radius = 1.0). */ - public VectorObject subdivideToGlobeGreatCirclePrecise(double epsilon) - { - VectorObject retVecObj = new VectorObject(); - if (!subdivideToGlobeGreatCirclePreciseNative(retVecObj,epsilon)) - return null; - - return retVecObj; + public VectorObject subdivideToGlobeGreatCirclePrecise(double epsilon) { + final VectorObject retVecObj = new VectorObject(); + return subdivideToGlobeGreatCirclePreciseNative(retVecObj,epsilon) ? retVecObj : null; } private native boolean subdivideToGlobeGreatCirclePreciseNative(VectorObject retVecObj,double epsilon); @@ -293,27 +306,23 @@ public VectorObject subdivideToGlobeGreatCirclePrecise(double epsilon) This version samples a great circle to display on a flat map. */ - public VectorObject subdivideToFlatGreatCirclePrecise(double epsilon) - { - VectorObject retVecObj = new VectorObject(); - if (!subdivideToFlatGreatCirclePreciseNative(retVecObj,epsilon)) - return null; - - return retVecObj; + public VectorObject subdivideToFlatGreatCirclePrecise(double epsilon) { + final VectorObject retVecObj = new VectorObject(); + return subdivideToFlatGreatCirclePreciseNative(retVecObj,epsilon) ? retVecObj : null; } private native boolean subdivideToFlatGreatCirclePreciseNative(VectorObject retVecObj,double epsilon); /** - * Tesselate the areal features and return a new vector object. + * Tessellate the areal features and return a new vector object. */ - public VectorObject tesselate() - { - VectorObject retVecObj = new VectorObject(); - if (!tesselateNative(retVecObj)) - return null; - - return retVecObj; + @Deprecated + public VectorObject tesselate() { + return tessellate(); + } + public VectorObject tessellate() { + final VectorObject retVecObj = new VectorObject(); + return tesselateNative(retVecObj) ? retVecObj : null; } private native boolean tesselateNative(VectorObject retVecObj); @@ -321,13 +330,9 @@ public VectorObject tesselate() /** * Clip the given areal features to a grid of the given size. */ - public VectorObject clipToGrid(Point2d size) - { - VectorObject retVecObj = new VectorObject(); - if (!clipToGridNative(retVecObj,size.getX(),size.getY())) - return null; - - return retVecObj; + public VectorObject clipToGrid(Point2d size) { + final VectorObject retVecObj = new VectorObject(); + return clipToGridNative(retVecObj,size.getX(),size.getY()) ? retVecObj : null; } private native boolean clipToGridNative(VectorObject retVecObj,double sizeX,double sizeY); @@ -335,13 +340,9 @@ public VectorObject clipToGrid(Point2d size) /** * Clip the given features to an Mbr */ - public VectorObject clipToMbr(Mbr mbr) - { - VectorObject retVecObj = new VectorObject(); - if (!clipToMbrNative(retVecObj, mbr.ll.getX(), mbr.ll.getY(), mbr.ur.getX(), mbr.ur.getY())) - return null; - - return retVecObj; + public VectorObject clipToMbr(Mbr mbr) { + final VectorObject retVecObj = new VectorObject(); + return clipToMbrNative(retVecObj, mbr.ll.getX(), mbr.ll.getY(), mbr.ur.getX(), mbr.ur.getY()) ? retVecObj : null; } private native boolean clipToMbrNative(VectorObject retVecObj,double llX,double llY, double urX, double urY); @@ -356,13 +357,9 @@ public VectorObject clipToMbr(Mbr mbr) * @param destSystem Destination coordinate system that we'll project data into. * @return The new vector object or null. */ - public VectorObject reproject(CoordSystem srcSystem,double scale,CoordSystem destSystem) - { - VectorObject retVecObj = new VectorObject(); - if (!reprojectNative(retVecObj,srcSystem,scale,destSystem)) - return null; - - return retVecObj; + public VectorObject reproject(CoordSystem srcSystem,double scale,CoordSystem destSystem) { + final VectorObject retVecObj = new VectorObject(); + return reprojectNative(retVecObj,srcSystem,scale,destSystem) ? retVecObj : null; } private native boolean reprojectNative(VectorObject vecObj,CoordSystem srcSystem,double scale,CoordSystem destSystem); @@ -377,12 +374,9 @@ public VectorObject reproject(CoordSystem srcSystem,double scale,CoordSystem des * * @return The filtered vector object or null. */ - public VectorObject filterClippedEdges() - { - VectorObject retVecObj = new VectorObject(); - if (!filterClippedEdgesNative(retVecObj)) - return null; - return retVecObj; + public VectorObject filterClippedEdges() { + final VectorObject retVecObj = new VectorObject(); + return filterClippedEdgesNative(retVecObj) ? retVecObj : null; } private native boolean filterClippedEdgesNative(VectorObject vecObj); @@ -391,12 +385,9 @@ public VectorObject filterClippedEdges() * Convert any linears features into areals, by closing them and return * a new vector object or null. */ - public VectorObject linearsToAreals() - { - VectorObject retVecObj = new VectorObject(); - if (!linearsToArealsNative(retVecObj)) - return null; - return retVecObj; + public VectorObject linearsToAreals() { + final VectorObject retVecObj = new VectorObject(); + return linearsToArealsNative(retVecObj) ? retVecObj : null; } private native boolean linearsToArealsNative(VectorObject vecObj); @@ -405,12 +396,9 @@ public VectorObject linearsToAreals() * Convert any areal features to linears (just the outline) and return * a new vector object or null. */ - public VectorObject arealsToLinears() - { - VectorObject retVecObj = new VectorObject(); - if (!arealsToLinearsNative(retVecObj)) - return null; - return retVecObj; + public VectorObject arealsToLinears() { + final VectorObject retVecObj = new VectorObject(); + return arealsToLinearsNative(retVecObj) ? retVecObj : null; } private native boolean arealsToLinearsNative(VectorObject vecObj); @@ -433,6 +421,36 @@ public static VectorObject createFromGeoJSON(@NotNull String json) { return vo.fromGeoJSON(json) ? vo : null; } + /** + * Create a new vector object as a linear from a collection of points + */ + @Nullable + public static VectorObject createLineString(@NotNull Point2d[] points) { + return createLineString(points, null); + } + + /** + * Create a new vector object as a linear from a collection of points and attributes + */ + @Nullable + public static native VectorObject createLineString(@NotNull Point2d[] points, + @Nullable AttrDictionary attrs); + + /** + * Create a new vector object as a polygon from a collection of points + */ + @Nullable + public static VectorObject createAreal(@NotNull Point2d[] points) { + return createAreal(points, null); + } + + /** + * Create a new vector object as a polygon from a collection of points and attributes + */ + @Nullable + public static native VectorObject createAreal(@NotNull Point2d[] points, + @Nullable AttrDictionary attrs); + /** * Load vector objects from a Shapefile. * @param fileName The filename of the Shapefile. @@ -461,11 +479,9 @@ public VectorIterator splitVectors() { /** * Make a complete copy of the vector object and return it. */ - public VectorObject deepCopy() - { - VectorObject vecObj = new VectorObject(); + public VectorObject deepCopy() { + final VectorObject vecObj = new VectorObject(); deepCopyNative(vecObj); - return vecObj; } @@ -473,18 +489,14 @@ public VectorObject deepCopy() /** * Load vector objects from a GeoJSON assembly, which is just a bunch of GeoJSON stuck together. - * @param json - * @return */ static public native Map FromGeoJSONAssembly(String json); - public void finalize() - { + public void finalize() { dispose(); } - static - { + static { nativeInit(); } private static native void nativeInit(); diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VectorStyle.java b/android/library/maply/src/main/java/com/mousebird/maply/VectorStyle.java index 29ca3883fd..f34984693f 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VectorStyle.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VectorStyle.java @@ -2,7 +2,7 @@ * com.mousebird.maply * * Created by Steve Gifford. - * Copyright 2013-2032 mousebird consulting + * Copyright 2013-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VectorStyleInterface.java b/android/library/maply/src/main/java/com/mousebird/maply/VectorStyleInterface.java index d784ca2e50..7ae78f2304 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VectorStyleInterface.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VectorStyleInterface.java @@ -3,7 +3,7 @@ * com.mousebirdconsulting.maply * * Created by Steve Gifford. - * Copyright 2013-2019 mousebird consulting + * Copyright 2013-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VectorStyleProcessor.java b/android/library/maply/src/main/java/com/mousebird/maply/VectorStyleProcessor.java index e64ae73e32..fd96239dca 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VectorStyleProcessor.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VectorStyleProcessor.java @@ -3,7 +3,7 @@ * com.mousebirdconsulting.maply * * Created by Steve Gifford. - * Copyright 2013-2019 mousebird consulting + * Copyright 2013-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VectorTileData.java b/android/library/maply/src/main/java/com/mousebird/maply/VectorTileData.java index 80061abb26..498a777d09 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VectorTileData.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VectorTileData.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/12/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VectorTileLineStyle.java b/android/library/maply/src/main/java/com/mousebird/maply/VectorTileLineStyle.java index a091cc4d1f..1e15f87783 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VectorTileLineStyle.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VectorTileLineStyle.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/27/17. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VectorTileMarkerStyle.java b/android/library/maply/src/main/java/com/mousebird/maply/VectorTileMarkerStyle.java index 8911d70574..2783471d93 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VectorTileMarkerStyle.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VectorTileMarkerStyle.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/27/17. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VectorTilePolygonStyle.java b/android/library/maply/src/main/java/com/mousebird/maply/VectorTilePolygonStyle.java index f817547ef6..5283725de8 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VectorTilePolygonStyle.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VectorTilePolygonStyle.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/27/17. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VectorTileStyle.java b/android/library/maply/src/main/java/com/mousebird/maply/VectorTileStyle.java index d75055e618..1a5e611644 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VectorTileStyle.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VectorTileStyle.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/27/17. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VectorTileTextStyle.java b/android/library/maply/src/main/java/com/mousebird/maply/VectorTileTextStyle.java index c7e01b5417..d1590e2f2a 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VectorTileTextStyle.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VectorTileTextStyle.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/27/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/VertexAttribute.java b/android/library/maply/src/main/java/com/mousebird/maply/VertexAttribute.java index d92343d697..b3f5be8808 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/VertexAttribute.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/VertexAttribute.java @@ -5,7 +5,7 @@ * com.mousebirdconsulting.maply * * Created by Steve Gifford on 4/17/16. - * Copyright 2013-2016 mousebird consulting + * Copyright 2013-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/View.java b/android/library/maply/src/main/java/com/mousebird/maply/View.java index f4e9e87e12..2312c0e5c4 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/View.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/View.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/13/15. - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/ViewState.java b/android/library/maply/src/main/java/com/mousebird/maply/ViewState.java index c484e1faed..40d2179ad0 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/ViewState.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/ViewState.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/2/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/WideVectorInfo.java b/android/library/maply/src/main/java/com/mousebird/maply/WideVectorInfo.java index d6186f7c0c..c47a05d861 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/WideVectorInfo.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/WideVectorInfo.java @@ -1,15 +1,33 @@ +/* WideVectorInfo.java + * WhirlyGlobeLib + * + * Created by Steve Gifford on 6/2/14. + * Copyright 2011-2022 mousebird consulting + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.mousebird.maply; import android.graphics.Color; -import android.graphics.Point; + +import androidx.annotation.ColorInt; /** * The Wide Vector Info class holds visual information related to groups of vectors. * For efficiency's sake we put visual info in this class, rather than on * attributes in the vectors themselves. There may be attributes that can * override these, however. - * */ +@SuppressWarnings("unused") public class WideVectorInfo extends BaseInfo { /** @@ -17,14 +35,12 @@ public class WideVectorInfo extends BaseInfo */ public static int WideVectorPriorityDefault = 51000; - public WideVectorInfo() - { + public WideVectorInfo() { initialise(); setDrawPriority(WideVectorPriorityDefault); } - public void finalize() - { + public void finalize() { dispose(); } @@ -32,10 +48,10 @@ public void finalize() * Set the color used by the geometry. * @param color Color in Android format, including alpha. */ - public void setColor(int color) - { - setColor(Color.red(color)/255.f,Color.green(color)/255.f,Color.blue(color)/255.f,Color.alpha(color)/255.f); + public void setColor(int color) { + setColorInt(Color.red(color),Color.green(color),Color.blue(color),Color.alpha(color)); } + public native @ColorInt int getColor(); /** * Set the color used by the geometry. Color values range from 0 to 1.0. @@ -47,56 +63,86 @@ public void setColor(int color) */ public native void setColor(float r,float g,float b,float a); + /** + * Set the color used by the geometry. Color values range from 0 to 1.0. + * You must specify all four values. Alpha controls transparency. + * @param r Red component. + * @param g Green component. + * @param b Blue component. + * @param a Alpha component. + */ + public native void setColorInt(int r,int g,int b,int a); + /** * This is the line width for vector features. By default this is 1.0. */ public native void setLineWidth(float lineWidth); + public native float getLineWidth(); /** * This is the repeat size for a texture applied along the widened line. * The value is in pixels for screen widths. */ public native void setTextureRepeatLength(double repeatLen); + public native double getTextureRepeatLength(); /** * Number of pixels to use in blending the edges of the wide vectors. */ public native void setEdgeFalloff(double falloff); + public native double getEdgeFalloff(); - enum JoinType {MiterJoin,BevelJoin}; + public enum JoinType {MiterJoin,RoundJoin,BevelJoin}; /** * When lines meet in a join there are several options for representing them. * These include MiterJoin, which is a simple miter join and BevelJoin which is a more complicated bevel. * See http://www.w3.org/TR/SVG/painting.html#StrokeLinejoinProperty for how these look. */ - public void setJoinType(JoinType joinType) - { - setJoinTypeNative(joinType.ordinal()); - } + public void setJoinType(JoinType joinType) { setJoinTypeNative(joinType.ordinal()); } + public JoinType getJoinType() { return JoinType.values()[getJoinTypeNative()]; } native void setJoinTypeNative(int joinType); + native int getJoinTypeNative(); /** * When using miter joins you can trigger them at a certain threshold. */ public native void setMitreLimit(double mitreLimit); + public native double getMitreLimit(); /** * This the texture to be applied to the widened vector. */ - public void setTexture(MaplyTexture tex) - { + public void setTexture(MaplyTexture tex) { setTexID(tex.texID); } /** * Set the texture to be applied by ID. */ - native void setTexID(long texID); + public native void setTexID(long texID); + public native long getTexID(); + + /** + * Whether the items are selectable + */ + public native void setSelectable(boolean enable); + public native boolean getSelectable(); + + /** + * Offset to the left or right of the center-line + */ + public native void setOffset(double pixels); + public native double getOffset(); + + /** + * Close any un-closed areal features when drawing lines for them + */ + public native void setCloseAreals(boolean close); + public native boolean getCloseAreals(); - static - { + static { nativeInit(); } private static native void nativeInit(); diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDBinaryOperatorExpression.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDBinaryOperatorExpression.java index 5e38dae8dd..2b8ff4b804 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDBinaryOperatorExpression.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDBinaryOperatorExpression.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDExpression.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDExpression.java index 79e20cbed4..560cec76db 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDExpression.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDExpression.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDExpressionFactory.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDExpressionFactory.java index b5ab0ca0ce..1f4ea7ec74 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDExpressionFactory.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDExpressionFactory.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDLiteralExpression.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDLiteralExpression.java index 3be6d77650..c4353c1a32 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDLiteralExpression.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDLiteralExpression.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDPropertyNameExpression.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDPropertyNameExpression.java index 661f7728cc..d7d3601048 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDPropertyNameExpression.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldexpressions/SLDPropertyNameExpression.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDBinaryComparisonOperator.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDBinaryComparisonOperator.java index 7513d2f290..1bfad5a3ed 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDBinaryComparisonOperator.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDBinaryComparisonOperator.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDIsBetweenOperator.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDIsBetweenOperator.java index b19a357031..d8e91e8841 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDIsBetweenOperator.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDIsBetweenOperator.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDIsLikeOperator.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDIsLikeOperator.java index 4aec08b868..86f0a71df6 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDIsLikeOperator.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDIsLikeOperator.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDIsNullOperator.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDIsNullOperator.java index 7d6ffd1e49..51a0f44d1d 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDIsNullOperator.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDIsNullOperator.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDLogicalOperator.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDLogicalOperator.java index a1d9cf5368..90bd0de4b1 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDLogicalOperator.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDLogicalOperator.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDNotOperator.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDNotOperator.java index ad6fbb56b4..6d663931cc 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDNotOperator.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDNotOperator.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDOperator.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDOperator.java index d0aa64594a..7fa4ee9a2f 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDOperator.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDOperator.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDOperatorFactory.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDOperatorFactory.java index e85e15f33b..9cec3bba2c 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDOperatorFactory.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldoperators/SLDOperatorFactory.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDFeatureTypeStyle.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDFeatureTypeStyle.java index 072fd0243c..e494311331 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDFeatureTypeStyle.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDFeatureTypeStyle.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDFilter.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDFilter.java index 4fd2fba6dd..725fc7c029 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDFilter.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDFilter.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDNamedLayer.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDNamedLayer.java index deac55f0b6..1a4d7e9c1e 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDNamedLayer.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDNamedLayer.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDParseHelper.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDParseHelper.java index ce14721b88..339ae5b7f3 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDParseHelper.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDParseHelper.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDRule.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDRule.java index 42a4b01ff4..ef2e9fa8f8 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDRule.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDRule.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDStyleSet.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDStyleSet.java index b8066c9d1e..a8b92bfa67 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDStyleSet.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDStyleSet.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDUserStyle.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDUserStyle.java index d7740fab77..191f58a162 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDUserStyle.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldstyleset/SLDUserStyle.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDLineSymbolizer.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDLineSymbolizer.java index 51fe185c4b..a1f37224af 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDLineSymbolizer.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDLineSymbolizer.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDPointSymbolizer.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDPointSymbolizer.java index 140b71ba26..c812778289 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDPointSymbolizer.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDPointSymbolizer.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDPolygonSymbolizer.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDPolygonSymbolizer.java index dab368ad7b..2fee6892b5 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDPolygonSymbolizer.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDPolygonSymbolizer.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDSymbolizer.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDSymbolizer.java index ec5f981f36..f38cb378f7 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDSymbolizer.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDSymbolizer.java @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDSymbolizerFactory.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDSymbolizerFactory.java index 2fe7cc6735..2e7ed6aff4 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDSymbolizerFactory.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDSymbolizerFactory.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDTextSymbolizer.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDTextSymbolizer.java index 131d348ae2..df8c0078c7 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDTextSymbolizer.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDTextSymbolizer.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 3/14/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDWellKnownMarkers.java b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDWellKnownMarkers.java index 3db6873d82..1258edf8ee 100644 --- a/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDWellKnownMarkers.java +++ b/android/library/maply/src/main/java/com/mousebird/maply/sld/sldsymbolizers/SLDWellKnownMarkers.java @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Ranen Ghosh on 7/10/17. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/CesiumElevationTestCase.h b/code graveyard/CesiumElevationTestCase.h index 54df2c0bb7..6c31dfef8d 100644 --- a/code graveyard/CesiumElevationTestCase.h +++ b/code graveyard/CesiumElevationTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 24/10/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2017 mousebird consulting. // #import diff --git a/code graveyard/ElevationCesiumChunk.h b/code graveyard/ElevationCesiumChunk.h index 8322336417..4558bc6b57 100644 --- a/code graveyard/ElevationCesiumChunk.h +++ b/code graveyard/ElevationCesiumChunk.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by @jmnavarro on 6/22/15. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ElevationCesiumChunk.mm b/code graveyard/ElevationCesiumChunk.mm index 111e5223c5..225161b26b 100644 --- a/code graveyard/ElevationCesiumChunk.mm +++ b/code graveyard/ElevationCesiumChunk.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/24/13. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ElevationCesiumFormat.h b/code graveyard/ElevationCesiumFormat.h index d4b888985d..69524418aa 100644 --- a/code graveyard/ElevationCesiumFormat.h +++ b/code graveyard/ElevationCesiumFormat.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by @jmnavarro on 6/16/15. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ElevationChunk.h b/code graveyard/ElevationChunk.h index d4014a4215..353dcb6688 100644 --- a/code graveyard/ElevationChunk.h +++ b/code graveyard/ElevationChunk.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/24/13. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ElevationChunk.mm b/code graveyard/ElevationChunk.mm index 4dc6885d65..73cb2b130a 100644 --- a/code graveyard/ElevationChunk.mm +++ b/code graveyard/ElevationChunk.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/24/13. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ElevationLocalDatabase.h b/code graveyard/ElevationLocalDatabase.h index ca5b2c84ce..3a79d214c5 100644 --- a/code graveyard/ElevationLocalDatabase.h +++ b/code graveyard/ElevationLocalDatabase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 10/12/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2017 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/code graveyard/ios/apps/AutoTester/AerisWeatherTestCase.h b/code graveyard/ios/apps/AutoTester/AerisWeatherTestCase.h index b3411b83f7..e085b6b8f9 100644 --- a/code graveyard/ios/apps/AutoTester/AerisWeatherTestCase.h +++ b/code graveyard/ios/apps/AutoTester/AerisWeatherTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Ranen Ghosh on 3/11/16. -// Copyright © 2016-2017 mousebird consulting. All rights reserved. +// Copyright 2016-2017 mousebird consulting. All rights reserved. // #import "MaplyTestCase.h" diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MapboxMultiSourceTileInfo.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MapboxMultiSourceTileInfo.h index 2a4fbd6a62..7cf7ac2195 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MapboxMultiSourceTileInfo.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MapboxMultiSourceTileInfo.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/23/15. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MapboxVectorTilesPagingDelegate.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MapboxVectorTilesPagingDelegate.h index b3602372c3..dda80cbdb5 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MapboxVectorTilesPagingDelegate.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MapboxVectorTilesPagingDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Jesse Crocker, Trailbehind inc. on 3/31/14. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyAerisTiles.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyAerisTiles.h index 98583d3ad2..a3145bd12f 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyAerisTiles.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyAerisTiles.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Ranen Ghosh on 3/4/16. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyAnimationTestTileSource.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyAnimationTestTileSource.h index 70cfecd711..e820d4bfd2 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyAnimationTestTileSource.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyAnimationTestTileSource.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/4/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyBlankTileSource.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyBlankTileSource.h index 285d5f1128..6b2d1f0371 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyBlankTileSource.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyBlankTileSource.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 7/15/15. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyElevationDatabase.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyElevationDatabase.h index f6a43eaf7e..fe5d73a4a6 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyElevationDatabase.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyElevationDatabase.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/7/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyElevationSource.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyElevationSource.h index e373fa1dad..086bfb1c3a 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyElevationSource.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyElevationSource.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 8/29/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyElevationSource_private.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyElevationSource_private.h index eefafbb059..2ac6217e0f 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyElevationSource_private.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyElevationSource_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 8/29/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyGDALRetileSource.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyGDALRetileSource.h index b4db6a75ae..cb5f6f4f10 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyGDALRetileSource.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyGDALRetileSource.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 12/2/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyLAZMeshBuilder.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyLAZMeshBuilder.h index a5c3390602..4e468d2f53 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyLAZMeshBuilder.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyLAZMeshBuilder.h @@ -3,7 +3,7 @@ // LidarViewer // // Created by Steve Gifford on 6/29/16. -// Copyright © 2016 mousebird consulting. All rights reserved. +// Copyright 2016 mousebird consulting. All rights reserved. // #ifndef MeshBuilder_h diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyLAZQuadReader.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyLAZQuadReader.h index 48dc7f5577..f40bf5047a 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyLAZQuadReader.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyLAZQuadReader.h @@ -3,7 +3,7 @@ // LidarViewer // // Created by Steve Gifford on 4/13/16. -// Copyright © 2016-2017 mousebird consulting. All rights reserved. +// Copyright 2016-2017 mousebird consulting. All rights reserved. // #import diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyLAZShader.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyLAZShader.h index 6df265621c..b0f20ae1f7 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyLAZShader.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyLAZShader.h @@ -3,7 +3,7 @@ // LidarViewer // // Created by Steve Gifford on 10/27/15. -// Copyright © 2015-2017 mousebird consulting. All rights reserved. +// Copyright 2015-2017 mousebird consulting. All rights reserved. // #import diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyMBTileSource.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyMBTileSource.h index 477260a2c8..e094af8e43 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyMBTileSource.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyMBTileSource.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/4/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyMultiplexTileSource.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyMultiplexTileSource.h index 11cfc03054..651dd08a98 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyMultiplexTileSource.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyMultiplexTileSource.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/5/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyPagingElevationTestTileSource.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyPagingElevationTestTileSource.h index 9ea2410d8d..c92271ce2f 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyPagingElevationTestTileSource.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyPagingElevationTestTileSource.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/19/14. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyPagingVectorTestTileSource.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyPagingVectorTestTileSource.h index 4f8548b167..592df5b232 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyPagingVectorTestTileSource.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyPagingVectorTestTileSource.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/19/14. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadImageOfflineLayer.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadImageOfflineLayer.h index 0d38d63e11..e1a2aa80b4 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadImageOfflineLayer.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadImageOfflineLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 10/7/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadImageTilesLayer.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadImageTilesLayer.h index 38fdd55eb5..b45cc2c01a 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadImageTilesLayer.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadImageTilesLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/13/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadImageTilesLayer_private.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadImageTilesLayer_private.h index 002cfcb536..f47dc9d3c9 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadImageTilesLayer_private.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadImageTilesLayer_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/13/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadPagingLayer.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadPagingLayer.h index ee61a83e55..38b47de887 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadPagingLayer.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadPagingLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/20/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadPagingLayer_private.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadPagingLayer_private.h index 0891f730ca..c00f040fc8 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadPagingLayer_private.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadPagingLayer_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/20/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadTracker.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadTracker.h index 5cb25e52df..1c2cfb2856 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadTracker.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadTracker.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/27/15. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadTracker_private.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadTracker_private.h index ef1e88be01..137812fef9 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadTracker_private.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyQuadTracker_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/27/15. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyRemoteTileElevationSource.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyRemoteTileElevationSource.h index bcbd66d18c..2f702c015c 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyRemoteTileElevationSource.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyRemoteTileElevationSource.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by @jmnavarro on 6/16/15. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyRemoteTileSource.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyRemoteTileSource.h index aef78b822d..087b97278b 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyRemoteTileSource.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyRemoteTileSource.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/4/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyRemoteTileSource_private.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyRemoteTileSource_private.h index 369109c744..009d52a2b1 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyRemoteTileSource_private.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyRemoteTileSource_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/4/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplySphericalQuadEarthWithTexGroup.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplySphericalQuadEarthWithTexGroup.h index aff067e827..7d59e3f8dd 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplySphericalQuadEarthWithTexGroup.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplySphericalQuadEarthWithTexGroup.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/24/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplySphericalQuadEarthWithTexGroup_private.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplySphericalQuadEarthWithTexGroup_private.h index b464d90a46..74f0396969 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplySphericalQuadEarthWithTexGroup_private.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplySphericalQuadEarthWithTexGroup_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/24/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyTileSource.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyTileSource.h index a6a97c82d0..ab6132bb20 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyTileSource.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyTileSource.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/7/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/WGSphericalEarthWithTexGroup_private.h b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/WGSphericalEarthWithTexGroup_private.h index e640bfca5d..e79f79e9ac 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/WGSphericalEarthWithTexGroup_private.h +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/include/WGSphericalEarthWithTexGroup_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MapboxMultiSourceTileInfo.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MapboxMultiSourceTileInfo.mm index dd18a69ed6..648c8ed74b 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MapboxMultiSourceTileInfo.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MapboxMultiSourceTileInfo.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/23/15. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MapboxVectorTilesPagingDelegate.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MapboxVectorTilesPagingDelegate.mm index 3e0774179e..05d4497961 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MapboxVectorTilesPagingDelegate.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MapboxVectorTilesPagingDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Jesse Crocker, Trailbehind inc. on 3/31/14. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyAerisTiles.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyAerisTiles.mm index 040ecaf49b..ceb24f6f8c 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyAerisTiles.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyAerisTiles.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Ranen Ghosh on 3/4/16. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyAnimationTestTileSource.m b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyAnimationTestTileSource.m index 704f995e1e..cd53ea5812 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyAnimationTestTileSource.m +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyAnimationTestTileSource.m @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/4/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyBlankTileSource.m b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyBlankTileSource.m index 94a2479d16..4814073880 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyBlankTileSource.m +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyBlankTileSource.m @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 7/15/15. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyElevationDatabase.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyElevationDatabase.mm index 1b2dfbc66d..b3f297bb66 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyElevationDatabase.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyElevationDatabase.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/7/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyElevationSource.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyElevationSource.mm index 7624d5ca27..f5e49be753 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyElevationSource.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyElevationSource.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 8/29/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyGDALRetileSource.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyGDALRetileSource.mm index acbaa0eebe..3a0c55aa5c 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyGDALRetileSource.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyGDALRetileSource.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 12/2/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyMBTileSource.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyMBTileSource.mm index fa92b0b97f..86dcafcafa 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyMBTileSource.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyMBTileSource.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/4/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyMultiplexTileSource.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyMultiplexTileSource.mm index 0aec09ba73..ba34c686aa 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyMultiplexTileSource.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyMultiplexTileSource.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/5/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyPagingElevationTestTileSource.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyPagingElevationTestTileSource.mm index 3940ad2c13..f08fa75f2f 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyPagingElevationTestTileSource.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyPagingElevationTestTileSource.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/19/14. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyPagingVectorTestTileSource.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyPagingVectorTestTileSource.mm index f940e497ff..90a8de3250 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyPagingVectorTestTileSource.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyPagingVectorTestTileSource.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/19/14. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadImageOfflineLayer.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadImageOfflineLayer.mm index 3eaa340f21..1baa6e002e 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadImageOfflineLayer.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadImageOfflineLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 10/7/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadImageTilesLayer.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadImageTilesLayer.mm index 33ee5d91cb..113e95f358 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadImageTilesLayer.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadImageTilesLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/13/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadPagingLayer.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadPagingLayer.mm index 38aac099ac..5e987d9829 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadPagingLayer.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadPagingLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/20/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadTracker.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadTracker.mm index 90ed95637d..93052f3ed4 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadTracker.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyQuadTracker.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/27/15. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyRemoteTileElevationSource.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyRemoteTileElevationSource.mm index 5a5550f5bc..dc7c68a800 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyRemoteTileElevationSource.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyRemoteTileElevationSource.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by @jmnavarro on 6/16/15. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyRemoteTileSource.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyRemoteTileSource.mm index 505b07e8eb..d2b3ca8a95 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyRemoteTileSource.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyRemoteTileSource.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/4/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplySphericalQuadEarthWithTexGroup.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplySphericalQuadEarthWithTexGroup.mm index aa0f592b76..785f8a56a0 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplySphericalQuadEarthWithTexGroup.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplySphericalQuadEarthWithTexGroup.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/24/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyTileSource.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyTileSource.mm index d487c828a7..a99351f5cb 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyTileSource.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/MaplyTileSource.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 10/18/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/WGSphericalEarthWithTexGroup.mm b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/WGSphericalEarthWithTexGroup.mm index ef3eeaa422..f2c6d616a4 100644 --- a/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/WGSphericalEarthWithTexGroup.mm +++ b/code graveyard/ios/library/WhirlyGlobe-MaplyComponent/src/WGSphericalEarthWithTexGroup.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/BigDrawable.h b/code graveyard/ios/library/WhirlyGlobeLib/include/BigDrawable.h index f5cb6fb643..f7f8a84052 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/BigDrawable.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/BigDrawable.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/6/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/BufferBuilder.h b/code graveyard/ios/library/WhirlyGlobeLib/include/BufferBuilder.h index 3064579efd..2d44d2d739 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/BufferBuilder.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/BufferBuilder.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 11/21/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/Cullable.h b/code graveyard/ios/library/WhirlyGlobeLib/include/Cullable.h index 1ea41c8a2a..753b61e3e8 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/Cullable.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/Cullable.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/DefaultShaderPrograms.h b/code graveyard/ios/library/WhirlyGlobeLib/include/DefaultShaderPrograms.h index 13e8398f1d..1ba2646c9f 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/DefaultShaderPrograms.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/DefaultShaderPrograms.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/29/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/DynamicDrawableAtlas.h b/code graveyard/ios/library/WhirlyGlobeLib/include/DynamicDrawableAtlas.h index 14219033ef..4c1c3ffa8c 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/DynamicDrawableAtlas.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/DynamicDrawableAtlas.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/6/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/Generator.h b/code graveyard/ios/library/WhirlyGlobeLib/include/Generator.h index 20d0a97c97..189edb9be2 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/Generator.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/Generator.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/10/11. - * Copyright 2011-2017 mousebird consulting. All rights reserved. + * Copyright 2011-2022 mousebird consulting. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/LongPressDelegate.h b/code graveyard/ios/library/WhirlyGlobeLib/include/LongPressDelegate.h index 01354da16c..b77299d0f9 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/LongPressDelegate.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/LongPressDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/22/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/MBTileQuadSource.h b/code graveyard/ios/library/WhirlyGlobeLib/include/MBTileQuadSource.h index 07971fca63..4134376615 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/MBTileQuadSource.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/MBTileQuadSource.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/23/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/MaplyVectorTiles.h b/code graveyard/ios/library/WhirlyGlobeLib/include/MaplyVectorTiles.h index 2d8e3e8e34..c16b18c924 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/MaplyVectorTiles.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/MaplyVectorTiles.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/NetworkTileQuadSource.h b/code graveyard/ios/library/WhirlyGlobeLib/include/NetworkTileQuadSource.h index dd2d746a2e..a183874d5c 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/NetworkTileQuadSource.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/NetworkTileQuadSource.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/11/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/PanDelegate.h b/code graveyard/ios/library/WhirlyGlobeLib/include/PanDelegate.h index e08ff92923..2727238e4c 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/PanDelegate.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/PanDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/18/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/ParticleSystemDrawableBuilderMTL.h b/code graveyard/ios/library/WhirlyGlobeLib/include/ParticleSystemDrawableBuilderMTL.h index c36b9afd31..4d5d84ca00 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/ParticleSystemDrawableBuilderMTL.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/ParticleSystemDrawableBuilderMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/ParticleSystemDrawableMTL.h b/code graveyard/ios/library/WhirlyGlobeLib/include/ParticleSystemDrawableMTL.h index fd8c9ec168..27d4e93e38 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/ParticleSystemDrawableMTL.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/ParticleSystemDrawableMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/PinchDelegate.h b/code graveyard/ios/library/WhirlyGlobeLib/include/PinchDelegate.h index 513fad22f1..f698061979 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/PinchDelegate.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/PinchDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/17/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/QuadDisplayLayer.h b/code graveyard/ios/library/WhirlyGlobeLib/include/QuadDisplayLayer.h index fcae116d69..8c063649c1 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/QuadDisplayLayer.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/QuadDisplayLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/17/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/Quadtree.h b/code graveyard/ios/library/WhirlyGlobeLib/include/Quadtree.h index 2e440dab53..75fa14202c 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/Quadtree.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/Quadtree.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/28/11. - * Copyright 2012-2017 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/SceneGraphManager.h b/code graveyard/ios/library/WhirlyGlobeLib/include/SceneGraphManager.h index fdb835b4bc..8c38f20d67 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/SceneGraphManager.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/SceneGraphManager.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/24/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/ScreenSpaceGenerator.h b/code graveyard/ios/library/WhirlyGlobeLib/include/ScreenSpaceGenerator.h index 91d0da8df5..a1a7faf3c2 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/ScreenSpaceGenerator.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/ScreenSpaceGenerator.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/12. - * Copyright 2011-2013 mousebird consulting. All rights reserved. + * Copyright 2011-2022 mousebird consulting. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/SphericalEarthChunkLayer.h b/code graveyard/ios/library/WhirlyGlobeLib/include/SphericalEarthChunkLayer.h index f9b249a3c0..38eb37abdd 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/SphericalEarthChunkLayer.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/SphericalEarthChunkLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/29/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/SphericalEarthLayer.h b/code graveyard/ios/library/WhirlyGlobeLib/include/SphericalEarthLayer.h index 393cff817a..8384191b8a 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/SphericalEarthLayer.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/SphericalEarthLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/11/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/SphericalEarthQuadLayer.h b/code graveyard/ios/library/WhirlyGlobeLib/include/SphericalEarthQuadLayer.h index da3529df47..d327c4db37 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/SphericalEarthQuadLayer.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/SphericalEarthQuadLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/6/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/SwipeDelegate.h b/code graveyard/ios/library/WhirlyGlobeLib/include/SwipeDelegate.h index ebae616863..2e1eeadae4 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/SwipeDelegate.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/SwipeDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/17/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/TextureGroup.h b/code graveyard/ios/library/WhirlyGlobeLib/include/TextureGroup.h index feb4c2b10b..6d281777b1 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/TextureGroup.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/TextureGroup.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/3/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/TileQuadLoader.h b/code graveyard/ios/library/WhirlyGlobeLib/include/TileQuadLoader.h index 94f285a1fb..1089c4ac30 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/TileQuadLoader.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/TileQuadLoader.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/27/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/TileQuadOfflineRenderer.h b/code graveyard/ios/library/WhirlyGlobeLib/include/TileQuadOfflineRenderer.h index def22f4a67..233aa2cad1 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/TileQuadOfflineRenderer.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/TileQuadOfflineRenderer.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/7/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/include/VectorDatabase.h b/code graveyard/ios/library/WhirlyGlobeLib/include/VectorDatabase.h index c0b036690e..8d10e1d2eb 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/include/VectorDatabase.h +++ b/code graveyard/ios/library/WhirlyGlobeLib/include/VectorDatabase.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/12/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/BigDrawable.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/BigDrawable.mm index 42d51cffbb..0013edb054 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/BigDrawable.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/BigDrawable.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/6/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/BufferBuilder.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/BufferBuilder.mm index 82181107a8..a179ac8fd4 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/BufferBuilder.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/BufferBuilder.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 11/21/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/Cullable.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/Cullable.mm index 623d952915..d90f32c005 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/Cullable.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/Cullable.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/DefaultShaderPrograms.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/DefaultShaderPrograms.mm index ecbd6cb19e..1d38fb385e 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/DefaultShaderPrograms.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/DefaultShaderPrograms.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/29/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/DynamicDrawableAtlas.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/DynamicDrawableAtlas.mm index 4cc1832567..2c2c994fa9 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/DynamicDrawableAtlas.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/DynamicDrawableAtlas.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/6/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/EAGLView.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/EAGLView.mm index 885594336d..53c8a76f89 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/EAGLView.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/EAGLView.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/5/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/Generator.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/Generator.mm index 3abee6fae8..40fb2b39d7 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/Generator.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/Generator.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/11/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/LongPressDelegate.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/LongPressDelegate.mm index f6f81d33cb..dc40ae3b38 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/LongPressDelegate.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/LongPressDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/22/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/MBTileQuadSource.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/MBTileQuadSource.mm index c7fd7763bd..a488ec97ac 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/MBTileQuadSource.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/MBTileQuadSource.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/23/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/MaplyVectorTiles.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/MaplyVectorTiles.mm index 22cead5f82..7a71db41b4 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/MaplyVectorTiles.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/MaplyVectorTiles.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/NetworkTileQuadSource.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/NetworkTileQuadSource.mm index 139e23a062..57abd4c05a 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/NetworkTileQuadSource.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/NetworkTileQuadSource.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/11/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/PanDelegate.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/PanDelegate.mm index 09e7a8d9e2..3b700d6387 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/PanDelegate.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/PanDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/18/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/ParticleSystemDrawableBuilderMTL.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/ParticleSystemDrawableBuilderMTL.mm index c9bdb4d84d..745812d74f 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/ParticleSystemDrawableBuilderMTL.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/ParticleSystemDrawableBuilderMTL.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/ParticleSystemDrawableMTL.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/ParticleSystemDrawableMTL.mm index a2e7a77376..703d9578f4 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/ParticleSystemDrawableMTL.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/ParticleSystemDrawableMTL.mm @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/PinchDelegate.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/PinchDelegate.mm index 50c9e2b52e..46b48b9e44 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/PinchDelegate.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/PinchDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/17/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/QuadDisplayLayer.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/QuadDisplayLayer.mm index 1f387d5b0b..38acc7c6f2 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/QuadDisplayLayer.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/QuadDisplayLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/17/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/Quadtree.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/Quadtree.mm index c44eae9cae..1f2dc663d7 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/Quadtree.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/Quadtree.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/29/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/SceneGraphManager.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/SceneGraphManager.mm index 0deb0295ac..5f28d4a6ba 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/SceneGraphManager.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/SceneGraphManager.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/24/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/SceneRendererGLES_iOS.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/SceneRendererGLES_iOS.mm index 1ad92bf42b..3e48173250 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/SceneRendererGLES_iOS.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/SceneRendererGLES_iOS.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/28/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/ScreenSpaceGenerator.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/ScreenSpaceGenerator.mm index f0d965a0bd..45ad7a17fb 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/ScreenSpaceGenerator.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/ScreenSpaceGenerator.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/12. - * Copyright 2011-2013 mousebird consulting. All rights reserved. + * Copyright 2011-2022 mousebird consulting. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/SphericalEarthChunkLayer.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/SphericalEarthChunkLayer.mm index 7e070786a9..2af0358c57 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/SphericalEarthChunkLayer.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/SphericalEarthChunkLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/23/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/SphericalEarthLayer.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/SphericalEarthLayer.mm index 45207f9285..d9f876f424 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/SphericalEarthLayer.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/SphericalEarthLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/11/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/SphericalEarthQuadLayer.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/SphericalEarthQuadLayer.mm index 0a868e9a12..f257b4575c 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/SphericalEarthQuadLayer.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/SphericalEarthQuadLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/6/12. - * Copyright 2012-2017 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/SwipeDelegate.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/SwipeDelegate.mm index fa0df26a38..3b8c680e18 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/SwipeDelegate.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/SwipeDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/17/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/TextureGroup.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/TextureGroup.mm index 387290549d..42eef22336 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/TextureGroup.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/TextureGroup.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/3/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/TileQuadLoader.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/TileQuadLoader.mm index fd911fb106..1a284a5072 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/TileQuadLoader.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/TileQuadLoader.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/27/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/TileQuadOfflineRenderer.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/TileQuadOfflineRenderer.mm index 47997739ce..78d073b56a 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/TileQuadOfflineRenderer.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/TileQuadOfflineRenderer.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/7/13. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/code graveyard/ios/library/WhirlyGlobeLib/src/VectorDatabase.mm b/code graveyard/ios/library/WhirlyGlobeLib/src/VectorDatabase.mm index 7775fd4e73..413fea3611 100644 --- a/code graveyard/ios/library/WhirlyGlobeLib/src/VectorDatabase.mm +++ b/code graveyard/ios/library/WhirlyGlobeLib/src/VectorDatabase.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/13/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/ActiveModel.h b/common/WhirlyGlobeLib/include/ActiveModel.h index 3f1c84b881..e271b3d080 100644 --- a/common/WhirlyGlobeLib/include/ActiveModel.h +++ b/common/WhirlyGlobeLib/include/ActiveModel.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 8/16/11. - * Copyright 2012-2021 mousebird consulting. + * Copyright 2012-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/BaseInfo.h b/common/WhirlyGlobeLib/include/BaseInfo.h index 8330fd89f2..50d5adaaf9 100644 --- a/common/WhirlyGlobeLib/include/BaseInfo.h +++ b/common/WhirlyGlobeLib/include/BaseInfo.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/6/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,9 +90,8 @@ typedef std::shared_ptr ColorExpressionInfoRef; /** Object use as the base for parsing description dictionaries. */ -class BaseInfo +struct BaseInfo { -public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW; BaseInfo(); @@ -100,7 +99,7 @@ class BaseInfo BaseInfo(const Dictionary &dict); // Convert contents to a string for debugging - virtual std::string toString(); + virtual std::string toString() const; /// Set the various parameters on a basic drawable void setupBasicDrawable(BasicDrawableBuilder *drawBuild) const; diff --git a/common/WhirlyGlobeLib/include/BasicDrawable.h b/common/WhirlyGlobeLib/include/BasicDrawable.h index a92e303c19..0e985499b6 100644 --- a/common/WhirlyGlobeLib/include/BasicDrawable.h +++ b/common/WhirlyGlobeLib/include/BasicDrawable.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/BasicDrawableBuilder.h b/common/WhirlyGlobeLib/include/BasicDrawableBuilder.h index 48c10c782b..6af9f6f160 100644 --- a/common/WhirlyGlobeLib/include/BasicDrawableBuilder.h +++ b/common/WhirlyGlobeLib/include/BasicDrawableBuilder.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/9/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/BasicDrawableBuilderGLES.h b/common/WhirlyGlobeLib/include/BasicDrawableBuilderGLES.h index 4c84b92412..99939d12ef 100644 --- a/common/WhirlyGlobeLib/include/BasicDrawableBuilderGLES.h +++ b/common/WhirlyGlobeLib/include/BasicDrawableBuilderGLES.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/10/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/BasicDrawableGLES.h b/common/WhirlyGlobeLib/include/BasicDrawableGLES.h index 1c3795dd8e..2b95ec4e0f 100644 --- a/common/WhirlyGlobeLib/include/BasicDrawableGLES.h +++ b/common/WhirlyGlobeLib/include/BasicDrawableGLES.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/BasicDrawableInstance.h b/common/WhirlyGlobeLib/include/BasicDrawableInstance.h index 5662c25f26..9e0a1f451a 100644 --- a/common/WhirlyGlobeLib/include/BasicDrawableInstance.h +++ b/common/WhirlyGlobeLib/include/BasicDrawableInstance.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/BasicDrawableInstanceBuilder.h b/common/WhirlyGlobeLib/include/BasicDrawableInstanceBuilder.h index 875a1167b1..cf2af2f2f6 100644 --- a/common/WhirlyGlobeLib/include/BasicDrawableInstanceBuilder.h +++ b/common/WhirlyGlobeLib/include/BasicDrawableInstanceBuilder.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/9/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/BasicDrawableInstanceBuilderGLES.h b/common/WhirlyGlobeLib/include/BasicDrawableInstanceBuilderGLES.h index be26b15aa2..279fe036e0 100644 --- a/common/WhirlyGlobeLib/include/BasicDrawableInstanceBuilderGLES.h +++ b/common/WhirlyGlobeLib/include/BasicDrawableInstanceBuilderGLES.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/10/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/BasicDrawableInstanceGLES.h b/common/WhirlyGlobeLib/include/BasicDrawableInstanceGLES.h index 6a4abebb59..f552fdc264 100644 --- a/common/WhirlyGlobeLib/include/BasicDrawableInstanceGLES.h +++ b/common/WhirlyGlobeLib/include/BasicDrawableInstanceGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/10/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/BillboardDrawableBuilder.h b/common/WhirlyGlobeLib/include/BillboardDrawableBuilder.h index 804f1d8d99..0ea092d8e6 100644 --- a/common/WhirlyGlobeLib/include/BillboardDrawableBuilder.h +++ b/common/WhirlyGlobeLib/include/BillboardDrawableBuilder.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/27/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/BillboardDrawableBuilderGLES.h b/common/WhirlyGlobeLib/include/BillboardDrawableBuilderGLES.h index 2b8c0c6c0f..6c9b5f346b 100644 --- a/common/WhirlyGlobeLib/include/BillboardDrawableBuilderGLES.h +++ b/common/WhirlyGlobeLib/include/BillboardDrawableBuilderGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/15/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/BillboardManager.h b/common/WhirlyGlobeLib/include/BillboardManager.h index f650e0c2b1..1a7a72136f 100644 --- a/common/WhirlyGlobeLib/include/BillboardManager.h +++ b/common/WhirlyGlobeLib/include/BillboardManager.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/ChangeRequest.h b/common/WhirlyGlobeLib/include/ChangeRequest.h index c610ec8dcb..6b39e20f68 100644 --- a/common/WhirlyGlobeLib/include/ChangeRequest.h +++ b/common/WhirlyGlobeLib/include/ChangeRequest.h @@ -1,9 +1,8 @@ -/* - * ChangeRequest.h +/* ChangeRequest.h * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import @@ -67,8 +65,8 @@ class SceneRenderer; class ChangeRequest { public: - ChangeRequest(); - virtual ~ChangeRequest(); + ChangeRequest() = default; + virtual ~ChangeRequest() = default; /// Return true if this change requires a GL Flush in the thread it was executed in virtual bool needsFlush(); @@ -81,9 +79,9 @@ class ChangeRequest /// Set this if you need to be run before the active models are run virtual bool needPreExecute(); - + /// If non-zero we'll execute this request after the given absolute time - TimeInterval when; + TimeInterval when = 0.0; }; /// Representation of a list of changes. Might get more complex in the future. diff --git a/common/WhirlyGlobeLib/include/ComponentManager.h b/common/WhirlyGlobeLib/include/ComponentManager.h index 8ab53f0b11..5ef6dd5af1 100644 --- a/common/WhirlyGlobeLib/include/ComponentManager.h +++ b/common/WhirlyGlobeLib/include/ComponentManager.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/15/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ class ComponentObject : public Identifiable { friend class ComponentManager; public: - virtual ~ComponentObject(); + virtual ~ComponentObject() = default; SimpleIDSet markerIDs; SimpleIDSet labelIDs; diff --git a/common/WhirlyGlobeLib/include/CoordSystem.h b/common/WhirlyGlobeLib/include/CoordSystem.h index 78ad46b4ac..832de233c4 100644 --- a/common/WhirlyGlobeLib/include/CoordSystem.h +++ b/common/WhirlyGlobeLib/include/CoordSystem.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/9/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/Dictionary.h b/common/WhirlyGlobeLib/include/Dictionary.h index 06daa47bc8..b4669a87a2 100644 --- a/common/WhirlyGlobeLib/include/Dictionary.h +++ b/common/WhirlyGlobeLib/include/Dictionary.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/16/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/DictionaryC.h b/common/WhirlyGlobeLib/include/DictionaryC.h index 91c919cc2d..6ed5a9d794 100644 --- a/common/WhirlyGlobeLib/include/DictionaryC.h +++ b/common/WhirlyGlobeLib/include/DictionaryC.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/16/13. - * Copyright 2011-2013 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/Drawable.h b/common/WhirlyGlobeLib/include/Drawable.h index 5aae5de1cf..bb49190684 100644 --- a/common/WhirlyGlobeLib/include/Drawable.h +++ b/common/WhirlyGlobeLib/include/Drawable.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/DrawableGLES.h b/common/WhirlyGlobeLib/include/DrawableGLES.h index 3d3e9e2c04..b8d12c6f00 100644 --- a/common/WhirlyGlobeLib/include/DrawableGLES.h +++ b/common/WhirlyGlobeLib/include/DrawableGLES.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 9/30/19. -* Copyright 2011-2021 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/DynamicTextureAtlas.h b/common/WhirlyGlobeLib/include/DynamicTextureAtlas.h index f707683958..37b489fd89 100644 --- a/common/WhirlyGlobeLib/include/DynamicTextureAtlas.h +++ b/common/WhirlyGlobeLib/include/DynamicTextureAtlas.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/28/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/DynamicTextureAtlasGLES.h b/common/WhirlyGlobeLib/include/DynamicTextureAtlasGLES.h index 08857b1a76..8877e37247 100644 --- a/common/WhirlyGlobeLib/include/DynamicTextureAtlasGLES.h +++ b/common/WhirlyGlobeLib/include/DynamicTextureAtlasGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/Expect.h b/common/WhirlyGlobeLib/include/Expect.h index b0f92e8d8a..6a8068d278 100644 --- a/common/WhirlyGlobeLib/include/Expect.h +++ b/common/WhirlyGlobeLib/include/Expect.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Tim Sylvester on 7/22/2021 - * Copyright 2021-2021 mousebird consulting + * Copyright 2021-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/FlatMath.h b/common/WhirlyGlobeLib/include/FlatMath.h index bb7e62efb3..cdd23197c8 100644 --- a/common/WhirlyGlobeLib/include/FlatMath.h +++ b/common/WhirlyGlobeLib/include/FlatMath.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/9/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/FontTextureManager.h b/common/WhirlyGlobeLib/include/FontTextureManager.h index 758435cbd3..1c0ba961d6 100644 --- a/common/WhirlyGlobeLib/include/FontTextureManager.h +++ b/common/WhirlyGlobeLib/include/FontTextureManager.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/15/13. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,21 +54,21 @@ class FontManager : public Identifiable virtual void teardown(PlatformThreadInfo *) { } // Mapping info from glyph to location in a dynamic texture - class GlyphInfo + struct GlyphInfo { - public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW; - GlyphInfo() : glyph(0), refCount(0) { } - GlyphInfo(WKGlyph glyph) : glyph(glyph), refCount(0) { } - bool operator < (const GlyphInfo &that) const - { return glyph < that.glyph; } - WKGlyph glyph; - Point2f size; - Point2f offset; - Point2f textureOffset; - SubTexture subTex; - int refCount; + GlyphInfo() = default; + GlyphInfo(WKGlyph glyph) : glyph(glyph) { } + bool operator < (const GlyphInfo &that) const { return glyph < that.glyph; } + + WKGlyph glyph = 0; + Point2f size = {0.0f, 0.0f}; + Point2f offset = {0.0f, 0.0f}; + Point2f textureOffset = {0.0f, 0.0f}; + SubTexture subTex = 0; + int refCount = 0; + float baseline = 0.0f; }; typedef struct GlyphInfoSorter @@ -110,22 +110,19 @@ typedef std::map SimpleIDGlyphMap; /** Information sufficient to draw a string as 3D geometry. All coordinates are in a local space related to the font size. */ -class DrawableString : public Identifiable +struct DrawableString : public Identifiable { -public: - DrawableString() { } - /// A rectangle describing the placement of a single glyph and /// the texture piece used to represent it - class Rect + struct Rect { - public: Point2f pts[2]; TexCoord texCoords[2]; - SubTexture subTex; + SubTexture subTex = 0; }; + std::vector glyphPolys; - + /// Bounding box of the string in coordinates related to the font size Mbr mbr; }; diff --git a/common/WhirlyGlobeLib/include/GeographicLib.h b/common/WhirlyGlobeLib/include/GeographicLib.h new file mode 100644 index 0000000000..263d74005e --- /dev/null +++ b/common/WhirlyGlobeLib/include/GeographicLib.h @@ -0,0 +1,78 @@ +/* GeographicLib.h + * WhirlyGlobeLib + * + * Created by Tim Sylvester on 1/14/22. + * Copyright 2022 mousebird consulting + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GeographicLib_h +#define GeographicLib_h + +#import "WhirlyVector.h" +#import + +namespace GeographicLib { + class Geodesic; + class Geocentric; +} +namespace WhirlyKit { + namespace detail { + // Generic geodesic initialized for WGS84 ellipsoid. + // We assume this is thread-safe because we only read from it. + extern const GeographicLib::Geodesic &wgs84Geodesic(); + extern const GeographicLib::Geocentric &wgs84Geocentric(); + } + +// Use an extra namespace to clarify that `Point3d`s are geocentric, not 3D Cartesian +namespace Geocentric { + +extern bool checkIntersection( + const Point3d &a, const Point3d &b, + const Point3d &c, const Point3d &d); + +#if defined(GEOGRAPHICLIB_GEODESIC_HPP) +extern bool checkIntersection( + const Point3d &a, const Point3d &b, + const Point3d &c, const Point3d &d, + const GeographicLib::Geodesic &geo); +#endif + +extern std::tuple findIntersection( + const Point3d &a, const Point3d &b, + const Point3d &c, const Point3d &d); + +#if defined(GEOGRAPHICLIB_GEODESIC_HPP) +extern std::tuple findIntersection( + const Point3d &a, const Point3d &b, + const Point3d &c, const Point3d &d, + const GeographicLib::Geodesic &geo); +#endif + +extern double initialHeading(const Point3d &startPt, const Point3d &endPt); +extern double finalHeading(const Point3d &startPt, const Point3d &endPt); +extern Point3d orthoDirect(const Point3d &start, double azimuthRad, double distMeters); + +extern std::tuple OrthoDist(const Point3d &gca, const Point3d &gcb, const Point3d &gcc); + +}} + +#if defined __cplusplus +extern "C" { +#endif + +#if defined __cplusplus +} // extern "C" +#endif + +#endif /* GeographicLib_h */ diff --git a/common/WhirlyGlobeLib/include/GeometryManager.h b/common/WhirlyGlobeLib/include/GeometryManager.h index 06bda06e98..06371d058a 100644 --- a/common/WhirlyGlobeLib/include/GeometryManager.h +++ b/common/WhirlyGlobeLib/include/GeometryManager.h @@ -1,9 +1,8 @@ -/* - * GeometryManager.h +/* GeometryManager.h * WhirlyGlobeLib * * Created by Steve Gifford on 11/25/14. - * Copyright 2012-2015 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import @@ -26,23 +24,23 @@ namespace WhirlyKit { - + typedef enum {GeometryBBoxSingle,GeometryBBoxTriangle,GeometryBBoxNone} GeometryBoundingBox; - + // Used to pass geometry around internally -class GeometryInfo : public BaseInfo +struct GeometryInfo : public BaseInfo { -public: - EIGEN_MAKE_ALIGNED_OPERATOR_NEW; - - GeometryInfo(); + GeometryInfo() = default; GeometryInfo(const Dictionary &); virtual ~GeometryInfo() = default; - bool colorOverride; - RGBAColor color; - int boundingBox; - float pointSize; + // Convert contents to a string for debugging + virtual std::string toString() const override { return BaseInfo::toString() + " +GeomInfo..."; } + + bool colorOverride = false; + RGBAColor color = RGBAColor::white(); + int boundingBox = GeometryBBoxNone; + float pointSize = 1.0f; }; typedef std::shared_ptr GeometryInfoRef; @@ -298,7 +296,7 @@ class GeometryRawPoints class GeometryManager : public SceneManager { public: - GeometryManager(); + GeometryManager() = default; virtual ~GeometryManager(); /// Add raw geometry at the given location diff --git a/common/WhirlyGlobeLib/include/GeometryOBJReader.h b/common/WhirlyGlobeLib/include/GeometryOBJReader.h index 4bf5e64c63..d8af5fc748 100644 --- a/common/WhirlyGlobeLib/include/GeometryOBJReader.h +++ b/common/WhirlyGlobeLib/include/GeometryOBJReader.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 11/25/14. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/GlobeAnimateHeight.h b/common/WhirlyGlobeLib/include/GlobeAnimateHeight.h index bf8ae23e44..5667c40596 100644 --- a/common/WhirlyGlobeLib/include/GlobeAnimateHeight.h +++ b/common/WhirlyGlobeLib/include/GlobeAnimateHeight.h @@ -1,9 +1,8 @@ -/* - * GlobeAnimateHeight.h +/* GlobeAnimateHeight.h * WhirlyGlobeLib * * Created by Steve Gifford on 2/7/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "WhirlyTypes.h" @@ -88,8 +86,10 @@ class AnimateViewHeight : public GlobeViewAnimationDelegate AnimateViewHeight(GlobeView *globeView,double toHeight,WhirlyKit::TimeInterval howLong); /// Update the globe view - virtual void updateView(GlobeView *globeView); - + virtual void updateView(WhirlyKit::View *); + + virtual bool isUserMotion() const { return false; } + /// If set, we're constraining the tilt based on height void setTiltDelegate(TiltCalculatorRef newDelegate); diff --git a/common/WhirlyGlobeLib/include/GlobeAnimateRotation.h b/common/WhirlyGlobeLib/include/GlobeAnimateRotation.h index f37ec061b6..1611630af6 100644 --- a/common/WhirlyGlobeLib/include/GlobeAnimateRotation.h +++ b/common/WhirlyGlobeLib/include/GlobeAnimateRotation.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/23/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,9 @@ class AnimateViewRotation : public GlobeViewAnimationDelegate AnimateViewRotation(GlobeView *globeView,const Eigen::Quaterniond &newRot,WhirlyKit::TimeInterval howLong); /// Update the globe view - virtual void updateView(GlobeView *globeView); + virtual void updateView(WhirlyKit::View *); + + virtual bool isUserMotion() const { return false; } protected: /// When to start the animation. Can be in the past diff --git a/common/WhirlyGlobeLib/include/GlobeAnimateViewMomentum.h b/common/WhirlyGlobeLib/include/GlobeAnimateViewMomentum.h index 35ffcb2a84..76935844e5 100644 --- a/common/WhirlyGlobeLib/include/GlobeAnimateViewMomentum.h +++ b/common/WhirlyGlobeLib/include/GlobeAnimateViewMomentum.h @@ -1,9 +1,8 @@ -/* - * AnimateViewMomentum.h +/* AnimateViewMomentum.h * WhirlyGlobeApp * * Created by Steve Gifford on 5/23/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "WhirlyTypes.h" @@ -33,11 +31,15 @@ namespace WhirlyGlobe class AnimateViewMomentum : public GlobeViewAnimationDelegate { public: - AnimateViewMomentum(GlobeViewRef globeView,double velocity,double acceleration,const Eigen::Vector3f &axis,bool northUp); - + AnimateViewMomentum(const GlobeViewRef &globeView, + double velocity,double acceleration, + const Eigen::Vector3f &axis,bool northUp); + /// Update the globe view - virtual void updateView(GlobeView *globeView); - + virtual void updateView(WhirlyKit::View *); + + virtual bool isUserMotion() const { return false; } + /// Set the velocity while this is running (for auto-rotate) void setVelocity(double newVel) { velocity = newVel; } @@ -45,11 +47,11 @@ class AnimateViewMomentum : public GlobeViewAnimationDelegate Eigen::Quaterniond rotForTime(GlobeView *globeView,WhirlyKit::TimeInterval sinceStart); double velocity,acceleration; - bool northUp; + bool northUp = false; Eigen::Quaterniond startQuat; Eigen::Vector3d axis; - double maxTime; - WhirlyKit::TimeInterval startDate; + double maxTime = MAXFLOAT; + WhirlyKit::TimeInterval startDate = 0.0; }; typedef std::shared_ptr AnimateViewMomentumRef; diff --git a/common/WhirlyGlobeLib/include/GlobeMath.h b/common/WhirlyGlobeLib/include/GlobeMath.h index 7435eb8f81..7e342a919f 100644 --- a/common/WhirlyGlobeLib/include/GlobeMath.h +++ b/common/WhirlyGlobeLib/include/GlobeMath.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/2/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/GlobeView.h b/common/WhirlyGlobeLib/include/GlobeView.h index 0a73ca3941..5eee9d2dd0 100644 --- a/common/WhirlyGlobeLib/include/GlobeView.h +++ b/common/WhirlyGlobeLib/include/GlobeView.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/14/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,18 +19,24 @@ #import "WhirlyKitView.h" #import "GlobeMath.h" +namespace WhirlyKit +{ +class View; +class SceneRenderer; +} + namespace WhirlyGlobe { - + class GlobeView; - + /// Animation callback -class GlobeViewAnimationDelegate +struct GlobeViewAnimationDelegate : public WhirlyKit::ViewAnimationDelegate { -public: - /// Called every tick to update the globe position - virtual void updateView(GlobeView *globeView) = 0; + virtual bool isUserMotion() const = 0; + virtual void updateView(WhirlyKit::View *) = 0; }; + typedef std::shared_ptr GlobeViewAnimationDelegateRef; /** Parameters associated with viewing the globe. @@ -53,10 +59,10 @@ class GlobeView : public WhirlyKit::View double maxHeightAboveGlobe() const; /// Set the height above globe, taking constraints into account - void setHeightAboveGlobe(double newH); + virtual void setHeightAboveGlobe(double newH); /// This version allows you to not update the watchers, if you're doing a bunch of updates at once - void setHeightAboveGlobe(double newH,bool updateWatchers); + virtual void setHeightAboveGlobe(double newH,bool updateWatchers); /// This version avoids the limit calculations (Kind of a hack) void setHeightAboveGlobeNoLimits(double newH,bool updateWatchers); @@ -65,10 +71,10 @@ class GlobeView : public WhirlyKit::View void setCenterOffset(double offX,double offY,bool updateWatchers); /// Update the quaternion - void setRotQuat(Eigen::Quaterniond rotQuat); + virtual void setRotQuat(Eigen::Quaterniond rotQuat); /// This version allows you to not update the watchers. - void setRotQuat(Eigen::Quaterniond rotQuat,bool updateWatchers); + virtual void setRotQuat(Eigen::Quaterniond rotQuat,bool updateWatchers); /// Return the current quaternion Eigen::Quaterniond getRotQuat() const { return rotQuat; } diff --git a/common/WhirlyGlobeLib/include/GridClipper.h b/common/WhirlyGlobeLib/include/GridClipper.h index e7b41ff75d..da04d89750 100644 --- a/common/WhirlyGlobeLib/include/GridClipper.h +++ b/common/WhirlyGlobeLib/include/GridClipper.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/16/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/Identifiable.h b/common/WhirlyGlobeLib/include/Identifiable.h index 31da537144..bfa9d4f7b7 100644 --- a/common/WhirlyGlobeLib/include/Identifiable.h +++ b/common/WhirlyGlobeLib/include/Identifiable.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/7/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/ImageTile.h b/common/WhirlyGlobeLib/include/ImageTile.h index 1482c8d307..e9fffa4552 100644 --- a/common/WhirlyGlobeLib/include/ImageTile.h +++ b/common/WhirlyGlobeLib/include/ImageTile.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/14/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/IntersectionManager.h b/common/WhirlyGlobeLib/include/IntersectionManager.h index 455ae8838c..7a48a02a8b 100644 --- a/common/WhirlyGlobeLib/include/IntersectionManager.h +++ b/common/WhirlyGlobeLib/include/IntersectionManager.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/29/16. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/LabelManager.h b/common/WhirlyGlobeLib/include/LabelManager.h index 4d9275899a..bd82fd09e4 100644 --- a/common/WhirlyGlobeLib/include/LabelManager.h +++ b/common/WhirlyGlobeLib/include/LabelManager.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/22/13. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,6 +81,8 @@ class SingleLabel int layoutPlacement; /// Shape for label to follow VectorRing layoutShape; + /// Identifies objects to be laid out together + std::string mergeID; // If set, we'll draw an outline to the mask target WhirlyKit::SimpleIdentity maskID; @@ -90,12 +92,12 @@ class SingleLabel LabelInfoRef infoOverride; // Used to build the drawable string on specific platforms - virtual std::vector generateDrawableStrings( - PlatformThreadInfo *threadInfo, + virtual std::vector> generateDrawableStrings( + PlatformThreadInfo *, const LabelInfo *, - const FontTextureManagerRef &fontTexManager, + const FontTextureManagerRef &, float &lineHeight, - ChangeSet &changes) = 0; + ChangeSet &) = 0; }; typedef std::shared_ptr SingleLabelRef; @@ -108,7 +110,7 @@ class LabelManager : public SceneManager { public: LabelManager(); - virtual ~LabelManager() = default; + virtual ~LabelManager(); /// Add the given set of labels, returning an ID that represents the whole thing SimpleIdentity addLabels(PlatformThreadInfo *threadInfo, diff --git a/common/WhirlyGlobeLib/include/LabelRenderer.h b/common/WhirlyGlobeLib/include/LabelRenderer.h index ea559b5be2..88b91e88a2 100644 --- a/common/WhirlyGlobeLib/include/LabelRenderer.h +++ b/common/WhirlyGlobeLib/include/LabelRenderer.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/11/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -65,16 +65,20 @@ typedef std::set LabelSceneRepSet; // How a label is justified for display typedef enum {WhirlyKitLabelMiddle,WhirlyKitLabelLeft,WhirlyKitLabelRight} LabelJustify; typedef enum {WhirlyKitTextCenter,WhirlyKitTextLeft,WhirlyKitTextRight} TextJustify; +typedef enum {WhirlyKitLabelBaseline,WhirlyKitLabelVCenter, /*...*/} LabelVerticalAlign; // Label spec passed around between threads class LabelInfo : public BaseInfo { public: LabelInfo(bool screenObject); - LabelInfo(const LabelInfo &that); + LabelInfo(const LabelInfo &that) = default; LabelInfo(const Dictionary &dict,bool screenObject); virtual ~LabelInfo() = default; + // Convert contents to a string for debugging + virtual std::string toString() const override { return BaseInfo::toString() + " +LabelInfo..."; } + bool hasTextColor = false; RGBAColor textColor = RGBAColor::white(); RGBAColor backColor = RGBAColor::clear(); @@ -83,6 +87,7 @@ class LabelInfo : public BaseInfo float height = 0.0f; LabelJustify labelJustify = WhirlyKitLabelMiddle; TextJustify textJustify = WhirlyKitTextCenter; + LabelVerticalAlign labelVAlign = WhirlyKitLabelBaseline; RGBAColor shadowColor = RGBAColor::black(); float shadowSize = -1.0f; RGBAColor outlineColor = RGBAColor::black(); @@ -93,6 +98,8 @@ class LabelInfo : public BaseInfo float layoutSpacing = 20.0f; int layoutRepeat = 0; bool layoutDebug = false; + /// Indicates that this label will be drawn over a marker generated by the same feature. + bool mergedSymbol = false; FloatExpressionInfoRef opacityExp; // ColorExpressionInfoRef colorExp; @@ -146,7 +153,7 @@ class LabelRenderer SimpleIdentity maskProgID = 0; /// Convenience routine to convert the points to model space - Point3dVector convertGeoPtsToModelSpace(const VectorRing &inPts); + Point3dVector convertGeoPtsToModelSpace(const VectorRing &inPts) const; /// Renders the labels into a big texture and stores the resulting info void render(PlatformThreadInfo *threadInfo,const std::vector &labels,ChangeSet &changes); diff --git a/common/WhirlyGlobeLib/include/LayoutManager.h b/common/WhirlyGlobeLib/include/LayoutManager.h index 57c608198d..0442b46cff 100644 --- a/common/WhirlyGlobeLib/include/LayoutManager.h +++ b/common/WhirlyGlobeLib/include/LayoutManager.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/15/13. - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,6 +89,8 @@ class LayoutObject : public ScreenSpaceObject Point3dVector layoutShape; + std::string mergeID; + /// If we're placing glyphs individually we'll do it with matrices std::vector > layoutPlaces; std::vector layoutModelPlaces; @@ -104,11 +106,11 @@ class LayoutObject : public ScreenSpaceObject WhirlyKitLayoutPlacementLeft | WhirlyKitLayoutPlacementRight | WhirlyKitLayoutPlacementAbove | WhirlyKitLayoutPlacementBelow; }; +using LayoutObjectRef = std::shared_ptr; // Private fields we use for object layout -class LayoutObjectEntry : public Identifiable +struct LayoutObjectEntry : public Identifiable { -public: LayoutObjectEntry(SimpleIdentity theId); LayoutObjectEntry(const LayoutObject&); LayoutObjectEntry(LayoutObject&&) noexcept; @@ -254,6 +256,9 @@ class LayoutManager : public SceneManager /// Move objects for layout (thread safe) void addLayoutObjects(std::vector &&newObjects); + /// Move objects for layout (thread safe) + void addLayoutObjects(std::vector &&newObjects); + /// Remove objects for layout (thread safe) void removeLayoutObjects(const SimpleIDSet &oldObjects); @@ -360,7 +365,7 @@ class LayoutManager : public SceneManager typedef std::set ClusteredObjectsSet; void runLayoutClustering(PlatformThreadInfo *threadInfo, - LayoutContainerVec layoutObjs, + LayoutContainerVec &layoutObjs, ClusteredObjectsSet &clusterGroups, std::vector &clusterEntries, std::vector &outClusterParams, @@ -416,6 +421,7 @@ class LayoutManager : public SceneManager int maxDisplayObjects = 0; /// If there were updates since the last layout bool hasUpdates = false; + bool hasRemoves = false; /// Cancel a layout run in progress volatile bool cancelLayout = false; /// Enable drawing layout boundaries diff --git a/common/WhirlyGlobeLib/include/Lighting.h b/common/WhirlyGlobeLib/include/Lighting.h index 30bd98c3f3..3849607c2f 100644 --- a/common/WhirlyGlobeLib/include/Lighting.h +++ b/common/WhirlyGlobeLib/include/Lighting.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/LineAndPointShadersGLES.h b/common/WhirlyGlobeLib/include/LineAndPointShadersGLES.h index 5e2fd94ca8..efe35c6299 100644 --- a/common/WhirlyGlobeLib/include/LineAndPointShadersGLES.h +++ b/common/WhirlyGlobeLib/include/LineAndPointShadersGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 8/21/18. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/LinearTextBuilder.h b/common/WhirlyGlobeLib/include/LinearTextBuilder.h index 117f35590f..2ff5542c14 100644 --- a/common/WhirlyGlobeLib/include/LinearTextBuilder.h +++ b/common/WhirlyGlobeLib/include/LinearTextBuilder.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/3/21. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/LoftManager.h b/common/WhirlyGlobeLib/include/LoftManager.h index 9291ff6be6..051ba6add1 100644 --- a/common/WhirlyGlobeLib/include/LoftManager.h +++ b/common/WhirlyGlobeLib/include/LoftManager.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/30/13. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/MapboxVectorFilter.h b/common/WhirlyGlobeLib/include/MapboxVectorFilter.h index 84d7b17d9b..43f36c045f 100644 --- a/common/WhirlyGlobeLib/include/MapboxVectorFilter.h +++ b/common/WhirlyGlobeLib/include/MapboxVectorFilter.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/8/20. -* Copyright 2011-2020 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/MapboxVectorStyleBackground.h b/common/WhirlyGlobeLib/include/MapboxVectorStyleBackground.h index c8dffe8761..291a613e9f 100644 --- a/common/WhirlyGlobeLib/include/MapboxVectorStyleBackground.h +++ b/common/WhirlyGlobeLib/include/MapboxVectorStyleBackground.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/17/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,10 +26,14 @@ namespace WhirlyKit This class corresponds to the paint portion of the Mapbox Vector Style definition of the background. You get one of these from parsing a Style, don't generate one. */ -class MapboxVectorBackgroundPaint +struct MapboxVectorBackgroundPaint { -public: - bool parse(PlatformThreadInfo *inst,MapboxVectorStyleSetImpl *styleSet,DictionaryRef styleEntry); + MapboxVectorBackgroundPaint() = default; + MapboxVectorBackgroundPaint(const MapboxVectorBackgroundPaint&) = default; + + bool parse(PlatformThreadInfo *, + MapboxVectorStyleSetImpl *, + const DictionaryRef &styleEntry); MapboxTransColorRef color; MapboxTransDoubleRef opacity; @@ -48,7 +52,10 @@ class MapboxVectorLayerBackground : public MapboxVectorStyleLayer const DictionaryRef &styleEntry, const MapboxVectorStyleLayerRef &refLayer, int drawPriority) override; - + + virtual MapboxVectorStyleLayerRef clone() const override; + virtual MapboxVectorStyleLayer& copy(const MapboxVectorStyleLayer&) override; + virtual void buildObjects(PlatformThreadInfo *inst, const std::vector &vecObjs, const VectorTileDataRef &tileInfo, @@ -59,6 +66,10 @@ class MapboxVectorLayerBackground : public MapboxVectorStyleLayer return paint.color ? paint.color->colorForZoom(zoom) : RGBAColor::clear(); } +protected: + // N.B.: does not copy base members + MapboxVectorLayerBackground& operator=(const MapboxVectorLayerBackground &) = default; + public: /// Controls how the background looks. MapboxVectorBackgroundPaint paint; diff --git a/common/WhirlyGlobeLib/include/MapboxVectorStyleCircle.h b/common/WhirlyGlobeLib/include/MapboxVectorStyleCircle.h index cf74f70f73..90cd16d1b3 100644 --- a/common/WhirlyGlobeLib/include/MapboxVectorStyleCircle.h +++ b/common/WhirlyGlobeLib/include/MapboxVectorStyleCircle.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/17/15. -* Copyright 2011-2021 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,10 +27,14 @@ namespace WhirlyKit You control the look of any rendered circles with this. It would typically be produced in parsing a Mapbox Vector Style. */ -class MapboxVectorCirclePaint +struct MapboxVectorCirclePaint { -public: - bool parse(PlatformThreadInfo *inst,MapboxVectorStyleSetImpl *styleSet,DictionaryRef styleEntry); + MapboxVectorCirclePaint() = default; + MapboxVectorCirclePaint(const MapboxVectorCirclePaint&) = default; + + bool parse(PlatformThreadInfo *inst, + MapboxVectorStyleSetImpl *styleSet, + const DictionaryRef &styleEntry); /// Radius, in pixels, of the circle to be produced MapboxTransDoubleRef radius; @@ -53,6 +57,9 @@ class MapboxVectorLayerCircle : public MapboxVectorStyleLayer public: MapboxVectorLayerCircle(MapboxVectorStyleSetImpl *styleSet) : MapboxVectorStyleLayer(styleSet) { } + virtual MapboxVectorStyleLayerRef clone() const override; + virtual MapboxVectorStyleLayer& copy(const MapboxVectorStyleLayer&) override; + virtual bool parse(PlatformThreadInfo *inst, const DictionaryRef &styleEntry, const MapboxVectorStyleLayerRef &refLayer, @@ -72,14 +79,16 @@ class MapboxVectorLayerCircle : public MapboxVectorStyleLayer return RGBAColor::clear(); } +protected: + // N.B.: This does not copy the base members + MapboxVectorLayerCircle& operator=(const MapboxVectorLayerCircle&) = default; + public: MapboxVectorCirclePaint paint; - SimpleIdentity circleTexID; - Point2f circleSize; - float importance; - std::string uuidField; // UUID field for markers/labels (from style settings) - std::string repUUIDField; // UUID field for representations (from style layers) + SimpleIdentity circleTexID = EmptyIdentity; + Point2f circleSize{0.0f, 0.0f}; + float importance = 0.0f; }; } diff --git a/common/WhirlyGlobeLib/include/MapboxVectorStyleFill.h b/common/WhirlyGlobeLib/include/MapboxVectorStyleFill.h index 6dc587b56a..c8a8f71e01 100644 --- a/common/WhirlyGlobeLib/include/MapboxVectorStyleFill.h +++ b/common/WhirlyGlobeLib/include/MapboxVectorStyleFill.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/17/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,11 @@ namespace WhirlyKit { // Paint for the vector layer fill -class MapboxVectorFillPaint +struct MapboxVectorFillPaint { -public: + MapboxVectorFillPaint() = default; + MapboxVectorFillPaint(const MapboxVectorFillPaint&) = default; + bool parse(PlatformThreadInfo *inst, MapboxVectorStyleSetImpl *styleSet, const DictionaryRef &styleEntry); @@ -45,19 +47,26 @@ class MapboxVectorLayerFill : public MapboxVectorStyleLayer const DictionaryRef &styleEntry, const MapboxVectorStyleLayerRef &refLayer, int drawPriority) override; - + + virtual MapboxVectorStyleLayerRef clone() const override; + virtual MapboxVectorStyleLayer& copy(const MapboxVectorStyleLayer&) override; + virtual void buildObjects(PlatformThreadInfo *inst, const std::vector &vecObjs, const VectorTileDataRef &tileInfo, const Dictionary *desc, const CancelFunction &cancelFn) override; - virtual void cleanup(PlatformThreadInfo *inst,ChangeSet &changes) override; + virtual void cleanup(PlatformThreadInfo *inst,ChangeSet &changes) override { } virtual RGBAColor getLegendColor(float zoom) const override { return paint.color ? paint.color->colorForZoom(zoom) : RGBAColor::clear(); } +protected: + // N.B.: does not copy base members + MapboxVectorLayerFill& operator=(const MapboxVectorLayerFill &) = default; + public: MapboxVectorFillPaint paint; SimpleIdentity arealShaderID; diff --git a/common/WhirlyGlobeLib/include/MapboxVectorStyleLayer.h b/common/WhirlyGlobeLib/include/MapboxVectorStyleLayer.h index 79afcb43f9..15b949e83a 100644 --- a/common/WhirlyGlobeLib/include/MapboxVectorStyleLayer.h +++ b/common/WhirlyGlobeLib/include/MapboxVectorStyleLayer.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/8/20. -* Copyright 2011-2021 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ class MapboxVectorStyleLayer : public VectorStyleImpl /// @brief Base class initialization. Copies data out of the refLayer MapboxVectorStyleLayer(MapboxVectorStyleSetImpl *styleSet); - virtual ~MapboxVectorStyleLayer(); + virtual ~MapboxVectorStyleLayer() = default; // Parse the layer entry out of the style sheet virtual bool parse(PlatformThreadInfo *inst, @@ -54,15 +54,18 @@ class MapboxVectorStyleLayer : public VectorStyleImpl const MapboxVectorStyleLayerRef &refLayer, int drawPriority); + virtual MapboxVectorStyleLayerRef clone() const = 0; + virtual MapboxVectorStyleLayer& copy(const MapboxVectorStyleLayer&) = 0; + /// Unique Identifier for this style - virtual long long getUuid(PlatformThreadInfo *inst) override; + virtual long long getUuid(PlatformThreadInfo *inst) override { return uuid; } /// Category used for sorting - virtual std::string getCategory(PlatformThreadInfo *inst) override; + virtual std::string getCategory(PlatformThreadInfo *inst) override { return category; } // Note: This no longer really holds /// Set if this geometry is additive (e.g. sticks around) rather than replacement - virtual bool geomAdditive(PlatformThreadInfo *inst) override; + virtual bool geomAdditive(PlatformThreadInfo *inst) override { return geomAdditiveVal; } /// Construct objects related to this style based on the input data. virtual void buildObjects(PlatformThreadInfo *inst, @@ -70,14 +73,18 @@ class MapboxVectorStyleLayer : public VectorStyleImpl const VectorTileDataRef &tileInfo, const Dictionary *desc, const CancelFunction &cancelFn) override = 0; - + /// Clean up any objects (textures, probably) - virtual void cleanup(PlatformThreadInfo *inst,ChangeSet &changes); + virtual void cleanup(PlatformThreadInfo *inst,ChangeSet &changes) { } - MapboxVectorStyleSetImpl *styleSet; +protected: + MapboxVectorStyleLayer& operator=(const MapboxVectorStyleLayer&) = default; + +public: + MapboxVectorStyleSetImpl *styleSet = nullptr; /// Set if we actually use this layer. Copied from the layout - bool visible; + bool visible = true; /// Type string (from spec) std::string type; @@ -98,24 +105,24 @@ class MapboxVectorStyleLayer : public VectorStyleImpl std::string sourceLayer; /// @brief Min/max zoom levels - int minzoom; - int maxzoom; + int minzoom = 0; + int maxzoom = 0; /// @brief Filter this layer uses to match up to data MapboxVectorFilterRef filter; /// @brief DrawPriority based on location in the style sheet - int drawPriority; + int drawPriority = 0; /// If set, the features produced will be selectable (if they can be) /// Inherited from the settings - bool selectable; + bool selectable = false; /// @brief Unique Identifier for this style - long long uuid; + long long uuid = 0; /// @brief Set if this geometry is additive (e.g. sticks around) rather than replacement - bool geomAdditiveVal; + bool geomAdditiveVal = false; /// @brief metadata tag from the JSON file DictionaryRef metadata; @@ -125,6 +132,11 @@ class MapboxVectorStyleLayer : public VectorStyleImpl /// @brief The specific representation for this layer (e.g., "selected") std::string representation; + + /// UUID field for markers/labels (from style settings) + std::string uuidField; + /// UUID field for representations (from style layers) + std::string repUUIDField; }; diff --git a/common/WhirlyGlobeLib/include/MapboxVectorStyleLine.h b/common/WhirlyGlobeLib/include/MapboxVectorStyleLine.h index 54f752c23d..538052842d 100644 --- a/common/WhirlyGlobeLib/include/MapboxVectorStyleLine.h +++ b/common/WhirlyGlobeLib/include/MapboxVectorStyleLine.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/17/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,23 +28,27 @@ typedef enum {MBLineJoinBevel,MBLineJoinRound,MBLineJoinMiter} MapboxVectorLineJ /** Controls how the lines are laid out (geometry, largely). */ -class MapboxVectorLineLayout +struct MapboxVectorLineLayout { -public: + MapboxVectorLineLayout() = default; + MapboxVectorLineLayout(const MapboxVectorLineLayout&) = default; + bool parse(PlatformThreadInfo *inst,MapboxVectorStyleSetImpl *styleSet,const DictionaryRef &styleEntry); - MapboxVectorLineCap cap; - MapboxVectorLineJoin join; - double miterLimit; - double roundLimit; + MapboxVectorLineCap cap = MBLineCapButt; + MapboxVectorLineJoin join = MBLineJoinBevel; + double miterLimit = 0.0; + double roundLimit = 0.0; }; /** Controls how the vector line looks. */ -class MapboxVectorLinePaint +struct MapboxVectorLinePaint { -public: + MapboxVectorLinePaint() = default; + MapboxVectorLinePaint(const MapboxVectorLinePaint&) = default; + bool parse(PlatformThreadInfo *inst,MapboxVectorStyleSetImpl *styleSet,const DictionaryRef &styleEntry); MapboxTransDoubleRef opacity; @@ -65,35 +69,39 @@ class MapboxVectorLayerLine : public MapboxVectorStyleLayer const DictionaryRef &styleEntry, const MapboxVectorStyleLayerRef &refLayer, int drawPriority) override; - + + virtual MapboxVectorStyleLayerRef clone() const override; + virtual MapboxVectorStyleLayer& copy(const MapboxVectorStyleLayer&) override; + virtual void buildObjects(PlatformThreadInfo *inst, const std::vector &vecObjs, const VectorTileDataRef &tileInfo, const Dictionary *desc, const CancelFunction &cancelFn) override; - virtual void cleanup(PlatformThreadInfo *inst,ChangeSet &changes) override; + virtual void cleanup(PlatformThreadInfo *inst,ChangeSet &changes) override { } virtual RGBAColor getLegendColor(float zoom) const override { return paint.color ? paint.color->colorForZoom(zoom) : RGBAColor::clear(); } +protected: + // N.B.: This does not copy the base members + MapboxVectorLayerLine& operator=(const MapboxVectorLayerLine&) = default; + public: MapboxVectorLineLayout layout; MapboxVectorLinePaint paint; - bool linearClipToBounds; - bool dropGridLines; + bool linearClipToBounds = false; + bool dropGridLines = false; // If non-zero we'll subdivide the line along a globe to the given tolerance - double subdivToGlobe; - - double lineScale; - double totLen; - double fade; - SimpleIdentity filledLineTexID; + double subdivToGlobe = 0.0; - std::string uuidField; // UUID field for markers/labels (from style settings) - std::string repUUIDField; // UUID field for representations (from style layers) + double lineScale = 0.0; + double totLen = 0.0; + double fade = 0.0; + SimpleIdentity filledLineTexID = EmptyIdentity; }; } diff --git a/common/WhirlyGlobeLib/include/MapboxVectorStyleRaster.h b/common/WhirlyGlobeLib/include/MapboxVectorStyleRaster.h index 78b9cb6340..388b905fb8 100644 --- a/common/WhirlyGlobeLib/include/MapboxVectorStyleRaster.h +++ b/common/WhirlyGlobeLib/include/MapboxVectorStyleRaster.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/17/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,14 +32,17 @@ class MapboxVectorLayerRaster : public MapboxVectorStyleLayer const DictionaryRef &styleEntry, const MapboxVectorStyleLayerRef &refLayer, int drawPriority) override; - + + virtual MapboxVectorStyleLayerRef clone() const override; + virtual MapboxVectorStyleLayer& copy(const MapboxVectorStyleLayer&) override; + virtual void buildObjects(PlatformThreadInfo *inst, const std::vector &vecObjs, const VectorTileDataRef &tileInfo, const Dictionary *desc, const CancelFunction &cancelFn) override; - virtual void cleanup(PlatformThreadInfo *inst,ChangeSet &changes) override; + virtual void cleanup(PlatformThreadInfo *inst,ChangeSet &changes) override { } protected: }; diff --git a/common/WhirlyGlobeLib/include/MapboxVectorStyleSetC.h b/common/WhirlyGlobeLib/include/MapboxVectorStyleSetC.h index e991b008f3..c8d16fd072 100644 --- a/common/WhirlyGlobeLib/include/MapboxVectorStyleSetC.h +++ b/common/WhirlyGlobeLib/include/MapboxVectorStyleSetC.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/8/20. -* Copyright 2011-2021 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -326,7 +326,10 @@ class MapboxVectorStyleSetImpl : public VectorStyleDelegateImpl virtual SimpleIdentity makeLineTexture(PlatformThreadInfo *inst,const std::vector &dashComponents) = 0; /// Create a local platform LabelInfo (since fonts are local) - virtual LabelInfoRef makeLabelInfo(PlatformThreadInfo *inst,const std::vector &fontName,float fontSize) = 0; + virtual LabelInfoRef makeLabelInfo(PlatformThreadInfo *, + const std::vector &fontNames, + float fontHeight, + bool mergedSymbol) = 0; /// Create a local platform label (fonts are local, and other stuff) virtual SingleLabelRef makeSingleLabel(PlatformThreadInfo *inst,const std::string &text) = 0; @@ -343,6 +346,19 @@ class MapboxVectorStyleSetImpl : public VectorStyleDelegateImpl /// Create a local platform component object virtual ComponentObjectRef makeComponentObject(PlatformThreadInfo *inst, const Dictionary *desc = nullptr) = 0; + /// Check whether the stylesheet already has representation layers + virtual bool hasRepresentations(); + + /// Add representation layers + virtual bool addRepresentations(PlatformThreadInfo *, const char* uuidAttr, + const std::vector &sources, + const std::vector &reps, + const std::vector &sizes, + const std::vector &colors); + +protected: + void addLayer(PlatformThreadInfo *, MapboxVectorStyleLayerRef); + public: Scene *scene; CoordSystem *coordSys; diff --git a/common/WhirlyGlobeLib/include/MapboxVectorStyleSpritesImpl.h b/common/WhirlyGlobeLib/include/MapboxVectorStyleSpritesImpl.h index 9db149a9f5..c04aa2e9e2 100644 --- a/common/WhirlyGlobeLib/include/MapboxVectorStyleSpritesImpl.h +++ b/common/WhirlyGlobeLib/include/MapboxVectorStyleSpritesImpl.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/28/20. -* Copyright 2011-2020 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/MapboxVectorStyleSymbol.h b/common/WhirlyGlobeLib/include/MapboxVectorStyleSymbol.h index e7c0926f70..11e953ade2 100644 --- a/common/WhirlyGlobeLib/include/MapboxVectorStyleSymbol.h +++ b/common/WhirlyGlobeLib/include/MapboxVectorStyleSymbol.h @@ -1,9 +1,8 @@ -/* - * MapboxVectorStyleSymbol.h +/* MapboxVectorStyleSymbol.h * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/17/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "MapboxVectorStyleSetC.h" @@ -30,17 +28,19 @@ typedef enum {MBTextTransNone,MBTextTransUppercase,MBTextTransLowercase} MapboxT /** Controls the layout logic for Mapbox Symbols. */ -class MapboxVectorSymbolLayout +struct MapboxVectorSymbolLayout { -public: + MapboxVectorSymbolLayout() = default; + MapboxVectorSymbolLayout(const MapboxVectorSymbolLayout&) = default; + bool parse(PlatformThreadInfo *inst, MapboxVectorStyleSetImpl *styleSet, const DictionaryRef &styleEntry); /// How we place the symbol (at a point, or along a line) - MapboxSymbolPlacement placement; + MapboxSymbolPlacement placement = MBPlacePoint; /// If set, turn the text uppercase - MapboxTextTransform textTransform; + MapboxTextTransform textTransform = MBTextTransNone; /// @brief Font to use for display std::vector textFontNames; /// @brief The maximum line width for wrapping @@ -51,16 +51,18 @@ class MapboxVectorSymbolLayout MapboxTransDoubleRef textOffsetX; MapboxTransDoubleRef textOffsetY; /// Text scale from the global settings - double globalTextScale; + double globalTextScale = 0.0; /// How the text is laid out in relation to it's attach point - MapboxTextAnchor textAnchor; + MapboxTextAnchor textAnchor = MBTextCenter; + MapboxTextAnchor iconAnchor = (MapboxTextAnchor)-1; /// Whether it goes to the layout engine - bool iconAllowOverlap,textAllowOverlap; + bool iconAllowOverlap = false; + bool textAllowOverlap = false; /// Text justification - bool textJustifySet; - TextJustify textJustify; + bool textJustifySet = false; + TextJustify textJustify = WhirlyKitTextCenter; - float layoutImportance; + float layoutImportance = 0.0f; // Text can be expressed in a complex way MapboxTransTextRef textField; @@ -73,9 +75,11 @@ class MapboxVectorSymbolLayout }; // Symbol visuals -class MapboxVectorSymbolPaint +struct MapboxVectorSymbolPaint { -public: + MapboxVectorSymbolPaint() = default; + MapboxVectorSymbolPaint(const MapboxVectorSymbolPaint&) = default; + bool parse(PlatformThreadInfo *inst, MapboxVectorStyleSetImpl *styleSet, const DictionaryRef &styleEntry); @@ -89,6 +93,7 @@ class MapboxVectorSymbolPaint MapboxTransDoubleRef textHaloBlur; // If there's a halo, this is the size MapboxTransDoubleRef textHaloWidth; + MapboxTransDoubleRef iconOpacity; }; /// @brief Icons and symbols @@ -107,8 +112,11 @@ class MapboxVectorLayerSymbol : public MapboxVectorStyleLayer const VectorTileDataRef &tileInfo, const Dictionary *desc, const CancelFunction &cancelFn) override; - - virtual void cleanup(PlatformThreadInfo *inst,ChangeSet &changes) override; + + virtual MapboxVectorStyleLayerRef clone() const override; + virtual MapboxVectorStyleLayer& copy(const MapboxVectorStyleLayer&) override; + + virtual void cleanup(PlatformThreadInfo *inst,ChangeSet &changes) override { } virtual std::string getLegendText(float zoom) const override { if (layout.iconImageField) { @@ -123,28 +131,32 @@ class MapboxVectorLayerSymbol : public MapboxVectorStyleLayer return paint.textColor ? paint.textColor->colorForZoom(zoom) : RGBAColor::clear(); } - std::string breakUpText(PlatformThreadInfo *inst, + std::string breakUpText(PlatformThreadInfo *, const std::string &text, double textMaxWidth, - const LabelInfoRef &labelInfo); - SingleLabelRef setupLabel(PlatformThreadInfo *inst, + const LabelInfoRef &); + SingleLabelRef setupLabel(PlatformThreadInfo *, const Point2f &pt, - const LabelInfoRef &labelInfo, + const LabelInfoRef &, const MutableDictionaryRef &attrs, - const VectorTileDataRef &tileInfo); - std::unique_ptr setupMarker(PlatformThreadInfo *inst, + const VectorTileDataRef &tileInfo, + bool mergedIcon); + std::unique_ptr setupMarker(PlatformThreadInfo *, const Point2f &pt, const MutableDictionaryRef &attrs, const VectorTileDataRef &tileInfo); - + +protected: + // N.B.: This does not copy the base members + MapboxVectorLayerSymbol& operator=(const MapboxVectorLayerSymbol&) = default; + +public: MapboxVectorSymbolLayout layout; MapboxVectorSymbolPaint paint; /// If set, only one label with its text will be displayed. Sorted out by the layout manager. - bool uniqueLabel; - std::string uuidField; // UUID field for markers/labels (from style settings) - std::string repUUIDField; // UUID field for representations (from style layers) - bool useZoomLevels; + bool uniqueLabel = false; + bool useZoomLevels = false; }; } diff --git a/common/WhirlyGlobeLib/include/MapboxVectorTileParser.h b/common/WhirlyGlobeLib/include/MapboxVectorTileParser.h index 64eddf6bfc..c622ae8302 100644 --- a/common/WhirlyGlobeLib/include/MapboxVectorTileParser.h +++ b/common/WhirlyGlobeLib/include/MapboxVectorTileParser.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/25/16. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/MaplyAnimateTranslateMomentum.h b/common/WhirlyGlobeLib/include/MaplyAnimateTranslateMomentum.h index fdc6915a92..079b7ecc70 100644 --- a/common/WhirlyGlobeLib/include/MaplyAnimateTranslateMomentum.h +++ b/common/WhirlyGlobeLib/include/MaplyAnimateTranslateMomentum.h @@ -1,9 +1,8 @@ -/* - * MaplyAnimateTranslateMomentum.h +/* MaplyAnimateTranslateMomentum.h * WhirlyGlobeLib * * Created by Steve Gifford on 1/20/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "WhirlyTypes.h" @@ -35,29 +33,32 @@ class AnimateTranslateMomentum : public MapViewAnimationDelegate { public: /// Initialize with a velocity and negative acceleration (to slow down) - AnimateTranslateMomentum(MapViewRef inMapView, + AnimateTranslateMomentum(const MapViewRef &inMapView, float inVel,float inAcc,const WhirlyKit::Point3f &inDir, const WhirlyKit::Point2dVector &inBounds, WhirlyKit::SceneRenderer *inSceneRenderer); /// Update the map view - virtual void updateView(MapView *mapView); + virtual void updateView(WhirlyKit::View *); + + virtual bool isUserMotion() const { return userMotion; } - /// Set if a user kicked this off (true by default) - bool userMotion; - protected: - bool withinBounds(const WhirlyKit::Point3d &loc,MapView * testMapView,WhirlyKit::Point3d *newCenter); + bool withinBounds(const WhirlyKit::Point3d &loc, + MapView * testMapView, + WhirlyKit::Point3d *newCenter); - MapViewRef mapView; WhirlyKit::SceneRenderer *renderer; float velocity,acceleration; Eigen::Vector3d dir; - float maxTime; + float maxTime = MAXFLOAT; WhirlyKit::TimeInterval startDate; WhirlyKit::Point3d org; WhirlyKit::Point2dVector bounds; + + /// Set if a user kicked this off (true by default) + bool userMotion = true; }; } diff --git a/common/WhirlyGlobeLib/include/MaplyAnimateTranslation.h b/common/WhirlyGlobeLib/include/MaplyAnimateTranslation.h index 796b2981a2..bc19350f29 100644 --- a/common/WhirlyGlobeLib/include/MaplyAnimateTranslation.h +++ b/common/WhirlyGlobeLib/include/MaplyAnimateTranslation.h @@ -1,9 +1,8 @@ -/* - * MaplyAnimateTranslation.h +/* MaplyAnimateTranslation.h * WhirlyGlobeLib * * Created by Steve Gifford on 1/20/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "WhirlyTypes.h" @@ -27,7 +25,11 @@ namespace Maply { // Bounds check that adjusts the center to try and compensate -bool MaplyGestureWithinBounds(const WhirlyKit::Point2dVector &bounds,const WhirlyKit::Point3d &loc,WhirlyKit::SceneRenderer *sceneRender,MapView *testMapView,WhirlyKit::Point3d *newCenter); +bool MaplyGestureWithinBounds(const WhirlyKit::Point2dVector &bounds, + const WhirlyKit::Point3d &loc, + WhirlyKit::SceneRenderer *sceneRender, + MapView *testMapView, + WhirlyKit::Point3d *newCenter); /// Maply translation from one location to another. class AnimateViewTranslation : public MapViewAnimationDelegate @@ -35,13 +37,18 @@ class AnimateViewTranslation : public MapViewAnimationDelegate public: /// Kick off a translate to the given position over the given time /// Assign this to the globe view's delegate and it'll do the rest - AnimateViewTranslation(MapViewRef mapView,WhirlyKit::SceneRenderer *renderer,WhirlyKit::Point3d &newLoc,float howLong); + AnimateViewTranslation(const MapViewRef &mapView, + WhirlyKit::SceneRenderer *renderer, + WhirlyKit::Point3d &newLoc, + float howLong); /// Set the bounding rectangle - void setBounds(WhirlyKit::Point2d *bounds); + void setBounds(const WhirlyKit::Point2d *bounds); /// Update the map view - virtual void updateView(MapView *mapView); + virtual void updateView(WhirlyKit::View *); + + virtual bool isUserMotion() const { return userMotion; } /// When to start the animation. Can be in the past WhirlyKit::TimeInterval startDate; @@ -51,17 +58,19 @@ class AnimateViewTranslation : public MapViewAnimationDelegate WhirlyKit::Point3d startLoc; /// Where to end the translation. We'll interpolate from the start to here. WhirlyKit::Point3d endLoc; + /// Set if a user kicked this off (true by default) - bool userMotion; + bool userMotion = true; protected: WhirlyKit::SceneRenderer *renderer; - bool withinBounds(const WhirlyKit::Point3d &loc,MapView * testMapView,WhirlyKit::Point3d *newCenter); - + bool withinBounds(const WhirlyKit::Point3d &loc, + MapView * testMapView, + WhirlyKit::Point3d *newCenter); + /// Boundary quad that we're to stay within WhirlyKit::Point2dVector bounds; - MapViewRef mapView; }; typedef std::shared_ptr AnimateViewTranslationRef; diff --git a/common/WhirlyGlobeLib/include/MaplyFlatView.h b/common/WhirlyGlobeLib/include/MaplyFlatView.h index 31342530d5..6f3b9b2baf 100644 --- a/common/WhirlyGlobeLib/include/MaplyFlatView.h +++ b/common/WhirlyGlobeLib/include/MaplyFlatView.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/2/13. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/MaplyVectorStyleC.h b/common/WhirlyGlobeLib/include/MaplyVectorStyleC.h index 531234489d..bdb5ec32f9 100644 --- a/common/WhirlyGlobeLib/include/MaplyVectorStyleC.h +++ b/common/WhirlyGlobeLib/include/MaplyVectorStyleC.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 4/9/20. -* Copyright 2011-2021 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/MaplyView.h b/common/WhirlyGlobeLib/include/MaplyView.h index 75d7abc282..e40af011aa 100644 --- a/common/WhirlyGlobeLib/include/MaplyView.h +++ b/common/WhirlyGlobeLib/include/MaplyView.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/9/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ namespace WhirlyKit { +class View; class SceneRenderer; } @@ -31,11 +32,12 @@ namespace Maply class MapView; /// Animation callback -class MapViewAnimationDelegate +struct MapViewAnimationDelegate : public WhirlyKit::ViewAnimationDelegate { -public: + virtual bool isUserMotion() const = 0; + /// Called every tick to update the map position - virtual void updateView(MapView *mapView) = 0; + virtual void updateView(WhirlyKit::View *) = 0; }; typedef std::shared_ptr MapViewAnimationDelegateRef; diff --git a/common/WhirlyGlobeLib/include/MarkerManager.h b/common/WhirlyGlobeLib/include/MarkerManager.h index e8814d1922..be2caec1f5 100644 --- a/common/WhirlyGlobeLib/include/MarkerManager.h +++ b/common/WhirlyGlobeLib/include/MarkerManager.h @@ -1,9 +1,8 @@ -/* - * MarkerManager.h +/* MarkerManager.h * WhirlyGlobeLib * * Created by Steve Gifford on 7/16/13. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import @@ -64,13 +62,15 @@ class MarkerSceneRep : public Identifiable typedef std::set MarkerSceneRepSet; // Used to pass marker information between threads -class MarkerInfo : public BaseInfo +struct MarkerInfo : public BaseInfo { -public: MarkerInfo(bool screenObject); MarkerInfo(const Dictionary &,bool screenObject); virtual ~MarkerInfo() = default; + // Convert contents to a string for debugging + virtual std::string toString() const { return BaseInfo::toString() + " + MarkerInfo..."; } + RGBAColor color; bool screenObject; float width,height; @@ -150,7 +150,11 @@ class Marker long orderBy = -1; /// Passed through the system as a unique identifier std::string uniqueID; - + /// Identifies objects that should be laid out together + std::string mergeID; + + int layoutPlacement = WhirlyKitLayoutPlacementNone; + // If set, we'll draw an outline to the mask target WhirlyKit::SimpleIdentity maskID = EmptyIdentity; WhirlyKit::SimpleIdentity maskRenderTargetID = EmptyIdentity; diff --git a/common/WhirlyGlobeLib/include/MemManagerGLES.h b/common/WhirlyGlobeLib/include/MemManagerGLES.h index a24a17421d..e3ba9086a9 100644 --- a/common/WhirlyGlobeLib/include/MemManagerGLES.h +++ b/common/WhirlyGlobeLib/include/MemManagerGLES.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/Moon.h b/common/WhirlyGlobeLib/include/Moon.h index c10c68ba91..0452920489 100644 --- a/common/WhirlyGlobeLib/include/Moon.h +++ b/common/WhirlyGlobeLib/include/Moon.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/OverlapHelper.h b/common/WhirlyGlobeLib/include/OverlapHelper.h index 65d7902036..7b4defcf0e 100644 --- a/common/WhirlyGlobeLib/include/OverlapHelper.h +++ b/common/WhirlyGlobeLib/include/OverlapHelper.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 9/28/15. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,44 +32,89 @@ namespace WhirlyKit { -class LayoutObjectEntry; +struct LayoutObjectEntry; class LayoutObject; using LayoutObjectEntryRef = std::shared_ptr; // We use this to avoid overlapping labels -class OverlapHelper +struct OverlapHelper { -public: - EIGEN_MAKE_ALIGNED_OPERATOR_NEW; + OverlapHelper(const Mbr &mbr,int sizeX,int sizeY,size_t totalObjs); - OverlapHelper(const Mbr &mbr,int sizeX,int sizeY); - // Try to add an object. Might fail (kind of the whole point). - bool addCheckObject(const Point2dVector &pts); - + bool addCheckObject(const Point2dVector &pts, const char* mergeID = nullptr); + bool addCheckObject(const Point2dVector &pts, const std::string &mergeID); + // See if there's an object in the way - bool checkObject(const Point2dVector &pts); - + bool checkObject(const Point2dVector &pts, const char* mergeID = nullptr); + bool checkObject(const Point2dVector &pts, const std::string &mergeID); + // Force an object in no matter what - void addObject(const Point2dVector &pts); + void addObject(Point2dVector pts, std::string mergeID = std::string()); protected: void calcCells(const Mbr &objMbr, int &sx, int &sy, int &ex, int &ey); - bool checkObject(const Point2dVector &pts, const Mbr &objMbr, int sx, int sy, int ex, int ey); + bool checkObject(const Point2dVector &pts, const Mbr &objMbr, + int sx, int sy, int ex, int ey, + const char* mergeID); + void addObject(Point2dVector pts, std::string mergeID, + int sx, int sy, int ex, int ey); + + struct GridCell + { + // Indexes into objects vector + std::vector objIndexes; + }; // Object and its bounds - class BoundedObject + struct BoundedObject { - public: - ~BoundedObject() { } + BoundedObject() = default; + BoundedObject(const BoundedObject&) = default; + BoundedObject& operator=(const BoundedObject&) = default; + + BoundedObject(const Point2dVector& inPts, const char* id) : + pts(inPts), mergeID(id ? id : std::string()) + { + } + + BoundedObject(Point2dVector&& inPts, std::string &&id) : + pts(std::move(inPts)), mergeID(std::move(id)) + { + } + + BoundedObject(BoundedObject&& that) : + pts(std::move(that.pts)), mergeID(std::move(that.mergeID)) + { + } + BoundedObject& operator=(BoundedObject&& that) + { + if (this != &that) + { + pts = std::move(that.pts); + mergeID = std::move(that.mergeID); + } + return *this; + } + Point2dVector pts; + std::string mergeID; }; - + + GridCell &cellAt(int x, int y) { return grid[y * sizeX + x]; } + Mbr mbr; - std::vector objects; - int sizeX,sizeY; + int sizeX; + int sizeY; + size_t totalObjs; Point2f cellSize; - std::vector > grid; + std::vector objects; + std::vector grid; + + // Estimate the fraction of objects likely to fall in a given cell + const double overlapHeuristic = 0.1; + + EIGEN_MAKE_ALIGNED_OPERATOR_NEW; }; // Used to figure out what clusters @@ -94,9 +139,8 @@ class ClusterHelper }; // Simple object we're trying to cluster - class SimpleObject : public ObjectWithBounds + struct SimpleObject : public ObjectWithBounds { - public: SimpleObject(); std::shared_ptr objEntry; int parentObject; diff --git a/common/WhirlyGlobeLib/include/ParticleSystemDrawable.h b/common/WhirlyGlobeLib/include/ParticleSystemDrawable.h index 31e29564e8..75550ac6a8 100644 --- a/common/WhirlyGlobeLib/include/ParticleSystemDrawable.h +++ b/common/WhirlyGlobeLib/include/ParticleSystemDrawable.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/28/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/ParticleSystemDrawableBuilder.h b/common/WhirlyGlobeLib/include/ParticleSystemDrawableBuilder.h index d217995642..4fccdd2990 100644 --- a/common/WhirlyGlobeLib/include/ParticleSystemDrawableBuilder.h +++ b/common/WhirlyGlobeLib/include/ParticleSystemDrawableBuilder.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/14/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/ParticleSystemDrawableBuilderGLES.h b/common/WhirlyGlobeLib/include/ParticleSystemDrawableBuilderGLES.h index b140beafff..bc0ebbda66 100644 --- a/common/WhirlyGlobeLib/include/ParticleSystemDrawableBuilderGLES.h +++ b/common/WhirlyGlobeLib/include/ParticleSystemDrawableBuilderGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/14/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/ParticleSystemDrawableGLES.h b/common/WhirlyGlobeLib/include/ParticleSystemDrawableGLES.h index 0fed1125b2..96582608bd 100644 --- a/common/WhirlyGlobeLib/include/ParticleSystemDrawableGLES.h +++ b/common/WhirlyGlobeLib/include/ParticleSystemDrawableGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/28/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/ParticleSystemManager.h b/common/WhirlyGlobeLib/include/ParticleSystemManager.h index 3ca72d4854..b970101013 100644 --- a/common/WhirlyGlobeLib/include/ParticleSystemManager.h +++ b/common/WhirlyGlobeLib/include/ParticleSystemManager.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/26/15. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/PerformanceTimer.h b/common/WhirlyGlobeLib/include/PerformanceTimer.h index e5ebe6c812..d3b4d7c864 100644 --- a/common/WhirlyGlobeLib/include/PerformanceTimer.h +++ b/common/WhirlyGlobeLib/include/PerformanceTimer.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/20/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,7 +79,7 @@ class PerformanceTimer void clear(); /// Write out the timings to the log - void log(); + void log(double min = 0.0); protected: std::map actives; diff --git a/common/WhirlyGlobeLib/include/Platform.h b/common/WhirlyGlobeLib/include/Platform.h index 9b7e7d1d75..396e1c83f6 100644 --- a/common/WhirlyGlobeLib/include/Platform.h +++ b/common/WhirlyGlobeLib/include/Platform.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/13/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/Program.h b/common/WhirlyGlobeLib/include/Program.h index d47ad48193..8259a5ada8 100644 --- a/common/WhirlyGlobeLib/include/Program.h +++ b/common/WhirlyGlobeLib/include/Program.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/23/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/ProgramGLES.h b/common/WhirlyGlobeLib/include/ProgramGLES.h index 5b392b3d0b..18b9ef89d1 100644 --- a/common/WhirlyGlobeLib/include/ProgramGLES.h +++ b/common/WhirlyGlobeLib/include/ProgramGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/23/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/Proj4CoordSystem.h b/common/WhirlyGlobeLib/include/Proj4CoordSystem.h index 38a81ba20f..39621947ba 100644 --- a/common/WhirlyGlobeLib/include/Proj4CoordSystem.h +++ b/common/WhirlyGlobeLib/include/Proj4CoordSystem.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 11/10/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/QuadDisplayControllerNew.h b/common/WhirlyGlobeLib/include/QuadDisplayControllerNew.h index 912c8de42b..8df99b4bb9 100644 --- a/common/WhirlyGlobeLib/include/QuadDisplayControllerNew.h +++ b/common/WhirlyGlobeLib/include/QuadDisplayControllerNew.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/13/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/QuadImageFrameLoader.h b/common/WhirlyGlobeLib/include/QuadImageFrameLoader.h index 08635ffd16..a565c46cb5 100644 --- a/common/WhirlyGlobeLib/include/QuadImageFrameLoader.h +++ b/common/WhirlyGlobeLib/include/QuadImageFrameLoader.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/15/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/QuadLoaderReturn.h b/common/WhirlyGlobeLib/include/QuadLoaderReturn.h index 76d59413d5..f18b9dc0db 100644 --- a/common/WhirlyGlobeLib/include/QuadLoaderReturn.h +++ b/common/WhirlyGlobeLib/include/QuadLoaderReturn.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/14/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/QuadSamplingController.h b/common/WhirlyGlobeLib/include/QuadSamplingController.h index 901be04ee4..cfc0fe6b67 100644 --- a/common/WhirlyGlobeLib/include/QuadSamplingController.h +++ b/common/WhirlyGlobeLib/include/QuadSamplingController.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/15/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/QuadSamplingParams.h b/common/WhirlyGlobeLib/include/QuadSamplingParams.h index 1a5396fb15..7cba7a31c2 100644 --- a/common/WhirlyGlobeLib/include/QuadSamplingParams.h +++ b/common/WhirlyGlobeLib/include/QuadSamplingParams.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/14/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/QuadTileBuilder.h b/common/WhirlyGlobeLib/include/QuadTileBuilder.h index d591e18511..40f8d26a3a 100644 --- a/common/WhirlyGlobeLib/include/QuadTileBuilder.h +++ b/common/WhirlyGlobeLib/include/QuadTileBuilder.h @@ -29,9 +29,34 @@ class QuadTileBuilder; This is passed to a Tile Builder Delegate when changes are being made in the Tile Builder; */ -class TileBuilderDelegateInfo { -public: - int targetLevel; +struct TileBuilderDelegateInfo +{ + TileBuilderDelegateInfo() = default; + TileBuilderDelegateInfo(const TileBuilderDelegateInfo&) = default; + TileBuilderDelegateInfo(TileBuilderDelegateInfo &&that) noexcept : + targetLevel(that.targetLevel), + loadTiles(std::move(that.loadTiles)), + unloadTiles(std::move(that.unloadTiles)), + enableTiles(std::move(that.enableTiles)), + disableTiles(std::move(that.disableTiles)), + changeTiles(std::move(that.changeTiles)) + { + } + TileBuilderDelegateInfo& operator=(const TileBuilderDelegateInfo&) = default; + TileBuilderDelegateInfo& operator=(TileBuilderDelegateInfo &&that) noexcept + { + if (this != &that) { + targetLevel = that.targetLevel; + loadTiles = std::move(that.loadTiles); + unloadTiles = std::move(that.unloadTiles); + enableTiles = std::move(that.enableTiles); + disableTiles = std::move(that.disableTiles); + changeTiles = std::move(that.changeTiles); + } + return *this; + } + + int targetLevel = -1; LoadedTileVec loadTiles; QuadTreeNew::NodeSet unloadTiles; LoadedTileVec enableTiles,disableTiles; diff --git a/common/WhirlyGlobeLib/include/RawData.h b/common/WhirlyGlobeLib/include/RawData.h index 41eea4791c..2dbb1fad38 100644 --- a/common/WhirlyGlobeLib/include/RawData.h +++ b/common/WhirlyGlobeLib/include/RawData.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/15/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/RawPNGImage.h b/common/WhirlyGlobeLib/include/RawPNGImage.h index e7116023f6..40c390da7f 100644 --- a/common/WhirlyGlobeLib/include/RawPNGImage.h +++ b/common/WhirlyGlobeLib/include/RawPNGImage.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/3/20. - * Copyright 2011-2020 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/RenderTarget.h b/common/WhirlyGlobeLib/include/RenderTarget.h index d8ec5274b9..d6bfffe9b6 100644 --- a/common/WhirlyGlobeLib/include/RenderTarget.h +++ b/common/WhirlyGlobeLib/include/RenderTarget.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/RenderTargetGLES.h b/common/WhirlyGlobeLib/include/RenderTargetGLES.h index b5746e89ce..2cd9d6370a 100644 --- a/common/WhirlyGlobeLib/include/RenderTargetGLES.h +++ b/common/WhirlyGlobeLib/include/RenderTargetGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/13/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/Scene.h b/common/WhirlyGlobeLib/include/Scene.h index d945366800..14dab45d81 100644 --- a/common/WhirlyGlobeLib/include/Scene.h +++ b/common/WhirlyGlobeLib/include/Scene.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/3/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -325,8 +325,11 @@ class Scene : public DelayedDeletable virtual bool removeTexture(SimpleIdentity texID); /// Called once by the renderer so we can reset any managers that care - void setRenderer(SceneRenderer *renderer); - + void setRenderer(SceneRenderer *inRenderer); + + /// Get the current scene renderer + SceneRenderer* getRenderer() const { return renderer; } + /// Return the given manager. This is thread safe; SceneManagerRef getManager(const char *name) { return getManager(std::string(name)); } /// Return the given manager. This is thread safe; @@ -499,6 +502,8 @@ class Scene : public DelayedDeletable // The font texture manager is created at startup FontTextureManagerRef fontTextureManager; + + SceneRenderer* renderer; }; - + } diff --git a/common/WhirlyGlobeLib/include/SceneGLES.h b/common/WhirlyGlobeLib/include/SceneGLES.h index e1535c4987..308635b939 100644 --- a/common/WhirlyGlobeLib/include/SceneGLES.h +++ b/common/WhirlyGlobeLib/include/SceneGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/14/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/SceneGraphManager.h b/common/WhirlyGlobeLib/include/SceneGraphManager.h index ea631171ef..e800b5bae4 100644 --- a/common/WhirlyGlobeLib/include/SceneGraphManager.h +++ b/common/WhirlyGlobeLib/include/SceneGraphManager.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/24/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -112,7 +112,7 @@ class SceneGraphManager : DelayedDeletable virtual ~SceneGraphManager(); /// Add a drawable to be referenced by the scenegraph - void addDrawable(BasicDrawable *draw,ChangeSet &changes); + void addDrawable(const BasicDrawableRef &draw,ChangeSet &changes); /// Add the given scenegraph fragment void attachSceneFragment(SimpleIdentity attachID,SceneGraphNode *node); diff --git a/common/WhirlyGlobeLib/include/SceneRenderer.h b/common/WhirlyGlobeLib/include/SceneRenderer.h index 0348a7d8ff..c45c34015b 100644 --- a/common/WhirlyGlobeLib/include/SceneRenderer.h +++ b/common/WhirlyGlobeLib/include/SceneRenderer.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/13/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -218,14 +218,20 @@ class SceneRenderer : public DelayedDeletable virtual void setClearColor(const RGBAColor &color); /// Return the current clear color - RGBAColor getClearColor(); + RGBAColor getClearColor() const; /// Get the framebuffer size (in pixels) - Point2f getFramebufferSize(); - + Point2f getFramebufferSize() const; + + /// Get the framebuffer size (in pixels) with a margin + Mbr getFramebufferBound(float marginFrac) const; + /// Get the framebuffer size (divided by scale) - Point2f getFramebufferSizeScaled(); - + Point2f getFramebufferSizeScaled() const; + + /// Get the framebuffer size (divided by scale) with a margin + Mbr getFramebufferBoundScaled(float marginFrac) const; + /// Return the attached Scene Scene *getScene(); @@ -233,11 +239,11 @@ class SceneRenderer : public DelayedDeletable View *getView(); /// Return the device scale (e.g. retina vs. not) - float getScale(); - + float getScale() const; + /// Set the screen scale (can vary) void setScale(float newScale); - + /// Used by the subclasses to determine if the view changed and needs to be updated virtual bool viewDidChange(); @@ -325,24 +331,8 @@ class SceneRenderer : public DelayedDeletable /// Maps name IDs to slots (slots are just used by Metal) virtual int getSlotForNameID(SimpleIdentity nameID); - /// The pixel width of the CAEAGLLayer. - int framebufferWidth; - /// The pixel height of the CAEAGLLayer. - int framebufferHeight; - - /// Scale, to reflect the device's screen - float scale; - - std::vector renderTargets; - std::vector workGroups; - - // Drawables that we currently know about, but are off - std::set offDrawables; + const std::vector &getRenderTargets() const { return renderTargets; } - // Explicitly clear any held structures - void shutdown(); - -public: // Called by the subclass virtual void init(); @@ -354,9 +344,23 @@ class SceneRenderer : public DelayedDeletable // Update the extra frame rendering count virtual void updateExtraFrames(); - + + const RenderTeardownInfoRef &getTeardownInfo() const { return teardownInfo; } + +protected: + /// Set the framebuffer size + /// You probably want resize() instead. + void setFramebufferSize(float width, float height); + void setFramebufferSize(const Point2f &size) { setFramebufferSize(size.x(), size.y()); } + + // Explicitly clear any held structures + void shutdown(); + +public: /// Scene we're drawing. This is set from outside Scene *scene; + +protected: /// The view controls how we're looking at the scene View *theView; /// Set this mode to modify how Z buffering is used (if at all) @@ -402,9 +406,9 @@ class SceneRenderer : public DelayedDeletable // If we're an offline renderer, the texture we're rendering into TextureRef framebufferTex; - + TimeInterval lightsLastUpdated; - Material defaultMat; + Material defaultMat; std::vector lights; // Everything torn down until the next frame @@ -412,6 +416,21 @@ class SceneRenderer : public DelayedDeletable // Map Name IDs to slots (when using Metal) std::map slotMap; + +protected: + /// The pixel width of the CAEAGLLayer. + int framebufferWidth; + /// The pixel height of the CAEAGLLayer. + int framebufferHeight; + + /// Scale, to reflect the device's screen + float scale; + + std::vector renderTargets; + std::vector workGroups; + + // Drawables that we currently know about, but are off + std::set offDrawables; }; typedef std::shared_ptr SceneRendererRef; diff --git a/common/WhirlyGlobeLib/include/SceneRendererGLES.h b/common/WhirlyGlobeLib/include/SceneRendererGLES.h index b873c894b0..1fd7296fae 100644 --- a/common/WhirlyGlobeLib/include/SceneRendererGLES.h +++ b/common/WhirlyGlobeLib/include/SceneRendererGLES.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/13/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/ScreenImportance.h b/common/WhirlyGlobeLib/include/ScreenImportance.h index 93ab3a5ee8..adb279f335 100644 --- a/common/WhirlyGlobeLib/include/ScreenImportance.h +++ b/common/WhirlyGlobeLib/include/ScreenImportance.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/11/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/ScreenObject.h b/common/WhirlyGlobeLib/include/ScreenObject.h index 30bc8a2535..5fd6bb26bb 100644 --- a/common/WhirlyGlobeLib/include/ScreenObject.h +++ b/common/WhirlyGlobeLib/include/ScreenObject.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/ScreenSpaceBuilder.h b/common/WhirlyGlobeLib/include/ScreenSpaceBuilder.h index 0257755c8b..b3d2287ee4 100644 --- a/common/WhirlyGlobeLib/include/ScreenSpaceBuilder.h +++ b/common/WhirlyGlobeLib/include/ScreenSpaceBuilder.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/21/14. - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ namespace WhirlyKit { class ScreenSpaceObject; +using ScreenSpaceObjectRef = std::shared_ptr; struct ScreenSpaceConvexGeometry; struct ScreenSpaceObjectLocation; @@ -139,7 +140,10 @@ class ScreenSpaceBuilder void addScreenObjects(std::vector &screenObjects, const std::vector *places = nullptr, SimpleIDUnorderedSet *drawIDs = nullptr); - + void addScreenObjects(std::vector &screenObjects, + const std::vector *places = nullptr, + SimpleIDUnorderedSet *drawIDs = nullptr); + /// Add a single screen space object void addScreenObject(const ScreenSpaceObject &screenObject, const Point3d &worldLoc, @@ -298,7 +302,8 @@ class ScreenSpaceObject : public Identifiable ScreenSpaceBuilder::DrawableState state; std::vector geometry; }; - +using ScreenSpaceObjectRef = std::shared_ptr; + /** We use the screen space object location to communicate where a screen space object is on the screen. */ diff --git a/common/WhirlyGlobeLib/include/ScreenSpaceDrawableBuilder.h b/common/WhirlyGlobeLib/include/ScreenSpaceDrawableBuilder.h index b280acdb20..ea2e9feb1b 100644 --- a/common/WhirlyGlobeLib/include/ScreenSpaceDrawableBuilder.h +++ b/common/WhirlyGlobeLib/include/ScreenSpaceDrawableBuilder.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 8/24/14. - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/ScreenSpaceDrawableBuilderGLES.h b/common/WhirlyGlobeLib/include/ScreenSpaceDrawableBuilderGLES.h index edac6850c0..7fbcde27f1 100644 --- a/common/WhirlyGlobeLib/include/ScreenSpaceDrawableBuilderGLES.h +++ b/common/WhirlyGlobeLib/include/ScreenSpaceDrawableBuilderGLES.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/14/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/SelectionManager.h b/common/WhirlyGlobeLib/include/SelectionManager.h index 808a5266e7..9f6e65cd37 100644 --- a/common/WhirlyGlobeLib/include/SelectionManager.h +++ b/common/WhirlyGlobeLib/include/SelectionManager.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/26/11. - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -321,6 +321,8 @@ class SelectionManager : public SceneManager Point2f frameSize; Point2f frameSizeScale; + + /// frame with margin, not scaled Mbr frameMbr; }; diff --git a/common/WhirlyGlobeLib/include/ShapeDrawableBuilder.h b/common/WhirlyGlobeLib/include/ShapeDrawableBuilder.h index 9aa922d997..1364637df7 100644 --- a/common/WhirlyGlobeLib/include/ShapeDrawableBuilder.h +++ b/common/WhirlyGlobeLib/include/ShapeDrawableBuilder.h @@ -1,9 +1,8 @@ -/* - * ShapeDrawableBuilder.h +/* ShapeDrawableBuilder.h * WhirlyGlobeLib * * Created by Steve Gifford on 9/28/11. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "Identifiable.h" @@ -30,21 +28,20 @@ namespace WhirlyKit /// Used to pass shape info between the shape layer and the drawable builder /// and within the threads of the shape layer -class ShapeInfo : public BaseInfo +struct ShapeInfo : public BaseInfo { -public: - EIGEN_MAKE_ALIGNED_OPERATOR_NEW; - ShapeInfo(); ShapeInfo(const Dictionary &); virtual ~ShapeInfo() = default; -public: - RGBAColor color; - float lineWidth; - bool insideOut; - bool hasCenter; - WhirlyKit::Point3d center; + // Convert contents to a string for debugging + virtual std::string toString() const { return BaseInfo::toString() + " +ShapeInfo..."; } + + RGBAColor color = RGBAColor::white(); + float lineWidth = 1.0f; + bool insideOut = false; + bool hasCenter = false; + WhirlyKit::Point3d center = { 0, 0, 0 }; }; typedef std::shared_ptr ShapeInfoRef; diff --git a/common/WhirlyGlobeLib/include/ShapeManager.h b/common/WhirlyGlobeLib/include/ShapeManager.h index 5a226e983a..dc9ba632c2 100644 --- a/common/WhirlyGlobeLib/include/ShapeManager.h +++ b/common/WhirlyGlobeLib/include/ShapeManager.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/ShapeReader.h b/common/WhirlyGlobeLib/include/ShapeReader.h index 9f2156cf27..aacfb8b943 100644 --- a/common/WhirlyGlobeLib/include/ShapeReader.h +++ b/common/WhirlyGlobeLib/include/ShapeReader.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/SharedAttributes.h b/common/WhirlyGlobeLib/include/SharedAttributes.h index b2d0818bc4..ecdab8b3ab 100644 --- a/common/WhirlyGlobeLib/include/SharedAttributes.h +++ b/common/WhirlyGlobeLib/include/SharedAttributes.h @@ -1,9 +1,8 @@ -/* - * SharedAttributes +/* SharedAttributes * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/19/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ /// Wrapper for string (Objective-C vs. other) @@ -235,6 +233,9 @@ /// Basic or performance mode for wide vectors #define MaplyWideVecImpl WKString("widevecimplementation") +/// Default/old mode for wide vectors +#define MaplyWideVecImplDefault WKString("widevecdefault") + /// Performance mode for wide vectors #define MaplyWideVecImplPerf WKString("widevecperformance") @@ -281,6 +282,9 @@ /// Offset to left (negative) or right (positive) of the centerline #define MaplyWideVecOffset WKString("vecOffset") +/// Close any un-closed areal features when drawing lines for them +#define MaplyVecCloseAreals WKString("vecCloseAreals") + /// If set we'll break up a vector feature to the given epsilon on a globe surface #define MaplySubdivEpsilon WKString("subdivisionepsilon") /// If subdiv epsilon is set we'll look for a subdivision type. Default is simple. diff --git a/common/WhirlyGlobeLib/include/SphericalEarthChunkManager.h b/common/WhirlyGlobeLib/include/SphericalEarthChunkManager.h index 3dadcb75bc..78ecdcbe59 100644 --- a/common/WhirlyGlobeLib/include/SphericalEarthChunkManager.h +++ b/common/WhirlyGlobeLib/include/SphericalEarthChunkManager.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/29/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/SphericalMercator.h b/common/WhirlyGlobeLib/include/SphericalMercator.h index f20b067948..708ab7db8c 100644 --- a/common/WhirlyGlobeLib/include/SphericalMercator.h +++ b/common/WhirlyGlobeLib/include/SphericalMercator.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/19/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/Sun.h b/common/WhirlyGlobeLib/include/Sun.h index e6025eb2f4..b9d91aca7d 100644 --- a/common/WhirlyGlobeLib/include/Sun.h +++ b/common/WhirlyGlobeLib/include/Sun.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/Tesselator.h b/common/WhirlyGlobeLib/include/Tesselator.h index ff082d8f76..cc56e4b6e8 100644 --- a/common/WhirlyGlobeLib/include/Tesselator.h +++ b/common/WhirlyGlobeLib/include/Tesselator.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/17/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/Texture.h b/common/WhirlyGlobeLib/include/Texture.h index 43dcbb2241..b6a6e0fbf0 100644 --- a/common/WhirlyGlobeLib/include/Texture.h +++ b/common/WhirlyGlobeLib/include/Texture.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/7/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/TextureAtlas.h b/common/WhirlyGlobeLib/include/TextureAtlas.h index 76ca11160d..045bac07ba 100644 --- a/common/WhirlyGlobeLib/include/TextureAtlas.h +++ b/common/WhirlyGlobeLib/include/TextureAtlas.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/28/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/TextureGLES.h b/common/WhirlyGlobeLib/include/TextureGLES.h index 045a546b85..7e5a494980 100644 --- a/common/WhirlyGlobeLib/include/TextureGLES.h +++ b/common/WhirlyGlobeLib/include/TextureGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/TriangleShadersGLES.h b/common/WhirlyGlobeLib/include/TriangleShadersGLES.h index e809e82060..1ced56f565 100644 --- a/common/WhirlyGlobeLib/include/TriangleShadersGLES.h +++ b/common/WhirlyGlobeLib/include/TriangleShadersGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 8/21/18. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/UtilsGLES.h b/common/WhirlyGlobeLib/include/UtilsGLES.h index 9ca1fc7e17..670f298ce2 100644 --- a/common/WhirlyGlobeLib/include/UtilsGLES.h +++ b/common/WhirlyGlobeLib/include/UtilsGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/21/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/VectorData.h b/common/WhirlyGlobeLib/include/VectorData.h index 8eb99a41ea..f69bae3a45 100644 --- a/common/WhirlyGlobeLib/include/VectorData.h +++ b/common/WhirlyGlobeLib/include/VectorData.h @@ -1,9 +1,8 @@ -/* - * VectorData.h +/* VectorData.h * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import @@ -109,27 +107,35 @@ struct VectorShapeRefHash : std::hash /// cast to get the specfic type. Don't forget to use the std dynamic cast //typedef std::set ShapeSet; typedef std::unordered_set ShapeSet; - + +namespace detail { + using TDefaultIntermediate = long double; +} + /// Calculate area of a loop -template double CalcLoopArea(const std::vector>&); +template +TRet CalcLoopArea(const std::vector>&); /// Calculate the centroid of a loop -template T CalcLoopCentroid(const std::vector>&); +template +T CalcLoopCentroid(const std::vector>&); /// Calculate the centroid of a loop when the area is already known -template T CalcLoopCentroid(const std::vector>&, double loopArea); +template +T CalcLoopCentroid(const std::vector>&, double loopArea); /// Calculate the center of mass of the points -template T CalcCenterOfMass(const std::vector> &loop); - -extern template double CalcLoopArea(const VectorRing&); -extern template double CalcLoopArea(const Point2dVector&); -extern template Point2f CalcLoopCentroid(const VectorRing&); -extern template Point2d CalcLoopCentroid(const Point2dVector&); -extern template Point2f CalcLoopCentroid(const VectorRing&, double); -extern template Point2d CalcLoopCentroid(const Point2dVector&, double); -extern template Point2f CalcCenterOfMass(const VectorRing&); -extern template Point2d CalcCenterOfMass(const Point2dVector&); +template +T CalcCenterOfMass(const std::vector> &loop); + +extern template double CalcLoopArea(const VectorRing&); +extern template double CalcLoopArea(const Point2dVector&); +extern template Point2f CalcLoopCentroid(const VectorRing&); +extern template Point2f CalcLoopCentroid(const VectorRing&, double); +extern template Point2d CalcLoopCentroid(const Point2dVector&); +extern template Point2d CalcLoopCentroid(const Point2dVector&, double); +extern template Point2f CalcCenterOfMass(const VectorRing&); +extern template Point2d CalcCenterOfMass(const Point2dVector&); /// Collection of triangles forming a mesh class VectorTriangles : public VectorShape diff --git a/common/WhirlyGlobeLib/include/VectorManager.h b/common/WhirlyGlobeLib/include/VectorManager.h index 0d861358f3..0740612701 100644 --- a/common/WhirlyGlobeLib/include/VectorManager.h +++ b/common/WhirlyGlobeLib/include/VectorManager.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/22/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,27 +63,27 @@ typedef enum {TextureProjectionNone,TextureProjectionTanPlane,TextureProjectionS class VectorInfo : public BaseInfo { public: - EIGEN_MAKE_ALIGNED_OPERATOR_NEW; - - VectorInfo(); + VectorInfo() = default; VectorInfo(const Dictionary &dict); virtual ~VectorInfo() = default; // Convert contents to a string for debugging - virtual std::string toString(); - - bool filled; - float sample; - SimpleIdentity texId; - Point2f texScale; - float subdivEps; - bool gridSubdiv; - TextureProjections texProj; - RGBAColor color; - float lineWidth; - bool centered; - bool vecCenterSet; - Point2f vecCenter; + virtual std::string toString() const override; + + bool filled = false; + float sample = 0.0f; + SimpleIdentity texId = EmptyIdentity; + Point2f texScale = { 1.0f, 1.0f }; + float subdivEps = 0.0f; + bool gridSubdiv = false; + TextureProjections texProj = TextureProjectionNone; + RGBAColor color = RGBAColor::white(); + float lineWidth = 1.0f; + bool centered = true; + bool vecCenterSet = false; + bool closeAreals = true; + bool selectable = true; + Point2f vecCenter = { 0.0f, 0.0f }; FloatExpressionInfoRef opacityExp; ColorExpressionInfoRef colorExp; }; diff --git a/common/WhirlyGlobeLib/include/VectorObject.h b/common/WhirlyGlobeLib/include/VectorObject.h index 2f6b07bae9..3a2ff3c6a1 100644 --- a/common/WhirlyGlobeLib/include/VectorObject.h +++ b/common/WhirlyGlobeLib/include/VectorObject.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/17/11. - * Copyright 2011-2013 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ class VectorObject : public Identifiable /// @brief Return the attributes for the first shape or NULL MutableDictionaryRef getAttributes() const; - void setAttributes(MutableDictionaryRef newDict); + void setAttributes(const MutableDictionaryRef &newDict); /// Make a complete company (nothing shared) and return it VectorObjectRef deepCopy() const; @@ -176,12 +176,45 @@ class VectorObject : public Identifiable */ VectorObjectRef filterClippedEdges() const; - // Convert any linear features into areals and return a new vector object + /// @brief Convert any linear features into areals and return a new vector object VectorObjectRef linearsToAreals() const; - // Convert any areal features into linears and return a new vector object + /// @brief Convert any areal features into linears and return a new vector object VectorObjectRef arealsToLinears() const; - + + /// @brief The number of linear features + int countLinears() const; + + /// @brief The number of areal features + int countAreals() const; + + /// @brief Reverse the direction of areal loops + void reverseAreals(); + + /// @brief Create a copy with reversed loops + VectorObjectRef reversedAreals() const; + + /// @brief The number of areal loops that are closed + int countClosedLoops() const; + + /// @brief The number of areal loops that are not closed + int countUnClosedLoops() const; + + /// @brief Ensure that loops are closed + void closeLoops(); + + /// @brief Ensure that loops are closed, returning a new object + VectorObjectRef closedLoops() const; + + /// @brief Ensure that loops are not closed + void unCloseLoops(); + + /// @brief Ensure that loops are not closed, returning a new object + VectorObjectRef unClosedLoops() const; + + /// @brief Check if any segments intersect any others + bool anyIntersections() const; + /// @brief Add objects form the given GeoJSON string. /// @param json The GeoJSON data as a std::string /// @return True on success, false on failure. @@ -195,6 +228,8 @@ class VectorObject : public Identifiable /// @brief Assemblies are just concatenated JSON static bool FromGeoJSONAssembly(const std::string &json,std::map &vecData); + static bool FromGeoJSONAssembly(const std::string &json,std::map &vecData); + public: void subdivideToInternal(float epsilon,WhirlyKit::CoordSystemDisplayAdapter *adapter,bool geolib,bool edgeMode); @@ -208,6 +243,6 @@ void SampleGreatCircle(const Point2d &startPt,const Point2d &endPt,double height // Sample a great circle and throw in an interpolated height at each point void SampleGreatCircleStatic(const Point2d &startPt,const Point2d &endPt,double height,Point3dVector &pts, - const WhirlyKit::CoordSystemDisplayAdapter *coordAdapter,double samples); + const WhirlyKit::CoordSystemDisplayAdapter *coordAdapter,int minSamples); } diff --git a/common/WhirlyGlobeLib/include/VectorOffset.h b/common/WhirlyGlobeLib/include/VectorOffset.h index cc5ace5a85..468e2494f2 100644 --- a/common/WhirlyGlobeLib/include/VectorOffset.h +++ b/common/WhirlyGlobeLib/include/VectorOffset.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/4/21. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/VectorTilePBFParser.h b/common/WhirlyGlobeLib/include/VectorTilePBFParser.h index 209e3f0775..6af98db1a5 100644 --- a/common/WhirlyGlobeLib/include/VectorTilePBFParser.h +++ b/common/WhirlyGlobeLib/include/VectorTilePBFParser.h @@ -3,7 +3,7 @@ // WhirlyGlobeMaplyComponent // // Created by Tim Sylvester on 10/30/20. -// Copyright © 2020 mousebird consulting. All rights reserved. +// Copyright 2020 mousebird consulting. All rights reserved. // #ifndef VectorTilePBFParser_h diff --git a/common/WhirlyGlobeLib/include/VertexAttribute.h b/common/WhirlyGlobeLib/include/VertexAttribute.h index 7bb88c9ce0..e6bd745f91 100644 --- a/common/WhirlyGlobeLib/include/VertexAttribute.h +++ b/common/WhirlyGlobeLib/include/VertexAttribute.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/VertexAttributeGLES.h b/common/WhirlyGlobeLib/include/VertexAttributeGLES.h index ebffada673..385bc1cbe3 100644 --- a/common/WhirlyGlobeLib/include/VertexAttributeGLES.h +++ b/common/WhirlyGlobeLib/include/VertexAttributeGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/WhirlyGeometry.h b/common/WhirlyGlobeLib/include/WhirlyGeometry.h index cbd15e17b8..5329ee64ca 100644 --- a/common/WhirlyGlobeLib/include/WhirlyGeometry.h +++ b/common/WhirlyGlobeLib/include/WhirlyGeometry.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/18/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/WhirlyGlobe.h b/common/WhirlyGlobeLib/include/WhirlyGlobe.h index e90530c21f..eb0f88851d 100644 --- a/common/WhirlyGlobeLib/include/WhirlyGlobe.h +++ b/common/WhirlyGlobeLib/include/WhirlyGlobe.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/12/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/WhirlyKitLog.h b/common/WhirlyGlobeLib/include/WhirlyKitLog.h index 7de63c063f..2d8d1c79da 100644 --- a/common/WhirlyGlobeLib/include/WhirlyKitLog.h +++ b/common/WhirlyGlobeLib/include/WhirlyKitLog.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,4 +39,11 @@ extern void wkLog(const char *formatStr,...); #define wkLogLevel(level, formatStr...) do {if ((level) >= (WK_MIN_LOG_LEVEL)) { wkLogLevel_((level), formatStr); }} while(0) extern void wkLogLevel_(WKLogLevel level,const char *formatStr,...); +#if !defined(WK_STD_DTOR_CATCH) && !defined(WK_STD_DTOR_CATCH_IN) +# define WK_STD_DTOR_CATCH_IN(name) catch (const std::exception &ex) { \ + wkLogLevel(Error, "Crash in %s: %s", (name), ex.what()); \ + } catch (...) { wkLogLevel(Error, "Crash in %s", (name)); } +# define WK_STD_DTOR_CATCH() WK_STD_DTOR_CATCH_IN(__func__) +#endif + #endif diff --git a/common/WhirlyGlobeLib/include/WhirlyKitView.h b/common/WhirlyGlobeLib/include/WhirlyKitView.h index 232cb239ef..ec90ba8421 100644 --- a/common/WhirlyGlobeLib/include/WhirlyKitView.h +++ b/common/WhirlyGlobeLib/include/WhirlyKitView.h @@ -1,9 +1,8 @@ -/* - * View.h +/* WhirlyKitView.h * WhirlyGlobeLib * * Created by Steve Gifford on 1/9/12. - * Copyright 2012 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import @@ -26,7 +24,7 @@ namespace WhirlyKit { - + class SceneRenderer; class View; class ViewState; @@ -40,9 +38,16 @@ class ViewWatcher /// Called when the view changes position virtual void viewUpdated(View *view) = 0; }; - typedef std::set ViewWatcherSet; +struct ViewAnimationDelegate +{ + virtual bool isUserMotion() const = 0; + + /// Called every tick to update the view position + virtual void updateView(WhirlyKit::View *) = 0; +}; + /** Whirly Kit View is the base class for the views used in WhirlyGlobe and Maply. It contains the general purpose methods and parameters related to the model and view matrices used for display. @@ -130,15 +135,18 @@ class View : public DelayedDeletable /// Used by subclasses to notify all the watchers of updates virtual void runViewUpdates(); - double fieldOfView,imagePlaneSize,nearPlane,farPlane; - Point2d centerOffset; + double fieldOfView = 0.0; + double imagePlaneSize = 0.0; + double nearPlane = 0.001; + double farPlane = 10.0; + Point2d centerOffset = { 0, 0 }; std::vector offsetMatrices; /// The last time the position was changed - TimeInterval lastChangedTime; + TimeInterval lastChangedTime = 0.0; /// Display adapter and coordinate system we're working in - WhirlyKit::CoordSystemDisplayAdapter *coordAdapter; + WhirlyKit::CoordSystemDisplayAdapter *coordAdapter = nullptr; /// If set, we'll scale the near and far clipping planes as we get closer - bool continuousZoom; + bool continuousZoom = false; /// Called when positions are updated ViewWatcherSet watchers; diff --git a/common/WhirlyGlobeLib/include/WhirlyOctEncoding.h b/common/WhirlyGlobeLib/include/WhirlyOctEncoding.h index 4729659530..f4f27e58f6 100644 --- a/common/WhirlyGlobeLib/include/WhirlyOctEncoding.h +++ b/common/WhirlyGlobeLib/include/WhirlyOctEncoding.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by @jmnavarro on 7/2/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/WhirlyTypes.h b/common/WhirlyGlobeLib/include/WhirlyTypes.h index f27aa23439..4cd216b527 100644 --- a/common/WhirlyGlobeLib/include/WhirlyTypes.h +++ b/common/WhirlyGlobeLib/include/WhirlyTypes.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/13/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/WhirlyVector.h b/common/WhirlyGlobeLib/include/WhirlyVector.h index 1f9536926b..0bd8b25165 100644 --- a/common/WhirlyGlobeLib/include/WhirlyVector.h +++ b/common/WhirlyGlobeLib/include/WhirlyVector.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/18/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,12 +37,13 @@ typedef std::vector > Point3fVector; typedef std::vector > Point3dVector; typedef std::vector > Vector4fVector; typedef std::vector > Vector4dVector; - + /// Convenience wrapper for texture coordinate -class TexCoord : public Eigen::Vector2f +struct TexCoord : public Eigen::Vector2f { -public: - TexCoord() { } + TexCoord() { } + TexCoord(const TexCoord& that) : Eigen::Vector2f(that) { } + TexCoord(const Eigen::Vector2f& that) : Eigen::Vector2f(that) { } TexCoord(float u,float v) : Eigen::Vector2f(u,v) { } float u() const { return x(); } float &u() { return x(); } diff --git a/common/WhirlyGlobeLib/include/WideVectorDrawableBuilder.h b/common/WhirlyGlobeLib/include/WideVectorDrawableBuilder.h index d13a62d403..88d8f863ff 100644 --- a/common/WhirlyGlobeLib/include/WideVectorDrawableBuilder.h +++ b/common/WhirlyGlobeLib/include/WideVectorDrawableBuilder.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/29/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ class WideVectorDrawableBuilder EIGEN_MAKE_ALIGNED_OPERATOR_NEW; WideVectorDrawableBuilder(std::string name,const SceneRenderer *sceneRenderer,Scene *scene); - virtual ~WideVectorDrawableBuilder(); + virtual ~WideVectorDrawableBuilder() = default; virtual void Init(unsigned int numVert, unsigned int numTri, diff --git a/common/WhirlyGlobeLib/include/WideVectorDrawableBuilderGLES.h b/common/WhirlyGlobeLib/include/WideVectorDrawableBuilderGLES.h index 396ca61bb2..a3400fed42 100644 --- a/common/WhirlyGlobeLib/include/WideVectorDrawableBuilderGLES.h +++ b/common/WhirlyGlobeLib/include/WideVectorDrawableBuilderGLES.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/14/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/include/WideVectorManager.h b/common/WhirlyGlobeLib/include/WideVectorManager.h index 76ef337c1e..74e3e859f3 100644 --- a/common/WhirlyGlobeLib/include/WideVectorManager.h +++ b/common/WhirlyGlobeLib/include/WideVectorManager.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/29/14. - * Copyright 2011-2020 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,23 +51,30 @@ typedef enum {WideVecImplBasic,WideVecImplPerf} WideVecImplType; class WideVectorInfo : public BaseInfo { public: - WideVectorInfo(); + WideVectorInfo() = default; WideVectorInfo(const Dictionary &dict); virtual ~WideVectorInfo() = default; - WideVecImplType implType; - RGBAColor color; - float width; - float offset; - float repeatSize; - float edgeSize; - float subdivEps; - WideVectorCoordsType coordType; - WideVectorLineJoinType joinType; - WideVectorLineCapType capType; - SimpleIdentity texID; - float miterLimit; - + // Convert contents to a string for debugging + virtual std::string toString() const override; + + WideVecImplType implType = WideVecImplBasic; + RGBAColor color = RGBAColor::white(); + float width = 2.0f; + float offset = 0.0f; + float repeatSize = 32.0f; + float edgeSize = 1.0f; + float subdivEps = 0.0f; + float miterLimit = 2.0f; + bool closeAreals = true; + bool selectable = true; + + WideVectorCoordsType coordType = WideVecCoordScreen; + WideVectorLineJoinType joinType = WideVecMiterJoin; + WideVectorLineCapType capType = WideVecButtCap; + + SimpleIdentity texID = EmptyIdentity; + FloatExpressionInfoRef widthExp; FloatExpressionInfoRef offsetExp; FloatExpressionInfoRef opacityExp; diff --git a/common/WhirlyGlobeLib/include/WrapperGLES.h b/common/WhirlyGlobeLib/include/WrapperGLES.h index b60e3f1f36..cf441a55d0 100644 --- a/common/WhirlyGlobeLib/include/WrapperGLES.h +++ b/common/WhirlyGlobeLib/include/WrapperGLES.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/18/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/BaseInfo.cpp b/common/WhirlyGlobeLib/src/BaseInfo.cpp index f7d76fa12a..b7b3ad4f0e 100644 --- a/common/WhirlyGlobeLib/src/BaseInfo.cpp +++ b/common/WhirlyGlobeLib/src/BaseInfo.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/6/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -248,31 +248,28 @@ std::string to_string(T value) return os.str(); } -std::string BaseInfo::toString() +std::string BaseInfo::toString() const { - std::string outStr = - (std::string)"minVis = " + to_string(minVis) + ";" + - " maxVis = " + to_string(maxVis) + ";" + - " minVisBand = " + to_string(minVisBand) + ";" + - " maxVisBand = " + to_string(maxVisBand) + ";" + - " minViewerDist = " + to_string(minViewerDist) + ";" + - " maxViewerDist = " + to_string(maxViewerDist) + ";" + - " zoomSlot = " + to_string(zoomSlot) + ";" + - " minZoomVis = " + to_string(minZoomVis) + ";" + - " maxZoomVis = " + to_string(maxZoomVis) + ";" + - " viewerCenter = (" + to_string(viewerCenter.x()) + "," + to_string(viewerCenter.y()) + "," + to_string(viewerCenter.z()) + ");" + - " drawOffset = " + to_string(drawOffset) + ";" + - " drawPriority = " + to_string(drawPriority) + ";" + - " enable = " + (enable ? "yes" : "no") + ";" + - " fade = " + to_string(fade) + ";" + - " fadeIn = " + to_string(fadeIn) + ";" + - " fadeOut = " + to_string(fadeOut) + ";" + - " fadeOutTime = " + to_string(fadeOutTime) + ";" + - " startEnable = " + to_string(startEnable) + ";" + - " endEnable = " + to_string(endEnable) + ";" + - " programID = " + to_string(programID) + ";"; - - return outStr; + return "minVis = " + to_string(minVis) + ";" + + " maxVis = " + to_string(maxVis) + ";" + + " minVisBand = " + to_string(minVisBand) + ";" + + " maxVisBand = " + to_string(maxVisBand) + ";" + + " minViewerDist = " + to_string(minViewerDist) + ";" + + " maxViewerDist = " + to_string(maxViewerDist) + ";" + + " zoomSlot = " + to_string(zoomSlot) + ";" + + " minZoomVis = " + to_string(minZoomVis) + ";" + + " maxZoomVis = " + to_string(maxZoomVis) + ";" + + " viewerCenter = (" + to_string(viewerCenter.x()) + "," + to_string(viewerCenter.y()) + "," + to_string(viewerCenter.z()) + ");" + + " drawOffset = " + to_string(drawOffset) + ";" + + " drawPriority = " + to_string(drawPriority) + ";" + + " enable = " + (enable ? "yes" : "no") + ";" + + " fade = " + to_string(fade) + ";" + + " fadeIn = " + to_string(fadeIn) + ";" + + " fadeOut = " + to_string(fadeOut) + ";" + + " fadeOutTime = " + to_string(fadeOutTime) + ";" + + " startEnable = " + to_string(startEnable) + ";" + + " endEnable = " + to_string(endEnable) + ";" + + " programID = " + to_string(programID) + ";"; } void BaseInfo::setupBasicDrawable(const BasicDrawableBuilderRef &drawBuild) const diff --git a/common/WhirlyGlobeLib/src/BasicDrawable.cpp b/common/WhirlyGlobeLib/src/BasicDrawable.cpp index f96511c527..f24552079c 100644 --- a/common/WhirlyGlobeLib/src/BasicDrawable.cpp +++ b/common/WhirlyGlobeLib/src/BasicDrawable.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/BasicDrawableBuilder.cpp b/common/WhirlyGlobeLib/src/BasicDrawableBuilder.cpp index d565bc1cfd..03e44e0e19 100644 --- a/common/WhirlyGlobeLib/src/BasicDrawableBuilder.cpp +++ b/common/WhirlyGlobeLib/src/BasicDrawableBuilder.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/BasicDrawableBuilderGLES.cpp b/common/WhirlyGlobeLib/src/BasicDrawableBuilderGLES.cpp index dcf93b8aae..f49a0998c2 100644 --- a/common/WhirlyGlobeLib/src/BasicDrawableBuilderGLES.cpp +++ b/common/WhirlyGlobeLib/src/BasicDrawableBuilderGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/10/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/BasicDrawableGLES.cpp b/common/WhirlyGlobeLib/src/BasicDrawableGLES.cpp index f88ddeb21e..3af9ccee8e 100644 --- a/common/WhirlyGlobeLib/src/BasicDrawableGLES.cpp +++ b/common/WhirlyGlobeLib/src/BasicDrawableGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/10/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/BasicDrawableInstance.cpp b/common/WhirlyGlobeLib/src/BasicDrawableInstance.cpp index 40a029a7e8..ac23f3197c 100644 --- a/common/WhirlyGlobeLib/src/BasicDrawableInstance.cpp +++ b/common/WhirlyGlobeLib/src/BasicDrawableInstance.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/BasicDrawableInstanceBuilder.cpp b/common/WhirlyGlobeLib/src/BasicDrawableInstanceBuilder.cpp index ef551ce41f..2d17a9a18d 100644 --- a/common/WhirlyGlobeLib/src/BasicDrawableInstanceBuilder.cpp +++ b/common/WhirlyGlobeLib/src/BasicDrawableInstanceBuilder.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/10/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/BasicDrawableInstanceBuilderGLES.cpp b/common/WhirlyGlobeLib/src/BasicDrawableInstanceBuilderGLES.cpp index 9a460d5907..eff4aa4f82 100644 --- a/common/WhirlyGlobeLib/src/BasicDrawableInstanceBuilderGLES.cpp +++ b/common/WhirlyGlobeLib/src/BasicDrawableInstanceBuilderGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/10/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/BasicDrawableInstanceGLES.cpp b/common/WhirlyGlobeLib/src/BasicDrawableInstanceGLES.cpp index abd0630a43..c5180ab0f9 100644 --- a/common/WhirlyGlobeLib/src/BasicDrawableInstanceGLES.cpp +++ b/common/WhirlyGlobeLib/src/BasicDrawableInstanceGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/10/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/BillboardDrawableBuilder.cpp b/common/WhirlyGlobeLib/src/BillboardDrawableBuilder.cpp index 97f837e0a8..2d99eed477 100644 --- a/common/WhirlyGlobeLib/src/BillboardDrawableBuilder.cpp +++ b/common/WhirlyGlobeLib/src/BillboardDrawableBuilder.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/27/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/BillboardDrawableBuilderGLES.cpp b/common/WhirlyGlobeLib/src/BillboardDrawableBuilderGLES.cpp index c6b3b303b6..ceac028ffb 100644 --- a/common/WhirlyGlobeLib/src/BillboardDrawableBuilderGLES.cpp +++ b/common/WhirlyGlobeLib/src/BillboardDrawableBuilderGLES.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/15/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/BillboardManager.cpp b/common/WhirlyGlobeLib/src/BillboardManager.cpp index c75fc930af..c331f74cb1 100644 --- a/common/WhirlyGlobeLib/src/BillboardManager.cpp +++ b/common/WhirlyGlobeLib/src/BillboardManager.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/CMakeLists.txt b/common/WhirlyGlobeLib/src/CMakeLists.txt index f15123ffd5..4f89c67224 100644 --- a/common/WhirlyGlobeLib/src/CMakeLists.txt +++ b/common/WhirlyGlobeLib/src/CMakeLists.txt @@ -36,6 +36,7 @@ target_sources( "${CMAKE_CURRENT_LIST_DIR}/../include/DynamicTextureAtlasGLES.h" "${CMAKE_CURRENT_LIST_DIR}/../include/FlatMath.h" "${CMAKE_CURRENT_LIST_DIR}/../include/FontTextureManager.h" + "${CMAKE_CURRENT_LIST_DIR}/../include/GeographicLib.h" "${CMAKE_CURRENT_LIST_DIR}/../include/GeometryManager.h" "${CMAKE_CURRENT_LIST_DIR}/../include/GeometryOBJReader.h" "${CMAKE_CURRENT_LIST_DIR}/../include/GlobeAnimateHeight.h" @@ -158,6 +159,7 @@ target_sources( "${CMAKE_CURRENT_LIST_DIR}/DynamicTextureAtlasGLES.cpp" "${CMAKE_CURRENT_LIST_DIR}/FlatMath.cpp" "${CMAKE_CURRENT_LIST_DIR}/FontTextureManager.cpp" + "${CMAKE_CURRENT_LIST_DIR}/GeographicLib.cpp" "${CMAKE_CURRENT_LIST_DIR}/GeometryManager.cpp" "${CMAKE_CURRENT_LIST_DIR}/GeometryOBJReader.cpp" "${CMAKE_CURRENT_LIST_DIR}/GlobeAnimateHeight.cpp" diff --git a/common/WhirlyGlobeLib/src/ChangeRequest.cpp b/common/WhirlyGlobeLib/src/ChangeRequest.cpp index 2bc281c5b2..4d6dfe854f 100644 --- a/common/WhirlyGlobeLib/src/ChangeRequest.cpp +++ b/common/WhirlyGlobeLib/src/ChangeRequest.cpp @@ -1,9 +1,8 @@ -/* - * ChangeRequest.cpp +/* ChangeRequest.cpp * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "ChangeRequest.h" @@ -33,13 +31,7 @@ void RenderTeardownInfo::destroyTexture(SceneRenderer *renderer,const TextureBas void RenderTeardownInfo::destroyDrawable(SceneRenderer *renderer,const DrawableRef &draw) { - draw->teardownForRenderer(renderer->getRenderSetupInfo(), renderer->getScene(), renderer->teardownInfo); -} - -ChangeRequest::ChangeRequest() : when(0.0) { } - -ChangeRequest::~ChangeRequest() -{ + draw->teardownForRenderer(renderer->getRenderSetupInfo(), renderer->getScene(), renderer->getTeardownInfo()); } bool ChangeRequest::needsFlush() { return false; } diff --git a/common/WhirlyGlobeLib/src/ComponentManager.cpp b/common/WhirlyGlobeLib/src/ComponentManager.cpp index baa497f2c4..fcc5d75c12 100644 --- a/common/WhirlyGlobeLib/src/ComponentManager.cpp +++ b/common/WhirlyGlobeLib/src/ComponentManager.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/15/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,8 @@ #import "WhirlyKitLog.h" #import "SharedAttributes.h" +//#define LOG_REPRESENTATIONS + namespace WhirlyKit { @@ -45,10 +47,6 @@ ComponentObject::ComponentObject(bool enable, bool selectable, const Dictionary } } -ComponentObject::~ComponentObject() -{ -} - void ComponentObject::clear() { markerIDs.clear(); @@ -113,6 +111,14 @@ void ComponentManager::addComponentObject(const ComponentObjectRef &compObj, Cha // If no representation is set, show this item if its representation is blank. const bool enable = (hit != representations.end()) ? (compObj->representation == hit->second) : compObj->representation.empty(); +#ifdef LOG_REPRESENTATIONS + if (enable) + wkLogLevel(Verbose, "CO id=%lld uuid=%s rep=%s active=%s result=%s", + compObj->getId(), compObj->uuid.c_str(), compObj->representation.c_str(), + (hit != representations.end())?hit->second.c_str():"(none)", + enable ? "enabled" : "disabled"); +#endif + enableComponentObject(compObj, enable, changes); } } @@ -125,6 +131,7 @@ bool ComponentManager::hasComponentObject(SimpleIdentity compID) return it != compObjsById.end(); } +// NOLINTNEXTLINE(google-default-arguments) void ComponentManager::removeComponentObject(PlatformThreadInfo *threadInfo, SimpleIdentity compID, ChangeSet &changes, @@ -134,6 +141,7 @@ void ComponentManager::removeComponentObject(PlatformThreadInfo *threadInfo, removeComponentObjects(threadInfo,compIDs, changes, disposeAfterRemoval); } +// NOLINTNEXTLINE(google-default-arguments) void ComponentManager::removeComponentObjects(PlatformThreadInfo *threadInfo, const std::vector &compObjs, ChangeSet &changes, @@ -141,7 +149,8 @@ void ComponentManager::removeComponentObjects(PlatformThreadInfo *threadInfo, { SimpleIDSet compIDs; - for (auto compObj: compObjs) { + for (const auto &compObj: compObjs) + { compIDs.insert(compObj->getId()); } @@ -192,12 +201,13 @@ void ComponentManager::removeComponentObjects_NoLock(PlatformThreadInfo *, } } +// NOLINTNEXTLINE(google-default-arguments) void ComponentManager::removeComponentObjects(PlatformThreadInfo *threadInfo, const SimpleIDSet &compIDs, ChangeSet &changes, __unused bool disposeAfterRemoval) // used by platform override { - if (compIDs.empty()) + if (compIDs.empty() || !scene) return; std::vector compRefs; @@ -252,6 +262,7 @@ void ComponentManager::removeComponentObjects(PlatformThreadInfo *threadInfo, releaseMaskIDs(maskIDs); } +// NOLINTNEXTLINE(google-default-arguments) void ComponentManager::enableComponentObject(SimpleIdentity compID, bool enable, ChangeSet &changes, bool resolveReps) { ComponentObjectRef compRef; @@ -279,6 +290,7 @@ void ComponentManager::enableComponentObject(SimpleIdentity compID, bool enable, } +// NOLINTNEXTLINE(google-default-arguments) void ComponentManager::enableComponentObjects(const SimpleIDSet &compIDs,bool enable,ChangeSet &changes, bool resolveReps) { std::vector compRefs; @@ -317,13 +329,9 @@ static bool ResolveRepresentationState(const ComponentObjectRef &thisObj, const assert(thisObj->uuid == thatObj->uuid && !thisObj->uuid.empty()); bool const enable = thisObj->enable; - if (thisObj.get() == thatObj.get()) + if (thisObj.get() == thatObj.get() || thatObj->representation == thisObj->representation) { - return enable; - } - else if (thatObj->representation == thisObj->representation) - { - // Another instance of the same representation. + // The references refer to the same object, or instances of the same representation. // For example, there may be two versions while transitioning between // levels, or the same object may appear in multiple tiles of a dataset. // Apply the same state to it. @@ -350,6 +358,7 @@ static bool ResolveRepresentationState(const ComponentObjectRef &thisObj, const return thatObj->enable; } +// NOLINTNEXTLINE(google-default-arguments) void ComponentManager::enableComponentObject(const ComponentObjectRef &compObj, bool enable, ChangeSet &changes, bool resolveReps) { // Note: Should lock just around this component object @@ -403,18 +412,18 @@ void ComponentManager::enableComponentObject(const ComponentObjectRef &compObj, } } -static const std::less DefStringLess; static inline bool HasUUID(const ComponentObjectRef &obj) { return !obj->uuid.empty(); } static inline bool ByUUIDThenRep(const ComponentObjectRef &l, const ComponentObjectRef &r) { - return DefStringLess(l->uuid, r->uuid) || // less - (!DefStringLess(r->uuid, l->uuid) && // equal - DefStringLess(l->representation, r->representation)); + return std::less<>()(l->uuid, r->uuid) || // less + (!std::less<>()(r->uuid, l->uuid) && // equal + std::less<>()(l->representation, r->representation)); } +// NOLINTNEXTLINE(google-default-arguments) void ComponentManager::enableComponentObjects(const std::vector &compRefs, bool enable, ChangeSet &changes, bool resolveReps) { @@ -464,6 +473,11 @@ void ComponentManager::setRepresentation(const std::string &repName, { std::vector enableObjs, disableObjs; +#ifdef LOG_REPRESENTATIONS + std::stringstream idsStr, enStr, disStr; + for (auto i = beg; i != end; ++i) idsStr << ((i==beg)?"":",") << i->c_str(); +#endif + std::unique_lock guardLock(lock); for (; beg != end; ++beg) @@ -521,6 +535,13 @@ void ComponentManager::setRepresentation(const std::string &repName, guardLock.unlock(); +#ifdef LOG_REPRESENTATIONS + for (const auto &x : enableObjs) enStr << x->getId() << ","; + for (const auto &x : disableObjs) disStr << x->getId() << ","; + wkLogLevel(Verbose, "Set representation %s for %s : enable %s disable %s", + repName.c_str(), idsStr.str().c_str(), enStr.str().c_str(), disStr.str().c_str()); +#endif + if (!enableObjs.empty()) enableComponentObjects(enableObjs, true, changes); if (!disableObjs.empty()) enableComponentObjects(disableObjs, false, changes); } diff --git a/common/WhirlyGlobeLib/src/CoordSystem.cpp b/common/WhirlyGlobeLib/src/CoordSystem.cpp index 677fe79db3..a9b6a81b6a 100644 --- a/common/WhirlyGlobeLib/src/CoordSystem.cpp +++ b/common/WhirlyGlobeLib/src/CoordSystem.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 9/14/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/Dictionary.cpp b/common/WhirlyGlobeLib/src/Dictionary.cpp index 94246ae48e..33582713b5 100644 --- a/common/WhirlyGlobeLib/src/Dictionary.cpp +++ b/common/WhirlyGlobeLib/src/Dictionary.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/16/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/DictionaryC.cpp b/common/WhirlyGlobeLib/src/DictionaryC.cpp index 031b6dc568..9b8524d42c 100644 --- a/common/WhirlyGlobeLib/src/DictionaryC.cpp +++ b/common/WhirlyGlobeLib/src/DictionaryC.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/16/13. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/Drawable.cpp b/common/WhirlyGlobeLib/src/Drawable.cpp index adbd17a213..241477ea80 100644 --- a/common/WhirlyGlobeLib/src/Drawable.cpp +++ b/common/WhirlyGlobeLib/src/Drawable.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/DrawableGLES.cpp b/common/WhirlyGlobeLib/src/DrawableGLES.cpp index 9eaf145a4b..75b086d46c 100644 --- a/common/WhirlyGlobeLib/src/DrawableGLES.cpp +++ b/common/WhirlyGlobeLib/src/DrawableGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/DynamicTextureAtlas.cpp b/common/WhirlyGlobeLib/src/DynamicTextureAtlas.cpp index f29835a550..b08f17544b 100644 --- a/common/WhirlyGlobeLib/src/DynamicTextureAtlas.cpp +++ b/common/WhirlyGlobeLib/src/DynamicTextureAtlas.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/28/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/DynamicTextureAtlasGLES.cpp b/common/WhirlyGlobeLib/src/DynamicTextureAtlasGLES.cpp index 45cc71bb09..93e9d29c8c 100644 --- a/common/WhirlyGlobeLib/src/DynamicTextureAtlasGLES.cpp +++ b/common/WhirlyGlobeLib/src/DynamicTextureAtlasGLES.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/FlatMath.cpp b/common/WhirlyGlobeLib/src/FlatMath.cpp index 9df1c0ddb8..f0e59ecd84 100644 --- a/common/WhirlyGlobeLib/src/FlatMath.cpp +++ b/common/WhirlyGlobeLib/src/FlatMath.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/10/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/FontTextureManager.cpp b/common/WhirlyGlobeLib/src/FontTextureManager.cpp index 47ef684ea2..978d174755 100644 --- a/common/WhirlyGlobeLib/src/FontTextureManager.cpp +++ b/common/WhirlyGlobeLib/src/FontTextureManager.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/15/13. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/GeographicLib.cpp b/common/WhirlyGlobeLib/src/GeographicLib.cpp new file mode 100644 index 0000000000..6486844a95 --- /dev/null +++ b/common/WhirlyGlobeLib/src/GeographicLib.cpp @@ -0,0 +1,248 @@ +// +// GeographicLib.cpp +// WhirlyGlobeMaplyComponent +// +// Created by Tim Sylvester on 1/14/22. +// Copyright © 2022 mousebird consulting. All rights reserved. +// + +#import "GeographicLib/Geodesic.hpp" +#import "GeographicLib/Geocentric.hpp" + +#import "../include/GeographicLib.h" +#import "WhirlyVector.h" + +#import + +#if !defined(M_2PI) +# define M_2PI (2 * M_PI) +#endif + +namespace WhirlyKit { + +namespace detail { + // These have to be functions for now; if they're global variables, + // they don't get initialized early enough for the static unit tests. + const GeographicLib::Geodesic &wgs84Geodesic() { return GeographicLib::Geodesic::WGS84(); } + const GeographicLib::Geocentric &wgs84Geocentric() { return GeographicLib::Geocentric::WGS84(); } +} + +using namespace detail; +namespace Geocentric { + +template +inline static void combine(double* eqA, double* eqB) +{ + if (eqB[0] == 0.0) + { + return; + } + if (std::fabs(eqA[0]) >= std::fabs(eqB[0])) + { + auto const f = eqB[0] / eqA[0]; + eqB[0] = 0; + for (auto i = 1; i < N; ++i) + { + eqB[i] -= f * eqA[i]; + } + } + else + { + auto const f = eqA[0] / eqB[0]; + eqA[0] = eqB[0]; + eqB[0] = 0; + for (auto i = 1; i < N; ++i) + { + std::swap(eqA[i], eqB[i]); + eqB[i] -= f * eqA[i]; + } + } +} + +// for n = 3, partially solve, zeroing the coefficients below the diagonal. +inline static void solveLinear3A(double* eq0, double* eq1, double* eq2) +{ + combine<4>(eq1, eq2); + combine<4>(eq0, eq1); + combine<3>(eq1 + 1, eq2 + 1); + + if (eq2[3] != 0.0) + { + eq2[3] = (eq2[2] == 0 ? INFINITY : eq2[3] / eq2[2]); + } + eq2[2] = 1; +} + +// Complete the solution started by solveLinear3Lower +inline static void solveLinear3B(double* eq0, double* eq1, double* eq2) +{ + eq1[3] -= eq1[2] * eq2[3]; + eq1[2] = 0; + if (eq1[3] != 0.0) + { + eq1[3] = (eq1[1] == 0.0 ? INFINITY : eq1[3] / eq1[1]); + } + eq1[1] = 1; + eq0[3] -= eq0[2] * eq2[3] + eq0[1] * eq1[3]; + eq0[1] = 0; + eq0[2] = 0; + if (eq0[3] != 0) + { + eq0[3] = (eq0[0] == 0.0 ? INFINITY : eq0[3] / eq0[0]); + } + eq0[0] = 1; +} + +// Project a vector onto the ellipsoid surface +static Point3d project(const Point3d &p, const GeographicLib::Geodesic &geo) +{ + const auto re = geo.EquatorialRadius(); + const auto rp = re - re * geo.Flattening(); + const auto x = p.x(); + const auto y = p.y(); + const auto z = p.z(); + const auto r = std::sqrt((x * x + y * y) / (re * re) + z * z / (rp * rp)); + return (r == 0) ? Point3d{ rp, y, z } : // it's a pole + Point3d{ x / r, y / r, z / r }; // anything else +} + +const static Point3d ptZero = { 0.0, 0.0, 0.0 }; + +// Find the intersection of geodesics A-B and C-D. +// Returns the intersection point iff CalcInt==true +template +static inline std::tuple intersection( + const Point3d &a, const Point3d &b, const Point3d &c, const Point3d &d, + const GeographicLib::Geodesic &geo) +{ + // Set equal the equations defining the two geodesics, as defined by the + // intersection of the ellipsoid and a plane through its center, and solve + // the resulting system of equations, yielding two antipodal solutions. + // + // ((x4 - x3) * s + x3) * t = (x2 - x1) * r + x1 + // ((y4 - y3) * s + y3) * t = (y2 - y1) * r + y1 + // ((z4 - z3) * s + z3) * t = (z2 - z1) * r + z1 + + double e0[4] = { d.x() - c.x(), c.x(), a.x() - b.x(), a.x() }; + double e1[4] = { d.y() - c.y(), c.y(), a.y() - b.y(), a.y() }; + double e2[4] = { d.z() - c.z(), c.z(), a.z() - b.z(), a.z() }; + solveLinear3A(e0, e1, e2); + + const auto r = e2[3]; + if (r >= 0.0 && r <= 1.0) + { + solveLinear3B(e0, e1, e2); + + // Solution on the right side, and within the segments? + const auto t = e1[3]; + if (t > 0.0) + { + const auto s = e0[3] / t; + if (s >= 0.0 && s <= 1.0) + { + // Yes! Project the solution vector onto the ellipsoid + return std::make_tuple(true, + CalcInt ? project((b - a) * r + a, geo) : ptZero); + } + } + } + + return std::make_tuple(false, ptZero); +} + +// Concrete instances for export +bool checkIntersection(const Point3d &a, const Point3d &b, const Point3d &c, const Point3d &d) { return checkIntersection(a, b, c, d, wgs84Geodesic()); } +bool checkIntersection(const Point3d &a, const Point3d &b, const Point3d &c, const Point3d &d, const GeographicLib::Geodesic &geo) { return std::get<0>(intersection(a, b, c, d, geo)); } +std::tuple findIntersection(const Point3d &a, const Point3d &b, const Point3d &c, const Point3d &d, const GeographicLib::Geodesic &geo) { return intersection(a, b, c, d, geo); } +std::tuple findIntersection(const Point3d &a, const Point3d &b, const Point3d &c, const Point3d &d) { return findIntersection(a, b, c, d, wgs84Geodesic()); } + + +// Project a geocentric point into the orthographic projection defined by the origin +static Point3d projectOrtho(const Point3d &origin, const Point3d &p) +{ + const double sinLat = origin.z(); + const double cosLat = std::sqrt(origin.x() * origin.x() + origin.y() * origin.y()); + const double sinLon = origin.x() / cosLat; + const double cosLon = -origin.y() / cosLat; + const double x1 = p.x() * cosLon + p.y() * sinLon; + const double y1 = -p.x() * sinLon + p.y() * cosLon; + return { x1, y1 * sinLat + p.z() * cosLat, -y1 * cosLat + p.z() * sinLat }; +} + +// Invert orthographic projection +static Point3d unprojectOrtho(const Point3d &origin, const Point3d &p) +{ + const double sinLat = origin.z(); + const double cosLat = std::sqrt(origin.x() * origin.x() + origin.y() * origin.y()); + const double sinLon = origin.x() / cosLat; + const double cosLon = -origin.y() / cosLat; + const double y1 = p.y() * sinLat - p.z() * cosLat; + const double z1 = p.y() * cosLat + p.z() * sinLat; + return { p.x() * cosLon - y1 * sinLon, p.x() * sinLon + y1 * cosLon, z1 }; +} + +static const double sinpi4 = std::sin(M_PI_4); + +// Calculate the angle between two vectors. +// Both vectors must be normalized! +static double angle(Point3d a, Point3d b) +{ + const double dp = a.dot(b); + if (std::fabs(dp) < sinpi4) + { + return std::acos(dp); + } + + const auto m = a.cross(b).norm(); + return (dp < 0) ? M_PI - std::asin(m) : std::asin(m); +} + +// TODO: This isn't fully accounting for eccentricity, so it's not super precise. +// (start,end,other)=>(downtrack,crosstrack,length) +std::tuple OrthoDist(const Point3d &gca, const Point3d &gcb, const Point3d &gcc) +{ + // Calculate the unit normal of the geodesic segment + const auto geoNorm = gca.cross(gcb).normalized(); + + // Calculate the unit normal of that and the point of interest + const auto orthoNorm = gcc.cross(geoNorm).normalized(); + + // Find the the point where the line to the target point is perpendicular + const auto cp = geoNorm.cross(orthoNorm); + + // Calculate the angles along and aside the segment + const auto t0 = angle(gca, gcb); + const auto t1 = angle(cp, gca); + const auto t2 = angle(cp, gcc); + + // Work out which quadrant we're in and fix the signs + const auto s1 = (cp.dot(geoNorm.cross(gca)) < 0) ? -1. : 1.; + const auto s2 = (gcc.dot(geoNorm) > 0) ? -1. : 1.; + + // Convert the angles to distances + const auto rad = GeographicLib::Constants::WGS84_a(); + return { rad * t1 * s1, rad * t2 * s2, rad * t0 }; +} + +double initialHeading(const Point3d &startPt, const Point3d &endPt) +{ + // Find the location of the endpoint in the orthographic projection defined by the start point + const auto end = projectOrtho(startPt, endPt); + + // If x==y==0 they are the same point and the heading is undefined + return std::atan2(end.x(), end.y()); +} +double finalHeading(const Point3d &startPt, const Point3d &endPt) +{ + return std::fmod(initialHeading(endPt, startPt) + M_2PI, M_2PI); +} + +Point3d orthoDirect(const Point3d &start, double azimuthRad, double distMeters) +{ + const double theta = distMeters / wgs84Geodesic().EquatorialRadius(); + const double r = sin(theta); + const double hdg = M_PI_2 - azimuthRad; + return unprojectOrtho(start, { r * std::cos(hdg), r * std::sin(hdg), std::cos(theta) }); +} + +}} diff --git a/common/WhirlyGlobeLib/src/GeometryManager.cpp b/common/WhirlyGlobeLib/src/GeometryManager.cpp index 0947daa999..cc8d37451d 100644 --- a/common/WhirlyGlobeLib/src/GeometryManager.cpp +++ b/common/WhirlyGlobeLib/src/GeometryManager.cpp @@ -1,9 +1,8 @@ -/* - * GeometryManager.mm +/* GeometryManager.cpp * WhirlyGlobeLib * * Created by Steve Gifford on 11/25/15. - * Copyright 2012-2015 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "GeometryManager.h" @@ -23,17 +21,13 @@ #import "BaseInfo.h" #import "BasicDrawableInstanceBuilder.h" #import "SharedAttributes.h" +#import "WhirlyKitLog.h" using namespace Eigen; using namespace WhirlyKit; namespace WhirlyKit { - -GeometryInfo::GeometryInfo() -: colorOverride(false), color(255,255,255,255), boundingBox(GeometryBBoxNone), pointSize(1.0) -{ -} GeometryInfo::GeometryInfo(const Dictionary &dict) : BaseInfo(dict) @@ -43,36 +37,44 @@ GeometryInfo::GeometryInfo(const Dictionary &dict) zBufferRead = true; if (!dict.hasField(MaplyZBufferWrite)) zBufferWrite = false; + colorOverride = dict.hasField(MaplyColor); - color = dict.getColor(MaplyColor, RGBAColor(255,255,255,255)); - std::string bboxVal = dict.getString(MaplyGeomBoundingBox,""); + color = dict.getColor(MaplyColor, color); + + const std::string bboxVal = dict.getString(MaplyGeomBoundingBox,""); if (bboxVal == MaplyGeomBoundingBoxSingle) { boundingBox = GeometryBBoxSingle; - } else if (bboxVal == MaplyGeomBoundingBoxTriangle) { + } + else if (bboxVal == MaplyGeomBoundingBoxTriangle) + { boundingBox = GeometryBBoxTriangle; - } else { - boundingBox = GeometryBBoxNone; } pointSize = dict.getDouble(MaplyGeomPointSize,1.0); } void GeomSceneRep::clearContents(SelectionManagerRef &selectManager,ChangeSet &changes,TimeInterval when) { - for (SimpleIDSet::iterator it = drawIDs.begin(); - it != drawIDs.end(); ++it) - changes.push_back(new RemDrawableReq(*it,when)); + for (const auto id : drawIDs) + { + changes.push_back(new RemDrawableReq(id,when)); + } if (selectManager && !selectIDs.empty()) + { selectManager->removeSelectables(selectIDs); + } } void GeomSceneRep::enableContents(SelectionManagerRef &selectManager,bool enable,ChangeSet &changes) { - for (SimpleIDSet::iterator it = drawIDs.begin(); - it != drawIDs.end(); ++it) - changes.push_back(new OnOffChangeRequest(*it, enable)); + for (const auto id : drawIDs) + { + changes.push_back(new OnOffChangeRequest(id, enable)); + } if (selectManager && !selectIDs.empty()) + { selectManager->enableSelectables(selectIDs, enable); + } } GeometryRaw::GeometryRaw() @@ -613,19 +615,20 @@ void GeometryRawPoints::buildDrawables(std::vector &dra } } - -GeometryManager::GeometryManager() -{ -} - GeometryManager::~GeometryManager() { - std::lock_guard guardLock(lock); + // destructors must not throw + try + { + std::lock_guard guardLock(lock); - for (GeomSceneRepSet::iterator it = sceneReps.begin(); - it != sceneReps.end(); ++it) - delete *it; - sceneReps.clear(); + auto reps = std::move(sceneReps); + for (auto &rep : reps) + { + delete rep; + } + } + WK_STD_DTOR_CATCH() } SimpleIdentity GeometryManager::addGeometry(std::vector &geom,const std::vector &instances,GeometryInfo &geomInfo,ChangeSet &changes) diff --git a/common/WhirlyGlobeLib/src/GeometryOBJReader.cpp b/common/WhirlyGlobeLib/src/GeometryOBJReader.cpp index bd186aee5c..e764ece630 100644 --- a/common/WhirlyGlobeLib/src/GeometryOBJReader.cpp +++ b/common/WhirlyGlobeLib/src/GeometryOBJReader.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 11/25/14. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/GlobeAnimateHeight.cpp b/common/WhirlyGlobeLib/src/GlobeAnimateHeight.cpp index e1f1fbdbf2..0263a74964 100644 --- a/common/WhirlyGlobeLib/src/GlobeAnimateHeight.cpp +++ b/common/WhirlyGlobeLib/src/GlobeAnimateHeight.cpp @@ -1,9 +1,8 @@ -/* - * GlobeAnimateHeight.mm +/* GlobeAnimateHeight.cpp * WhirlyGlobeLib * * Created by Steve Gifford on 5/23/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "GlobeAnimateHeight.h" @@ -108,30 +106,33 @@ void AnimateViewHeight::setTiltDelegate(TiltCalculatorRef newDelegate) } // Called by the view when it's time to update -void AnimateViewHeight::updateView(GlobeView *globeView) +void AnimateViewHeight::updateView(WhirlyKit::View *view) { + auto globeView = (GlobeView *)view; if (startDate == 0.0) return; - TimeInterval now = TimeGetCurrent(); - double span = endDate-startDate; - double remain = endDate - now; + const TimeInterval now = TimeGetCurrent(); + const double span = endDate-startDate; + const double remain = endDate - now; // All done. Snap to the end - if (remain < 0) + if (remain <= 0) { globeView->setHeightAboveGlobe(endHeight,false); startDate = 0; endDate = 0; globeView->cancelAnimation(); - } else { + } + else + { // Interpolate somewhere along the path - double t = (span-remain)/span; + const double t = (span-remain)/span; globeView->setHeightAboveGlobe(startHeight + (endHeight-startHeight)*t,true); if (tiltDelegate) { - double newTilt = tiltDelegate->tiltFromHeight(globeView->getHeightAboveGlobe()); + const double newTilt = tiltDelegate->tiltFromHeight(globeView->getHeightAboveGlobe()); globeView->setTilt(newTilt); } } diff --git a/common/WhirlyGlobeLib/src/GlobeAnimateRotation.cpp b/common/WhirlyGlobeLib/src/GlobeAnimateRotation.cpp index 71320b4429..fc562de386 100644 --- a/common/WhirlyGlobeLib/src/GlobeAnimateRotation.cpp +++ b/common/WhirlyGlobeLib/src/GlobeAnimateRotation.cpp @@ -1,9 +1,8 @@ -/* - * AnimateRotation.mm +/* GlobeAnimateRotation.cpp * WhirlyGlobeLib * * Created by Steve Gifford on 5/23/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "Platform.h" @@ -27,23 +25,26 @@ using namespace Eigen; namespace WhirlyGlobe { -AnimateViewRotation::AnimateViewRotation(GlobeView *globeView,const Eigen::Quaterniond &newRot,TimeInterval howLong) +AnimateViewRotation::AnimateViewRotation(GlobeView *globeView, + const Eigen::Quaterniond &newRot, + TimeInterval howLong) : + startDate(TimeGetCurrent()), + startRot(globeView->getRotQuat()), + endRot(newRot) { - startDate = TimeGetCurrent(); - endDate = TimeGetCurrent() + howLong; - startRot = globeView->getRotQuat(); - endRot = newRot; + endDate = startDate + howLong; } - + // Called by the view when it's time to update -void AnimateViewRotation::updateView(GlobeView *globeView) +void AnimateViewRotation::updateView(WhirlyKit::View *view) { + auto globeView = (GlobeView *)view; if (startDate == 0.0) return; - TimeInterval now = TimeGetCurrent(); - double span = endDate-startDate; - double remain = endDate - now; + const TimeInterval now = TimeGetCurrent(); + const double span = endDate-startDate; + const double remain = endDate - now; // All done. Snap to the end if (remain < 0) @@ -52,9 +53,11 @@ void AnimateViewRotation::updateView(GlobeView *globeView) startDate = 0; endDate = 0; globeView->cancelAnimation(); - } else { + } + else + { // Interpolate somewhere along the path - double t = (span-remain)/span; + const double t = (span-remain)/span; globeView->setRotQuat(startRot.slerp(t,endRot)); } } diff --git a/common/WhirlyGlobeLib/src/GlobeAnimateViewMomentum.cpp b/common/WhirlyGlobeLib/src/GlobeAnimateViewMomentum.cpp index a2897b7ef8..68f373dac6 100644 --- a/common/WhirlyGlobeLib/src/GlobeAnimateViewMomentum.cpp +++ b/common/WhirlyGlobeLib/src/GlobeAnimateViewMomentum.cpp @@ -1,9 +1,8 @@ -/* - * AnimateViewMomentum.mm +/* AnimateViewMomentum.cpp * WhirlyGlobeApp * * Created by Steve Gifford on 5/23/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import @@ -28,34 +26,31 @@ using namespace WhirlyKit; namespace WhirlyGlobe { -AnimateViewMomentum::AnimateViewMomentum(GlobeViewRef globeView,double inVel,double inAcc,const Eigen::Vector3f &inAxis,bool inNorthUp) +AnimateViewMomentum::AnimateViewMomentum(const GlobeViewRef &globeView,double inVel,double inAcc, + const Eigen::Vector3f &inAxis,bool inNorthUp) : + velocity(inVel), + acceleration(inAcc), + northUp(inNorthUp), + axis(inAxis.cast()), + startQuat(globeView->getRotQuat()), + startDate(TimeGetCurrent()) { - velocity = inVel; - acceleration = inAcc; - northUp = inNorthUp; - axis = Vector3d(inAxis.x(),inAxis.y(),inAxis.z()); - startQuat = globeView->getRotQuat(); - - startDate = TimeGetCurrent(); - + // Let's calculate the maximum time, so we know when to stop if (acceleration != 0.0) { - maxTime = 0.0; - if (acceleration != 0.0) - maxTime = -velocity / acceleration; - maxTime = std::max(0.0,maxTime); - + maxTime = std::max(0.0,-velocity / acceleration); if (maxTime == 0.0) + { startDate = 0; - } else - maxTime = MAXFLOAT; + } + } } Quaterniond AnimateViewMomentum::rotForTime(GlobeView *globeView,TimeInterval sinceStart) { // Calculate the offset based on angle - float totalAng = (velocity + 0.5 * acceleration * sinceStart) * sinceStart; + const float totalAng = (velocity + 0.5 * acceleration * sinceStart) * sinceStart; Eigen::Quaterniond diffRot(Eigen::AngleAxisd(totalAng,axis)); Eigen::Quaterniond newQuat; newQuat = startQuat * diffRot; @@ -89,13 +84,13 @@ Quaterniond AnimateViewMomentum::rotForTime(GlobeView *globeView,TimeInterval si } // Called by the view when it's time to update -void AnimateViewMomentum::updateView(GlobeView *globeView) +void AnimateViewMomentum::updateView(WhirlyKit::View *view) { + auto globeView = (GlobeView *)view; if (startDate == 0.0) return; float sinceStart = TimeGetCurrent()-startDate; - if (sinceStart > maxTime) { // This will snap us to the end and then we stop diff --git a/common/WhirlyGlobeLib/src/GlobeMath.cpp b/common/WhirlyGlobeLib/src/GlobeMath.cpp index 35ec72f636..9d17e769ea 100644 --- a/common/WhirlyGlobeLib/src/GlobeMath.cpp +++ b/common/WhirlyGlobeLib/src/GlobeMath.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/2/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/GlobeView.cpp b/common/WhirlyGlobeLib/src/GlobeView.cpp index d25b771172..a492988017 100644 --- a/common/WhirlyGlobeLib/src/GlobeView.cpp +++ b/common/WhirlyGlobeLib/src/GlobeView.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/14/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -225,11 +225,11 @@ Eigen::Matrix4d GlobeView::calcModelMatrix() const Point2d modelOff(0.0,0.0); if (centerOffset.x() != 0.0 || centerOffset.y() != 0.0) { // imagePlaneSize is actually half the image plane size in the horizontal - modelOff = Point2d(centerOffset.x() * imagePlaneSize, centerOffset.y() * imagePlaneSize) * (heightAboveGlobe+1.0)/nearPlane; + modelOff = (centerOffset * imagePlaneSize) * (heightAboveGlobe+1.0)/nearPlane; } - Eigen::Affine3d trans(Eigen::Translation3d(modelOff.x(),modelOff.y(),-calcEarthZOffset())); - Eigen::Affine3d rot(rotQuat); + const Eigen::Affine3d trans(Eigen::Translation3d(modelOff.x(),modelOff.y(),-calcEarthZOffset())); + const Eigen::Affine3d rot(rotQuat); return (trans * rot).matrix(); } @@ -431,9 +431,10 @@ void GlobeView::cancelAnimation() void GlobeView::animate() { // Have to hold on to the delegate because it can call cancelAnimation.... which frees the delegate - auto theDelegate = delegate; - if (theDelegate) + if (auto theDelegate = delegate) + { theDelegate->updateView(this); + } } ViewStateRef GlobeView::makeViewState(SceneRenderer *renderer) diff --git a/common/WhirlyGlobeLib/src/GridClipper.cpp b/common/WhirlyGlobeLib/src/GridClipper.cpp index 8239c546bb..ccc70dc427 100644 --- a/common/WhirlyGlobeLib/src/GridClipper.cpp +++ b/common/WhirlyGlobeLib/src/GridClipper.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/16/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/Identifiable.cpp b/common/WhirlyGlobeLib/src/Identifiable.cpp index 67f6f62075..721c8bcc72 100644 --- a/common/WhirlyGlobeLib/src/Identifiable.cpp +++ b/common/WhirlyGlobeLib/src/Identifiable.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/7/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/ImageTile.cpp b/common/WhirlyGlobeLib/src/ImageTile.cpp index ea3ccf6133..904bdbe2f6 100644 --- a/common/WhirlyGlobeLib/src/ImageTile.cpp +++ b/common/WhirlyGlobeLib/src/ImageTile.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/14/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/LabelManager.cpp b/common/WhirlyGlobeLib/src/LabelManager.cpp index d4f9ef2e00..a7d36c6058 100644 --- a/common/WhirlyGlobeLib/src/LabelManager.cpp +++ b/common/WhirlyGlobeLib/src/LabelManager.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/7/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,8 @@ #import "ScreenSpaceBuilder.h" #import "FontTextureManager.h" #import "SharedAttributes.h" - #import "LabelManager.h" +#import "WhirlyKitLog.h" using namespace Eigen; @@ -57,6 +57,22 @@ LabelManager::LabelManager() { } +LabelManager::~LabelManager() +{ + // destructors must never throw, wrap stuff that might fail + try + { + std::lock_guard guardLock(lock); + + auto reps = std::move(labelReps); + for (auto rep : reps) + { + delete rep; + } + } + WK_STD_DTOR_CATCH() +} + SimpleIdentity LabelManager::addLabels(PlatformThreadInfo *threadInfo, const std::vector &labels, const LabelInfo &desc,ChangeSet &changes) @@ -152,36 +168,33 @@ SimpleIdentity LabelManager::addLabels(PlatformThreadInfo *threadInfo, if (const auto selectManager = scene->getManager(kWKSelectionManager)) { int n = 0; - for (unsigned int ii=0;iiaddSelectableScreenRect(sel.selectID,sel.center,sel.pts, sel.minVis,sel.maxVis,sel.enable); labelRep->selectIDs.insert(sel.selectID); } - for (unsigned int ii=0;iiaddSelectableMovingScreenRect(sel.selectID,sel.center,sel.endCenter, sel.startTime,sel.endTime,sel.pts, sel.minVis,sel.maxVis,sel.enable); labelRep->selectIDs.insert(sel.selectID); } - for (unsigned int ii=0;iiaddSelectableRect(sel.selectID,sel.pts,sel.minVis,sel.maxVis,sel.enable); labelRep->selectIDs.insert(sel.selectID); } diff --git a/common/WhirlyGlobeLib/src/LabelRenderer.cpp b/common/WhirlyGlobeLib/src/LabelRenderer.cpp index f63b1e6cb1..b9e2c65884 100644 --- a/common/WhirlyGlobeLib/src/LabelRenderer.cpp +++ b/common/WhirlyGlobeLib/src/LabelRenderer.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/11/13. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,17 +53,6 @@ LabelInfo::LabelInfo(bool screenObject) : { } -LabelInfo::LabelInfo(const LabelInfo &that) : - BaseInfo(that), hasTextColor(that.hasTextColor), textColor(that.textColor), backColor(that.backColor), - screenObject(that.screenObject), width(that.width), height(that.height), - labelJustify(that.labelJustify), textJustify(that.textJustify), - shadowColor(that.shadowColor), shadowSize(that.shadowSize), - outlineColor(that.outlineColor), outlineSize(that.outlineSize), - lineHeight(that.lineHeight), fontPointSize(that.fontPointSize), - layoutOffset(that.layoutOffset), layoutSpacing(that.layoutSpacing), layoutRepeat(that.layoutRepeat) -{ -} - LabelInfo::LabelInfo(const Dictionary &dict, bool screenObject) : BaseInfo(dict), screenObject(screenObject) @@ -80,6 +69,7 @@ LabelInfo::LabelInfo(const Dictionary &dict, bool screenObject) : lineHeight = (float)dict.getDouble(MaplyTextLineHeight,0.0); labelJustify = parseLabelJustify(dict.getString(MaplyLabelJustifyName), WhirlyKitLabelMiddle); textJustify = parseTextJustify(dict.getString(MaplyTextJustify), WhirlyKitTextLeft); + labelVAlign = WhirlyKitLabelBaseline;//todo layoutDebug = dict.getInt(MaplyTextLayoutDebug,false); layoutRepeat = dict.getInt(MaplyTextLayoutRepeat,-1); layoutSpacing = (float)dict.getDouble(MaplyTextLayoutSpacing,24.0); @@ -104,7 +94,7 @@ LabelRenderer::LabelRenderer(Scene *scene, { } -Point3dVector LabelRenderer::convertGeoPtsToModelSpace(const VectorRing &inPts) +Point3dVector LabelRenderer::convertGeoPtsToModelSpace(const VectorRing &inPts) const { CoordSystemDisplayAdapter *coordAdapt = scene->getCoordAdapter(); CoordSystem *coordSys = coordAdapt->getCoordSystem(); @@ -151,18 +141,14 @@ void LabelRenderer::render(PlatformThreadInfo *threadInfo, const auto drawStrs = label->generateDrawableStrings(threadInfo,labelInfo,fontTexManager, lineHeight,changes); - if (cancelFn(threadInfo)) + if (cancelFn(threadInfo) || drawStrs.empty()) { - for (auto drawStr : drawStrs) - { - delete drawStr; - } return; } // Calculate total draw and layout MBRs Mbr drawMbr, layoutMbr; - for (const auto drawStr : drawStrs) + for (const auto &drawStr : drawStrs) { drawMbr.expand(drawStr->mbr); layoutMbr.expand(drawStr->mbr); @@ -212,13 +198,21 @@ void LabelRenderer::render(PlatformThreadInfo *threadInfo, #ifndef __ANDROID__ // Except we do need to tweak things a little, even for the layout engine // Note: But only on iOS because... reasons - const float heightAboveBaseline = drawMbr.ur().y(); - justifyOff.y() += heightAboveBaseline/2.0; + if (labelInfo->labelVAlign == WhirlyKitLabelBaseline) + { + const float heightAboveBaseline = drawMbr.ur().y(); + justifyOff.y() += heightAboveBaseline/2.0f; + } +#else + if (labelInfo->labelVAlign == WhirlyKitLabelBaseline) + { + justifyOff.y() -= drawMbr.ll().y(); + } #endif screenShape->setDrawOrder(labelInfo->drawOrder); screenShape->setDrawPriority(labelInfo->drawPriority+1); - screenShape->setVisibility(labelInfo->minVis, labelInfo->maxVis); + screenShape->setVisibility((float)labelInfo->minVis, (float)labelInfo->maxVis); screenShape->setZoomInfo(labelInfo->zoomSlot, labelInfo->minZoomVis, labelInfo->maxZoomVis); screenShape->setScaleExp(labelInfo->scaleExp); screenShape->setOpacityExp(labelInfo->opacityExp); @@ -232,6 +226,8 @@ void LabelRenderer::render(PlatformThreadInfo *threadInfo, if (label->isSelectable && label->selectID != EmptyIdentity) screenShape->setId(label->selectID); screenShape->setWorldLoc(coordAdapter->localToDisplay(coordAdapter->getCoordSystem()->geographicToLocal3d(label->loc))); + if (label->hasMotion) + screenShape->setMovingLoc(coordAdapter->localToDisplay(coordAdapter->getCoordSystem()->geographicToLocal3d(label->endLoc)), label->startTime, label->endTime); // If there's an icon, we need to offset const Point2d iconSize = ((label->iconTexture == EmptyIdentity) ? Point2d(0,0) : @@ -303,6 +299,9 @@ void LabelRenderer::render(PlatformThreadInfo *threadInfo, // Propagate the unique ID to the layout object layoutObject->uniqueID = label->uniqueID; + // Potentially lay it out along with other objects + layoutObject->mergeID = label->mergeID; + // Put together the layout info //layoutObject->hint = label->text; layoutObject->layoutPts = geomCoords; @@ -312,7 +311,8 @@ void LabelRenderer::render(PlatformThreadInfo *threadInfo, layoutObject->importance = layoutImportance; layoutObject->acceptablePlacement = layoutPlacement; layoutObject->setEnable(labelInfo->enable); - + layoutObject->layoutDebug = labelInfo->layoutDebug; + // Setup layout points if we have them if (!label->layoutShape.empty()) { @@ -321,7 +321,6 @@ void LabelRenderer::render(PlatformThreadInfo *threadInfo, layoutObject->layoutOffset = labelInfo->layoutOffset; layoutObject->layoutSpacing = labelInfo->layoutSpacing; layoutObject->layoutWidth = height; - layoutObject->layoutDebug = labelInfo->layoutDebug; } // The shape starts out disabled @@ -429,7 +428,7 @@ void LabelRenderer::render(PlatformThreadInfo *threadInfo, double offsetY = 0.0; for (auto it = drawStrs.rbegin(); it != drawStrs.rend(); ++it) { - const auto drawStr = *it; + const auto &drawStr = *it; if (!drawStr) continue; @@ -499,11 +498,7 @@ void LabelRenderer::render(PlatformThreadInfo *threadInfo, } screenObjects.emplace_back(std::move(*screenShape)); } - - for (auto drawStr : drawStrs) - { - delete drawStr; - } + } } diff --git a/common/WhirlyGlobeLib/src/LayoutManager.cpp b/common/WhirlyGlobeLib/src/LayoutManager.cpp index 407ba3924d..5eb0d7f2c1 100644 --- a/common/WhirlyGlobeLib/src/LayoutManager.cpp +++ b/common/WhirlyGlobeLib/src/LayoutManager.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/15/13. - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,6 +49,7 @@ LayoutObject::LayoutObject(LayoutObject &&other) noexcept : layoutShape (std::move(other.layoutShape)), layoutPlaces (std::move(other.layoutPlaces)), layoutModelPlaces (std::move(other.layoutModelPlaces)), + mergeID (std::move(other.mergeID)), acceptablePlacement(other.acceptablePlacement), hint (std::move(other.hint)) { @@ -72,6 +73,7 @@ LayoutObject &LayoutObject::operator=(LayoutObject &&other) noexcept layoutShape = std::move(other.layoutShape); layoutPlaces = std::move(other.layoutPlaces); layoutModelPlaces = std::move(other.layoutModelPlaces); + mergeID = std::move(other.mergeID); acceptablePlacement = other.acceptablePlacement; hint = std::move(other.hint); } @@ -217,6 +219,21 @@ void LayoutManager::addLayoutObjects(std::vector &&newObjects) } } +void LayoutManager::addLayoutObjects(std::vector &&newObjects) +{ + if (!newObjects.empty() && !shutdown) + { + // Construct the new objects first + std::vector toAdd; + toAdd.reserve(newObjects.size()); + for (auto &newObject : newObjects) + { + toAdd.emplace_back(std::make_shared(std::move(*newObject))); + } + addLayoutObjects(std::move(toAdd)); + } +} + void LayoutManager::addLayoutObjects(std::vector &&toAdd) { std::lock_guard guardLock(lock); @@ -269,9 +286,12 @@ void LayoutManager::removeLayoutObjects(const SimpleIDSet &oldObjectIds) for (const auto oldObjectId : oldObjectIds) { key->setId(oldObjectId); - layoutObjects.erase(key); + if (layoutObjects.erase(key)) + { + hasUpdates = true; + hasRemoves = true; + } } - hasUpdates = true; } bool LayoutManager::hasChanges() @@ -448,7 +468,7 @@ void LayoutManager::deferUntil(TimeInterval minTime) } } -// Size of the overlap sampler +// Size of the overlap sampler grid, optimized for labels that are wider than they are tall static const int OverlapSampleX = 10; static const int OverlapSampleY = 60; @@ -748,7 +768,7 @@ bool LayoutManager::runLayoutRules(PlatformThreadInfo *threadInfo, } // Extents for the layout helpers - const Point2f frameBufferSize(renderer->framebufferWidth, renderer->framebufferHeight); + const Point2f frameBufferSize = renderer->getFramebufferSize(); const Mbr screenMbr(frameBufferSize * -ScreenBuffer, frameBufferSize * (1.0 + ScreenBuffer)); @@ -770,7 +790,7 @@ bool LayoutManager::runLayoutRules(PlatformThreadInfo *threadInfo, // NSLog(@"----Starting Layout----"); // Set up the overlap sampler - OverlapHelper overlapMan(screenMbr,OverlapSampleX,OverlapSampleY); + OverlapHelper overlapMan(screenMbr,OverlapSampleX,OverlapSampleY,localLayoutObjects.size()); // Add in the unique objects, cluster entries and then sort them all for (auto &it : uniqueLayoutObjs) @@ -792,6 +812,8 @@ bool LayoutManager::runLayoutRules(PlatformThreadInfo *threadInfo, overlapMan.addObject(objPts); } + std::unordered_multimap mergeMap(localLayoutObjects.size()); + // Lay out the various objects that are active int numSoFar = 0; for (auto &container : layoutObjs) @@ -815,7 +837,6 @@ bool LayoutManager::runLayoutRules(PlatformThreadInfo *threadInfo, // Some of these may share unique IDs bool pickedOne = false; -// wkLog("----"); for (auto &layoutObj : container.objs) { @@ -894,9 +915,10 @@ bool LayoutManager::runLayoutRules(PlatformThreadInfo *threadInfo, //for (const auto &p : objPts) wkLogLevel(Debug, " (%f,%f)\n",p.x(),p.y()); // Now try it. Objects we've pegged as essential always win - if (overlapMan.addCheckObject(objPts) || container.importance >= MAXFLOAT) + if (container.importance >= MAXFLOAT || + overlapMan.addCheckObject(objPts, layoutObj->obj.mergeID)) { - if (showDebugBoundaries) + if (showDebugBoundaries || layoutObj->obj.layoutDebug) { // Debugging visual output // The chosen placement is drawn in black. @@ -909,7 +931,7 @@ bool LayoutManager::runLayoutRules(PlatformThreadInfo *threadInfo, break; } - if (showDebugBoundaries) + if (showDebugBoundaries || layoutObj->obj.layoutDebug) { // Placements that don't work are drawn in translucent blue addDebugOutput(objPts,globeViewState,mapViewState,frameBufferSize, @@ -934,6 +956,40 @@ bool LayoutManager::runLayoutRules(PlatformThreadInfo *threadInfo, if (isActive) numSoFar++; + // Keep merged items in sync. + if (!layoutObj->obj.mergeID.empty()) + { + // Consider the objects we've already seen with the same merge ID + const auto range = mergeMap.equal_range(layoutObj->obj.mergeID); + for (auto ii = range.first; ii != range.second; ++ii) + { + auto &prevObj = *ii->second; + if (isActive && !prevObj.newEnable) + { + // That object was disabled, we need to disable this one to match. + isActive = false; + layoutObj->newEnable = false; + // we can stop looking + break; + } + else if (!isActive && prevObj.newEnable) + { + // That object was enabled, we need to disable it to match this one. + // This might actually undo the change leaving us with no changes, but we + // can't easily detect that. + prevObj.newEnable = false; + layoutObj->changed = true; + hadChanges = true; + } + } + // If this one is still enabled, or is the first disabled + // item of its ID that we've seen, we need to keep track of it. + if (layoutObj->newEnable || range.first == range.second) + { + mergeMap.insert(std::make_pair(layoutObj->obj.mergeID, layoutObj)); + } + } + // See if we've changed any of the state if (layoutObj->currentEnable != isActive || layoutObj->newEnable || layoutObj->offset != objOffset) { @@ -952,7 +1008,7 @@ bool LayoutManager::runLayoutRules(PlatformThreadInfo *threadInfo, } void LayoutManager::runLayoutClustering(PlatformThreadInfo *threadInfo, - LayoutContainerVec layoutObjs, + LayoutContainerVec &layoutObjs, ClusteredObjectsSet &clusterGroups, std::vector &clusterEntries, std::vector &outClusterParams, @@ -1288,7 +1344,8 @@ void LayoutManager::layoutAlongShape(const LayoutObjectEntryRef &layoutObj, // } // } - if (!overlapMan.checkObject(thePts)) { + if (!overlapMan.checkObject(thePts)) + { failed = true; break; } @@ -1313,7 +1370,9 @@ void LayoutManager::layoutAlongShape(const LayoutObjectEntryRef &layoutObj, // Add the individual glyphs to the overlap manager for (auto &glyph: overlapPts) + { overlapMan.addObject(glyph); + } if (layoutObj->obj.layoutRepeat > 0 && layoutInstances.size() >= layoutObj->obj.layoutRepeat) break; @@ -1681,7 +1740,7 @@ void LayoutManager::handleFadeOut(const TimeInterval curTime, } // Build drawables for them... - ScreenSpaceBuilder ssBuild(renderer,coordAdapter,renderer->scale); + ScreenSpaceBuilder ssBuild(renderer,coordAdapter,renderer->getScale()); buildDrawables(ssBuild, /*doFades*/false, /*doClusters=*/false, curTime, nullptr, rebuildLayoutObjs, oldClusters, oldClusterParams, nullptr, nullptr); const auto newDraws = ssBuild.flushChanges(changes); @@ -1736,6 +1795,8 @@ void LayoutManager::updateLayout(PlatformThreadInfo *threadInfo,const ViewStateR // Any changes made after this will require another round of layout hasUpdates = false; + const bool hadRemoves = hasRemoves; + hasRemoves = false; // Release the external lock to allow objects to be added and removed while we're doing the // layout on our copies, and replace it with a separate lock to make sure we're only run once. @@ -1794,7 +1855,7 @@ void LayoutManager::updateLayout(PlatformThreadInfo *threadInfo,const ViewStateR layoutChanges = true; } - if (!layoutChanges) + if (!layoutChanges && !hadRemoves) { return; } @@ -1812,7 +1873,7 @@ void LayoutManager::updateLayout(PlatformThreadInfo *threadInfo,const ViewStateR // Generate the drawables. // Note that the renderer is not managed by a shared pointer, and will be destroyed // during shutdown, so we must stop using it quickly if controller shutdown is initiated. - ScreenSpaceBuilder ssBuild(renderer,coordAdapter,renderer->scale); + ScreenSpaceBuilder ssBuild(renderer,coordAdapter,renderer->getScale()); //wkLog("Starting Layout t=%f", curTime); diff --git a/common/WhirlyGlobeLib/src/Lighting.cpp b/common/WhirlyGlobeLib/src/Lighting.cpp index 6c0c7db760..2133566d7c 100644 --- a/common/WhirlyGlobeLib/src/Lighting.cpp +++ b/common/WhirlyGlobeLib/src/Lighting.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/LineAndPointShadersGLES.cpp b/common/WhirlyGlobeLib/src/LineAndPointShadersGLES.cpp index ac62f92ea9..928c51ee6e 100644 --- a/common/WhirlyGlobeLib/src/LineAndPointShadersGLES.cpp +++ b/common/WhirlyGlobeLib/src/LineAndPointShadersGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 8/21/18. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/LinearTextBuilder.cpp b/common/WhirlyGlobeLib/src/LinearTextBuilder.cpp index dee723c73c..fd65053029 100644 --- a/common/WhirlyGlobeLib/src/LinearTextBuilder.cpp +++ b/common/WhirlyGlobeLib/src/LinearTextBuilder.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/3/21. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/LoftManager.cpp b/common/WhirlyGlobeLib/src/LoftManager.cpp index 7f8f842b74..843f85244c 100644 --- a/common/WhirlyGlobeLib/src/LoftManager.cpp +++ b/common/WhirlyGlobeLib/src/LoftManager.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/30/13. - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/MapboxVectorFilter.cpp b/common/WhirlyGlobeLib/src/MapboxVectorFilter.cpp index 1f655f3c24..174cafcc6f 100644 --- a/common/WhirlyGlobeLib/src/MapboxVectorFilter.cpp +++ b/common/WhirlyGlobeLib/src/MapboxVectorFilter.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/8/20. -* Copyright 2011-2020 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/MapboxVectorStyleBackground.cpp b/common/WhirlyGlobeLib/src/MapboxVectorStyleBackground.cpp index ce4375dfba..cb65bf84b6 100644 --- a/common/WhirlyGlobeLib/src/MapboxVectorStyleBackground.cpp +++ b/common/WhirlyGlobeLib/src/MapboxVectorStyleBackground.cpp @@ -1,8 +1,8 @@ -/* MapboxVectorStyleBackground.mm +/* MapboxVectorStyleBackground.cpp * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/17/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,18 +17,17 @@ */ #import "MapboxVectorStyleBackground.h" -#import "WhirlyKitLog.h" #import "Tesselator.h" namespace WhirlyKit { -bool MapboxVectorBackgroundPaint::parse(PlatformThreadInfo *inst, +bool MapboxVectorBackgroundPaint::parse(PlatformThreadInfo *, MapboxVectorStyleSetImpl *styleSet, - DictionaryRef styleEntry) + const DictionaryRef &styleEntry) { color = styleSet->transColor("background-color",styleEntry,RGBAColor::black()); - styleSet->unsupportedCheck("background-image","paint_background",styleEntry); + MapboxVectorStyleSetImpl::unsupportedCheck("background-image","paint_background",styleEntry); opacity = styleSet->transDouble("background-opacity",styleEntry,1.0); @@ -63,6 +62,23 @@ bool MapboxVectorLayerBackground::parse(PlatformThreadInfo *inst, return true; } +MapboxVectorStyleLayerRef MapboxVectorLayerBackground::clone() const +{ + auto layer = std::make_shared(styleSet); + layer->copy(*this); + return layer; +} + +MapboxVectorStyleLayer& MapboxVectorLayerBackground::copy(const MapboxVectorStyleLayer& that) +{ + this->MapboxVectorStyleLayer::copy(that); + if (const auto fill = dynamic_cast(&that)) + { + operator=(*fill); + } + return *this; +} + void MapboxVectorLayerBackground::buildObjects(PlatformThreadInfo *inst, const std::vector &vecObjs, const VectorTileDataRef &tileInfo, @@ -111,7 +127,7 @@ void MapboxVectorLayerBackground::buildObjects(PlatformThreadInfo *inst, if (const auto vecID = styleSet->vecManage->addVectors(&tessShapes, vecInfo, tileInfo->changes)) { - const auto compObj = styleSet->makeComponentObject(inst, desc); + auto compObj = styleSet->makeComponentObject(inst, desc); // not currently supported //compObj->representation = representation; @@ -119,7 +135,7 @@ void MapboxVectorLayerBackground::buildObjects(PlatformThreadInfo *inst, compObj->vectorIDs.insert(vecID); styleSet->compManage->addComponentObject(compObj, tileInfo->changes); - tileInfo->compObjs.push_back(compObj); + tileInfo->compObjs.push_back(std::move(compObj)); } } diff --git a/common/WhirlyGlobeLib/src/MapboxVectorStyleCircle.cpp b/common/WhirlyGlobeLib/src/MapboxVectorStyleCircle.cpp index 438f7c50ac..6523305e07 100644 --- a/common/WhirlyGlobeLib/src/MapboxVectorStyleCircle.cpp +++ b/common/WhirlyGlobeLib/src/MapboxVectorStyleCircle.cpp @@ -1,8 +1,8 @@ -/* MapboxVectorStyleCircle.h +/* MapboxVectorStyleCircle.cpp * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/17/15. -* Copyright 2011-2021 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,23 +17,24 @@ */ #import "MapboxVectorStyleCircle.h" -#import "WhirlyKitLog.h" namespace WhirlyKit { +extern const int ScreenDrawPriorityOffset; + bool MapboxVectorCirclePaint::parse(PlatformThreadInfo *, MapboxVectorStyleSetImpl *styleSet, - DictionaryRef styleEntry) + const DictionaryRef &styleEntry) { if (!styleSet) return false; radius = styleSet->transDouble("circle-radius", styleEntry, 5.0); - fillColor = styleSet->colorValue("circle-color",nullptr,styleEntry,RGBAColor::black(),false); + fillColor = MapboxVectorStyleSetImpl::colorValue("circle-color",nullptr,styleEntry,RGBAColor::black(),false); opacity = styleSet->transDouble("circle-opacity",styleEntry,1.0); strokeWidth = styleSet->transDouble("circle-stroke-width",styleEntry,0.0); - strokeColor = styleSet->colorValue("circle-stroke-color",NULL,styleEntry,RGBAColor::black(),false); + strokeColor = MapboxVectorStyleSetImpl::colorValue("circle-stroke-color",nullptr,styleEntry,RGBAColor::black(),false); strokeOpacity = styleSet->transDouble("circle-stroke-opacity",styleEntry,1.0); return true; @@ -51,7 +52,7 @@ bool MapboxVectorLayerCircle::parse(PlatformThreadInfo *inst, } const double maxRadius = paint.radius->maxVal(); - const double maxStrokeWidth = paint.strokeWidth->maxVal(); + const auto maxStrokeWidth = (float)paint.strokeWidth->maxVal(); // todo: have to evaluate these dynamically to support expressions const auto theFillColor = paint.opacity ? @@ -64,16 +65,33 @@ bool MapboxVectorLayerCircle::parse(PlatformThreadInfo *inst, circleTexID = styleSet->makeCircleTexture(inst,maxRadius,theFillColor,theStrokeColor,maxStrokeWidth,&circleSize); // Larger circles are slightly more important - importance = drawPriority/1000 + styleSet->tileStyleSettings->markerImportance + maxRadius / 100000.0; + importance = (float)(drawPriority/1000.0 + styleSet->tileStyleSettings->markerImportance + maxRadius / 100000.0); - repUUIDField = styleSet->stringValue("X-Maply-RepresentationUUIDField", styleEntry, std::string()); + repUUIDField = MapboxVectorStyleSetImpl::stringValue("X-Maply-RepresentationUUIDField", styleEntry, std::string()); uuidField = styleSet->tileStyleSettings->uuidField; - uuidField = styleSet->stringValue("X-Maply-UUIDField", styleEntry, uuidField); + uuidField = MapboxVectorStyleSetImpl::stringValue("X-Maply-UUIDField", styleEntry, uuidField); return true; } +MapboxVectorStyleLayerRef MapboxVectorLayerCircle::clone() const +{ + auto layer = std::make_shared(styleSet); + layer->copy(*this); + return layer; +} + +MapboxVectorStyleLayer& MapboxVectorLayerCircle::copy(const MapboxVectorStyleLayer& that) +{ + this->MapboxVectorStyleLayer::copy(that); + if (const auto fill = dynamic_cast(&that)) + { + operator=(*fill); + } + return *this; +} + void MapboxVectorLayerCircle::cleanup(PlatformThreadInfo *inst,ChangeSet &changes) { if (circleTexID != EmptyIdentity) @@ -106,7 +124,8 @@ void MapboxVectorLayerCircle::buildObjects(PlatformThreadInfo *inst, MarkerInfo markerInfo(/*screenObject=*/true); markerInfo.zoomSlot = styleSet->zoomSlot; markerInfo.color = RGBAColor(255,255,255,(int)(opacity*255)); - markerInfo.drawPriority = drawPriority + tileInfo->ident.level * std::max(0, styleSet->tileStyleSettings->drawPriorityPerLevel) + 1; + markerInfo.drawPriority = drawPriority + ScreenDrawPriorityOffset + + tileInfo->ident.level * std::max(0, styleSet->tileStyleSettings->drawPriorityPerLevel) + 1; markerInfo.programID = styleSet->screenMarkerProgramID; if (minzoom != 0 || maxzoom < 1000) @@ -115,6 +134,8 @@ void MapboxVectorLayerCircle::buildObjects(PlatformThreadInfo *inst, markerInfo.maxZoomVis = maxzoom; } + VectorRing tmpRing; + std::vector> markerOwner; // automatic cleanup of local temporary allocations const auto emptyVal = std::make_pair(MarkerPtrVec(), VecObjRefVec()); for (const auto &vecObj : vecObjs) @@ -123,7 +144,8 @@ void MapboxVectorLayerCircle::buildObjects(PlatformThreadInfo *inst, { return; } - if (vecObj->getVectorType() != VectorPointType) + if (vecObj->getVectorType() != VectorPointType && + vecObj->getVectorType() != VectorLinearType) { continue; } @@ -133,21 +155,44 @@ void MapboxVectorLayerCircle::buildObjects(PlatformThreadInfo *inst, for (const VectorShapeRef &shape : vecObj->shapes) { - const auto pts = dynamic_cast(shape.get()); - if (!pts) + VectorRing* pts; + if (const auto vecPts = dynamic_cast(shape.get())) + { + pts = &vecPts->pts; + } + else if (const auto vecLin = dynamic_cast(shape.get())) + { + tmpRing.clear(); + const auto area = CalcLoopArea(vecLin->pts); + if (area == 0) + { + tmpRing.push_back(vecLin->calcGeoMbr().mid()); + } + else + { + tmpRing.push_back(CalcLoopCentroid(vecLin->pts, area)); + } + pts = &tmpRing; + } + else { continue; } - for (const auto &pt : pts->pts) + for (const auto &pt : *pts) { + if (markerOwner.empty()) + { + markerOwner.reserve(pts->size() * vecObj->shapes.size()); + } + // Add a marker per point markerOwner.emplace_back(std::make_unique()); auto marker = markerOwner.back().get(); marker->loc = GeoCoord(pt.x(),pt.y()); marker->texIDs.push_back(circleTexID); - marker->width = 2*radius * settings.markerScale * settings.circleScale; - marker->height = 2*radius * settings.markerScale * settings.circleScale; + marker->width = (float)(2*radius * settings.markerScale * settings.circleScale); + marker->height = (float)(2*radius * settings.markerScale * settings.circleScale); marker->layoutWidth = marker->width; marker->layoutHeight = marker->height; marker->layoutImportance = MAXFLOAT; //importance + (101-tileInfo->ident.level)/100.0; @@ -163,8 +208,8 @@ void MapboxVectorLayerCircle::buildObjects(PlatformThreadInfo *inst, if (markers.empty()) { - markers.reserve(pts->pts.size()); - markerObjs.reserve(pts->pts.size()); + markers.reserve(pts->size()); + markerObjs.reserve(pts->size()); } markers.push_back(marker); markerObjs.push_back(vecObj); @@ -174,20 +219,21 @@ void MapboxVectorLayerCircle::buildObjects(PlatformThreadInfo *inst, for (const auto &kvp : markersByUUID) { - if (cancelFn(inst)) - { - return; - } - const auto &uuid = kvp.first; const auto &markers = kvp.second.first; const auto &markerObjs = kvp.second.second; - // Generate one component object per unique UUID (including blank) - const auto compObj = styleSet->makeComponentObject(inst, desc); + if (markers.empty()) + { + continue; + } + if (cancelFn(inst)) + { + break; + } - compObj->uuid = uuid; - compObj->representation = representation; + // Generate one component object per unique UUID (including blank) + auto compObj = styleSet->makeComponentObject(inst, desc); // Keep the vector objects around if they need to be selectable if (selectable) @@ -207,16 +253,14 @@ void MapboxVectorLayerCircle::buildObjects(PlatformThreadInfo *inst, } } - if (!markers.empty()) + // Set up the markers and get a change set + if (const auto markerID = styleSet->markerManage->addMarkers(markers, markerInfo, tileInfo->changes)) { - // Set up the markers and get a change set - if (const auto markerID = styleSet->markerManage->addMarkers(markers, markerInfo, tileInfo->changes)) - { - compObj->markerIDs.insert(markerID); - } - + compObj->uuid = uuid; + compObj->representation = representation; + compObj->markerIDs.insert(markerID); styleSet->compManage->addComponentObject(compObj, tileInfo->changes); - tileInfo->compObjs.push_back(compObj); + tileInfo->compObjs.push_back(std::move(compObj)); } } } diff --git a/common/WhirlyGlobeLib/src/MapboxVectorStyleFill.cpp b/common/WhirlyGlobeLib/src/MapboxVectorStyleFill.cpp index 667083b3fa..8a399d2e7c 100644 --- a/common/WhirlyGlobeLib/src/MapboxVectorStyleFill.cpp +++ b/common/WhirlyGlobeLib/src/MapboxVectorStyleFill.cpp @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/17/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,8 +70,21 @@ bool MapboxVectorLayerFill::parse(PlatformThreadInfo *inst, return true; } -void MapboxVectorLayerFill::cleanup(PlatformThreadInfo *inst,ChangeSet &changes) +MapboxVectorStyleLayerRef MapboxVectorLayerFill::clone() const { + auto layer = std::make_shared(styleSet); + layer->copy(*this); + return layer; +} + +MapboxVectorStyleLayer& MapboxVectorLayerFill::copy(const MapboxVectorStyleLayer& that) +{ + this->MapboxVectorStyleLayer::copy(that); + if (const auto fill = dynamic_cast(&that)) + { + operator=(*fill); + } + return *this; } void MapboxVectorLayerFill::buildObjects(PlatformThreadInfo *inst, @@ -91,7 +104,7 @@ void MapboxVectorLayerFill::buildObjects(PlatformThreadInfo *inst, return; } - const auto compObj = styleSet->makeComponentObject(inst, desc); + auto compObj = styleSet->makeComponentObject(inst, desc); // not currently supported //compObj->representation = representation; @@ -241,7 +254,7 @@ void MapboxVectorLayerFill::buildObjects(PlatformThreadInfo *inst, if (!compObj->vectorIDs.empty()) { styleSet->compManage->addComponentObject(compObj, tileInfo->changes); - tileInfo->compObjs.push_back(compObj); + tileInfo->compObjs.push_back(std::move(compObj)); } } diff --git a/common/WhirlyGlobeLib/src/MapboxVectorStyleLayer.cpp b/common/WhirlyGlobeLib/src/MapboxVectorStyleLayer.cpp index 743a678e97..ce0f886a83 100644 --- a/common/WhirlyGlobeLib/src/MapboxVectorStyleLayer.cpp +++ b/common/WhirlyGlobeLib/src/MapboxVectorStyleLayer.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/8/20. -* Copyright 2011-2021 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,7 +90,7 @@ MapboxVectorStyleLayerRef MapboxVectorStyleLayer::VectorStyleLayer(PlatformThrea layer->filter->parse(filterArray,styleSet); } - layer->visible = styleSet->boolValue("visibility", layerDict->getDict("layout"), "visible", true); + layer->visible = MapboxVectorStyleSetImpl::boolValue("visibility", layerDict->getDict("layout"), "visible", true); layer->selectable = styleSet->tileStyleSettings->selectable; layer->metadata = layerDict->getDict("metadata"); layer->representation = layerDict->getString("X-Maply-Representation"); @@ -98,14 +98,26 @@ MapboxVectorStyleLayerRef MapboxVectorStyleLayer::VectorStyleLayer(PlatformThrea return layer; } -MapboxVectorStyleLayer::MapboxVectorStyleLayer(MapboxVectorStyleSetImpl *styleSet) -: visible(true), minzoom(0), maxzoom(0), drawPriority(0), -selectable(false), uuid(0), geomAdditiveVal(false), styleSet(styleSet) +MapboxVectorStyleLayer::MapboxVectorStyleLayer(MapboxVectorStyleSetImpl *styleSet) : + styleSet(styleSet) { } -MapboxVectorStyleLayer::~MapboxVectorStyleLayer() +MapboxVectorStyleLayerRef MapboxVectorStyleLayer::clone() const { +#if defined(DEBUG) + assert(!"MapboxVectorStyleLayer::clone should be overridden"); +#else + return MapboxVectorStyleLayerRef(); +#endif +} + +MapboxVectorStyleLayer& MapboxVectorStyleLayer::copy(const MapboxVectorStyleLayer& that) +{ + operator=(that); + // N.B.: metadata, filters share references to common objects + // If these properties need to be mutable, they should be deep-copied here + return *this; } bool MapboxVectorStyleLayer::parse(PlatformThreadInfo *inst, @@ -122,34 +134,15 @@ bool MapboxVectorStyleLayer::parse(PlatformThreadInfo *inst, uuid = styleSet->generateID(); ident = styleEntry->getString("id"); - source = styleSet->stringValue("source", styleEntry, refLayer ? refLayer->source : std::string()); - sourceLayer = styleSet->stringValue("source-layer", styleEntry, refLayer ? refLayer->sourceLayer : std::string()); + source = MapboxVectorStyleSetImpl::stringValue("source", styleEntry, refLayer ? refLayer->source : std::string()); + sourceLayer = MapboxVectorStyleSetImpl::stringValue("source-layer", styleEntry, refLayer ? refLayer->sourceLayer : std::string()); - minzoom = styleSet->intValue("minzoom", styleEntry, 0); - maxzoom = styleSet->intValue("maxzoom", styleEntry, 1000); + minzoom = MapboxVectorStyleSetImpl::intValue("minzoom", styleEntry, 0); + maxzoom = MapboxVectorStyleSetImpl::intValue("maxzoom", styleEntry, 1000); - category = styleSet->stringValue("wkcategory", styleEntry, std::string()); + category = MapboxVectorStyleSetImpl::stringValue("wkcategory", styleEntry, std::string()); return true; } -long long MapboxVectorStyleLayer::getUuid(PlatformThreadInfo *inst) -{ - return uuid; -} - -std::string MapboxVectorStyleLayer::getCategory(PlatformThreadInfo *inst) -{ - return category; -} - -bool MapboxVectorStyleLayer::geomAdditive(PlatformThreadInfo *inst) -{ - return geomAdditiveVal; -} - -void MapboxVectorStyleLayer::cleanup(PlatformThreadInfo *inst,ChangeSet &changes) -{ -} - } diff --git a/common/WhirlyGlobeLib/src/MapboxVectorStyleLine.cpp b/common/WhirlyGlobeLib/src/MapboxVectorStyleLine.cpp index 15be0f0b23..b97a360242 100644 --- a/common/WhirlyGlobeLib/src/MapboxVectorStyleLine.cpp +++ b/common/WhirlyGlobeLib/src/MapboxVectorStyleLine.cpp @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/17/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,29 +25,29 @@ namespace WhirlyKit static const char * const lineCapVals[] = {"butt","round","square",nullptr}; static const char * const joinVals[] = {"bevel","round","miter",nullptr}; -bool MapboxVectorLineLayout::parse(PlatformThreadInfo *,MapboxVectorStyleSetImpl *styleSet,const DictionaryRef &styleEntry) +bool MapboxVectorLineLayout::parse(PlatformThreadInfo *,MapboxVectorStyleSetImpl *, const DictionaryRef &styleEntry) { - cap = styleEntry ? (MapboxVectorLineCap)styleSet->enumValue(styleEntry->getEntry("line-cap"),lineCapVals,(int)MBLineCapButt) : MBLineCapButt; - join = styleEntry ? (MapboxVectorLineJoin)styleSet->enumValue(styleEntry->getEntry("line-join"),joinVals,(int)MBLineJoinMiter) : MBLineJoinMiter; - miterLimit = styleSet->doubleValue("line-miter-limit", styleEntry, 2.0); - roundLimit = styleSet->doubleValue("line-round-limit", styleEntry, 1.0); + cap = styleEntry ? (MapboxVectorLineCap)MapboxVectorStyleSetImpl::enumValue(styleEntry->getEntry("line-cap"),lineCapVals,(int)MBLineCapButt) : MBLineCapButt; + join = styleEntry ? (MapboxVectorLineJoin)MapboxVectorStyleSetImpl::enumValue(styleEntry->getEntry("line-join"),joinVals,(int)MBLineJoinMiter) : MBLineJoinMiter; + miterLimit = MapboxVectorStyleSetImpl::doubleValue("line-miter-limit", styleEntry, 2.0); + roundLimit = MapboxVectorStyleSetImpl::doubleValue("line-round-limit", styleEntry, 1.0); return true; } bool MapboxVectorLinePaint::parse(PlatformThreadInfo *,MapboxVectorStyleSetImpl *styleSet,const DictionaryRef &styleEntry) { - styleSet->unsupportedCheck("line-translate", "line-paint", styleEntry); - styleSet->unsupportedCheck("line-translate-anchor", "line-paint", styleEntry); - styleSet->unsupportedCheck("line-gap-width", "line-paint", styleEntry); - styleSet->unsupportedCheck("line-blur", "line-paint", styleEntry); - styleSet->unsupportedCheck("line-image", "line-paint", styleEntry); + MapboxVectorStyleSetImpl::unsupportedCheck("line-translate", "line-paint", styleEntry); + MapboxVectorStyleSetImpl::unsupportedCheck("line-translate-anchor", "line-paint", styleEntry); + MapboxVectorStyleSetImpl::unsupportedCheck("line-gap-width", "line-paint", styleEntry); + MapboxVectorStyleSetImpl::unsupportedCheck("line-blur", "line-paint", styleEntry); + MapboxVectorStyleSetImpl::unsupportedCheck("line-image", "line-paint", styleEntry); opacity = styleSet->transDouble("line-opacity", styleEntry, 1.0); width = styleSet->transDouble("line-width", styleEntry, 1.0); offset = styleSet->transDouble("line-offset", styleEntry, 0.0); color = styleSet->transColor("line-color", styleEntry, RGBAColor::black()); - pattern = styleSet->stringValue("line-pattern", styleEntry, ""); + pattern = MapboxVectorStyleSetImpl::stringValue("line-pattern", styleEntry, ""); if (styleEntry && styleEntry->getType("line-dasharray") == DictTypeArray) { auto vecArray = styleEntry->getArray("line-dasharray"); @@ -75,10 +75,10 @@ bool MapboxVectorLayerLine::parse(PlatformThreadInfo *inst, return false; } - this->drawPriority = styleSet->intValue("drawPriority", styleEntry, drawPriority); - linearClipToBounds = styleSet->boolValue("linearize-clip-to-bounds", styleEntry, "yes", false); - dropGridLines = styleSet->boolValue("drop-grid-lines", styleEntry, "yes", false); - subdivToGlobe = styleSet->doubleValue("subdiv-to-globe", styleEntry, 0.0); + this->drawPriority = MapboxVectorStyleSetImpl::intValue("drawPriority", styleEntry, drawPriority); + linearClipToBounds = MapboxVectorStyleSetImpl::boolValue("linearize-clip-to-bounds", styleEntry, "yes", false); + dropGridLines = MapboxVectorStyleSetImpl::boolValue("drop-grid-lines", styleEntry, "yes", false); + subdivToGlobe = MapboxVectorStyleSetImpl::doubleValue("subdiv-to-globe", styleEntry, 0.0); filledLineTexID = EmptyIdentity; if (!paint.lineDashArray.empty()) @@ -104,20 +104,33 @@ bool MapboxVectorLayerLine::parse(PlatformThreadInfo *inst, filledLineTexID = styleSet->makeLineTexture(inst,dashComponents); } - fade = styleSet->doubleValue("fade",styleEntry,0.0); + fade = MapboxVectorStyleSetImpl::doubleValue("fade",styleEntry,0.0); - repUUIDField = styleSet->stringValue("X-Maply-RepresentationUUIDField", styleEntry, std::string()); + repUUIDField = MapboxVectorStyleSetImpl::stringValue("X-Maply-RepresentationUUIDField", styleEntry, std::string()); lineScale = styleSet->tileStyleSettings->lineScale; uuidField = styleSet->tileStyleSettings->uuidField; - uuidField = styleSet->stringValue("X-Maply-UUIDField", styleEntry, uuidField); + uuidField = MapboxVectorStyleSetImpl::stringValue("X-Maply-UUIDField", styleEntry, uuidField); return true; } -void MapboxVectorLayerLine::cleanup(PlatformThreadInfo *inst,ChangeSet &changes) +MapboxVectorStyleLayerRef MapboxVectorLayerLine::clone() const { + auto layer = std::make_shared(styleSet); + layer->copy(*this); + return layer; +} + +MapboxVectorStyleLayer& MapboxVectorLayerLine::copy(const MapboxVectorStyleLayer& that) +{ + this->MapboxVectorStyleLayer::copy(that); + if (const auto line = dynamic_cast(&that)) + { + operator=(*line); + } + return *this; } void MapboxVectorLayerLine::buildObjects(PlatformThreadInfo *inst, @@ -195,7 +208,7 @@ void MapboxVectorLayerLine::buildObjects(PlatformThreadInfo *inst, } #endif - const RGBAColorRef color = styleSet->resolveColor(paint.color, paint.opacity, tileInfo->ident.level, resolveMode); + const RGBAColorRef color = MapboxVectorStyleSetImpl::resolveColor(paint.color, paint.opacity, tileInfo->ident.level, resolveMode); const double width = paint.width->valForZoom(tileInfo->ident.level) * lineScale; const double offset = paint.offset->valForZoom(tileInfo->ident.level) * lineScale; @@ -279,17 +292,16 @@ void MapboxVectorLayerLine::buildObjects(PlatformThreadInfo *inst, const auto &uuid = kvp.first; const auto &shapes = kvp.second; - // Generate one component object per unique UUID (including blank) - const auto compObj = styleSet->makeComponentObject(inst, desc); - - compObj->uuid = uuid; - compObj->representation = representation; - if (const auto wideVecID = styleSet->wideVecManage->addVectors(shapes, vecInfo, tileInfo->changes)) { + // Generate one component object per unique UUID (including blank) + auto compObj = styleSet->makeComponentObject(inst, desc); + + compObj->uuid = uuid; + compObj->representation = representation; compObj->wideVectorIDs.insert(wideVecID); styleSet->compManage->addComponentObject(compObj, tileInfo->changes); - tileInfo->compObjs.push_back(compObj); + tileInfo->compObjs.push_back(std::move(compObj)); } } } diff --git a/common/WhirlyGlobeLib/src/MapboxVectorStyleRaster.cpp b/common/WhirlyGlobeLib/src/MapboxVectorStyleRaster.cpp index 55ff2664ff..5ebdb8e919 100644 --- a/common/WhirlyGlobeLib/src/MapboxVectorStyleRaster.cpp +++ b/common/WhirlyGlobeLib/src/MapboxVectorStyleRaster.cpp @@ -1,8 +1,8 @@ -/* MapboxVectorStyleRaster.mm +/* MapboxVectorStyleRaster.cpp * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/17/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,23 @@ bool MapboxVectorLayerRaster::parse(PlatformThreadInfo *inst, return MapboxVectorStyleLayer::parse(inst, styleEntry, refLayer, drawPriority); } +MapboxVectorStyleLayerRef MapboxVectorLayerRaster::clone() const +{ + auto layer = std::make_shared(styleSet); + layer->copy(*this); + return layer; +} + +MapboxVectorStyleLayer& MapboxVectorLayerRaster::copy(const MapboxVectorStyleLayer& that) +{ + this->MapboxVectorStyleLayer::copy(that); + if (const auto line = dynamic_cast(&that)) + { + operator=(*line); + } + return *this; +} + void MapboxVectorLayerRaster::buildObjects(__unused PlatformThreadInfo *inst, __unused const std::vector &vecObjs, __unused const VectorTileDataRef &tileInfo, @@ -37,8 +54,4 @@ void MapboxVectorLayerRaster::buildObjects(__unused PlatformThreadInfo *inst, { } -void MapboxVectorLayerRaster::cleanup(PlatformThreadInfo *inst,ChangeSet &changes) -{ -} - } diff --git a/common/WhirlyGlobeLib/src/MapboxVectorStyleSetC.cpp b/common/WhirlyGlobeLib/src/MapboxVectorStyleSetC.cpp index 147e6c1b6c..789bea1793 100644 --- a/common/WhirlyGlobeLib/src/MapboxVectorStyleSetC.cpp +++ b/common/WhirlyGlobeLib/src/MapboxVectorStyleSetC.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/8/20. -* Copyright 2011-2021 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,8 @@ #import "SharedAttributes.h" #import "WhirlyKitLog.h" #import "MapboxVectorStyleBackground.h" +#import "MapboxVectorStyleLine.h" +#import "MapboxVectorStyleSymbol.h" #import namespace WhirlyKit @@ -494,22 +496,13 @@ bool MapboxVectorStyleSetImpl::parse(PlatformThreadInfo *inst,const DictionaryRe // Layers are where the action is const std::vector layerStyles = styleDict->getArray(strLayers); int which = 0; - for (const auto &layerStyle : layerStyles) { - if (layerStyle->getType() == DictTypeDictionary) { - auto layer = MapboxVectorStyleLayer::VectorStyleLayer(inst,this,layerStyle->getDict(),(1*which + tileStyleSettings->baseDrawPriority)); - if (!layer) - { - continue; - } - - // Sort into various buckets for quick lookup - layersByName[layer->ident] = layer; - layersByUUID[layer->getUuid(inst)] = layer; - if (!layer->sourceLayer.empty()) - { - layersBySource.insert(std::make_pair(layer->sourceLayer, layer)); - } - layers.push_back(layer); + for (const auto &layerStyle : layerStyles) + { + if (layerStyle->getType() == DictTypeDictionary) + { + const auto pri = which + tileStyleSettings->baseDrawPriority; + auto layer = MapboxVectorStyleLayer::VectorStyleLayer(inst,this,layerStyle->getDict(),pri); + addLayer(inst, std::move(layer)); } which++; } @@ -517,6 +510,23 @@ bool MapboxVectorStyleSetImpl::parse(PlatformThreadInfo *inst,const DictionaryRe return true; } +void MapboxVectorStyleSetImpl::addLayer(PlatformThreadInfo *inst, MapboxVectorStyleLayerRef layer) +{ + if (!layer) + { + return; + } + + // Sort into various buckets for quick lookup + layersByName[layer->ident] = layer; + layersByUUID[layer->getUuid(inst)] = layer; + if (!layer->sourceLayer.empty()) + { + layersBySource.insert(std::make_pair(layer->sourceLayer, layer)); + } + layers.push_back(std::move(layer)); +} + long long MapboxVectorStyleSetImpl::generateID() { return currentID++; @@ -1028,6 +1038,111 @@ void MapboxVectorStyleSetImpl::addSprites(MapboxVectorStyleSpritesRef newSprites sprites = std::move(newSprites); } +bool MapboxVectorStyleSetImpl::hasRepresentations() +{ + return std::any_of(layers.begin(), layers.end(), + [](const auto &layer){ return !layer->getRepresentation().empty(); }); +} + +static std::string repLayerName(const std::string &ident, const std::string &repName) +{ + std::string s; + s.reserve(ident.size() + repName.size() + 1); + s.append(ident).append("_", 1).append(repName); + return s; +} + +bool MapboxVectorStyleSetImpl::addRepresentations(PlatformThreadInfo *inst, + const char* uuidAttr, + const std::vector &sources, + const std::vector &reps, + const std::vector &sizes, + const std::vector &colors) +{ + std::vector newLayers; + + // each layer-source + for (const auto &source : sources) + { + // find matching layers + const auto range = layersBySource.equal_range(source); + + if (range.first == range.second) + { + wkLogLevel(Debug, "Layer source '%s' does not match any layers", source.c_str()); + continue; + } + + // each layer with matching source + for (auto iLayer = range.first; iLayer != range.second; ++iLayer) + { + // each representation name + for (size_t repIdx = 0; repIdx < reps.size(); ++repIdx) + { + const auto &repName = reps[repIdx]; + const auto &size = sizes[repIdx]; + const auto &color = colors[repIdx]; + + auto &layer = *iLayer->second; + const auto &ident = layer.ident; + + if (!layer.representation.empty()) + { + // This is already a representation layer + continue; + } + + const auto repIdent = repLayerName(ident, repName); + if (std::any_of(range.first, range.second, + [&](const auto &kv){ return kv.second->ident == repIdent; })) + { + // This layer already has a corresponding layer for this representation + continue; + } + + wkLogLevel(Verbose, "Adding representation layer %s for %s with src=%s and rep=%s", + repIdent.c_str(), layer.ident.c_str(), layer.sourceLayer.c_str(), repName.c_str()); + + // Make a copy of the layer + if (auto layerCopy = layer.clone()) + { + layer.repUUIDField = uuidAttr; + layerCopy->repUUIDField = uuidAttr; + layerCopy->representation = repName; + layerCopy->ident = repIdent; + layerCopy->visible = false; + // todo: virtual methods for override color/size/etc. + // todo: override arbitrary properties? + if (size > 0) + { + if (auto sym = dynamic_cast(layerCopy.get())) + { + sym->layout.iconSize = std::make_shared(size); + } + } + if (!color.empty()) + { + if (auto lin = dynamic_cast(layerCopy.get())) + { + const auto multiplyAlpha = false; // ? + const auto colorRef = parseColor(color, std::string(), RGBAColorRef(), multiplyAlpha); + lin->paint.color = std::make_shared(colorRef); + } + } + newLayers.push_back(std::move(layerCopy)); + } + } + } + } + + for (auto &layer : newLayers) + { + addLayer(inst, std::move(layer)); + } + return true; +} + + //#define LOW_LEVEL_UNIT_TESTS #if defined(LOW_LEVEL_UNIT_TESTS) static struct UnitTests { @@ -1068,7 +1183,7 @@ static struct UnitTests { //todo: hsl/hsla - wkLog("MapboxStyleSet Color Tests Passed"); + wkLogLevel(Info, "MapboxStyleSet Color Tests Passed"); } RGBAColorRef c(RGBAColor cv) const { return std::make_shared(cv); } RGBAColorRef c(uint32_t cv) const { return c(RGBAColor::FromARGBInt(cv)); } @@ -1077,13 +1192,13 @@ static struct UnitTests { } void check(const RGBAColorRef &cv, const RGBAColorRef &exp, const char *v = nullptr) { if ((bool)cv != (bool)exp) { - wkLog("RGBAColor text failed: expected %s got %s%s%s", + wkLogLevel(Error, "RGBAColor text failed: expected %s got %s%s%s", exp ? "value" : "null", cv ? "value" : "null", v ? " from input: " : "", v ? v : ""); assert(!"RGBAColor parse test failed"); } if (cv && exp && *cv != *exp) { - wkLog("RGBAColor parse failed: expected %.8x got %.8x%s%s", + wkLogLevel(Error, "RGBAColor parse failed: expected %.8x got %.8x%s%s", exp->asARGBInt(), cv->asARGBInt(), v ? " from input: " : "", v ? v : ""); assert(!"RGBAColor parse test failed"); diff --git a/common/WhirlyGlobeLib/src/MapboxVectorStyleSpritesImpl.cpp b/common/WhirlyGlobeLib/src/MapboxVectorStyleSpritesImpl.cpp index 210209b189..5f59b391a3 100644 --- a/common/WhirlyGlobeLib/src/MapboxVectorStyleSpritesImpl.cpp +++ b/common/WhirlyGlobeLib/src/MapboxVectorStyleSpritesImpl.cpp @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 7/28/20. - * Copyright 2011-2020 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/MapboxVectorStyleSymbol.cpp b/common/WhirlyGlobeLib/src/MapboxVectorStyleSymbol.cpp index e181f07647..11765cd11c 100644 --- a/common/WhirlyGlobeLib/src/MapboxVectorStyleSymbol.cpp +++ b/common/WhirlyGlobeLib/src/MapboxVectorStyleSymbol.cpp @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/17/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,12 +19,15 @@ #import "MapboxVectorStyleSymbol.h" #import "Dictionary.h" #import "WhirlyKitLog.h" +#import #import #import namespace WhirlyKit { +extern const int ScreenDrawPriorityOffset = 1000000; + static const char * const placementVals[] = {"point","line",nullptr}; static const char * const transformVals[] = {"none","uppercase","lowercase",nullptr}; static const char * const anchorVals[] = {"center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right",nullptr}; @@ -36,8 +39,8 @@ bool MapboxVectorSymbolLayout::parse(PlatformThreadInfo *, const DictionaryRef &styleEntry) { globalTextScale = styleSet->tileStyleSettings->textScale; - placement = styleEntry ? (MapboxSymbolPlacement)styleSet->enumValue(styleEntry->getEntry("symbol-placement"), placementVals, (int)MBPlacePoint) : MBPlacePoint; - textTransform = styleEntry ? (MapboxTextTransform)styleSet->enumValue(styleEntry->getEntry("text-transform"), transformVals, (int)MBTextTransNone) : MBTextTransNone; + placement = styleEntry ? (MapboxSymbolPlacement)MapboxVectorStyleSetImpl::enumValue(styleEntry->getEntry("symbol-placement"), placementVals, (int)MBPlacePoint) : MBPlacePoint; + textTransform = styleEntry ? (MapboxTextTransform)MapboxVectorStyleSetImpl::enumValue(styleEntry->getEntry("text-transform"), transformVals, (int)MBTextTransNone) : MBTextTransNone; textField = styleSet->transText("text-field", styleEntry, std::string()); @@ -59,19 +62,26 @@ bool MapboxVectorSymbolLayout::parse(PlatformThreadInfo *, textMaxWidth = styleSet->transDouble("text-max-width", styleEntry, 10.0); textSize = styleSet->transDouble("text-size", styleEntry, 24.0); - const auto offsetEntries = styleSet->arrayValue("text-offset", styleEntry); + const auto offsetEntries = MapboxVectorStyleSetImpl::arrayValue("text-offset", styleEntry); textOffsetX = (offsetEntries.size() > 0) ? styleSet->transDouble(offsetEntries[0], 0) : MapboxTransDoubleRef(); //NOLINT textOffsetY = (offsetEntries.size() > 1) ? styleSet->transDouble(offsetEntries[1], 0) : MapboxTransDoubleRef(); - textAnchor = MBTextCenter; - if (styleEntry && styleEntry->getType("text-anchor") == DictTypeArray) { - textAnchor = (MapboxTextAnchor)styleSet->enumValue(styleEntry->getEntry("text-anchor"), anchorVals, (int)MBTextCenter); + if (styleEntry && styleEntry->getType("text-anchor") == DictTypeString) + { + textAnchor = (MapboxTextAnchor)MapboxVectorStyleSetImpl::enumValue( + styleEntry->getEntry("text-anchor"), anchorVals, (int)textAnchor); + } + if (styleEntry && styleEntry->getType("icon-anchor") == DictTypeString) + { + iconAnchor = (MapboxTextAnchor)MapboxVectorStyleSetImpl::enumValue( + styleEntry->getEntry("icon-anchor"), anchorVals, (int)iconAnchor); } - iconAllowOverlap = styleSet->boolValue("icon-allow-overlap", styleEntry, "on", false); - textAllowOverlap = styleSet->boolValue("text-allow-overlap", styleEntry, "on", false); + + iconAllowOverlap = MapboxVectorStyleSetImpl::boolValue("icon-allow-overlap", styleEntry, "on", false); + textAllowOverlap = MapboxVectorStyleSetImpl::boolValue("text-allow-overlap", styleEntry, "on", false); layoutImportance = styleSet->tileStyleSettings->labelImportance; textJustifySet = (styleEntry && styleEntry->getEntry("text-justify")); - textJustify = styleEntry ? (TextJustify)styleSet->enumValue(styleEntry->getEntry("text-justify"), justifyVals, WhirlyKitTextCenter) : WhirlyKitTextCenter; + textJustify = styleEntry ? (TextJustify)MapboxVectorStyleSetImpl::enumValue(styleEntry->getEntry("text-justify"), justifyVals, WhirlyKitTextCenter) : WhirlyKitTextCenter; iconImageField = styleSet->transText("icon-image", styleEntry, std::string()); iconSize = styleSet->transDouble("icon-size", styleEntry, 1.0); @@ -88,7 +98,8 @@ bool MapboxVectorSymbolPaint::parse(PlatformThreadInfo *, textHaloColor = styleSet->transColor("text-halo-color", styleEntry, RGBAColor::black()); textHaloBlur = styleSet->transDouble("text-halo-blur", styleEntry, 0.0); textHaloWidth = styleSet->transDouble("text-halo-width", styleEntry, 0.0); - + iconOpacity = styleSet->transDouble("icon-opacity", styleEntry, 1.0); + return true; } @@ -107,12 +118,12 @@ bool MapboxVectorLayerSymbol::parse(PlatformThreadInfo *inst, if (!hasLayout && !hasPaint) return false; - uniqueLabel = styleSet->boolValue("unique-label", styleEntry, "yes", false); + uniqueLabel = MapboxVectorStyleSetImpl::boolValue("unique-label", styleEntry, "yes", false); - repUUIDField = styleSet->stringValue("X-Maply-RepresentationUUIDField", styleEntry, std::string()); + repUUIDField = MapboxVectorStyleSetImpl::stringValue("X-Maply-RepresentationUUIDField", styleEntry, std::string()); uuidField = styleSet->tileStyleSettings->uuidField; - uuidField = styleSet->stringValue("X-Maply-UUIDField", styleEntry, uuidField); + uuidField = MapboxVectorStyleSetImpl::stringValue("X-Maply-UUIDField", styleEntry, uuidField); useZoomLevels = styleSet->tileStyleSettings->useZoomLevels; @@ -194,115 +205,136 @@ static float calcStringHash(const std::string &str) return val / (float)len / 256.0f; } -void MapboxVectorLayerSymbol::cleanup(PlatformThreadInfo *inst,ChangeSet &changes) +MapboxVectorStyleLayerRef MapboxVectorLayerSymbol::clone() const +{ + auto layer = std::make_shared(styleSet); + layer->copy(*this); + return layer; +} + +MapboxVectorStyleLayer& MapboxVectorLayerSymbol::copy(const MapboxVectorStyleLayer& that) +{ + this->MapboxVectorStyleLayer::copy(that); + if (const auto line = dynamic_cast(&that)) + { + // N.B.: paint and symbol settings share refs, may need to deep-copy + operator=(*line); + } + return *this; +} + +static int justifyPlacement(TextJustify justify) +{ + switch (justify) + { + case WhirlyKitTextCenter: return WhirlyKitLayoutPlacementCenter; + case WhirlyKitTextLeft: return WhirlyKitLayoutPlacementLeft; + case WhirlyKitTextRight: return WhirlyKitLayoutPlacementRight; + default: return WhirlyKitLayoutPlacementNone; + } +} + +static int anchorPlacement(MapboxTextAnchor anchor) { + // Anchor options for the layout engine + switch (anchor) + { + case MBTextCenter: return WhirlyKitLayoutPlacementCenter; + case MBTextLeft: return WhirlyKitLayoutPlacementLeft; + case MBTextRight: return WhirlyKitLayoutPlacementRight; + case MBTextTop: return WhirlyKitLayoutPlacementAbove; + case MBTextBottom: return WhirlyKitLayoutPlacementBelow; + // Note: The rest of these aren't quite right + case MBTextTopLeft: return WhirlyKitLayoutPlacementLeft | WhirlyKitLayoutPlacementAbove; + case MBTextTopRight: return WhirlyKitLayoutPlacementRight | WhirlyKitLayoutPlacementAbove; + case MBTextBottomLeft: return WhirlyKitLayoutPlacementLeft | WhirlyKitLayoutPlacementBelow; + case MBTextBottomRight: return WhirlyKitLayoutPlacementRight | WhirlyKitLayoutPlacementBelow; + default: return WhirlyKitLayoutPlacementNone; + } +} + +static void transformText(std::string &text, MapboxTextTransform tx) +{ + // todo: handle unicode + switch (tx) + { + case MBTextTransUppercase: + std::transform(text.begin(), text.end(), text.begin(), ::toupper); + break; + case MBTextTransLowercase: + std::transform(text.begin(), text.end(), text.begin(), ::tolower); + break; + default: break; + } } SingleLabelRef MapboxVectorLayerSymbol::setupLabel(PlatformThreadInfo *inst, const Point2f &pt, const LabelInfoRef &labelInfo, const MutableDictionaryRef &attrs, - const VectorTileDataRef &tileInfo) + const VectorTileDataRef &tileInfo, + bool mergedIcon) { // Reconstruct the string from its replacement form std::string text = layout.textField->textForZoom(tileInfo->ident.level).build(attrs); - if (text.empty()) { + if (text.empty()) + { return SingleLabelRef(); } // Change the text if needed - switch (layout.textTransform) - { - case MBTextTransNone: - break; - case MBTextTransUppercase: - std::transform(text.begin(), text.end(), text.begin(), ::toupper); - break; - case MBTextTransLowercase: - std::transform(text.begin(), text.end(), text.begin(), ::tolower); - break; - } + transformText(text, layout.textTransform); // TODO: Put this back, but we need information about the font // Break it up into lines, if necessary double textMaxWidth = layout.textMaxWidth->valForZoom(tileInfo->ident.level); if (textMaxWidth != 0.0) + { text = breakUpText(inst,text,textMaxWidth * labelInfo->fontPointSize,labelInfo); + } // Construct the label - SingleLabelRef label = styleSet->makeSingleLabel(inst,text); - label->loc = GeoCoord(pt.x(),pt.y()); + auto label = styleSet->makeSingleLabel(inst,text); + label->loc = pt; label->isSelectable = selectable; if (!uuidField.empty()) + { label->uniqueID = attrs->getString(uuidField); - else if (uniqueLabel) { + } + else if (uniqueLabel) + { label->uniqueID = text; std::transform(label->uniqueID.begin(), label->uniqueID.end(), label->uniqueID.begin(), ::tolower); } - // The rank is most important, followed by the zoom level. This keeps the countries on top. - int rank = 1000; - if (attrs->hasField("rank")) { - rank = attrs->getInt("rank"); - } - // Random tweak to cut down on flashing - // TODO: Move the layout importance into the label itself - float strHash = calcStringHash(text); label->layoutEngine = true; - label->layoutImportance = MAXFLOAT; - if (!layout.textAllowOverlap) { + label->layoutImportance = MAXFLOAT; // TODO: Move the layout importance into the label itself + if (!layout.textAllowOverlap) + { // If we're allowing layout, then we need to communicate valid text justification // if the style wanted us to do that - if (layout.textJustifySet) { - switch (layout.textJustify) { - case WhirlyKitTextCenter: - label->layoutPlacement = WhirlyKitLayoutPlacementCenter; - break; - case WhirlyKitTextLeft: - label->layoutPlacement = WhirlyKitLayoutPlacementLeft; - break; - case WhirlyKitTextRight: - label->layoutPlacement = WhirlyKitLayoutPlacementRight; - break; - } + if (layout.textJustifySet) + { + label->layoutPlacement = justifyPlacement(layout.textJustify); } - label->layoutImportance = layout.layoutImportance + 1.0f - ((float)rank + (float)(101-tileInfo->ident.level)/100.0f)/1000.0f + strHash/10000.0f; - } - // Anchor options for the layout engine - switch (layout.textAnchor) { - case MBTextCenter: - label->layoutPlacement = WhirlyKitLayoutPlacementCenter; - break; - case MBTextLeft: - label->layoutPlacement = WhirlyKitLayoutPlacementLeft; - break; - case MBTextRight: - label->layoutPlacement = WhirlyKitLayoutPlacementRight; - break; - case MBTextTop: - label->layoutPlacement = WhirlyKitLayoutPlacementAbove; - break; - case MBTextBottom: - label->layoutPlacement = WhirlyKitLayoutPlacementBelow; - break; - // Note: The rest of these aren't quite right - case MBTextTopLeft: - label->layoutPlacement = WhirlyKitLayoutPlacementLeft | WhirlyKitLayoutPlacementAbove; - break; - case MBTextTopRight: - label->layoutPlacement = WhirlyKitLayoutPlacementRight | WhirlyKitLayoutPlacementAbove; - break; - case MBTextBottomLeft: - label->layoutPlacement = WhirlyKitLayoutPlacementLeft | WhirlyKitLayoutPlacementBelow; - break; - case MBTextBottomRight: - label->layoutPlacement = WhirlyKitLayoutPlacementRight | WhirlyKitLayoutPlacementBelow; - break; + // The rank is most important, keeps the countries on top. + const auto rank = (float)attrs->getInt("rank", 1000); + const auto rankImport = 1.0f - rank / 1000.0f; + // Then zoom level. + const float levelImport = (float)(101 - tileInfo->ident.level) / 100000.0f; + // Apply a small adjustment to the layout importance based on the string hash so that the + // values are (almost) certainly unique, making the sort order stable and preventing the + // layout from changing which items are in front on every pass. + // todo: this is actually larger than the level value, consider adjusting the denominators + const auto hashImport = calcStringHash(text) / 10000.0f; + label->layoutImportance = layout.layoutImportance + rankImport + levelImport + hashImport; } - + + label->layoutPlacement = anchorPlacement(layout.textAnchor); + return label; } @@ -333,32 +365,30 @@ std::unique_ptr MapboxVectorLayerSymbol::setupMarker(PlatformThreadInfo return nullptr; } - markerSize.x() *= styleSet->tileStyleSettings->markerScale * styleSet->tileStyleSettings->symbolScale; - markerSize.y() *= styleSet->tileStyleSettings->markerScale * styleSet->tileStyleSettings->symbolScale; + markerSize *= styleSet->tileStyleSettings->markerScale * styleSet->tileStyleSettings->symbolScale; if (!layout.iconSize->isExpression()) { const double size = layout.iconSize->valForZoom(tileInfo->ident.level); - markerSize.x() *= size; - markerSize.y() *= size; + markerSize *= size; } auto marker = std::make_unique(); marker->width = markerSize.x(); marker->height = markerSize.y(); - marker->loc = GeoCoord(pt.x(),pt.y()); + marker->loc = pt; marker->layoutImportance = layout.iconAllowOverlap ? MAXFLOAT : layout.layoutImportance; - SimpleIdentity markerTexID = subTex.getId(); + const SimpleIdentity markerTexID = subTex.getId(); if (markerTexID != EmptyIdentity) { marker->texIDs.push_back(markerTexID); } - + + marker->layoutPlacement = anchorPlacement(layout.iconAnchor); + return marker; } -static const int ScreenDrawPriorityOffset = 1000000; - using MarkerPtrVec = std::vector; using VecObjRefVec = std::vector; using LabelRefVec = std::vector; @@ -373,6 +403,16 @@ static std::tuple Lookup(const std:: return std::make_tuple(&std::get<0>(value),&std::get<1>(value),&std::get<2>(value)); } +// Generate a unique ID for matching up the layout objects generated by symbols with both a label and an icon +static std::atomic_int64_t curMergeId; +template +static const char *genMergeId(std::array &buf) +{ + const size_t id = ++curMergeId; + const int res = snprintf(&buf[0], buf.size() - 1, "%zd", id); + return (res > 0 && res < buf.size() - 1) ? &buf[0] : nullptr; +} + void MapboxVectorLayerSymbol::buildObjects(PlatformThreadInfo *inst, const std::vector &vecObjs, const VectorTileDataRef &tileInfo, @@ -387,80 +427,100 @@ void MapboxVectorLayerSymbol::buildObjects(PlatformThreadInfo *inst, const auto zoomLevel = tileInfo->ident.level; - auto const capacity = vecObjs.size() * 5; // ? - std::unordered_map> markersByUUID(capacity); - - // Render at the max size and then scale dynamically - double textSize = layout.textSize->maxVal() * layout.globalTextScale; - textSize = std::max(1.0, std::round(textSize)); + // We'll try for one color for the whole thing + // Note: To fix this we need to blast the text apart into pieces + const auto textColor = MapboxVectorStyleSetImpl::resolveColor(paint.textColor, nullptr, zoomLevel, + MBResolveColorOpacityReplaceAlpha); - // When there's no dynamic scaling, we need to scale the text size down - textSize /= styleSet->tileStyleSettings->rendererScale; + const auto textField = (textColor && layout.textField) ? + layout.textField->textForZoom(zoomLevel) : MapboxRegexField(); - LabelInfoRef labelInfo = styleSet->makeLabelInfo(inst,layout.textFontNames,(float)textSize); - if (!labelInfo) { + const bool iconInclude = layout.iconImageField && styleSet->sprites; + bool textInclude = (textField.valid && !textField.chunks.empty()); + if (!textInclude && !iconInclude) + { return; } - labelInfo->hasExp = true; - labelInfo->zoomSlot = styleSet->zoomSlot; - if (minzoom != 0 || maxzoom < 1000) + // If we're doing a merged symbol, the font height needs to be treated differently + const auto merged = textInclude && iconInclude; + + // If we will be producing both icons and text, it's likely that their sizes need to correspond + // (e.g., highway shields) so we can't apply independent scale factors. For now, use the marker + // scales for the text instead of the normal text scale. + const auto renderScale = styleSet->tileStyleSettings->rendererScale; + // see setupMarker + const auto markerCombinedScale = + styleSet->tileStyleSettings->markerScale * styleSet->tileStyleSettings->symbolScale * + (layout.iconSize->isExpression() ? 1.0 : layout.iconSize->valForZoom(tileInfo->ident.level)); + // todo: An extra renderScale (or just 2?) seems to be needed here, why? + const auto textScale = merged ? markerCombinedScale * renderScale : layout.globalTextScale; + // Render at the max size and then scale dynamically + const auto textSize = (float)(layout.textSize->maxVal() * textScale / renderScale); + + // todo: if icon size is an expression, make text size an expression based on it? + //if (layout.iconSize->isExpression()) + //{ + //} + + if (textSize < 1) { - labelInfo->minZoomVis = minzoom; - labelInfo->maxZoomVis = maxzoom; -// wkLogLevel(Debug, "zoomSlot = %d, minZoom = %f, maxZoom = %f",styleSet->zoomSlot,labelInfo->minZoomVis,labelInfo->maxZoomVis); + return; } - labelInfo->screenObject = true; - labelInfo->fade = 0.0; - labelInfo->textJustify = layout.textJustify; - labelInfo->drawPriority = drawPriority + zoomLevel * std::max(0, styleSet->tileStyleSettings->drawPriorityPerLevel) + ScreenDrawPriorityOffset; - labelInfo->opacityExp = paint.textOpacity->expression(); - // We'll try for one color for the whole thing - // Note: To fix this we need to blast the text apart into pieces - const auto textColor = MapboxVectorStyleSetImpl::resolveColor(paint.textColor, nullptr, zoomLevel, - MBResolveColorOpacityReplaceAlpha); - if (textColor) + const auto labelInfo = styleSet->makeLabelInfo(inst,layout.textFontNames,textSize,merged); + if (!labelInfo) { - labelInfo->textColor = *textColor; + return; } - // We can apply a scale, but it needs to be scaled to the current text size - labelInfo->scaleExp = layout.textSize->expression(); - if (labelInfo->scaleExp) + const auto priority = drawPriority + ScreenDrawPriorityOffset + zoomLevel * + std::max(0, styleSet->tileStyleSettings->drawPriorityPerLevel); + if (textInclude) { - const auto maxTextVal = (float)layout.textSize->maxVal(); - for (float &stopOutput : labelInfo->scaleExp->stopOutputs) + labelInfo->zoomSlot = styleSet->zoomSlot; + if (minzoom != 0 || maxzoom < 1000) { - stopOutput /= maxTextVal; + labelInfo->minZoomVis = minzoom; + labelInfo->maxZoomVis = maxzoom; + } + labelInfo->screenObject = true; + labelInfo->textJustify = layout.textJustify; + labelInfo->drawPriority = priority; + labelInfo->opacityExp = paint.textOpacity->expression(); + labelInfo->textColor = textColor ? *textColor : RGBAColor::white(); + + // We can apply a scale, but it needs to be scaled to the current text size. + // That is, the expression produces [0.0,1.0] when is then multiplied by textSize + labelInfo->scaleExp = layout.textSize->expression(); + if (labelInfo->scaleExp) + { + const auto maxTextVal = (float)layout.textSize->maxVal(); + for (float &stopOutput : labelInfo->scaleExp->stopOutputs) + { + stopOutput /= maxTextVal; + } } - } - - if (paint.textHaloColor && paint.textHaloWidth) - { - labelInfo->outlineColor = paint.textHaloColor->colorForZoom(zoomLevel); - // Note: We're not using blur right here - labelInfo->outlineSize = std::max(0.5, (paint.textHaloWidth->valForZoom(zoomLevel) - paint.textHaloBlur->valForZoom(zoomLevel))); - } - - // // Note: Made up value for pushing multi-line text together - // desc[kMaplyTextLineSpacing] = @(4.0 / 5.0 * font.lineHeight); - const auto textField = (textColor && textSize > 0.0 && layout.textField) ? - layout.textField->textForZoom(zoomLevel) : MapboxRegexField(); + if (paint.textHaloColor && paint.textHaloWidth) + { + labelInfo->outlineColor = paint.textHaloColor->colorForZoom(zoomLevel); + // Note: We're not using blur right here + labelInfo->outlineSize = std::max(0.5, (paint.textHaloWidth->valForZoom(zoomLevel) - + paint.textHaloBlur->valForZoom(zoomLevel))); + } - const bool iconInclude = layout.iconImageField && styleSet->sprites; - const bool textInclude = (textField.valid && !textField.chunks.empty()); - if (!textInclude && !iconInclude) - { - return; + labelInfo->hasExp = labelInfo->scaleExp || labelInfo->opacityExp; } + // Note: Made up value for pushing multi-line text together + //desc[kMaplyTextLineSpacing] = @(4.0 / 5.0 * font.lineHeight); + // Sort out the image for the marker if we're doing that MarkerInfo markerInfo(/*screenObject=*/true); - markerInfo.hasExp = true; markerInfo.zoomSlot = styleSet->zoomSlot; markerInfo.scaleExp = layout.iconSize->expression(); + markerInfo.opacityExp = paint.iconOpacity->expression(); if (minzoom != 0 || maxzoom < 1000) { @@ -471,10 +531,10 @@ void MapboxVectorLayerSymbol::buildObjects(PlatformThreadInfo *inst, if (iconInclude) { markerInfo.programID = styleSet->screenMarkerProgramID; - markerInfo.drawPriority = labelInfo->drawPriority; + markerInfo.drawPriority = priority; } - ComponentObjectRef compObj = styleSet->makeComponentObject(inst); + markerInfo.hasExp = markerInfo.colorExp || markerInfo.scaleExp || markerInfo.opacityExp; // Calculate the present value of the offsets in ems. // This isn't in setupLabel because it only needs to be done once. @@ -484,6 +544,10 @@ void MapboxVectorLayerSymbol::buildObjects(PlatformThreadInfo *inst, const Point2d offset = Point2d(layout.textOffsetX ? (layout.textOffsetX->valForZoom(zoomLevel) * textSize) : 0.0, layout.textOffsetY ? (layout.textOffsetY->valForZoom(zoomLevel) * -textSize) : 0.0); + auto const capacity = vecObjs.size() * 5; // ? + std::unordered_map> markersByUUID(capacity); + + std::array mergeIdent = {'\0'}; std::vector> markerOwner; for (const auto& vecObj : vecObjs) { @@ -523,8 +587,14 @@ void MapboxVectorLayerSymbol::buildObjects(PlatformThreadInfo *inst, { if (textInclude) { - if (auto label = setupLabel(inst,pt,labelInfo,attrs,tileInfo)) + if (auto label = setupLabel(inst,pt,labelInfo,attrs,tileInfo,iconInclude)) { + if (iconInclude) + { + genMergeId(mergeIdent); + label->mergeID = &mergeIdent[0]; + } + label->screenOffset = offset; uuidLabels->push_back(label); #if DEBUG @@ -541,6 +611,11 @@ void MapboxVectorLayerSymbol::buildObjects(PlatformThreadInfo *inst, { if (auto marker = setupMarker(inst, pt, attrs, tileInfo)) { + if (textInclude) + { + marker->mergeID = &mergeIdent[0]; + } + uuidMarkers->push_back(marker.get()); uuidVecObjs->push_back(vecObj); markerOwner.emplace_back(std::move(marker)); @@ -587,10 +662,33 @@ void MapboxVectorLayerSymbol::buildObjects(PlatformThreadInfo *inst, const auto pt = Point2f(middle.x(), middle.y()); + bool markerAdded = false; + if (iconInclude) + { + if (auto marker = setupMarker(inst, pt, attrs, tileInfo)) + { + if (textInclude) + { + genMergeId(mergeIdent); + marker->mergeID = &mergeIdent[0]; + } + + uuidMarkers->push_back(marker.get()); + uuidVecObjs->push_back(vecObj); + markerOwner.emplace_back(std::move(marker)); + markerAdded = true; + } + } + if (textInclude) { - if (auto label = setupLabel(inst,pt,labelInfo,attrs,tileInfo)) + if (auto label = setupLabel(inst,pt,labelInfo,attrs,tileInfo,iconInclude)) { + if (markerAdded) + { + label->mergeID = &mergeIdent[0]; + } + if (layout.placement == MBPlaceLine) { label->rotation = (float)(-rot + M_PI/2.0); @@ -606,16 +704,6 @@ void MapboxVectorLayerSymbol::buildObjects(PlatformThreadInfo *inst, uuidLabels->push_back(label); } } - - if (iconInclude) - { - if (auto marker = setupMarker(inst, pt, attrs, tileInfo)) - { - uuidMarkers->push_back(marker.get()); - uuidVecObjs->push_back(vecObj); - markerOwner.emplace_back(std::move(marker)); - } - } } } } @@ -653,26 +741,39 @@ void MapboxVectorLayerSymbol::buildObjects(PlatformThreadInfo *inst, continue; } - const auto pt = Point2f(middle.x(), middle.y()); - - if (textInclude) - { - if (auto label = setupLabel(inst, pt, labelInfo, attrs, tileInfo)) - { - // layout.placement is ignored for polygons - // except for offset, which we already calculated so we might as well use - label->screenOffset = offset; - uuidLabels->push_back(label); - } - } + const Point2f pt = middle.cast(); + bool markerAdded = false; if (iconInclude) { if (auto marker = setupMarker(inst, pt, attrs, tileInfo)) { + if (textInclude) + { + genMergeId(mergeIdent); + marker->mergeID = &mergeIdent[0]; + } + uuidMarkers->push_back(marker.get()); uuidVecObjs->push_back(vecObj); markerOwner.emplace_back(std::move(marker)); + markerAdded = true; + } + } + + if (textInclude) + { + if (auto label = setupLabel(inst, pt, labelInfo, attrs, tileInfo, iconInclude)) + { + if (markerAdded) + { + label->mergeID = &mergeIdent[0]; + } + + // layout.placement is ignored for polygons + // except for offset, which we already calculated so we might as well use + label->screenOffset = offset; + uuidLabels->push_back(label); } } } @@ -682,21 +783,22 @@ void MapboxVectorLayerSymbol::buildObjects(PlatformThreadInfo *inst, for (auto &kvp : markersByUUID) { - if (cancelFn(inst)) - { - return; - } - const auto& uuid = kvp.first; const auto& uuidMarkers = std::get<0>(kvp.second); const auto& uuidVecObjs = std::get<1>(kvp.second); const auto& uuidLabels = std::get<2>(kvp.second); - // Generate one component object per unique UUID (including blank) - const auto uuidCompObj = styleSet->makeComponentObject(inst, desc); + if (uuidLabels.empty() && uuidMarkers.empty()) + { + continue; + } + if (cancelFn(inst)) + { + break; + } - uuidCompObj->uuid = uuid; - uuidCompObj->representation = representation; + // Generate one component object per unique UUID (including blank) + auto uuidCompObj = styleSet->makeComponentObject(inst, desc); if (selectable) { @@ -704,11 +806,6 @@ void MapboxVectorLayerSymbol::buildObjects(PlatformThreadInfo *inst, const auto count = std::min(uuidMarkers.size(), uuidVecObjs.size()); for (auto i = (size_t)0; i < count; ++i) { - if ((i % 100) == 0 && cancelFn(inst)) - { - return; - } - auto *marker = uuidMarkers[i]; const auto &vecObj = uuidVecObjs[i]; @@ -726,11 +823,6 @@ void MapboxVectorLayerSymbol::buildObjects(PlatformThreadInfo *inst, { uuidCompObj->labelIDs.insert(labelID); } - - if (cancelFn(inst)) - { - return; - } } if (!uuidMarkers.empty()) @@ -739,17 +831,15 @@ void MapboxVectorLayerSymbol::buildObjects(PlatformThreadInfo *inst, { uuidCompObj->markerIDs.insert(markerID); } - - if (cancelFn(inst)) - { - return; - } } if (!uuidCompObj->labelIDs.empty() || !uuidCompObj->markerIDs.empty()) { + uuidCompObj->uuid = uuid; + uuidCompObj->representation = representation; + styleSet->compManage->addComponentObject(uuidCompObj, tileInfo->changes); - tileInfo->compObjs.push_back(uuidCompObj); + tileInfo->compObjs.push_back(std::move(uuidCompObj)); } } } diff --git a/common/WhirlyGlobeLib/src/MapboxVectorTileParser.cpp b/common/WhirlyGlobeLib/src/MapboxVectorTileParser.cpp index 0ec7c1e58f..d07b724c6b 100644 --- a/common/WhirlyGlobeLib/src/MapboxVectorTileParser.cpp +++ b/common/WhirlyGlobeLib/src/MapboxVectorTileParser.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/25/16. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -213,17 +213,12 @@ bool MapboxVectorTileParser::parse(PlatformThreadInfo *styleInst, // Ask the subclass to run the style and fill in the VectorTileData buildForStyle(styleInst,it.first,vecs,styleData,cancelFn); - if (cancelFn(styleInst)) - { - return false; - } - // Sort the results into categories if needed auto catIt = styleCategories.find(it.first); if (catIt != styleCategories.end() && !styleData->compObjs.empty()) { const std::string &category = catIt->second; - auto compObjs = styleData->compObjs; + auto &compObjs = styleData->compObjs; auto categoryIt = tileData->categories.find(category); if (categoryIt != tileData->categories.end()) { @@ -234,6 +229,14 @@ bool MapboxVectorTileParser::parse(PlatformThreadInfo *styleInst, // Merge this into the general return data tileData->mergeFrom(styleData.get()); + + // The changes in `tileData` represent objects already tracked + // in the managers they must be merged or we'll have leaks, so + // we can't return between the build and the merge above. + if (cancelFn(styleInst)) + { + return false; + } } // These are layered on top for debugging diff --git a/common/WhirlyGlobeLib/src/MaplyAnimateTranslateMomentum.cpp b/common/WhirlyGlobeLib/src/MaplyAnimateTranslateMomentum.cpp index cddd334ede..08e1742a03 100644 --- a/common/WhirlyGlobeLib/src/MaplyAnimateTranslateMomentum.cpp +++ b/common/WhirlyGlobeLib/src/MaplyAnimateTranslateMomentum.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/20/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,21 +25,18 @@ using namespace WhirlyKit; namespace Maply { AnimateTranslateMomentum::AnimateTranslateMomentum( - MapViewRef inMapView, + const MapViewRef &inMapView, float inVel, float inAcc, const WhirlyKit::Point3f &inDir, const Point2dVector &inBounds, SceneRenderer *inSceneRenderer) : - mapView(std::move(inMapView)), velocity(inVel), acceleration(inAcc), - renderer(inSceneRenderer), - userMotion(true), - maxTime(MAXFLOAT) + renderer(inSceneRenderer) { dir = Vector3fToVector3d(inDir.normalized()); startDate = TimeGetCurrent(); - org = mapView->getLoc(); + org = inMapView->getLoc(); // Let's calculate the maximum time, so we know when to stop if (acceleration != 0.0) @@ -64,14 +61,15 @@ bool AnimateTranslateMomentum::withinBounds(const Point3d &loc,MapView *testMapV } // Called by the view when it's time to update -void AnimateTranslateMomentum::updateView(MapView *mapView) +void AnimateTranslateMomentum::updateView(WhirlyKit::View *view) { + auto mapView = (MapView *)view; if (startDate == 0.0) return; - float sinceStart = TimeGetCurrent() - startDate; + auto sinceStart = TimeGetCurrent() - startDate; - if (sinceStart > maxTime) + if (sinceStart >= maxTime) { // This will snap us to the end and then we stop sinceStart = maxTime; @@ -80,8 +78,8 @@ void AnimateTranslateMomentum::updateView(MapView *mapView) } // Calculate the distance - double dist = (velocity + 0.5 * acceleration * sinceStart) * sinceStart; - Point3d newLoc = org + dir * dist; + const double dist = (velocity + 0.5 * acceleration * sinceStart) * sinceStart; + const Point3d newLoc = org + dir * dist; mapView->setLoc(newLoc,false); Point3d newCenter; @@ -93,9 +91,11 @@ void AnimateTranslateMomentum::updateView(MapView *mapView) if (withinBounds(newLoc, &testMapView, &newCenter)) { mapView->setLoc(newCenter,true); - } else { + } + else + { startDate = 0.0; } } - + } diff --git a/common/WhirlyGlobeLib/src/MaplyAnimateTranslation.cpp b/common/WhirlyGlobeLib/src/MaplyAnimateTranslation.cpp index 6a89f81420..b7a7afcaea 100644 --- a/common/WhirlyGlobeLib/src/MaplyAnimateTranslation.cpp +++ b/common/WhirlyGlobeLib/src/MaplyAnimateTranslation.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/20/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,8 @@ using namespace Eigen; namespace Maply { -bool MaplyGestureWithinBounds(const Point2dVector &bounds,const Point3d &loc,SceneRenderer *sceneRender,MapView *testMapView,Point3d *newCenter) +bool MaplyGestureWithinBounds(const Point2dVector &bounds,const Point3d &loc, + SceneRenderer *sceneRender,MapView *testMapView,Point3d *newCenter) { if (newCenter) *newCenter = loc; @@ -33,15 +34,16 @@ bool MaplyGestureWithinBounds(const Point2dVector &bounds,const Point3d &loc,Sce return true; // The corners of the view should be within the bounds - Point2f corners[4]; - corners[0] = Point2f(0,0); - corners[1] = Point2f(sceneRender->framebufferWidth, 0.0); - corners[2] = Point2f(sceneRender->framebufferWidth, sceneRender->framebufferHeight); - corners[3] = Point2f(0.0, sceneRender->framebufferHeight); - + Point2f frameSize = sceneRender->getFramebufferSize(); + const Point2f corners[4] = { + { 0, 0 }, + { frameSize.x(), 0.0 }, + frameSize, + { 0.0, frameSize.y() }, + }; + bool isValid = false; Point2d locOffset(0,0); - Point2f frameSize(sceneRender->framebufferWidth,sceneRender->framebufferHeight); for (unsigned tests=0;tests<4;tests++) { Point3d newLoc = loc+Point3d(locOffset.x(),locOffset.y(),0.0); @@ -78,22 +80,23 @@ bool MaplyGestureWithinBounds(const Point2dVector &bounds,const Point3d &loc,Sce return isValid; } -AnimateViewTranslation::AnimateViewTranslation(MapViewRef inMapView,WhirlyKit::SceneRenderer *inRenderer,Point3d &newLoc,float howLong) +AnimateViewTranslation::AnimateViewTranslation(const MapViewRef &mapView, + WhirlyKit::SceneRenderer *inRenderer, + Point3d &newLoc,float howLong) : + renderer(inRenderer) { - mapView = inMapView; - renderer = inRenderer; startDate = TimeGetCurrent(); endDate = startDate + howLong; startLoc = mapView->getLoc(); endLoc = newLoc; - userMotion = true; } - -void AnimateViewTranslation::setBounds(Point2d *inBounds) + +void AnimateViewTranslation::setBounds(const Point2d *inBounds) { bounds.clear(); + bounds.reserve(4); for (unsigned int ii=0;ii<4;ii++) - bounds.push_back(Point2d(inBounds[ii].x(),inBounds[ii].y())); + bounds.push_back(inBounds[ii]); } // Bounds check on a single point @@ -102,35 +105,37 @@ bool AnimateViewTranslation::withinBounds(const Point3d &loc,MapView * testMapVi return MaplyGestureWithinBounds(bounds,loc,renderer,testMapView,newCenter); } -void AnimateViewTranslation::updateView(MapView *mapView) +void AnimateViewTranslation::updateView(WhirlyKit::View *view) { + auto mapView = (MapView *)view; if (startDate == 0.0) return; - TimeInterval now = TimeGetCurrent(); - TimeInterval span = endDate - startDate; - TimeInterval remain = endDate - now; + const TimeInterval now = TimeGetCurrent(); + const TimeInterval span = endDate - startDate; + const TimeInterval remain = endDate - now; Point3d newLoc; - - // All done, snap to end if (remain < 0) { + // All done, snap to end newLoc = endLoc; startDate = 0; endDate = 0; mapView->cancelAnimation(); - } else { + } + else + { // Interpolate in the middle - float t = (span-remain)/span; - Point3d midLoc = startLoc + (endLoc-startLoc)*t; - newLoc = midLoc; + const float t = (span-remain)/span; + newLoc = startLoc + (endLoc-startLoc)*t; } // Test the prospective point first Point3d newCenter; MapView testMapView(*mapView); - if (withinBounds(newLoc, &testMapView, &newCenter)) { + if (withinBounds(newLoc, &testMapView, &newCenter)) + { mapView->setLoc(newCenter); } } diff --git a/common/WhirlyGlobeLib/src/MaplyFlatView.cpp b/common/WhirlyGlobeLib/src/MaplyFlatView.cpp index 31fa0ef3aa..6599bfe661 100644 --- a/common/WhirlyGlobeLib/src/MaplyFlatView.cpp +++ b/common/WhirlyGlobeLib/src/MaplyFlatView.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/2/13. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/MaplyVectorStyleC.cpp b/common/WhirlyGlobeLib/src/MaplyVectorStyleC.cpp index f3c9c414f1..55f2410558 100644 --- a/common/WhirlyGlobeLib/src/MaplyVectorStyleC.cpp +++ b/common/WhirlyGlobeLib/src/MaplyVectorStyleC.cpp @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 4/9/20. -* Copyright 2011-2021 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/MaplyView.cpp b/common/WhirlyGlobeLib/src/MaplyView.cpp index f570c243d5..dfc18043a3 100644 --- a/common/WhirlyGlobeLib/src/MaplyView.cpp +++ b/common/WhirlyGlobeLib/src/MaplyView.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/9/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -296,14 +296,15 @@ void MapView::cancelAnimation() void MapView::animate() { // Have to hold on to the delegate because it can call cancelAnimation.... which frees the delegate - auto theDelegate = delegate; - if (theDelegate) + if (auto theDelegate = delegate) + { theDelegate->updateView(this); + } } ViewStateRef MapView::makeViewState(SceneRenderer *renderer) { - return ViewStateRef(new MapViewState(this,renderer)); + return std::make_shared(this,renderer); } MapViewState::MapViewState(MapView *mapView,SceneRenderer *renderer) diff --git a/common/WhirlyGlobeLib/src/MarkerManager.cpp b/common/WhirlyGlobeLib/src/MarkerManager.cpp index 820ac04b1f..3a65c7b266 100644 --- a/common/WhirlyGlobeLib/src/MarkerManager.cpp +++ b/common/WhirlyGlobeLib/src/MarkerManager.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/16/13. - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ #import "ScreenSpaceBuilder.h" #import "SharedAttributes.h" #import "CoordSystem.h" +#import "WhirlyKitLog.h" using namespace Eigen; using namespace WhirlyKit; @@ -114,13 +115,18 @@ MarkerManager::MarkerManager() : MarkerManager::~MarkerManager() { - std::lock_guard guardLock(lock); - - for (auto markerRep : markerReps) + // destructors must never throw, wrap stuff that might fail + try { - delete markerRep; + std::lock_guard guardLock(lock); + + auto reps = std::move(markerReps); + for (auto markerRep : reps) + { + delete markerRep; + } } - markerReps.clear(); + WK_STD_DTOR_CATCH() } typedef std::map DrawableMap; @@ -135,7 +141,7 @@ Point3dVector MarkerManager::convertGeoPtsToModelSpace(const VectorRing &inPts) for (const auto &pt: inPts) { - const auto localPt = coordSys->geographicToLocal3d(GeoCoord(pt.x(),pt.y())); + const auto localPt = coordSys->geographicToLocal3d(pt); outPts.push_back(coordAdapt->localToDisplay(localPt)); } @@ -180,11 +186,11 @@ SimpleIdentity MarkerManager::addMarkers(const std::vector &markers,co DrawableMap drawables; // Screen space markers - std::vector screenShapes; + std::vector screenShapes; screenShapes.reserve(markers.size()); // Objects to be controlled by the layout layer - std::vector layoutObjects; + std::vector layoutObjects; layoutObjects.reserve(markers.size()); bool cancel = false; @@ -242,17 +248,17 @@ SimpleIdentity MarkerManager::addMarkers(const std::vector &markers,co layoutImport = marker->layoutImportance; } - LayoutObject *layoutObj = nullptr; - ScreenSpaceObject *shape; + std::shared_ptr layoutObj; + std::shared_ptr shape; // may or may not alias layoutObj if (layoutImport < MAXFLOAT) { markerRep->useLayout = true; - layoutObj = new LayoutObject(); + layoutObj = std::make_shared(); shape = layoutObj; } else { - shape = new ScreenSpaceObject(); + shape = std::make_shared(); } if (!marker->uniqueID.empty() && layoutObj) @@ -334,14 +340,13 @@ SimpleIdentity MarkerManager::addMarkers(const std::vector &markers,co markerRep->screenShapeIDs.insert(shape->getId()); // Setup layout points if we have them - if (!marker->layoutShape.empty()) + if (!marker->layoutShape.empty() && layoutObj) { layoutObj->layoutShape = convertGeoPtsToModelSpace(marker->layoutShape); layoutObj->layoutRepeat = markerInfo.layoutRepeat; layoutObj->layoutOffset = markerInfo.layoutOffset; layoutObj->layoutSpacing = markerInfo.layoutSpacing; layoutObj->layoutWidth = 2.0f * height2; - layoutObj->layoutDebug = markerInfo.layoutDebug; } // Handle the mask rendering if it's there @@ -382,11 +387,16 @@ SimpleIdentity MarkerManager::addMarkers(const std::vector &markers,co layoutObj->layoutPts = layoutObj->selectPts; } + layoutObj->layoutDebug = markerInfo.layoutDebug; layoutObj->clusterGroup = markerInfo.clusterGroup; layoutObj->importance = layoutImport; + // No moving it around - layoutObj->acceptablePlacement = 1; - + layoutObj->acceptablePlacement = marker->layoutPlacement; + + // Potentially lay it out with something else (e.g., a label) + layoutObj->mergeID = marker->mergeID; + // Start out off, let the layout layer handle the rest shape->setEnable(markerInfo.enable); if (markerInfo.startEnable != markerInfo.endEnable) @@ -398,7 +408,7 @@ SimpleIdentity MarkerManager::addMarkers(const std::vector &markers,co if (layoutObj) { - layoutObjects.push_back(layoutObj); + layoutObjects.push_back(std::move(layoutObj)); } else { @@ -444,7 +454,7 @@ SimpleIdentity MarkerManager::addMarkers(const std::vector &markers,co } } - screenShapes.push_back(shape); + screenShapes.push_back(std::move(shape)); } } else @@ -565,25 +575,14 @@ SimpleIdentity MarkerManager::addMarkers(const std::vector &markers,co ssBuild.addScreenObjects(screenShapes); ssBuild.flushChanges(changes, markerRep->drawIDs); } - for (auto &screenShape : screenShapes) - { - delete screenShape; - } } // And any layout constraints to the layout engine - // todo: use shared_ptr and move instead of copy and delete if (layoutManager && !layoutObjects.empty() && !cancel) { - layoutManager->addLayoutObjects(layoutObjects); + layoutManager->addLayoutObjects(std::move(layoutObjects)); } - for (auto &layoutObject : layoutObjects) - { - delete layoutObject; - } - layoutObjects.clear(); - if (!cancel && renderer) { const SimpleIdentity markerID = markerRep->getId(); @@ -623,6 +622,9 @@ void MarkerManager::enableMarkers(SimpleIDSet &markerIDs,bool enable,ChangeSet & void MarkerManager::removeMarkers(SimpleIDSet &markerIDs,ChangeSet &changes) { + if (!scene) + return; + const auto selectManager = scene->getManager(kWKSelectionManager); const auto layoutManager = scene->getManager(kWKLayoutManager); diff --git a/common/WhirlyGlobeLib/src/MemManagerGLES.cpp b/common/WhirlyGlobeLib/src/MemManagerGLES.cpp index a7c346313e..a76493f039 100644 --- a/common/WhirlyGlobeLib/src/MemManagerGLES.cpp +++ b/common/WhirlyGlobeLib/src/MemManagerGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/Moon.cpp b/common/WhirlyGlobeLib/src/Moon.cpp index 764f5c7e23..2f837262cb 100644 --- a/common/WhirlyGlobeLib/src/Moon.cpp +++ b/common/WhirlyGlobeLib/src/Moon.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting. All rights reserved. + * Copyright 2011-2022 mousebird consulting. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/OverlapHelper.cpp b/common/WhirlyGlobeLib/src/OverlapHelper.cpp index 83184d5e4c..5c0f046382 100644 --- a/common/WhirlyGlobeLib/src/OverlapHelper.cpp +++ b/common/WhirlyGlobeLib/src/OverlapHelper.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 9/28/15. - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ #import "WhirlyGeometry.h" #import "VectorData.h" #import "Expect.h" +#import "WhirlyKitLog.h" using namespace Eigen; using namespace WhirlyKit; @@ -27,44 +28,47 @@ using namespace WhirlyKit; namespace WhirlyKit { -OverlapHelper::OverlapHelper(const Mbr &mbr,int sizeX,int sizeY) : - mbr(mbr), sizeX(sizeX), sizeY(sizeY) +OverlapHelper::OverlapHelper(const Mbr &mbr, int sizeX, int sizeY, size_t count) : + mbr(mbr), + sizeX(sizeX), + sizeY(sizeY), + totalObjs(count), + cellSize(mbr.span().cwiseQuotient(Point2f(sizeX, sizeY))) { - grid.resize(sizeX*sizeY); - cellSize = Point2f((mbr.ur().x()-mbr.ll().x())/(float)sizeX, - (mbr.ur().y()-mbr.ll().y())/(float)sizeY); + grid.resize(sizeX * sizeY); + + if (count > 0) + { + objects.reserve(count); + } +} + +bool OverlapHelper::addCheckObject(const Point2dVector &pts, const std::string &mergeID) +{ + return addCheckObject(pts, mergeID.empty() ? nullptr : mergeID.c_str()); +} +bool OverlapHelper::checkObject(const Point2dVector &pts, const std::string &mergeID) +{ + return checkObject(pts, mergeID.empty() ? nullptr : mergeID.c_str()); } // Try to add an object. Might fail (kind of the whole point). -bool OverlapHelper::addCheckObject(const Point2dVector &pts) +bool OverlapHelper::addCheckObject(const Point2dVector &pts, const char* mergeID) { const Mbr objMbr(pts); int sx,sy,ex,ey; calcCells(objMbr, sx,sy,ex,ey); - if (!checkObject(pts, objMbr, sx,sy,ex,ey)) + if (!checkObject(pts, objMbr, sx,sy,ex,ey, mergeID)) { return false; } // Okay, so it doesn't overlap. Let's add it where needed. - objects.resize(objects.size()+1); + addObject(pts, mergeID ? mergeID : std::string(), + sx, sy, ex, ey); - const int newId = (int)(objects.size()-1); - - BoundedObject &newObj = objects[newId]; - newObj.pts = pts; - - for (int ix=sx;ix<=ex;ix++) - { - for (int iy=sy;iy<=ey;iy++) - { - std::vector &objList = grid[iy*sizeX + ix]; - objList.push_back(newId); - } - } - return true; } @@ -76,37 +80,43 @@ void OverlapHelper::calcCells(const Mbr &objMbr, int &sx, int &sy, int &ex, int ey = std::min(sizeY - 1, (int) ceil((objMbr.ur().y() - mbr.ll().y()) / cellSize.y())); } +static inline bool eq(const char* ida, const std::string &idb) +{ + // Don't create a temporary string object for for `ida` + return ida && ida == idb; +} + bool OverlapHelper::checkObject(const Point2dVector &pts, const Mbr &objMbr, - int sx, int sy, int ex, int ey) + int sx, int sy, int ex, int ey, const char* mergeID) { + const auto sizeGuess = (int)std::ceil((ex - sx + 1) * (ey - sy + 1) / overlapHeuristic); + std::unordered_set indexes(std::max(1, sizeGuess)); + + // Gather all the matching indexes, ignoring duplicates for (int ix=sx;ix<=ex;ix++) { for (int iy=sy;iy<=ey;iy++) { - const std::vector &objList = grid[iy*sizeX + ix]; - for (int ii : objList) - { - const BoundedObject &testObj = objects[ii]; - // This will result in testing the same thing multiple times - if (ConvexPolyIntersect(testObj.pts,pts)) - { - return false; - } - } + const auto &cellIndexes = cellAt(ix, iy).objIndexes; + indexes.insert(cellIndexes.begin(), cellIndexes.end()); } } - return true; + // Check each unique object index, unless it shares the same ID + return !std::any_of(indexes.begin(), indexes.end(), [&](int ii) { + return !eq(mergeID, objects[ii].mergeID) && + ConvexPolyIntersect(objects[ii].pts,pts); + }); } -bool OverlapHelper::checkObject(const Point2dVector &pts) +bool OverlapHelper::checkObject(const Point2dVector &pts, const char* mergeID) { const Mbr objMbr(pts); int sx,sy,ex,ey; calcCells(objMbr, sx,sy,ex,ey); - return checkObject(pts, objMbr, sx,sy,ex,ey); + return checkObject(pts, objMbr, sx,sy,ex,ey, mergeID); } -void OverlapHelper::addObject(const Point2dVector &pts) +void OverlapHelper::addObject(Point2dVector pts, std::string mergeID) { const Mbr objMbr(pts); @@ -114,19 +124,26 @@ void OverlapHelper::addObject(const Point2dVector &pts) calcCells(objMbr, sx,sy,ex,ey); // Okay, so it doesn't overlap. Let's add it where needed. - objects.resize(objects.size()+1); - - const int newId = (int)(objects.size()-1); + addObject(std::move(pts), std::move(mergeID), sx, sy, ex, ey); +} - BoundedObject &newObj = objects[newId]; - newObj.pts = pts; +void OverlapHelper::addObject(Point2dVector pts, std::string mergeID, + int sx, int sy, int ex, int ey) +{ + objects.emplace_back(std::move(pts), std::move(mergeID)); + const auto newId = (int)(objects.size() - 1); + const auto sizeEstimate = std::max((int)std::ceil(totalObjs * overlapHeuristic),5); for (int ix=sx;ix<=ex;ix++) { for (int iy=sy;iy<=ey;iy++) { - std::vector &objList = grid[iy*sizeX + ix]; - objList.push_back(newId); + auto &cell = cellAt(ix, iy); + if (cell.objIndexes.empty()) + { + cell.objIndexes.reserve(sizeEstimate); + } + cell.objIndexes.push_back(newId); } } } @@ -138,11 +155,10 @@ ClusterHelper::SimpleObject::SimpleObject() ClusterHelper::ClusterHelper(const Mbr &mbr,int sizeX,int sizeY,float resScale, Point2d clusterMarkerSize) : mbr(mbr), sizeX(sizeX), sizeY(sizeY), resScale(resScale), + cellSize(mbr.span().cwiseQuotient(Point2f(sizeX, sizeY)).cast()), clusterMarkerSize(std::move(clusterMarkerSize)) { - grid.resize(sizeX*sizeY); - cellSize = Point2d((mbr.ur().x()-mbr.ll().x())/(double)sizeX, - (mbr.ur().y()-mbr.ll().y())/(double)sizeY); + grid.resize(sizeX * sizeY); } void ClusterHelper::calcCells(const Mbr &checkMbr,int &sx,int &sy,int &ex,int &ey) @@ -151,8 +167,17 @@ void ClusterHelper::calcCells(const Mbr &checkMbr,int &sx,int &sy,int &ex,int &e sy = std::max(0, (int)floor((checkMbr.ll().y()-mbr.ll().y())/cellSize.y())); ex = std::min(sizeX - 1, (int)ceil( (checkMbr.ur().x()-mbr.ll().x())/cellSize.x())); ey = std::min(sizeY - 1, (int)ceil( (checkMbr.ur().y()-mbr.ll().y())/cellSize.y())); + + if (ex < sx || ey < sy) + { + wkLogLevel(Warn, "Invalid cluster cell range (%d,%d)/(%d,%d) from (%.1f,%.1f,%.1f,%.1f)/(%.1f,%.1f,%.1f,%.1f) in %d/%d cells, size %.2f/%.2f", + sx, sy, ex, ey, + mbr.ll().x(), mbr.ll().y(), mbr.ur().x(), mbr.ur().y(), + checkMbr.ll().x(), checkMbr.ll().y(), checkMbr.ur().x(), checkMbr.ur().y(), + sizeX, sizeY, cellSize.x(), cellSize.y()); + } } - + void ClusterHelper::addToCells(const Mbr &objMbr, int index) { int sx,sy,ex,ey; diff --git a/common/WhirlyGlobeLib/src/ParticleSystemDrawable.cpp b/common/WhirlyGlobeLib/src/ParticleSystemDrawable.cpp index da5ae8f025..37e245100d 100644 --- a/common/WhirlyGlobeLib/src/ParticleSystemDrawable.cpp +++ b/common/WhirlyGlobeLib/src/ParticleSystemDrawable.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/28/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/ParticleSystemDrawableBuilder.cpp b/common/WhirlyGlobeLib/src/ParticleSystemDrawableBuilder.cpp index 3d7958c229..c81ab2e764 100644 --- a/common/WhirlyGlobeLib/src/ParticleSystemDrawableBuilder.cpp +++ b/common/WhirlyGlobeLib/src/ParticleSystemDrawableBuilder.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/14/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/ParticleSystemDrawableBuilderGLES.cpp b/common/WhirlyGlobeLib/src/ParticleSystemDrawableBuilderGLES.cpp index 7b77071253..b3bc5f5126 100644 --- a/common/WhirlyGlobeLib/src/ParticleSystemDrawableBuilderGLES.cpp +++ b/common/WhirlyGlobeLib/src/ParticleSystemDrawableBuilderGLES.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/14/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/ParticleSystemDrawableGLES.cpp b/common/WhirlyGlobeLib/src/ParticleSystemDrawableGLES.cpp index 88d20ba0b3..13a8aa47fe 100644 --- a/common/WhirlyGlobeLib/src/ParticleSystemDrawableGLES.cpp +++ b/common/WhirlyGlobeLib/src/ParticleSystemDrawableGLES.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/28/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -229,6 +229,8 @@ void ParticleSystemDrawableGLES::drawTeardownTextures(RendererFrameInfo *frameIn void ParticleSystemDrawableGLES::drawSetupUniforms(RendererFrameInfo *frameInfo,Scene *scene,ProgramGLES *prog) { + const Point2f frameSize = frameInfo->sceneRenderer->getFramebufferSize(); + // Model/View/Projection matrix prog->setUniform(mvpMatrixNameID, frameInfo->mvpMat); prog->setUniform(mvpInvMatrixNameID, frameInfo->mvpInvMat); @@ -236,10 +238,10 @@ void ParticleSystemDrawableGLES::drawSetupUniforms(RendererFrameInfo *frameInfo, prog->setUniform(mvNormalMatrixNameID, frameInfo->viewModelNormalMat); prog->setUniform(mvpNormalMatrixNameID, frameInfo->mvpNormalMat); prog->setUniform(u_pMatrixNameID, frameInfo->projMat); - prog->setUniform(u_ScaleNameID, Point2f(2.f/(float)frameInfo->sceneRenderer->framebufferWidth,2.f/(float)frameInfo->sceneRenderer->framebufferHeight)); + prog->setUniform(u_ScaleNameID, Point2f(2.f/frameSize.x(),2.f/frameSize.y())); // Size of a single pixel - Point2f pixDispSize(frameInfo->screenSizeInDisplayCoords.x()/frameInfo->sceneRenderer->framebufferWidth,frameInfo->screenSizeInDisplayCoords.y()/frameInfo->sceneRenderer->framebufferHeight); + const Point2f pixDispSize = frameInfo->screenSizeInDisplayCoords.cast().cwiseQuotient(frameSize); // If this is present, the drawable wants to do something based where the viewer is looking prog->setUniform(u_EyeVecNameID, frameInfo->fullEyeVec); diff --git a/common/WhirlyGlobeLib/src/ParticleSystemManager.cpp b/common/WhirlyGlobeLib/src/ParticleSystemManager.cpp index 4f74f8cede..97a2ef8036 100644 --- a/common/WhirlyGlobeLib/src/ParticleSystemManager.cpp +++ b/common/WhirlyGlobeLib/src/ParticleSystemManager.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/26/15. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/PerformanceTimer.cpp b/common/WhirlyGlobeLib/src/PerformanceTimer.cpp index 63ec026fdf..c1a1acff50 100644 --- a/common/WhirlyGlobeLib/src/PerformanceTimer.cpp +++ b/common/WhirlyGlobeLib/src/PerformanceTimer.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/20/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -119,7 +119,7 @@ void PerformanceTimer::report(const std::string &what) wkLogLevel(Verbose,"Maply Performance: %s",what.c_str()); } -void PerformanceTimer::log() +void PerformanceTimer::log(double min) { std::vector sortedEntries; sortedEntries.reserve(timeEntries.size()); @@ -132,7 +132,7 @@ void PerformanceTimer::log() char line[1024]; for (const auto &entry : sortedEntries) { - if (entry.numRuns > 0) + if (entry.numRuns > 0 && entry.maxDur >= min) { sprintf(line,"%s: min, max, mean = (%.3f, %.3f, %.4f) ms, %d reports", entry.name.c_str(),1000*entry.minDur,1000*entry. @@ -143,7 +143,7 @@ void PerformanceTimer::log() for (const auto &countEntry : countEntries) { const CountEntry &entry = countEntry.second; - if (entry.numRuns > 0) + if (entry.numRuns > 0 && entry.maxCount > 0) { sprintf(line,"%s: min, max, mean (%d, %d, %.3f), %d reports", entry.name.c_str(),entry.minCount,entry.maxCount, diff --git a/common/WhirlyGlobeLib/src/Program.cpp b/common/WhirlyGlobeLib/src/Program.cpp index f400d0d8f6..397ea1a066 100644 --- a/common/WhirlyGlobeLib/src/Program.cpp +++ b/common/WhirlyGlobeLib/src/Program.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/23/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/ProgramGLES.cpp b/common/WhirlyGlobeLib/src/ProgramGLES.cpp index 438afbd9b5..db0aa3e96d 100644 --- a/common/WhirlyGlobeLib/src/ProgramGLES.cpp +++ b/common/WhirlyGlobeLib/src/ProgramGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/23/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/Proj4CoordSystem.cpp b/common/WhirlyGlobeLib/src/Proj4CoordSystem.cpp index 7cec480f24..5e01ab80b5 100644 --- a/common/WhirlyGlobeLib/src/Proj4CoordSystem.cpp +++ b/common/WhirlyGlobeLib/src/Proj4CoordSystem.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 11/10/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/QuadDisplayControllerNew.cpp b/common/WhirlyGlobeLib/src/QuadDisplayControllerNew.cpp index a9e2223513..de6159a95d 100644 --- a/common/WhirlyGlobeLib/src/QuadDisplayControllerNew.cpp +++ b/common/WhirlyGlobeLib/src/QuadDisplayControllerNew.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/13/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/QuadImageFrameLoader.cpp b/common/WhirlyGlobeLib/src/QuadImageFrameLoader.cpp index 43f9c4556a..bcd14bc429 100644 --- a/common/WhirlyGlobeLib/src/QuadImageFrameLoader.cpp +++ b/common/WhirlyGlobeLib/src/QuadImageFrameLoader.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/15/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -300,16 +300,22 @@ bool QIFTileAsset::frameLoaded(PlatformThreadInfo *threadInfo, ChangeSet &changes) { // Sometimes changes are made directly with the managers and we need to reflect that // even if those features are immediately deleted - if (!loadReturn->changes.empty()) - changes.insert(changes.end(),loadReturn->changes.begin(),loadReturn->changes.end()); + changes.insert(changes.end(),loadReturn->changes.begin(),loadReturn->changes.end()); + loadReturn->changes.clear(); auto frame = loadReturn->frame ? findFrameFor(loadReturn->frame) : nullptr; if (loadReturn->frame && !frame) { if (!loadReturn->compObjs.empty()) + { loader->compManager->removeComponentObjects(threadInfo,loadReturn->compObjs, changes); + loadReturn->compObjs.clear(); + } if (!loadReturn->ovlCompObjs.empty()) + { loader->compManager->removeComponentObjects(threadInfo,loadReturn->ovlCompObjs, changes); + loadReturn->ovlCompObjs.clear(); + } wkLogLevel(Warn,"QuadImageFrameLoader: Got frame back outside of range"); return false; } @@ -317,9 +323,15 @@ bool QIFTileAsset::frameLoaded(PlatformThreadInfo *threadInfo, // Check the generation. This is how we catch old data that was in transit. if (loadReturn->generation < loader->getGeneration()) { if (!loadReturn->compObjs.empty()) + { loader->compManager->removeComponentObjects(threadInfo,loadReturn->compObjs, changes); + loadReturn->compObjs.clear(); + } if (!loadReturn->ovlCompObjs.empty()) + { loader->compManager->removeComponentObjects(threadInfo,loadReturn->ovlCompObjs, changes); + loadReturn->ovlCompObjs.clear(); + } // wkLogLevel(Debug, "QuadImageFrameLoader: Dropped an old loadReturn after a reload."); return true; } @@ -337,8 +349,10 @@ bool QIFTileAsset::frameLoaded(PlatformThreadInfo *threadInfo, // Component objects (if there) for (const ComponentObjectRef& compObj : loadReturn->compObjs) compObjs.insert(compObj->getId()); + loadReturn->compObjs.clear(); for (const ComponentObjectRef& ovlCompObj : loadReturn->ovlCompObjs) ovlCompObjs.insert(ovlCompObj->getId()); + loadReturn->ovlCompObjs.clear(); if (frame) { // Clear out the old texture if it's there @@ -1023,27 +1037,43 @@ void QuadImageFrameLoader::mergeLoadedTile(PlatformThreadInfo *threadInfo,QuadLo } // If there is a tile, then notify it - if (tile) { - if (failed) { + if (tile) + { + if (failed) + { tile->frameFailed(threadInfo, this, loadReturn, changes); - } else { - if (!tile->frameLoaded(threadInfo, this, loadReturn, texs, changes)) - failed = true; + } + else if (!tile->frameLoaded(threadInfo, this, loadReturn, texs, changes)) + { + failed = true; } } - // For whatever reason, didn't correctly integrate the tile - // so now delete everything - if (failed) { + // For whatever reason, didn't correctly integrate the tile, so now delete everything + if (failed) + { for (auto tex: texs) + { delete tex; + } texs.clear(); + + // Keep the changes created while setting up objects + changes.insert(changes.end(), loadReturn->changes.begin(), loadReturn->changes.end()); + loadReturn->changes.clear(); + + // Remove any objects that were added SimpleIDSet compObjs; for (const auto& compObj : loadReturn->compObjs) + { compObjs.insert(compObj->getId()); + } for (const auto& compObj : loadReturn->ovlCompObjs) + { compObjs.insert(compObj->getId()); + } compManager->removeComponentObjects(threadInfo, compObjs, changes); + loadReturn->clear(); } } @@ -1054,8 +1084,8 @@ void QuadImageFrameLoader::updateRenderState(ChangeSet &changes) // See if there's any loading happening bool allLoaded = true; for (const auto& it : tiles) { - auto tileID = it.first; - auto tile = it.second; + const auto &tileID = it.first; + const auto &tile = it.second; if (tileID.level == targetLevel && tile->anyFramesLoading(this)) { allLoaded = false; break; @@ -1067,13 +1097,11 @@ void QuadImageFrameLoader::updateRenderState(ChangeSet &changes) if (curOvlLevel == -1) { curOvlLevel = targetLevel; if (debugMode) - wkLogLevel(Debug, "MaplyQuadImageLoader: Picking new overlay level %d, targetLevel = %d",curOvlLevel,targetLevel); - } else { - if (allLoaded) { - curOvlLevel = targetLevel; - if (debugMode) - wkLogLevel(Debug, "MaplyQuadImageLoader: Picking new overlay level %d, targetLevel = %d",curOvlLevel,targetLevel); - } + wkLogLevel(Debug, "MaplyQuadImageLoader: Picking new overlay level %d",curOvlLevel); + } else if (allLoaded && curOvlLevel != targetLevel) { + if (debugMode) + wkLogLevel(Debug, "MaplyQuadImageLoader: Picking new overlay level %d -> %d",curOvlLevel,targetLevel); + curOvlLevel = targetLevel; } // Work through the tiles, figuring out textures and objects @@ -1149,7 +1177,7 @@ void QuadImageFrameLoader::updateRenderState(ChangeSet &changes) } } } else { - int newDrawPriority = baseDrawPriority + drawPriorityPerLevel * tileID.level; + const int newDrawPriority = baseDrawPriority + drawPriorityPerLevel * tileID.level; for (int focusID = 0;focusIDgetInstanceDrawIDs(focusID)) { changes.push_back(new OnOffChangeRequest(drawID,false)); @@ -1451,6 +1479,11 @@ void QuadImageFrameLoader::updateForFrame(RendererFrameInfo *frameInfo) if (!scene) return; + // We're shutting down, so don't do this + if (lastRunReqFlag && !*lastRunReqFlag) + return; + + ChangeSet changes; TimeInterval now = control->getScene()->getCurrentTime(); diff --git a/common/WhirlyGlobeLib/src/QuadLoaderReturn.cpp b/common/WhirlyGlobeLib/src/QuadLoaderReturn.cpp index 75eb6c32f4..a9fd055647 100644 --- a/common/WhirlyGlobeLib/src/QuadLoaderReturn.cpp +++ b/common/WhirlyGlobeLib/src/QuadLoaderReturn.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/14/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ */ #import "QuadLoaderReturn.h" +#import "WhirlyKitLog.h" namespace WhirlyKit { @@ -35,6 +36,10 @@ QuadLoaderReturn::QuadLoaderReturn(int generation) : QuadLoaderReturn::~QuadLoaderReturn() { + if (!changes.empty()) + { + wkLogLevel(Warn, "LoaderReturn destroyed with %lld pending changes", changes.size()); + } } void QuadLoaderReturn::clear() @@ -43,7 +48,9 @@ void QuadLoaderReturn::clear() images.clear(); compObjs.clear(); ovlCompObjs.clear(); -} + // Note: changes are not cleared, they have to be deleted and should be handled elsewhere +} + } diff --git a/common/WhirlyGlobeLib/src/QuadSamplingController.cpp b/common/WhirlyGlobeLib/src/QuadSamplingController.cpp index 411ff3ae4c..01bbf33845 100644 --- a/common/WhirlyGlobeLib/src/QuadSamplingController.cpp +++ b/common/WhirlyGlobeLib/src/QuadSamplingController.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/15/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/QuadSamplingParams.cpp b/common/WhirlyGlobeLib/src/QuadSamplingParams.cpp index 61749dc144..8e8a2d6028 100644 --- a/common/WhirlyGlobeLib/src/QuadSamplingParams.cpp +++ b/common/WhirlyGlobeLib/src/QuadSamplingParams.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/14/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/QuadTreeNew.cpp b/common/WhirlyGlobeLib/src/QuadTreeNew.cpp index a35cfc0d52..e8d91afb55 100644 --- a/common/WhirlyGlobeLib/src/QuadTreeNew.cpp +++ b/common/WhirlyGlobeLib/src/QuadTreeNew.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford - * Copyright 2012-2021 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/RawData.cpp b/common/WhirlyGlobeLib/src/RawData.cpp index b75cc93a9c..03ba188cbc 100644 --- a/common/WhirlyGlobeLib/src/RawData.cpp +++ b/common/WhirlyGlobeLib/src/RawData.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/15/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/RawPNGImage.cpp b/common/WhirlyGlobeLib/src/RawPNGImage.cpp index b7a5ad7d2e..3327e8fb08 100644 --- a/common/WhirlyGlobeLib/src/RawPNGImage.cpp +++ b/common/WhirlyGlobeLib/src/RawPNGImage.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/3/20. - * Copyright 2011-2020 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/RenderTarget.cpp b/common/WhirlyGlobeLib/src/RenderTarget.cpp index 9b517265b6..4f5e21ec43 100644 --- a/common/WhirlyGlobeLib/src/RenderTarget.cpp +++ b/common/WhirlyGlobeLib/src/RenderTarget.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +66,7 @@ AddRenderTargetReq::AddRenderTargetReq(SimpleIdentity renderTargetID,int width,i // Set up a render target void AddRenderTargetReq::execute(Scene *scene,SceneRenderer *renderer,View *view) { - RenderTargetRef renderTarget = RenderTargetRef(renderer->makeRenderTarget()); + auto renderTarget = renderer->makeRenderTarget(); renderTarget->setId(renderTargetID); renderTarget->width = width; renderTarget->height = height; @@ -81,35 +81,38 @@ void AddRenderTargetReq::execute(Scene *scene,SceneRenderer *renderer,View *view renderTarget->calcMinMax = calcMinMax; renderTarget->init(renderer,scene,texID); - renderer->addRenderTarget(renderTarget); + renderer->addRenderTarget(std::move(renderTarget)); } -ChangeRenderTargetReq::ChangeRenderTargetReq(SimpleIdentity renderTargetID,SimpleIdentity texID) -: renderTargetID(renderTargetID), texID(texID) +ChangeRenderTargetReq::ChangeRenderTargetReq(SimpleIdentity renderTargetID,SimpleIdentity texID) : + renderTargetID(renderTargetID), + texID(texID) { } void ChangeRenderTargetReq::execute(Scene *scene,SceneRenderer *renderer,View *view) { - for (RenderTargetRef renderTarget : renderer->renderTargets) + for (const auto &renderTarget : renderer->getRenderTargets()) { - if (renderTarget->getId() == renderTargetID) { + if (renderTarget->getId() == renderTargetID) + { renderTarget->setTargetTexture(renderer,scene,texID); break; } } } -ClearRenderTargetReq::ClearRenderTargetReq(SimpleIdentity targetID) -: renderTargetID(targetID) +ClearRenderTargetReq::ClearRenderTargetReq(SimpleIdentity targetID) : + renderTargetID(targetID) { } void ClearRenderTargetReq::execute(Scene *scene,SceneRenderer *renderer,View *view) { - for (RenderTargetRef renderTarget : renderer->renderTargets) + for (const auto &renderTarget : renderer->getRenderTargets()) { - if (renderTarget->getId() == renderTargetID) { + if (renderTarget->getId() == renderTargetID) + { renderTarget->clearOnce = true; break; } diff --git a/common/WhirlyGlobeLib/src/RenderTargetGLES.cpp b/common/WhirlyGlobeLib/src/RenderTargetGLES.cpp index 39ee1f86d9..d82d83a024 100644 --- a/common/WhirlyGlobeLib/src/RenderTargetGLES.cpp +++ b/common/WhirlyGlobeLib/src/RenderTargetGLES.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/13/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/Scene.cpp b/common/WhirlyGlobeLib/src/Scene.cpp index 681bbac179..3ce77c9a23 100644 --- a/common/WhirlyGlobeLib/src/Scene.cpp +++ b/common/WhirlyGlobeLib/src/Scene.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/3/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,10 @@ #import "GeometryManager.h" #import "ComponentManager.h" +#if __clang_major__ >= 3 +#include +#endif + namespace WhirlyKit { @@ -143,16 +147,46 @@ Scene::~Scene() { manager.second->setScene(nullptr); } + +#if DEBUG + std::vector> wm(managers.size()); + std::transform(managers.begin(), managers.end(), wm.begin(), [](auto p){ return p.second; }); +#endif managers.clear(); - - auto theChangeRequests = changeRequests; - changeRequests.clear(); - for (auto & theChangeRequest : theChangeRequests) + +#if DEBUG + wm.erase(std::remove_if(wm.begin(), wm.end(), [](auto p){ return !p.lock(); }), wm.end()); + for (const auto &w : wm) + { + if (const auto p = w.lock()) + { + const auto &ref = *p; + const auto name = typeid(ref).name(); + int32_t status = 0; + size_t len = 256; + std::vector buf(len + 1); +#if __clang_major__ >= 3 + abi::__cxa_demangle(name, &buf[0], &len, &status); +#endif + wkLogLevel(Warn, "Scene Manager live after scene destroyed: '%s' (%s)", &buf[0], name); + } + } +#endif + + auto theChangeRequests = std::move(changeRequests); + for (auto *theChangeRequest : theChangeRequests) { - // Note: Tear down change requests? delete theChangeRequest; } - + theChangeRequests.clear(); + + auto timedChanges = std::move(timedChangeRequests); + for (auto *theChangeRequest : timedChanges) + { + delete theChangeRequest; + } + timedChanges.clear(); + activeModels.clear(); subTextureMap.clear(); @@ -239,18 +273,20 @@ void Scene::addLocalMbr(const Mbr &localMbr) } } -void Scene::setRenderer(SceneRenderer *renderer) +void Scene::setRenderer(SceneRenderer *inRenderer) { - if (renderer) + if (inRenderer) { - setupInfo = renderer->getRenderSetupInfo(); + setupInfo = inRenderer->getRenderSetupInfo(); } std::lock_guard guardLock(managerLock); + renderer = inRenderer; + for (const auto &kvp : managers) { - kvp.second->setRenderer(renderer); + kvp.second->setRenderer(inRenderer); } } @@ -359,18 +395,19 @@ int Scene::preProcessChanges(WhirlyKit::View *view,SceneRenderer *renderer,__unu { std::lock_guard guardLock(changeRequestLock); // Just doing the ones that require a pre-process - for (auto &changeRequest : changeRequests) + for (auto &req : changeRequests) { - ChangeRequest *req = changeRequest; - if (req && req->needPreExecute()) { + if (req && req->needPreExecute()) + { preRequests.push_back(req); - changeRequest = nullptr; + req = nullptr; } } } // Run these outside of the lock, since they might use the lock - for (auto req : preRequests) { + for (auto req : preRequests) + { req->execute(this,renderer,view); delete req; } @@ -382,33 +419,46 @@ int Scene::preProcessChanges(WhirlyKit::View *view,SceneRenderer *renderer,__unu // We'll grab the lock and we're only expecting to be called in the rendering thread int Scene::processChanges(WhirlyKit::View *view,SceneRenderer *renderer,TimeInterval now) { - std::lock_guard guardLock(changeRequestLock); - // See if any of the timed changes are ready - std::vector toMove; - for (ChangeRequest *req : timedChangeRequests) - { - if (now >= req->when) - toMove.push_back(req); - else - break; - } - for (ChangeRequest *req : toMove) + // Set up a local collection of approximately the same capacity before locking + decltype(changeRequests) localChanges; + localChanges.reserve(changeRequests.capacity()); + { - timedChangeRequests.erase(req); - changeRequests.push_back(req); + std::lock_guard guardLock(changeRequestLock); + + // See if any of the timed changes are ready + if (!timedChangeRequests.empty()) + { + // Establish the range of changes to be moved + const auto beg = timedChangeRequests.begin(); + auto end = beg; + while (end != timedChangeRequests.end() && (*end)->when <= now) + { + ++end; + } + + // Move them + if (end != beg) + { + std::copy(beg, end, std::back_inserter(changeRequests)); + timedChangeRequests.erase(beg, end); + } + } + + // Move the outstanding changes to the local collection and release the lock + localChanges.swap(changeRequests); } - - for (auto req : changeRequests) + + for (auto req : localChanges) { - if (req) { + if (req) + { req->execute(this,renderer,view); delete req; } } - int numChanges = changeRequests.size(); - changeRequests.clear(); - - return numChanges; + + return localChanges.size(); } bool Scene::hasChanges(TimeInterval now) const @@ -687,9 +737,9 @@ void RemTextureReq::execute(Scene *scene,SceneRenderer *renderer,WhirlyKit::View TextureBaseRef tex = scene->getTexture(texture); if (tex) { - if (renderer->teardownInfo) + if (auto info = renderer->getTeardownInfo()) { - renderer->teardownInfo->destroyTexture(renderer,tex); + info->destroyTexture(renderer,tex); } scene->removeTexture(texture); } else @@ -766,10 +816,9 @@ RemDrawableReq::RemDrawableReq(SimpleIdentity drawId,TimeInterval inWhen) void RemDrawableReq::execute(Scene *scene,SceneRenderer *renderer,WhirlyKit::View *view) { - DrawableRef draw = scene->getDrawable(drawID); - if (draw) + if (DrawableRef draw = scene->getDrawable(drawID)) { - renderer->removeDrawable(draw, true, renderer->teardownInfo); + renderer->removeDrawable(draw, true, renderer->getTeardownInfo()); scene->remDrawable(draw); } else @@ -786,7 +835,7 @@ void AddProgramReq::execute(Scene *scene,SceneRenderer *renderer,WhirlyKit::View void RemProgramReq::execute(Scene *scene,SceneRenderer *renderer,WhirlyKit::View *view) { - scene->removeProgram(programId,renderer->teardownInfo); + scene->removeProgram(programId,renderer->getTeardownInfo()); } RunBlockReq::RunBlockReq(BlockFunc newFunc) : func(std::move(newFunc)) diff --git a/common/WhirlyGlobeLib/src/SceneGLES.cpp b/common/WhirlyGlobeLib/src/SceneGLES.cpp index 84697adfbd..debec54c88 100644 --- a/common/WhirlyGlobeLib/src/SceneGLES.cpp +++ b/common/WhirlyGlobeLib/src/SceneGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/14/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/SceneGraphManager.cpp b/common/WhirlyGlobeLib/src/SceneGraphManager.cpp index e5cee50857..8e45bb276e 100644 --- a/common/WhirlyGlobeLib/src/SceneGraphManager.cpp +++ b/common/WhirlyGlobeLib/src/SceneGraphManager.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/24/12. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -155,7 +155,7 @@ void SceneGraphManager::update(ViewStateRef viewState,ChangeSet &changes) activeDrawIDs = shouldBeOn; } -void SceneGraphManager::addDrawable(BasicDrawable *draw,ChangeSet &changes) +void SceneGraphManager::addDrawable(const BasicDrawableRef &draw,ChangeSet &changes) { drawables.insert(draw->getId()); changes.push_back(new AddDrawableReq(draw)); diff --git a/common/WhirlyGlobeLib/src/SceneRenderer.cpp b/common/WhirlyGlobeLib/src/SceneRenderer.cpp index 796df71bfd..c1746ce946 100644 --- a/common/WhirlyGlobeLib/src/SceneRenderer.cpp +++ b/common/WhirlyGlobeLib/src/SceneRenderer.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/13/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -151,12 +151,18 @@ Scene *SceneRenderer::getScene() View *SceneRenderer::getView() { return theView; } -float SceneRenderer::getScale() +float SceneRenderer::getScale() const { return scale; } void SceneRenderer::setScale(float newScale) { scale = newScale; } +void SceneRenderer::setFramebufferSize(float width, float height) +{ + framebufferWidth = width; + framebufferHeight = height; +} + void SceneRenderer::setZBufferMode(WhirlyKitSceneRendererZBufferMode inZBufferMode) { zBufferMode = inZBufferMode; } @@ -171,9 +177,9 @@ void SceneRenderer::setView(View *newView) void SceneRenderer::addRenderTarget(RenderTargetRef newTarget) { - auto workGroup = workGroups[WorkGroup::Offscreen]; + const auto &workGroup = workGroups[WorkGroup::Offscreen]; workGroup->renderTargetContainers.push_back(workGroup->makeRenderTargetContainer(newTarget)); - renderTargets.insert(renderTargets.begin(),newTarget); + renderTargets.insert(renderTargets.begin(),std::move(newTarget)); } void SceneRenderer::addDrawable(DrawableRef newDrawable) @@ -289,21 +295,33 @@ void SceneRenderer::removeRenderTarget(SimpleIdentity targetID) } void SceneRenderer::defaultTargetInit(RenderTarget *) - { } +{ } void SceneRenderer::presentRender() - { } +{ } -Point2f SceneRenderer::getFramebufferSize() +Point2f SceneRenderer::getFramebufferSize() const { return Point2f(framebufferWidth,framebufferHeight); } -Point2f SceneRenderer::getFramebufferSizeScaled() +Mbr SceneRenderer::getFramebufferBound(float margin) const { - return Point2f(framebufferWidth/scale,framebufferHeight/scale); + const Point2f size = getFramebufferSize(); + return { size * -margin, size * (1.0f + margin) }; } - + +Point2f SceneRenderer::getFramebufferSizeScaled() const +{ + return Point2f(framebufferWidth,framebufferHeight) / ((scale != 0) ? scale : 1.0f); +} + +Mbr SceneRenderer::getFramebufferBoundScaled(float margin) const +{ + const Point2f size = getFramebufferSizeScaled(); + return { size * -margin, size * (1.0f + margin) }; +} + void SceneRenderer::setRenderUntil(TimeInterval newRenderUntil) { renderUntil = std::max(renderUntil,newRenderUntil); @@ -357,7 +375,7 @@ void SceneRenderer::setScene(WhirlyKit::Scene *newScene) } } -RGBAColor SceneRenderer::getClearColor() +RGBAColor SceneRenderer::getClearColor() const { return clearColor; } diff --git a/common/WhirlyGlobeLib/src/SceneRendererGLES.cpp b/common/WhirlyGlobeLib/src/SceneRendererGLES.cpp index 2c44214d30..1bfe587f1e 100644 --- a/common/WhirlyGlobeLib/src/SceneRendererGLES.cpp +++ b/common/WhirlyGlobeLib/src/SceneRendererGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/13/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -395,7 +395,8 @@ void SceneRendererGLES::render(TimeInterval duration) perfTimer.startTiming("Scene preprocessing"); // Run the preprocess for the changes. These modify things the active models need. - const int numPreProcessChanges = scene->preProcessChanges(theView, this, now); + // Since the results won't actually be drawn instantly, consider changes up to half a frame ahead. + const int numPreProcessChanges = scene->preProcessChanges(theView, this, now + duration / 2); if (UNLIKELY(reportStats)) perfTimer.addCount("Preprocess Changes", numPreProcessChanges); @@ -426,8 +427,8 @@ void SceneRendererGLES::render(TimeInterval duration) perfTimer.startTiming("Scene processing"); // Merge any outstanding changes into the scenegraph - scene->processChanges(theView,this,now); - + scene->processChanges(theView,this,now + duration / 2); + if (UNLIKELY(reportStats)) perfTimer.stopTiming("Scene processing"); @@ -706,11 +707,26 @@ void SceneRendererGLES::render(TimeInterval duration) if (UNLIKELY(reportStats)) perfTimer.stopTiming("Render Frame"); - + + const TimeInterval newNow = scene->getCurrentTime(); + const TimeInterval frameDuration = newNow - now; + + // If we've finished faster than is necessary to achieve the target frame rate, process + // changes that came in or became active since we started so that the next frame is faster. + if (frameDuration < duration) + { + if (UNLIKELY(reportStats)) + perfTimer.startTiming("Scene processing 2"); + + scene->processChanges(theView, this, newNow + duration / 2); + + if (UNLIKELY(reportStats)) + perfTimer.stopTiming("Scene processing 2"); + } + // Update the frames per sec if (UNLIKELY(reportStats && frameCount >= perfInterval)) { - const TimeInterval newNow = scene->getCurrentTime(); const TimeInterval howLong = newNow - frameCountStart; framesPerSec = (float)(frameCount / howLong); frameCountStart = newNow; @@ -732,7 +748,7 @@ void SceneRendererGLES::render(TimeInterval duration) wkLogLevel(Verbose," Frames per sec = %.2f",framesPerSec); } - perfTimer.log(); + perfTimer.log(0.0001); perfTimer.clear(); } } diff --git a/common/WhirlyGlobeLib/src/ScreenImportance.cpp b/common/WhirlyGlobeLib/src/ScreenImportance.cpp index 39fe2c0d24..ada2e63ff4 100644 --- a/common/WhirlyGlobeLib/src/ScreenImportance.cpp +++ b/common/WhirlyGlobeLib/src/ScreenImportance.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/11/13. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/ScreenObject.cpp b/common/WhirlyGlobeLib/src/ScreenObject.cpp index f658b56e6f..2ad4d8a863 100644 --- a/common/WhirlyGlobeLib/src/ScreenObject.cpp +++ b/common/WhirlyGlobeLib/src/ScreenObject.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/ScreenSpaceBuilder.cpp b/common/WhirlyGlobeLib/src/ScreenSpaceBuilder.cpp index 96caf3c772..b594644983 100644 --- a/common/WhirlyGlobeLib/src/ScreenSpaceBuilder.cpp +++ b/common/WhirlyGlobeLib/src/ScreenSpaceBuilder.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/21/14. - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -393,7 +393,8 @@ void ScreenSpaceBuilder::addRectangle(const Point3d &worldLoc,const Point2d *coo } void ScreenSpaceBuilder::addRectangle(const Point3d &worldLoc,double rotation, - bool keepUpright,const Point2d *coords, + __unused bool keepUpright, + const Point2d *coords, const TexCoord *texCoords,const RGBAColor &color, SimpleIDUnorderedSet *drawIDs) { @@ -411,7 +412,8 @@ void ScreenSpaceBuilder::addRectangle(const Point3d &worldLoc,double rotation, { const Point2d &coord = coords[ii]; const TexCoord *texCoord = (texCoords ? &texCoords[ii] : nullptr); - drawWrap->addVertex(coordAdapter,scale,worldLoc, nullptr, rotation, coord, texCoord, &color, nullptr); + drawWrap->addVertex(coordAdapter,scale,worldLoc, nullptr, + (float)rotation, coord, texCoord, &color, nullptr); } drawWrap->addTri(0+baseVert,1+baseVert,2+baseVert); drawWrap->addTri(0+baseVert,2+baseVert,3+baseVert); @@ -429,13 +431,13 @@ void ScreenSpaceBuilder::addScreenObjects(std::vector &screen addScreenObject(ssObj,ssObj.worldLoc,&ssObj.geometry,places,drawIDs); } } - + void ScreenSpaceBuilder::addScreenObjects(std::vector &screenObjects, const std::vector *places, SimpleIDUnorderedSet *drawIDs) { std::sort(screenObjects.begin(),screenObjects.end(), - [](const ScreenSpaceObject *a, const ScreenSpaceObject *b) {return a->orderBy < b->orderBy; }); + [](const auto *a, const auto *b) {return a->orderBy < b->orderBy; }); for (const auto *ssObj : screenObjects) { @@ -443,6 +445,19 @@ void ScreenSpaceBuilder::addScreenObjects(std::vector &scre } } +void ScreenSpaceBuilder::addScreenObjects(std::vector &screenObjects, + const std::vector *places, + SimpleIDUnorderedSet *drawIDs) +{ + std::sort(screenObjects.begin(),screenObjects.end(), + [](const auto &a, const auto &b) {return a->orderBy < b->orderBy; }); + + for (const auto &ssObj : screenObjects) + { + addScreenObject(*ssObj, ssObj->worldLoc, &ssObj->geometry,places,drawIDs); + } +} + void ScreenSpaceBuilder::addScreenObject(const ScreenSpaceObject &ssObj, const Point3d &worldLoc, const std::vector *geoms, diff --git a/common/WhirlyGlobeLib/src/ScreenSpaceDrawableBuilder.cpp b/common/WhirlyGlobeLib/src/ScreenSpaceDrawableBuilder.cpp index f664e08570..8e7cb46e84 100644 --- a/common/WhirlyGlobeLib/src/ScreenSpaceDrawableBuilder.cpp +++ b/common/WhirlyGlobeLib/src/ScreenSpaceDrawableBuilder.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 8/24/14. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/ScreenSpaceDrawableBuilderGLES.cpp b/common/WhirlyGlobeLib/src/ScreenSpaceDrawableBuilderGLES.cpp index 93cd619964..36b9e51a11 100644 --- a/common/WhirlyGlobeLib/src/ScreenSpaceDrawableBuilderGLES.cpp +++ b/common/WhirlyGlobeLib/src/ScreenSpaceDrawableBuilderGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/14/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/SelectionManager.cpp b/common/WhirlyGlobeLib/src/SelectionManager.cpp index d692185c38..c3def9ede4 100644 --- a/common/WhirlyGlobeLib/src/SelectionManager.cpp +++ b/common/WhirlyGlobeLib/src/SelectionManager.cpp @@ -4,7 +4,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 10/26/11. - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -779,22 +779,18 @@ void SelectionManager::getScreenSpaceObjects(const PlacementInfo &pInfo,std::vec SelectionManager::PlacementInfo::PlacementInfo(ViewStateRef inViewState,SceneRenderer *renderer) : viewState(std::move(inViewState)) { - const float scale = renderer->getScale(); - // Sort out what kind of view it is globeViewState = dynamic_cast(viewState.get()); mapViewState = dynamic_cast(viewState.get()); heightAboveSurface = globeViewState ? globeViewState->heightAboveGlobe : - mapViewState ? mapViewState->heightAboveSurface : 0; + mapViewState ? mapViewState->heightAboveSurface : 0; // Calculate a slightly bigger framebuffer to grab nearby features - frameSize = Point2f(renderer->framebufferWidth,renderer->framebufferHeight); - frameSizeScale = Point2f((float)renderer->framebufferWidth/scale, - (float)renderer->framebufferHeight/scale); - const float marginX = frameSize.x() * 0.25f; - const float marginY = frameSize.y() * 0.25f; - frameMbr.ll() = Point2f(0 - marginX,0 - marginY); - frameMbr.ur() = Point2f(frameSize.x() + marginX,frameSize.y() + marginY); + frameSize = renderer->getFramebufferSize(); + frameSizeScale = renderer->getFramebufferSizeScaled(); + + const float margin = 0.25f; + frameMbr = renderer->getFramebufferBound(margin); } void SelectionManager::projectWorldPointToScreen(const Point3d &worldLoc,const PlacementInfo &pInfo,Point2dVector &screenPts,float scale) @@ -933,7 +929,7 @@ void SelectionManager::pickObjects(const Point2f &touchPt,float maxDist,const Vi const Matrix4d modelTrans = pInfo.viewState->fullMatrices[0]; const Matrix4d normalMat = pInfo.viewState->fullMatrices[0].inverse().transpose(); - const Point2f frameBufferSize(renderer->framebufferWidth, renderer->framebufferHeight); + const Point2f frameBufferSize = renderer->getFramebufferSize(); const auto layoutManager = scene->getManager(kWKLayoutManager); diff --git a/common/WhirlyGlobeLib/src/ShapeDrawableBuilder.cpp b/common/WhirlyGlobeLib/src/ShapeDrawableBuilder.cpp index 350592d2e3..19e5d40af3 100644 --- a/common/WhirlyGlobeLib/src/ShapeDrawableBuilder.cpp +++ b/common/WhirlyGlobeLib/src/ShapeDrawableBuilder.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 9/28/11. - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,19 +33,12 @@ namespace WhirlyKit { ShapeInfo::ShapeInfo() - : color(RGBAColor(255,255,255,255)) - , lineWidth(1.0) - , insideOut(false) - , hasCenter(false) - , center(0.0,0.0,0.0) { zBufferRead = true; } ShapeInfo::ShapeInfo(const Dictionary &dict) : BaseInfo(dict) - , hasCenter(false) - , center(0,0,0) { zBufferRead = dict.getBool(MaplyZBufferRead, true); color = dict.getColor(MaplyColor,RGBAColor(255,255,255,255)); diff --git a/common/WhirlyGlobeLib/src/ShapeManager.cpp b/common/WhirlyGlobeLib/src/ShapeManager.cpp index 7906368b5b..650dd14573 100644 --- a/common/WhirlyGlobeLib/src/ShapeManager.cpp +++ b/common/WhirlyGlobeLib/src/ShapeManager.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/ShapeReader.cpp b/common/WhirlyGlobeLib/src/ShapeReader.cpp index b2f3c02508..7dcd769bca 100644 --- a/common/WhirlyGlobeLib/src/ShapeReader.cpp +++ b/common/WhirlyGlobeLib/src/ShapeReader.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/2/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/SphericalEarthChunkManager.cpp b/common/WhirlyGlobeLib/src/SphericalEarthChunkManager.cpp index f2f4f22207..33864979b1 100644 --- a/common/WhirlyGlobeLib/src/SphericalEarthChunkManager.cpp +++ b/common/WhirlyGlobeLib/src/SphericalEarthChunkManager.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/23/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/SphericalMercator.cpp b/common/WhirlyGlobeLib/src/SphericalMercator.cpp index 5c05c1b237..093b9dc7dd 100644 --- a/common/WhirlyGlobeLib/src/SphericalMercator.cpp +++ b/common/WhirlyGlobeLib/src/SphericalMercator.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/19/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/Sun.cpp b/common/WhirlyGlobeLib/src/Sun.cpp index 022615cce2..40744b9138 100644 --- a/common/WhirlyGlobeLib/src/Sun.cpp +++ b/common/WhirlyGlobeLib/src/Sun.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2016 mousebird consulting. All rights reserved. + * Copyright 2011-2022 mousebird consulting. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/Tesselator.cpp b/common/WhirlyGlobeLib/src/Tesselator.cpp index 801b6112a8..8b80f6859d 100644 --- a/common/WhirlyGlobeLib/src/Tesselator.cpp +++ b/common/WhirlyGlobeLib/src/Tesselator.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/17/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/Texture.cpp b/common/WhirlyGlobeLib/src/Texture.cpp index d41ef0aacb..ea693914ee 100644 --- a/common/WhirlyGlobeLib/src/Texture.cpp +++ b/common/WhirlyGlobeLib/src/Texture.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/7/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/TextureAtlas.cpp b/common/WhirlyGlobeLib/src/TextureAtlas.cpp index f708e7bd47..ef2fe6f1ab 100644 --- a/common/WhirlyGlobeLib/src/TextureAtlas.cpp +++ b/common/WhirlyGlobeLib/src/TextureAtlas.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/28/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,8 +34,7 @@ void SubTexture::setFromTex(const TexCoord &texOrg,const TexCoord &texDest) // Calculate a destination texture coordinate TexCoord SubTexture::processTexCoord(const TexCoord &inCoord) const { - const Vector3f res = trans * Vector3f(inCoord.x(),inCoord.y(),1.0); - return TexCoord(res.x(),res.y()); + return Slice(trans * Pad(inCoord, 1.0f)); } // Calculate destination texture coords for a while group diff --git a/common/WhirlyGlobeLib/src/TextureGLES.cpp b/common/WhirlyGlobeLib/src/TextureGLES.cpp index fc34737fc7..5a2796ae82 100644 --- a/common/WhirlyGlobeLib/src/TextureGLES.cpp +++ b/common/WhirlyGlobeLib/src/TextureGLES.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/7/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/TriangleShadersGLES.cpp b/common/WhirlyGlobeLib/src/TriangleShadersGLES.cpp index 3c10fb3bbe..bf8dcc7961 100644 --- a/common/WhirlyGlobeLib/src/TriangleShadersGLES.cpp +++ b/common/WhirlyGlobeLib/src/TriangleShadersGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 8/21/18. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/UtilsGLES.cpp b/common/WhirlyGlobeLib/src/UtilsGLES.cpp index b9c41e9c84..e9d8dbb42b 100644 --- a/common/WhirlyGlobeLib/src/UtilsGLES.cpp +++ b/common/WhirlyGlobeLib/src/UtilsGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/21/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/VectorData.cpp b/common/WhirlyGlobeLib/src/VectorData.cpp index a0a100c1e9..1604049ad1 100644 --- a/common/WhirlyGlobeLib/src/VectorData.cpp +++ b/common/WhirlyGlobeLib/src/VectorData.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,32 +24,41 @@ namespace WhirlyKit { +using TDefInt = detail::TDefaultIntermediate; -template -double CalcLoopArea(const std::vector> &loop) +template +TRet CalcLoopArea(const std::vector> &loop, size_t loopSize) { - if (loop.empty()) + if (loopSize < 3 || loopSize > loop.size()) { return 0; } // If the loop returns to the initial point, stop there. // If it does not, force it to be closed by re-considering the first point. - const bool closed = !loop.empty() && loop.front() == loop.back(); - const auto loopSize = loop.size(); + const bool closed = (loop[0] == loop[loopSize - 1]); const auto maxIter = closed ? loopSize - 1 : loopSize; - double area = 0.0; + TInt area = 0.0; for (unsigned int ii=0;ii +TRet CalcLoopArea(const std::vector> &loop) +{ + return CalcLoopArea(loop,loop.size()); } // Calculate the centroid of a loop when the area is already known -template +template T CalcLoopCentroid(const std::vector> &loop, double loopArea) { if (loop.empty()) @@ -69,14 +78,14 @@ T CalcLoopCentroid(const std::vector> &loop, doubl const auto loopSize = loop.size(); const auto maxIter = closed ? loopSize - 1 : loopSize; - double sumX = 0, sumY = 0; + TInt sumX = 0, sumY = 0; for (unsigned int ii=0;ii(sumX/(3*loopArea)), @@ -84,20 +93,20 @@ T CalcLoopCentroid(const std::vector> &loop, doubl } // Calculate the centroid of an arbitrary loop -template +template T CalcLoopCentroid(const std::vector> &loop) { - return CalcLoopCentroid(loop, CalcLoopArea(loop)); + return CalcLoopCentroid(loop, CalcLoopArea(loop)); } -template +template T CalcCenterOfMass(const std::vector> &loop) { if (loop.empty()) { return {0,0}; } - double cx = 0, cy = 0; + TInt cx = 0, cy = 0; for (const auto &pt : loop) { cx += pt.x(); cy += pt.y(); @@ -108,49 +117,51 @@ T CalcCenterOfMass(const std::vector> &loop) } // Export specific instantiations of the templates above. -template double CalcLoopArea(const VectorRing&); -template double CalcLoopArea(const Point2dVector&); -template Point2f CalcLoopCentroid(const VectorRing&); -template Point2d CalcLoopCentroid(const Point2dVector&); -template Point2f CalcLoopCentroid(const VectorRing&, double); -template Point2d CalcLoopCentroid(const Point2dVector&, double); -template Point2f CalcCenterOfMass(const VectorRing&); -template Point2d CalcCenterOfMass(const Point2dVector&); +template double CalcLoopArea(const VectorRing&); +template double CalcLoopArea(const Point2dVector&); +template Point2f CalcLoopCentroid(const VectorRing&); +template Point2f CalcLoopCentroid(const VectorRing&, double); +template Point2d CalcLoopCentroid(const Point2dVector&); +template Point2d CalcLoopCentroid(const Point2dVector&, double); +template Point2f CalcCenterOfMass(const VectorRing&); +template Point2d CalcCenterOfMass(const Point2dVector&); // Break any edge longer than the given length void SubdivideEdges(const VectorRing &inPts,VectorRing &outPts,bool closed,float maxLen) { - const float maxLen2 = maxLen*maxLen; + const double maxLen2 = (double)maxLen * maxLen; if (outPts.empty()) { outPts.reserve(2 * inPts.size()); } - + for (int ii=0;ii<(closed ? inPts.size() : inPts.size()-1);ii++) { const Point2f &p0 = inPts[ii]; const Point2f &p1 = inPts[(ii+1)%inPts.size()]; outPts.push_back(p0); - Point2f dir = p1-p0; - const float dist2 = dir.squaredNorm(); + Point2d dir = p1.cast() - p0.cast(); + const double dist2 = dir.squaredNorm(); if (dist2 > maxLen2) { - const float dist = sqrtf(dist2); + const double dist = std::sqrt(dist2); dir /= dist; - for (float pos=maxLen;pos()+dir*pos).cast()); } } } if (!closed) + { outPts.push_back(inPts.back()); + } } void SubdivideEdges(const VectorRing3d &inPts,VectorRing3d &outPts,bool closed,float maxLen) { - const float maxLen2 = maxLen*maxLen; + const double maxLen2 = (double)maxLen * maxLen; if (outPts.empty()) { @@ -163,12 +174,12 @@ void SubdivideEdges(const VectorRing3d &inPts,VectorRing3d &outPts,bool closed,f const Point3d &p1 = inPts[(ii+1)%inPts.size()]; outPts.push_back(p0); Point3d dir = p1-p0; - const float dist2 = dir.squaredNorm(); + const double dist2 = dir.squaredNorm(); if (dist2 > maxLen2) { - const float dist = sqrtf(dist2); + const double dist = std::sqrt(dist2); dir /= dist; - for (float pos=maxLen;pos("float", 1e-5); + testArea("double", 1e-8); + // todo: centroid, center-mass, subdivide, ... + wkLogLevel(Info, "VectorData unit tests passed"); + } + template + void testArea(const char* name, double threshold) { + wkLogLevel(Verbose,"Starting area tests for %s", name); + + const TVec pts { + {-93.42748312189,48.62219265172}, + {-93.42762783548,48.61944238743}, + {-93.4210071888, 48.6193706394}, + {-93.42748312189,48.62219265172} // closed + }; + const TVec rpts(pts.rbegin(), pts.rend()); + + const auto aClosed = CalcLoopArea(pts); + const auto aOpen = CalcLoopArea(pts, pts.size() - 1); + const auto aRevClosed = CalcLoopArea(rpts); + const auto aRevOpen = CalcLoopArea(rpts, rpts.size() - 1); + + // Should do exactly the same operations for open and closed polygons + assert(aClosed == aOpen); + assert(aRevClosed == aRevOpen); + + // Reversed polygons might get slightly different answers + const auto diff = (aClosed - (-aRevClosed)) / aClosed; + assert(diff <= threshold); + } +} tests; +#endif + } -#include + diff --git a/common/WhirlyGlobeLib/src/VectorManager.cpp b/common/WhirlyGlobeLib/src/VectorManager.cpp index 39b91ab886..7d5ca4768e 100644 --- a/common/WhirlyGlobeLib/src/VectorManager.cpp +++ b/common/WhirlyGlobeLib/src/VectorManager.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/26/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,23 +34,21 @@ static const std::string vecBuilderName("Vector Layer"); // NOLINT(cert-err58-cp static const std::string vecManagerName("VectorManager"); // NOLINT(cert-err58-cpp) static const std::string colorStr("color"); // NOLINT(cert-err58-cpp) constructor can throw -VectorInfo::VectorInfo() : - filled(false), sample(false), texId(EmptyIdentity), texScale(1.0,1.0), - subdivEps(0.0), gridSubdiv(false), texProj(TextureProjectionNone), - color(RGBAColor(255,255,255,255)), lineWidth(1.0), - centered(true), vecCenterSet(false), vecCenter(0.0,0.0) -{ -} - VectorInfo::VectorInfo(const Dictionary &dict) -: BaseInfo(dict) + : BaseInfo(dict) { - filled = dict.getBool(MaplyFilled,false); - sample = dict.getBool("sample",false); - texId = dict.getInt(MaplyVecTexture,EmptyIdentity); - texScale.x() = dict.getDouble(MaplyVecTexScaleX,1.0); - texScale.y() = dict.getDouble(MaplyVecTexScaleY,1.0); - subdivEps = (float)dict.getDouble(MaplySubdivEpsilon,0.0); + filled = dict.getBool(MaplyFilled,filled); + texId = dict.getInt(MaplyVecTexture,texId); + texScale = { dict.getDouble(MaplyVecTexScaleX,texScale.x()), + dict.getDouble(MaplyVecTexScaleY,texScale.y()) }; + subdivEps = (float)dict.getDouble(MaplySubdivEpsilon,subdivEps); + color = dict.getColor(MaplyColor,color); + lineWidth = (float)dict.getDouble(MaplyVecWidth,lineWidth); + centered = dict.getBool(MaplyVecCentered,centered); + closeAreals = dict.getBool(MaplyVecCloseAreals, closeAreals); + + const auto sampleVal = (float)dict.getDouble("sample", 0.0); + sample = (sampleVal > 0) ? sampleVal : (dict.getBool("sample",sample) ? 0.1f : 0.0f); const std::string subdivType = dict.getString(MaplySubdivType); gridSubdiv = subdivType == MaplySubdivGrid; @@ -64,24 +62,15 @@ VectorInfo::VectorInfo(const Dictionary &dict) { texProj = TextureProjectionScreen; } - else - { - texProj = TextureProjectionNone; - } - color = dict.getColor(MaplyColor,RGBAColor(255,255,255,255)); - lineWidth = (float)dict.getDouble(MaplyVecWidth,1.0); - centered = dict.getBool(MaplyVecCentered,true); - vecCenterSet = false; if (dict.hasField(MaplyVecCenterX) && dict.hasField(MaplyVecCenterY)) { vecCenterSet = true; - vecCenter.x() = dict.getDouble(MaplyVecCenterX); - vecCenter.y() = dict.getDouble(MaplyVecCenterY); + vecCenter = { dict.getDouble(MaplyVecCenterX), dict.getDouble(MaplyVecCenterY) }; } } -std::string VectorInfo::toString() +std::string VectorInfo::toString() const { using std::to_string; std::string outStr = BaseInfo::toString(); @@ -102,7 +91,7 @@ std::string VectorInfo::toString() return outStr; } - + void VectorSceneRep::clear(ChangeSet &changes) { for (auto it : drawIDs) @@ -671,8 +660,9 @@ SimpleIdentity VectorManager::addVectors(const ShapeSet *shapes, const VectorInf drawBuildTri.setCenter(center,geoCenter); } - VectorRing tempRing; + VectorRing tempRing, tempRing2; VectorRing3d tempRing3d; + constexpr auto localCoords = false; for (auto const &it : *shapes) { @@ -681,27 +671,41 @@ SimpleIdentity VectorManager::addVectors(const ShapeSet *shapes, const VectorInf if (vecInfo.filled) { // Triangulate outside and loops - drawBuildTri.addPoints(theAreal->loops,theAreal->getAttrDictRef(), false); + drawBuildTri.addPoints(theAreal->loops,theAreal->getAttrDictRef(), localCoords); + continue; } - else + + // Work through the loops + for (const auto& ring : theAreal->loops) + { + if (ring.size() < 3) { - // Work through the loops - for (unsigned int ri=0;riloops.size();ri++) + // no can do... should we draw it as a line instead? + continue; + } + + const auto *theRing = ˚ + if (vecInfo.closeAreals && ring.front() != ring.back()) { - const VectorRing &ring = theAreal->loops[ri]; - - // Break the edges around the globe (presumably) - if (vecInfo.sample > 0.0) - { - VectorRing newPts; - SubdivideEdges(ring, newPts, false, vecInfo.sample); - drawBuild.addPoints(newPts,true,theAreal->getAttrDictRef(),false); - } - else - { - drawBuild.addPoints(ring,true,theAreal->getAttrDictRef(),false); - } + // Make a copy, duplicating the first point at the end + tempRing.clear(); + tempRing.reserve(ring.size() + 1); + tempRing.assign(ring.begin(), ring.end()); + tempRing.push_back(ring.front()); + theRing = &tempRing; } + + const auto isClosed = (theRing->front() == theRing->back()); + + // Break the edges around the globe (presumably) + if (vecInfo.sample > 0.0) + { + tempRing2.clear(); + SubdivideEdges(*theRing, tempRing2, isClosed, vecInfo.sample); + theRing = &tempRing2; + } + + drawBuild.addPoints(*theRing, isClosed, theAreal->getAttrDictRef(), localCoords); } } else if (const auto theLinear = dynamic_cast(it.get())) @@ -709,7 +713,7 @@ SimpleIdentity VectorManager::addVectors(const ShapeSet *shapes, const VectorInf if (vecInfo.filled) { // Triangulate the outside - drawBuildTri.addPoints(theLinear->pts,theLinear->getAttrDictRef(), false); + drawBuildTri.addPoints(theLinear->pts,theLinear->getAttrDictRef(), localCoords); } else { @@ -717,11 +721,11 @@ SimpleIdentity VectorManager::addVectors(const ShapeSet *shapes, const VectorInf { tempRing.clear(); SubdivideEdges(theLinear->pts, tempRing, false, vecInfo.sample); - drawBuild.addPoints(tempRing,false,theLinear->getAttrDictRef(),false); + drawBuild.addPoints(tempRing,false,theLinear->getAttrDictRef(),localCoords); } else { - drawBuild.addPoints(theLinear->pts,false,theLinear->getAttrDictRef(),false); + drawBuild.addPoints(theLinear->pts,false,theLinear->getAttrDictRef(),localCoords); } } } @@ -730,7 +734,7 @@ SimpleIdentity VectorManager::addVectors(const ShapeSet *shapes, const VectorInf if (vecInfo.filled) { // Triangulate the outside - drawBuildTri.addPoints(theLinear3d->pts,theLinear3d->getAttrDictRef(), false); + drawBuildTri.addPoints(theLinear3d->pts,theLinear3d->getAttrDictRef(), localCoords); } else { @@ -738,11 +742,11 @@ SimpleIdentity VectorManager::addVectors(const ShapeSet *shapes, const VectorInf { tempRing3d.clear(); SubdivideEdges(theLinear3d->pts, tempRing3d, false, vecInfo.sample); - drawBuild.addPoints(tempRing3d,false,theLinear3d->getAttrDictRef(),false); + drawBuild.addPoints(tempRing3d,false,theLinear3d->getAttrDictRef(),localCoords); } else { - drawBuild.addPoints(theLinear3d->pts,false,theLinear3d->getAttrDictRef(),false); + drawBuild.addPoints(theLinear3d->pts,false,theLinear3d->getAttrDictRef(),localCoords); } } } @@ -1010,12 +1014,6 @@ static std::unordered_set &AllIDs(const VectorSceneRep &rep, std set.insert(rep.instIDs.begin(), rep.instIDs.end()); return set; } -static std::unordered_set AllIDs(const VectorSceneRep &rep) -{ - std::unordered_set set; - AllIDs(rep,set); - return set; -} void VectorManager::changeVectors(SimpleIdentity vecID,const VectorInfo &vecInfo,ChangeSet &changes) { diff --git a/common/WhirlyGlobeLib/src/VectorObject.cpp b/common/WhirlyGlobeLib/src/VectorObject.cpp index 0a9e0c62a6..7a60503784 100644 --- a/common/WhirlyGlobeLib/src/VectorObject.cpp +++ b/common/WhirlyGlobeLib/src/VectorObject.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 7/17/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,14 @@ #import "WhirlyKitLog.h" #import "GlobeView.h" #import "MaplyView.h" + +#import "GeographicLib/Geocentric.hpp" #import "GeographicLib/Geodesic.hpp" +#import "GeographicLib.h" namespace WhirlyKit { +using namespace detail; VectorObject::VectorObject() : VectorObject(10) @@ -62,7 +66,7 @@ bool VectorObject::FromGeoJSONAssembly(const std::string &json,std::mapshapes.reserve(vecObj->shapes.size() + it.second.size()); vecObj->shapes.insert(it.second.begin(),it.second.end()); vecData[it.first] = vecObj; @@ -70,17 +74,36 @@ bool VectorObject::FromGeoJSONAssembly(const std::string &json,std::map &vecData) +{ + // TODO: unordered_map? + std::map newShapes; + + if (!VectorParseGeoJSONAssembly(json, newShapes)) + return false; + + for (auto const &it : newShapes) + { + auto vecObj = std::make_shared(); + vecObj->shapes.reserve(vecObj->shapes.size() + it.second.size()); + vecObj->shapes.insert(it.second.begin(),it.second.end()); + vecData[it.first] = std::move(vecObj); + } + + return true; +} + bool VectorObject::fromShapeFile(const std::string &fileName) { ShapeReader shapeReader(fileName); if (!shapeReader.isValid()) return false; - const int numObj = shapeReader.getNumObjects(); + const unsigned numObj = shapeReader.getNumObjects(); shapes.reserve(shapes.size() + numObj); for (unsigned int ii=0;iigetAttrDict(); } -void VectorObject::setAttributes(MutableDictionaryRef newDict) +void VectorObject::setAttributes(const MutableDictionaryRef &newDict) { for (const auto &shape : shapes) + { shape->setAttrDict(newDict); + } } void VectorObject::mergeVectorsFrom(const VectorObject &otherVec) { - shapes.reserve(shapes.size() + otherVec.shapes.size()); + shapes.reserve(otherVec.shapes.size()); shapes.insert(otherVec.shapes.begin(),otherVec.shapes.end()); } @@ -108,7 +133,7 @@ void VectorObject::splitVectors(std::vector &vecs) vecs.reserve(vecs.size() + shapes.size()); for (const auto &shape : shapes) { - VectorObject *vecObj = new VectorObject(); + auto *vecObj = new VectorObject(); vecObj->shapes.insert(shape); vecs.push_back(vecObj); } @@ -119,15 +144,21 @@ bool VectorObject::center(Point2d ¢er) const Mbr mbr; for (const auto &shape : shapes) { - GeoMbr geoMbr = shape->calcGeoMbr(); - mbr.addPoint(geoMbr.ll()); - mbr.addPoint(geoMbr.ur()); + const GeoMbr geoMbr = shape->calcGeoMbr(); + if (geoMbr.valid()) + { + mbr.addPoint(geoMbr.ll()); + mbr.addPoint(geoMbr.ur()); + } } - center.x() = (mbr.ll().x() + mbr.ur().x())/2.0; - center.y() = (mbr.ll().y() + mbr.ur().y())/2.0; - - return true; + if (mbr.valid()) + { + center.x() = (mbr.ll().x() + mbr.ur().x()) / 2.0; + center.y() = (mbr.ll().y() + mbr.ur().y()) / 2.0; + return true; + } + return false; } bool VectorObject::centroid(Point2d ¢roid) const @@ -138,29 +169,36 @@ bool VectorObject::centroid(Point2d ¢roid) const for (const auto &shapeRef : shapes) { const auto shape = shapeRef.get(); - if (const auto areal = dynamic_cast(shape)) { - if (areal->loops.size() > 0) { - for (unsigned int ii=0;iiloops.size();ii++) + if (const auto areal = dynamic_cast(shape)) + { + if (!areal->loops.empty()) + { + for (const auto &loop : areal->loops) { - const float area = CalcLoopArea(areal->loops[ii]); + const float area = CalcLoopArea(loop); if (std::abs(area) > std::abs(bigArea)) { - bigLoop = &areal->loops[ii]; + bigLoop = &loop; bigArea = area; } } } - } else if (const auto linear = dynamic_cast(shape)) { + } else if (const auto linear = dynamic_cast(shape)) + { const GeoCoord midCoord = linear->geoMbr.mid(); centroid.x() = midCoord.x(); centroid.y() = midCoord.y(); return true; - } else if (const auto linear3d = dynamic_cast(shape)) { + } + else if (const auto linear3d = dynamic_cast(shape)) + { const GeoCoord midCoord = linear3d->geoMbr.mid(); centroid.x() = midCoord.x(); centroid.y() = midCoord.y(); return true; - } else if (const auto pts = dynamic_cast(shape)) { + } + else if (const auto pts = dynamic_cast(shape)) + { const GeoCoord midCoord = pts->geoMbr.mid(); centroid.x() = midCoord.x(); centroid.y() = midCoord.y(); @@ -181,19 +219,19 @@ bool VectorObject::centroid(Point2d ¢roid) const bool VectorObject::largestLoopCenter(Point2d ¢er,Point2d &ll,Point2d &ur) const { // Find the loop with the largest area - float bigArea = -1.0; + double bigArea = -1.0; const VectorRing *bigLoop = nullptr; for (const auto &shape : shapes) { const auto areal = dynamic_cast(shape.get()); - if (areal && areal->loops.size() > 0) + if (areal && !areal->loops.empty()) { - for (unsigned int ii=0;iiloops.size();ii++) + for (const auto &loop : areal->loops) { - const float area = std::abs(CalcLoopArea(areal->loops[ii])); + const auto area = std::abs(CalcLoopArea(loop)); if (area > bigArea) { - bigLoop = &areal->loops[ii]; + bigLoop = &loop; bigArea = area; } } @@ -240,7 +278,7 @@ bool VectorObject::linearMiddle(Point2d &middle,double &rot) const const float len = (pts[ii+1]-pts[ii]).norm(); totLen += len; } - const float halfLen = totLen / 2.0; + const float halfLen = totLen / 2.0f; // Now we'll walk along, looking for the middle float lenSoFar = 0.0; @@ -273,7 +311,7 @@ bool VectorObject::linearMiddle(Point2d &middle,double &rot) const const float len = (pts[ii+1]-pts[ii]).norm(); totLen += len; } - const float halfLen = totLen / 2.0; + const float halfLen = totLen / 2.0f; // Now we'll walk along, looking for the middle float lenSoFar = 0.0; @@ -334,10 +372,10 @@ bool VectorObject::linearMiddle(Point2d &middle,double &rot,CoordSystem *coordSy const float len = (pts[ii+1]-pts[ii]).norm(); totLen += len; } - const float halfLen = totLen / 2.0; + const float halfLen = totLen / 2.0f; // Now we'll walk along, looking for the middle - float lenSoFar = 0.0; + double lenSoFar = 0.0; for (unsigned int ii=0;iigeographicToLocal3d(GeoCoord(pts[ii].x(),pts[ii].y())); @@ -350,7 +388,7 @@ bool VectorObject::linearMiddle(Point2d &middle,double &rot,CoordSystem *coordSy const GeoCoord middleGeo = coordSys->localToGeographic(thePt); middle.x() = middleGeo.x(); middle.y() = middleGeo.y(); - rot = M_PI/2.0-atan2(pt1.y()-pt0.y(),pt1.x()-pt0.x()); + rot = M_PI_2 - atan2(pt1.y()-pt0.y(),pt1.x()-pt0.x()); return true; } @@ -380,10 +418,10 @@ bool VectorObject::linearMiddle(Point2d &middle,double &rot,CoordSystem *coordSy const float len = (pts[ii+1]-pts[ii]).norm(); totLen += len; } - const float halfLen = totLen / 2.0; + const double halfLen = totLen / 2.0; // Now we'll walk along, looking for the middle - float lenSoFar = 0.0; + double lenSoFar = 0.0; for (unsigned int ii=0;iilocalToGeographic(thePt); middle.x() = middleGeo.x(); middle.y() = middleGeo.y(); - rot = M_PI/2.0-atan2(pt1.y()-pt0.y(),pt1.x()-pt0.x()); + rot = M_PI_2 - atan2(pt1.y()-pt0.y(),pt1.x()-pt0.x()); return true; } @@ -717,7 +755,7 @@ bool VectorObject::pointNearLinear(const Point2d &coord,float maxDistance, return false; } - + double VectorObject::areaOfOuterLoops() const { double area = 0.0; @@ -726,45 +764,50 @@ double VectorObject::areaOfOuterLoops() const const auto areal = dynamic_cast(shape.get()); if (areal && !areal->loops.empty()) { - area = CalcLoopArea(areal->loops[0]); + area += CalcLoopArea(areal->loops[0]); } } return area; } - + bool VectorObject::boundingBox(Point2d &ll,Point2d &ur) const { - bool valid = false; Mbr mbr; for (const auto &shape : shapes) { const GeoMbr geoMbr = shape->calcGeoMbr(); - mbr.addPoint(geoMbr.ll()); - mbr.addPoint(geoMbr.ur()); - valid = true; + if (geoMbr.valid()) + { + mbr.addPoint(geoMbr.ll()); + mbr.addPoint(geoMbr.ur()); + } } - if (valid) + if (mbr.valid()) { ll.x() = mbr.ll().x(); ll.y() = mbr.ll().y(); ur.x() = mbr.ur().x(); ur.y() = mbr.ur().y(); + return true; } - - return valid; + return false; } void VectorObject::addHole(const VectorRing &hole) { + if (shapes.empty()) + { + return; + } const auto areal = dynamic_cast(shapes.begin()->get()); if (areal) { areal->loops.push_back(hole); } } - + VectorObjectRef VectorObject::deepCopy() const { auto newVecObj = std::make_shared(); @@ -1068,7 +1111,97 @@ static void fixEdges(const VectorRing& outPts2D, VectorRing& offsetPts2D) offsetPts2D.back() = outPts2D.back() + Point2f(xOff,0.0); } -static const GeographicLib::Geodesic &wgs84Geodesic = GeographicLib::Geodesic::WGS84(); +template +static inline Point3d toGeocentric(const Eigen::Matrix &p, double geoidHeight = 0.0) +{ + double x = 0, y = 0, z = 0; + wgs84Geocentric().Forward(WhirlyKit::RadToDeg(p.y()), + WhirlyKit::RadToDeg(p.x()), + geoidHeight, x, y, z); + return {x,y,z}; +} + +// Test for any intersections among non-consecutive segments. +// If `close` is true, consider an implicit segment from end-begin, if those are not equal. +template +static bool anyIntersect(const TIter beg, const TIter end, bool close) +{ + if (std::distance(beg, end) < 4) + { + // triangles can't self-intersect + return false; + } + + // We consider intersection between the segment from the current point + // to the next and the segment *after* the next, adjacent segment. + auto ia = beg; + auto ib = std::next(beg, 1); + + auto a = Point3d(); + auto b = toGeocentric(*ia); + + for (;; ib = std::next(ia = ib)) + { + auto ic = std::next(ib); + if (ic == end) + { + break; + } + + a = b; + b = toGeocentric(*ib); + + auto id = std::next(ic); + + // Convert initial points to geocentric for intersection calculations + auto c = Point3d(); + auto d = toGeocentric(*ic); + + for (; ; id = std::next(ic = id)) + { + // We have considered the final segment and might be done... + if (id == end) + { + // Unless we need to consider the implicit segment from the last to the first point... + if (close) + { + // Are those equal? + if (*ic == *beg) + { + // Yes, the sequence is explicitly closed, so we are done. + break; + } + else + { + // No, check the implicit closing segment by wrapping to the first point + id = beg; + } + } + else + { + break; + } + } + + // Step forward + c = d; + d = toGeocentric(*id); + + // Check A-B against C-D + if (Geocentric::checkIntersection(a, b, c, d, wgs84Geodesic())) + { + return true; + } + + if (id == beg) + { + // wrap-around case + break; + } + } + } + return false; +} static std::pair CalcInv(const Point2f &p1, const Point2f &p2) { @@ -1077,7 +1210,7 @@ static std::pair CalcInv(const Point2f &p1, const Point2f &p2) const auto lat2 = WhirlyKit::RadToDeg(p2.y()); const auto lon2 = WhirlyKit::RadToDeg(p2.x()); double dist = 0.0, az1 = 0.0, az2 = 0.0; - wgs84Geodesic.Inverse(lat1, lon1, lat2, lon2, dist, az1, az2); + detail::wgs84Geodesic().Inverse(lat1, lon1, lat2, lon2, dist, az1, az2); return std::make_pair(dist,WhirlyKit::DegToRad(az1)); } @@ -1088,7 +1221,7 @@ static std::pair CalcDirect(const Point2f &origin, double az, doub const auto azDeg = WhirlyKit::RadToDeg(az); double lat2 = 0.0, lon2 = 0.0; - const auto res = wgs84Geodesic.Direct(lat1, lon1, azDeg, dist, lat2, lon2); + const auto res = detail::wgs84Geodesic().Direct(lat1, lon1, azDeg, dist, lat2, lon2); return std::make_pair(std::isfinite(res), Point2f((float)WhirlyKit::DegToRad(lon2), @@ -1144,7 +1277,7 @@ static void SubdivideGeoLib(Tin beg, Tin end, Tout out, double maxDistMeters) template struct Adapt3dTo2f : std::vector::const_iterator { - Adapt3dTo2f(T i) : _i(i) {} + explicit Adapt3dTo2f(T i) : _i(i) {} Adapt3dTo2f(const Adapt3dTo2f &i) : _i(i._i) {} Point2f operator*() const { return Point2f(_i->x(),_i->y()); } Adapt3dTo2f& operator++() { ++_i; return *this; } @@ -1155,7 +1288,7 @@ template struct Adapt3dTo2f : std::vector::const_iterator }; template struct Adapt2fTo3d { - Adapt2fTo3d(T i) : _i(i) {} + explicit Adapt2fTo3d(T i) : _i(i) {} Adapt2fTo3d& operator*() { return *this; } Adapt2fTo3d& operator++() { ++_i; return this; } Adapt2fTo3d operator++(int) { auto x = *this; ++_i; return x; } @@ -1191,7 +1324,7 @@ void VectorObject::subdivideToInternal(float epsilon,WhirlyKit::CoordSystemDispl { CoordSystem *coordSys = adapter->getCoordSystem(); - const auto geoDist = useGeoLib ? epsilon * wgs84Geodesic.EquatorialRadius() : 0.0; + const auto geoDist = useGeoLib ? epsilon * detail::wgs84Geodesic().EquatorialRadius() : 0.0; for (const auto &shapeRef : shapes) { @@ -1271,13 +1404,17 @@ VectorObjectRef VectorObject::linearsToAreals() const for (const auto &shape : shapes) { - if (const auto ar = std::dynamic_pointer_cast(shape)) { - newVec->shapes.insert(ar); - } else if (const auto ln = std::dynamic_pointer_cast(shape)) { - const auto newAr = VectorAreal::createAreal(); + if (const auto ln = dynamic_cast(shape.get())) + { + auto newAr = VectorAreal::createAreal(); + newAr->setAttrDict(ln->getAttrDict()); newAr->loops.push_back(ln->pts); newVec->shapes.insert(newAr); } + else + { + newVec->shapes.insert(shape); + } } return newVec; @@ -1290,22 +1427,200 @@ VectorObjectRef VectorObject::arealsToLinears() const for (const auto &shape : shapes) { - if (const auto ar = dynamic_cast(shape.get())) + if (const auto ar = dynamic_cast(shape.get())) { - for (const auto &loop : ar->loops) { - const auto newLn = VectorLinear::createLinear(); + for (const auto &loop : ar->loops) + { + auto newLn = VectorLinear::createLinear(); newLn->setAttrDict(ar->getAttrDict()); newLn->pts = loop; - newVec->shapes.insert(newLn); + newVec->shapes.insert(std::move(newLn)); } - } else if (const auto ln = std::dynamic_pointer_cast(shape)) { - newVec->shapes.insert(ln); + } + else + { + newVec->shapes.insert(shape); } } - + return newVec; } - + +// Count collection contents castable to the specified type +template +static int count(TIter beg, TIter end) +{ + return (int)std::count_if(beg, end, [](const auto& s) { return dynamic_cast(s.get()); }); +} + +int VectorObject::countLinears() const +{ + return count(shapes.cbegin(), shapes.cend()); +} + +int VectorObject::countAreals() const +{ + return count(shapes.cbegin(), shapes.cend()); +} + +void VectorObject::reverseAreals() +{ + for (auto& shape : shapes) + { + if (auto areal = dynamic_cast(shape.get())) + { + for (auto &loop : areal->loops) + { + std::reverse(loop.begin(), loop.end()); + } + } + } +} + +VectorObjectRef VectorObject::reversedAreals() const +{ + auto newVec = std::make_shared(); + newVec->shapes.reserve(shapes.size()); + + for (const auto &shape : shapes) + { + if (const auto ar = dynamic_cast(shape.get())) + { + auto newAr = VectorAreal::createAreal(); + newAr->setAttrDict(ar->getAttrDict()); + newAr->loops.reserve(ar->loops.size()); + for (const auto &loop : ar->loops) + { + newAr->loops.emplace_back(loop.rbegin(), loop.rend()); + } + newVec->shapes.insert(newAr); + } + else + { + newVec->shapes.insert(shape); + } + } + + return newVec; +} + +int VectorObject::countClosedLoops() const +{ + int n = 0; + for (auto& shape : shapes) + { + if (auto areal = dynamic_cast(shape.get())) + { + for (auto &loop : areal->loops) + { + if (loop.size() > 2 && loop.front() == loop.back()) + { + ++n; + } + } + } + } + return n; +} + +int VectorObject::countUnClosedLoops() const +{ + int n = 0; + for (auto& shape : shapes) + { + if (auto areal = dynamic_cast(shape.get())) + { + for (auto &loop : areal->loops) + { + if (loop.size() > 2 && loop.front() != loop.back()) + { + ++n; + } + } + } + } + return n; +} + +void VectorObject::closeLoops() +{ + for (auto& shape : shapes) + { + if (auto areal = dynamic_cast(shape.get())) + { + for (auto &loop : areal->loops) + { + if (loop.size() > 2 && loop.front() != loop.back()) + { + loop.push_back(loop.front()); + } + } + } + } +} + +VectorObjectRef VectorObject::closedLoops() const +{ + if (auto newObj = deepCopy()) + { + newObj->closeLoops(); + return newObj; + } + return VectorObjectRef(); +} + +void VectorObject::unCloseLoops() +{ + for (auto& shape : shapes) + { + if (auto areal = dynamic_cast(shape.get())) + { + for (auto &loop : areal->loops) + { + if (loop.size() > 2 && loop.front() == loop.back()) + { + loop.pop_back(); + } + } + } + } +} + +VectorObjectRef VectorObject::unClosedLoops() const +{ + if (auto newObj = deepCopy()) + { + newObj->unCloseLoops(); + return newObj; + } + return VectorObjectRef(); +} + +bool VectorObject::anyIntersections() const +{ + for (const auto &shape : shapes) + { + if (const auto ln = dynamic_cast(shape.get())) + { + if (anyIntersect(ln->pts.cbegin(), ln->pts.cend(), false)) + { + return true; + } + } + else if (const auto ar = dynamic_cast(shape.get())) + { + for (const auto &loop : ar->loops) + { + if (anyIntersect(loop.cbegin(), loop.cend(), true)) + { + return true; + } + } + } + } + return false; +} + VectorObjectRef VectorObject::filterClippedEdges() const { auto newVec = std::make_shared(); @@ -1514,7 +1829,7 @@ void SampleGreatCircle(const Point2d &startPt,const Point2d &endPt,double height } void SampleGreatCircleStatic(const Point2d &startPt,const Point2d &endPt,double height,Point3dVector &pts, - const WhirlyKit::CoordSystemDisplayAdapter *coordAdapter,double samples) + const WhirlyKit::CoordSystemDisplayAdapter *coordAdapter,int minPts) { const bool isFlat = coordAdapter->isFlat(); @@ -1529,7 +1844,9 @@ void SampleGreatCircleStatic(const Point2d &startPt,const Point2d &endPt,double VectorRing3d tmpPts; tmpPts.reserve(10); // ? - SubdivideEdgesToSurfaceGC(inPts, tmpPts, false, coordAdapter, 1.0, 0.0, samples); + + + SubdivideEdgesToSurfaceGC(inPts, tmpPts, false, coordAdapter, 1.0, 0.0, minPts); pts = tmpPts; // To apply the height, we'll need the total length @@ -1550,9 +1867,9 @@ void SampleGreatCircleStatic(const Point2d &startPt,const Point2d &endPt,double lenSoFar += len; // Parabolic curve - const float b = 4*height; - const float a = -b; - const float thisHeight = a*(t*t) + b*t; + const double b = 4*height; + const double a = -b; + const double thisHeight = a*(t*t) + b*t; if (isFlat) pt.z() = thisHeight; diff --git a/common/WhirlyGlobeLib/src/VectorOffset.cpp b/common/WhirlyGlobeLib/src/VectorOffset.cpp index 4589f6d375..27b61c7efa 100644 --- a/common/WhirlyGlobeLib/src/VectorOffset.cpp +++ b/common/WhirlyGlobeLib/src/VectorOffset.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/4/21. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/VectorTilePBFParser.cpp b/common/WhirlyGlobeLib/src/VectorTilePBFParser.cpp index 50eb060dea..1b2170b7c0 100644 --- a/common/WhirlyGlobeLib/src/VectorTilePBFParser.cpp +++ b/common/WhirlyGlobeLib/src/VectorTilePBFParser.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Tim Sylvester on 10/30/20. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/VertexAttribute.cpp b/common/WhirlyGlobeLib/src/VertexAttribute.cpp index adc0243572..22f9c39f39 100644 --- a/common/WhirlyGlobeLib/src/VertexAttribute.cpp +++ b/common/WhirlyGlobeLib/src/VertexAttribute.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/VertexAttributeGLES.cpp b/common/WhirlyGlobeLib/src/VertexAttributeGLES.cpp index 10637dc575..e2e85816fb 100644 --- a/common/WhirlyGlobeLib/src/VertexAttributeGLES.cpp +++ b/common/WhirlyGlobeLib/src/VertexAttributeGLES.cpp @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/WhirlyGeometry.cpp b/common/WhirlyGlobeLib/src/WhirlyGeometry.cpp index 53ef3132bd..cb038c1bc5 100644 --- a/common/WhirlyGlobeLib/src/WhirlyGeometry.cpp +++ b/common/WhirlyGlobeLib/src/WhirlyGeometry.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/18/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/WhirlyKitView.cpp b/common/WhirlyGlobeLib/src/WhirlyKitView.cpp index 6d2423b12f..effe55707b 100644 --- a/common/WhirlyGlobeLib/src/WhirlyKitView.cpp +++ b/common/WhirlyGlobeLib/src/WhirlyKitView.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/9/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,27 +29,31 @@ using namespace Eigen; namespace WhirlyKit { -View::View() : - coordAdapter(nullptr) +View::View() { fieldOfView = 60.0 / 360.0 * 2 * M_PI; // 60 degree field of view - nearPlane = 0.001; imagePlaneSize = nearPlane * std::tan(fieldOfView / 2.0f); - farPlane = 10.0; - centerOffset = Point2d(0.0,0.0); lastChangedTime = TimeGetCurrent(); - continuousZoom = false; } -View::View(const View &that) - : fieldOfView(that.fieldOfView), nearPlane(that.nearPlane), imagePlaneSize(that.imagePlaneSize), - farPlane(that.farPlane), lastChangedTime(that.lastChangedTime), continuousZoom(that.continuousZoom), - coordAdapter(that.coordAdapter) +View::View(const View &that) : + nearPlane(that.nearPlane), + farPlane(that.farPlane), + fieldOfView(that.fieldOfView), + imagePlaneSize(that.imagePlaneSize), + lastChangedTime(that.lastChangedTime), + continuousZoom(that.continuousZoom), + coordAdapter(that.coordAdapter), + centerOffset(that.centerOffset) { } - + void View::calcFrustumWidth(unsigned int frameWidth,unsigned int frameHeight,Point2d &ll,Point2d &ur,double & near,double &far) { + if (frameWidth == 0) + { + return; + } ll.x() = -imagePlaneSize; ur.x() = imagePlaneSize; const double ratio = ((double)frameHeight / (double)frameWidth); diff --git a/common/WhirlyGlobeLib/src/WhirlyOctEncoding.cpp b/common/WhirlyGlobeLib/src/WhirlyOctEncoding.cpp index a9897ca5fb..f4c43a59ee 100644 --- a/common/WhirlyGlobeLib/src/WhirlyOctEncoding.cpp +++ b/common/WhirlyGlobeLib/src/WhirlyOctEncoding.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by @jmnavarro on 7/2/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/WhirlyGlobeLib/src/WhirlyVector.cpp b/common/WhirlyGlobeLib/src/WhirlyVector.cpp index 434a542a49..176e8a77b8 100644 --- a/common/WhirlyGlobeLib/src/WhirlyVector.cpp +++ b/common/WhirlyGlobeLib/src/WhirlyVector.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/25/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -670,7 +670,7 @@ static struct UnitTests { //geoMbrOverlap(); //geoMbrOverlap(); - wkLog("Vector unit tests passed"); + wkLogLevel(Info, "Vector unit tests passed"); } template void genericMbr() { using TP = typename T::value_type; diff --git a/common/WhirlyGlobeLib/src/WideVectorDrawableBuilder.cpp b/common/WhirlyGlobeLib/src/WideVectorDrawableBuilder.cpp index 05bb11f69b..128eefdda8 100644 --- a/common/WhirlyGlobeLib/src/WideVectorDrawableBuilder.cpp +++ b/common/WhirlyGlobeLib/src/WideVectorDrawableBuilder.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/29/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,11 +36,7 @@ WideVectorDrawableBuilder::WideVectorDrawableBuilder(std::string name, p1_index(-1), n0_index(-1), offset_index(-1), c0_index(-1), tex_index(-1) { } - -WideVectorDrawableBuilder::~WideVectorDrawableBuilder() -{ -} - + void WideVectorDrawableBuilder::Init(unsigned int numVert, unsigned int numTri, unsigned int numCenterline, @@ -55,8 +51,14 @@ void WideVectorDrawableBuilder::Init(unsigned int numVert, basicDrawable->Init(); basicDrawable->setupStandardAttributes(); basicDrawable->setType(Triangles); - basicDrawable->points.reserve(numVert); - basicDrawable->tris.reserve(numTri); + if (numVert > 0) + { + basicDrawable->points.reserve(numVert); + } + if (numTri > 0) + { + basicDrawable->tris.reserve(numTri); + } if (implType == WideVecImplPerf) { instDrawable = renderer->makeBasicDrawableInstanceBuilder(name); diff --git a/common/WhirlyGlobeLib/src/WideVectorDrawableBuilderGLES.cpp b/common/WhirlyGlobeLib/src/WideVectorDrawableBuilderGLES.cpp index 71ec360e36..1f7ef62fb6 100644 --- a/common/WhirlyGlobeLib/src/WideVectorDrawableBuilderGLES.cpp +++ b/common/WhirlyGlobeLib/src/WideVectorDrawableBuilderGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/14/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,11 +35,12 @@ void WideVectorTweakerGLES::tweakForFrame(Drawable *inDraw,RendererFrameInfo *fr return; } - const double frameSize = std::min(frameInfo->sceneRenderer->framebufferWidth, frameInfo->sceneRenderer->framebufferHeight); + const Point2f frameSize = frameInfo->sceneRenderer->getFramebufferSize(); + const double frameSpan = std::min(frameSize.x(), frameSize.y()); const double screenSize = std::min(frameInfo->screenSizeInDisplayCoords.x(), frameInfo->screenSizeInDisplayCoords.y()); const double screenWidth = frameInfo->screenSizeInDisplayCoords.x(); - const double pixDispScale = screenSize / frameSize; - const double texScale = frameSize / (screenWidth * texRepeat); + const double pixDispScale = screenSize / frameSpan; + const double texScale = frameSpan / (screenWidth * texRepeat); const float zoom = (opacityExp || colorExp || widthExp) ? getZoom(*inDraw,*frameInfo->scene,0.0f) : 0.0f; Vector4f c = colorExp ? colorExp->evaluateF(zoom,color) : color.asRGBAVecF(); @@ -149,7 +150,7 @@ varying vec4 v_color; void main() { v_color = a_color; - float t0 = clamp(a_c0 * u_real_w2,-4.0,5.0); // Position along the line + float t0 = clamp(a_c0 * u_real_w2,-1.0,2.0); // Position along the line vec3 v = a_p1 - a_position; vec3 dir = normalize(v); float realCenterLine = a_offset.z * u_wideOffset * u_real_w2 / u_w2; @@ -191,7 +192,7 @@ varying float v_dot; void main() { v_color = a_color; - float t0 = clamp(a_c0 * u_real_w2,-4.0,5.0); // Position along the line + float t0 = clamp(a_c0 * u_real_w2,-1.0,2.0); // Position along the line vec3 v = a_p1 - a_position; vec3 dir = normalize(v); float realCenterLine = a_offset.z * u_wideOffset * u_real_w2 / u_w2; diff --git a/common/WhirlyGlobeLib/src/WideVectorManager.cpp b/common/WhirlyGlobeLib/src/WideVectorManager.cpp index 3cbd6632cd..dd51dbf164 100644 --- a/common/WhirlyGlobeLib/src/WideVectorManager.cpp +++ b/common/WhirlyGlobeLib/src/WideVectorManager.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/29/14. - * Copyright 2011-2021 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,42 +29,59 @@ using namespace Eigen; namespace WhirlyKit { -WideVectorInfo::WideVectorInfo() : - implType(WideVecImplBasic), color(RGBAColor::white()), width(2.0), - repeatSize(32.0), edgeSize(1.0), subdivEps(0.0), - coordType(WideVecCoordScreen), joinType(WideVecMiterJoin), capType(WideVecButtCap), - texID(EmptyIdentity), miterLimit(2.0), offset(0.0f) -{ -} WideVectorInfo::WideVectorInfo(const Dictionary &dict) : BaseInfo(dict) { - implType = WideVecImplBasic; - std::string implTypeStr = dict.getString(MaplyWideVecImpl); - if (!implTypeStr.compare(MaplyWideVecImplPerf)) - implType = WideVecImplPerf; - color = dict.getColor(MaplyColor,RGBAColor::white()); - width = dict.getDouble(MaplyVecWidth,2.0); - offset = (float)-dict.getDouble(MaplyWideVecOffset,0.0); - std::string coordTypeStr = dict.getString(MaplyWideVecCoordType); - subdivEps = (float)dict.getDouble(MaplySubdivEpsilon,0.0); - coordType = WideVecCoordScreen; + color = dict.getColor(MaplyColor,color); + width = dict.getDouble(MaplyVecWidth,width); + offset = (float)-dict.getDouble(MaplyWideVecOffset,-offset); + subdivEps = (float)dict.getDouble(MaplySubdivEpsilon,subdivEps); + texID = dict.getInt(MaplyVecTexture,EmptyIdentity); + repeatSize = (float)dict.getDouble(MaplyWideVecTexRepeatLen,repeatSize); + edgeSize = (float)dict.getDouble(MaplyWideVecEdgeFalloff,edgeSize); + miterLimit = (float)dict.getDouble(MaplyWideVecMiterLimit,miterLimit); + + const std::string implTypeStr = dict.getString(MaplyWideVecImpl); + implType = implTypeStr.compare(MaplyWideVecImplPerf) ? WideVecImplBasic : WideVecImplPerf; + + closeAreals = dict.getBool(MaplyVecCloseAreals, closeAreals); + + const std::string coordTypeStr = dict.getString(MaplyWideVecCoordType); if (!coordTypeStr.compare(MaplyWideVecCoordTypeReal)) coordType = WideVecCoordReal; else if (!coordTypeStr.compare(MaplyWideVecCoordTypeScreen)) coordType = WideVecCoordScreen; - joinType = WideVecMiterJoin; - std::string jointTypeStr = dict.getString(MaplyWideVecJoinType); - capType = WideVecButtCap; + // Note: Not supporting this right now - // _joinType = (WhirlyKit::WideVectorLineJoinType)[desc enumForKey:@"wideveclinejointype" values:@[@"miter",@"round",@"bevel"] default:WideVecMiterJoin]; - // std::String capTypeStr = dict.getString(MaplyWideVecCapType); - // _capType = (WhirlyKit::WideVectorLineCapType)[desc enumForKey:@"wideveclinecaptype" values:@[@"butt",@"round",@"square"] default:WideVecButtCap]; - texID = dict.getInt(MaplyVecTexture,EmptyIdentity); - repeatSize = (float)dict.getDouble(MaplyWideVecTexRepeatLen,32); - edgeSize = (float)dict.getDouble(MaplyWideVecEdgeFalloff,1.0); - miterLimit = (float)dict.getDouble(MaplyWideVecMiterLimit,2.0); + //const std::string jointTypeStr = dict.getString(MaplyWideVecJoinType); + //_joinType = (WhirlyKit::WideVectorLineJoinType)[desc enumForKey:@"wideveclinejointype" values:@[@"miter",@"round",@"bevel"] default:WideVecMiterJoin]; + //const std::string capTypeStr = dict.getString(MaplyWideVecCapType); + //_capType = (WhirlyKit::WideVectorLineCapType)[desc enumForKey:@"wideveclinecaptype" values:@[@"butt",@"round",@"square"] default:WideVecButtCap]; +} + +std::string WideVectorInfo::toString() const +{ + std::ostringstream ss; + ss << "\n" + << "color=" << color.asARGBInt() << "\n" + << "width=" << width << "\n" + << "offset=" << offset << "\n" + << "repeat=" << repeatSize << "\n" + << "edge=" << edgeSize << "\n" + << "subdivEps" << subdivEps << "\n" + << "miterLimit" << miterLimit << "\n" + << "closeAreals" << closeAreals << "\n" + << "implType=" << implType << "\n" + << "coordType=" << coordType << "\n" + << "joinType=" << joinType << "\n" + << "capType=" << capType << "\n" + << "texID=" << texID << "\n" + << "widthExp=" << (widthExp ? /*widthExp->toString()*/"(set)" : "(none)") << "\n" // todo + << "offsetExp=" << (offsetExp ? /*offsetExp->toString()*/"(set)" : "(none)") << "\n" // todo + << "opacityExp=" << (opacityExp ? /*opacityExp->toString()*/"(set)" : "(none)") << "\n" // todo + << "colorExp=" << (colorExp ? /*colorExp->toString()*/"(set)" : "(none)") << "\n"; // todo + return BaseInfo::toString() + ss.str(); } // Turn this on for smaller texture lengths @@ -417,8 +434,8 @@ class WideVectorBuilder { WideVectorLineJoinType joinType = vecInfo->joinType; // Switch to a bevel join if the angle is too great for a miter - double miterLimit = vecInfo->miterLimit; - if (joinType == WideVecMiterJoin && angleBetween > (M_PI-miterLimit*M_PI/180.0)) + const double miterLimit = vecInfo->miterLimit * M_PI / 180.0; + if (joinType == WideVecMiterJoin && angleBetween > (M_PI - miterLimit)) joinType = WideVecBevelJoin; // We don't do bevels below 30 degrees if (joinType == WideVecBevelJoin && angleBetween > 150.0 / 180.0 * M_PI) @@ -552,7 +569,7 @@ class WideVectorBuilder // Add a point to the widened linear we're building - void addPoint(const Point3d &inPt,const Point3d &up,WideVectorDrawableBuilderRef &drawable,bool closed,bool buildSegment,bool buildJunction) + void addPoint(const Point3d &inPt,const Point3d &up,const WideVectorDrawableBuilderRef &drawable,bool closed,bool buildSegment,bool buildJunction) { // Compare with the last point, if it's the same, toss it if (!pts.empty() && pts.back() == inPt && !closed) @@ -570,7 +587,7 @@ class WideVectorBuilder } // Flush out any outstanding points - void flush(WideVectorDrawableBuilderRef &drawable,bool buildLastSegment, bool buildLastJunction) + void flush(const WideVectorDrawableBuilderRef &drawable,bool buildLastSegment, bool buildLastJunction) { if (pts.size() >= 2) { @@ -600,14 +617,21 @@ class WideVectorBuilder }; // Used to build up drawables -class WideVectorDrawableConstructor +struct WideVectorDrawableConstructor { -public: - WideVectorDrawableConstructor(SceneRenderer *sceneRender,Scene *scene,const WideVectorInfo *vecInfo,int numMaskIDs) - : sceneRender(sceneRender), scene(scene), vecInfo(vecInfo), drawable(nullptr), centerValid(false), localCenter(0,0,0), dispCenter(0,0,0), numMaskIDs(numMaskIDs) + WideVectorDrawableConstructor(SceneRenderer *sceneRender, + Scene *scene, + const WideVectorInfo *vecInfo, + int numMaskIDs, + bool doColors) : + sceneRender(sceneRender), + scene(scene), + vecInfo(vecInfo), + numMaskIDs(numMaskIDs), + doColors(doColors), + coordAdapter(scene->getCoordAdapter()), + coordSys(scene->getCoordAdapter()->getCoordSystem()) { - coordAdapter = scene->getCoordAdapter(); - coordSys = coordAdapter->getCoordSystem(); } // Center to use for drawables we create @@ -617,9 +641,20 @@ class WideVectorDrawableConstructor localCenter = newLocalCenter; dispCenter = newDispCenter; } - + + void setColor(const RGBAColor &c) + { + if (doColors && c != color) + { + flush(); + color = c; + } + } + // Build or return a suitable drawable (depending on the mode) - WideVectorDrawableBuilderRef getDrawable(int ptCount,int triCount,int ptCountAllocate,int triCountAllocate,int clineCount) + WideVectorDrawableBuilderRef getDrawable(int ptCount,int triCount, + int ptCountAllocate,int triCountAllocate, + int clineCount) { if (vecInfo->implType == WideVecImplPerf) { // Performance mode uses instancing and makes the renderer do the work @@ -628,7 +663,7 @@ class WideVectorDrawableConstructor { flush(); - WideVectorDrawableBuilderRef wideDrawable = sceneRender->makeWideVectorDrawableBuilder("Wide Vector"); + auto wideDrawable = sceneRender->makeWideVectorDrawableBuilder("Wide Vector"); wideDrawable->Init(ptCountAllocate,triCountAllocate,clineCount, vecInfo->implType, !scene->getCoordAdapter()->isFlat(), @@ -651,6 +686,10 @@ class WideVectorDrawableConstructor maskEntries[ii] = wideDrawable->addAttribute(BDIntType, a_maskNameIDs[ii], sceneRender->getSlotForNameID(a_maskNameIDs[ii]), ptCount); drawable->setColor(vecInfo->color); + if (doColors) + { + drawable->setColor(color); + } int baseTexId = 0; if (vecInfo->texID != EmptyIdentity) @@ -700,6 +739,11 @@ class WideVectorDrawableConstructor maskEntries[ii] = wideDrawable->addAttribute(BDIntType, a_maskNameIDs[ii], sceneRender->getSlotForNameID(a_maskNameIDs[ii]), ptAlloc); drawable->setColor(vecInfo->color); + if (doColors) + { + drawable->setColor(color); + } + int baseTexId = 0; if (vecInfo->texID != EmptyIdentity) drawable->setTexId(baseTexId++, vecInfo->texID); @@ -811,12 +855,7 @@ class WideVectorDrawableConstructor makeDistinctTurns = true; if (pts.size() > 2) { - if (pts.front() == pts.back()) - { - startPoint = -3; - } else { - startPoint = -2; - } + startPoint = (pts.front() == pts.back()) ? -3 : -2; } } @@ -832,33 +871,32 @@ class WideVectorDrawableConstructor // Guess at how many points and triangles we'll need int totalTriCount = (int)(5*pts.size()); int totalPtCount = totalTriCount * 3; - if (totalTriCount < 0) totalTriCount = 0; - if (totalPtCount < 0) totalPtCount = 0; - + // Work through the segments Point2f lastPt; bool validLastPt = false; for (int ii=startPoint;ii<(int)pts.size();ii++) { - // Get the points in display space - Point2f geoA = pts[(ii+pts.size())%pts.size()]; - + // Get the points in display space. + // Note that we may be starting with a negative index. + const Point2f &geoA = pts[(ii + pts.size()) % pts.size()]; + if (validLastPt && geoA == lastPt) + { continue; + } + + const Point3d localPa = coordSys->geographicToLocal3d(GeoCoord(geoA.x(),geoA.y())); + const Point3d dispPa = coordAdapter->localToDisplay(localPa); + const Point3d thisUp = coordAdapter->isFlat() ? up : coordAdapter->normalForLocal(localPa); - Point3d localPa = coordSys->geographicToLocal3d(GeoCoord(geoA.x(),geoA.y())); - Point3d dispPa = coordAdapter->localToDisplay(localPa); - Point3d thisUp = up; - if (!coordAdapter->isFlat()) - thisUp = coordAdapter->normalForLocal(localPa); - // Get a drawable ready - int triCount = 2+3; - int ptCount = triCount*3; - WideVectorDrawableBuilderRef thisDrawable = getDrawable(ptCount,triCount,totalPtCount,totalTriCount,0); + const int triCount = 2+3; + const int ptCount = triCount*3; + auto thisDrawable = getDrawable(ptCount,triCount,totalPtCount,totalTriCount,0); vecBuilder.maskEntries = maskEntries; - totalTriCount -= triCount; - totalPtCount -= ptCount; + totalTriCount -= std::min(triCount,totalTriCount); + totalPtCount -= std::min(ptCount, totalPtCount); drawMbr.addPoint(geoA); bool doSegment = !closed || (ii > 0); @@ -955,17 +993,20 @@ class WideVectorDrawableConstructor drawable = nullptr; } - bool centerValid; - int numMaskIDs; + bool centerValid = false; + int numMaskIDs = 0; std::vector maskEntries; - Point3d localCenter,dispCenter; + Point3d localCenter = {0,0,0}; + Point3d dispCenter = {0,0,0}; Mbr drawMbr; - SceneRenderer *sceneRender; - Scene *scene; - CoordSystemDisplayAdapter *coordAdapter; - CoordSystem *coordSys; + SceneRenderer *sceneRender = nullptr; + Scene *scene = nullptr; + CoordSystemDisplayAdapter *coordAdapter = nullptr; + CoordSystem *coordSys = nullptr; + bool doColors = false; + RGBAColor color = RGBAColor::white(); const WideVectorInfo *vecInfo; - WideVectorDrawableBuilderRef drawable; + WideVectorDrawableBuilderRef drawable = nullptr; std::vector drawables; }; @@ -998,16 +1039,22 @@ WideVectorManager::~WideVectorManager() sceneReps.clear(); } +static const std::string colorStr = "color"; // NOLINT(cert-err58-cpp) constructor can throw static const std::string maskID0 = "maskID0"; // NOLINT SimpleIdentity WideVectorManager::addVectors(const std::vector &shapes,const WideVectorInfo &vecInfo,ChangeSet &changes) { // Calculate a center for this geometry + bool doColors = false; bool hasMaskIDs = false; GeoMbr geoMbr; for (const auto &shape : shapes) { - if (!hasMaskIDs && shape->getAttrDict()->hasField(maskID0)) + if (!doColors && shape->getAttrDictRef()->hasField(colorStr)) + { + doColors = true; + } + if (!hasMaskIDs && shape->getAttrDictRef()->hasField(maskID0)) { hasMaskIDs = true; } @@ -1020,7 +1067,8 @@ SimpleIdentity WideVectorManager::addVectors(const std::vector & return EmptyIdentity; } - WideVectorDrawableConstructor builder(renderer,scene,&vecInfo,hasMaskIDs ? WhirlyKitMaxMasks : 0); + const int maskIDs = hasMaskIDs ? WhirlyKitMaxMasks : 0; + WideVectorDrawableConstructor builder(renderer,scene,&vecInfo,maskIDs,doColors); const GeoCoord centerGeo = geoMbr.mid(); @@ -1030,10 +1078,18 @@ SimpleIdentity WideVectorManager::addVectors(const std::vector & const auto centerUp = coordAdapter->isFlat() ? Point3d(0,0,1) : coordAdapter->normalForLocal(localCenter); builder.setCenter(localCenter,centerDisp); + builder.setColor(vecInfo.color); VectorRing tempLoop; for (const auto &shape : shapes) { + const auto &attrs = shape->getAttrDictRef(); + + if (attrs->hasField(colorStr)) + { + builder.setColor(attrs->getColor(colorStr, vecInfo.color)); + } + // Look for mask IDs. // Only support 2 for now std::vector maskIDs; @@ -1042,9 +1098,9 @@ SimpleIdentity WideVectorManager::addVectors(const std::vector & for (unsigned int ii=0;ii<2;ii++) { std::string attrName = "maskID" + std::to_string(ii); - if (shape->getAttrDict()->hasField(attrName)) + if (attrs->hasField(attrName)) { - maskIDs.push_back(shape->getAttrDict()->getInt64(attrName)); + maskIDs.push_back(attrs->getInt64(attrName)); } } } @@ -1057,7 +1113,7 @@ SimpleIdentity WideVectorManager::addVectors(const std::vector & } } - if (const auto lin = std::dynamic_pointer_cast(shape)) + if (const auto lin = dynamic_cast(shape.get())) { builder.addLinear(lin->pts, centerUp, maskIDs, false); } @@ -1065,17 +1121,26 @@ SimpleIdentity WideVectorManager::addVectors(const std::vector & { for (const auto &loop : ar->loops) { - if (loop.size() > 2 && (loop.begin() != loop.end() && vecInfo.implType != WideVecImplPerf)) + if (loop.size() < 2) { - // Just tack on another point at the end. Kind of dumb, but easy. - tempLoop = loop; - tempLoop.push_back(loop[0]); - builder.addLinear(tempLoop, centerUp, maskIDs, true); + continue; } - else + + // todo: sample/subdivide edges + + const auto *theLoop = &loop; + if (vecInfo.closeAreals && loop.size() > 2 && (loop.front() != loop.back())) { - builder.addLinear(loop, centerUp, maskIDs, true); + // Just tack on another point at the end. Kind of dumb, but easy. + tempLoop.clear(); + tempLoop.reserve(loop.size() + 1); + tempLoop.assign(loop.begin(), loop.end()); + tempLoop.push_back(loop.front()); + theLoop = &tempLoop; } + + const bool isClosed = (theLoop->front() == theLoop->back()); + builder.addLinear(*theLoop, centerUp, maskIDs, isClosed); } } } diff --git a/common/WhirlyGlobeLib/src/WrapperGLES.cpp b/common/WhirlyGlobeLib/src/WrapperGLES.cpp index fc08a168b3..a1b3cf97fb 100644 --- a/common/WhirlyGlobeLib/src/WrapperGLES.cpp +++ b/common/WhirlyGlobeLib/src/WrapperGLES.cpp @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/18/13. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common/local_libs/nanopb/maply_pb_names.h b/common/local_libs/nanopb/maply_pb_names.h index 80947570ac..ed5c28f5a4 100644 --- a/common/local_libs/nanopb/maply_pb_names.h +++ b/common/local_libs/nanopb/maply_pb_names.h @@ -3,7 +3,7 @@ // WhirlyGlobeMaplyComponent // // Created by Tim Sylvester on 11/2/20. -// Copyright © 2020 mousebird consulting. All rights reserved. +// Copyright 2020 mousebird consulting. All rights reserved. // #ifndef maply_pb_names_h diff --git a/doc/TestCaseStatus.yaml b/doc/TestCaseStatus.yaml index c1bbc5d6e4..505ab7c3f3 100644 --- a/doc/TestCaseStatus.yaml +++ b/doc/TestCaseStatus.yaml @@ -462,10 +462,9 @@ cases: Map: ✓ Globe: ✓ Issues: - - Loader sometimes not shutting down when cycling styles, leaving map elements behind - Needs `imageVectorHybrid` even when not really appropriate Issues: - - Highway shield markers + text don't work correctly + - Highway shield markers + text don't align precisely - Blocky basemaps sometimes, adjust importance values? Checks: - Vector and hybrid styles display correctly diff --git a/ios/apps/AutoTester/AutoTester.xcodeproj/project.pbxproj b/ios/apps/AutoTester/AutoTester.xcodeproj/project.pbxproj index f0aace35ee..16e59e6aa3 100644 --- a/ios/apps/AutoTester/AutoTester.xcodeproj/project.pbxproj +++ b/ios/apps/AutoTester/AutoTester.xcodeproj/project.pbxproj @@ -43,7 +43,6 @@ 2B29944B243BA08D00677DE4 /* MapboxKindaMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B29944A243BA08D00677DE4 /* MapboxKindaMap.swift */; }; 2B29944D243BA16000677DE4 /* SimpleStyleTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B29944C243BA16000677DE4 /* SimpleStyleTestCase.swift */; }; 2B29944F243BA31900677DE4 /* cube.obj in Resources */ = {isa = PBXBuildFile; fileRef = 2B29944E243BA31900677DE4 /* cube.obj */; }; - 2B2A417E1D83454900098E12 /* ActiveObjectTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B2A417D1D83454900098E12 /* ActiveObjectTestCase.m */; }; 2B392B711C5AC59D001EE40B /* RunwayBuilderTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B392B701C5AC59D001EE40B /* RunwayBuilderTestCase.m */; }; 2B446AAE21EFE29B0078A975 /* WMSTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = E5679F451CB72DE800369A15 /* WMSTestCase.m */; }; 2B4B30AA2395E0DE00854073 /* MapboxTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B4B30A32395E0DE00854073 /* MapboxTestCase.swift */; }; @@ -109,6 +108,7 @@ 2BF29B8C24D2268200553963 /* LegendViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2BF29B8B24D2268200553963 /* LegendViewController.storyboard */; }; 2BF29B8F24D226B000553963 /* LegendViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BF29B8E24D226B000553963 /* LegendViewController.swift */; }; 2BFC7E511D132DCB0040E2A3 /* ScreenMarkersTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BFC7E501D132DCB0040E2A3 /* ScreenMarkersTestCase.m */; }; + 31041A3E27A4AE76004B25E1 /* ActiveObjectTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31041A3D27A4AE76004B25E1 /* ActiveObjectTestCase.swift */; }; 311E0A9C2680F597007BE16F /* ATS_Route.shp in Resources */ = {isa = PBXBuildFile; fileRef = 311E0A902680F597007BE16F /* ATS_Route.shp */; }; 311E0A9D2680F597007BE16F /* Airspace_Boundary.dbf in Resources */ = {isa = PBXBuildFile; fileRef = 311E0A912680F597007BE16F /* Airspace_Boundary.dbf */; }; 311E0A9E2680F597007BE16F /* Airspace_Boundary.shx in Resources */ = {isa = PBXBuildFile; fileRef = 311E0A922680F597007BE16F /* Airspace_Boundary.shx */; }; @@ -531,7 +531,7 @@ 8F981DB91DE3577C00717DF1 /* ne_10m_roads.prj in Resources */ = {isa = PBXBuildFile; fileRef = 8F981DB31DE3577C00717DF1 /* ne_10m_roads.prj */; }; 8F981DBB1DE3577C00717DF1 /* ne_10m_roads.shp in Resources */ = {isa = PBXBuildFile; fileRef = 8F981DB51DE3577C00717DF1 /* ne_10m_roads.shp */; }; 8F981DBC1DE3577C00717DF1 /* ne_10m_roads.shx in Resources */ = {isa = PBXBuildFile; fileRef = 8F981DB61DE3577C00717DF1 /* ne_10m_roads.shx */; }; - D8200C911BE92B2F00B22CF5 /* WideVectorsTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = D8200C901BE92B2F00B22CF5 /* WideVectorsTestCase.m */; }; + D8200C911BE92B2F00B22CF5 /* WideVectorsTestCase.mm in Sources */ = {isa = PBXBuildFile; fileRef = D8200C901BE92B2F00B22CF5 /* WideVectorsTestCase.mm */; }; D8200CA11BE9563F00B22CF5 /* StickersTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8200CA01BE9563F00B22CF5 /* StickersTestCase.swift */; }; D8200CA41BE9624300B22CF5 /* LoftedPolysTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = D8200CA31BE9624300B22CF5 /* LoftedPolysTestCase.m */; }; D8228A921BE77816001D6914 /* MovingScreenLabelsTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8228A911BE77816001D6914 /* MovingScreenLabelsTestCase.swift */; }; @@ -655,8 +655,6 @@ 2B29944A243BA08D00677DE4 /* MapboxKindaMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MapboxKindaMap.swift; path = "../../../library/WhirlyGlobe-MaplyComponent/src/helpers/MapboxKindaMap.swift"; sourceTree = ""; }; 2B29944C243BA16000677DE4 /* SimpleStyleTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimpleStyleTestCase.swift; sourceTree = ""; }; 2B29944E243BA31900677DE4 /* cube.obj */ = {isa = PBXFileReference; lastKnownFileType = text; name = cube.obj; path = resources/cube.obj; sourceTree = SOURCE_ROOT; }; - 2B2A417C1D83454900098E12 /* ActiveObjectTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActiveObjectTestCase.h; sourceTree = ""; }; - 2B2A417D1D83454900098E12 /* ActiveObjectTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ActiveObjectTestCase.m; sourceTree = ""; }; 2B361E3921237CFE0074D06D /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; 2B392B6F1C5AC59D001EE40B /* RunwayBuilderTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunwayBuilderTestCase.h; sourceTree = ""; }; 2B392B701C5AC59D001EE40B /* RunwayBuilderTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RunwayBuilderTestCase.m; sourceTree = ""; }; @@ -720,6 +718,7 @@ 2BF29B8E24D226B000553963 /* LegendViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegendViewController.swift; sourceTree = ""; }; 2BFC7E4F1D132DCB0040E2A3 /* ScreenMarkersTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScreenMarkersTestCase.h; sourceTree = ""; }; 2BFC7E501D132DCB0040E2A3 /* ScreenMarkersTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScreenMarkersTestCase.m; sourceTree = ""; }; + 31041A3D27A4AE76004B25E1 /* ActiveObjectTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActiveObjectTestCase.swift; sourceTree = ""; }; 311E0A902680F597007BE16F /* ATS_Route.shp */ = {isa = PBXFileReference; lastKnownFileType = file; name = ATS_Route.shp; path = ../../../resources/vectors/faa/ATS_Route.shp; sourceTree = SOURCE_ROOT; }; 311E0A912680F597007BE16F /* Airspace_Boundary.dbf */ = {isa = PBXFileReference; lastKnownFileType = file; name = Airspace_Boundary.dbf; path = ../../../resources/vectors/faa/Airspace_Boundary.dbf; sourceTree = SOURCE_ROOT; }; 311E0A922680F597007BE16F /* Airspace_Boundary.shx */ = {isa = PBXFileReference; lastKnownFileType = file; name = Airspace_Boundary.shx; path = ../../../resources/vectors/faa/Airspace_Boundary.shx; sourceTree = SOURCE_ROOT; }; @@ -1152,7 +1151,7 @@ 8F981DB61DE3577C00717DF1 /* ne_10m_roads.shx */ = {isa = PBXFileReference; lastKnownFileType = file; name = ne_10m_roads.shx; path = ../../../resources/vectors/ne_10m_roads/ne_10m_roads.shx; sourceTree = ""; }; 8FE129181CDFB3B8004744FC /* TestCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestCell.swift; sourceTree = ""; }; D8200C8F1BE92B2F00B22CF5 /* WideVectorsTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WideVectorsTestCase.h; sourceTree = ""; }; - D8200C901BE92B2F00B22CF5 /* WideVectorsTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WideVectorsTestCase.m; sourceTree = ""; }; + D8200C901BE92B2F00B22CF5 /* WideVectorsTestCase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WideVectorsTestCase.mm; sourceTree = ""; }; D8200C971BE93E6E00B22CF5 /* StarsSunTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StarsSunTestCase.swift; sourceTree = ""; }; D8200C9D1BE9516300B22CF5 /* ShapesTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShapesTestCase.h; sourceTree = ""; }; D8200CA01BE9563F00B22CF5 /* StickersTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StickersTestCase.swift; sourceTree = ""; }; @@ -1345,8 +1344,7 @@ 88BF115A1BCDA9530002205E /* testCases */ = { isa = PBXGroup; children = ( - 2B2A417C1D83454900098E12 /* ActiveObjectTestCase.h */, - 2B2A417D1D83454900098E12 /* ActiveObjectTestCase.m */, + 31041A3D27A4AE76004B25E1 /* ActiveObjectTestCase.swift */, 2B6611E525D1C35D009D228F /* AirwayTestCase.swift */, D8E12ECC1BDE9FD500BB7BC7 /* AnimatedBasemapTestCase.swift */, 2BD358F21DD3EA0400081EA8 /* AnimatedMarkersTestCase.swift */, @@ -1430,7 +1428,7 @@ 2BBB70811D5E9079009B67A6 /* VectorStyleTestCase.h */, 2BBB70821D5E9079009B67A6 /* VectorStyleTestCase.m */, D8200C8F1BE92B2F00B22CF5 /* WideVectorsTestCase.h */, - D8200C901BE92B2F00B22CF5 /* WideVectorsTestCase.m */, + D8200C901BE92B2F00B22CF5 /* WideVectorsTestCase.mm */, E5679F441CB72DE800369A15 /* WMSTestCase.h */, E5679F451CB72DE800369A15 /* WMSTestCase.m */, ); @@ -2608,7 +2606,6 @@ buildActionMask = 2147483647; files = ( 2B1E85A622B44D5800AB7208 /* BillboardTestCase.swift in Sources */, - 2B2A417E1D83454900098E12 /* ActiveObjectTestCase.m in Sources */, 2BA827CD225EBDBF00324594 /* GeoJSONStyleTestCase.swift in Sources */, E5679F481CB72DE800369A15 /* LabelAnimationTestCase.m in Sources */, 2BDEB3021C924842003259B3 /* ExtrudedModelTestCase.m in Sources */, @@ -2620,6 +2617,7 @@ 2B73D6B4207C106C00AF5095 /* GlobeSamplerTestCase.swift in Sources */, 2BC41C8521F00AA9002926B7 /* BNGTestCase.swift in Sources */, 311E0ABA268F7A09007BE16F /* ParticleTest.mm in Sources */, + 31041A3E27A4AE76004B25E1 /* ActiveObjectTestCase.swift in Sources */, 88BF11491BCD3DA40002205E /* MaplyTestCase.m in Sources */, D8341A731BE2DFE100411A46 /* ScreenLabelsTestCase.swift in Sources */, E5D2D6751DEDEABF00E02305 /* AnimationDelegateTestCase.swift in Sources */, @@ -2631,7 +2629,7 @@ 2B4B30AD2395E0DE00854073 /* LayerStartupShutdownTestCase.swift in Sources */, E5679F4A1CB72DE800369A15 /* FindHeightTestCase.m in Sources */, 2B158BEF1D5D19E900103E04 /* VectorHoleTestCase.m in Sources */, - D8200C911BE92B2F00B22CF5 /* WideVectorsTestCase.m in Sources */, + D8200C911BE92B2F00B22CF5 /* WideVectorsTestCase.mm in Sources */, 2B446AAE21EFE29B0078A975 /* WMSTestCase.m in Sources */, 2BFC7E511D132DCB0040E2A3 /* ScreenMarkersTestCase.m in Sources */, 2BC41C8321F00AA6002926B7 /* BNGCustomMapTestCase.swift in Sources */, diff --git a/ios/apps/AutoTester/AutoTester/AppDelegate.swift b/ios/apps/AutoTester/AutoTester/AppDelegate.swift index 7b5e8c93bd..40c69ccca1 100644 --- a/ios/apps/AutoTester/AutoTester/AppDelegate.swift +++ b/ios/apps/AutoTester/AutoTester/AppDelegate.swift @@ -3,7 +3,7 @@ // HelloEarthSwift // // Created by jmnavarro on 18/08/15. -// Copyright (c) 2015-2019 mousebird consulting. All rights reserved. +// Copyright (c) 2015-2022 mousebird consulting. All rights reserved. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/LegendViewController.swift b/ios/apps/AutoTester/AutoTester/LegendViewController.swift index 7e2c3e3a21..053f26fa4c 100644 --- a/ios/apps/AutoTester/AutoTester/LegendViewController.swift +++ b/ios/apps/AutoTester/AutoTester/LegendViewController.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 7/29/20. -// Copyright © 2020 mousebird consulting. All rights reserved. +// Copyright 2020-2022 mousebird consulting. All rights reserved. // import Foundation diff --git a/ios/apps/AutoTester/AutoTester/MaplyTesterBridge.h b/ios/apps/AutoTester/AutoTester/MaplyTesterBridge.h index dbbdb3354d..6942e91eea 100644 --- a/ios/apps/AutoTester/AutoTester/MaplyTesterBridge.h +++ b/ios/apps/AutoTester/AutoTester/MaplyTesterBridge.h @@ -11,6 +11,9 @@ #import "MaplyBridge.h" +#import "GeoJSONSource.h" +#import "GeographicLib.h" + #import "MaplyTestCase.h" #import "VectorsTestCase.h" #import "TextureVectorTestCase.h" @@ -30,12 +33,9 @@ #import "PagingLayerTestCase.h" #import "VectorHoleTestCase.h" #import "VectorStyleTestCase.h" -#import "ActiveObjectTestCase.h" -#import "GeoJSONSource.h" #import "GlyphProblemTestCase.h" #import "ChangeVectorsTestCase.h" #import "RepresentationsTestCase.h" -#import "GeographicLib.h" #import "LIDARTestCase.h" #import "ParticleTest.h" diff --git a/ios/apps/AutoTester/AutoTester/MapzenSource.h b/ios/apps/AutoTester/AutoTester/MapzenSource.h index e199248d55..3703131619 100644 --- a/ios/apps/AutoTester/AutoTester/MapzenSource.h +++ b/ios/apps/AutoTester/AutoTester/MapzenSource.h @@ -3,7 +3,7 @@ // WhirlyGlobeComponentTester // // Created by Steve Gifford on 11/20/14. -// Copyright © 2014-2017 mousebird consulting. All rights reserved. +// Copyright 2014-2022 mousebird consulting. All rights reserved. // #import diff --git a/ios/apps/AutoTester/AutoTester/MapzenSource.m b/ios/apps/AutoTester/AutoTester/MapzenSource.m index 4d432ea802..6b027fe5ab 100644 --- a/ios/apps/AutoTester/AutoTester/MapzenSource.m +++ b/ios/apps/AutoTester/AutoTester/MapzenSource.m @@ -3,7 +3,7 @@ // WhirlyGlobeComponentTester // // Created by Steve Gifford on 11/20/14. -// Copyright © 2014-2017 mousebird consulting. All rights reserved. +// Copyright 2014-2022 mousebird consulting. All rights reserved. // #import "MapzenSource.h" diff --git a/ios/apps/AutoTester/AutoTester/TestCell.swift b/ios/apps/AutoTester/AutoTester/TestCell.swift index 53944d8f55..fdbe6eb560 100644 --- a/ios/apps/AutoTester/AutoTester/TestCell.swift +++ b/ios/apps/AutoTester/AutoTester/TestCell.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 8/5/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/TestTileImageFetcher.swift b/ios/apps/AutoTester/AutoTester/TestTileImageFetcher.swift index 27d23c6fec..23ca59225d 100644 --- a/ios/apps/AutoTester/AutoTester/TestTileImageFetcher.swift +++ b/ios/apps/AutoTester/AutoTester/TestTileImageFetcher.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Tim Sylvester on 4/20/21. -// Copyright © 2021 mousebird consulting. All rights reserved. +// Copyright 2021-2022 mousebird consulting. All rights reserved. // import Foundation diff --git a/ios/apps/AutoTester/AutoTester/testCases/ActiveObjectTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/ActiveObjectTestCase.h deleted file mode 100644 index efe8cc9a5d..0000000000 --- a/ios/apps/AutoTester/AutoTester/testCases/ActiveObjectTestCase.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ActiveObjectTestCase.h -// AutoTester -// -// Created by Steve Gifford on 9/9/16. -// Copyright © 2016-2017 mousebird consulting. -// - -#import "MaplyTestCase.h" - -@interface ActiveObjectTestCase : MaplyTestCase - -@end diff --git a/ios/apps/AutoTester/AutoTester/testCases/ActiveObjectTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/ActiveObjectTestCase.m deleted file mode 100644 index 65e08229fc..0000000000 --- a/ios/apps/AutoTester/AutoTester/testCases/ActiveObjectTestCase.m +++ /dev/null @@ -1,104 +0,0 @@ -// -// ActiveObjectTestCase.m -// AutoTester -// -// Created by Steve Gifford on 9/9/16. -// Copyright © 2016-2017 mousebird consulting. -// - -#import "ActiveObjectTestCase.h" -#import "AutoTester-Swift.h" - -@interface SimpleActiveObject : MaplyActiveObject -@end - -@implementation SimpleActiveObject -{ - MaplyComponentObject *compObj; - MaplyTexture *tex; -} - -- (nonnull instancetype)initWithViewController:(MaplyBaseViewController *__nonnull)viewC image:(MaplyTexture *)inTex -{ - self = [super initWithViewController:viewC]; - tex = inTex; - - return self; -} - -- (bool)hasUpdate -{ - return true; -} - -- (void)updateForFrame:(void *)frameInfo -{ - // Delete it - if (compObj) - { - [self.viewC removeObjects:@[compObj] mode:MaplyThreadCurrent]; - compObj = nil; - } - - MaplyCoordinate coord = MaplyCoordinateMakeWithDegrees(-1 + 2*drand48(), -1 + 2*drand48()); - MaplyScreenMarker *marker = [[MaplyScreenMarker alloc] init]; - marker.loc = coord; - marker.image = tex; - marker.size = CGSizeMake(64,64); - marker.layoutImportance = MAXFLOAT; - compObj = [self.viewC addScreenMarkers:@[marker] desc:@{kMaplyFade: @(NO)} mode:MaplyThreadCurrent]; -} - -@end - -@implementation ActiveObjectTestCase -{ - SimpleActiveObject *activeObject; - CartoDBLightTestCase *baseCase; -} - -- (instancetype)init -{ - if (self = [super init]) { - self.name = @"Active Object"; - self.implementations = MaplyTestCaseImplementationMap | MaplyTestCaseImplementationGlobe; - } - - return self; -} - -- (void)setupActiveObject:(MaplyBaseViewController *)viewC -{ - MaplyTexture *tex = [viewC addTexture:[UIImage imageNamed:@"beer-24@2x.png"] desc:nil mode:MaplyThreadCurrent]; - - activeObject = [[SimpleActiveObject alloc] initWithViewController:viewC image:tex]; - - [viewC addActiveObject:activeObject]; -} - -- (void)setUpWithGlobe:(WhirlyGlobeViewController *)globeVC -{ - baseCase = [[CartoDBLightTestCase alloc] init]; - [baseCase setUpWithGlobe:globeVC]; - - [self setupActiveObject:globeVC]; -} - -- (void)setUpWithMap:(MaplyViewController *)mapVC -{ - baseCase = [[CartoDBLightTestCase alloc] init]; - [baseCase setUpWithMap:mapVC]; - - [self setupActiveObject:mapVC]; -} - -- (void)stop -{ - if (baseCase) - { - [baseCase stop]; - baseCase = nil; - } -} - -@end diff --git a/ios/apps/AutoTester/AutoTester/testCases/ActiveObjectTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/ActiveObjectTestCase.swift new file mode 100644 index 0000000000..414cb58d2d --- /dev/null +++ b/ios/apps/AutoTester/AutoTester/testCases/ActiveObjectTestCase.swift @@ -0,0 +1,138 @@ +// +// ActiveObjectTestCase.swift +// AutoTester +// +// Created by Tim Sylvester on 1/28/22. +// Copyright 2022 mousebird consulting. All rights reserved. +// + +import Foundation + +class ActiveObjectTestCase : MaplyTestCase { + override init() { + super.init(name: "Active Object", supporting: [.globe, .map]) + } + + func setupActiveObject(_ viewC: MaplyBaseViewController?) { + guard let vc = viewC else { return } + + if tex == nil, let img = UIImage(named: "beer-24@2x.png") { + tex = vc.addTexture(img, desc: nil, mode: .current) + } + guard let tex = tex else { return } + + let obj = SimpleActiveObject(viewController: vc, image: tex) + activeObject = obj + vc.add(obj) + } + + override func setUpWithGlobe(_ globeVC: WhirlyGlobeViewController) { + baseCase.setUpWithGlobe(globeVC) + setupActiveObject(globeVC) + } + + override func setUpWithMap(_ mapVC: MaplyViewController) { + baseCase.setUpWithMap(mapVC) + setupActiveObject(mapVC) + } + + override func stop() { + if let obj = activeObject { + baseViewController?.remove(obj) + activeObject = nil + } + if let tex = tex { + baseViewController?.remove(tex, mode: .any) + self.tex = nil + } + baseCase.stop() + } + + private var activeObject: SimpleActiveObject? + private let baseCase = CartoDBLightTestCase() + private var tex: MaplyTexture? +} + +class SimpleActiveObject: MaplyActiveObject { + init(viewController viewC: MaplyBaseViewController, image inTex: MaplyTexture?) { + super.init(viewController: viewC) + markerTex = inTex + } + + override func hasUpdate() -> Bool { + return true + } + + override func update(forFrame frameInfo: UnsafeMutableRawPointer?) { + guard let vc = viewC else { return } + + let oldObjs = [MaplyComponentObject](compObjs) + compObjs.removeAll() + + let offset = MaplyCoordinateMakeWithDegrees(Float(-1.0 + 2.0 * drand48()), + Float(-1.0 + 2.0 * drand48())) + markerCoord = MaplyCoordinate(x: markerCoord.x + offset.x, + y: markerCoord.y + offset.y) + + let marker = MaplyScreenMarker() + marker.loc = markerCoord + marker.image = markerTex + marker.size = CGSize(width: 64, height: 64) + marker.color = UIColor.init(white: 1.0, alpha: 0.5) + marker.layoutImportance = MAXFLOAT + + let desc = [ + kMaplyFade: false, + kMaplyEnable: false, + ]; + + if let co = vc.addScreenMarkers([marker], desc: desc, mode: .current) { + compObjs.append(co) + } + + for i in 0..<2 { + for j in 0..<2 { + let lat = 50.0 + Float(i + 2 * j) + let lon = Float(-110.0) + var pts = [ + MaplyCoordinateMakeWithDegrees(lon, lat), + MaplyCoordinateMakeWithDegrees(lon + 1, lat), + MaplyCoordinateMakeWithDegrees(lon + Float(wideLinePos), lat + 0.1), + MaplyCoordinateMakeWithDegrees(lon, lat), + ] + + let vec = MaplyVectorObject(lineString: &pts, numCoords: (j==0) ? 3 : 4) + let wideDesc = [ + kMaplyEnable: false, + kMaplyColor: UIColor.red.withAlphaComponent(0.5), + kMaplyVecWidth: 20, + kMaplyWideVecEdgeFalloff: 5, + kMaplyWideVecJoinType: kMaplyWideVecMiterJoin, + kMaplyWideVecMiterLimit: miterLimit, + kMaplyWideVecImpl: (i==0) ? kMaplyWideVecImplPerf : kMaplyWideVecImplDefault, + ] as [String : Any] + if let co = vc.addWideVectors([vec], desc: wideDesc, mode: .current) { + compObjs.append(co) + } + } + } + + wideLinePos += wideLineDir * wideLineDif + if wideLinePos > 2 || wideLinePos < -2 { + wideLineDir = -wideLineDir + wideLinePos += wideLineDir * wideLineDif + } + + + vc.enable(compObjs, mode: .current) + vc.remove(oldObjs, mode: .current) + } + + private var compObjs = [MaplyComponentObject]() + private var markerTex: MaplyTexture? + private var markerCoord = MaplyCoordinate(x: 0, y: 0) + private var wideLinePos = 0.0 + private let wideLineDif = 0.01 + private var wideLineDir = -1.0 + private var miterLimit = 0.0 +} diff --git a/ios/apps/AutoTester/AutoTester/testCases/AirwayTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/AirwayTestCase.swift index b349b5ac22..3ec0f0887a 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/AirwayTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/AirwayTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 2/8/21. -// Copyright © 2021 mousebird consulting. All rights reserved. +// Copyright 2021-2022 mousebird consulting. All rights reserved. // import Foundation @@ -40,10 +40,7 @@ class GraphBuilder { class AirwayTestCase: MaplyTestCase { override init() { - super.init() - - self.name = "Airways & Airspaces" - self.implementations = [.globe, .map] + super.init(name: "Airways & Airspaces", supporting: [.globe, .map]) } let baseCase = StamenWatercolorRemote() diff --git a/ios/apps/AutoTester/AutoTester/testCases/AnimatedBasemapTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/AnimatedBasemapTestCase.swift index 58891da3f8..a57e4b41ad 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/AnimatedBasemapTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/AnimatedBasemapTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 26/10/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/AnimatedMarkersTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/AnimatedMarkersTestCase.swift index 9e297e9eb9..e0e0aaf785 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/AnimatedMarkersTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/AnimatedMarkersTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 11/9/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // import Foundation diff --git a/ios/apps/AutoTester/AutoTester/testCases/AnimationDelegateTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/AnimationDelegateTestCase.swift index 9eb7b31d12..af776b5e4a 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/AnimationDelegateTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/AnimationDelegateTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Ranen Ghosh on 2016-11-29. -// Copyright © 2016-2021 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/BNGCustomMapTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/BNGCustomMapTestCase.swift index 75df222bb4..9bb211cbd6 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/BNGCustomMapTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/BNGCustomMapTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 10/12/15. -// Copyright © 2015-2021 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit @@ -21,12 +21,15 @@ class BNGCustomMapTestCase: MaplyTestCase { baseCase.setUpWithMap(mapVC) createBritishNationalOverlayLocal(mapVC) - let bound = geoBound(Self.buildBritishNationalGrid(false)) - let middle = MaplyCoordinate(x: (bound.ll.x + bound.ur.x) / 2.0, - y: (bound.ll.y + bound.ur.y) / 2.0) - let h = mapVC.findHeight(toViewBounds: bound, pos: middle) - mapVC.setPosition(middle, height: h/3) - mapVC.animate(toPosition: middle, height: h, heading: 0, time: 1) + mapVC.addPostInitBlock { [weak self] in + guard let self = self else { return } + let bound = self.geoBound(Self.buildBritishNationalGrid(false)) + let middle = MaplyCoordinate(x: (bound.ll.x + bound.ur.x) / 2.0, + y: (bound.ll.y + bound.ur.y) / 2.0) + let h = mapVC.findHeight(toViewBounds: bound, pos: middle) + mapVC.setPosition(middle, height: h/3) + mapVC.animate(toPosition: middle, height: h, heading: 0, time: 1) + } } public func geoBound(_ coordSys: MaplyCoordinateSystem) -> MaplyBoundingBox { diff --git a/ios/apps/AutoTester/AutoTester/testCases/BNGTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/BNGTestCase.swift index 2dcfa747ae..6a383806f5 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/BNGTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/BNGTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 10/12/15. -// Copyright © 2015-2021 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit @@ -26,12 +26,15 @@ class BNGTestCase: MaplyTestCase { bngCase.createBritishNationalOverlayLocal(globeVC) - let bound = bngCase.geoBound(BNGCustomMapTestCase.buildBritishNationalGrid(false)) - let middle = MaplyCoordinate(x: (bound.ll.x + bound.ur.x) / 2.0, - y: (bound.ll.y + bound.ur.y) / 2.0) - let h = globeVC.findHeight(toViewBounds: bound, pos: middle) - globeVC.setPosition(middle, height: h/3) - globeVC.animate(toPosition: middle, height: h, heading: 0, time: 1) + globeVC.addPostInitBlock { [weak self] in + guard let self = self else { return } + let bound = self.bngCase.geoBound(BNGCustomMapTestCase.buildBritishNationalGrid(false)) + let middle = MaplyCoordinate(x: (bound.ll.x + bound.ur.x) / 2.0, + y: (bound.ll.y + bound.ur.y) / 2.0) + let h = globeVC.findHeight(toViewBounds: bound, pos: middle) + globeVC.setPosition(middle, height: h/3) + globeVC.animate(toPosition: middle, height: h, heading: 0, time: 1) + } } override func stop() { diff --git a/ios/apps/AutoTester/AutoTester/testCases/BillboardTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/BillboardTestCase.swift index 9324d116b9..aced3c484c 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/BillboardTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/BillboardTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 6/14/19. -// Copyright © 2019 mousebird consulting. All rights reserved. +// Copyright 2019-2022 mousebird consulting. All rights reserved. // import Foundation @@ -17,7 +17,7 @@ class BillboardTestCase : MaplyTestCase { self.implementations = [.globe] } - func insertMarkers (_ arrayComp: [MaplyVectorObject], theViewC: MaplyBaseViewController) { + func insertBillboards(_ arrayComp: [MaplyVectorObject], theViewC: MaplyBaseViewController) { let size = CGSize(width: 0.05, height: 0.05); var billboards = [MaplyBillboard]() guard let image0 = UIImage(named: "marker-24@2x") else { @@ -37,12 +37,12 @@ class BillboardTestCase : MaplyTestCase { theViewC.addBillboards(billboards, desc: [kMaplyBillboardOrient: kMaplyBillboardOrientEye], mode: .any) } - let baseCase : VectorsTestCase = VectorsTestCase() + let baseCase = VectorsTestCase() override func setUpWithGlobe(_ globeVC: WhirlyGlobeViewController) { baseCase.setUpWithGlobe(globeVC) - insertMarkers(baseCase.vecList as! [MaplyVectorObject], theViewC: globeVC) + insertBillboards(baseCase.vecList as! [MaplyVectorObject], theViewC: globeVC) + globeVC.setTiltMinHeight(0.001, maxHeight: 0.1, minTilt: -80*Float.pi/180, maxTilt: 0.0) globeVC.animate(toPosition: MaplyCoordinateMakeWithDegrees(151.211111, -33.859972), time: 1.0) } - } diff --git a/ios/apps/AutoTester/AutoTester/testCases/CartoDBInterpreter.h b/ios/apps/AutoTester/AutoTester/testCases/CartoDBInterpreter.h index efd76c4eec..9cd96be6a9 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/CartoDBInterpreter.h +++ b/ios/apps/AutoTester/AutoTester/testCases/CartoDBInterpreter.h @@ -3,7 +3,7 @@ // HelloEarth // // Created by Steve Gifford on 11/18/14. -// Copyright © 2014-2017 mousebird consulting. +// Copyright 2014-2022 mousebird consulting. // #import diff --git a/ios/apps/AutoTester/AutoTester/testCases/CartoDBInterpreter.m b/ios/apps/AutoTester/AutoTester/testCases/CartoDBInterpreter.m index f8a46e8ae9..b4a4467866 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/CartoDBInterpreter.m +++ b/ios/apps/AutoTester/AutoTester/testCases/CartoDBInterpreter.m @@ -3,7 +3,7 @@ // HelloEarth // // Created by Steve Gifford on 11/18/14. -// Copyright © 2014-2017 mousebird consulting. +// Copyright 2014-2022 mousebird consulting. // #import "CartoDBInterpreter.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/CartoDBLightTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/CartoDBLightTestCase.swift index dc1ee8a580..5218ca2ec8 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/CartoDBLightTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/CartoDBLightTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Stephen Gifford on 3/27/18. -// Copyright © 2018 mousebird consulting. +// Copyright 2018-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/CartoDBTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/CartoDBTestCase.h index 0a27774307..bfbcbd15c7 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/CartoDBTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/CartoDBTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 6/12/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/CartoDBTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/CartoDBTestCase.m index 509d91e842..0b0d6153fa 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/CartoDBTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/CartoDBTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 6/12/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "CartoDBTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/ChangeVectorsTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/ChangeVectorsTestCase.h index 1570bef829..48bf529097 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ChangeVectorsTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/ChangeVectorsTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Tim Sylvester on 31 Dec 2020. -// Copyright © 2020 mousebird consulting. +// Copyright 2020-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/ChangeVectorsTestCase.mm b/ios/apps/AutoTester/AutoTester/testCases/ChangeVectorsTestCase.mm index e576371371..cc16e47805 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ChangeVectorsTestCase.mm +++ b/ios/apps/AutoTester/AutoTester/testCases/ChangeVectorsTestCase.mm @@ -3,7 +3,7 @@ // AutoTester // // Created by Tim Sylvester on 31 Dec. 2020. -// Copyright © 2020 mousebird consulting. +// Copyright 2020-2022 mousebird consulting. // #import "VectorsTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/ClusteredMarkersTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/ClusteredMarkersTestCase.swift index bbf8e0db94..4b721cf424 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ClusteredMarkersTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/ClusteredMarkersTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 2/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/ESRIRemoteTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/ESRIRemoteTestCase.swift index 6a72ee3b4e..77f6eea6b4 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ESRIRemoteTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/ESRIRemoteTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Jess Taylor on 6/14/21. -// Copyright © 2021 mousebird consulting. All rights reserved. +// Copyright 2021-2022 mousebird consulting. All rights reserved. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/ExtrudedModelTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/ExtrudedModelTestCase.h index 4607faf969..728d971845 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ExtrudedModelTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/ExtrudedModelTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 3/10/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/ExtrudedModelTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/ExtrudedModelTestCase.m index fbcd4eb7a2..faa6c8acc2 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ExtrudedModelTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/ExtrudedModelTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 3/10/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import diff --git a/ios/apps/AutoTester/AutoTester/testCases/FindHeightTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/FindHeightTestCase.h index c45b66b182..5c28a4c103 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/FindHeightTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/FindHeightTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Ranen Ghosh on 4/7/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/FindHeightTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/FindHeightTestCase.m index 80c084d93a..ee4fe3d3ec 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/FindHeightTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/FindHeightTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by Ranen Ghosh on 4/7/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "FindHeightTestCase.h" @@ -52,20 +52,48 @@ - (void)setUpWithGlobe:(WhirlyGlobeViewController *)globeVC [self setupWithBaseVC:(MaplyBaseViewController *)globeVC]; [globeVC animateToPosition:MaplyCoordinateMakeWithDegrees(-98.58, 39.83) height:1.5 heading:0 time:1.0]; - dispatch_after( dispatch_time(DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC), dispatch_get_main_queue(), - ^{ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ if (self->stopped) { return; } - MaplyBoundingBox bbox; - bbox.ll = MaplyCoordinateMakeWithDegrees(7.05090689853, 47.7675500593); - bbox.ur = MaplyCoordinateMakeWithDegrees(8.06813647023, 49.0562323851); + const MaplyBoundingBox bbox = { MaplyCoordinateMakeWithDegrees(7.05090689853, 47.7675500593), + MaplyCoordinateMakeWithDegrees(8.06813647023, 49.0562323851) }; [self addBoundingBox:bbox baseVC:globeVC]; + const CGPoint margin = CGPointMake(20, 50); + const MaplyCoordinate center = MaplyCoordinateMakeWithDegrees((7.05090689853+8.06813647023)/2, (47.7675500593+49.0562323851)/2); - const double height = [globeVC findHeightToViewBounds:bbox pos:center]; - [globeVC animateToPosition:center height:height*1.1 heading:0 time:3.0]; + const double height = [globeVC findHeightToViewBounds:bbox + pos:center + marginX:-margin.x + marginY:-margin.y]; + if (height > 0) + { + [globeVC animateToPosition:center height:height heading:0 time:3.0]; + } NSLog(@"height = %f",height); + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 4.0 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ + if (self->stopped) { + return; + } + // Consider the bottom/right quarter of the screen to test offset and size + const CGRect wholeFrame = globeVC.view.frame; + const CGRect frame = CGRectIntersection(wholeFrame, + CGRectOffset(wholeFrame, wholeFrame.size.width / 2, wholeFrame.size.height / 2)); + MaplyCoordinate newCenter = {0,0}; + const double height = [globeVC findHeightToViewBounds:bbox + pos:center + frame:frame + newPos:&newCenter + marginX:-margin.x + marginY:-margin.y]; + if (height > 0) + { + [globeVC animateToPosition:newCenter height:height heading:0 time:1.0]; + } + NSLog(@"center = %f/%f height = %f", 180*newCenter.y/M_PI, 180*newCenter.x/M_PI, height); + }); }); } @@ -77,20 +105,50 @@ - (void)setUpWithMap:(MaplyViewController *)mapVC [self setupWithBaseVC:(MaplyBaseViewController *)mapVC]; [mapVC animateToPosition:MaplyCoordinateMakeWithDegrees(-98.58, 39.83) height:1.5 time:1.0]; - dispatch_after( dispatch_time(DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC), dispatch_get_main_queue(), - ^{ + dispatch_after( dispatch_time(DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ if (self->stopped) { return; } - MaplyBoundingBox bbox; - bbox.ll = MaplyCoordinateMakeWithDegrees(7.05090689853, 47.7675500593); - bbox.ur = MaplyCoordinateMakeWithDegrees(8.06813647023, 49.0562323851); + MaplyBoundingBox bbox = { MaplyCoordinateMakeWithDegrees(7.05090689853, 47.7675500593), + MaplyCoordinateMakeWithDegrees(8.06813647023, 49.0562323851) }; [self addBoundingBox:bbox baseVC:mapVC]; - + + const CGPoint margin = CGPointMake(20, 50); + const MaplyCoordinate center = MaplyCoordinateMakeWithDegrees((7.05090689853+8.06813647023)/2, (47.7675500593+49.0562323851)/2); - const double height = [mapVC findHeightToViewBounds:bbox pos:center marginX:20.0 marginY:100.0]; - [mapVC animateToPosition:center height:height heading:mapVC.heading time:3.0]; + const double height = [mapVC findHeightToViewBounds:bbox + pos:center + marginX:-margin.x + marginY:-margin.y]; + if (height > 0) + { + [mapVC animateToPosition:center height:height heading:mapVC.heading time:3.0]; + } NSLog(@"height = %f",height); + + // Then, repeat but fit it into just part of the view + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 4.0 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ + if (self->stopped) { + return; + } + // Consider the bottom/right quarter of the screen to test offset and size + const CGRect wholeFrame = mapVC.view.frame; + const CGRect frame = CGRectIntersection(wholeFrame, + CGRectOffset(wholeFrame, wholeFrame.size.width / 2, + wholeFrame.size.height / 2)); + MaplyCoordinate newCenter = {0,0}; + const double height = [mapVC findHeightToViewBounds:bbox + pos:center + frame:frame + newPos:&newCenter + marginX:-margin.x + marginY:-margin.y]; + if (height > 0) + { + [mapVC animateToPosition:newCenter height:height heading:mapVC.heading time:1.0]; + } + NSLog(@"center = %f/%f height = %f", 180*newCenter.y/M_PI, 180*newCenter.x/M_PI, height); + }); }); } diff --git a/ios/apps/AutoTester/AutoTester/testCases/GeoJSONStyleTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/GeoJSONStyleTestCase.swift index 5b8eec7c65..d47e099ef4 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/GeoJSONStyleTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/GeoJSONStyleTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Ranen Ghosh on 2016-12-23. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/GeographyClass.swift b/ios/apps/AutoTester/AutoTester/testCases/GeographyClass.swift index 718341abc7..f9442a3609 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/GeographyClass.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/GeographyClass.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 2/12/20. -// Copyright © 2015-2020 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit @@ -21,8 +21,10 @@ public class GeographyClassTestCase: MaplyTestCase { var layers : [ImageLayer] = [] var varTarget : MaplyVariableTarget? = nil - func setupMBTiles(_ name: String, offscreen: Bool, transparent: Bool, drawPriority: Int32, viewC: MaplyBaseViewController) -> ImageLayer? { - guard let fetcher = MaplyMBTileFetcher(mbTiles: name) else { + func setupMBTiles(_ name: String, offscreen: Bool, transparent: Bool, + drawPriority: Int32, viewC: MaplyBaseViewController, + cacheSize: Int32 = -1) -> ImageLayer? { + guard let fetcher = MaplyMBTileFetcher(mbTiles: name, cacheSize: cacheSize) else { return nil } @@ -63,7 +65,8 @@ public class GeographyClassTestCase: MaplyTestCase { offscreen: false, transparent: false, drawPriority: kMaplyImageLayerDrawPriorityDefault, - viewC: viewC) { + viewC: viewC, + cacheSize: 0) { layers.append(layer) } } diff --git a/ios/apps/AutoTester/AutoTester/testCases/GlobeSamplerTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/GlobeSamplerTestCase.swift index e6a1d3f9e4..36b4d702eb 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/GlobeSamplerTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/GlobeSamplerTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Stephen Gifford on 3/27/18. -// Copyright © 2018 mousebird consulting. +// Copyright 2018-2022 mousebird consulting. // import Foundation diff --git a/ios/apps/AutoTester/AutoTester/testCases/GlyphProblemTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/GlyphProblemTestCase.h index 1574a3d4c7..ef147544ff 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/GlyphProblemTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/GlyphProblemTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by zhoujiong on 2019/11/12. -// Copyright © 2019 mousebird consulting. All rights reserved. +// Copyright 2019-2022 mousebird consulting. All rights reserved. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/GlyphProblemTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/GlyphProblemTestCase.m index af50d850f0..5cc488266e 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/GlyphProblemTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/GlyphProblemTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by zhoujiong on 2019/11/12. -// Copyright © 2019 mousebird consulting. All rights reserved. +// Copyright 2019-2022 mousebird consulting. All rights reserved. // #define MIN_HEIGHT 0.000251845893 diff --git a/ios/apps/AutoTester/AutoTester/testCases/GreatCircleTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/GreatCircleTestCase.swift index 8d1fe45b81..41b7abaca5 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/GreatCircleTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/GreatCircleTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 3/11/16. -// Copyright © 2016-2021 mousebird consulting. All rights reserved. +// Copyright 2016-2022 mousebird consulting. All rights reserved. // import Foundation @@ -326,7 +326,17 @@ class GreatCircleTestCase: MaplyTestCase { compObjs.append(obj) } } - + + do { + let points = [MaplyCoordinateMakeWithDegrees(0.167914, 51.197795),MaplyCoordinateMakeWithDegrees(-0.119376, 51.225319)] + + let vector = MaplyVectorObject(lineString: points, numCoords: 2, attributes: [kMaplyColor:UIColor.orange]) + + let desc = [kMaplyDrawPriority: kMaplyVectorDrawPriorityDefault+200,kMaplyVecWidth:6] + if let co = viewC.addWideVectors([vector], desc: desc, mode: MaplyThreadMode.current) { + compObjs.append(co) + } + } return compObjs; } diff --git a/ios/apps/AutoTester/AutoTester/testCases/ImageReloadTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/ImageReloadTestCase.swift index 211cdac8d0..4645a0c2af 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ImageReloadTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/ImageReloadTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 4/9/19. -// Copyright © 2019 mousebird consulting. All rights reserved. +// Copyright 2019-2022 mousebird consulting. All rights reserved. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/Issue721TestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/Issue721TestCase.swift index 5e0dccc64b..0b1412bdd3 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/Issue721TestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/Issue721TestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 24/10/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // import Foundation diff --git a/ios/apps/AutoTester/AutoTester/testCases/LIDARTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/LIDARTestCase.h index fe1a3f6a9d..dbcbd44f05 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/LIDARTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/LIDARTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 1/24/17. -// Copyright © 2017 mousebird consulting. +// Copyright 2017-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/LIDARTestCase.mm b/ios/apps/AutoTester/AutoTester/testCases/LIDARTestCase.mm index 05523c3dce..fa587fa48d 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/LIDARTestCase.mm +++ b/ios/apps/AutoTester/AutoTester/testCases/LIDARTestCase.mm @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 1/24/17. -// Copyright © 2017 mousebird consulting. +// Copyright 2017-2022 mousebird consulting. // #import "LIDARTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/LabelAnimationTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/LabelAnimationTestCase.h index a012504cc0..a236ea3a0b 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/LabelAnimationTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/LabelAnimationTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Ranen Ghosh on 4/7/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/LabelAnimationTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/LabelAnimationTestCase.m index 089f7d3953..25bb158bdd 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/LabelAnimationTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/LabelAnimationTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by Ranen Ghosh on 4/7/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "LabelAnimationTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/LabelsTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/LabelsTestCase.h index 9c4cb93749..91418db7fd 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/LabelsTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/LabelsTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 2/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/LabelsTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/LabelsTestCase.m index 1751d87cd0..62b87c6dc4 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/LabelsTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/LabelsTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 2/11/15. -// Copyright © 2015-2021 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "LabelsTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/LayerStartupShutdownTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/LayerStartupShutdownTestCase.swift index 148a48f5ae..afe5891c93 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/LayerStartupShutdownTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/LayerStartupShutdownTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 10/30/19. -// Copyright © 2019 mousebird consulting. All rights reserved. +// Copyright 2019-2022 mousebird consulting. All rights reserved. // import UIKit @@ -55,6 +55,21 @@ class LayerStartupShutdownTestCase: MaplyTestCase { self.testCase.baseViewController = mapViewController self.testCase.setUpWithMap(self.mapViewController!) + if let vc = baseViewController, + let image = UIImage(named: "marker-stroked-24@2x"), + let tex = vc.addTexture(image, desc: nil, mode: .current) { + for i in (0..<100) { + let marker = MaplyScreenMarker() + marker.loc = MaplyCoordinateMakeWithDegrees(Float(i), Float(i)) + marker.size = CGSize(width: 32, height: 32) + marker.image = tex + marker.layoutImportance = Float.infinity + if let co = vc.addScreenMarkers([marker], desc: nil, mode: .any) { + vc.remove([co], mode: .any) + } + } + } + // Shut it down in a bit DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { if self.run { diff --git a/ios/apps/AutoTester/AutoTester/testCases/LocationTrackingRealTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/LocationTrackingRealTestCase.swift index 6be7d48222..a9bcd87da7 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/LocationTrackingRealTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/LocationTrackingRealTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Ranen Ghosh on 2016-12-06. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/LocationTrackingSimTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/LocationTrackingSimTestCase.swift index ed9d06270d..c948cda951 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/LocationTrackingSimTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/LocationTrackingSimTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Ranen Ghosh on 2016-11-23. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/LoftedPolysTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/LoftedPolysTestCase.h index cc78562dc2..e17c8c2a99 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/LoftedPolysTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/LoftedPolysTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 3/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/LoftedPolysTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/LoftedPolysTestCase.m index 7f917c6384..e56053b86a 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/LoftedPolysTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/LoftedPolysTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 3/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "LoftedPolysTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/MapTilerCircleTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/MapTilerCircleTestCase.swift index a6713b3985..232d53af16 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/MapTilerCircleTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/MapTilerCircleTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Tim Sylvester on 3/23/21. -// Copyright © 2021 mousebird consulting. All rights reserved. +// Copyright 2021-2022 mousebird consulting. All rights reserved. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/MapTilerTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/MapTilerTestCase.swift index 729caf20da..fab0d89196 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/MapTilerTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/MapTilerTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 11/8/19. -// Copyright © 2021 mousebird consulting. All rights reserved. +// Copyright 2021-2022 mousebird consulting. All rights reserved. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/MapboxTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/MapboxTestCase.swift index 4a480f77de..7545bed003 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/MapboxTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/MapboxTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 11/12/19. -// Copyright © 2019 mousebird consulting. All rights reserved. +// Copyright 2019-2022 mousebird consulting. All rights reserved. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/MaplyTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/MaplyTestCase.h index 7efccd3b68..bf848ca8bd 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/MaplyTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/MaplyTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 13/10/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import diff --git a/ios/apps/AutoTester/AutoTester/testCases/MaplyTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/MaplyTestCase.m index 918b08d1c4..078c7cb61a 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/MaplyTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/MaplyTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 13/10/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "MaplyTestCase.h" @@ -115,7 +115,10 @@ - (void)setName:(NSString *)name _name = name; } -- (void)globeViewController:(WhirlyGlobeViewController *__nonnull)viewC allSelect:(NSArray *__nonnull)selectedObjs atLoc:(MaplyCoordinate)coord onScreen:(CGPoint)screenPt +- (void)globeViewController:(WhirlyGlobeViewController *__nonnull)viewC + allSelect:(NSArray *__nonnull)selectedObjs + atLoc:(MaplyCoordinate)coord + onScreen:(CGPoint)screenPt { [self handleSelection:selectedObjs]; } @@ -135,14 +138,20 @@ -(void)maplyViewController:(MaplyViewController *)viewC didSelect:(NSObject *)se [self handleSelection:selectedObj]; } -- (void)maplyViewController:(MaplyViewController *__nonnull)viewC didSelect:(NSObject *__nonnull)selectedObj atLoc:(MaplyCoordinate)coord onScreen:(CGPoint)screenPt +- (void)maplyViewController:(MaplyViewController *__nonnull)viewC + didSelect:(NSObject *__nonnull)selectedObj + atLoc:(MaplyCoordinate)coord + onScreen:(CGPoint)screenPt { - [self handleSelection:selectedObj]; + [self handleSelection:selectedObj atLoc:coord onScreen:screenPt]; } -- (void)maplyViewController:(MaplyViewController *)viewC allSelect:(NSArray *)selectedObjs atLoc:(MaplyCoordinate)coord onScreen:(CGPoint)screenPt +- (void)maplyViewController:(MaplyViewController *)viewC + allSelect:(NSArray *)selectedObjs + atLoc:(MaplyCoordinate)coord + onScreen:(CGPoint)screenPt { - [self handleSelection:selectedObjs]; + [self handleSelection:selectedObjs atLoc:coord onScreen:screenPt]; } - (void)maplyViewController:(MaplyViewController *)viewC didTapAt:(MaplyCoordinate)coord @@ -152,6 +161,12 @@ - (void)maplyViewController:(MaplyViewController *)viewC didTapAt:(MaplyCoordina - (void)handleSelection:(id)selectedObjs { +} + +- (void)handleSelection:(id)selectedObjs atLoc:(MaplyCoordinate)coord onScreen:(CGPoint)screenPt +{ + [self handleSelection:selectedObjs]; + // If we've currently got a selected view, get rid of it // if (selectedViewTrack) // { diff --git a/ios/apps/AutoTester/AutoTester/testCases/MarkersTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/MarkersTestCase.swift index d121305a1c..0241ec5827 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/MarkersTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/MarkersTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 2/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit @@ -39,12 +39,58 @@ class MarkersTestCase: MaplyTestCase { baseCase.setUpWithGlobe(globeVC) insertMarkers(baseCase.vecList!, theViewC: globeVC) globeVC.animate(toPosition: MaplyCoordinateMakeWithDegrees(151.211111, -33.859972), time: 1.0) + + addLongPressGesture() } override func setUpWithMap(_ mapVC: MaplyViewController) { baseCase.setUpWithMap(mapVC) insertMarkers(baseCase.vecList!, theViewC: mapVC) mapVC.animate(toPosition: MaplyCoordinateMakeWithDegrees(151.211111, -33.859972), time: 1.0) + + addLongPressGesture() } +} + +// MARK: - Long Press + +extension MarkersTestCase { + + private func addLongPressGesture() { + + let gesture = UILongPressGestureRecognizer(target: self, action: #selector(longPressed(_:))) + baseViewController?.view.addGestureRecognizer(gesture) + } + + @objc + private func longPressed(_ gesture: UILongPressGestureRecognizer) { + + let point = gesture.location(in: gesture.view) + var loc: MaplyCoordinate? + + if let mapViewController = mapViewController { + loc = mapViewController.geo(fromScreenPoint: point) + } else if let globeViewController = globeViewController { + loc = globeViewController.geoPoint(fromScreen: point)?.maplyCoordinateValue + } + guard let loc = loc else { + return + } + showObjectsCount(at: loc) + } + + private func showObjectsCount(at coord: MaplyCoordinate) { + + guard let viewC = baseViewController else { + return + } + let objs = viewC.objects(atCoord: coord) ?? [] + let labelsAndMarkers = viewC.labelsAndMarkers(atCoord: coord) ?? [] + let vc = UIAlertController(title: nil, message: "\(objs.count) selectable vector objects and \(labelsAndMarkers.count) selectable labels and markers found at tapped location", preferredStyle: .alert) + viewC.present(vc, animated: true, completion: nil) + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + viewC.dismiss(animated: true, completion: nil) + } + } } diff --git a/ios/apps/AutoTester/AutoTester/testCases/MegaMarkersTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/MegaMarkersTestCase.h index c4be6cd9b6..af026098f2 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/MegaMarkersTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/MegaMarkersTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 2/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/MegaMarkersTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/MegaMarkersTestCase.m index 23babe9766..3db4f621d8 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/MegaMarkersTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/MegaMarkersTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 2/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "MegaMarkersTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/ModelsTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/ModelsTestCase.swift index a5fe117ffd..4bd93f8f10 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ModelsTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/ModelsTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 2/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/MovingScreenLabelsTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/MovingScreenLabelsTestCase.swift index c4632d051e..dadd5fd9fb 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/MovingScreenLabelsTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/MovingScreenLabelsTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 2/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit @@ -14,13 +14,71 @@ class MovingScreenLabelsTestCase: MaplyTestCase { super.init() self.name = "Moving Screen Labels" - self.implementations = [] + self.implementations = [.globe, .map] } + + let baseCase : VectorsTestCase = VectorsTestCase() override func setUpWithGlobe(_ globeVC: WhirlyGlobeViewController) { + baseCase.setUpWithGlobe(globeVC) + setUp(globeVC) + globeVC.height = 2 + globeVC.heading = -Float.pi/2 + globeVC.animate(toPosition: MaplyCoordinateMakeWithDegrees(0, 10), height:0.5, heading:0, time:0.5) } override func setUpWithMap(_ mapVC: MaplyViewController) { + baseCase.setUpWithMap(mapVC) + setUp(mapVC) + mapVC.setPosition(MaplyCoordinateMakeWithDegrees(0, 10), height: 0.5) } + + func setUp(_ vc: MaplyBaseViewController) { + self.labelObj = makeLabels() + timer = Timer.scheduledTimer(withTimeInterval: duration, repeats: true) { [weak self] _ in + guard let self = self else { return } + self.clearLabels() + self.labelObj = self.makeLabels() + } + } + + func clearLabels() { + if let obj = labelObj { + baseViewController?.remove(obj) + labelObj = nil + } + } + + func makeLabels() -> MaplyComponentObject? { + let pts = [ + MaplyCoordinateMakeWithDegrees(0.0, 0.0), + MaplyCoordinateMakeWithDegrees(10.0, 10.0), + MaplyCoordinateMakeWithDegrees(0.0, 20.0), + MaplyCoordinateMakeWithDegrees(-10.0, 10.0) + ] + let labels = (0.. MaplyMovingScreenLabel in + let label = MaplyMovingScreenLabel() + label.duration = duration + label.loc = pts[i] + label.endLoc = pts[(i + 1) % pts.count] + label.layoutImportance = Float.greatestFiniteMagnitude + label.text = "Text" + return label + } + return baseViewController?.addScreenLabels(labels, + desc: [kMaplyFont: UIFont.systemFont(ofSize: 32.0), + kMaplyTextColor: UIColor.red]) + } + + + override func stop() { + timer?.invalidate() + timer = nil + clearLabels() + } + + let duration = 5.0 + var timer: Timer? + var labelObj: MaplyComponentObject? } diff --git a/ios/apps/AutoTester/AutoTester/testCases/MovingScreenMarkersTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/MovingScreenMarkersTestCase.swift index dc7d525de1..292a436d95 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/MovingScreenMarkersTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/MovingScreenMarkersTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Tim Sylvester on 9 Feb. 2021 -// Copyright © 2021 mousebird consulting. +// Copyright 2021-2022 mousebird consulting. // import Foundation diff --git a/ios/apps/AutoTester/AutoTester/testCases/NASAGIBSTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/NASAGIBSTestCase.swift index 6423c08ac5..e888cccbb3 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/NASAGIBSTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/NASAGIBSTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 6/12/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/OfflineRenderTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/OfflineRenderTestCase.swift index 69105d05f5..e2aaf5c79a 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/OfflineRenderTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/OfflineRenderTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on Oct 23 2019. -// Copyright © 2015-2019 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/PagingLayerTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/PagingLayerTestCase.h index c8154cdc38..358d9d0d46 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/PagingLayerTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/PagingLayerTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 6/28/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/PagingLayerTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/PagingLayerTestCase.m index bc5502172f..9934d51027 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/PagingLayerTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/PagingLayerTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 6/28/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "PagingLayerTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/ParticleTest.h b/ios/apps/AutoTester/AutoTester/testCases/ParticleTest.h index 7a409be582..28733d4b29 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ParticleTest.h +++ b/ios/apps/AutoTester/AutoTester/testCases/ParticleTest.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponentTester * * Created by Steve Gifford on 10/21/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/AutoTester/AutoTester/testCases/ParticleTest.mm b/ios/apps/AutoTester/AutoTester/testCases/ParticleTest.mm index 2f000c8af6..91e81a3fe2 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ParticleTest.mm +++ b/ios/apps/AutoTester/AutoTester/testCases/ParticleTest.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponentTester * * Created by Steve Gifford on 10/21/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/AutoTester/AutoTester/testCases/ParticleTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/ParticleTestCase.swift index 448b92b1d6..2c4e934b46 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ParticleTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/ParticleTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 18/1/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // import UIKit @@ -18,8 +18,8 @@ class ParticleTestCase: MaplyTestCase { } fileprivate func setUpOverlay (_ baseView: MaplyBaseViewController) { - let partDelegate = ParticleTileDelegate(url: "http://tilesets.s3-website-us-east-1.amazonaws.com/wind_test/{dir}_tiles/{z}/{x}/{y}.png", minZoom: Int32(2), maxZoom: Int32(5), viewC: baseView) - let layer = MaplyQuadPagingLoader()//coordSystem: (partDelegate?.coordSys)!, delegate: partDelegate!) + //let partDelegate = ParticleTileDelegate(url: "http://tilesets.s3-website-us-east-1.amazonaws.com/wind_test/{dir}_tiles/{z}/{x}/{y}.png", minZoom: Int32(2), maxZoom: Int32(5), viewC: baseView) + //let layer = MaplyQuadPagingLoader()//coordSystem: (partDelegate?.coordSys)!, delegate: partDelegate!) //layer?.flipY = false; //baseView.add(layer!) } diff --git a/ios/apps/AutoTester/AutoTester/testCases/RepresentationsTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/RepresentationsTestCase.h index c0e4ef6158..186fff99f2 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/RepresentationsTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/RepresentationsTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Tim Sylvester on 31 Dec 2020. -// Copyright © 2020 mousebird consulting. +// Copyright 2020-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/RepresentationsTestCase.mm b/ios/apps/AutoTester/AutoTester/testCases/RepresentationsTestCase.mm index 99eeb0be5e..17a96bede6 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/RepresentationsTestCase.mm +++ b/ios/apps/AutoTester/AutoTester/testCases/RepresentationsTestCase.mm @@ -3,7 +3,7 @@ // AutoTester // // Created by Tim Sylvester on 6 Jan. 2020. -// Copyright © 2021 mousebird consulting. +// Copyright 2021-2022 mousebird consulting. // #import "VectorsTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/RunwayBuilderTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/RunwayBuilderTestCase.h index 849638522d..895167605f 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/RunwayBuilderTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/RunwayBuilderTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 1/28/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/RunwayBuilderTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/RunwayBuilderTestCase.m index 2fc40ea151..db099356d9 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/RunwayBuilderTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/RunwayBuilderTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 1/28/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "RunwayBuilderTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/ScreenLabelsTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/ScreenLabelsTestCase.swift index bdc6f8ba9d..6db5e45cbc 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ScreenLabelsTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/ScreenLabelsTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 30/10/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/ScreenMarkersTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/ScreenMarkersTestCase.h index 44cb6225c6..3be1f94caf 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ScreenMarkersTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/ScreenMarkersTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 6/16/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/ScreenMarkersTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/ScreenMarkersTestCase.m index e4ccabdfe3..ac2404a479 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ScreenMarkersTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/ScreenMarkersTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 6/16/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "ScreenMarkersTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/ShapefileTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/ShapefileTestCase.h index fb17b9c238..da557a8ccb 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ShapefileTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/ShapefileTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 6/25/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/ShapefileTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/ShapefileTestCase.m index ed530fb8af..20fce814bf 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ShapefileTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/ShapefileTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 6/25/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "ShapefileTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/ShapesTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/ShapesTestCase.h index eb35059410..75fe92b30b 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ShapesTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/ShapesTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 3/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/ShapesTestCase.mm b/ios/apps/AutoTester/AutoTester/testCases/ShapesTestCase.mm index e391621c5f..f4aef2c7c6 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/ShapesTestCase.mm +++ b/ios/apps/AutoTester/AutoTester/testCases/ShapesTestCase.mm @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 3/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "ShapesTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/SimpleStyleTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/SimpleStyleTestCase.swift index bd4f880480..7ca53f2ad2 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/SimpleStyleTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/SimpleStyleTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 3/31/20. -// Copyright © 2021 mousebird consulting. All rights reserved. +// Copyright 2021-2022 mousebird consulting. All rights reserved. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/StamenWatercolorRemote.swift b/ios/apps/AutoTester/AutoTester/testCases/StamenWatercolorRemote.swift index 44d83be7ef..38b02c4a41 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/StamenWatercolorRemote.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/StamenWatercolorRemote.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 13/10/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/StarsSunTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/StarsSunTestCase.swift index 240b01f3b4..ddad806598 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/StarsSunTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/StarsSunTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 3/11/15. -// Copyright © 2015-2021 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/StartupShutdownTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/StartupShutdownTestCase.swift index 0bee842b7c..228d88258c 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/StartupShutdownTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/StartupShutdownTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 10/29/19. -// Copyright © 2019 mousebird consulting. All rights reserved. +// Copyright 2019-2022 mousebird consulting. All rights reserved. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/StickersTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/StickersTestCase.swift index 49c79f2dca..fbc35e961a 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/StickersTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/StickersTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 3/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // import UIKit diff --git a/ios/apps/AutoTester/AutoTester/testCases/TextureVectorTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/TextureVectorTestCase.h index 5504baa3d1..e05dc993bb 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/TextureVectorTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/TextureVectorTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 11/2/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/TextureVectorTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/TextureVectorTestCase.m index e776f883d4..2b47c5f3e6 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/TextureVectorTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/TextureVectorTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 11/2/16. -// Copyright © 2016-2021 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "TextureVectorTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/VectorHoleTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/VectorHoleTestCase.h index 3d6623f4f7..5de7c7b9b9 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/VectorHoleTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/VectorHoleTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 8/11/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/VectorHoleTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/VectorHoleTestCase.m index 3fda66ff12..e7fbafde44 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/VectorHoleTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/VectorHoleTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 8/11/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "VectorHoleTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/VectorMBTilesTestCase.swift b/ios/apps/AutoTester/AutoTester/testCases/VectorMBTilesTestCase.swift index 4c9a44c734..06b57092d1 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/VectorMBTilesTestCase.swift +++ b/ios/apps/AutoTester/AutoTester/testCases/VectorMBTilesTestCase.swift @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 3/9/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // import Foundation diff --git a/ios/apps/AutoTester/AutoTester/testCases/VectorStyleTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/VectorStyleTestCase.h index 08fd6e61f5..1e92922e09 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/VectorStyleTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/VectorStyleTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 8/12/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/VectorStyleTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/VectorStyleTestCase.m index af169c423e..7b30c31796 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/VectorStyleTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/VectorStyleTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by Steve Gifford on 8/12/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "VectorStyleTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/VectorsTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/VectorsTestCase.h index 2911dcfebe..cfb8f1ef59 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/VectorsTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/VectorsTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 29/10/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/VectorsTestCase.mm b/ios/apps/AutoTester/AutoTester/testCases/VectorsTestCase.mm index 266074bf41..4e00985b48 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/VectorsTestCase.mm +++ b/ios/apps/AutoTester/AutoTester/testCases/VectorsTestCase.mm @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 29/10/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "VectorsTestCase.h" @@ -16,7 +16,6 @@ @interface VectorsTestCase() @property (strong, nonatomic) MaplyVectorObject * selectedCountry; - @end @implementation VectorsTestCase @@ -37,10 +36,20 @@ - (instancetype)init - (void) overlayCountries: (MaplyBaseViewController*) baseVC { NSDictionary *vectorDict = @{ - kMaplyColor: [UIColor whiteColor], - kMaplySelectable: @(true), - kMaplyFade: @(0.2), - kMaplyVecWidth: @(4.0)}; + kMaplyDrawPriority: @(kMaplyVectorDrawPriorityDefault + 1), + kMaplyColor: [UIColor redColor], + kMaplySelectable: @(true), + kMaplyFade: @(0.2), + }; + NSDictionary *wideDict = @{ + kMaplyWideVecImpl: kMaplyWideVecImplPerf, + kMaplyDrawPriority: @(kMaplyVectorDrawPriorityDefault), + kMaplyVecCloseAreals: @(false), + kMaplyColor: [UIColor whiteColor], + kMaplySelectable: @(false), + kMaplyFade: @(0.2), + kMaplyVecWidth: @(3.0), + }; NSArray * paths = [[NSBundle mainBundle] pathsForResourcesOfType:@"geojson" inDirectory:nil]; for (NSString* fileName in paths) { // We only want the three letter countries @@ -61,6 +70,10 @@ - (void) overlayCountries: (MaplyBaseViewController*) baseVC if (compObj) { [self.compObjs addObject:compObj]; } + compObj = [baseVC addWideVectors:@[wgVecObj] desc:wideDict]; + if (compObj) { + [self.compObjs addObject:compObj]; + } // [baseVC addSelectionVectors:[NSArray arrayWithObject:wgVecObj]]; if ([vecName isEqualToString:@"Spain"]) { self.selectedCountry = wgVecObj; @@ -89,21 +102,34 @@ - (void)setUpWithMap:(MaplyViewController *)mapVC [self overlayCountries:(MaplyBaseViewController*)mapVC]; } -- (void) handleSelection:(MaplyBaseViewController *)viewC - selected:(NSObject *)selectedObj -{ - // ensure it's a MaplyVectorObject. It should be one of our outlines. - if ([selectedObj isKindOfClass:[MaplyVectorObject class]]) { - MaplyVectorObject *theVector = (MaplyVectorObject *)selectedObj; - MaplyCoordinate location; - - if ([theVector centroid:&location]) { - MaplyAnnotation *annotate = [[MaplyAnnotation alloc]init]; - annotate.title = @"Selected"; - annotate.subTitle = (NSString *)theVector.attributes[@"title"]; - [viewC addAnnotation:annotate forPoint:location offset:CGPointZero]; - } - } +- (void)handleSelection:(NSArray*)selectedObjs + atLoc:(MaplyCoordinate)coord + onScreen:(CGPoint)screenPt { + [self.baseViewController clearAnnotations]; + + CGPoint offset = CGPointMake(0,0); + for (__strong NSObject* obj in selectedObjs) { + if ([obj isKindOfClass:[MaplySelectedObject class]]) { + obj = ((MaplySelectedObject *)obj).selectedObj; + } + // ensure it's a MaplyVectorObject. It should be one of our outlines. + if ([obj isKindOfClass:[MaplyVectorObject class]]) { + MaplyVectorObject *theVector = (MaplyVectorObject *)obj; + + MaplyCoordinate location; + if (![theVector centroid:&location]) { + location = theVector.center; + } + + MaplyAnnotation *annotate = [[MaplyAnnotation alloc]init]; + annotate.title = [NSString stringWithFormat:@"Selected (at x=%.0f y=%.0f)", screenPt.x, screenPt.y];; + annotate.subTitle = (NSString *)theVector.attributes[@"title"]; + [self.baseViewController addAnnotation:annotate + forPoint:location + offset:offset]; + offset.x += 10; + } + } } - (void) stop diff --git a/ios/apps/AutoTester/AutoTester/testCases/WMSTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/WMSTestCase.h index 85fdd782bc..96db360db2 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/WMSTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/WMSTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by Ranen Ghosh on 4/7/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/WMSTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/WMSTestCase.m index 48eca01a0c..18f83ac44a 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/WMSTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/WMSTestCase.m @@ -3,7 +3,7 @@ // AutoTester // // Created by Ranen Ghosh on 4/7/16. -// Copyright © 2016-2017 mousebird consulting. +// Copyright 2016-2022 mousebird consulting. // #import "WMSTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/WideVectorsTestCase.h b/ios/apps/AutoTester/AutoTester/testCases/WideVectorsTestCase.h index 7d9e606a1b..30e41d3853 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/WideVectorsTestCase.h +++ b/ios/apps/AutoTester/AutoTester/testCases/WideVectorsTestCase.h @@ -3,7 +3,7 @@ // AutoTester // // Created by jmnavarro on 3/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "MaplyTestCase.h" diff --git a/ios/apps/AutoTester/AutoTester/testCases/WideVectorsTestCase.m b/ios/apps/AutoTester/AutoTester/testCases/WideVectorsTestCase.mm similarity index 70% rename from ios/apps/AutoTester/AutoTester/testCases/WideVectorsTestCase.m rename to ios/apps/AutoTester/AutoTester/testCases/WideVectorsTestCase.mm index 05af1d4c66..150a0bbd94 100644 --- a/ios/apps/AutoTester/AutoTester/testCases/WideVectorsTestCase.m +++ b/ios/apps/AutoTester/AutoTester/testCases/WideVectorsTestCase.mm @@ -1,9 +1,9 @@ // -// WideVectorsTestCase.m +// WideVectorsTestCase.mm // AutoTester // // Created by jmnavarro on 3/11/15. -// Copyright © 2015-2017 mousebird consulting. +// Copyright 2015-2022 mousebird consulting. // #import "WideVectorsTestCase.h" @@ -235,37 +235,119 @@ - (NSArray *)addWideVectors:(MaplyVectorObject *)vecObj return @[lines,screenLines,realLines,labelObj]; } -- (void)overlap:(MaplyBaseViewController *)viewC { +// Like `overlap:` but confirms that splitting vector colors within a single CO/info context +- (void)vecColors:(MaplyBaseViewController *)viewC { + const auto cx = -60.0; + const auto cy = 40.0; + const auto cs = 0.1; + NSMutableArray *objs = [NSMutableArray arrayWithCapacity:5]; + for (int i = 0; i < 5; ++i) { // lines + const MaplyCoordinate coords[] = { + MaplyCoordinateMakeWithDegrees(cx - 4*cs + i*1*cs, cy + 3*cs), + MaplyCoordinateMakeWithDegrees(cx + 2*cs + i*3*cs, cy - 2*cs), + MaplyCoordinateMakeWithDegrees(cx + 8*cs - i*2*cs, cy - 6*cs), + }; + + const auto cc = 0.2f * i; + UIColor *vecColor = [UIColor colorWithRed:0 green:cc blue:1.0f-cc alpha:0.5]; + NSDictionary *vecDesc = @{ kMaplyColor: vecColor }; + + MaplyVectorObject *vecObj = [[MaplyVectorObject alloc] initWithLineString:&coords[0] + numCoords:sizeof(coords)/sizeof(coords[0]) + attributes:vecDesc]; + [vecObj subdivideToGlobe:0.0001]; + [objs addObject:vecObj]; + } NSDictionary *wideDesc = @{ - kMaplyColor: [UIColor colorWithRed:0 green:0 blue:1.0 alpha:0.2], - kMaplyFilled: @NO, + kMaplyColor: [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.2], kMaplyEnable: @YES, kMaplyFade: @0, kMaplyDrawPriority: @(kMaplyVectorDrawPriorityDefault + 1), - kMaplyVecCentered: @YES, - kMaplyVecTexture: [NSNull null], kMaplyWideVecEdgeFalloff:@(5), kMaplyWideVecJoinType: kMaplyWideVecMiterJoin, kMaplyWideVecCoordType: kMaplyWideVecCoordTypeScreen, kMaplyWideVecCoordType: kMaplyWideVecCoordTypeScreen, - kMaplyWideVecOffset: @(10.0), - kMaplyWideVecMiterLimit: @(10.0), // More than 10 degrees need a bevel join - kMaplyVecWidth: @(20.0), - kMaplyWideVecImpl: kMaplyWideVecImplPerf,//kMaplyWideVecImpl, + kMaplyWideVecOffset: @(5), + kMaplyWideVecMiterLimit: @(10.0), + kMaplyVecWidth: @(10.0), + //kMaplyWideVecImpl: kMaplyWideVecImplDefault, + kMaplyWideVecImpl: kMaplyWideVecImplPerf, }; - NSMutableArray* objs = [NSMutableArray new]; + [viewC addWideVectors:objs desc:wideDesc mode:MaplyThreadCurrent]; + + NSMutableDictionary *desc = [NSMutableDictionary dictionaryWithDictionary:wideDesc]; for (int i = 0; i < 5; ++i) { - MaplyCoordinate coords[2] = { - MaplyCoordinateMakeWithDegrees(-90 + i*2, 40), - MaplyCoordinateMakeWithDegrees(-80 - i*2, 30), - }; - MaplyVectorObject *vecObj = [[MaplyVectorObject alloc] initWithLineString:&coords[0] numCoords:2 attributes:nil]; - [vecObj subdivideToGlobe:0.0001]; - [objs addObject:vecObj]; + const auto cc = 0.2f * i; + UIColor *clColor = [UIColor colorWithRed:0 green:1.0f-cc blue:cc alpha:0.5]; + objs[i].attributes[kMaplyColor] = clColor; + } + [viewC addVectors:objs desc:desc mode:MaplyThreadCurrent]; +} + +- (void)overlap:(MaplyBaseViewController *)viewC { + const auto cx = -90.0; + const auto cy = 40.0; + const auto cs = 0.1; + for (int k = 0; k < 2; ++k) // rows + for (int j = 0; j < 2; ++j) // cols + { + const int csep = 1; // column separation + const int rsep = 2; // row, 0 to overlay for def/perf comparison + for (int i = 0; i < 5; ++i) { // lines + const MaplyCoordinate coords[] = { + MaplyCoordinateMakeWithDegrees(cx - 5*cs + i*1*cs + j*csep, cy + 5*cs - k*rsep), + MaplyCoordinateMakeWithDegrees(cx + 0*cs + i*2*cs + j*csep, cy - 0*cs - k*rsep), + MaplyCoordinateMakeWithDegrees(cx + 10*cs - i*2*cs + j*csep, cy - 10*cs - k*rsep), + }; + + const auto cc = 0.2f * i; + UIColor *vecColor = [UIColor colorWithRed:0 green:cc blue:1.0f-cc alpha:0.5]; + UIColor *clColor = [UIColor colorWithRed:0 green:1.0f-cc blue:cc alpha:0.5]; + NSDictionary *vecDesc = @{ + kMaplyColor: k ? vecColor : [NSNull null], + }; + + MaplyVectorObject *vecObj = [[MaplyVectorObject alloc] initWithLineString:&coords[0] + numCoords:sizeof(coords)/sizeof(coords[0]) + attributes:vecDesc]; + [vecObj subdivideToGlobe:0.0001]; + + // Set 0: default implementation, color=blue + // Set 1: performance implementation, color=red + // Set 2: performance implementation, color=blue + NSDictionary *wideDesc = @{ + kMaplyColor: j ? [UIColor colorWithRed:0.0 green:0.0 blue:1.0 alpha:0.2] : + [UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.2], + kMaplyFilled: @NO, + kMaplyEnable: @YES, + kMaplyFade: @0, + kMaplyDrawPriority: @(kMaplyVectorDrawPriorityDefault + 1), + kMaplyVecCentered: @YES, + kMaplyVecTexture: [NSNull null], + kMaplyWideVecEdgeFalloff:@(i), + kMaplyWideVecJoinType: kMaplyWideVecMiterJoin, + kMaplyWideVecCoordType: kMaplyWideVecCoordTypeScreen, + kMaplyWideVecCoordType: kMaplyWideVecCoordTypeScreen, + kMaplyWideVecOffset: @(2 * i), + kMaplyWideVecMiterLimit: @(10.0), // More than 10 degrees need a bevel join + kMaplyVecWidth: @(20.0), + kMaplyWideVecImpl: j ? kMaplyWideVecImplDefault : kMaplyWideVecImplPerf, + }; + + [viewC addWideVectors:@[vecObj] desc:wideDesc mode:MaplyThreadCurrent]; + + // Add a centerline for visualizing offsets + NSMutableDictionary *desc = [NSMutableDictionary dictionaryWithDictionary:wideDesc]; + if (k) { + vecObj.attributes[kMaplyColor] = clColor; + } else { + desc[kMaplyColor] = [UIColor magentaColor]; + } + [viewC addVectors:@[vecObj] desc:desc mode:MaplyThreadCurrent]; + } } - [viewC addWideVectors:objs desc:wideDesc mode:MaplyThreadCurrent]; } - (void)wideLineTest:(MaplyBaseViewController *)viewC @@ -285,6 +367,8 @@ - (void)wideLineTest:(MaplyBaseViewController *)viewC // [self addGeoJson:@"uturn.geojson"]; [self overlap:viewC]; + + [self vecColors:viewC]; } diff --git a/ios/apps/Contributed/WhirlyGraph/Classes/GridClipper.cpp b/ios/apps/Contributed/WhirlyGraph/Classes/GridClipper.cpp index fe2389a7f1..6ffcd004d5 100644 --- a/ios/apps/Contributed/WhirlyGraph/Classes/GridClipper.cpp +++ b/ios/apps/Contributed/WhirlyGraph/Classes/GridClipper.cpp @@ -3,7 +3,7 @@ // WhirlyGlobeApp // // Created by Stephen Gifford on 7/16/11. -// Copyright 2011 mousebird consulting. All rights reserved. +// Copyright 2011-2022 mousebird consulting. All rights reserved. // #include "GridClipper.h" diff --git a/ios/apps/Contributed/WhirlyGraph/Classes/InteractionLayer.h b/ios/apps/Contributed/WhirlyGraph/Classes/InteractionLayer.h index 89adb83f00..4ed8329bd8 100644 --- a/ios/apps/Contributed/WhirlyGraph/Classes/InteractionLayer.h +++ b/ios/apps/Contributed/WhirlyGraph/Classes/InteractionLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 2/3/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/Contributed/WhirlyGraph/Classes/InteractionLayer.mm b/ios/apps/Contributed/WhirlyGraph/Classes/InteractionLayer.mm index a2264f27fd..a9281086fd 100644 --- a/ios/apps/Contributed/WhirlyGraph/Classes/InteractionLayer.mm +++ b/ios/apps/Contributed/WhirlyGraph/Classes/InteractionLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 2/3/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/Contributed/WhirlyGraph/Classes/PanDelegateFixed.h b/ios/apps/Contributed/WhirlyGraph/Classes/PanDelegateFixed.h index 67ab2746bc..b4466720b4 100644 --- a/ios/apps/Contributed/WhirlyGraph/Classes/PanDelegateFixed.h +++ b/ios/apps/Contributed/WhirlyGraph/Classes/PanDelegateFixed.h @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 4/28/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/Contributed/WhirlyGraph/Classes/PanDelegateFixed.mm b/ios/apps/Contributed/WhirlyGraph/Classes/PanDelegateFixed.mm index 5b55bea210..d0f6aec2a7 100644 --- a/ios/apps/Contributed/WhirlyGraph/Classes/PanDelegateFixed.mm +++ b/ios/apps/Contributed/WhirlyGraph/Classes/PanDelegateFixed.mm @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 4/28/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/Contributed/WhirlyGraph/Classes/Tesselator.h b/ios/apps/Contributed/WhirlyGraph/Classes/Tesselator.h index 4c4e3adb7d..9594f0a9f6 100644 --- a/ios/apps/Contributed/WhirlyGraph/Classes/Tesselator.h +++ b/ios/apps/Contributed/WhirlyGraph/Classes/Tesselator.h @@ -3,7 +3,7 @@ // WhirlyGlobeApp // // Created by Stephen Gifford on 7/17/11. -// Copyright 2011 mousebird consulting. All rights reserved. +// Copyright 2011-2022 mousebird consulting. All rights reserved. // #import diff --git a/ios/apps/Contributed/WhirlyGraph/Classes/Tesselator.mm b/ios/apps/Contributed/WhirlyGraph/Classes/Tesselator.mm index a238e8319c..f0dd89f512 100644 --- a/ios/apps/Contributed/WhirlyGraph/Classes/Tesselator.mm +++ b/ios/apps/Contributed/WhirlyGraph/Classes/Tesselator.mm @@ -3,7 +3,7 @@ // WhirlyGlobeApp // // Created by Stephen Gifford on 7/17/11. -// Copyright 2011 mousebird consulting. All rights reserved. +// Copyright 2011-2022 mousebird consulting. All rights reserved. // #import diff --git a/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppAppDelegate.h b/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppAppDelegate.h index 5dc2d5e647..87fcfc6798 100644 --- a/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppAppDelegate.h +++ b/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppAppDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 1/12/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppAppDelegate.mm b/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppAppDelegate.mm index b9bb8dae82..64ccf0e246 100644 --- a/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppAppDelegate.mm +++ b/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppAppDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 1/12/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppViewController.h b/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppViewController.h index 883ac00bdf..c6f9cb775d 100644 --- a/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppViewController.h +++ b/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppViewController.h @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 1/12/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppViewController.mm b/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppViewController.mm index ca2bafd56d..beee9e7ec0 100644 --- a/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppViewController.mm +++ b/ios/apps/Contributed/WhirlyGraph/Classes/WhirlyGlobeAppViewController.mm @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 1/12/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/Contributed/WhirlyGraph/Classes/debug.h b/ios/apps/Contributed/WhirlyGraph/Classes/debug.h index d5ee20770a..525f369ee7 100644 --- a/ios/apps/Contributed/WhirlyGraph/Classes/debug.h +++ b/ios/apps/Contributed/WhirlyGraph/Classes/debug.h @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 1/12/11. - * Copyright 2011 mousebird consulting. All rights reserved. + * Copyright 2011-2022 mousebird consulting. All rights reserved. * */ diff --git a/ios/apps/ImageChopper/ImageChopper/main.mm b/ios/apps/ImageChopper/ImageChopper/main.mm index 4ae8af2154..9868345782 100644 --- a/ios/apps/ImageChopper/ImageChopper/main.mm +++ b/ios/apps/ImageChopper/ImageChopper/main.mm @@ -3,7 +3,7 @@ // ImageChopper // // Created by Stephen Gifford on 4/18/11. -// Copyright 2011 mousebird consulting. All rights reserved. +// Copyright 2011-2022 mousebird consulting. All rights reserved. // #import diff --git a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/AppDelegate.h b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/AppDelegate.h index 003eca20ba..e6a39f20b1 100644 --- a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/AppDelegate.h +++ b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/AppDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 9/4/12. - * Copyright 2011-2012 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/InteractionLayer.h b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/InteractionLayer.h index 9952398cb1..a8624798b1 100644 --- a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/InteractionLayer.h +++ b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/InteractionLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 2/3/11. - * Copyright 2011-2012 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/InteractionLayer.mm b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/InteractionLayer.mm index 6b7c2acada..d64f0b926f 100644 --- a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/InteractionLayer.mm +++ b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/InteractionLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 2/3/11. - * Copyright 2011-2012 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/PanDelegateFixed.h b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/PanDelegateFixed.h index 810a99c7c6..402eb377a3 100644 --- a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/PanDelegateFixed.h +++ b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/PanDelegateFixed.h @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 4/28/11. - * Copyright 2011-2012 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/PanDelegateFixed.mm b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/PanDelegateFixed.mm index 773e2923bc..75973b5dd6 100644 --- a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/PanDelegateFixed.mm +++ b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/PanDelegateFixed.mm @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 4/28/11. - * Copyright 2011-2012 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/WhirlyGlobeAppViewController.h b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/WhirlyGlobeAppViewController.h index ebee6d08ba..7d04462af8 100644 --- a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/WhirlyGlobeAppViewController.h +++ b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/WhirlyGlobeAppViewController.h @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 1/12/11. - * Copyright 2011-2012 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/WhirlyGlobeAppViewController.mm b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/WhirlyGlobeAppViewController.mm index c4c0a497cb..ef4a7534fe 100644 --- a/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/WhirlyGlobeAppViewController.mm +++ b/ios/apps/code graveyard/WhirlyGlobeApp/WhirlyGlobeApp/WhirlyGlobeAppViewController.mm @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 1/12/11. - * Copyright 2011-2012 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/AppDelegate.h b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/AppDelegate.h index 5ba861ca71..88a7a4fa3e 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/AppDelegate.h +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/AppDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeTester * * Created by Steve Gifford on 10/26/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/AppDelegate.mm b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/AppDelegate.mm index 7d9fc59f09..76c5c94253 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/AppDelegate.mm +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/AppDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobeTester * * Created by Steve Gifford on 10/26/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/BigButtonViewController.h b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/BigButtonViewController.h index ce0c6de007..609c4e6285 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/BigButtonViewController.h +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/BigButtonViewController.h @@ -3,7 +3,7 @@ * WhirlyGlobeTester * * Created by Steve Gifford on 11/12/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/BigButtonViewController.m b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/BigButtonViewController.m index e2d766613b..eab6919585 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/BigButtonViewController.m +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/BigButtonViewController.m @@ -3,7 +3,7 @@ * WhirlyGlobeTester * * Created by Steve Gifford on 11/12/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/GlobeViewController.h b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/GlobeViewController.h index b1522612a8..a5073f9bc2 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/GlobeViewController.h +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/GlobeViewController.h @@ -3,7 +3,7 @@ * WhirlyGlobeTester * * Created by Steve Gifford on 10/26/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/GlobeViewController.mm b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/GlobeViewController.mm index a0b22b49d3..b5de5a009b 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/GlobeViewController.mm +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/GlobeViewController.mm @@ -3,7 +3,7 @@ * WhirlyGlobeTester * * Created by Steve Gifford on 10/26/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/InteractionLayer.h b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/InteractionLayer.h index a1e1615b4a..7ffc027f70 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/InteractionLayer.h +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/InteractionLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobeTester * * Created by Steve Gifford on 10/26/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/InteractionLayer.mm b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/InteractionLayer.mm index 611e1b91ce..18f5c29878 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/InteractionLayer.mm +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/InteractionLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobeTester * * Created by Steve Gifford on 10/26/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OptionsViewController.h b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OptionsViewController.h index 09a04f24f0..3df8eef10f 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OptionsViewController.h +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OptionsViewController.h @@ -3,7 +3,7 @@ * WhirlyGlobeTester * * Created by Steve Gifford on 11/12/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OptionsViewController.mm b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OptionsViewController.mm index 4103d145b1..d6d3befe56 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OptionsViewController.mm +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OptionsViewController.mm @@ -3,7 +3,7 @@ * WhirlyGlobeTester * * Created by Steve Gifford on 11/12/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OverlayViewController.h b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OverlayViewController.h index 852df9bfc6..55bbe723ac 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OverlayViewController.h +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OverlayViewController.h @@ -3,7 +3,7 @@ * WhirlyGlobeTester * * Created by Steve Gifford on 1/4/12. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OverlayViewController.m b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OverlayViewController.m index 9a7278d3f6..372d8b59b4 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OverlayViewController.m +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/OverlayViewController.m @@ -3,7 +3,7 @@ * WhirlyGlobeTester * * Created by Steve Gifford on 1/4/12. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/PanDelegateFixed.h b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/PanDelegateFixed.h index 07a16913dc..6043ef9231 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/PanDelegateFixed.h +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/PanDelegateFixed.h @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 4/28/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/PanDelegateFixed.mm b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/PanDelegateFixed.mm index b91ac00214..30cc5f53ac 100644 --- a/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/PanDelegateFixed.mm +++ b/ios/apps/code graveyard/WhirlyGlobeTester/WhirlyGlobeTester/PanDelegateFixed.mm @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 4/28/11. - * Copyright 2011 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/WhirlyGlobeMaplyComponent.xcodeproj/project.pbxproj b/ios/library/WhirlyGlobe-MaplyComponent/WhirlyGlobeMaplyComponent.xcodeproj/project.pbxproj index 475c643cc1..c5b3d7c2d2 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/WhirlyGlobeMaplyComponent.xcodeproj/project.pbxproj +++ b/ios/library/WhirlyGlobe-MaplyComponent/WhirlyGlobeMaplyComponent.xcodeproj/project.pbxproj @@ -982,6 +982,7 @@ 31942FE7254B5C0A0006B499 /* maply_pb_decode.h in Headers */ = {isa = PBXBuildFile; fileRef = 31942FC5254B5C0A0006B499 /* maply_pb_decode.h */; }; 3194300A254B77F00006B499 /* vector_tile.pb.c in Sources */ = {isa = PBXBuildFile; fileRef = 31943009254B77F00006B499 /* vector_tile.pb.c */; }; 31A2B37F26AA136A00221CFF /* Expect.h in Headers */ = {isa = PBXBuildFile; fileRef = 31A2B37E26AA136900221CFF /* Expect.h */; }; + 31CAB8DF2792126A00A5F744 /* GeographicLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31CAB8DE2792126A00A5F744 /* GeographicLib.cpp */; }; C490572A265AB9E3001E4A98 /* bucketalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4905728265AB9E3001E4A98 /* bucketalloc.cpp */; }; C490572B265AB9E3001E4A98 /* bucketalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = C4905729265AB9E3001E4A98 /* bucketalloc.h */; }; C490572D265ABAB8001E4A98 /* glues.h in Headers */ = {isa = PBXBuildFile; fileRef = C490572C265ABAB8001E4A98 /* glues.h */; }; @@ -1987,8 +1988,8 @@ 31942FC5254B5C0A0006B499 /* maply_pb_decode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = maply_pb_decode.h; sourceTree = ""; }; 31943009254B77F00006B499 /* vector_tile.pb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vector_tile.pb.c; path = ../../../../common/WhirlyGlobeLib/src/vector_tile.pb.c; sourceTree = ""; }; 31A2B37E26AA136900221CFF /* Expect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Expect.h; path = ../../../../common/WhirlyGlobeLib/include/Expect.h; sourceTree = ""; }; - E56DB3D41D6B1B17007000D2 /* SLDStyleSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SLDStyleSet.h; sourceTree = ""; }; - E56DB3D71D6B1B5A007000D2 /* SLDStyleSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SLDStyleSet.m; sourceTree = ""; }; + 31CAB8DD27920F4A00A5F744 /* GeographicLib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GeographicLib.h; path = ../../../../common/WhirlyGlobeLib/include/GeographicLib.h; sourceTree = ""; }; + 31CAB8DE2792126A00A5F744 /* GeographicLib.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = GeographicLib.cpp; path = ../../../../common/WhirlyGlobeLib/src/GeographicLib.cpp; sourceTree = ""; }; C4905728265AB9E3001E4A98 /* bucketalloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bucketalloc.cpp; sourceTree = ""; }; C4905729265AB9E3001E4A98 /* bucketalloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bucketalloc.h; sourceTree = ""; }; C490572C265ABAB8001E4A98 /* glues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glues.h; path = ../../include/glues.h; sourceTree = ""; }; @@ -2129,6 +2130,7 @@ 2B446AF221F79A5F0078A975 /* WhirlyGeometry.h */, 2B446AF621F79A5F0078A975 /* WhirlyOctEncoding.h */, 2B446AF721F79A5F0078A975 /* WhirlyVector.h */, + 31CAB8DD27920F4A00A5F744 /* GeographicLib.h */, ); name = "geometry utils"; sourceTree = ""; @@ -2149,6 +2151,7 @@ 2B446B0D21F79AD00078A975 /* WhirlyGeometry.cpp */, 2B446B0A21F79AD00078A975 /* WhirlyOctEncoding.cpp */, 2B446B0E21F79AD00078A975 /* WhirlyVector.cpp */, + 31CAB8DE2792126A00A5F744 /* GeographicLib.cpp */, ); name = "geometry utils"; sourceTree = ""; @@ -4941,6 +4944,7 @@ 2B82B6B11E82E24A0095FB14 /* PJ_sts.c in Sources */, 2B82B6611E82E24A0095FB14 /* pj_errno.c in Sources */, 2B3F451A243F8FBF00F85414 /* MaplyVectorStyleC.cpp in Sources */, + 31CAB8DF2792126A00A5F744 /* GeographicLib.cpp in Sources */, 2B8A78DE228C851D008B0A1F /* MaplyBaseInteractionLayer.mm in Sources */, 2B8A78A022864901008B0A1F /* MarkerManager.cpp in Sources */, 2B82B6751E82E24A0095FB14 /* PJ_imw_p.c in Sources */, diff --git a/ios/library/WhirlyGlobe-MaplyComponent/WhirlyGlobeMaplyComponent/WhirlyGlobeMaplyComponent.h b/ios/library/WhirlyGlobe-MaplyComponent/WhirlyGlobeMaplyComponent/WhirlyGlobeMaplyComponent.h index 493429c064..46d9dbb6d3 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/WhirlyGlobeMaplyComponent/WhirlyGlobeMaplyComponent.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/WhirlyGlobeMaplyComponent/WhirlyGlobeMaplyComponent.h @@ -3,7 +3,7 @@ // WhirlyGlobeMaplyComponent // // Created by Steve Gifford on 6/29/16. -// Copyright © 2016-2019 mousebird consulting. +// Copyright 2016-2019 mousebird consulting. // #import diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/GlobeTapMessage.h b/ios/library/WhirlyGlobe-MaplyComponent/include/GlobeTapMessage.h index e5e8668956..c61b3a58fe 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/GlobeTapMessage.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/GlobeTapMessage.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/3/11. - * Copyright 2011-2017 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyBridge.h b/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyBridge.h index cc48d41188..cd3fb0ca2a 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyBridge.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyBridge.h @@ -3,7 +3,7 @@ * MaplyBridge * * Created by jmnavarro on 7/19/15. - * Copyright 2015 mousebird consulting + * Copyright 2015-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyComponent.h b/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyComponent.h index 2a7c904392..ee729c63d3 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyComponent.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/MaplyComponent.h @@ -3,7 +3,7 @@ * MaplyComponent * * Created by Steve Gifford on 9/6/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/MaplySharedAttributes.h b/ios/library/WhirlyGlobe-MaplyComponent/include/MaplySharedAttributes.h index 21eb048a72..00bd24d551 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/MaplySharedAttributes.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/MaplySharedAttributes.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/19/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -224,6 +224,9 @@ extern NSString* const kMaplyWideVecCoordTypeScreen; /// Controls the wide vector implementation. Basic implementation by default. extern NSString* const kMaplyWideVecImpl; +/// Default/old implementation of the wide vectors +extern NSString* const kMaplyWideVecImplDefault; + /// Performance implementation of the wide vectors extern NSString* const kMaplyWideVecImplPerf; @@ -265,6 +268,9 @@ extern NSString* const kMaplyWideVecTexRepeatLen; /// Offset to left (negative) or right (positive) of the centerline extern NSString* const kMaplyWideVecOffset; +/// Close any un-closed areal features when drawing lines for them +extern NSString* const kMaplyVecCloseAreals; + /// If set we'll break up a vector feature to the given epsilon on a globe surface extern NSString* const kMaplySubdivEpsilon; /// If subdiv epsilon is set we'll look for a subdivision type. Default is simple. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/UIKit/NSData+Zlib.h b/ios/library/WhirlyGlobe-MaplyComponent/include/UIKit/NSData+Zlib.h index b692ca08d3..4a28f18d36 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/UIKit/NSData+Zlib.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/UIKit/NSData+Zlib.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/7/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/WhirlyGlobeComponent.h b/ios/library/WhirlyGlobe-MaplyComponent/include/WhirlyGlobeComponent.h index 1576531a91..4faafd6995 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/WhirlyGlobeComponent.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/WhirlyGlobeComponent.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyActiveObject.h b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyActiveObject.h index 0c32cdf4c8..864e8534ef 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyActiveObject.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyActiveObject.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 4/3/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyAnnotation.h b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyAnnotation.h index e88584244f..271dbc9093 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyAnnotation.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyAnnotation.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 12/13/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyBaseViewController.h b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyBaseViewController.h index 34aab3764d..9959b97399 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyBaseViewController.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyBaseViewController.h @@ -2,7 +2,7 @@ * MaplyComponent * * Created by Steve Gifford on 12/14/12. - * Copyright 2012-2021 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,7 @@ #import "rendering/MaplyVertexAttribute.h" typedef double (^ZoomEasingBlock)(double z0,double z1,double t); +typedef void (__strong ^InitCompletionBlock)(void); /** When selecting multiple objects, one or more of these is returned. @@ -1293,6 +1294,15 @@ typedef double (^ZoomEasingBlock)(double z0,double z1,double t); */ - (MaplyCoordinate3dD)displayPointFromGeoD:(MaplyCoordinate)geoCoord; +/** + Utility routine to convert from a lat/lon (in radians) to display coordinates + + This is a simple routine to get display coordinates from geocoordinates. Display coordinates for the globe are based on a radius of 1.0 and an origin of (0,0,0). + + @return The input coordinate in display coordinates. + */ +- (MaplyCoordinate3dD)displayPointFromGeoDD:(MaplyCoordinateD)geoCoord; + /** If you've paused the animation earlier, this will start it again. @@ -1453,7 +1463,7 @@ typedef double (^ZoomEasingBlock)(double z0,double z1,double t); - (void)disable3dTouchSelection; /** - Return all the selectable objects at the given location. + Return all the selectable vector objects at the given location. Objects can be selected via the delegate or the search can be run directly here. @@ -1461,6 +1471,15 @@ typedef double (^ZoomEasingBlock)(double z0,double z1,double t); */ - (NSArray * _Nullable)objectsAtCoord:(MaplyCoordinate)coord; +/** + Return all the selectable labels and markers at the given location. + + Objects can be selected via the delegate or the search can be run directly here. + + This is not thread safe and will block the main thread. + */ +- (NSArray * _Nullable)labelsAndMarkersAtCoord:(MaplyCoordinate)coord; + /// Turn on/off performance output (goes to the log periodically). @property (nonatomic,assign) bool performanceOutput; @@ -1554,4 +1573,10 @@ typedef double (^ZoomEasingBlock)(double z0,double z1,double t); /// Return the renderer type being used - (MaplyRenderType)getRenderType; +/** + Blocks to be called after the view is set up, or immediately if it is already set up. + Similar to `addPostSurfaceRunnable` on Android. +*/ +- (void)addPostInitBlock:(_Nonnull InitCompletionBlock)block; + @end diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyControllerLayer.h b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyControllerLayer.h index 04dc405b62..d8775d064f 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyControllerLayer.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyControllerLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 10/25/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyGlobeRenderController.h b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyGlobeRenderController.h index 03d03cb1b7..27a9e33ca4 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyGlobeRenderController.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyGlobeRenderController.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 10/23/10. -* Copyright 2011-2019 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyRenderController.h b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyRenderController.h index 59020be6f1..69ff44b5eb 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyRenderController.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyRenderController.h @@ -3,7 +3,7 @@ * WhirlyGlobeMaplyComponent * * Created by Stephen Gifford on 1/19/18. - * Copyright 2012-2021 Saildrone Inc. + * Copyright 2012-2022 Saildrone Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyUpdateLayer.h b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyUpdateLayer.h index 427a566ad7..d11f8ff778 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyUpdateLayer.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyUpdateLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 4/13/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyViewController.h b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyViewController.h index 5374d6fd14..90334ce41f 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyViewController.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyViewController.h @@ -1,9 +1,8 @@ -/* - * MaplyViewController.h +/* MaplyViewController.h * MaplyComponent * * Created by Steve Gifford on 9/6/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import @@ -586,24 +584,48 @@ typedef NS_ENUM(NSInteger, MaplyMapType) { @param pos Where the view will be looking. */ -- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox pos:(MaplyCoordinate)pos; +- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox + pos:(MaplyCoordinate)pos; /** Find a height that shows the given bounding box. - This method will search for a height that shows the given bounding box within the view. The search is inefficient, so don't call this a lot. - - This version takes a margin to add around the outside of the area. + + This version takes a margin to add around the outside of the area. Positive margins increase the screen area considered, making the + given area larger. Negative margins make the specified area smaller. @param bbox The bounding box (in radians) we're trying to view. - @param pos Where the view will be looking. - @param marginX Horizontal boundary around the area - @param marginY Vertical boundary around the area */ -- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox pos:(MaplyCoordinate)pos marginX:(double)marginX marginY:(double)marginY; +- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox + pos:(MaplyCoordinate)pos + marginX:(double)marginX + marginY:(double)marginY; + +/** + Find a height that shows the given bounding box. + This method will search for a height that shows the given bounding box within the view. The search is inefficient, so don't call this a lot. + + This version takes a margin to add around the outside of the area. Positive margins increase the screen area considered, making the + given area larger. Negative margins make the specified area smaller. + + This version attempts to place the given bounds within a rectangle other than the whole view frame. + + @param bbox The bounding box (in radians) we're trying to view. + @param pos Where the view will be looking. + @param frame The screen area to consider. + @param newPos (out,optional) The center location needed to place \c pos at the center of \c frame + @param marginX Horizontal boundary around the area + @param marginY Vertical boundary around the area + */ +- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox + pos:(MaplyCoordinate)pos + frame:(CGRect)frame + newPos:(MaplyCoordinate *_Nullable)newPos + marginX:(double)marginX + marginY:(double)marginY; /** diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyViewTracker.h b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyViewTracker.h index d8d36bc539..b61634a833 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyViewTracker.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/control/MaplyViewTracker.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/26/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/control/WhirlyGlobeViewController.h b/ios/library/WhirlyGlobe-MaplyComponent/include/control/WhirlyGlobeViewController.h index 3aa2874e73..9e50b02689 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/control/WhirlyGlobeViewController.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/control/WhirlyGlobeViewController.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -718,6 +718,47 @@ */ - (float)findHeightToViewBounds:(MaplyBoundingBox)bbox pos:(MaplyCoordinate)pos; +/** + Find a height that shows the given bounding box. + This method will search for a height that shows the given bounding box within the view. The search is inefficient, so don't call this a lot. + + This version takes a margin to add around the outside of the area. Positive margins increase the screen area considered, making the + given area larger. Negative margins make the specified area smaller. + + @param bbox The bounding box (in radians) we're trying to view. + @param pos Where the view will be looking. + @param marginX Horizontal boundary around the area + @param marginY Vertical boundary around the area + */ +- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox + pos:(MaplyCoordinate)pos + marginX:(double)marginX + marginY:(double)marginY; + +/** + Find a height that shows the given bounding box. + This method will search for a height that shows the given bounding box within the view. The search is inefficient, so don't call this a lot. + + This version takes a margin to add around the outside of the area. Positive margins increase the screen area considered, making the + given area larger. Negative margins make the specified area smaller. + + This version attempts to place the given bounds within a rectangle other than the whole view frame. + Note that this doesn't work well when the bounds are very large. + + @param bbox The bounding box (in radians) we're trying to view. + @param pos Where the view will be looking. + @param frame The screen area to consider. + @param newPos (out,optional) The center location needed to place \c pos at the center of \c frame + @param marginX Horizontal boundary around the area + @param marginY Vertical boundary around the area + */ +- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox + pos:(MaplyCoordinate)pos + frame:(CGRect)frame + newPos:(MaplyCoordinate *_Nullable)newPos + marginX:(double)marginX + marginY:(double)marginY; + /** Return the extents of the current view. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/data_sources/MaplyMBTileFetcher.h b/ios/library/WhirlyGlobe-MaplyComponent/include/data_sources/MaplyMBTileFetcher.h index 3f485f5f1f..21daca15e5 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/data_sources/MaplyMBTileFetcher.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/data_sources/MaplyMBTileFetcher.h @@ -1,9 +1,8 @@ -/* - * MaplyMBTileFetcher.h +/* MaplyMBTileFetcher.h * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/13/18. - * Copyright 2011-2019 mousebird consulting inc + * Copyright 2011-2022 mousebird consulting inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "loading/MaplyTileSourceNew.h" @@ -35,6 +33,10 @@ /// Initialize with the name of the local MBTiles file - (nullable instancetype)initWithMBTiles:(NSString *__nonnull)fileName; +/// Initialize with the name of the local MBTiles file and cache size in bytes (rounded up to whole pages) +- (nullable instancetype)initWithMBTiles:(NSString *__nonnull)fileName + cacheSize:(int)cacheSize; + // Coordinate system (probably Spherical Mercator) - (MaplyCoordinateSystem * __nonnull)coordSys; diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/data_sources/MaplyWMSTileSource.h b/ios/library/WhirlyGlobe-MaplyComponent/include/data_sources/MaplyWMSTileSource.h index 64ffffa48d..55a5397d57 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/data_sources/MaplyWMSTileSource.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/data_sources/MaplyWMSTileSource.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 7/25/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeDoubleTapDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeDoubleTapDelegate.h index 3449216fc6..3162d69c21 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeDoubleTapDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeDoubleTapDelegate.h @@ -3,7 +3,7 @@ * * * Created by Steve Gifford on 2/7/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeDoubleTapDragDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeDoubleTapDragDelegate.h index 13a0f14c28..8446c236a0 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeDoubleTapDragDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeDoubleTapDragDelegate.h @@ -3,7 +3,7 @@ * * * Created by Steve Gifford on 2/7/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobePanDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobePanDelegate.h index ff24be7629..b02de88529 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobePanDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobePanDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 4/28/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobePinchDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobePinchDelegate.h index a430c4322c..3c6c2e1ebd 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobePinchDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobePinchDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 8/22/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeRotateDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeRotateDelegate.h index 20f0b76767..847483e953 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeRotateDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeRotateDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/10/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeTapDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeTapDelegate.h index 8ba6efe2e5..fde8b8d044 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeTapDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeTapDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/3/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeTiltDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeTiltDelegate.h index 302a63bfc5..738bec6e83 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeTiltDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeTiltDelegate.h @@ -2,7 +2,7 @@ * TiltDelegate.h * * Created by Stephen Gifford on 1/5/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeTwoFingerTapDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeTwoFingerTapDelegate.h index 054310a502..9ea9c6d9e3 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeTwoFingerTapDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/GlobeTwoFingerTapDelegate.h @@ -3,7 +3,7 @@ * * * Created by Steve Gifford on 2/7/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyDoubleTapDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyDoubleTapDelegate.h index 62dcd3347e..720b7deec8 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyDoubleTapDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyDoubleTapDelegate.h @@ -3,7 +3,7 @@ * * * Created by Jesse Crocker on 2/3/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyDoubleTapDragDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyDoubleTapDragDelegate.h index b04cfeb55d..813523eec5 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyDoubleTapDragDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyDoubleTapDragDelegate.h @@ -3,7 +3,7 @@ * * * Created by Steve Gifford on 2/7/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyPanDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyPanDelegate.h index a406e23b2d..3206eb3894 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyPanDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyPanDelegate.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/10/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyPinchDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyPinchDelegate.h index 885e0cffd6..9c6144fc64 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyPinchDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyPinchDelegate.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/10/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyRotateDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyRotateDelegate.h index 1db3c6a9de..4f8db0cb0d 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyRotateDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyRotateDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by rghosh0 around 9/26/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTapDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTapDelegate.h index 450739a23c..6f2187cbb6 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTapDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTapDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/20/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTapMessage.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTapMessage.h index 584dadfc4e..3fa054eb69 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTapMessage.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTapMessage.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 9/19/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTouchCancelAnimationDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTouchCancelAnimationDelegate.h index 8d711747ce..8f8f835310 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTouchCancelAnimationDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTouchCancelAnimationDelegate.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Jesse Crocker on 7/15/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTwoFingerTapDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTwoFingerTapDelegate.h index 727f751a4c..6adc6df56e 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTwoFingerTapDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyTwoFingerTapDelegate.h @@ -3,7 +3,7 @@ * * * Created by Jesse Crocker on 2/4/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyZoomGestureDelegate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyZoomGestureDelegate.h index 1933030e9e..574c5e5609 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyZoomGestureDelegate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/gestures/MaplyZoomGestureDelegate.h @@ -1,9 +1,7 @@ -/* - * MaplyZoomGestureDelegate.h - * +/* MaplyZoomGestureDelegate.h * * Created by Jesse Crocker on 2/4/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyGeomBuilder.h b/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyGeomBuilder.h index 4d751d8d3c..d7562a0401 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyGeomBuilder.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyGeomBuilder.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 1/20/16 - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyIconManager.h b/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyIconManager.h index f82a1dcd9d..b97196eed1 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyIconManager.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyIconManager.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/11/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,6 +84,10 @@ **/ + (nullable UIImage *)iconForName:(NSString *__nullable)name size:(CGSize)size color:(UIColor *__nullable)color circleColor:(UIColor *__nullable)circleColor strokeSize:(float)strokeSize strokeColor:(UIColor *__nullable)strokeColor; +/** Clear the cache + */ ++ (void)clearIconCache; + /** Set up the icon manager this way to build textures associated with a particular view controller. */ @@ -125,6 +129,11 @@ */ - (NSArray * __nonnull)addFeatures:(NSArray * __nonnull)vecObjs mode:(MaplyThreadMode)mode; +/** Clear the icon cache. + Any references to the textures should already be cleared. + */ +- (void)clearCache; + /// Delete any cached textures and such - (void)shutdown; diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyLocationTracker.h b/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyLocationTracker.h index 3ca2210d28..485ab605ed 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyLocationTracker.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyLocationTracker.h @@ -3,7 +3,7 @@ * MaplyComponent * * Created by Ranen Ghosh on 11/23/16. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyTextureBuilder.h b/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyTextureBuilder.h index f58bd1ed21..74d842cd8e 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyTextureBuilder.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/helpers/MaplyTextureBuilder.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/30/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/GeoJSONSource.h b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/GeoJSONSource.h index 4995fa8d28..829aaaa2a0 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/GeoJSONSource.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/GeoJSONSource.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Ranen Ghosh on 2016-11-18. - * Copyright 2016-2021 mousebird consulting + * Copyright 2016-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyImageTile.h b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyImageTile.h index b5d07363e4..5dcbe9bf15 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyImageTile.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyImageTile.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 10/18/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadImageFrameLoader.h b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadImageFrameLoader.h index 9388dc1b31..45f1553c41 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadImageFrameLoader.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadImageFrameLoader.h @@ -2,7 +2,7 @@ * MaplyQuadImageFrameLoader.h * * Created by Steve Gifford on 9/13/18. - * Copyright 2012-2018 mousebird consulting inc + * Copyright 2012-2022 mousebird consulting inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadImageLoader.h b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadImageLoader.h index f0baa94013..ed1c9b6de5 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadImageLoader.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadImageLoader.h @@ -2,7 +2,7 @@ * MaplyQuadImageLoader.h * * Created by Steve Gifford on 4/10/18. - * Copyright 2012-2018 Saildrone Inc + * Copyright 2012-2022 Saildrone Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadLoader.h b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadLoader.h index cc0a516381..5f9e49e971 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadLoader.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadLoader.h @@ -2,7 +2,7 @@ * MaplyQuadLoader.h * * Created by Steve Gifford on 2/12/19. - * Copyright 2012-2019 Saildrone Inc + * Copyright 2012-2022 Saildrone Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -191,6 +191,9 @@ /// Set the interpreter for the data coming back. If you're just getting images, don't set this. - (void)setInterpreter:(NSObject * __nonnull)interp; +/// Return the current interpreter +- (NSObject * __nullable)getInterpreter; + /** Change the interpreter and reload all the data.
diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadPagingLoader.h b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadPagingLoader.h index bab1c6a578..adc40d5dd5 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadPagingLoader.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadPagingLoader.h @@ -2,7 +2,7 @@ * MaplyQuadPagingLoader.h * * Created by Steve Gifford on 2/21/91. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadSampler.h b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadSampler.h index 6d8f8b2f8e..422a0a42ae 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadSampler.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyQuadSampler.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 3/27/18. - * Copyright 2011-2019 Saildrone Inc + * Copyright 2011-2022 Saildrone Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyRemoteTileFetcher.h b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyRemoteTileFetcher.h index d4d6b166f0..109f764d66 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyRemoteTileFetcher.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyRemoteTileFetcher.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/15/18. - * Copyright 2011-2019 Saildrone Inc + * Copyright 2011-2022 Saildrone Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -134,12 +134,12 @@ fetchInfo is a MaplyRemoteTileFetchInfo describing the rest of the tile characteristics. tileID is the tile in question. */ -- (NSData * __nullable)dataForTile:(MaplyRemoteTileFetchInfo * __nonnull)fetchInfo tileID:(MaplyTileID)tileID; +- (id __nullable)dataForTile:(MaplyRemoteTileFetchInfo * __nonnull)fetchInfo tileID:(MaplyTileID)tileID; @end /** - If a tile fetch request fails, this object allows you second change to provide the data. + If a tile fetch request fails, this object allows you second chance to provide the data. Maybe you have an old version in a cache somewhere. Provide that. Or fail and the tile fetch will continue to fail. */ @@ -150,7 +150,7 @@ This might be an old version of the data you have lying around. It's up to you. Returning nil means the fetch fails as normal. */ -- (NSData * __nullable)dataForTile:(MaplyRemoteTileFetchInfo * __nonnull)fetchInfo tileID:(MaplyTileID)tileID; +- (id __nullable)dataForTile:(MaplyRemoteTileFetchInfo * __nonnull)fetchInfo tileID:(MaplyTileID)tileID; @end @@ -173,11 +173,11 @@ /// Local storage is for pre-downloaded tiles, rather than a cache. This is consulted *before* we go out to the network. /// If it fails, then we hit the local file cache and then we hit the network -- (void)setLocalStorage:(NSObject * __nonnull)localStorage; +- (void)setLocalStorage:(NSObject * __nullable)localStorage; /// After a tile fails to load from local storage, local cache and then a remote request, you have one more chance to provide the data /// Useful if you've got an old version of the tile lying around you might use in a pinch -- (void)setSecondChance:(NSObject * __nonnull)secondChance; +- (void)setSecondChance:(NSObject * __nullable)secondChance; /// Return the fetching stats since the beginning or since the last reset - (MaplyRemoteTileFetcherStats * __nullable)getStats:(bool)allTime; diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplySimpleTileFetcher.h b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplySimpleTileFetcher.h index 7c7858446d..58f3910e75 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplySimpleTileFetcher.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplySimpleTileFetcher.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/31/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyTileSourceNew.h b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyTileSourceNew.h index a1004a73a7..94560e922e 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyTileSourceNew.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/loading/MaplyTileSourceNew.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/13/18. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/math/MaplyCoordinate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/math/MaplyCoordinate.h index 5d16811af3..d1c01e8a6d 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/math/MaplyCoordinate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/math/MaplyCoordinate.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/math/MaplyCoordinateSystem.h b/ios/library/WhirlyGlobe-MaplyComponent/include/math/MaplyCoordinateSystem.h index 23b0496c6f..4339066391 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/math/MaplyCoordinateSystem.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/math/MaplyCoordinateSystem.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/13/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/math/MaplyMatrix.h b/ios/library/WhirlyGlobe-MaplyComponent/include/math/MaplyMatrix.h index 7d4d5ccc39..646a29bf6b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/math/MaplyMatrix.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/math/MaplyMatrix.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 10/16/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/math/WGCoordinate.h b/ios/library/WhirlyGlobe-MaplyComponent/include/math/WGCoordinate.h index a4013a1e79..82da582596 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/math/WGCoordinate.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/math/WGCoordinate.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/17/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/ImageTexture_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/ImageTexture_private.h index 459ab2bfd9..0ac7d87828 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/ImageTexture_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/ImageTexture_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/19/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MapboxVectorStyleSet_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MapboxVectorStyleSet_private.h index 62bcda70a5..176d3ab015 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MapboxVectorStyleSet_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MapboxVectorStyleSet_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 4/8/20. -* Copyright 2011-2020 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MapboxVectorTiles_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MapboxVectorTiles_private.h index dae9ce3032..c3d6c600ce 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MapboxVectorTiles_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MapboxVectorTiles_private.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/10/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyActiveObject_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyActiveObject_private.h index a578bcdccc..02250d9fd5 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyActiveObject_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyActiveObject_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 4/3/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyAnnotation_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyAnnotation_private.h index 97485e5077..af2473453b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyAnnotation_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyAnnotation_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 12/13/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyBaseInteractionLayer_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyBaseInteractionLayer_private.h index 890cc6ef94..093bc4d641 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyBaseInteractionLayer_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyBaseInteractionLayer_private.h @@ -2,7 +2,7 @@ * MaplyComponent * * Created by Steve Gifford on 12/14/12. - * Copyright 2012-2021 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -205,10 +205,13 @@ - (void)removeImageTexture:(MaplyTexture *__nonnull)tex changes:(WhirlyKit::ChangeSet &)changes; // Do a point in poly check for vectors we're representing -- (NSArray *__nullable)findVectorsInPoint:(WhirlyKit::Point2f)pt; - (NSArray *__nullable)findVectorsInPoint:(WhirlyKit::Point2f)pt inView:(MaplyBaseViewController*__nullable)vc multi:(bool)multi; +// Find MaplySelectableObjects at a screen point - (NSObject*__nullable)selectLabelsAndMarkerForScreenPoint:(CGPoint)screenPoint; +- (NSMutableArray*__nullable)selectMultipleLabelsAndMarkersForScreenPoint:(CGPoint)screenPoint; +- (NSMutableArray*__nullable)convertSelectedObjects:(const std::vector &)selectedObjs; +- (NSMutableArray*__nullable)convertSelectedVecObjects:(NSArray*__nullable)vecObjs; // Find the Maply object corresponding to the given ID (from the selection manager). // Thread-safe diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyBaseViewController_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyBaseViewController_private.h index 22bb964b2b..868df0589b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyBaseViewController_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyBaseViewController_private.h @@ -3,7 +3,7 @@ * MaplyComponent * * Created by Steve Gifford on 12/14/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ #import "FontTextureManager_iOS.h" #import "ViewWrapper.h" -@interface MaplyBaseViewController() +@interface MaplyBaseViewController() { @public MaplyRenderController *renderControl; diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyComponentObject_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyComponentObject_private.h index 02a4ea4c2f..a8d990ddeb 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyComponentObject_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyComponentObject_private.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyControllerLayer_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyControllerLayer_private.h index a8a46078e5..8f3c4cc3a6 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyControllerLayer_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyControllerLayer_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyCoordinateSystem_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyCoordinateSystem_private.h index 3eee0502a7..4f4829bd38 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyCoordinateSystem_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyCoordinateSystem_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/13/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyGeomBuilder_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyGeomBuilder_private.h index c5379fdd4b..abb9b5225b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyGeomBuilder_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyGeomBuilder_private.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 1/20/16 - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyGeomModel_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyGeomModel_private.h index 877fe2006d..07edbad6a4 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyGeomModel_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyGeomModel_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 12/1/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyGlobeRenderController_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyGlobeRenderController_private.h index 6788854983..cb3967207f 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyGlobeRenderController_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyGlobeRenderController_private.h @@ -3,7 +3,7 @@ * WhirlyGlobeMaplyComponent * * Created by Stephen Gifford on 11/6/19. - * Copyright 2012-2019 mousebird consulting inc + * Copyright 2012-2022 mousebird consulting inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyImageTile_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyImageTile_private.h index ccaa8ee946..ea4830ecef 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyImageTile_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyImageTile_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 10/18/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyInteractionLayer_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyInteractionLayer_private.h index 409b8cb9a4..546ca39184 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyInteractionLayer_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyInteractionLayer_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/19/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyMatrix_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyMatrix_private.h index 0701211866..e8d40d55be 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyMatrix_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyMatrix_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 10/16/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyParticleSystem_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyParticleSystem_private.h index 1e7c43ef7f..9b902a0933 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyParticleSystem_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyParticleSystem_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 4/26/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyPoints_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyPoints_private.h index 8efbceab8e..7674eb07cf 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyPoints_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyPoints_private.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 10/21/15 - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyQuadImageLoader_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyQuadImageLoader_private.h index 88e0deb078..d94d35af06 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyQuadImageLoader_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyQuadImageLoader_private.h @@ -2,7 +2,7 @@ * MaplyQuadImageLoader_private.h * * Created by Steve Gifford on 4/10/18. - * Copyright 2012-2018 Saildrone Inc + * Copyright 2012-2022 Saildrone Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyQuadLoader_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyQuadLoader_private.h index 173ee71336..ce815444ae 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyQuadLoader_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyQuadLoader_private.h @@ -2,7 +2,7 @@ * MaplyQuadImageLoader_private.h * * Created by Steve Gifford on 2/12/19. - * Copyright 2012-2019 mousebird consulting inc + * Copyright 2012-2022 mousebird consulting inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyQuadSampler_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyQuadSampler_private.h index 4ecbe2c818..d364d6c488 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyQuadSampler_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyQuadSampler_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/15/18. - * Copyright 2011-2019 Saildrone Inc + * Copyright 2011-2022 Saildrone Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyRenderController_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyRenderController_private.h index f593508f24..9de57a550a 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyRenderController_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyRenderController_private.h @@ -3,7 +3,7 @@ * WhirlyGlobeMaplyComponent * * Created by Stephen Gifford on 1/19/18. - * Copyright 2012-2018 Saildrone Inc. + * Copyright 2012-2022 Saildrone Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyRenderTarget_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyRenderTarget_private.h index 429463b491..f85ce0541b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyRenderTarget_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyRenderTarget_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/13/17. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyScreenObject_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyScreenObject_private.h index 7a5340dfd4..19c26b764b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyScreenObject_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyScreenObject_private.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 3/2/15 - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyShader_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyShader_private.h index 0dfea633b2..5fadbc0a14 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyShader_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyShader_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/7/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyShape_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyShape_private.h index 16c30bf96d..c4e31ae238 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyShape_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyShape_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 7/13/15. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyTextureAtlas_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyTextureAtlas_private.h index d2e102cb75..d7bc4519cc 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyTextureAtlas_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyTextureAtlas_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/11/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyTexture_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyTexture_private.h index e04e01283e..496c797468 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyTexture_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyTexture_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 10/25/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyUpdateLayer_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyUpdateLayer_private.h index 7a6da0a293..2760ff6a19 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyUpdateLayer_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyUpdateLayer_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 4/13/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVariableTarget_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVariableTarget_private.h index 4356a11242..09b7bc5cbe 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVariableTarget_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVariableTarget_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/18/18. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVectorObject_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVectorObject_private.h index a03f1850d7..abd8f3090a 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVectorObject_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVectorObject_private.h @@ -1,9 +1,8 @@ -/* - * WGVectorObject_private.h +/* WGVectorObject_private.h * WhirlyGlobeComponent * * Created by Steve Gifford on 8/2/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "visual_objects/MaplyVectorObject.h" @@ -31,9 +29,9 @@ } // Construct as a wrapper -- (id)initWithRef:(const WhirlyKit::VectorObjectRef&)vecObj; +- (id)initWithRef:(WhirlyKit::VectorObjectRef)vecObj; // Construct a vector object from the Vector DB raw format -- (void)addShape:(const WhirlyKit::VectorShapeRef&)shape; +- (void)addShape:(WhirlyKit::VectorShapeRef)shape; @end diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVectorStyle_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVectorStyle_private.h index 66c4f5f2d6..47ec96c283 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVectorStyle_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVectorStyle_private.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -97,9 +97,10 @@ class MapboxVectorStyleSetImpl_iOS : public MapboxVectorStyleSetImpl const std::vector &dashComponents) override; /// Make platform specific label info object (ideally we're caching these) - virtual LabelInfoRef makeLabelInfo(PlatformThreadInfo *_Nullable inst, - const std::vector &fontName, - float fontSize) override; + virtual LabelInfoRef makeLabelInfo(PlatformThreadInfo *_Nullable, + const std::vector &fontNames, + float fontHeight, + bool mergedSymbol) override; /// Create a local platform label (fonts are local, and other stuff) virtual SingleLabelRef makeSingleLabel(PlatformThreadInfo *_Nullable inst, diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVertexAttribute_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVertexAttribute_private.h index 6262a51a5b..db777d451d 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVertexAttribute_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyVertexAttribute_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 11/29/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyViewController_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyViewController_private.h index 554093aba2..2aa9396a41 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyViewController_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyViewController_private.h @@ -1,9 +1,8 @@ -/* - * MaplyViewController_private.h +/* MaplyViewController_private.h * MaplyComponent * * Created by Steve Gifford on 12/14/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "MaplyViewController.h" diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyZoomGestureDelegate_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyZoomGestureDelegate_private.h index 773841c526..dd0f5684ce 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyZoomGestureDelegate_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/MaplyZoomGestureDelegate_private.h @@ -3,7 +3,7 @@ * * * Created by Jesse Crocker on 2/4/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/ViewPlacementActiveModel.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/ViewPlacementActiveModel.h index c131a11138..5dcd36f283 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/ViewPlacementActiveModel.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/ViewPlacementActiveModel.h @@ -1,9 +1,8 @@ -/* - * ViewPlacementGenerator.h +/* ViewPlacementGenerator.h * WhirlyGlobeLib * * Created by Steve Gifford on 7/25/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +14,10 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import #import -#import "WhirlyVector.h" #import "Scene.h" #import "DataLayer.h" #import "LayerThread.h" diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/WGInteractionLayer_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/WGInteractionLayer_private.h index dc513da36a..5cca9373cf 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/WGInteractionLayer_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/WGInteractionLayer_private.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/WGViewControllerLayer_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/WGViewControllerLayer_private.h index 35125c8317..b89be87e7e 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/WGViewControllerLayer_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/WGViewControllerLayer_private.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/17/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/WhirlyGlobeViewController_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/WhirlyGlobeViewController_private.h index f273227205..d75c559850 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/WhirlyGlobeViewController_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/WhirlyGlobeViewController_private.h @@ -1,9 +1,8 @@ -/* - * WhirlyGlobeViewController_private.h +/* WhirlyGlobeViewController_private.h * WhirlyGlobeComponent * * Created by Steve Gifford on 10/26/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/WorkRegion_private.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/WorkRegion_private.h index e398f11101..b191547b65 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/WorkRegion_private.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/WorkRegion_private.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Tim Sylvester on 10/19/2020. - * Copyright 2020 mousebird consulting + * Copyright 2020-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/private/sqlhelpers.h b/ios/library/WhirlyGlobe-MaplyComponent/include/private/sqlhelpers.h index 803121d522..3e67303cbe 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/private/sqlhelpers.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/private/sqlhelpers.h @@ -1,9 +1,8 @@ -/* - * sqlhelpers.h +/* sqlhelpers.h * WhirlyGlobeLib * * Created by Steve Gifford on 9/8/09. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #include diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyAtmosphere.h b/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyAtmosphere.h index e3c053b1fe..93ff18767e 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyAtmosphere.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyAtmosphere.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/30/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyLight.h b/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyLight.h index 5ca5223684..b45bdfbec8 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyLight.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyLight.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/30/13. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyRenderTarget.h b/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyRenderTarget.h index 4d7d835960..4754560fe8 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyRenderTarget.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyRenderTarget.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/13/17. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyShader.h b/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyShader.h index 2655d96c14..45e309e7af 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyShader.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyShader.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/7/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyVariableTarget.h b/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyVariableTarget.h index 54698537b4..0938db18e9 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyVariableTarget.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyVariableTarget.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/18/18. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyVertexAttribute.h b/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyVertexAttribute.h index 122f37f294..07e220ae03 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyVertexAttribute.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/rendering/MaplyVertexAttribute.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 11/29/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapboxVectorStyleSet.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapboxVectorStyleSet.h index 51565270d0..310ed63501 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapboxVectorStyleSet.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapboxVectorStyleSet.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/16/15. - * Copyright 2011-2015 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorStyle.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorStyle.h index 19e4611134..378bff48a4 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorStyle.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorStyle.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorStyleSimple.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorStyleSimple.h index 72801f4878..3897286390 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorStyleSimple.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorStyleSimple.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 3/15/16. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileLineStyle.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileLineStyle.h index a0f7217657..3576988dd1 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileLineStyle.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileLineStyle.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileMarkerStyle.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileMarkerStyle.h index b896335266..1675f9f91f 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileMarkerStyle.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileMarkerStyle.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTilePolygonStyle.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTilePolygonStyle.h index 3eb5221f5a..09d3bb1b03 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTilePolygonStyle.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTilePolygonStyle.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileStyle.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileStyle.h index f24c0c1974..0fec245322 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileStyle.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileStyle.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileTextStyle.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileTextStyle.h index ebdbd6c698..21d491ca81 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileTextStyle.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MaplyVectorTileTextStyle.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapnikStyle.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapnikStyle.h index ddeeedc86e..4f51fd323b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapnikStyle.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapnikStyle.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Jesse Crocker, Trailbehind inc. on 3/31/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapnikStyleRule.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapnikStyleRule.h index 84e1d7d5fa..f4628572ff 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapnikStyleRule.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapnikStyleRule.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Jesse Crocker, Trailbehind inc. on 3/31/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapnikStyleSet.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapnikStyleSet.h index c53b04e820..38b07fb89e 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapnikStyleSet.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/MapnikStyleSet.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Jesse Crocker, Trailbehind inc. on 3/31/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDExpressions.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDExpressions.h index 096f8ef382..43a042d28a 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDExpressions.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDExpressions.h @@ -3,7 +3,7 @@ // SLDTest // // Created by Ranen Ghosh on 2016-08-12. -// Copyright © 2016-2019 mousebird consulting. +// Copyright 2016-2019 mousebird consulting. // #import diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDOperators.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDOperators.h index bd305a777a..c9202129de 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDOperators.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDOperators.h @@ -3,7 +3,7 @@ // SLDTest // // Created by Ranen Ghosh on 2016-08-12. -// Copyright © 2016-2019 mousebird consulting. +// Copyright 2016-2019 mousebird consulting. // #import diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDStyleSet.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDStyleSet.h index 462b30ac6a..f4d4dd4658 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDStyleSet.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDStyleSet.h @@ -3,7 +3,7 @@ // SLDTest // // Created by Ranen Ghosh on 2016-08-12. -// Copyright © 2016-2019 mousebird consulting. +// Copyright 2016-2019 mousebird consulting. // #import diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDSymbolizers.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDSymbolizers.h index 9e41141ee5..c0e16c04ae 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDSymbolizers.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDSymbolizers.h @@ -3,7 +3,7 @@ // SLDTest // // Created by Ranen Ghosh on 2016-08-12. -// Copyright © 2016-2019 mousebird consulting. +// Copyright 2016-2019 mousebird consulting. // #import diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDWellKnownMarkers.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDWellKnownMarkers.h index e461154ad1..cdb4cc88c6 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDWellKnownMarkers.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_styles/SLDWellKnownMarkers.h @@ -3,7 +3,7 @@ // SLDTest // // Created by Ranen Ghosh on 2016-08-23. -// Copyright © 2016-2019 mousebird consulting. +// Copyright 2016-2019 mousebird consulting. // #import diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_tiles/MapboxVectorInterpreter.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_tiles/MapboxVectorInterpreter.h index 7cabe5b630..56cee83a47 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_tiles/MapboxVectorInterpreter.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_tiles/MapboxVectorInterpreter.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on January 24 2018 - * Copyright 2011-2019 Saildrone + * Copyright 2011-2022 Saildrone * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_tiles/MapboxVectorTiles.h b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_tiles/MapboxVectorTiles.h index afc9f8cf25..727478c07b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/vector_tiles/MapboxVectorTiles.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/vector_tiles/MapboxVectorTiles.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 4/10/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyBillboard.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyBillboard.h index e4a79e8934..55b7b86bd0 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyBillboard.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyBillboard.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 10/28/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyCluster.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyCluster.h index d95e1a8634..8b2164d355 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyCluster.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyCluster.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/29/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyComponentObject.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyComponentObject.h index c026653f26..59ccde63e4 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyComponentObject.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyComponentObject.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/18/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyGeomModel.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyGeomModel.h index db522ba8a3..bd61158db8 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyGeomModel.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyGeomModel.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 11/26/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyLabel.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyLabel.h index 2571a634df..b3bc093eaf 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyLabel.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyLabel.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/24/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyMarker.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyMarker.h index b525f29d3d..d5b58d3625 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyMarker.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyMarker.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/24/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyMoon.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyMoon.h index e147ca4f41..555060feed 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyMoon.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyMoon.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 7/2/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyParticleSystem.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyParticleSystem.h index 7a84326c2f..5fd2b0b3b3 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyParticleSystem.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyParticleSystem.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 4/26/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyPoints.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyPoints.h index 3e54fbc471..2a6088d59f 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyPoints.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyPoints.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 10/21/15 - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyScreenLabel.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyScreenLabel.h index c48bf418a2..c1da2be74c 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyScreenLabel.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyScreenLabel.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/24/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyScreenMarker.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyScreenMarker.h index 6fd9a6bdea..8a57790569 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyScreenMarker.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyScreenMarker.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyScreenObject.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyScreenObject.h index 93a599ae80..2de0e50357 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyScreenObject.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyScreenObject.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 2/28/15 - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyShape.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyShape.h index 9befbeb8ba..d4097de059 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyShape.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyShape.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/28/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyStarsModel.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyStarsModel.h index 8d4b9d9d6f..7acb0839d5 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyStarsModel.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyStarsModel.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/4/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplySticker.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplySticker.h index da17d06b46..a13d5d66ac 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplySticker.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplySticker.h @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 11/27/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplySun.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplySun.h index def5da6449..e493f74311 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplySun.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplySun.h @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/24/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyTexture.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyTexture.h index 7c7f7c77d6..d9eb9df0c2 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyTexture.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyTexture.h @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 10/25/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyVectorObject.h b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyVectorObject.h index d86ade7a5b..81561a5a09 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyVectorObject.h +++ b/ios/library/WhirlyGlobe-MaplyComponent/include/visual_objects/MaplyVectorObject.h @@ -1,9 +1,8 @@ -/* - * MaplyVectorObject.h +/* MaplyVectorObject.h * WhirlyGlobeComponent * * Created by Steve Gifford on 8/2/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import @@ -138,30 +136,64 @@ typedef NS_ENUM(NSInteger, MaplyVectorObjectType) { /** Initialize with a linear feature. + This version takes an array of coordinates (2 `NSNumber`s per coordinate, in degrees) and the attribution. + With this it will make a linear feature. + Prefer the `inDegrees:` overload to reduce ambiguity. + Returns nil if the coordinate array contains an odd number of values. + */ +- (nullable instancetype)initWithLineString:(const NSArray *__nonnull)coords + attributes:(NSDictionary *__nullable)attr; + +/** + Initialize with a linear feature. + This version takes an array of coordinate pairs (as NSNumber) and the attribution. With this it will make a linear feature. + Returns nil if the coordinate array contains an odd number of values. */ -- (nonnull instancetype)initWithLineString:(const NSArray *__nonnull)coords attributes:(NSDictionary *__nullable)attr; +- (nullable instancetype)initWithLineString:(const NSArray *__nonnull)coords + attributes:(NSDictionary *__nullable)attr + inDegrees:(bool)inDegrees; /** Initialize with a linear feature. - + This version takes an array of coordinates, the size of that array and the attribution. With this it will make a linear feature. */ -- (nonnull instancetype)initWithLineString:(const MaplyCoordinate *__nonnull)coords numCoords:(int)numCoords attributes:(NSDictionary *__nullable)attr; +- (nonnull instancetype)initWithLineString:(const MaplyCoordinate *__nonnull)coords + numCoords:(int)numCoords + attributes:(NSDictionary *__nullable)attr; /** Inintialize as an areal feature. - - This version takes an array of coordinates, the size of that array and the attribution. With this it will make a single area feature with one (exterior) loop. To add loops, call addHole:numCoords: + + This version takes an array of coordinates, the size of that array and the attribution. + With this it will make a single area feature with one (exterior) loop. To add loops, call `addHole:numCoords:` */ -- (nonnull instancetype)initWithAreal:(const MaplyCoordinate *__nonnull)coords numCoords:(int)numCoords attributes:(NSDictionary *__nullable)attr; +- (nonnull instancetype)initWithAreal:(const MaplyCoordinate *__nonnull)coords + numCoords:(int)numCoords + attributes:(NSDictionary *__nullable)attr; /** Inintialize as an areal feature. - - This version takes an array of coordinates (2 numbers per coordinate). With this it will make a single area feature with one (exterior) loop. To add loops, call addHole:numCoords: + + This version takes an array of coordinates (2 `NSNumber`s per coordinate, in radians). + With this it will make a single area feature with one (exterior) loop. To add loops, call addHole:numCoords: + Prefer the `inDegrees:` overload to reduce ambiguity. + Returns nil if the coordinate array contains an odd number of values. */ -- (nonnull instancetype)initWithArealArray:(const NSArray *__nonnull)coords attributes:(NSDictionary *__nullable)attr; +- (nullable instancetype)initWithArealArray:(const NSArray *__nonnull)coords + attributes:(NSDictionary *__nullable)attr; + +/** + Inintialize as an areal feature. + + This version takes an array of coordinates (2 `NSNumber`s per coordinate, in radians). + With this it will make a single area feature with one (exterior) loop. To add loops, call `addHole:numCoords:` + Returns nil if the coordinate array contains an odd number of values. +*/ +- (nullable instancetype)initWithArealArray:(const NSArray *__nonnull)coords + attributes:(NSDictionary *__nullable)attr + inDegrees:(bool)inDegrees; /** Initializes with vectors parsed from geoJSON. @@ -416,6 +448,16 @@ typedef NS_ENUM(NSInteger, MaplyVectorObjectType) { */ - (MaplyVectorObject * __nonnull)arealsToLinears; +/** + Reverse the direction of areal loops in-place + */ +- (void)reverseAreals; + +/** + Return a copy with the areal loops reversed + */ +- (MaplyVectorObject * __nonnull)reversedAreals; + /** Filter out edges created from clipping areal features on the server. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/UIKit/NSData+Zlib.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/UIKit/NSData+Zlib.mm index c128e84c90..35cac003e6 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/UIKit/NSData+Zlib.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/UIKit/NSData+Zlib.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/7/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyActiveObject.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyActiveObject.mm index ea3f3dfa79..39d4b47467 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyActiveObject.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyActiveObject.mm @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 4/3/13. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,8 +74,11 @@ - (void)registerWithScene - (void)removeFromScene { - if (activeInter) + if (activeInter) { scene->removeActiveModel(nullptr, activeInter); + activeInter->activeObject = nil; + activeInter = nullptr; + } } - (void)startWithScene:(WhirlyKit::Scene *)inScene diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyAnnotation.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyAnnotation.mm index c894807267..aeb32bae9a 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyAnnotation.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyAnnotation.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 12/13/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyBaseInteractionLayer.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyBaseInteractionLayer.mm index b32b2b8c6f..7c5cd5efa4 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyBaseInteractionLayer.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyBaseInteractionLayer.mm @@ -3,7 +3,7 @@ * MaplyComponent * * Created by Steve Gifford on 12/14/12. - * Copyright 2012-2021 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1779,9 +1779,12 @@ - (void)addWideVectorsRun:(NSArray *)argArray std::vector shapes; for (const MaplyVectorObject *vecObj in vectors) { - for (auto shape: vecObj->vObj->shapes) { - auto dict = std::dynamic_pointer_cast(shape->getAttrDict()); - [self resolveMaskIDs:dict->dict compObj:compObj]; + for (const auto &shape: vecObj->vObj->shapes) + { + if (auto dict = dynamic_cast(shape->getAttrDictRef().get())) + { + [self resolveMaskIDs:dict->dict compObj:compObj]; + } } // Maybe need to make a copy if we're going to sample @@ -2838,14 +2841,16 @@ - (void)addBillboardsRun:(NSArray *)argArray std::vector wkBills; for (MaplyBillboard *bill in bills) { - Billboard *wkBill = new Billboard(); - Point3d localPt = coordSys->geographicToLocal3d(GeoCoord(bill.center.x,bill.center.y)); - Point3d dispPt = coordAdapter->localToDisplay(Point3d(localPt.x(),localPt.y(),bill.center.z)); + auto wkBill = std::make_unique(); + const Point3d localPt = coordSys->geographicToLocal3d(GeoCoord(bill.center.x,bill.center.y)); + const Point3d dispPt = coordAdapter->localToDisplay(Point3d(localPt.x(),localPt.y(),bill.center.z)); wkBill->center = dispPt; wkBill->isSelectable = bill.selectable; if (wkBill->isSelectable) + { wkBill->selectID = Identifiable::genId(); - + } + if (bill.selectable) { compManager->addSelectObject(wkBill->selectID,bill); @@ -2853,31 +2858,38 @@ - (void)addBillboardsRun:(NSArray *)argArray } MaplyScreenObject *screenObj = bill.screenObj; - if (!screenObj) { - delete wkBill; + if (!screenObj) + { continue; } - MaplyBoundingBox size = [screenObj getSize]; - Point2d size2d = Point2d(size.ur.x-size.ll.x,size.ur.y-size.ll.y); + const MaplyBoundingBox size = [screenObj getSize]; + const Point2d size2d = Point2d(size.ur.x-size.ll.x,size.ur.y-size.ll.y); wkBill->size = size2d; // Work through the individual polygons in a billboard - for (SimplePolyRef thePoly : screenObj->screenObj.polys) + for (const SimplePolyRef &thePoly : screenObj->screenObj.polys) { - SimplePoly_iOSRef poly = std::dynamic_pointer_cast(thePoly); - SingleBillboardPoly billPoly; + auto poly = dynamic_cast(thePoly.get()); + + wkBill->polys.emplace_back(); + auto &billPoly = wkBill->polys.back(); + billPoly.pts = poly->pts; billPoly.texCoords = poly->texCoords; billPoly.color = poly->color; + if (bill.vertexAttributes) + { [self resolveVertexAttrs:billPoly.vertexAttrs from:bill.vertexAttributes]; + } if (poly->texture) { MaplyTexture *tex = nil; if ([poly->texture isKindOfClass:[UIImage class]]) { tex = [self addImage:poly->texture imageFormat:MaplyImageIntRGBA mode:threadMode]; - } else if ([poly->texture isKindOfClass:[MaplyTexture class]]) + } + else if ([poly->texture isKindOfClass:[MaplyTexture class]]) { tex = (MaplyTexture *)poly->texture; } @@ -2887,18 +2899,28 @@ - (void)addBillboardsRun:(NSArray *)argArray billPoly.texId = tex.texID; } } - wkBill->polys.push_back(billPoly); } // Now for the strings for (auto theStrWrap : screenObj->screenObj.strings) { - StringWrapper_iOSRef strWrap = std::dynamic_pointer_cast(theStrWrap); + auto strWrap = dynamic_cast(theStrWrap.get()); + if (!strWrap) + { + continue; + } + // Convert the string to polygons - DrawableString *drawStr = fontTexManager->addString(NULL, strWrap->str,changes); + auto drawStr = fontTexManager->addString(nullptr, strWrap->str,changes); + if (!drawStr) + { + continue; + } + for (const DrawableString::Rect &rect : drawStr->glyphPolys) { - SingleBillboardPoly billPoly; + wkBill->polys.emplace_back(); + auto &billPoly = wkBill->polys.back(); billPoly.pts.resize(4); billPoly.texCoords.resize(4); billPoly.texId = rect.subTex.texId; @@ -2910,25 +2932,22 @@ - (void)addBillboardsRun:(NSArray *)argArray billPoly.pts[1] = Point2d(rect.pts[1].x(),rect.pts[0].y()); billPoly.pts[2] = Point2d(rect.pts[1].x(),rect.pts[1].y()); billPoly.pts[3] = Point2d(rect.pts[0].x(),rect.pts[1].y()); + for (unsigned int ip=0;ip<4;ip++) { - const Point2d &oldPt = billPoly.pts[ip]; - Point3d newPt = strWrap->mat * Point3d(oldPt.x(),oldPt.y(),1.0); - billPoly.pts[ip] = Point2d(newPt.x(),newPt.y()); + billPoly.pts[ip] = Slice((strWrap->mat * Pad(billPoly.pts[ip], 1.0)).eval()); } - + wkBill->polys.push_back(billPoly); } compObj->contents->drawStringIDs.insert(drawStr->getId()); - delete drawStr; } - wkBills.push_back(wkBill); + wkBills.push_back(wkBill.release()); } - - SimpleIdentity billId = billManager->addBillboards(wkBills, billInfo, changes); - if (billId) + + if (SimpleIdentity billId = billManager->addBillboards(wkBills, billInfo, changes)) { compObj->contents->billIDs.insert(billId); } @@ -3612,11 +3631,6 @@ - (void)setRepresentationRun:(NSArray *)argArray // Search for a point inside any of our vector objects // Runs in layer thread -- (NSArray *)findVectorsInPoint:(Point2f)pt -{ - return [self findVectorsInPoint:pt inView:nil multi:true]; -} - - (NSArray *)findVectorsInPoint:(Point2f)pt inView:(MaplyBaseViewController *)vc multi:(bool)multi { if (!layerThread || !vc || !vc->renderControl) @@ -3645,7 +3659,55 @@ - (NSObject *)getSelectableObject:(WhirlyKit::SimpleIdentity)objId - (NSObject*)selectLabelsAndMarkerForScreenPoint:(CGPoint)screenPoint { - return nil; + return [[self selectMultipleLabelsAndMarkersForScreenPoint:screenPoint] firstObject]; +} + +- (NSMutableArray*)selectMultipleLabelsAndMarkersForScreenPoint:(CGPoint)screenPoint +{ + NSMutableArray *retSelectArr = [NSMutableArray array]; + return retSelectArr; +} + +- (NSMutableArray*__nullable)convertSelectedObjects:(const std::vector &)selectedObjs +{ + NSMutableArray *retSelectArr = [NSMutableArray array]; + // Work through the objects the manager found, creating entries for each + for (unsigned int ii = 0; ii < selectedObjs.size(); ii++) + { + const SelectionManager::SelectedObject &theSelObj = selectedObjs[ii]; + + for (auto selectID : theSelObj.selectIDs) + { + MaplySelectedObject *selObj = [[MaplySelectedObject alloc] init]; + selObj.selectedObj = compManager->getSelectObject(selectID); + + selObj.screenDist = theSelObj.screenDist; + selObj.cluster = theSelObj.isCluster; + selObj.zDist = theSelObj.distIn3D; + + if (selObj.selectedObj) + [retSelectArr addObject:selObj]; + } + } + + return retSelectArr; +} + +- (NSMutableArray*)convertSelectedVecObjects:(NSArray*)vecObjs +{ + NSMutableArray *retSelectArr = [NSMutableArray array]; + + for (MaplyVectorObject *vecObj in vecObjs) + { + MaplySelectedObject *selObj = [[MaplySelectedObject alloc] init]; + selObj.selectedObj = vecObj; + selObj.screenDist = 0.0; + // Note: Not quite right + selObj.zDist = 0.0; + [retSelectArr addObject:selObj]; + } + + return retSelectArr; } - (void)dumpStats diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyBaseViewController.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyBaseViewController.mm index 78e40bf9d2..7be90bd119 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyBaseViewController.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyBaseViewController.mm @@ -2,7 +2,7 @@ * MaplyComponent * * Created by Steve Gifford on 12/14/12. - * Copyright 2012-2021 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ */ #import "control/MaplyBaseViewController.h" -#import "MaplyBaseViewController_private.h" +#import "private/MaplyBaseViewController_private.h" #import "UIKit/NSData+Zlib.h" #import "MaplyTexture_private.h" @@ -115,11 +115,13 @@ @implementation MaplyBaseViewController { MaplyLocationTracker *_locationTracker; bool _layoutFade; + NSMutableArray *_postInitCalls; } - (instancetype)init{ self = [super init]; _layoutFade = false; + _postInitCalls = [NSMutableArray new]; return self; } @@ -169,14 +171,13 @@ - (ViewRef) loadSetup_view - (void)loadSetup_mtlView { SceneRendererMTL *renderMTL = (SceneRendererMTL *)renderControl->sceneRenderer.get(); - - WhirlyKitMTLView *mtlView = [[WhirlyKitMTLView alloc] initWithDevice:((RenderSetupInfoMTL *) renderMTL->getRenderSetupInfo())->mtlDevice]; + RenderSetupInfoMTL *setupInfo = (RenderSetupInfoMTL *) renderMTL->getRenderSetupInfo(); + + WhirlyKitMTLView *mtlView = [[WhirlyKitMTLView alloc] initWithDevice:setupInfo->mtlDevice]; + mtlView.preferredFramesPerSecond = (_frameInterval > 0) ? (60.0 / _frameInterval) : 120; + mtlView.wrapperDelegate = self; + wrapView = mtlView; - if (_frameInterval <= 0) - mtlView.preferredFramesPerSecond = 120; - else { - mtlView.preferredFramesPerSecond = 60 / _frameInterval; - } } - (MaplyBaseInteractionLayer *) loadSetup_interactionLayer @@ -305,7 +306,7 @@ - (void) loadSetup annotations = [NSMutableArray array]; // View placement manager - viewPlacementModel = ViewPlacementActiveModelRef(new ViewPlacementActiveModel()); + viewPlacementModel = std::make_shared(); renderControl->scene->addActiveModel(viewPlacementModel); // Apply layout fade option set before init to the newly-created manager @@ -426,11 +427,18 @@ - (void)viewWillDisappear:(BOOL)animated - (void)viewWillLayoutSubviews { - if (wrapView) { + if (wrapView) + { wrapView.frame = self.view.bounds; } } +- (void)viewDidLayoutSubviews +{ + // The layout hasn't actually run yet, it's only been kicked off + // See `layoutDidRun:` +} + - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; @@ -1208,12 +1216,20 @@ - (void)endChanges } } --(NSArray*)objectsAtCoord:(MaplyCoordinate)coord +- (NSArray*)objectsAtCoord:(MaplyCoordinate)coord { if (!renderControl) return nil; - - return [renderControl->interactLayer findVectorsInPoint:Point2f(coord.x,coord.y)]; + + return [renderControl->interactLayer findVectorsInPoint:Point2f(coord.x,coord.y) inView:self multi:true]; +} + +- (NSArray*)labelsAndMarkersAtCoord:(MaplyCoordinate)coord +{ + if (!renderControl) + return nil; + + return [renderControl->interactLayer selectMultipleLabelsAndMarkersForScreenPoint:[self screenPointFromGeo:coord]]; } #pragma mark - Properties @@ -1263,12 +1279,24 @@ - (MaplyCoordinate3dD)displayPointFromGeoD:(MaplyCoordinate)geoCoord return displayCoord; } +- (MaplyCoordinate3dD)displayPointFromGeoDD:(MaplyCoordinateD)geoCoord +{ + MaplyCoordinate3dD displayCoord = {0,0,0}; + if (!renderControl) + return displayCoord; + + Point3d pt = renderControl->visualView->coordAdapter->localToDisplay(renderControl->visualView->coordAdapter->getCoordSystem()->geographicToLocal(Point2d(geoCoord.x,geoCoord.y))); + + displayCoord.x = pt.x(); displayCoord.y = pt.y(); displayCoord.z = pt.z(); + return displayCoord; +} + - (float)currentMapScale { if (!renderControl) return 0.0; - Point2f frameSize(renderControl->sceneRenderer->framebufferWidth,renderControl->sceneRenderer->framebufferHeight); + const Point2f frameSize = renderControl->sceneRenderer->getFramebufferSize(); if (frameSize.x() == 0) return MAXFLOAT; return (float)renderControl->visualView->currentMapScale(frameSize); @@ -1279,7 +1307,7 @@ - (float)heightForMapScale:(float)scale if (!renderControl) return 0.0; - Point2f frameSize(renderControl->sceneRenderer->framebufferWidth,renderControl->sceneRenderer->framebufferHeight); + const Point2f frameSize = renderControl->sceneRenderer->getFramebufferSize(); if (frameSize.x() == 0) return -1.0; return (float)renderControl->visualView->heightForMapScale(scale,frameSize); @@ -1429,7 +1457,7 @@ - (float)currentMapZoom:(MaplyCoordinate)coordinate if (!renderControl) return 0.0; - Point2f frameSize(renderControl->sceneRenderer->framebufferWidth,renderControl->sceneRenderer->framebufferHeight); + const Point2f frameSize = renderControl->sceneRenderer->getFramebufferSize(); if (frameSize.x() == 0) return MAXFLOAT; return (float)renderControl->visualView->currentMapZoom(frameSize,coordinate.y); @@ -1588,7 +1616,8 @@ - (CGSize)getFramebufferSize if (!renderControl || !renderControl->sceneRenderer) return CGSizeZero; - return CGSizeMake(renderControl->sceneRenderer->framebufferWidth,renderControl->sceneRenderer->framebufferHeight); + const Point2f frameSize = renderControl->sceneRenderer->getFramebufferSize(); + return CGSizeMake(frameSize.x(), frameSize.y()); } - (MaplyRenderType)getRenderType @@ -1651,4 +1680,29 @@ - (MaplyRemoteTileFetcher *)addTileFetcher:(NSString * __nonnull)name return renderControl ? [renderControl addTileFetcher:name] : nil; } +- (void)layoutDidRun +{ + // Layout complete, we can do stuff like `findHeightToViewBounds` now + for (InitCompletionBlock block in _postInitCalls) + { + block(); + } + _postInitCalls = nil; +} + +- (void)addPostInitBlock:(_Nonnull InitCompletionBlock)block +{ + if (block) + { + if (_postInitCalls) + { + [_postInitCalls addObject:block]; + } + else + { + block(); + } + } +} + @end diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyCluster.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyCluster.mm index 746e2bf520..b8a2962b98 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyCluster.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyCluster.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/29/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyControllerLayer.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyControllerLayer.mm index 08aacd8a55..049832108e 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyControllerLayer.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyControllerLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyGlobeRenderController.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyGlobeRenderController.mm index af5f594f6e..f2e9c9122b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyGlobeRenderController.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyGlobeRenderController.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 10/23/10. -* Copyright 2011-2019 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -126,9 +126,9 @@ - (UIImage *)asImage:(MaplyRenderController *)renderControl // otherwise, use kCGImageAlphaPremultipliedLast CGDataProviderRef ref = CGDataProviderCreateWithData(NULL, [_data bytes], [_data length], NULL); CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); - int framebufferWidth = renderControl->sceneRenderer->framebufferWidth; - int framebufferHeight = renderControl->sceneRenderer->framebufferHeight; - CGImageRef iref = CGImageCreate(framebufferWidth, framebufferHeight, 8, 32, framebufferWidth * 4, colorspace, kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast, + const Point2f frameSize = renderControl->sceneRenderer->getFramebufferSize(); + CGImageRef iref = CGImageCreate(frameSize.x(), frameSize.y(), 8, 32, frameSize.x() * 4, colorspace, + kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast, ref, NULL, true, kCGRenderingIntentDefault); // OpenGL ES measures data in PIXELS @@ -139,8 +139,8 @@ - (UIImage *)asImage:(MaplyRenderController *)renderControl // Set the scale parameter to your OpenGL ES view's contentScaleFactor // so that you get a high-resolution snapshot when its value is greater than 1.0 CGFloat scale = 1.0; - widthInPoints = framebufferWidth / scale; - heightInPoints = framebufferHeight / scale; + widthInPoints = frameSize.x() / scale; + heightInPoints = frameSize.y() / scale; UIGraphicsBeginImageContextWithOptions(CGSizeMake(widthInPoints, heightInPoints), NO, scale); } diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyInteractionLayer.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyInteractionLayer.mm index 78e5e14e54..5217e3c8b7 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyInteractionLayer.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyInteractionLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,22 +68,14 @@ - (void)teardown // Do the logic for a selection // Runs in the layer thread -- (void) userDidTapLayerThread:(MaplyTapMessage *)msg +- (void)userDidTapLayerThread:(MaplyTapMessage *)msg { // First, we'll look for labels and markers NSMutableArray *retSelectArr = [self selectMultipleLabelsAndMarkersForScreenPoint:msg.touchLoc]; // Next, try the vectors NSArray *vecObjs = [self findVectorsInPoint:Point2f(msg.whereGeo.x(),msg.whereGeo.y()) inView:(MaplyBaseViewController*)self.viewController multi:true]; - for (MaplyVectorObject *vecObj in vecObjs) - { - MaplySelectedObject *selObj = [[MaplySelectedObject alloc] init]; - selObj.selectedObj = vecObj; - selObj.screenDist = 0.0; - // Note: Not quite right - selObj.zDist = 0.0; - [retSelectArr addObject:selObj]; - } + [retSelectArr addObjectsFromArray:[self convertSelectedVecObjects:vecObjs]]; // Tell the view controller about it dispatch_async(dispatch_get_main_queue(),^ @@ -93,42 +85,20 @@ - (void) userDidTapLayerThread:(MaplyTapMessage *)msg ); } +// Check for a selection +- (void)userDidTap:(MaplyTapMessage *)msg +{ + // Pass it off to the layer thread + [self performSelector:@selector(userDidTapLayerThread:) onThread:layerThread withObject:msg waitUntilDone:NO]; +} + - (NSMutableArray*)selectMultipleLabelsAndMarkersForScreenPoint:(CGPoint)screenPoint { SelectionManagerRef selectManager = std::dynamic_pointer_cast(scene->getManager(kWKSelectionManager)); std::vector selectedObjs; selectManager->pickObjects(Point2f(screenPoint.x,screenPoint.y),10.0,mapView->makeViewState(layerThread.renderer),selectedObjs); - - NSMutableArray *retSelectArr = [NSMutableArray array]; - if (!selectedObjs.empty()) - { - // Work through the objects the manager found, creating entries for each - for (unsigned int ii=0;iigetSelectObject(selectID); - - selObj.screenDist = theSelObj.screenDist; - selObj.cluster = theSelObj.isCluster; - selObj.zDist = theSelObj.distIn3D; - - if (selObj.selectedObj) - [retSelectArr addObject:selObj]; - } - } - } - - return retSelectArr; -} -// Check for a selection -- (void) userDidTap:(MaplyTapMessage *)msg -{ - // Pass it off to the layer thread - [self performSelector:@selector(userDidTapLayerThread:) onThread:layerThread withObject:msg waitUntilDone:NO]; + return [self convertSelectedObjects:selectedObjs]; } @end diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyRenderController.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyRenderController.mm index 57474b4fe3..145aa70493 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyRenderController.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyRenderController.mm @@ -867,7 +867,8 @@ - (CGSize)getFramebufferSize if (!sceneRenderer) return CGSizeZero; - return CGSizeMake(sceneRenderer->framebufferWidth,sceneRenderer->framebufferHeight); + const Point2f size = sceneRenderer->getFramebufferSize(); + return CGSizeMake(size.x(),size.y()); } // MARK: Snapshot protocol diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplySharedAttributes.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplySharedAttributes.mm index 8d0afd7481..3f1f155210 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplySharedAttributes.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplySharedAttributes.mm @@ -1,9 +1,8 @@ -/* - * MaplySharedAttributes.h +/* MaplySharedAttributes.h * WhirlyGlobe-MaplyComponent * * Created by Ranen Ghosh on 2/24/16. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,14 +14,17 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ // We pull in as many of the shared attributes as possible +// Declare strings as ObjC for this compilation unit. #define WKString(str) @str + #import "SharedAttributes.h" #import "MaplySharedAttributes.h" +#define WKDefineConst(N) NSString* const kMaply##N = Maply##N; + /// Use this hint to turn the zbuffer on or off. Pass in an NSNumber boolean. Takes effect on the next frame. NSString* const kMaplyRenderHintZBuffer = MaplyRenderHintZBuffer; /// Use this hint to turn culling optimization on or off. Pass in an NSNumber boolean. @@ -224,11 +226,16 @@ /// It's real world coordinates for kMaplyWideVecCoordTypeReal and pixel size for kMaplyWideVecCoordTypeScreen NSString* const kMaplyWideVecTexRepeatLen = MaplyWideVecTexRepeatLen; -NSString* const kMaplyWideVecImpl = MaplyWideVecImpl; -NSString* const kMaplyWideVecImplPerf = MaplyWideVecImplPerf; +/// Controls the wide vector implementation. Basic implementation by default. +WKDefineConst(WideVecImpl) +WKDefineConst(WideVecImplDefault) +WKDefineConst(WideVecImplPerf) /// Offset to left (negative) or right (positive) of the centerline -NSString* const kMaplyWideVecOffset = MaplyWideVecOffset; +WKDefineConst(WideVecOffset) + +/// Close any un-closed areal features when drawing lines for them +WKDefineConst(VecCloseAreals) /// If set we'll break up a vector feature to the given epsilon on a globe surface NSString* const kMaplySubdivEpsilon = MaplySubdivEpsilon; diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyUpdateLayer.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyUpdateLayer.mm index 3d3d0f9e8a..3283d61c8b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyUpdateLayer.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyUpdateLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 4/13/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyViewController.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyViewController.mm index e2af4bcce7..8eb3ae66d3 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyViewController.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyViewController.mm @@ -1,9 +1,8 @@ -/* - * MaplyViewController.mm +/* MaplyViewController.mm * MaplyComponent * * Created by Steve Gifford on 9/6/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import @@ -152,18 +150,12 @@ - (void)viewUpdated:(View *)view; // Interface object between Obj-C and C++ for animation callbacks // Also used to catch view geometry updates -class MaplyViewControllerAnimationWrapper : public Maply::MapViewAnimationDelegate, public ViewWatcher +struct MaplyViewControllerAnimationWrapper : public Maply::MapViewAnimationDelegate, public ViewWatcher { -public: - MaplyViewControllerAnimationWrapper() - : control(nil) - { - } - // Called by the View to set up view state per frame - void updateView(Maply::MapView *mapView) + void updateView(WhirlyKit::View *view) { - [control updateView:mapView]; + [control updateView:(Maply::MapView *)view]; } // Called by the view when things are changed @@ -171,9 +163,10 @@ virtual void viewUpdated(View *view) { [control viewUpdated:view]; } - -public: - MaplyViewController __weak * control; + + virtual bool isUserMotion() const { return false; } + + MaplyViewController __weak * control = nil; }; @implementation MaplyViewController @@ -789,12 +782,13 @@ - (void)animateToPoint:(Point3d)newLoc time:(TimeInterval)howLong { mapView->cancelAnimation(); - AnimateViewTranslationRef anim = AnimateViewTranslationRef(new AnimateViewTranslation(mapView,renderControl->sceneRenderer.get(),newLoc,howLong)); + const auto render = renderControl->sceneRenderer.get(); + AnimateViewTranslationRef anim = std::make_shared(mapView,render,newLoc,howLong); anim->userMotion = false; anim->setBounds(bounds2d); curAnimation = anim; - mapView->setDelegate(anim); + mapView->setDelegate(std::move(anim)); } // External facing version of rotateToPoint @@ -1116,9 +1110,9 @@ - (void)animateWithDelegate:(NSObject *)in // Tell the delegate what we're up to [animationDelegate mapViewController:self startState:stateStart startTime:now endTime:animationDelegateEnd]; - MaplyViewControllerAnimationWrapper *delegate = new MaplyViewControllerAnimationWrapper(); + auto delegate = std::make_shared(); delegate->control = self; - mapView->setDelegate(MapViewAnimationDelegateRef(delegate)); + mapView->setDelegate(std::move(delegate)); } // Called every frame from within the map view @@ -1254,34 +1248,81 @@ - (CGPoint)screenPointFromGeo:(MaplyCoordinate)geoCoord - (CGPoint)screenPointFromGeo:(MaplyCoordinate)geoCoord mapView:(Maply::MapView *)theView { if (!renderControl) - return CGPointMake(0.0, 0.0); - - Point3d pt = theView->coordAdapter->localToDisplay(theView->coordAdapter->getCoordSystem()->geographicToLocal3d(GeoCoord(geoCoord.x,geoCoord.y))); - - Eigen::Matrix4d modelTrans = theView->calcFullMatrix(); - auto frameSizeScaled = renderControl->sceneRenderer->getFramebufferSizeScaled(); - Point2f screenPt = theView->pointOnScreenFromPlane(pt, &modelTrans, frameSizeScaled); + { + return CGPointZero; + } + + const auto adapter = theView->coordAdapter; + const Point3d localPt = adapter->getCoordSystem()->geographicToLocal3d(GeoCoord(geoCoord.x,geoCoord.y)); + const Point3d displayPt = adapter->localToDisplay(localPt); + const Eigen::Matrix4d modelTrans = theView->calcFullMatrix(); + const Point2f frameSizeScaled = renderControl->sceneRenderer->getFramebufferSizeScaled(); + const Point2f screenPt = theView->pointOnScreenFromPlane(displayPt, &modelTrans, frameSizeScaled); return CGPointMake(screenPt.x(),screenPt.y()); } // See if the given bounding box is all on screen -- (bool)checkCoverage:(const Mbr &)mbr mapView:(Maply::MapView *)theView height:(float)height margin:(const Point2d &)margin -{ - // Center the bound - const Point3d localMid = mapView->coordAdapter->getCoordSystem()->geographicToLocal(mbr.mid().cast()); +- (bool)checkCoverage:(const Mbr &)mbr + mapView:(Maply::MapView *)theView + loc:(MaplyCoordinate)loc + height:(float)height + frame:(CGRect)frame + newLoc:(MaplyCoordinate *)newLoc + margin:(const Point2d &)margin +{ + if (frame.size.width == 0 || frame.size.height == 0) + { + return false; + } + if (newLoc) + { + *newLoc = loc; + } + + const auto &coordAdapter = mapView->coordAdapter; + const auto *coordSys = coordAdapter->getCoordSystem(); + + // Center the given location + Point3d localMid = coordSys->geographicToLocal(Point2d(loc.x, loc.y)); theView->setLoc(Point3d(localMid.x(),localMid.y(),height),false); + // If they want to center in an area other than the whole view frame, we need to work out + // what center point will place the given location at the center of the given view frame. + const auto screenCenter = CGPointMake(CGRectGetMidX(self.view.frame), CGRectGetMidY(self.view.frame)); + const auto frameCenter = CGPointMake(CGRectGetMidX(frame), CGRectGetMidY(frame)); + const auto offset = CGPointMake(frameCenter.x - screenCenter.x, frameCenter.y - screenCenter.y); + if (offset.x != 0 || offset.y != 0) + { + const auto invCenter = CGPointMake(screenCenter.x - offset.x,screenCenter.y - offset.y); + MaplyCoordinate invGeo = {0,0}; + if (![self geoFromScreenPoint:invCenter view:theView geo:&invGeo]) + { + return false; + } + + // Place the given location at the center of the given frame + localMid = coordSys->geographicToLocal(Point2d(invGeo.x, invGeo.y)); + theView->setLoc(Point3d(localMid.x(), localMid.y(), height), false); + + if (newLoc) + { + *newLoc = invGeo; + } + } + // Get the corners Point2fVector pts; mbr.asPoints(pts); - // Check each one - const CGRect &frame = self.view.frame; + // Check if each corner is within the given frame in this view for (const auto &pt : pts) { const CGPoint screenPt = [self screenPointFromGeo:{pt.x(),pt.y()} mapView:theView]; - if (screenPt.x < -margin.x() || screenPt.x > frame.size.width + margin.x() || - screenPt.y < -margin.y() || screenPt.y > frame.size.height + margin.y()) + if (!std::isfinite(screenPt.y) || + screenPt.x < frame.origin.x - margin.x() || + screenPt.y < frame.origin.y - margin.y() || + screenPt.x > frame.origin.x + frame.size.width + margin.x() || + screenPt.y > frame.origin.y + frame.size.height + margin.y()) { return false; } @@ -1289,32 +1330,53 @@ - (bool)checkCoverage:(const Mbr &)mbr mapView:(Maply::MapView *)theView height: return true; } -- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox pos:(MaplyCoordinate)pos +- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox + pos:(MaplyCoordinate)pos { - return [self findHeightToViewBounds:bbox pos:pos marginX:0 marginY:0]; + return [self findHeightToViewBounds:bbox + pos:pos + marginX:0 + marginY:0]; } -- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox pos:(MaplyCoordinate)pos marginX:(double)marginX marginY:(double)marginY +- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox + pos:(MaplyCoordinate)pos + marginX:(double)marginX + marginY:(double)marginY +{ + return [self findHeightToViewBounds:bbox + pos:pos + frame:self.view.frame + newPos:nil + marginX:marginX + marginY:marginY]; +} + +- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox + pos:(MaplyCoordinate)pos + frame:(CGRect)frame + newPos:(MaplyCoordinate *)newPos + marginX:(double)marginX + marginY:(double)marginY { - const Point2d margin(marginX,marginY); - if (!mapView) { return 0; } - Maply::MapView tempMapView(*mapView); - // Center the temporary view on the new center point at the current height - const Point3d oldLoc = tempMapView.getLoc(); - Point3d newLoc = Point3d(pos.x,pos.y,oldLoc.z()); - if (_coordSys) + // checkCoverage won't work if the frame size isn't set + if (frame.size.height * frame.size.width == 0) { - newLoc = _coordSys->coordSystem->geographicToLocal3d(GeoCoord(pos.x,pos.y)); - newLoc.z() = oldLoc.z(); + return 0; } - tempMapView.setLoc(newLoc, false); - const Mbr mbr(Point2f(bbox.ll.x,bbox.ll.y),Point2f(bbox.ur.x,bbox.ur.y)); + Maply::MapView tempMapView(*mapView); + + // Center the temporary view on the new center point at the current height + //const Point3d oldLoc = tempMapView.getLoc(); + + const Mbr mbr { { bbox.ll.x, bbox.ll.y }, { bbox.ur.x, bbox.ur.y } }; + const Point2d margin(marginX,marginY); float minHeight = tempMapView.minHeightAboveSurface(); float maxHeight = tempMapView.maxHeightAboveSurface(); @@ -1325,37 +1387,45 @@ - (float)findHeightToViewBounds:(MaplyBoundingBox)bbox pos:(MaplyCoordinate)pos } // Check that we can at least see it - bool minOnScreen = [self checkCoverage:mbr mapView:&tempMapView height:minHeight margin:margin]; - bool maxOnScreen = [self checkCoverage:mbr mapView:&tempMapView height:maxHeight margin:margin]; + MaplyCoordinate minPos, maxPos; + const bool minOnScreen = [self checkCoverage:mbr mapView:&tempMapView loc:pos height:minHeight + frame:frame newLoc:&minPos margin:margin]; + const bool maxOnScreen = [self checkCoverage:mbr mapView:&tempMapView loc:pos height:maxHeight + frame:frame newLoc:&maxPos margin:margin]; if (!minOnScreen && !maxOnScreen) { - tempMapView.setLoc(oldLoc,false); - return oldLoc.z(); - } else if (minOnScreen) { + if (newPos) + { + *newPos = pos; + } + return 0.0; + } + else if (minOnScreen) + { // already fits at min zoom - maxHeight = minHeight; - } else { - // Now for the binary search - float minRange = 1e-5; - do + if (newPos) { - float midHeight = (minHeight + maxHeight)/2.0; - bool midOnScreen = [self checkCoverage:mbr mapView:&tempMapView height:midHeight margin:margin]; - - if (!minOnScreen && midOnScreen) - { - maxHeight = midHeight; - maxOnScreen = YES; - } else if (!midOnScreen && maxOnScreen) { - minHeight = midHeight; - minOnScreen = NO; - } else { - // Not expecting this - break; - } - } while (maxHeight-minHeight > minRange); + *newPos = minPos; + } + return minHeight; + } + + // minHeight is out but maxHeight works. + // Binary search to find the lowest height that still works. + constexpr float minRange = 1e-5; + while (maxHeight - minHeight > minRange) + { + const float midHeight = (minHeight + maxHeight)/2.0; + if ([self checkCoverage:mbr mapView:&tempMapView loc:pos height:midHeight + frame:frame newLoc:newPos margin:margin]) + { + maxHeight = midHeight; + } + else + { + minHeight = midHeight; + } } - return maxHeight; } @@ -1482,18 +1552,8 @@ - (void) animationDidEnd:(NSNotification *)note if (note.object != mapView->tag) return; - bool userMotion = false; - - auto delegate = mapView->getDelegate(); - AnimateViewTranslation *viewTrans = dynamic_cast(delegate.get()); - if (viewTrans) { - userMotion = viewTrans->userMotion; - } else { - AnimateTranslateMomentum *viewTrans = dynamic_cast(delegate.get()); - if (viewTrans) { - userMotion = viewTrans->userMotion; - } - } + const auto delegate = mapView->getDelegate(); + const bool userMotion = delegate && delegate->isUserMotion(); isAnimating = false; [self handleStopMoving:userMotion]; @@ -1525,23 +1585,45 @@ - (void)handleStopMoving:(bool)userMotion } } -- (MaplyCoordinate)geoFromScreenPoint:(CGPoint)point { - Point3d hit; - SceneRenderer *sceneRender = wrapView.renderer; - Eigen::Matrix4d theTransform = mapView->calcFullMatrix(); - auto frameSizeScaled = sceneRender->getFramebufferSizeScaled(); - Point2f point2f(point.x,point.y); - if (mapView->pointOnPlaneFromScreen(point2f, &theTransform, frameSizeScaled, &hit, true)) +- (MaplyCoordinate)geoFromScreenPoint:(CGPoint)point +{ + return [self geoFromScreenPoint:point view:mapView.get()]; +} + +- (MaplyCoordinate)geoFromScreenPoint:(CGPoint)point view:(MapView*)view +{ + MaplyCoordinate geo = {0,0}; + [self geoFromScreenPoint:point view:view geo:&geo]; + return geo; +} + +- (bool)geoFromScreenPoint:(CGPoint)point geo:(MaplyCoordinate*)geo +{ + return [self geoFromScreenPoint:point view:mapView.get() geo:geo]; +} + +- (bool)geoFromScreenPoint:(CGPoint)point view:(MapView*)view geo:(MaplyCoordinate*)geo +{ + if (view) { - Point3d localPt = coordAdapter->displayToLocal(hit); - GeoCoord coord = coordAdapter->getCoordSystem()->localToGeographic(localPt); - MaplyCoordinate maplyCoord; - maplyCoord.x = coord.x(); - maplyCoord.y = coord.y(); - return maplyCoord; - } else { - return MaplyCoordinateMakeWithDegrees(0, 0); + SceneRenderer *sceneRender = wrapView.renderer; + Eigen::Matrix4d theTransform = view->calcFullMatrix(); + const auto frameSizeScaled = sceneRender->getFramebufferSizeScaled(); + + Point2f point2f(point.x,point.y); + Point3d hit; + if (view->pointOnPlaneFromScreen(point2f, &theTransform, frameSizeScaled, &hit, true)) + { + if (geo) + { + const Point3d localPt = coordAdapter->displayToLocal(hit); + const GeoCoord coord = coordAdapter->getCoordSystem()->localToGeographic(localPt); + *geo = {coord.x(), coord.y()}; + } + return true; + } } + return false; } @@ -1550,11 +1632,13 @@ - (void)corners:(MaplyCoordinate *)corners if (!renderControl) return; - CGPoint screenCorners[4]; - screenCorners[0] = CGPointMake(0.0, 0.0); - screenCorners[1] = CGPointMake(renderControl->sceneRenderer->framebufferWidth,0.0); - screenCorners[2] = CGPointMake(renderControl->sceneRenderer->framebufferWidth,renderControl->sceneRenderer->framebufferHeight); - screenCorners[3] = CGPointMake(0.0, renderControl->sceneRenderer->framebufferHeight); + const Point2f frameSize = renderControl->sceneRenderer->getFramebufferSize(); + const CGPoint screenCorners[4] = { + CGPointMake(0.0f, 0.0f), + CGPointMake(frameSize.x(),0.0f), + CGPointMake(frameSize.x(),frameSize.y()), + CGPointMake(0.0f, frameSize.y()), + }; for (unsigned int ii=0;ii<4;ii++) { diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyViewTracker.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyViewTracker.mm index 22d49d7bb7..559a844c37 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyViewTracker.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/MaplyViewTracker.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/26/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/WGInteractionLayer.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/WGInteractionLayer.mm index 0c182b8443..52d411ef85 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/WGInteractionLayer.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/WGInteractionLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,7 +107,7 @@ -(void)processAutoSpin:(id)sender // Do the logic for a selection // Runs in the layer thread -- (void) userDidTapLayerThread:(WhirlyGlobeTapMessage *)msg +- (void)userDidTapLayerThread:(WhirlyGlobeTapMessage *)msg { lastTouched = scene->getCurrentTime(); if (autoSpinner) @@ -124,15 +124,7 @@ - (void) userDidTapLayerThread:(WhirlyGlobeTapMessage *)msg // Next, try the vectors NSArray *vecObjs = [self findVectorsInPoint:Point2f(msg.whereGeo.x(),msg.whereGeo.y()) inView:(MaplyBaseViewController*)self.viewController multi:true]; - for (MaplyVectorObject *vecObj in vecObjs) - { - MaplySelectedObject *selObj = [[MaplySelectedObject alloc] init]; - selObj.selectedObj = vecObj; - selObj.screenDist = 0.0; - // Note: Not quite right - selObj.zDist = 0.0; - [retSelectArr addObject:selObj]; - } + [retSelectArr addObjectsFromArray:[self convertSelectedVecObjects:vecObjs]]; // Tell the view controller about it dispatch_async(dispatch_get_main_queue(),^ @@ -143,49 +135,19 @@ - (void) userDidTapLayerThread:(WhirlyGlobeTapMessage *)msg } // Check for a selection -- (void) userDidTap:(WhirlyGlobeTapMessage *)msg +- (void)userDidTap:(WhirlyGlobeTapMessage *)msg { // Pass it off to the layer thread [self performSelector:@selector(userDidTapLayerThread:) onThread:layerThread withObject:msg waitUntilDone:NO]; } - - -- (NSObject*)selectLabelsAndMarkerForScreenPoint:(CGPoint)screenPoint { - return [[self selectMultipleLabelsAndMarkersForScreenPoint:screenPoint] firstObject]; -} - - (NSMutableArray*)selectMultipleLabelsAndMarkersForScreenPoint:(CGPoint)screenPoint { SelectionManagerRef selectManager = std::dynamic_pointer_cast(scene->getManager(kWKSelectionManager)); std::vector selectedObjs; selectManager->pickObjects(Point2f(screenPoint.x,screenPoint.y),10.0,globeView->makeViewState(layerThread.renderer),selectedObjs); - - NSMutableArray *retSelectArr = [NSMutableArray array]; - if (!selectedObjs.empty()) - { - // Work through the objects the manager found, creating entries for each - for (unsigned int ii=0;iigetSelectObject(selectID); - - selObj.screenDist = theSelObj.screenDist; - selObj.cluster = theSelObj.isCluster; - selObj.zDist = theSelObj.distIn3D; - - if (selObj.selectedObj) - [retSelectArr addObject:selObj]; - } - } - } - - return retSelectArr; -} + return [self convertSelectedObjects:selectedObjs]; +} @end diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/WGViewControllerLayer.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/WGViewControllerLayer.mm index fb0ca8077e..71ab6c87f5 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/WGViewControllerLayer.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/WGViewControllerLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/17/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/control/WhirlyGlobeViewController.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/control/WhirlyGlobeViewController.mm index 94080a733d..26ce563bef 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/control/WhirlyGlobeViewController.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/control/WhirlyGlobeViewController.mm @@ -1,9 +1,8 @@ -/* - * WhirlyGlobeViewController.mm +/* WhirlyGlobeViewController.mm * WhirlyGlobeComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import @@ -118,28 +116,23 @@ - (void)viewUpdated:(View *)view; // Interface object between Obj-C and C++ for animation callbacks // Also used to catch view geometry updates -class WhirlyGlobeViewWrapper : public WhirlyGlobe::GlobeViewAnimationDelegate, public ViewWatcher +struct WhirlyGlobeViewWrapper : public WhirlyGlobe::GlobeViewAnimationDelegate, public ViewWatcher { -public: - WhirlyGlobeViewWrapper() - : control(nil) - { - } - // Called by the View to set up view state per frame - void updateView(WhirlyGlobe::GlobeView *globeView) + void updateView(WhirlyKit::View *view) { - [control updateView:globeView]; + [control updateView:(WhirlyGlobe::GlobeView *)view]; } - + // Called by the view when things are changed virtual void viewUpdated(View *view) { [control viewUpdated:view]; } - -public: - WhirlyGlobeViewController __weak * control; + + virtual bool isUserMotion() const { return false; } + + WhirlyGlobeViewController __weak * control = nil; }; @implementation WhirlyGlobeViewController @@ -410,6 +403,7 @@ - (bool)pinchGesture return pinchDelegate != nil; } + - (void)setRotateGesture:(bool)rotateGesture { if (rotateGesture) @@ -1182,12 +1176,16 @@ - (void)corners:(MaplyCoordinate *)corners forRot:(Eigen::Quaterniond)theRot vie { if (!renderControl) return; - - Point2f screenCorners[4]; - screenCorners[0] = Point2f(0.0, 0.0); - screenCorners[1] = Point2f(renderControl->sceneRenderer->framebufferWidth,0.0); - screenCorners[2] = Point2f(renderControl->sceneRenderer->framebufferWidth,renderControl->sceneRenderer->framebufferHeight); - screenCorners[3] = Point2f(0.0, renderControl->sceneRenderer->framebufferHeight); + + const Point2f frameSize = renderControl->sceneRenderer->getFramebufferSize(); + const Point2f frameSizeScaled = renderControl->sceneRenderer->getFramebufferSizeScaled(); + + const Point2f screenCorners[4] = { + Point2f(0.0, 0.0), + Point2f(frameSize.x(),0.0), + frameSize, + Point2f(0.0, frameSize.y()), + }; Eigen::Matrix4d modelTrans; Eigen::Affine3d trans(Eigen::Translation3d(0,0,-globeView->calcEarthZOffset())); @@ -1196,7 +1194,6 @@ - (void)corners:(MaplyCoordinate *)corners forRot:(Eigen::Quaterniond)theRot vie modelTrans = viewMat * modelMat; - auto frameSizeScaled = renderControl->sceneRenderer->getFramebufferSizeScaled(); for (unsigned int ii=0;ii<4;ii++) { Point3d hit; @@ -1333,31 +1330,91 @@ - (void) animationDidEnd:(NSNotification *)note // NSLog(@"Animation ended"); // Momentum animation is only kicked off by the pan delegate. - bool userMotion = false; - if (dynamic_cast(globeView->getDelegate().get())) - userMotion = true; + const auto delegate = globeView->getDelegate(); + const bool userMotion = delegate && delegate->isUserMotion(); isAnimating = false; knownAnimateEndRot = false; [self handleStopMoving:userMotion]; } -// See if the given bounding box is all on sreen -- (bool)checkCoverage:(Mbr &)mbr globeView:(WhirlyGlobe::GlobeView *)theView height:(float)height -{ +// See if the given bounding box is all on screen +- (bool)checkCoverage:(const Mbr &)mbr + globeView:(WhirlyGlobe::GlobeView *)theView + loc:(MaplyCoordinate)loc + height:(float)height + frame:(CGRect)frame + newLoc:(MaplyCoordinate *)newLoc +{ + return [self checkCoverage:mbr + globeView:theView + loc:loc + height:height + frame:frame + newLoc:newLoc + margin:{0.0,0.0}]; +} + +- (bool)checkCoverage:(const Mbr &)mbr + globeView:(WhirlyGlobe::GlobeView *)theView + loc:(MaplyCoordinate)loc + height:(float)height + frame:(CGRect)frame + newLoc:(MaplyCoordinate *)newLoc + margin:(const Point2d &)margin +{ + if (!theView || frame.size.width * frame.size.height == 0) + { + return false; + } + if (newLoc) + { + *newLoc = loc; + } + + // Center the given location + Eigen::Quaterniond newRotQuat = theView->makeRotationToGeoCoord(GeoCoord(loc.x,loc.y), true); + theView->setRotQuat(newRotQuat,false); theView->setHeightAboveGlobe(height, false); + // If they want to center in an area other than the whole view frame, we need to work out + // what center point will place the given location at the center of the given view frame. + const auto screenCenter = CGPointMake(CGRectGetMidX(self.view.frame), CGRectGetMidY(self.view.frame)); + const auto frameCenter = CGPointMake(CGRectGetMidX(frame), CGRectGetMidY(frame)); + const auto offset = CGPointMake(frameCenter.x - screenCenter.x, frameCenter.y - screenCenter.y); + if (offset.x != 0 || offset.y != 0) + { + const auto invCenter = CGPointMake(screenCenter.x - offset.x, screenCenter.y - offset.y); + MaplyCoordinate invGeo = {0,0}; + if (![self geoPointFromScreen:invCenter theView:theView geoCoord:&invGeo]) + { + return false; + } + + // Place the given location at the center of the given frame + newRotQuat = theView->makeRotationToGeoCoord(Point2d(invGeo.x,invGeo.y), true); + theView->setRotQuat(newRotQuat,false); + + if (newLoc) + { + *newLoc = invGeo; + } + } + Point2fVector pts; mbr.asPoints(pts); - CGRect frame = self.view.frame; - for (unsigned int ii=0;ii frame.size.width || screenPt.y > frame.size.height) + const CGPoint screenPt = [self pointOnScreenFromGeo:{pt.x(), pt.y()} globeView:theView]; + if (!std::isfinite(screenPt.y) || + screenPt.x < frame.origin.x - margin.x() || + screenPt.y < frame.origin.y - margin.y() || + screenPt.x > frame.origin.x + frame.size.width + margin.x() || + screenPt.y > frame.origin.y + frame.size.height + margin.y()) + { return false; + } } return true; @@ -1365,17 +1422,49 @@ - (bool)checkCoverage:(Mbr &)mbr globeView:(WhirlyGlobe::GlobeView *)theView hei - (float)findHeightToViewBounds:(MaplyBoundingBox)bbox pos:(MaplyCoordinate)pos { - if (!globeView) { + return [self findHeightToViewBounds:bbox pos:pos marginX:0 marginY:0]; +} + +- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox + pos:(MaplyCoordinate)pos + marginX:(double)marginX + marginY:(double)marginY +{ + return [self findHeightToViewBounds:bbox + pos:pos + frame:self.view.frame + newPos:nil + marginX:marginX + marginY:marginY]; +} + +- (float)findHeightToViewBounds:(MaplyBoundingBox)bbox + pos:(MaplyCoordinate)pos + frame:(CGRect)frame + newPos:(MaplyCoordinate *)newPos + marginX:(double)marginX + marginY:(double)marginY +{ + if (!globeView) + { return 0; } + + // checkCoverage won't work if the frame size isn't set + if (frame.size.width * frame.size.height == 0) + { + return 0; + } + GlobeView tempGlobe(*globeView); - - float oldHeight = globeView->getHeightAboveGlobe(); - Eigen::Quaterniond newRotQuat = tempGlobe.makeRotationToGeoCoord(GeoCoord(pos.x,pos.y), true); - tempGlobe.setRotQuat(newRotQuat,false); - Mbr mbr(Point2f(bbox.ll.x,bbox.ll.y),Point2f(bbox.ur.x,bbox.ur.y)); - + //const float oldHeight = globeView->getHeightAboveGlobe(); + //const Eigen::Quaterniond newRotQuat = tempGlobe.makeRotationToGeoCoord(GeoCoord(pos.x,pos.y), true); + //tempGlobe.setRotQuat(newRotQuat,false); + + const Mbr mbr({ bbox.ll.x, bbox.ll.y }, { bbox.ur.x, bbox.ur.y }); + const Point2d margin(marginX, marginY); + double minHeight = tempGlobe.minHeightAboveGlobe(); double maxHeight = tempGlobe.maxHeightAboveGlobe(); if (pinchDelegate) @@ -1385,39 +1474,49 @@ - (float)findHeightToViewBounds:(MaplyBoundingBox)bbox pos:(MaplyCoordinate)pos } // Check that we can at least see it - bool minOnScreen = [self checkCoverage:mbr globeView:&tempGlobe height:minHeight]; - bool maxOnScreen = [self checkCoverage:mbr globeView:&tempGlobe height:maxHeight]; - if (!minOnScreen && !maxOnScreen) + MaplyCoordinate minPos, maxPos; + const bool minOnScreen = [self checkCoverage:mbr globeView:&tempGlobe loc:pos height:minHeight + frame:frame newLoc:&minPos margin:margin]; + bool maxOnScreen = [self checkCoverage:mbr globeView:&tempGlobe loc:pos height:maxHeight + frame:frame newLoc:&maxPos margin:margin]; + + // If there's a frame offset, max height will often + // fail, so we need to search both directions. + if (!minOnScreen && !maxOnScreen && !newPos) { - tempGlobe.setHeightAboveGlobe(oldHeight,false); - return oldHeight; + if (newPos) + { + *newPos = pos; + } + return 0.0; } - - // Now for the binary search - float minRange = 1e-5; - do + else if (minOnScreen) { - float midHeight = (minHeight + maxHeight)/2.0; - bool midOnScreen = [self checkCoverage:mbr globeView:&tempGlobe height:midHeight]; - - if (!minOnScreen && midOnScreen) + if (newPos) + { + *newPos = minPos; + } + return minHeight; + } + + // minHeight is out but maxHeight works. + // Binary search to find the lowest height that still works. + constexpr float minRange = 1e-5; + while (maxHeight - minHeight > minRange) + { + const float midHeight = (minHeight + maxHeight)/2.0; + if ([self checkCoverage:mbr globeView:&tempGlobe loc:pos height:midHeight + frame:frame newLoc:newPos margin:margin]) { maxHeight = midHeight; - maxOnScreen = midOnScreen; - } else if (!midOnScreen && maxOnScreen) + maxOnScreen = true; + } + else { - minHeight = midHeight; - minOnScreen = midOnScreen; - } else { - // Not expecting this - break; + (maxOnScreen ? minHeight : maxHeight) = midHeight; } - - if (maxHeight-minHeight < minRange) - break; - } while (true); - - return maxHeight; + } + return maxOnScreen ? maxHeight : 0.0; } - (CGPoint)pointOnScreenFromGeo:(MaplyCoordinate)geoCoord @@ -1428,70 +1527,95 @@ - (CGPoint)pointOnScreenFromGeo:(MaplyCoordinate)geoCoord - (CGPoint)pointOnScreenFromGeo:(MaplyCoordinate)geoCoord globeView:(GlobeView *)theView { if (!renderControl) - return CGPointMake(0.0, 0.0); - + { + return CGPointZero; + } + + const Point2f frameSizeScaled = renderControl->sceneRenderer->getFramebufferSizeScaled(); + if (frameSizeScaled.x() <= 0 || frameSizeScaled.y() <= 0) + { + // Called too early, wait until we're set up + return CGPointZero; + } + Point3d pt = theView->coordAdapter->localToDisplay(theView->coordAdapter->getCoordSystem()->geographicToLocal3d(GeoCoord(geoCoord.x,geoCoord.y))); Eigen::Matrix4d modelTrans = theView->calcFullMatrix(); - auto screenPt = theView->pointOnScreenFromSphere(pt, &modelTrans, renderControl->sceneRenderer->getFramebufferSizeScaled()); + auto screenPt = theView->pointOnScreenFromSphere(pt, &modelTrans, frameSizeScaled); return CGPointMake(screenPt.x(),screenPt.y()); } - (CGPoint)screenPointFromGeo:(MaplyCoordinate)geoCoord { CGPoint p; - - if (![self screenPointFromGeo:geoCoord screenPt:&p]) { - return CGPointZero; - } - - return p; + return [self screenPointFromGeo:geoCoord screenPt:&p] ? p : CGPointZero; } - (bool)screenPointFromGeo:(MaplyCoordinate)geoCoord screenPt:(CGPoint *)screenPt { if (!renderControl) + { return false; - - Point3d pt = renderControl->visualView->coordAdapter->localToDisplay(renderControl->visualView->coordAdapter->getCoordSystem()->geographicToLocal3d(GeoCoord(geoCoord.x,geoCoord.y))); - Point3f pt3f(pt.x(),pt.y(),pt.z()); - - Eigen::Matrix4d modelTrans4d = renderControl->visualView->calcModelMatrix(); - Eigen::Matrix4d viewTrans4d = renderControl->visualView->calcViewMatrix(); - Eigen::Matrix4d modelAndViewMat4d = viewTrans4d * modelTrans4d; - Eigen::Matrix4f modelAndViewMat = Matrix4dToMatrix4f(modelAndViewMat4d); - Eigen::Matrix4f modelAndViewNormalMat = modelAndViewMat.inverse().transpose(); + } - if (CheckPointAndNormFacing(pt3f,pt3f.normalized(),modelAndViewMat,modelAndViewNormalMat) < 0.0) - return false; - - auto screenPt2f = globeView->pointOnScreenFromSphere(pt, &modelAndViewMat4d, renderControl->sceneRenderer->getFramebufferSizeScaled()); - screenPt->x = screenPt2f.x(); screenPt->y = screenPt2f.y(); + const auto adapter = renderControl->visualView->coordAdapter; + const Point3d localPt = adapter->getCoordSystem()->geographicToLocal3d(GeoCoord(geoCoord.x,geoCoord.y)); + const Point3d displayPt = adapter->localToDisplay(localPt); + const Point3f displayPtf = displayPt.cast(); - if (screenPt->x < 0 || screenPt->y < 0 || screenPt->x > renderControl->sceneRenderer->framebufferWidth || screenPt->y > renderControl->sceneRenderer->framebufferHeight) + const Eigen::Matrix4d modelTrans4d = renderControl->visualView->calcModelMatrix(); + const Eigen::Matrix4d viewTrans4d = renderControl->visualView->calcViewMatrix(); + const Eigen::Matrix4d modelAndViewMat4d = viewTrans4d * modelTrans4d; + const Eigen::Matrix4f modelAndViewMat = Matrix4dToMatrix4f(modelAndViewMat4d); + const Eigen::Matrix4f modelAndViewNormalMat = modelAndViewMat.inverse().transpose(); + + if (CheckPointAndNormFacing(displayPtf,displayPtf.normalized(),modelAndViewMat,modelAndViewNormalMat) < 0.0) + { return false; + } - return true; + const Point2f frameSizeScaled = renderControl->sceneRenderer->getFramebufferSizeScaled(); + + auto screenPt2f = globeView->pointOnScreenFromSphere(displayPt, &modelAndViewMat4d, frameSizeScaled); + *screenPt = CGPointMake(screenPt2f.x(), screenPt2f.y()); + + return (screenPt->x >= 0 && screenPt->y >= 0 && + screenPt->x < frameSizeScaled.x() && + screenPt->y < frameSizeScaled.y()); } - (bool)geoPointFromScreen:(CGPoint)screenPt geoCoord:(MaplyCoordinate *)retCoord { - if (!renderControl) + return [self geoPointFromScreen:screenPt theView:globeView.get() geoCoord:retCoord]; +} + +- (bool)geoPointFromScreen:(CGPoint)screenPt + theView:(WhirlyGlobe::GlobeView * __nonnull)theView + geoCoord:(MaplyCoordinate * __nonnull)retCoord +{ + if (!renderControl || !theView) + { return false; - + } + + const auto *coordAdapter = theView->coordAdapter; + const auto *coordSys = coordAdapter->getCoordSystem(); + const auto frameSize = renderControl->sceneRenderer->getFramebufferSizeScaled(); + Point3d hit; Point2f screenPt2f(screenPt.x,screenPt.y); - Eigen::Matrix4d theTransform = globeView->calcFullMatrix(); - if (globeView->pointOnSphereFromScreen(screenPt2f, theTransform, renderControl->sceneRenderer->getFramebufferSizeScaled(), hit, true)) + Eigen::Matrix4d theTransform = theView->calcFullMatrix(); + if (theView->pointOnSphereFromScreen(screenPt2f, theTransform, frameSize, hit, true)) { - GeoCoord geoCoord = renderControl->visualView->coordAdapter->getCoordSystem()->localToGeographic(renderControl->visualView->coordAdapter->displayToLocal(hit)); - retCoord->x = geoCoord.x(); - retCoord->y = geoCoord.y(); - + if (retCoord) + { + const GeoCoord geoCoord = coordSys->localToGeographic(coordAdapter->displayToLocal(hit)); + *retCoord = { geoCoord.x(), geoCoord.y() }; + } return true; - } else - return false; + } + return false; } - (nullable NSValue *)geoPointFromScreen:(CGPoint)screenPt @@ -1852,16 +1976,19 @@ - (int)getUsableGeoBoundsForView:(MaplyBoundingBox *)bboxes visual:(bool)visualB if (!renderControl) return 0; - float extentEps = visualBoxes ? FullExtentEps : 0.0; + const float extentEps = visualBoxes ? FullExtentEps : 0.0; - Point2f screenCorners[4]; - screenCorners[0] = Point2f(0.0, 0.0); - screenCorners[1] = Point2f(renderControl->sceneRenderer->framebufferWidth,0.0); - screenCorners[2] = Point2f(renderControl->sceneRenderer->framebufferWidth,renderControl->sceneRenderer->framebufferHeight); - screenCorners[3] = Point2f(0.0, renderControl->sceneRenderer->framebufferHeight); + const Point2f frameSize = renderControl->sceneRenderer->getFramebufferSize(); + const Point2f frameSizeScaled = renderControl->sceneRenderer->getFramebufferSizeScaled(); + + const Point2f screenCorners[4] = { + { 0.0, 0.0 }, + { frameSize.x(), 0.0 }, + frameSize, + { 0.0, frameSize.y() }, + }; - Eigen::Matrix4d modelTrans = globeView->calcFullMatrix(); - auto frameSizeScaled = renderControl->sceneRenderer->getFramebufferSizeScaled(); + const Eigen::Matrix4d modelTrans = globeView->calcFullMatrix(); Point3d corners[4]; bool cornerValid[4]; @@ -2050,11 +2177,9 @@ - (int)getUsableGeoBoundsForView:(MaplyBoundingBox *)bboxes visual:(bool)visualB } } else { // Check the poles - Point3d poles[2]; - poles[0] = Point3d(0,0,1); - poles[1] = Point3d(0,0,-1); + const Point3d poles[2] = { { 0, 0, 1 }, { 0, 0, -1 } }; - Eigen::Matrix4d modelAndViewNormalMat = modelTrans.inverse().transpose(); + const Eigen::Matrix4d modelAndViewNormalMat = modelTrans.inverse().transpose(); for (unsigned int ii=0;ii<2;ii++) { @@ -2062,10 +2187,14 @@ - (int)getUsableGeoBoundsForView:(MaplyBoundingBox *)bboxes visual:(bool)visualB if (CheckPointAndNormFacing(pt,pt.normalized(),modelTrans,modelAndViewNormalMat) < 0.0) continue; - Point2f screenPt = globeView->pointOnScreenFromSphere(pt, &modelTrans, frameSizeScaled); + const Point2f screenPt = globeView->pointOnScreenFromSphere(pt, &modelTrans, frameSizeScaled); + const Point2f frameSize = renderControl->sceneRenderer->getFramebufferSizeScaled(); - if (screenPt.x() < 0 || screenPt.y() < 0 || screenPt.x() > renderControl->sceneRenderer->framebufferWidth || screenPt.y() > renderControl->sceneRenderer->framebufferHeight) + if (screenPt.x() < 0 || screenPt.y() < 0 || + screenPt.x() > frameSize.x() || screenPt.y() > frameSize.y()) + { continue; + } // Include the pole and just do the whole area switch (ii) diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/data_sources/MaplyMBTileFetcher.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/data_sources/MaplyMBTileFetcher.mm index d3461b9383..0a6bd8cb5a 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/data_sources/MaplyMBTileFetcher.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/data_sources/MaplyMBTileFetcher.mm @@ -1,9 +1,8 @@ -/* - * MaplyMBTileFetcher.mm +/* MaplyMBTileFetcher.mm * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/13/18. - * Copyright 2011-2019 mousebird consulting inc + * Copyright 2011-2022 mousebird consulting inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "data_sources/MaplyMBTileFetcher.h" @@ -36,6 +34,12 @@ @implementation MaplyMBTileFetcher } - (nullable instancetype)initWithMBTiles:(NSString *__nonnull)mbTilesName +{ + return [self initWithMBTiles:mbTilesName cacheSize:-1]; +} + +- (nullable instancetype)initWithMBTiles:(NSString *__nonnull)mbTilesName + cacheSize:(int)cacheSize { NSString *infoPath = nil; // See if that was a direct path first @@ -59,18 +63,70 @@ - (nullable instancetype)initWithMBTiles:(NSString *__nonnull)mbTilesName } } } - + + const char* nameStr = [infoPath cStringUsingEncoding:NSASCIIStringEncoding]; + if (!nameStr || !nameStr[0]) + { + return nil; + } + // Open the sqlite DB sqlite3 *db = nil; - if (sqlite3_open([infoPath cStringUsingEncoding:NSASCIIStringEncoding],&db) != SQLITE_OK) + // Disable writes, eliminating the need for locking. + const int flags = SQLITE_OPEN_READONLY | + SQLITE_OPEN_NOMUTEX; + //| SQLITE_OPEN_EXRESCODE; // extended error codes on failure - available in later versions + const int openRes = sqlite3_open_v2(nameStr, &db, flags, nullptr); + if (openRes != SQLITE_OK) { + const char* const err = sqlite3_errstr(openRes); + wkLogLevel(Error, "SQLite failed to open '%s' - %d: %s", nameStr, openRes, err ? err : "?"); return nil; } - + const auto cs = [[MaplySphericalMercator alloc] initWebStandard]; - + + if (cacheSize >= 0) + { + try + { + sqlhelpers::StatementRead pageStmt(db, "PRAGMA page_size", false); + const int pageSize = pageStmt.stepRow() ? pageStmt.getInt() : 0; + if (pageSize > 0) + { + const int cachePages = (cacheSize + pageSize - 1) / pageSize; + const auto sql = "PRAGMA cache_size=" + std::to_string(cachePages); + sqlhelpers::StatementRead configStmt(db, sql.c_str(), true); + + sqlhelpers::StatementRead cacheStmt(db, "PRAGMA cache_size", false); + if (cacheStmt.stepRow()) + { + const int actualCachePages = cacheStmt.getInt(); + wkLogLevel(Info, "SQLite cache size set to %d pages = %d bytes", + actualCachePages, actualCachePages * pageSize); + } + } + } + catch (const std::exception &e) + { + wkLogLevel(Warn, "Failed to set SQLite cache (%s)", e.what()); + } + catch (int e) + { + const char* const str = sqlite3_errstr(e); + wkLogLevel(Warn, "Failed to set SQLite cache (%d): %s", e, str ? str : "?"); + } + catch (...) + { + const int e = sqlite3_errcode(db); + const char* const str = sqlite3_errmsg(db); + wkLogLevel(Warn, "Failed to set SQLite cache (%d): %s", e, str ? str : "?"); + } + } + // Look at the metadata GeoMbr gmbr; + bool failed = false; try { sqlhelpers::StatementRead readStmt(db,@"select value from metadata where name='bounds';"); @@ -131,24 +187,41 @@ - (nullable instancetype)initWithMBTiles:(NSString *__nonnull)mbTilesName sqlhelpers::StatementRead testStmt(db,@"SELECT name FROM sqlite_master WHERE type='table' AND name='tiles';"); if (testStmt.stepRow()) tilesStyles = true; - } catch (int e) { - NSLog(@"Exception fetching MBTiles metadata (%d)", e); - if (db) { - sqlite3_close(db); - } - return nil; - } catch (...) { - NSLog(@"Unknown exception fetching MBTiles metadata"); - if (db) { + } + catch (const std::exception &e) + { + wkLogLevel(Error, "Exception fetching MBTiles metadata (%s)", e.what()); + failed = true; + } + catch (int e) + { + const char* const str = sqlite3_errstr(e); + wkLogLevel(Error, "Exception fetching MBTiles metadata (%d): %s", e, str ? str : "?"); + failed = true; + } + catch (...) + { + const int e = sqlite3_errcode(db); + const char* const str = sqlite3_errmsg(db); + wkLogLevel(Error, "Exception fetching MBTiles metadata (%d): %s", e, str ? str : "?"); + failed = true; + } + + if (failed) + { + if (db) + { sqlite3_close(db); } return nil; } - self = [super initWithName:mbTilesName minZoom:minZoom maxZoom:maxZoom]; - geoMbr = gmbr; - coordSys = cs; - sqlDb = db; + if ((self = [super initWithName:mbTilesName minZoom:minZoom maxZoom:maxZoom])) + { + geoMbr = gmbr; + coordSys = cs; + sqlDb = db; + } return self; } diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/data_sources/MaplyWMSTileSource.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/data_sources/MaplyWMSTileSource.mm index 2bbec37a6f..5cb277855b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/data_sources/MaplyWMSTileSource.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/data_sources/MaplyWMSTileSource.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 7/25/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeDoubleTapDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeDoubleTapDelegate.mm index 07a9235f28..8b29bc7ba1 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeDoubleTapDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeDoubleTapDelegate.mm @@ -1,9 +1,7 @@ -/* - * GlobeDoubleTapDelegate.mm - * +/* GlobeDoubleTapDelegate.mm * * Created by Steve Gifford on 2/7/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +13,12 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "gestures/GlobeDoubleTapDelegate.h" #import "GlobeAnimateHeight.h" #import "ViewWrapper.h" +#import "SceneRenderer.h" using namespace WhirlyKit; using namespace WhirlyGlobe; @@ -54,19 +52,19 @@ - (void)tapGesture:(id)sender // Just figure out where we tapped Point3d hit; - Eigen::Matrix4d theTransform = globeView->calcFullMatrix(); - CGPoint touchLoc = [tap locationInView:tap.view]; - Point2f touchLoc2f(touchLoc.x,touchLoc.y); + const Eigen::Matrix4d theTransform = globeView->calcFullMatrix(); + const CGPoint touchLoc = [tap locationInView:tap.view]; + const Point2f touchLoc2f(touchLoc.x,touchLoc.y); auto frameSizeScaled = sceneRenderer->getFramebufferSizeScaled(); if (globeView->pointOnSphereFromScreen(touchLoc2f, theTransform, frameSizeScaled, hit, true)) { - double curH = globeView->getHeightAboveGlobe(); - double newH = curH / _zoomTapFactor; + const double curH = globeView->getHeightAboveGlobe(); + const double newH = curH / _zoomTapFactor; if (_minZoom < newH && newH < _maxZoom) { - auto animate = new AnimateViewHeight(globeView,newH,_zoomAnimationDuration); + auto animate = std::make_shared(globeView,newH,_zoomAnimationDuration); animate->setTiltDelegate(_tiltDelegate); - globeView->setDelegate(GlobeViewAnimationDelegateRef(animate)); + globeView->setDelegate(std::move(animate)); } } } diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeDoubleTapDragDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeDoubleTapDragDelegate.mm index a7f3aac89a..688c0359c4 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeDoubleTapDragDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeDoubleTapDragDelegate.mm @@ -3,7 +3,7 @@ * * * Created by Steve Gifford on 2/7/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ #import "gestures/GlobeDoubleTapDragDelegate.h" #import "GlobeView.h" #import "ViewWrapper.h" +#import "SceneRenderer.h" using namespace WhirlyKit; using namespace WhirlyGlobe; diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobePanDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobePanDelegate.mm index 081b7aa21f..018f41d6c0 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobePanDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobePanDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobeApp * * Created by Stephen Gifford on 4/28/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobePinchDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobePinchDelegate.mm index 5caab82fc0..80d211188b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobePinchDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobePinchDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 8/22/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeRotateDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeRotateDelegate.mm index df50265be1..e30ca40ec9 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeRotateDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeRotateDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/10/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTapDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTapDelegate.mm index ef96e1eb56..62958b21e4 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTapDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTapDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/3/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTapMessage.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTapMessage.mm index f29063ecdf..d5db85e9d1 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTapMessage.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTapMessage.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/3/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTiltDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTiltDelegate.mm index a060c93461..62ec44fc9e 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTiltDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTiltDelegate.mm @@ -2,7 +2,7 @@ * TiltDelegate.mm * * Created by Stephen Gifford on 1/5/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTwoFingerTapDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTwoFingerTapDelegate.mm index a43be7000b..aa0a232cb0 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTwoFingerTapDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/GlobeTwoFingerTapDelegate.mm @@ -1,9 +1,8 @@ /* * GlobeTwoFingerTapDelegate.mm * - * * Created by Steve Gifford on 2/7/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +20,7 @@ #import "gestures/GlobeTwoFingerTapDelegate.h" #import "GlobeAnimateHeight.h" #import "ViewWrapper.h" +#import "SceneRenderer.h" using namespace WhirlyKit; using namespace WhirlyGlobe; @@ -51,7 +51,7 @@ - (void)tapGesture:(id)sender UITapGestureRecognizer *tap = sender; UIView *wrapView = (UIView *)tap.view; SceneRenderer *sceneRenderer = wrapView.renderer; - auto frameSizeScaled = sceneRenderer->getFramebufferSizeScaled(); + const auto frameSizeScaled = sceneRenderer->getFramebufferSizeScaled(); // Just figure out where we tapped Point3d hit; diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/Maply3dTouchPreviewDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/Maply3dTouchPreviewDelegate.mm index a023fcae56..a0549626af 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/Maply3dTouchPreviewDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/Maply3dTouchPreviewDelegate.mm @@ -45,14 +45,14 @@ - (UIViewController * _Nullable)previewingContext:(idgetFramebufferSizeScaled(); if (self.mapView->pointOnPlaneFromScreen(touchLoc2f, &theTransform, frameSizeScaled, &hit, true)) { - double newZ = curLoc.z() - (curLoc.z() - self.minZoom)/2.0; + const double newZ = curLoc.z() - (curLoc.z() - self.minZoom)/2.0; if (self.minZoom >= self.maxZoom || (self.minZoom < newZ && newZ < self.maxZoom)) { - Point3d newLoc(hit.x(),hit.y(),newZ); + const Point3d newLoc(hit.x(),hit.y(),newZ); Point3d newCenter; MapView testMapView(*(self.mapView)); // Check if we're still within bounds if (MaplyGestureWithinBounds(bounds, newLoc, sceneRenderer, &testMapView, &newCenter)) { - MapViewAnimationDelegateRef animation(new AnimateViewTranslation(self.mapView,sceneRenderer,newCenter,_animTime)); - self.mapView->setDelegate(animation); + self.mapView->setDelegate(std::make_shared( + self.mapView,sceneRenderer,newCenter,_animTime)); } } } else { diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyDoubleTapDragDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyDoubleTapDragDelegate.mm index f36f1ddcac..f9cb582a30 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyDoubleTapDragDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyDoubleTapDragDelegate.mm @@ -3,7 +3,7 @@ * * * Created by Steve Gifford on 2/7/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyPanDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyPanDelegate.mm index 3440fae2e8..860666262b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyPanDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyPanDelegate.mm @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/10/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -156,8 +156,8 @@ - (void)panAction:(id)sender // Check if we're still within bounds if (MaplyGestureWithinBounds(bounds, newLoc, sceneRender, &testMapView, &newCenter)) { - auto animation = std::make_shared(mapView,sceneRender,newCenter,animTime); - mapView->setDelegate(animation); + mapView->setDelegate(std::make_shared( + mapView,sceneRender,newCenter,animTime)); } } } diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyPinchDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyPinchDelegate.mm index 3da57398c0..72fc81e348 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyPinchDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyPinchDelegate.mm @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/10/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyRotateDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyRotateDelegate.mm index c0639fc0c4..88d881140c 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyRotateDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyRotateDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by rghosh0 around 9/26/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTapDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTapDelegate.mm index 12057a1bda..f4eb5f949c 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTapDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTapDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/20/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTapMessage.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTapMessage.mm index ca12368b23..c253d344ca 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTapMessage.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTapMessage.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 9/19/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTouchCancelAnimationDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTouchCancelAnimationDelegate.mm index 7d5ff70003..b55c5af886 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTouchCancelAnimationDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTouchCancelAnimationDelegate.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Jesse Crocker on 7/15/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTwoFingerTapDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTwoFingerTapDelegate.mm index e68c05ec5e..1afe51c9de 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTwoFingerTapDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyTwoFingerTapDelegate.mm @@ -3,7 +3,7 @@ * * * Created by Jesse Crocker on 2/4/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,26 +53,31 @@ - (void)tapGesture:(id)sender Point3d curLoc = self.mapView->getLoc(); // Just figure out where we tapped Point3d hit; - Eigen::Matrix4d theTransform = self.mapView->calcFullMatrix(); - CGPoint touchLoc = [tap locationInView:tap.view]; - Point2f touchLoc2f(touchLoc.x,touchLoc.y); - if (self.mapView->pointOnPlaneFromScreen(touchLoc2f, &theTransform, Point2f(sceneRenderer->framebufferWidth/wrapView.contentScaleFactor,sceneRenderer->framebufferHeight/wrapView.contentScaleFactor), &hit, true)) + const Eigen::Matrix4d theTransform = self.mapView->calcFullMatrix(); + const CGPoint touchLoc = [tap locationInView:tap.view]; + const Point2f touchLoc2f(touchLoc.x,touchLoc.y); + const Point2f frameSize = sceneRenderer->getFramebufferSize(); + if (self.mapView->pointOnPlaneFromScreen(touchLoc2f, &theTransform, frameSize / wrapView.contentScaleFactor, &hit, true)) { - double newZ = curLoc.z() + (curLoc.z() - self.minZoom)/2.0; + const double newZ = curLoc.z() + (curLoc.z() - self.minZoom)/2.0; if (self.minZoom >= self.maxZoom || (self.minZoom < newZ && newZ < self.maxZoom)) { - Point3d newLoc(hit.x(),hit.y(),newZ); - Point3f newLoc3f(newLoc.x(),newLoc.y(),newLoc.z()); + const Point3d newLoc(hit.x(),hit.y(),newZ); + const Point3f newLoc3f(newLoc.x(),newLoc.y(),newLoc.z()); Point3d newCenter; Maply::MapView testMapView(*(self.mapView)); // Check if we're still within bounds - if (MaplyGestureWithinBounds(bounds,newLoc,sceneRenderer,&testMapView,&newCenter)) { - Maply::AnimateViewTranslationRef animation = AnimateViewTranslationRef(new AnimateViewTranslation(self.mapView,sceneRenderer,newCenter,_animTime)); - self.mapView->setDelegate(animation); + if (MaplyGestureWithinBounds(bounds,newLoc,sceneRenderer,&testMapView,&newCenter)) + { + AnimateViewTranslation x(self.mapView,sceneRenderer,newCenter,_animTime); + self.mapView->setDelegate(std::make_shared( + self.mapView,sceneRenderer,newCenter,_animTime)); } } - } else { + } + else + { // Not expecting this case } diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyZoomGestureDelegate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyZoomGestureDelegate.mm index 77eb475139..c61a4d7b7a 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyZoomGestureDelegate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/gestures/MaplyZoomGestureDelegate.mm @@ -3,7 +3,7 @@ * * * Created by Jesse Crocker on 2/4/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,16 +60,17 @@ - (void)tapGesture:(id)sender UIView *wrapView = (UIView *)tap.view; SceneRenderer *sceneRenderer = wrapView.renderer; - Point3d curLoc = _mapView->getLoc(); + const Point3d curLoc = _mapView->getLoc(); // NSLog(@"curLoc x:%f y:%f z:%f", curLoc.x(), curLoc.y(), curLoc.z()); // Just figure out where we tapped Point3d hit; - Eigen::Matrix4d theTransform = _mapView->calcFullMatrix(); - CGPoint touchLoc = [tap locationInView:tap.view]; - Point2f touchLoc2f(touchLoc.x,touchLoc.y); - if (_mapView->pointOnPlaneFromScreen(touchLoc2f, &theTransform, Point2f(sceneRenderer->framebufferWidth/wrapView.contentScaleFactor,sceneRenderer->framebufferHeight/wrapView.contentScaleFactor), &hit, true)) + const Eigen::Matrix4d theTransform = _mapView->calcFullMatrix(); + const CGPoint touchLoc = [tap locationInView:tap.view]; + const Point2f touchLoc2f(touchLoc.x,touchLoc.y); + const Point2f frameSize = sceneRenderer->getFramebufferSize(); + if (_mapView->pointOnPlaneFromScreen(touchLoc2f, &theTransform, frameSize/wrapView.contentScaleFactor, &hit, true)) { - double newZ = curLoc.z() - (curLoc.z() - _minZoom)/2.0; + const double newZ = curLoc.z() - (curLoc.z() - _minZoom)/2.0; Point2d newCenter; if (_minZoom >= _maxZoom || (_minZoom < newZ && newZ < _maxZoom)) { diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MapboxKindaMap.swift b/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MapboxKindaMap.swift index ae52923222..05459f88bd 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MapboxKindaMap.swift +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MapboxKindaMap.swift @@ -3,7 +3,7 @@ // WhirlyGlobeMaplyComponent // // Created by Steve Gifford on 11/11/19. -// Copyright © 2019 mousebird consulting. All rights reserved. +// Copyright 2019-2022 mousebird consulting. All rights reserved. // import UIKit @@ -69,7 +69,10 @@ public class MapboxKindaMap { // We'll scale the text size calculations based on this value // If it's set to 0, we'll figure this out from minImportance public var textScale = 0.0 - + + // Set to override the default marker scale + public var markerScale: Double? = nil + // If we're doing offline rendering for the map tiles, this is the size public var offlineRenderSize = (width: 512.0, height: 512.0) @@ -209,30 +212,30 @@ public class MapboxKindaMap { let source = $0 as! MaplyMapboxVectorStyleSource if source.tileSpec == nil /*&& success*/ { if let urlStr = source.url, - let origURL = URL(string: urlStr) { - let url = self.cacheResolve(self.fileOverride(origURL)) + let origURL = URL(string: urlStr) { + let url = fileOverride(origURL) // Go fetch the TileJSON let fetchIdx = self.outstandingFetches.count - let dataTask = URLSession.shared.dataTask(with: self.makeURLRequest(url)) { (data, resp, error) in + let dataTask = URLSession.shared.dataTask(with: makeURLRequest(cacheResolve(url))) { [self] (data, resp, error) in guard error == nil else { print("Error trying to fetch tileJson from \(urlStr) : \(error?.localizedDescription ?? "unknown")") - self.stop() + stop() return } if let data = data, - let resp = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] { + let resp = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] { source.tileSpec = resp - self.cacheFile(origURL, data: data) + cacheFile(origURL, data: data) DispatchQueue.main.async { - self.outstandingFetches[fetchIdx] = nil - self.checkFinished() + outstandingFetches[fetchIdx] = nil + checkFinished() } } } - self.outstandingFetches.append(dataTask) + outstandingFetches.append(dataTask) dataTask.resume() } else { print("Expecting either URL or tile info for a source. Skipping this source.") @@ -242,68 +245,67 @@ public class MapboxKindaMap { } // And for the sprite sheets + let scaleRatio = "@2x" if let spriteURLStr = styleSheet.spriteURL, - var spriteJSONurl = URL(string: spriteURLStr.appending("@2x.json")), - var spritePNGurl = URL(string: spriteURLStr.appending("@2x.png")) { - spriteJSONurl = self.fileOverride(spriteJSONurl) - spritePNGurl = self.fileOverride(spritePNGurl) - let fetchIdx1 = self.outstandingFetches.count - let dataTask1 = URLSession.shared.dataTask(with: self.makeURLRequest(self.cacheResolve(self.fileOverride(spriteJSONurl)))) { (data, _, error) in - guard error == nil else { - print("Failed to fetch spriteJSON from \(spriteURLStr)") - self.stop() - return - } - - if let data = data, !data.isEmpty { - self.spriteJSON = data - self.cacheFile(spriteJSONurl, data: data) - } + let spriteJSONRawUrl = URL(string: spriteURLStr.appending(scaleRatio).appending(".json")), + let spritePNGRawUrl = URL(string: spriteURLStr.appending(scaleRatio).appending(".png")) { - DispatchQueue.main.async { - if self.outstandingFetches.count > fetchIdx1 { - self.outstandingFetches[fetchIdx1] = nil - } - self.checkFinished() - } + let spriteJSONurl = self.fileOverride(spriteJSONRawUrl) + let spritePNGurl = self.fileOverride(spritePNGRawUrl) + let fetchIdx1 = self.outstandingFetches.count + let dataTask1 = URLSession.shared.dataTask(with: makeURLRequest(cacheResolve(spriteJSONurl))) { [self] (data, _, error) in + guard error == nil else { + print("Failed to fetch spriteJSON from \(spriteURLStr)") + self.stop() + return } - self.outstandingFetches.append(dataTask1) - dataTask1.resume() - let fetchIdx2 = self.outstandingFetches.count - let dataTask2 = URLSession.shared.dataTask(with: self.makeURLRequest(self.cacheResolve(self.fileOverride(spritePNGurl)))) { (data, _, error) in - guard error == nil else { - print("Failed to fetch spritePNG from \(spriteURLStr)") - self.stop() - return - } - if let data = data, !data.isEmpty { - self.spritePNG = UIImage(data: data) - self.cacheFile(spritePNGurl, data: data) + + if let data = data, !data.isEmpty { + spriteJSON = data + self.cacheFile(spriteJSONurl, data: data) + } + + DispatchQueue.main.async { + if self.outstandingFetches.count > fetchIdx1 { + self.outstandingFetches[fetchIdx1] = nil } + self.checkFinished() + } + } + self.outstandingFetches.append(dataTask1) + dataTask1.resume() - DispatchQueue.main.async { - if self.outstandingFetches.count > fetchIdx2 { - self.outstandingFetches[fetchIdx2] = nil - } - self.checkFinished() + let fetchIdx2 = self.outstandingFetches.count + let dataTask2 = URLSession.shared.dataTask(with: makeURLRequest(cacheResolve(spritePNGurl))) { (data, _, error) in + guard error == nil else { + print("Failed to fetch spritePNG from \(spriteURLStr)") + self.stop() + return + } + if let data = data, !data.isEmpty { + self.spritePNG = UIImage(data: data) + self.cacheFile(spritePNGurl, data: data) + } + + DispatchQueue.main.async { + if self.outstandingFetches.count > fetchIdx2 { + self.outstandingFetches[fetchIdx2] = nil } + self.checkFinished() } - self.outstandingFetches.append(dataTask2) - dataTask2.resume() } - - //if !success { - // self.stop() - //} + self.outstandingFetches.append(dataTask2) + dataTask2.resume() + } } - + // Done messing with settings? Then fire this puppy up // Will shut down the loader(s) it started public func start() { guard let viewC = viewC else { return } - + if let styleSheetData = styleSheetData { guard let styleSheet = MapboxVectorStyleSet(json: styleSheetData, settings: self.styleSettings, @@ -322,11 +324,10 @@ public class MapboxKindaMap { } else if var styleURL = styleURL { // Dev might be overriding the source styleURL = fileOverride(styleURL) - styleURL = cacheResolve(styleURL) - + // Go get the style sheet (this will also handle local let fetchIdx = self.outstandingFetches.count - let dataTask = URLSession.shared.dataTask(with: self.makeURLRequest(styleURL)) { (data, _, error) in + let dataTask = URLSession.shared.dataTask(with: makeURLRequest(cacheResolve(styleURL))) { (data, _, error) in guard error == nil, var data = data, !data.isEmpty else { print("Error fetching style sheet:\n\(String(describing: error))") @@ -355,20 +356,19 @@ public class MapboxKindaMap { return } - DispatchQueue.main.async { - self.outstandingFetches[fetchIdx] = nil + DispatchQueue.main.async { [self] in + outstandingFetches[fetchIdx] = nil guard let styleSheet = MapboxVectorStyleSet(dict: jsonDict!, - settings: self.styleSettings, + settings: styleSettings, viewC: viewC) else { print("Failed to parse style sheet") - self.stop() + stop() return } - self.styleSheetData = data + styleSheetData = data self.styleSheet = styleSheet - self.cacheFile(self.styleURL!, data: data) - - self.styleSheetKickoff() + cacheFile(styleURL, data: data) + styleSheetKickoff() } } outstandingFetches.append(dataTask) @@ -479,8 +479,9 @@ public class MapboxKindaMap { styleSettings.textScale = Float(0.5 * minImportance / (512.0 * 512.0)) } - // We fetch the @2x versions of markers by default, so we need to scale back down - styleSettings.markerScale = Float(UIScreen.main.scale / 2.0) * 2.0 / 3.0 + let defMarkerScaleFactor = 1.0 / 3.0 + let defMarkerScale = UIScreen.main.scale.native * defMarkerScaleFactor + styleSettings.markerScale = Float(self.markerScale ?? defMarkerScale) // Image/vector hybrids draw the polygons into a background image if imageVectorHybrid { diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyGeomBuilder.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyGeomBuilder.mm index c73f2c4189..1a2751124a 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyGeomBuilder.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyGeomBuilder.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 1/20/16 - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyIconManager.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyIconManager.mm index f583fe22bc..e0b5cfcc2f 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyIconManager.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyIconManager.mm @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/11/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -168,6 +168,11 @@ + (UIImage *)iconForName:(NSString *)name size:(CGSize)size color:(UIColor *)col circleColor:circleColor strokeSize:strokeSize strokeColor:strokeColor]; } ++ (void)clearIconCache +{ + [[MaplySimpleStyleManager shared] clearCache]; +} + // Colors can be in short form: // "#ace" // or long form @@ -336,7 +341,7 @@ - (MaplyTexture *)textureForStyle:(MaplySimpleStyle *)style return nil; } -- (void)shutdown +- (void)clearCache { @synchronized (self) { NSMutableArray *texs = [NSMutableArray array]; @@ -348,6 +353,11 @@ - (void)shutdown } } +- (void)shutdown +{ + [self clearCache]; +} + - (MaplySimpleStyle * __nonnull)makeStyle:(NSDictionary *__nonnull)dict { MaplySimpleStyle *style = [[MaplySimpleStyle alloc] init]; diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyLocationTracker.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyLocationTracker.mm index 943f3f88c3..236c8d5d22 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyLocationTracker.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyLocationTracker.mm @@ -3,7 +3,7 @@ * MaplyComponent * * Created by Ranen Ghosh on 11/23/16. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyTextureBuilder.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyTextureBuilder.mm index 301a7d1954..cd2c1c2435 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyTextureBuilder.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/MaplyTextureBuilder.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/30/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/sqlhelpers.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/sqlhelpers.mm index f8edc1515d..229126769a 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/sqlhelpers.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/helpers/sqlhelpers.mm @@ -1,9 +1,8 @@ -/* - * sqlhelpers.mm +/* sqlhelpers.mm * WhirlyGlobeLib * * Created by Steve Gifford on 9/8/09. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "sqlhelpers.h" @@ -28,13 +26,15 @@ void OneShot(sqlite3 *db,const char *stmtStr) { sqlite3_stmt *stmt = NULL; - if (sqlite3_prepare_v2(db,stmtStr,-1,&stmt,NULL) != SQLITE_OK) - throw 1; - - if (sqlite3_step(stmt) != SQLITE_DONE) + int res = sqlite3_prepare_v2(db,stmtStr,-1,&stmt,NULL); + if (res != SQLITE_OK) + throw res; + + res = sqlite3_step(stmt); + if (res != SQLITE_DONE) { sqlite3_finalize(stmt); - throw 1; + throw res; } sqlite3_finalize(stmt); @@ -99,13 +99,13 @@ void OneShot(sqlite3 *db,NSString *stmtStr) curField = 0; - int ret = sqlite3_step(stmt); + const int ret = sqlite3_step(stmt); if (ret == SQLITE_ROW) return true; if (ret == SQLITE_DONE) return false; - throw 1; + throw ret; } // Done with the statement @@ -123,7 +123,7 @@ void OneShot(sqlite3 *db,NSString *stmtStr) int StatementRead::getInt() { if (isFinalized) - throw 1; + throw SQLITE_IOERR_CLOSE; return sqlite3_column_int(stmt, curField++); } @@ -132,7 +132,7 @@ void OneShot(sqlite3 *db,NSString *stmtStr) double StatementRead::getDouble() { if (isFinalized) - throw 1; + throw SQLITE_IOERR_CLOSE; return sqlite3_column_double(stmt, curField++); } @@ -141,7 +141,7 @@ void OneShot(sqlite3 *db,NSString *stmtStr) NSString *StatementRead::getString() { if (isFinalized) - throw 1; + throw SQLITE_IOERR_CLOSE; const char *str = (const char *)sqlite3_column_text(stmt, curField++); if (str == nil) @@ -154,7 +154,7 @@ void OneShot(sqlite3 *db,NSString *stmtStr) BOOL StatementRead::getBool() { if (isFinalized) - throw 1; + throw SQLITE_IOERR_CLOSE; const char *str = (const char *)sqlite3_column_text(stmt, curField++); @@ -167,7 +167,7 @@ void OneShot(sqlite3 *db,NSString *stmtStr) NSData *StatementRead::getBlob() { if (isFinalized) - throw 1; + throw SQLITE_IOERR_CLOSE; const char *blob = (const char *)sqlite3_column_blob(stmt, curField); int blobSize = sqlite3_column_bytes(stmt,curField); @@ -191,10 +191,11 @@ void OneShot(sqlite3 *db,NSString *stmtStr) void StatementWrite::init(sqlite3 *db,const char *stmtStr) { isFinalized = false; - if (sqlite3_prepare_v2(db,stmtStr,-1,&stmt,NULL) != SQLITE_OK) + const int res = sqlite3_prepare_v2(db,stmtStr,-1,&stmt,NULL); + if (res != SQLITE_OK) { NSLog(@"Sqlite error: %s",sqlite3_errmsg(db)); - throw 1; + throw res; } curField = 1; } @@ -209,10 +210,11 @@ void OneShot(sqlite3 *db,NSString *stmtStr) void StatementWrite::go() { if (isFinalized) - throw 1; + throw SQLITE_IOERR_CLOSE; - if (sqlite3_step(stmt) != SQLITE_DONE) - throw 1; + const int res = sqlite3_step(stmt); + if (res != SQLITE_DONE) + throw res; } // Finalize the statement @@ -230,7 +232,7 @@ void OneShot(sqlite3 *db,NSString *stmtStr) void StatementWrite::add(int iVal) { if (isFinalized) - throw 1; + throw SQLITE_IOERR_CLOSE; sqlite3_bind_int(stmt,curField++,iVal); } @@ -239,7 +241,7 @@ void OneShot(sqlite3 *db,NSString *stmtStr) void StatementWrite::add(double dVal) { if (isFinalized) - throw 1; + throw SQLITE_IOERR_CLOSE; sqlite3_bind_double(stmt,curField++,dVal); } @@ -259,7 +261,7 @@ void OneShot(sqlite3 *db,NSString *stmtStr) void StatementWrite::add(BOOL bVal) { if (isFinalized) - throw 1; + throw SQLITE_IOERR_CLOSE; sqlite3_bind_text(stmt, curField++, (bVal ? "yes" : "no"), -1, SQLITE_STATIC); } diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyImageTile.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyImageTile.mm index 1cc9394f30..12d7a242de 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyImageTile.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyImageTile.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/7/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyQuadImageFrameLoader.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyQuadImageFrameLoader.mm index 29139e09a3..0dee37464f 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyQuadImageFrameLoader.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyQuadImageFrameLoader.mm @@ -2,7 +2,7 @@ * MaplyQuadImageFrameLoader.mm * * Created by Steve Gifford on 9/13/18. - * Copyright 2012-2018 mousebird consulting inc + * Copyright 2012-2022 mousebird consulting inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyQuadLoader.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyQuadLoader.mm index 7a2167f5f4..88637674bc 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyQuadLoader.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyQuadLoader.mm @@ -1,7 +1,7 @@ /* MaplyQuadLoader.mm * * Created by Steve Gifford on 2/12/19. - * Copyright 2012-2021 Saildrone Inc + * Copyright 2012-2022 Saildrone Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ - (id)initWithLoader:(MaplyQuadLoaderBase *)loader loadReturn = std::make_shared(loader->loader->getGeneration()); viewC = loader.viewC; - return self; + return self; } - (void)setTileID:(MaplyTileID)tileID @@ -106,7 +106,11 @@ @implementation MaplyQuadLoaderBase - (instancetype)initWithViewC:(NSObject *)inViewC { - self = [super init]; + if (!(self = [super init])) + { + return nil; + } + _flipY = true; _viewC = inViewC; _numSimultaneousTiles = 8; @@ -118,24 +122,26 @@ - (instancetype)initWithViewC:(NSObject *)inViewC - (bool)delayedInit { - return true; + return valid; } - (void)dealloc { + if (valid) + { + wkLogLevel(Warn, "MaplyQuadLoader dealloc without shutdown"); + } if ([pendingReturns count]) { - wkLog("MaplyQuadLoaderBase - LoaderReturns not cleaned up"); + wkLogLevel(Warn, "MaplyQuadLoaderBase - LoaderReturns not cleaned up"); } } - (bool)isLoading { // Maybe we're still setting up - if (!loader) - return true; - - return loader->getLoadingStatus(); + const auto ldr = loader; + return !ldr || ldr->getLoadingStatus(); } - (MaplyBoundingBox)geoBoundsForTile:(MaplyTileID)tileID @@ -185,10 +191,9 @@ - (MaplyBoundingBoxD)geoBoundsForTileD:(MaplyTileID)tileID - (MaplyBoundingBox)boundsForTile:(MaplyTileID)tileID { + const MaplyBoundingBoxD boundsD = [self boundsForTileD:tileID]; + MaplyBoundingBox bounds; - MaplyBoundingBoxD boundsD; - - boundsD = [self boundsForTileD:tileID]; bounds.ll = MaplyCoordinateMake(boundsD.ll.x, boundsD.ll.y); bounds.ur = MaplyCoordinateMake(boundsD.ur.x, boundsD.ur.y); @@ -200,14 +205,12 @@ - (MaplyBoundingBoxD)boundsForTileD:(MaplyTileID)tileID if (!samplingLayer) return kMaplyNullBoundingBoxD; - MaplyBoundingBoxD bounds; - - QuadDisplayControllerNewRef control = [samplingLayer.quadLayer getController]; if (!control) - return bounds; - - MbrD mbrD = control->getQuadTree()->generateMbrForNode(WhirlyKit::QuadTreeNew::Node(tileID.x,tileID.y,tileID.level)); + return kMaplyNullBoundingBoxD; + + const MbrD mbrD = control->getQuadTree()->generateMbrForNode(WhirlyKit::QuadTreeNew::Node(tileID.x,tileID.y,tileID.level)); + MaplyBoundingBoxD bounds; bounds.ll = MaplyCoordinateDMake(mbrD.ll().x(), mbrD.ll().y()); bounds.ur = MaplyCoordinateDMake(mbrD.ur().x(), mbrD.ur().y()); @@ -220,11 +223,11 @@ - (MaplyCoordinate3d)displayCenterForTile:(MaplyTileID)tileID if (!control) return MaplyCoordinate3dMake(0.0, 0.0, 0.0); - Mbr mbr = control->getQuadTree()->generateMbrForNode(WhirlyKit::QuadTreeNew::Node(tileID.x,tileID.y,tileID.level)); - Point2d pt((mbr.ll().x()+mbr.ur().x())/2.0,(mbr.ll().y()+mbr.ur().y())/2.0); - Scene *scene = control->getScene(); - Point3d locCoord = CoordSystemConvert3d(control->getCoordSys(), scene->getCoordAdapter()->getCoordSystem(), Point3d(pt.x(),pt.y(),0.0)); - Point3d dispCoord = scene->getCoordAdapter()->localToDisplay(locCoord); + const Mbr mbr = control->getQuadTree()->generateMbrForNode(WhirlyKit::QuadTreeNew::Node(tileID.x,tileID.y,tileID.level)); + const Point2d pt((mbr.ll().x()+mbr.ur().x())/2.0,(mbr.ll().y()+mbr.ur().y())/2.0); + const Scene *scene = control->getScene(); + const Point3d locCoord = CoordSystemConvert3d(control->getCoordSys(), scene->getCoordAdapter()->getCoordSystem(), Point3d(pt.x(),pt.y(),0.0)); + const Point3d dispCoord = scene->getCoordAdapter()->localToDisplay(locCoord); return MaplyCoordinate3dMake(dispCoord.x(), dispCoord.y(), dispCoord.z()); } @@ -237,6 +240,10 @@ - (int)getZoomSlot return samplingLayer->sampleControl.getDisplayControl()->getZoomSlot(); } +- (NSObject *)getInterpreter +{ + return loadInterp; +} - (void)setInterpreter:(NSObject *)interp { @@ -260,16 +267,18 @@ - (MaplyLoaderReturn *)makeLoaderReturn - (void)changeTileInfos:(NSArray *> *)tileInfos { - if (!samplingLayer) - return; - const auto __strong thread = samplingLayer.layerThread; - if ([NSThread currentThread] != thread) { + if (!thread) + { + return; + } + + if ([NSThread currentThread] != thread) + { [self performSelector:@selector(changeTileInfos:) onThread:thread withObject:tileInfos waitUntilDone:false]; return; } - ChangeSet changes; loader->setTileInfos(tileInfos); loader->reload(nullptr,-1,changes); @@ -278,11 +287,14 @@ - (void)changeTileInfos:(NSArray *> *)tileInfos - (void)changeInterpreter:(NSObject *)interp { - if (!samplingLayer) - return; - const auto __strong thread = samplingLayer.layerThread; - if ([NSThread currentThread] != thread) { + if (!thread) + { + return; + } + + if ([NSThread currentThread] != thread) + { [self performSelector:@selector(changeInterpreter:) onThread:thread withObject:interp waitUntilDone:false]; return; } @@ -305,20 +317,26 @@ - (void)reloadArea:(MaplyBoundingBox)bounds - (void)reloadAreas:(NSArray*)bounds { - if (!samplingLayer) + const auto __strong thread = samplingLayer.layerThread; + const auto ldr = loader; + if (!thread || !ldr) + { return; + } - const auto __strong thread = samplingLayer.layerThread; - if ([NSThread currentThread] != thread) { + if ([NSThread currentThread] != thread) + { [self performSelector:@selector(reloadAreas:) onThread:thread withObject:bounds waitUntilDone:false]; return; } std::vector boxes; const auto count = bounds ? [bounds count] : 0; - if (count) { + if (count) + { boxes.reserve(count); - for (int i = 0; i < count; ++i) { + for (int i = 0; i < count; ++i) + { const auto v = [bounds[i] maplyBoundingBoxValue]; boxes.emplace_back(Point2f(v.ll.x,v.ll.y), Point2f(v.ur.x,v.ur.y)); } @@ -326,17 +344,21 @@ - (void)reloadAreas:(NSArray*)bounds auto const* boxPtr = boxes.empty() ? nullptr : &boxes[0]; ChangeSet changes; - loader->reload(nullptr,-1,boxPtr,(int)boxes.size(),changes); + ldr->reload(nullptr,-1,boxPtr,(int)boxes.size(),changes); [thread addChangeRequests:changes]; } - (void)updatePriorities { - if (!samplingLayer) - return; - const auto __strong thread = samplingLayer.layerThread; - if ([NSThread currentThread] != thread) { + const auto ldr = loader; + if (!thread || !ldr) + { + return; + } + + if ([NSThread currentThread] != thread) + { [self performSelector:@selector(updatePriorities) onThread:thread withObject:nil waitUntilDone:false]; return; } @@ -347,7 +369,8 @@ - (void)updatePriorities // Called on a random dispatch queue - (void)fetchRequestSuccess:(MaplyTileFetchRequest *)request tileID:(MaplyTileID)tileID frame:(int)frame data:(id)data; { - if (!loader || !valid) + const auto __strong thread = self->samplingLayer.layerThread; + if (!loader || !valid || !thread) return; if (loader->getDebugMode()) @@ -368,8 +391,27 @@ - (void)fetchRequestSuccess:(MaplyTileFetchRequest *)request tileID:(MaplyTileID NSLog(@"MaplyQuadLader:fetchRequestSuccess: client return unknown data type. Dropping."); } } - - [self performSelector:@selector(mergeFetchRequest:) onThread:self->samplingLayer.layerThread withObject:loadData waitUntilDone:NO]; + + { + std::lock_guard lock(self->pendingReturnsLock); + if (valid) + { + [self->pendingReturns addObject:loadData]; + } + else + { + // Shutdown already started, newly added objects may not be cleaned up. + [self cleanupLoadedData:loadData]; + } + } + + if (valid) + { + [self performSelector:@selector(mergeFetchRequest:) + onThread:thread + withObject:loadData + waitUntilDone:NO]; + } } // Called on SamplingLayer.layerThread @@ -395,7 +437,6 @@ - (void)tileUnloaded:(MaplyTileID)tileID { } // If we parsed the data, but need to drop it before it gets merged, we do it here -// TODO: Not doing anything with the change list in loadReturn // And this seems to have an ordering problem - (void)cleanupLoadedData:(MaplyLoaderReturn *)loadReturn { @@ -404,18 +445,38 @@ - (void)cleanupLoadedData:(MaplyLoaderReturn *)loadReturn SimpleIDSet compIDs; for (auto comp: loadReturn->loadReturn->compObjs) + { compIDs.insert(comp->getId()); + } + loadReturn->loadReturn->compObjs.clear(); for (auto comp: loadReturn->loadReturn->ovlCompObjs) + { compIDs.insert(comp->getId()); + } + loadReturn->loadReturn->ovlCompObjs.clear(); [renderC removeObjectsByID:compIDs mode:MaplyThreadCurrent]; + + for (auto change : loadReturn->loadReturn->changes) + { + delete change; + } + loadReturn->loadReturn->changes.clear(); } // Called on the SamplingLayer.LayerThread - (void)mergeFetchRequest:(MaplyLoaderReturn *)loadReturn { if (!loader || !valid) + { + [self cleanupLoadedData:loadReturn]; return; - + } + + { + std::lock_guard lock(self->pendingReturnsLock); + [self->pendingReturns removeObject:loadReturn]; + } + // Could do this at startup too if (_numSimultaneousTiles > 0 && !serialQueue) { serialQueue = dispatch_queue_create("Quad Loader Serial", DISPATCH_QUEUE_SERIAL); @@ -427,6 +488,7 @@ - (void)mergeFetchRequest:(MaplyLoaderReturn *)loadReturn if (!loader->isFrameLoading(tileID,loadReturn->loadReturn->frame)) { if (_debugMode) NSLog(@"MaplyQuadImageLoader: Dropping fetched tile %d: (%d,%d) frame %d",tileID.level,tileID.x,tileID.y,loadReturn->loadReturn->frame->frameIndex); + [self cleanupLoadedData:loadReturn]; return; } @@ -463,7 +525,10 @@ - (void)mergeFetchRequest:(MaplyLoaderReturn *)loadReturn dispatch_async(theQueue, ^{ if (!self->valid || !self->_viewC) + { + [self cleanupLoadedData:loadReturn]; return; + } auto loadAndMerge = ^{ // No load interpreter means the fetcher created the objects. Hopefully. @@ -473,19 +538,33 @@ - (void)mergeFetchRequest:(MaplyLoaderReturn *)loadReturn // Merge in the results on the sampling layer thread. // If the load was canceled, or we're shutting down and the thread no // longer exists, then we need to clean up the results to avoid leaks. - const auto thread = self->samplingLayer.layerThread; - if (!thread || [thread isCancelled]) { + const auto __strong thread = self->samplingLayer.layerThread; + if (!thread || [thread isCancelled]) + { [self cleanupLoadedData:loadReturn]; - } else { + } + else + { // Objects in this LoaderReturn have already been added to the base controller. // If the layer thread is stopped between now and when the perform occurs, those // objects will not be cleaned up by mergeLoadedTile(), and need to be cleaned up // in shutdown() instead. { std::lock_guard lock(self->pendingReturnsLock); - [self->pendingReturns addObject:loadReturn]; + if (self->valid) + { + [self->pendingReturns addObject:loadReturn]; + } + else + { + // Shutdown already started, newly added objects may not be cleaned up. + [self cleanupLoadedData:loadReturn]; + } + } + if (self->valid) + { + [self performSelector:@selector(mergeLoadedTile:) onThread:thread withObject:loadReturn waitUntilDone:NO]; } - [self performSelector:@selector(mergeLoadedTile:) onThread:thread withObject:loadReturn waitUntilDone:NO]; } }; @@ -519,7 +598,8 @@ - (void)mergeLoadedTile:(MaplyLoaderReturn *)loadReturn [self->pendingReturns removeObject:loadReturn]; } - if (!loader || !thread || !valid) { + if (!loader || !thread || !valid) + { [self cleanupLoadedData:loadReturn]; return; } @@ -538,12 +618,13 @@ - (void)mergeLoadedTile:(MaplyLoaderReturn *)loadReturn - (void)cleanup { + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(delayedInit) object:nil]; + { std::lock_guard lock(self->pendingReturnsLock); - if (auto __strong viewC = _viewC) { - for (MaplyLoaderReturn *loadReturn in pendingReturns) { - [self cleanupLoadedData:loadReturn]; - } + for (MaplyLoaderReturn *loadReturn in pendingReturns) + { + [self cleanupLoadedData:loadReturn]; } [pendingReturns removeAllObjects]; } @@ -551,15 +632,21 @@ - (void)cleanup ChangeSet changes; loader->cleanup(nullptr,changes); - if (!changes.empty()) { + if (!changes.empty()) + { const auto __strong thread = samplingLayer.layerThread; - if (thread) { + if (thread) + { [thread addChangeRequests:changes]; [thread flushChangeRequests]; - } else { - for (auto change : changes) { + } + else + { + for (auto change : changes) + { delete change; } + changes.clear(); } } @@ -574,11 +661,23 @@ - (void)cleanup - (void)shutdown { - valid = false; + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(delayedInit) object:nil]; + + { + std::lock_guard lock(self->pendingReturnsLock); + valid = false; + } const auto __strong thread = samplingLayer.layerThread; if (thread) + { [self performSelector:@selector(cleanup) onThread:thread withObject:nil waitUntilDone:NO]; + } + else + { + wkLogLevel(Warn, "MaplyQuadLoader layer thread stopped before shutdown"); + [self cleanup]; + } } @end diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyQuadPagingLoader.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyQuadPagingLoader.mm index edfd98963f..8dabe4600c 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyQuadPagingLoader.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyQuadPagingLoader.mm @@ -1,8 +1,7 @@ -/* - * MaplyQuadPagingLoader.mm +/* MaplyQuadPagingLoader.mm * * Created by Steve Gifford on 2/21/91. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +13,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "loading/MaplyQuadPagingLoader.h" @@ -54,10 +52,13 @@ - (void)addCompObjs:(NSArray *)compObjs - (NSArray *)getCompObjs { NSMutableArray *ret = [[NSMutableArray alloc] init]; - for (auto compObj : loadReturn->compObjs) { - MaplyComponentObject *compObjWrap = [[MaplyComponentObject alloc] init]; - compObjWrap->contents = std::dynamic_pointer_cast(compObj); - [ret addObject:compObjWrap]; + for (auto compObj : loadReturn->compObjs) + { + if (MaplyComponentObject *compObjWrap = [[MaplyComponentObject alloc] init]) + { + compObjWrap->contents = std::dynamic_pointer_cast(compObj); + [ret addObject:compObjWrap]; + } } return ret; @@ -72,24 +73,26 @@ - (instancetype)initWithParams:(MaplySamplingParams *)inParams loadInterp:(NSObject *)inLoadInterp viewC:(MaplyBaseViewController * )inViewC { - self = [super initWithViewC:inViewC]; + if (!(self = [super initWithViewC:inViewC])) + { + return nil; + } params = inParams->params; params.generateGeom = false; loadInterp = inLoadInterp; - + // Loader does all the work. The Obj-C version is just a wrapper - self->loader = QuadImageFrameLoader_iosRef(new QuadImageFrameLoader_ios(params, - tileInfo, - QuadImageFrameLoader::Object)); + const auto mode = QuadImageFrameLoader::Object; + self->loader = std::make_shared(params, tileInfo, mode); self.flipY = true; self.debugMode = false; self->minLevel = tileInfo.minZoom; self->maxLevel = tileInfo.maxZoom; self->valid = true; - + // Start things out after a delay // This lets the caller mess with settings [self performSelector:@selector(delayedInit) withObject:nil afterDelay:0.0]; @@ -99,19 +102,33 @@ - (instancetype)initWithParams:(MaplySamplingParams *)inParams - (bool)delayedInit { - loader->layer = self; - + if (![super delayedInit]) + { + return false; + } + const auto __strong vc = self.viewC; - if (!tileFetcher) { + const auto ldr = loader; + + if (vc && !tileFetcher) + { tileFetcher = [vc addTileFetcher:MaplyQuadImageLoaderFetcherName]; } - loader->tileFetcher = tileFetcher; - loader->layer = self; - samplingLayer = [[vc getRenderControl] findSamplingLayer:params forUser:self->loader]; + if (ldr) + { + ldr->tileFetcher = tileFetcher; + ldr->layer = self; + } + + samplingLayer = [[vc getRenderControl] findSamplingLayer:params forUser:ldr]; + // Do this again in case they changed them - loader->setSamplingParams(params); - loader->setFlipY(self.flipY); + if (ldr) + { + ldr->setSamplingParams(params); + ldr->setFlipY(self.flipY); + } [loadInterp setLoader:self]; @@ -125,6 +142,10 @@ - (MaplyLoaderReturn *)makeLoaderReturn - (void)reload { + // Called before it's set up. Dude. Calm down. + if (!samplingLayer) + return; + [super reload]; } diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyRemoteTileFetcher.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyRemoteTileFetcher.mm index 58a397b8a2..b20329a6f7 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyRemoteTileFetcher.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyRemoteTileFetcher.mm @@ -426,12 +426,12 @@ - (instancetype)initWithName:(NSString *)inName connections:(int)numConnections return self; } -- (void)setLocalStorage:(NSObject * __nonnull)inLocalStorage +- (void)setLocalStorage:(NSObject *)inLocalStorage { localStorage = inLocalStorage; } -- (void)setSecondChance:(NSObject * __nonnull)inSecondChance +- (void)setSecondChance:(NSObject *)inSecondChance { secondChance = inSecondChance; } diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplySimpleTileFetcher.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplySimpleTileFetcher.mm index fed6dac99e..2fc20bcb41 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplySimpleTileFetcher.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplySimpleTileFetcher.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/31/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyTileSourceNew.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyTileSourceNew.mm index 56e593db84..14fe8e99c4 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyTileSourceNew.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/loading/MaplyTileSourceNew.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/13/18. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/math/MaplyCoordinate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/math/MaplyCoordinate.mm index 672bb10f8a..2683bc9519 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/math/MaplyCoordinate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/math/MaplyCoordinate.mm @@ -2,7 +2,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/math/MaplyCoordinateSystem.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/math/MaplyCoordinateSystem.mm index e39eac87e0..7004b7b378 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/math/MaplyCoordinateSystem.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/math/MaplyCoordinateSystem.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 5/13/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/math/MaplyMatrix.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/math/MaplyMatrix.mm index a68050db44..dde59a678a 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/math/MaplyMatrix.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/math/MaplyMatrix.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 10/16/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/math/WGCoordinate.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/math/WGCoordinate.mm index 2202399b38..bfe632ed66 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/math/WGCoordinate.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/math/WGCoordinate.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/17/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyAtmosphere.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyAtmosphere.mm index 844c98a7a9..89e2a7b995 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyAtmosphere.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyAtmosphere.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/30/15. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyRenderTarget.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyRenderTarget.mm index 7e11b0d6a2..49c924e33e 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyRenderTarget.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyRenderTarget.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/13/17. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyShader.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyShader.mm index ebcf2e4ea4..3e52de4e5d 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyShader.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyShader.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 2/7/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyTextureAtlas.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyTextureAtlas.mm index 303ae0af23..cf35395001 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyTextureAtlas.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyTextureAtlas.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/11/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyVariableTarget.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyVariableTarget.mm index 72439a524e..612895dfb3 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyVariableTarget.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/MaplyVariableTarget.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/18/18. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/ViewPlacementActiveModel.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/ViewPlacementActiveModel.mm index 958e0a5a54..8a807f6ac2 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/ViewPlacementActiveModel.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/rendering/ViewPlacementActiveModel.mm @@ -1,9 +1,8 @@ -/* - * ViewPlacementGenerator.mm +/* ViewPlacementActiveModel.mm * WhirlyGlobeLib * * Created by Steve Gifford on 7/25/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "ViewPlacementActiveModel.h" @@ -134,20 +132,20 @@ // Overall extents we'll look at. Everything else is tossed. // Note: This is too simple - Mbr frameMbr; - float marginX = frameInfo->sceneRenderer->framebufferWidth * 1.1; - float marginY = frameInfo->sceneRenderer->framebufferHeight * 1.1; - frameMbr.ll() = Point2f(0 - marginX,0 - marginY); - frameMbr.ur() = Point2f(frameInfo->sceneRenderer->framebufferWidth + marginX,frameInfo->sceneRenderer->framebufferHeight + marginY); - + const float margin = 0.1f; + const Mbr frameMbr = frameInfo->sceneRenderer->getFramebufferBound(margin); + std::vector modelAndViewMats; // modelAndViewNormalMats; - for (unsigned int offi=0;offioffsetMatrices.size();offi++) + modelAndViewMats.reserve(frameInfo->offsetMatrices.size()); + for (const auto &mat : frameInfo->offsetMatrices) + { + // Project the world location to the screen + modelAndViewMats.push_back(frameInfo->viewTrans4d * mat * frameInfo->modelTrans4d); + } + for (const auto &mat : frameInfo->offsetMatrices) { // Project the world location to the screen - Eigen::Matrix4d modelAndViewMat = frameInfo->viewTrans4d * frameInfo->offsetMatrices[offi] * frameInfo->modelTrans4d; -// Eigen::Matrix4d modelAndViewNormalMat = modelAndViewMat.inverse().transpose(); - modelAndViewMats.push_back(modelAndViewMat); -// modelAndViewNormalMats.push_back(modelAndViewNormalMat); + modelAndViewMats.push_back(frameInfo->viewTrans4d * mat * frameInfo->modelTrans4d); } std::set localViewSet; @@ -157,16 +155,14 @@ changedSinceUpdate = false; } - auto frameSizeScaled = frameInfo->sceneRenderer->getFramebufferSize(); + const auto frameSizeScaled = frameInfo->sceneRenderer->getFramebufferSize(); - for (std::set::iterator it = localViewSet.begin(); - it != localViewSet.end(); ++it) + for (const auto &viewInst : localViewSet) { - const ViewInstance &viewInst = *it; bool hidden = NO; Point2f screenPt; - if (!it->active) + if (!viewInst.active) continue; // Height above globe test diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/GeoJSONSource.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/GeoJSONSource.mm index 1fff2285d7..56fedb76fa 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/GeoJSONSource.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/GeoJSONSource.mm @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Ranen Ghosh on 2016-11-18. - * Copyright 2016-2021 mousebird consulting + * Copyright 2016-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapboxVectorInterpreter.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapboxVectorInterpreter.mm index fd8fc0112a..3618ee2ba0 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapboxVectorInterpreter.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapboxVectorInterpreter.mm @@ -283,24 +283,29 @@ - (void)dataForTile:(MaplyImageLoaderReturn *)loadReturn loader:(MaplyQuadLoader std::vector compObjs,ovlCompObjs; for (NSData *thisTileData : pbfDatas) { if (loadReturn.isCancelled) { - return; + break; } // Use a separate work item for each tile, so that we react quickly if told to shut down WorkRegion wr(vc); if (!wr) { - return; + break; } RawNSDataReader thisTileDataWrap(thisTileData); MaplyVectorTileData *vecTileReturn = [[MaplyVectorTileData alloc] initWithID:tileID bbox:spherMercBBox geoBBox:geoBBox]; // Parse the vector features and then merge them into the change set in the load return vecTileParser->parse(NULL, &thisTileDataWrap, vecTileReturn->data.get(), &loadReturn->loadReturn->cancel); - loadReturn->loadReturn->changes.insert(loadReturn->loadReturn->changes.end(),vecTileReturn->data->changes.begin(),vecTileReturn->data->changes.end()); - - if (!vecTileReturn->data->compObjs.empty()) - compObjs.insert(compObjs.end(),vecTileReturn->data->compObjs.begin(),vecTileReturn->data->compObjs.end()); + loadReturn->loadReturn->changes.insert(loadReturn->loadReturn->changes.end(), + vecTileReturn->data->changes.begin(), + vecTileReturn->data->changes.end()); + vecTileReturn->data->changes.clear(); + compObjs.insert(compObjs.end(), + std::make_move_iterator(vecTileReturn->data->compObjs.begin()), + std::make_move_iterator(vecTileReturn->data->compObjs.end())); + vecTileReturn->data->compObjs.clear(); + const auto it = vecTileReturn->data->categories.find("overlay"); if (it != vecTileReturn->data->categories.end()) { auto const &ids = it->second; @@ -308,11 +313,14 @@ - (void)dataForTile:(MaplyImageLoaderReturn *)loadReturn loader:(MaplyQuadLoader } } - if ([loadReturn isKindOfClass:[MaplyImageLoaderReturn class]]) { + if ([loadReturn isKindOfClass:[MaplyImageLoaderReturn class]] && !loadReturn.isCancelled) { if (auto wr = WorkRegion(vc)) { if (offlineRender) { // Rendered image goes in first - auto tileImage = [[MaplyImageTile alloc] initWithRawImage:imageData width:offlineRender.getFramebufferSize.width height:offlineRender.getFramebufferSize.height viewC:vc]; + auto tileImage = [[MaplyImageTile alloc] initWithRawImage:imageData + width:offlineRender.getFramebufferSize.width + height:offlineRender.getFramebufferSize.height + viewC:vc]; [loadReturn addImageTile:tileImage]; } else if (images.empty()) { // Make a single color background image @@ -325,10 +333,7 @@ - (void)dataForTile:(MaplyImageLoaderReturn *)loadReturn loader:(MaplyQuadLoader UIColor *thisBackColor = backColor ? [UIColor colorFromRGBA:*backColor] : [UIColor blackColor]; [thisBackColor getRed:&red green:&green blue:&blue alpha:&alpha]; unsigned int pixel = 0xff << 24 | (int)(blue * 255) << 16 | (int)(green * 255) << 8 | (int)(red * 255); - for (unsigned int pix=0;pix &fontNames,float fontSize) +static UIFont *findFont(const std::string &fontName, float fontSize) { - UIFont *font = nil; - - // Work through the font names until we find one - for (auto fontName: fontNames) { - // Let's try just the name - NSString *fontNameStr = [NSString stringWithFormat:@"%s",fontName.c_str()]; - font = [UIFont fontWithName:fontNameStr size:fontSize]; - if (!font) { - // The font names vary a bit on iOS so we'll try reformatting the name - NSArray *components = [fontNameStr componentsSeparatedByString:@" "]; - NSString *fontNameStr2 = nil; - switch ([components count]) + // Let's try just the name + NSString *fontNameStr = [NSString stringWithUTF8String:fontName.c_str()]; + if (UIFont* font = [UIFont fontWithName:fontNameStr size:fontSize]) + { + return font; + } + + // The font names vary a bit on iOS so we'll try reformatting the name + NSArray *components = [fontNameStr componentsSeparatedByString:@" "]; + NSString *fontNameStr2 = nil; + switch (components.count) + { + // One component should already have worked + case 1: + return nil; + // For two, try switching the separator + case 2: + fontNameStr2 = [fontNameStr stringByReplacingOccurrencesOfString:@" " withString:@"-"]; + return [UIFont fontWithName:fontNameStr2 size:fontSize]; + case 3: + // Try - + fontNameStr2 = [NSString stringWithFormat:@"%@%@-%@",[components objectAtIndex:0],[components objectAtIndex:1],[components lastObject]]; + if (UIFont* font = [UIFont fontWithName:fontNameStr2 size:fontSize]) { - // One component should already have worked - case 1: - break; - // For two, we - case 2: - if ([components count] == 2) { - fontNameStr2 = [fontNameStr stringByReplacingOccurrencesOfString:@" " withString:@"-"]; - font = [UIFont fontWithName:fontNameStr2 size:fontSize]; - } - break; - case 3: - { - // Try - - fontNameStr2 = [NSString stringWithFormat:@"%@%@-%@",[components objectAtIndex:0],[components objectAtIndex:1],[components lastObject]]; - font = [UIFont fontWithName:fontNameStr2 size:fontSize]; - - // Sometimes a font like "Noto Sans Regular" is just "NotoSans" because I hate everyone involved with fonts - if (!font && [[components lastObject] isEqualToString:@"Regular"]) { - font = [UIFont fontWithName:[NSString stringWithFormat:@"%@%@",[components objectAtIndex:0],[components objectAtIndex:1]] size:fontSize]; - } - - // Okay, let's try a slightly different construction - if (!font) { - font = [UIFont fontWithName:[NSString stringWithFormat:@"%@-%@%@",[components objectAtIndex:0],[components objectAtIndex:1],[components objectAtIndex:2]] size:fontSize]; - } - - // And try an even stupider construction - if (!font) { - font = [UIFont fontWithName:[NSString stringWithFormat:@"%@-%@_%@-%@",[components objectAtIndex:0],[components objectAtIndex:2],[components objectAtIndex:1],[components objectAtIndex:2]] size:fontSize]; - } - } - break; - default: + return font; + } + + // Sometimes a font like "Noto Sans Regular" is just "NotoSans" because I hate everyone involved with fonts + if ([[components lastObject] isEqualToString:@"Regular"]) + { + fontNameStr2 = [NSString stringWithFormat:@"%@%@", + [components objectAtIndex:0], + [components objectAtIndex:1]]; + if (UIFont* font = [UIFont fontWithName:fontNameStr2 size:fontSize]) { - // Try - - NSMutableString *str = [[NSMutableString alloc] init]; - for (unsigned int ii=0;ii<[components count]-1;ii++) - [str appendString:[components objectAtIndex:ii]]; - [str appendFormat:@"-%@",[components lastObject]]; - fontNameStr2 = str; - font = [UIFont fontWithName:fontNameStr2 size:fontSize]; + return font; } - break; } + // Okay, let's try a slightly different construction + fontNameStr2 = [NSString stringWithFormat:@"%@-%@%@", + [components objectAtIndex:0], + [components objectAtIndex:1], + [components objectAtIndex:2]]; + if (UIFont* font = [UIFont fontWithName:fontNameStr2 size:fontSize]) + { + return font; + } + + // And try an even stupider construction + fontNameStr2 = [NSString stringWithFormat:@"%@-%@_%@-%@", + [components objectAtIndex:0], + [components objectAtIndex:2], + [components objectAtIndex:1], + [components objectAtIndex:2]]; + if (UIFont* font = [UIFont fontWithName:fontNameStr2 size:fontSize]) + { + return font; + } + break; + default: + { + // Try - + NSMutableString *str = [[NSMutableString alloc] init]; + for (unsigned int ii=0;ii<[components count]-1;ii++) + { + [str appendString:[components objectAtIndex:ii]]; + } + [str appendFormat:@"-%@",[components lastObject]]; + if (UIFont* font = [UIFont fontWithName:str size:fontSize]) + { + return font; + } } - + } + return nil; +} + +LabelInfoRef MapboxVectorStyleSetImpl_iOS::makeLabelInfo(PlatformThreadInfo *, + const std::vector &fontNames, + float fontSize, bool mergedSymbol) +{ + // Work through the font names until we find one + UIFont *font = nil; + for (const auto &fontName: fontNames) + { + font = findFont(fontName, fontSize); if (font) + { break; + } } - if (!font) { + + if (!font) + { font = [UIFont systemFontOfSize:fontSize]; - NSLog(@"Failed to find font %s",fontNames[0].c_str()); + wkLogLevel(Warn, "Failed to find font '%s' ..., using system font '%s'", + fontNames[0].c_str(), font ? font.fontName.UTF8String : ""); } + // If we want the reqested size to be the cap-height, line-height, ascent+descent, etc., this is how we can adjust it. + //if (mergedSymbol) + //{ + // CGSize withinSize = CGSizeMake(FLT_MAX, FLT_MAX); + // const auto opts = NSStringDrawingUsesDeviceMetrics; + // NSDictionary* attrs = @{NSFontAttributeName: font}; + // const CGRect bound = [@"M" boundingRectWithSize:withinSize options:opts attributes:attrs context:nil]; + // const auto newSize = fontSize * fontSize / bound.size.height; + // font = [font fontWithSize:newSize]; + //} + auto labelInfo = std::make_shared(font,/*screenObject=*/true); + labelInfo->fontPointSize = fontSize; + labelInfo->mergedSymbol = mergedSymbol; + labelInfo->labelVAlign = WhirlyKitLabelVCenter; labelInfo->programID = screenMarkerProgramID; return labelInfo; diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorStyleSimple.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorStyleSimple.mm index 5b891b9290..4864005bf6 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorStyleSimple.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorStyleSimple.mm @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 3/15/16. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileLineStyle.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileLineStyle.mm index 73dfddb49e..fa5b3a609d 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileLineStyle.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileLineStyle.mm @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileMarkerStyle.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileMarkerStyle.mm index fd68f82e0d..b7c0225229 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileMarkerStyle.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileMarkerStyle.mm @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTilePolygonStyle.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTilePolygonStyle.mm index 2e2fbd4954..91e5e70908 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTilePolygonStyle.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTilePolygonStyle.mm @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileStyle.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileStyle.mm index a2cdfff472..885d434a3b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileStyle.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileStyle.mm @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileTextStyle.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileTextStyle.mm index 12e748cfcc..428b5c6e57 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileTextStyle.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MaplyVectorTileTextStyle.mm @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/3/14. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapnikStyle.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapnikStyle.mm index a8df596d5d..f1ed1182a9 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapnikStyle.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapnikStyle.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Jesse Crocker, Trailbehind inc. on 3/31/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapnikStyleRule.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapnikStyleRule.mm index e7bb9526d1..ed5f0cd338 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapnikStyleRule.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapnikStyleRule.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Jesse Crocker, Trailbehind inc. on 3/31/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapnikStyleSet.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapnikStyleSet.mm index e9e608901b..a8110d7fb3 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapnikStyleSet.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/vector_tiles/MapnikStyleSet.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Jesse Crocker, Trailbehind inc. on 3/31/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyBillboard.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyBillboard.mm index 29a332437d..af86fcca29 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyBillboard.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyBillboard.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 10/28/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyComponentObject.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyComponentObject.mm index c01f71381d..2cf836fc41 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyComponentObject.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyComponentObject.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyGeomModel.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyGeomModel.mm index 01cad31372..95f6d19f75 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyGeomModel.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyGeomModel.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 11/26/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,14 +90,20 @@ - (void)asRawGeometry:(std::vector &)outRawGeom withTexM } } +static const GeometryRaw emptyGeom; + +static const int corners[4][2] = {{0,0},{1,0},{1,1},{0,1}}; + // Return the ID for or generate a base model in the Geometry Manager -- (WhirlyKit::SimpleIdentity)getBaseModel:(MaplyBaseInteractionLayer *)inLayer fontTexManager:(const WhirlyKit::FontTextureManager_iOSRef &)fontTexManager compObj:(MaplyComponentObject *)compObj mode:(MaplyThreadMode)threadMode +- (WhirlyKit::SimpleIdentity)getBaseModel:(MaplyBaseInteractionLayer *)inLayer + fontTexManager:(const WhirlyKit::FontTextureManager_iOSRef &)fontTexManager + compObj:(MaplyComponentObject *)compObj + mode:(MaplyThreadMode)threadMode { @synchronized(self) { if (layer) return baseModelID; - if (!inLayer) return EmptyIdentity; @@ -108,35 +114,40 @@ - (void)asRawGeometry:(std::vector &)outRawGeom withTexM if (shape) { - ShapeManagerRef shapeManager = std::dynamic_pointer_cast(inLayer->scene->getManager(kWKShapeManager)); - - WhirlyKit::Shape *wkShape = nil; - if ([shape isKindOfClass:[MaplyShapeCircle class]]) - wkShape = [(MaplyShapeCircle *)shape asWKShape:nil]; - else if ([shape isKindOfClass:[MaplyShapeSphere class]]) - wkShape = [(MaplyShapeSphere *)shape asWKShape:nil]; - else if ([shape isKindOfClass:[MaplyShapeCylinder class]]) - wkShape = [(MaplyShapeCylinder *)shape asWKShape:nil]; - else if ([shape isKindOfClass:[MaplyShapeExtruded class]]) - wkShape = [(MaplyShapeExtruded *)shape asWKShape:nil]; - - if (wkShape) - shapeManager->convertShape(*wkShape,procGeom); - } else { + if (auto shapeManager = inLayer->scene->getManager(kWKShapeManager)) + { + WhirlyKit::Shape *wkShape = nil; + if ([shape isKindOfClass:[MaplyShapeCircle class]]) + wkShape = [(MaplyShapeCircle *)shape asWKShape:nil]; + else if ([shape isKindOfClass:[MaplyShapeSphere class]]) + wkShape = [(MaplyShapeSphere *)shape asWKShape:nil]; + else if ([shape isKindOfClass:[MaplyShapeCylinder class]]) + wkShape = [(MaplyShapeCylinder *)shape asWKShape:nil]; + else if ([shape isKindOfClass:[MaplyShapeExtruded class]]) + wkShape = [(MaplyShapeExtruded *)shape asWKShape:nil]; + + if (wkShape) + { + shapeManager->convertShape(*wkShape,procGeom); + } + } + } + else + { // Add the textures std::vector texFileNames; [self getTextureFileNames:texFileNames]; std::vector texIDMap(texFileNames.size()); + const MaplyQuadImageFormat format = MaplyImage4Layer8Bit; int whichTex = 0; for (const std::string &texFileName : texFileNames) { - MaplyTexture *tex = [inLayer addImage:[UIImage imageNamed:[NSString stringWithFormat:@"%s",texFileName.c_str()]] imageFormat:MaplyImage4Layer8Bit mode:threadMode]; - if (tex) + if (NSString* name = [NSString stringWithFormat:@"%s", texFileName.c_str()]) + if (UIImage* img = [UIImage imageNamed:name]) + if (MaplyTexture *tex = [inLayer addImage:img imageFormat:format mode:threadMode]) { maplyTextures.insert(tex); texIDMap[whichTex] = tex.texID; - } else { - texIDMap[whichTex] = EmptyIdentity; } whichTex++; } @@ -151,66 +162,68 @@ - (void)asRawGeometry:(std::vector &)outRawGeom withTexM for (const GeomStringWrapper &strWrap : strings) { // Convert the string to polygons - DrawableString *drawStr = fontTexManager->addString(NULL,strWrap.str,changes); + auto drawStr = fontTexManager->addString(nullptr,strWrap.str,changes); + if (!drawStr) + { + continue; + } + for (const DrawableString::Rect &rect : drawStr->glyphPolys) { - // Find the appropriate geometry bucket - auto it = stringGeom.find(rect.subTex.texId); - GeometryRaw *geom = NULL; - if (it == stringGeom.end()) + // Find or insert the appropriate geometry bucket + const auto result = stringGeom.insert(std::make_pair(rect.subTex.texId, emptyGeom)); + auto &geom = result.first->second; + if (result.second) { - stringGeom[rect.subTex.texId] = GeometryRaw(); - geom = &stringGeom[rect.subTex.texId]; - geom->texIDs.push_back((int)rect.subTex.texId); - } else - geom = &stringGeom[rect.subTex.texId]; - - // Convert and transform the points - int basePt = (int)geom->pts.size(); - geom->pts.reserve(geom->pts.size()+4); - Point2d pts[4]; - pts[0] = Point2d(rect.pts[0].x(),rect.pts[0].y()); - pts[1] = Point2d(rect.pts[1].x(),rect.pts[0].y()); - pts[2] = Point2d(rect.pts[1].x(),rect.pts[1].y()); - pts[3] = Point2d(rect.pts[0].x(),rect.pts[1].y()); + // A new item was inserted + geom.texIDs.push_back((int)rect.subTex.texId); + const int count = 3; + geom.pts.reserve(4*count); + geom.norms.reserve(4*count); + geom.texCoords.reserve(4*count); + geom.triangles.reserve(2*count); + } + + const int basePt = (int)geom.pts.size(); + const Vector4d norm = strWrap.mat * Vector4d(0,0,1,0); + for (unsigned int ip=0;ip<4;ip++) { - auto &pt = pts[ip]; - Vector4d outPt = strWrap.mat * Vector4d(pt.x(),pt.y(),0.0,1.0); - geom->pts.push_back(Point3d(outPt.x(),outPt.y(),outPt.z())); + // Convert and transform the points + const auto x = rect.pts[corners[ip][0]].x(); + const auto y = rect.pts[corners[ip][1]].y(); + const Vector4d outPt = strWrap.mat * Vector4d(x,y,0.0,1.0); + geom.pts.emplace_back(outPt.x(),outPt.y(),outPt.z()); + + // The normal is the same for everything + geom.norms.emplace_back(norm.x(),norm.y(),norm.z()); + + // And the texture coordinates + geom.texCoords.push_back(rect.subTex.processTexCoord(TexCoord(corners[ip][0],corners[ip][1]))); } - // The normal is the same for everything - Vector4d norm = strWrap.mat * Vector4d(0,0,1,0); - geom->norms.reserve(geom->norms.size()+4); - for (unsigned int ip=0;ip<4;ip++) - geom->norms.push_back(Point3d(norm.x(),norm.y(),norm.z())); - - // And the texture coordinates - geom->texCoords.reserve(geom->texCoords.size()+4); - geom->texCoords.push_back(rect.subTex.processTexCoord(TexCoord(0,0))); - geom->texCoords.push_back(rect.subTex.processTexCoord(TexCoord(1,0))); - geom->texCoords.push_back(rect.subTex.processTexCoord(TexCoord(1,1))); - geom->texCoords.push_back(rect.subTex.processTexCoord(TexCoord(0,1))); - // Wire up the two triangles - geom->triangles.reserve(geom->triangles.size()+2); - geom->triangles.push_back(GeometryRaw::RawTriangle(basePt+0,basePt+1,basePt+2)); - geom->triangles.push_back(GeometryRaw::RawTriangle(basePt+0,basePt+2,basePt+3)); + geom.triangles.emplace_back(basePt+0,basePt+1,basePt+2); + geom.triangles.emplace_back(basePt+0,basePt+2,basePt+3); } - + compObj->contents->drawStringIDs.insert(drawStr->getId()); - delete drawStr; } // Convert the string geometry - procGeom.reserve(procGeom.size()+stringGeom.size()); + if (procGeom.empty()) + { + procGeom.reserve(stringGeom.size()); + } for (auto &it : stringGeom) + { procGeom.push_back(it.second); - - GeometryManagerRef geomManager = std::dynamic_pointer_cast(inLayer->scene->getManager(kWKGeometryManager)); - GeometryInfo geomInfo; - baseModelID = geomManager->addBaseGeometry(procGeom, geomInfo, changes); + } + + if (auto geomManager = inLayer->scene->getManager(kWKGeometryManager)) + { + baseModelID = geomManager->addBaseGeometry(procGeom, GeometryInfo(), changes); + } // Need to flush these changes immediately inLayer->scene->addChangeRequests(changes); diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyLabel.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyLabel.mm index 03f0af9ce7..d8d1a092c3 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyLabel.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyLabel.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/24/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyLight.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyLight.mm index 62bcd9e84a..f5922a05b5 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyLight.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyLight.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 1/30/13. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyMarker.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyMarker.mm index 4b204d1a5a..89ddcedbbc 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyMarker.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyMarker.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/24/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyMoon.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyMoon.mm index cdbe1393aa..0870164c43 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyMoon.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyMoon.mm @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 7/2/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyParticleSystem.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyParticleSystem.mm index bd41845612..49101d4dde 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyParticleSystem.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyParticleSystem.mm @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 4/26/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyPoints.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyPoints.mm index 501aabd6ab..9fe113791f 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyPoints.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyPoints.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 10/21/15 - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyScreenLabel.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyScreenLabel.mm index d1e557daf2..1e0cb15e10 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyScreenLabel.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyScreenLabel.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/24/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyScreenMarker.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyScreenMarker.mm index 392b810e4d..a317bde1d6 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyScreenMarker.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyScreenMarker.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 7/21/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyScreenObject.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyScreenObject.mm index f4429df4b4..ce65747b6f 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyScreenObject.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyScreenObject.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 3/2/15 - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyShape.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyShape.mm index 9d789a262a..f7b6021ba5 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyShape.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyShape.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 9/28/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyStarsModel.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyStarsModel.mm index efb120532c..387f7d1d6b 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyStarsModel.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyStarsModel.mm @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/4/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplySticker.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplySticker.mm index 271fdb1f65..1c9b6f1a4c 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplySticker.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplySticker.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 11/27/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplySun.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplySun.mm index 19ca3b622b..bd0cc050b7 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplySun.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplySun.mm @@ -2,7 +2,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 6/24/15. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyTexture.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyTexture.mm index cf87f2df12..0c9abf1576 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyTexture.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyTexture.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 10/25/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyVectorObject.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyVectorObject.mm index 538f36bb37..8a42b9c432 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyVectorObject.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyVectorObject.mm @@ -3,7 +3,7 @@ * WhirlyGlobeComponent * * Created by Steve Gifford on 8/2/12. - * Copyright 2012-2019 mousebird consulting + * Copyright 2012-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -104,11 +104,13 @@ - (instancetype)init return self; } -- (id)initWithRef:(const WhirlyKit::VectorObjectRef&)vecObj +- (id)initWithRef:(WhirlyKit::VectorObjectRef)vecObj { self = [super init]; - - vObj = vecObj; + if (!self) + return nil; + + vObj = std::move(vecObj); return self; } @@ -122,31 +124,43 @@ - (instancetype)initWithPoint:(MaplyCoordinate)coord attributes:(NSDictionary *) /// Construct with a single point ref - (instancetype)initWithPointRef:(const MaplyCoordinate *)coord attributes:(NSDictionary *)attr { - self = [super init]; - - if (self) + if ((self = [super init])) { VectorPointsRef pts = VectorPoints::createPoints(); - pts->pts.push_back(GeoCoord(coord->x,coord->y)); + pts->pts.emplace_back(coord->x,coord->y); + pts->initGeoMbr(); auto dict = std::make_shared([NSMutableDictionary dictionaryWithDictionary:attr]); + pts->setAttrDict(std::move(dict)); vObj = std::make_shared(); - pts->setAttrDict(dict); - pts->initGeoMbr(); - vObj->shapes.insert(pts); + vObj->shapes.insert(std::move(pts)); } return self; } -- (instancetype)initWithLineString:(const NSArray *__nonnull)inCoords attributes:(NSDictionary *)attr +- (instancetype)initWithLineString:(const NSArray *__nonnull)inCoords + attributes:(NSDictionary *)attr +{ + return [self initWithLineString:inCoords attributes:attr inDegrees:true]; +} + +- (instancetype)initWithLineString:(const NSArray *__nonnull)inCoords + attributes:(NSDictionary *)attr + inDegrees:(bool)inDegrees { + if ((inCoords.count % 2) != 0) + { + NSLog(@"Expecting an even number of coordinates in initWithArealArray:"); + return nil; + } + const int numCoords = [inCoords count]/2; std::vector coords(numCoords); for (int i = 0; i < numCoords; i++) { const float x = [inCoords[2*i] floatValue]; const float y = [inCoords[2*i+1] floatValue]; - coords[i] = MaplyCoordinateMakeWithDegrees(x, y); + coords[i] = inDegrees ? MaplyCoordinateMakeWithDegrees(x, y) : MaplyCoordinateMake(x, y); } self = [self initWithLineString:&coords[0] numCoords:numCoords attributes:attr]; @@ -157,75 +171,73 @@ - (instancetype)initWithLineString:(const NSArray *__nonnull)inCoords /// Construct with a linear feature (e.g. line string) - (instancetype)initWithLineString:(const MaplyCoordinate *)coords numCoords:(int)numCoords attributes:(NSDictionary *)attr { - self = [super init]; - - if (self) + if ((self = [super init])) { vObj = std::make_shared(); VectorLinearRef lin = VectorLinear::createLinear(); lin->pts.reserve(numCoords); for (unsigned int ii=0;iipts.emplace_back(coords[ii].x,coords[ii].y); + } auto dict = std::make_shared([NSMutableDictionary dictionaryWithDictionary:attr]); - lin->setAttrDict(dict); + lin->setAttrDict(std::move(dict)); lin->initGeoMbr(); - vObj->shapes.insert(lin); + vObj->shapes.insert(std::move(lin)); } - return self; } /// Construct as an areal with an exterior - (instancetype)initWithAreal:(const MaplyCoordinate *)coords numCoords:(int)numCoords attributes:(NSDictionary *)attr { - self = [super init]; - - if (self) + if ((self = [super init])) { - vObj = std::make_shared(); - VectorArealRef areal = VectorAreal::createAreal(); VectorRing pts; pts.reserve(numCoords); for (unsigned int ii=0;iiloops.push_back(pts); + } + areal->loops.push_back(std::move(pts)); auto dict = std::make_shared([NSMutableDictionary dictionaryWithDictionary:attr]); - areal->setAttrDict(dict); + areal->setAttrDict(std::move(dict)); areal->initGeoMbr(); - vObj->shapes.insert(areal); + vObj = std::make_shared(); + vObj->shapes.insert(std::move(areal)); } - return self; } -- (nonnull instancetype)initWithArealArray:(const NSArray *__nonnull)coords attributes:(NSDictionary *__nullable)attr +- (nullable instancetype)initWithArealArray:(const NSArray *__nonnull)coords + attributes:(NSDictionary *__nullable)attr { - self = [super init]; - if ([coords count] % 1 != 0) { + return [self initWithArealArray:coords attributes:attr inDegrees:false]; +} + +- (nullable instancetype)initWithArealArray:(const NSArray *__nonnull)inCoords + attributes:(NSDictionary *__nullable)attr + inDegrees:(bool)inDegrees +{ + if ((inCoords.count % 2) != 0) + { NSLog(@"Expecting an even number of coordinates in initWithArealArray:"); return nil; } - - if (self) - { - vObj = std::make_shared(); - VectorArealRef areal = VectorAreal::createAreal(); - VectorRing pts; - pts.reserve([coords count]); - for (unsigned int ii=0;ii<[coords count];ii+=2) - pts.emplace_back([[coords objectAtIndex:ii] doubleValue],[[coords objectAtIndex:ii+1] doubleValue]); - areal->loops.push_back(pts); - auto dict = std::make_shared([NSMutableDictionary dictionaryWithDictionary:attr]); - areal->setAttrDict(dict); - areal->initGeoMbr(); - vObj->shapes.insert(areal); + const int numCoords = inCoords.count/2; + std::vector coords(numCoords); + + for (int i = 0; i < numCoords; i++) { + const float x = [inCoords[2*i] floatValue]; + const float y = [inCoords[2*i+1] floatValue]; + coords[i] = inDegrees ? MaplyCoordinateMakeWithDegrees(x, y) : MaplyCoordinateMake(x, y); } - - return self; + self = [self initWithAreal:&coords[0] numCoords:numCoords attributes:attr]; + return self; } /// Construct from GeoJSON @@ -763,6 +775,16 @@ - (MaplyVectorObject *)arealsToLinears return newVec; } +- (void)reverseAreals +{ + vObj->reverseAreals(); +} + +- (MaplyVectorObject * __nonnull)reversedAreals +{ + return [[MaplyVectorObject alloc] initWithRef:vObj->reversedAreals()]; +} + - (MaplyVectorObject *__nonnull)filterClippedEdges { MaplyVectorObject *newVec = [[MaplyVectorObject alloc] init]; @@ -799,8 +821,9 @@ - (MaplyVectorObject *) clipToMbr:(MaplyCoordinate)ll upperRight:(MaplyCoordinat return newVec; } -- (void)addShape:(const WhirlyKit::VectorShapeRef&)shape { - vObj->shapes.insert(shape); +- (void)addShape:(WhirlyKit::VectorShapeRef)shape +{ + vObj->shapes.insert(std::move(shape)); } diff --git a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyVertexAttribute.mm b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyVertexAttribute.mm index bf00e669ca..5b81ac7a73 100644 --- a/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyVertexAttribute.mm +++ b/ios/library/WhirlyGlobe-MaplyComponent/src/visual_objects/MaplyVertexAttribute.mm @@ -3,7 +3,7 @@ * WhirlyGlobe-MaplyComponent * * Created by Steve Gifford on 11/29/13. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/BasicDrawableBuilderMTL.h b/ios/library/WhirlyGlobeLib/include/BasicDrawableBuilderMTL.h index 48dd2d4dfb..cf187d1396 100644 --- a/ios/library/WhirlyGlobeLib/include/BasicDrawableBuilderMTL.h +++ b/ios/library/WhirlyGlobeLib/include/BasicDrawableBuilderMTL.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/BasicDrawableInstanceBuilderMTL.h b/ios/library/WhirlyGlobeLib/include/BasicDrawableInstanceBuilderMTL.h index d9a9174732..fc19f4b701 100644 --- a/ios/library/WhirlyGlobeLib/include/BasicDrawableInstanceBuilderMTL.h +++ b/ios/library/WhirlyGlobeLib/include/BasicDrawableInstanceBuilderMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/BasicDrawableInstanceMTL.h b/ios/library/WhirlyGlobeLib/include/BasicDrawableInstanceMTL.h index 35cc765126..fb920f7ac5 100644 --- a/ios/library/WhirlyGlobeLib/include/BasicDrawableInstanceMTL.h +++ b/ios/library/WhirlyGlobeLib/include/BasicDrawableInstanceMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/BasicDrawableMTL.h b/ios/library/WhirlyGlobeLib/include/BasicDrawableMTL.h index eecc30be02..b2cd5767f2 100644 --- a/ios/library/WhirlyGlobeLib/include/BasicDrawableMTL.h +++ b/ios/library/WhirlyGlobeLib/include/BasicDrawableMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/BillboardDrawableBuilderMTL.h b/ios/library/WhirlyGlobeLib/include/BillboardDrawableBuilderMTL.h index efd696f623..3e74a99f78 100644 --- a/ios/library/WhirlyGlobeLib/include/BillboardDrawableBuilderMTL.h +++ b/ios/library/WhirlyGlobeLib/include/BillboardDrawableBuilderMTL.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/ComponentManager_iOS.h b/ios/library/WhirlyGlobeLib/include/ComponentManager_iOS.h index 8d2850c197..a6b15d282c 100644 --- a/ios/library/WhirlyGlobeLib/include/ComponentManager_iOS.h +++ b/ios/library/WhirlyGlobeLib/include/ComponentManager_iOS.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/15/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/DataLayer.h b/ios/library/WhirlyGlobeLib/include/DataLayer.h index a46c47248f..4215159022 100644 --- a/ios/library/WhirlyGlobeLib/include/DataLayer.h +++ b/ios/library/WhirlyGlobeLib/include/DataLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/DefaultShadersMTL.h b/ios/library/WhirlyGlobeLib/include/DefaultShadersMTL.h index 0cb6906746..9104cea9b4 100644 --- a/ios/library/WhirlyGlobeLib/include/DefaultShadersMTL.h +++ b/ios/library/WhirlyGlobeLib/include/DefaultShadersMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -406,6 +406,7 @@ struct ProjVertexTriWideVecPerf { float4 color; float2 texCoord; float w2; + float edge; uint2 maskIDs; }; diff --git a/ios/library/WhirlyGlobeLib/include/Dictionary_NSDictionary.h b/ios/library/WhirlyGlobeLib/include/Dictionary_NSDictionary.h index 15ab131ec1..e778c7c61d 100644 --- a/ios/library/WhirlyGlobeLib/include/Dictionary_NSDictionary.h +++ b/ios/library/WhirlyGlobeLib/include/Dictionary_NSDictionary.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/24/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/DrawableMTL.h b/ios/library/WhirlyGlobeLib/include/DrawableMTL.h index 44b500a761..f9280a1d04 100644 --- a/ios/library/WhirlyGlobeLib/include/DrawableMTL.h +++ b/ios/library/WhirlyGlobeLib/include/DrawableMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 9/30/19. -* Copyright 2011-2019 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/DynamicTextureAtlasMTL.h b/ios/library/WhirlyGlobeLib/include/DynamicTextureAtlasMTL.h index 5d0f0930e8..420fbb1c3a 100644 --- a/ios/library/WhirlyGlobeLib/include/DynamicTextureAtlasMTL.h +++ b/ios/library/WhirlyGlobeLib/include/DynamicTextureAtlasMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/EAGLView.h b/ios/library/WhirlyGlobeLib/include/EAGLView.h index 500d2752c8..6ad2fa901b 100644 --- a/ios/library/WhirlyGlobeLib/include/EAGLView.h +++ b/ios/library/WhirlyGlobeLib/include/EAGLView.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/5/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/FontTextureManager_iOS.h b/ios/library/WhirlyGlobeLib/include/FontTextureManager_iOS.h index 8e84747539..2bf48f5a47 100644 --- a/ios/library/WhirlyGlobeLib/include/FontTextureManager_iOS.h +++ b/ios/library/WhirlyGlobeLib/include/FontTextureManager_iOS.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/4/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,13 +57,22 @@ class FontTextureManager_iOS : public FontTextureManager virtual ~FontTextureManager_iOS(); /// Add the given string. Caller is responsible for deleting the DrawableString - WhirlyKit::DrawableString *addString(PlatformThreadInfo *threadInfo,NSAttributedString *str,ChangeSet &changes); + std::unique_ptr addString(PlatformThreadInfo *,NSAttributedString *,ChangeSet &); virtual void teardown(PlatformThreadInfo*) override; protected: - NSData *renderGlyph(CGGlyph glyph,FontManager_iOSRef fm,Point2f &size,Point2f &glyphSize,Point2f &offset,Point2f &textureOffset); - FontManager_iOSRef findFontManagerForFont(UIFont *uiFont,UIColor *colorUI,UIColor *backColorUI,UIColor *outlineColorUI,float outlinesize); + NSData *renderGlyph(CGGlyph glyph, + const FontManager_iOSRef &, + Point2f &size, // out: size with borders + Point2f &glyphSize, // out: size of glyph only + Point2f &offset, // out: baseline/advance + Point2f &textureOffset);// out: offset into texture + FontManager_iOSRef findFontManagerForFont(UIFont *uiFont, + UIColor *colorUI, + UIColor *backColorUI, + UIColor *outlineColorUI, + float outlinesize); }; typedef std::shared_ptr FontTextureManager_iOSRef; diff --git a/ios/library/WhirlyGlobeLib/include/GeographicLib.h b/ios/library/WhirlyGlobeLib/include/GeographicLib.h index cac222a485..df2a077077 100644 --- a/ios/library/WhirlyGlobeLib/include/GeographicLib.h +++ b/ios/library/WhirlyGlobeLib/include/GeographicLib.h @@ -3,7 +3,7 @@ // WhirlyGlobeLib // // Created by Tim Sylvester on 12/14/20. -// Copyright © 2020 mousebird consulting. All rights reserved. +// Copyright 2020 mousebird consulting. All rights reserved. // #ifndef GeographicLib_Wrapper_h diff --git a/ios/library/WhirlyGlobeLib/include/GlobeView_iOS.h b/ios/library/WhirlyGlobeLib/include/GlobeView_iOS.h index 308dc24012..f8b2c4c2a8 100644 --- a/ios/library/WhirlyGlobeLib/include/GlobeView_iOS.h +++ b/ios/library/WhirlyGlobeLib/include/GlobeView_iOS.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/30/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/ImageTile_iOS.h b/ios/library/WhirlyGlobeLib/include/ImageTile_iOS.h index 6a662d440a..7f0e7aade3 100644 --- a/ios/library/WhirlyGlobeLib/include/ImageTile_iOS.h +++ b/ios/library/WhirlyGlobeLib/include/ImageTile_iOS.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/14/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/LayerThread.h b/ios/library/WhirlyGlobeLib/include/LayerThread.h index b12c2de365..7669aae8af 100644 --- a/ios/library/WhirlyGlobeLib/include/LayerThread.h +++ b/ios/library/WhirlyGlobeLib/include/LayerThread.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/1/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/LayerViewWatcher.h b/ios/library/WhirlyGlobeLib/include/LayerViewWatcher.h index 98698e5d02..8ab7499e27 100644 --- a/ios/library/WhirlyGlobeLib/include/LayerViewWatcher.h +++ b/ios/library/WhirlyGlobeLib/include/LayerViewWatcher.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/28/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/LayoutLayer.h b/ios/library/WhirlyGlobeLib/include/LayoutLayer.h index 32be73de73..512f757000 100644 --- a/ios/library/WhirlyGlobeLib/include/LayoutLayer.h +++ b/ios/library/WhirlyGlobeLib/include/LayoutLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/4/12. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/MTLView.h b/ios/library/WhirlyGlobeLib/include/MTLView.h index 1cfe16f0c7..77c96e5b89 100644 --- a/ios/library/WhirlyGlobeLib/include/MTLView.h +++ b/ios/library/WhirlyGlobeLib/include/MTLView.h @@ -1,9 +1,8 @@ -/* - * MTLView.h +/* MTLView.h * WhirlyGlobeLib * * Created by Steve Gifford on 5/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,26 +14,18 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import #import - #import "ViewWrapper.h" -#import "SceneRendererMTL.h" -/** OpenGL View is a - base class for implementing an open GL rendering view. - This is modeled off of the example. We subclass this for - our own purposes. +/** Base class for implementing a Metal rendering view. + This is modeled off of the example. We subclass this for our own purposes. */ @interface WhirlyKitMTLView : MTKView /// Default init call -- (id)initWithDevice:(id)mtlDevice; - -/// We're only expecting this to be set once -@property (nonatomic) WhirlyKit::SceneRenderer *renderer; +- (id _Nullable )initWithDevice:(_Nonnull id)mtlDevice; @end diff --git a/ios/library/WhirlyGlobeLib/include/MapView_iOS.h b/ios/library/WhirlyGlobeLib/include/MapView_iOS.h index 7eca94b808..798216922a 100644 --- a/ios/library/WhirlyGlobeLib/include/MapView_iOS.h +++ b/ios/library/WhirlyGlobeLib/include/MapView_iOS.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/30/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/NSDictionary+Stuff.h b/ios/library/WhirlyGlobeLib/include/NSDictionary+Stuff.h index d47c1819b6..4aa61e09d8 100644 --- a/ios/library/WhirlyGlobeLib/include/NSDictionary+Stuff.h +++ b/ios/library/WhirlyGlobeLib/include/NSDictionary+Stuff.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/15/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/NSString+Stuff.h b/ios/library/WhirlyGlobeLib/include/NSString+Stuff.h index e89e383822..7eeabf8871 100644 --- a/ios/library/WhirlyGlobeLib/include/NSString+Stuff.h +++ b/ios/library/WhirlyGlobeLib/include/NSString+Stuff.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/11/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/ProgramMTL.h b/ios/library/WhirlyGlobeLib/include/ProgramMTL.h index 410d3b64b8..1edfad2290 100644 --- a/ios/library/WhirlyGlobeLib/include/ProgramMTL.h +++ b/ios/library/WhirlyGlobeLib/include/ProgramMTL.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/QuadDisplayLayerNew.h b/ios/library/WhirlyGlobeLib/include/QuadDisplayLayerNew.h index 632c9855f3..56174172bf 100644 --- a/ios/library/WhirlyGlobeLib/include/QuadDisplayLayerNew.h +++ b/ios/library/WhirlyGlobeLib/include/QuadDisplayLayerNew.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/26/18. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/QuadImageFrameLoader_iOS.h b/ios/library/WhirlyGlobeLib/include/QuadImageFrameLoader_iOS.h index d660c2b081..f738f09421 100644 --- a/ios/library/WhirlyGlobeLib/include/QuadImageFrameLoader_iOS.h +++ b/ios/library/WhirlyGlobeLib/include/QuadImageFrameLoader_iOS.h @@ -1,9 +1,8 @@ -/* - * QuadImageFrameLoader_iOS.h +/* QuadImageFrameLoader_iOS.h * WhirlyGlobeLib * * Created by Steve Gifford on 2/18/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +14,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "QuadImageFrameLoader.h" @@ -27,7 +25,7 @@ - (void)fetchRequestSuccess:(MaplyTileFetchRequest *)request tileID:(MaplyTileID)tileID frame:(int)frame data:(NSData *)data; // Called on a random dispatch queue - (void)fetchRequestFail:(MaplyTileFetchRequest *)request tileID:(MaplyTileID)tileID frame:(int)frame error:(NSError *)error; -// Also called on a randomd ispatch queue +// Also called on a random dispatch queue - (void)tileUnloaded:(MaplyTileID)tileID; @end diff --git a/ios/library/WhirlyGlobeLib/include/RawData_NSData.h b/ios/library/WhirlyGlobeLib/include/RawData_NSData.h index 9c077df4d3..fca3459c24 100644 --- a/ios/library/WhirlyGlobeLib/include/RawData_NSData.h +++ b/ios/library/WhirlyGlobeLib/include/RawData_NSData.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/23/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/RenderTargetMTL.h b/ios/library/WhirlyGlobeLib/include/RenderTargetMTL.h index b911b69f04..7542a5e332 100644 --- a/ios/library/WhirlyGlobeLib/include/RenderTargetMTL.h +++ b/ios/library/WhirlyGlobeLib/include/RenderTargetMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/SceneMTL.h b/ios/library/WhirlyGlobeLib/include/SceneMTL.h index 621f44665f..4d1551adaf 100644 --- a/ios/library/WhirlyGlobeLib/include/SceneMTL.h +++ b/ios/library/WhirlyGlobeLib/include/SceneMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/SceneRendererGLES_iOS.h b/ios/library/WhirlyGlobeLib/include/SceneRendererGLES_iOS.h index a35fe70bee..88fc25fd29 100644 --- a/ios/library/WhirlyGlobeLib/include/SceneRendererGLES_iOS.h +++ b/ios/library/WhirlyGlobeLib/include/SceneRendererGLES_iOS.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/28/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/SceneRendererMTL.h b/ios/library/WhirlyGlobeLib/include/SceneRendererMTL.h index 065ab0354a..c4c938a96d 100644 --- a/ios/library/WhirlyGlobeLib/include/SceneRendererMTL.h +++ b/ios/library/WhirlyGlobeLib/include/SceneRendererMTL.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/ScreenObject_iOS.h b/ios/library/WhirlyGlobeLib/include/ScreenObject_iOS.h index d60fe5fc4f..953e6a1973 100644 --- a/ios/library/WhirlyGlobeLib/include/ScreenObject_iOS.h +++ b/ios/library/WhirlyGlobeLib/include/ScreenObject_iOS.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/ScreenSpaceDrawableBuilderMTL.h b/ios/library/WhirlyGlobeLib/include/ScreenSpaceDrawableBuilderMTL.h index e3967a385a..961b94c749 100644 --- a/ios/library/WhirlyGlobeLib/include/ScreenSpaceDrawableBuilderMTL.h +++ b/ios/library/WhirlyGlobeLib/include/ScreenSpaceDrawableBuilderMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/SingleLabel_iOS.h b/ios/library/WhirlyGlobeLib/include/SingleLabel_iOS.h index 04e11a0d06..e13072d5be 100644 --- a/ios/library/WhirlyGlobeLib/include/SingleLabel_iOS.h +++ b/ios/library/WhirlyGlobeLib/include/SingleLabel_iOS.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/4/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,11 +31,12 @@ class SingleLabel_iOS: public SingleLabel SingleLabel_iOS(NSString* s = nullptr) : text(s) {} // Used to build the drawable string on specific platforms - virtual std::vector generateDrawableStrings(PlatformThreadInfo *threadInfo, - const LabelInfo *, - const FontTextureManagerRef &fontTexManager, - float &lineHeight, - ChangeSet &changes) override; + virtual std::vector> generateDrawableStrings( + PlatformThreadInfo *, + const LabelInfo *, + const FontTextureManagerRef &, + float &lineHeight, + ChangeSet &) override; // Pass this around as an NSString NSString *text; diff --git a/ios/library/WhirlyGlobeLib/include/Snapshot_iOS.h b/ios/library/WhirlyGlobeLib/include/Snapshot_iOS.h index dd429b8830..2cbc998c45 100644 --- a/ios/library/WhirlyGlobeLib/include/Snapshot_iOS.h +++ b/ios/library/WhirlyGlobeLib/include/Snapshot_iOS.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/12/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/TextureGLES_iOS.h b/ios/library/WhirlyGlobeLib/include/TextureGLES_iOS.h index 1d8ebcb243..28e877ef78 100644 --- a/ios/library/WhirlyGlobeLib/include/TextureGLES_iOS.h +++ b/ios/library/WhirlyGlobeLib/include/TextureGLES_iOS.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/31/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/TextureMTL.h b/ios/library/WhirlyGlobeLib/include/TextureMTL.h index 0aaa605df5..38d15e12c5 100644 --- a/ios/library/WhirlyGlobeLib/include/TextureMTL.h +++ b/ios/library/WhirlyGlobeLib/include/TextureMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/UIColor+Stuff.h b/ios/library/WhirlyGlobeLib/include/UIColor+Stuff.h index 3ae9fe49ed..10ac038b03 100644 --- a/ios/library/WhirlyGlobeLib/include/UIColor+Stuff.h +++ b/ios/library/WhirlyGlobeLib/include/UIColor+Stuff.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/15/11. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/UIImage+Stuff.h b/ios/library/WhirlyGlobeLib/include/UIImage+Stuff.h index 443f804c40..394375f9a8 100644 --- a/ios/library/WhirlyGlobeLib/include/UIImage+Stuff.h +++ b/ios/library/WhirlyGlobeLib/include/UIImage+Stuff.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/11/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/UpdateDisplayLayer.h b/ios/library/WhirlyGlobeLib/include/UpdateDisplayLayer.h index e7c07c33ce..f920015cfc 100644 --- a/ios/library/WhirlyGlobeLib/include/UpdateDisplayLayer.h +++ b/ios/library/WhirlyGlobeLib/include/UpdateDisplayLayer.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/19/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/VectorData_iOS.h b/ios/library/WhirlyGlobeLib/include/VectorData_iOS.h index 16d0029f8e..9fbe3ed257 100644 --- a/ios/library/WhirlyGlobeLib/include/VectorData_iOS.h +++ b/ios/library/WhirlyGlobeLib/include/VectorData_iOS.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/6/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/VertexAttributeMTL.h b/ios/library/WhirlyGlobeLib/include/VertexAttributeMTL.h index 370fd342af..a9e3cd0f15 100644 --- a/ios/library/WhirlyGlobeLib/include/VertexAttributeMTL.h +++ b/ios/library/WhirlyGlobeLib/include/VertexAttributeMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/ViewWrapper.h b/ios/library/WhirlyGlobeLib/include/ViewWrapper.h index 9ad6dbb5fb..5bf9f006cc 100644 --- a/ios/library/WhirlyGlobeLib/include/ViewWrapper.h +++ b/ios/library/WhirlyGlobeLib/include/ViewWrapper.h @@ -1,9 +1,8 @@ -/* - * ViewWrapper.h +/* ViewWrapper.h * WhirlyGlobeLib * * Created by Steve Gifford on 5/15/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,21 +14,28 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import -#import "SceneRenderer.h" -/** OpenGL View is a - base class for implementing an open GL rendering view. - This is modeled off of the example. We subclass this for - our own purposes. +namespace WhirlyKit +{ + class SceneRenderer; +} + +@protocol ViewWrapperDelegateProtocol +- (void)layoutDidRun; +@end + +/** Base class for implementing a Metal rendering view. + This is modeled off of the example. We subclass this for our own purposes. */ @protocol WhirlyKitViewWrapper /// Renderer we're using -@property (nonatomic) WhirlyKit::SceneRenderer *renderer; +@property (nonatomic) WhirlyKit::SceneRenderer * _Nullable renderer; + +@property (nonatomic) NSObject * __weak _Nullable wrapperDelegate; /// True if we've got a displayLink turned on to animate. - (BOOL)isAnimating; diff --git a/ios/library/WhirlyGlobeLib/include/WhirlyGlobe_iOS.h b/ios/library/WhirlyGlobeLib/include/WhirlyGlobe_iOS.h index 36d95a06d5..efc5619d90 100644 --- a/ios/library/WhirlyGlobeLib/include/WhirlyGlobe_iOS.h +++ b/ios/library/WhirlyGlobeLib/include/WhirlyGlobe_iOS.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/7/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/WideVectorDrawableBuilderMTL.h b/ios/library/WhirlyGlobeLib/include/WideVectorDrawableBuilderMTL.h index 189d63d314..e287e97f6e 100644 --- a/ios/library/WhirlyGlobeLib/include/WideVectorDrawableBuilderMTL.h +++ b/ios/library/WhirlyGlobeLib/include/WideVectorDrawableBuilderMTL.h @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/include/WrapperMTL.h b/ios/library/WhirlyGlobeLib/include/WrapperMTL.h index 227c59e004..9e0a95705f 100644 --- a/ios/library/WhirlyGlobeLib/include/WrapperMTL.h +++ b/ios/library/WhirlyGlobeLib/include/WrapperMTL.h @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/BasicDrawableBuilderMTL.mm b/ios/library/WhirlyGlobeLib/src/BasicDrawableBuilderMTL.mm index e1aa11579e..bc81c75348 100644 --- a/ios/library/WhirlyGlobeLib/src/BasicDrawableBuilderMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/BasicDrawableBuilderMTL.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/BasicDrawableInstanceBuilderMTL.mm b/ios/library/WhirlyGlobeLib/src/BasicDrawableInstanceBuilderMTL.mm index b519c93833..a00834f3e2 100644 --- a/ios/library/WhirlyGlobeLib/src/BasicDrawableInstanceBuilderMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/BasicDrawableInstanceBuilderMTL.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/BasicDrawableInstanceMTL.mm b/ios/library/WhirlyGlobeLib/src/BasicDrawableInstanceMTL.mm index efe9d40087..94e29a6975 100644 --- a/ios/library/WhirlyGlobeLib/src/BasicDrawableInstanceMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/BasicDrawableInstanceMTL.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/BasicDrawableMTL.mm b/ios/library/WhirlyGlobeLib/src/BasicDrawableMTL.mm index 16273284df..19e9600c91 100644 --- a/ios/library/WhirlyGlobeLib/src/BasicDrawableMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/BasicDrawableMTL.mm @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ #import "TextureMTL.h" #import "SceneMTL.h" #import "DefaultShadersMTL.h" +#import "WhirlyKitLog.h" using namespace Eigen; @@ -644,6 +645,12 @@ void BasicDrawableMTL::encodeDirect(RendererFrameInfoMTL *frameInfo,id cmdEncode,Scene *scene) { + if (!setupForMTL) + { + wkLogLevel(Warn, "Drawable %lld not set up - skipping", getId()); + return; + } + SceneRendererMTL *sceneRender = (SceneRendererMTL *)frameInfo->sceneRenderer; id renderState = getRenderPipelineState(sceneRender,scene,(ProgramMTL *)frameInfo->program,(RenderTargetMTL *)frameInfo->renderTarget); @@ -761,6 +768,12 @@ return; } + if (!setupForMTL) + { + wkLogLevel(Warn, "Drawable %lld not set up - skipping", getId()); + return; + } + id renderState = getRenderPipelineState(sceneRender,scene,program,renderTarget); // Wire up the various inputs that we know about diff --git a/ios/library/WhirlyGlobeLib/src/BillboardDrawableBuilderMTL.mm b/ios/library/WhirlyGlobeLib/src/BillboardDrawableBuilderMTL.mm index fe85bee692..1b0f66b707 100644 --- a/ios/library/WhirlyGlobeLib/src/BillboardDrawableBuilderMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/BillboardDrawableBuilderMTL.mm @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/ComponentManager_iOS.mm b/ios/library/WhirlyGlobeLib/src/ComponentManager_iOS.mm index 226b1bc097..10c99f5cd9 100644 --- a/ios/library/WhirlyGlobeLib/src/ComponentManager_iOS.mm +++ b/ios/library/WhirlyGlobeLib/src/ComponentManager_iOS.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/15/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/Dictionary_NSDictionary.mm b/ios/library/WhirlyGlobeLib/src/Dictionary_NSDictionary.mm index 5a75b06cd8..2b1d788121 100644 --- a/ios/library/WhirlyGlobeLib/src/Dictionary_NSDictionary.mm +++ b/ios/library/WhirlyGlobeLib/src/Dictionary_NSDictionary.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/24/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -361,7 +361,8 @@ MutableDictionaryRef MutableDictionaryMake() /// Returns true if the field exists bool iosMutableDictionary::hasField(const std::string &name) const { - return [dict objectForKey:StdStringToString(name)] != nil; + const id value = [dict objectForKey:StdStringToString(name)]; + return (value != nil) && ![value isKindOfClass:NSNull.class]; } /// Returns the field type diff --git a/ios/library/WhirlyGlobeLib/src/DrawableMTL.mm b/ios/library/WhirlyGlobeLib/src/DrawableMTL.mm index e12ec2e0c6..9de7283a86 100644 --- a/ios/library/WhirlyGlobeLib/src/DrawableMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/DrawableMTL.mm @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/10/20. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/DynamicTextureAtlasMTL.mm b/ios/library/WhirlyGlobeLib/src/DynamicTextureAtlasMTL.mm index 484398bd8e..3881a918bd 100644 --- a/ios/library/WhirlyGlobeLib/src/DynamicTextureAtlasMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/DynamicTextureAtlasMTL.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/FontTextureManager_iOS.mm b/ios/library/WhirlyGlobeLib/src/FontTextureManager_iOS.mm index 240ebf7d07..0978aec64c 100644 --- a/ios/library/WhirlyGlobeLib/src/FontTextureManager_iOS.mm +++ b/ios/library/WhirlyGlobeLib/src/FontTextureManager_iOS.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/4/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -121,24 +121,30 @@ } // Render the glyph into a buffer -NSData *FontTextureManager_iOS::renderGlyph(CGGlyph glyph,FontManager_iOSRef fm,Point2f &size,Point2f &glyphSize,Point2f &offset,Point2f &textureOffset) +NSData *FontTextureManager_iOS::renderGlyph(CGGlyph glyph, const FontManager_iOSRef &fm, + Point2f &size,Point2f &glyphSize, + Point2f &offset,Point2f &textureOffset) { - int width,height; - // Boundary around the image to capture the full data if (fm->outlineSize > 0.0) { - int outlineUp = ceilf(fm->outlineSize); + const auto outlineUp = (int)std::ceil(fm->outlineSize); textureOffset = Point2f(1+outlineUp, 1+outlineUp); - } else + } + else + { textureOffset = Point2f(1, 1); + } - CGRect boundRect = CTFontGetBoundingRectsForGlyphs(fm->font,kCTFontOrientationDefault,&glyph,NULL,1); - size.x() = ceilf(boundRect.size.width)+2*textureOffset.x(); size.y() = ceilf(boundRect.size.height)+2*textureOffset.y(); - width = size.x(); height = size.y(); - - if (width <= 0 || height <= 0) - return nil; + const CGRect boundRect = CTFontGetBoundingRectsForGlyphs(fm->font,kCTFontOrientationDefault,&glyph,nil,1); + size.x() = std::ceil(boundRect.size.width)+2*textureOffset.x(); + size.y() = std::ceil(boundRect.size.height)+2*textureOffset.y(); + const auto width = (int)size.x(); + const auto height = (int)size.y(); + + if (width <= 0 || height <= 0) + return nil; + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); // Set up a real context for the glyph rendering NSMutableData *retData = [NSMutableData dataWithLength:width*height*4]; @@ -156,8 +162,8 @@ CGContextTranslateCTM(theContext, 0.0f, height); CGContextScaleCTM(theContext, 1.0f, -1.0f); // Now draw it - int baselineOffX = (boundRect.origin.x < 0 ? floorf(boundRect.origin.x) : ceilf(boundRect.origin.x)); - int baselineOffY = (boundRect.origin.y < 0 ? floorf(boundRect.origin.y) : ceilf(boundRect.origin.y)); + const int baselineOffX = (boundRect.origin.x < 0 ? floorf(boundRect.origin.x) : ceilf(boundRect.origin.x)); + const int baselineOffY = (boundRect.origin.y < 0 ? floorf(boundRect.origin.y) : ceilf(boundRect.origin.y)); offset = Point2f(baselineOffX,baselineOffY); glyphSize = Point2f(boundRect.size.width,boundRect.size.height); @@ -211,8 +217,23 @@ } /// Add the given string. Caller is responsible for deleting the DrawableString -WhirlyKit::DrawableString *FontTextureManager_iOS::addString(PlatformThreadInfo *threadInfo,NSAttributedString *str,ChangeSet &changes) +std::unique_ptr FontTextureManager_iOS::addString( + PlatformThreadInfo *, NSAttributedString *str, ChangeSet &changes) { + auto drawString = std::make_unique(); + auto drawStringRep = std::make_unique(drawString->getId()); + + // Convert to runs of glyphs + CTLineRef line = CTLineCreateWithAttributedString((__bridge CFAttributedStringRef)str); + + // Work through the runs (which share attributes) + CFArrayRef runs = CTLineGetGlyphRuns(line); + CGFloat /*lineHeight = 0.0, lineWidth = 0.0,*/ ascent = 0.0, descent = 0.0; + /*lineWidth = */CTLineGetTypographicBounds(line,&ascent,&descent,nullptr); + //lineHeight = ascent+descent; + + drawString->mbr.reset(); + // We could make this more granular std::lock_guard guardLock(lock); @@ -221,21 +242,7 @@ // Let's do the biggest possible texture with small cells 32 bits deep texAtlas = new DynamicTextureAtlas("Font Texture Atlas",2048,16,TexTypeUnsignedByte); } - - DrawableString *drawString = new DrawableString(); - - // Convert to runs of glyphs - CTLineRef line = CTLineCreateWithAttributedString((__bridge CFAttributedStringRef)str); - - // Work through the runs (which share attributes) - CFArrayRef runs = CTLineGetGlyphRuns(line); - CGFloat /*lineHeight = 0.0, lineWidth = 0.0,*/ ascent = 0.0, descent = 0.0; - /*lineWidth = */CTLineGetTypographicBounds(line,&ascent,&descent,NULL); - //lineHeight = ascent+descent; - - DrawStringRep *drawStringRep = new DrawStringRep(drawString->getId()); - - drawString->mbr.reset(); + for (unsigned int ii=0;iifindGlyph(glyph); if (!glyphInfo) @@ -287,44 +294,47 @@ // We need to render that Glyph and add it Point2f texSize,glyphSize; Point2f offset,textureOffset; - NSData *glyphImage = renderGlyph(glyph, fm, texSize, glyphSize, offset, textureOffset); - if (glyphImage) + if (NSData *glyphImage = renderGlyph(glyph, fm, texSize, glyphSize, offset, textureOffset)) { - Texture *tex = nil; - RawDataRef glyphImageWrap(new RawNSDataReader(glyphImage)); - tex = new TextureMTL("Font Texture Manager",glyphImageWrap,false); - tex->setWidth(texSize.x()); - tex->setHeight(texSize.y()); + RawDataRef glyphImageWrap = std::make_shared(glyphImage); + + TextureMTL tex("Font Texture Manager",glyphImageWrap,false); + tex.setWidth(texSize.x()); + tex.setHeight(texSize.y()); + SubTexture subTex; - Point2f realSize(glyphSize.x()+2*textureOffset.x(),glyphSize.y()+2*textureOffset.y()); - std::vector texs; - texs.push_back(tex); - if (texAtlas->addTexture(sceneRender, texs, -1, &realSize, NULL, subTex, changes, 0, 1)) - glyphInfo = fm->addGlyph(glyph, subTex, Point2f(glyphSize.x(),glyphSize.y()), offset, textureOffset); - delete tex; + const Point2f realSize(glyphSize.x()+2*textureOffset.x(),glyphSize.y()+2*textureOffset.y()); + + std::vector texs = { &tex }; + if (texAtlas->addTexture(sceneRender, texs, -1, &realSize, nullptr, subTex, changes, 0, 1)) + { + glyphInfo = fm->addGlyph(glyph, subTex, glyphSize.cast(), offset, textureOffset); + } } } if (glyphInfo) { // Now we make a rectangle that covers the glyph in its texture atlas - DrawableString::Rect rect; - CGPoint &offset = offsets[jj]; - + const CGPoint &offset = offsets[jj]; const float scale = 1.0/BogusFontScale; + drawString->glyphPolys.emplace_back(); + auto &rect = drawString->glyphPolys.back(); + // Note: was -1,-1 - rect.pts[0] = Point2f(glyphInfo->offset.x()*scale-glyphInfo->textureOffset.x()*scale,glyphInfo->offset.y()*scale-glyphInfo->textureOffset.y()*scale)+Point2f(offset.x,offset.y); + rect.pts[0] = Point2f(glyphInfo->offset.x()*scale-glyphInfo->textureOffset.x()*scale, + glyphInfo->offset.y()*scale-glyphInfo->textureOffset.y()*scale)+Point2f(offset.x,offset.y); rect.texCoords[0] = TexCoord(0.0,0.0); // Note: was 2,2 - rect.pts[1] = Point2f(glyphInfo->size.x()*scale+2*glyphInfo->textureOffset.x()*scale,glyphInfo->size.y()*scale+2*glyphInfo->textureOffset.y()*scale)+rect.pts[0]; + rect.pts[1] = Point2f(glyphInfo->size.x()*scale+2*glyphInfo->textureOffset.x()*scale, + glyphInfo->size.y()*scale+2*glyphInfo->textureOffset.y()*scale)+rect.pts[0]; rect.texCoords[1] = TexCoord(1.0,1.0); - rect.subTex = glyphInfo->subTex; - drawString->glyphPolys.push_back(rect); + drawString->mbr.addPoint(rect.pts[0]); drawString->mbr.addPoint(rect.pts[1]); - + glyphsUsed.insert(glyphInfo->glyph); } } @@ -340,20 +350,18 @@ // drawString->mbr.ur() = Point2f(lineWidth,ascent); CFRelease(line); - + // If it didn't produce anything, just delete it now if (drawString->glyphPolys.empty()) { - delete drawString; - delete drawStringRep; - drawStringRep = NULL; - drawString = NULL; + drawString.reset(); } - // We need to track the glyphs we're using - if (drawStringRep != NULL) - drawStringReps.insert(drawStringRep); - + else if (drawStringRep) + { + drawStringReps.insert(drawStringRep.release()); + } + return drawString; } diff --git a/ios/library/WhirlyGlobeLib/src/GeographicLib.mm b/ios/library/WhirlyGlobeLib/src/GeographicLib.mm index eb5784f70f..c2c4c96790 100644 --- a/ios/library/WhirlyGlobeLib/src/GeographicLib.mm +++ b/ios/library/WhirlyGlobeLib/src/GeographicLib.mm @@ -6,13 +6,15 @@ // Copyright © 2020 mousebird consulting. All rights reserved. // -#import "GeographicLib.h" -#import "CoordSystem.h" -#import "WhirlyGeometry.h" - #import "GeographicLib/Geodesic.hpp" #import "GeographicLib/Geocentric.hpp" +#import "../../../../common/WhirlyGlobeLib/include/GeographicLib.h" +#import "../include/GeographicLib.h" +#import "CoordSystem.h" +#import "WhirlyGeometry.h" +#import "WhirlyKitLog.h" + #import #import @@ -21,13 +23,7 @@ #endif typedef WhirlyKit::Point3d Point3d; - -namespace { - // Generic geodesic initialized for WGS84 ellipsoid. - // We assume this is thread-safe because we only read from it. - static const GeographicLib::Geodesic &wgs84Geodesic = GeographicLib::Geodesic::WGS84(); - static const GeographicLib::Geocentric &wgs84Geocentric = GeographicLib::Geocentric::WGS84(); -} +using namespace WhirlyKit::detail; MaplyCoordinate GeoLibCalcDirectF(MaplyCoordinate origin, double azimuth, double distance) { @@ -42,7 +38,7 @@ MaplyCoordinateD GeoLibCalcDirectD(MaplyCoordinateD origin, double azimuthRadian const auto azDeg = WhirlyKit::RadToDeg(azimuthRadians); double lat2 = 0.0, lon2 = 0.0; - const auto res = wgs84Geodesic.Direct(lat1, lon1, azDeg, distanceMeters, lat2, lon2); + const auto res = wgs84Geodesic().Direct(lat1, lon1, azDeg, distanceMeters, lat2, lon2); return std::isfinite(res) ? MaplyCoordinateD { WhirlyKit::DegToRad(lon2), WhirlyKit::DegToRad(lat2) } @@ -58,7 +54,7 @@ static GeoLibInv CalcInv(T p1, T p2) const auto lat2 = WhirlyKit::RadToDeg(p2.y); const auto lon2 = WhirlyKit::RadToDeg(p2.x); double dist = 0.0, az1 = 0.0, az2 = 0.0; - wgs84Geodesic.Inverse(lat1, lon1, lat2, lon2, dist, az1, az2); + wgs84Geodesic().Inverse(lat1, lon1, lat2, lon2, dist, az1, az2); return GeoLibInv { dist, WhirlyKit::DegToRad(az1), WhirlyKit::DegToRad(az2) }; } } @@ -85,20 +81,22 @@ static bool InPoly(TPoint p, const TPolyPt poly[], unsigned count) { { pts.push_back(f); } + + // TODO: this is using spherical assumptions return WhirlyKit::PointInPolygon(WhirlyKit::Point2d(p.x, p.y), pts); } static inline Point3d CoordToGeocentric(const MaplyCoordinateD &p, double geoidHeight = 0.0) { double x = 0, y = 0, z = 0; - wgs84Geocentric.Forward(WhirlyKit::RadToDeg(p.y), WhirlyKit::RadToDeg(p.x), geoidHeight, x, y, z); + wgs84Geocentric().Forward(WhirlyKit::RadToDeg(p.y), WhirlyKit::RadToDeg(p.x), geoidHeight, x, y, z); return {x,y,z}; } static inline MaplyCoordinateD GeocentricToCoord(const Point3d &p) { double lat = 0, lon = 0, height = 0; - wgs84Geocentric.Reverse(p.x(), p.y(), p.z(), lat, lon, height); + wgs84Geocentric().Reverse(p.x(), p.y(), p.z(), lat, lon, height); return { WhirlyKit::DegToRad(lon), WhirlyKit::DegToRad(lat) }; } } @@ -109,130 +107,6 @@ static inline MaplyCoordinateD GeocentricToCoord(const Point3d &p) bool MaplyCoordinateDInPolygonD(MaplyCoordinateD p, const MaplyCoordinateD polygon[], unsigned count) { return InPoly(p, polygon, count); } -namespace { - - template - inline static void combine(double* eqA, double* eqB) - { - if (eqB[0] == 0.0) - { - return; - } - if (std::fabs(eqA[0]) >= std::fabs(eqB[0])) - { - auto const f = eqB[0] / eqA[0]; - eqB[0] = 0; - for (auto i = 1; i < N; ++i) - { - eqB[i] -= f * eqA[i]; - } - } - else - { - auto const f = eqA[0] / eqB[0]; - eqA[0] = eqB[0]; - eqB[0] = 0; - for (auto i = 1; i < N; ++i) - { - std::swap(eqA[i], eqB[i]); - eqB[i] -= f * eqA[i]; - } - } - } - - // for n = 3, partially solve, zeroing the coefficients below the diagonal. - inline static void solveLinear3A(double* eq0, double* eq1, double* eq2) - { - combine<4>(eq1, eq2); - combine<4>(eq0, eq1); - combine<3>(eq1 + 1, eq2 + 1); - - if (eq2[3] != 0.0) - { - eq2[3] = (eq2[2] == 0 ? INFINITY : eq2[3] / eq2[2]); - } - eq2[2] = 1; - } - - // Complete the solution started by solveLinear3Lower - inline static void solveLinear3B(double* eq0, double* eq1, double* eq2) - { - eq1[3] -= eq1[2] * eq2[3]; - eq1[2] = 0; - if (eq1[3] != 0.0) - { - eq1[3] = (eq1[1] == 0.0 ? INFINITY : eq1[3] / eq1[1]); - } - eq1[1] = 1; - eq0[3] -= eq0[2] * eq2[3] + eq0[1] * eq1[3]; - eq0[1] = 0; - eq0[2] = 0; - if (eq0[3] != 0) - { - eq0[3] = (eq0[0] == 0.0 ? INFINITY : eq0[3] / eq0[0]); - } - eq0[0] = 1; - } - - // Project a vector onto the ellipsoid surface - static Point3d project(const Point3d &p, const GeographicLib::Geodesic &geo) - { - const auto re = geo.EquatorialRadius(); - const auto rp = re - re * geo.Flattening(); - const auto x = p.x(); - const auto y = p.y(); - const auto z = p.z(); - const auto r = std::sqrt((x * x + y * y) / (re * re) + z * z / (rp * rp)); - return (r == 0) ? Point3d{ rp, y, z } : // it's a pole - Point3d{ x / r, y / r, z / r }; // anything else - } - - const static Point3d ptZero = { 0.0, 0.0, 0.0 }; - - // Find the intersection of geodesics A-B and C-D. - // Returns the intersection point iff CalcInt==true - template - static inline std::tuple intersection( - const Point3d &a, const Point3d &b, const Point3d &c, const Point3d &d, - const GeographicLib::Geodesic &geo) - { - // Set equal the equations defining the two geodesics, as defined by the - // intersection of the ellipsoid and a plane through its center, and solve - // the resulting system of equations, yielding two antipodal solutions. - // - // ((x4 - x3) * s + x3) * t = (x2 - x1) * r + x1 - // ((y4 - y3) * s + y3) * t = (y2 - y1) * r + y1 - // ((z4 - z3) * s + z3) * t = (z2 - z1) * r + z1 - - double e0[4] = { d.x() - c.x(), c.x(), a.x() - b.x(), a.x() }; - double e1[4] = { d.y() - c.y(), c.y(), a.y() - b.y(), a.y() }; - double e2[4] = { d.z() - c.z(), c.z(), a.z() - b.z(), a.z() }; - solveLinear3A(e0, e1, e2); - - const auto r = e2[3]; - if (r >= 0.0 && r <= 1.0) - { - solveLinear3B(e0, e1, e2); - - // Solution on the right side, and within the segments? - const auto t = e1[3]; - if (t > 0.0) - { - const auto s = e0[3] / t; - if (s >= 0.0 && s <= 1.0) - { - // Yes! Project the solution vector onto the ellipsoid - return std::make_tuple(true, - CalcInt ? project((b - a) * r + a, geo) : ptZero); - } - } - } - - return std::make_tuple(false, ptZero); - } - -} - GeoLibInt GeoLibIntersectD(MaplyCoordinateD a, MaplyCoordinateD b, MaplyCoordinateD c, MaplyCoordinateD d) { const auto gca = CoordToGeocentric(a); @@ -242,7 +116,7 @@ GeoLibInt GeoLibIntersectD(MaplyCoordinateD a, MaplyCoordinateD b, MaplyCoordina bool res; Point3d p; - std::tie(res,p) = intersection(gca, gcb, gcc, gcd, wgs84Geodesic); + std::tie(res,p) = WhirlyKit::Geocentric::findIntersection(gca, gcb, gcc, gcd, wgs84Geodesic()); return res ? GeoLibInt{ GeocentricToCoord(p), true } : GeoLibInt{ { 0, 0 }, false }; } @@ -267,12 +141,9 @@ bool GeoLibLineDIntersectsPolygonD(MaplyCoordinateD startPt, MaplyCoordinateD en // Alternate with each new point so we only convert each point once, and we don't care about direction ((i & 1) ? gca : gcb) = CoordToGeocentric(p); - if (gca != gcb) + if (gca != gcb && WhirlyKit::Geocentric::checkIntersection(gcStart, gcEnd, gca, gcb, wgs84Geodesic())) { - if (std::get<0>(intersection(gcStart, gcEnd, gca, gcb, wgs84Geodesic))) - { - return true; - } + return true; } } return false; @@ -281,110 +152,17 @@ bool GeoLibLineDIntersectsPolygonD(MaplyCoordinateD startPt, MaplyCoordinateD en double GeoLibDistanceD(MaplyCoordinateD startPt, MaplyCoordinateD endPt) { double s12 = 0.0; - wgs84Geodesic.Inverse(WhirlyKit::RadToDeg(startPt.y), - WhirlyKit::RadToDeg(startPt.x), - WhirlyKit::RadToDeg(endPt.y), - WhirlyKit::RadToDeg(endPt.x), - s12); + wgs84Geodesic().Inverse(WhirlyKit::RadToDeg(startPt.y), WhirlyKit::RadToDeg(startPt.x), + WhirlyKit::RadToDeg(endPt.y), WhirlyKit::RadToDeg(endPt.x), s12); return s12; } -namespace { - - // Project a geocentric point into the orthographic projection defined by the origin - static Point3d projectOrtho(const Point3d &origin, const Point3d &p) - { - const double sinLat = origin.z(); - const double cosLat = std::sqrt(origin.x() * origin.x() + origin.y() * origin.y()); - const double sinLon = origin.x() / cosLat; - const double cosLon = -origin.y() / cosLat; - const double x1 = p.x() * cosLon + p.y() * sinLon; - const double y1 = -p.x() * sinLon + p.y() * cosLon; - return { x1, y1 * sinLat + p.z() * cosLat, -y1 * cosLat + p.z() * sinLat }; - } - - // Invert orthographic projection - static Point3d unprojectOrtho(const Point3d &origin, const Point3d &p) - { - const double sinLat = origin.z(); - const double cosLat = std::sqrt(origin.x() * origin.x() + origin.y() * origin.y()); - const double sinLon = origin.x() / cosLat; - const double cosLon = -origin.y() / cosLat; - const double y1 = p.y() * sinLat - p.z() * cosLat; - const double z1 = p.y() * cosLat + p.z() * sinLat; - return { p.x() * cosLon - y1 * sinLon, p.x() * sinLon + y1 * cosLon, z1 }; - } - - static const double sinpi4 = std::sin(M_PI_4); - - // Calculate the angle between two vectors. - // Both vectors must be normalized! - static double angle(Point3d a, Point3d b) - { - const double dp = a.dot(b); - if (std::fabs(dp) < sinpi4) - { - return std::acos(dp); - } - - const auto m = a.cross(b).norm(); - return (dp < 0) ? M_PI - std::asin(m) : std::asin(m); - } - - // TODO: This isn't fully accounting for eccentricity, so it's not super precise. - static GeoLibOrthoDist _GeoLibOrthoDistD(const Point3d &gca, const Point3d &gcb, const Point3d &gcc) - { - // Calculate the unit normal of the geodesic segment - const auto geoNorm = gca.cross(gcb).normalized(); - - // Calculate the unit normal of that and the point of interest - const auto orthoNorm = gcc.cross(geoNorm).normalized(); - - // Find the the point where the line to the target point is perpendicular - const auto cp = geoNorm.cross(orthoNorm); - - // Calculate the angles along and aside the segment - const auto t0 = angle(gca, gcb); - const auto t1 = angle(cp, gca); - const auto t2 = angle(cp, gcc); - - // Work out which quadrant we're in and fix the signs - const auto s1 = (cp.dot(geoNorm.cross(gca)) < 0) ? -1. : 1.; - const auto s2 = (gcc.dot(geoNorm) > 0) ? -1. : 1.; - - // Convert the angles to distances - const auto rad = GeographicLib::Constants::WGS84_a(); - return { rad * t1 * s1, rad * t2 * s2, rad * t0 }; - } - - static double initialHeadingD(const Point3d &startPt, const Point3d &endPt) - { - // Find the location of the endpoint in the orthographic projection defined by the start point - const auto end = projectOrtho(startPt, endPt); - - // If x==y==0 they are the same point and the heading is undefined - return std::atan2(end.x(), end.y()); - } - //static double finalHeadingD(const Point3d &startPt, const Point3d &endPt) - //{ - // return std::fmod(initialHeadingD(endPt, startPt) + M_2PI, M_2PI); - //} - - static Point3d orthoDirect(const Point3d &start, double azimuthRad, double distMeters) - { - const double theta = distMeters / wgs84Geodesic.EquatorialRadius(); - const double r = sin(theta); - const double hdg = M_PI_2 - azimuthRad; - return unprojectOrtho(start, { r * std::cos(hdg), r * std::sin(hdg), std::cos(theta) }); - } -} - double GeoLibInitialHeadingD(MaplyCoordinateD startPt, MaplyCoordinateD endPt) { const auto gcStart = CoordToGeocentric(startPt); const auto gcEnd = CoordToGeocentric(endPt); - return initialHeadingD(gcStart, gcEnd); + return WhirlyKit::Geocentric::initialHeading(gcStart, gcEnd); } bool GeoLibLineDIntersectsCircleD(MaplyCoordinateD startPt, MaplyCoordinateD endPt, MaplyCoordinateD center, double radiusMeters) @@ -413,36 +191,37 @@ GeoLibIntPair GeoLibLineDIntersectCircleD(MaplyCoordinateD startPt, MaplyCoordin GeoLibIntPair result = { {{ 0.0, 0.0 }, { 0.0, 0.0 }}, { 0.0, 0.0 }, 0 }; - auto const res = _GeoLibOrthoDistD(gcStart, gcEnd, gcCenter); - if (res.downtrackDistance < -radiusMeters || // preceeds the GC segment by more than the radius - res.downtrackDistance > res.segmentLength + radiusMeters || // follows the GC segment by more than the radius - std::fabs(res.crosstrackDistance) > radiusMeters) // to the side of the GC segment by more than the radius + double dt, ct, len; + std::tie(dt, ct, len) = WhirlyKit::Geocentric::OrthoDist(gcStart, gcEnd, gcCenter); + if (dt < -radiusMeters || // preceeds the GC segment by more than the radius + dt > len + radiusMeters || // follows the GC segment by more than the radius + std::fabs(ct) > radiusMeters) // to the side of the GC segment by more than the radius { return result; } // Use the right-triangle-simplified law of cosines for triangles on a sphere - const double earthRad = wgs84Geodesic.EquatorialRadius(); + const double earthRad = wgs84Geodesic().EquatorialRadius(); const double a = earthRad * std::acos(std::cos(radiusMeters / earthRad) / - std::cos(std::fabs(res.crosstrackDistance) / earthRad)); + std::cos(std::fabs(ct) / earthRad)); // The intersections must be symmetric around the perpendicular intercept - const double dist1 = res.downtrackDistance + a; - const double dist2 = res.downtrackDistance - a; + const double dist1 = dt + a; + const double dist2 = dt - a; - const double hdg = initialHeadingD(gcStart, gcEnd); + const double hdg = WhirlyKit::Geocentric::initialHeading(gcStart, gcEnd); - if (dist1 >= 0.0 && dist1 <= res.segmentLength) + if (dist1 >= 0.0 && dist1 <= len) { result.distances[0] = dist1; - result.intersections[0] = GeocentricToCoord(orthoDirect(gcStart, hdg, dist1)); + result.intersections[0] = GeocentricToCoord(WhirlyKit::Geocentric::orthoDirect(gcStart, hdg, dist1)); result.count += 1; } - if (dist2 >= 0.0 && dist2 <= res.segmentLength) + if (dist2 >= 0.0 && dist2 <= len) { result.distances[result.count] = dist2; - result.intersections[result.count] = GeocentricToCoord(orthoDirect(gcStart, hdg, dist2)); + result.intersections[result.count] = GeocentricToCoord(WhirlyKit::Geocentric::orthoDirect(gcStart, hdg, dist2)); result.count += 1; } @@ -458,7 +237,8 @@ GeoLibOrthoDist GeoLibOrthoDistD(MaplyCoordinateD a, MaplyCoordinateD b, MaplyCo const auto gca = CoordToGeocentric(a).normalized(); const auto gcb = CoordToGeocentric(b).normalized(); const auto gcc = CoordToGeocentric(c).normalized(); - return _GeoLibOrthoDistD(gca, gcb, gcc); + const auto res = WhirlyKit::Geocentric::OrthoDist(gca, gcb, gcc); + return { std::get<0>(res), std::get<1>(res), std::get<2>(res) }; } namespace { @@ -466,7 +246,8 @@ GeoLibOrthoDist GeoLibOrthoDistD(MaplyCoordinateD a, MaplyCoordinateD b, MaplyCo static inline double normalizeAzimuth(double a) { a = std::fmod(a, M_2PI); - while (a < 0.0) { + while (a < 0.0) + { a += M_2PI; } return a; @@ -529,6 +310,7 @@ static inline double arcSpan(double beginAzimuthRad, double endAzimuthRad, bool TestOrthoDist(); TestLineCircleInt(); TestSampleArc(); + wkLog("GeographicLib Tests Passed"); } void TestDistance() { // Values from 10.5281/zenodo.32156 diff --git a/ios/library/WhirlyGlobeLib/src/GlobeView_iOS.mm b/ios/library/WhirlyGlobeLib/src/GlobeView_iOS.mm index 12edec7a91..d8dce0e2b2 100644 --- a/ios/library/WhirlyGlobeLib/src/GlobeView_iOS.mm +++ b/ios/library/WhirlyGlobeLib/src/GlobeView_iOS.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/30/19. -* Copyright 2011-2019 mousebird consulting +* Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/ImageTile_iOS.mm b/ios/library/WhirlyGlobeLib/src/ImageTile_iOS.mm index 7497fe6731..179e28623c 100644 --- a/ios/library/WhirlyGlobeLib/src/ImageTile_iOS.mm +++ b/ios/library/WhirlyGlobeLib/src/ImageTile_iOS.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/14/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/LayerThread.mm b/ios/library/WhirlyGlobeLib/src/LayerThread.mm index 4c0ab1249c..7426166a6f 100644 --- a/ios/library/WhirlyGlobeLib/src/LayerThread.mm +++ b/ios/library/WhirlyGlobeLib/src/LayerThread.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/2/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -159,9 +159,22 @@ - (void)addChangeRequest:(WhirlyKit::ChangeRequest *)changeRequest - (void)addChangeRequests:(std::vector &)newChangeRequests { + if (self.isCancelled) + { + // We're already shutting down, and we may have already + // cleaned up the pending changes, so just discard these. + for (auto req : newChangeRequests) + { + delete req; + } + newChangeRequests.clear(); + } + if (newChangeRequests.empty()) + { return; - + } + std::lock_guard guardLock(changeLock); // If we don't have one coming, schedule a merge @@ -187,27 +200,19 @@ - (void)requestFlush - (void)runAddChangeRequests { - if ([self isCancelled]) { - std::lock_guard guardLock(changeLock); - for (auto change : changeRequests) { - delete change; - } - changeRequests.clear(); - return; - } - inRunAddChangeRequests = true; for (NSObject *layer in layers) { if ([layer respondsToSelector:@selector(preSceneFlush:)]) [layer preSceneFlush:self]; } inRunAddChangeRequests = false; - + + // Copy the pending changes to a local collection within the mutex. + // We must not return without passing these to the scene or destroying them. std::vector changesToProcess; { std::lock_guard guardLock(changeLock); - changesToProcess = changeRequests; - changeRequests.clear(); + changesToProcess = std::move(changeRequests); } bool requiresFlush = false; @@ -215,15 +220,17 @@ - (void)runAddChangeRequests ChangeSet changesToAdd; for (unsigned int ii=0;iineedsFlush(); change->setupForRenderer(_renderer->getRenderSetupInfo(),_scene); changesToAdd.push_back(changesToProcess[ii]); - } else + } + else + { // A NULL change request is just a flush request requiresFlush = true; + } } // If anything needed a flush after that, let's do it @@ -234,7 +241,8 @@ - (void)runAddChangeRequests if (changesToAdd.empty()) changesToAdd.push_back(nullptr); } - + + // Pass ownership of change requests to the scene _scene->addChangeRequests(changesToAdd); } @@ -311,7 +319,7 @@ - (void)main } [pauseLock unlock]; } - + [NSObject cancelPreviousPerformRequestsWithTarget:self]; [_viewWatcher stop]; diff --git a/ios/library/WhirlyGlobeLib/src/LayerViewWatcher.mm b/ios/library/WhirlyGlobeLib/src/LayerViewWatcher.mm index 2a24870a34..87d6632c6f 100644 --- a/ios/library/WhirlyGlobeLib/src/LayerViewWatcher.mm +++ b/ios/library/WhirlyGlobeLib/src/LayerViewWatcher.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/28/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -132,7 +132,7 @@ - (void)addWatcherTarget:(id)target selector:(SEL)selector minTime:(TimeInterval if (!lastViewState) { const auto __strong thread = layerThread; - if (thread.renderer->framebufferWidth != 0) + if (thread.renderer->getFramebufferSize().x() != 0) { lastViewState = view->makeViewState(thread.renderer); } @@ -189,7 +189,7 @@ - (void)viewUpdated:(View *)inView return; // The view has to be valid first - if (thread.renderer->framebufferWidth <= 0.0) + if (thread.renderer->getFramebufferSize().x() <= 0.0) { // Let's check back every so often [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(viewUpdated:) object:nil]; diff --git a/ios/library/WhirlyGlobeLib/src/LayoutLayer.mm b/ios/library/WhirlyGlobeLib/src/LayoutLayer.mm index 80311d4f50..ebb5a048b7 100644 --- a/ios/library/WhirlyGlobeLib/src/LayoutLayer.mm +++ b/ios/library/WhirlyGlobeLib/src/LayoutLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/4/12. - * Copyright 2011-2019 mousebird consulting. + * Copyright 2011-2022 mousebird consulting. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/MTLView.mm b/ios/library/WhirlyGlobeLib/src/MTLView.mm index ef8db89b93..a1eca62aac 100644 --- a/ios/library/WhirlyGlobeLib/src/MTLView.mm +++ b/ios/library/WhirlyGlobeLib/src/MTLView.mm @@ -1,9 +1,8 @@ -/* - * MTLView.mm +/* MTLView.mm * WhirlyGlobeLib * * Created by Steve Gifford on 5/20/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +14,11 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ #import "MTLView.h" +#import "WhirlyKitLog.h" +#import "SceneRendererMTL.h" using namespace WhirlyKit; @@ -30,13 +30,21 @@ @implementation WhirlyKitMTLView bool animating; } +// defined in WhirlyKitViewWrapper +@synthesize renderer; +@synthesize wrapperDelegate; + - (id)initWithDevice:(id)mtlDevice { - self = [super initWithFrame:CGRectZero device:mtlDevice]; + if (!(self = [super initWithFrame:CGRectZero device:mtlDevice])) + { + return nil; + } self.colorPixelFormat = MTLPixelFormatBGRA8Unorm; self.depthStencilPixelFormat = MTLPixelFormatDepth32Float; - if (@available(iOS 13.0, *)) { + if (@available(iOS 13.0, *)) + { self.depthStencilAttachmentTextureUsage = MTLTextureUsageShaderWrite | MTLTextureUsageShaderRead | MTLTextureUsageRenderTarget; } self.framebufferOnly = true; @@ -51,18 +59,18 @@ - (void)setContentScaleFactor:(CGFloat)contentScaleFactor { super.contentScaleFactor = contentScaleFactor; - if (_renderer) - _renderer->setScale(contentScaleFactor); + if (renderer) + renderer->setScale(contentScaleFactor); } -- (void)setRenderer:(WhirlyKit::SceneRenderer *)renderer +- (void)setRenderer:(WhirlyKit::SceneRenderer *)inRenderer { - SceneRendererMTL *renderMTL = dynamic_cast(renderer); + SceneRendererMTL *renderMTL = dynamic_cast(inRenderer); if (!renderMTL) return; - _renderer = renderer; - _renderer->setScale(self.contentScaleFactor); + self->renderer = inRenderer; + self->renderer->setScale(self.contentScaleFactor); renderMTL->setup(self.frame.size.width, self.frame.size.height,false); } @@ -71,12 +79,23 @@ - (void)layoutSubviews { [super layoutSubviews]; - SceneRendererMTL *renderMTL = dynamic_cast(_renderer); - if (!renderMTL) - return; - - renderMTL->resize((int)self.frame.size.width*self.contentScaleFactor, - (int)self.frame.size.height*self.contentScaleFactor); + if (auto renderMTL = dynamic_cast(renderer)) + { + const CGSize size = self.frame.size; + const auto width = (int)(size.width * self.contentScaleFactor); + const auto height = (int)(size.height * self.contentScaleFactor); + if (width > 0 && height > 0) + { + if (renderMTL->resize(width, height)) + { + [self.wrapperDelegate layoutDidRun]; + } + } + else + { + wkLogLevel(Debug, "Ignoring empty view resize"); + } + } } - (id)getDrawable @@ -88,7 +107,7 @@ - (void)draw { [super draw]; - SceneRendererMTL *renderMTL = dynamic_cast(_renderer); + SceneRendererMTL *renderMTL = dynamic_cast(renderer); if (!renderMTL) return; @@ -125,7 +144,7 @@ - (void) stopAnimation - (void) teardown { - _renderer = nil; + self->renderer = nil; } @end diff --git a/ios/library/WhirlyGlobeLib/src/MapView_iOS.mm b/ios/library/WhirlyGlobeLib/src/MapView_iOS.mm index 4d7eeb38c5..5fb36e4955 100644 --- a/ios/library/WhirlyGlobeLib/src/MapView_iOS.mm +++ b/ios/library/WhirlyGlobeLib/src/MapView_iOS.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/30/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/NSDictionary+Stuff.m b/ios/library/WhirlyGlobeLib/src/NSDictionary+Stuff.m index 58557b21e9..78d628930b 100644 --- a/ios/library/WhirlyGlobeLib/src/NSDictionary+Stuff.m +++ b/ios/library/WhirlyGlobeLib/src/NSDictionary+Stuff.m @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/15/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/NSString+Stuff.mm b/ios/library/WhirlyGlobeLib/src/NSString+Stuff.mm index 55aa317893..eedea3c413 100644 --- a/ios/library/WhirlyGlobeLib/src/NSString+Stuff.mm +++ b/ios/library/WhirlyGlobeLib/src/NSString+Stuff.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/11/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/Platform.mm b/ios/library/WhirlyGlobeLib/src/Platform.mm index 66fdc10ac2..a3c368d751 100644 --- a/ios/library/WhirlyGlobeLib/src/Platform.mm +++ b/ios/library/WhirlyGlobeLib/src/Platform.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 12/13/14. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/ProgramMTL.mm b/ios/library/WhirlyGlobeLib/src/ProgramMTL.mm index 98770e1c0a..81a73c4eb6 100644 --- a/ios/library/WhirlyGlobeLib/src/ProgramMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/ProgramMTL.mm @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/QuadDisplayLayerNew.mm b/ios/library/WhirlyGlobeLib/src/QuadDisplayLayerNew.mm index 1d5599c013..72f0e6d316 100644 --- a/ios/library/WhirlyGlobeLib/src/QuadDisplayLayerNew.mm +++ b/ios/library/WhirlyGlobeLib/src/QuadDisplayLayerNew.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/26/18. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/QuadImageFrameLoader_iOS.mm b/ios/library/WhirlyGlobeLib/src/QuadImageFrameLoader_iOS.mm index d5828d0712..bc3d2d6302 100644 --- a/ios/library/WhirlyGlobeLib/src/QuadImageFrameLoader_iOS.mm +++ b/ios/library/WhirlyGlobeLib/src/QuadImageFrameLoader_iOS.mm @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/18/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/RawData_NSData.mm b/ios/library/WhirlyGlobeLib/src/RawData_NSData.mm index 1e16238e2e..8c041191aa 100644 --- a/ios/library/WhirlyGlobeLib/src/RawData_NSData.mm +++ b/ios/library/WhirlyGlobeLib/src/RawData_NSData.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/23/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/RenderTargetMTL.mm b/ios/library/WhirlyGlobeLib/src/RenderTargetMTL.mm index 99dc9c1ab8..500e00a6d5 100644 --- a/ios/library/WhirlyGlobeLib/src/RenderTargetMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/RenderTargetMTL.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/SceneMTL.mm b/ios/library/WhirlyGlobeLib/src/SceneMTL.mm index dc71923270..5002b820ca 100644 --- a/ios/library/WhirlyGlobeLib/src/SceneMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/SceneMTL.mm @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/SceneRendererMTL.mm b/ios/library/WhirlyGlobeLib/src/SceneRendererMTL.mm index dcad6ab883..9874fbe68d 100644 --- a/ios/library/WhirlyGlobeLib/src/SceneRendererMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/SceneRendererMTL.mm @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,14 +57,14 @@ { } -RenderTargetContainerMTL::RenderTargetContainerMTL(RenderTargetRef renderTarget) -: RenderTargetContainer(renderTarget) +RenderTargetContainerMTL::RenderTargetContainerMTL(RenderTargetRef renderTarget) : + RenderTargetContainer(std::move(renderTarget)) { } RenderTargetContainerRef WorkGroupMTL::makeRenderTargetContainer(RenderTargetRef renderTarget) { - return std::make_shared(renderTarget); + return std::make_shared(std::move(renderTarget)); } SceneRendererMTL::SceneRendererMTL(id mtlDevice,id mtlLibrary, float inScale) @@ -86,15 +86,15 @@ init(); // Calculation shaders - workGroups.push_back(WorkGroupRef(new WorkGroupMTL(WorkGroup::Calculation))); + workGroups.push_back(std::make_shared(WorkGroup::Calculation)); // Offscreen target render group - workGroups.push_back(WorkGroupRef(new WorkGroupMTL(WorkGroup::Offscreen))); + workGroups.push_back(std::make_shared(WorkGroup::Offscreen)); // Middle one for weird stuff - workGroups.push_back(WorkGroupRef(new WorkGroupMTL(WorkGroup::ReduceOps))); + workGroups.push_back(std::make_shared(WorkGroup::ReduceOps)); // Last workgroup is used for on screen rendering - workGroups.push_back(WorkGroupRef(new WorkGroupMTL(WorkGroup::ScreenRender))); + workGroups.push_back(std::make_shared(WorkGroup::ScreenRender)); - scale = inScale; + setScale(inScale); setupInfo.mtlDevice = mtlDevice; setupInfo.uniformBuff = setupInfo.heapManage.allocateBuffer(HeapManagerMTL::Drawable,sizeof(WhirlyKitShader::Uniforms)); setupInfo.lightingBuff = setupInfo.heapManage.allocateBuffer(HeapManagerMTL::Drawable,sizeof(WhirlyKitShader::Lighting)); @@ -137,9 +137,9 @@ defaultTarget->width = sizeX; defaultTarget->height = sizeY; defaultTarget->clearEveryFrame = true; - if (offscreen) { - framebufferWidth = sizeX; - framebufferHeight = sizeY; + if (offscreen) + { + setFramebufferSize(sizeX, sizeY); // Create the texture we'll use right here TextureMTLRef fbTexMTL = TextureMTLRef(new TextureMTL("Framebuffer Texture")); @@ -189,8 +189,7 @@ if (framebufferTex) return false; - framebufferWidth = sizeX; - framebufferHeight = sizeY; + setFramebufferSize(sizeX, sizeY); RenderTargetRef defaultTarget = renderTargets.back(); defaultTarget->width = sizeX; @@ -214,7 +213,7 @@ CopyIntoMtlFloat3(uniforms.eyePos,frameInfo->eyePos); CopyIntoMtlFloat3(uniforms.eyeVec,frameInfo->eyeVec); CopyIntoMtlFloat2(uniforms.screenSizeInDisplayCoords,Point2f(frameInfo->screenSizeInDisplayCoords.x(),frameInfo->screenSizeInDisplayCoords.y())); - Point2f frameSize(frameInfo->sceneRenderer->framebufferWidth,frameInfo->sceneRenderer->framebufferHeight); + const Point2f frameSize = frameInfo->sceneRenderer->getFramebufferSize(); CopyIntoMtlFloat2(uniforms.frameSize, frameSize); uniforms.globeMode = !coordAdapter->isFlat(); uniforms.frameCount = frameCount; @@ -468,7 +467,7 @@ const Eigen::Matrix4f viewTrans = Matrix4dToMatrix4f(viewTrans4d); // Set up a projection matrix - const Point2f frameSize(framebufferWidth,framebufferHeight); + const Point2f frameSize = getFramebufferSize(); const Eigen::Matrix4d projMat4d = theView->calcProjectionMatrix(frameSize,0.0); const Eigen::Matrix4d modelAndViewMat4d = viewTrans4d * modelTrans4d; @@ -521,11 +520,12 @@ frameCount++; - TimeInterval now = scene->getCurrentTime(); + const TimeInterval now = scene->getCurrentTime(); teardownInfo = NULL; - if (framebufferWidth <= 0 || framebufferHeight <= 0) + const Point2f frameSize = getFramebufferSize(); + if (frameSize.x() <= 0 || frameSize.y() <= 0) { // Process the scene even if the window isn't up processScene(now); @@ -557,7 +557,6 @@ Eigen::Matrix4f modelTrans = Matrix4dToMatrix4f(modelTrans4d); // Set up a projection matrix - Point2f frameSize(framebufferWidth,framebufferHeight); Eigen::Matrix4d projMat4d = theView->calcProjectionMatrix(frameSize,0.0); Eigen::Matrix4d modelAndViewMat4d = viewTrans4d * modelTrans4d; @@ -603,7 +602,8 @@ Matrix4d modelTransInv4d = modelTrans4d.inverse(); Vector4d eyeVec4d = modelTransInv4d * Vector4d(0,0,1,0.0); baseFrameInfo.heightAboveSurface = theView->heightAboveSurface(); - if (scene->getCoordAdapter()->isFlat()) { + const bool isFlat = scene->getCoordAdapter()->isFlat(); + if (isFlat) { Vector4d eyePos4d = modelTransInv4d * Vector4d(0.0,0.0,0.0,1.0); eyePos4d /= eyePos4d.w(); baseFrameInfo.eyePos = Vector3d(eyePos4d.x(),eyePos4d.y(),eyePos4d.z()); @@ -815,7 +815,11 @@ if (indirectRender) { if (@available(iOS 12.0, *)) { - [cmdEncode setCullMode:MTLCullModeFront]; + // Front-face culling on by default for globes + // Note: Would like to not set this every time + if (!isFlat) { + [cmdEncode setCullMode:MTLCullModeFront]; + } for (const auto &drawGroup : targetContainerMTL->drawGroups) { if (drawGroup->numCommands > 0) { [cmdEncode setDepthStencilState:drawGroup->depthStencil]; @@ -861,10 +865,12 @@ bool lastZBufferWrite = zBufferWrite; bool lastZBufferRead = zBufferRead; - // Backface culling on by default + // Front-face culling on by default for globes // Note: Would like to not set this every time - [cmdEncode setCullMode:MTLCullModeFront]; - + if (!isFlat) { + [cmdEncode setCullMode:MTLCullModeFront]; + } + // Work through the drawables for (const auto &draw : targetContainer->drawables) { auto drawMTL = std::dynamic_pointer_cast(draw); diff --git a/ios/library/WhirlyGlobeLib/src/ScreenObject_iOS.mm b/ios/library/WhirlyGlobeLib/src/ScreenObject_iOS.mm index 84ec6cb140..6f84ce5bba 100644 --- a/ios/library/WhirlyGlobeLib/src/ScreenObject_iOS.mm +++ b/ios/library/WhirlyGlobeLib/src/ScreenObject_iOS.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/8/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/ScreenSpaceDrawableBuilderMTL.mm b/ios/library/WhirlyGlobeLib/src/ScreenSpaceDrawableBuilderMTL.mm index 04144aab21..e78a9ed4c5 100644 --- a/ios/library/WhirlyGlobeLib/src/ScreenSpaceDrawableBuilderMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/ScreenSpaceDrawableBuilderMTL.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/SingleLabel_iOS.mm b/ios/library/WhirlyGlobeLib/src/SingleLabel_iOS.mm index f7c4df20c9..65e850ffd7 100644 --- a/ios/library/WhirlyGlobeLib/src/SingleLabel_iOS.mm +++ b/ios/library/WhirlyGlobeLib/src/SingleLabel_iOS.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/4/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,15 +39,23 @@ // Used to build the drawable string on specific platforms -std::vector SingleLabel_iOS::generateDrawableStrings(PlatformThreadInfo *threadInfo,const LabelInfo *inLabelInfo,const FontTextureManagerRef &inFontTexManager,float &lineHeight,ChangeSet &changes) +std::vector> SingleLabel_iOS::generateDrawableStrings( + PlatformThreadInfo *threadInfo, const LabelInfo *inLabelInfo, + const FontTextureManagerRef &inFontTexManager,float &lineHeight,ChangeSet &changes) { - FontTextureManager_iOSRef fontTexManager = std::dynamic_pointer_cast(inFontTexManager); + auto fontTexManager = dynamic_cast(inFontTexManager.get()); const LabelInfo_iOS *labelInfo = (LabelInfo_iOS *)inLabelInfo; - NSArray *strings = [text componentsSeparatedByString:@"\n"]; - std::vector drawStrs; + std::vector> drawStrs; - if (!fontTexManager) { + if (!fontTexManager || !labelInfo) + { + return drawStrs; + } + + NSArray *strings = [text componentsSeparatedByString:@"\n"]; + if (strings.count == 0) + { return drawStrs; } @@ -58,36 +66,45 @@ if (infoOverride && infoOverride->lineHeight > 0.0) lineHeight = infoOverride->lineHeight; - int whichLine=0; - for (NSString *text in strings) { + float offset = 0.0f; + for (NSString *text in strings) + { // Build the attributed string NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:text]; NSInteger strLen = [attrStr length]; [attrStr addAttribute:NSFontAttributeName value:labelInfo->font range:NSMakeRange(0, strLen)]; if (labelInfo->outlineSize > 0.0) { - UIColor *outlineColor = [UIColor colorWithRed:labelInfo->outlineColor.r/255.0 green:labelInfo->outlineColor.g/255.0 blue:labelInfo->outlineColor.b/255.0 alpha:labelInfo->outlineColor.a/255.0]; - UIColor *textColor = [UIColor colorWithRed:labelInfo->textColor.r/255.0 green:labelInfo->textColor.g/255.0 blue:labelInfo->textColor.b/255.0 alpha:labelInfo->textColor.a/255.0]; - [attrStr addAttribute:kOutlineAttributeSize value:[NSNumber numberWithFloat:labelInfo->outlineSize] range:NSMakeRange(0, strLen)]; - [attrStr addAttribute:kOutlineAttributeColor value:outlineColor range:NSMakeRange(0, strLen)]; - [attrStr addAttribute:NSForegroundColorAttributeName value:textColor range:NSMakeRange(0, strLen)]; + UIColor *outlineColor = [UIColor colorWithRed:labelInfo->outlineColor.r/255.0f + green:labelInfo->outlineColor.g/255.0f + blue:labelInfo->outlineColor.b/255.0f + alpha:labelInfo->outlineColor.a/255.0f]; + UIColor *textColor = [UIColor colorWithRed:labelInfo->textColor.r/255.0f + green:labelInfo->textColor.g/255.0f + blue:labelInfo->textColor.b/255.0f + alpha:labelInfo->textColor.a/255.0f]; + [attrStr addAttribute:kOutlineAttributeSize + value:[NSNumber numberWithFloat:labelInfo->outlineSize] + range:NSMakeRange(0, strLen)]; + [attrStr addAttribute:kOutlineAttributeColor + value:outlineColor range:NSMakeRange(0, strLen)]; + [attrStr addAttribute:NSForegroundColorAttributeName + value:textColor + range:NSMakeRange(0, strLen)]; } - DrawableString *drawStr = fontTexManager->addString(threadInfo, attrStr, changes); - if (!drawStr) - continue; - - // Modify the MBR if this is a multi-line label - if (whichLine > 0) { - drawStr->mbr.ll().y() += lineHeight * whichLine; - drawStr->mbr.ur().y() += lineHeight * whichLine; + if (auto drawStr = fontTexManager->addString(threadInfo, attrStr, changes)) + { + // Modify the MBR if this is a multi-line label + drawStr->mbr.ll().y() += offset; + drawStr->mbr.ur().y() += offset; + + drawStrs.push_back(std::move(drawStr)); } - - drawStrs.push_back(drawStr); - whichLine++; + offset += lineHeight; } return drawStrs; } - + } diff --git a/ios/library/WhirlyGlobeLib/src/TextureMTL.mm b/ios/library/WhirlyGlobeLib/src/TextureMTL.mm index a46fd05f06..90c4cecfb2 100644 --- a/ios/library/WhirlyGlobeLib/src/TextureMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/TextureMTL.mm @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -343,6 +343,7 @@ static RawDataRef ConvertRGBA8888toRGBA5551(const RawDataRef &inData, int width, if (!texData) { desc.usage = MTLTextureUsageRenderTarget | MTLTextureUsageShaderRead; + desc.allowGPUOptimizedContents = false; // todo: maybe we want private for depth/stencil everywhere? // "MTLTextureDescriptor: Depth, Stencil, DepthStencil textures cannot be diff --git a/ios/library/WhirlyGlobeLib/src/Texture_iOS.mm b/ios/library/WhirlyGlobeLib/src/Texture_iOS.mm index 5c0d23bf38..cc2c1fb5ba 100644 --- a/ios/library/WhirlyGlobeLib/src/Texture_iOS.mm +++ b/ios/library/WhirlyGlobeLib/src/Texture_iOS.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/31/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/UIColor+Stuff.mm b/ios/library/WhirlyGlobeLib/src/UIColor+Stuff.mm index 3ee0ff57bd..7454719908 100644 --- a/ios/library/WhirlyGlobeLib/src/UIColor+Stuff.mm +++ b/ios/library/WhirlyGlobeLib/src/UIColor+Stuff.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 3/15/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/UIImage+Stuff.mm b/ios/library/WhirlyGlobeLib/src/UIImage+Stuff.mm index 13e165a260..7c41bbe5c1 100644 --- a/ios/library/WhirlyGlobeLib/src/UIImage+Stuff.mm +++ b/ios/library/WhirlyGlobeLib/src/UIImage+Stuff.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 1/11/11. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/UpdateDisplayLayer.mm b/ios/library/WhirlyGlobeLib/src/UpdateDisplayLayer.mm index 021d4c512d..5d50719716 100644 --- a/ios/library/WhirlyGlobeLib/src/UpdateDisplayLayer.mm +++ b/ios/library/WhirlyGlobeLib/src/UpdateDisplayLayer.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 6/19/12. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/VectorData_iOS.mm b/ios/library/WhirlyGlobeLib/src/VectorData_iOS.mm index d6a315e45a..dbaa7ecf1b 100644 --- a/ios/library/WhirlyGlobeLib/src/VectorData_iOS.mm +++ b/ios/library/WhirlyGlobeLib/src/VectorData_iOS.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 2/6/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/VertexAttributeMTL.mm b/ios/library/WhirlyGlobeLib/src/VertexAttributeMTL.mm index 3dfb06f4a6..4b4a67b32a 100644 --- a/ios/library/WhirlyGlobeLib/src/VertexAttributeMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/VertexAttributeMTL.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/WhirlyKitLog.mm b/ios/library/WhirlyGlobeLib/src/WhirlyKitLog.mm index 0f3a61dc31..39a1fe8c88 100644 --- a/ios/library/WhirlyGlobeLib/src/WhirlyKitLog.mm +++ b/ios/library/WhirlyGlobeLib/src/WhirlyKitLog.mm @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by jmnavarro - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/WideVectorDrawableBuilderMTL.mm b/ios/library/WhirlyGlobeLib/src/WideVectorDrawableBuilderMTL.mm index 479a201b1e..727930c613 100644 --- a/ios/library/WhirlyGlobeLib/src/WideVectorDrawableBuilderMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/WideVectorDrawableBuilderMTL.mm @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/WrapperMTL.mm b/ios/library/WhirlyGlobeLib/src/WrapperMTL.mm index 9866ab7d55..0a3c08b7ee 100644 --- a/ios/library/WhirlyGlobeLib/src/WrapperMTL.mm +++ b/ios/library/WhirlyGlobeLib/src/WrapperMTL.mm @@ -2,7 +2,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2021 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ios/library/WhirlyGlobeLib/src/wkDefaultShaders.metal b/ios/library/WhirlyGlobeLib/src/wkDefaultShaders.metal index 1c8d565247..805550a746 100644 --- a/ios/library/WhirlyGlobeLib/src/wkDefaultShaders.metal +++ b/ios/library/WhirlyGlobeLib/src/wkDefaultShaders.metal @@ -3,7 +3,7 @@ * WhirlyGlobeLib * * Created by Steve Gifford on 5/16/19. - * Copyright 2011-2019 mousebird consulting + * Copyright 2011-2022 mousebird consulting * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -336,7 +336,6 @@ vertex ProjVertexTriA vertexTri_noLight( outVert.position = float4(vertPos,1.0); else { float4 pt = uniforms.pMatrix * (uniforms.mvMatrix * float4(vertPos,1.0) + uniforms.mvMatrixDiff * float4(vertPos,1.0)); - pt /= pt.w; outVert.position = pt; } @@ -364,7 +363,6 @@ vertex ProjVertexTriA vertexTri_noLightExp( outVert.position = float4(vertPos,1.0); else { float4 pt = uniforms.pMatrix * (uniforms.mvMatrix * float4(vertPos,1.0) + uniforms.mvMatrixDiff * float4(vertPos,1.0)); - pt /= pt.w; outVert.position = pt; } @@ -409,7 +407,6 @@ vertex ProjVertexTriA vertexTri_light( else { float4 pt = uniforms.pMatrix * (uniforms.mvMatrix * vertArgs.uniDrawState.singleMat * float4(vert.position,1.0) + uniforms.mvMatrixDiff * vertArgs.uniDrawState.singleMat * float4(vert.position,1.0)); - pt /= pt.w; outVert.position = pt; } @@ -449,7 +446,6 @@ vertex ProjVertexTriA vertexTri_lightExp( else { float4 pt = uniforms.pMatrix * (uniforms.mvMatrix * vertArgs.uniDrawState.singleMat * float4(vert.position,1.0) + uniforms.mvMatrixDiff * vertArgs.uniDrawState.singleMat * float4(vert.position,1.0)); - pt /= pt.w; outVert.position = pt; } @@ -515,7 +511,6 @@ vertex ProjVertexTriB vertexTri_multiTex( else { float4 pt = uniforms.pMatrix * (uniforms.mvMatrix * vertArgs.uniDrawState.singleMat * float4(vert.position,1.0) + uniforms.mvMatrixDiff * vertArgs.uniDrawState.singleMat * float4(vert.position,1.0)); - pt /= pt.w; outVert.position = pt; } outVert.color = resolveLighting(vertPos, @@ -630,7 +625,7 @@ vertex ProjVertexTriWideVec vertexTri_wideVec( float realCenterLine = centerLine * pixScale; float t0 = vert.c0 * (realWidth2 + realCenterLine); - t0 = clamp(t0,-4.0,5.0); + t0 = clamp(t0,-1.0,2.0); float3 dir = normalize(vert.p1 - vert.position); float3 realPosOffset = (vert.p1 - vert.position) * t0 + dir * realWidth2 * vert.offset.y + @@ -642,8 +637,7 @@ vertex ProjVertexTriWideVec vertexTri_wideVec( outVert.texCoord = float2(vert.texInfo.x, texPos); float4 screenPos = uniforms.pMatrix * (uniforms.mvMatrix * float4(pos,1.0) + uniforms.mvMatrixDiff * float4(pos,1.0)) + uniforms.pMatrix * (uniforms.mvMatrix * float4(realPosOffset,0.0) + uniforms.mvMatrixDiff * float4(realPosOffset,0.0)); - screenPos /= screenPos.w; - outVert.position = float4(screenPos.xy,0,1.0); + outVert.position = float4(screenPos.xy,0,screenPos.w); outVert.dotProd = calcGlobeDotProd(uniforms,pos,vert.normal); outVert.w2 = w2; @@ -698,7 +692,7 @@ vertex ProjVertexTriWideVec vertexTri_wideVecExp( float realCenterLine = centerLine * pixScale; float t0 = vert.c0 * (realWidth2 + realCenterLine); - t0 = clamp(t0,-4.0,5.0); + t0 = clamp(t0,-1.0,2.0); float3 dir = normalize(vert.p1 - vert.position); float3 realPosOffset = (vert.p1 - vert.position) * t0 + dir * realWidth2 * vert.offset.y + @@ -710,8 +704,7 @@ vertex ProjVertexTriWideVec vertexTri_wideVecExp( outVert.texCoord = float2(vert.texInfo.x, texPos); float4 screenPos = uniforms.pMatrix * (uniforms.mvMatrix * float4(pos,1.0) + uniforms.mvMatrixDiff * float4(pos,1.0)) + uniforms.pMatrix * (uniforms.mvMatrix * float4(realPosOffset,0.0) + uniforms.mvMatrixDiff * float4(realPosOffset,0.0)); - screenPos /= screenPos.w; - outVert.position = float4(screenPos.xy,0,1.0); + outVert.position = float4(screenPos.xy,0,screenPos.w); outVert.dotProd = calcGlobeDotProd(uniforms,pos,vert.normal); outVert.w2 = w2; @@ -969,7 +962,9 @@ vertex ProjVertexTriWideVecPerf vertexTri_wideVecPerf( outVert.color = color * calculateFade(uniforms,vertArgs.uniDrawState); outVert.w2 = vertArgs.wideVec.w2; - + outVert.edge = vertArgs.wideVec.edge; + outVert.texCoord = float2(interDir,0); + if (isValid && dotProd > 0.0) { if (iPtsValid) { outVert.position = float4(iPts, 0.0, 1.0); @@ -1004,8 +999,10 @@ fragment float4 fragmentTri_wideVecPerf( discard_fragment(); } } + + float edgeAlpha = (vert.edge > 0) ? clamp((1 - abs(vert.texCoord.x)) * vert.w2 / vert.edge, 0.0, 1.0) : 1.0; - return vert.color; + return vert.color * float4(1,1,1,edgeAlpha); }