[geos-commits] r3808 - trunk/examples

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Jun 6 13:18:50 PDT 2013


Author: strk
Date: 2013-06-06 13:18:50 -0700 (Thu, 06 Jun 2013)
New Revision: 3808

Removed:
   trunk/examples/CPCLException.cpp
   trunk/examples/CoordinateSequencesExample.cpp
   trunk/examples/CustomCoordinateSequenceExample.cpp
   trunk/examples/CustomCoordinateSequenceExample.h
   trunk/examples/CustomPointCoordinateSequence.cpp
   trunk/examples/Makefile.am
Log:
Drop obsoleted files

Deleted: trunk/examples/CPCLException.cpp
===================================================================
--- trunk/examples/CPCLException.cpp	2013-06-06 16:39:20 UTC (rev 3807)
+++ trunk/examples/CPCLException.cpp	2013-06-06 20:18:50 UTC (rev 3808)
@@ -1,32 +0,0 @@
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * 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 "CustomCoordinateSequenceExample.h"
-#include <geos/util.h>
-
-using namespace geos;
-
-CPCLException::CPCLException()
-	:
-	GEOSException("CPCLException", "")
-{
-}
-
-CPCLException::CPCLException(const string& msg)
-	GEOSException("CPCLException", msg)
-{
-}
-
-CPCLException::~CPCLException(){}

