Apply clang-tidy-4.0 modernize-use-nullptr

Used command:
run-clang-tidy.py -header-filter='.*' -checks='-*,modernize-use-nullptr' -fix

Part of GEOS RFC 5: C++11 Compilation Mode
3.7
Mateusz Loskot 2017-09-09 21:42:52 +02:00
parent 661420a67e
commit 6f0c2bac08
229 changed files with 1574 additions and 1574 deletions

View File

@ -77,7 +77,7 @@ public:
static double nonRobustComputeEdgeDistance(const geom::Coordinate& p,const geom::Coordinate& p1,const geom::Coordinate& p2);
LineIntersector(const geom::PrecisionModel* initialPrecisionModel=NULL)
LineIntersector(const geom::PrecisionModel* initialPrecisionModel=nullptr)
:
precisionModel(initialPrecisionModel),
result(0),

View File

@ -37,7 +37,7 @@ namespace geom { // geos::geom
class GEOS_DLL Lineal : public virtual Geometry
{
protected:
Lineal(): Geometry(0) {}
Lineal(): Geometry(nullptr) {}
};
} // namespace geos::geom

View File

@ -37,7 +37,7 @@ namespace geom { // geos::geom
class GEOS_DLL Polygonal : public virtual Geometry
{
protected:
Polygonal(): Geometry(0) {}
Polygonal(): Geometry(nullptr) {}
};
} // namespace geos::geom

View File

@ -37,7 +37,7 @@ namespace geom { // geos::geom
class GEOS_DLL Puntal : public virtual Geometry
{
protected:
Puntal(): Geometry(0) {}
Puntal(): Geometry(nullptr) {}
};
} // namespace geos::geom

View File

@ -51,7 +51,7 @@ public:
PreparedLineString(const Geometry * geom)
:
BasicPreparedGeometry( geom),
segIntFinder( NULL)
segIntFinder( nullptr)
{ }
~PreparedLineString();

View File

@ -59,7 +59,7 @@ public:
DirectedEdgeStar()
:
EdgeEndStar(),
resultAreaEdgeList(0),
resultAreaEdgeList(nullptr),
label()
{}

View File

@ -214,7 +214,7 @@ public:
index::SegmentIntersector* computeSelfNodes(
algorithm::LineIntersector *li,
bool computeRingSelfNodes,
const geom::Envelope *env=0)
const geom::Envelope *env=nullptr)
{
return computeSelfNodes(*li, computeRingSelfNodes, env);
}
@ -223,7 +223,7 @@ public:
algorithm::LineIntersector *li,
bool computeRingSelfNodes,
bool isDoneIfProperInt,
const geom::Envelope *env=0)
const geom::Envelope *env=nullptr)
{
return computeSelfNodes(*li, computeRingSelfNodes, isDoneIfProperInt, env);
}
@ -232,15 +232,15 @@ public:
// be deprecated.
index::SegmentIntersector* computeSelfNodes(
algorithm::LineIntersector& li,
bool computeRingSelfNodes, const geom::Envelope *env=0);
bool computeRingSelfNodes, const geom::Envelope *env=nullptr);
index::SegmentIntersector* computeSelfNodes(
algorithm::LineIntersector& li,
bool computeRingSelfNodes, bool isDoneIfProperInt, const geom::Envelope *env=0);
bool computeRingSelfNodes, bool isDoneIfProperInt, const geom::Envelope *env=nullptr);
index::SegmentIntersector* computeEdgeIntersections(GeometryGraph *g,
algorithm::LineIntersector *li, bool includeProper,
const geom::Envelope *env=0);
const geom::Envelope *env=nullptr);
std::vector<Edge*> *getEdges();

View File

@ -51,9 +51,9 @@ public:
virtual ~SweepLineEvent();
bool isInsert() { return insertEvent==NULL; }
bool isInsert() { return insertEvent==nullptr; }
bool isDelete() { return insertEvent!=NULL; }
bool isDelete() { return insertEvent!=nullptr; }
SweepLineEvent* getInsertEvent() { return insertEvent; }

View File

