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

[core] Fix within expression #16232

Merged
merged 5 commits into from
Mar 5, 2020
Merged

Conversation

zmiao
Copy link
Contributor

@zmiao zmiao commented Feb 26, 2020

  • Fix error within decision when point is on Polygon line
  • This patch will allow different geojson variants to be used as arguments of within expression, like
{
    "type": "Feature",
    "geometry": {
      "type": "Point",
      "coordinates": [
        -199.68749999999997,
        33.137551192346145
      ]
    }
 }
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Point",
        "coordinates": [
          -34.80468749999999,
          32.24997445586331
        ]
      }
    }
]
}
{
    "type": "Point",
    "coordinates": [
      -199.68749999999997,
      33.137551192346145
    ]
}

@zmiao zmiao force-pushed the zmiao-within-support-different-geojson branch from aa97495 to 2d3d22f Compare February 26, 2020 11:21
@zmiao zmiao changed the title [core] Make within expression support generic geoJSON data [core] Fix within expression Feb 28, 2020
@zmiao zmiao force-pushed the zmiao-within-support-different-geojson branch 2 times, most recently from 277199e to 2d18b5f Compare March 4, 2020 09:41
@zmiao zmiao self-assigned this Mar 4, 2020
@zmiao zmiao marked this pull request as ready for review March 4, 2020 10:27
src/mbgl/style/expression/within.cpp Outdated Show resolved Hide resolved
src/mbgl/util/geometry_within.cpp Show resolved Hide resolved
src/mbgl/util/geometry_within.cpp Show resolved Hide resolved
src/mbgl/style/expression/within.cpp Show resolved Hide resolved
src/mbgl/style/expression/within.cpp Outdated Show resolved Hide resolved
@zmiao zmiao force-pushed the zmiao-within-support-different-geojson branch from 554a6c1 to 6f794f8 Compare March 4, 2020 21:55
@zmiao zmiao added the needs changelog Indicates PR needs a changelog entry prior to merging. label Mar 4, 2020
Copy link
Contributor

@pozdnyakov pozdnyakov left a comment

Choose a reason for hiding this comment

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

LGTM % comments

ctx.error("'within' expression requires valid geojson source that contains polygon geometry type.");
return nullopt;
}

struct PolygonInfo {
PolygonInfo(const Feature::geometry_type& geometry_, const WithinBBox& bbox_) : geometry(geometry_), bbox(bbox_){};
Copy link
Contributor

Choose a reason for hiding this comment

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

PolygonInfo(Feature::geometry_type geometry_) : geometry(std::move(geometry_)), bbox(calculateBBox(geometry))

@zmiao zmiao force-pushed the zmiao-within-support-different-geojson branch from 6f794f8 to 43e39ad Compare March 5, 2020 15:38
@zmiao zmiao force-pushed the zmiao-within-support-different-geojson branch from 266c1ad to bbb3449 Compare March 5, 2020 17:47
@zmiao zmiao merged commit c9c03b0 into master Mar 5, 2020
@zmiao zmiao deleted the zmiao-within-support-different-geojson branch March 5, 2020 18:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs changelog Indicates PR needs a changelog entry prior to merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants