當前位置: 首頁>>代碼示例>>Java>>正文


Java Geo.bearing方法代碼示例

本文整理匯總了Java中com.androzic.util.Geo.bearing方法的典型用法代碼示例。如果您正苦於以下問題:Java Geo.bearing方法的具體用法?Java Geo.bearing怎麽用?Java Geo.bearing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.androzic.util.Geo的用法示例。


在下文中一共展示了Geo.bearing方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: navigateTo

import com.androzic.util.Geo; //導入方法依賴的package包/類
private void navigateTo(final Route route, final int direction)
{
	clearNavigation();
	connect();
	startForeground(NOTIFICATION_ID, getNotification());

	vmgav = new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

	navRoute = route;
	navDirection = direction;
	navCurrentRoutePoint = navDirection == 1 ? 1 : navRoute.length()-2;

	navWaypoint = navRoute.getWaypoint(navCurrentRoutePoint);
	prevWaypoint = navRoute.getWaypoint(navCurrentRoutePoint - navDirection);
	navProximity = navWaypoint.proximity > 0 ? navWaypoint.proximity : routeProximity;
	navRouteDistance = -1;
	navCourse = Geo.bearing(prevWaypoint.latitude, prevWaypoint.longitude, navWaypoint.latitude, navWaypoint.longitude);
	updateNavigationState(STATE_STARTED);
	if (lastKnownLocation != null)
		calculateNavigationStatus(lastKnownLocation, 0, 0);
}
 
開發者ID:andreynovikov,項目名稱:Androzic,代碼行數:22,代碼來源:NavigationService.java

示例2: 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);
}
 
開發者ID:andreynovikov,項目名稱:androzic-library,代碼行數:33,代碼來源:Route.java

示例3: course

import com.androzic.util.Geo; //導入方法依賴的package包/類
public double course(int prev, int next)
{
	synchronized (waypoints)
	{
		return Geo.bearing(waypoints.get(prev).latitude, waypoints.get(prev).longitude, waypoints.get(next).latitude, waypoints.get(next).longitude);
	}
}
 
開發者ID:andreynovikov,項目名稱:androzic-library,代碼行數:8,代碼來源:Route.java

示例4: setRouteWaypoint

import com.androzic.util.Geo; //導入方法依賴的package包/類
public void setRouteWaypoint(int waypoint)
{
	navCurrentRoutePoint = waypoint;
	navWaypoint = navRoute.getWaypoint(navCurrentRoutePoint);
	int prev = navCurrentRoutePoint - navDirection;
	if (prev >= 0 && prev < navRoute.length())
		prevWaypoint = navRoute.getWaypoint(prev);
	else
		prevWaypoint = null;
	navProximity = navWaypoint.proximity > 0 ? navWaypoint.proximity : routeProximity;
	navRouteDistance = -1;
	navCourse = prevWaypoint == null ? 0.0 : Geo.bearing(prevWaypoint.latitude, prevWaypoint.longitude, navWaypoint.latitude, navWaypoint.longitude);
	updateNavigationState(STATE_NEXTWPT);
}
 
開發者ID:andreynovikov,項目名稱:Androzic,代碼行數:15,代碼來源:NavigationService.java

示例5: nextRouteWaypoint

import com.androzic.util.Geo; //導入方法依賴的package包/類
public void nextRouteWaypoint() throws IndexOutOfBoundsException
{
	navCurrentRoutePoint += navDirection;
	navWaypoint = navRoute.getWaypoint(navCurrentRoutePoint);
	prevWaypoint = navRoute.getWaypoint(navCurrentRoutePoint - navDirection);
	navProximity = navWaypoint.proximity > 0 ? navWaypoint.proximity : routeProximity;
	navRouteDistance = -1;
	navCourse = Geo.bearing(prevWaypoint.latitude, prevWaypoint.longitude, navWaypoint.latitude, navWaypoint.longitude);
	updateNavigationState(STATE_NEXTWPT);
}
 
開發者ID:andreynovikov,項目名稱:Androzic,代碼行數:11,代碼來源:NavigationService.java

示例6: prevRouteWaypoint

import com.androzic.util.Geo; //導入方法依賴的package包/類
public void prevRouteWaypoint() throws IndexOutOfBoundsException
{
	navCurrentRoutePoint -= navDirection;
	navWaypoint = navRoute.getWaypoint(navCurrentRoutePoint);
	int prev = navCurrentRoutePoint - navDirection;
	if (prev >= 0 && prev < navRoute.length())
		prevWaypoint = navRoute.getWaypoint(prev);
	else
		prevWaypoint = null;
	navProximity = navWaypoint.proximity > 0 ? navWaypoint.proximity : routeProximity;
	navRouteDistance = -1;
	navCourse = prevWaypoint == null ? 0.0 : Geo.bearing(prevWaypoint.latitude, prevWaypoint.longitude, navWaypoint.latitude, navWaypoint.longitude);
	updateNavigationState(STATE_NEXTWPT);
}
 
開發者ID:andreynovikov,項目名稱:Androzic,代碼行數:15,代碼來源:NavigationService.java

示例7: onPrepareBuffer

import com.androzic.util.Geo; //導入方法依賴的package包/類
@Override
public void onPrepareBuffer(final Viewport viewport, final Canvas c)
{
	if (ancor == null)
		return;
	
	final double[] loc = viewport.mapCenter;
	final int[] cxy = viewport.mapCenterXY;

       int sx = ancorXY[0] - cxy[0] + viewport.width / 2;
       int sy = ancorXY[1] - cxy[1] + viewport.height / 2;
       
       if (ancorXY[0] != cxy[0] || ancorXY[1] != cxy[1])
       {
        if (sx >= 0 && sy >= 0 && sx <= viewport.width && sy <= viewport.height)
        {
        	c.drawLine(0, 0, ancorXY[0]-cxy[0], ancorXY[1]-cxy[1], linePaint);
        	c.drawCircle(ancorXY[0]-cxy[0], ancorXY[1]-cxy[1], linePaint.getStrokeWidth(), circlePaint);
        }
        else
        {
        	double bearing = Geo.bearing(loc[0], loc[1], ancor[0], ancor[1]);
        	c.save();
        	c.rotate((float) bearing, 0, 0);
        	c.drawLine(0, 0, 0, - viewport.height / 2 - viewport.width / 2, linePaint);
        	c.restore();
        }
       }
}
 
開發者ID:andreynovikov,項目名稱:Androzic,代碼行數:30,代碼來源:DistanceOverlay.java

示例8: 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);
}
 
開發者ID:andreynovikov,項目名稱:androzic-plugin-tracker,代碼行數:75,代碼來源:TrackerList.java


注:本文中的com.androzic.util.Geo.bearing方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。