MCPcopy Index your code
hub / github.com/1993hzw/TiledMapView

github.com/1993hzw/TiledMapView @1.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.2 ↗ · + Follow
678 symbols 1,447 edges 64 files 88 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

TiledMapView

Tiled map loader for Android, based on the pyramid model, supports a variety of projections, including Web Mercator projection, latitude and longitude projection and custom projection; supports locating, adding layers and overlays.

Android瓦片地图加载,基于金字塔模型,支持多种投影,包括Web墨卡托投影,经纬度直投及自定义投影等;支持定位,添加图层和覆盖物。

googlemap

tianditu

Usage 用法

Gradle

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

dependencies {
    compile 'com.github.1993hzw:TiledMapView:1.1.1'
}

TiledMapView uses the library Picasso as the default images loader. So you should add the additional dependence if you want to use the Picasso :

TiledMapView使用Picasso库作为默认图像加载程序。因此,如果你想使用Picasso,应该额外增加依赖:

dependencies {
    implementation 'com.squareup.picasso:picasso:2.71828'
}

Code

Add the TiledMapView to your layout.xml:

在布局里添加TiledMapView:

<cn.forward.tiledmapview.TiledMapView
    android:id="@+id/mapview"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
TiledMapView mapView = (TiledMapView)findViewById(R.id.mapview);

Now, you can add a tile layer. For example, you can add the Google tiled map:

现在你可以添加瓦片图层。以加载谷歌地图为例:

TiledMapView mapView = (TiledMapView) findViewById(R.id.mapview);
ITileLayer googleTileLayer = new GoogleTileLayer(mMapView, GoogleOnlineTileImageSource.ImgType.SATILLITE_WITH_MARKER);
mapView.getLayerGroup().add(googleTileLayer);

Currently, Tiled MapView directly supports loading Google maps (GoogleTileLayer), Tianditu maps(TiandituTileLayer), and the custom tiled maps.

目前,TiledMapView直接支持加载谷歌地图(GoogleTileLayer),天地图(TiandituTileLayer),以及自定义瓦片地图。

Also, you can add some overlays:

另外,你也可以添加覆盖物:

TextPixelOverlay textPixelOverlay = new TextPixelOverlay("Hello world!");
textPixelOverlay.setBackgroundColor(0x99ffffff);
textPixelOverlay.getTextPaint().setColor(Color.BLUE);
textPixelOverlay.getTextPaint().setTextSize(Util.dp2px(getApplicationContext(), 14));
textPixelOverlay.setLocationOnMap(0,-300);
mapView.getLayerGroup().add(textPixelOverlay);

You can use BitmapPixelOverlay/BitmapMapOverlay, if you want add a bitmap overlay.

可以通过使用BitmapPixelOverlay/BitmapMapOverlay添加图片覆盖物

Extending 拓展

There is a sample of LOL game map which shows how to load the custom tiled map.

这里有一个加载LOL游戏地图的示例,显示了如何加载自定义瓦片地图

lol

TiledMapView is a powerful, customizable and extensible loading library. There will be more documentation in the future, but you can now find more features by reading the code. Just enjoy it!

TiledMapView是一个功能强大、可定制和可扩展的加载库。将来会提供更多的文档,当然,现在您可以通过阅读代码来找到更多的特性,尽情探索吧!

Tile cutter 瓦片切割工具

The local tiles in this project are generated by tile-cutter. For more information, please go to tile-cutter.

本项目中的本地瓦片均由tile-cutter生成,想要了解更多请前往tile-cutter

The developer 开发者

154330138@qq.com hzw19933@gmail.com

Q&A TiledMap交流群 QQ Group ID: 885437848

License

    Copyright (C) 2019  Ziwei Huang

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

Donations 打赏

If this project helps you a lot and you want to support the project's development and maintenance of this project, feel free to scan the following QR code for donation. Your donation is highly appreciated. Thank you!

如果这个项目对您有很大帮助,并且您想支持该项目的项目开发和维护,请扫描以下二维码进行捐赠。非常感谢您的支持!

donate

Extension points exported contracts — how you extend this code

ITileImageSource (Interface)
@author ziwei huang [13 implementers]
library/src/main/java/cn/forward/tiledmapview/core/ITileImageSource.java
IMapTouchDetector (Interface)
@author ziwei huang [4 implementers]
library/src/main/java/cn/forward/tiledmapview/core/IMapTouchDetector.java
IOnTouchGestureListener (Interface)
识别手势的回调接口 [4 implementers]
library/src/main/java/cn/forward/tiledmapview/util/TouchGestureDetector.java
ILoaderCallback (Interface)
(no doc) [5 implementers]
library/src/main/java/cn/forward/tiledmapview/core/ITileImageCache.java
OnScaleGestureListener (Interface)
The listener for receiving notifications when gestures occur. If you want to listen for all the different gestures then [3 …
library/src/main/java/cn/forward/tiledmapview/util/ScaleGestureDetectorApi27.java

Core symbols most depended-on inside this repo

getWidth
called by 25
library/src/main/java/cn/forward/tiledmapview/overlay/AbstractOverlay.java
getResolution
called by 23
library/src/main/java/cn/forward/tiledmapview/core/ITileConfig.java
add
called by 22
library/src/main/java/cn/forward/tiledmapview/core/ILayerGroup.java
getHeight
called by 20
library/src/main/java/cn/forward/tiledmapview/overlay/AbstractOverlay.java
get
called by 16
library/src/main/java/cn/forward/tiledmapview/core/ILayerGroup.java
d
called by 15
library/src/main/java/cn/forward/tiledmapview/util/LogUtil.java
getResolution
called by 14
library/src/main/java/cn/forward/tiledmapview/TiledMapView.java
setVisible
called by 13
library/src/main/java/cn/forward/tiledmapview/core/ILayer.java

Shape

Method 598
Class 59
Interface 17
Enum 4

Languages

Java100%

Modules by API surface

library/src/main/java/cn/forward/tiledmapview/TiledMapView.java63 symbols
library/src/main/java/cn/forward/tiledmapview/util/TouchGestureDetector.java46 symbols
library/src/main/java/cn/forward/tiledmapview/core/ITiledMapView.java36 symbols
library/src/main/java/cn/forward/tiledmapview/util/ScaleGestureDetectorApi27.java33 symbols
library/src/main/java/cn/forward/tiledmapview/layer/TileImageCache.java29 symbols
library/src/main/java/cn/forward/tiledmapview/overlay/AbstractOverlay.java26 symbols
library/src/main/java/cn/forward/tiledmapview/core/MapRect.java26 symbols
library/src/main/java/cn/forward/tiledmapview/layer/TileLayer.java21 symbols
library/src/main/java/cn/forward/tiledmapview/core/ILayer.java21 symbols
library/src/main/java/cn/forward/tiledmapview/core/ITileConfig.java18 symbols
app/src/main/java/cn/forward/tiledmapview/demo/TiledMapDemoActivity.java18 symbols
library/src/main/java/cn/forward/tiledmapview/LayerGroup.java17 symbols

For agents

$ claude mcp add TiledMapView \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact