Skip to content

Commit

Permalink
fix geos/coverage being gitignored
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev committed Nov 29, 2023
1 parent ba314fc commit 3d6a966
Show file tree
Hide file tree
Showing 27 changed files with 4,693 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ deps/libnetcdf/netcdf*.tar.gz
lib/binding
lib/index.d.ts
doc
coverage
/coverage
package-lock.json
yarn.lock
Attic
Expand Down
137 changes: 137 additions & 0 deletions deps/libgeos/geos/include/geos/coverage/Corner.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2021 Paul Ramsey <[email protected]>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/

#pragma once

#include <geos/geom/Envelope.h>
#include <geos/simplify/LinkedLine.h>
#include <geos/export.h>

#include <vector>
#include <memory>
#include <queue>

namespace geos {
namespace simplify {
class LinkedLine;
}
namespace geom {
class Coordinate;
class LineString;
}
}


using geos::geom::Coordinate;
using geos::geom::Envelope;
using geos::geom::LineString;
using geos::simplify::LinkedLine;


namespace geos {
namespace coverage { // geos::coverage


class Corner
{

public:

Corner(const LinkedLine* edge, std::size_t i);

bool isVertex(std::size_t index) const;

inline std::size_t getIndex() const {
return m_index;
}

inline double getArea() const {
return m_area;
};

const Coordinate& prev() const;
const Coordinate& next() const;

Envelope envelope() const;

bool isVertex(const Coordinate& v) const;
bool isBaseline(const Coordinate& p0, const Coordinate& p1) const;
bool intersects(const Coordinate& v) const;
bool isRemoved() const;

const Coordinate& getCoordinate() {
return m_edge->getCoordinate(m_index);
}

std::unique_ptr<LineString> toLineString() const;

inline int compareTo(const Corner& rhs) const {
double area_lhs = getArea();
double area_rhs = rhs.getArea();

if (area_lhs == area_rhs) {
std::size_t index_lhs = getIndex();
std::size_t index_rhs = rhs.getIndex();
if (index_lhs == index_rhs) return 0;
else return index_lhs < index_rhs ? -1 : 1;
}
else
return area_lhs < area_rhs ? -1 : 1;
}

bool operator< (const Corner& rhs) const {
return compareTo(rhs) < 0;
};

bool operator> (const Corner& rhs) const {
return compareTo(rhs) > 0;
};

bool operator==(const Corner& rhs) const {
return compareTo(rhs) == 0;
};

struct Greater {
inline bool operator()(const Corner & a, const Corner & b) const {
return a.compareTo(b) > 0;
}
};

// Order using greater for compatibility with the Java PriorityQueue
// implementation, which returns the smallest item off the top of the
// queue
using PriorityQueue = std::priority_queue<Corner, std::vector<Corner>, Corner::Greater>;


private:

// members
const LinkedLine* m_edge;
std::size_t m_index;
std::size_t m_prev;
std::size_t m_next;
double m_area;

// methods
static double area(const LinkedLine& edge, std::size_t index);

}; // Corner



GEOS_DLL std::ostream& operator<< (std::ostream& os, const Corner& c);


} // geos::coverage
} // geos
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2021 Paul Ramsey <[email protected]>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/

#pragma once

#include <unordered_set>

#include <geos/geom/CoordinateSequenceFilter.h>
#include <geos/geom/Coordinate.h>
#include <geos/geom/LineSegment.h>
#include <geos/export.h>

namespace geos {
namespace geom {
class CoordinateSequence;
class Geometry;
}
}

using geos::geom::Coordinate;
using geos::geom::CoordinateSequence;
using geos::geom::CoordinateSequenceFilter;
using geos::geom::Geometry;
using geos::geom::LineSegment;

namespace geos {
namespace coverage { // geos::coverage

class CoverageBoundarySegmentFinder : public CoordinateSequenceFilter
{


public:

CoverageBoundarySegmentFinder(LineSegment::UnorderedSet& segs)
: m_boundarySegs(segs)
{};

bool isGeometryChanged() const override {
return false;
}

bool isDone() const override {
return false;
}

void filter_ro(const CoordinateSequence& seq, std::size_t i) override;


static LineSegment::UnorderedSet
findBoundarySegments(const std::vector<const Geometry*>& geoms);

static bool isBoundarySegment(
const LineSegment::UnorderedSet& boundarySegs,
const CoordinateSequence* seq,
std::size_t i);

private:

static LineSegment
createSegment(const CoordinateSequence& seq, std::size_t i);


LineSegment::UnorderedSet& m_boundarySegs;


}; // CoverageBoundarySegmentFinder



} // geos::coverage
} // geos
Loading

0 comments on commit 3d6a966

Please sign in to comment.