本文整理汇总了Java中org.oscim.core.MapPosition类的典型用法代码示例。如果您正苦于以下问题:Java MapPosition类的具体用法?Java MapPosition怎么用?Java MapPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapPosition类属于org.oscim.core包,在下文中一共展示了MapPosition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onMapEvent
import org.oscim.core.MapPosition; //导入依赖的package包/类
@Override
public void onMapEvent(Event e, MapPosition mapPosition) {
if (e == Map.ANIM_START) {
// throw new RuntimeException("Use MapView animator instance of map.animator");
mAnimator.cancel();
} else if (e == Map.POSITION_EVENT) {
{// set yOffset at dependency of tilt
if (mapPosition.getTilt() > 0) {
float offset = MathUtils.linearInterpolation
(viewport().getMinTilt(), viewport().getMaxTilt(), 0, 0.8f, mapPosition.getTilt());
viewport().setMapScreenCenter(offset);
} else {
viewport().setMapScreenCenter(0);
}
}
}
// mostly handled at MapView
}
开发者ID:Longri,项目名称:cachebox3.0,代码行数:19,代码来源:CacheboxMapAdapter.java
示例2: setMapLocation
import org.oscim.core.MapPosition; //导入依赖的package包/类
@Override
public void setMapLocation(@NonNull GeoPoint point) {
if (mSavedLocationState == LocationState.NORTH || mSavedLocationState == LocationState.TRACK) {
mSavedLocationState = LocationState.ENABLED;
}
if (mLocationState == LocationState.NORTH || mLocationState == LocationState.TRACK) {
mLocationState = LocationState.ENABLED;
updateLocationDrawable();
}
MapPosition mapPosition = mMap.getMapPosition();
if (mapPosition.scale > (2 << 7)) {
mMap.animator().animateTo(point);
} else {
mMap.animator().animateTo(MAP_POSITION_ANIMATION_DURATION, point, 2 << 14, false);
}
}
开发者ID:andreynovikov,项目名称:trekarta,代码行数:17,代码来源:MainActivity.java
示例3: startMapSelection
import org.oscim.core.MapPosition; //导入依赖的package包/类
private void startMapSelection(boolean zoom) {
if (mFragmentManager.getBackStackEntryCount() > 0) {
popAll();
}
if (zoom) {
MapPosition mapPosition = mMap.getMapPosition();
mapPosition.setScale(MapCoverageLayer.TEXT_MIN_SCALE + 5f);
mapPosition.setBearing(0f);
mapPosition.setTilt(0f);
mMap.animator().animateTo(MAP_POSITION_ANIMATION_DURATION, mapPosition);
}
MapSelection fragment = (MapSelection) Fragment.instantiate(this, MapSelection.class.getName());
fragment.setMapIndex(mNativeMapIndex);
fragment.setEnterTransition(new Slide());
FragmentTransaction ft = mFragmentManager.beginTransaction();
ft.replace(R.id.contentPanel, fragment, "mapSelection");
ft.addToBackStack("mapSelection");
ft.commit();
updateMapViewArea();
}
开发者ID:andreynovikov,项目名称:trekarta,代码行数:21,代码来源:MainActivity.java
示例4: onDataSourceSelected
import org.oscim.core.MapPosition; //导入依赖的package包/类
@Override
public void onDataSourceSelected(@NonNull DataSource source) {
Bundle args = new Bundle(3);
if (mLocationState != LocationState.DISABLED && mLocationService != null) {
Location location = mLocationService.getLocation();
args.putDouble(DataList.ARG_LATITUDE, location.getLatitude());
args.putDouble(DataList.ARG_LONGITUDE, location.getLongitude());
} else {
MapPosition position = mMap.getMapPosition();
args.putDouble(DataList.ARG_LATITUDE, position.getLatitude());
args.putDouble(DataList.ARG_LONGITUDE, position.getLongitude());
}
args.putInt(DataList.ARG_HEIGHT, mExtendPanel.getHeight());
DataList fragment = (DataList) Fragment.instantiate(this, DataList.class.getName(), args);
fragment.setDataSource(source);
FragmentTransaction ft = mFragmentManager.beginTransaction();
fragment.setEnterTransition(new Fade());
ft.add(R.id.extendPanel, fragment, "dataList");
ft.addToBackStack("dataList");
ft.commit();
}
开发者ID:andreynovikov,项目名称:trekarta,代码行数:22,代码来源:MainActivity.java
示例5: parse_22_Bookmarks_One
import org.oscim.core.MapPosition; //导入依赖的package包/类
private static void parse_22_Bookmarks_One(final XMLMemento xmlBookmark, final MapBookmark bookmark) {
// SET_FORMATTING_OFF
// SET_FORMATTING_ON
bookmark.id = Util.getXmlString(xmlBookmark, ATTR_ID, Long.toString(System.nanoTime()));
bookmark.name = Util.getXmlString(xmlBookmark, ATTR_NAME, UI.EMPTY_STRING);
/*
* Map position
*/
final MapPosition mapPosition = new MapPosition();
mapPosition.x = Util.getXmlDouble(xmlBookmark, ATTR_MAP_POSITION_X, 0.5);
mapPosition.y = Util.getXmlDouble(xmlBookmark, ATTR_MAP_POSITION_Y, 0.5);
mapPosition.scale = Util.getXmlDouble(xmlBookmark, ATTR_MAP_POSITION_SCALE, 1);
mapPosition.bearing = Util.getXmlFloat(xmlBookmark, ATTR_MAP_POSITION_BEARING, 0f);
mapPosition.tilt = Util.getXmlFloat(xmlBookmark, ATTR_MAP_POSITION_TILT, 0f);
mapPosition.zoomLevel = Util.getXmlInteger(xmlBookmark, ATTR_MAP_POSITION_ZOOM_LEVEL, 1);
bookmark.setMapPosition(mapPosition);
}
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:24,代码来源:MapBookmarkManager.java
示例6: defineColumn_20_Zoomlevel
import org.oscim.core.MapPosition; //导入依赖的package包/类
/**
* Column: Zoomlevel
*/
private void defineColumn_20_Zoomlevel() {
final TableColumnDefinition colDef = new TableColumnDefinition(_columnManager, "zoomLevel", SWT.TRAIL); //$NON-NLS-1$
colDef.setColumnLabel(Messages.Map_Bookmark_Column_ZoomLevel_Tooltip);
colDef.setColumnHeaderText(Messages.Map_Bookmark_Column_ZoomLevel);
colDef.setColumnHeaderToolTipText(Messages.Map_Bookmark_Column_ZoomLevel_Tooltip);
colDef.setIsDefaultColumn();
colDef.setDefaultColumnWidth(_pc.convertWidthInCharsToPixels(5));
// colDef.setColumnWeightData(new ColumnWeightData(5));
colDef.setLabelProvider(new CellLabelProvider() {
@Override
public void update(final ViewerCell cell) {
final MapBookmark bookmark = (MapBookmark) cell.getElement();
final MapPosition mapPos = bookmark.getMapPosition();
cell.setText(Integer.toString(mapPos.zoomLevel));
}
});
}
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:27,代码来源:MapBookmarkView.java
示例7: setMapLocation_InMapThread
import org.oscim.core.MapPosition; //导入依赖的package包/类
private static void setMapLocation_InMapThread(final Map map, final MapPosition mapPosition) {
// final boolean isAnimation = animationTime != 0 && isAnimateLocation;
//
// if (isAnimation) {
//
// final Animator animator = map.animator();
//
// animator.cancel();
// animator.animateTo(
// (long) (animationTime * 1000),
// mapPosition,
// animationEasingType);
// } else {
//
map.setMapPosition(mapPosition);
map.setMapPosition(mapPosition);
// }
map.updateMap(true);
}
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:22,代码来源:Map25ConfigManager.java
示例8: onMapPosition
import org.oscim.core.MapPosition; //导入依赖的package包/类
@Override
public void onMapPosition(final GeoPosition geoCenter, final int zoomLevel, final boolean isZoomed) {
if (_isInSelectBookmark) {
// prevent fire the sync event
return;
}
_isInZoom = isZoomed;
{
centerTour();
}
_isInZoom = false;
if (_isInMapSync) {
return;
}
_lastFiredSyncEventTime = System.currentTimeMillis();
final MapPosition mapPosition = new MapLocation(geoCenter, zoomLevel - 1).getMapPosition();
MapManager.fireSyncMapEvent(mapPosition, this, 0);
}
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:25,代码来源:Map2View.java
示例9: updateMapFromLocationManager
import org.oscim.core.MapPosition; //导入依赖的package包/类
@SuppressWarnings("MissingPermission")
private void updateMapFromLocationManager() {
LocationManager lm = (LocationManager) getSystemService(LOCATION_SERVICE);
Location last = null;
for (String provider : lm.getAllProviders()) {
if (lm.isProviderEnabled(provider)) {
Location t = lm.getLastKnownLocation(provider);
if (t != null && (last == null || t.getTime() > last.getTime())) {
last = t;
}
}
}
Log.d(TAG, "Set location to " + last);
if (last != null) {
mapView.map().setMapPosition(new MapPosition(last.getLatitude(), last.getLongitude(), 4096));
}
}
开发者ID:microg,项目名称:android_packages_apps_GmsCore,代码行数:18,代码来源:PlacePickerActivity.java
示例10: quarterOn
import org.oscim.core.MapPosition; //导入依赖的package包/类
public MapController quarterOn(Location location, double bearing) {
ViewController v = map.viewport();
Float tilt = map.getMapPosition().getTilt();
final int zoom = map.getMapPosition().getZoomLevel();
MapPosition position = new MapPosition(location.getLatitude(), location.getLongitude(),
Math.pow(2, zoom));
v.setMapPosition(position);
map.updateMap(true);
float[] ext = new float[8];
v.getMapExtents(ext, 0);
position.setBearing((float) bearing);
v.setMapPosition(position);
v.moveMap(0, ext[1] / 2);
v.getMapPosition(position);
position.setTilt(tilt);
map.setMapPosition(position);
map.updateMap(true);
return this;
}
开发者ID:mapzen,项目名称:open,代码行数:20,代码来源:MapController.java
示例11: restoreFromSavedLocation
import org.oscim.core.MapPosition; //导入依赖的package包/类
public void restoreFromSavedLocation() {
if (!hasStoredMapPosition()) {
((MapzenApplication) activity.getApplication()).activateMoveMapToLocation();
return;
} else {
((MapzenApplication) activity.getApplication()).deactivateMoveMapToLocation();
}
int latitudeE6 = preferences.getInt(KEY_LATITUDE, 0);
int longitudeE6 = preferences.getInt(KEY_LONGITUDE, 0);
float scale = preferences.getFloat(KEY_MAP_SCALE,
(float) Math.pow(2, DEFAULT_ZOOM_LEVEL));
float tilt = preferences.getFloat(KEY_TILT, 0);
float bearing = preferences.getFloat(KEY_BEARING, 0);
MapPosition mapPosition = new MapPosition();
mapPosition.setPosition(latitudeE6 / 1E6, longitudeE6 / 1E6);
mapPosition.setTilt(tilt);
mapPosition.setScale(scale);
mapPosition.setBearing(bearing);
storeMapPosition(mapPosition);
map.setMapPosition(mapPosition);
map.updateMap(true);
}
开发者ID:mapzen,项目名称:open,代码行数:23,代码来源:MapController.java
示例12: onPause
import org.oscim.core.MapPosition; //导入依赖的package包/类
@Override
protected void onPause() {
super.onPause();
Editor editor = getSharedPreferences(PREFERENCES_FILE, MODE_PRIVATE).edit();
editor.clear();
// save the map position
MapPosition mapPosition = new MapPosition();
mMap.viewport().getMapPosition(mapPosition);
GeoPoint geoPoint = mapPosition.getGeoPoint();
editor.putInt(KEY_LATITUDE, geoPoint.latitudeE6);
editor.putInt(KEY_LONGITUDE, geoPoint.longitudeE6);
editor.putFloat(KEY_MAP_SCALE, (float) mapPosition.scale);
editor.commit();
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:21,代码来源:MapActivity.java
示例13: registerMapView
import org.oscim.core.MapPosition; //导入依赖的package包/类
/**
* This method is called once by each MapView during its setup process.
*
* @param mapView
* the calling MapView.
*/
public final void registerMapView(MapView mapView) {
mMapView = mapView;
mMap = mapView.map();
SharedPreferences sharedPreferences = getSharedPreferences(PREFERENCES_FILE,
MODE_PRIVATE);
if (containsViewport(sharedPreferences)) {
// get and set the map position and zoom level
int latitudeE6 = sharedPreferences.getInt(KEY_LATITUDE, 0);
int longitudeE6 = sharedPreferences.getInt(KEY_LONGITUDE, 0);
float scale = sharedPreferences.getFloat(KEY_MAP_SCALE, 1);
MapPosition mapPosition = new MapPosition();
mapPosition.setPosition(latitudeE6 / 1E6, longitudeE6 / 1E6);
mapPosition.setScale(scale);
mMap.setMapPosition(mapPosition);
}
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:27,代码来源:MapActivity.java
示例14: getMapPosition
import org.oscim.core.MapPosition; //导入依赖的package包/类
/**
* Get the current MapPosition.
*
* @param pos MapPosition to be updated.
*
* @return true iff current position is different from
* passed position.
*/
public synchronized boolean getMapPosition(MapPosition pos) {
boolean changed = (pos.scale != mPos.scale
|| pos.x != mPos.x
|| pos.y != mPos.y
|| pos.bearing != mPos.bearing
|| pos.tilt != mPos.tilt);
pos.bearing = mPos.bearing;
pos.tilt = mPos.tilt;
pos.x = mPos.x;
pos.y = mPos.y;
pos.scale = mPos.scale;
pos.zoomLevel = FastMath.log2((int) mPos.scale);
return changed;
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:27,代码来源:Viewport.java
示例15: setMatrix
import org.oscim.core.MapPosition; //导入依赖的package包/类
protected void setMatrix(GLMatrix mvp, GLViewport v, boolean project, float coordScale) {
MapPosition oPos = mMapPosition;
double tileScale = Tile.SIZE * v.pos.scale;
double x = oPos.x - v.pos.x;
double y = oPos.y - v.pos.y;
if (mFlipOnDateLine) {
//wrap around date-line
while (x < 0.5)
x += 1.0;
while (x > 0.5)
x -= 1.0;
}
mvp.setTransScale((float) (x * tileScale),
(float) (y * tileScale),
(float) (v.pos.scale / oPos.scale) / coordScale);
mvp.multiplyLhs(project ? v.viewproj : v.view);
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:23,代码来源:BucketRenderer.java
示例16: setColor
import org.oscim.core.MapPosition; //导入依赖的package包/类
static void setColor(AreaStyle a, Shader s, MapPosition pos) {
float fade = a.getFade(pos.scale);
float blend = a.getBlend(pos.scale);
if (fade < 1.0f) {
GLState.blend(true);
GLUtils.setColor(s.uColor, a.color, fade);
} else if (blend > 0.0f) {
if (blend == 1.0f)
GLUtils.setColor(s.uColor, a.blendColor, 1);
else
GLUtils.setColorBlend(s.uColor, a.color,
a.blendColor, blend);
} else {
/* test if color contains alpha */
GLState.blend((a.color & OPAQUE) != OPAQUE);
GLUtils.setColor(s.uColor, a.color, 1);
}
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:20,代码来源:MeshBucket.java
示例17: onMapEvent
import org.oscim.core.MapPosition; //导入依赖的package包/类
@Override
public void onMapEvent(Event event, MapPosition mapPosition) {
if (event == Map.CLEAR_EVENT) {
/* sync with TileRenderer */
synchronized (mRenderer) {
tileRenderer().clearTiles();
mTileManager.init();
}
if (mTileManager.update(mapPosition))
notifyLoaders();
} else if (event == Map.POSITION_EVENT) {
if (mTileManager.update(mapPosition))
notifyLoaders();
}
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:19,代码来源:TileLayer.java
示例18: getMapPosition
import org.oscim.core.MapPosition; //导入依赖的package包/类
/**
* Get the current MapPosition
*
* @param pos MapPosition object to be updated
* @return true if current position is different from 'pos'.
*/
public synchronized boolean getMapPosition(MapPosition pos) {
boolean changed = (pos.x != mAbsX || pos.y != mAbsY
|| pos.scale != mAbsScale
|| pos.angle != mRotation
|| pos.tilt != mTilt);
if (!changed)
return false;
int z = FastMath.log2((int) mAbsScale);
pos.angle = mRotation;
pos.tilt = mTilt;
pos.x = mAbsX;
pos.y = mAbsY;
pos.scale = mAbsScale;
pos.zoomLevel = z;
return true;
}
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:30,代码来源:MapViewPosition.java
示例19: setMatrix
import org.oscim.core.MapPosition; //导入依赖的package包/类
/**
* Utility: Set matrices.mvp matrix relative to the difference of current
* MapPosition and mMapPosition.
* Use this to 'stick' your layer to the map.
*
* @param position
* current MapPosition
* @param matrices
* current Matrices
* @param project
* if true apply view- and projection, or just view otherwise.
*/
protected void setMatrix(MapPosition position, Matrices matrices, boolean project) {
MapPosition oPos = mMapPosition;
double tileScale = Tile.SIZE * position.scale;
double x = oPos.x - position.x;
double y = oPos.y - position.y;
// wrap around date-line
// while (x < -1)
// x += 1.0;
// while (x > 2)
// x -= 1.0;
matrices.mvp.setTransScale((float) (x * tileScale), (float) (y * tileScale),
(float) ((position.scale / oPos.scale) / GLRenderer.COORD_SCALE));
matrices.mvp.multiplyLhs(project ? matrices.viewproj : matrices.view);
}
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:32,代码来源:RenderLayer.java
示例20: onPause
import org.oscim.core.MapPosition; //导入依赖的package包/类
@Override
protected void onPause() {
super.onPause();
mMapView.onPause();
Editor editor = getSharedPreferences(PREFERENCES_FILE, MODE_PRIVATE).edit();
editor.clear();
// save the map position
MapPosition mapPosition = new MapPosition();
mMapView.getMapViewPosition().getMapPosition(mapPosition);
GeoPoint geoPoint = mapPosition.getGeoPoint();
editor.putInt(KEY_LATITUDE, geoPoint.latitudeE6);
editor.putInt(KEY_LONGITUDE, geoPoint.longitudeE6);
editor.putFloat(KEY_MAP_SCALE, (float)mapPosition.scale);
//editor.putString(KEY_THEME, mMapView.getRenderTheme());
editor.commit();
}
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:24,代码来源:MapActivity.java
注:本文中的org.oscim.core.MapPosition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论