Fix memory in QuadEdgeSubdivision (#604)
[geos.git] / src / planargraph / Subgraph.cpp
blob505789ced99a9edd2baa21d6c2b9178b0bead473
1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2006 Refractions Research Inc.
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
13 * Last port: planargraph/Subgraph.java rev. 1.3 (JTS-1.7)
15 **********************************************************************/
17 #include <geos/planargraph/Subgraph.h>
18 #include <geos/planargraph/Edge.h>
19 #include <geos/planargraph/DirectedEdge.h>
21 #include <utility>
22 #include <vector>
24 using namespace std;
26 namespace geos {
27 namespace planargraph {
29 pair<Edge::NonConstSet::iterator, bool>
30 Subgraph::add(Edge *e)
32 pair<Edge::NonConstSet::iterator,bool> p = edges.insert(e);
33 if (!p.second) return p;
35 dirEdges.push_back(e->getDirEdge(0));
36 dirEdges.push_back(e->getDirEdge(1));
37 nodeMap.add(e->getDirEdge(0)->getFromNode());
38 nodeMap.add(e->getDirEdge(1)->getFromNode());
40 return p;
43 } // namespace planargraph
44 } // namespace geos