point-in-polygon 相关问题


如何获取应用程序的屏幕空间或 MAUI 中顶部和底部栏的高度?

我在计算某些项目的位置时遇到问题,以及它们是否在 MAUI 的屏幕上可见,使用如下函数 public Point GetScreenCoords(VisualElement视图) { var 结果 = 新...


使用 IndexedPointInAreaLocator 和 STRTree(JTS 拓扑套件)无法实现多边形中的点性能

私人列表findZonesForShipPosition(点点){ List zoneDefinitionCacheHits = new ArrayList<>(); strTree.query(point.getEnvelopeIn... private List<ZoneDefinitionCacheMemory> findZonesForShipPosition(Point point) { List<Object> zoneDefinitionCacheHits = new ArrayList<>(); strTree.query(point.getEnvelopeInternal(), zoneDefinitionCacheHits::add); return zoneDefinitionCacheHits.stream() .filter(ZoneDefinitionCacheMemory.class::isInstance) .map(ZoneDefinitionCacheMemory.class::cast) .filter(zoneDefinition -> isPointInsideGeometry(point, zoneDefinition.getGeometry())) .toList(); } private boolean isPointInsideGeometry(Point point, Geometry geometry) { PointOnGeometryLocator pointOnGeometryLocator = new IndexedPointInAreaLocator(geometry); int location = pointOnGeometryLocator.locate(point.getCoordinate()); boolean isInside = location == Location.INTERIOR; return isInside; } 我使用上面的代码来搜索多边形中的点,在查询之前将所有多边形和多边形插入到 strTree 中,并且我还使用 IndexedPointInAreaLocator 在 STR Tree 的顶部添加一个附加过滤器来验证是否给定点是否确实位于几何中。 此外,我的多边形非常大,这意味着某些多边形中有近 160 万个点。 因此,通过此实现,我面临着性能问题,这种方法至少需要 100 毫秒才能完成,这对于我的用例来说是不期望的。 这里可能出现什么问题?或任何以某种方式加快速度的建议。 我的用例:我将获得很多点来检测它们是否位于给定几何形状(多边形和多多边形)的内部或外部 我尝试使用 Polygon.contains(point) 谓词,但它比 IndexedPointInAreaLocator 方法花费更多时间。 如果你的多边形很大(从某种意义上说它们覆盖了很大的区域)或者形状很奇怪。然后,细分它们可能会提高索引性能,请记住索引首先在多边形的边界框上工作,以节省在多边形测试中进行昂贵的点。如果一个点落入许多边界框但只有一个多边形,则索引不会有太大帮助。 Paul Ramsey 的这篇博客文章在 PostGIS 上下文中讨论了这一点,但这里的底层实现是相同的。这个answer将帮助您划分多边形(因为我认为JTS没有细分方法)。 您还可以从 JTS 代码周围使用 GeoTools 中受益,因为这将允许您切换到使用具有内置索引的 PostGIS 或 GeoPackage 数据库,或更简单的 在内存存储中建立索引。


为什么每次我尝试将应用程序从 Anypoint Studio 部署到 CloudHub 时,我的 pom.xml 文件都会更新?

我的 pom.xml 文件中有以下部分用于我正在执行的虚拟项目: org.mule.tools.maven mule-maven-插件 我正在做的一个虚拟项目的 pom.xml 文件中有以下部分: <plugin> <groupId>org.mule.tools.maven</groupId> <artifactId>mule-maven-plugin</artifactId> <version>${mule.maven.plugin.version}</version> <extensions>true</extensions> <configuration> <classifier>mule-application</classifier> </configuration> </plugin> 每当我尝试直接从 Studio 将应用程序部署到 CloudHub 时,上面的部分就会更改为以下部分: <plugin> <groupId>org.mule.tools.maven</groupId> <artifactId>mule-maven-plugin</artifactId> <version>${mule.maven.plugin.version}</version> <extensions>true</extensions> <configuration> <classifier>---- select project type ----</classifier> </configuration> </plugin> 然后部署失败并出现以下错误: Publication status: error [INFO] ------------------------------------------------------------ [INFO] Steps: [INFO] - Description: Publishing asset [INFO] - Status: error [INFO] - Errors: [The asset is invalid, Error while trying to set type: app. Expected type is: rest-api.] [INFO] ......................................... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:33 min [INFO] Finished at: 2024-01-08T14:11:31+05:30 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.mule.tools.maven:exchange-mule-maven-plugin:0.0.17:exchange-deploy (default-exchange-deploy) on project super-biodata-sapi: Exchange publication failed: Publication ended with errors: [The asset is invalid, Error while trying to set type: app. Expected type is: rest-api.] -> [Help 1] 这可能是什么原因? 以下是一些细节: Anypoint Studio版本:7.16.0 Maven版本:3.8.8 Mule 运行时版本:4.4.0 Mule Maven 插件版本:3.8.0/4.0.0(两者都尝试过) Java版本:OpenJDK 11.0.9 我以前使用过 Anypoint Studio 7.15,在那里完全相同的项目没有任何问题。但更新后,我遇到了很多问题。 我还尝试使用“rest-api”而不是“mule-application”。然后,首先在部署开始时,“rest-api”更改为“mule-application”,然后再次更改为“----选择项目类型----”,最后失败。 我怀疑存在混乱。您提到您正在尝试将 Mule 4 应用程序部署到 CloudHub,但对资产的引用和错误消息与将资产发布到 Any point Exchange 相关。 CloudHub是一个部署和执行Mule应用程序的云平台。 Anypoint Exchange 是资产存储库,包括 REST API 的定义,但不包括 Mule 4 应用程序,也不用于执行任何操作。有关有效资产的详细信息,请参阅文档。 由于 mule-application 不是发布到 Exchange 的有效资产类型(对于 Mule 4),那么 Studio 似乎试图让您更改为有效的资产类型。 如果您尝试部署到 CloudHub,请参阅文档了解不同的方法。


在具有 Open Liberty Dev 模式的 Maven 项目中使用本地库

我有一个 Maven 项目,它构建了一个部署到 Open Liberty 的战争。我正在使用 Liberty maven 插件: io.openliberty.tools 我有一个 Maven 项目,它构建了一个部署到 Open Liberty 的战争。我正在使用 Liberty maven 插件: <plugin> <groupId>io.openliberty.tools</groupId> <artifactId>liberty-maven-plugin</artifactId> <version>3.9</version> <!-- Specify configuration, executions for liberty-maven-plugin --> </plugin> 我正在利用开发模式并且它运行良好。但是,我想在 Dev 模式下使用本地 jar 文件库。 我期望我能够将 jar 文件放置在项目中的特定位置,并且 Liberty 开发模式会自动拾取它们 - 类似于自动拾取 server.xml 的方式src/main/liberty/config。我的 server.xml 设置为在此处查找库:${shared.config.dir}/lib/global,因此我尝试将罐子放入 src/main/liberty/shared/config/lib/global 中,但这不起作用。 我看到的另一种选择是使用 Libity 插件的 copyDependencies 配置。 有一些推荐的方法可以实现我想做的事情吗?理想情况下,我想要最简单的解决方案,既适用于 liberty dev 模式,也适用于 vanilla maven 构建 (mvn package)。 这里的类似问题利用了 copyDependencies 配置,但具体来说,我正在寻找本地 jar 的最佳解决方案(是的,我可以使用系统范围的 Maven 坐标或在本地安装 jar) 如何在 Maven 构建期间将外部依赖项复制到 Open Liberty 谢谢 好问题,稍微概括一下问题,您可能可以使用三种方法: 1.使用资源插件 <build> <resources> <!-- Explicitly configure the default too --> <resource> <directory>${project.basedir}/src/main/resources</directory> </resource> <!-- Custom library --> <resource> <directory>${project.basedir}/mylib</directory> <targetPath>${project.build.directory}/liberty/wlp/usr/shared/lib/global</targetPath> <!-- Default, but just emphasizing the point --> <filtering>false</filtering> </resource> </resources> 由于开发模式在其“生命周期”中调用 resources:resources 目标,因此可以在没有任何插件配置的情况下进行配置(使用“/project/build/resources”(在 XPath 术语中)元素),并使用您的 <targetPath>可以复制到任何位置。 2.添加到config目录(src/main/liberty/config) 除了src/main/liberty/config/server.xml处的主服务器XML配置文件之外,您还可以将其他文件和目录放在那里,所有文件和目录都将通过开发模式复制过来。 所以你可以创建,例如src/main/liberty/config/mylib/my.jar,它会被复制到target/liberty/wlp/usr/servers/defaultServer/mylib/my.jar。然后,您可以从 server.xml 将此位置引用为相对于服务器配置目录的 "mylib/my.jar"。 (这不太适合要求复制到“.../shared/lib/global”的原始用例,但可能适合其他查看此问题的人)。 3.添加系统范围的依赖项 这在原来的问题中已经提到过。我不太喜欢这个解决方案。为了完整起见,我会提及它,但请您自行查找详细信息。 这可能会很有趣。


© www.soinside.com 2019 - 2024. All rights reserved.