Android Open Source - SmartMap Google Map View






From Project

Back to project page SmartMap.

License

The source code is released under:

Apache License

If you think the Android project SmartMap listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.dennytech.smartmap.impl.google;
//ww w.jav a  2 s .  co m
import android.content.Context;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.ViewGroup.LayoutParams;

import com.dennytech.smartmap.IGeoPoint;
import com.dennytech.smartmap.IMapView;
import com.dennytech.smartmap.IMapViewLayoutParams;
import com.dennytech.smartmap.IOverlay;
import com.dennytech.smartmap.IProjection;
import com.dennytech.smartmap.MapViewCallback;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;

public class GoogleMapView implements IMapView {

  MyGoogleMapView mapView;

  GoogleMapController mapController;
  GoogleGeoPoint mapCenter;
  
  MapViewCallback mCallback;

  public GoogleMapView(Context context, String apiKey) {
    mapView = new MyGoogleMapView(context, apiKey);

    mapController = new GoogleMapController();

    mapCenter = new GoogleGeoPoint();
  }

  public View real() {
    return mapView;
  }
  
  public void setCallback(MapViewCallback callback) {
    mapView.setCallback(callback);
  }

  public GoogleMapController getController() {
    return mapController.wrap(mapView.getController());
  }

  public GoogleGeoPoint getMapCenter() {
    return mapCenter.wrap(mapView.getMapCenter());
  }

  public void setBuiltInZoomControls(boolean on) {
    mapView.setBuiltInZoomControls(on);
  }

  @Override
  public void addOverlay(IOverlay ol) {
    mapView.getOverlays().add((Overlay) ol.real());
  }

  @Override
  public void removeOverlay(IOverlay ol) {
    mapView.getOverlays().remove(ol.real());
  }

  @Override
  public void clearOverlay() {
    mapView.getOverlays().clear();
  }

  public int getMaxZoomLevel() {
    return mapView.getMaxZoomLevel();
  }

  @Override
  public int getZoomLevel() {
    return mapView.getZoomLevel();
  }

  public void setLayoutParams(LayoutParams params) {
    mapView.setLayoutParams(params);
  }

  public void setClickable(boolean clickable) {
    mapView.setClickable(clickable);
  }

  @Override
  public IProjection getProjection() {
    return new GoogleProjection().wrap(mapView.getProjection());
  }

  @Override
  public void invalidate() {
    mapView.invalidate();
  }

  @Override
  public void addView(View child, IMapViewLayoutParams params) {
    mapView.addView(child, (MapView.LayoutParams) params.real());
  }

  @Override
  public void updateViewLayout(View view, LayoutParams params) {
    mapView.updateViewLayout(view, params);
  }

  @Override
  public void setOnTouchListener(OnTouchListener listener) {
    mapView.setOnTouchListener(listener);
  }

  public static class MVLayoutParams implements IMapViewLayoutParams {

    private MapView.LayoutParams mReal;

    public MVLayoutParams(int width, int height, IGeoPoint point,
        int alignment) {
      mReal = new MapView.LayoutParams(width, height,
          (GeoPoint) (point == null ? null : point.real()), alignment);
    }

    public MVLayoutParams(MapView.LayoutParams params) {
      mReal = params;
    }

    @Override
    public Object real() {
      return mReal;
    }

    @Override
    public int getWidth() {
      return mReal.width;
    }

    @Override
    public int getHeight() {
      return mReal.height;
    }

    @Override
    public IGeoPoint getPoint() {
      return new GoogleGeoPoint(mReal.point);
    }

    @Override
    public void setPoint(IGeoPoint point) {
      mReal.point = (GeoPoint) point.real();
    }

    @Override
    public int getAlignment() {
      return mReal.alignment;
    }

    @Override
    public int getMode() {
      return mReal.mode;
    }
  }
}




Java Source Code List

com.dennytech.smartmap.IGeoPoint.java
com.dennytech.smartmap.IItemizedOverlay.java
com.dennytech.smartmap.IMapController.java
com.dennytech.smartmap.IMapFragment.java
com.dennytech.smartmap.IMapViewLayoutParams.java
com.dennytech.smartmap.IMapView.java
com.dennytech.smartmap.IMyLocationOverlay.java
com.dennytech.smartmap.IOverlayItem.java
com.dennytech.smartmap.IOverlay.java
com.dennytech.smartmap.IProjection.java
com.dennytech.smartmap.ItemizedOverlayCallBack.java
com.dennytech.smartmap.MapUtils.java
com.dennytech.smartmap.MapViewCallback.java
com.dennytech.smartmap.OverlayCallBack.java
com.dennytech.smartmap.SMItemizedOverlay.java
com.dennytech.smartmap.SMMapFragment.java
com.dennytech.smartmap.SMMyLocationOverlay.java
com.dennytech.smartmap.SMOverlay.java
com.dennytech.smartmap.impl.autonavi.ANGeoPoint.java
com.dennytech.smartmap.impl.autonavi.ANItemizedOverlay.java
com.dennytech.smartmap.impl.autonavi.ANMapActivity.java
com.dennytech.smartmap.impl.autonavi.ANMapController.java
com.dennytech.smartmap.impl.autonavi.ANMapViewLayoutParams.java
com.dennytech.smartmap.impl.autonavi.ANMapView.java
com.dennytech.smartmap.impl.autonavi.ANMyLocationOverlay.java
com.dennytech.smartmap.impl.autonavi.ANOverlayItem.java
com.dennytech.smartmap.impl.autonavi.ANOverlay.java
com.dennytech.smartmap.impl.autonavi.ANProjection.java
com.dennytech.smartmap.impl.autonavi.myANMapView.java
com.dennytech.smartmap.impl.google.GoogleGeoPoint.java
com.dennytech.smartmap.impl.google.GoogleItemizedOverlay.java
com.dennytech.smartmap.impl.google.GoogleMapActivity.java
com.dennytech.smartmap.impl.google.GoogleMapController.java
com.dennytech.smartmap.impl.google.GoogleMapView.java
com.dennytech.smartmap.impl.google.GoogleMyLocationOverlay.java
com.dennytech.smartmap.impl.google.GoogleOverlayItem.java
com.dennytech.smartmap.impl.google.GoogleOverlay.java
com.dennytech.smartmap.impl.google.GoogleProjection.java
com.dennytech.smartmap.impl.google.myGoogleMapView.java