Skip to content

Commit

Permalink
Implement TileFeatureLayer aspects of Validity/ValidityCollection/Val…
Browse files Browse the repository at this point in the history
…idityPoint.
  • Loading branch information
Waguramu committed Oct 29, 2024
1 parent 22d1572 commit 89cd89b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libs/model/include/mapget/model/attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Geometry;
* AttributeLayer, and may have typed `direction` and
* `validity` fields in addition to other arbitrary object fields.
*/
class Attribute : public simfil::ProceduralObject<2, Attribute>
class Attribute : public simfil::ProceduralObject<2, Attribute, TileFeatureLayer>
{
friend class TileFeatureLayer;
template<typename> friend struct simfil::shared_model_ptr;
Expand Down
2 changes: 2 additions & 0 deletions libs/model/include/mapget/model/attrlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class AttributeLayerList;
* Represents a collection of Attributes which are semantically related.
* For example, all feature attributes which refer to road rules, such
* as speed limits, might belong to the same attribute layer.
* TODO: Convert to use BaseObject
*/
class AttributeLayer : public simfil::Object
{
Expand Down Expand Up @@ -47,6 +48,7 @@ class AttributeLayer : public simfil::Object
/**
* Collection of attribute layers - this is merely a typed dict which
* stores (layer-name, layer) pairs.
* TODO: Convert to use BaseObject
*/
class AttributeLayerList : public simfil::Object
{
Expand Down
2 changes: 2 additions & 0 deletions libs/model/include/mapget/model/feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ class Feature : public simfil::MandatoryDerivedModelNodeBase<TileFeatureLayer>
*/
using simfil::MandatoryDerivedModelNodeBase<TileFeatureLayer>::model;

// TODO: Change relations to use a RelationCollection derived from BaseArray

/**
* Create a new named relation and immediately insert it into the feature.
* Variants:
Expand Down
5 changes: 2 additions & 3 deletions libs/model/src/attr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace mapget
{

Attribute::Attribute(Attribute::Data* data, simfil::ModelConstPtr l, simfil::ModelNodeAddress a)
: simfil::ProceduralObject<2, Attribute>(data->fields_, std::move(l), a), data_(data)
: simfil::ProceduralObject<2, Attribute, TileFeatureLayer>(data->fields_, std::move(l), a), data_(data)
{
if (data_->validity_)
fields_.emplace_back(
Expand Down Expand Up @@ -67,8 +67,7 @@ bool Attribute::forEachField(
model_ptr<SourceDataReferenceCollection> Attribute::sourceDataReferences() const
{
if (data_->sourceDataRefs_) {
auto& layer = dynamic_cast<TileFeatureLayer&>(model());
return layer.resolveSourceDataReferenceCollection(*model_ptr<simfil::ModelNode>::make(model_, data_->sourceDataRefs_));
return model().resolveSourceDataReferenceCollection(*model_ptr<simfil::ModelNode>::make(model_, data_->sourceDataRefs_));
}
return {};
}
Expand Down

0 comments on commit 89cd89b

Please sign in to comment.