本文整理汇总了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;
}
示例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());
}
示例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));
}
示例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));
}
示例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;
}
示例6: getLength
import com.google.maps.android.SphericalUtil; //导入方法依赖的package包/类
public double getLength() {
return SphericalUtil.computeLength(Arrays.asList(points));
}