在浏览器中渲染 2d autocad 绘图的想法
我正在开发 .net mvc Web 应用程序。一项核心功能是需要获取 DWG (AutoCAD) 文件并将其渲染在 Web 应用程序上,以便用户可以放大/缩小并在绘图上移动。我还需要在绘图中添加叠加层来表示各种事物。
我正在努力找出最好的方法来做到这一点。有各种 .net CAD 库,但最好的基于浏览器的工具是将文件转换为服务器上的图像并将其呈现在页面上。
我目前的想法是将 dwg 转换为图像,使用 google maptiler 之类的东西以各种方式切碎图像缩放级别,然后使用 openlayers.org 之类的东西将其呈现给用户。
还有其他/更简单/更好的解决方案吗?
I'm working on a .net mvc web application. A core piece of functionality is a requirement to take a DWG (AutoCAD) file, and render it on the web application, in such a way that the user can zoom in/out and move about the drawing. I also need to add overlays to the drawing to represent various things.
I'm trying to work out the best way to do this. There are various .net CAD libraries out there but the best you can get browser-based are tools that will convert the file to an image on the server and render it on the page.
My current idea is to convert the dwg to an image, use something like google maptiler to chop up the image at various zoom levels, and then use something like openlayers.org to present this to the user.
Are there other/easier/better solutions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将 DWG 转换为 GIS 格式,例如地理参考图像(例如 geoTIFF),然后使用地图服务器将图像提供给 OpenLayers 或 Google 地图。
本质上,地图服务器会根据请求即时为您切碎图块。这意味着您可以支持任意缩放和平移。
这是使用 OpenLayers 进行操作的“最纯粹”方式 - 而且比听起来容易得多。 MapServer & GeoServer 是很好的免费开源地图服务器,这对他们来说只是普通的东西。过去,我曾经自己将图像切入 Google 地图图块中,但现在我不会再回头了。
You could convert the DWG to a GIS format like a geo-referenced image (e.g. geoTIFF), and then use a map server to serve the image to OpenLayers or to Google Maps.
Essentially the map server chops up the tiles for you on-the-fly as they are requested. This means you can support arbitrary zooming and panning.
This is the "purest" way of doing things with OpenLayers - and it's a lot easier than it might sound. MapServer & GeoServer are good free open source map servers, this is vanilla stuff for them. In the past I used to chop up images into Google Maps tiles myself, but I'm not going back now.
您可能需要查看 Autodesk 的 Freewheel 应用程序,它允许您在服务器上渲染 2D 和 3D 文件。
另一种可能性是将绘图文件的相关部分转换为您自己的格式,并使用 Javascript 渲染它们。您可以使用像 Dojo 这样的库来实现这一点。这种方法需要更多工作,但您将获得跨浏览器兼容性和对显示的更多控制。
You may want to look Autodesk's Freewheel application, which allows you to render 2D and 3D files on the server.
Another possibility would be to convert the relevant parts of the drawing file to your own format, and render them with Javascript. You can use a library like Dojo to facilitate this. This approach is more work, but you will get cross-browser compatibility and more control over the display.