在 mapsforge 中有很多“缩放”的方法。
如本例所示,您可以尝试直接缩放模型.zoom()
,mapViewPosition
而不是直接缩放模型。
如果这是您的要求,请尝试以下操作:
代码:
MapViewPosition mapViewPosition = mapView.getModel().mapViewPosition;
mapViewPosition.zoom((byte) XX); // Change it to a number (i.g. "(byte) 3")
我什至看不懂街名。
但是,如果您正在谈论UI TEXT,则可以尝试像这样更改它:
mapView.setTextScale(XX); // Again, number goes here
如果仅文本大小对您来说还不够,您可以尝试创建一个新的RenderTheme。
文档示例:
代码:
tileRendererLayer.setXmlRenderTheme(new ExternalRenderTheme(File)) // File should be
// the XML file for the RenderTheme
XML:
<?xml version="1.0" encoding="UTF-8"?>
<rendertheme xmlns="http://mapsforge.org/renderTheme" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mapsforge.org/renderTheme renderTheme.xsd" version="1">
<!-- matches all ways with a "highway=trunk" or a "highway=motorway" tag -->
<rule e="way" k="highway" v="trunk|motorway">
<line stroke="#FF9900" stroke-width="2.5" />
</rule>
<!-- matches all closed ways (first node equals last node) with an "amenity=…" tag -->
<rule e="way" k="amenity" v="*" closed="yes">
<area fill="#DDEECC" stroke="#006699" stroke-width="0.3" />
</rule>
<!-- matches all nodes with a "tourism=hotel" tag on zoom level 16 and above
-->
<rule e="node" k="tourism" v="hotel" zoom-min="16">
<symbol src="file:/path/to/symbol/icon/hotel.png" />
<caption k="name" font-style="bold" font-size="10" fill="#4040ff" />
</rule>
</rendertheme>