Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.dinopolis.gpstool
Class TrackManagerImpl  view TrackManagerImpl download TrackManagerImpl.java

java.lang.Object
  extended byorg.dinopolis.gpstool.TrackManagerImpl
All Implemented Interfaces:
GPSMapKeyConstants, TrackManager

public class TrackManagerImpl
extends java.lang.Object
implements TrackManager, GPSMapKeyConstants

Manages tracks and provides these to all modules. Internally, all org.dinopolis.gpstool.gpsinput.GPSTrack objects that are added or downloaded are converted to org.dinopolis.gpstool.track.Track objects, so they may be projected and printed.

Version:
$Revision: 1.8 $

Field Summary
(package private)  java.lang.String active_track_identifier_
           
(package private)  org.dinopolis.gpstool.gpsinput.GPSDataProcessor gps_data_processor_
           
(package private)  org.dinopolis.util.Resources resources_
           
(package private)  java.util.Vector track_listeners_
           
(package private)  java.util.Map track_map_
           
 
Fields inherited from interface org.dinopolis.gpstool.GPSMapKeyConstants
KEY_ALARM_FILE, KEY_ANGLE_FORMAT_HEADING, KEY_ANGLE_FORMAT_LATLON, KEY_ANGLE_FORMAT_VALID_FORMATS, KEY_CURRENT_GPS_POSITION_LATITUDE, KEY_CURRENT_GPS_POSITION_LONGITUDE, KEY_CURRENT_GPS_POSITION_REMEMBER_CURRENT_GPS_POSITION, KEY_CURRENT_MAP_POSITION_LATITUDE, KEY_CURRENT_MAP_POSITION_LONGITUDE, KEY_CURRENT_MAP_POSITION_REMEMBER_CURRENT_MAP_POSITION, KEY_CURSOR_PAN_ICON, KEY_CURSOR_ZOOM_IN_ICON, KEY_CURSOR_ZOOM_OUT_ICON, KEY_DEVELOPMENT_PLUGINS_CLASSLOADER_USE_DEFAULT_CLASSLOADER, KEY_FILE_LOCATION_DIR, KEY_FILE_LOCATION_FILENAME, KEY_FILE_MAINDIR, KEY_FILE_MAP_DESCRIPTION_FILE, KEY_FILE_MAP_DESCRIPTION_FILE_DETECT_CHANGES, KEY_FILE_MAP_DIR, KEY_FILE_MAP_FILENAME_PATTERN, KEY_FILE_MAP_FILENAME_PREFIX, KEY_FILE_PLUGIN_DIRS, KEY_FILE_TRACK_DIR, KEY_GPS_DEVICE_DATA_FILENAME, KEY_GPS_DEVICE_GPSD_HOST, KEY_GPS_DEVICE_GPSD_PORT, KEY_GPS_DEVICE_MODE, KEY_GPS_DEVICE_NMEA_DELAY, KEY_GPS_DEVICE_NMEA_IGNORE_CHECKSUM, KEY_GPS_DEVICE_NMEALOGFILE, KEY_GPS_DEVICE_PREFIX, KEY_GPS_DEVICE_PROTOCOL, KEY_GPS_DEVICE_SERIAL_PORT, KEY_GPS_DEVICE_SERIAL_SPEED, KEY_GPS_DEVICE_SERIAL_SPEED_DEFAULT_GARMIN, KEY_GPS_DEVICE_SERIAL_SPEED_DEFAULT_NMEA, KEY_GPS_DEVICE_SERIAL_SPEED_DEFAULT_SIRF2, KEY_GRATICULE_COLOR_FIVE_LINES, KEY_GRATICULE_COLOR_ONE_LINES, KEY_GRATICULE_COLOR_TEN_LINES, KEY_GRATICULE_DRAW_TEXT, KEY_GRATICULE_LAYER_ACTIVE, KEY_GRATICULE_LINES_THRESHOLD, KEY_HTTP_PROXY_AUTHENTICATION_PASSWORD, KEY_HTTP_PROXY_AUTHENTICATION_USE, KEY_HTTP_PROXY_AUTHENTICATION_USERNAME, KEY_HTTP_PROXY_HOST, KEY_HTTP_PROXY_PORT, KEY_HTTP_PROXY_PREFIX, KEY_HTTP_PROXY_USE, KEY_LOCALIZE_ALL, KEY_LOCALIZE_ALTITUDE, KEY_LOCALIZE_APPLY_BUTTON, KEY_LOCALIZE_BYTES, KEY_LOCALIZE_CANCEL_BUTTON, KEY_LOCALIZE_CATEGORY, KEY_LOCALIZE_CENTER_MAP_DIALOG_TITLE, KEY_LOCALIZE_CLEAR_BUTTON, KEY_LOCALIZE_CLICK_TO_CHANGE_POS_MESSAGE, KEY_LOCALIZE_CLOSE_BUTTON, KEY_LOCALIZE_CONTINUE_BUTTON, KEY_LOCALIZE_DELETELOCK_BUTTON, KEY_LOCALIZE_DISPLAY, KEY_LOCALIZE_DISTANCE, KEY_LOCALIZE_EMPTY_MARKER_NAME, KEY_LOCALIZE_EXPORT_LOCATION_DIALOG_TITLE, KEY_LOCALIZE_FILENAME, KEY_LOCALIZE_GOTO_BUTTON, KEY_LOCALIZE_HEIGHT, KEY_LOCALIZE_IGNORE_BUTTON, KEY_LOCALIZE_IMAGES, KEY_LOCALIZE_INFO, KEY_LOCALIZE_LATITUDE, KEY_LOCALIZE_LEVEL_OF_DETAIL, KEY_LOCALIZE_LOAD_LOCATION_DIALOG_TITLE, KEY_LOCALIZE_LOAD_PROGRESS, KEY_LOCALIZE_LOAD_SHAPE_DIALOG_TITLE, KEY_LOCALIZE_LOCATION_MARKER_CATEGORY_ID_PREFIX, KEY_LOCALIZE_LONGITUDE, KEY_LOCALIZE_MAPS, KEY_LOCALIZE_MESSAGE_CREATE_DATABASE_MESSAGE, KEY_LOCALIZE_MESSAGE_ERROR_TITLE, KEY_LOCALIZE_MESSAGE_EXPORT_ERROR_MESSAGE, KEY_LOCALIZE_MESSAGE_FILE_NOT_FOUND_MESSAGE, KEY_LOCALIZE_MESSAGE_GPS_PROPERTIES_EFFECT_ON_RESTART, KEY_LOCALIZE_MESSAGE_INFO_TITLE, KEY_LOCALIZE_MESSAGE_LATITUDE_OR_LONGITUDE_WRONG_FORMAT, KEY_LOCALIZE_MESSAGE_LATITUDE_WRONG_FORMAT, KEY_LOCALIZE_MESSAGE_LINES_READ_MESSAGE, KEY_LOCALIZE_MESSAGE_LOCK_EXISTS_TEXT, KEY_LOCALIZE_MESSAGE_LOCK_EXISTS_TITLE, KEY_LOCALIZE_MESSAGE_LONGITUDE_WRONG_FORMAT, KEY_LOCALIZE_MESSAGE_OPTIMIZE_DATABASE_MESSAGE, KEY_LOCALIZE_MESSAGE_WARNING_TITLE, KEY_LOCALIZE_NAME, KEY_LOCALIZE_NEW_LOCATION_MARKER_TITLE, KEY_LOCALIZE_NONE, KEY_LOCALIZE_NOTHING_FOUND, KEY_LOCALIZE_OK_BUTTON, KEY_LOCALIZE_PREVIEW_BUTTON, KEY_LOCALIZE_RAWGPSDATAFRAME_TITLE, KEY_LOCALIZE_ROUTE, KEY_LOCALIZE_ROUTEPOINT, KEY_LOCALIZE_SAVE_AS_DIALOG_TITLE, KEY_LOCALIZE_SAVE_BUTTON, KEY_LOCALIZE_SCALE, KEY_LOCALIZE_SEARCH_LOCATION_MARKER_TITLE, KEY_LOCALIZE_SELECT_LOCATION_MARKER_CATEGORIES_TITLE, KEY_LOCALIZE_TRACK, KEY_LOCALIZE_TRACKPOINT, KEY_LOCALIZE_WAYPOINT, KEY_LOCALIZE_WIDTH, KEY_LOCATION_FILE_CSV_DESCRIPTIVE_NAME, KEY_LOCATION_FILE_CSV_EXTENSION, KEY_LOCATION_FILE_GEONET_COMPRESSED_EXTENSION, KEY_LOCATION_FILE_GEONET_DESCRIPTIVE_NAME, KEY_LOCATION_FILE_GEONET_EXTENSION, KEY_LOCATION_FILE_GPSDRIVE_DESCRIPTIVE_NAME, KEY_LOCATION_FILE_GPSDRIVE_EXTENSION, KEY_LOCATION_FILE_ZIP_EXTENSION, KEY_LOCATION_LAYER_ACTIVE, KEY_LOCATION_MARKER_CATEGORY_AVAILABLE_CATEGORIES, KEY_LOCATION_MARKER_CATEGORY_ICON_SUFFIX, KEY_LOCATION_MARKER_CATEGORY_LEVEL_OF_DETAIL_SCALES, KEY_LOCATION_MARKER_CATEGORY_LEVEL_OF_DETAIL_SUFFIX, KEY_LOCATION_MARKER_CATEGORY_VISIBLE_SUFFIX, KEY_LOCATION_MARKER_DB_CREATE_DB_SCRIPT_URL, KEY_LOCATION_MARKER_DB_JDBCDRIVER, KEY_LOCATION_MARKER_DB_OPTIMIZE_DB_ON_START, KEY_LOCATION_MARKER_DB_PASSWORD, KEY_LOCATION_MARKER_DB_URL, KEY_LOCATION_MARKER_DB_USER, KEY_LOCATION_MARKER_SELECT_CATEGORY_ALLOW_EDIT_LEVEL_OF_DETAIL, KEY_LOCATION_MARKER_SELECT_CATEGORY_LEVEL_OF_DETAIL_COLUMN_INDEX, KEY_LOCATION_MARKER_SELECT_CATEGORY_LEVEL_OF_DETAIL_COLUMN_WIDTH, KEY_LOCATION_MARKER_SELECT_CATEGORY_NAME_COLUMN_INDEX, KEY_LOCATION_MARKER_SELECT_CATEGORY_NAME_COLUMN_WIDTH, KEY_LOCATION_MARKER_SELECT_CATEGORY_VISIBLE_COLUMN_INDEX, KEY_LOCATION_MARKER_SELECT_CATEGORY_VISIBLE_COLUMN_WIDTH, KEY_LOCATION_MARKER_SHOW_NAMES, KEY_LOCATION_MARKER_TEXT_BACKGROUND_COLOR, KEY_LOCATION_MARKER_TEXT_COLOR, KEY_LOCATION_MARKER_TEXT_FONT_SIZE, KEY_LOCATION_MARKER_USE_DB, KEY_LOCKFILES, KEY_MAP_LAYER_ACTIVE, KEY_MAP_SCALE, KEY_MAP_SCALE_REMEMBER_MAP_SCALE, KEY_MAP_VISIBLE_MAP_SCALE_FACTOR, KEY_MENU_LAYERS_LABEL, KEY_MENU_MOUSE_MODE_LABEL, KEY_MENU_PLUGIN_LABEL, KEY_MOUSE_MODE_DEFAULT_MODE, KEY_NUMBER_FORMAT_DISTANCE, KEY_POSITION_CIRCLE_COLOR, KEY_POSITION_CIRCLE_LINE_WIDTH, KEY_POSITION_CIRCLE_RADIUS, KEY_POSITION_FOLLOW_ME_MODE, KEY_POSITION_FOLLOW_ME_PITCH, KEY_POSITION_FOLLOW_ME_PITCH_VALUE_PREFIX, KEY_POSITION_ICON, KEY_POSITION_USE_ICON, KEY_REMEMBER_FRAME_SETTINGS, KEY_RESOURCE_EDITOR_TITLE, KEY_SCALE_LAYER_ACTIVE, KEY_SCALE_RULE_AIMED_LENGTH, KEY_SHAPE_FILE_DESCRIPTIVE_NAME, KEY_SHAPE_FILE_EXTENSION, KEY_SHAPE_LAYER_ACTIVE, KEY_SPLASH_IMAGE, KEY_SPLASH_MAX_PROGRESS, KEY_TACHOMETER_REFRESH_TIME, KEY_TRACK_ACTIVE_TRACK_IDENTIFIER, KEY_TRACK_FILE_DESCRIPTIVE_NAME, KEY_TRACK_FILE_EXTENSION, KEY_TRACK_FILE_FORMAT, KEY_TRACK_FILE_PATTERN, KEY_TRACK_FILE_PREFIX, KEY_UNIT_DISTANCE, KEY_WINDOW_DIMENSION_HEIGHT, KEY_WINDOW_DIMENSION_WIDTH, KEY_WINDOW_LOCATION_X, KEY_WINDOW_LOCATION_Y, VALUE_KEY_DEVICE_MODE_FILE, VALUE_KEY_DEVICE_MODE_GPSD, VALUE_KEY_DEVICE_MODE_NONE, VALUE_KEY_DEVICE_MODE_SERIAL, VALUE_KEY_DEVICE_PROTOCOL_GARMIN, VALUE_KEY_DEVICE_PROTOCOL_NMEA
 
