Changeset: 7bc822a66258 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7bc822a66258
Modified Files:
        geom/monetdb5/geom.mal
        geom/monetdb5/geomPoints.c
        geom/sql/40_geom.sql
Branch: geo
Log Message:

Added distance in MAL + fix in SQL + changed some throw


diffs (148 lines):

diff --git a/geom/monetdb5/geom.mal b/geom/monetdb5/geom.mal
--- a/geom/monetdb5/geom.mal
+++ b/geom/monetdb5/geom.mal
@@ -446,6 +446,9 @@ module batgeom;
 command Distance(a:bat[:oid,:wkb], b:bat[:oid,:wkb]) :bat[:oid,:dbl] address 
wkbDistance_bat;
 command Distance(a:wkb, b:bat[:oid,:wkb]) :bat[:oid,:dbl] address 
wkbDistance_geom_bat;
 command Distance(a:bat[:oid,:wkb], b:wkb) :bat[:oid,:dbl] address 
wkbDistance_bat_geom;
+command Distance(g:wkb, x:bat[:oid,:dbl], y:bat[:oid,:dbl], srid:int) 
:bat[:oid,:dbl] address wkbPointsDistance_geom_bat;
+command Distance(g:wkb, x:bat[:oid,:dbl], y:bat[:oid,:dbl], o:bat[:oid,:oid], 
srid:int) :bat[:oid,:dbl] address wkbFilteredPointsDistance_geom_bat;
+
 
 command Contains(a:bat[:oid,:wkb], b:bat[:oid,:wkb]) :bat[:oid,:bit] address 
wkbContains_bat;
 command Contains(a:wkb, b:bat[:oid,:wkb]) :bat[:oid,:bit] address 
