feat: establish formal raster particle source chain
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "fill_extrusion_layer.hpp"
|
||||
#include "location_indicator_layer.hpp"
|
||||
#include <mbgl/layermanager/particle_validation_layer_factory.hpp>
|
||||
#include <mbgl/layermanager/raster_particle_layer_factory.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
@@ -28,6 +29,7 @@ namespace android {
|
||||
LayerManagerAndroid::LayerManagerAndroid() {
|
||||
// VALIDATION ONLY: JSON style access; intentionally no Android product API/JNI peer.
|
||||
addLayerTypeCoreOnly(std::make_unique<ParticleValidationLayerFactory>());
|
||||
addLayerTypeCoreOnly(std::make_unique<RasterParticleLayerFactory>());
|
||||
#if defined(MBGL_LAYER_FILL_DISABLE_RUNTIME)
|
||||
addLayerTypeCoreOnly(std::make_unique<FillLayerFactory>());
|
||||
#elif !defined(MBGL_LAYER_FILL_DISABLE_ALL)
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"schema": "maplibre-particle-fixture/v1",
|
||||
"fixtureId": "nodata",
|
||||
"fieldType": "WIND",
|
||||
"displayDomain": "GLOBAL",
|
||||
"dataVersion": 1,
|
||||
"timeIndex": 0,
|
||||
"timestamp": null,
|
||||
"bounds": {"west": -180.0, "south": -85.0, "east": 180.0, "north": 85.0},
|
||||
"crs": "EPSG:4326",
|
||||
"grid": {"width": 16, "height": 16, "registration": "node", "origin": "north-west", "rowOrder": "north-to-south", "columnOrder": "west-to-east"},
|
||||
"vector": {"uPositive": "east", "vPositive": "north", "unit": "m/s", "layout": "interleaved-uv", "encoding": "float32-le", "noData": -9999.0, "file": "field.f32"},
|
||||
"mask": {"mode": "none"},
|
||||
"integrity": {"fieldByteLength": 2048, "fieldSha256": "5756a6ac403a435ff001ff7261160de718c4a2964434ba7b9be2bfe74f071ff0"}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"schema": "maplibre-particle-fixture/v1",
|
||||
"fixtureId": "uniform-east",
|
||||
"fieldType": "WIND",
|
||||
"displayDomain": "GLOBAL",
|
||||
"dataVersion": 1,
|
||||
"timeIndex": 0,
|
||||
"timestamp": null,
|
||||
"bounds": {"west": -180.0, "south": -85.0, "east": 180.0, "north": 85.0},
|
||||
"crs": "EPSG:4326",
|
||||
"grid": {"width": 16, "height": 16, "registration": "node", "origin": "north-west", "rowOrder": "north-to-south", "columnOrder": "west-to-east"},
|
||||
"vector": {"uPositive": "east", "vPositive": "north", "unit": "m/s", "layout": "interleaved-uv", "encoding": "float32-le", "noData": -9999.0, "file": "field.f32"},
|
||||
"mask": {"mode": "none"},
|
||||
"integrity": {"fieldByteLength": 2048, "fieldSha256": "0da648fdcf61b5ea6383960583bdc74287c3fa758c6e5a7eb7d234f2d7c3283f"}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"schema": "maplibre-particle-fixture/v1",
|
||||
"fixtureId": "uniform-north",
|
||||
"fieldType": "WIND",
|
||||
"displayDomain": "GLOBAL",
|
||||
"dataVersion": 1,
|
||||
"timeIndex": 0,
|
||||
"timestamp": null,
|
||||
"bounds": {"west": -180.0, "south": -85.0, "east": 180.0, "north": 85.0},
|
||||
"crs": "EPSG:4326",
|
||||
"grid": {"width": 16, "height": 16, "registration": "node", "origin": "north-west", "rowOrder": "north-to-south", "columnOrder": "west-to-east"},
|
||||
"vector": {"uPositive": "east", "vPositive": "north", "unit": "m/s", "layout": "interleaved-uv", "encoding": "float32-le", "noData": -9999.0, "file": "field.f32"},
|
||||
"mask": {"mode": "none"},
|
||||
"integrity": {"fieldByteLength": 2048, "fieldSha256": "20eb0da1812e616cee1740ee8e22a7bda377d6785cc6e7007fb26afa5ab255bc"}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"schema": "maplibre-particle-fixture/v1",
|
||||
"fixtureId": "vortex",
|
||||
"fieldType": "WIND",
|
||||
"displayDomain": "GLOBAL",
|
||||
"dataVersion": 1,
|
||||
"timeIndex": 0,
|
||||
"timestamp": null,
|
||||
"bounds": {"west": -180.0, "south": -85.0, "east": 180.0, "north": 85.0},
|
||||
"crs": "EPSG:4326",
|
||||
"grid": {"width": 16, "height": 16, "registration": "node", "origin": "north-west", "rowOrder": "north-to-south", "columnOrder": "west-to-east"},
|
||||
"vector": {"uPositive": "east", "vPositive": "north", "unit": "m/s", "layout": "interleaved-uv", "encoding": "float32-le", "noData": -9999.0, "file": "field.f32"},
|
||||
"mask": {"mode": "none"},
|
||||
"integrity": {"fieldByteLength": 2048, "fieldSha256": "aa7fd26d5e4605dc363636b99e17c6bb495d51350a5a2cd8abe5bf0ada741c5a"}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import org.maplibre.android.maps.Style
|
||||
import org.maplibre.android.style.layers.PaintPropertyValue
|
||||
import org.maplibre.android.testapp.R
|
||||
|
||||
/** VALIDATION ONLY: Android OpenGL host for the 30-01/30-02 Core RenderLayer experiments. */
|
||||
/** Android OpenGL host for the formal raster-array to raster-particle fixture path. */
|
||||
class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
private lateinit var mapView: MapView
|
||||
private lateinit var maplibreMap: MapLibreMap
|
||||
@@ -72,10 +72,12 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
if (this::maplibreMap.isInitialized) setValidationProperties(active = active, maskMode = MASK_OCEAN_B)
|
||||
}
|
||||
findViewById<Button>(R.id.validationUniformEast).setOnClickListener {
|
||||
if (this::maplibreMap.isInitialized) setValidationProperties(active, maskMode, FIXTURE_UNIFORM_EAST)
|
||||
fixtureMode = FIXTURE_UNIFORM_EAST
|
||||
if (this::maplibreMap.isInitialized) loadValidationStyle(active, enabled)
|
||||
}
|
||||
findViewById<Button>(R.id.validationUniformNorth).setOnClickListener {
|
||||
if (this::maplibreMap.isInitialized) setValidationProperties(active, maskMode, FIXTURE_UNIFORM_NORTH)
|
||||
fixtureMode = FIXTURE_UNIFORM_NORTH
|
||||
if (this::maplibreMap.isInitialized) loadValidationStyle(active, enabled)
|
||||
}
|
||||
findViewById<Button>(R.id.validationDateline).setOnClickListener {
|
||||
maplibreMap.cameraPosition = CameraPosition.Builder().target(LatLng(0.0, 179.0)).zoom(2.0).build()
|
||||
@@ -107,9 +109,8 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
return
|
||||
}
|
||||
layer.setProperties(
|
||||
PaintPropertyValue("particle-validation-active", active),
|
||||
PaintPropertyValue("particle-validation-mask-mode", maskMode),
|
||||
PaintPropertyValue("particle-fixture-mode", fixtureMode)
|
||||
PaintPropertyValue("raster-particle-active", active),
|
||||
PaintPropertyValue("raster-particle-mask-mode", maskMode)
|
||||
)
|
||||
status.text = statusText()
|
||||
Log.i(TAG, "ParticleRender: property update active=$active maskMode=$maskMode fixtureMode=$fixtureMode")
|
||||
@@ -124,9 +125,10 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun validationStyle(active: Boolean, enabled: Boolean): String {
|
||||
val fixtureId = fixtureId()
|
||||
val particleLayer = if (enabled) {
|
||||
"""{"id":"particle-validation-core","type":"particle-validation",
|
||||
"paint":{"particle-validation-active":$active,"particle-validation-mask-mode":$maskMode,"particle-fixture-mode":$fixtureMode}},"""
|
||||
"""{"id":"particle-raster-core","type":"raster-particle","source":"particle-fixture",
|
||||
"paint":{"raster-particle-active":$active,"raster-particle-mask-mode":$maskMode}},"""
|
||||
} else {
|
||||
""
|
||||
}
|
||||
@@ -135,6 +137,12 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
"version": 8,
|
||||
"name": "Particle Core Layer Validation",
|
||||
"sources": {
|
||||
"particle-fixture": {
|
||||
"type": "raster-array",
|
||||
"fixture": "$fixtureId",
|
||||
"metadata": "asset://integration/particle-fixtures/$fixtureId/metadata.json",
|
||||
"field": "asset://integration/particle-fixtures/$fixtureId/field.f32"
|
||||
},
|
||||
"validation-point": {
|
||||
"type": "geojson",
|
||||
"data": {"type":"Feature","geometry":{"type":"Point","coordinates":[0,0]}}
|
||||
@@ -168,13 +176,18 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
mapView.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
private fun fixtureId(): String = when (fixtureMode) {
|
||||
FIXTURE_UNIFORM_NORTH -> "uniform-north"
|
||||
else -> "uniform-east"
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "ParticleValidation"
|
||||
private const val STATE_ACTIVE = "particle_validation.active"
|
||||
private const val STATE_ENABLED = "particle_validation.enabled"
|
||||
private const val STATE_MASK_MODE = "particle_validation.mask_mode"
|
||||
private const val STATE_FIXTURE_MODE = "particle_validation.fixture_mode"
|
||||
private const val PARTICLE_LAYER_ID = "particle-validation-core"
|
||||
private const val PARTICLE_LAYER_ID = "particle-raster-core"
|
||||
private const val MASK_GLOBAL = 0
|
||||
private const val MASK_OCEAN_A = 1
|
||||
private const val MASK_OCEAN_B = 2
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <mbgl/layermanager/line_layer_factory.hpp>
|
||||
#include <mbgl/layermanager/location_indicator_layer_factory.hpp>
|
||||
#include <mbgl/layermanager/particle_validation_layer_factory.hpp>
|
||||
#include <mbgl/layermanager/raster_particle_layer_factory.hpp>
|
||||
#include <mbgl/layermanager/raster_layer_factory.hpp>
|
||||
#include <mbgl/layermanager/symbol_layer_factory.hpp>
|
||||
#include <mbgl/util/logging.hpp>
|
||||
@@ -52,6 +53,7 @@ void LayerManagerDefault::addLayerTypeCoreOnly(std::unique_ptr<mbgl::LayerFactor
|
||||
LayerManagerDefault::LayerManagerDefault() {
|
||||
// VALIDATION ONLY: 30-01 source-less Core RenderLayer experiment.
|
||||
addLayerType(std::make_unique<ParticleValidationLayerFactory>());
|
||||
addLayerType(std::make_unique<RasterParticleLayerFactory>());
|
||||
#if !defined(MBGL_LAYER_FILL_DISABLE_ALL)
|
||||
addLayerType(std::make_unique<FillLayerFactory>());
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user