-
Notifications
You must be signed in to change notification settings - Fork 336
Home
moagrius edited this page Jul 14, 2014
·
12 revisions
The TileView widget is a subclass of ViewGroup that provides a mechanism to asynchronously display tile-based images, with additional functionality for 2D dragging, flinging, pinch or double-tap to zoom, adding overlaying Views (markers), built-in Hot Spot support, dynamic path drawing, multiple levels of detail, and support for any relative positioning or coordinate system.
A minimal implementation might look like this:
TileView tileView = new TileView(this);
tileView.setSize(3000,5000);
tileView.addDetailLevel(1.0f, "path/to/tiles/%col%-%row%.jpg");
A more advanced implementation might look like:
TileView tileView = new TileView(this);
tileView.setSize(3000,5000);
tileView.addTileViewEventListener(someMapEventListener);
tileView.addMarkerEventListener(someMarkerEventListener);
tileView.defineRelativeBounds(42.379676, -71.094919, 42.346550, -71.040280);
tileView.addDetailLevel(1.000f, "tiles/boston-1000-%col%_%row%.jpg", 256, 256);
tileView.addDetailLevel(0.500f, "tiles/boston-500-%col%_%row%.jpg", 256, 256);
tileView.addDetailLevel(0.250f, "tiles/boston-250-%col%_%row%.jpg", 256, 256);
tileView.addDetailLevel(0.125f, "tiles/boston-125-%col%_%row%.jpg", 128, 128);
tileView.addMarker(someView, 42.35848, -71.063736);
tileView.addMarker(anotherView, 42.3665, -71.05224);
A sample project is available for review as well.