This commit is contained in:
wangcongtao
2020-12-18 10:55:17 +08:00
parent bb85ba8cd1
commit 036d85df1e
35 changed files with 533 additions and 382 deletions

View File

@@ -5,7 +5,6 @@ import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.MogoLatLng;
@@ -13,12 +12,7 @@ import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.constants.SafeType;
import com.mogo.module.common.constants.VisionMode;
import com.mogo.module.common.drawer.marker.MarkerResourceManager;
import com.mogo.module.common.utils.CoordinateUtils;
import com.mogo.service.adas.entity.ADASRecognizedListResult;
import java.util.ArrayList;
@@ -105,8 +99,9 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
if ( latLon == null ) {
continue;
}
double targetPos[] = CoordinateUtils.transformFromWGSToGCJ( latLon.lat, latLon.lon );
points.add( endLatLon = new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
// double targetPos[] = transformGcj02ToFitMap( latLon.lat, latLon.lon );
// points.add( endLatLon = new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
points.add( endLatLon = new MogoLatLng( latLon.lat, latLon.lon ) );
}
} else if ( recognizedListResult.latLonList != null
@@ -118,7 +113,9 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
continue;
}
points.add( latLng );
points.add( endLatLon = new MogoLatLng( latLng.lat, latLon.lon ) );
// double targetPos[] = transformGcj02ToFitMap( latLon.lat, latLon.lon );
// points.add( endLatLon = new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
points.add( endLatLon = new MogoLatLng( latLon.lat, latLon.lon ) );
}
if ( endLatLon != null ) {
marker.setObject( endLatLon );
@@ -172,12 +169,13 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
return null;
}
// double targetPos[] = transformGcj02ToFitMap( recognizedListResult.latLonList.get( 0 ).lat, recognizedListResult.latLonList.get( 0 ).lon );
MogoMarkerOptions options = new MogoMarkerOptions()
.owner( DataTypes.TYPE_MARKER_ADAS )
.icon( inflateView( recognizedListResult, machineVision, curSpeed ) )
.gps( true )
.anchor( 0.5f, 0.5f )
.rotate( ( float ) recognizedListResult.heading )
// .position( new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
.position( new MogoLatLng( recognizedListResult.latLonList.get( 0 ).lat, recognizedListResult.latLonList.get( 0 ).lon ) );
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_ADAS, options );
}

View File

@@ -1,5 +1,7 @@
package com.mogo.module.common.drawer;
import com.mogo.map.CoordinatesTransformer;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.CarModelType;
import com.mogo.module.common.constants.SafeType;
@@ -72,4 +74,13 @@ class BaseDrawer {
// 根据车道、行驶方向等计算出选用哪个车模图片
return CarModelType.Other;
}
private CoordinatesTransformer mTransformer;
protected double[] transformGcj02ToFitMap( double lat, double lon ) {
if ( mTransformer == null ) {
mTransformer = MogoApisHandler.getInstance().getApis().getMapServiceApi().getCoordinatesTransformer();
}
return mTransformer.transform( lat, lon );
}
}

View File

