亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? gpslog.java

?? JavaGPS enables access to GPS devices from any Java application. Provides Java API, NMEA0183 parser,
?? JAVA
字號:
/***********************************************************************
 *  J a v a G P S - GPS access library and Java API                    *
 *  Copyright (C) 2001 Ulrich Walther                                  *
 *                                                                     *
 *  This program is free software; you can redistribute it and/or      *
 *  modify it under the terms of the GNU General Public License as     *
 *  published by the Free Software Foundation; either version 2 of     *
 *  the License, or (at your option) any later version.                *
 *                                                                     *
 *  This program is distributed in the hope that it will be useful,    *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
 *  General Public License for more details.                           *
 *                                                                     *
 *  You should have received a copy of the GNU General Public          *
 *  License along with this program; if not, write to the Free         *
 *  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,     *
 *  MA 02111-1307 USA                                                  *
 ***********************************************************************/

package org.iu.gps;

import java.io.*;
import java.util.*;

/**
 *  This class represents a device-independent GPS log. Further, it is capable
 *  of converting raw GPS log files from GPS devices into our internal
 *  representation on the fly.
 *
 *@author    walther
 */
public class GPSLog implements Serializable {
	/**
	 *  Specifies the start time of the log.
	 */
	protected Date start;

	/**
	 *  Specifies the duration of the log in seconds.
	 */
	protected int duration;

	/**
	 *  Specifies the GPSInfo elements of the log, one for each second of logged
	 *  data.
	 */
	protected Vector gpslog;


	/**
	 *  Creates an empty GPSLog.
	 */
	public GPSLog()
	{
		duration = 0;
		gpslog = new Vector();
	}


	/**
	 *  Creates an empty GPSLog with given time/date.
	 *
	 *@param  _start  Creation date of the log.
	 */
	public GPSLog( Date _start )
	{
		this();
		start = _start;
	}


	/**
	 *  Loads GPSLog from a raw GPS driver log file.
	 *
	 *@param  is            Input stream.
	 *@return               Returns a new GPSLog object representing the given
	 *      stream's log data.
	 *@throws  IOException  In case of I/O Error.
	 */
	public static GPSLog loadRaw( InputStream is ) throws IOException
	{
		BufferedReader in = new BufferedReader( new InputStreamReader(
				is ) );

		//System.out.println("Converting GPS RAW logfile...");

		GPSInfo gpsInfo = new GPSInfo();
		NMEA.infiniteAge( gpsInfo );

		long t0;

		long t1;

		long t2;
		String msg = "";
		boolean replayLog = false;
		long replayBase = -1;
		// seconds counter for GPSLog creation
		int t = 0;

		// (try to) read the first line
		try
		{
			msg = filter( in.readLine() );
		}
		catch ( Exception e )
		{
			// cannot read, return null log
			return null;
		}

		//System.out.println( msg );

		// check that we are reading previously logged messages
		if ( msg.charAt( 0 ) != '$' && msg.indexOf( ":" ) > 0
				 && Character.isDigit( msg.charAt( 0 ) ) )
		{
			replayBase = Long.parseLong( msg.substring( 0, msg.indexOf( ':' ) ) );
		}
		else
		// check for raw log without timestamp
				if ( msg.charAt( 0 ) == '$' )
		{
			replayBase = 0;

			while ( ( msg = filter( in.readLine() ) ) != null )
			{
				// parse NMEA message until we find the first UTC time
				if ( msg != null && NMEA.check( msg ) )
				{
					//System.out.println("DEBUG "+msg);
					// parse known messages
					synchronized ( gpsInfo )
					{
						if ( NMEA.parse( msg, gpsInfo ) )
						{
							;
						}
					}
				}

				if ( gpsInfo.utc != null )
				{
					replayBase = UTCtoMS( gpsInfo.utc );
					break;
				}
			}

			// could not find time base in NMEA messages
			if ( replayBase == 0 )
			{
				return null;
			}
		}
		else
		{
			return null;
		}

		t0 = t1 = replayBase;
		//System.currentTimeMillis();

		// create a new GPS log with start time/date
		GPSLog gl = new GPSLog( new Date( t0 ) );

		// read over the whole log file
		while ( ( msg = filter( in.readLine() ) ) != null )
		{
			try
			{
				// read the time when the msg was logged, and
				// skip time in msg

				if ( msg.indexOf( ':' ) > 0 )
				{
					// parse line with timestamp
					long twait = Long.parseLong( msg.substring( 0, msg.indexOf( ':' ) ) ) - replayBase;
					msg = msg.substring( msg.indexOf( ':' ) + 1 );
					//System.out.println("Replay "+msg);
					long ct = System.currentTimeMillis();
					t2 = twait + replayBase;
					// wait to replay correct timely behaviour
					if ( ct - t0 < twait )
					{
						//System.out.println(" sleeping "+ (twait - (ct-t0)) );
						//Thread.currentThread().sleep( twait - (ct-t0) );
					}
				}
				else
				{
					// parse line without timestamp
					// these are raw logs from the GPS
					t2 = UTCtoMS( gpsInfo.utc );
//				System.err.println(t2);
				}

				if ( msg != null && NMEA.check( msg ) )
				{
					//System.out.println("DEBUG "+msg);
					// parse known messages
					synchronized ( gpsInfo )
					{
						if ( NMEA.parse( msg, gpsInfo ) )
						{
							;
						}
					}
				}

				// check if GPSInfo has to be aged...
				while ( t2 - t1 >= 1000 )
				{
					GPSInfo gc = ( GPSInfo ) gpsInfo.clone();
					GPSDriver.normGPSInfo( gc );
					gl.setInfoAt( t, gc );
					t++;
					//System.out.println("t="+t1+" x="+gc.X+" y="+gc.Y);

					NMEA.increaseAge( gpsInfo );
					t1 += 1000;

					//System.out.println("\n\n*** GPSInfo ***");
					//NMEA.printAll( gpsInfo );
				}
			}
			catch ( Exception e )
			{
				e.printStackTrace();
			}
		}
		return gl;
	}


