Skip to content

Commit

Permalink
Remove fields related to feature state
Browse files Browse the repository at this point in the history
Move the new fields to GL Native as they are not part of
the GeoJSON specification.
  • Loading branch information
Juha Alanen committed Oct 28, 2019
1 parent b3f4bd4 commit a5571a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 62 deletions.
56 changes: 8 additions & 48 deletions include/mapbox/feature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,79 +101,39 @@ struct feature
geometry_type geometry;
property_map properties;
identifier id;
std::string source;
std::string sourceLayer;
property_map state;

feature()
: geometry(),
properties(),
id(),
source(),
sourceLayer(),
state() {}
id() {}
feature(geometry_type const& geom_)
: geometry(geom_),
properties(),
id(),
source(),
sourceLayer(),
state() {}
id() {}
feature(geometry_type&& geom_)
: geometry(std::move(geom_)),
properties(),
id(),
source(),
sourceLayer(),
state() {}
id() {}
feature(geometry_type const& geom_, property_map const& prop_)
: geometry(geom_),
properties(prop_),
id(),
source(),
sourceLayer(),
state() {}
: geometry(geom_), properties(prop_), id() {}
feature(geometry_type&& geom_, property_map&& prop_)
: geometry(std::move(geom_)),
properties(std::move(prop_)),
id(),
source(),
sourceLayer(),
state() {}
id() {}
feature(geometry_type const& geom_, property_map const& prop_, identifier const& id_)
: geometry(geom_),
properties(prop_),
id(id_),
source(),
sourceLayer(),
state() {}
id(id_) {}
feature(geometry_type&& geom_, property_map&& prop_, identifier&& id_)
: geometry(std::move(geom_)),
properties(std::move(prop_)),
id(std::move(id_)),
source(),
sourceLayer(),
state() {}
feature(geometry_type const& geom_, property_map const& prop_, identifier const& id_, std::string const& source_, std::string const& sourceLayer_, property_map const& state_)
: geometry(geom_),
properties(prop_),
id(id_),
source(source_),
sourceLayer(sourceLayer_),
state(state_) {}
feature(geometry_type&& geom_, property_map&& prop_, identifier&& id_, std::string&& source_, std::string&& sourceLayer_, property_map&& state_)
: geometry(std::move(geom_)),
properties(std::move(prop_)),
id(std::move(id_)),
source(std::move(source_)),
sourceLayer(std::move(sourceLayer_)),
state(std::move(state_)) {}
id(std::move(id_)) {}
};

template <class T>
constexpr bool operator==(feature<T> const& lhs, feature<T> const& rhs)
{
return lhs.id == rhs.id && lhs.geometry == rhs.geometry && lhs.properties == rhs.properties && lhs.source == rhs.source && lhs.sourceLayer == rhs.sourceLayer && lhs.state == rhs.state;
return lhs.id == rhs.id && lhs.geometry == rhs.geometry && lhs.properties == rhs.properties;
}

template <class T>
Expand Down
14 changes: 0 additions & 14 deletions test/feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,6 @@ TEST_CASE("test feature")

CHECK(id1 == id1);
CHECK(id1 != id2);

feature<int64_t> fs1{point<int64_t>()};
feature<int64_t> fs2{point<int64_t>()};

fs1.source = "source1";
fs1.sourceLayer = "sourceLayer1";
fs2.source = "source1";
fs2.sourceLayer = "sourceLayer1";
fs1.state["hover"] = true;
fs2.state["hover"] = true;
CHECK(fs1 == fs2);

fs2.state["hover"] = false;
CHECK(fs1 != fs2);
}

TEST_CASE("test feature collection")
Expand Down

0 comments on commit a5571a3

Please sign in to comment.