Deleted: trunk/examples/CoordinateSequencesExample.cpp
===================================================================
--- trunk/examples/CoordinateSequencesExample.cpp	2013-06-06 16:39:20 UTC (rev 3807)
+++ trunk/examples/CoordinateSequencesExample.cpp	2013-06-06 20:18:50 UTC (rev 3808)
@@ -1,108 +0,0 @@
-/**********************************************************************
- * WARNING! This example is obsoleted, read doc/example.cpp for
- * an updated example.
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * 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 <iostream>
-
-#include <geos/io.h>
-#include <geos/util.h>
-#include <geos/geom.h>
-#include <geos/geosAlgorithm.h>
-
-using namespace std;
-using namespace geos;
-
-int main(int argc, char** argv)
-{
-	try {
-	cout << "Start:" << endl << endl;
-
-	CoordinateSequence *cl1=new CoordinateArraySequence();
-
-	//CoordinateSequence cl1 is empty
-	cout << endl << "CoordinateSequence cl1: " << cl1->toString() << endl;
-	//Adding points
-	cl1->add(*(new Coordinate(140,120)));
-	cl1->add(*(new Coordinate(160,20)));
-	cl1->add(*(new Coordinate(33,33)));
-	cl1->add(*(new Coordinate(20,20)));
-	cl1->add(*(new Coordinate(11,11)));
-	cl1->add(*(new Coordinate(140,120)));
-	cout << "CoordinateSequence cl1: " << cl1->toString() << endl;
-	//Changing point
-	cl1->setAt(*(new Coordinate(20,120)),4);
-	cout << "CoordinateSequence cl1: " << cl1->toString() << endl;
-	//Deleting point
-	cl1->deleteAt(2);
-	cout << "CoordinateSequence cl1: " << cl1->toString() << endl;
-
-	//Switching CoordinateSequenceFactory to create PointCoordinateSequences
-	//PointCoordinateSequence is a sample implementation of a user-defined
-	//CoordinateSequence based on a vector of struct {3 x double}
-	CoordinateSequenceFactory::internalFactory=new PointCoordinateSequenceFactory();
-	//Now calls to CoordinateSequenceFactory would create PointCoordinateSequences
-	CoordinateSequence *cl2=CoordinateSequenceFactory::internalFactory->createCoordinateSequence();
-	//It is also possible to explicitly create PointCoordinateSequences
-	//CoordinateSequence *cl2=new PointCoordinateSequence();
-
-	//CoordinateSequence cl2 is empty
-	cout << endl << "CoordinateSequence cl2: " << cl2->toString() << endl;
-	//Adding points
-	//Points could be added as Coordinates
-	cl2->add(*(new Coordinate(11,11)));
-	cl2->add(*(new Coordinate(140,200)));
-	cl2->add(*(new Coordinate(33,33)));
-	//or using native PointCoordinateSequence format
-	point_3d p1={240,200,DoubleNotANumber};
-	point_3d p2={55,55,DoubleNotANumber};
-	point_3d p3={140,120,DoubleNotANumber};
-	((PointCoordinateSequence*) cl2)->add(p1);
-	((PointCoordinateSequence*) cl2)->add(p2);
-	((PointCoordinateSequence*) cl2)->add(p3);
-	cout << "CoordinateSequence cl2: " << cl2->toString() << endl;
-	//Changing point
-	//Points can be set using Coordinates
-	cl2->setAt(*(new Coordinate(240,120)),4);
-	//or using native PointCoordinateSequence format
-	point_3d pn={140,120,DoubleNotANumber};
-	((PointCoordinateSequence*) cl2)->setAt(pn,0);
-	cout << "CoordinateSequence cl2: " << cl2->toString() << endl;
-	//Deleting point
-	cl2->deleteAt(2);
-	cout << "CoordinateSequence cl2: " << cl2->toString() << endl;
-
-	//To do the operations:
-	//First we need to create a GeometryFactory
-	GeometryFactory *gf=new GeometryFactory(new PrecisionModel(),0);
-	//Now we can create Geometries
-	Geometry *geom1=gf->createPolygon(gf->createLinearRing(cl1),NULL);
-	cout << endl << "Geometry 1:" << endl << geom1->toString() << endl;
-	Geometry *geom2=gf->createPolygon(gf->createLinearRing(cl2),NULL);
-	cout << endl << "Geometry 2:" << endl << geom2->toString() << endl;
-	//And see how they relate to each other
-	IntersectionMatrix *im=geom1->relate(geom2);
-	cout << endl << "Result of relate() operation should be \"FF2F01212\"" << endl;
-	cout << "Result is: " << im->toString() << endl;
-
-	cout << "End" << endl;
-	} catch (const GEOSException& ge) {
-		cout << ge->toString() << endl;
-	}
-
-	return 0;
-}
-

Deleted: trunk/examples/CustomCoordinateSequenceExample.cpp
===================================================================
--- trunk/examples/CustomCoordinateSequenceExample.cpp	2013-06-06 16:39:20 UTC (rev 3807)
+++ trunk/examples/CustomCoordinateSequenceExample.cpp	2013-06-06 20:18:50 UTC (rev 3808)
@@ -1,82 +0,0 @@
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * 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 <iostream>
-
-#include "CustomCoordinateSequenceExample.h"
-#include <geos/io.h>
-#include <geos/util.h>
-#include <geos/geom.h>
-#include <geos/geosAlgorithm.h>
-
-using namespace std;
-using namespace geos;
-
-int main(int argc, char** argv) {
-	try {
-	cout << "Start:" << endl << endl;
-
-	//CustomPointCoordinateSequence is a sample implementation of a user-defined
-	//wrapper around their internal storage format (array of point_3d struct {3 x double})
-
-	point_3d p1={11,11,DoubleNotANumber};
-	point_3d p2={140,200,DoubleNotANumber};
-	point_3d p3={240,200,DoubleNotANumber};
-	point_3d p4={55,55,DoubleNotANumber};
-	point_3d p5={140,120,DoubleNotANumber};
-	
-	//Array of point_3d (internal storage format)
-	point_3d points[5];
-	points[0]=p1;
-	points[1]=p2;
-	points[2]=p3;
-	points[3]=p4;
-	points[4]=p5;
-
-	//Creating CoordinateSequence
-	CoordinateSequence *cl=new CustomPointCoordinateSequence(points,5);
-
-	cout << endl << "CoordinateSequence cl: " << cl->toString() << endl;
-	//Changing point
-	//Points can be set using Coordinates
-	cl->setAt(*(new Coordinate(240,120)),3);
-	//or using native CustomPointCoordinateSequence format
-	point_3d pn={140,120,DoubleNotANumber};
-	((CustomPointCoordinateSequence*) cl)->setAt(pn,0);
-	cout << "CoordinateSequence cl: " << cl->toString() << endl;
-
-	//Since the underlying storage format is a fixed size array
-	//points can't be added or deleted
-	//cl->add(*(new Coordinate(240,120)),4); //Would cause exception
-	//cl->deleteAt(2); //Would cause exception
-
-	//To do the operations:
-	//First we need to create a GeometryFactory
-	GeometryFactory *gf=new GeometryFactory(new PrecisionModel(),0);
-	//Now we can create a Geometry
-	Geometry *geom=gf->createPolygon(gf->createLinearRing(cl),NULL);
-	cout << endl << "Geometry:" << endl << geom->toString() << endl;
-	//And see if the geometry is valid
-	cout << "Geometry is valid? " << (geom->isValid()?"true":"false") << endl;
-
-	cout << "End" << endl;
-	} catch (const GEOSException& ge) {
-		cout << ge.what() << endl;
-
-	}
-
-	return 0;
-}
-

Deleted: trunk/examples/CustomCoordinateSequenceExample.h
===================================================================
--- trunk/examples/CustomCoordinateSequenceExample.h	2013-06-06 16:39:20 UTC (rev 3807)
+++ trunk/examples/CustomCoordinateSequenceExample.h	2013-06-06 20:18:50 UTC (rev 3808)
@@ -1,66 +0,0 @@
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * 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.
- *
- **********************************************************************
- **********************************************************************/
-
-
-#ifndef GEOS_EX2_H
-#define GEOS_EX2_H
-
-#include <geos/platform.h>
-#include <geos/geom.h>
-#include <geos/util.h>
-
-using namespace std;
-using namespace geos;
-
-/*
- * This is an example of how you can create a custom CoordinateSequence class that wraps
- * your own way of storing lists of coordinates. Depending on your internal storage
- * format some methods in the wrapper class might not work properly (but have to be
- * preserved for the interface compatibility. In this example CustomPointCoordinateSequence
- * wraps an array of point_3d. Since the array is fixed length, methods like 'add' or
- * 'deleteAt' will not work.
- */
-class CustomPointCoordinateSequence : public BasicCoordinateSequence {
-public:
-	CustomPointCoordinateSequence(point_3d *newPts,int newSize);
-	CustomPointCoordinateSequence(const CustomPointCoordinateSequence &cl);
-	bool isEmpty();
-	void add(Coordinate& c); //NoOp (exception)
-	void add(point_3d p); //NoOp (exception)
-	int getSize();
-	Coordinate& getAt(int pos);
-	point_3d getPointAt(int pos);
-	void setAt(Coordinate& c, int pos);
-	void setAt(point_3d p, int pos);
-	void deleteAt(int pos); //NoOp (exception)
-	vector<Coordinate>* toVector();
-	vector<point_3d>* toPointVector();
-	string toString();
-	void setPoints(const vector<Coordinate> &v);
-	void setPoints(const vector<point_3d> &v);
-private:
-	point_3d *pts;
-	int size;
-};
-
-class CPCLException: public GEOSException {
-public:
-	CPCLException();
-	CPCLException(const string& msg);
-	~CPCLException();
-};
-
-#endif
-

