显示SVG文件中的Andr​​oid [英] Displaying SVG files in Android

查看:204
本文介绍了显示SVG文件中的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个应用程序,将显示在一些楼层平面位置。导航是通过Wi-Fi以一定的方式实施,我已经做到了,因此现在我已经展示平面图的问题。这可能是一些矢量格式,serfing上网一段时间后我decieded,它必须是.svg文件之后。 我找到了一些解决方案,但它不是为我工作!

I want to create an app that will display position on some floor plan. Navigation is implementing via wi-fi in certain way, I've done it and so now I have a problem of displaying floor plan. It might be in some vector format, after serfing internet for some time I've decieded that it must be .svg file. I found some solutions, but it isn't working for me!

1 库SVG-安卓 有机会展示.SVG文件,但只是简单的文件。它工作正常,仅在教程文件,但不得用于任何其它.svg文件(例如,一些其他的文件,你会创建Inkspace)。

1. Library svg-android There is opportunity to display .svg files, but only "simple" files. It works fine only for file in tutorial, but not for any other .svg file (for example, some other file, that you'll create with Inkspace).

所以,我decieded,我会分析.svg文件,从中做出DOM,在某种程度上得到对象和属性,并通过OpenGL ES绘制。

So, I decieded, that I'll parse .svg file, make DOM from it, somehow get objects and attributes and draw it via OpenGL ES.

2 阿帕奇蜡染 乍一看,非常好的解决方案,但有一个问题。 Android有一些本土Apache库,当我尝试做一些与蜡染,它抛出NoClassDefFoundError的,因为它没有搜索蜡染库,但在本土库。 当然,我们可以添加源$ C ​​$ C在我们的项目中,只需要蜡染解析器.SVG文件和编辑它在某些方面,更是有大量的工作,具有相同的更迭,我们可以写我们自己的解析器。

2. Apache Batik At first glance, very good solution, but there is a problem. Android has some "native" apache libraries and when I try to do something with batik, it throws NoClassDefFoundError, because it's searching not in batik libraries, but in "native" libraries. Of course, we can add source code in our project, take only batik parser for .svg files and edit it in some way, but there is a lot of work, with same succes we can write our own parser.

3。微型线(http://www.tinyline.com/) 有没有试用版,但如果我们将看到它是如何工作的SVG文件和Android的描述(http://www.tinyline.com/svgt/index.html),我们会看到有只光栅化这样的文件,这一切。

3. Tiny Line (http://www.tinyline.com/) There is no trial version, but if we'll see description (http://www.tinyline.com/svgt/index.html) of how it works for svg files and android, we'll see that there is only rasterisation of such files and that's all.

有没有什么解决办法比写自己的解析器更好? 有没有人遇到过这个问题吗?

Is there any solution better than writing own parser? Did anyone come across this problem?

推荐答案

我会建议使用#1。不要写你自己的解析器。它只是将是一个巨大的头痛。

I would suggest using #1. Don't write your own parser. It's just going to be a huge headache.

如何详细贵平面图必须是? Android的SVG支持SVG相当好。它只是不具有过滤器或光源的大力支持。您的SVG是不会有那些在他们(我希望)。

How detailed does your floor plan have to be? android-svg supports SVG fairly well. It just doesn't have great support for filters or light sources. Your SVG isn't going to have those in them (I hope).

如果你不想这样做,看看四棵。您可以呈现出一个巨大的形象,打破下来到像格式的四叉树,然后只加载您需要的四边形。

If you don't want to do that, look into quad trees. You can render out a huge image and break that down into a quadtree like format then only load the quads you require.

这篇关于显示SVG文件中的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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