本文整理汇总了Java中org.oscim.core.GeoPoint类的典型用法代码示例。如果您正苦于以下问题:Java GeoPoint类的具体用法?Java GeoPoint怎么用?Java GeoPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeoPoint类属于org.oscim.core包,在下文中一共展示了GeoPoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import org.oscim.core.GeoPoint; //导入依赖的package包/类
public static void init(int arraySize) {
points = new GeoPoint[arraySize][arraySize];
allPoints.clear();
GeoPoint leftTop = new GeoPoint(60.0, 13.0);
GeoPoint pX, pY;
pX = leftTop;
pY = leftTop;
for (int x = 0; x < arraySize; x++) {
for (int y = 0; y < arraySize; y++) {
allPoints.add(pX);
points[x][y] = new GeoPoint(pX.latitudeE6, pX.longitudeE6);
GeoPoint projectedPoint = pX.destinationPoint(distance, 90);
assertThat("distance", pX.sphericalDistance(projectedPoint), closeTo(distance, tolerance));
pX = projectedPoint;
}
pX = pY = pY.destinationPoint(distance, 180);
}
}
开发者ID:Longri,项目名称:cachebox3.0,代码行数:21,代码来源:SquareTest.java
示例2: onActivityCreated
import org.oscim.core.GeoPoint; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Bundle arguments = getArguments();
double latitude = arguments.getDouble(ARG_LATITUDE);
double longitude = arguments.getDouble(ARG_LONGITUDE);
mZoomLevel = arguments.getInt(ARG_ZOOM_LEVEL);
boolean hideObjects = arguments.getBoolean(ARG_HIDE_OBJECTS);
int transparency = arguments.getInt(ARG_TRANSPARENCY);
mLocation = new GeoPoint(latitude, longitude);
mMapList.removeAllViews();
if (mMaps.size() == 0) {
mEmptyView.setVisibility(View.VISIBLE);
mMapListHeader.setVisibility(View.GONE);
} else {
mEmptyView.setVisibility(View.GONE);
mMapListHeader.setVisibility(View.VISIBLE);
for (MapFile map : mMaps)
addMap(map);
}
mHideSwitch.setChecked(hideObjects);
mTransparencySeekBar.setProgress(transparency);
}
开发者ID:andreynovikov,项目名称:trekarta,代码行数:27,代码来源:MapList.java
示例3: setMapLocation
import org.oscim.core.GeoPoint; //导入依赖的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
示例4: showMarkerInformation
import org.oscim.core.GeoPoint; //导入依赖的package包/类
@Override
public void showMarkerInformation(@NonNull GeoPoint point, @Nullable String name) {
if (mFragmentManager.getBackStackEntryCount() > 0) {
popAll();
}
Bundle args = new Bundle(3);
args.putDouble(MarkerInformation.ARG_LATITUDE, point.getLatitude());
args.putDouble(MarkerInformation.ARG_LONGITUDE, point.getLongitude());
args.putString(MarkerInformation.ARG_NAME, name);
Fragment fragment = Fragment.instantiate(this, MarkerInformation.class.getName(), args);
fragment.setEnterTransition(new Slide());
FragmentTransaction ft = mFragmentManager.beginTransaction();
ft.replace(R.id.contentPanel, fragment, "markerInformation");
ft.addToBackStack("markerInformation");
ft.commit();
updateMapViewArea();
}
开发者ID:andreynovikov,项目名称:trekarta,代码行数:18,代码来源:MainActivity.java
示例5: onWaypointCreate
import org.oscim.core.GeoPoint; //导入依赖的package包/类
@Override
public void onWaypointCreate(GeoPoint point, String name, boolean locked, boolean customize) {
final Waypoint waypoint = new Waypoint(name, point.getLatitude(), point.getLongitude());
waypoint.date = new Date();
waypoint.locked = locked;
mWaypointDbDataSource.saveWaypoint(waypoint);
MarkerItem marker = new MarkerItem(waypoint, name, null, point);
mMarkerLayer.addItem(marker);
mMap.updateMap(true);
if (!customize)
return;
Snackbar snackbar = Snackbar
.make(mCoordinatorLayout, R.string.msgPlaceSaved, Snackbar.LENGTH_LONG)
.setAction(R.string.actionCustomize, new View.OnClickListener() {
@Override
public void onClick(View view) {
onWaypointProperties(waypoint);
}
});
snackbar.show();
}
开发者ID:andreynovikov,项目名称:trekarta,代码行数:22,代码来源:MainActivity.java
示例6: testMgrsParser
import org.oscim.core.GeoPoint; //导入依赖的package包/类
@Test
public void testMgrsParser() throws Exception {
double testLatitude = 39.095973;
double testLongitude = -94.573414;
GeoPoint actual = CoordinatesParser.parse("15SUD 63936 28605");
assertEquals("Failed to parse 15SUD 63936 28605", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse 15SUD 63936 28605", testLongitude, actual.getLongitude(), 0.000005);
actual = CoordinatesParser.parse("15SUD6393628605");
assertEquals("Failed to parse 15SUD6393628605", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse 15SUD6393628605", testLongitude, actual.getLongitude(), 0.000005);
actual = CoordinatesParser.parse("15S UD 63936 28605");
assertEquals("Failed to parse 15S UD 63936 28605", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse 15S UD 63936 28605", testLongitude, actual.getLongitude(), 0.000005);
//TODO Correctly lex this format
/*
actual = CoordinatesLexer.parse("15 S UD 63936 28605");
assertEquals("Failed to parse 15 S UD 63936 28605", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse 15 S UD 63936 28605", testLongitude, actual.getLongitude(), 0.000005);
*/
}
开发者ID:andreynovikov,项目名称:trekarta,代码行数:21,代码来源:CoordinatesParserTest.java
示例7: testMinutesParser
import org.oscim.core.GeoPoint; //导入依赖的package包/类
@Test
public void testMinutesParser() throws Exception {
double testLatitude = 39.095973;
double testLongitude = -94.573414;
GeoPoint actual = JosmCoordinatesParser.parse("39\u00B0 05.7584' -94\u00B0 34.4048'");
assertEquals("Failed to parse 39\u00B0 05.7584' -94\u00B0 34.4048'", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse 39\u00B0 05.7584' -94\u00B0 34.4048'", testLongitude, actual.getLongitude(), 0.000005);
actual = JosmCoordinatesParser.parse("39\u00B0 05.7584 N, 94\u00B0 34.4048 W");
assertEquals("Failed to parse 39\u00B0 05.7584 N, 94\u00B0 34.4048 W", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse 39\u00B0 05.7584 N, 94\u00B0 34.4048 W", testLongitude, actual.getLongitude(), 0.000005);
actual = JosmCoordinatesParser.parse("W 94\u00B034.4048' N 39\u00B005.7584'");
assertEquals("Failed to parse W 94\u00B034.4048' N 39\u00B005.7584'", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse W 94\u00B034.4048' N 39\u00B005.7584'", testLongitude, actual.getLongitude(), 0.000005);
actual = JosmCoordinatesParser.parse("N 39 05,7584 W 94 34,4048");
assertEquals("Failed to parse N 39 05,7584 W 94 34,4048", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse N 39 05,7584 W 94 34,4048", testLongitude, actual.getLongitude(), 0.000005);
testLatitude = 39.083333;
testLongitude = -94.566666;
actual = JosmCoordinatesParser.parse("39 05, -94 34");
assertEquals("Failed to parse 39 05, -94 34", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse 39 05, -94 34", testLongitude, actual.getLongitude(), 0.000005);
actual = JosmCoordinatesParser.parse("N 39\u00B0 05, W 94\u00B0 34");
assertEquals("Failed to parse N 39\u00B0 05, W 94\u00B0 34", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse N 39\u00B0 05, W 94\u00B0 34", testLongitude, actual.getLongitude(), 0.000005);
}
开发者ID:andreynovikov,项目名称:trekarta,代码行数:26,代码来源:JosmCoordinatesParserTest.java
示例8: testSecondsParser
import org.oscim.core.GeoPoint; //导入依赖的package包/类
@Test
public void testSecondsParser() throws Exception {
double testLatitude = 39.095973;
double testLongitude = -94.573414;
GeoPoint actual = JosmCoordinatesParser.parse("39\u00B0 05' 45.503\" -94\u00B0 34' 24.290\"");
assertEquals("Failed to parse 39\u00B0 05' 45.503\" -94\u00B0 34' 24.290\"", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse 39\u00B0 05' 45.503\" -94\u00B0 34' 24.290\"", testLongitude, actual.getLongitude(), 0.000005);
actual = JosmCoordinatesParser.parse("N39\u00B0 05' 45.503\" W94\u00B0 34' 24.290\"");
assertEquals("Failed to parse N39\u00B0 05' 45.503\" W94\u00B0 34' 24.290\"", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse N39\u00B0 05' 45.503\" W94\u00B0 34' 24.290\"", testLongitude, actual.getLongitude(), 0.000005);
actual = JosmCoordinatesParser.parse("39\u00B005'45.503\"N 94\u00B034'24.290\"W");
assertEquals("Failed to parse 39°05'45.503\"N 94°34'24.290\"W", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse 39°05'45.503\"N 94°34'24.290\"W", testLongitude, actual.getLongitude(), 0.000005);
actual = JosmCoordinatesParser.parse("39 deg 05' 45.50\" N, 94 deg 34' 24.29\" W");
assertEquals("Failed to parse 39 deg 05' 45.50\" N, 94 deg 34' 24.29\" W", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse 39 deg 05' 45.50\" N, 94 deg 34' 24.29\" W", testLongitude, actual.getLongitude(), 0.000005);
testLatitude = 39.095833;
testLongitude = -94.573333;
actual = JosmCoordinatesParser.parse("39\u00B005'45\" N 94\u00B034'24\" W");
assertEquals("Failed to parse 39\u00B005'45\" N 94\u00B034'24\" W", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse 39\u00B005'45\" N 94\u00B034'24\" W", testLongitude, actual.getLongitude(), 0.000005);
actual = JosmCoordinatesParser.parse("39 5 45, -94 34 24");
assertEquals("Failed to parse 39 5 45, -94 34 24", testLatitude, actual.getLatitude(), 0.000005);
assertEquals("Failed to parse 39 5 45, -94 34 24", testLongitude, actual.getLongitude(), 0.000005);
}
开发者ID:andreynovikov,项目名称:trekarta,代码行数:26,代码来源:JosmCoordinatesParserTest.java
示例9: createBoundingBox
import org.oscim.core.GeoPoint; //导入依赖的package包/类
private BoundingBox createBoundingBox(final GeoPoint[] geoPoints) {
// this is optimized for performance by using an array which BoundingBox do no support
int minLat = Integer.MAX_VALUE;
int minLon = Integer.MAX_VALUE;
int maxLat = Integer.MIN_VALUE;
int maxLon = Integer.MIN_VALUE;
for (final GeoPoint geoPoint : geoPoints) {
if (geoPoint != null) {
minLat = Math.min(minLat, geoPoint.latitudeE6);
minLon = Math.min(minLon, geoPoint.longitudeE6);
maxLat = Math.max(maxLat, geoPoint.latitudeE6);
maxLon = Math.max(maxLon, geoPoint.longitudeE6);
}
}
return new BoundingBox(minLat, minLon, maxLat, maxLon);
}
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:22,代码来源:Map25View.java
示例10: getDrawable
import org.oscim.core.GeoPoint; //导入依赖的package包/类
@Override
public Drawable getDrawable(Map map) {
if (!isVisible() || removed) return null;
List<GeoPoint> points = new ArrayList<GeoPoint>();
for (LatLng point : options.getPoints()) {
points.add(GmsMapsTypeHelper.fromLatLng(point));
}
if (points.size() < 3 || (points.size() == 3 && points.get(2).equals(points.get(0)))) {
// Need at least 3 distinguished points to draw a polygon
return null;
}
// TODO: holes
return new PolygonDrawable(points, Style.builder()
.fillAlpha(1)
.strokeColor(getStrokeColor())
.strokeWidth(getStrokeWidth())
.fillColor(getFillColor())
.build());
}
开发者ID:microg,项目名称:android_packages_apps_GmsCore,代码行数:20,代码来源:PolygonImpl.java
示例11: onPause
import org.oscim.core.GeoPoint; //导入依赖的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
示例12: animateTo
import org.oscim.core.GeoPoint; //导入依赖的package包/类
public synchronized void animateTo(long duration, GeoPoint geoPoint,
double scale, boolean relative) {
mMap.getMapPosition(mStartPos);
if (relative)
scale = mStartPos.scale * scale;
scale = clamp(scale, Viewport.MIN_SCALE, Viewport.MAX_SCALE);
mDeltaPos.set(longitudeToX(geoPoint.getLongitude()) - mStartPos.x,
latitudeToY(geoPoint.getLatitude()) - mStartPos.y,
scale - mStartPos.scale,
0, 0);
animStart(duration, ANIM_MOVE | ANIM_SCALE);
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:17,代码来源:Animator.java
示例13: readMapStartPosition
import org.oscim.core.GeoPoint; //导入依赖的package包/类
private OpenResult readMapStartPosition(ReadBuffer readBuffer) {
if (this.hasStartPosition) {
// get and check the start position latitude (4 byte)
int mapStartLatitude = readBuffer.readInt();
if (mapStartLatitude < RequiredFields.LATITUDE_MIN
|| mapStartLatitude > RequiredFields.LATITUDE_MAX) {
return new OpenResult("invalid map start latitude: " + mapStartLatitude);
}
// get and check the start position longitude (4 byte)
int mapStartLongitude = readBuffer.readInt();
if (mapStartLongitude < RequiredFields.LONGITUDE_MIN
|| mapStartLongitude > RequiredFields.LONGITUDE_MAX) {
return new OpenResult("invalid map start longitude: " + mapStartLongitude);
}
this.startPosition = new GeoPoint(mapStartLatitude, mapStartLongitude);
}
return OpenResult.SUCCESS;
}
开发者ID:opensciencemap,项目名称:vtm,代码行数:21,代码来源:OptionalFields.java
示例14: animateTo
import org.oscim.core.GeoPoint; //导入依赖的package包/类
public synchronized void animateTo(GeoPoint geoPoint) {
double f = Tile.SIZE << ABS_ZOOMLEVEL;
mStartX = mAbsX * f;
mStartY = mAbsY * f;
mEndX = MercatorProjection.longitudeToX(geoPoint.getLongitude()) * f;
mEndY = MercatorProjection.latitudeToY(geoPoint.getLatitude()) * f;
mEndX -= mStartX;
mEndY -= mStartY;
mAnimMove = true;
mAnimScale = false;
mAnimFling = false;
animStart(300);
}
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:18,代码来源:MapViewPosition.java
示例15: onPause
import org.oscim.core.GeoPoint; //导入依赖的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
示例16: readMapStartPosition
import org.oscim.core.GeoPoint; //导入依赖的package包/类
private OpenResult readMapStartPosition(ReadBuffer readBuffer) {
if (this.hasStartPosition) {
// get and check the start position latitude (4 byte)
int mapStartLatitude = readBuffer.readInt();
if (mapStartLatitude < RequiredFields.LATITUDE_MIN
|| mapStartLatitude > RequiredFields.LATITUDE_MAX) {
return new OpenResult("invalid map start latitude: " + mapStartLatitude);
}
// get and check the start position longitude (4 byte)
int mapStartLongitude = readBuffer.readInt();
if (mapStartLongitude < RequiredFields.LONGITUDE_MIN
|| mapStartLongitude > RequiredFields.LONGITUDE_MAX) {
return new OpenResult("invalid map start longitude: " + mapStartLongitude);
}
this.startPosition = new GeoPoint(mapStartLatitude, mapStartLongitude);
}
return OpenResult.SUCCESS;
}
开发者ID:opensciencemap,项目名称:vtm-android,代码行数:21,代码来源:OptionalFields.java
示例17: onContextItemSelected
import org.oscim.core.GeoPoint; //导入依赖的package包/类
public boolean onContextItemSelected(MenuItem item, GeoPoint geoPoint) {
switch (item.getItemId()) {
case R.id.menu_poi_nearby:
Intent intent = new Intent(App.activity, POIActivity.class);
intent.putExtra("ID", poiMarkers.getBubbledItemId());
App.activity.startActivityForResult(intent, TileMap.POIS_REQUEST);
return true;
case R.id.menu_poi_clear:
poiMarkers.removeAllItems();
mPOIs.clear();
App.map.updateMap(true);
return true;
default:
}
return false;
}
开发者ID:opensciencemap,项目名称:vtm-app,代码行数:20,代码来源:POISearch.java
示例18: getRouteAsync
import org.oscim.core.GeoPoint; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void getRouteAsync() {
if (mRouteTask != null) {
mRouteTask.cancel(true);
mRouteTask = null;
}
if (mStartPoint == null || mDestinationPoint == null) {
mRouteOverlay.clearPath();
return;
}
List<GeoPoint> waypoints = new ArrayList<GeoPoint>();
waypoints.add(mStartPoint);
//add intermediate via points:
for (GeoPoint p : mViaPoints) {
waypoints.add(p);
}
waypoints.add(mDestinationPoint);
mRouteTask = new UpdateRouteTask();
mRouteTask.execute(waypoints);
}
开发者ID:opensciencemap,项目名称:vtm-app,代码行数:24,代码来源:RouteSearch.java
示例19: runLongpressTimer
import org.oscim.core.GeoPoint; //导入依赖的package包/类
public void runLongpressTimer() {
// mMap.postDelayed(action, delay);
mLongpressTimer = new Timer();
mLongpressTimer.schedule(new TimerTask() {
@Override
public void run() {
final GeoPoint p1 = mMap.viewport().fromScreenPoint(mCurX1,
mCurY1);
final GeoPoint p2 = mMap.viewport().fromScreenPoint(mCurX2,
mCurY2);
mMap.post(new Runnable() {
@Override
public void run() {
mReceiver.longPressHelper(p1, p2);
}
});
}
}, LONGPRESS_THRESHOLD);
}
开发者ID:opensciencemap,项目名称:vtm-app,代码行数:23,代码来源:DistanceTouchOverlay.java
示例20: getUrl
import org.oscim.core.GeoPoint; //导入依赖的package包/类
/**
* Build the URL to Google Directions service returning a route in XML
* format
*
* @param waypoints
* ...
* @return ...
*/
protected String getUrl(List<GeoPoint> waypoints) {
StringBuffer urlString = new StringBuffer(GOOGLE_DIRECTIONS_SERVICE);
urlString.append("origin=");
GeoPoint p = waypoints.get(0);
urlString.append(geoPointAsString(p));
urlString.append("&destination=");
int destinationIndex = waypoints.size() - 1;
p = waypoints.get(destinationIndex);
urlString.append(geoPointAsString(p));
for (int i = 1; i < destinationIndex; i++) {
if (i == 1)
urlString.append("&waypoints=");
else
urlString.append("%7C"); // the pipe (|), url-encoded
p = waypoints.get(i);
urlString.append(geoPointAsString(p));
}
urlString.append("&units=metric&sensor=false");
Locale locale = Locale.getDefault();
urlString.append("&language=" + locale.getLanguage());
urlString.append(mOptions);
return urlString.toString();
}
开发者ID:opensciencemap,项目名称:vtm-app,代码行数:33,代码来源:GoogleRouteProvider.java
注:本文中的org.oscim.core.GeoPoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论