Exemplo n.º 1
0
  public MapTileLayer setBaseMap(TileSource tileSource) {
    MapTileLayer baseLayer = new MapTileLayer(this);

    baseLayer.setTileSource(tileSource);

    mLayerManager.add(1, baseLayer);

    mRotationEnabled = true;

    // mLayerManager.add(new GenericOverlay(this, new GridRenderLayer(this)));
    mLayerManager.add(new BuildingOverlay(this, baseLayer.getTileLayer()));
    LabelLayer ll = new LabelLayer(this, baseLayer.getTileLayer());
    mLayerManager.add(ll);

    return baseLayer;
  }
Exemplo n.º 2
0
  /**
   * @param context the enclosing MapActivity instance.
   * @param attributeSet a set of attributes.
   * @throws IllegalArgumentException if the context object is not an instance of {@link
   *     MapActivity} .
   */
  public MapView(Context context, AttributeSet attributeSet) {
    super(context, attributeSet);

    if (!(context instanceof MapActivity)) {
      throw new IllegalArgumentException("context is not an instance of MapActivity");
    }

    this.setWillNotDraw(true);

    DisplayMetrics metrics = getResources().getDisplayMetrics();
    dpi = Math.max(metrics.xdpi, metrics.ydpi);

    // TODO make this dpi dependent
    Tile.SIZE = 400;

    MapActivity mapActivity = (MapActivity) context;

    mMapViewPosition = new MapViewPosition(this);
    mMapPosition = new MapPosition();

    mLayerManager = new LayerManager(context);

    mGLView = new GLView(context, this);

    mDebugSettings = new DebugSettings();

    // FIXME
    MapTileLoader.setDebugSettings(mDebugSettings);

    mapActivity.registerMapView(this);

    LayoutParams params =
        new LayoutParams(
            android.view.ViewGroup.LayoutParams.MATCH_PARENT,
            android.view.ViewGroup.LayoutParams.MATCH_PARENT);

    addView(mGLView, params);

    mLayerManager.add(0, new MapEventLayer(this));

    clearMap();
    redrawMap(false);
  }
Exemplo n.º 3
0
 public MapTileLayer setBaseMap(BitmapTileLayer tileLayer) {
   mLayerManager.add(0, new MapEventLayer(this));
   mLayerManager.add(1, tileLayer);
   return null;
 }
Exemplo n.º 4
0
 public void setBackgroundMap(BitmapTileLayer tileLayer) {
   mLayerManager.add(0, tileLayer);
 }