/********************************************************************** * $Id: SegmentNode.cpp,v 1.5.2.1 2005/05/23 18:41:51 strk Exp $ * * GEOS - Geometry Engine Open Source * http://geos.refractions.net * * 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 Licence as published * by the Free Software Foundation. * See the COPYING file for more information. * **********************************************************************/ #include #include namespace geos { SegmentNode::SegmentNode(Coordinate *newCoord, int nSegmentIndex, double newDist) { //coord=newCoord; coord=new Coordinate(*newCoord); segmentIndex=nSegmentIndex; dist=newDist; } SegmentNode::~SegmentNode() { delete coord; } /** * @return -1 this EdgeIntersection is located before the argument location * @return 0 this EdgeIntersection is at the argument location * @return 1 this EdgeIntersection is located after the argument location */ int SegmentNode::compare(int cSegmentIndex, double cDist) { if (segmentIndex < cSegmentIndex) return -1; if (segmentIndex > cSegmentIndex) return 1; if (distcDist) return 1; return 0; } bool SegmentNode::isEndPoint(int maxSegmentIndex) { if (segmentIndex == 0 && dist == 0.0) return true; if (segmentIndex == maxSegmentIndex) return true; return false; } int SegmentNode::compareTo(void* obj) { SegmentNode *other=(SegmentNode*) obj; return compare(other->segmentIndex, other->dist); } string SegmentNode::print() { ostringstream s; s<toString()<<" seg#="<