Deleted: trunk/examples/CustomPointCoordinateSequence.cpp
===================================================================
--- trunk/examples/CustomPointCoordinateSequence.cpp	2013-06-06 16:39:20 UTC (rev 3807)
+++ trunk/examples/CustomPointCoordinateSequence.cpp	2013-06-06 20:18:50 UTC (rev 3808)
@@ -1,137 +0,0 @@
-/**********************************************************************
- *
- * GEOS - Geometry Engine Open Source
- * http://geos.osgeo.org
- *
- * 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 "CustomCoordinateSequenceExample.h"
-#include <sstream>
-#include <iostream>
-
-using namespace geos;
-
-CustomPointCoordinateSequence::CustomPointCoordinateSequence(point_3d *newPts,int newSize) {
-	pts=newPts;
-	size=newSize;
-}
-
-CustomPointCoordinateSequence::CustomPointCoordinateSequence(const CustomPointCoordinateSequence &c) {
-	pts=c.pts;
-	size=c.size;
-}
-
-void CustomPointCoordinateSequence::setPoints(const vector<Coordinate> &v) {
-	if(v.size()==size) {
-		point_3d pt;
-		for(int i=0;i<(int)v.size(); i++) {
-			pt.x=v[i].x;
-			pt.y=v[i].y;
-			pt.z=v[i].z;
-			pts[i]=pt;
-		}
-	} else {
-		throw  CPCLException("size mismatch\n");
-	}
-}
-
-void CustomPointCoordinateSequence::setPoints(const vector<point_3d> &v) {
-	if(v.size()==size) {
-		for(int i=0;i<(int)v.size(); i++) {
-			pts[i]=v[i];
-		}
-	} else {
-		throw  CPCLException("size mismatch\n");
-	}
-}
-
-vector<Coordinate>* CustomPointCoordinateSequence::toVector() {
-	vector<Coordinate>* v=new vector<Coordinate>();
-	for(int i=0;i<size;i++) {
-		v->push_back(*(new Coordinate(pts[i].x,pts[i].y,pts[i].z)));
-	}
-	return v;
-}
-
-vector<point_3d>* CustomPointCoordinateSequence::toPointVector() {
-	vector<point_3d>* v=new vector<point_3d>();
-	for(int i=0;i<size;i++) {
-		v->push_back(pts[i]);
-	}
-	return v;
-}
-
-bool CustomPointCoordinateSequence::isEmpty() {
-	return size==0;
-}
-
-void CustomPointCoordinateSequence::add(Coordinate& c){
-	throw  CPCLException("list's size can't be modified\n");
-}
-
-void CustomPointCoordinateSequence::add(point_3d p){
-	throw  CPCLException("list's size can't be modified\n");
-}
-
-int CustomPointCoordinateSequence::getSize(){
-	return size;
-}
-
-Coordinate& CustomPointCoordinateSequence::getAt(int pos){
-	point_3d pt;
-	if (pos>=0 && pos<size) {
-		pt=pts[pos];
-		return *(new Coordinate(pt.x,pt.y,pt.z));
-	} else
-		throw  CPCLException("can't retrieve element\n");
-}
-
-point_3d CustomPointCoordinateSequence::getPointAt(int pos){
-	if (pos>=0 && pos<size) {
-		return pts[pos];
-	} else
-		throw  CPCLException("can't retrieve element\n");
-}
-
-void CustomPointCoordinateSequence::setAt(Coordinate& c, int pos){
-	point_3d pt={c.x,c.y,c.z};
-	if (pos>=0 && pos<size) 
-		pts[pos]=pt;
-	else
-		throw  CPCLException("can't change element\n");
-}
-
-void CustomPointCoordinateSequence::setAt(point_3d p, int pos){
-	if (pos>=0 && pos<size) 
-		pts[pos]=p;
-	else
-		throw  CPCLException("can't change element\n");
-}
-
-void CustomPointCoordinateSequence::deleteAt(int pos){
-	throw  CPCLException("list's size can't be modified\n");
-}
-
-string CustomPointCoordinateSequence::toString() {
-	ostringstream s;
-	//string result("");
-	//char buffer[100];
-	for (int i=0;i<size;i++) {
-		point_3d c=pts[i];
-		//sprintf(buffer,"(%g,%g,%g) ",c.x,c.y,c.z);
-		s<<"("<<c.x<<","<<c.y<<","<<c.z<<") ";
-		//result.append(buffer);
-	}
-	//result.append("");
-	//return result;
-	return s.str();
-}
-

Deleted: trunk/examples/Makefile.am
===================================================================
--- trunk/examples/Makefile.am	2013-06-06 16:39:20 UTC (rev 3807)
+++ trunk/examples/Makefile.am	2013-06-06 20:18:50 UTC (rev 3808)
@@ -1,23 +0,0 @@
-#
-# This file is part of project GEOS (http://trac.osgeo.org/geos/) 
-#
-noinst_PROGRAMS = \
-    CoordinateSequencesExample \
-    CustomCoordinateSequenceExample 
-
-LIBS = $(top_srcdir)/src/geom/libgeos.la
-# -lmpatrol -lbfd -lintl -liberty -limagehlp
-
-CustomCoordinateSequenceExample_SOURCES = \
-    CustomPointCoordinateSequence.cpp \
-    CustomCoordinateSequenceExample.cpp \
-    CPCLException.cpp \
-    CustomCoordinateSequenceExample.h
-
-CustomCoordinateSequenceExample_LDADD = $(LIBS)
-
-CoordinateSequencesExample_SOURCES = CoordinateSequencesExample.cpp 
-CoordinateSequencesExample_LDADD = $(LIBS)
-
-INCLUDES = -I$(top_srcdir)/include
-INCLUDES += -I$(top_srcdir)/io/markup



More information about the geos-commits mailing list