EnvelopesIntersect restituisce 1 (TRUE) se le curve di due figure geometriche si intersecano; altrimenti restituisce 0 (FALSE).
Sintassi
db2gse.EnvelopesIntersect(g1 db2gse.ST_Geometry, g2 db2gse.ST_Geometry)
Tipo di ritorno
Integer
Esempi
La funzione get_window richiama le coordinate della finestra di visualizzazione dall'applicazione. Il parametro della finestra ha una struttura a forma di poligono contenente una stringa di coordinate che rappresentano il poligono di visualizzazione. La funzione PolyFromShape converte il formato della finestra di visualizzazione in un poligono DB2 Spatial Extender che viene utilizzato dalla funzione EnvelopesIntersect come curva di intersezione. Vengono restituiti tutti i poligoni SENSITIVE_AREAS che intersecano l'interno o i margini della finestra di visualizzazione. Ogni poligono viene richiamato dalla serie dei risultati e passato alla funzione 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.AsBinaryShape(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);