转换列表java.awt.geom.Point2D中到java.awt.geom.Area中 [英] Convert a list java.awt.geom.Point2D to a java.awt.geom.Area

查看:403
本文介绍了转换列表java.awt.geom.Point2D中到java.awt.geom.Area中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组我想转成Java中的一个闭合多边形点。我目前正在使用java.awt.geom.Point2D中和java.awt.geom.Area中,但无法弄清楚如何将一组点到一个区域。

I have a set of points that i want to turn into a closed polygon in Java. I'm currently trying to use java.awt.geom.Point2D and java.awt.geom.Area but can't figure out how to turn a group of the points into an Area.

我想我可以定义一组基于点Line2Ds,然后添加到这些领域,而且这是一个大量的工作,我很懒。那么,有没有一种更简单的方法去。

I think I can define a set of Line2Ds based on the points and then add those to the Areas, but that's a lot of work and I'm lazy. So is there an easier way to go.

问题是我有纬度/经度坐标列表,并希望建立,我可以使用命中测试的区域。

The problem is I have a list of lat/lon coordinates and want to build up an area that I can use for hit testing.

非核心Java库是一个可能性,以及。

Non-core Java libraries are a possibility as well.

更新,我看着java.awt.Polygon中使用,但它仅支持整数,我用双打为坐标操作。

Update, I looked at using java.awt.Polygon but it only supports ints and I'm operating with doubles for the coordinates.

推荐答案

http://bugs.sun.com/bugdatabase/view%5Fbug.do?bug%5Fid=4077518

听到了,客户?您应该使用的GeneralPath,尽管自1990年代后期没有Polygon2D的是API中一个明显的怪物卡车大小的洞。

Hear that, "customer"? You should be using GeneralPath, even though the absence of Polygon2D since the late 1990s is an obvious monster-truck-sized hole in the API.

这篇关于转换列表java.awt.geom.Point2D中到java.awt.geom.Area中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