java importgeopoint_Java GeoPoint.project方法代碼示例

本文整理匯總了Java中com.nextgis.maplib.datasource.GeoPoint.project方法的典型用法代碼示例。如果您正苦於以下問題:Java GeoPoint.project方法的具體用法?Java GeoPoint.project怎麽用?Java GeoPoint.project使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.nextgis.maplib.datasource.GeoPoint的用法示例。

在下文中一共展示了GeoPoint.project方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: movePointToLocation

​點讚 3

import com.nextgis.maplib.datasource.GeoPoint; //導入方法依賴的package包/類

protected boolean movePointToLocation() {

Activity parent = (Activity) mContext;

GpsEventSource gpsEventSource = ((IGISApplication) parent.getApplication()).getGpsEventSource();

Location location = gpsEventSource.getLastKnownLocation();

if (null != location) {

//change to screen coordinates

GeoPoint pt = new GeoPoint(location.getLongitude(), location.getLatitude());

pt.setCRS(GeoConstants.CRS_WGS84);

pt.project(GeoConstants.CRS_WEB_MERCATOR);

GeoPoint screenPt = mMap.mapToScreen(pt);

return moveSelectedPoint((float) screenPt.getX(), (float) screenPt.getY());

} else

Toast.makeText(parent, R.string.error_no_location, Toast.LENGTH_SHORT).show();

return false;

}

開發者ID:nextgis,項目名稱:android_maplibui,代碼行數:18,

示例2: autopanTo

​點讚 3

import com.nextgis.maplib.datasource.GeoPoint; //導入方法依賴的package包/類

private void autopanTo(Location autopanLocation, Location location) {

GeoPoint oldLocation = new GeoPoint(autopanLocation.getLongitude(), autopanLocation.getLatitude());

GeoPoint newLocation = new GeoPoint(location.getLongitude(), location.getLatitude());

oldLocation.setCRS(GeoConstants.CRS_WGS84);

oldLocation.project(GeoConstants.CRS_WEB_MERCATOR);

newLocation.setCRS(GeoConstants.CRS_WGS84);

newLocation.project(GeoConstants.CRS_WEB_MERCATOR);

double dx = oldLocation.getX() - newLocation.getX();

double dy = oldLocation.getY() - newLocation.getY();

GeoPoint newCenter = mMapViewOverlays.getMapCenter();

newCenter.setX(newCenter.getX() - dx);

newCenter.setY(newCenter.getY() - dy);

mMapViewOverlays.panTo(newCenter);

}

開發者ID:nextgis,項目名稱:android_maplibui,代碼行數:17,

示例3: getFix

​點讚 3

import com.nextgis.maplib.datasource.GeoPoint; //導入方法依賴的package包/類

public static GeoPoint getFix(ArrayList items) {

InfoItem gpsItem = null;

for (InfoItem item : items) {

if (item.getColumn(LoggerConstants.HEADER_GPS_LAT) != null) {

gpsItem = item;

break;

}

}

double x = 0, y = 0;

if (gpsItem != null) {

Object value = gpsItem.getColumn(LoggerConstants.HEADER_GPS_LAT).getValue();

if (value instanceof Double)

y = (double) value;

value = gpsItem.getColumn(LoggerConstants.HEADER_GPS_LON).getValue();

if (value instanceof Double)

x = (double) value;

}

GeoPoint point = new GeoPoint(x, y);

point.setCRS(GeoConstants.CRS_WGS84);

point.project(GeoConstants.CRS_WEB_MERCATOR);

return point;

}

開發者ID:nextgis,項目名稱:nextgislogger,代碼行數:26,

示例4: getCoordinates

​點讚 2

import com.nextgis.maplib.datasource.GeoPoint; //導入方法依賴的package包/類

public GeoPoint getCoordinates(int CRS)

{

if (CRS == GeoConstants.CRS_WGS84) {

GeoPoint wgs = new GeoPoint(mCoordinates.getX(), mCoordinates.getY());

wgs.setCRS(GeoConstants.CRS_WEB_MERCATOR);

wgs.project(GeoConstants.CRS_WGS84);

return wgs;

}

return mCoordinates;

}

開發者ID:nextgis,項目名稱:android_maplibui,代碼行數:12,

示例5: setOverlayPoint

