我按照这里的示例:How to set screen zoom by geopoints?
但我的问题是我的路线在mapview中非常小。它应该在边界附近结束。
以下代码的外观如下:
private void centerMap(ArrayList<GeoPoint> waypoints) {
GeoPoint[] geoPoints = new GeoPoint[waypoints.size()];
for(int i = 0; i<waypoints.size(); i++) {
geoPoints[i] = waypoints.get(i);
}
int minLat = Integer.MAX_VALUE;
int maxLat = Integer.MIN_VALUE;
int minLon = Integer.MAX_VALUE;
int maxLon = Integer.MIN_VALUE;
//for (Point point : twoPoints) {
for(GeoPoint point: geoPoints){
int lat = (int) (point.getLatitude() * 1E6);
int lon = (int) (point.getLongitude() * 1E6);
maxLat = Math.max(lat, maxLat);
minLat = Math.min(lat, minLat);
maxLon = Math.max(lon, maxLon);
minLon = Math.min(lon, minLon);
}
mapView.getController().zoomToSpan(Math.abs(maxLat - minLat), Math.abs(maxLon - minLon));
mapView.getController().setCenter(new GeoPoint((maxLat + minLat) / 2, (maxLon + minLon) / 2));
}
答案 0 :(得分:0)
<table>
<thead>
<tr>
<th>Loan Type</th>
<th>Amount Borrowed</th>
<th>Current Payment</th>
<th>Current Term</th>
<th>Total Cost of Loan</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<script>
var myObject = {balance: 10000, monthlyPayment: 98.41810662028588, total: 11810.172794434306};
$('tbody tr').find('td:nth-child(specfic_tr_number)').html(myObject.balance);
</script>
请注意,在osmdroid中,lat / lon值现在默认为double。