	/**
	 *  Loads a GPSLog from a given stream, uses device-independent file format.
	 *  Falls back and tries to load raw GPS log if the given input stream is not
	 *  in the device-independent format.
	 *
	 *@param  _is  Input stream.
	 *@return      Returns new GPSLog object representing the log from the given
	 *      stream.
	 */
	public static GPSLog load( InputStream _is )
	{
		BufferedInputStream is = new BufferedInputStream( _is );
		is.mark( 0 );
		ObjectInputStream ois = null;
		try
		{
			ois = new ObjectInputStream( is );
			GPSLog gl = ( GPSLog ) ois.readObject();
			if ( gl != null )
			{
				return gl;
			}
		}
		catch ( Exception e )
		{
			//e.printStackTrace();
		}

		try
		{
			if ( ois != null )
			{
				ois.close();
			}
			// reset input stream
			is.reset();

			//System.out.println("Fallback to raw log...");

			// try to load stream as a raw log
			return loadRaw( is );
		}
		catch ( Exception e2 )
		{
			//e2.printStackTrace();
		}
		return null;
	}


	/**
	 *  Test method.
	 *  Converts old log file into new log file format.
	 *
	 *@param  arg
	 *@throws  Exception
	 */
	public static void main( String[] arg ) throws Exception
	{

		if ( arg.length != 2 )
		{
			System.err.println( "Syntax: oldlog_name converted_log_name" );
			System.exit( -1 );
		}
		GPSLog gl = GPSLog.loadRaw( new FileInputStream( arg[0] ) );
		gl.save( new java.util.zip.GZIPOutputStream( new FileOutputStream( arg[1] ) ) );
	}


	private static long UTCtoMS( String utc )
	{
		int h = Integer.parseInt( utc.substring( 0, 2 ) );
		int m = Integer.parseInt( utc.substring( 2, 4 ) );
		int s = Integer.parseInt( utc.substring( 4, 6 ) );

		return 1000l * ( h * 3600 + m * 60 + s );
	}


	private static String filter( String s )
	{
		if ( s == null )
		{
			return s;
		}

		int idx = s.indexOf( ':' );
		if ( idx >= 0 )
		{
			return s.substring( idx + 1 );
		}
		else
		{
			return s;
		}
	}


