Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/deps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CPMAddPackage(
"EXPECTED_BUILD_TESTS OFF"
"EXPECTED_BUILD_PACKAGE_DEB OFF")
CPMAddPackage(
URI "gh:Klebert-Engineering/simfil@0.6.3#improvement/generic-resolve"
URI "gh:Klebert-Engineering/simfil#byte-array"
OPTIONS
"SIMFIL_WITH_MODEL_JSON ON"
"SIMFIL_SHARED OFF")
Expand Down
2 changes: 1 addition & 1 deletion libs/model/include/mapget/model/featurelayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class TileFeatureLayer : public TileLayer, public simfil::ModelPool
* @param query Simfil query
* @param node Model root node to query
* @param anyMode Auto-wrap expression in `any(...)`
* @param autoWildcard Auto expand constant expressions to `** = <expr>`
* @param autoWildcard Auto expand constant expressions to `** == <expr>`
*/
struct QueryResult {
// The list of values resulting from the query evaluation.
Expand Down
13 changes: 11 additions & 2 deletions libs/model/src/featureid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include <sstream>

#include "mapget/log.h"

namespace mapget
{

Expand Down Expand Up @@ -30,8 +32,11 @@ std::string FeatureId::toString() const

auto addIdPart = [&result](auto&& v)
{
if constexpr (!std::is_same_v<std::decay_t<decltype(v)>, std::monostate>)
if constexpr (std::is_same_v<std::decay_t<decltype(v)>, simfil::ByteArray>) {
raiseFmt("FeatureId part value 'b\"{}\"' cannot be a ByteArray.", v.toHex());
} else if constexpr (!std::is_same_v<std::decay_t<decltype(v)>, std::monostate>) {
result << "." << v;
}
};

// Add common id-part fields
Expand Down Expand Up @@ -94,7 +99,11 @@ KeyValueViewPairs FeatureId::keyValuePairs() const
std::visit(
[&result, &keyStr](auto&& v)
{
if constexpr (!std::is_same_v<std::decay_t<decltype(v)>, std::monostate> && !std::is_same_v<std::decay_t<decltype(v)>, double>) {
using T = std::decay_t<decltype(v)>;
if constexpr (std::is_same_v<T, simfil::ByteArray>) {
raiseFmt("FeatureId part '{}' cannot be a ByteArray.", keyStr ? *keyStr : "<unknown>");
}
else if constexpr (!std::is_same_v<T, std::monostate> && !std::is_same_v<T, double>) {
result.emplace_back(*keyStr, v);
}
},
Expand Down
13 changes: 11 additions & 2 deletions libs/pymapget/binding/py-layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,17 @@ void bindTileLayer(py::module_& m)
std::visit(
[&](auto&& vv)
{
if constexpr (!std::is_same_v<std::decay_t<decltype(vv)>, std::monostate>)
using V = std::decay_t<decltype(vv)>;
if constexpr (std::is_same_v<V, std::monostate>) {
return;
}
else if constexpr (std::is_same_v<V, ByteArray>) {
// Store bytes in hex to keep JSON valid and readable.
self.setInfo(k, vv.toHex());
}
else {
self.setInfo(k, vv);
}
},
v);
},
Expand All @@ -106,7 +115,7 @@ void bindTileLayer(py::module_& m)
R"pbdoc(
Set a JSON field to store sizes, construction times,
and other arbitrary meta-information. The value may be
bool, int, double or string.
bool, int, double or string. ByteArray values are stored as hex strings.
)pbdoc")
.def(
"set_prefix",
Expand Down
Loading