From e5e5a22786d83d0dbfc5058cf6df7bfa699fc87a Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Mon, 12 Jun 2023 11:07:43 +0200 Subject: [PATCH] Read performshading from geojson file --- .../src/geojson/geojsonproperties.cpp | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/modules/globebrowsing/src/geojson/geojsonproperties.cpp b/modules/globebrowsing/src/geojson/geojsonproperties.cpp index 594fb49892..b7e768484a 100644 --- a/modules/globebrowsing/src/geojson/geojsonproperties.cpp +++ b/modules/globebrowsing/src/geojson/geojsonproperties.cpp @@ -64,6 +64,8 @@ namespace geojson::propertykeys { constexpr std::string_view AltitudeModeClamp = "clampToGround"; constexpr std::string_view AltitudeModeAbsolute = "absolute"; constexpr std::string_view AltitudeModeRelative = "relativeToGround"; + + constexpr std::string_view PerformShading = "performShading"; } // namespace geojson::propertykeys namespace { @@ -210,7 +212,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo ExtrudeInfo = { "Extrude", "Extrude", - "If true, extrude the mesh or line to intersect the globe", + "If true, extrude the geometry to intersect the globe.Lines/polygons will be" + "extruded with polygons,and points with lines ", openspace::properties::Property::Visibility::User }; @@ -404,16 +407,16 @@ GeoJsonProperties::GeoJsonProperties() addProperty(performShading); altitudeModeOption.addOptions({ - { static_cast(AltitudeMode::Absolute), "Absolute"}, + { static_cast(AltitudeMode::Absolute), "Absolute" }, { static_cast(AltitudeMode::RelativeToGround), "Relative to Ground" } //{ static_cast(AltitudeMode::ClampToGround), "Clamp to Ground" } / TODO: add ClampToGround - }); + }); addProperty(altitudeModeOption); pointAnchorOption.addOptions({ - { static_cast(PointTextureAnchor::Bottom), "Bottom"}, + { static_cast(PointTextureAnchor::Bottom), "Bottom" }, { static_cast(PointTextureAnchor::Center), "Center" } - }); + }); addProperty(pointAnchorOption); addPropertySubOwner(tessellation); @@ -555,6 +558,9 @@ GeoJsonOverrideProperties propsFromGeoJson(const geos::io::GeoJSONFeature& featu )); } } + else if (keyMatches(key, propertykeys::PerformShading, PerformShadingInfo)) { + result.performShading = value.getBoolean(); + } else if (keyMatches(key, propertykeys::Tessellate, TessellationEnabledInfo)) { result.tessellationEnabled = value.getBoolean(); } @@ -563,7 +569,13 @@ GeoJsonOverrideProperties propsFromGeoJson(const geos::io::GeoJSONFeature& featu result.useTessellationLevel = true; result.tessellationLevel = static_cast(value.getNumber()); } - else if (keyMatches(key, propertykeys::TessellationMaxDistance, TessellationDistanceInfo)) { + else if ( + keyMatches( + key, + propertykeys::TessellationMaxDistance, + TessellationDistanceInfo + )) + { result.tessellationDistance = static_cast(value.getNumber()); } };