diff options
author | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2014-07-21 14:36:17 -0400 |
---|---|---|
committer | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2014-08-12 17:04:40 -0400 |
commit | cd5c001c43b295ad601b0004f9c31f9d454f5d04 (patch) | |
tree | 72e6279b18ebb7272eac033af74a822ba8e8dd76 /src/mongo/db/geo/shapes.h | |
parent | 712768556e72d1756995c6a7b020b875fb9d6ea9 (diff) | |
download | mongo-cd5c001c43b295ad601b0004f9c31f9d454f5d04.tar.gz |
SERVER-14510 Custom CRS for strict winding order enforcement
Add big polygon parsing and query.
Diffstat (limited to 'src/mongo/db/geo/shapes.h')
-rw-r--r-- | src/mongo/db/geo/shapes.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/mongo/db/geo/shapes.h b/src/mongo/db/geo/shapes.h index 4091ce9357c..074c71d2e4e 100644 --- a/src/mongo/db/geo/shapes.h +++ b/src/mongo/db/geo/shapes.h @@ -34,6 +34,7 @@ #include "mongo/base/owned_pointer_vector.h" #include "mongo/db/jsobj.h" +#include "mongo/db/geo/big_polygon.h" #include "mongo/db/geo/s2.h" #include "third_party/s2/s2cap.h" #include "third_party/s2/s2cell.h" @@ -250,8 +251,9 @@ namespace mongo { // Clearly this isn't right but currently it's sufficient. enum CRS { UNSET, - FLAT, - SPHERE + FLAT, // Equirectangular flat projection (i.e. trivial long/lat projection to flat map) + SPHERE, // WGS84 + STRICT_SPHERE // WGS84 with strict winding order }; // TODO: Make S2 less integral to these types - additional S2 shapes should be an optimization @@ -298,7 +300,11 @@ namespace mongo { PolygonWithCRS() : crs(UNSET) {} - S2Polygon polygon; + scoped_ptr<S2Polygon> s2Polygon; + // Simple polygons with strict winding order may be bigger or smaller than a hemisphere. + // Only used for query. We don't support storing/indexing big polygons. + scoped_ptr<BigSimplePolygon> bigPolygon; + Polygon oldPolygon; CRS crs; }; @@ -347,12 +353,15 @@ namespace mongo { }; // - // Projection functions - we don't project types other than points for now + // Projection functions - we only project following types for now + // - Point + // - Polygon (from STRICT_SPHERE TO SPHERE) // - struct ShapeProjection { static bool supportsProject(const PointWithCRS& point, const CRS crs); + static bool supportsProject(const PolygonWithCRS& polygon, const CRS crs); static void projectInto(PointWithCRS* point, CRS crs); + static void projectInto(PolygonWithCRS* point, CRS crs); }; } // namespace mongo |