当前位置: 首页>>代码示例>>Java>>正文


Java TileOverlay类代码示例

本文整理汇总了Java中com.google.android.gms.maps.model.TileOverlay的典型用法代码示例。如果您正苦于以下问题:Java TileOverlay类的具体用法?Java TileOverlay怎么用?Java TileOverlay使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TileOverlay类属于com.google.android.gms.maps.model包,在下文中一共展示了TileOverlay类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setMapFile

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
public static void setMapFile(MapsActivity context) {
    MapsForgeTilesProvider provider;
    try {
         provider = new MapsForgeTilesProvider(
                 context.getApplication(), new File(mapFile), new File(themeFile));
    } catch (Exception e) {
        mapFile = null;
        e.printStackTrace();
        Toast.makeText(context, "無法開啟檔案", Toast.LENGTH_SHORT).show();
        return;
    }

    TileOverlay lastTile = context.getMapsManager().getCurrentMapTile();
    if (lastTile != null)
        lastTile.remove();

    MapsManager manager = context.getMapsManager();
    manager.setCurrentMapTile(manager.getCurrentMap().addTileOverlay(
            new TileOverlayOptions().tileProvider(provider)));
    manager.getCurrentMapTile().setZIndex(ZINDEX_BASEMAP);
    manager.getCurrentMap().setMapType(GoogleMap.MAP_TYPE_NONE);
}
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:23,代码来源:TileUtils.java

示例2: setFloorElementsVisible

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
/**
 * Change the visibility of all Markers and TileOverlays for a floor.
 */
private void setFloorElementsVisible(int floor, boolean visible) {
    // Overlays
    final TileOverlay overlay = mTileOverlays.get(floor);
    if (overlay != null) {
        overlay.setVisible(visible);
    }

    // Markers
    final ArrayList<Marker> markers = mMarkersFloor.get(floor);
    if (markers != null) {
        for (Marker m : markers) {
            m.setVisible(visible);
        }
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:19,代码来源:MapFragment.java

示例3: remove

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
/**
 * Remove this tile layer
 * @param args
 * @param callbackContext
 * @throws JSONException 
 */
protected void remove(JSONArray args, CallbackContext callbackContext) throws JSONException {
  String id = args.getString(1);
  TileOverlay tileOverlay = (TileOverlay)this.objects.get(id);
  if (tileOverlay == null) {
    this.sendNoResult(callbackContext);
    return;
  }
  tileOverlay.remove();
  tileOverlay.clearTileCache();
  
  id = id.replace("tile_", "tileProvider_");
  this.objects.put(id, null);
  this.objects.remove(id);
  this.sendNoResult(callbackContext);
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:22,代码来源:PluginTileOverlay.java

示例4: addXYZDirectoryCacheOverlay

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
/**
 * Add XYZ Directory tile cache overlay
 * @param enabledCacheOverlays
 * @param xyzDirectoryCacheOverlay
 */
private void addXYZDirectoryCacheOverlay(Map<String, CacheOverlay> enabledCacheOverlays, XYZDirectoryCacheOverlay xyzDirectoryCacheOverlay){
	// Retrieve the cache overlay if it already exists (and remove from cache overlays)
	CacheOverlay cacheOverlay = cacheOverlays.remove(xyzDirectoryCacheOverlay.getCacheName());
	if(cacheOverlay == null){
		// Create a new tile provider and add to the map
		TileProvider tileProvider = new FileSystemTileProvider(256, 256, xyzDirectoryCacheOverlay.getDirectory().getAbsolutePath());
		TileOverlayOptions overlayOptions = createTileOverlayOptions(tileProvider);
		// Set the tile overlay in the cache overlay
		TileOverlay tileOverlay = map.addTileOverlay(overlayOptions);
		xyzDirectoryCacheOverlay.setTileOverlay(tileOverlay);
		cacheOverlay = xyzDirectoryCacheOverlay;
	}
	// Add the cache overlay to the enabled cache overlays
	enabledCacheOverlays.put(cacheOverlay.getCacheName(), cacheOverlay);
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:21,代码来源:MapFragment.java

示例5: setFloorElementsVisible

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
/**
 * Change the visibility of all Markers and TileOverlays for a floor.
 *
 * @param floor
 * @param visible
 */
private void setFloorElementsVisible(int floor, boolean visible) {
    // Overlays
    final TileOverlay overlay = mTileOverlays.get(floor);
    if (overlay != null) {
        overlay.setVisible(visible);
    }

    // Markers
    final ArrayList<Marker> markers = mMarkersFloor.get(floor);
    if (markers != null) {
        for (Marker m : markers) {
            m.setVisible(visible);
        }
    }
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:22,代码来源:MapFragment.java

示例6: clearMap

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
private void clearMap() {
    if (mMap != null) {
        for (int floor =0; floor < mMarkersFloor.size();floor++) {
            ArrayList<Marker> markers = mMarkersFloor.valueAt(floor);
            if (markers != null) {
                for (Marker marker : markers) {
                    marker.setVisible(false);
                }
            }
        }

        for (int floor =0; floor < mTileOverlays.size();floor++) {
            TileOverlay overlay = mTileOverlays.valueAt(floor);
            if(overlay!=null) {
                overlay.setVisible(false);
            }
        }

    }


}
 
开发者ID:secondsun,项目名称:devnexus-android,代码行数:23,代码来源:VenueMapFragment.java

示例7: addTileOverlay

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
public final TileOverlay addTileOverlay(TileOverlayOptions paramTileOverlayOptions)
{
  try
  {
    f localf = this.Br.addTileOverlay(paramTileOverlayOptions);
    if (localf != null)
    {
      TileOverlay localTileOverlay = new TileOverlay(localf);
      return localTileOverlay;
    }
    return null;
  }
  catch (RemoteException localRemoteException)
  {
    throw new RuntimeRemoteException(localRemoteException);
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:18,代码来源:GoogleMap.java

示例8: makeCheckBox

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
/**
 * Creates check box for a given search term
 *
 * @param keyword the search terms associated with the check box
 */
private void makeCheckBox(final String keyword) {
    mCheckboxLayout.setVisibility(View.VISIBLE);

    // Make new checkbox
    CheckBox checkBox = new CheckBox(this);
    checkBox.setText(keyword);
    checkBox.setTextColor(HEATMAP_COLORS[mOverlaysRendered]);
    checkBox.setChecked(true);
    checkBox.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            CheckBox c = (CheckBox) view;
            // Text is the keyword
            TileOverlay overlay = mOverlays.get(keyword);
            if (overlay != null) {
                overlay.setVisible(c.isChecked());
            }
        }
    });
    mCheckboxLayout.addView(checkBox);
}
 
开发者ID:googlemaps,项目名称:android-maps-utils,代码行数:27,代码来源:HeatmapsPlacesDemoActivity.java

示例9: clearMap

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
/**
 * Clears the map and initialises all map variables that hold markers and overlays.
 */
private void clearMap() {
    if (mMap != null) {
        mMap.clear();
    }

    // setup tile provider arrays
    mTileProviders = new TileProvider[NUM_FLOORS];
    mTileOverlays = new TileOverlay[NUM_FLOORS];

    mMarkers = new HashMap<String, MarkerModel>();
    mMarkersFloor = new ArrayList<ArrayList<Marker>>();

    // initialise floor marker lists
    for (int i = 0; i < NUM_FLOORS; i++) {
        mMarkersFloor.add(i, new ArrayList<Marker>());
    }
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:21,代码来源:MapFragment.java

示例10: pickOnlineTile

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
public static void pickOnlineTile(final Context context) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle("選擇線上底圖")
            .setItems(ONLINE_TILES, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    MapsManager manager = ((MapsActivity) context).getMapsManager();
                    GoogleMap map = manager.getCurrentMap();

                    TileOverlay lastTile = manager.getCurrentMapTile();
                    if (lastTile != null)
                        lastTile.remove();

                    switch (which) {
                        case 0:
                            map.setMapType(MAP_TYPE_HYBRID);
                            break;

                        case 1:
                            map.setMapType(MAP_TYPE_NORMAL);
                            break;

                        default:
                            TileOverlay newTile = map.addTileOverlay(
                                    getTileSetting(URL_ONLINE_TILES[which].toString()));
                            newTile.setZIndex(ZINDEX_BASEMAP);
                            manager.setCurrentMapTile(newTile);
                            map.setMapType(MAP_TYPE_NONE);
                    }
                }
            });
    builder.show();
}
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:34,代码来源:TileUtils.java

示例11: pickAdditionalTile

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
public static void pickAdditionalTile(final Context context) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle("選擇疊加圖層")
            .setItems(ADDITION_TILES, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    MapsManager manager = ((MapsActivity) context).getMapsManager();
                    GoogleMap map = manager.getCurrentMap();
                    switch (which) {
                        case 1:
                            manager.addMapAddTiles(map.addTileOverlay(
                                    new TileOverlayOptions().tileProvider(
                                            new CoorTileProvider(context, Color.BLACK))));
                            break;

                        case 2:
                            manager.addMapAddTiles(map.addTileOverlay(
                                    new TileOverlayOptions().tileProvider(
                                            new CoorTileProvider(context, Color.WHITE))));
                            break;

                        case 4:
                            manager.clearCurrentMapAddTiles();
                            break;

                        default:
                            TileOverlay tileOverlay = map.addTileOverlay(
                                    getTileSetting(URL_ADDITIONAL_TILES[which].toString()));
                            tileOverlay.setZIndex(ZINDEX_ADDTILE);
                            manager.addMapAddTiles(tileOverlay);
                    }
                }
            });
    builder.show();
}
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:36,代码来源:TileUtils.java

