0

我正在使用 Hibernate Spatial API 检查多边形内部\外部的一个点。但这对我的用例没有帮助。

根据我的用例,我的数据库中有一个多边形形状。*需要检查一个点是否在存储的多边形内部/外部*

  • 点(几何)是我的输入。
  • 多边形(几何)存储在我的数据库中。
  • 每次我必须用我的存储多边形检查输入。

    通过 inside() 方法(HibernateSpatial API - NOT MySQL 方法),我可以通过点(几何)。但是该方法正在检查我的用例。


within 方法检查是否包含多边形的点。所以我在我的用例中得到了错误的结果。请参阅他们的文档以供参考。

   * An implication of the definition is that
   * "The boundary of a Geometry is not within the Geometry".
   * In other words, if a geometry A is a subset of
   * the points in the boundary of a geomtry B, <code>A.within(B) = false</code>
   *
   *@param  g  the <code>Geometry</code> with which to compare this <code>Geometry</code>
   *@return        <code>true</code> if this <code>Geometry</code> is within
   *      <code>other</code>
   *
   * @see Geometry#contains
   */

  public boolean within(Geometry g) {

        return g.contains(this);

  } 

如何使用 HibernateSpatial API 中的 Point 检查内部或外部的多边形。任何帮助深表感谢。

4

1 回答 1

0

以其他方式实现检查。需要实现另一种方法。方法如下

contains(Geometry G)

文档清楚地说明了这一点

于 2014-04-03T07:55:46.157 回答