本文整理汇总了Java中com.qozix.tileview.TileView.addDetailLevel方法的典型用法代码示例。如果您正苦于以下问题:Java TileView.addDetailLevel方法的具体用法?Java TileView.addDetailLevel怎么用?Java TileView.addDetailLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.qozix.tileview.TileView
的用法示例。
在下文中一共展示了TileView.addDetailLevel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.qozix.tileview.TileView; //导入方法依赖的package包/类
@Override
public void onCreate( Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
// multiple references
TileView tileView = getTileView();
// let the image explode
tileView.setScaleLimits( 0, 2 );
// size of original image at 100% mScale
tileView.setSize( 2835, 4289 );
// detail levels
tileView.addDetailLevel( 1.000f, "tiles/painting/1000/%d_%d.jpg");
tileView.addDetailLevel( 0.500f, "tiles/painting/500/%d_%d.jpg");
tileView.addDetailLevel( 0.250f, "tiles/painting/250/%d_%d.jpg");
tileView.addDetailLevel( 0.125f, "tiles/painting/125/%d_%d.jpg");
// set mScale to 0, but keep scaleToFit true, so it'll be as small as possible but still match the container
tileView.setScale( 0 );
// let's use 0-1 positioning...
tileView.defineBounds( 0, 0, 1, 1 );
// frame to center
frameTo( 0.5, 0.5 );
// render while panning
tileView.setShouldRenderWhilePanning( true );
// disallow going back to minimum scale while double-taping at maximum scale (for demo purpose)
tileView.setShouldLoopScale( false );
}
示例2: onCreate
import com.qozix.tileview.TileView; //导入方法依赖的package包/类
@Override
public void onCreate( Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
// multiple references
TileView tileView = getTileView();
// size of original image at 100% mScale
tileView.setSize( 4015, 4057 );
// we're running from assets, should be fairly fast decodes, go ahead and render asap
tileView.setShouldRenderWhilePanning( true );
// detail levels
tileView.addDetailLevel( 1.000f, "tiles/fantasy/1000/%d_%d.jpg");
tileView.addDetailLevel( 0.500f, "tiles/fantasy/500/%d_%d.jpg");
tileView.addDetailLevel( 0.250f, "tiles/fantasy/250/%d_%d.jpg");
tileView.addDetailLevel( 0.125f, "tiles/fantasy/125/%d_%d.jpg" );
// allow scaling past original size
tileView.setScaleLimits( 0, 2 );
// lets center all markers both horizontally and vertically
tileView.setMarkerAnchorPoints( -0.5f, -0.5f );
// individual markers
placeMarker( R.drawable.fantasy_elves, 1616, 1353 );
placeMarker( R.drawable.fantasy_humans, 2311, 2637 );
placeMarker( R.drawable.fantasy_dwarves, 2104, 701 );
placeMarker( R.drawable.fantasy_rohan, 2108, 1832 );
placeMarker( R.drawable.fantasy_troll, 3267, 1896 );
// frame the troll
frameTo( 3267, 1896 );
}
示例3: setMap
import com.qozix.tileview.TileView; //导入方法依赖的package包/类
/**
* Sets the map to generate a new {@link TileView}.
*
* @param map The new {@link Map} object
*/
public void setMap(Map map) {
/* Keep a weakRef for future references */
mMapWeakReference = new WeakReference<>(map);
TileView tileView = new TileView(this.getContext());
/* Set the size of the view in px at scale 1 */
tileView.setSize(map.getWidthPx(), map.getHeightPx());
/* Lowest scale */
List<MapGson.Level> levelList = map.getLevelList();
float scale = 1 / (float) Math.pow(2, levelList.size() - 1);
/* Scale limits */
tileView.setScaleLimits(scale, 2);
/* Starting scale */
tileView.setScale(scale);
/* DetailLevel definition */
for (MapGson.Level level : levelList) {
tileView.addDetailLevel(scale, level.level, level.tile_size.x, level.tile_size.y);
/* Calculate each level scale for best precision */
scale = 1 / (float) Math.pow(2, levelList.size() - level.level - 2);
}
/* Panning outside of the map is not possible --affects minimum scale */
tileView.setShouldScaleToFit(true);
/* Disable animations. As of 03/2016, it leads to performance drops */
tileView.setTransitionsEnabled(false);
/* Render while panning */
tileView.setShouldRenderWhilePanning(true);
/* Map calibration */
tileView.defineBounds(0, 0, 1, 1);
/* The calibration marker */
mCalibrationMarker = new CalibrationMarker(this.getContext());
MarkerTouchMoveListener.MarkerMoveCallback callback = new CalibrationMarkerMoveCallback();
mCalibrationMarker.setOnTouchListener(new MarkerTouchMoveListener(tileView, callback));
tileView.addMarker(mCalibrationMarker, 0.5, 0.5, -0.5f, -0.5f);
/* The BitmapProvider */
tileView.setBitmapProvider(map.getBitmapProvider());
/* Add the TileView to the root view */
setTileView(tileView);
/* Update the ui */
rootView.setup();
/* Check whether the Map has defined a projection */
if (map.getProjection() == null) {
rootView.noProjectionDefined();
} else {
rootView.projectionDefined();
}
}
示例4: onCreate
import com.qozix.tileview.TileView; //导入方法依赖的package包/类
@Override
public void onCreate( Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
// multiple references
TileView tileView = getTileView();
// size of original image at 100% mScale
tileView.setSize( 2736, 2880 );
// small map, let's let it resize to 200%
tileView.setScaleLimits( 0, 2 );
// we're running from assets, should be fairly fast decodes, go ahead and render asap
tileView.setShouldRenderWhilePanning( true );
// detail levels
tileView.addDetailLevel( 1.000f, "tiles/plans/1000/%d_%d.jpg");
tileView.addDetailLevel( 0.500f, "tiles/plans/500/%d_%d.jpg");
tileView.addDetailLevel( 0.250f, "tiles/plans/250/%d_%d.jpg");
tileView.addDetailLevel( 0.125f, "tiles/plans/125/%d_%d.jpg");
// let's use 0-1 positioning...
tileView.defineBounds( 0, 0, 1, 1 );
// center markers along both axes
tileView.setMarkerAnchorPoints( -0.5f, -0.5f );
// add a marker listener
tileView.setMarkerTapListener( mMarkerTapListener );
// add some pins...
addPin( 0.25, 0.25 );
addPin( 0.25, 0.75 );
addPin( 0.75, 0.25 );
addPin( 0.75, 0.75 );
addPin( 0.50, 0.50 );
// mScale it down to manageable size
tileView.setScale( 0.5f );
// center the frame
frameTo( 0.5, 0.5 );
}