JavaFX创建交互式地图 [英] JavaFX creating interactive map

查看:857
本文介绍了JavaFX创建交互式地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在设置交互式地图时遇到了问题。我想在鼠标移动到地图上时进行视觉反馈,以向用户指示他们可以点击哪些区域(例如,当鼠标光标超过可点击的
区域/城镇或区域可能突出显示时,鼠标光标可能会发生变化/发光)。

I have got a problem to set up the interactive map. I want to make the visual feedback as the mouse is moved over the map to indicate to users what areas they can click on (e.g. the mouse cursor might change when over a clickable area/town or the area might be highlighted/glow).

我怎样才能做到这一点?

How can I achieve this?

推荐答案

您的问题有点难以回答,因为您没有告诉我们您的地图是如何绘制的以及您已经绘制了什么了解地图上显示的几何图形。如果您只有地图的光栅图像,例如从纸质地图扫描,然后事情变得复杂。
对于类似的任务,我首先编写了一个程序来对地图进行地理参考,并以多边形的形式确定有趣区域的轮廓。
然后我使用多边形在地图显示上绘制轮廓。我为每个多边形添加了监听器,以便在鼠标进入或退出某个区域时收到通知。

Your question is a little bit difficult to answer because you do not tell us how your map is drawn and what you already know about the geometry shown on the map. If you only have a raster image of your map, e.g. scanned from a paper map, then things are getting complicated. For a similar task I first wrote a program to geo-reference the map and determine the outlines of the interesting areas in the form of polygons. Then I used the polygons to draw the outlines on the map display. I added listeners to each polygon so that I am notified when the mouse enters or exits an area.

这篇关于JavaFX创建交互式地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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