Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

6264 mutable geojson - #6347

Merged
tobrun merged 1 commit into
masterfrom
6264-mutable-geojson
Sep 20, 2016
Merged

tobrun merged 1 commit into
masterfrom
6264-mutable-geojson

Conversation

@tobrun

@tobrun tobrun commented Sep 15, 2016

Copy link
Copy Markdown
Member

References #6264, this PR follows approach as documented in OP:

For GeoJSON data changes, maybe we can get away without batching, and instead just add a loop over tiles in GeoJSONSource::Impl::setGeoJSON, calling GeometryTile::setData on each one with the new data.

cc @mollymerp

@tobrun tobrun added the Core The cross-platform C++ core, aka mbgl label Sep 15, 2016
@mention-bot

Copy link
Copy Markdown

@tobrun, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh, @mourner and @incanus to be potential reviewers.

@jfirebaugh

Copy link
Copy Markdown
Contributor

This approach looks good! Can you refactor it so that the geoJSONOrSupercluster.is<...>() conditionals and get<GeoJSONVTPointer>()->getTile(...) code isn't duplicated between GeoJSONSource::Impl::setGeoJSON and GeoJSONSource::Impl::createTile? This can be done by removing the const mapbox::geometry::feature_collection<int16_t>& features argument from the GeoJSONTile constructor, adding a method void GeoJSONSource::Impl::setTileData(GeoJSONTile&, const OverscaledTileID& tileID) which calls GeoJSONTile::updateData, and calling setTileData from both setGeoJSON and createTile.

@tobrun
tobrun force-pushed the 6264-mutable-geojson branch 2 times, most recently from 5ec8137 to 0b69453 Compare September 20, 2016 12:06
@tobrun tobrun added this to the android-v4.2.0 milestone Sep 20, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe a GeoJSONSource::setTileData method is necessary, only GeoJSONSource::Impl::setTileData. Remember, GeoJSONSource = public core API, GeoJSONSource::Impl = internal API.

@jfirebaugh jfirebaugh Sep 20, 2016 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing nit: for (const auto& item : tiles).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid the need for a static_cast here by assigning to a auto tilePointer = ..., so that the inferred type is std::unique_ptr<GeoJSONTile>. (If the compiler then complains about the return statement, make it return std::move(tilePointer).)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome!

Comment thread src/mbgl/tile/geojson_tile.cpp Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: space before {.

@tobrun
tobrun force-pushed the 6264-mutable-geojson branch from 0b69453 to 728906d Compare September 20, 2016 18:01
@tobrun
tobrun force-pushed the 6264-mutable-geojson branch from 728906d to 41d811b Compare September 20, 2016 18:08
@tobrun
tobrun merged commit 7df9a21 into master Sep 20, 2016
@tobrun
tobrun deleted the 6264-mutable-geojson branch September 20, 2016 18:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Core The cross-platform C++ core, aka mbgl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants