使用 C# 绘制楼层地图
我打算做一个与停车管理相关的应用程序。用户填写有汽车的地方。
下图取自一个中文软件。它有停车位,用户可以选择是否免费。我不明白它是如何完成的,但该软件将 bmp
文件作为输入,然后用户可以向其中添加海湾信息。
添加信息后,用户可以单击添加的任何海湾来查看其信息。
我很困惑如何将 bmp
文件分层,以便单独识别每个海湾。
任何可以轻松完成此任务的东西(winform 或 WPF) 我想知道我怎样才能完成这项任务。任何开源库?任何东西。
I intend to make an application that is related to parking management.User fills in the places where car is present.
The figure shown below is taken from a software made in chines language. It has parking bays and user selects that if it is free or not. I donot understand how it is done but that software takes bmp
file as input and then user can add bay information to it.
after the information has been added user can click on any bay added to see its information.
i am confused that how a bmp
file can be layered in such a way that each bay is being identified seperately.
anything(winform or WPF) in which this task is easy to accomplish
i want to know that how can i acomplish this task. any open source library ?anything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我将从所有海湾都是白色的事实开始,因此通过进行一些图像处理,程序可以通过查找所有颜色来确定车库的布局,然后获取将导致生成图例的信息。这在向楼梯添加信息时非常有用,例如,它将与停车位信息不同。
现在,由于 bmp 地图是静态的,我会将其转换为 .png 以方便使用。
然后,创建第二个具有透明背景的 .png 并将其放在第一个 .png 之上,以便可以添加数字等信息。
因此,您可以通过这种方法拥有多个图层,并根据需要放置正确的图层来显示它。
您也可以只存储标签的 x,y 坐标,但我认为这会很糟糕,因为程序必须每次都将其添加到图像中,而不是只执行一次。
I would start with the fact that all the bays are white, so by doing a little image processing a program can determine what the layout of the garage is by finding all the colors, then getting the information that will lead to a legend being generated. This is useful since then when adding information to stairs, for example, it will be different than information on a parking spot.
Now, since the bmp map is static, I would convert it to a .png for ease of use.
Then, create a second .png that has a transparent background and put that on top of the first, so information such as the numbers can be added.
So then you could have multiple layers by going with this approach, and display it by putting the correct layers on as needed.
You could also just store the x,y coordinates of the labels, but I think that would be bad since then the program has to add this to the image every time, rather than just doing it one time.
我知道这不是 C# 答案,但 winforms 和 wpf 都可以托管 Web 浏览器控件。这是一个很好的功能,因为 html 支持称为图像映射的东西,它正是您所寻找的。本质上,您可以识别单个图像中的区域,并在单击、悬停等时对它们执行某些操作。
图像地图:http://www.w3schools.com/TAGS/tag_map.asp
I know this isn't a C# answer, but winforms and wpf can both host a web browser control. That is a nice feature since html has support for something called image maps which do exactly what you are looking for. Essentially, you can identify areas in a single image and when clicked, hovered, etc... do something with them.
Image maps: http://www.w3schools.com/TAGS/tag_map.asp