();
- }
- return webObjcache;
- }
-
-
-
-
-}
diff --git a/qy/src/main/java/com/qiyou/mb/android/QiYouConstant.java b/qy/src/main/java/com/qiyou/mb/android/QiYouConstant.java
deleted file mode 100644
index 7f19d26..0000000
--- a/qy/src/main/java/com/qiyou/mb/android/QiYouConstant.java
+++ /dev/null
@@ -1,409 +0,0 @@
-package com.qiyou.mb.android;
-
-public class QiYouConstant {
-
- public QiYouConstant() {
- // TODO Auto-generated constructor stub
- }
-//public final static String BAIDU_API_KEY = "rI4GlZIZcFv5fB5qxotyrW9f";
-
-//public final static String GG_API_KEY ="AIzaSyAnkLsprzJIbz_9EVOMcXvlPlxYtIfc0yg"; --office AIzaSyBygKp-tvHCRJFt19NJ2oyq0N6aCUCbKjU
-public final static String GG_API_KEY ="AIzaSyBAey0WNbuvc2WeEbCOsGEpp2WW0iw77u0";
-//public final static String BASE_URL ="https://www.i7lv.net/";// "http://office:8080/qiyouji/"; //http://121.42.55.18:8080/qiyouji/
-public final static String BASE_URL ="https://www.i7lv.com/";//new website
-public final static String BASE_MD_URL = BASE_URL;//+"upload/";
-public final static String BASE_STATIC_URL = BASE_URL +"staticmap/";
-public final static String TENCENT_APP_ID = "1104563148";
-// TODO Turn off when deploying.
-public static boolean DEVELOPER_MODE = false;
-//public final static float POINT_RD = 500; //used in route_fragment for checkWps
-public static boolean PLAYBACK_CAN_RECORD = false ;//DEVELOPER_MODE ;
-
-public static boolean STRICT_MODE =false;//DEVELOPER_MODE;
-// public static boolean STRICT_MODE =false;
-
-public static boolean LOG_LEVEL_DEBUG = DEVELOPER_MODE;
-// public static boolean LOG_LEVEL_DEBUG =true;
-public static boolean LOG_LEVEL_ERROR =DEVELOPER_MODE;
-// public static boolean LOG_LEVEL_ERROR =true;
-//public static String APP_DIR ="/qiyou/";
-
-public static int MAX_UPLOAD_WPS_SIZE_PER_KM = 10;
-public static boolean LOG_LEVEL_DEBUG_FILE = DEVELOPER_MODE;// LOG_LEVEL_DEBUG;
-public static String APP_SD_DIR="qiyou";
-public static String SD_PATH ="/sdcard/qiyou/";
-public static String MEDIA_PATH =SD_PATH+"medias/";
-public static String MEDIA_FOLDER_PREFIX ="i7lv_No.";
-public static String FOOTMARK_PATH =SD_PATH+"footmarks/";
-public static String PHOTO_CACHE_PATH =SD_PATH+"photoCache/";
-public static String EXP_PATH =SD_PATH+"exp/";
-public static String IMP_PATH =SD_PATH+"imp/";
-public static String CONTENT_SD_DIR=SD_PATH+"dbcontent/";
-public static String VERSION_ADDRESS ="download/version.xml";
-public static String GPX_CACHE_PATH= SD_PATH + "gpxcache/";
-public static String ACT_CACHE_PATH= SD_PATH + "actcache/";
-public static String BEAR_TEXT = "BEARS.txt";
-public static String STAT_TEXT = "STAT";
-
-
-public static boolean SUPPORTS_GINGERBREAD = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD;
-public static boolean SUPPORTS_HONEYCOMB = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB;
-public static boolean SUPPORTS_FROYO = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.FROYO;
-public static boolean SUPPORTS_ECLAIR = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ECLAIR;
-
-//public static String NO_SAT_SIGNAL ="卫星定位中...";
-
-public static String ACTION_NEW_FORCE_UPDATE ="com.qiyou.mb.android.receivers.FORCE_UPDATE_RECEIVER";
-public static String ACTION_NEW_LOCATION_CHANGED ="com.qiyou.mb.android.receivers.LOCATION_CHANGED";
-public static String ACTION_NEW_COARSE_LOCATION ="com.qiyou.mb.android.receivers.COARSE_LOCATION";
-public static String ACTION_NEW_WAYPOINTS_TO_SAVE ="com.qiyou.mb.android.receivers.NEW_WAY_POINTS";
-public static String ACTION_NEW_LOCATION_GETBACK ="com.qiyou.mb.android.receivers.locationgot";
-//public static String ACTION_CONNECTIVITY_CHANGE ="android.net.conn.CONNECTIVITY_CHANGE";
-public static String ACTION_CONNECTIVITY_CHANGE ="android.net.conn.CONNECTIVITY_CHANGE";
-public static String PROXIMITY_INTENT_ACTION ="com.qiyou.mb.android.receivers.ALERTPROXIMITY";
-public static String ACTION_SYNC_STATISTICS ="com.qiyou.mb.android.ACTION_SYNC_STATISTICS";
-public static String SPLITOR="*&^,";
-public static String SPLITOR_KEY="\\*\\&\\^,";
-
-
-public static String EXTRA_KEY_BOOT="android.intent.action.BOOT_COMPLETED";
-
-public static String DB_TRACKS_ACTION ="db_tracks_action"; // track table action
-public static String NEW_LOCATION ="new_location"; // track recording
-public static String NEW_NAVIFO_MSG ="NEW_NAVIFO_MSG"; // track recording
-public static String NEW_NAVIFO_DIST_PROGRESS ="DIST_PROGRESS"; // track recording
-public static String NEW_GPX_TRACK ="new_gpx_track"; // track recording
-public static String INITIAL_GPXS ="INITIAL_GPXS"; // track recording
-public static String UPDATE_CATE_TRACK ="UPDATE_CATE_TRACK"; // track recording
-public static String UPDATE_TRACK_AVSTATUS ="UPDATE_TRACK_AVSTATUS"; // track recording
-
-public static String STOP_LOCATION_SERVICE ="STOP_LOCATION_SERVICE"; // track recording
-public static String UPDATE_TRACK_GEO ="update_trackGEO"; // track recording
-public static String UPDATE_TRACK ="update_track"; //
-public static String EXTR_KEY_FINISH_RECORDING ="FINISH_RECORDING"; //
-public static String UPDATE_RECORDING_TRACK ="update_rec_track"; //
-
-public static String IMPORT_TRACK ="import_track"; //
-public static String QUERY_TRACKS ="query_track"; //
-
-public static String SHARED_PREFERENCE_FILE = "SHARED_PREFERENCE_FILE";
-public static String APPLICATION_PREFERENCE_FILE = "APPLICATION_PREFERENCE_FILE";
-
-
-public static int MAX_TIME_UPDATE_DB =20*2000 ;
-public static int MAX_GPS_SPAN =2000;
-public static int TIME_FOR_LIGHT_LINE=MAX_GPS_SPAN/2*60*4; //当两点时间间隔大于此值,画细线
-public static int GPS_CODE_START_WPS_CNT_SKIP =15;
-//public static int MAX_GPS_DISTANCE =1;
-public static int MAX_GEO_TIME =QiYouConstant.MAX_GPS_SPAN*60;//MAX_TIME_UPDATE_DB*2;//MAX_GPS_SPAN*60*10; //120000;//max time between two GEO points in a track ,2 Minutes
-
-public static int MAX_TRACK_RESTORE_TIME =60000;//max time to restore a track from an restart of Application,1 Minutes
-public static int MAX_GPS_OFF_TIME =1*60*1000;//max time GPS OFF time, then cancel the gps request.
-
-public static int MAX_WPS_UPDATE_DB =30 ;
-//最长20秒 请求一次数据库更新
-//public static int MAX_TIME_UPDATE_DB =MAX_GPS_SPAN* MAX_WPS_UPDATE_DB ;
-
-public static int MAX_TIME_FORCE_UDATE =MAX_TIME_UPDATE_DB ;
-public static int MAX_TIME_GET_TRACK_FROM_DB =6000;
-//最多10个wp 请求一次数据库更新
-
-//distance between 2 wp is long than 10 m, can only be inserted to db.
-public static int MIN_WPS_DISTANCE_FACTOR =2; //minDistance = MIN_WPS_DISTANCE_FACTOR*MAX_GPS_SPAN*speed
-public static String PK_INT_WPS_KEEP_PERCENT ="PK_WPS_KEEP_PERCENT";
-public static String PK_BL_WPS_SAVE_ALL ="PK_WPS_SAVE_ALL";
-public static boolean WPS_SAVE_ALL =false;
-
-
-public static int WPS_SAVE_PERCENT_FACTOR =5; //(100/x)% to keep. example,100/5=20% keep, 80% drop
-public static int WPS_ROAD_BEARING =15; //how much bearing change can be take as a roadwp,35,2; 25,4;...30,4;35,3;20,4
-public static int WPS_ROAD_BEAR_CNT =3; //at least how much continued bear points can be counted as a valid roadbear
-
-public static String PK_INT_WPS_CNT_BEAR ="PK_INT_WPS_CNT_BEAR";
-public static String PK_INT_ANGLE_BEAR ="PK_INT_ANGLE_BEAR";
-public static String PK_BL_ONE_SHOT_BEAR ="PK_BL_ONE_SHOT_BEAR";
-public static String PK_BL_SPEAK_KM ="PK_BL_SPEAK_KM";
-public static Boolean BL_SPEAK_KM =true;
-public static Boolean BL_ONE_SHOT_BEAR =false;
-
-public static String PK_BL_SHARE_LOCATION ="PK_BL_SHARE_LOCATION";
-public static Boolean PV_BL_SHARE_LOCATION =false;
-// public static int PV_LG_SHARE_INTERVAL=60000;
-// public static String PK_LG_SHARE_INTERVAL="PK_LG_SHARE_INTERVAL";
-
-// public static String PK_BL_LIVE_LOCATION ="PK_BL_LIVE_LOCATION";
-// public static Boolean PV_BL_LIVE_LOCATION =true;
- public static String PK_INT_LIVE_SPAN ="PK_INT_LIVE_SPAN";
- public static int PV_INT_LIVE_SPAN =60000; //1 minute interval for sending out live locaiton
-
-
-public static String PK_STR_SHARE_MSG ="PK_STR_SHARE_MSG";
-public static String PV_STR_SHARE_MSG ="";
-
-
-public static String PK_ST_OPEN_ID ="PK_ST_OPEN_ID";
-public static String PV_OPEN_ID ="";
-
-
-public static String PK_STR_ACCESS_TOKEN ="PK_STR_ACCESS_TOKEN";
-public static String PV_ACCESS_TOKEN ="";
-
-
-public static String PK_L_EXPIRES_IN ="PK_L_EXPIRES_IN";
-public static long PV_EXPIRES_IN =0;
-
-public static String PK_INT_LIVE_TERM ="PK_INT_LIVE_TERM";
-public static int PV_INT_LIVE_TERM =8; //1 minute interval for sending out live locaiton
-
-public static String PK_BL_NAVI_VIBRATOR_ON="PK_BL_NAVI_VIBRATOR_ON";
-public static Boolean PV_BL_NAVI_VIBRATOR_ON=true;
-
-
-//海拔差的采样个数
-public static int MAX_WPS_EVERAGE_ELE_CNT =5 ;
-
-public static int TRACK_STATUS_PENDING = 0;
-public static int TRACK_STATUS_TRACKING = 1;
-public static int TRACK_STATUS_PAUSED = 2;
-public static int TRACK_STATUS_FINISHED =3;
-
-public static int TRACK_SPLIT_DIST =1000;
-public static float ELED_FACTOR =0.01f;
-//public static int TRACK_TYPE_BIKE =0;
-//public static int TRACK_TYPE_WALK =1;
-//public static int TRACK_TYPE_CAR =2;
-//public static int TRACK_TYPE_COPY =3;
-//public static int TRACK_TYPE_PIC =4;
-
-public static String EXTRA_KEY_NETWORK_LOCATION = "EXTRA_KEY_NETWORK_LOCATION";
-//public static String EXTRA_KEY_GEO = "EXTRA_KEY_GEO";
-public static String EXTRA_KEY_OFFMAP = "EXTRA_KEY_OFFMAP";
-public static String EXTRA_KEY_GET_CURRENT_CITY = "EXTRA_KEY_GET_CURRENT_CITY";
-//public static String EXTRA_KEY_CITY_NAME = "EXTRA_KEY_CITY_NAME";
-public static String EXTRA_KEY_FORCE_UPDATE = "EXTRA_KEY_FORCE_UPDATE";
-public static String EXTRA_KEY_FINISH_RECORDING = "EXTRA_KEY_FINISH_RECORDING";
-public static String EXTRA_KEY_FORCE_UPDATE_STAT = "EXTRA_KEY_FORCE_UPDATE_STAT";
-public static String EXTRA_KEY_TICK_UPDATE = "EXTRA_KEY_TICK_UPDATE";
-public static String EXTRA_KEY_START_GPS = "EXTRA_KEY_START_GPS";
-public static String EXTRA_KEY_STOP_GPS = "EXTRA_KEY_STOP_GPS";
-
-public static String EXTRA_KEY_UPLOAD_SHARED_LOCATION = "EXTRA_KEY_UPLOAD_SHARED_LOCATION";
-
-
-public static String EXTRA_KEY_REFERENCE = "reference";
-public static String EXTRA_KEY_GET_CURRENT_TRACK_BY_ID = "GET_CURRENT_TRACK_BY_ID";
-public static String EXTRA_KEY_GET_TRACK_BY_ID = "GET_TRACK_BY_ID";
-public static String EXTRA_KEY_GET_TRACK_BY_IDS = "GET_TRACK_BY_IDS";
-public static String EXTRA_KEY_GET_MAX_AV_TRACK = "EXTRA_KEY_GET_MAX_AV_TRACK";
-public static String EXTRA_KEY_TRACK_GEOS = "EXTRA_KEY_TRACK_GEOS";
-public static String EXTRA_KEY_GET_STSTICS_TRACKS = "EXTRA_KEY_GET_STAT_TRACK";
-public static String EXTRA_KEY_UPDATE_WAYPOINTS = "EXTRA_KEY_UPDATE_WAYPOINTS";
-public static String EXTRA_KEY_UPDATE_SVRNOS = "EXTRA_KEY_UPDATE_SVRNOS";
-public static String EXTRA_KEY_UPDATE_MEDIAS = "EXTRA_KEY_UPDATE_MEDIAS";
-public static String EXTRA_KEY_IS_MD = "EXTRA_KEY_IS_MD";
-//public static String EXTRA_KEY_GET_TYPE_USED_LST = "EXTRA_KEY_GET_TYPE_USED_LST";
-public static String EXTRA_KEY_ID = "_id";
-public static String EXTRA_KEY_TYPE = "_type";
-public static String EXTRA_KEY_WEB_REQUEST = "EXTRA_KEY_WEB_REQUEST";
-public static String EXTRA_KEY_LOCATION = "location";
-public static String EXTRA_KEY_RADIUS = "radius";
-public static String EXTRA_KEY_TIME_STAMP = "time_stamp";
-public static String EXTRA_KEY_PAUSING_TIME = "pausingTime";
-public static String EXTRA_KEY_NO_LOCCATION_SIGNAL = "NO_SIGNAL";
-public static String EXTRA_KEY_DISTANCE = "distance";
-public static String EXTRA_KEY_LOG_SHELL = "LOG";
-public static String EXTRA_VALUE_LOG_SHELL = "logcat | grep com.qiyou";
-
- public static String EXTRA_KEY_GENERAL = "EXTRA_KEY_GENERAL";
- public static String EXTRA_KEY_QCODEDESC = "EXTRA_KEY_QCODEDESC";
- public static String EXTRA_KEY_RESTMETHOD = "EXTRA_KEY_RESTMETHOD";
- public static String EXTRA_KEY_SVRID = "EXTRA_KEY_SVRID";
- //public static String EXTRA_KEY_FORCEREFRESH = "force_refresh";
-//public static String EXTRA_KEY_IN_BACKGROUND = "EXTRA_KEY_IN_BACKGROUND";
-public static String EXTRA_KEY_START_PROXI_ALERT="START_PROXI_ALERT";
-public static String EXTRA_KEY_START_NAVI="START_PROXI_NAVI";
-
-
-public static String GPX_NAME = "reference";
-
-
-
-public static String SPLASH_OKAY_TO_QUIT ="com.qiyou.mb.android.splash_okay_to_quit";
-public static String EXTRA_KEY_SPLASH ="OKAY_TO_QUIT";
-
-
-public static String PK_STR_USER ="PK_STR_USER";
-public static String PV_STR_USER ="";
-
-//preference key
-//public static String PK_INT_USER_ID ="PK_INT_USER_ID";
-//public static String PK_STR_USER_TITLE ="PK_STR_USER_TITLE";
-//public static String PK_STR_USER_PAIMING ="PK_STR_USER_PAIMING";
-//public static String PK_STR_USER_SCORE ="PK_STR_USER_SCORE";
-//public static String PK_STR_USER_ACCOUNT ="PK_STR_USER_ACCOUNT";
-public static String PK_STR_USER_NAME ="PK_STR_USER_NAME";
-//public static String PK_STR_USER_EMAIL ="PK_STR_USER_EMAIL";
-public static String PK_FLOAT_USER_WEIGHT ="PK_FLOAT_USER_WEIGHT";
-//public static String PK_STR_USER_PASSWD ="PK_STR_USER_PASSWD";
-public static String PK_INT_APP_CNT="PK_INT_APP_CNT";
-public static String PK_LAST_BBS_CATE = "PK_LAST_BBS_CATE";
-public static String PV_LAST_BBS_CATE = "";
-public static String PK_LONG_LAST_START ="PK_INT_LAST_START";
-public static String PK_LONG_LAST_QUIT ="PK_INT_LAST_QUIT";
-public static String PK_LONG_TRACK_MANULE_PAUSED ="PK_LONG_TRACK_MANULE_PAUSED";
-public static String PK_LONG_LAST_MANULE_PAUSED ="PK_LONG_LAST_MANULE_PAUSED";
-public static String PK_DOU_LAST_LAT="PK_INT_LAST_LAT";
-public static String PK_DOU_LAST_LON="PK_INT_LAST_LON";
-public static String PK_INT_LAST_UNFINISHED_TRACKID="PK_INT_LAST_UNFINISHED_TRACKID";
-public static String PK_INT_LAST_UNFINISHED_NAVID="PK_INT_LAST_UNFINISHED_NAVID";
-public static String PK_INT_LAST_UNFINISHED_NAV_WEB="PK_INT_LAST_UNFINISHED_NAV_WEB";
-public static String PK_INT_LAST_SYNC_TIME="PK_INT_LAST_SYNC_TIME";
-
-public static String PK_INT_LAST_TRACKTYPE="PK_INT_LAST_TRACKTYPE";
-public static String PK_LONG_LAST_TRACK_START="PK_LONG_LAST_TRACK_START";
-public static String PK_INT_LAST_NAVI_TRACK="PK_INT_LAST_NAVI_TRACK";
-public static String PK_STR_CITY="PK_STR_CITY";
-public static String PK_INT_GPS_SPAN ="PK_INT_GPS_SPAN";
-public static String PK_INT_SPORTS_SPEAK_MODEL ="PK_INT_SPORTS_SPEAK_MODEL";
-public static String PK_INT_NAVI_SPEAK_MODEL ="PK_INT_NAVI_SPEAK_MODEL";
-/**
- * 0 精简,1标准,2关闭
- */
-public static int PV_INT_SPORTS_SPEAK_MODEL =0;
-/**
- * 0 精简,1标准,2关闭
- */
-public static int PV_INT_NAVI_SPEAK_MODEL =0;
-public static boolean CAN_SPEAK = true;
-public static String PK_INT_TAB_SLICED ="PK_INT_TAB_SLICED";
-
-public static String PK_INT_MAX_WPS_EVERAGE_ELE_CNT ="PK_INT_MAX_WPS_EVERAGE_ELE_CNT";
-
-
-public static String PK_BL_PLAYBACK_PAUSE_WITH_UI ="PK_BL_PLAYBACK_PAUSE_WITH_UI";
-public static String PK_BL_PLAYBACK_CAN_RECORD ="PK_BL_PLAYBACK_CAN_RECORD";
-public static String PK_INT_PLAYBACK_TIME_INTERVAL ="PK_INT_PLAYBACK_TIME_INTERVAL";
-
-//used in location service.
-public static String PK_LONG_SUM_PAUSE ="PK_LONG_SUM_PAUSE";
-public static String PK_LONG_SUM_OFFTIME ="PK_LONG_SUM_OFFTIME";
-public static String PK_LONG_SUM_OFFTIMEWP ="PK_LONG_SUM_OFFTIMEWP";
-public static String PK_LAST_OFFTIME ="PK_LAST_OFFTIME";
-public static String PK_LAST_PAUSED ="PK_LAST_PAUSED";
-public static String PK_LONG_SUMDIST ="PK_LONG_SUMDIST";
-public static String PK_INT_RECORDINGID="PK_INT_RECORDINGID";
-public static String PK_LONG_MINTIME="PK_MINTIME";
-public static String PK_FLOAT_LOCDIST="PK_LOCDIST";
-public static String PK_FLOAT_SPDIST="PK_SPDIST";
-public static String PK_INT_PHONEID="PK_INT_PHONEID";
-public static String PK_INT_SCREEN_HEIGHT ="PK_INT_SCREEN_HEIGHT";
-public static String PK_INT_SCREEN_WIDTH ="PK_INT_SCREEN_WIDTH";
-public static int PV_INT_PHONEID=-1;
-public static int PV_INT_SCREEN_HEIGHT=-1;
-public static int PV_INT_SCREEN_WIDTH=-1 ;
-//public static String PV_USER_EMAIL ="";
-public static int PV_USER_ID =-1;
-public static int PV_RECORDINGID ;
-//public static String PV_USER_ACCOUNT ="";
-public static String PV_USER_NAME ="";
-//public static String PV_USER_PASSWD ="QPASSWDI";
-public static float PV_USER_WEIGHT =70;
-public static int PV_APP_CNT=0;
-public static long PV_LONG_LAST_START =0;
-public static long PV_LONG_LAST_QUIT =0;
-
-public static int PLAYBACK_TIME_INTERVAL =1000;
-
-public static String PK_BL_PLAYBACK_RECORD_SCREEN_OFF ="PK_BL_PLAYBACK_RECORD_SCREEN_OFF";
-public static Boolean PV_BL_PLAYBACK_PAUSE_WITH_UI =true; //can play or simulator navi when screen is off
-
-public static String PK_BL_SAVE_POWER ="PK_BL_SAVE_POWER";
-public static Boolean PV_BL_SAVE_POWER =true; //智能调节gps频率
-
-
-
-
-
-
-//public static boolean PV_PLAYBACK_RECORD_SCREEN_OFF =true;
-//beijing tain an men geo
-public static float PV_LAST_LAT=39.90960456049752f;
-public static float PV_LAST_LON=116.3972282409668f ;
-public static String PV_LAST_CITY="北京市" ;
-
-public static int WEB_PIC_SIZE =480; //PIC SIZE UPLOAD TO WEB
-public static int MAP_PIC_SIZE =PV_INT_SCREEN_WIDTH/15;//40;//PIC SHOW ON MAP
-public static int SUBNAIL_PIC_SIZE =PV_INT_SCREEN_WIDTH/2;//400;//PIC SHOW ON MAP
-public final static int SMALLPIC_SIZE_COMPRESS_REATE=70;
-public final static String WATER_MARKER_SIGN="爱骑驴";
-
-//public static final int WP_MEDIA_TYPE_PIC =0;
-//public static final int WP_MEDIA_TYPE_VOICE2 =2;
-//public static final int WP_MEDIA_TYPE_VIDEO =3;
-
-public static final int GEO_COUNTRY =0;
-public static final int GEO_PROVINCE =1;
-public final static int GEO_CITY =2;
-public static final int GEO_DISTRICT =3;
-public static final int GEO_STREET =4;
-public static final int GEO_STREETNO =5;
-public static String EXTRA_KEY_POPULATE_GEOS ="EXTRA_KEY_POPULATE_GEOS";
-public static String EXTRA_KEY_NEW_GEOS ="EXTRA_KEY_NEW_GEOS";
-
-public static final int NETWORK_TYPE_OFF=-1;
-public static final int NETWORK_TYPE_MOBILE=0;
-public static final int NETWORK_TYPE_WIFII=1;
-public static boolean NETWORK_CONNECTED=false;
-public static final String LOCATION_FORCE_UPDATE="FORCE_UPDATE";
-public static final String LOCATION_BD_LOC="BD_LOC";
-public static final String LOCATION_RD_LOC="ROADB_LOC";
-
-public static final String LOCATION_MONITOR="LOCATION_MONITOR";
-
-
-public static final float MAX_ELE=8888F;
-
-public static String FOOT_MARK_TITLE_TEMPLATE="%s";
-
-public static String FOOT_MARK_TURN_TEMPLATE="%s
";
-
-public static long LAST_GEO_UPDATE=0;
-public static long LAST_OFFMAP_UPDATE=0;
-public static long LAST_WIFI_TIME=0;
-public static String PK_LONG_LAST_OFFMAP_UPDATE="PK_LONG_LAST_OFFMAP_UPDATE";
-
-public static String PK_STRING_SHOWING_GPX="PK_STRING_SHOWING_GPX";
-
-public static String PK_BL_CAN_UPDATE_UI="PK_BL_CAN_UPDATE_UI";
-
-public static String PK_LONG_LAST_WIFI_TIME="PK_LONG_LAST_WIFI_TIME";
-public static String PK_LONG_LAST_GEO_UPDATE="PK_LONG_LAST_GEO_UPDATE";
-public static boolean CAN_GEO_UPDATE =false;//System.currentTimeMillis() -LAST_GEO_UPDATE > GEO_UPDATE_INTERVAL*1000*60;
-public static boolean CAN_OFFMAP_UPDATE =false;//System.currentTimeMillis() -LAST_GEO_UPDATE > GEO_UPDATE_INTERVAL*1000*60;
-public static boolean CAN_WIFI_PROCESS =false;
-//public static long TIME_SINCE_LAST_GEO_UPDATE=System.currentTimeMillis() -LAST_GEO_UPDATE ;
-public static boolean NETWORK_LOCATION_FOR_GEO=false;
-public static boolean NETWORK_LOCATION_FOR_LOCATION=false;
-
-public static boolean IS_PROCESSING_GEO_FOOTMARK=false;
-
-public static int TRACK_NUMBERS_IN_STATISTICS_CHART=10;
-
-
-public static int WIFI_CONNECT_CHANGE_INTERVAL =1;//1分钟内不接受WIFI接入事件
-public static int OFFMAP_UPDATE_INTERVAL =10;//20分钟内不接受因网络变化发生的geo地图数据更新.
-public static int GEO_UPDATE_INTERVAL =DEVELOPER_MODE?1:5;//10分钟内不接受因网络变化发生的geo地图数据更新.
-public static boolean PROCESS_ALLTRACK_GEO_FOOTMARK= false;//DEVELOPER_MODE;
-public static boolean IS_TEST_NAV=true;//DEVELOPER_MODE;
-
-
-
-public static String JSONOBJECT_KEY="jokey";
-public static String MSG_KEY="msgkey";
-public static String SIGN_KEY="signkey";
-public static String SIMPLE_KEY="simplekey";
-
-public static String MAP_PIC_WATER_MARK_WORDS="快乐运动,爱骑驴 \n www.i7lv.com";
-public static String MAP_PIC_WATER_MARK_PIC=" ";
-
-}
diff --git a/qy/src/main/java/com/qiyou/mb/android/beans/.gitignore b/qy/src/main/java/com/qiyou/mb/android/beans/.gitignore
deleted file mode 100644
index ee4c926..0000000
--- a/qy/src/main/java/com/qiyou/mb/android/beans/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/test
diff --git a/qy/src/main/java/com/qiyou/mb/android/beans/Footmark.java b/qy/src/main/java/com/qiyou/mb/android/beans/Footmark.java
deleted file mode 100644
index c7d90fa..0000000
--- a/qy/src/main/java/com/qiyou/mb/android/beans/Footmark.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.qiyou.mb.android.beans;
-
-import java.util.ArrayList;
-
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.google.gson.Gson;
-import com.qiyou.mb.android.beans.basic.Footmark_bean;
-import com.qiyou.mb.android.utils.Utils;
-
-public class Footmark {
- public static String TAG ="com.qiyou.beans.footmark";
- public static String dTAG ="com.qiyou";
- public Footmark() {
- // TODO Auto-generated constructor stub
- }
-
- private ArrayList fbs;
- private String comment;
- private int trackId;
- private String name;
- private long time;
-
-
- public Footmark(String jsonFm){
- Gson gson = new Gson();
- try{
- if(!TextUtils.isEmpty(jsonFm)){
- Footmark fm = gson.fromJson(jsonFm, Footmark.class);
- fbs = fm.getFbs();
- trackId=fm.getTrackId();
- name=fm.getName();
- time=fm.getTime();
- comment=fm.getComment();
- }
- }catch(Exception e) {
- Utils.logStackTrace(e, dTAG);
- if(!TextUtils.isEmpty(jsonFm)){
- Log.e(dTAG,TAG + " Json to footmark error--------------as below json ----" );
- Log.e(dTAG ,TAG+ jsonFm );
- }
- }
- }
-
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-
- public ArrayList getFbs() {
- return fbs;
- }
-
- public void setFbs(ArrayList fbs) {
- this.fbs = fbs;
- }
-
- public int getTrackId() {
- return trackId;
- }
- public void setTrackId(int trackId) {
- this.trackId = trackId;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public long getTime() {
- return time;
- }
- public void setTime(long time) {
- this.time = time;
- }
-
- public boolean toPdf(){
-
- return true;
- }
-
- public boolean tofile(){
-
- return true;
- }
-}
diff --git a/qy/src/main/java/com/qiyou/mb/android/beans/Group.java b/qy/src/main/java/com/qiyou/mb/android/beans/Group.java
deleted file mode 100644
index 16f6cca..0000000
--- a/qy/src/main/java/com/qiyou/mb/android/beans/Group.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package com.qiyou.mb.android.beans;
-
-import java.util.ArrayList;
-
-import com.qiyou.mb.android.beans.basic.Activity_bean;
-import com.qiyou.mb.android.beans.basic.Group_bean;
-
-public class Group {
-
- public Group() {
- // TODO Auto-generated constructor stub
- }
- private ArrayList users;
- private ArrayList activities;
- private Group_bean group_bean;
-
- public boolean join(){
- return true;
- }
-
- public boolean update(){
- return true;
- }
-
- public boolean create(){
- return true;
- }
-
- public boolean delete(){
- return true;
- }
-
-
- /**
- * @return the users
- */
- public ArrayList getUsers() {
- return users;
- }
- /**
- * @param users the users to set
- */
- public void setUsers(ArrayList users) {
- this.users = users;
- }
- /**
- * @return the activities
- */
- public ArrayList getActivities() {
- return activities;
- }
- /**
- * @param activities the activities to set
- */
- public void setActivities(ArrayList activities) {
- this.activities = activities;
- }
- /**
- * @return the group_bean
- */
- public Group_bean getGroup_bean() {
- return group_bean;
- }
- /**
- * @param group_bean the group_bean to set
- */
- public void setGroup_bean(Group_bean group_bean) {
- this.group_bean = group_bean;
- }
-
-
-}
diff --git a/qy/src/main/java/com/qiyou/mb/android/beans/Statistics.java b/qy/src/main/java/com/qiyou/mb/android/beans/Statistics.java
deleted file mode 100644
index e1a0f45..0000000
--- a/qy/src/main/java/com/qiyou/mb/android/beans/Statistics.java
+++ /dev/null
@@ -1,431 +0,0 @@
-package com.qiyou.mb.android.beans;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import com.qiyou.mb.android.beans.basic.BStatistics;
-import com.qiyou.mb.android.beans.basic.CItem;
-import com.qiyou.mb.android.beans.basic.StatTrack;
-import com.qiyou.mb.android.beans.basic.Statics_bean;
-import com.qiyou.mb.android.beans.basic.Track_bean;
-import com.qiyou.mb.android.beans.basic.TypeStatistics;
-import com.qiyou.mb.android.utils.enums.TrackAvStatus;
-import com.qiyou.mb.android.utils.enums.TrackType;
-import com.qiyou.mb.android.utils.log.QLog;
-
-public class Statistics extends BStatistics {
- public static String TAG ="com.qiyou.beans.Statistics";
- public static String dTAG ="com.qiyou";
-
-
-
-
- public void mergeTrack(Track track){
- if(track.getTrackBean().getAvStatus()==TrackAvStatus.ACTIVE){
- trackPlus( track);
- return;
- }
-
- //trackMinus(track); //when delete/inactive track,to reload the stats from db
-
- }
-
-
- private void minusType(Integer typeToRemove,int trackId){
- if(typeToRemove>-1 &&statisticsTracks.get(typeToRemove)!=null){ //to remove from the old type list
- statisticsTracks.get(typeToRemove).getSbs().remove(Integer.valueOf(trackId));
- cnt--;
-// QLog.getLogger().d(dTAG, TAG+" MergeTrack: statisticsTracks.get(location).getSbs().size()==0?:" +(statisticsTracks.get(typeToRemove).getSbs().size()==0));
-
- Integer position =positionInTypeUsedLst(typeToRemove);
-
- if(statisticsTracks.get(typeToRemove).getSbs().size()==0){
-
-// QLog.getLogger().d(dTAG, TAG+" MergeTrack: before del getTypeUsedLst().size() ?:" + getTypeUsedLst().size());
-// QLog.getLogger().d(dTAG, TAG+" MergeTrack: before del gStatisticsTracks.size() ?:" + statisticsTracks.size());
-// QLog.getLogger().d(dTAG, TAG+" MergeTrack: type to delete,position to delete?:" + typeToRemove +","+positionInTypeUsedLst(typeToRemove));
-
-// getTypeUsedLst().remove( new CItem(String.valueOf(typeToRemove),TrackType.valueOf(typeToRemove).toCHString()));
- getTypeUsedLst().remove(getTypeUsedLst().get(position));
-// statisticsTracks.get(location).setStatTrack(new StatTrack());
- statisticsTracks.remove(typeToRemove);
-
-// QLog.getLogger().d(dTAG, TAG+" MergeTrack: after del getTypeUsedLst().size() ?:" + getTypeUsedLst().size());
-// QLog.getLogger().d(dTAG, TAG+" MergeTrack: after del gStatisticsTracks.size() ?:" + statisticsTracks.size());
-
- }else if(position > 0 && getTypeUsedLst().get(position).getCnt()>1) { //sbs not blank
-
- getTypeUsedLst().get(position).setCnt(getTypeUsedLst().get(position).getCnt()-1);
- }
- }
- }
-
- public void trackMinus(Track track){
-
- Integer typeToRemove =track.getTrackBean().getType().toInt();
- int trackId=track.getTrackBean().getTrackId() ;
- if(trackId<=0){
- return;
- }
- TypeStatistics stat =getStatisticsTracks().get(Integer.valueOf(typeToRemove));
- if(stat==null)return;
-
- minusType(typeToRemove,trackId);
-
-
- //set last id
- if(stat.getTrackIds().size()>0 && stat.getTrackIds().contains(Integer.valueOf(trackId)) && stat.getTrackIds().get(Integer.valueOf(trackId))!=null){
-
- int miner =stat.getTrackIds().get(Integer.valueOf(trackId));
- int bigger =0;
- for(int i:stat.getTrackIds().keySet()){
- if(i>trackId && trackId==stat.getTrackIds().get(Integer.valueOf(i))){
- bigger=i;
- stat.getTrackIds().put(bigger, miner);
- if(track.getTrackBean().getEndTime() ==lastTime)
- lastTime=stat.getSbs().get(Integer.valueOf(bigger)).getEndTime();
-
- break;
- }
- }
-
-
- }
-
-
- if(track.getTrackBean().getType()!=TrackType.GPX)
- mergeTrackValues(stat ,track);
-
- stat.getSbs().remove(Integer.valueOf(trackId));
-
-
-
- }
-
- public void trackPlus(Track track){
- if(track ==null || track.getTrackBean().getTrackId()==0)return;
- int trackId=track.getTrackBean().getTrackId() ;
- int type =track.getTrackBean().getType().toInt();
-
- TypeStatistics stat =getStatisticsTracks().get(Integer.valueOf(type));
- QLog.getLogger().dLog(dTAG, TAG+" mergeTrack type " + track.getTrackBean().getType().toCHString());
- QLog.getLogger().dLog(dTAG, TAG+" mergeTrack Dist:trackId " + trackId);
- QLog.getLogger().dLog(dTAG, TAG+" mergeTrack Dist: stat==null " + (stat==null));
- if(stat==null){
- stat = new TypeStatistics(100,track.getTrackBean().getStartTime(),type);
-
- }
-
- boolean isExist =stat.getSbs().get(Integer.valueOf(trackId))!=null;
-
-// QLog.getLogger().d(dTAG, TAG+" mergeTrack: isExist?" +isExist );
-
- if(!isExist){
-
- cnt++;
-
- Integer typeToRemove =-1;
- for(Integer i:statisticsTracks.keySet()){
-// QLog.getLogger().d(dTAG, TAG+" MergeTrack: type:" +TrackType.valueOf(i).toCHString() );
-// QLog.getLogger().d(dTAG, TAG+" MergeTrack: track exist in type list?:" +statisticsTracks.get(i).getSbs().keySet().contains(Integer.valueOf(trackId)) );
- if(statisticsTracks.get(i).getSbs().keySet().contains(Integer.valueOf(trackId))){
-
- stat.getSbs().put(trackId, statisticsTracks.get(i).getSbs().get(Integer.valueOf(trackId)));
-
- typeToRemove =Integer.valueOf(i);
- break;
-
- }
-
- }
-// QLog.getLogger().d(dTAG, TAG+" MergeTrack: statisticsTracks.get(location)!=null?,location is" +typeToRemove+","+ (statisticsTracks.get(typeToRemove)!=null ));
-
- //in case track type changed from one type to another.
- if(typeToRemove>-1 &&statisticsTracks.get(typeToRemove)!=null){ //to remove from the old type list
- /*statisticsTracks.get(typeToRemove).getSbs().remove(Integer.valueOf(trackId));
- cnt--;
- QLog.getLogger().d(dTAG, TAG+" MergeTrack: statisticsTracks.get(location).getSbs().size()==0?:" +(statisticsTracks.get(typeToRemove).getSbs().size()==0));
-
- Integer position =positionInTypeUsedLst(typeToRemove);
-
- if(statisticsTracks.get(typeToRemove).getSbs().size()==0){
-
- QLog.getLogger().d(dTAG, TAG+" MergeTrack: before del getTypeUsedLst().size() ?:" + getTypeUsedLst().size());
- QLog.getLogger().d(dTAG, TAG+" MergeTrack: before del gStatisticsTracks.size() ?:" + statisticsTracks.size());
-
- QLog.getLogger().d(dTAG, TAG+" MergeTrack: type to delete,position to delete?:" + typeToRemove +","+positionInTypeUsedLst(typeToRemove));
-
-// getTypeUsedLst().remove( new CItem(String.valueOf(typeToRemove),TrackType.valueOf(typeToRemove).toCHString()));
- getTypeUsedLst().remove(getTypeUsedLst().get(position));
-// statisticsTracks.get(location).setStatTrack(new StatTrack());
- statisticsTracks.remove(typeToRemove);
-
- QLog.getLogger().d(dTAG, TAG+" MergeTrack: after del getTypeUsedLst().size() ?:" + getTypeUsedLst().size());
- QLog.getLogger().d(dTAG, TAG+" MergeTrack: after del gStatisticsTracks.size() ?:" + statisticsTracks.size());
-
- }else if(getTypeUsedLst().get(position).getCnt()>1) { //sbs not blank
-
- getTypeUsedLst().get(position).setCnt(getTypeUsedLst().get(position).getCnt()-1);
- }*/
- minusType(typeToRemove,trackId);
- }else{ //just a new one.
-
-
- }
-
- if(type!=TrackType.GPX.toInt()) {
-
- if(!typeExitsInTypeUsedLst(type)){
- CItem c =new CItem(String.valueOf(track.getTrackBean().getType().toInt()),track.getTrackBean().getType().toCHString());
- c.setCnt(1);
- // if(typeUsedLst==null || !typeExitsInTypeUsedLst(track.getTrackBean().getType().toInt())){
- getTypeUsedLst().add(c);
- // }
-
- if(firstTime==0 ||firstTime>0 && firstTime0 && !stat.getTrackIds().contains(Integer.valueOf(trackId))){
-
- int max=0;
- for(int i:stat.getTrackIds().keySet()){
- max=maxmax){
- stat.getTrackIds().put(trackId, max);
- QLog.getLogger().dLog(dTAG, TAG+" 1 set last id: trackId>max:" + (trackId>max));
- }
-
-
- }
-
- }
-
-// if(stat.getSbs().get(Integer.valueOf(trackId))==null){
-
-
-
-// stat.getStatTrack().mergeTrack(track);
- if(track.getTrackBean().getType()!=TrackType.GPX)
- mergeTrackValues(stat ,track);
-
- if(!stat.getTrackIds().containsKey(Integer.valueOf(trackId))){
- QLog.getLogger().dLog(dTAG, TAG+"2 current track id:" + trackId);
- QLog.getLogger().dLog(dTAG, TAG+"2 last track id:" + getLastTrackId());
- stat.getTrackIds().put(trackId, getLastTrackId());
-
- }
-
- this.setLastTrackId(trackId);
-
- stat.getSbs().put(trackId, new Statics_bean(track.getTrackBean()));
-// setMaxAvStat(stat.getStatTrack());
- if(lastTime==0 ||lastTime>0 && lastTime>changedCates,Boolean isNew){
- categoryList= getCategoryList();
- ArrayList cates;
- boolean hasChg = false;
- for(Integer trackId: changedCates.keySet()){
- cates =changedCates.get(trackId);
- if(cates==null)continue;
- if(trackId==0 && isNew){
-
- }
-
-
- for(String cate:categoryList.keySet()){
- if(!isNew &&cates.contains(cate)){ //del
-// QLog.getLogger().d(dTAG, " .................removing cates trackId ?"+trackId);
- categoryList.get(cate).remove(Integer.valueOf(trackId));
- hasChg=true;
- continue;
- }
- if(isNew&&cates.contains(cate)){
- if(!categoryList.get(cate).contains(Integer.valueOf(trackId)) ||trackId==0){
- if(!categoryList.get(cate).contains(Integer.valueOf(trackId)))
- categoryList.get(cate).add(Integer.valueOf(trackId));
- hasChg=true;
-// QLog.getLogger().d(dTAG, " .................adding cates trackId ?"+trackId);
- }
- }
-
- }
- }
- return hasChg;
-}
-
-
-
-}
diff --git a/qy/src/main/java/com/qiyou/mb/android/beans/Track.java b/qy/src/main/java/com/qiyou/mb/android/beans/Track.java
deleted file mode 100644
index 2284a20..0000000
--- a/qy/src/main/java/com/qiyou/mb/android/beans/Track.java
+++ /dev/null
@@ -1,2509 +0,0 @@
-/**
- *
- */
-package com.qiyou.mb.android.beans;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.alternativevision.gpx.beans.GPX;
-
-import android.location.Location;
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
-import com.qiyou.mb.android.QiYouConstant;
-import com.qiyou.mb.android.beans.basic.GEOaddress;
-import com.qiyou.mb.android.beans.basic.Media;
-import com.qiyou.mb.android.beans.basic.Track_bean;
-import com.qiyou.mb.android.beans.basic.Waypoint;
-import com.qiyou.mb.android.beans.basic.Waypoint_bean;
-import com.qiyou.mb.android.utils.Utils;
-import com.qiyou.mb.android.utils.enums.TrackStatus;
-import com.qiyou.mb.android.utils.enums.TrackType;
-import com.qiyou.mb.android.utils.enums.mediaStatus;
-import com.qiyou.mb.android.utils.enums.mediaType;
-import com.qiyou.mb.android.utils.enums.wpFlag;
-import com.qiyou.mb.android.utils.log.QLog;
-//import org.alternativevision.gpx.GPXParser;
-//import com.baidu.a.a.a.a;
-
-/**
- * @author mwang
- *
- *一次骑行/运动记录
- */
-public class Track {
- public static String TAG ="com.qiyou.beans.Track";
- public static String dTAG ="com.qiyou";
- private Track_bean tb;
- private Waypoint _lastWp;
- private Waypoint _startWp;
- private String _lastWpJson;
- private String _startWpJson;
- private StringBuffer wpsJson ; //wps 原始 Json ;和数据库里保存的track content字段内容一致.
-// private Waypoint _lastRoadBear;
- private String _lastRbJson="";
- private StringBuffer _roadBook = new StringBuffer();
- private StringBuffer _rdWpsJson = new StringBuffer();
- private StringBuffer _mdWpsJson = new StringBuffer();
-// public ArrayList roadWps = new ArrayList();
- private String _maxDistWpJson;
- private Waypoint _maxDistWp;
- private double maxR;
- public StringBuffer newMdWpsJson = new StringBuffer();
-
- public Track()
- {
- tb = new Track_bean();
- tb.setUserid(QiYouConstant.PV_USER_ID);
- }
-
- public Track(String jsonTrack){
- Gson gson = new Gson();
- try{
- tb = gson.fromJson(jsonTrack, Track_bean.class);
- }catch(Exception e)
- {
- Utils.logStackTrace(e, dTAG);
- }
- }
- public Track(Track_bean track_bean)
- {
- if (track_bean == null)
- {
- this.tb = new Track_bean();
- this.tb.setUserid(QiYouConstant.PV_USER_ID);
- return;
- }
-
- this.tb = track_bean;
- this._startWp = this.tb.getStartWp();
- this._lastWp = this.tb.getLastWp();
- this._maxDistWp = this.tb.getMaxDistWp();
-
-// QLog.getLogger().d(dTAG, " mtrack_bean startwp: "+mTrack_bean.getStartWp().toString());
-// QLog.getLogger().d(dTAG, " mtrack_bean endwp: "+mTrack_bean.getLastWp().toString());
-// QLog.getLogger().d(dTAG, " mtrack_bean endwp: "+mTrack_bean.getLastWp().toString());
-// getTrackBean().getTrkseg().clear();
-// QLog.getLogger().d(dTAG, " loaded track is"+this.toGsonString());
-
-
- }
-// public Track(GPX gpx){
-// pareseGpx( gpx);
-// }
-
- public Track(int trackId, boolean isAssembleContent,String rdWpsJson,String mdWpsJson){
- getTrackBean().setTrackId(trackId);
- if(isAssembleContent)
- assemblyContent();
- if(TextUtils.isEmpty(rdWpsJson)){
- assemblyBearContent();
- }
- pareseTrack(null, null, rdWpsJson, mdWpsJson);
-
- }
-
- public Track(int trackId,String jsonTrack, String jsonWps,String rdWpsJson,String mdWpsJson){
- getTrackBean().setTrackId(trackId);
- if(TextUtils.isEmpty(rdWpsJson)){
- assemblyBearContent();
- }
- pareseTrack(jsonTrack, jsonWps, rdWpsJson, mdWpsJson);
-
- }
- /*
- * jsonTrack can be null
- */
- public Track(String jsonTrack, String jsonWps,String rdWpsJson,String mdWpsJson){
-
- pareseTrack(jsonTrack, jsonWps, rdWpsJson, mdWpsJson);
-
- }
-
- void pareseTrack(String jsonTrack, String jsonWps,String rdWpsJson,String mdWpsJson){
- Gson gson = new Gson();
- try{
- if(!TextUtils.isEmpty(jsonTrack)){
- tb = gson.fromJson(jsonTrack, Track_bean.class);
- return;
- }
- else getTrackBean();//tb = new Track_bean();
- String json="";
- //检查 json 格式,应该为[{...},{...}]格式
-// wpsJson = new StringBuffer();
-// wpsJson.append(jsonWps); //put it before convert to wps, in case failed, then recovery track will miss existed wps in db.
- if(!TextUtils.isEmpty(jsonWps)){
-// json= jsonWps.replace("[","").replace("]", "").replace(" ","").replace("}{", "},{").replace("null", "");
- json=getCleanJson(jsonWps);
-
- wpsJson = new StringBuffer();
- wpsJson.append(json); //put it before convert to wps, in case failed, then recovery track will miss existed wps in db.
- // tb.setTrksegs(wps);
- if(!json.startsWith("["))
- json ="["+json ;
- if(!json.endsWith("]")){
- json =json+"]";
- }
- tb.setTrksegs(getWPS(gson,json));
- wpsJson=new StringBuffer(); //TODO check if it will cause : //put it before convert to wps, in case failed, then recovery track will miss existed wps in db.
- }
- if(!TextUtils.isEmpty(rdWpsJson)){
-// json= rdWpsJson.replace("[","").replace("]", "").replace(" ","").replace("}{", "},{").replace("null", "");;
- json=getCleanJson(rdWpsJson);
-// json= rdWpsJson.replace(" ","");
- if(!json.startsWith("["))
- json ="["+json ;
- if(!json.endsWith("]")){
- json =json+"]";
- }
-// roadWps =getWPS(gson,jsonWps);
- tb.setRoadWps(getWPS(gson,json));
- }
- if(!TextUtils.isEmpty(mdWpsJson) && mdWpsJson.length()>1){
-// _mdWpsJson.append(mdWpsJson);
-// json= mdWpsJson.replace("[","").replace("]", "").replace(" ","");
- json= mdWpsJson.replace(" ","").replace("}{", "},{").replace("null", "").replace("}]{" ,"},{").replace("[]" ,"");
- if(!json.startsWith("["))
- json ="["+json ;
- if(!json.endsWith("]")){
- json =json+"]";
- }
-// QLog.getLogger().d(dTAG, TAG+" setMdWps: "+ tb.getTrackId() +", track status is" +tb.getStatus());
- tb.setMdWps(getWPS(gson,json));
- }
-
-
-
-
- //wpsJson 初始化,为继续采集/更新gps位置信息(wps)做准备.
-// wpsJson = new StringBuffer();
-// wpsJson.append(jsonWps);
- }catch(Exception e)
- {
- Utils.logStackTrace(e, dTAG);
- if(!TextUtils.isEmpty(jsonTrack)){
- Log.e(dTAG,TAG + " Json to track error--------------as below jsonTrack----" );
- Log.e(dTAG ,TAG+ jsonTrack );
- }
- if(!TextUtils.isEmpty(jsonWps)){
- Log.e(dTAG ,TAG+"below is wps jsonWps---------------");
- Log.e(dTAG ,TAG+ jsonWps );
- }
-
-
- }
- }
-
- String getCleanJson(String json){
-
- json = json.replace("[","").replace("]", "").replace(" ","").replace("}{", "},{").replace("null", "");
-// json = json.replace(" ","").replace("}{", "},{").replace("null", "");
-// json ="["+json+"]";
- return json;
- }
- /*CopyOnWriteArrayList getWPS(Gson gson, String jsonWps) throws Exception{
- CopyOnWriteArrayList wps = new CopyOnWriteArrayList();
- try{
- Type type = new TypeToken>(){}.getType();
- wps = gson.fromJson(jsonWps,type);
- }catch(Exception e)
- {
- //throw e;
- Log.e(dTAG,TAG+"Track "+ tb.getTrackId() +" getWPS error: "+ jsonWps);
- wps =buildWps(jsonWps);
-
- }
-// dwps =buildWps(jsonWps);
- return wps;
-
-
- }*/
-
- ArrayList getWPS(Gson gson, String jsonWps) throws Exception{
- ArrayList wps = new ArrayList();
- try{
- Type type = new TypeToken< ArrayList>(){}.getType();
- wps = gson.fromJson(jsonWps,type);
- }catch(Exception e)
- {
- //throw e;
- Log.e(dTAG,TAG+"Track "+ tb.getTrackId() +" getWPS error: "+ jsonWps);
- wps =buildWps(jsonWps);
-
- }
-// dwps =buildWps(jsonWps);
- return wps;
-
-
- }
-
- /*CopyOnWriteArrayList buildWps(String jsonWps) {
-
- CopyOnWriteArrayList wps = new CopyOnWriteArrayList();
-// jsonWps= jsonWps.replace("[","").replace("]", "").replace(" ","").replace("}{", "},{");
- jsonWps= jsonWps.replace(" ","").replace("}{", "},{");
- String[] wpsS = jsonWps.split("\\}\\,\\{");
- String tmp = null;
- for(String json : wpsS){
- tmp = json;
- json =json.endsWith("}")?json: json.endsWith("},")?json:json+"}";
- json =json.startsWith("[")?json.substring(1,json.length()):json.endsWith("]") ?json.substring(0,json.length()-1):json;
- json =json.startsWith("{")?json:json.startsWith(",{")?json:"{"+json;
- try{
-// tmp = json;
- wps.add( new Waypoint(json).getWb());
- }
- catch (Exception e){
- Log.e(dTAG,TAG+ " buildWps error for json: "+ tmp);
- Log.e(dTAG,TAG+ " Track "+ tb.getTrackId() +" buildWps error: "+ json);
- Utils.logStackTrace(e, TAG);
- Log.e(dTAG,e.getLocalizedMessage());
- }
-
- }
- return wps;
- }*/
-
-
- ArrayList buildWps(String jsonWps) {
-
- ArrayList wps = new ArrayList();
-// jsonWps= jsonWps.replace("[","").replace("]", "").replace(" ","").replace("}{", "},{");
- jsonWps= jsonWps.replace(" ","").replace("}{", "},{");
- String[] wpsS = jsonWps.split("\\}\\,\\{");
- String tmp = null;
- for(String json : wpsS){
- tmp = json;
- json =json.endsWith("}")?json: json.endsWith("},")?json:json+"}";
- json =json.startsWith("[")?json.substring(1,json.length()):json.endsWith("]") ?json.substring(0,json.length()-1):json;
- json =json.startsWith("{")?json:json.startsWith(",{")?json:"{"+json;
- try{
-// tmp = json;
- wps.add( new Waypoint(json).getWb());
- }
- catch (Exception e){
- Log.e(dTAG,TAG+ " buildWps error for json: "+ tmp);
- Log.e(dTAG,TAG+ " Track "+ tb.getTrackId() +" buildWps error: "+ json);
- Utils.logStackTrace(e, TAG);
- Log.e(dTAG,e.getLocalizedMessage());
- }
-
- }
- return wps;
- }
-
-
- public static Track newInstance(String gpxFile){
-// GPX gpx=Utils.pareseGpx(gpxFile);
-// Track tr = new Track(Utils.pareseGpx(gpxFile));
-// tr.getTrackBean().setSrc(gpxFile);
-
- Track tr = new Track();
- /*if(tr.pareseGpx(gpx)){
- tr.getTrackBean().setSrc(gpxFile);
- return tr;
- }else return null;*/
- if(tr.pareseGpx(gpxFile)){
- return tr;
- }else return null;
-
- }
- public boolean pareseGpx(String gpxFileName){
-// public boolean pareseGpx(GPX gpx){
- try{
-
- long t1 =System.currentTimeMillis();
-
- GPX gpx=Utils.pareseGpx(gpxFileName);
- long t2 =System.currentTimeMillis();
- // QLog.getLogger().d(dTAG, "pares gpx time 1: "+ Utils.getTimeCnt(t2-t1, true));
- if(gpx==null)return false;
- org.alternativevision.gpx.beans.Track gpxTr = null;
- while(gpx.getTracks().iterator().hasNext()){
- gpxTr =gpx.getTracks().iterator().next();
- if(gpxTr!=null)
- break; //support only one track,currently.
- }
- if(gpxTr==null)return false;
-
-
- tb =new Track_bean();
- tb.setCreator(gpx.getCreator());//gpx.getCreator());
- tb.setCreatTime(System.currentTimeMillis());
- tb.setName(gpxTr.getName());
- tb.setComment(gpxTr.getComment());
- tb.setDescription(gpxTr.getDescription());
- tb.setType(TrackType.GPX);
- tb.setSrc(gpxFileName);
- long t3 =System.currentTimeMillis();
- // QLog.getLogger().d(dTAG, "pares gpx time 2: "+ Utils.getTimeCnt(t3-t2, true));
- ArrayList gpxWps = gpxTr.getTrackPoints();
- Waypoint lastwp=null;
- float dist=0f;
- long sumdist=0;
- float eDist=0f;
- final float avSpeed=20f/3600f;//米/毫秒
- long lasttime=0;
- for(org.alternativevision.gpx.beans.Waypoint gpxWp:gpxWps){
- Waypoint wp = new Waypoint();
-
- wp.getWb().setDesc(gpxWp.getDescription());
- if(gpxWp.getLatitude()!=null)
- wp.getWb().setLatitude( (gpxWp.getLatitude().floatValue()));
- if(gpxWp.getLongitude()!=null)
- wp.getWb().setLongitude( (gpxWp.getLongitude().floatValue()));
- wp.getWb().setComment(gpxWp.getComment());
- if(gpxWp.getElevation()!=null)
- wp.getWb().setElevation(gpxWp.getElevation().floatValue());
- if(gpxWp.getSpeed()!=null)
- wp.getWb().setSpeed(gpxWp.getSpeed().floatValue()*3.6f);
- if(gpxWp.getTime()!=null){
- if(gpxWp.getTime().getTime()>0)
- wp.getWb().setTime(gpxWp.getTime().getTime());
- else{
-
- long time_interval =(long)(dist/avSpeed);
- // QLog.getLogger().d(dTAG,TAG+" interval is "+time_interval);
- lasttime=lasttime>0?lasttime:System.currentTimeMillis();
- wp.getWb().setTime(lasttime+time_interval);
- }
- }
-
- if(lastwp!=null){
- dist =(float) Utils.getDistanceFromXtoY(wp.getWb().getLatitude(), wp.getWb().getLongitude(), lastwp.getWb().getLatitude(), lastwp.getWb().getLongitude());
- sumdist+=dist;
- eDist=wp.getWb().getElevation()-lastwp.getWb().getElevation();
- lasttime=wp.getWb().getTime();
- }
-
- wp.getWb().setDistance(dist);
- wp.getWb().setSumDist(sumdist);
- wp.getWb().setEled(eDist);
-
- String gPics=gpxWp.getPics();
- if(!TextUtils.isEmpty(gPics)){
- String gpxPath=gpxFileName.substring(0,gpxFileName.lastIndexOf("/")+1);
-
- String[] pics;
- if(gPics.contains(","))
- pics = gPics.split(",");
- else if(gPics.contains(";")){
- pics = gPics.split(";");
- }else
- pics = gPics.split(",");
-
- if(pics!=null && pics.length>0){
- for(String url :pics){
- this.setMd(gpxPath+url, null, mediaType.PIC);
- // QLog.getLogger().d(dTAG,TAG+" added PIC to gpxTrack \n "+ gpxPath+url);
- }
- }
- }
- setLastWp( wp);
-
- /*_lastWpJson=wp.toJsonWp();
- if( setLastWp( wp) ){
- if (TextUtils.isEmpty(_startWpJson ) || wpsJson ==null){
- _startWpJson = _lastWpJson;
- wpsJson = new StringBuffer();
- }
-
- wpsJson.append(_lastWpJson);
- wpsJson.append(",");
- }*/
-
- lastwp =wp;
- }
-
-
- getJsonWps().append(wps2json(tb.getTrkseg()));
-
- long t4 =System.currentTimeMillis();
- // QLog.getLogger().d(dTAG, "pares gpx time 3: "+ Utils.getTimeCnt(t4-t3, true));
- if(_maxDistWp!=null){
- _maxDistWp.getWb().setTurnFlag(wpFlag.MAXR);
- setLastRoadBear(_maxDistWp);
- // QLog.getLogger().d(dTAG,TAG+" set marR WP to the roadbear \n "+ _maxDistWp.toString());
- }
-
- if(_lastWp!=null){
- _lastWp.getWb().setTurnFlag(wpFlag.END);
- setLastRoadBear(_lastWp);
- // QLog.getLogger().d(dTAG,TAG+" set last WP to the roadbear \n "+ _lastWp.toString());
- }
- setBearWps(tb.getRoadWps());
-
- long t5 =System.currentTimeMillis();
-
- // QLog.getLogger().d(dTAG, "pares gpx time 4: "+ Utils.getTimeCnt(t5-t4, true));
- }catch(Exception e)
- {
- Utils.logStackTrace(e, dTAG);
- return false;
- }
- return true;
- }
-
- public boolean mergeTrack(int trackId){
-
-
- Utils.getContentPah(trackId);
- StringBuffer wpsJson;
- if(trackId<=0)
- return false;
- else{
- wpsJson=new StringBuffer();
- try {
-
- wpsJson.append(Utils.readSDFile(getContentPah()));
- } catch (IOException e) {
- Utils.logStackTrace(e, TAG);
- }
- }
-
- String json=wpsJson.toString();
-// CopyOnWriteArrayList inWps = null;
- ArrayList inWps = null;
- if(!TextUtils.isEmpty(json)){
- json=getCleanJson(json);
- if(!json.startsWith("["))
- json ="["+json ;
- if(!json.endsWith("]")){
- json =json+"]";
- }
- try {
- inWps = getWPS( new Gson(),json);
- } catch (Exception e) {
- Utils.logStackTrace(e, dTAG);
- if(!TextUtils.isEmpty(json)){
- Log.e(dTAG ,TAG+" below is wps jsonWps---------------");
- Log.e(dTAG ,TAG+ json );
- }
- }
- }
-
- Waypoint wp;
- float oDist=tb.getDistance();
- for(Waypoint_bean wb:inWps){
- wb.setSumDist(wb.getSumDist()+oDist);
- wp=new Waypoint();
- wp.setWb(wb);
- this.setLastWp(wp);
- wpsJson.append(wp.toString());
- wpsJson.append(",");
- }
-
-// return QiYouConstant.CONTENT_SD_DIR + getTrackBean().getTrackId()+".txt";
-
-
-
-
- return true;
- }
-
- public boolean mergeTrack(Track mTrack){
- if(mTrack==null)return false;
-
- Waypoint wp;
- float oDist=tb.getDistance();
- for(Waypoint_bean wb:mTrack.getTrackBean().getTrkseg()){
- wb.setSumDist(wb.getSumDist()+oDist);
- wp=new Waypoint();
- wp.setWb(wb);
- this.setLastWp(wp);
- }
- wpsJson.append(mTrack.getJsonWps());
- return true;
- }
-
-
- /**
- * @return the tb
- */
- public Track_bean getTrackBean() {
- if(tb ==null) tb = new Track_bean();
- return tb;
- }
-
- /**
- * @param tb the tb to set
- */
- public void setTrackBean(Track_bean tb) {
- this.tb = tb;
- }
-
- /*
- * return string generated by Gson for the referenced track_bean
- */
- public String toGsonString()
- {
-// long bfdbTime = System.currentTimeMillis();
- String strwb ="";
- // if(null != tb.getNumber())
- {
- Gson gson = new Gson();
- try{
- strwb = gson.toJson(tb);
- /* if(QiYouConstant.DEVELOPER_MODE)
- {
- QLog.getLogger().d(dTAG ,TAG+" 准备 track to json 耗时: " +String.valueOf((System.currentTimeMillis()-bfdbTime)) + "毫秒");
-
- }*/
- }catch(Exception e)
- {
-
- Utils.logStackTrace(e, dTAG);
- }
-
- }
- // Log.e(TAG,strwb);
- return strwb;
- }
-
- /**
- * Returns a JSON String representation of referenced track_bean.
- */
- @Override
- public String toString() {
- return toGsonString();
- /*StringBuffer sb = new StringBuffer();
- sb.append("{");
- sb.append("name:"+tb.getName()+",");
- sb.append("cmt:" + tb.getComment() + ",");
- sb.append("desc"+tb.getDescription() + ",");
- sb.append("src:"+tb.getSrc() +",");
- sb.append("number:"+tb.getNumber()+ ",");
- sb.append("type:"+tb.getType()+ ",");
- sb.append("trkseg:");
- sb.append("[");
- ArrayList wplst =tb.getTrkseg();
- if(null !=wplst )
- for(Waypoint wp:wplst)
- {
- sb.append(wp.toString());
- }
- sb.append("]");
- sb.append("}");
- //return sb.toString();
- */
-
- }
-
- public String toGpxString()
- {
-
-
- return null;
- }
-
- /**
- * @return the lastWp
- */
- public Waypoint getLastWp() {
- return _lastWp;
- }
-
-
-
- /**
- * add new waypoint to the track *
- * @param lastWp the lastWp to set
- *
- * return false when the wp is null or not a new wp.
- */
- public boolean setLastWp(Waypoint lastWp) {
- if(lastWp == null ||lastWp.getWb().getTime()==0)return false;
-
-// if(lastWp.getWb().getTime()_lastWp.getWb().getTime()){// ||QiYouConstant.DEVELOPER_MODE){
- _lastWp = lastWp;
- tb.setLastWp(_lastWp);
- tb.getTrkseg().add(_lastWp.getWb());
-// if(lastWp.getWb().getDistance()>=0)
-// tb.setDistance(tb.getDistance()+lastWp.getWb().getDistance()); //累加总里程, Meter
-
- if(lastWp.getWb().getSumDist()>tb.getDistance())
- tb.setDistance(lastWp.getWb().getSumDist()); //累加总里程, Meter
-
- tb.setPauseTime(tb.getPauseTime()+lastWp.getWb().getPauseTime());//累加暂停时间
-// if(lastWp.getWb().getTime()>tb.getEndTime())
- tb.setEndTime(lastWp.getWb().getTime());//更新 最后一个wp time
- // tb.setOffTime(tb.getOffTime()+lastWp.getWb().getOfftime()); // track offtime will be handled by force update
- if(lastWp.getWb().getElevation()!=0 && lastWp.getWb().getEled()>0){
- tb.seteUpDist(tb.geteUpDist()+lastWp.getWb().getEled()); //累加累积上升海拔高度
-
- }
- if(lastWp.getWb().getElevation()!=0 && lastWp.getWb().getEled()<0){
- tb.seteDownDist(tb.geteDownDist()+ lastWp.getWb().getEled()) ;//累加累积下降海拔高度
- }
-// if(lastWp.getWb().getSpeed() >tb.getTopSpeed())
- tb.setTopSpeed(lastWp.getWb().getSpeed());
- // if(lastWp.getWb().getRoadBear()!=0)setLastRoadBear(lastWp);
-
-// QLog.getLogger().dLog(dTAG, "set lastwp,lastWp.getWb().getTurnFlag()"+ lastWp.getWb().getTurnFlag());
- if(!tb.getRoadWps().contains(lastWp)
- && lastWp.getWb().getTurnFlag()!=wpFlag.NORMAL
- &&lastWp.getWb().getTurnFlag()!=wpFlag.CUST
- &&lastWp.getWb().getTurnFlag()!=wpFlag.TENT
- &&lastWp.getWb().getTurnFlag()!=wpFlag.REST
- )
- setLastRoadBear(lastWp);
- if(tb.getType()==TrackType.GPX && !TextUtils.isEmpty(lastWp.getWb().getComment())){
- lastWp.getWb().setRoadBook(lastWp.getWb().getComment());
- lastWp.getWb().setComment("");
- tb.getRoadWps().add(lastWp.getWb());
- }
-
- maxR=Utils.getDistanceFromXtoY(_lastWp.getWb().getLatitude(), _lastWp.getWb().getLongitude(), _startWp.getWb().getLatitude(), _startWp.getWb().getLongitude());
- if(maxR>tb.getMaxR() && maxR0 && lastWp.getWb().getTime() == _lastWp.getWb().getTime() ){
- _lastWp = lastWp;
- // wpsJson.replace(wpsJson., end, string)
- _lastWpJson=_lastWp.toString();
-
- int start = wpsJson.lastIndexOf("},{")+3;
- int end =wpsJson.length();
- //wpsJson.append(_lastWpJson);
- wpsJson.replace(start, end, _lastWpJson);
- wpsJson.append(",");
- // QLog.getLogger().d(dTAG ,TAG+" setLastWp, added medias"+_lastWpJson );
- return true;
- }
- else
- {
- Log.e(dTAG ,TAG+ " setLastWp, failed: new wp to set--->"+lastWp.toString());
- if(null != _lastWp){
- Log.e(dTAG ,TAG+ " track's _lastWp's time is: "+ _lastWp.getWb().getTime());
- }
- return false;
- }
- }
-
- /*
- * 新采集的wp加入到当前的轨迹中.
- * 有一次装箱操作
- */
- public boolean setLastWp(String jsonWp) {
- // Log.e(TAG +"set lastWp:" ,jsonWp);
- try{
- Waypoint wpobj = new Waypoint(jsonWp);
- _lastWpJson=jsonWp;
- if( setLastWp( wpobj) ){
- if (TextUtils.isEmpty(_startWpJson ) || wpsJson ==null){
- _startWpJson = jsonWp;
- wpsJson = new StringBuffer();
- }
-
- wpsJson.append(jsonWp);
- wpsJson.append(",");
- //Log.e(TAG +"track wps json:", wpsJson.toString());
- //Log.e(TAG +"set lastWp true:" ,jsonWp);
- return true;
-
- }else {
- // QLog.getLogger().d(dTAG,TAG +" set lastWp false:---->"+jsonWp);
- }
- }catch(Exception e){
- Log.e(dTAG ,TAG+ " setLastWp, failed: --->"+jsonWp );
- Utils.logStackTrace(e, dTAG);
- }
- return false;
- }
-
- /*
- * load last/first wp from db.
- */
- public void loadLastWp(String jsonWp) {
- // Log.e(TAG +"set lastWp:" ,jsonWp);
- try{
- Waypoint wpobj = new Waypoint(jsonWp);
- _lastWpJson=jsonWp;
- if (TextUtils.isEmpty(_startWpJson ) ){
- _startWpJson = jsonWp;
-
- }
- if(tb.getStartWp() ==null ||_startWp == null){
- _startWp =_startWp==null?wpobj:_startWp;
- if(tb.getStartWp() ==null)tb.setStartWp(_startWp);
- }
-
- _lastWp = wpobj;
- tb.setLastWp(_lastWp);
-
- }catch(Exception e){
- Log.e(dTAG ,TAG+ " setLastWp, failed: --->"+jsonWp );
- Utils.logStackTrace(e, dTAG);
- }
-
- }
-
-
-
- public Waypoint getStartWp() {
- return _startWp;
- }
- public void setStartWp(Waypoint wp) {
- _startWp =wp;
- }
-
-
- //TODO: check to use StringBuffer or just a String.
- public StringBuffer getJsonWps() {
- if (wpsJson ==null) wpsJson = new StringBuffer();
- return wpsJson;
- }
-
- public String getLastJsonWp() {
-
- if(TextUtils.isEmpty(_lastWpJson)){
- if( _lastWp !=null){
- _lastWpJson = _lastWp.toString();
- }
- }
- return _lastWpJson;
- }
-
- /*public void setLastWpJson(String lastWpJson) {
- setLastWp(lastWpJson);
-
- }
-*/
- public String getStartJsonWp() {
- if(TextUtils.isEmpty(_startWpJson )){
- if( _startWp !=null){
- _startWpJson = _startWp.toString();
- // QLog.getLogger().d(dTAG,TAG+" Start wp is null, set value as _startWpJson = _startWp.toString()");
- }else if(getJsonWps().length()>0){
- _startWpJson =wpsJson.substring(0,wpsJson.indexOf("},", 0)+1 );
- // QLog.getLogger().d(dTAG,TAG+" Start wp is null, set value as _startWpJson = wpsJson.substring");
- }else if (getTrackBean().getTrkseg().size()>0){
- Gson gson = new Gson();
- wpsJson.append(gson.toJson(getTrackBean().getTrkseg()));
- // QLog.getLogger().d(dTAG,TAG+" Start wp is null, set value as wpsJson = gson.toJson(getTrackBean().getTrkseg())");
- getStartJsonWp();
- }else if(!TextUtils.isEmpty(_lastWpJson )){
- _startWpJson =_lastWpJson;
- }
-
- }
- return _startWpJson;
- }
-
- public void startNewTrack(TrackType trackType)
- {
- tb = new Track_bean();
- tb.setCreatTime(System.currentTimeMillis());
- this.tb.setStatus(TrackStatus.RECORDING);
-// this.tb.setStartTime(System.currentTimeMillis());
- this.tb.setUserid(QiYouConstant.PV_USER_ID);
- this.tb.setDistance(0);
- this.tb.setGpsSpan(QiYouConstant.MAX_GPS_SPAN*QiYouConstant.WPS_SAVE_PERCENT_FACTOR);
- tb.setType(trackType);
-// this.tb.setComment("QiYouConstant.MAX_GPS_SPAN*QiYouConstant.WPS_SAVE_PERCENT_FACTORE: " +QiYouConstant.MAX_GPS_SPAN +","+ QiYouConstant.WPS_SAVE_PERCENT_FACTORE);
- }
-
-
-
-public void setLastRoadBear(Waypoint wp) {
-// QLog.getLogger().d(dTAG,TAG +" roadWps.size: "+roadWps.size());
- if(wp==null) return;
-
-
- if(tb.getRoadWps().size()==0){ //wp.getWb().getTurnFlag() ==0){// && !TextUtils.isEmpty(getStartJsonWp())){//first start wp
-// _lastRoadBear = wp;
- _startWp.getWb().setTurnFlag(wpFlag.START);
- tb.getRoadWps().add(_startWp.getWb());
- _lastRbJson =getStartJsonWp();// _startWpJson;
- _rdWpsJson.append(_lastRbJson);
-// saveBear(wp.getWb());
- return;
- }
-
- wpFlag turnFlag =wp.getWb().getTurnFlag();
-
-// QLog.getLogger().dLog(dTAG,"wp.getWb().getTurnFlag() is:" +turnFlag);
-
- if(turnFlag==wpFlag.TURNLEFT || turnFlag ==wpFlag.TURNRIGHT || turnFlag ==wpFlag.TURNBACK){ //针对普通左右掉头路点
- if(wp.getWb().getBearDist()==0) return;
- }
-
-
-
-
-// saveBear(wp.getWb());
-
-
-// String sb="\" "+ (tb.getRoadWps().size()-1 ) +". "+getBearMsg(wp.getWb().getRoadBear());
-// String sb="\" "+ (tb.getRoadWps().size()-1 ) +". " + getBearMsg(wp.getWb().getBearing());
-
-// String turn= wp.getWb().getTurnFlag()>0?wp.getWb().getTurnFlag()==1?"左转":"反向":"右转";
-// int turnFlag =tb.getRoadWps().get(tb.getRoadWps().size()).getTurnFlag();
-
-
-
- String sb="";
- if(turnFlag==wpFlag.TURNLEFT || turnFlag ==wpFlag.TURNRIGHT || turnFlag ==wpFlag.TURNBACK){ // turn bear wp
-
- if(wp.getWb().getBearDist()==0) return;
-
-// tb.getRoadWps().add(wp.getWb()); //add turn bear way point
-// Waypoint_bean lastBear=tb.getRoadWps().get(tb.getRoadWps().size()-2);
- Waypoint_bean lastBear=tb.getRoadWps().get(tb.getRoadWps().size()-1);
- if(lastBear==null) return;
-
-
- Location currentLocaiton = new Location("bear");
- currentLocaiton.setLatitude(wp.getWb().getLatitude());
- currentLocaiton.setLongitude(wp.getWb().getLongitude());
-
- Location lastLocation = new Location("bear");
- lastLocation.setLatitude(lastBear.getLatitude());
- lastLocation.setLongitude(lastBear.getLongitude());
-
- float bearDegree=lastLocation.bearingTo(currentLocaiton);
-
- String turn =turnFlag.toCHString();
-
-// QLog.getLogger().dLog(dTAG,"wp.getWb().getTurnFlag().toCHString() is:" +turn);
-
-
- String format = "\" 沿%s方向, 前行%s后%s";//,至%s处\"";
-
- sb =String.format(format
-// ,Utils.getBearMsg(lastBear.getBearing(),false)
- ,Utils.getBearMsg(bearDegree,false)
- ,Utils.getFormatedDistance( wp.getWb().getBearDist() )
- ,turn
-// ,Utils.getFormatedDistance( wp.getWb().getSumDist() )
- );
-
- /* if(wp.getWb().getBearDist()>1000)
- _roadBook.append(sb+"\n"); */
-
-// QLog.getLogger().dLog(dTAG," roadbook is: " +sb);
-
-// wp.getWb().setRoadBook(sb);
-// tb.getRoadWps().get(tb.getRoadWps().size()-1).setRoadBook(sb);
- lastBear.setRoadBook(sb);
- lastBear.setBearDist( wp.getWb().getBearDist() );
- tb.getRoadWps().add(wp.getWb()); //add turn bear way point
-
-
- // tb.getRoadWps().add(_lastRoadBear.getWb());
-// QLog.getLogger().d(dTAG, TAG+" _lastRbJson" +_lastRbJson);
- _lastRbJson = this._lastWpJson.replace("\"roadBook\":\"\",", "");
- _lastRbJson = _lastRbJson.substring(0, _lastRbJson.length()-1) + ",\"roadBook\":"+sb +"},";
-// QLog.getLogger().d(dTAG, TAG+" _lastRbJson" +_lastRbJson);
-// QLog.getLogger().dLog(dTAG," _lastRbJson is: " +_lastRbJson);
- _rdWpsJson.append(_lastRbJson);
-
- return;
-
- }else if(wp.getWb().getTurnFlag()==wpFlag.MAXR){ //maxR
- int i=0;
- for(Waypoint_bean wb:tb.getRoadWps()){
- if(wb==null)continue;
- if(wb.getSumDist()1){
-
- wp.getWb().setRoadBook("到达本次记录最远位置 \n距起点直线距离 "
- +Utils.getFormatedDistance( getTrackBean().getMaxR())
- +",运动距离 " + Utils.getFormatedDistance( wp.getWb().getSumDist()));
- tb.getRoadWps().add(i, wp.getWb());
- // QLog.getLogger().d(dTAG,TAG +" ......................到达本次记录最远位置" + Utils.getFormatedDistance( getTrackBean().getMaxR()));
-// _lastRbJson =wp.toString();
- break;
- }else{
- Log.e(dTAG,TAG+" Wrong wps....");
- i++;
- }
-
- }
- } else if(turnFlag==wpFlag.END){ //last wp
- sb="\" 到达本次记录的终点位置(结束)";
- wp.getWb().setRoadBook(sb);
- tb.getRoadWps().add(wp.getWb());
- _roadBook.append(sb);
-
- }
-
-
-}
-
-/*
- *gpx from aiqilv lushu
- */
-public boolean isGpx(){
- return tb.getType()==TrackType.GPX;
-}
-
-public boolean isLushu(){
- return tb.getCreator()!=null &&tb.getCreator().startsWith("爱骑驴路书");
- }
-
-private ArrayList mdList;
-/*
- * level : 0, standard GEO; 1: detail ; 2: pic only
- */
-public List