當前位置: 首頁>>代碼示例>>Java>>正文


Java LatLngBounds.contains方法代碼示例

本文整理匯總了Java中com.google.android.gms.maps.model.LatLngBounds.contains方法的典型用法代碼示例。如果您正苦於以下問題:Java LatLngBounds.contains方法的具體用法?Java LatLngBounds.contains怎麽用?Java LatLngBounds.contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.gms.maps.model.LatLngBounds的用法示例。


在下文中一共展示了LatLngBounds.contains方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onLocationChanged

import com.google.android.gms.maps.model.LatLngBounds; //導入方法依賴的package包/類
@Override
public void onLocationChanged(Location location) {
	this.location = location;
	Log.d(LOG_NAME, "Map location updated.");
	if (locationChangedListener != null) {
		locationChangedListener.onLocationChanged(location);
	}

	if (followMe) {
		LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds;
		LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
		if (!bounds.contains(latLng)) {
			// Move the camera to the user's location once it's available!
			map.animateCamera(CameraUpdateFactory.newLatLng(latLng));
		}
	}
}
 
開發者ID:ngageoint,項目名稱:mage-android,代碼行數:18,代碼來源:MapFragment.java

示例2: limitBounds

import com.google.android.gms.maps.model.LatLngBounds; //導入方法依賴的package包/類
public static void limitBounds(GoogleMap map, CameraPosition cameraPosition, LatLngBounds bounds, float minZoom, LatLng centre) {
  if (bounds.contains(map.getCameraPosition().target) && cameraPosition.zoom >= minZoom) {
    return;
  }

  float targetZoom = cameraPosition.zoom;
  if (cameraPosition.zoom < minZoom) {
    targetZoom = minZoom;
  }

  if (centre != null) {
    map.animateCamera(CameraUpdateFactory.newLatLngZoom(centre, targetZoom));
  } else {
    double targetLong = cameraPosition.target.longitude;
    if (cameraPosition.target.longitude < bounds.southwest.longitude) {
      targetLong = bounds.southwest.longitude;
    } else if (cameraPosition.target.longitude > bounds.northeast.longitude) {
      targetLong = bounds.northeast.longitude;
    }

    double targetLat = cameraPosition.target.latitude;
    if (cameraPosition.target.latitude < bounds.southwest.latitude) {
      targetLat = bounds.southwest.latitude;
    } else if (cameraPosition.target.latitude > bounds.northeast.latitude) {
      targetLat = bounds.northeast.latitude;
    }

    LatLng targetLatLng = new LatLng(targetLat, targetLong);
    map.animateCamera(CameraUpdateFactory.newLatLngZoom(targetLatLng, targetZoom));
  }
}
 
開發者ID:fiskurgit,項目名稱:KortidTol,代碼行數:32,代碼來源:MapTools.java

示例3: checkIfOnCampus

import com.google.android.gms.maps.model.LatLngBounds; //導入方法依賴的package包/類
private boolean checkIfOnCampus(double lat, double lng){
    LatLngBounds bounds = new LatLngBounds(new LatLng(53.517288, -113.533018),
            new LatLng(53.530606, -113.511475));
    if (bounds.contains(new LatLng(lat, lng)))
    {
        return true;
    }
    else
    {
        return false;
    }
}
 
開發者ID:cfudge,項目名稱:ClassDiscuss,代碼行數:13,代碼來源:MapActivity.java

示例4: containsInBoundary

import com.google.android.gms.maps.model.LatLngBounds; //導入方法依賴的package包/類
/** Returns true if any point of the feature falls into provided bounds */
public boolean containsInBoundary(LatLngBounds bounds){
    for(LatLng p : points){
        if(bounds.contains(p))
            return true;
    }
    return false;
}
 
開發者ID:MASTUSAID,項目名稱:MAST-MOBILE,代碼行數:9,代碼來源:MapFeature.java

示例5: getPointToSnap

import com.google.android.gms.maps.model.LatLngBounds; //導入方法依賴的package包/類
public LatLng getPointToSnap(LatLngBounds bounds, android.graphics.Point pointToTest, int snappingTolerance){
    for (int i = 0; i < getScreenPoints().size(); i++){
        if (GisUtility.getDistanceBetweenPoints(screenPoints.get(i), pointToTest) <= snappingTolerance) {
            // Test point to be in the visible bound
            if(bounds.contains(points.get(i)))
                return points.get(i);
        }
    }
    return null;
}
 
開發者ID:MASTUSAID,項目名稱:MAST-MOBILE,代碼行數:11,代碼來源:MapFeature.java

示例6: getSegmentPointToSnap

import com.google.android.gms.maps.model.LatLngBounds; //導入方法依賴的package包/類
public LatLng getSegmentPointToSnap(LatLngBounds bounds, LatLng pointToTest, android.graphics.Point screenPointToTest, int snappingTolerance){
    for (int i = 0; i < getScreenPoints().size(); i++){
        if(i + 1 < getScreenPoints().size()){
            if (GisUtility.getDistanceToSegment(screenPointToTest, screenPoints.get(i), screenPoints.get(i + 1)) <= snappingTolerance) {
                LatLng pointToSnap = GisUtility.getClosestPointOnSegment(pointToTest, points.get(i), points.get(i + 1));
                if(bounds.contains(pointToSnap))
                    return pointToSnap;
            }
        }
    }
    return null;
}
 
開發者ID:MASTUSAID,項目名稱:MAST-MOBILE,代碼行數:13,代碼來源:MapFeature.java

示例7: isGroundOverlayContains

import com.google.android.gms.maps.model.LatLngBounds; //導入方法依賴的package包/類
/**
 * Check if a ground overlay contains a point
 * @param groundOverlay
 * @param point
 */
private boolean isGroundOverlayContains(GroundOverlay groundOverlay, LatLng point) {
  LatLngBounds groundOverlayBounds = groundOverlay.getBounds();

  return groundOverlayBounds.contains(point);
}
 
開發者ID:AdrianBZG,項目名稱:PhoneChat,代碼行數:11,代碼來源:GoogleMaps.java

示例8: isGroundOverlayContains

import com.google.android.gms.maps.model.LatLngBounds; //導入方法依賴的package包/類
/**
 * Check if a ground overlay contains a point
 * @param groundOverlay
 * @param point
 */
private boolean isGroundOverlayContains(GroundOverlay groundOverlay, LatLng point) {
  LatLngBounds groundOverlayBounds = groundOverlay.getBounds();
  
  return groundOverlayBounds.contains(point);
}
 
開發者ID:neo4art,項目名稱:neo4art,代碼行數:11,代碼來源:GoogleMaps.java


注:本文中的com.google.android.gms.maps.model.LatLngBounds.contains方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。