@@ -1,13 +1,10 @@
package com.mogo.module.common.drawer;
import android.content.Context;
import android.graphics.Bitmap;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.MogoLatLng;
@@ -15,17 +12,10 @@ import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.constants.CarModelType;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.constants.SafeType;
import com.mogo.module.common.constants.VisionMode;
import com.mogo.module.common.drawer.marker.MarkerResourceManager;
import com.mogo.module.common.entity.CloudLocationInfo;
import com.mogo.module.common.entity.CloudRoadData;
import com.mogo.module.common.entity.MogoSnapshotSetData;
import com.mogo.module.common.utils.CoordinateUtils;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.ViewUtils;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
@@ -80,6 +70,8 @@ class SnapshotSetDataDrawer extends BaseDrawer {
private Map< String, MogoLatLng > mLastPositions = new ConcurrentHashMap<>();
private boolean mIsVrMode = false;
/**
* 其他车辆、rsu 车辆数据
*
@@ -128,22 +120,30 @@ class SnapshotSetDataDrawer extends BaseDrawer {
}
mCloudSnapshotMarkersCaches.put( uniqueKey, marker );
} else {
marker.setGps( false );
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode();
if ( mIsVrMode ) {
marker.use3DResource( getVrModel() );
} else {
marker.setIcon( ViewUtils.fromView( inflateView( cloudRoadData, machineVision, 0 ) ) );
}
}
MogoLatLng lastPosition = mLastPositions.get( uniqueKey );
double targetPos[] = CoordinateUtils.transformFromWGSToGCJ( target.lat, target.lon );
double lastPos[] = CoordinateUtils.transformFromWGSToGCJ( lastPosition.lat, lastPosition.lon );
// double targetPos[] = transformGcj02ToFitMap( target.lat, target.lon );
// double lastPos[] = transformGcj02ToFitMap( lastPosition.lat, lastPosition.lon );
if ( lastPosition != null ) {
if ( lastPosition.equals( target ) ) {
marker.setPosition( lastPos[POS_LAT], lastPos[POS_LON] );
marker.setPosition( lastPosition.lat, lastPosition.lon );
} else {
List< MogoLatLng > points = new ArrayList<>();
points.add( new MogoLatLng( lastPos[POS_LAT], lastPos[POS_LON] ) );
points.add( new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
marker.startSmooth( points, 1 );
points.add( new MogoLatLng( lastPosition.lat, lastPosition.lon ) );
points.add( new MogoLatLng( target.lat, target.lon ) );
marker.startSmoothInMs( points, 1000L );
}
} else {
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
marker.setPosition( targetPos[POS_LAT], targetPos[POS_LON] );
marker.setPosition( target.lat, target.lon );
}
}
mLastPositions.put( uniqueKey, target );
@@ -197,16 +197,25 @@ class SnapshotSetDataDrawer extends BaseDrawer {
}
Logger.d( TAG, "draw marker uniqueKey = %s", data.getUniqueKey() );
// double coor[] = transformGcj02ToFitMap( data.getLat(), data.getLon() );
MogoMarkerOptions options = new MogoMarkerOptions()
.owner( DataTypes.TYPE_MARKER_CLOUD_DATA )
.icon( inflateView( data, machineVision, curSpeed ) )
.gps( true )
.anchor( 0.5f, 0.5f )
.rotate( ( float ) data.getHeading() )
// .position( new MogoLatLng( coor[POS_LAT], coor[POS_LON] ) );
.position( new MogoLatLng( data.getLat(), data.getLon() ) );
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
options.icon3DRes( getVrModel() );
} else {
options.icon( inflateView( data, machineVision, curSpeed ) );
}
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_CLOUD_DATA, options );
}
private int getVrModel() {
return R.raw.taxi;
}
private View inflateView( CloudRoadData data, boolean machineVision, double curSpeed ) {
View rootView = LayoutInflater.from( AbsMogoApplication.getApp() ).inflate( R.layout.module_commons_layout_car, null );
// SafeType safeType = getSafeType( data.getDistance(), data.getSpeed(), curSpeed );
@@ -223,28 +232,4 @@ class SnapshotSetDataDrawer extends BaseDrawer {
iv.setImageResource( R.drawable.icon_map_marker_car_gray );
return rootView;
}
private Bitmap fromView( View view ) {
view.setDrawingCacheEnabled( true );
processChildView( view );
view.destroyDrawingCache();
view.measure( View.MeasureSpec.makeMeasureSpec( 0, View.MeasureSpec.UNSPECIFIED ), View.MeasureSpec.makeMeasureSpec( 0, View.MeasureSpec.UNSPECIFIED ) );
view.layout( 0, 0, view.getMeasuredWidth(), view.getMeasuredHeight() );
Bitmap bitmap = null;
return ( bitmap = view.getDrawingCache() ) != null ? bitmap.copy( Bitmap.Config.ARGB_8888, false ) : null;
}
private void processChildView( View view ) {
if ( !( view instanceof ViewGroup ) ) {
if ( view instanceof TextView ) {
( ( TextView ) view ).setHorizontallyScrolling( false );
}
} else {
for ( int var1 = 0; var1 < ( ( ViewGroup ) view ).getChildCount(); ++var1 ) {
processChildView( ( ( ViewGroup ) view ).getChildAt( var1 ) );
}
}
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.module.common.drawer.marker;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
@@ -26,6 +27,8 @@ import com.mogo.utils.logger.Logger;
public class MapMarkerView extends MapMarkerBaseView {
private String TAG = "MapMarkerView";
private FrameLayout clMarkerTopView;
public MapMarkerView( Context context ) {
super( context );
}
@@ -48,6 +51,7 @@ public class MapMarkerView extends MapMarkerBaseView {
protected void initView( Context context ) {
LayoutInflater.from( context ).inflate( R.layout.modudle_services_marker_layout, this );
ivIcon = findViewById( R.id.ivIcon );
clMarkerTopView = findViewById( R.id.clMarkerTopView );
ivCar = findViewById( R.id.ivCar );
}
@@ -57,7 +61,9 @@ public class MapMarkerView extends MapMarkerBaseView {
Object bindObj = markerShowEntity.getBindObj();
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow_vr );
clMarkerTopView.setBackgroundResource( R.drawable.module_services_marker_vr_bkg );
} else {
clMarkerTopView.setBackgroundResource( R.drawable.module_services_marker_bkg );
ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow );
}
switch ( markerShowEntity.getMarkerType() ) {
@@ -65,14 +71,14 @@ public class MapMarkerView extends MapMarkerBaseView {
case ModuleNames.CARD_TYPE_NOVELTY:
if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) {
// 根据poiType获取对应的图片
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
String poiType = ( ( MarkerExploreWay ) bindObj ).getPoiType();
PoiWrapper poiWrapper =
CloudPoiManager.getInstance().getWrapperByPoiType(poiType);
if (poiWrapper != null) {
CloudPoiManager.getInstance().getWrapperByPoiType( poiType );
if ( poiWrapper != null ) {
// 加载图片
loadPoiTypeIcon(poiWrapper.getIconUrl(),poiWrapper.getIconRes());
}else{
Logger.e(TAG, "未能根据poiType获取对应poi信息无法渲染marker====" + poiType);
loadPoiTypeIcon( poiWrapper.getIconUrl(), poiWrapper.getIconRes() );
} else {
Logger.e( TAG, "未能根据poiType获取对应poi信息无法渲染marker====" + poiType );
}
}
break;

View File

@@ -3,6 +3,8 @@ package com.mogo.module.common.entity;
import android.os.Parcel;
import android.os.Parcelable;
import com.mogo.utils.CoordinateUtils;
import java.util.Objects;
/**
@@ -19,10 +21,13 @@ public class CloudLocationInfo implements Parcelable {
private double alt;
private double speed;
public double oldLat;
public double oldLon;
public CloudLocationInfo() {
}
public CloudLocationInfo(CloudLocationInfo info) {
public CloudLocationInfo( CloudLocationInfo info ) {
this.lat = info.getLat();
this.lon = info.getLon();
this.heading = info.getHeading();
@@ -32,7 +37,17 @@ public class CloudLocationInfo implements Parcelable {
this.speed = info.speed;
}
protected CloudLocationInfo(Parcel in) {
public void convertCoor2GCJ02(){
this.oldLat = lat;
this.oldLon = lon;
double[] amapCoord = CoordinateUtils.transformFromWGSToGCJ( lat, lon );
if ( amapCoord != null ) {
this.lat = amapCoord[0];
this.lon = amapCoord[1];
}
}
protected CloudLocationInfo( Parcel in ) {
lat = in.readDouble();
lon = in.readDouble();
heading = in.readDouble();
@@ -43,14 +58,14 @@ public class CloudLocationInfo implements Parcelable {
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeDouble(lat);
dest.writeDouble(lon);
dest.writeDouble(heading);
dest.writeLong(systemTime);
dest.writeLong(satelliteTime);
dest.writeDouble(alt);
dest.writeDouble(speed);
public void writeToParcel( Parcel dest, int flags ) {
dest.writeDouble( lat );
dest.writeDouble( lon );
dest.writeDouble( heading );
dest.writeLong( systemTime );
dest.writeLong( satelliteTime );
dest.writeDouble( alt );
dest.writeDouble( speed );
}
@Override
@@ -58,14 +73,14 @@ public class CloudLocationInfo implements Parcelable {
return 0;
}
public static final Creator<CloudLocationInfo> CREATOR = new Creator<CloudLocationInfo>() {
public static final Creator< CloudLocationInfo > CREATOR = new Creator< CloudLocationInfo >() {
@Override
public CloudLocationInfo createFromParcel(Parcel in) {
return new CloudLocationInfo(in);
public CloudLocationInfo createFromParcel( Parcel in ) {
return new CloudLocationInfo( in );
}
@Override
public CloudLocationInfo[] newArray(int size) {
public CloudLocationInfo[] newArray( int size ) {
return new CloudLocationInfo[size];
}
};
@@ -74,7 +89,7 @@ public class CloudLocationInfo implements Parcelable {
return lat;
}
public void setLat(double lat) {
public void setLat( double lat ) {
this.lat = lat;
}
@@ -82,7 +97,7 @@ public class CloudLocationInfo implements Parcelable {
return lon;
}
public void setLon(double lon) {
public void setLon( double lon ) {
this.lon = lon;
}
@@ -90,7 +105,7 @@ public class CloudLocationInfo implements Parcelable {
return heading;
}
public void setHeading(double heading) {
public void setHeading( double heading ) {
this.heading = heading;
}
@@ -98,7 +113,7 @@ public class CloudLocationInfo implements Parcelable {
return systemTime;
}
public void setSystemTime(long systemTime) {
public void setSystemTime( long systemTime ) {
this.systemTime = systemTime;
}
@@ -106,7 +121,7 @@ public class CloudLocationInfo implements Parcelable {
return satelliteTime;
}
public void setSatelliteTime(long satelliteTime) {
public void setSatelliteTime( long satelliteTime ) {
this.satelliteTime = satelliteTime;
}
@@ -114,7 +129,7 @@ public class CloudLocationInfo implements Parcelable {
return alt;
}
public void setAlt(double alt) {
public void setAlt( double alt ) {
this.alt = alt;
}
@@ -122,7 +137,7 @@ public class CloudLocationInfo implements Parcelable {
return speed;
}
public void setSpeed(double speed) {
public void setSpeed( double speed ) {
this.speed = speed;
}
@@ -141,24 +156,24 @@ public class CloudLocationInfo implements Parcelable {
public String print() {
return "CloudLocation{ lon: " + lon + " lat: " + lat + " heading: " + heading + " speed: "
+ speed+"}";
+ speed + "}";
}
@Override
public boolean equals(Object o) {
if (this == o) {
public boolean equals( Object o ) {
if ( this == o ) {
return true;
}
if (o == null || getClass() != o.getClass()) {
if ( o == null || getClass() != o.getClass() ) {
return false;
}
CloudLocationInfo that = (CloudLocationInfo) o;
return Double.compare(that.lat, lat) == 0 &&
Double.compare(that.lon, lon) == 0;
CloudLocationInfo that = ( CloudLocationInfo ) o;
return Double.compare( that.lat, lat ) == 0 &&
Double.compare( that.lon, lon ) == 0;
}
@Override
public int hashCode() {
return Objects.hash(lat, lon);
return Objects.hash( lat, lon );
}
}

View File

@@ -1,88 +0,0 @@
package com.mogo.module.common.utils;
import java.math.BigDecimal;
/**
* 坐标系转化
*
* @author linyang
* @since 2020.10.21
*/
public class CoordinateSystemTransformationUtil {
private static final double x_PI = 52.35987755982988D;
private static final double PI = 3.141592653589793D;
private static final double a = 6378245.0D;
private static final double ee = 0.006693421622965943D;
public static final boolean outOfChina( double lat, double lng ) {
return lng <= 73.66D || lng >= 135.05D || lat <= 3.86D || lat >= 53.55D;
}
private static final double transformLat( double lng, double lat ) {
double ret = -100.0D + 2.0D * lng + 3.0D * lat + 0.2D * lat * lat + 0.1D * lng * lat + 0.2D * Math.sqrt( Math.abs( lng ) );
ret += ( 20.0D * Math.sin( 6.0D * lng * 3.141592653589793D ) + 20.0D * Math.sin( 2.0D * lng * 3.141592653589793D ) ) * 2.0D / 3.0D;
ret += ( 20.0D * Math.sin( lat * 3.141592653589793D ) + 40.0D * Math.sin( lat / 3.0D * 3.141592653589793D ) ) * 2.0D / 3.0D;
ret += ( 160.0D * Math.sin( lat / 12.0D * 3.141592653589793D ) + ( double ) 320 * Math.sin( lat * 3.141592653589793D / 30.0D ) ) * 2.0D / 3.0D;
return ret;
}
private static final double transformLon( double lng, double lat ) {
double ret = 300.0D + lng + 2.0D * lat + 0.1D * lng * lng + 0.1D * lng * lat + 0.1D * Math.sqrt( Math.abs( lng ) );
ret += ( 20.0D * Math.sin( 6.0D * lng * 3.141592653589793D ) + 20.0D * Math.sin( 2.0D * lng * 3.141592653589793D ) ) * 2.0D / 3.0D;
ret += ( 20.0D * Math.sin( lng * 3.141592653589793D ) + 40.0D * Math.sin( lng / 3.0D * 3.141592653589793D ) ) * 2.0D / 3.0D;
ret += ( 150.0D * Math.sin( lng / 12.0D * 3.141592653589793D ) + 300.0D * Math.sin( lng / 30.0D * 3.141592653589793D ) ) * 2.0D / 3.0D;
return ret;
}
public static final double[] transformWgsToGcj( double wgLat, double wgLon ) {
double[] point = new double[2];
if ( outOfChina( wgLat, wgLon ) ) {
point[0] = wgLon;
point[1] = wgLat;
return point;
} else {
double dLat = transformLat( wgLon - 105.0D, wgLat - 35.0D );
double dLon = transformLon( wgLon - 105.0D, wgLat - 35.0D );
double radLat = wgLat / 180.0D * 3.141592653589793D;
double magic = Math.sin( radLat );
magic = ( double ) 1 - 0.006693421622965943D * magic * magic;
double sqrtMagic = Math.sqrt( magic );
dLat = dLat * 180.0D / ( 6335552.717000426D / ( magic * sqrtMagic ) * 3.141592653589793D );
dLon = dLon * 180.0D / ( 6378245.0D / sqrtMagic * Math.cos( radLat ) * 3.141592653589793D );
double mgLat = wgLat + dLat;
double mgLon = wgLon + dLon;
point[0] = dealRound( mgLon );
point[1] = dealRound( mgLat );
return point;
}
}
public static final double[] transformGcj02toWgs84( double lat, double lng ) {
double[] var10000;
if ( outOfChina( lat, lng ) ) {
var10000 = new double[]{lng, lat};
} else {
double dlat = transformLat( lng - 105.0D, lat - 35.0D );
double dlng = transformLon( lng - 105.0D, lat - 35.0D );
double radlat = lat / 180.0D * 3.141592653589793D;
double magic = Math.sin( radlat );
magic = ( double ) 1 - 0.006693421622965943D * magic * magic;
double sqrtmagic = Math.sqrt( magic );
dlat = dlat * 180.0D / ( 6335552.717000426D / ( magic * sqrtmagic ) * 3.141592653589793D );
dlng = dlng * 180.0D / ( 6378245.0D / sqrtmagic * Math.cos( radlat ) * 3.141592653589793D );
double mglat = lat + dlat;
double mglng = lng + dlng;
var10000 = new double[]{dealRound( lng * ( double ) 2 - mglng ), dealRound( lat * ( double ) 2 - mglat )};
}
return var10000;
}
private static final double dealRound( double value ) {
BigDecimal bg = new BigDecimal( value );
double result = bg.setScale( 6, 4 ).doubleValue();
return result;
}
}

View File

@@ -1,68 +0,0 @@
package com.mogo.module.common.utils;
/**
* @author donghongyu
*/
public class CoordinateUtils {
private static double a = 6378245.0;
private static double ee = 0.00669342162296594323;
/**
* 手机GPS坐标转火星坐标
*
* @return
*/
public static double[] transformFromWGSToGCJ( double lat, double lon ) {
//如果在国外,则默认不进行转换
if ( outOfChina( lat, lon ) ) {
return new double[]{lat, lon};
}
double dLat = transformLat( lon - 105.0,
lat - 35.0 );
double dLon = transformLon( lon - 105.0,
lat - 35.0 );
double radLat = lat / 180.0 * Math.PI;
double magic = Math.sin( radLat );
magic = 1 - ee * magic * magic;
double sqrtMagic = Math.sqrt( magic );
dLat = ( dLat * 180.0 ) / ( ( a * ( 1 - ee ) ) / ( magic * sqrtMagic ) * Math.PI );
dLon = ( dLon * 180.0 ) / ( a / sqrtMagic * Math.cos( radLat ) * Math.PI );
return new double[]{lat + dLat, lon + dLon};
}
public static double transformLat( double x, double y ) {
double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y
+ 0.2 * Math.sqrt( x > 0 ? x : -x );
ret += ( 20.0 * Math.sin( 6.0 * x * Math.PI ) + 20.0 * Math.sin( 2.0 * x
* Math.PI ) ) * 2.0 / 3.0;
ret += ( 20.0 * Math.sin( y * Math.PI ) + 40.0 * Math.sin( y / 3.0
* Math.PI ) ) * 2.0 / 3.0;
ret += ( 160.0 * Math.sin( y / 12.0 * Math.PI ) + 320 * Math.sin( y
* Math.PI / 30.0 ) ) * 2.0 / 3.0;
return ret;
}
public static double transformLon( double x, double y ) {
double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1
* Math.sqrt( x > 0 ? x : -x );
ret += ( 20.0 * Math.sin( 6.0 * x * Math.PI ) + 20.0 * Math.sin( 2.0 * x
* Math.PI ) ) * 2.0 / 3.0;
ret += ( 20.0 * Math.sin( x * Math.PI ) + 40.0 * Math.sin( x / 3.0
* Math.PI ) ) * 2.0 / 3.0;
ret += ( 150.0 * Math.sin( x / 12.0 * Math.PI ) + 300.0 * Math.sin( x
/ 30.0 * Math.PI ) ) * 2.0 / 3.0;
return ret;
}
public static boolean outOfChina( double lat, double lon ) {
if ( lon < 72.004 || lon > 137.8347 )
return true;
if ( lat < 0.8293 || lat > 55.8271 )
return true;
return false;
}
}