7.2.2 使用3D几何体:J3D_Geometry类
Oracle Database 11g的一个主要的新功能就是它能够对复杂的3D对象(表面和立方体)进行建模。新的J3D_Geometry类能够帮助你操作那些结构。注意,它是JGeometry的子类,所以到目前为止,你已经了解的所有方法都是适用的。
像处理JGeometry一样,从数据库中读取J3D_Geometry对象,然后由JGeometry对象构造一个J3D_Geometry对象。例如:
- byte[] image = rs. getBytes (1);
- JGeometry geom = JGeometry.load(image);
- J3D_Geometry geom3D = new J3D_Geometry (
- geom.getType(), geom.getSRID(),
- geom.getElemInfo(), geom.getOrdinatesArray()
- );
仅通过使用规则的JGeometry.store()函数向数据库中写入J3D_Geometry对象:
- STRUCT dbObject = JGeometry.store (dbConnection, geom3d);
- stmt.setObject (1,dbObject);
与JGeometry相似,它提供给你大量的方法用来对几何体进行不同的操作。表7-8总结了这些方法。
表7-8 3D几何体处理函数
方 法 | 目 的 |
anyInteract(J3D_Geometry A, double tolerance) | 判断两个三维几何体是否相交 |
extrusion(JGeometry polygon, double grdHeight, double height, Connection conn, boolean cond, double tolerance) | 通过对一个二维多边形 进行拉伸返回一个三维几何体 |
closestPoints(J3D_Geometry A, double tolerance) | 计算出两个三维几何体 中离得最近的点 |
getMBH(J3D_Geometry geom) | 对一个三维几何体返 回一个三维的边界框 |
validate(double tolerance) | 验证一个三维图像的有效性 |
area(double tolerance) | 计算一个面或立方体 中一面的面积 |
length(int count_shared_edges, double tolerance) | 计算三维形状的长度 |
volume(double tolerance) | 计算三维立方体的体积 |
distance(J3D_Geometry A, double tolerance) | 计算两个三维几何体之间的距 |