本文整理汇总了Java中com.androzic.util.Geo.distance方法的典型用法代码示例。如果您正苦于以下问题:Java Geo.distance方法的具体用法?Java Geo.distance怎么用?Java Geo.distance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.androzic.util.Geo
的用法示例。
在下文中一共展示了Geo.distance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: navRouteWaypointETE
import com.androzic.util.Geo; //导入方法依赖的package包/类
public int navRouteWaypointETE(int index)
{
if (index == 0)
return 0;
int ete = Integer.MAX_VALUE;
if (avvmg > 0)
{
int i = navDirection == DIRECTION_FORWARD ? index : navRoute.length() - index - 1;
int j = i - navDirection;
MapObject w1 = navRoute.getWaypoint(i);
MapObject w2 = navRoute.getWaypoint(j);
double distance = Geo.distance(w1.latitude, w1.longitude, w2.latitude, w2.longitude);
ete = (int) Math.round(distance / avvmg / 60);
}
return ete;
}
示例2: addPoint
import com.androzic.util.Geo; //导入方法依赖的package包/类
public void addPoint(boolean continous, double lat, double lon, double elev, double speed, double bearing, double accuracy, long time)
{
if (lastTrackPoint != null)
{
distance += Geo.distance(lastTrackPoint.latitude, lastTrackPoint.longitude, lat, lon);
}
lastTrackPoint = new TrackPoint(continous, lat, lon, elev, speed, bearing, accuracy, time);
boolean needNewSegment = false;
synchronized (lastSegment)
{
needNewSegment = !continous || lastSegment.trackpoints.size() > SEGMENT_CAPACITY;
}
if (needNewSegment)
{
synchronized (this)
{
lastSegment = new TrackSegment();
lastSegment.independent = !continous;
segments.add(lastSegment);
}
}
synchronized (lastSegment)
{
if (maxPoints > 0 && lastSegment.trackpoints.size() > maxPoints)
{
// TODO add correct cleaning if preferences changed
TrackPoint fp = lastSegment.trackpoints.get(0);
TrackPoint sp = lastSegment.trackpoints.get(1);
distance -= Geo.distance(fp.latitude, fp.longitude, sp.latitude, sp.longitude);
lastSegment.trackpoints.remove(0);
}
lastSegment.trackpoints.add(lastTrackPoint);
}
lastSegment.bounds.extend(lastTrackPoint.latitude, lastTrackPoint.longitude);
}
示例3: addWaypoint
import com.androzic.util.Geo; //导入方法依赖的package包/类
public void addWaypoint(Waypoint waypoint)
{
if (lastWaypoint != null)
{
distance += Geo.distance(lastWaypoint.latitude, lastWaypoint.longitude, waypoint.latitude, waypoint.longitude);
}
lastWaypoint = waypoint;
waypoints.add(lastWaypoint);
}
示例4: insertWaypoint
import com.androzic.util.Geo; //导入方法依赖的package包/类
public void insertWaypoint(Waypoint waypoint)
{
if (waypoints.size() < 2)
{
addWaypoint(waypoint);
return;
}
int after = waypoints.size() - 1;
double xtk = Double.MAX_VALUE;
synchronized (waypoints)
{
for (int i = 0; i < waypoints.size()-1; i++)
{
double distance = Geo.distance(waypoint.latitude, waypoint.longitude, waypoints.get(i+1).latitude, waypoints.get(i+1).longitude);
double bearing1 = Geo.bearing(waypoint.latitude, waypoint.longitude, waypoints.get(i+1).latitude, waypoints.get(i+1).longitude);
double dtk1 = Geo.bearing(waypoints.get(i).latitude, waypoints.get(i).longitude, waypoints.get(i+1).latitude, waypoints.get(i+1).longitude);
double cxtk1 = Math.abs(Geo.xtk(distance, dtk1, bearing1));
double bearing2 = Geo.bearing(waypoint.latitude, waypoint.longitude, waypoints.get(i).latitude, waypoints.get(i).longitude);
double dtk2 = Geo.bearing(waypoints.get(i+1).latitude, waypoints.get(i+1).longitude, waypoints.get(i).latitude, waypoints.get(i).longitude);
double cxtk2 = Math.abs(Geo.xtk(distance, dtk2, bearing2));
if (cxtk2 != Double.POSITIVE_INFINITY && cxtk1 < xtk)
{
xtk = cxtk1;
after = i;
}
}
}
waypoints.add(after+1, waypoint);
lastWaypoint = waypoints.get(waypoints.size()-1);
distance = distanceBetween(0, waypoints.size()-1);
}
示例5: distanceBetween
import com.androzic.util.Geo; //导入方法依赖的package包/类
public double distanceBetween(int first, int last)
{
double dist = 0.0;
synchronized (waypoints)
{
for (int i = first; i < last; i++)
{
dist += Geo.distance(waypoints.get(i).latitude, waypoints.get(i).longitude, waypoints.get(i+1).latitude, waypoints.get(i+1).longitude);
}
}
return dist;
}
示例6: bindView
import com.androzic.util.Geo; //导入方法依赖的package包/类
@Override
public void bindView(View view, Context context, Cursor cursor)
{
Log.w(TAG, ">>>> bindView");
Tracker tracker = dataAccess.getFullInfoTracker(cursor);
TextView t = (TextView) view.findViewById(R.id.name);
t.setText(tracker.name);
Application application = Application.getApplication();
Bitmap b = application.getMarker(tracker.marker);
if (b != null)
{
Drawable drawable = new BitmapDrawable(getResources(), b);
drawable.setBounds(0, 0, b.getWidth(), b.getHeight());
t.setCompoundDrawables(drawable, null, null, null);
t.setCompoundDrawablePadding(b.getWidth() / 3);
}
else
{
t.setCompoundDrawables(null, null, null, null);
}
t = (TextView) view.findViewById(R.id.sender);
t.setText(tracker.sender);
t = (TextView) view.findViewById(R.id.imei);
t.setText(tracker.imei);
String coordinates = StringFormatter.coordinates(coordinatesFormat, " ", tracker.latitude, tracker.longitude);
t = (TextView) view.findViewById(R.id.coordinates);
t.setText(coordinates);
String speed = String.valueOf(Math.round(tracker.speed * speedFactor)) + " " + speedAbbr;
t = (TextView) view.findViewById(R.id.speed);
t.setText(speed);
String distance = "";
synchronized (currentLocation)
{
if (!"fake".equals(currentLocation.getProvider()))
{
double dist = Geo.distance(tracker.latitude, tracker.longitude, currentLocation.getLatitude(), currentLocation.getLongitude());
double bearing = Geo.bearing(currentLocation.getLatitude(), currentLocation.getLongitude(), tracker.latitude, tracker.longitude);
distance = StringFormatter.distanceH(dist) + " " + StringFormatter.bearingSimpleH(bearing);
}
}
t = (TextView) view.findViewById(R.id.distance);
t.setText(distance);
String battery = "";
if (tracker.battery == Integer.MAX_VALUE)
battery = getString(R.string.full);
if (tracker.battery == Integer.MIN_VALUE)
battery = getString(R.string.low);
if (tracker.battery >= 0 && tracker.battery <= 100)
battery = String.valueOf(tracker.battery) + "%";
t = (TextView) view.findViewById(R.id.battery);
if (! "".equals(battery))
t.setText(String.format("%s: %s", getString(R.string.battery), battery));
else
t.setText("");
String signal = "";
if (tracker.signal == Integer.MAX_VALUE)
signal = getString(R.string.full);
if (tracker.signal == Integer.MIN_VALUE)
signal = getString(R.string.low);
if (tracker.signal >= 0 && tracker.signal <= 100)
signal = String.valueOf(tracker.signal) + "%";
t = (TextView) view.findViewById(R.id.signal);
if (! "".equals(signal))
t.setText(String.format("%s: %s", getString(R.string.signal), signal));
else
t.setText("");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(tracker.time);
Date date = calendar.getTime();
String modified = DateFormat.getDateFormat(TrackerList.this).format(date) + " " + DateFormat.getTimeFormat(TrackerList.this).format(date);
t = (TextView) view.findViewById(R.id.modified);
t.setText(modified);
}