1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
/**********************************************************************
* $Id: MaximalEdgeRing.cpp 1820 2006-09-06 16:54:23Z mloskot $
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
* Copyright (C) 2005-2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
* 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.
*
**********************************************************************
*
* Last port: operation/overlay/MaximalEdgeRing.java rev. 1.13
*
**********************************************************************/
#include <geos/operation/overlay/MaximalEdgeRing.h>
#include <geos/operation/overlay/MinimalEdgeRing.h>
#include <geos/geomgraph/EdgeRing.h>
#include <geos/geomgraph/DirectedEdge.h>
#include <geos/geomgraph/Node.h>
#include <geos/geomgraph/EdgeEndStar.h>
#include <geos/geomgraph/DirectedEdgeStar.h>
#include <cassert>
#include <vector>
#ifndef GEOS_DEBUG
#define GEOS_DEBUG 0
#endif
#if GEOS_DEBUG
#include <iostream>
#endif
using namespace std;
using namespace geos::geomgraph;
using namespace geos::geom;
namespace geos {
namespace operation { // geos.operation
namespace overlay { // geos.operation.overlay
/*public*/
// CGAlgorithms obsoleted
MaximalEdgeRing::MaximalEdgeRing(DirectedEdge *start,
const GeometryFactory *geometryFactory)
:
EdgeRing(start, geometryFactory)
{
computePoints(start);
computeRing();
#if GEOS_DEBUG
cerr << "MaximalEdgeRing[" << this << "] ctor" << endl;
#endif
}
/*public*/
MaximalEdgeRing::~MaximalEdgeRing()
{
#if GEOS_DEBUG
cerr << "MaximalEdgeRing[" << this << "] dtor" << endl;
#endif
}
/*public*/
DirectedEdge*
MaximalEdgeRing::getNext(DirectedEdge *de)
{
return de->getNext();
}
/*public*/
void
MaximalEdgeRing::setEdgeRing(DirectedEdge *de,EdgeRing *er)
{
de->setEdgeRing(er);
}
/*public*/
void
MaximalEdgeRing::linkDirectedEdgesForMinimalEdgeRings()
{
DirectedEdge* de=startDe;
do {
Node* node=de->getNode();
EdgeEndStar* ees = node->getEdges();
assert(dynamic_cast<DirectedEdgeStar*>(ees));
DirectedEdgeStar* des = static_cast<DirectedEdgeStar*>(ees);
des->linkMinimalDirectedEdges(this);
de=de->getNext();
} while (de!=startDe);
}
/*public*/
vector<MinimalEdgeRing*>*
MaximalEdgeRing::buildMinimalRings()
{
vector<MinimalEdgeRing*> *minEdgeRings=new vector<MinimalEdgeRing*>;
buildMinimalRings(*minEdgeRings);
return minEdgeRings;
}
/*public*/
void
MaximalEdgeRing::buildMinimalRings(vector<MinimalEdgeRing*>& minEdgeRings)
{
DirectedEdge *de=startDe;
do {
if(de->getMinEdgeRing()==NULL) {
MinimalEdgeRing *minEr=new MinimalEdgeRing(de, geometryFactory);
minEdgeRings.push_back(minEr);
}
de=de->getNext();
} while(de!=startDe);
}
} // namespace geos.operation.overlay
} // namespace geos.operation
} // namespace geos
/**********************************************************************
* $Log$
* Revision 1.19 2006/03/27 16:02:34 strk
* Added INL file for MinimalEdgeRing, added many debugging blocks,
* fixed memory leak in ConnectedInteriorTester (bug #59)
*
* Revision 1.18 2006/03/17 13:24:59 strk
* opOverlay.h header splitted. Reduced header inclusions in operation/overlay implementation files. ElevationMatrixFilter code moved from own file to ElevationMatrix.cpp (ideally a class-private).
*
* Revision 1.17 2006/03/14 17:08:04 strk
* comments cleanup, integrity checks
*
* Revision 1.16 2006/03/09 18:18:39 strk
* Added memory-friendly MaximalEdgeRing::buildMinimalRings() implementation.
* Applied patch to IsValid operation from JTS-1.7.1
*
**********************************************************************/
|