若两个几何图形的包络相交, EnvelopesIntersect 返回 1 (TRUE);否则,它返回 0 (FALSE)。
语法
db2gse.EnvelopesIntersect(g1 db2gse.ST_Geometry, g2 db2gse.ST_Geometry)
返回类型
整数
示例
get_window 函数从应用程序检索显示窗口的坐标。 窗口参数实际上是一种多边形形状结构,它包含一列代表显示多边形的坐标。 PolyFromShape 函数将显示窗口形状转换为 DB2 Spatial Extender 多边形, EnvelopesIntersect 函数将该多边形用作它的相交包络。返回与显示窗口的内部或边界相交的所有 SENSITIVE_AREAS 区域多边形。将每个多边形从结果集取出并传送给 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);