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


Java PolyUtil.containsLocation方法代码示例

本文整理汇总了Java中com.google.maps.android.PolyUtil.containsLocation方法的典型用法代码示例。如果您正苦于以下问题:Java PolyUtil.containsLocation方法的具体用法?Java PolyUtil.containsLocation怎么用?Java PolyUtil.containsLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.maps.android.PolyUtil的用法示例。


在下文中一共展示了PolyUtil.containsLocation方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: combineHoles

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
private static ArrayList<ArrayList<LatLng>> combineHoles(ArrayList<ArrayList<LatLng>> holes) {
    // Loop from last element
    // Each loop checks it against all other elements
    for (int i = (holes.size() - 1); i > 0; i--) {
        // loop from first element and combine checked element from above loop
        for (int j = 0 ; j < i ; j ++) {
            // Check to see if any point in j falls within i
            for (LatLng latLng : holes.get(i)) {
                // If it does, combine i to j and delete i
                if (PolyUtil.containsLocation(latLng, holes.get(j), true)) {
                    holes.set(j, combinePolygonGreen(holes.get(j), holes.get(i), true));
                    holes.remove(i);
                    // Recursivly run algorithm until no holes intersect
                    return combineHoles(holes);
                }
            }
        }
    }
    return holes;
}
 
开发者ID:kav0rka,项目名称:VennTracker,代码行数:21,代码来源:Circles.java

示例2: getLastIndex

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
private static int getLastIndex(ArrayList<LatLng> circlePoints, ArrayList<LatLng> checkAgainst) {
    int endIndex = 0;
    boolean stopChecking = false;
    for (LatLng latLng : circlePoints) {

        if (!PolyUtil.containsLocation(latLng, checkAgainst, isGeoDisc)) {
            endIndex = circlePoints.indexOf(latLng);
            stopChecking = true;
        } else {
            if (stopChecking) {
                break;
            }
        }
    }
    return endIndex;
}
 
开发者ID:kav0rka,项目名称:VennTracker,代码行数:17,代码来源:Circles.java

示例3: isPointOnPolygon

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
/**
 * Is the point of the polygon
 *
 * @param point     point
 * @param polygon   polygon
 * @param geodesic  geodesic check flag
 * @param tolerance distance tolerance
 * @return true if on the polygon
 */
public static boolean isPointOnPolygon(LatLng point, PolygonOptions polygon, boolean geodesic, double tolerance) {

    boolean onPolygon = PolyUtil.containsLocation(point, polygon.getPoints(), geodesic) ||
            PolyUtil.isLocationOnEdge(point, polygon.getPoints(), geodesic, tolerance);

    if (onPolygon) {
        for (List<LatLng> hole : polygon.getHoles()) {
            if (PolyUtil.containsLocation(point, hole, geodesic)) {
                onPolygon = false;
                break;
            }
        }
    }

    return onPolygon;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:26,代码来源:MapUtils.java

示例4: checkIntersection

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
private void checkIntersection(LatLng point)
{

    if (arrayLayers == null)
        return;
    for (Parcel parcel : arrayLayers)
    {
        if (BuildConfig.DEBUG) Log.d(TAG, "======= Checking polygons for parcel =======");
        for (GeoJsonPolygon polygon : parcel.polygons)
        {
            if (BuildConfig.DEBUG) Log.d(TAG, polygon.getCoordinates().toString());
            if (BuildConfig.DEBUG) Log.d(TAG, point.toString());

            if (PolyUtil.containsLocation(point, polygon.getCoordinates().get(0), true))
                setPolygonGreen(parcel.layer);
            else
                setPolygonGrey(parcel.layer);
        }
    }
}
 
开发者ID:ekylibre,项目名称:zero-android,代码行数:21,代码来源:MapsActivity.java

示例5: subtractHoles

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
private static ArrayList<LatLng> subtractHoles(ArrayList<LatLng> polygonPointsGreen, Context context) {
    for (int i = mHoles.size() - 1 ; i >= 0 ; i--) {
        for (LatLng latLng : polygonPointsGreen) {
            if (PolyUtil.containsLocation(latLng, mHoles.get(i), isGeoDisc)) {
                polygonPointsGreen = subtractCircle(polygonPointsGreen, mHoles.get(i), context);
                mHoles.remove(i);
                break;
            }
        }

    }
    return polygonPointsGreen;
}
 
开发者ID:kav0rka,项目名称:VennTracker,代码行数:14,代码来源:Circles.java

示例6: onLocationChanged

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
public void onLocationChanged(Location location)
{
    double latitude = location.getLatitude();
    double longitude = location.getLongitude();
    LatLng newLocation = new LatLng(latitude, longitude);

    String out = "0";

    String selectQuery = "SELECT imei,latitude,longitude,datetime(timestamp,'localtime') as currentTime, out FROM position ORDER BY currentTime LIMIT 1";
    Cursor cursor = localdb.rawQuery(selectQuery, null);

    if (cursor.moveToFirst()) //If there is any location info before
    {
        HashMap<String, String> lastLocation = new HashMap<String, String>();
        for(int i=0; i<cursor.getColumnCount();i++)
            lastLocation.put(cursor.getColumnName(i), cursor.getString(i));

        //If Last location is out of activation area
        if(lastLocation.get("out") == "1")
        {
            //if (true)
            if (PolyUtil.containsLocation(newLocation,ituArea.getPoints(),true))
                Insertion(newLocation, out);
        }
        //If distance greater or equal to 20 meter between last location and new location
        //else if(true)
        else if(getDistance(newLocation, new LatLng(Double.parseDouble(lastLocation.get("latitude")),Double.parseDouble(lastLocation.get("longitude")))) >= 20)
        {
            //if(false)
            if (!PolyUtil.containsLocation(newLocation,ituArea.getPoints(),true))
                out = "1";
            Insertion(newLocation,out);
        }
    }
    else // First location info
    {
        //if (true)
        if (PolyUtil.containsLocation(newLocation,ituArea.getPoints(),true))
            Insertion(newLocation,out);
    }
}
 
开发者ID:sarikaya,项目名称:Bee-Analyzer,代码行数:42,代码来源:MapsActivity.java

示例7: pointIsOnShape

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @Override
 */
public boolean pointIsOnShape(LatLng latLng, double tolerance) {

    boolean onShape = PolyUtil.containsLocation(latLng, polygon.getPoints(), polygon.isGeodesic());

    return onShape;
}
 
开发者ID:ngageoint,项目名称:mage-android,代码行数:12,代码来源:MapPolygonObservation.java

示例8: containsLocation

import com.google.maps.android.PolyUtil; //导入方法依赖的package包/类
/**
 * Checks if the DeelgebiedData contains a location.
 *
 * @param location The location to check.
 * @return Value indicating if the location is within the DeelgebiedData.
 * */
public boolean containsLocation(LatLng location)
{
    return PolyUtil.containsLocation(location, coordinates, false);
}
 
开发者ID:RSDT,项目名称:Japp16,代码行数:11,代码来源:Deelgebied.java


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