Benutzer- und Referenzhandbuch

EnvelopesIntersect

EnvelopesIntersect gibt 1 (TRUE) zurück, wenn sich die Umrisse von zwei Geometrien schneiden; andernfalls wird 0 (FALSE) zurückgegeben.

Syntax

db2gse.EnvelopesIntersect(g1 db2gse.ST_Geometry, g2 db2gse.ST_Geometry)

Rückgabetyp

Integer

Beispiele

Die Funktion get_window ruft die Koordinaten des Anzeigefensters aus der Anwendung ab. Der Fensterparameter ist tatsächlich eine Struktur in Form eines Polygons mit einer Zeichenfolge von Koordinaten, die das Anzeigepolygon darstellen. Die Funktion PolyFromShape wandelt die Form des Anzeigefensters in ein DB2 Spatial Extender-Polygon um, das die Funktion EnvelopesIntersect als ihren Schnittumriß verwendet. Alle Zonenpolygone SENSITIVE_AREAS, die den inneren Bereich oder die Begrenzung des Anzeigefensters schneiden, werden zurückgegeben. Jedes Polygon wird aus dem Ergebnis abgerufen und an die Funktion draw_polygon weitergegeben.

/* 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);


[ Seitenanfang | Vorherige Seite | Nächste Seite | Inhaltsverzeichnis | Index ]