	/**
	 *  Sets GPSInfo in the log for a specific time.
	 *
	 *@param  t   time in seconds.
	 *@param  gi  GPSInfo to set.
	 */
	public void setInfoAt( int t, GPSInfo gi )
	{
		gpslog.add( t, gi );
		if ( t > duration )
		{
			duration = t;
		}
	}


	/**
	 *  Returns the duration of the log in seconds.
	 *
	 *@return    Duration in seconds.
	 */
	public int getDuration()
	{
		return duration;
	}


	/**
	 *  Gets the GPSInfo from the log at a certain point of time, where t>=0 and t
	 *  smaller than duration.
	 *
	 *@param  t  time in seconds (>=0 and smaller duration)
	 *@return    GPSInfo at specified time, or null if not available.
	 */
	public GPSInfo getInfoAt( int t )
	{
		return ( GPSInfo ) gpslog.elementAt( t );
	}


	/**
	 *  Saves the log in the given output stream.
	 *
	 *@param  os            Output stream to use for saving.
	 *@throws  IOException  In case of I/O error.
	 */
	public void save( OutputStream os ) throws IOException
	{
		ObjectOutputStream oos = new ObjectOutputStream( os );
		oos.writeObject( this );
		oos.close();
		os.flush();
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
粉嫩aⅴ一区二区三区四区五区 | 欧美一区二区三区在线观看 | 亚洲国产精华液网站w| 制服丝袜亚洲精品中文字幕| 欧美性感一区二区三区| 欧美在线free| 欧美亚洲精品一区| 欧美在线观看禁18| 欧美高清视频在线高清观看mv色露露十八 | 国产一区二区美女| 国产精品伊人色| 国产精品 欧美精品| 岛国av在线一区| 97久久精品人人做人人爽50路| 高清免费成人av| 色综合天天做天天爱| 91污在线观看| 欧美日韩中文字幕一区二区| 日韩欧美国产小视频| 久久综合九色欧美综合狠狠| 亚洲国产电影在线观看| 亚洲免费高清视频在线| 天天av天天翘天天综合网色鬼国产| 美女网站色91| 成人深夜视频在线观看| 色综合色综合色综合| 91福利国产成人精品照片| 欧美午夜不卡在线观看免费| 日韩精品一区二区三区在线观看| 久久蜜桃一区二区| 一级精品视频在线观看宜春院 | 国产乱码精品1区2区3区| 不卡视频在线观看| 欧美三级三级三级爽爽爽| 久久综合视频网| 亚洲三级电影网站| 久久精品噜噜噜成人av农村| 99久精品国产| 日韩欧美的一区二区| 亚洲免费在线播放| 国精产品一区一区三区mba桃花| 99久久精品国产一区二区三区| 51精品国自产在线| 综合在线观看色| 紧缚奴在线一区二区三区| 99re热这里只有精品视频| 日韩色在线观看| 一区二区在线看| 国产不卡高清在线观看视频| 制服丝袜亚洲网站| 亚洲综合清纯丝袜自拍| 国产aⅴ综合色| 欧美日韩激情一区二区三区| 国产精品入口麻豆九色| 九一九一国产精品| 欧美日韩一二三| 亚洲欧美日韩一区二区| 国产成人av一区二区三区在线| 91精品视频网| 亚洲五月六月丁香激情| 色中色一区二区| 中文字幕亚洲成人| 久久精品国产77777蜜臀| 欧美色图天堂网| 亚洲精品日日夜夜| av在线不卡免费看| 国产精品久久久久久户外露出 | 亚洲女性喷水在线观看一区| 国产一区二区按摩在线观看| 欧美一区日本一区韩国一区| 亚洲chinese男男1069| 一本色道**综合亚洲精品蜜桃冫| 日韩理论片在线| 成人网在线免费视频| 国产精品女主播av| 成人精品免费视频| 中文字幕在线一区| av色综合久久天堂av综合| 国产偷国产偷精品高清尤物| 国产激情精品久久久第一区二区| 精品卡一卡二卡三卡四在线| 韩国v欧美v亚洲v日本v| 精品粉嫩aⅴ一区二区三区四区| 精品一区二区精品| 久久这里只有精品视频网| 国产乱码精品一区二区三区忘忧草 | 亚洲精品久久嫩草网站秘色| www.在线成人| 亚洲美女屁股眼交3| 91精品福利在线| 亚洲国产精品久久久久秋霞影院| 欧美日韩国产小视频在线观看| 伊人一区二区三区| 91精品国产一区二区三区蜜臀| 蜜桃传媒麻豆第一区在线观看| 日韩一级片网址| 激情综合网最新| 中文一区一区三区高中清不卡| 99re视频精品| 日本不卡一二三| 久久免费看少妇高潮| 91丝袜国产在线播放| 亚洲国产cao| 久久婷婷色综合| 91天堂素人约啪| 欧美aⅴ一区二区三区视频| 久久久美女毛片| 91网站黄www| 奇米影视在线99精品| 欧美韩国日本一区| 欧美日本国产一区| 成人免费视频视频在线观看免费| 亚洲精品久久嫩草网站秘色| 日韩免费视频一区| 色婷婷av一区二区三区软件| 免费观看日韩av| 亚洲另类春色国产| 久久综合一区二区| 在线观看亚洲专区| 国产凹凸在线观看一区二区 | 欧美一区二区三区男人的天堂| 国产成人综合亚洲91猫咪| 亚洲精品久久久久久国产精华液| 91精品免费在线观看| 色av成人天堂桃色av| 国产一区二区三区在线观看免费视频 | 激情综合网av| 亚洲一区二区三区美女| 国产欧美一二三区| 91精品国产入口| 在线欧美小视频| 粉嫩13p一区二区三区| 日本在线不卡一区| 亚洲国产另类av| 综合久久国产九一剧情麻豆| 久久综合久色欧美综合狠狠| 欧美日韩国产免费| 91在线视频播放| 粉嫩绯色av一区二区在线观看| 蓝色福利精品导航| 日本视频中文字幕一区二区三区| 亚洲欧美欧美一区二区三区| 欧美激情一区二区三区全黄| 久久午夜羞羞影院免费观看| 制服丝袜av成人在线看| 欧美日韩一区二区在线观看 | 精品入口麻豆88视频| 欧美日韩成人在线一区| 欧美综合天天夜夜久久| 色婷婷久久久久swag精品| 97精品电影院| 色伊人久久综合中文字幕| 99久久免费国产| 91丝袜美腿高跟国产极品老师 | 亚洲福利一二三区| 有坂深雪av一区二区精品| 亚洲欧洲成人精品av97| 国产精品狼人久久影院观看方式| 国产亚洲短视频| 亚洲国产精品二十页| 国产精品久久久久久久久搜平片| 国产欧美综合在线| 国产精品网站在线播放| 国产精品拍天天在线| 国产精品久久久久三级| 亚洲欧美日韩中文播放| 亚洲成人av一区二区| 日韩一区欧美二区| 久久精品噜噜噜成人88aⅴ| 精品午夜一区二区三区在线观看 | 一区二区不卡在线视频 午夜欧美不卡在| 国产精品全国免费观看高清| 国产精品成人免费在线| 亚洲精品成人少妇| 午夜伦欧美伦电影理论片| 美女一区二区视频| 国产999精品久久久久久| 91蜜桃婷婷狠狠久久综合9色| 欧美在线色视频| 欧美精品一区视频| 国产精品美女久久久久aⅴ | 国产精品欧美一区喷水| 亚洲国产一区在线观看| 日本三级韩国三级欧美三级| 国产精品一区二区黑丝| 一本色道久久综合精品竹菊| 欧美一区二区三区视频免费 | 欧美激情一区在线| 亚洲福利视频三区| 国产精品18久久久久久久久久久久 | 一区二区三区鲁丝不卡| 蜜臀va亚洲va欧美va天堂| 成人免费毛片高清视频| 欧美日本一区二区三区| 国产亚洲欧美激情| 午夜电影久久久| jlzzjlzz亚洲女人18| 欧美一区二区视频网站| 中文字幕视频一区二区三区久| 日韩经典中文字幕一区|