📄 viewinputattributes.java
字号:
/* Copyright (C) 2001, 2008 United States Government as represented by
the Administrator of the National Aeronautics and Space Administration.
All Rights Reserved.
*/
package gov.nasa.worldwind.awt;
import gov.nasa.worldwind.Configuration;
import gov.nasa.worldwind.util.Logging;
import java.util.*;
/**
* @author dcollins
* @version $Id: ViewInputAttributes.java 8975 2009-02-24 18:38:35Z dcollins $
*/
public class ViewInputAttributes
{
public static class ActionAttributes
{
private double minValue;
private double maxValue;
private boolean enableSmoothing;
private double smoothingValue;
public ActionAttributes(double minValue, double maxValue, boolean enableSmoothing, double smoothingValue)
{
this.setValues(minValue, maxValue);
this.setEnableSmoothing(enableSmoothing);
this.setSmoothingValue(smoothingValue);
}
public ActionAttributes(ActionAttributes attributes)
{
if (attributes == null)
{
String message = Logging.getMessage("nullValue.AttributesIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.minValue = attributes.minValue;
this.maxValue = attributes.maxValue;
this.smoothingValue = attributes.smoothingValue;
}
public double[] getValues()
{
return new double[] {this.minValue, this.maxValue};
}
public void setValues(double minValue, double maxValue)
{
if (minValue <= 0)
{
String message = Logging.getMessage("generic.ArgumentOutOfRange", "minValue <= 0");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (maxValue <= 0)
{
String message = Logging.getMessage("generic.ArgumentOutOfRange", "maxValue <= 0");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.minValue = minValue;
this.maxValue = maxValue;
}
public void setValue(double value)
{
this.setValues(value, value);
}
public boolean isEnableSmoothing()
{
return this.enableSmoothing;
}
public void setEnableSmoothing(boolean enable)
{
this.enableSmoothing = enable;
}
public double getSmoothingValue()
{
return this.smoothingValue;
}
public void setSmoothingValue(double smoothingValue)
{
if (smoothingValue < 0 || smoothingValue >= 1.0)
{
String message = Logging.getMessage("generic.ArgumentOutOfRange", "smoothingValue < 0 || smoothingValue >= 1");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.smoothingValue = smoothingValue;
}
}
public static class DeviceAttributes
{
private double sensitivity;
public DeviceAttributes(double sensitivity)
{
this.setSensitivity(sensitivity);
}
public DeviceAttributes(DeviceAttributes attributes)
{
if (attributes == null)
{
String message = Logging.getMessage("nullValue.AttributesIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.sensitivity = attributes.sensitivity;
}
public double getSensitivity()
{
return this.sensitivity;
}
public void setSensitivity(double sensitivity)
{
if (sensitivity <= 0)
{
String message = Logging.getMessage("generic.ArgumentOutOfRange", "sensitivity <= 0");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.sensitivity = sensitivity;
}
}
public static class ActionAttributesMap
{
private Map<Object, ActionAttributes> actionMap = new HashMap<Object, ActionAttributes>();
public ActionAttributesMap()
{
}
public ActionAttributes getActionAttributes(Object actionKey)
{
if (actionKey == null)
{
String message = Logging.getMessage("nullValue.ActionKeyIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
return this.actionMap.get(actionKey);
}
public void setActionAttributes(Object actionKey, ActionAttributes attributes)
{
if (actionKey == null)
{
String message = Logging.getMessage("nullValue.ActionKeyIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (attributes == null)
{
String message = Logging.getMessage("nullValue.AttributesIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.actionMap.put(actionKey, attributes);
}
}
public static final String VIEW_FOCUS = "gov.nasa.worldwind.ViewFocus";
public static final String VIEW_FOCUS_SLOW = "gov.nasa.worldwind.ViewFocusSlow";
public static final String VIEW_PAN = "gov.nasa.worldwind.ViewPan";
public static final String VIEW_PAN_SLOW = "gov.nasa.worldwind.ViewPanSlow";
public static final String VIEW_ROTATE = "gov.nasa.worldwind.ViewRotate";
public static final String VIEW_ROTATE_SLOW = "gov.nasa.worldwind.ViewRotateSlow";
public static final String VIEW_ZOOM = "gov.nasa.worldwind.ViewZoom";
public static final String VIEW_ZOOM_SLOW = "gov.nasa.worldwind.ViewZoomSlow";
public static final String DEVICE_KEYBOARD = "gov.nasa.worldwind.DeviceKeyboard";
public static final String DEVICE_MOUSE = "gov.nasa.worldwind.DeviceMouse";
public static final String DEVICE_MOUSE_WHEEL = "gov.nasa.worldwind.DeviceMouseWheel";
// Device sensitivity defaults.
private static final double DEFAULT_KEY_SENSITIVITY = 1.0; // Scalar multiplier
private static final double DEFAULT_MOUSE_SENSITIVITY = 1.0; // Scalar multiplier
private static final double DEFAULT_MOUSE_WHEEL_SENSITIVITY = 1.0; // Scalar multiplier
private static final double DEFAULT_SLOW_VALUE = 0.25; // Scalar multiplier
// Action smoothing defaults.
private static final boolean DEFAULT_FOCUS_SMOOTHING_ENABLED = true;
private static final boolean DEFAULT_PAN_SMOOTHING_ENABLED = true;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -