Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new plugin for showing AIS positions of vessels #21556

Open
wants to merge 102 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
ddb8fab
new plugin: AIS vessel tracker, initial version
f-n Jun 16, 2024
f31f333
new plugin: AIS vessel tracker, initial version
f-n Jun 16, 2024
2a4eb97
insert some AIS objects for test purposes
f-n Jun 16, 2024
36ea38a
Merge branch 'osmandapp:master' into master
f-n Jun 16, 2024
984114f
Merge branch 'master' of https://github.com/f-n/OsmAnd
f-n Jun 16, 2024
b881cae
added syntax check for IP address and port number in settings dialog
f-n Jun 17, 2024
4fc4199
display distance and bearing in context menu
f-n Jun 18, 2024
57b9064
add 2 settings: AIS_OBJ_LOST_TIMEOUT and AIS_SHIP_LOST_TIMEOUT
f-n Jun 21, 2024
705bbd4
ship destination consisting of "@" is considered as invalid
f-n Jun 21, 2024
4afa720
improved preference setup dialog for network setting: show current va…
f-n Jun 22, 2024
32ebd90
new class to calculate CPA nd TCPA (not included into GUI yet)
f-n Jun 25, 2024
9b95c9d
update of CPA class after some testing (not included into GUI yet)
f-n Jun 30, 2024
c61a34e
use CPA data request in AIS object context menu to display CPA, TCPA
f-n Jul 1, 2024
c9eb718
some code refactoring
f-n Jul 2, 2024
406a2c8
additional preferences regarding CPA (not used in the application yet)
f-n Jul 2, 2024
93e4a5f
code refactoring regarding maxObjectAgeInMinutes, vesselLostTimeoutIn…
f-n Jul 2, 2024
a2fe7b4
add CPA check into vessel visualisation
f-n Jul 4, 2024
e70e8a2
adjust layout of context menu entries
f-n Jul 6, 2024
6006050
add disclaimer in the plugin description
f-n Jul 7, 2024
ad66408
address some concurrency issue in AIS object list
f-n Jul 21, 2024
2a435cb
use getCurrentLocation() instead of getLocation() for CPA calculations
f-n Jul 21, 2024
62131ba
add TCP connection reset after mapActivityResume in special situations
f-n Jul 23, 2024
a00ce91
added icon in the top area of the context menu
f-n Jul 23, 2024
460b7cb
do not show negative CPA times in context menu
f-n Jul 29, 2024
41804f5
change bitmap+color handling
f-n Jul 31, 2024
c3081a2
adjust logic for bitmap/color selection
f-n Aug 4, 2024
e662ce4
merge
f-n Aug 11, 2024
a8a4d77
adjustments after merge
f-n Aug 11, 2024
bd97816
Merge branch 'osmandapp:master' into master
f-n Aug 11, 2024
41cb344
merge
f-n Aug 11, 2024
82c727c
restart network listeners in cast of protocol change (UDP/TCP)
f-n Aug 13, 2024
932e4c2
increase max number of AIS objects to 200
f-n Aug 13, 2024
57f1d43
Merge branch 'osmandapp:master' into master
f-n Aug 14, 2024
831d16e
merge
f-n Aug 14, 2024
d2d355f
Merge branch 'osmandapp:master' into master
f-n Aug 15, 2024
821b7e8
Merge branch 'osmandapp:master' into master
f-n Aug 21, 2024
354e98a
Merge branch 'osmandapp:master' into master
f-n Aug 22, 2024
351f5fe
Merge branch 'osmandapp:master' into master
f-n Aug 23, 2024
a517a93
Merge branch 'osmandapp:master' into master
f-n Aug 23, 2024
0ad07ed
Merge branch 'osmandapp:master' into master
f-n Aug 24, 2024
6d869a8
Merge branch 'osmandapp:master' into master
f-n Aug 24, 2024
2217579
Merge branch 'osmandapp:master' into master
f-n Aug 25, 2024
acb5931
Merge branch 'osmandapp:master' into master
f-n Aug 25, 2024
862e7fe
Merge branch 'osmandapp:master' into master
f-n Aug 26, 2024
2a14544
adjusted CPA warning indication: add new condition: examine time when…
f-n Sep 24, 2024
bfb7b7b
change the available set for configurable CPA warning distances (now …
f-n Sep 24, 2024
8ba1e6e
Merge remote-tracking branch 'origin/master'
f-n Sep 26, 2024
5528bc8
fixed wrong visualisation for AIS message type 18
f-n Sep 26, 2024
ef3b284
adjusted/extended object description in the context menu
f-n Sep 26, 2024
5751e5a
adjust visualisation of moored vessels (vessels at rest): draw a circ…
f-n Sep 27, 2024
c8d7277
added two new AIS object types: AIS_VESSEL_AUTHORITIES and AIS_VESSE…
f-n Sep 28, 2024
0fa48ed
correct wrong color definition in AisObject.selectColor()
f-n Oct 18, 2024
b91c88d
allow status change from VALID to INVALID for some AIS attributes
f-n Oct 19, 2024
3440de8
created new AisObjectType: AIS_VESSEL_OTHER with individual color
f-n Oct 19, 2024
26a8e7c
special handling for objectClass = AIS_INVALID: might be moveable
f-n Oct 20, 2024
6a75d68
new plugin: AIS vessel tracker, initial version
f-n Jun 16, 2024
9bbd7fa
new plugin: AIS vessel tracker, initial version
f-n Jun 16, 2024
75f91e1
insert some AIS objects for test purposes
f-n Jun 16, 2024
84aa2eb
added syntax check for IP address and port number in settings dialog
f-n Jun 17, 2024
cfa015f
display distance and bearing in context menu
f-n Jun 18, 2024
a439e0b
add 2 settings: AIS_OBJ_LOST_TIMEOUT and AIS_SHIP_LOST_TIMEOUT
f-n Jun 21, 2024
8955967
ship destination consisting of "@" is considered as invalid
f-n Jun 21, 2024
78ceb14
improved preference setup dialog for network setting: show current va…
f-n Jun 22, 2024
7549fbe
new class to calculate CPA nd TCPA (not included into GUI yet)
f-n Jun 25, 2024
d12c0c5
update of CPA class after some testing (not included into GUI yet)
f-n Jun 30, 2024
3362c2a
use CPA data request in AIS object context menu to display CPA, TCPA
f-n Jul 1, 2024
7660bbb
some code refactoring
f-n Jul 2, 2024
fa21385
additional preferences regarding CPA (not used in the application yet)
f-n Jul 2, 2024
92eb0dc
code refactoring regarding maxObjectAgeInMinutes, vesselLostTimeoutIn…
f-n Jul 2, 2024
5ac23cf
add CPA check into vessel visualisation
f-n Jul 4, 2024
68f8d80
adjust layout of context menu entries
f-n Jul 6, 2024
1ab832e
add disclaimer in the plugin description
f-n Jul 7, 2024
8a65f7e
address some concurrency issue in AIS object list
f-n Jul 21, 2024
823aafc
use getCurrentLocation() instead of getLocation() for CPA calculations
f-n Jul 21, 2024
173df3e
add TCP connection reset after mapActivityResume in special situations
f-n Jul 23, 2024
562da86
added icon in the top area of the context menu
f-n Jul 23, 2024
8467b79
do not show negative CPA times in context menu
f-n Jul 29, 2024
abde360
change bitmap+color handling
f-n Jul 31, 2024
30ca7cc
adjust logic for bitmap/color selection
f-n Aug 4, 2024
0e72e91
adjustments after merge
f-n Aug 11, 2024
a9da155
restart network listeners in cast of protocol change (UDP/TCP)
f-n Aug 13, 2024
0cf6b9f
increase max number of AIS objects to 200
f-n Aug 13, 2024
06586cb
adjusted CPA warning indication: add new condition: examine time when…
f-n Sep 24, 2024
457d61b
change the available set for configurable CPA warning distances (now …
f-n Sep 24, 2024
0f6716d
fixed wrong visualisation for AIS message type 18
f-n Sep 26, 2024
f1b03c5
adjusted/extended object description in the context menu
f-n Sep 26, 2024
39978be
adjust visualisation of moored vessels (vessels at rest): draw a circ…
f-n Sep 27, 2024
46fb122
added two new AIS object types: AIS_VESSEL_AUTHORITIES and AIS_VESSE…
f-n Sep 28, 2024
1c3cd32
correct wrong color definition in AisObject.selectColor()
f-n Oct 18, 2024
dcd9967
allow status change from VALID to INVALID for some AIS attributes
f-n Oct 19, 2024
e5dcee3
created new AisObjectType: AIS_VESSEL_OTHER with individual color
f-n Oct 19, 2024
e310ec1
special handling for objectClass = AIS_INVALID: might be moveable
f-n Oct 20, 2024
acc6095
after git rebase
f-n Nov 23, 2024
ea02688
Merge branch 'osmandapp:master' into master
f-n Dec 3, 2024
9187499
Merge branch 'osmandapp:master' into master
f-n Dec 4, 2024
39a8127
Merge branch 'osmandapp:master' into master
f-n Dec 5, 2024
284249d
Merge branch 'osmandapp:master' into master
f-n Dec 8, 2024
a323d98
Merge branch 'osmandapp:master' into master
f-n Dec 10, 2024
3461633
Merge branch 'master' into ais
Chumva Dec 20, 2024
af0aba7
Remove unnecessary changes
Chumva Dec 20, 2024
1987620
Merge remote-tracking branch 'origin/master'
Chumva Jan 31, 2025
2bdf5e0
Add ability to show ais info from plugin
Chumva Jan 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions OsmAnd/build-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -444,4 +444,5 @@ dependencies {
androidTestImplementation ('androidx.test.espresso:espresso-contrib:3.5.1') {
exclude module: "protobuf-lite"
}
implementation 'net.sf.marineapi:marineapi:0.12.0'
}
Binary file added OsmAnd/res/drawable-hdpi/ais_aton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-hdpi/ais_aton_virt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-hdpi/ais_land.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-hdpi/ais_plane.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-hdpi/ais_sar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-hdpi/ais_vessel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-hdpi/ais_vessel_cross.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-hdpi/ais_vessel_red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-mdpi/ais_aton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-mdpi/ais_aton_virt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-mdpi/ais_land.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-mdpi/ais_plane.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-mdpi/ais_sar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-mdpi/ais_vessel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-mdpi/ais_vessel_cross.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-mdpi/ais_vessel_red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-xhdpi/ais_aton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-xhdpi/ais_aton_virt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-xhdpi/ais_land.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-xhdpi/ais_map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-xhdpi/ais_plane.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-xhdpi/ais_sar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-xhdpi/ais_vessel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-xhdpi/ais_vessel_cross.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-xhdpi/ais_vessel_red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OsmAnd/res/drawable-xxhdpi/ais_aton.png
Binary file added OsmAnd/res/drawable-xxhdpi/ais_aton_virt.png
Binary file added OsmAnd/res/drawable-xxhdpi/ais_land.png
Binary file added OsmAnd/res/drawable-xxhdpi/ais_plane.png
Binary file added OsmAnd/res/drawable-xxhdpi/ais_sar.png
Binary file added OsmAnd/res/drawable-xxhdpi/ais_vessel.png
Binary file added OsmAnd/res/drawable-xxhdpi/ais_vessel_cross.png
Binary file added OsmAnd/res/drawable-xxhdpi/ais_vessel_red.png
29 changes: 26 additions & 3 deletions OsmAnd/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,44 @@
- For wording and consistency, please note https://docs.osmand.net/docs/technical/contributions/translating-osmand
Thx - Hardy
-->
<string name="ais_load_data">Load AIS data from file</string>
<string name="ais_address_settings">IP address settings</string>
<string name="ais_address_settings_description">Choose NMEA protocol (UDP/TCP) and define addresses</string>
<string name="ais_nmea_protocol">Protocol for NMEA data reception</string>
<string name="ais_nmea_protocol_description">Choose protocol for NMEA data reception</string>
<string name="ais_address_nmea_server">IP address of NMEA data source</string>
<string name="ais_address_nmea_server_description">Define IP address of the NMEA data source (if TCP is used)</string>
<string name="ais_port_nmea_server">TCP port of NMEA data source</string>
<string name="ais_port_nmea_server_description">Define TCP port number of the NMEA data source</string>
<string name="ais_port_nmea_local">UDP port of local NMEA data receiver</string>
<string name="ais_port_nmea_local_description">Define UPD port where OsmAnd receives NMEA data</string>
<string name="ais_object_lost_timeouts">Timeout settings for AIS signal reception</string>
<string name="ais_object_lost_timeouts_description">Set timeout values to identify lost AIS objects if no signal was received for a specific time.</string>
<string name="ais_object_lost_timeout">Timeout for visibility when object is lost</string>
<string name="ais_object_lost_timeout_description">Set Timeout for visibility of AIS objects: After this time without signal reception, the AIS object will be removed from screen.</string>
<string name="ais_ship_lost_timeout">Timeout for ship visibility when no signal received</string>
<string name="ais_ship_lost_timeout_description">Set timeout for ship visibility: After this time without signal reception, the ship symbol will change its state on screen: It will be crossed out.</string>
<string name="ais_cpa_settings">Settings related to CPA</string>
<string name="ais_cpa_settings_description">These values define the presentation of AIS objects that may come too close to the own position.</string>
<string name="ais_cpa_warning_time">Warning time to reach the Closest Point of Approach (CPA)</string>
<string name="ais_cpa_warning_time_description">If the TCPA (time to reach the CPA with another vessel) is less than this value, the vessel is marked with red color.</string>
<string name="ais_cpa_warning_distance">Warning distance for the Closes Point of Approach (CPA)</string>
<string name="ais_cpa_warning_distance_description">Vessels are marked with red color if the CPA is less than this value and the CPA is reached in the near future (see setting "Warning time to reach the CPA").</string>
<string name="plugin_ais_tracker_name">AIS vessel tracker</string>
<string name="plugin_ais_tracker_description">Display AIS positions and information about surrounding vessels. The AIS data is received via network from an external AIS receiver.</string>
<string name="plugin_ais_tracker_disclaimer">DISCLAIMER\n\nThis plugin is a hobby project and not designed for reliability and correctness. DO NOT rely upon this software in any way including for navigation and/or safety of life.</string>
<string name="shared_string_length">Length</string>
<string name="shared_string_avg_altitude">Avg. altitude</string>
<string name="shared_string_avg_speed">Min. speed</string>
<string name="popular_places_nearby">Popular places nearby</string>
<string name="recently_visited">Recently visited</string>

<string name="shared_string_default_view">Default view</string>
<string name="map_widget_route_information">Route information</string>
<string name="map_widget_route_information_desc">Displays the estimated arrival time, remaining travel time, and distance for the current navigation route.</string>
<string name="display_distance_to_first_intermediate">Show route details for the next stop</string>
<string name="display_distance_to_first_intermediate_summary">Shows time and distance for the next stop first. Turn off to always show details for the destination.</string>

<string name="rendering_attr_showClimbingRoutes_name">Climbing routes</string>
<string name="rendering_attr_showClimbingRoutes_description">Show climbing routes</string>

<string name="calculating_indication_message">Calculating…</string>
<string name="calculate_size">Calculate size</string>
<string name="default_buttons_size_original_description">Each button would keep its own size.</string>
Expand Down
70 changes: 70 additions & 0 deletions OsmAnd/res/xml/ais_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:title="AIS">

<PreferenceCategory
android:key="ais_address_settings"
android:layout="@layout/preference_category_with_descr"
android:title="@string/ais_address_settings" />

<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="ais_nmea_protocol"
android:layout="@layout/preference_with_descr"
android:title="@string/ais_nmea_protocol"
tools:summary="@string/ais_nmea_protocol_description" />

<net.osmand.plus.settings.preferences.EditTextPreferenceEx
android:key="ais_address_nmea_server"
android:layout="@layout/preference_with_descr"
android:title="@string/ais_address_nmea_server"
tools:summary="@string/ais_address_nmea_server_description" />

<net.osmand.plus.settings.preferences.EditTextPreferenceEx
android:key="ais_port_nmea_server"
android:layout="@layout/preference_with_descr"
android:inputType="number"
android:title="@string/ais_port_nmea_server"
tools:summary="@string/ais_port_nmea_server_description" />

<net.osmand.plus.settings.preferences.EditTextPreferenceEx
android:key="ais_port_nmea_local"
android:layout="@layout/preference_with_descr"
android:title="@string/ais_port_nmea_local"
tools:summary="@string/ais_port_nmea_local_description" />

<PreferenceCategory
android:key="ais_object_lost_timeouts"
android:layout="@layout/preference_category_with_descr"
android:title="@string/ais_object_lost_timeouts" />

<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="ais_object_lost_timeout"
android:layout="@layout/preference_with_descr"
android:title="@string/ais_object_lost_timeout"
tools:summary="@string/ais_object_lost_timeout_description" />

<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="ais_ship_lost_timeout"
android:layout="@layout/preference_with_descr"
android:title="@string/ais_ship_lost_timeout"
tools:summary="@string/ais_ship_lost_timeout_description" />

<PreferenceCategory
android:key="ais_cpa_settings"
android:layout="@layout/preference_category_with_descr"
android:title="@string/ais_cpa_settings" />

<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="ais_cpa_warning_time"
android:layout="@layout/preference_with_descr"
android:title="@string/ais_cpa_warning_time"
tools:summary="@string/ais_cpa_warning_time_description" />

<net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="ais_cpa_warning_distance"
android:layout="@layout/preference_with_descr"
android:title="@string/ais_cpa_warning_distance"
tools:summary="@string/ais_cpa_warning_distance_description" />

</PreferenceScreen>
11 changes: 11 additions & 0 deletions OsmAnd/res/xml/development_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,17 @@
android:summaryOn="@string/shared_string_enabled"
android:title="@string/allow_display_on_top" />

<PreferenceCategory
android:key="aistracker"
android:layout="@layout/preference_category_with_descr"
android:title="@string/plugin_ais_tracker_name" />

<Preference
android:key="aistracker_simulation"
android:layout="@layout/preference_with_descr"
android:persistent="false"
android:title="@string/ais_load_data" />

<PreferenceCategory
android:key="info"
android:layout="@layout/preference_category_with_descr"
Expand Down
4 changes: 4 additions & 0 deletions OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.plugins.OsmandPlugin;
import net.osmand.plus.plugins.PluginsHelper;
import net.osmand.plus.plugins.aistracker.AisObject;
import net.osmand.plus.plugins.aistracker.AisObjectMenuController;
import net.osmand.plus.plugins.audionotes.AudioVideoNoteMenuController;
import net.osmand.plus.plugins.audionotes.Recording;
import net.osmand.plus.plugins.mapillary.MapillaryImage;
Expand Down Expand Up @@ -218,6 +220,8 @@ public static MenuController getMenuController(@NonNull MapActivity mapActivity,
menuController = new RenderedObjectMenuController(mapActivity, pointDescription, (RenderedObject) object);
} else if (object instanceof MapillaryImage) {
menuController = new MapillaryMenuController(mapActivity, pointDescription, (MapillaryImage) object);
} else if (object instanceof AisObject) {
menuController = new AisObjectMenuController(mapActivity, pointDescription, (AisObject) object);
} else if (object instanceof SelectedGpxPoint) {
menuController = new SelectedGpxMenuController(mapActivity, pointDescription, (SelectedGpxPoint) object);
} else if (object instanceof ClickableWay) {
Expand Down
12 changes: 7 additions & 5 deletions OsmAnd/src/net/osmand/plus/plugins/PluginsHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import net.osmand.plus.plugins.skimaps.SkiMapsPlugin;
import net.osmand.plus.plugins.srtm.SRTMPlugin;
import net.osmand.plus.plugins.weather.WeatherPlugin;
import net.osmand.plus.plugins.aistracker.AisTrackerPlugin;
import net.osmand.plus.poi.PoiUIFilter;
import net.osmand.plus.quickaction.QuickActionType;
import net.osmand.plus.search.dialogs.QuickSearchDialogFragment;
Expand Down Expand Up @@ -111,6 +112,7 @@ public static void initPlugins(@NonNull OsmandApplication app) {
checkMarketPlugin(app, new SRTMPlugin(app));
allPlugins.add(new WeatherPlugin(app));
checkMarketPlugin(app, new NauticalMapsPlugin(app));
allPlugins.add(new AisTrackerPlugin(app));
checkMarketPlugin(app, new SkiMapsPlugin(app));
allPlugins.add(new AudioVideoNotesPlugin(app));
checkMarketPlugin(app, new ParkingPositionPlugin(app));
Expand Down Expand Up @@ -559,14 +561,14 @@ public static List<String> getDisabledRouterNames() {
}

public static List<String> onIndexingFiles(@Nullable IProgress progress) {
List<String> l = new ArrayList<>();
List<String> list = new ArrayList<>();
for (OsmandPlugin plugin : getEnabledPlugins()) {
List<String> ls = plugin.indexingFiles(progress);
if (ls != null && ls.size() > 0) {
l.addAll(ls);
List<String> files = plugin.indexingFiles(progress);
if (!Algorithms.isEmpty(files)) {
list.addAll(files);
}
}
return l;
return list;
}

public static void onMapActivityCreate(@NonNull MapActivity activity) {
Expand Down
52 changes: 52 additions & 0 deletions OsmAnd/src/net/osmand/plus/plugins/aistracker/AisLoadTask.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package net.osmand.plus.plugins.aistracker;

import android.net.Uri;
import android.os.AsyncTask;

import androidx.annotation.NonNull;

import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.importfiles.ImportHelper;
import net.osmand.plus.plugins.PluginsHelper;
import net.osmand.plus.utils.FileUtils;
import net.osmand.util.Algorithms;

import org.apache.commons.logging.Log;

import java.io.File;

public class AisLoadTask extends AsyncTask<Void, Void, String> {

private static final Log LOG = PlatformUtil.getLog(AisLoadTask.class.getName());

private final AisTrackerPlugin plugin = PluginsHelper.requirePlugin(AisTrackerPlugin.class);
private final OsmandApplication app;
private final Uri uri;

private File file;

public AisLoadTask(@NonNull OsmandApplication app, @NonNull Uri uri) {
this.app = app;
this.uri = uri;
}

@Override
protected String doInBackground(Void... voids) {
String name = ImportHelper.getNameFromContentUri(app, uri);
file = new File(FileUtils.getTempDir(app), "ais" + "_" + name);
return ImportHelper.copyFile(app, file, uri, true, false);
}

@Override
protected void onPostExecute(String error) {
if (Algorithms.isEmpty(error)) {
if (file.exists()) {
plugin.getSimulationProvider().startSimulation(file);
}
} else {
LOG.error(error);
app.showToastMessage(error);
}
}
}
Loading
Loading