positiondegrees.java

来自「A Java Framework for connecting to and e」· Java 代码 · 共 40 行

JAVA
40
字号
package com.libGPS4j2me;

/**
* Class used to store degrees, usually latitude or longitude.
*/ 

public class PositionDegrees {	
	protected double value;
	
	public PositionDegrees(double v) {
		value = v;
	}
	
	/**
	* Returns the degrees part of this object, when converted to coordinates.
	*/		
	public int getDegrees() {
		return (int) value;	
	}
	
	/**
	* Converts the degrees to Radians. 
	*/
	public PositionRadians convertToRadians() {
		return new PositionRadians(( value * Math.PI ) / 180.0d);
	}
	
	/**
	* Returns the minutes part of this object, when converted to coordinates.
	*/	
	public double getMinutes() {
		double v = value;
		v -= getDegrees();
		return 60 * v; // 60 minutes in one degree.
	}
	
	public String toString() {
		return String.valueOf(getDegrees()) + "\' " + String.valueOf((int)getMinutes()) + "\"";
	}
}

⌨️ 快捷键说明

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