⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 positionradians.java

📁 A Java Framework for connecting to and exchanging data from GPS units to J2ME Mobile Devices. Serial
💻 JAVA
字号:
package com.libGPS4j2me;

/**
* Class used to store radians, usually latitude or longitude.
* Contains methods for converting to the format degress,minutes.
*/ 
public class PositionRadians {
	private final double value;
	
	/**
	* Initializes the PositionRadians-object. After the object is constructed, it can't change is value.
	*/
	public PositionRadians(double v) {
		value = v;
	}
	
	public double getRadians() {
		return value;
	}

	/**
	* Returns the degrees part of this object, when converted to coordinates.
	*/		
	public int getDegrees() {
		return (int) (value * (180.0d / Math.PI));
	}
	
	/**
	* Returns the minutes part of this object, when converted to coordinates.
	*/	
	public double getMinutes() {
		double v = value * (180.0d / Math.PI);
		v -= getDegrees();
		return 60 * v; // 60 minutes in one degree.
	}

	
	/** 
	* Tests if the two PositionRadians contains the same value.
	*/ 
	public boolean equals(PositionRadians p) {
		if (value == p.value)
			return true;
		else
			return false;
	}
	
	/**
	* Tests if this PositionRadians is greater than p.
	*/	
	public boolean greaterThan(PositionRadians p) {
		if (value > p.value) 
			return true;
		else
			return false;
	}
	
	/**
	* Tests if this PositionRadians is smaller than p.	 
	*/ 
	
	public boolean smallerThan(PositionRadians p) {
		if (value < p.value) 
			return true;
		else
			return false;
	}	
	
	public String toString() {
		return String.valueOf(getDegrees()) + "\' " + String.valueOf((int)getMinutes()) + "\"";
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -