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


Java VisibleRegion类代码示例

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


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

示例1: getVisibleRegion

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
/**
 * Return the visible region of the map
 * Thanks @fschmidt
 */
@SuppressWarnings("unused")
private void getVisibleRegion(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
  VisibleRegion visibleRegion = map.getProjection().getVisibleRegion();
  LatLngBounds latLngBounds = visibleRegion.latLngBounds;
  JSONObject result = new JSONObject();
  JSONObject northeast = new JSONObject();
  JSONObject southwest = new JSONObject();
  northeast.put("lat", latLngBounds.northeast.latitude);
  northeast.put("lng", latLngBounds.northeast.longitude);
  southwest.put("lat", latLngBounds.southwest.latitude);
  southwest.put("lng", latLngBounds.southwest.longitude);
  result.put("northeast", northeast);
  result.put("southwest", southwest);
  
  JSONArray latLngArray = new JSONArray();
  latLngArray.put(northeast);
  latLngArray.put(southwest);
  result.put("latLngArray", latLngArray);
  
  callbackContext.success(result);
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:26,代码来源:PluginMap.java

示例2: getMapCenter

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
private LatLng getMapCenter(){
    VisibleRegion visibleRegion = mGoogleMap.getProjection()
            .getVisibleRegion();

    Point x = mGoogleMap.getProjection().toScreenLocation(
            visibleRegion.farRight);

    Point y = mGoogleMap.getProjection().toScreenLocation(
            visibleRegion.nearLeft);

    Point centerPoint = new Point(x.x / 2, y.y / 2);

    LatLng centerFromPoint = mGoogleMap.getProjection().fromScreenLocation(
            centerPoint);
    return centerFromPoint;
}
 
开发者ID:kiideveloper,项目名称:pokiimap-human,代码行数:17,代码来源:MapWrapperFragment.java

示例3: getSuggestedRadius

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
/**
 * Suggest an initial radius (in meters) for the quiet place based on the
 * current zoom level of the map.
 * <p/>
 * Current process:
 * * Get the bounding box of the current map view
 * * Find the shortest dimension (horizontal or vertical)
 * * Get the distance in meters of that dimension
 * * Suggest the radius as 1/8th of that.
 *
 * @return suggested radius in meters
 */
public double getSuggestedRadius() {
    VisibleRegion region = getMap().getProjection().getVisibleRegion();

    double horizontalDistance = getDistance(region.farLeft, region.farRight);
    double verticalDistance = getDistance(region.nearLeft, region.farLeft);
    double chosenDimension = horizontalDistance;
    if (verticalDistance < horizontalDistance) {
        chosenDimension = verticalDistance;
    }

    double radius = chosenDimension * Config.SUGGESTED_RADIUS_MULTIPLIER;
    if (radius < Config.QP_SIZE_FLOOR) {
        radius = Config.QP_SIZE_FLOOR;
    }
    return radius;
}
 
开发者ID:Preston-Landers,项目名称:QuietPlaces,代码行数:29,代码来源:QPMapFragment.java

示例4: getVisibleRegion

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
public VisibleRegion getVisibleRegion()
{
  Parcel localParcel1 = Parcel.obtain();
  Parcel localParcel2 = Parcel.obtain();
  try
  {
    localParcel1.writeInterfaceToken("com.google.android.gms.maps.internal.IProjectionDelegate");
    this.dU.transact(3, localParcel1, localParcel2, 0);
    localParcel2.readException();
    VisibleRegion localVisibleRegion;
    if (localParcel2.readInt() != 0)
      localVisibleRegion = VisibleRegion.CREATOR.createFromParcel(localParcel2);
    else
      localVisibleRegion = null;
    return localVisibleRegion;
  }
  finally
  {
    localParcel2.recycle();
    localParcel1.recycle();
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:23,代码来源:IProjectionDelegate.java

示例5: init

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
@Before
public void init() {
    Mockito.when(map.getCameraPosition()).thenReturn(new CameraPosition(new LatLng(0, 0), 8, 0, 0));
    Mockito.when(map.getProjection()).thenReturn(projection);
    Mockito.when(projection.getVisibleRegion()).thenReturn(new VisibleRegion(new LatLng(-1, -1), new LatLng(-1, 1), new LatLng(1, -1), new LatLng(1, 1), new LatLngBounds(new LatLng(-1, -1), new LatLng(1, 1))));

    Mockito.when(marker1.isVisible()).thenReturn(true);
    Mockito.when(marker1.getPosition()).thenReturn(new LatLng(0, 0));

    Mockito.when(marker2.isVisible()).thenReturn(true);
    Mockito.when(marker2.getPosition()).thenReturn(new LatLng(50, 50));

    Mockito.when(marker3.isVisible()).thenReturn(true);
    Mockito.when(marker3.getPosition()).thenReturn(new LatLng(0.1, 0.1));

    ClusteringSettings settings = new ClusteringSettings().addMarkersDynamically(true);
    strategy = new GridClusteringStrategy(settings, map, new ArrayList<DelegatingMarker>(), refresher);
}
 
开发者ID:benbek,项目名称:HereAStory-Android,代码行数:19,代码来源:DynamicGridClusteringStrategyTest.java

示例6: setExtents

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
protected void setExtents() {
    if (map != null) {
        VisibleRegion region = map.getProjection().getVisibleRegion();
        double ullon = region.farLeft.longitude;
        double ullat = region.farLeft.latitude;
        double lrlon = region.nearRight.longitude;
        double lrlat = region.nearRight.latitude;
        //set the geo extents
        utility.SetExtents(ullon, lrlon, ullat, lrlat);
        //set the pixels extents
        android.graphics.Point ul = map.getProjection().toScreenLocation(region.farLeft);
        android.graphics.Point lr = map.getProjection().toScreenLocation(region.nearRight);
        double width = lr.x - ul.x;
        double height = lr.y - ul.y;
        utility.set_displayPixelsWidth(width);
        utility.set_displayPixelsHeight(height);
    }
    return;
}
 
开发者ID:missioncommand,项目名称:mil-sym-android,代码行数:20,代码来源:MyView.java

示例7: onCameraChange

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
public void onCameraChange(CameraPosition position) {
	LatLng pos = mMarker.getPosition();
	final Projection proj = mMap.getProjection();
	final VisibleRegion vr = proj.getVisibleRegion();
	final LatLng farLeft = vr.farLeft;
	final LatLng farRight = vr.farRight;
	final LatLng nearLeft = vr.nearLeft;
	final LatLng nearRight = vr.nearRight;

	double screenLat = Math.abs(farLeft.latitude - nearRight.latitude) / 2.0;
	double screenLng = Math.abs(farLeft.longitude - nearRight.longitude) / 2.0;

	double latDiff = Math.abs(mInit.latitude - position.target.latitude);
	double lngDiff = Math.abs(mInit.longitude - position.target.longitude);

	if (latDiff > screenLat || lngDiff > screenLng) {
	    double cLat = mMap.getCameraPosition().target.latitude;
		double cLng = mMap.getCameraPosition().target.longitude;
		mInit = new LatLng(cLat, cLng);
		mMarker.position(mInit);
		mMap.clear();
		mMap.addMarker(mMarker);
	}
	
}
 
开发者ID:hilarycheng,项目名称:xposed-gps,代码行数:26,代码来源:MainActivity.java

示例8: calculateVisibleClusters

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
private void calculateVisibleClusters() {
    IProjection projection = map.getProjection();
    VisibleRegion visibleRegion = projection.getVisibleRegion();
    LatLngBounds bounds = visibleRegion.latLngBounds;
    visibleClusters[0] = convLat(bounds.southwest.latitude);
    visibleClusters[1] = convLng(bounds.southwest.longitude);
    visibleClusters[2] = convLat(bounds.northeast.latitude);
    visibleClusters[3] = convLng(bounds.northeast.longitude);
}
 
开发者ID:mosquitolabs,项目名称:referendum_1o_android,代码行数:10,代码来源:GridClusteringStrategy.java

示例9: showMarkersInVisibleRegion

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
private void showMarkersInVisibleRegion() {
    IProjection projection = map.getProjection();
    VisibleRegion visibleRegion = projection.getVisibleRegion();
    visibleRegionBounds = visibleRegion.latLngBounds;
    Iterator<DelegatingMarker> iterator = markers.iterator();
    while (iterator.hasNext()) {
        DelegatingMarker marker = iterator.next();
        if (visibleRegionBounds.contains(marker.getPosition())) {
            marker.changeVisible(true);
            iterator.remove();
        }
    }
}
 
开发者ID:mosquitolabs,项目名称:referendum_1o_android,代码行数:14,代码来源:DynamicNoClusteringStrategy.java

示例10: isPolygonContains

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
/**
 * Intersects using the Winding Number Algorithm
 * @ref http://www.nttpc.co.jp/company/r_and_d/technology/number_algorithm.html
 * @param path
 * @param point
 * @return
 */
private boolean isPolygonContains(List<LatLng> path, LatLng point) {
  int wn = 0;
  Projection projection = map.getProjection();
  VisibleRegion visibleRegion = projection.getVisibleRegion();
  LatLngBounds bounds = visibleRegion.latLngBounds;
  Point sw = projection.toScreenLocation(bounds.southwest);

  Point touchPoint = projection.toScreenLocation(point);
  touchPoint.y = sw.y - touchPoint.y;
  double vt;

  for (int i = 0; i < path.size() - 1; i++) {
    Point a = projection.toScreenLocation(path.get(i));
    a.y = sw.y - a.y;
    Point b = projection.toScreenLocation(path.get(i + 1));
    b.y = sw.y - b.y;

    if ((a.y <= touchPoint.y) && (b.y > touchPoint.y)) {
      vt = ((double)touchPoint.y - (double)a.y) / ((double)b.y - (double)a.y);
      if (touchPoint.x < ((double)a.x + (vt * ((double)b.x - (double)a.x)))) {
        wn++;
      }
    } else if ((a.y > touchPoint.y) && (b.y <= touchPoint.y)) {
      vt = ((double)touchPoint.y - (double)a.y) / ((double)b.y - (double)a.y);
      if (touchPoint.x < ((double)a.x + (vt * ((double)b.x - (double)a.x)))) {
        wn--;
      }
    }
  }

  return (wn != 0);
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:40,代码来源:GoogleMaps.java

示例11: getVisibleMapArea

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
public VisibleMapArea getVisibleMapArea(){
    final GoogleMap map = getMap();
    if(map == null)
        return null;

    final VisibleRegion mapRegion = map.getProjection().getVisibleRegion();
    return new VisibleMapArea(MapUtils.latLngToCoord(mapRegion.farLeft),
            MapUtils.latLngToCoord(mapRegion.nearLeft),
            MapUtils.latLngToCoord(mapRegion.nearRight),
            MapUtils.latLngToCoord(mapRegion.farRight));
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:12,代码来源:GoogleMapFragment.java

示例12: a

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
public final VisibleRegion a()
{
  try
  {
    VisibleRegion localVisibleRegion = this.a.a();
    return localVisibleRegion;
  }
  catch (RemoteException localRemoteException)
  {
    throw new bm(localRemoteException);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:13,代码来源:fet.java

示例13: isPolygonContains

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
/**
 * Intersects using the Winding Number Algorithm
 * @ref http://www.nttpc.co.jp/company/r_and_d/technology/number_algorithm.html
 * @param path
 * @param point
 * @return
 */
private boolean isPolygonContains(List<LatLng> path, LatLng point) {
  int wn = 0;
  Projection projection = map.getProjection();
  VisibleRegion visibleRegion = projection.getVisibleRegion();
  LatLngBounds bounds = visibleRegion.latLngBounds;
  Point sw = projection.toScreenLocation(bounds.southwest);
  
  Point touchPoint = projection.toScreenLocation(point);
  touchPoint.y = sw.y - touchPoint.y;
  double vt;
  
  for (int i = 0; i < path.size() - 1; i++) {
    Point a = projection.toScreenLocation(path.get(i));
    a.y = sw.y - a.y;
    Point b = projection.toScreenLocation(path.get(i + 1));
    b.y = sw.y - b.y;
    
    if ((a.y <= touchPoint.y) && (b.y > touchPoint.y)) {
      vt = ((double)touchPoint.y - (double)a.y) / ((double)b.y - (double)a.y);
      if (touchPoint.x < ((double)a.x + (vt * ((double)b.x - (double)a.x)))) {
        wn++;
      }
    } else if ((a.y > touchPoint.y) && (b.y <= touchPoint.y)) {
      vt = ((double)touchPoint.y - (double)a.y) / ((double)b.y - (double)a.y);
      if (touchPoint.x < ((double)a.x + (vt * ((double)b.x - (double)a.x)))) {
        wn--;
      }
    }
  }
  
  return (wn != 0);
}
 
开发者ID:neo4art,项目名称:neo4art,代码行数:40,代码来源:GoogleMaps.java

示例14: getVisibleRegion

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
public final VisibleRegion getVisibleRegion()
{
  try
  {
    VisibleRegion localVisibleRegion = this.Ce.getVisibleRegion();
    return localVisibleRegion;
  }
  catch (RemoteException localRemoteException)
  {
    throw new RuntimeRemoteException(localRemoteException);
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:13,代码来源:Projection.java

示例15: updateSlider

import com.google.android.gms.maps.model.VisibleRegion; //导入依赖的package包/类
private void updateSlider() {
    if (null != mCircle) {
        mSlider.setEnabled(true);
        VisibleRegion region = mMap.getProjection().getVisibleRegion();
        double dist = Utils.distance(region.farLeft, region.farRight, DistanceUnit.Kilometers) * 1000;
        mSlider.setMax(mSlider.getMeasuredWidth());
        mSlider.setProgress((int) (mSlider.getMeasuredWidth() * mCircle.getRadius() * 2 / dist));
    } else {
        mSlider.setEnabled(false);
    }
}
 
开发者ID:yolanother,项目名称:geofenceeditor,代码行数:12,代码来源:GeofenceEditorActivity.java


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