summaryrefslogtreecommitdiff
path: root/src/mongo/db/geo/shapes.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/geo/shapes.h')
-rw-r--r--src/mongo/db/geo/shapes.h19
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