本文整理汇总了Java中com.playuav.android.utils.unit.UnitManager类的典型用法代码示例。如果您正苦于以下问题:Java UnitManager类的具体用法?Java UnitManager怎么用?Java UnitManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UnitManager类属于com.playuav.android.utils.unit包,在下文中一共展示了UnitManager类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateItemView
import com.playuav.android.utils.unit.UnitManager; //导入依赖的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);
}
}
示例2: updateHome
import com.playuav.android.utils.unit.UnitManager; //导入依赖的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));
}
示例3: updateTextViews
import com.playuav.android.utils.unit.UnitManager; //导入依赖的package包/类
private void updateTextViews() {
boolean setDefault = true;
List<Survey> surveyList = getMissionItems();
if (!surveyList.isEmpty()) {
Survey survey = surveyList.get(0);
SurveyDetail surveyDetail = survey.getSurveyDetail();
try {
UnitProvider unitProvider = UnitManager.getUnitProvider();
footprintTextView.setText(String.format("%s: %s x %s",
getString(R.string.footprint),
unitProvider.distanceToString(surveyDetail.getLateralFootPrint()),
unitProvider.distanceToString(surveyDetail
.getLongitudinalFootPrint())));
groundResolutionTextView.setText(String.format("%s: %s /px",
getString(R.string.ground_resolution),
unitProvider.areaToString(surveyDetail.getGroundResolution())));
distanceTextView.setText(String.format("%s: %s",
getString(R.string.distance_between_pictures),
unitProvider.distanceToString(surveyDetail
.getLongitudinalPictureDistance())));
distanceBetweenLinesTextView.setText(String.format("%s: %s",
getString(R.string.distance_between_lines),
unitProvider.distanceToString(surveyDetail
.getLateralPictureDistance())));
areaTextView.setText(String.format("%s: %s", getString(R.string.area),
unitProvider.areaToString(survey.getPolygonArea())));
lengthView.setText(String.format("%s: %s", getString(R.string.mission_length),
unitProvider.distanceToString(survey.getGridLength())));
numberOfPicturesView.setText(String.format("%s: %d", getString(R.string.pictures),
survey.getCameraCount()));
numberOfStripsView.setText(String.format("%s: %d", getString(R.string.number_of_strips),
survey.getNumberOfLines()));
setDefault = false;
} catch (Exception e) {
setDefault = true;
}
}
if (setDefault) {
footprintTextView.setText(getString(R.string.footprint) + ": ???");
groundResolutionTextView.setText(getString(R.string.ground_resolution) + ": ???");
distanceTextView.setText(getString(R.string.distance_between_pictures) + ": ???");
distanceBetweenLinesTextView.setText(getString(R.string.distance_between_lines)
+ ": ???");
areaTextView.setText(getString(R.string.area) + ": ???");
lengthView.setText(getString(R.string.mission_length) + ": ???");
numberOfPicturesView.setText(getString(R.string.pictures) + "???");
numberOfStripsView.setText(getString(R.string.number_of_strips) + "???");
}
}