Ejemplo n.º 1
0
    void object::test<5>()
    {
		cs_ = GEOSCoordSeq_create(1, 3);
		
		unsigned int size;
		unsigned int dims;

		ensure ( 0 != GEOSCoordSeq_getSize(cs_, &size) );
		ensure_equals( size, 1u );

		ensure ( 0 != GEOSCoordSeq_getDimensions(cs_, &dims) );
		ensure_equals( dims, 3u );

		double x = 10;
		double y = 11;
		double z = 12;

        // Y, X, Z
		GEOSCoordSeq_setOrdinate(cs_, 0, 1, y);
		GEOSCoordSeq_setOrdinate(cs_, 0, 0, x);
		GEOSCoordSeq_setOrdinate(cs_, 0, 2, z);

		double xcheck, ycheck, zcheck;
		ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 1, &ycheck) );
		ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 0, &xcheck) );
		ensure( 0 != GEOSCoordSeq_getOrdinate(cs_, 0, 2, &zcheck) );

		ensure_equals( xcheck, x );
		ensure_equals( ycheck, y );
		ensure_equals( zcheck, z );
    }	
Ejemplo n.º 2
0
    void object::test<2>()
    {
        geom1_ = GEOSGeomFromWKT("POLYGON((1 1,1 5,5 5,5 1,1 1))");
        // geom2_ = GEOSGeomFromWKT("POINT(8 8)");
        geom2_ = GEOSGeomFromWKT("POLYGON((8 8, 9 9, 9 10, 8 8))");
        
        ensure( 0 != geom1_ );
        ensure( 0 != geom2_ );

        GEOSCoordSequence *coords_;
        coords_ = GEOSNearestPoints(geom1_, geom2_);

        ensure( 0 != coords_ );

        unsigned int size;
        GEOSCoordSeq_getSize(coords_, &size);
        ensure( 2 == size );

        double  x1, x2, y1, y2;

        /* Point in geom1_
         */
        GEOSCoordSeq_getOrdinate(coords_, 0, 0, &x1);
        GEOSCoordSeq_getOrdinate(coords_, 0, 1, &y1);

        /* Point in geom2_
         */
        GEOSCoordSeq_getOrdinate(coords_, 1, 0, &x2);
        GEOSCoordSeq_getOrdinate(coords_, 1, 1, &y2);

        ensure( 5 == x1 );
        ensure( 5 == y1 );
        ensure( 8 == x2 );
        ensure( 8 == y2 );

        GEOSCoordSeq_destroy(coords_);
    }