• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MathUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.o3dr.services.android.lib.util.MathUtils的典型用法代码示例。如果您正苦于以下问题:Java MathUtils类的具体用法?Java MathUtils怎么用?Java MathUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MathUtils类属于com.o3dr.services.android.lib.util包,在下文中一共展示了MathUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getRemainingMissionLength

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
private double getRemainingMissionLength(){
    Gps gps = drone.getAttribute(AttributeType.GPS);
    if(mission == null || mission.getMissionItems().size() == 0 || gps == null || !gps.isValid())
        return -1;
    LatLong dronePos = gps.getPosition();
    List<MissionItem> missionItems = mission.getMissionItems();
    List<LatLong> path = new ArrayList<LatLong>();
    path.add(dronePos);
    for(int i = Math.max(nextWaypoint - 1, 0); i < missionItems.size(); i++){
        MissionItem item = missionItems.get(i);
        if(item instanceof MissionItem.SpatialItem){
            MissionItem.SpatialItem spatialItem = (MissionItem.SpatialItem)item;
            LatLongAlt coordinate = spatialItem.getCoordinate();
            path.add(new LatLong(coordinate.getLatitude(), coordinate.getLongitude()));
        }

    }
    return MathUtils.getPolylineLength(path);
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:20,代码来源:ModeAutoFragment.java


示例2: getDistanceFromLastWaypoint

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
public double getDistanceFromLastWaypoint(MissionItemProxy waypointRender) {
    if (missionItemProxies.size() < 2)
        return 0;

    MissionItem waypoint = waypointRender.getMissionItem();
    if (!(waypoint instanceof MissionItem.SpatialItem))
        return 0;

    int index = missionItemProxies.indexOf(waypointRender);
    if (index == -1 || index == 0)
        return 0;

    MissionItem previous = missionItemProxies.get(index - 1).getMissionItem();
    if (previous instanceof MissionItem.SpatialItem) {
        return MathUtils.getDistance3D(((MissionItem.SpatialItem) waypoint).getCoordinate(),
                ((MissionItem.SpatialItem) previous).getCoordinate());
    }

    return 0;
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:21,代码来源:MissionProxy.java


示例3: getDistanceFromLastWaypoint

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
public double getDistanceFromLastWaypoint(MissionItemProxy waypointRender) {
       if(missionItemProxies.size() < 2)
           return 0;

	MissionItem waypoint = waypointRender.getMissionItem();
	if (!(waypoint instanceof MissionItem.SpatialItem))
		return 0;

       final int index = missionItemProxies.indexOf(waypointRender);
       if(index == -1 || index == 0)
           return 0;

       MissionItem previous = missionItemProxies.get(index - 1).getMissionItem();
       if(previous instanceof MissionItem.SpatialItem){
           return MathUtils.getDistance(((MissionItem.SpatialItem) waypoint).getCoordinate(),
                   ((MissionItem.SpatialItem) previous).getCoordinate());
       }

	return 0;
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:21,代码来源:MissionProxy.java


示例4: updateItemView

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
@Override
public void updateItemView(final Context context, final Drone drone) {
	if (mItemView != null) {
		String update = "--";
              if(drone != null && drone.isConnected()) {
                  final Gps droneGps = drone.getGps();
                  final Home droneHome = drone.getHome();
                  if(droneGps.isValid() && droneHome.isValid()) {
                      double distanceToHome = MathUtils.getDistance(droneHome.getCoordinate(),
                              droneGps.getPosition());
                      update = String.format("Home\n%s", UnitManager.getUnitProvider()
                              .distanceToString(distanceToHome));
                  }
              }
		((TextView) mItemView).setText(update);
	}
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:18,代码来源:InfoBarItem.java


示例5: updateHomeTelem

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
private void updateHomeTelem() {
    final Context context = getActivity().getApplicationContext();
    final Drone drone = getDrone();

    String update = getString(R.string.empty_content);
    if (drone.isConnected()) {
        final Gps droneGps = drone.getAttribute(AttributeType.GPS);
        final Home droneHome = drone.getAttribute(AttributeType.HOME);
        if (droneGps.isValid() && droneHome.isValid()) {
            LengthUnit distanceToHome = getLengthUnitProvider().boxBaseValueToTarget
                    (MathUtils.getDistance(droneHome.getCoordinate(), droneGps.getPosition()));
            update = String.format("%s", distanceToHome);
        }
    }

    homeTelem.setText(update);
}
 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:18,代码来源:ActionBarTelemFragment.java


示例6: getDistanceFromLastWaypoint

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
public double getDistanceFromLastWaypoint(MissionItemProxy waypointRender) {
    if (missionItemProxies.size() < 2)
        return 0;

    MissionItem waypoint = waypointRender.getMissionItem();
    if (!(waypoint instanceof MissionItem.SpatialItem))
        return 0;

    final int index = missionItemProxies.indexOf(waypointRender);
    if (index == -1 || index == 0)
        return 0;

    MissionItem previous = missionItemProxies.get(index - 1).getMissionItem();
    if (previous instanceof MissionItem.SpatialItem) {
        return MathUtils.getDistance(((MissionItem.SpatialItem) waypoint).getCoordinate(),
                ((MissionItem.SpatialItem) previous).getCoordinate());
    }

    return 0;
}
 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:21,代码来源:MissionProxy.java


示例7: updateRadio

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
private void updateRadio(Drone drone) {
    if (mInboxBuilder == null)
        return;

    Signal droneSignal = drone.getAttribute(AttributeType.SIGNAL);
    String update = droneSignal == null ? "--" : String.format("%d%%", MathUtils.getSignalStrength(droneSignal
            .getFadeMargin(), droneSignal.getRemFadeMargin()));
    mInboxBuilder.setLine(4, SpannableUtils.normal("Signal:   ", SpannableUtils.bold(update)));
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:10,代码来源:StatusBarNotificationProvider.java


示例8: updateHome

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
private void updateHome(Drone drone) {
    if (mInboxBuilder == null)
        return;

    String update = "--";
    final Gps droneGps = this.drone.getAttribute(AttributeType.GPS);
    final Home droneHome = this.drone.getAttribute(AttributeType.HOME);
    if (droneGps != null && droneGps.isValid() && droneHome != null && droneHome.isValid()) {
        LengthUnit distanceToHome = UnitManager.getUnitSystem(mContext).getLengthUnitProvider()
                .boxBaseValueToTarget(MathUtils.getDistance2D(droneHome.getCoordinate(), droneGps.getPosition()));
        update = String.format("Home\n%s", distanceToHome);
    }
    mInboxBuilder.setLine(0, SpannableUtils.normal("Home:   ", update));
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:15,代码来源:StatusBarNotificationProvider.java


示例9: onGestureEnded

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
@Override
public void onGestureEnded(GestureOverlayView arg0, MotionEvent arg1) {
	overlay.setEnabled(false);
	List<LatLong> path = decodeGesture();
	if (path.size() > 1) {
		path = MathUtils.simplify(path, toleranceInPixels);
	}
	listener.onPathFinished(path);
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:10,代码来源:GestureMapFragment.java


示例10: getTotalMissionLength

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
private double getTotalMissionLength(){
    List<MissionItem> missionItems = mission.getMissionItems();
    List<LatLong> path = new ArrayList<LatLong>();
    for(int i = 0; i < missionItems.size(); i++){
        MissionItem item = missionItems.get(i);
        if(item instanceof MissionItem.SpatialItem){
            MissionItem.SpatialItem spatialItem = (MissionItem.SpatialItem)item;
            LatLongAlt coordinate = spatialItem.getCoordinate();
            path.add(new LatLong(coordinate.getLatitude(), coordinate.getLongitude()));
        }

    }
    return MathUtils.getPolylineLength(path);
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:15,代码来源:ModeAutoFragment.java


示例11: updateHomeTelem

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
private void updateHomeTelem() {
    final Drone drone = getDrone();

    String update = getString(R.string.empty_content);
    int drawableResId = appPrefs.isReturnToMeEnabled()
            ? R.drawable.ic_person_grey_700_18dp
            : R.drawable.ic_home_grey_700_18dp;

    if (drone.isConnected()) {
        final Gps droneGps = drone.getAttribute(AttributeType.GPS);
        final Home droneHome = drone.getAttribute(AttributeType.HOME);
        if (droneGps.isValid() && droneHome.isValid()) {
            LengthUnit distanceToHome = getLengthUnitProvider().boxBaseValueToTarget
                    (MathUtils.getDistance2D(droneHome.getCoordinate(), droneGps.getPosition()));
            update = String.format("%s", distanceToHome);

            final ReturnToMeState returnToMe = drone.getAttribute(AttributeType.RETURN_TO_ME_STATE);
            switch (returnToMe.getState()) {

                case ReturnToMeState.STATE_UPDATING_HOME:
                    //Change the home telemetry icon
                    drawableResId = R.drawable.ic_person_blue_a400_18dp;
                    break;

                case ReturnToMeState.STATE_USER_LOCATION_INACCURATE:
                case ReturnToMeState.STATE_USER_LOCATION_UNAVAILABLE:
                case ReturnToMeState.STATE_WAITING_FOR_VEHICLE_GPS:
                case ReturnToMeState.STATE_ERROR_UPDATING_HOME:
                    drawableResId = R.drawable.ic_person_red_500_18dp;
                    update = getString(R.string.empty_content);
                    break;
            }
        }
    }

    homeTelem.setCompoundDrawablesWithIntrinsicBounds(drawableResId, 0, 0, 0);
    homeTelem.setText(update);
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:39,代码来源:ActionBarTelemFragment.java


示例12: updateHomeDistance

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
private void updateHomeDistance(){
    if(distanceView == null && distanceLabelView == null)
        return;

    boolean hideDistanceInfo = true;

    Drone drone = getDrone();
    Home home = drone == null ? null : drone.<Home>getAttribute(AttributeType.HOME);

    if(home != null && home.isValid() && mSelectedProxies.size() == 1) {
        MissionItemProxy itemProxy = mSelectedProxies.get(0);
        MissionItem item = itemProxy.getMissionItem();
        if(item instanceof MissionItem.SpatialItem) {
            LatLongAlt itemCoordinate = ((MissionItem.SpatialItem)item).getCoordinate();
            LatLongAlt homeCoordinate = home.getCoordinate();
            double homeDistance = MathUtils.getDistance3D(homeCoordinate, itemCoordinate);
            if(homeDistance > 0) {
                hideDistanceInfo = false;

                if (distanceView != null) {
                    distanceView.setText(getLengthUnitProvider().boxBaseValueToTarget(homeDistance).toString());
                    distanceView.setVisibility(View.VISIBLE);

                    if (distanceLabelView != null) {
                        distanceLabelView.setVisibility(View.VISIBLE);
                    }
                }
            }
        }
    }

    if(hideDistanceInfo){
        if(distanceView != null)
            distanceView.setVisibility(View.GONE);

        if(distanceLabelView != null){
            distanceLabelView.setVisibility(View.GONE);
        }
    }
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:41,代码来源:MissionDetailFragment.java


示例13: updateRadio

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
private void updateRadio(Drone drone) {
	if (mInboxBuilder == null)
		return;

       Signal droneSignal = drone.getSignal();
       String update = droneSignal == null ? "--" : String.format("%d%%", MathUtils.getSignalStrength(droneSignal
               .getFadeMargin(), droneSignal.getRemFadeMargin()));
	mInboxBuilder.setLine(4, SpannableUtils.normal("Signal:   ", SpannableUtils.bold(update)));
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:10,代码来源:StatusBarNotificationProvider.java


示例14: updateHome

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
private void updateHome(Drone drone) {
	if (mInboxBuilder == null)
		return;

       String update = "--";
           final Gps droneGps = this.drone.getGps();
           final Home droneHome = this.drone.getHome();
           if(droneGps != null && droneGps.isValid() && droneHome != null && droneHome.isValid()) {
               double distanceToHome = MathUtils.getDistance(droneHome.getCoordinate(),
                       droneGps.getPosition());
               update = String.format("Home\n%s", UnitManager.getUnitProvider().distanceToString
                       (distanceToHome));
           }
	mInboxBuilder.setLine(0, SpannableUtils.normal("Home:   ", update));
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:16,代码来源:StatusBarNotificationProvider.java


示例15: onGestureEnded

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
@Override
public void onGestureEnded(GestureOverlayView arg0, MotionEvent arg1) {
	view.setEnabled(false);
	List<LatLong> path = decodeGesture();
	if (path.size() > 1) {
		path = MathUtils.simplify(path, toleranceInPixels);
	}
	listener.onPathFinished(path);
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:10,代码来源:PathGesture.java


示例16: updateInfo

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
private void updateInfo() {
    if(selectedMsg != null) {
        statusView.setVisibility(View.VISIBLE);

        // coords
        final LatLong msgCoord = coordFromMsgGlobalPositionInt(selectedMsg);

        // distance
        if(lastGCSPosition == null || lastGCSPosition.getLatitude() == 0 || lastGCSPosition
                .getLongitude() == 0) {
            // unknown
            distanceView.setText(R.string.status_waiting_for_gps, TextView.BufferType.NORMAL);
            azimuthView.setText("");
        } else {
            String distance = String.format("Distance: %.01fm",
                    MathUtils.getDistance(lastGCSPosition, msgCoord));
            if(lastGCSBearingTo != Float.MAX_VALUE) {
                final String bearing = String.format(" @ %.0f°", lastGCSBearingTo);
                distance += bearing;
            }
            distanceView.setText(distance);

            if(lastGCSAzimuth != Double.MAX_VALUE) {
                final String azimuth = String.format("Heading: %.0f°", lastGCSAzimuth);
                azimuthView.setText(azimuth);
            }
        }

        latView.setText(String.format("Latitude: %f°", msgCoord.getLatitude()));
        lonView.setText(String.format("Longitude: %f°", msgCoord.getLongitude()));
    } else {
        statusView.setVisibility(View.INVISIBLE);
        latView.setText("");
        lonView.setText("");
        distanceView.setText("");
        azimuthView.setText("");
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:39,代码来源:LocatorActivity.java


示例17: getMissionLength

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
public double getMissionLength() {
	List<LatLong> points = getPathPoints();
       double length = 0;
	if (points.size()>1) {
		for (int i = 1; i < points.size(); i++) {
			length += MathUtils.getDistance(points.get(i-1), points.get(i));
		}
	}

       return length;
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:12,代码来源:MissionProxy.java


示例18: setValuesFromRadio

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
private void setValuesFromRadio(final Drone drone) {
          Signal droneSignal = drone.getSignal();
	((TextView) mItemView).setText(String.format(Locale.ENGLISH, "%d%%",
                  MathUtils.getSignalStrength(droneSignal.getFadeMargin(),
                          droneSignal.getRemFadeMargin())));

	mRssiView.setText(String.format("RSSI %2.0f dB", droneSignal.getRssi()));
	mRemRssiView.setText(String.format("RemRSSI %2.0f dB", droneSignal.getRemrssi()));
	mNoiseView.setText(String.format("Noise %2.0f dB", droneSignal.getNoise()));
	mRemNoiseView.setText(String.format("RemNoise %2.0f dB", droneSignal.getRemnoise()));
	mFadeView.setText(String.format("Fade %2.0f dB", droneSignal.getFadeMargin()));
	mRemFadeView.setText(String.format("RemFade %2.0f dB", droneSignal.getRemFadeMargin()));
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:14,代码来源:InfoBarItem.java


示例19: updateRadio

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
private void updateRadio(Drone drone) {
	if (mInboxBuilder == null)
		return;

       Signal droneSignal = drone.getAttribute(AttributeType.SIGNAL);
       String update = droneSignal == null ? "--" : String.format("%d%%", MathUtils.getSignalStrength(droneSignal
               .getFadeMargin(), droneSignal.getRemFadeMargin()));
	mInboxBuilder.setLine(4, SpannableUtils.normal("Signal:   ", SpannableUtils.bold(update)));
}
 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:10,代码来源:StatusBarNotificationProvider.java


示例20: updateHome

import com.o3dr.services.android.lib.util.MathUtils; //导入依赖的package包/类
private void updateHome(Drone drone) {
	if (mInboxBuilder == null)
		return;

       String update = "--";
           final Gps droneGps = this.drone.getAttribute(AttributeType.GPS);
           final Home droneHome = this.drone.getAttribute(AttributeType.HOME);
           if(droneGps != null && droneGps.isValid() && droneHome != null && droneHome.isValid()) {
               LengthUnit distanceToHome = UnitManager.getUnitSystem(mContext).getLengthUnitProvider()
                       .boxBaseValueToTarget(MathUtils.getDistance(droneHome.getCoordinate(), droneGps.getPosition()));
               update = String.format("Home\n%s", distanceToHome);
           }
	mInboxBuilder.setLine(0, SpannableUtils.normal("Home:   ", update));
}
 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:15,代码来源:StatusBarNotificationProvider.java



注:本文中的com.o3dr.services.android.lib.util.MathUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Permission类代码示例发布时间:2022-05-22
下一篇:
Java WriteOutContentHandler类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap