summaryrefslogtreecommitdiff
path: root/src/mongo/db/geo/big_polygon.h
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 00:22:50 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 10:56:02 -0400
commit9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch)
tree3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/db/geo/big_polygon.h
parent01965cf52bce6976637ecb8f4a622aeb05ab256a (diff)
downloadmongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/db/geo/big_polygon.h')
-rw-r--r--src/mongo/db/geo/big_polygon.h102
1 files changed, 49 insertions, 53 deletions
diff --git a/src/mongo/db/geo/big_polygon.h b/src/mongo/db/geo/big_polygon.h
index c5a913ac05b..9551ecb4b8f 100644
--- a/src/mongo/db/geo/big_polygon.h
+++ b/src/mongo/db/geo/big_polygon.h
@@ -40,82 +40,78 @@
namespace mongo {
- // Simple GeoJSON polygon with a custom CRS identifier as having a strict winding order.
- // The winding order will determine unambiguously the inside/outside of the polygon even
- // if larger than one hemisphere.
- //
- // BigSimplePolygon uses S2Loop internally, which follows a left-foot rule (inside to the
- // left when walking the edge of the polygon, counter-clockwise)
- class BigSimplePolygon : public S2Region {
- public:
-
- BigSimplePolygon();
-
- BigSimplePolygon(S2Loop* loop);
-
- virtual ~BigSimplePolygon();
-
- void Init(S2Loop* loop);
+// Simple GeoJSON polygon with a custom CRS identifier as having a strict winding order.
+// The winding order will determine unambiguously the inside/outside of the polygon even
+// if larger than one hemisphere.
+//
+// BigSimplePolygon uses S2Loop internally, which follows a left-foot rule (inside to the
+// left when walking the edge of the polygon, counter-clockwise)
+class BigSimplePolygon : public S2Region {
+public:
+ BigSimplePolygon();
- double GetArea() const;
+ BigSimplePolygon(S2Loop* loop);
- bool Contains(const S2Polygon& polygon) const;
+ virtual ~BigSimplePolygon();
- bool Contains(const S2Polyline& line) const;
+ void Init(S2Loop* loop);
- // Needs to be this way for S2 compatibility
- bool Contains(S2Point const& point) const;
+ double GetArea() const;
- bool Intersects(const S2Polygon& polygon) const;
+ bool Contains(const S2Polygon& polygon) const;
- bool Intersects(const S2Polyline& line) const;
+ bool Contains(const S2Polyline& line) const;
- bool Intersects(S2Point const& point) const;
+ // Needs to be this way for S2 compatibility
+ bool Contains(S2Point const& point) const;
- // Only used in tests
- void Invert();
+ bool Intersects(const S2Polygon& polygon) const;
- const S2Polygon& GetPolygonBorder() const;
+ bool Intersects(const S2Polyline& line) const;
- const S2Polyline& GetLineBorder() const;
+ bool Intersects(S2Point const& point) const;
- //
- // S2Region interface
- //
+ // Only used in tests
+ void Invert();
- BigSimplePolygon* Clone() const;
+ const S2Polygon& GetPolygonBorder() const;
- S2Cap GetCapBound() const;
+ const S2Polyline& GetLineBorder() const;
- S2LatLngRect GetRectBound() const;
+ //
+ // S2Region interface
+ //
- bool Contains(S2Cell const& cell) const;
+ BigSimplePolygon* Clone() const;
- bool MayIntersect(S2Cell const& cell) const;
+ S2Cap GetCapBound() const;
- bool VirtualContainsPoint(S2Point const& p) const;
+ S2LatLngRect GetRectBound() const;
- void Encode(Encoder* const encoder) const;
+ bool Contains(S2Cell const& cell) const;
- bool Decode(Decoder* const decoder);
+ bool MayIntersect(S2Cell const& cell) const;
- bool DecodeWithinScope(Decoder* const decoder);
+ bool VirtualContainsPoint(S2Point const& p) const;
- private:
+ void Encode(Encoder* const encoder) const;
- std::unique_ptr<S2Loop> _loop;
+ bool Decode(Decoder* const decoder);
- // Cache whether the loop area is at most 2*Pi (the area of hemisphere).
- //
- // S2 guarantees that any loop in a valid (normalized) polygon, no matter a hole
- // or a shell, has to be less than 2*Pi. So if the loop is normalized, it's the same
- // with the border polygon, otherwise, the border polygon is its complement.
- bool _isNormalized;
+ bool DecodeWithinScope(Decoder* const decoder);
- // Cached to do Intersects() and Contains() with S2Polylines.
- mutable std::unique_ptr<S2Polyline> _borderLine;
- mutable std::unique_ptr<S2Polygon> _borderPoly;
- };
+private:
+ std::unique_ptr<S2Loop> _loop;
+ // Cache whether the loop area is at most 2*Pi (the area of hemisphere).
+ //
+ // S2 guarantees that any loop in a valid (normalized) polygon, no matter a hole
+ // or a shell, has to be less than 2*Pi. So if the loop is normalized, it's the same
+ // with the border polygon, otherwise, the border polygon is its complement.
+ bool _isNormalized;
+
+ // Cached to do Intersects() and Contains() with S2Polylines.
+ mutable std::unique_ptr<S2Polyline> _borderLine;
+ mutable std::unique_ptr<S2Polygon> _borderPoly;
+};
}
-