当前位置: 首页>>代码示例>>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;未经允许,请勿转载。