/src/geos/src/operation/grid/FloodFill.cpp
Line | Count | Source |
1 | | /********************************************************************** |
2 | | * |
3 | | * GEOS - Geometry Engine Open Source |
4 | | * http://geos.osgeo.org |
5 | | * |
6 | | * Copyright (C) 2018-2025 ISciences, LLC |
7 | | * |
8 | | * This is free software; you can redistribute and/or modify it under |
9 | | * the terms of the GNU Lesser General Public Licence as published |
10 | | * by the Free Software Foundation. |
11 | | * See the COPYING file for more information. |
12 | | * |
13 | | **********************************************************************/ |
14 | | |
15 | | #include <geos/operation/grid/FloodFill.h> |
16 | | #include <geos/operation/grid/Grid.h> |
17 | | #include <geos/algorithm/locate/IndexedPointInAreaLocator.h> |
18 | | #include <geos/geom/Location.h> |
19 | | |
20 | | using geos::geom::Geometry; |
21 | | |
22 | | namespace geos::operation::grid { |
23 | | |
24 | | FloodFill::FloodFill(const Geometry& g, const Grid<bounded_extent>& extent) |
25 | 0 | : m_extent{ extent } |
26 | 0 | , m_g{ g } |
27 | 0 | , m_loc{ nullptr } |
28 | 0 | { |
29 | 0 | m_loc = std::make_unique<algorithm::locate::IndexedPointInAreaLocator>(m_g); |
30 | 0 | } |
31 | | |
32 | 0 | FloodFill::~FloodFill() = default; |
33 | | |
34 | | bool |
35 | | FloodFill::cellIsInside(size_t i, size_t j) const |
36 | 0 | { |
37 | 0 | geom::CoordinateXY p( m_extent.getColX(j), m_extent.getRowY(i) ); |
38 | |
|
39 | 0 | return m_loc->locate(&p) == geom::Location::INTERIOR; |
40 | 0 | } |
41 | | |
42 | | } |