/src/geos/src/triangulate/tri/TriEdge.cpp
Line | Count | Source |
1 | | /********************************************************************** |
2 | | * |
3 | | * GEOS - Geometry Engine Open Source |
4 | | * http://geos.osgeo.org |
5 | | * |
6 | | * Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca> |
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/geom/Coordinate.h> |
16 | | #include <geos/triangulate/tri/TriEdge.h> |
17 | | #include <geos/export.h> |
18 | | |
19 | | #include <iostream> |
20 | | |
21 | | namespace geos { // geos |
22 | | namespace triangulate { // geos.triangulate |
23 | | namespace tri { // geos.triangulate.tri |
24 | | |
25 | | |
26 | | /* private */ |
27 | | void |
28 | | TriEdge::normalize() |
29 | 0 | { |
30 | 0 | if ( p0.compareTo(p1) < 0 ) { |
31 | 0 | Coordinate tmp = p0; |
32 | 0 | p0 = p1; |
33 | 0 | p1 = tmp; |
34 | 0 | } |
35 | 0 | } |
36 | | |
37 | | |
38 | | /* public */ |
39 | | std::size_t |
40 | | TriEdge::HashCode::operator()(TriEdge const& te) const |
41 | 0 | { |
42 | 0 | geom::Coordinate::HashCode coordHash; |
43 | |
|
44 | 0 | std::size_t result = 17; |
45 | 0 | result ^= coordHash(te.p0); |
46 | 0 | result ^= coordHash(te.p1); |
47 | 0 | return result; |
48 | 0 | } |
49 | | |
50 | | /* public */ |
51 | | bool |
52 | | operator == (TriEdge const& te0, TriEdge const& te1) |
53 | 0 | { |
54 | 0 | return te0.p0 == te1.p0 && te0.p1 == te1.p1; |
55 | 0 | } |
56 | | |
57 | | |
58 | | |
59 | | std::ostream& |
60 | | operator<<(std::ostream& os, const TriEdge& te) |
61 | 0 | { |
62 | 0 | os << "LINESTRING ("; |
63 | 0 | os << te.p0 << ", "; |
64 | 0 | os << te.p1 << ")"; |
65 | 0 | return os; |
66 | 0 | } |
67 | | |
68 | | |
69 | | } // namespace geos.triangulate.tri |
70 | | } // namespace geos.triangulate |
71 | | } // namespace geos |
72 | | |