​點讚 2

import com.nextgis.maplib.datasource.GeoPoint; //導入方法依賴的package包/類

public void setOverlayPoint(MotionEvent event) {

GeoPoint mapPoint = mMap.screenToMap(new GeoPoint(event.getX(), event.getY()));

mapPoint.setCRS(GeoConstants.CRS_WEB_MERCATOR);

mapPoint.project(GeoConstants.CRS_WGS84);

mOverlayPoint.setCoordinates(mapPoint);

mOverlayPoint.setVisible(true);

}

開發者ID:nextgis,項目名稱:android_maplibui,代碼行數:8,

示例6: onUpgrade

​點讚 2

import com.nextgis.maplib.datasource.GeoPoint; //導入方法依賴的package包/類

@Override

public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) {

super.onUpgrade(sqLiteDatabase, oldVersion, newVersion);

Cursor data;

boolean tableExists = false;

try {

data = sqLiteDatabase.query(TrackLayer.TABLE_TRACKS, null, null, null, null, null, null);

tableExists = true;

data.close();

} catch (Exception ignored) { }

if (oldVersion <= 2 && tableExists) {

sqLiteDatabase.execSQL("alter table " + TrackLayer.TABLE_TRACKS + " add column " + TrackLayer.FIELD_COLOR + " integer;");

GeoPoint point = new GeoPoint();

ContentValues cv = new ContentValues();

data = sqLiteDatabase.query(TrackLayer.TABLE_TRACKPOINTS,

new String[]{TrackLayer.FIELD_TIMESTAMP, TrackLayer.FIELD_LON, TrackLayer.FIELD_LAT}, null, null, null, null, null);

if (data != null) {

if (data.moveToFirst()) {

do {

point.setCoordinates(data.getDouble(1), data.getDouble(2));

point.setCRS(GeoConstants.CRS_WGS84);

point.project(GeoConstants.CRS_WEB_MERCATOR);

cv.clear();

cv.put(TrackLayer.FIELD_LON, point.getX());

cv.put(TrackLayer.FIELD_LAT, point.getY());

sqLiteDatabase.update(TrackLayer.TABLE_TRACKPOINTS, cv, TrackLayer.FIELD_TIMESTAMP + " = ?", new String[]{data.getLong(0) + ""});

} while (data.moveToNext());

}

data.close();

}

}

}

開發者ID:nextgis,項目名稱:android_maplib,代碼行數:39,

示例7: formatCoordinates

​點讚 2

import com.nextgis.maplib.datasource.GeoPoint; //導入方法依賴的package包/類

protected String formatCoordinates(GeoPoint pt) {

pt.setCRS(CRS_WEB_MERCATOR);

pt.project(CRS_WGS84);

SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());

int format = Integer.parseInt(prefs.getString(SettingsConstantsUI.KEY_PREF_COORD_FORMAT, Location.FORMAT_DEGREES + ""));

int fraction = prefs.getInt(SettingsConstantsUI.KEY_PREF_COORD_FRACTION, 6);

String lat = getString(com.nextgis.maplibui.R.string.latitude_caption_short) + ": " +

LocationUtil.formatLatitude(pt.getY(), format, fraction, getResources());

String lon = getString(com.nextgis.maplibui.R.string.longitude_caption_short) + ": " +

LocationUtil.formatLongitude(pt.getX(), format, fraction, getResources());

return lat + "
" + lon;

}

開發者ID:nextgis,項目名稱:android_gisapp,代碼行數:16,

示例8: draw

​點讚 2

import com.nextgis.maplib.datasource.GeoPoint; //導入方法依賴的package包/類

@Override