示例12: clearCurrentMapAddTiles

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
public void clearCurrentMapAddTiles() {
    List<TileOverlay> addTiles;
    if (currentMapCode == MAP_CODE_MAIN)
        addTiles = mMapAddTiles.first;
    else
        addTiles = mMapAddTiles.second;

    for (TileOverlay layer : addTiles)
        layer.remove();
    addTiles.clear();
}
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:12,代码来源:MapsManager.java

示例13: createTileOverlay

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
/**
 * Create tile overlay
 * 
 * @param args
 * @param callbackContext
 * @throws JSONException
 */
@SuppressWarnings("unused")
private void createTileOverlay(final JSONArray args,
  final CallbackContext callbackContext) throws JSONException {

  JSONObject opts = args.getJSONObject(1);
  int tileSize = opts.getInt("tileSize");
  final String tileUrlFormat = opts.getString("tileUrlFormat");
  
  double opacity = 1.0;
  if (opts.has("opacity")) {
    opacity = opts.getDouble("opacity");
  }
  PluginTileProvider tileProvider = new PluginTileProvider(tileUrlFormat, opacity, tileSize);

  TileOverlayOptions options = new TileOverlayOptions();
  options.tileProvider(tileProvider);
  if (opts.has("zIndex")) {
    options.zIndex((float)opts.getDouble("zIndex"));
  }
  if (opts.has("visible")) {
    options.visible(opts.getBoolean("visible"));
  }
  TileOverlay tileOverlay = this.map.addTileOverlay(options);
  String id = "tile_" + tileOverlay.getId();

  this.objects.put(id, tileOverlay);
  this.objects.put(id.replace("tile_", "tileProvider_"), tileProvider);

  JSONObject result = new JSONObject();
  result.put("hashCode", tileOverlay.hashCode());
  result.put("id", id);
  callbackContext.success(result);
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:41,代码来源:PluginTileOverlay.java

示例14: clearTileCache

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
/**
 * Clear cache
 * @param args
 * @param callbackContext
 * @throws JSONException 
 */
protected void clearTileCache(JSONArray args, CallbackContext callbackContext) throws JSONException {
  String id = args.getString(1);
  TileOverlay tileOverlay = (TileOverlay)this.objects.get(id);
  tileOverlay.clearTileCache();
  this.sendNoResult(callbackContext);
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:13,代码来源:PluginTileOverlay.java

示例15: loadOfflineData

import com.google.android.gms.maps.model.TileOverlay; //导入依赖的package包/类
private void loadOfflineData(int pos) {
    try {
        String extPath = Environment.getExternalStorageDirectory().getAbsolutePath();
        String filepath = extPath + "/" + CommonFunctions.parentFolderName + "/" + CommonFunctions.dataFolderName
                + "/" + offlineSpatialData.get(pos).getFile_Name();
        OfflineTileProvider provider = offlineSpatialData.get(pos).getProvider();
        File mbtileFile = new File(filepath);

        TileOverlayOptions opts = new TileOverlayOptions();
        if (provider == null) {
            // Create an instance of OfflineTileProvider.
            provider = new OfflineTileProvider(mbtileFile);
            offlineSpatialData.get(pos).setProvider(provider);
        }
        // Set the tile provider on the TileOverlayOptions.
        opts.tileProvider(provider);
        // Add the tile overlay to the map.
        TileOverlay overlay = googleMap.addTileOverlay(opts);
        offlineSpatialData.get(pos).setOverlay(overlay);

        // Sometime later when the map view is destroyed, close the provider.
        // This is important to prevent a leak of the backing SQLiteDatabase.
        provider.close();
    } catch (Exception e) {
        cf.appLog("", e);
        //String msg = getResources().getString(R.string.unableToLoadOfflineData);
        //Toast.makeText(context,msg+": "+offlineSpatialData.get(pos).getAlias(), Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:MASTUSAID,项目名称:MAST-MOBILE,代码行数:30,代码来源:MapViewerActivity.java


注:本文中的com.google.android.gms.maps.model.TileOverlay类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。