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


Java SphericalUtil.computeLength方法代码示例

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


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

示例1: getLongitudeDistance

import com.google.maps.android.SphericalUtil; //导入方法依赖的package包/类
/**
 * Get the longitude distance in the middle latitude
 *
 * @param minLongitude min longitude
 * @param maxLongitude max longitude
 * @param latitude     latitude
 * @return distance
 * @since 1.2.7
 */
public static double getLongitudeDistance(double minLongitude,
                                          double maxLongitude,
                                          double latitude) {
    LatLng leftMiddle = new LatLng(latitude, minLongitude);
    LatLng middle = new LatLng(latitude, (minLongitude + maxLongitude) / 2.0);
    LatLng rightMiddle = new LatLng(latitude, maxLongitude);

    List<LatLng> path = new ArrayList<LatLng>();
    path.add(leftMiddle);
    path.add(middle);
    path.add(rightMiddle);

    double lonDistance = SphericalUtil.computeLength(path);
    return lonDistance;
}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:25,代码来源:TileBoundingBoxMapUtils.java

示例2: showLineCharts

import com.google.maps.android.SphericalUtil; //导入方法依赖的package包/类
private void showLineCharts() {
    List<Entry> altitudeEntries = new ArrayList<>();
    List<Entry> speedEntries = new ArrayList<>();
    BRecord lastRecord = null;

    final List<ILatLonRecord> trackPoints = igcFile.getTrackPoints();
    int index;
    int lastIndexShown = 0;

    for (index = 0; index < trackPoints.size(); index++) {
        BRecord bRecord = (BRecord) trackPoints.get(index);

        if (index % Constants.Chart.POINTS_SIMPLIFIER == 0) {
            altitudeEntries.add(new Entry(index, bRecord.getAltitude()));
        }

        if (index % Constants.Chart.POINTS_SIMPLIFIER == 0) {
            if (lastRecord == null) {
                lastRecord = (BRecord) trackPoints.get(0);
            }
            double distanceBetween = SphericalUtil.computeLength(Utilities.getLatLngPoints(trackPoints.subList(lastIndexShown, index)));
            long timeBetween = Utilities.getDiffTimeInSeconds(lastRecord.getTime(), bRecord.getTime());
            int averageSpeed = Utilities.calculateAverageSpeed(distanceBetween, timeBetween);

            speedEntries.add(new Entry(index, averageSpeed));
            lastRecord = bRecord;
            lastIndexShown = index;
        }
    }

    //Hack to always graph at altitude and speed where the glider has landed after the graph is simplified
    altitudeEntries.add(new Entry(index + 1, ((BRecord) igcFile.getTrackPoints().get(igcFile.getTrackPoints().size() - 1)).getAltitude()));
    speedEntries.add(new Entry(index + 1, 0));

    setupGraphic(altitudeLineChart, altitudeEntries, igcFile.getMinAltitude(), new AltitudeGrphicFormatter());
    setupGraphic(speedLineChart, speedEntries, 0, new SpeedGrphicFormatter());
}
 
开发者ID:santiago-hollmann,项目名称:igcparser,代码行数:38,代码来源:FlightInformationActivity.java

示例3: calculateTaskDistance

import com.google.maps.android.SphericalUtil; //导入方法依赖的package包/类
public static double calculateTaskDistance(List<ILatLonRecord> waypoints) {
    ArrayList<ILatLonRecord> listCRecord = new ArrayList<>();
    for (ILatLonRecord waypoint : waypoints) {
        CRecordWayPoint cRecord = (CRecordWayPoint) waypoint;
        if (cRecord.getType() != CRecordType.LANDING && cRecord.getType() != CRecordType.TAKEOFF) {
            listCRecord.add(cRecord);
        }
    }
    return SphericalUtil.computeLength(Utilities.getLatLngPoints(listCRecord));
}
 
开发者ID:santiago-hollmann,项目名称:igcparser,代码行数:11,代码来源:WaypointUtilities.java

示例4: getTaskTraveledDistance

import com.google.maps.android.SphericalUtil; //导入方法依赖的package包/类
public static double getTaskTraveledDistance(IGCFile igcFile, HashMap<String, Integer> mapAreaReached) {
    ArrayList<ILatLonRecord> list = new ArrayList<>();
    if (!igcFile.isTaskCompleted()) {
        return igcFile.getDistance();
    }

    ArrayList<Integer> listReachedAreas = getListReachedAreas(mapAreaReached);
    for (int i = 0; i < listReachedAreas.size(); i++) {
        list.add(igcFile.getTrackPoints().get(listReachedAreas.get(i)));
    }
    return SphericalUtil.computeLength(Utilities.getLatLngPoints(list));
}
 
开发者ID:santiago-hollmann,项目名称:igcparser,代码行数:13,代码来源:WaypointUtilities.java

示例5: computeDrawingLength

import com.google.maps.android.SphericalUtil; //导入方法依赖的package包/类
/**
 * Compute the length of the drawing in meters.
 *
 * @return the length of the drawing in meters.
 */
private double computeDrawingLength() {
    double length = 0d;
    for (String encodedPath : mEncodedPolylines) {
        final List<LatLng> path = PolyUtil.decode(encodedPath);
        length += SphericalUtil.computeLength(path);
    }
    return length;
}
 
开发者ID:tvbarthel,项目名称:SayItFromTheSky,代码行数:14,代码来源:Drawing.java

示例6: getLength

import com.google.maps.android.SphericalUtil; //导入方法依赖的package包/类
public double getLength() {
    return SphericalUtil.computeLength(Arrays.asList(points));
}
 
开发者ID:bkhezry,项目名称:ExtraMapUtils,代码行数:4,代码来源:ExtraPolyline.java


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