本文整理汇总了Java中org.beyene.sius.unit.length.LengthUnit类的典型用法代码示例。如果您正苦于以下问题:Java LengthUnit类的具体用法?Java LengthUnit怎么用?Java LengthUnit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LengthUnit类属于org.beyene.sius.unit.length包,在下文中一共展示了LengthUnit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateMissionLength
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的package包/类
private void updateMissionLength() {
if (missionProxy != null) {
Pair<Double, Double> distanceAndTime = missionProxy.getMissionFlightTime();
LengthUnit convertedMissionLength = unitSystem.getLengthUnitProvider()
.boxBaseValueToTarget(distanceAndTime.first);
double time = distanceAndTime.second;
String infoString = getString(R.string.editor_info_window_distance,
convertedMissionLength.toString()) +
", " +
getString(R.string.editor_info_window_flight_time, time == Double.POSITIVE_INFINITY
? time
: String.format(Locale.US, "%1$02d:%2$02d", ((int) time / 60), ((int) time % 60)));
infoView.setText(infoString);
// Remove detail window if item is removed
if (missionProxy.selection.getSelected().isEmpty() && itemDetailFragment != null) {
removeItemDetail();
}
}
}
示例2: onApiConnected
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的package包/类
@Override
public void onApiConnected() {
super.onApiConnected();
final View view = getView();
typeSpinner.setSelection(commandAdapter.getPosition(MissionItemType.REGION_OF_INTEREST));
final LengthUnitProvider lengthUP = getLengthUnitProvider();
final LengthWheelAdapter altitudeAdapter = new LengthWheelAdapter(getContext(), R.layout.wheel_text_centered,
lengthUP.boxBaseValueToTarget(MIN_ALTITUDE), lengthUP.boxBaseValueToTarget(MAX_ALTITUDE));
CardWheelHorizontalView<LengthUnit> altitudePicker = (CardWheelHorizontalView<LengthUnit>) view
.findViewById(R.id.altitudePicker);
altitudePicker.setViewAdapter(altitudeAdapter);
altitudePicker.addScrollListener(this);
altitudePicker.setCurrentValue(lengthUP.boxBaseValueToTarget(((RegionOfInterest) getMissionItems().get(0))
.getCoordinate().getAltitude()));
}
示例3: onApiConnected
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的package包/类
@Override
public void onApiConnected() {
super.onApiConnected();
final View view = getView();
final Context context = getContext();
typeSpinner.setSelection(commandAdapter.getPosition(MissionItemType.TAKEOFF));
final LengthUnitProvider lengthUP = getLengthUnitProvider();
final LengthWheelAdapter altitudeAdapter = new LengthWheelAdapter(context, R.layout.wheel_text_centered,
lengthUP.boxBaseValueToTarget(MIN_ALTITUDE), lengthUP.boxBaseValueToTarget(MAX_ALTITUDE));
CardWheelHorizontalView<LengthUnit> cardAltitudePicker = (CardWheelHorizontalView) view
.findViewById(R.id.altitudePicker);
cardAltitudePicker.setViewAdapter(altitudeAdapter);
cardAltitudePicker.addScrollListener(this);
final NumericWheelAdapter pitchAdapter = new NumericWheelAdapter(context, R.layout.wheel_text_centered, 0, 90, "%d°");
final CardWheelHorizontalView<Integer> pitchPicker = (CardWheelHorizontalView) view.findViewById(R.id.pitchPicker);
pitchPicker.setViewAdapter(pitchAdapter);
pitchPicker.addScrollListener(this);
Takeoff item = (Takeoff) getMissionItems().get(0);
cardAltitudePicker.setCurrentValue(lengthUP.boxBaseValueToTarget(item.getTakeoffAltitude()));
pitchPicker.setCurrentValue((int) item.getTakeoffPitch());
}
示例4: onApiConnected
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的package包/类
@Override
public void onApiConnected() {
super.onApiConnected();
final View view = getView();
typeSpinner.setSelection(commandAdapter.getPosition(MissionItemType.CAMERA_TRIGGER));
CameraTrigger item = (CameraTrigger) getMissionItems().get(0);
final LengthUnitProvider lengthUnitProvider = getLengthUnitProvider();
final LengthWheelAdapter adapter = new LengthWheelAdapter(getContext(), R.layout.wheel_text_centered,
lengthUnitProvider.boxBaseValueToTarget(Utils.MIN_DISTANCE),
lengthUnitProvider.boxBaseValueToTarget(Utils.MAX_DISTANCE));
final CardWheelHorizontalView<LengthUnit> cardAltitudePicker = (CardWheelHorizontalView<LengthUnit>) view
.findViewById(R.id.picker1);
cardAltitudePicker.setViewAdapter(adapter);
cardAltitudePicker.addScrollListener(this);
cardAltitudePicker.setCurrentValue(lengthUnitProvider.boxBaseValueToTarget(item.getTriggerDistance()));
}
示例5: onApiConnected
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的package包/类
@Override
public void onApiConnected() {
final Drone drone = getDrone();
if (mAltitudeWheel != null) {
GuidedState guidedState = drone.getAttribute(AttributeType.GUIDED_STATE);
LatLongAlt coordinate = guidedState == null ? null : guidedState.getCoordinate();
final LengthUnit initialValue = getLengthUnitProvider().boxBaseValueToTarget(
Math.max(guidedState == null
? DEFAULT_ALTITUDE
: coordinate == null ? DEFAULT_ALTITUDE : coordinate.getAltitude(),
DEFAULT_ALTITUDE));
mAltitudeWheel.setCurrentValue(initialValue);
}
parentActivity.setGuidedClickListener(this);
Type droneType = drone.getAttribute(AttributeType.TYPE);
if(droneType.getDroneType() == Type.TYPE_ROVER){
mAltitudeWheel.setVisibility(View.GONE);
}
else{
mAltitudeWheel.setVisibility(View.VISIBLE);
}
}
示例6: updateHomeTelem
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的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);
}
示例7: updateMissionLength
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的package包/类
private void updateMissionLength() {
if (missionProxy != null) {
double missionLength = missionProxy.getMissionLength();
LengthUnit convertedMissionLength = unitSystem.getLengthUnitProvider().boxBaseValueToTarget(missionLength);
double speedParameter = dpApp.getDrone().getSpeedParameter() / 100; //cm/s to m/s conversion.
if(speedParameter == 0)
speedParameter = DEFAULT_SPEED;
int time = (int) (missionLength / speedParameter);
String infoString = getString(R.string.editor_info_window_distance, convertedMissionLength.toString())
+ ", " + getString(R.string.editor_info_window_flight_time, time / 60, time % 60);
infoView.setText(infoString);
// Remove detail window if item is removed
if (missionProxy.selection.getSelected().isEmpty() && itemDetailFragment != null) {
removeItemDetail();
}
}
}
示例8: onApiConnected
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的package包/类
@Override
public void onApiConnected() {
super.onApiConnected();
typeSpinner.setSelection(commandAdapter.getPosition(MissionItemType.TAKEOFF));
final LengthUnitProvider lengthUP = getLengthUnitProvider();
final LengthWheelAdapter altitudeAdapter = new LengthWheelAdapter(getContext(), R.layout.wheel_text_centered,
lengthUP.boxBaseValueToTarget(0), lengthUP.boxBaseValueToTarget(MAX_ALTITUDE));
CardWheelHorizontalView<LengthUnit> cardAltitudePicker = (CardWheelHorizontalView) getView()
.findViewById(R.id.altitudePicker);
cardAltitudePicker.setViewAdapter(altitudeAdapter);
cardAltitudePicker.addScrollListener(this);
Takeoff item = (Takeoff) getMissionItems().get(0);
cardAltitudePicker.setCurrentValue(lengthUP.boxBaseValueToTarget(item.getTakeoffAltitude()));
}
示例9: onApiConnected
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的package包/类
@Override
public void onApiConnected() {
super.onApiConnected();
final View view = getView();
typeSpinner.setSelection(commandAdapter.getPosition(MissionItemType.CAMERA_TRIGGER));
CameraTrigger item = (CameraTrigger) getMissionItems().get(0);
final LengthUnitProvider lengthUnitProvider = getLengthUnitProvider();
final LengthWheelAdapter adapter = new LengthWheelAdapter(getContext(), R.layout.wheel_text_centered,
lengthUnitProvider.boxBaseValueToTarget(0), lengthUnitProvider.boxBaseValueToTarget(100));
final CardWheelHorizontalView<LengthUnit> cardAltitudePicker = (CardWheelHorizontalView<LengthUnit>) view
.findViewById(R.id.picker1);
cardAltitudePicker.setViewAdapter(adapter);
cardAltitudePicker.addScrollListener(this);
cardAltitudePicker.setCurrentValue(lengthUnitProvider.boxBaseValueToTarget(item.getTriggerDistance()));
}
示例10: updateHome
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的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));
}
示例11: onViewCreated
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的package包/类
@Override
public void onViewCreated(View parentView, Bundle savedInstanceState) {
super.onViewCreated(parentView, savedInstanceState);
final DroidPlannerPrefs dpPrefs = getAppPrefs();
final LengthUnitProvider lengthUnitProvider = getLengthUnitProvider();
final LengthWheelAdapter altitudeAdapter = new LengthWheelAdapter(getContext(), R.layout.wheel_text_centered,
lengthUnitProvider.boxBaseValueToTarget(dpPrefs.getMinAltitude()),
lengthUnitProvider.boxBaseValueToTarget(dpPrefs.getMaxAltitude()));
mAltitudeWheel = (CardWheelHorizontalView<LengthUnit>) parentView.findViewById(R.id.altitude_spinner);
mAltitudeWheel.setViewAdapter(altitudeAdapter);
mAltitudeWheel.addScrollListener(this);
}
示例12: onScrollingEnded
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的package包/类
@Override
public void onScrollingEnded(CardWheelHorizontalView cardWheel, LengthUnit startValue, LengthUnit endValue) {
switch (cardWheel.getId()) {
case R.id.altitude_spinner:
final Drone drone = getDrone();
if (drone.isConnected()) {
ControlApi.getApi(drone).climbTo(endValue.toBase().getValue());
}
break;
}
}
示例13: onApiConnected
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的package包/类
@Override
public void onApiConnected() {
final Drone drone = getDrone();
if (mAltitudeWheel != null) {
final DroidPlannerPrefs dpPrefs = getAppPrefs();
final double maxAlt = dpPrefs.getMaxAltitude();
final double minAlt = dpPrefs.getMinAltitude();
final double defaultAlt = dpPrefs.getDefaultAltitude();
GuidedState guidedState = drone.getAttribute(AttributeType.GUIDED_STATE);
LatLongAlt coordinate = guidedState == null ? null : guidedState.getCoordinate();
final double baseValue = Math.min(maxAlt,
Math.max(minAlt, coordinate == null ? defaultAlt : coordinate.getAltitude()));
final LengthUnit initialValue = getLengthUnitProvider().boxBaseValueToTarget(baseValue);
mAltitudeWheel.setCurrentValue(initialValue);
}
parent.setGuidedClickListener(this);
Type droneType = drone.getAttribute(AttributeType.TYPE);
if (droneType.getDroneType() == Type.TYPE_ROVER) {
mAltitudeWheel.setVisibility(View.GONE);
} else {
mAltitudeWheel.setVisibility(View.VISIBLE);
}
}
示例14: onViewCreated
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的package包/类
@Override
public void onViewCreated(View parentView, Bundle savedInstanceState) {
super.onViewCreated(parentView, savedInstanceState);
modeDescription = (TextView) parentView.findViewById(R.id.ModeDetail);
final Context context = getContext();
final LengthUnitProvider lengthUP = getLengthUnitProvider();
final DroidPlannerPrefs dpPrefs = getAppPrefs();
final LengthWheelAdapter radiusAdapter = new LengthWheelAdapter(context, R.layout.wheel_text_centered,
lengthUP.boxBaseValueToTarget(Utils.MIN_DISTANCE), lengthUP.boxBaseValueToTarget(Utils.MAX_DISTANCE));
mRadiusWheel = (CardWheelHorizontalView<LengthUnit>) parentView.findViewById(R.id.radius_spinner);
mRadiusWheel.setViewAdapter(radiusAdapter);
mRadiusWheel.addScrollListener(this);
final LengthWheelAdapter roiHeightAdapter = new LengthWheelAdapter(context, R.layout.wheel_text_centered,
lengthUP.boxBaseValueToTarget(dpPrefs.getMinAltitude()), lengthUP.boxBaseValueToTarget(dpPrefs.getMaxAltitude()));
roiHeightWheel = (CardWheelHorizontalView<LengthUnit>) parentView.findViewById(R.id.roi_height_spinner);
roiHeightWheel.setViewAdapter(roiHeightAdapter);
roiHeightWheel.addScrollListener(this);
spinner = (Spinner) parentView.findViewById(R.id.follow_type_spinner);
adapter = new FollowTypesAdapter(context, false);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(this);
}
示例15: onScrollingEnded
import org.beyene.sius.unit.length.LengthUnit; //导入依赖的package包/类
@Override
public void onScrollingEnded(CardWheelHorizontalView cardWheel, LengthUnit oldValue, LengthUnit newValue) {
final Drone drone = getDrone();
switch (cardWheel.getId()) {
case R.id.radius_spinner:
if (drone.isConnected()) {
Bundle params = new Bundle();
params.putDouble(FollowType.EXTRA_FOLLOW_RADIUS, newValue.toBase().getValue());
FollowApi.getApi(drone).updateFollowParams(params);
}
break;
case R.id.roi_height_spinner:
if (drone.isConnected()) {
final LatLongAlt roiCoord = roiMarkerInfo.getPosition();
if (roiCoord != null) {
roiCoord.setAltitude(newValue.toBase().getValue());
pushROITargetToVehicle(drone, roiCoord);
}
}
break;
default:
super.onScrollingEnded(cardWheel, oldValue, newValue);
break;
}
}