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
|
/**********************************************************************
* $Id: IntersectionAdder.cpp 1820 2006-09-06 16:54:23Z mloskot $
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
* Copyright (C) 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: noding/SingleInteriorIntersectionFinder.java rev. ??? (JTS-1.8)
*
**********************************************************************/
#include <geos/noding/SingleInteriorIntersectionFinder.h>
#include <geos/noding/SegmentString.h>
#include <geos/algorithm/LineIntersector.h>
#include <geos/geom/Coordinate.h>
using namespace geos::geom;
namespace geos {
namespace noding { // geos.noding
/*public (override) */
void
SingleInteriorIntersectionFinder::processIntersections(
SegmentString* e0, int segIndex0,
SegmentString* e1, int segIndex1)
{
using geos::geom::Coordinate;
// short-circuit if intersection already found
if (hasIntersection())
return;
// don't bother intersecting a segment with itself
if (e0 == e1 && segIndex0 == segIndex1) return;
const Coordinate& p00 = e0->getCoordinate(segIndex0);
const Coordinate& p01 = e0->getCoordinate(segIndex0 + 1);
const Coordinate& p10 = e1->getCoordinate(segIndex1);
const Coordinate& p11 = e1->getCoordinate(segIndex1 + 1);
li.computeIntersection(p00, p01, p10, p11);
//if (li.hasIntersection() && li.isProper()) Debug.println(li);
if (li.hasIntersection())
{
if (li.isInteriorIntersection())
{
intSegments.resize(4);
intSegments[0] = p00;
intSegments[1] = p01;
intSegments[2] = p10;
intSegments[3] = p11;
interiorIntersection = li.getIntersection(0);
}
}
}
} // namespace geos.noding
} // namespace geos
/**********************************************************************
* $Log$
**********************************************************************/
|