Constructor Summary
TrackManagerImpl()
          Empty constructor
 
Method Summary
 void addToActiveTrack(org.dinopolis.gpstool.gpsinput.GPSTrackpoint trackpoint)
          Adds the given trackpoint to the active track.
 void addToTrack(java.lang.String identifier, org.dinopolis.gpstool.gpsinput.GPSTrackpoint trackpoint)
          Adds the given trackpoint to the track with the given identifier.
 void addTrack(org.dinopolis.gpstool.gpsinput.GPSTrack track)
          Add a track.
 void addTrackListener(org.dinopolis.gpstool.event.TrackChangedListener listener)
          Adds a track listener.
 void addTracksFromGPSDevice()
          Download all tracks from the connected gps device and adds them to the list of tracks.
protected  void fireTrackChangedEvent(org.dinopolis.gpstool.event.TrackChangedEvent event)
          Inform all registered listeners about track changes.
 java.lang.String getActiveTrackIdentifier()
          Returns the name of the active track (the track used by the addToActiveTrack(GPSTrackpoint) 55 method).
 org.dinopolis.gpstool.track.Track getProjectedTrack(java.lang.String identifier, Projection projection)
          Returns a projected track (holding the screen coordinates as well as the geographic coordinates).
 org.dinopolis.gpstool.track.Track getTrack(java.lang.String identifier)
          Returns the track with the given identifier or null if no track was found with the given identifier.
 java.lang.String[] getTrackIdentifiers()
          Returns the track identifiers.
 java.util.List getTracks()
          Returns a copy of the list of tracks (org.dinopolis.gpstool.track.Track objects).
 java.util.List getVisibleProjectedTracks(Projection projection)
          Returns all visible projected tracks (holding the screen coordinates as well as the geographic coordinates) in a List.
 void initialize(org.dinopolis.gpstool.plugin.PluginSupport support)
          Initialize with all the track manager needs (resources and gps data processor).
static boolean isTrackVisible(org.dinopolis.gpstool.gpsinput.GPSTrack track, org.dinopolis.gpstool.util.GeoExtent visible_area)
          Returns true if the given track is starts in, ends in or crosses the given area, false otherwise.
 void removeTrack(java.lang.String identifier)
          Removes the track with the given identifier.
 void removeTrackListener(org.dinopolis.gpstool.event.TrackChangedListener listener)
          Removes a track listener.
 void setActiveTrackIdentifier(java.lang.String identifier)
          Defines the track with the given identifier as the active track (the track used by the addToActiveTrack(GPSTrackpoint) 55 method).
 void setTracks(java.util.List tracks)
          Set the tracks.
 void uploadTracksToGPSDevice()
          Uploads all available tracks to the gps device.
 void uploadTracksToGPSDevice(java.lang.String[] identifiers)
          Uploads the tracks with the given identifiers to the gps device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

track_map_

java.util.Map track_map_

gps_data_processor_

org.dinopolis.gpstool.gpsinput.GPSDataProcessor gps_data_processor_

track_listeners_

java.util.Vector track_listeners_

active_track_identifier_

java.lang.String active_track_identifier_

resources_

org.dinopolis.util.Resources resources_
Constructor Detail

TrackManagerImpl

public TrackManagerImpl()
Empty constructor

