EnvelopesIntersect renvoie la valeur 1 (TRUE) si les enveloppes de deux géométries génèrent une intersection, et la valeur 0 (FALSE) dans le cas contraire.
Syntaxe
db2gse.EnvelopesIntersect(g1 db2gse.ST_Geometry, g2 db2gse.ST_Geometry)
Type de retour
Integer
Exemples
La fonction get_window extrait les coordonnées de la fenêtre d'affichage à partir de l'application. Le paramètre de la fenêtre est en l'occurrence une structure de forme polygonale contenant une chaîne de coordonnées qui représentent le polygone d'affichage. La fonction PolyFromShape convertit la forme de la fenêtre d'affichage en un polygone Extension Spatiale ; la fonction EnvelopesIntersect se sert de celui-ci en tant qu'enveloppe de l'intersection qu'elle génère. Tous les polygones de zone SENSITIVE_AREAS qui forment une intersection avec l'intérieur ou le contour de la fenêtre d'affichage sont renvoyés. Chaque polygone est extrait de l'ensemble de résultats et transmis à la fonction draw_polygon.
/* Get the display window coordinates as a polygon shape. get_window(&window) /* Create the SQL expression. The db2gse.EnvelopesIntersect function will be used to limit the result set to only those zone polygons that intersect the envelope of the display window. */ strcpy(sqlstmt, "select db2gse.AsShape(zone) from SENSITIVE_AREAS where db2gse.EnvelopesIntersect (zone, db2gse.PolyFromShape(cast(? as blob(1m)), db2gse.coordref()..srid(0)))"); /* Set blob_len to the byte length of a 5 point shape polygon. */ blob_len = 128; /* Prepare the SQL statement. */ SQLPrepare(hstmt, (UCHAR *)sqlstmt, SQL_NTS); /* Set the pcbvalue1 to the window shape */ pcbvalue1 = blob_len; /* Bind the shape parameter */ SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_BLOB, blob_len,0, window, blob_len, &pcbvalue1); /* Execute the query */ rc = SQLExecute (hstmt); /* Assign the results of the query, (the Zone polygons) to the fetched_binary variable. */ SQLBindCol (hstmt, 1, SQL_C_Binary, fetched_binary, 100000, &ind_blob); /* Fetch each polygon within the display window and display it. */ while(SQL_SUCCESS == (rc = SQLFetch(hstmt)) draw_polygon(fetched_binary);