本文整理汇总了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));
}
}
}
示例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));
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}