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
|
/**********************************************************************
* $Id: GeometryGraphOperation.cpp,v 1.16 2004/11/17 08:13:16 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 Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/
#include <geos/operation.h>
#include <stdio.h>
namespace geos {
CGAlgorithms* GeometryGraphOperation::cga=new CGAlgorithms();
LineIntersector* GeometryGraphOperation::li=new RobustLineIntersector();
GeometryGraphOperation::GeometryGraphOperation(const Geometry *g0, const Geometry *g1) {
// use the most precise model for the result
if (g0->getPrecisionModel()->compareTo(g1->getPrecisionModel())>=0)
setComputationPrecision(g0->getPrecisionModel());
else
setComputationPrecision(g1->getPrecisionModel());
arg=new vector<GeometryGraph*>(2);
(*arg)[0]=new GeometryGraph(0,g0);
(*arg)[1]=new GeometryGraph(1, g1);
}
GeometryGraphOperation::GeometryGraphOperation(const Geometry *g0) {
setComputationPrecision(g0->getPrecisionModel());
arg=new vector<GeometryGraph*>(1);
(*arg)[0]=new GeometryGraph(0,g0);;
}
const Geometry* GeometryGraphOperation::getArgGeometry(int i) const {
return (*arg)[i]->getGeometry();
}
void GeometryGraphOperation::setComputationPrecision(const PrecisionModel* pm) {
resultPrecisionModel=pm;
li->setPrecisionModel(resultPrecisionModel);
}
GeometryGraphOperation::~GeometryGraphOperation() {
//delete resultPrecisionModel;
//delete arg;
for(int i=0;i<(int)arg->size();i++) {
delete (*arg)[i];
}
delete arg;
}
} // namespace geos
/**********************************************************************
* $Log: GeometryGraphOperation.cpp,v $
* Revision 1.16 2004/11/17 08:13:16 strk
* Indentation changes.
* Some Z_COMPUTATION activated by default.
*
* Revision 1.15 2004/10/21 22:29:54 strk
* Indentation changes and some more COMPUTE_Z rules
*
* Revision 1.14 2004/07/02 13:28:27 strk
* Fixed all #include lines to reflect headers layout change.
* Added client application build tips in README.
*
* Revision 1.13 2004/03/29 06:59:25 ybychkov
* "noding/snapround" package ported (JTS 1.4);
* "operation", "operation/valid", "operation/relate" and "operation/overlay" upgraded to JTS 1.4;
* "geom" partially upgraded.
*
* Revision 1.12 2003/11/07 01:23:42 pramsey
* Add standard CVS headers licence notices and copyrights to all cpp and h
* files.
*
*
**********************************************************************/
|