Method Detail

initialize

public void initialize(org.dinopolis.gpstool.plugin.PluginSupport support)
Initialize with all the track manager needs (resources and gps data processor).


getTracks

public java.util.List getTracks()
Returns a copy of the list of tracks (org.dinopolis.gpstool.track.Track objects).

Specified by:
getTracks in interface TrackManager

setTracks

public void setTracks(java.util.List tracks)
Set the tracks. All previously stored tracks are removed.

Specified by:
setTracks in interface TrackManager

addTrack

public void addTrack(org.dinopolis.gpstool.gpsinput.GPSTrack track)
Add a track. If a track with the same identifier already exists, the old track is overwritten.

Specified by:
addTrack in interface TrackManager

getTrackIdentifiers

public java.lang.String[] getTrackIdentifiers()
Returns the track identifiers.

Specified by:
getTrackIdentifiers in interface TrackManager

getTrack

public org.dinopolis.gpstool.track.Track getTrack(java.lang.String identifier)
Returns the track with the given identifier or null if no track was found with the given identifier.

Specified by:
getTrack in interface TrackManager

removeTrack

public void removeTrack(java.lang.String identifier)
Removes the track with the given identifier.

Specified by:
removeTrack in interface TrackManager

setActiveTrackIdentifier

public void setActiveTrackIdentifier(java.lang.String identifier)
                              throws java.lang.IllegalArgumentException