wkbContains_geom_bat;
diff --git a/geom/monetdb5/geomPoints.c b/geom/monetdb5/geomPoints.c
--- a/geom/monetdb5/geomPoints.c
+++ b/geom/monetdb5/geomPoints.c
@@ -396,54 +396,54 @@ str wkbFilteredPointsDistance_geom_bat(b
 
        //get the descriptors of the BATs
        if ((xBAT = BATdescriptor(*xBAT_id)) == NULL) {
-               throw(MAL, "batgeom.wkbDistanceFiltered", 
RUNTIME_OBJECT_MISSING);
+               throw(MAL, "batgeom.Distance", RUNTIME_OBJECT_MISSING);
        }
        if ((yBAT = BATdescriptor(*yBAT_id)) == NULL) {
                BBPreleaseref(xBAT->batCacheid);
-               throw(MAL, "batgeom.wkbDistanceFiltered", 
RUNTIME_OBJECT_MISSING);
+               throw(MAL, "batgeom.Distance", RUNTIME_OBJECT_MISSING);
        }
        if ((OIDsBAT = BATdescriptor(*OIDsBAT_id)) == NULL) {
                BBPreleaseref(xBAT->batCacheid);
                BBPreleaseref(yBAT->batCacheid);
-               throw(MAL, "batgeom.wkbDistanceFiltered", 
RUNTIME_OBJECT_MISSING);
+               throw(MAL, "batgeom.Distance", RUNTIME_OBJECT_MISSING);
        }
        
        //check if the BATs have dense heads and are aligned
        if (!BAThdense(xBAT) || !BAThdense(yBAT) || !BAThdense(OIDsBAT)) {
-               ret = createException(MAL, "batgeom.wkbDistanceFiltered", "BATs 
must have dense heads");
+               ret = createException(MAL, "batgeom.Distance", "BATs must have 
dense heads");
                goto clean;
        }
        if(xBAT->hseqbase != yBAT->hseqbase || BATcount(xBAT) != 
BATcount(yBAT)) {
-               ret=createException(MAL, "batgeom.wkbDistanceFiltered", "BATs 
must be aligned");
+               ret=createException(MAL, "batgeom.Distance", "BATs must be 
aligned");
                goto clean;
        }
 
        //project the x and y BATs
        xFilteredBAT = BATproject(OIDsBAT, xBAT);
        if(xFilteredBAT == NULL) {
-               ret=createException(MAL,"batgeom.wkbDistanceFiltered","Problem 
projecting xBAT");
+               ret=createException(MAL,"batgeom.Distance","Problem projecting 
xBAT");
                goto clean;
        }
        yFilteredBAT = BATproject(OIDsBAT, yBAT);
        if(xFilteredBAT == NULL) {
-               ret=createException(MAL,"batgeom.wkbDistanceFiltered","Problem 
projecting yBAT");
+               ret=createException(MAL,"batgeom.Distance","Problem projecting 
yBAT");
                goto clean;
        }
 
        //here the BAT version of some contain function that takes the BATs of 
the x y coordinates should be called
        //create the points BAT
        if((pointsBAT = BATMakePoint2D(xFilteredBAT, yFilteredBAT)) == NULL) {
-               ret = createException(MAL, "batgeom.wkbDistanceFiltered", 
"Problem creating the points from the coordinates");
+               ret = createException(MAL, "batgeom.Distance", "Problem 
creating the points from the coordinates");
                goto clean;
        }
        //set the srid  
        if((pointsWithSRIDBAT = BATSetSRID(pointsBAT, *srid)) == NULL) {
-               ret = createException(MAL, "batgeom.wkbDistanceFiltered", 
"Problem setting srid to the points");
+               ret = createException(MAL, "batgeom.Distance", "Problem setting 
srid to the points");
                goto clean;
        }
        //check the contains
        if((outBAT = BATDistance(geomWKB, pointsWithSRIDBAT)) == NULL) {
-               ret = createException(MAL, "batgeom.wkbDistanceFiltered", 
"Problem evalauting the contains");
+               ret = createException(MAL, "batgeom.Distance", "Problem 
evalauting the contains");
                goto clean;
        }
 
@@ -478,23 +478,23 @@ str wkbFilterWithImprints_geom_bat(bat* 
 
        //get the descriptors of the BATs
        if ((xBAT = BATdescriptor(*xBAT_id)) == NULL) {
-               throw(MAL, "batgeom.wkbFilterWithImprints", 
RUNTIME_OBJECT_MISSING);
+               throw(MAL, "batgeom.Filter", RUNTIME_OBJECT_MISSING);
        }
        if ((yBAT = BATdescriptor(*yBAT_id)) == NULL) {
                BBPreleaseref(xBAT->batCacheid);
-               throw(MAL, "batgeom.wkbFilterWithImprints", 
RUNTIME_OBJECT_MISSING);
+               throw(MAL, "batgeom.Filter", RUNTIME_OBJECT_MISSING);
        }
 
        //check if the BATs have dense heads and are aligned
        if (!BAThdense(xBAT) || !BAThdense(yBAT)) {
                BBPreleaseref(xBAT->batCacheid);
                BBPreleaseref(yBAT->batCacheid);
-               return createException(MAL, "batgeom.wkbFilterWithImprints", 
"BATs must have dense heads");
+               return createException(MAL, "batgeom.Filter", "BATs must have 
dense heads");
        }
        if(xBAT->hseqbase != yBAT->hseqbase || BATcount(xBAT) != 
BATcount(yBAT)) {
                BBPreleaseref(xBAT->batCacheid);
                BBPreleaseref(yBAT->batCacheid);
-               return createException(MAL, "batgeom.wkbFilterWithImprints", 
"BATs must be aligned");
+               return createException(MAL, "batgeom.Filter", "BATs must be 
aligned");
        }
 
        //create the MBR of the geom
@@ -502,7 +502,7 @@ str wkbFilterWithImprints_geom_bat(bat* 
                str msg;
                BBPreleaseref(xBAT->batCacheid);
                BBPreleaseref(yBAT->batCacheid);
-               msg = createException(MAL, "batgeom.wkbFilterWithImprints", 
"%s", err);
+               msg = createException(MAL, "batgeom.Filter", "%s", err);
                GDKfree(err);
                return msg;
        }
@@ -514,7 +514,7 @@ str wkbFilterWithImprints_geom_bat(bat* 
        if(xCandidateOIDsBAT == NULL) {
                BBPreleaseref(xBAT->batCacheid);
                BBPreleaseref(yBAT->batCacheid);
-               return 
createException(MAL,"batgeom.wkbFilterWithImprints","Problem filtering xBAT");
+               return createException(MAL,"batgeom.Filter","Problem filtering 
xBAT");
        }
        
        //get candidateOIDs using yBAT and xCandidateOIDsBAT
@@ -524,7 +524,7 @@ str wkbFilterWithImprints_geom_bat(bat* 
        if(candidateOIDsBAT == NULL) {
                BBPreleaseref(xBAT->batCacheid);
                BBPreleaseref(yBAT->batCacheid);
-               return 
createException(MAL,"batgeom.wkbFilterWithImprints","Problem filtering yBAT");
+               return createException(MAL,"batgeom.Filter","Problem filtering 
yBAT");
        }
 
        BBPreleaseref(xBAT->batCacheid);
diff --git a/geom/sql/40_geom.sql b/geom/sql/40_geom.sql
--- a/geom/sql/40_geom.sql
+++ b/geom/sql/40_geom.sql
@@ -4057,7 +4057,7 @@ CREATE FUNCTION ST_Overlaps(geom1 Geomet
 CREATE FUNCTION ST_Relate(geom1 Geometry, geom2 Geometry, 
intersection_matrix_pattern string) RETURNS boolean EXTERNAL NAME geom."Relate";
 --Distance between Geometries
 CREATE FUNCTION ST_Distance(geom1 Geometry, geom2 Geometry) RETURNS double 
EXTERNAL NAME geom."Distance";
-CREATE FUNCTION ST_Distance(geom1 Geometry, xCoordinate double, yCoordinate 
double, srid integer) RETURNS boolean EXTERNAL NAME geom."Distance";
+CREATE FUNCTION ST_Distance(geom1 Geometry, xCoordinate double, yCoordinate 
double, srid integer) RETURNS double EXTERNAL NAME geom."Distance";
 --Functions that implement spatial operators
 CREATE FUNCTION ST_Intersection(geom1 Geometry, geom2 Geometry) RETURNS 
Geometry EXTERNAL NAME geom."Intersection";
 CREATE FUNCTION ST_Difference(geom1 Geometry, geom2 Geometry) RETURNS Geometry 
EXTERNAL NAME geom."Differnce";
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to