public void draw(Canvas canvas, MapDrawable mapDrawable) {

if (mCurrentLocation != null && isMarkerEnabled()) {

double lat = mCurrentLocation.getLatitude();

double lon = mCurrentLocation.getLongitude();

mMarker.setMarker(getDefaultMarker());

mMarker.setCoordinatesFromWGS(lon, lat);

if (null != mapDrawable) {

// set accuracy marker with proper meter radius

double accuracy = mCurrentLocation.getAccuracy();

accuracy = getAccuracyRadius(lat, accuracy);

GeoPoint centerPoint = new GeoPoint(lon, lat);

centerPoint.setCRS(GeoConstants.CRS_WGS84);

centerPoint.project(GeoConstants.CRS_WEB_MERCATOR);

centerPoint = mapDrawable.mapToScreen(centerPoint);

GeoPoint newPoint = new GeoPoint(lon, accuracy);

newPoint.setCRS(GeoConstants.CRS_WGS84);

newPoint.project(GeoConstants.CRS_WEB_MERCATOR);

newPoint = mapDrawable.mapToScreen(newPoint);

int radius = (int) (centerPoint.getY() - newPoint.getY());

mAccuracy.setMarker(getAccuracyMarker(radius));

mAccuracy.setCoordinatesFromWGS(lon, lat);

// set marker in current map and screen bounds flags

newPoint = mMarker.getCoordinates(GeoConstants.CRS_WEB_MERCATOR);

mIsInBounds = mapDrawable.getCurrentBounds().contains(newPoint);

GeoEnvelope screenBounds = mapDrawable.getFullScreenBounds();

mIsInScreenBounds = mapDrawable.screenToMap(screenBounds).contains(newPoint);

}

if (mIsInBounds) {

if (mIsAccuracyEnabled) {

drawOverlayItem(canvas, mAccuracy);

}

drawOverlayItem(canvas, mMarker);

}

}

}

開發者ID:nextgis,項目名稱:android_maplibui,代碼行數:43,

示例9: appendTrack

​點讚 2

import com.nextgis.maplib.datasource.GeoPoint; //導入方法依賴的package包/類

void appendTrack(File temp, String name, StringBuilder sb, Formatter f, Cursor trackpoints) throws IOException {

GeoPoint point = new GeoPoint();

int latId = trackpoints.getColumnIndex(TrackLayer.FIELD_LAT);

int lonId = trackpoints.getColumnIndex(TrackLayer.FIELD_LON);

int timeId = trackpoints.getColumnIndex(TrackLayer.FIELD_TIMESTAMP);

int eleId = trackpoints.getColumnIndex(TrackLayer.FIELD_ELE);

int satId = trackpoints.getColumnIndex(TrackLayer.FIELD_SAT);

int fixId = trackpoints.getColumnIndex(TrackLayer.FIELD_FIX);

DecimalFormat df = new DecimalFormat("0", new DecimalFormatSymbols(Locale.ENGLISH));

df.setMaximumFractionDigits(340); //340 = DecimalFormat.DOUBLE_FRACTION_DIGITS

sb.setLength(0);

sb.append(GPX_TAG_TRACK);

if (name != null) {

sb.append(GPX_TAG_NAME);

sb.append(name);

sb.append(GPX_TAG_NAME_CLOSE);

}

sb.append(GPX_TAG_TRACK_SEGMENT);

FileUtil.writeToFile(temp, sb.toString(), true);

do {

sb.setLength(0);

point.setCoordinates(trackpoints.getDouble(lonId), trackpoints.getDouble(latId));

point.setCRS(CRS_WEB_MERCATOR);

point.project(CRS_WGS84);

String sLon = df.format(point.getX());

String sLat = df.format(point.getY());

f.format(GPX_TAG_TRACK_SEGMENT_POINT, sLat, sLon);

f.format(GPX_TAG_TRACK_SEGMENT_POINT_TIME, getTimeStampAsString(trackpoints.getLong(timeId)));

f.format(GPX_TAG_TRACK_SEGMENT_POINT_ELE, df.format(trackpoints.getDouble(eleId)));

f.format(GPX_TAG_TRACK_SEGMENT_POINT_SAT, trackpoints.getString(satId));

f.format(GPX_TAG_TRACK_SEGMENT_POINT_FIX, trackpoints.getString(fixId));

sb.append(GPX_TAG_TRACK_SEGMENT_POINT_CLOSE);

FileUtil.writeToFile(temp, sb.toString(), true);

} while (trackpoints.moveToNext());

sb.setLength(0);

sb.append(GPX_TAG_TRACK_SEGMENT_CLOSE);

sb.append(GPX_TAG_TRACK_CLOSE);

FileUtil.writeToFile(temp, sb.toString(), true);

}

開發者ID:nextgis,項目名稱:android_maplibui,代碼行數:46,

注:本文中的com.nextgis.maplib.datasource.GeoPoint.project方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值