balabala~~~

This commit is contained in:
wangcongtao
2020-10-30 14:44:07 +08:00
parent b8a9cf80ab
commit 58e0355da7
34 changed files with 452 additions and 133 deletions

View File

@@ -41,18 +41,10 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
@Override
protected void addDleMaps() {
mCustomMapView = new CustomMapView().create( getContext() );
if ( mCustomMapView != null ) {
final View mapView = mCustomMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
} else {
Logger.e( TAG, "create MapView instance failed." );
}
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
}
display2DMap( true, true );
}
private void addAMapView(){
mAMapView = new AMapBaseMapView().create( getContext() );
if ( mAMapView != null ) {
final View mapView = mAMapView.getMapView();
@@ -64,42 +56,68 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
}
mMapView = mAMapView;
}
mCustomMapView.getMapView().setVisibility( View.GONE );
private void addVrMapView(){
mCustomMapView = new CustomMapView().create( getContext() );
if ( mCustomMapView != null ) {
final View mapView = mCustomMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
} else {
Logger.e( TAG, "create MapView instance failed." );
}
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
}
mCustomMapView.onCreate( null );
}
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
private void removeVrMapView(){
try {
mCustomMapView.onDestroy();
removeView( mCustomMapView.getMapView() );
} catch ( Exception e ) {
e.printStackTrace();
}
}
private void removeAMapView(){
try {
mAMapView.onPause();
removeView( mAMapView.getMapView() );
} catch ( Exception e ) {
e.printStackTrace();
}
}
@Override
public void display2DMap( boolean invokeCreateAuto, boolean invokeResumeAuto ) {
mIsVrMode = false;
mMapView = mAMapView;
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
MogoMap.getInstance().init( getContext(), mAMapView.getMap() );
removeVrMapView();
addAMapView();
mMapView = mAMapView;
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
MogoMapUIController.getInstance().setDelegate( AMapUIController.getInstance() );
mCustomMapView.onPause();
mCustomMapView.getMapView().setVisibility( View.GONE );
mAMapView.onResume();
mAMapView.getMapView().setVisibility( View.VISIBLE );
}
@Override
public void displayVRMap( boolean invokeCreateAuto, boolean invokeResumeAuto ) {
mIsVrMode = true;
mMapView = mCustomMapView;
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
MogoMap.getInstance().init( getContext(), mCustomMapView.getMap() );
removeAMapView();
addVrMapView();
mMapView = mCustomMapView;
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
MogoMapUIController.getInstance().setDelegate( com.mogo.map.impl.custom.uicontroller.AMapUIController.getInstance() );
mCustomMapView.onResume();
mCustomMapView.getMapView().setVisibility( View.VISIBLE );
mAMapView.onPause();
mAMapView.getMapView().setVisibility( View.GONE );
post( new Runnable() {
@Override
public void run() {
try {
mAMapView.getMap().getUIController().showMyLocation( true );
getMap().getUIController().showMyLocation( true );
} catch ( Exception e ) {
e.printStackTrace();
}