/src/geos/src/operation/relateng/DimensionLocation.cpp
Line | Count | Source |
1 | | /********************************************************************** |
2 | | * |
3 | | * GEOS - Geometry Engine Open Source |
4 | | * http://geos.osgeo.org |
5 | | * |
6 | | * Copyright (c) 2024 Martin Davis |
7 | | * Copyright (C) 2024 Paul Ramsey <pramsey@cleverelephant.ca> |
8 | | * |
9 | | * This is free software; you can redistribute and/or modify it under |
10 | | * the terms of the GNU Lesser General Public Licence as published |
11 | | * by the Free Software Foundation. |
12 | | * See the COPYING file for more information. |
13 | | * |
14 | | **********************************************************************/ |
15 | | |
16 | | #include <geos/operation/relateng/DimensionLocation.h> |
17 | | #include <geos/geom/Dimension.h> |
18 | | #include <geos/geom/Location.h> |
19 | | |
20 | | |
21 | | using geos::geom::Location; |
22 | | using geos::geom::Dimension; |
23 | | |
24 | | |
25 | | namespace geos { // geos |
26 | | namespace operation { // geos.operation |
27 | | namespace relateng { // geos.operation.relateng |
28 | | |
29 | | |
30 | | /* public static */ |
31 | | int |
32 | | DimensionLocation::locationArea(Location loc) |
33 | 0 | { |
34 | 0 | switch (loc) { |
35 | 0 | case Location::INTERIOR: return AREA_INTERIOR; |
36 | 0 | case Location::BOUNDARY: return AREA_BOUNDARY; |
37 | 0 | default: |
38 | 0 | return EXTERIOR; |
39 | 0 | } |
40 | 0 | } |
41 | | |
42 | | |
43 | | /* public static */ |
44 | | int |
45 | | DimensionLocation::locationLine(Location loc) |
46 | 0 | { |
47 | 0 | switch (loc) { |
48 | 0 | case Location::INTERIOR: return LINE_INTERIOR; |
49 | 0 | case Location::BOUNDARY: return LINE_BOUNDARY; |
50 | 0 | default: |
51 | 0 | return EXTERIOR; |
52 | 0 | } |
53 | 0 | } |
54 | | |
55 | | |
56 | | /* public static */ |
57 | | int |
58 | | DimensionLocation::locationPoint(Location loc) |
59 | 0 | { |
60 | 0 | switch (loc) { |
61 | 0 | case Location::INTERIOR: return POINT_INTERIOR; |
62 | 0 | default: |
63 | 0 | return EXTERIOR; |
64 | 0 | } |
65 | 0 | } |
66 | | |
67 | | |
68 | | /* public static */ |
69 | | Location |
70 | | DimensionLocation::location(int dimLoc) |
71 | 0 | { |
72 | 0 | switch (dimLoc) { |
73 | 0 | case POINT_INTERIOR: |
74 | 0 | case LINE_INTERIOR: |
75 | 0 | case AREA_INTERIOR: |
76 | 0 | return Location::INTERIOR; |
77 | 0 | case LINE_BOUNDARY: |
78 | 0 | case AREA_BOUNDARY: |
79 | 0 | return Location::BOUNDARY; |
80 | 0 | default: |
81 | 0 | return Location::EXTERIOR; |
82 | 0 | } |
83 | 0 | } |
84 | | |
85 | | |
86 | | /* public static */ |
87 | | int |
88 | | DimensionLocation::dimension(int dimLoc) |
89 | 0 | { |
90 | 0 | switch (dimLoc) { |
91 | 0 | case POINT_INTERIOR: |
92 | 0 | return Dimension::P; |
93 | 0 | case LINE_INTERIOR: |
94 | 0 | case LINE_BOUNDARY: |
95 | 0 | return Dimension::L; |
96 | 0 | case AREA_INTERIOR: |
97 | 0 | case AREA_BOUNDARY: |
98 | 0 | return Dimension::A; |
99 | 0 | default: |
100 | 0 | return Dimension::False; |
101 | 0 | } |
102 | 0 | } |
103 | | |
104 | | |
105 | | /* public static */ |
106 | | int |
107 | | DimensionLocation::dimension(int dimLoc, int exteriorDim) |
108 | 0 | { |
109 | 0 | if (dimLoc == EXTERIOR) |
110 | 0 | return exteriorDim; |
111 | 0 | else |
112 | 0 | return dimension(dimLoc); |
113 | 0 | } |
114 | | |
115 | | |
116 | | |
117 | | |
118 | | |
119 | | } // namespace geos.operation.overlayng |
120 | | } // namespace geos.operation |
121 | | } // namespace geos |
122 | | |
123 | | |
124 | | |
125 | | |