@ -71,7 +71,7 @@ public:
static std::vector<MonotoneChain*>* getChains(const geom::CoordinateSequence *pts)
{
return getChains(pts, NULL);
return getChains(pts, nullptr);
}
/** \brief

View File

@ -23,7 +23,7 @@ namespace sweepline { // geos:index:sweepline
class GEOS_DLL SweepLineInterval {
public:
SweepLineInterval(double newMin, double newMax, void* newItem=0);
SweepLineInterval(double newMin, double newMax, void* newItem=nullptr);
double getMin();
double getMax();
void* getItem();

View File

@ -43,7 +43,7 @@ class GEOS_DLL ByteOrderDataInStream {
public:
ByteOrderDataInStream(std::istream *s=NULL);
ByteOrderDataInStream(std::istream *s=nullptr);
~ByteOrderDataInStream();

View File

@ -104,7 +104,7 @@ private:
void execute()
{
if (segInt.get() != NULL) return;
if (segInt.get() != nullptr) return;
checkInteriorIntersections();
}

View File

@ -103,7 +103,7 @@ public:
hasProper(false),
hasProperInterior(false),
hasInterior(false),
properIntersectionPoint(NULL),
properIntersectionPoint(nullptr),
li(newLi),
numIntersections(0),
numInteriorIntersections(0),

View File

@ -76,11 +76,11 @@ private:
public:
MCIndexNoder(SegmentIntersector *nSegInt=NULL)
MCIndexNoder(SegmentIntersector *nSegInt=nullptr)
:
SinglePassNoder(nSegInt),
idCounter(0),
nodedSegStrings(NULL),
nodedSegStrings(nullptr),
nOverlaps(0)
{}

View File

@ -65,8 +65,8 @@ public:
_hasIntersection(false),
_hasProperIntersection(false),
_hasNonProperIntersection(false),
intPt( NULL),
intSegments( NULL)
intPt( nullptr),
intSegments( nullptr)
{ }
~SegmentIntersectionDetector()

View File

@ -39,7 +39,7 @@ class SegmentSetMutualIntersector
public:
SegmentSetMutualIntersector()
: segInt(0)
: segInt(nullptr)
{}
virtual ~SegmentSetMutualIntersector() {}

View File

@ -54,7 +54,7 @@ private:
virtual void computeIntersects(SegmentString *e0, SegmentString *e1);
public:
SimpleNoder(SegmentIntersector* nSegInt=NULL)
SimpleNoder(SegmentIntersector* nSegInt=nullptr)
:
SinglePassNoder(nSegInt)
{}

View File

@ -56,7 +56,7 @@ protected:
public:
SinglePassNoder(SegmentIntersector* nSegInt=NULL): segInt(nSegInt) {}
SinglePassNoder(SegmentIntersector* nSegInt=nullptr): segInt(nSegInt) {}
virtual ~SinglePassNoder() {}

View File

@ -71,7 +71,7 @@ public:
unsigned int vertexIndex);
bool snap(HotPixel& hotPixel) {
return snap(hotPixel, 0, 0);
return snap(hotPixel, nullptr, 0);
}

View File

@ -101,11 +101,11 @@ public:
BufferBuilder(const BufferParameters& nBufParams)
:
bufParams(nBufParams),
workingPrecisionModel(NULL),
li(NULL),
intersectionAdder(NULL),
workingNoder(NULL),
geomFact(NULL),
workingPrecisionModel(nullptr),
li(nullptr),
intersectionAdder(nullptr),
workingNoder(nullptr),
geomFact(nullptr),
edgeList()
{}

View File

@ -171,7 +171,7 @@ public:
:
argGeom(g),
bufParams(),
resultGeometry(NULL)
resultGeometry(nullptr)
{
}
@ -187,7 +187,7 @@ public:
:
argGeom(g),
bufParams(params),
resultGeometry(NULL)
resultGeometry(nullptr)
{
}

View File

@ -83,7 +83,7 @@ public:
OffsetSegmentString()
:
ptList(new geom::CoordinateArraySequence()),
precisionModel(NULL),
precisionModel(nullptr),
minimumVertexDistance (0.0)
{
}
@ -98,7 +98,7 @@ public:
if ( ptList ) ptList->clear();
else ptList = new geom::CoordinateArraySequence();
precisionModel = NULL;
precisionModel = nullptr;
minimumVertexDistance = 0.0;
}
@ -167,7 +167,7 @@ public:
{
closeRing();
geom::CoordinateSequence* ret = ptList;
ptList = 0;
ptList = nullptr;
return ret;
}

View File

@ -202,7 +202,7 @@ public:
LineSequencer()
:
factory(0),
factory(nullptr),
lineCount(0),
isRun(false),
sequencedGeometry(nullptr),

View File

@ -201,7 +201,7 @@ private:
void computeOverlay(OpCode opCode); // throw(TopologyException *);
void insertUniqueEdges(std::vector<geomgraph::Edge*> *edges, const geom::Envelope *env=0);
void insertUniqueEdges(std::vector<geomgraph::Edge*> *edges, const geom::Envelope *env=nullptr);
/*
* If either of the GeometryLocations for the existing label is
@ -241,7 +241,7 @@ private:
* but in the original arg Geometry it is actually
* in the interior due to the Boundary Determination Rule)
*/
void copyPoints(int argIndex, const geom::Envelope *env=0);
void copyPoints(int argIndex, const geom::Envelope *env=nullptr);
/** \brief
* Compute initial labelling for all DirectedEdges at each node.

View File

@ -82,7 +82,7 @@ public:
PointBuilder(OverlayOp *newOp,
const geom::GeometryFactory *newGeometryFactory,
algorithm::PointLocator *newPtLocator=NULL)
algorithm::PointLocator *newPtLocator=nullptr)
:
op(newOp),
geometryFactory(newGeometryFactory),

View File

@ -147,7 +147,7 @@ public:
*/
CascadedPolygonUnion(std::vector<geom::Polygon*>* polys)
: inputPolys(polys),
geomFactory(NULL)
geomFactory(nullptr)
{}
/**

View File

@ -105,7 +105,7 @@ public:
*/
CascadedUnion(const std::vector<geom::Geometry*>* geoms)
: inputGeoms(geoms),
geomFactory(NULL)
geomFactory(nullptr)
{}
/**

View File

@ -54,7 +54,7 @@ public:
geom::Geometry* getGeometry(std::size_t index)
{
if (index >= this->base_type::size())
return NULL;
return nullptr;
return (*this)[index];
}

View File

@ -118,7 +118,7 @@ public:
template <class T>
UnaryUnionOp(const T& geoms)
:
geomFact(0)
geomFact(nullptr)
{
extractGeoms(geoms);
}

View File

@ -225,7 +225,7 @@ public:
:
parentGeometry(geom),
isChecked(false),
validErr(NULL),
validErr(nullptr),
isSelfTouchingRingFormingHoleValid(false)
{}

View File

@ -61,7 +61,7 @@ public:
:
graph(newGraph),
rings(),
nestedPt(NULL)
nestedPt(nullptr)
{}
~SimpleNestedRingTester() {

View File

@ -75,7 +75,7 @@ public:
graph(newGraph),
rings(),
sweepLine(new index::sweepline::SweepLineIndex()),
nestedPt(NULL)
nestedPt(nullptr)
{}
~SweeplineNestedRingTester()

View File

@ -108,7 +108,7 @@ public:
GeometryPrecisionReducer(const geom::PrecisionModel &pm)
:
newFactory(0),
newFactory(nullptr),
targetPM(pm),
removeCollapsed(true),
isPointwise(false)

View File

@ -73,13 +73,13 @@ public:
/** \brief start a new timer */
void start() {
gettimeofday(&starttime, NULL);
gettimeofday(&starttime, nullptr);
}
/** \brief stop current timer */
void stop()
{
gettimeofday(&stoptime, NULL);
gettimeofday(&stoptime, nullptr);
double elapsed = 1000000*(stoptime.tv_sec-starttime.tv_sec)+
(stoptime.tv_usec-starttime.tv_usec);

View File

@ -481,7 +481,7 @@ ConvexHull::lineOrPolygon(const Coordinate::ConstVect &input)
}
CoordinateSequence *cl2=toCoordinateSequence(cleaned);
LinearRing *linearRing=geomFactory->createLinearRing(cl2);
return geomFactory->createPolygon(linearRing,NULL);
return geomFactory->createPolygon(linearRing,nullptr);
}
/*private*/
@ -497,7 +497,7 @@ ConvexHull::cleanRing(const Coordinate::ConstVect &original,
assert(last);
assert(original[0]->equals2D(*last));
const Coordinate *prev = NULL;
const Coordinate *prev = nullptr;
for (size_t i=0; i<npts-1; ++i)
{
const Coordinate *curr = original[i];
@ -506,7 +506,7 @@ ConvexHull::cleanRing(const Coordinate::ConstVect &original,
// skip consecutive equal coordinates
if (curr->equals2D(*next)) continue;
if ( prev != NULL && isBetween(*prev, *curr, *next) )
if ( prev != nullptr && isBetween(*prev, *curr, *next) )
{
continue;
}

View File

@ -773,7 +773,7 @@ LineIntersector::intersection(const Coordinate& p1,
#endif
}
if (precisionModel!=NULL) {
if (precisionModel!=nullptr) {
precisionModel->makePrecise(intPtOut);
}

View File

@ -53,8 +53,8 @@ MCPointInRing::MCPointInRing(const LinearRing *newRing)
:
ring(newRing),
interval(),
pts(NULL),
tree(NULL),
pts(nullptr),
tree(nullptr),
crossings(0)
{
buildIndex();

View File

@ -68,12 +68,12 @@ namespace algorithm { // geos.algorithm
MinimumDiameter::MinimumDiameter(const Geometry* newInputGeom)
{
minBaseSeg=new LineSegment();
minWidthPt=NULL;
minWidthPt=nullptr;
minPtIndex=0;
minWidth=0.0;
inputGeom=newInputGeom;
isConvex=false;
convexHullPts=NULL;
convexHullPts=nullptr;
}
/**
@ -89,11 +89,11 @@ MinimumDiameter::MinimumDiameter(const Geometry* newInputGeom)
MinimumDiameter::MinimumDiameter(const Geometry* newInputGeom, const bool newIsConvex)
{
minBaseSeg=new LineSegment();
minWidthPt=NULL;
minWidthPt=nullptr;
minWidth=0.0;
inputGeom=newInputGeom;
isConvex=newIsConvex;
convexHullPts=NULL;
convexHullPts=nullptr;
}
MinimumDiameter::~MinimumDiameter()
@ -152,8 +152,8 @@ MinimumDiameter::getDiameter()
{
computeMinimumDiameter();
// return empty linestring if no minimum width calculated
if (minWidthPt==NULL)
return inputGeom->getFactory()->createLineString(NULL);
if (minWidthPt==nullptr)
return inputGeom->getFactory()->createLineString(nullptr);
Coordinate basePt;
minBaseSeg->project(*minWidthPt, basePt);
@ -169,7 +169,7 @@ void
MinimumDiameter::computeMinimumDiameter()
{
// check if computation is cached
if (minWidthPt!=NULL)
if (minWidthPt!=nullptr)
return;
if (isConvex)
computeWidthConvex(inputGeom);
@ -203,9 +203,9 @@ MinimumDiameter::computeWidthConvex(const Geometry *geom)
case 0:
minWidth=0.0;
delete minWidthPt;
minWidthPt=NULL;
minWidthPt=nullptr;
delete minBaseSeg;
minBaseSeg=NULL;
minBaseSeg=nullptr;
break;
case 1:
minWidth = 0.0;
@ -351,7 +351,7 @@ Geometry* MinimumDiameter::getMinimumRectangle()
seq->setAt(p0, 4); // close
LinearRing* shell = inputGeom->getFactory()->createLinearRing( seq );
return inputGeom->getFactory()->createPolygon( shell, NULL );
return inputGeom->getFactory()->createPolygon( shell, nullptr );
}
double MinimumDiameter::computeC(double a, double b, const Coordinate& p)

View File

@ -35,7 +35,7 @@ namespace algorithm { // geos.algorithm
SIRtreePointInRing::SIRtreePointInRing(LinearRing *newRing):
PointInRing(),
ring(newRing),
sirTree(NULL),
sirTree(nullptr),
crossings(0)
{
buildIndex();

View File

@ -82,10 +82,10 @@ CoordinateSequence::hasRepeatedPoints(const CoordinateSequence *cl)
const Coordinate*
CoordinateSequence::minCoordinate() const
{
const Coordinate* minCoord=NULL;
const Coordinate* minCoord=nullptr;
const std::size_t size=getSize();
for(std::size_t i=0; i<size; i++) {
if(minCoord==NULL || minCoord->compareTo(getAt(i))>0) {
if(minCoord==nullptr || minCoord->compareTo(getAt(i))>0) {
minCoord=&getAt(i);
}
}
@ -95,10 +95,10 @@ CoordinateSequence::minCoordinate() const
const Coordinate*
CoordinateSequence::minCoordinate(CoordinateSequence *cl)
{
const Coordinate* minCoord=NULL;
const Coordinate* minCoord=nullptr;
const std::size_t size=cl->getSize();
for(std::size_t i=0;i<size; i++) {
if(minCoord==NULL || minCoord->compareTo(cl->getAt(i))>0) {
if(minCoord==nullptr || minCoord->compareTo(cl->getAt(i))>0) {
minCoord=&(cl->getAt(i));
}
}
@ -177,7 +177,7 @@ CoordinateSequence::equals(const CoordinateSequence *cl1,
// FIXME: use std::equals()
if (cl1==cl2) return true;
if (cl1==NULL||cl2==NULL) return false;
if (cl1==nullptr||cl2==nullptr) return false;
size_t npts1=cl1->getSize();
if (npts1!=cl2->getSize()) return false;
for (size_t i=0; i<npts1; i++) {

View File

@ -110,9 +110,9 @@ Geometry::Geometry(const GeometryFactory *newFactory)
:
envelope(nullptr),
_factory(newFactory),
_userData(NULL)
_userData(nullptr)
{
if ( _factory == NULL ) {
if ( _factory == nullptr ) {
_factory = GeometryFactory::getDefaultInstance();
}
SRID=_factory->getSRID();
@ -123,7 +123,7 @@ Geometry::Geometry(const Geometry &geom)
:
SRID(geom.getSRID()),
_factory(geom._factory),
_userData(NULL)
_userData(nullptr)
{
if ( geom.envelope.get() )
{
@ -164,7 +164,7 @@ Geometry::hasNullElements(const vector<Geometry *>* lrs)
{
size_t n=lrs->size();
for (size_t i=0; i<n; ++i) {
if ((*lrs)[i]==NULL) {
if ((*lrs)[i]==nullptr) {
return true;
}
}
@ -198,7 +198,7 @@ Point*
Geometry::getCentroid() const
{
Coordinate centPt;
if ( ! getCentroid(centPt) ) return NULL;
if ( ! getCentroid(centPt) ) return nullptr;
// We don't use createPointFromInternalCoord here
// because ::getCentroid() takes care about rounding
@ -223,13 +223,13 @@ Geometry::getInteriorPoint() const
int dim=getDimension();
if (dim==0) {
InteriorPointPoint intPt(this);
if ( ! intPt.getInteriorPoint(interiorPt) ) return NULL;
if ( ! intPt.getInteriorPoint(interiorPt) ) return nullptr;
} else if (dim==1) {
InteriorPointLine intPt(this);
if ( ! intPt.getInteriorPoint(interiorPt) ) return NULL;
if ( ! intPt.getInteriorPoint(interiorPt) ) return nullptr;
} else {
InteriorPointArea intPt(this);
if ( ! intPt.getInteriorPoint(interiorPt) ) return NULL;
if ( ! intPt.getInteriorPoint(interiorPt) ) return nullptr;
}
Point *p=getFactory()->createPointFromInternalCoord(&interiorPt, this);
return p;
@ -256,7 +256,7 @@ void
Geometry::geometryChangedAction()
{
//delete envelope;
envelope.reset(NULL);
envelope.reset(nullptr);
}
bool
@ -544,7 +544,7 @@ Geometry::Union(const Geometry *other) const
if ( isEmpty() ) return other->clone();
if ( other->isEmpty() ) return clone();
Geometry *out = NULL;
Geometry *out = nullptr;
#ifdef SHORTCIRCUIT_PREDICATES
// if envelopes are disjoint return a MULTI geom or
@ -562,7 +562,7 @@ Geometry::Union(const Geometry *other) const
v->reserve(ngeomsThis+ngeomsOther);
if ( NULL != (coll = dynamic_cast<const GeometryCollection *>(this)) )
if ( nullptr != (coll = dynamic_cast<const GeometryCollection *>(this)) )
{
for (size_t i=0; i<ngeomsThis; ++i)
v->push_back(coll->getGeometryN(i)->clone());
@ -570,7 +570,7 @@ Geometry::Union(const Geometry *other) const
v->push_back(this->clone());
}
if ( NULL != (coll = dynamic_cast<const GeometryCollection *>(other)) )
if ( nullptr != (coll = dynamic_cast<const GeometryCollection *>(other)) )
{
for (size_t i=0; i<ngeomsOther; ++i)
v->push_back(coll->getGeometryN(i)->clone());
@ -626,7 +626,7 @@ Geometry::symDifference(const Geometry *other) const
v->reserve(ngeomsThis+ngeomsOther);
if ( NULL != (coll = dynamic_cast<const GeometryCollection *>(this)) )
if ( nullptr != (coll = dynamic_cast<const GeometryCollection *>(this)) )
{
for (size_t i=0; i<ngeomsThis; ++i)
v->push_back(coll->getGeometryN(i)->clone());
@ -634,7 +634,7 @@ Geometry::symDifference(const Geometry *other) const
v->push_back(this->clone());
}
if ( NULL != (coll = dynamic_cast<const GeometryCollection *>(other)) )
if ( nullptr != (coll = dynamic_cast<const GeometryCollection *>(other)) )
{
for (size_t i=0; i<ngeomsOther; ++i)
v->push_back(coll->getGeometryN(i)->clone());

View File

@ -61,7 +61,7 @@ GeometryCollection::GeometryCollection(const GeometryCollection &gc)
GeometryCollection::GeometryCollection(vector<Geometry *> *newGeoms, const GeometryFactory *factory):
Geometry(factory)
{
if (newGeoms==NULL) {
if (newGeoms==nullptr) {
geometries=new vector<Geometry *>();
return;
}

View File

@ -281,7 +281,7 @@ GeometryFactory::toGeometry(const Envelope* envelope) const
coord.y = envelope->getMinY();
cl->add(coord);
Polygon *p = createPolygon(createLinearRing(cl), NULL);
Polygon *p = createPolygon(createLinearRing(cl), nullptr);
return p;
}
@ -296,7 +296,7 @@ GeometryFactory::getPrecisionModel() const
Point*
GeometryFactory::createPoint() const
{
return new Point(NULL, this);
return new Point(nullptr, this);
}
/*public*/
@ -326,7 +326,7 @@ Point*
GeometryFactory::createPoint(const CoordinateSequence &fromCoords) const
{
CoordinateSequence *newCoords = fromCoords.clone();
Point *g = NULL;
Point *g = nullptr;
try {
g = new Point(newCoords,this);
} catch (...) {
@ -341,7 +341,7 @@ GeometryFactory::createPoint(const CoordinateSequence &fromCoords) const
MultiLineString*
GeometryFactory::createMultiLineString() const
{
return new MultiLineString(NULL,this);
return new MultiLineString(nullptr,this);
}
/*public*/
@ -364,7 +364,7 @@ GeometryFactory::createMultiLineString(const vector<Geometry *> &fromLines)
if ( ! line ) throw geos::util::IllegalArgumentException("createMultiLineString called with a vector containing non-LineStrings");
(*newGeoms)[i] = new LineString(*line);
}
MultiLineString *g = NULL;
MultiLineString *g = nullptr;
try {
g = new MultiLineString(newGeoms,this);
} catch (...) {
@ -381,14 +381,14 @@ GeometryFactory::createMultiLineString(const vector<Geometry *> &fromLines)
GeometryCollection*
GeometryFactory::createGeometryCollection() const
{
return new GeometryCollection(NULL,this);
return new GeometryCollection(nullptr,this);
}
/*public*/
Geometry*
GeometryFactory::createEmptyGeometry() const
{
return new GeometryCollection(NULL,this);
return new GeometryCollection(nullptr,this);
}
/*public*/
@ -406,7 +406,7 @@ GeometryFactory::createGeometryCollection(const vector<Geometry *> &fromGeoms) c
for (size_t i=0; i<fromGeoms.size(); i++) {
(*newGeoms)[i] = fromGeoms[i]->clone();
}
GeometryCollection *g = NULL;
GeometryCollection *g = nullptr;
try {
g = new GeometryCollection(newGeoms,this);
} catch (...) {
@ -423,7 +423,7 @@ GeometryFactory::createGeometryCollection(const vector<Geometry *> &fromGeoms) c
MultiPolygon*
GeometryFactory::createMultiPolygon() const
{
return new MultiPolygon(NULL,this);
return new MultiPolygon(nullptr,this);
}
/*public*/
@ -442,7 +442,7 @@ GeometryFactory::createMultiPolygon(const vector<Geometry *> &fromPolys) const
{
(*newGeoms)[i] = fromPolys[i]->clone();
}
MultiPolygon *g = NULL;
MultiPolygon *g = nullptr;
try {
g = new MultiPolygon(newGeoms,this);
} catch (...) {
@ -459,7 +459,7 @@ GeometryFactory::createMultiPolygon(const vector<Geometry *> &fromPolys) const
LinearRing*
GeometryFactory::createLinearRing() const
{
return new LinearRing(NULL,this);
return new LinearRing(nullptr,this);
}
/*public*/
@ -481,7 +481,7 @@ LinearRing*
GeometryFactory::createLinearRing(const CoordinateSequence& fromCoords) const
{
CoordinateSequence *newCoords = fromCoords.clone();
LinearRing *g = NULL;
LinearRing *g = nullptr;
// construction failure will delete newCoords
g = new LinearRing(newCoords, this);
return g;
@ -504,7 +504,7 @@ GeometryFactory::createMultiPoint(const vector<Geometry *> &fromPoints) const
(*newGeoms)[i] = fromPoints[i]->clone();
}
MultiPoint *g = NULL;
MultiPoint *g = nullptr;
try {
g = new MultiPoint(newGeoms,this);
} catch (...) {
@ -521,7 +521,7 @@ GeometryFactory::createMultiPoint(const vector<Geometry *> &fromPoints) const
MultiPoint*
GeometryFactory::createMultiPoint() const
{
return new MultiPoint(NULL, this);
return new MultiPoint(nullptr, this);
}
/*public*/
@ -535,7 +535,7 @@ GeometryFactory::createMultiPoint(const CoordinateSequence &fromCoords) const
Point *pt=createPoint(fromCoords.getAt(i));
pts->push_back(pt);
}
MultiPoint *mp = NULL;
MultiPoint *mp = nullptr;
try {
mp = createMultiPoint(pts);
} catch (...) {
@ -557,7 +557,7 @@ GeometryFactory::createMultiPoint(const std::vector<Coordinate> &fromCoords) con
Point *pt=createPoint(fromCoords[i]);
pts->push_back(pt);
}
MultiPoint *mp = NULL;
MultiPoint *mp = nullptr;
try {
mp = createMultiPoint(pts);
} catch (...) {
@ -572,7 +572,7 @@ GeometryFactory::createMultiPoint(const std::vector<Coordinate> &fromCoords) con
Polygon*
GeometryFactory::createPolygon() const
{
return new Polygon(NULL, NULL, this);
return new Polygon(nullptr, nullptr, this);
}
/*public*/
@ -594,7 +594,7 @@ GeometryFactory::createPolygon(const LinearRing &shell, const vector<Geometry *>
{
(*newHoles)[i] = holes[i]->clone();
}
Polygon *g = NULL;
Polygon *g = nullptr;
try {
g = new Polygon(newRing, newHoles, this);
} catch (...) {
@ -611,7 +611,7 @@ GeometryFactory::createPolygon(const LinearRing &shell, const vector<Geometry *>
LineString *
GeometryFactory::createLineString() const
{
return new LineString(NULL, this);
return new LineString(nullptr, this);
}
/*public*/
@ -643,7 +643,7 @@ GeometryFactory::createLineString(const CoordinateSequence &fromCoords)
const
{
CoordinateSequence *newCoords = fromCoords.clone();
LineString *g = NULL;
LineString *g = nullptr;
// construction failure will delete newCoords
g = new LineString(newCoords, this);
return g;

View File

@ -69,7 +69,7 @@ LineString::reverse() const
void
LineString::validateConstruction()
{
if (points.get()==NULL)
if (points.get()==nullptr)
{
points.reset(getFactory()->getCoordinateSequenceFactory()->create());
return;
@ -118,7 +118,7 @@ LineString::getCoordinates() const
const CoordinateSequence*
LineString::getCoordinatesRO() const
{
assert(0 != points.get());
assert(nullptr != points.get());
return points.get();
}
@ -176,7 +176,7 @@ Point*
LineString::getStartPoint() const
{
if (isEmpty()) {
return NULL;
return nullptr;
//return new Point(NULL,NULL);
}
return getPointN(0);
@ -186,7 +186,7 @@ Point*
LineString::getEndPoint() const
{
if (isEmpty()) {
return NULL;
return nullptr;
//return new Point(NULL,NULL);
}
return getPointN(getNumPoints() - 1);
@ -364,7 +364,7 @@ LineString::compareToSameClass(const Geometry *ls) const
const Coordinate*
LineString::getCoordinate() const
{
if (isEmpty()) return NULL;
if (isEmpty()) return nullptr;
return &(points->getAt(0));
}

View File

@ -84,7 +84,7 @@ Geometry*
MultiLineString::getBoundary() const
{
if (isEmpty()) {
return getFactory()->createGeometryCollection(NULL);
return getFactory()->createGeometryCollection(nullptr);
}
//Geometry *in = toInternalGeometry(this);
GeometryGraph gg(0, this);

View File

@ -48,7 +48,7 @@ Point::Point(CoordinateSequence *newCoords, const GeometryFactory *factory)
Geometry(factory),
coordinates(newCoords)
{
if (coordinates.get()==NULL) {
if (coordinates.get()==nullptr) {
coordinates.reset(factory->getCoordinateSequenceFactory()->create());
return;
}
@ -129,7 +129,7 @@ Point::getY() const
const Coordinate *
Point::getCoordinate() const
{
return coordinates->getSize()!=0 ? &(coordinates->getAt(0)) : NULL;
return coordinates->getSize()!=0 ? &(coordinates->getAt(0)) : nullptr;
}
string
@ -141,7 +141,7 @@ Point::getGeometryType() const
Geometry *
Point::getBoundary() const
{
return getFactory()->createGeometryCollection(NULL);
return getFactory()->createGeometryCollection(nullptr);
}
Envelope::Ptr

View File

@ -73,18 +73,18 @@ Polygon::Polygon(LinearRing *newShell, vector<Geometry *> *newHoles,
const GeometryFactory *newFactory):
Geometry(newFactory)
{
if (newShell==NULL) {
shell=getFactory()->createLinearRing(NULL);
if (newShell==nullptr) {
shell=getFactory()->createLinearRing(nullptr);
}
else
{
if (newHoles != NULL && newShell->isEmpty() && hasNonEmptyElements(newHoles)) {
if (newHoles != nullptr && newShell->isEmpty() && hasNonEmptyElements(newHoles)) {
throw util::IllegalArgumentException("shell is empty but holes are not");
}
shell=newShell;
}
if (newHoles==NULL)
if (newHoles==nullptr)
{
holes=new vector<Geometry *>();
}
@ -151,7 +151,7 @@ Polygon::getCoordinateDimension() const
{
int dimension=2;
if( shell != NULL )
if( shell != nullptr )
dimension = max(dimension,shell->getCoordinateDimension());
size_t nholes=holes->size();
@ -476,7 +476,7 @@ bool
Polygon::isRectangle() const
{
if ( getNumInteriorRing() != 0 ) return false;
assert(shell!=NULL);
assert(shell!=nullptr);
if ( shell->getNumPoints() != 5 ) return false;
const CoordinateSequence &seq = *(shell->getCoordinatesRO());

View File

@ -41,12 +41,12 @@ PreparedGeometryFactory::create( const geom::Geometry * g) const
{
using geos::geom::GeometryTypeId;
if (0 == g)
if (nullptr == g)
{
throw util::IllegalArgumentException("PreparedGeometry constructd with null Geometry object");
}
PreparedGeometry* pg = 0;
PreparedGeometry* pg = nullptr;
switch ( g->getGeometryTypeId() )
{

View File

@ -39,7 +39,7 @@ namespace prep { // geos.geom.prep
// public:
//
PreparedPolygon::PreparedPolygon(const geom::Geometry * geom)
: BasicPreparedGeometry(geom), segIntFinder(0), ptOnGeomLoc(0)
: BasicPreparedGeometry(geom), segIntFinder(nullptr), ptOnGeomLoc(nullptr)
{
isRectangle = getGeometry().isRectangle();
}

View File

@ -61,7 +61,7 @@ GeometryCombiner::GeometryCombiner(std::vector<Geometry*> const& geoms)
GeometryFactory const*
GeometryCombiner::extractFactory(std::vector<Geometry*> const& geoms)
{
return geoms.empty() ? NULL : geoms.front()->getFactory();
return geoms.empty() ? nullptr : geoms.front()->getFactory();
}
Geometry* GeometryCombiner::combine()
@ -76,10 +76,10 @@ Geometry* GeometryCombiner::combine()
}
if (elems.empty()) {
if (geomFactory != NULL) {
return geomFactory->createGeometryCollection(NULL);
if (geomFactory != nullptr) {
return geomFactory->createGeometryCollection(nullptr);
}
return NULL;
return nullptr;
}
// return the "simplest possible" geometry
@ -89,7 +89,7 @@ Geometry* GeometryCombiner::combine()
void
GeometryCombiner::extractElements(Geometry* geom, std::vector<Geometry*>& elems)
{
if (geom == NULL)
if (geom == nullptr)
return;
for (std::size_t i = 0; i < geom->getNumGeometries(); ++i) {

View File

@ -48,7 +48,7 @@ namespace util { // geos.geom.util
* an edited Geometry with the same GeometryFactory as the input Geometry.
*/
GeometryEditor::GeometryEditor(){
factory=NULL;
factory=nullptr;
}
/**
@ -74,7 +74,7 @@ Geometry*
GeometryEditor::edit(const Geometry *geometry, GeometryEditorOperation *operation)
{
// if client did not supply a GeometryFactory, use the one from the input Geometry
if (factory == NULL)
if (factory == nullptr)
factory=geometry->getFactory();
if ( const GeometryCollection *gc =
@ -100,7 +100,7 @@ GeometryEditor::edit(const Geometry *geometry, GeometryEditorOperation *operatio
// Unsupported Geometry classes should be caught in the GeometryEditorOperation.
assert(!static_cast<bool>("SHOULD NEVER GET HERE"));
return NULL;
return nullptr;
}
Polygon*
@ -112,7 +112,7 @@ GeometryEditor::editPolygon(const Polygon *polygon,GeometryEditorOperation *oper
if (newPolygon->isEmpty()) {
//RemoveSelectedPlugIn relies on this behaviour. [Jon Aquino]
if ( newPolygon->getFactory() != factory ) {
Polygon *ret = factory->createPolygon(NULL, NULL);
Polygon *ret = factory->createPolygon(nullptr, nullptr);
delete newPolygon;
return ret;
} else {
@ -127,7 +127,7 @@ GeometryEditor::editPolygon(const Polygon *polygon,GeometryEditorOperation *oper
//RemoveSelectedPlugIn relies on this behaviour. [Jon Aquino]
delete shell;
delete newPolygon;
return factory->createPolygon(NULL,NULL);
return factory->createPolygon(nullptr,nullptr);
}
vector<Geometry*> *holes=new vector<Geometry*>;

View File

@ -54,8 +54,8 @@ namespace util { // geos.geom.util
/*public*/
GeometryTransformer::GeometryTransformer()
:
factory(NULL),
inputGeom(NULL),
factory(nullptr),
inputGeom(nullptr),
pruneEmptyGeometry(true),
preserveGeometryCollectionType(true),
preserveCollections(false),
@ -86,21 +86,21 @@ GeometryTransformer::transform(const Geometry* nInputGeom)
factory = inputGeom->getFactory();
if ( const Point* p=dynamic_cast<const Point*>(inputGeom) )
return transformPoint(p, NULL);
return transformPoint(p, nullptr);
if ( const MultiPoint* mp=dynamic_cast<const MultiPoint*>(inputGeom) )
return transformMultiPoint(mp, NULL);
return transformMultiPoint(mp, nullptr);
if ( const LinearRing* lr=dynamic_cast<const LinearRing*>(inputGeom) )
return transformLinearRing(lr, NULL);
return transformLinearRing(lr, nullptr);
if ( const LineString* ls=dynamic_cast<const LineString*>(inputGeom) )
return transformLineString(ls, NULL);
return transformLineString(ls, nullptr);
if ( const MultiLineString* mls=dynamic_cast<const MultiLineString*>(inputGeom) )
return transformMultiLineString(mls, NULL);
return transformMultiLineString(mls, nullptr);
if ( const Polygon* p=dynamic_cast<const Polygon*>(inputGeom) )
return transformPolygon(p, NULL);
return transformPolygon(p, nullptr);
if ( const MultiPolygon* mp=dynamic_cast<const MultiPolygon*>(inputGeom) )
return transformMultiPolygon(mp, NULL);
return transformMultiPolygon(mp, nullptr);
if ( const GeometryCollection* gc=dynamic_cast<const GeometryCollection*>(inputGeom) )
return transformGeometryCollection(gc, NULL);
return transformGeometryCollection(gc, nullptr);
throw IllegalArgumentException("Unknown Geometry subtype.");
}
@ -165,7 +165,7 @@ GeometryTransformer::transformMultiPoint(
assert(p);
Geometry::Ptr transformGeom = transformPoint(p, geom);
if ( transformGeom.get() == NULL ) continue;
if ( transformGeom.get() == nullptr ) continue;
if ( transformGeom->isEmpty() ) continue;
// If an exception is thrown we'll leak
@ -239,7 +239,7 @@ GeometryTransformer::transformMultiLineString(
assert(l);
Geometry::Ptr transformGeom = transformLineString(l, geom);
if ( transformGeom.get() == NULL ) continue;
if ( transformGeom.get() == nullptr ) continue;
if ( transformGeom->isEmpty() ) continue;
// If an exception is thrown we'll leak
@ -268,7 +268,7 @@ GeometryTransformer::transformPolygon(
assert(lr);
Geometry::Ptr shell = transformLinearRing(lr, geom);
if ( shell.get() == NULL
if ( shell.get() == nullptr
|| ! dynamic_cast<LinearRing*>(shell.get())
|| shell->isEmpty() )
{
@ -284,7 +284,7 @@ GeometryTransformer::transformPolygon(
Geometry::Ptr hole(transformLinearRing(lr, geom));
if ( hole.get() == NULL || hole->isEmpty() ) {
if ( hole.get() == nullptr || hole->isEmpty() ) {
continue;
}
@ -309,7 +309,7 @@ GeometryTransformer::transformPolygon(
{
// would like to use a manager constructor here
vector<Geometry*>* components = new vector<Geometry*>();
if ( shell.get() != NULL ) {
if ( shell.get() != nullptr ) {
components->push_back(shell.release());
}
@ -343,7 +343,7 @@ GeometryTransformer::transformMultiPolygon(
assert(p);
Geometry::Ptr transformGeom = transformPolygon(p, geom);
if ( transformGeom.get() == NULL ) continue;
if ( transformGeom.get() == nullptr ) continue;
if ( transformGeom->isEmpty() ) continue;
// If an exception is thrown we'll leak
@ -371,7 +371,7 @@ GeometryTransformer::transformGeometryCollection(
{
Geometry::Ptr transformGeom = transform(
geom->getGeometryN(i)); // no parent ?
if ( transformGeom.get() == NULL ) continue;
if ( transformGeom.get() == nullptr ) continue;
if ( pruneEmptyGeometry && transformGeom->isEmpty() ) continue;
// If an exception is thrown we'll leak

View File

@ -85,7 +85,7 @@ SineStarFactory::createSineStar() const
geomFact->getCoordinateSequenceFactory()->create( pts.release() )
);
unique_ptr<LinearRing> ring ( geomFact->createLinearRing( cs.release() ) );
unique_ptr<Polygon> poly ( geomFact->createPolygon(ring.release(), 0) );
unique_ptr<Polygon> poly ( geomFact->createPolygon(ring.release(), nullptr) );
return poly;
}

View File

@ -76,11 +76,11 @@ DirectedEdge::DirectedEdge(Edge *newEdge, bool newIsForward):
isForwardVar(newIsForward),
isInResultVar(false),
isVisitedVar(false),
sym(NULL),
next(NULL),
nextMin(NULL),
edgeRing(NULL),
minEdgeRing(NULL)
sym(nullptr),
next(nullptr),
nextMin(nullptr),
edgeRing(nullptr),
minEdgeRing(nullptr)
{
depth[0]=0;
depth[1]=-999;

View File

@ -90,7 +90,7 @@ DirectedEdge*
DirectedEdgeStar::getRightmostEdge()
{
EdgeEndStar::iterator it=begin();
if ( it==end() ) return NULL;
if ( it==end() ) return nullptr;
assert(*it);
assert(dynamic_cast<DirectedEdge*>(*it));
@ -121,7 +121,7 @@ DirectedEdgeStar::getRightmostEdge()
return deLast;
}
assert(0); // found two horizontal edges incident on node
return NULL;
return nullptr;
}
/*public*/
@ -192,7 +192,7 @@ DirectedEdgeStar::updateLabelling(const Label& nodeLabel)
std::vector<DirectedEdge*>*
DirectedEdgeStar::getResultAreaEdges()
{
if (resultAreaEdgeList!=NULL) return resultAreaEdgeList;
if (resultAreaEdgeList!=nullptr) return resultAreaEdgeList;
resultAreaEdgeList=new std::vector<DirectedEdge*>();
@ -216,8 +216,8 @@ DirectedEdgeStar::linkResultDirectedEdges()
// make sure edges are copied to resultAreaEdges list
getResultAreaEdges();
// find first area edge (if any) to start linking at
DirectedEdge *firstOut=NULL;
DirectedEdge *incoming=NULL;
DirectedEdge *firstOut=nullptr;
DirectedEdge *incoming=nullptr;
int state=SCANNING_FOR_INCOMING;
// link edges in CCW order
for (std::vector<DirectedEdge*>::iterator
@ -235,7 +235,7 @@ DirectedEdgeStar::linkResultDirectedEdges()
assert(nextIn);
// record first outgoing edge, in order to link the last incoming edge
if (firstOut==NULL && nextOut->isInResult()) firstOut=nextOut;
if (firstOut==nullptr && nextOut->isInResult()) firstOut=nextOut;
switch (state) {
case SCANNING_FOR_INCOMING:
@ -251,7 +251,7 @@ DirectedEdgeStar::linkResultDirectedEdges()
}
}
if (state==LINKING_TO_OUTGOING) {
if (firstOut==NULL)
if (firstOut==nullptr)
{
throw util::TopologyException("no outgoing dirEdge found",
getCoordinate());
@ -267,8 +267,8 @@ void
DirectedEdgeStar::linkMinimalDirectedEdges(EdgeRing *er)
{
// find first area edge (if any) to start linking at
DirectedEdge *firstOut=NULL;
DirectedEdge *incoming=NULL;
DirectedEdge *firstOut=nullptr;
DirectedEdge *incoming=nullptr;
int state=SCANNING_FOR_INCOMING;
// link edges in CW order
@ -285,7 +285,7 @@ DirectedEdgeStar::linkMinimalDirectedEdges(EdgeRing *er)
assert(nextIn);
// record first outgoing edge, in order to link the last incoming edge
if (firstOut==NULL && nextOut->getEdgeRing()==er) firstOut=nextOut;
if (firstOut==nullptr && nextOut->getEdgeRing()==er) firstOut=nextOut;
switch (state) {
case SCANNING_FOR_INCOMING:
if (nextIn->getEdgeRing()!=er) continue;
@ -301,7 +301,7 @@ DirectedEdgeStar::linkMinimalDirectedEdges(EdgeRing *er)
}
}
if (state==LINKING_TO_OUTGOING) {
assert(firstOut!=NULL); // found null for first outgoing dirEdge
assert(firstOut!=nullptr); // found null for first outgoing dirEdge
assert(firstOut->getEdgeRing()==er); // unable to link last incoming dirEdge
assert(incoming);
incoming->setNextMin(firstOut);
@ -315,8 +315,8 @@ DirectedEdgeStar::linkAllDirectedEdges()
//getEdges();
// find first area edge (if any) to start linking at
DirectedEdge *prevOut=NULL;
DirectedEdge *firstIn=NULL;
DirectedEdge *prevOut=nullptr;
DirectedEdge *firstIn=nullptr;
// link edges in CW order
EdgeEndStar::reverse_iterator rbeginIt=rbegin();
@ -330,8 +330,8 @@ DirectedEdgeStar::linkAllDirectedEdges()
DirectedEdge *nextIn=nextOut->getSym();
assert(nextIn);
if (firstIn==NULL) firstIn=nextIn;
if (prevOut!=NULL) nextIn->setNext(prevOut);
if (firstIn==nullptr) firstIn=nextIn;
if (prevOut!=nullptr) nextIn->setNext(prevOut);
// record outgoing edge, in order to link the last incoming edge
prevOut=nextOut;
}

View File

@ -89,8 +89,8 @@ Edge::~Edge()
Edge::Edge(CoordinateSequence* newPts, const Label& newLabel)
:
GraphComponent(newLabel),
mce(NULL),
env(NULL),
mce(nullptr),
env(nullptr),
isIsolatedVar(true),
depth(),
depthDelta(0),
@ -104,8 +104,8 @@ Edge::Edge(CoordinateSequence* newPts, const Label& newLabel)
Edge::Edge(CoordinateSequence* newPts)
:
GraphComponent(),
mce(NULL),
env(NULL),
mce(nullptr),
env(nullptr),
isIsolatedVar(true),
depth(),
depthDelta(0),
@ -120,7 +120,7 @@ MonotoneChainEdge*
Edge::getMonotoneChainEdge()
{
testInvariant();
if (mce==NULL) mce=new MonotoneChainEdge(this);
if (mce==nullptr) mce=new MonotoneChainEdge(this);
return mce;
}
@ -288,7 +288,7 @@ Envelope*
Edge::getEnvelope()
{
// compute envelope lazily
if (env==NULL)
if (env==nullptr)
{
env=new Envelope();
unsigned int npts=getNumPoints();

View File

@ -42,9 +42,9 @@ using namespace geos::algorithm;
/*public*/
EdgeEnd::EdgeEnd()
:
edge(NULL),
edge(nullptr),
label(),
node(NULL),
node(nullptr),
dx(0.0),
dy(0.0),
quadrant(0)
@ -56,7 +56,7 @@ EdgeEnd::EdgeEnd(Edge* newEdge)
:
edge(newEdge),
label(),
node(NULL),
node(nullptr),
dx(0.0),
dy(0.0),
quadrant(0)
@ -69,7 +69,7 @@ EdgeEnd::EdgeEnd(Edge* newEdge, const Coordinate& newP0,
:
edge(newEdge),
label(newLabel),
node(NULL),
node(nullptr),
dx(0.0),
dy(0.0),
quadrant(0)
@ -83,7 +83,7 @@ EdgeEnd::EdgeEnd(Edge* newEdge, const Coordinate& newP0,
:
edge(newEdge),
label(),
node(NULL),
node(nullptr),
dx(0.0),
dy(0.0),
quadrant(0)

View File

@ -76,7 +76,7 @@ EdgeEnd*
EdgeEndStar::getNextCW(EdgeEnd *ee)
{
EdgeEndStar::iterator it=find(ee);
if ( it==end() ) return NULL;
if ( it==end() ) return nullptr;
if ( it==begin() ) { it=end(); --it; }
else --it;
return *it;

View File

@ -80,7 +80,7 @@ EdgeList::findEqualEdge(Edge *e)
#endif
if ( it != ocaMap.end() ) return it->second;
return 0;
return nullptr;
}
Edge*

View File

@ -64,9 +64,9 @@ EdgeRing::EdgeRing(DirectedEdge *newStart,
edges(),
pts(newGeometryFactory->getCoordinateSequenceFactory()->create()),
label(Location::UNDEF), // new Label(Location::UNDEF)),
ring(NULL),
ring(nullptr),
isHoleVar(false),
shell(NULL)
shell(nullptr)
{
/*
* Commented out to fix different polymorphism in C++ (from Java)
@ -90,7 +90,7 @@ EdgeRing::~EdgeRing()
* destroyed by `ring' dtor and we must not destroy
* it twice.
*/
if ( ring == NULL )
if ( ring == nullptr )
{
delete pts;
}
@ -149,7 +149,7 @@ bool
EdgeRing::isShell()
{
testInvariant();
return (shell==NULL);
return (shell==nullptr);
}
EdgeRing*
@ -163,7 +163,7 @@ void
EdgeRing::setShell(EdgeRing *newShell)
{
shell=newShell;
if (shell!=NULL) shell->addHole(this);
if (shell!=nullptr) shell->addHole(this);
testInvariant();
}
@ -202,7 +202,7 @@ EdgeRing::computeRing()
{
testInvariant();
if (ring!=NULL) return; // don't compute more than once
if (ring!=nullptr) return; // don't compute more than once
ring=geometryFactory->createLinearRing(pts);
isHoleVar=CGAlgorithms::isCCW(pts);
@ -230,7 +230,7 @@ EdgeRing::computePoints(DirectedEdge *newStart)
do {
//util::Assert::isTrue(de!=NULL,"EdgeRing::computePoints: found null Directed Edge");
//assert(de!=NULL); // EdgeRing::computePoints: found null Directed Edge
if(de==NULL)
if(de==nullptr)
throw util::TopologyException(
"EdgeRing::computePoints: found null Directed Edge");
@ -333,7 +333,7 @@ void
EdgeRing::addPoints(Edge *edge, bool isForward, bool isFirstEdge)
{
// EdgeRing::addPoints: can't add points after LinearRing construction
assert(ring==NULL);
assert(ring==nullptr);
assert(edge);
const CoordinateSequence* edgePts=edge->getCoordinates();

View File

@ -547,7 +547,7 @@ GeometryGraph::GeometryGraph(int newArgIndex,
argIndex(newArgIndex),
hasTooFewPointsVar(false)
{
if (parentGeom!=NULL) add(parentGeom);
if (parentGeom!=nullptr) add(parentGeom);
}
GeometryGraph::GeometryGraph(int newArgIndex,
@ -561,13 +561,13 @@ GeometryGraph::GeometryGraph(int newArgIndex,
argIndex(newArgIndex),
hasTooFewPointsVar(false)
{
if (parentGeom!=NULL) add(parentGeom);
if (parentGeom!=nullptr) add(parentGeom);
}
GeometryGraph::GeometryGraph()
:
PlanarGraph(),
parentGeom(NULL),
parentGeom(nullptr),
useBoundaryDeterminationRule(true),
boundaryNodeRule(algorithm::BoundaryNodeRule::getBoundaryOGCSFS()),
argIndex(-1),

View File

@ -28,7 +28,7 @@ namespace geomgraph { // geos.geomgraph
Node *
NodeFactory::createNode(const Coordinate &coord) const
{
return new Node(coord,NULL);
return new Node(coord,nullptr);
}
const NodeFactory &

View File

@ -62,7 +62,7 @@ NodeMap::addNode(const Coordinate& coord)
cerr<<"["<<this<<"] NodeMap::addNode("<<coord.toString()<<")";
#endif
Node *node=find(coord);
if (node==NULL) {
if (node==nullptr) {
#if GEOS_DEBUG
cerr<<" is new"<<endl;
#endif
@ -94,7 +94,7 @@ NodeMap::addNode(Node *n)
#endif
Coordinate *c=const_cast<Coordinate *>(&n->getCoordinate());
Node *node=find(*c);
if (node==NULL) {
if (node==nullptr) {
#if GEOS_DEBUG
cerr<<" is new"<<endl;
#endif
@ -136,7 +136,7 @@ NodeMap::find(const Coordinate& coord) const
NodeMap::const_iterator found=nodeMap.find(c);
if (found==nodeMap.end())
return NULL;
return nullptr;
else
return found->second;
}

View File

@ -111,7 +111,7 @@ PlanarGraph::isBoundaryNode(int geomIndex, const Coordinate& coord)
assert(nodes);
Node *node=nodes->find(coord);
if (node==NULL) return false;
if (node==nullptr) return false;
const Label& label = node->getLabel();
if (! label.isNull() && label.getLocation(geomIndex)==Location::BOUNDARY)
@ -290,7 +290,7 @@ PlanarGraph::findEdgeEnd(Edge *e)
// should test using values rather then pointers ?
if (ee->getEdge()==e) return ee;
}
return NULL;
return nullptr;
}
/*public*/
@ -308,7 +308,7 @@ PlanarGraph::findEdge(const Coordinate& p0, const Coordinate& p1)
if (p0==eCoord->getAt(0) && p1==eCoord->getAt(1))
return e;
}
return NULL;
return nullptr;
}
/*public*/
@ -342,7 +342,7 @@ PlanarGraph::findEdgeInSameDirection(const Coordinate& p0,
}
}
return NULL;
return nullptr;
}
/*private*/

View File

@ -49,7 +49,7 @@ SimpleMCSweepLineIntersector::computeIntersections(vector<Edge*> *edges,
SegmentIntersector *si, bool testAllSegments)
{
if (testAllSegments)
add(edges,NULL);
add(edges,nullptr);
else
add(edges);
computeIntersections(si);
@ -96,7 +96,7 @@ SimpleMCSweepLineIntersector::add(Edge *edge, void* edgeSet)
{
GEOS_CHECK_FOR_INTERRUPTS();
MonotoneChain *mc=new MonotoneChain(mce,i);
SweepLineEvent *insertEvent=new SweepLineEvent(edgeSet,mce->getMinX(i),NULL,mc);
SweepLineEvent *insertEvent=new SweepLineEvent(edgeSet,mce->getMinX(i),nullptr,mc);
events.push_back(insertEvent);
events.push_back(new SweepLineEvent(edgeSet,mce->getMaxX(i),insertEvent,mc));
}
@ -161,7 +161,7 @@ SimpleMCSweepLineIntersector::processOverlaps(int start, int end,
MonotoneChain *mc1=(MonotoneChain*) ev1->getObject();
// don't compare edges in same group
// null group indicates that edges should be compared
if (ev0->edgeSet==NULL || (ev0->edgeSet!=ev1->edgeSet))
if (ev0->edgeSet==nullptr || (ev0->edgeSet!=ev1->edgeSet))
{
mc0->computeIntersections(mc1,si);
nOverlaps++;

View File

@ -47,7 +47,7 @@ SimpleSweepLineIntersector::computeIntersections(vector<Edge*> *edges,
SegmentIntersector *si, bool testAllSegments)
{
if (testAllSegments)
add(edges,NULL);
add(edges,nullptr);
else
add(edges);
computeIntersections(si);
@ -90,7 +90,7 @@ SimpleSweepLineIntersector::add(Edge *edge, void* edgeSet)
for(std::size_t i=0; i<n; ++i)
{
SweepLineSegment *ss=new SweepLineSegment(edge, i);
SweepLineEvent *insertEvent=new SweepLineEvent(edgeSet, ss->getMinX(), NULL, ss);
SweepLineEvent *insertEvent=new SweepLineEvent(edgeSet, ss->getMinX(), nullptr, ss);
events.push_back(insertEvent);
events.push_back(new SweepLineEvent(edgeSet, ss->getMaxX(), insertEvent, ss));
}
@ -148,7 +148,7 @@ SimpleSweepLineIntersector::processOverlaps(int start,int end,SweepLineEvent *ev
if (ev1->isInsert())
{
SweepLineSegment *ss1=(SweepLineSegment*) ev1->getObject();
if (ev0->edgeSet==NULL || (ev0->edgeSet!=ev1->edgeSet))
if (ev0->edgeSet==nullptr || (ev0->edgeSet!=ev1->edgeSet))
{
ss0->computeIntersections(ss1,si);
nOverlaps++;

View File

@ -32,7 +32,7 @@ SweepLineEvent::SweepLineEvent(void* newEdgeSet, double x,
insertEvent(newInsertEvent),
deleteEventIndex(0)
{
if(insertEvent!=NULL) eventType=DELETE_EVENT;
if(insertEvent!=nullptr) eventType=DELETE_EVENT;
else eventType=INSERT_EVENT;
}

View File

@ -66,14 +66,14 @@ Bintree::~Bintree()
int
Bintree::depth()
{
if (root!=NULL) return root->depth();
if (root!=nullptr) return root->depth();
return 0;
}
int
Bintree::size()
{
if (root!=NULL) return root->size();
if (root!=nullptr) return root->size();
return 0;
}
@ -85,7 +85,7 @@ Bintree::size()
int
Bintree::nodeSize()
{
if (root!=NULL) return root->nodeSize();
if (root!=nullptr) return root->nodeSize();
return 0;
}

View File

@ -35,7 +35,7 @@ Key::computeLevel(Interval *newInterval)
Key::Key(Interval *newInterval)
{
interval=NULL;
interval=nullptr;
pt=0.0;
level=0;
computeKey(newInterval);

View File

@ -38,9 +38,9 @@ Node*
Node::createExpanded(Node *node,Interval *addInterval)
{
Interval *expandInt=new Interval(addInterval);
if (node!=NULL) expandInt->expandToInclude(node->interval);
if (node!=nullptr) expandInt->expandToInclude(node->interval);
Node *largerNode=createNode(expandInt);
if (node!=NULL) largerNode->insert(node);
if (node!=nullptr) largerNode->insert(node);
delete expandInt;
return largerNode;
}
@ -99,7 +99,7 @@ Node::find(Interval *searchInterval)
int subnodeIndex=getSubnodeIndex(searchInterval,centre);
if (subnodeIndex==-1)
return this;
if (subnode[subnodeIndex]!=NULL) {
if (subnode[subnodeIndex]!=nullptr) {
// query lies in subnode, so search it
Node *node=subnode[subnodeIndex];
return node->find(searchInterval);
@ -111,7 +111,7 @@ Node::find(Interval *searchInterval)
void
Node::insert(Node *node)
{
assert(interval==NULL || interval->contains(node->interval));
assert(interval==nullptr || interval->contains(node->interval));
int index=getSubnodeIndex(node->interval,centre);
assert(index >= 0);
if (node->level==level-1) {
@ -132,7 +132,7 @@ Node::insert(Node *node)
Node*
Node::getSubnode(int index)
{
if (subnode[index]==NULL) {
if (subnode[index]==nullptr) {
subnode[index]=createSubnode(index);
}
return subnode[index];

View File

@ -44,8 +44,8 @@ NodeBase::getSubnodeIndex(Interval *interval, double centre)
NodeBase::NodeBase()
{
items=new vector<void*>();
subnode[0]=NULL;
subnode[1]=NULL;
subnode[0]=nullptr;
subnode[1]=nullptr;
}
NodeBase::~NodeBase() {
@ -55,8 +55,8 @@ NodeBase::~NodeBase() {
delete items;
delete subnode[0];
delete subnode[1];
subnode[0]=NULL;
subnode[1]=NULL;
subnode[0]=nullptr;
subnode[1]=nullptr;
}
vector<void*>*
@ -72,7 +72,7 @@ void NodeBase::add(void* item){
vector<void*>* NodeBase::addAllItems(vector<void*> *newItems) {
items->insert(items->end(),newItems->begin(),newItems->end());
for(int i=0;i<2;i++) {
if (subnode[i]!=NULL) {
if (subnode[i]!=nullptr) {
subnode[i]->addAllItems(newItems);
}
}
@ -86,7 +86,7 @@ NodeBase::addAllItemsFromOverlapping(Interval *interval,vector<void*> *resultIte
return items;
resultItems->insert(resultItems->end(),items->begin(),items->end());
for (int i=0;i<2;i++) {
if (subnode[i]!=NULL) {
if (subnode[i]!=nullptr) {
subnode[i]->addAllItemsFromOverlapping(interval,resultItems);
}
}
@ -98,7 +98,7 @@ NodeBase::depth()
{
int maxSubDepth=0;
for (int i=0;i<2;i++) {
if (subnode[i]!=NULL) {
if (subnode[i]!=nullptr) {
int sqd=subnode[i]->depth();
if (sqd>maxSubDepth)
maxSubDepth=sqd;
@ -112,7 +112,7 @@ NodeBase::size()
{
int subSize=0;
for (int i=0;i<2;i++) {
if (subnode[i]!=NULL) {
if (subnode[i]!=nullptr) {
subSize+=subnode[i]->size();
}
}
@ -124,7 +124,7 @@ NodeBase::nodeSize()
{
int subSize=0;
for (int i=0;i<2;i++) {
if (subnode[i]!=NULL) {
if (subnode[i]!=nullptr) {
subSize+=subnode[i]->nodeSize();
}
}

View File

@ -47,7 +47,7 @@ Root::insert(Interval *itemInterval,void* item)
* If the subnode doesn't exist or this item is not contained in it,
* have to expand the tree upward to contain the item.
*/
if (node==NULL || !node->getInterval()->contains(itemInterval))
if (node==nullptr || !node->getInterval()->contains(itemInterval))
{
Node* largerNode=Node::createExpanded(node,itemInterval);
// delete subnode[index];

View File

@ -34,7 +34,7 @@ MonotoneChain::MonotoneChain(const geom::CoordinateSequence& newPts,
size_t nstart, size_t nend, void* nContext)
:
pts(newPts),
env(0),
env(nullptr),
context(nContext),
start(nstart),
end(nend),
@ -50,7 +50,7 @@ MonotoneChain::~MonotoneChain()
const Envelope&
MonotoneChain::getEnvelope() const
{
if (0 == env)
if (nullptr == env)
{
const Coordinate& p0 = pts[start];
const Coordinate& p1 = pts[end];

View File

@ -34,7 +34,7 @@ namespace intervalrtree {
void
SortedPackedIntervalRTree::init()
{
if (root != NULL) return;
if (root != nullptr) return;
root = buildTree();
}
@ -104,13 +104,13 @@ SortedPackedIntervalRTree::buildLevel( IntervalRTreeNode::ConstVect * src, Inter
SortedPackedIntervalRTree::SortedPackedIntervalRTree()
:
leaves( new IntervalRTreeNode::ConstVect()),
root( NULL),
root( nullptr),
level( 0)
{ }
SortedPackedIntervalRTree::~SortedPackedIntervalRTree()
{
if ( root != NULL )
if ( root != nullptr )
{
// deleting root cascades to all IntervalRTreeNode's
delete root;
@ -128,7 +128,7 @@ SortedPackedIntervalRTree::~SortedPackedIntervalRTree()
void
SortedPackedIntervalRTree::insert( double min, double max, void * item)
{
if (root != NULL)
if (root != nullptr)
throw new util::UnsupportedOperationException( "Index cannot be added to once it has been queried");
leaves->push_back( new IntervalRTreeLeafNode( min, max, item));

View File

@ -101,7 +101,7 @@ Node::find(const Envelope *searchEnv)
int subnodeIndex=getSubnodeIndex(searchEnv, centre);
if (subnodeIndex==-1)
return this;
if (subnode[subnodeIndex]!=NULL) {
if (subnode[subnodeIndex]!=nullptr) {
// query lies in subquad, so search it
Node *node=subnode[subnodeIndex];
return node->find(searchEnv);
@ -145,7 +145,7 @@ Node*
Node::getSubnode(int index)
{
assert(index >=0 && index < 4);
if (subnode[index] == NULL)
if (subnode[index] == nullptr)
{
subnode[index] = createSubnode(index).release();
}

View File

@ -63,10 +63,10 @@ NodeBase::getSubnodeIndex(const Envelope *env, const Coordinate& centre)
NodeBase::NodeBase()
{
subnode[0]=0;
subnode[1]=0;
subnode[2]=0;
subnode[3]=0;
subnode[0]=nullptr;
subnode[1]=nullptr;
subnode[2]=nullptr;
subnode[3]=nullptr;
}
NodeBase::~NodeBase()
@ -75,10 +75,10 @@ NodeBase::~NodeBase()
delete subnode[1];
delete subnode[2];
delete subnode[3];
subnode[0]=NULL;
subnode[1]=NULL;
subnode[2]=NULL;
subnode[3]=NULL;
subnode[0]=nullptr;
subnode[1]=nullptr;
subnode[2]=nullptr;
subnode[3]=nullptr;
}
vector<void*>&
@ -141,7 +141,7 @@ NodeBase::depth() const
unsigned int maxSubDepth=0;
for (int i=0; i<4; ++i)
{
if (subnode[i] != NULL)
if (subnode[i] != nullptr)
{
unsigned int sqd=subnode[i]->depth();
if ( sqd > maxSubDepth )
@ -157,7 +157,7 @@ NodeBase::size() const
unsigned int subSize=0;
for(int i=0; i<4; i++)
{
if (subnode[i] != NULL)
if (subnode[i] != nullptr)
{
subSize += subnode[i]->size();
}
@ -171,7 +171,7 @@ NodeBase::getNodeCount() const
unsigned int subSize=0;
for(int i=0; i<4; ++i)
{
if (subnode[i] != NULL)
if (subnode[i] != nullptr)
{
subSize += subnode[i]->size();
}
@ -188,7 +188,7 @@ NodeBase::toString() const
for (int i=0; i<4; i++)
{
s<<"subnode["<<i<<"] ";
if ( subnode[i] == NULL ) s<<"NULL";
if ( subnode[i] == nullptr ) s<<"NULL";
else s<<subnode[i]->toString();
s<<endl;
}
@ -206,7 +206,7 @@ NodeBase::visit(const Envelope* searchEnv, ItemVisitor& visitor)
visitItems(searchEnv, visitor);
for (int i = 0; i < 4; i++) {
if (subnode[i] != NULL) {
if (subnode[i] != nullptr) {
subnode[i]->visit(searchEnv, visitor);
}
}
@ -246,7 +246,7 @@ NodeBase::remove(const Envelope* itemEnv, void* item)
if (subnode[i]->isPrunable())
{
delete subnode[i];
subnode[i] = NULL;
subnode[i] = nullptr;
}
break;
}

View File

@ -76,10 +76,10 @@ Root::insert(const Envelope *itemEnv, void* item)
* If the subquad doesn't exist or this item is not contained in it,
* have to expand the tree upward to contain the item.
*/
if (node==NULL || !node->getEnvelope()->contains(itemEnv))
if (node==nullptr || !node->getEnvelope()->contains(itemEnv))
{
std::unique_ptr<Node> snode (node); // may be NULL
node = 0; subnode[index] = 0;
node = nullptr; subnode[index] = nullptr;
std::unique_ptr<Node> largerNode =
Node::createExpanded(std::move(snode), *itemEnv);

View File

@ -32,7 +32,7 @@ namespace strtree { // geos.index.strtree
*/
AbstractNode::AbstractNode(int newLevel, int capacity) {
childBoundables.reserve(capacity);
bounds=NULL;
bounds=nullptr;
level=newLevel;
}
@ -42,7 +42,7 @@ AbstractNode::~AbstractNode() {
const void *
AbstractNode::getBounds() const
{
if (bounds==NULL) {
if (bounds==nullptr) {
bounds = computeBounds();
}
return bounds;
@ -61,7 +61,7 @@ int AbstractNode::getLevel() {
* (wrapped in an ItemBoundable)
*/
void AbstractNode::addChildBoundable(Boundable *childBoundable) {
assert(bounds==NULL);
assert(bounds==nullptr);
childBoundables.push_back(childBoundable);
}

View File

@ -33,7 +33,7 @@ namespace strtree { // geos.index.strtree
AbstractSTRtree::~AbstractSTRtree()
{
assert(0 != itemBoundables);
assert(nullptr != itemBoundables);
BoundableList::iterator it = itemBoundables->begin();
BoundableList::iterator end = itemBoundables->end();
while (it != end)
@ -43,7 +43,7 @@ AbstractSTRtree::~AbstractSTRtree()
}
delete itemBoundables;
assert(0 != nodes);
assert(nullptr != nodes);
for (std::size_t i = 0, nsize = nodes->size(); i < nsize; i++)
{
delete (*nodes)[i];
@ -125,7 +125,7 @@ AbstractSTRtree::query(const void* searchBounds, vector<void*>& matches)
{
if (!built) build();
if (itemBoundables->empty()) assert(root->getBounds()==NULL);
if (itemBoundables->empty()) assert(root->getBounds()==nullptr);
if (getIntersectsOp()->intersects(root->getBounds(), searchBounds))
{
@ -139,7 +139,7 @@ AbstractSTRtree::query(const void* searchBounds, ItemVisitor& visitor)
{
if (!built) build();
if (itemBoundables->empty()) assert(root->getBounds()==NULL);
if (itemBoundables->empty()) assert(root->getBounds()==nullptr);
if (getIntersectsOp()->intersects(root->getBounds(),searchBounds))
{
@ -184,7 +184,7 @@ AbstractSTRtree::remove(const void* searchBounds, void* item)
{
if (!built) build();
if (itemBoundables->empty()) {
assert(root->getBounds() == NULL);
assert(root->getBounds() == nullptr);
}
if (getIntersectsOp()->intersects(root->getBounds(), searchBounds)) {
return remove(searchBounds, *root, item);
@ -362,7 +362,7 @@ ItemsList* AbstractSTRtree::itemsTree(AbstractNode* node)
ItemsList* valuesTreeForChild =
itemsTree(static_cast<AbstractNode*>(childBoundable));
// only add if not null (which indicates an item somewhere in this tree
if (valuesTreeForChild != NULL)
if (valuesTreeForChild != nullptr)
valuesTreeForNode->push_back_owned(valuesTreeForChild);
}
else if (dynamic_cast<ItemBoundable*>(childBoundable)) {
@ -374,7 +374,7 @@ ItemsList* AbstractSTRtree::itemsTree(AbstractNode* node)
}
}
if (valuesTreeForNode->empty())
return NULL;
return nullptr;
return valuesTreeForNode.release();
}
@ -386,7 +386,7 @@ ItemsList* AbstractSTRtree::itemsTree()
}
ItemsList* valuesTree (itemsTree(root));
if (valuesTree == NULL)
if (valuesTree == nullptr)
return new ItemsList();
return valuesTree;

View File

@ -63,7 +63,7 @@ bool BoundablePair::isLeaves() const {
}
bool BoundablePair::isComposite(const Boundable* item) {
return dynamic_cast<const AbstractNode*>(item) != NULL;
return dynamic_cast<const AbstractNode*>(item) != nullptr;
}
double BoundablePair::area(const Boundable* b) {

View File

@ -100,12 +100,12 @@ protected:
void* computeBounds() const
{
Interval* bounds=NULL;
Interval* bounds=nullptr;
const BoundableList& b = *getChildBoundables();
for(unsigned int i=0; i<b.size(); ++i)
{
const Boundable* childBoundable=b[i];
if (bounds==NULL) {
if (bounds==nullptr) {
bounds=new Interval(*((Interval*)childBoundable->getBounds()));
} else {
bounds->expandToInclude((Interval*)childBoundable->getBounds());

View File

@ -211,7 +211,7 @@ std::pair<const void*, const void*> STRtree::nearestNeighbour(STRtree* tree, Ite
std::pair<const void*, const void*> STRtree::nearestNeighbour(BoundablePair* initBndPair, double maxDistance) {
double distanceLowerBound = maxDistance;
BoundablePair* minPair = NULL;
BoundablePair* minPair = nullptr;
BoundablePair::BoundablePairQueue priQ;
priQ.push(initBndPair);
@ -291,10 +291,10 @@ protected:
void* computeBounds() const
{
Envelope* bounds=NULL;
Envelope* bounds=nullptr;
const BoundableList& b = *getChildBoundables();
if ( b.empty() ) return NULL;
if ( b.empty() ) return nullptr;
BoundableList::const_iterator i=b.begin();
BoundableList::const_iterator e=b.end();

View File

@ -27,20 +27,20 @@ SweepLineEvent::SweepLineEvent(double x, SweepLineEvent *newInsertEvent,
insertEvent(newInsertEvent),
sweepInt(newSweepInt)
{
if (insertEvent!=0)
if (insertEvent!=nullptr)
eventType=SweepLineEvent::DELETE_EVENT;
}
bool
SweepLineEvent::isInsert()
{
return insertEvent==0;
return insertEvent==nullptr;
}
bool
SweepLineEvent::isDelete()
{
return insertEvent!=0;
return insertEvent!=nullptr;
}
SweepLineEvent*

View File

@ -44,7 +44,7 @@ void
SweepLineIndex::add(SweepLineInterval *sweepInt)
{
// FIXME: who's going to delete the newly-created events ?
SweepLineEvent *insertEvent=new SweepLineEvent(sweepInt->getMin(),NULL,sweepInt);
SweepLineEvent *insertEvent=new SweepLineEvent(sweepInt->getMin(),nullptr,sweepInt);
events.push_back(insertEvent);
events.push_back(new SweepLineEvent(sweepInt->getMax(), insertEvent, sweepInt));
}

View File

@ -32,8 +32,8 @@ CLocalizer::CLocalizer()
// Avoid multithreading issues caused by setlocale
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
char* p = std::setlocale(LC_NUMERIC, NULL);
if (0 != p)
char* p = std::setlocale(LC_NUMERIC, nullptr);
if (nullptr != p)
{
saved_locale = p;
}

View File

@ -355,11 +355,11 @@ WKBReader::readPolygon()
cout<<"WKB numRings: "<<numRings<<endl;
#endif
LinearRing *shell = NULL;
LinearRing *shell = nullptr;
if( numRings > 0 )
shell = readLinearRing();
vector<Geometry *>*holes=NULL;
vector<Geometry *>*holes=nullptr;
if ( numRings > 1 )
{
try {

View File

@ -45,7 +45,7 @@ namespace geos {
namespace io { // geos.io
WKBWriter::WKBWriter(int dims, int bo, bool srid):
defaultOutputDimension(dims), byteOrder(bo), includeSRID(srid), outStream(NULL)
defaultOutputDimension(dims), byteOrder(bo), includeSRID(srid), outStream(nullptr)
{
if ( dims < 2 || dims > 3 )
throw util::IllegalArgumentException("WKB output dimension must be 2 or 3");

View File

@ -63,7 +63,7 @@ WKTReader::read(const string &wellKnownText)
//unique_ptr<StringTokenizer> tokenizer(new StringTokenizer(wellKnownText));
CLocalizer clocale;
StringTokenizer tokenizer(wellKnownText);
Geometry *g=NULL;
Geometry *g=nullptr;
g=readGeometryTaggedText(&tokenizer);
return g;
}
@ -367,11 +367,11 @@ WKTReader::readMultiPointText(StringTokenizer *tokenizer)
Polygon*
WKTReader::readPolygonText(StringTokenizer *tokenizer)
{
Polygon *poly=NULL;
LinearRing *shell=NULL;
Polygon *poly=nullptr;
LinearRing *shell=nullptr;
string nextToken=getNextEmptyOrOpener(tokenizer);
if (nextToken=="EMPTY") {
return geometryFactory->createPolygon(NULL,NULL);
return geometryFactory->createPolygon(nullptr,nullptr);
}
vector<Geometry *> *holes=new vector<Geometry *>();
@ -397,19 +397,19 @@ WKTReader::readPolygonText(StringTokenizer *tokenizer)
MultiLineString* WKTReader::readMultiLineStringText(StringTokenizer *tokenizer) {
string nextToken=getNextEmptyOrOpener(tokenizer);
if (nextToken=="EMPTY") {
return geometryFactory->createMultiLineString(NULL);
return geometryFactory->createMultiLineString(nullptr);
}
vector<Geometry *> *lineStrings=new vector<Geometry *>();
LineString *lineString = NULL;
LineString *lineString = nullptr;
try {
lineString=readLineStringText(tokenizer);
lineStrings->push_back(lineString);
lineString=NULL;
lineString=nullptr;
nextToken=getNextCloserOrComma(tokenizer);
while(nextToken==",") {
lineString=readLineStringText(tokenizer);
lineStrings->push_back(lineString);
lineString=NULL;
lineString=nullptr;
nextToken=getNextCloserOrComma(tokenizer);
}
} catch (...) {
@ -427,19 +427,19 @@ MultiLineString* WKTReader::readMultiLineStringText(StringTokenizer *tokenizer)
MultiPolygon* WKTReader::readMultiPolygonText(StringTokenizer *tokenizer) {
string nextToken=getNextEmptyOrOpener(tokenizer);
if (nextToken=="EMPTY") {
return geometryFactory->createMultiPolygon(NULL);
return geometryFactory->createMultiPolygon(nullptr);
}
vector<Geometry *> *polygons=new vector<Geometry *>();
Polygon *polygon = NULL;
Polygon *polygon = nullptr;
try {
polygon=readPolygonText(tokenizer);
polygons->push_back(polygon);
polygon=NULL;
polygon=nullptr;
nextToken=getNextCloserOrComma(tokenizer);
while(nextToken==",") {
polygon=readPolygonText(tokenizer);
polygons->push_back(polygon);
polygon=NULL;
polygon=nullptr;
nextToken=getNextCloserOrComma(tokenizer);
}
} catch (...) {
@ -457,19 +457,19 @@ MultiPolygon* WKTReader::readMultiPolygonText(StringTokenizer *tokenizer) {
GeometryCollection* WKTReader::readGeometryCollectionText(StringTokenizer *tokenizer) {
string nextToken=getNextEmptyOrOpener(tokenizer);
if (nextToken=="EMPTY") {
return geometryFactory->createGeometryCollection(NULL);
return geometryFactory->createGeometryCollection(nullptr);
}
vector<Geometry *> *geoms=new vector<Geometry *>();
Geometry *geom=NULL;
Geometry *geom=nullptr;
try {
geom=readGeometryTaggedText(tokenizer);
geoms->push_back(geom);
geom=NULL;
geom=nullptr;
nextToken=getNextCloserOrComma(tokenizer);
while(nextToken==",") {
geom=readGeometryTaggedText(tokenizer);
geoms->push_back(geom);
geom=NULL;
geom=nullptr;
nextToken=getNextCloserOrComma(tokenizer);
}
} catch (...) {

View File

@ -236,7 +236,7 @@ WKTWriter::appendPointTaggedText(const Coordinate* coordinate, int level,
Writer *writer)
{
writer->write("POINT ");
if( outputDimension == 3 && !old3D && coordinate != NULL )
if( outputDimension == 3 && !old3D && coordinate != nullptr )
writer->write( "Z " );
appendPointText(coordinate, level, writer);
@ -306,7 +306,7 @@ void
WKTWriter::appendPointText(const Coordinate* coordinate, int /*level*/,
Writer *writer)
{
if (coordinate==NULL) {
if (coordinate==nullptr) {
writer->write("EMPTY");
} else {
writer->write("(");

View File

@ -80,7 +80,7 @@ Geometry *ExtractLineByLocation::reverse(const Geometry *linear)
else
{
assert(!static_cast<bool>("non-linear geometry encountered"));
return 0;
return nullptr;
}
}
}

View File

@ -45,7 +45,7 @@ LinearGeometryBuilder::LinearGeometryBuilder(const GeometryFactory* geomFact) :
geomFact(geomFact),
ignoreInvalidLines(false),
fixInvalidLines(false),
coordList(0) {}
coordList(nullptr) {}
/* public */
void
@ -100,7 +100,7 @@ LinearGeometryBuilder::endLine()
if (coordList)
{
delete coordList;
coordList = 0;
coordList = nullptr;
}
return;
}
@ -120,7 +120,7 @@ LinearGeometryBuilder::endLine()
}
}
LineString* line = 0;
LineString* line = nullptr;
try
{
line = geomFact->createLineString(coordList);
@ -134,7 +134,7 @@ LinearGeometryBuilder::endLine()
}
if (line) lines.push_back(line);
coordList = 0;
coordList = nullptr;
}
/* public */

View File

@ -70,7 +70,7 @@ void LinearIterator::loadCurrentLine()
{
if (componentIndex >= numLines)
{
currentLine = 0;
currentLine = nullptr;
return;
}
currentLine = dynamic_cast<const LineString *> (linear->getGeometryN(componentIndex));

View File

@ -97,7 +97,7 @@ LocationIndexOfPoint::LocationIndexOfPoint(const Geometry *linearGeom) :
LinearLocation LocationIndexOfPoint::indexOf(const Coordinate& inputPt) const
{
return indexOfFromStart(inputPt, 0);
return indexOfFromStart(inputPt, nullptr);
}
LinearLocation

View File

@ -58,7 +58,7 @@ public:
if ( ls ) {
geom::CoordinateSequence* coord = ls->getCoordinates();
// coord ownership transferred to SegmentString
SegmentString *ss = new NodedSegmentString(coord, 0);
SegmentString *ss = new NodedSegmentString(coord, nullptr);
_to.push_back(ss);
}
}
@ -125,7 +125,7 @@ GeometryNoder::getNoded()
extractSegmentStrings(argGeom, lineList);
Noder& noder = getNoder();
SegmentString::NonConstVect* nodedEdges = 0;
SegmentString::NonConstVect* nodedEdges = nullptr;
try {
noder.computeNodes( &lineList );

View File

@ -60,7 +60,7 @@ IteratedNoder::computeNodes(SegmentString::NonConstVect* segStrings)
nodedSegStrings = segStrings;
int nodingIterationCount = 0;
int lastNodesCreated = -1;
vector<SegmentString*> *lastStrings = 0;
vector<SegmentString*> *lastStrings = nullptr;
do {
// NOTE: will change this.nodedSegStrings

View File

@ -58,7 +58,7 @@ HotPixel::getSafeEnvelope() const
{
static const double SAFE_ENV_EXPANSION_FACTOR = 0.75;
if (safeEnv.get() == NULL) {
if (safeEnv.get() == nullptr) {
double safeTolerance = SAFE_ENV_EXPANSION_FACTOR / scaleFactor;
safeEnv = unique_ptr<Envelope>(new Envelope(originalPt.x - safeTolerance,
originalPt.x + safeTolerance,

View File

@ -81,7 +81,7 @@ EndpointInfo::EndpointInfo(const Coordinate& newPt)
IsSimpleOp::IsSimpleOp()
:
isClosedEndpointsInInterior(true),
geom(0),
geom(nullptr),
nonSimpleLocation()
{}
@ -269,11 +269,11 @@ IsSimpleOp::addEndpoint(
map<const Coordinate*,EndpointInfo*,CoordinateLessThen>::iterator it=endPoints.find(p);
EndpointInfo *eiInfo;
if (it==endPoints.end()) {
eiInfo=NULL;
eiInfo=nullptr;
} else {
eiInfo=it->second;
}
if (eiInfo==NULL) {
if (eiInfo==nullptr) {
eiInfo=new EndpointInfo(*p);
endPoints[p]=eiInfo;
}

View File

@ -188,7 +188,7 @@ BufferBuilder::bufferLineSingleSided( const Geometry* g, double distance,
CoordinateSequence* seq = lineList[i];
// SegmentString takes ownership of CoordinateSequence
SegmentString* ss = new NodedSegmentString(seq, NULL);
SegmentString* ss = new NodedSegmentString(seq, nullptr);
curveList.push_back( ss );
}
lineList.clear();
@ -256,7 +256,7 @@ BufferBuilder::bufferLineSingleSided( const Geometry* g, double distance,
// Remove end points if they are a part of the original line to be
// buffered.
CoordinateSequence::Ptr coords(mergedLines->back()->getCoordinates());
if ( NULL != coords.get() )
if ( nullptr != coords.get() )
{
// Use 98% of the buffer width as the point-distance requirement - this
// is to ensure that the point that is "distance" +/- epsilon is not
@ -368,7 +368,7 @@ BufferBuilder::buffer(const Geometry *g, double distance)
// throw(GEOSException *)
{
const PrecisionModel *precisionModel=workingPrecisionModel;
if (precisionModel==NULL)
if (precisionModel==nullptr)
precisionModel=g->getPrecisionModel();
assert(precisionModel);
@ -410,7 +410,7 @@ BufferBuilder::buffer(const Geometry *g, double distance)
std::cerr << std::endl << edgeList << std::endl;
#endif
Geometry* resultGeom=NULL;
Geometry* resultGeom=nullptr;
std::unique_ptr< std::vector<Geometry*> > resultPolyList;
std::vector<BufferSubgraph*> subgraphList;
@ -476,14 +476,14 @@ Noder*
BufferBuilder::getNoder(const PrecisionModel* pm)
{
// this doesn't change workingNoder precisionModel!
if (workingNoder != NULL) return workingNoder;
if (workingNoder != nullptr) return workingNoder;
// otherwise use a fast (but non-robust) noder
if ( li ) // reuse existing IntersectionAdder and LineIntersector
{
li->setPrecisionModel(pm);
assert(intersectionAdder!=NULL);
assert(intersectionAdder!=nullptr);
}
else
{
@ -581,7 +581,7 @@ BufferBuilder::insertUniqueEdge(Edge *e)
// fast lookup
Edge *existingEdge = edgeList.findEqualEdge(e);
// If an identical edge already exists, simply update its label
if (existingEdge != NULL) {
if (existingEdge != nullptr) {
Label& existingLabel = existingEdge->getLabel();
Label labelToMerge = e->getLabel();
@ -694,7 +694,7 @@ BufferBuilder::buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
geom::Geometry*
BufferBuilder::createEmptyResultGeometry() const
{
geom::Geometry* emptyGeom = geomFact->createPolygon(NULL, NULL);
geom::Geometry* emptyGeom = geomFact->createPolygon(nullptr, nullptr);
return emptyGeom;
}

View File

@ -132,7 +132,7 @@ BufferOp::computeGeometry()
bufferOriginalPrecision();
if (resultGeometry!=NULL) return;
if (resultGeometry!=nullptr) return;
#if GEOS_DEBUG
std::cerr << "bufferOriginalPrecision failed (" << saveException.what() << "), trying with reduced precision"
@ -167,7 +167,7 @@ BufferOp::bufferReducedPrecision()
// don't propagate the exception - it will be detected by fact that resultGeometry is null
}
if (resultGeometry!=NULL) {
if (resultGeometry!=nullptr) {
// debug
//if ( saveException ) std::cerr<<saveException->toString()<<std::endl;
return;

View File

@ -53,8 +53,8 @@ BufferSubgraph::BufferSubgraph()
finder(),
dirEdgeList(),
nodes(),
rightMostCoord(NULL),
env(NULL)
rightMostCoord(nullptr),
env(nullptr)
{
}
@ -155,7 +155,7 @@ BufferSubgraph::computeNodeDepth(Node *n)
// throw(TopologyException *)
{
// find a visited dirEdge to start at
DirectedEdge *startEdge=NULL;
DirectedEdge *startEdge=nullptr;
assert(dynamic_cast<DirectedEdgeStar *>(n->getEdges()));
DirectedEdgeStar *ees=static_cast<DirectedEdgeStar *>(n->getEdges());
@ -176,7 +176,7 @@ BufferSubgraph::computeNodeDepth(Node *n)
//if (startEdge==null) return;
// only compute string append if assertion would fail
if (startEdge == NULL)
if (startEdge == nullptr)
{
throw util::TopologyException(
"unable to find edge to compute depths at",
@ -319,7 +319,7 @@ BufferSubgraph::contains(set<Node*>&nodeSet, Node *node)
Envelope *
BufferSubgraph::getEnvelope()
{
if (env == NULL) {
if (env == nullptr) {
env = new Envelope();
std::size_t const size = dirEdgeList.size();
for(std::size_t i=0; i<size; ++i)

Some files were not shown because too many files have changed in this diff Show More