Defines the track with the given identifier as the active track (the track used by the addToActiveTrack(GPSTrackpoint) 55 method).

Specified by:
setActiveTrackIdentifier in interface TrackManager

getActiveTrackIdentifier

public java.lang.String getActiveTrackIdentifier()
Returns the name of the active track (the track used by the addToActiveTrack(GPSTrackpoint) 55 method).

Specified by:
getActiveTrackIdentifier in interface TrackManager

addToTrack

public void addToTrack(java.lang.String identifier,
                       org.dinopolis.gpstool.gpsinput.GPSTrackpoint trackpoint)
                throws java.lang.IllegalArgumentException
Adds the given trackpoint to the track with the given identifier.

Specified by:
addToTrack in interface TrackManager

addToActiveTrack

public void addToActiveTrack(org.dinopolis.gpstool.gpsinput.GPSTrackpoint trackpoint)
                      throws java.lang.IllegalArgumentException
Adds the given trackpoint to the active track.

Specified by:
addToActiveTrack in interface TrackManager

addTracksFromGPSDevice

public void addTracksFromGPSDevice()
                            throws java.lang.UnsupportedOperationException,
                                   org.dinopolis.gpstool.gpsinput.GPSException
Download all tracks from the connected gps device and adds them to the list of tracks.

Specified by:
addTracksFromGPSDevice in interface TrackManager

uploadTracksToGPSDevice

public void uploadTracksToGPSDevice()
                             throws java.lang.UnsupportedOperationException,
                                    org.dinopolis.gpstool.gpsinput.GPSException
Uploads all available tracks to the gps device.

Specified by:
uploadTracksToGPSDevice in interface TrackManager

uploadTracksToGPSDevice

public void uploadTracksToGPSDevice(java.lang.String[] identifiers)
                             throws java.lang.UnsupportedOperationException,
                                    org.dinopolis.gpstool.gpsinput.GPSException
Uploads the tracks with the given identifiers to the gps device.

Specified by:
uploadTracksToGPSDevice in interface TrackManager

addTrackListener

public void addTrackListener(org.dinopolis.gpstool.event.TrackChangedListener listener)
Adds a track listener.

Specified by:
addTrackListener in interface TrackManager

removeTrackListener

public void removeTrackListener(org.dinopolis.gpstool.event.TrackChangedListener listener)
Removes a track listener.

Specified by:
removeTrackListener in interface TrackManager

getVisibleProjectedTracks

public java.util.List getVisibleProjectedTracks(Projection projection)
                                         throws java.lang.InterruptedException
Returns all visible projected tracks (holding the screen coordinates as well as the geographic coordinates) in a List. If no tracks are found (or visible), an empty list is returned. Visiblity is determined for the given projection. The tracks returned are deep cloned, so any changes in these tracks do not influence the tracks stored in the track manager (and vice versa).

Specified by:
getVisibleProjectedTracks in interface TrackManager

getProjectedTrack

public org.dinopolis.gpstool.track.Track getProjectedTrack(java.lang.String identifier,
                                                           Projection projection)
Returns a projected track (holding the screen coordinates as well as the geographic coordinates). At the moment, no caching is done, so the calculation is always executed when this method is called. If no track was found with the given identifier, null is returned. The track returned is deep cloned, so any changes in this tracks does not influence the tracks stored in the track manager (and vice versa). TODO: cache calls with same projection

Specified by:
getProjectedTrack in interface TrackManager

isTrackVisible

public static boolean isTrackVisible(org.dinopolis.gpstool.gpsinput.GPSTrack track,
                                     org.dinopolis.gpstool.util.GeoExtent visible_area)
Returns true if the given track is starts in, ends in or crosses the given area, false otherwise.


fireTrackChangedEvent

protected void fireTrackChangedEvent(org.dinopolis.gpstool.event.TrackChangedEvent event)
Inform all registered listeners about track changes.