generated from Grigo/AndroidTemplate
New approach is working. Added new ship marker
This commit is contained in:
+41
@@ -1,5 +1,6 @@
|
|||||||
*.iml
|
*.iml
|
||||||
.gradle
|
.gradle
|
||||||
|
.idea
|
||||||
/local.properties
|
/local.properties
|
||||||
/.idea/caches
|
/.idea/caches
|
||||||
/.idea/libraries
|
/.idea/libraries
|
||||||
@@ -14,3 +15,43 @@
|
|||||||
.externalNativeBuild
|
.externalNativeBuild
|
||||||
.cxx
|
.cxx
|
||||||
local.properties
|
local.properties
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Local configuration file (sdk path, etc)
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
# Log/OS Files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Android Studio generated files and folders
|
||||||
|
captures/
|
||||||
|
.externalNativeBuild/
|
||||||
|
.cxx/
|
||||||
|
*.aab
|
||||||
|
*.apk
|
||||||
|
output-metadata.json
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
*.iml
|
||||||
|
.idea/
|
||||||
|
misc.xml
|
||||||
|
deploymentTargetDropDown.xml
|
||||||
|
render.experimental.xml
|
||||||
|
|
||||||
|
# Keystore files
|
||||||
|
*.jks
|
||||||
|
*.keystore
|
||||||
|
|
||||||
|
# Google Services (e.g. APIs or Firebase)
|
||||||
|
google-services.json
|
||||||
|
|
||||||
|
# Android Profiling
|
||||||
|
*.hprof
|
||||||
|
|
||||||
|
# Android Studio / IntelliJ IDEA
|
||||||
|
*.iws
|
||||||
|
.idea/libraries
|
||||||
|
.idea/tasks.xml
|
||||||
|
.idea/vcs.xml
|
||||||
|
.idea/workspace.xml
|
||||||
@@ -39,40 +39,44 @@ public class YandexMapImpl implements MapInterface {
|
|||||||
private boolean ownVesselClickListenerSet = false;
|
private boolean ownVesselClickListenerSet = false;
|
||||||
private Map<String, Boolean> aisVesselClickListenersSet = new HashMap<>();
|
private Map<String, Boolean> aisVesselClickListenersSet = new HashMap<>();
|
||||||
|
|
||||||
|
// Флаги для предотвращения повторного добавления обработчиков
|
||||||
|
private Map<String, Boolean> aisVesselClickListenersAdded = new HashMap<>();
|
||||||
|
|
||||||
|
// Слушатель поворота карты
|
||||||
|
private com.yandex.mapkit.map.InputListener inputListener;
|
||||||
|
private float lastMapAzimuth = 0.0f;
|
||||||
|
|
||||||
|
// Отслеживание двойного клика для AIS судов
|
||||||
|
private Map<String, Long> lastClickTime = new HashMap<>();
|
||||||
|
private static final long DOUBLE_CLICK_DELAY = 300; // 300мс для двойного клика
|
||||||
|
|
||||||
public YandexMapImpl(Context context, MapView mapView) {
|
public YandexMapImpl(Context context, MapView mapView) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.mapView = mapView;
|
this.mapView = mapView;
|
||||||
this.aisMarkers = new HashMap<>();
|
this.aisMarkers = new HashMap<>();
|
||||||
this.aisVessels = new HashMap<>();
|
this.aisVessels = new HashMap<>();
|
||||||
|
|
||||||
android.util.Log.d("YandexMapImpl", "Конструктор YandexMapImpl вызван");
|
|
||||||
android.util.Log.d("YandexMapImpl", "Context: " + (context != null ? "установлен" : "null"));
|
|
||||||
android.util.Log.d("YandexMapImpl", "MapView: " + (mapView != null ? "установлен" : "null"));
|
|
||||||
|
|
||||||
// Получение коллекции объектов карты
|
// Получение коллекции объектов карты
|
||||||
try {
|
try {
|
||||||
this.mapObjects = mapView.getMap().getMapObjects().addCollection();
|
this.mapObjects = mapView.getMap().getMapObjects().addCollection();
|
||||||
android.util.Log.d("YandexMapImpl", "Коллекция объектов карты создана: " + (mapObjects != null ? "успешно" : "null"));
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
android.util.Log.e("YandexMapImpl", "Ошибка создания коллекции объектов карты: " + e.getMessage(), e);
|
// Ошибка создания коллекции объектов карты
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
android.util.Log.d("YandexMapImpl", "initialize() вызван");
|
// Инициализируем слушатель поворота карты
|
||||||
android.util.Log.d("YandexMapImpl", "mapObjects: " + (mapObjects != null ? "установлен" : "null"));
|
setupCameraListener();
|
||||||
android.util.Log.d("YandexMapImpl", "mapView: " + (mapView != null ? "установлен" : "null"));
|
|
||||||
android.util.Log.d("YandexMapImpl", "context: " + (context != null ? "установлен" : "null"));
|
|
||||||
|
|
||||||
// Карта уже инициализирована в конструкторе
|
|
||||||
if (mapObjects != null) {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Коллекция объектов карты готова к использованию");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
|
// Удаляем слушатель ввода
|
||||||
|
if (inputListener != null && mapView != null) {
|
||||||
|
mapView.getMap().removeInputListener(inputListener);
|
||||||
|
}
|
||||||
|
|
||||||
if (mapObjects != null) {
|
if (mapObjects != null) {
|
||||||
mapView.getMap().getMapObjects().remove(mapObjects);
|
mapView.getMap().getMapObjects().remove(mapObjects);
|
||||||
}
|
}
|
||||||
@@ -83,151 +87,123 @@ public class YandexMapImpl implements MapInterface {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addOwnVesselMarker(Vessel vessel) {
|
public void addOwnVesselMarker(Vessel vessel) {
|
||||||
android.util.Log.d("YandexMapImpl", "addOwnVesselMarker вызван: lat=" + vessel.getLatitude() + ", lon=" + vessel.getLongitude() + ", course=" + vessel.getCourse() + "°");
|
|
||||||
|
|
||||||
// Сохраняем ссылку на судно
|
// Сохраняем ссылку на судно
|
||||||
this.ownVessel = vessel;
|
this.ownVessel = vessel;
|
||||||
|
|
||||||
// Проверяем координаты
|
// Проверяем валидность координат (исключаем только невалидные значения)
|
||||||
if (vessel.getLatitude() == 0.0 && vessel.getLongitude() == 0.0) {
|
if (Double.isNaN(vessel.getLatitude()) || Double.isNaN(vessel.getLongitude()) ||
|
||||||
android.util.Log.w("YandexMapImpl", "Координаты равны 0,0 - маркер не будет создан");
|
Double.isInfinite(vessel.getLatitude()) || Double.isInfinite(vessel.getLongitude())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ownVesselMarker != null) {
|
if (ownVesselMarker != null) {
|
||||||
android.util.Log.d("YandexMapImpl", "Удаляем существующий маркер");
|
|
||||||
mapObjects.remove(ownVesselMarker);
|
mapObjects.remove(ownVesselMarker);
|
||||||
}
|
}
|
||||||
|
|
||||||
Point point = new Point(vessel.getLatitude(), vessel.getLongitude());
|
Point point = new Point(vessel.getLatitude(), vessel.getLongitude());
|
||||||
android.util.Log.d("YandexMapImpl", "Создаем Point: " + point);
|
|
||||||
|
|
||||||
ownVesselMarker = mapObjects.addPlacemark(point);
|
ownVesselMarker = mapObjects.addPlacemark(point);
|
||||||
android.util.Log.d("YandexMapImpl", "Placemark создан: " + (ownVesselMarker != null ? "успешно" : "null"));
|
|
||||||
|
|
||||||
if (ownVesselMarker == null) {
|
if (ownVesselMarker == null) {
|
||||||
android.util.Log.e("YandexMapImpl", "Не удалось создать Placemark!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Используем готовую иконку стрелки с учетом курса
|
// Используем готовую иконку стрелки с учетом курса (синий цвет для нашего судна)
|
||||||
android.util.Log.d("YandexMapImpl", "Устанавливаем иконку стрелки с курсом: " + vessel.getCourse() + "°");
|
setMarkerIcon(ownVesselMarker, "target", vessel.getCourse(), android.graphics.Color.BLUE);
|
||||||
setMarkerIcon(ownVesselMarker, "arrowship", vessel.getCourse());
|
|
||||||
|
|
||||||
// Устанавливаем размер иконки
|
// Устанавливаем размер иконки
|
||||||
android.util.Log.d("YandexMapImpl", "Устанавливаем IconStyle...");
|
|
||||||
com.yandex.mapkit.map.IconStyle iconStyle = new com.yandex.mapkit.map.IconStyle();
|
com.yandex.mapkit.map.IconStyle iconStyle = new com.yandex.mapkit.map.IconStyle();
|
||||||
iconStyle.setScale(1.5f); // Увеличиваем размер иконки
|
iconStyle.setScale(1.0f); // Уменьшаем масштаб иконки
|
||||||
ownVesselMarker.setIconStyle(iconStyle);
|
ownVesselMarker.setIconStyle(iconStyle);
|
||||||
|
|
||||||
// Устанавливаем обработчик кликов только если он еще не установлен
|
// Устанавливаем обработчик кликов только если он еще не установлен
|
||||||
if (!ownVesselClickListenerSet) {
|
if (!ownVesselClickListenerSet) {
|
||||||
android.util.Log.d("YandexMapImpl", "Устанавливаем обработчик клика для маркера...");
|
|
||||||
ownVesselMarker.addTapListener((mapObject, point1) -> {
|
ownVesselMarker.addTapListener((mapObject, point1) -> {
|
||||||
android.util.Log.d("YandexMapImpl", "Клик по маркеру нашего судна!");
|
|
||||||
if (markerClickListener != null && ownVessel != null) {
|
if (markerClickListener != null && ownVessel != null) {
|
||||||
android.util.Log.d("YandexMapImpl", "Вызываем callback onOwnVesselClick");
|
|
||||||
markerClickListener.onOwnVesselClick(ownVessel);
|
markerClickListener.onOwnVesselClick(ownVessel);
|
||||||
} else {
|
|
||||||
android.util.Log.e("YandexMapImpl", "markerClickListener == null или ownVessel == null!");
|
|
||||||
android.util.Log.d("YandexMapImpl", "markerClickListener = " + (markerClickListener != null ? "установлен" : "null"));
|
|
||||||
android.util.Log.d("YandexMapImpl", "ownVessel = " + (ownVessel != null ? "установлен" : "null"));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
ownVesselClickListenerSet = true;
|
ownVesselClickListenerSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
android.util.Log.d("YandexMapImpl", "Маркер нашего судна создан и настроен, markerClickListener = " + (markerClickListener != null ? "установлен" : "null"));
|
|
||||||
|
|
||||||
// Проверяем, что маркер действительно добавлен в коллекцию
|
|
||||||
android.util.Log.d("YandexMapImpl", "Маркер добавлен в коллекцию объектов карты");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateOwnVesselPosition(Vessel vessel) {
|
public void updateOwnVesselPosition(Vessel vessel) {
|
||||||
android.util.Log.d("YandexMapImpl", "updateOwnVesselPosition вызван: lat=" + vessel.getLatitude() + ", lon=" + vessel.getLongitude() + ", course=" + vessel.getCourse() + "°");
|
|
||||||
|
|
||||||
// Обновляем ссылку на судно
|
// Обновляем ссылку на судно
|
||||||
this.ownVessel = vessel;
|
this.ownVessel = vessel;
|
||||||
|
|
||||||
// Проверяем координаты
|
// Проверяем валидность координат (исключаем только невалидные значения)
|
||||||
if (vessel.getLatitude() == 0.0 && vessel.getLongitude() == 0.0) {
|
if (Double.isNaN(vessel.getLatitude()) || Double.isNaN(vessel.getLongitude()) ||
|
||||||
android.util.Log.w("YandexMapImpl", "Координаты равны 0,0 - обновление пропущено");
|
Double.isInfinite(vessel.getLatitude()) || Double.isInfinite(vessel.getLongitude())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ownVesselMarker == null) {
|
if (ownVesselMarker == null) {
|
||||||
// Создаем маркер нашего судна, если его еще нет
|
// Создаем маркер нашего судна, если его еще нет
|
||||||
android.util.Log.d("YandexMapImpl", "Создаем новый маркер нашего судна");
|
|
||||||
addOwnVesselMarker(vessel);
|
addOwnVesselMarker(vessel);
|
||||||
} else {
|
} else {
|
||||||
// Проверяем, нужно ли обновить курс
|
// Всегда обновляем иконку с текущим курсом
|
||||||
boolean needCourseUpdate = Math.abs(vessel.getCourse()) > 0.1; // Если курс больше 0.1 градуса
|
// Обновляем иконку с новым курсом (синий цвет для нашего судна)
|
||||||
|
setMarkerIcon(ownVesselMarker, "target", vessel.getCourse(), android.graphics.Color.BLUE);
|
||||||
if (needCourseUpdate) {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Обновляем курс маркера на " + vessel.getCourse() + "°");
|
|
||||||
// Обновляем только иконку с новым курсом
|
|
||||||
setMarkerIcon(ownVesselMarker, "arrowship", vessel.getCourse());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Обновляем позицию маркера
|
// Обновляем позицию маркера
|
||||||
Point newPoint = new Point(vessel.getLatitude(), vessel.getLongitude());
|
Point newPoint = new Point(vessel.getLatitude(), vessel.getLongitude());
|
||||||
ownVesselMarker.setGeometry(newPoint);
|
ownVesselMarker.setGeometry(newPoint);
|
||||||
android.util.Log.d("YandexMapImpl", "Позиция маркера обновлена на: " + newPoint);
|
|
||||||
|
|
||||||
// Переустанавливаем обработчик клика после обновления маркера
|
// Обработчик клика уже установлен при создании маркера, не добавляем повторно
|
||||||
if (markerClickListener != null) {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Переустанавливаем обработчик клика после обновления маркера");
|
|
||||||
// В Яндекс.Картах нет метода setTapListener(null), поэтому просто добавляем новый обработчик
|
|
||||||
ownVesselMarker.addTapListener((mapObject, point1) -> {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Клик по маркеру нашего судна!");
|
|
||||||
if (markerClickListener != null && ownVessel != null) {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Вызываем callback onOwnVesselClick");
|
|
||||||
markerClickListener.onOwnVesselClick(ownVessel);
|
|
||||||
} else {
|
|
||||||
android.util.Log.e("YandexMapImpl", "markerClickListener == null или ownVessel == null!");
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
android.util.Log.d("YandexMapImpl", "Маркер нашего судна обновлен, ownVesselMarker = " + (ownVesselMarker != null ? "создан" : "null") + ", markerClickListener = " + (markerClickListener != null ? "установлен" : "null"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addAISVesselMarker(AISVessel vessel) {
|
public void addAISVesselMarker(AISVessel vessel) {
|
||||||
android.util.Log.d("YandexMapImpl", "addAISVesselMarker вызван: lat=" + vessel.getLatitude() + ", lon=" + vessel.getLongitude() + ", course=" + vessel.getCourse() + "°");
|
// Проверяем валидность координат (исключаем только невалидные значения)
|
||||||
|
if (Double.isNaN(vessel.getLatitude()) || Double.isNaN(vessel.getLongitude()) ||
|
||||||
|
Double.isInfinite(vessel.getLatitude()) || Double.isInfinite(vessel.getLongitude())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Point point = new Point(vessel.getLatitude(), vessel.getLongitude());
|
Point point = new Point(vessel.getLatitude(), vessel.getLongitude());
|
||||||
com.yandex.mapkit.map.PlacemarkMapObject marker = mapObjects.addPlacemark(point);
|
com.yandex.mapkit.map.PlacemarkMapObject marker = mapObjects.addPlacemark(point);
|
||||||
|
|
||||||
|
if (marker == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Сохраняем ссылку на судно
|
// Сохраняем ссылку на судно
|
||||||
aisVessels.put(vessel.getMmsi(), vessel);
|
aisVessels.put(vessel.getMmsi(), vessel);
|
||||||
|
|
||||||
// Используем готовую иконку стрелки для AIS судов с учетом курса
|
// Используем готовую иконку стрелки для AIS судов с учетом курса и цвета
|
||||||
setMarkerIcon(marker, "arrowship", vessel.getCourse());
|
int vesselColor = getVesselColor(vessel);
|
||||||
|
setMarkerIcon(marker, "target", vessel.getCourse(), vesselColor, vessel.isSelected());
|
||||||
|
|
||||||
// Устанавливаем размер иконки
|
// Устанавливаем размер иконки
|
||||||
com.yandex.mapkit.map.IconStyle iconStyle = new com.yandex.mapkit.map.IconStyle();
|
com.yandex.mapkit.map.IconStyle iconStyle = new com.yandex.mapkit.map.IconStyle();
|
||||||
iconStyle.setScale(1.5f); // Увеличиваем размер иконки
|
iconStyle.setScale(1.0f); // Уменьшаем масштаб иконки
|
||||||
marker.setIconStyle(iconStyle);
|
marker.setIconStyle(iconStyle);
|
||||||
|
|
||||||
// Установка обработчика кликов только если он еще не установлен
|
// Установка обработчика кликов только если он еще не установлен
|
||||||
String mmsi = vessel.getMmsi();
|
String mmsi = vessel.getMmsi();
|
||||||
if (!aisVesselClickListenersSet.containsKey(mmsi) || !aisVesselClickListenersSet.get(mmsi)) {
|
if (!aisVesselClickListenersAdded.containsKey(mmsi) || !aisVesselClickListenersAdded.get(mmsi)) {
|
||||||
marker.addTapListener((mapObject, point1) -> {
|
marker.addTapListener((mapObject, point1) -> {
|
||||||
android.util.Log.d("YandexMapImpl", "Клик по AIS маркеру: " + mmsi);
|
// Проверяем двойной клик
|
||||||
|
long currentTime = System.currentTimeMillis();
|
||||||
|
Long lastTime = lastClickTime.get(mmsi);
|
||||||
|
|
||||||
|
if (lastTime != null && (currentTime - lastTime) < DOUBLE_CLICK_DELAY) {
|
||||||
|
// Двойной клик - вызываем BottomSheet
|
||||||
if (markerClickListener != null) {
|
if (markerClickListener != null) {
|
||||||
android.util.Log.d("YandexMapImpl", "Вызываем callback onAISVesselClick");
|
|
||||||
markerClickListener.onAISVesselClick(vessel);
|
markerClickListener.onAISVesselClick(vessel);
|
||||||
} else {
|
|
||||||
android.util.Log.e("YandexMapImpl", "markerClickListener == null!");
|
|
||||||
android.util.Log.d("YandexMapImpl", "markerClickListener = " + (markerClickListener != null ? "установлен" : "null"));
|
|
||||||
}
|
}
|
||||||
|
lastClickTime.remove(mmsi); // Сбрасываем для следующего двойного клика
|
||||||
|
} else {
|
||||||
|
// Одиночный клик - выделяем/снимаем выделение
|
||||||
|
toggleVesselSelection(vessel);
|
||||||
|
lastClickTime.put(mmsi, currentTime);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
aisVesselClickListenersSet.put(mmsi, true);
|
aisVesselClickListenersAdded.put(mmsi, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
aisMarkers.put(vessel.getMmsi(), marker);
|
aisMarkers.put(vessel.getMmsi(), marker);
|
||||||
@@ -243,27 +219,11 @@ public class YandexMapImpl implements MapInterface {
|
|||||||
Point newPoint = new Point(vessel.getLatitude(), vessel.getLongitude());
|
Point newPoint = new Point(vessel.getLatitude(), vessel.getLongitude());
|
||||||
marker.setGeometry(newPoint);
|
marker.setGeometry(newPoint);
|
||||||
|
|
||||||
// Обновляем курс маркера, если он изменился
|
// Всегда обновляем курс маркера
|
||||||
if (Math.abs(vessel.getCourse()) > 0.1) {
|
int vesselColor = getVesselColor(vessel);
|
||||||
android.util.Log.d("YandexMapImpl", "Обновляем курс AIS маркера " + vessel.getMmsi() + " на " + vessel.getCourse() + "°");
|
setMarkerIcon(marker, "target", vessel.getCourse(), vesselColor, vessel.isSelected());
|
||||||
setMarkerIcon(marker, "arrowship", vessel.getCourse());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Переустанавливаем обработчик клика после обновления маркера
|
// Обработчик клика уже установлен при создании маркера, не добавляем повторно
|
||||||
if (markerClickListener != null) {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Переустанавливаем обработчик клика для AIS маркера: " + vessel.getMmsi());
|
|
||||||
// В Яндекс.Картах нет метода setTapListener(null), поэтому просто добавляем новый обработчик
|
|
||||||
marker.addTapListener((mapObject, point1) -> {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Клик по AIS маркеру: " + vessel.getMmsi());
|
|
||||||
if (markerClickListener != null) {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Вызываем callback onAISVesselClick");
|
|
||||||
markerClickListener.onAISVesselClick(vessel);
|
|
||||||
} else {
|
|
||||||
android.util.Log.e("YandexMapImpl", "markerClickListener == null!");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,8 +235,9 @@ public class YandexMapImpl implements MapInterface {
|
|||||||
}
|
}
|
||||||
// Удаляем ссылку на судно
|
// Удаляем ссылку на судно
|
||||||
aisVessels.remove(mmsi);
|
aisVessels.remove(mmsi);
|
||||||
// Удаляем флаг обработчика кликов
|
// Удаляем флаги обработчиков кликов
|
||||||
aisVesselClickListenersSet.remove(mmsi);
|
aisVesselClickListenersSet.remove(mmsi);
|
||||||
|
aisVesselClickListenersAdded.remove(mmsi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -287,6 +248,7 @@ public class YandexMapImpl implements MapInterface {
|
|||||||
aisMarkers.clear();
|
aisMarkers.clear();
|
||||||
aisVessels.clear();
|
aisVessels.clear();
|
||||||
aisVesselClickListenersSet.clear();
|
aisVesselClickListenersSet.clear();
|
||||||
|
aisVesselClickListenersAdded.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -322,7 +284,6 @@ public class YandexMapImpl implements MapInterface {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMarkerClickListener(MarkerClickListener listener) {
|
public void setMarkerClickListener(MarkerClickListener listener) {
|
||||||
android.util.Log.d("YandexMapImpl", "setMarkerClickListener вызван: " + (listener != null ? "listener установлен" : "listener == null"));
|
|
||||||
this.markerClickListener = listener;
|
this.markerClickListener = listener;
|
||||||
|
|
||||||
// Переустанавливаем обработчики кликов для всех существующих маркеров
|
// Переустанавливаем обработчики кликов для всех существующих маркеров
|
||||||
@@ -334,46 +295,108 @@ public class YandexMapImpl implements MapInterface {
|
|||||||
* Этот метод переустанавливает обработчики для всех маркеров
|
* Этот метод переустанавливает обработчики для всех маркеров
|
||||||
*/
|
*/
|
||||||
private void updateAllMarkerClickListeners() {
|
private void updateAllMarkerClickListeners() {
|
||||||
android.util.Log.d("YandexMapImpl", "updateAllMarkerClickListeners вызван - переустанавливаем обработчики");
|
// Обработчик для маркера нашего судна уже установлен при создании, не добавляем повторно
|
||||||
|
|
||||||
// Переустанавливаем обработчик для маркера нашего судна
|
// Обработчики для AIS маркеров уже установлены при создании, не добавляем повторно
|
||||||
if (ownVesselMarker != null) {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Переустанавливаем обработчик для маркера нашего судна");
|
|
||||||
// В Яндекс.Картах нет метода setTapListener(null), поэтому просто добавляем новый обработчик
|
|
||||||
ownVesselMarker.addTapListener((mapObject, point1) -> {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Клик по маркеру нашего судна!");
|
|
||||||
if (markerClickListener != null && ownVessel != null) {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Вызываем callback onOwnVesselClick");
|
|
||||||
markerClickListener.onOwnVesselClick(ownVessel);
|
|
||||||
} else {
|
|
||||||
android.util.Log.e("YandexMapImpl", "markerClickListener == null или ownVessel == null!");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
ownVesselClickListenerSet = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Переустанавливаем обработчики для AIS маркеров
|
/**
|
||||||
for (Map.Entry<String, com.yandex.mapkit.map.PlacemarkMapObject> entry : aisMarkers.entrySet()) {
|
* Создание повернутой цветной иконки из ресурса
|
||||||
String mmsi = entry.getKey();
|
*/
|
||||||
com.yandex.mapkit.map.PlacemarkMapObject marker = entry.getValue();
|
private Bitmap createRotatedIconFromResource(int resourceId, double course, int color) {
|
||||||
AISVessel vessel = aisVessels.get(mmsi);
|
return createRotatedIconFromResource(resourceId, course, color, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (marker != null && vessel != null) {
|
/**
|
||||||
android.util.Log.d("YandexMapImpl", "Переустанавливаем обработчик для AIS маркера: " + mmsi);
|
* Создание повернутой цветной иконки из ресурса с поддержкой выделения
|
||||||
// В Яндекс.Картах нет метода setTapListener(null), поэтому просто добавляем новый обработчик
|
*/
|
||||||
marker.addTapListener((mapObject, point1) -> {
|
private Bitmap createRotatedIconFromResource(int resourceId, double course, int color, boolean isSelected) {
|
||||||
android.util.Log.d("YandexMapImpl", "Клик по AIS маркеру: " + mmsi);
|
try {
|
||||||
if (markerClickListener != null) {
|
// Получаем drawable из ресурса
|
||||||
android.util.Log.d("YandexMapImpl", "Вызываем callback onAISVesselClick");
|
Drawable drawable = context.getResources().getDrawable(resourceId, null);
|
||||||
markerClickListener.onAISVesselClick(vessel);
|
if (drawable == null) {
|
||||||
} else {
|
return null;
|
||||||
android.util.Log.e("YandexMapImpl", "markerClickListener == null!");
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
});
|
// Применяем цвет к drawable
|
||||||
aisVesselClickListenersSet.put(mmsi, true);
|
if (color != 0) {
|
||||||
|
drawable.setColorFilter(color, android.graphics.PorterDuff.Mode.SRC_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Получаем оригинальные размеры drawable
|
||||||
|
int originalWidth = drawable.getIntrinsicWidth();
|
||||||
|
int originalHeight = drawable.getIntrinsicHeight();
|
||||||
|
|
||||||
|
// Если размеры не определены, используем стандартные
|
||||||
|
if (originalWidth <= 0) originalWidth = 32;
|
||||||
|
if (originalHeight <= 0) originalHeight = 48;
|
||||||
|
|
||||||
|
// Масштабируем размеры (уменьшаем еще больше)
|
||||||
|
float scale = 0.3f; // Уменьшаем в 3.3 раза
|
||||||
|
int width = (int) (originalWidth * scale);
|
||||||
|
int height = (int) (originalHeight * scale);
|
||||||
|
|
||||||
|
// Получаем азимут карты (поворот карты)
|
||||||
|
float mapAzimuth = 0.0f;
|
||||||
|
try {
|
||||||
|
CameraPosition cameraPosition = mapView.getMap().getCameraPosition();
|
||||||
|
mapAzimuth = cameraPosition.getAzimuth();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Не удалось получить азимут карты
|
||||||
|
}
|
||||||
|
|
||||||
|
// Создаем bitmap минимального размера для уменьшения хитбокса
|
||||||
|
int bitmapSize = Math.max(width, height) + 8; // Добавляем только небольшой отступ
|
||||||
|
Bitmap bitmap = Bitmap.createBitmap(bitmapSize, bitmapSize, Bitmap.Config.ARGB_8888);
|
||||||
|
Canvas canvas = new Canvas(bitmap);
|
||||||
|
|
||||||
|
// Поворачиваем маркер на курс судна с учетом поворота карты
|
||||||
|
// Курс судна - это направление относительно севера
|
||||||
|
// Азимут карты - это поворот карты относительно севера
|
||||||
|
// Итоговый поворот = курс судна - азимут карты (чтобы маркер оставался относительно севера)
|
||||||
|
float rotationAngle = (float) (course - mapAzimuth);
|
||||||
|
|
||||||
|
// Центрируем drawable в bitmap
|
||||||
|
int centerX = bitmapSize / 2;
|
||||||
|
int centerY = bitmapSize / 2;
|
||||||
|
int left = centerX - width / 2;
|
||||||
|
int top = centerY - height / 2;
|
||||||
|
|
||||||
|
// Устанавливаем границы для drawable
|
||||||
|
drawable.setBounds(left, top, left + width, top + height);
|
||||||
|
|
||||||
|
// Поворачиваем canvas на курс
|
||||||
|
canvas.save();
|
||||||
|
canvas.rotate(rotationAngle, centerX, centerY);
|
||||||
|
|
||||||
|
// Рисуем drawable
|
||||||
|
drawable.draw(canvas);
|
||||||
|
|
||||||
|
canvas.restore();
|
||||||
|
|
||||||
|
// Если судно выделено, добавляем рамку выделения
|
||||||
|
if (isSelected) {
|
||||||
|
// Получаем drawable для рамки выделения
|
||||||
|
Drawable selectionDrawable = context.getResources().getDrawable(
|
||||||
|
context.getResources().getIdentifier("chosentarget", "drawable", context.getPackageName()), null);
|
||||||
|
|
||||||
|
if (selectionDrawable != null) {
|
||||||
|
// Масштабируем рамку выделения
|
||||||
|
int selectionSize = Math.max(width, height) + 16; // Рамка немного больше
|
||||||
|
int selectionLeft = centerX - selectionSize / 2;
|
||||||
|
int selectionTop = centerY - selectionSize / 2;
|
||||||
|
|
||||||
|
selectionDrawable.setBounds(selectionLeft, selectionTop,
|
||||||
|
selectionLeft + selectionSize, selectionTop + selectionSize);
|
||||||
|
|
||||||
|
// Рисуем рамку выделения
|
||||||
|
selectionDrawable.draw(canvas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bitmap;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,10 +433,8 @@ public class YandexMapImpl implements MapInterface {
|
|||||||
canvas.drawPath(path, paint);
|
canvas.drawPath(path, paint);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
|
|
||||||
android.util.Log.d("YandexMapImpl", "Программная иконка с курсом " + course + "° создана успешно, размер: " + size + "x" + size);
|
|
||||||
return bitmap;
|
return bitmap;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
android.util.Log.e("YandexMapImpl", "Ошибка создания программной иконки: " + e.getMessage(), e);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -429,7 +450,6 @@ public class YandexMapImpl implements MapInterface {
|
|||||||
* Принудительно пересоздает маркер нашего судна с иконкой
|
* Принудительно пересоздает маркер нашего судна с иконкой
|
||||||
*/
|
*/
|
||||||
public void recreateOwnVesselMarker(Vessel vessel) {
|
public void recreateOwnVesselMarker(Vessel vessel) {
|
||||||
android.util.Log.d("YandexMapImpl", "Принудительно пересоздаем маркер нашего судна");
|
|
||||||
if (ownVesselMarker != null) {
|
if (ownVesselMarker != null) {
|
||||||
mapObjects.remove(ownVesselMarker);
|
mapObjects.remove(ownVesselMarker);
|
||||||
ownVesselMarker = null;
|
ownVesselMarker = null;
|
||||||
@@ -442,7 +462,6 @@ public class YandexMapImpl implements MapInterface {
|
|||||||
* Вызывается после закрытия BottomSheet для восстановления функциональности
|
* Вызывается после закрытия BottomSheet для восстановления функциональности
|
||||||
*/
|
*/
|
||||||
public void refreshMarkerClickListeners() {
|
public void refreshMarkerClickListeners() {
|
||||||
android.util.Log.d("YandexMapImpl", "refreshMarkerClickListeners вызван - переустанавливаем все обработчики");
|
|
||||||
updateAllMarkerClickListeners();
|
updateAllMarkerClickListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,84 +469,143 @@ public class YandexMapImpl implements MapInterface {
|
|||||||
* Устанавливает иконку для маркера с fallback
|
* Устанавливает иконку для маркера с fallback
|
||||||
*/
|
*/
|
||||||
private void setMarkerIcon(com.yandex.mapkit.map.PlacemarkMapObject marker, String iconName, double course) {
|
private void setMarkerIcon(com.yandex.mapkit.map.PlacemarkMapObject marker, String iconName, double course) {
|
||||||
try {
|
setMarkerIcon(marker, iconName, course, 0); // По умолчанию без цвета
|
||||||
android.util.Log.d("YandexMapImpl", "Пытаемся установить иконку: " + iconName + " с курсом: " + course + "°");
|
|
||||||
android.util.Log.d("YandexMapImpl", "Package name: " + context.getPackageName());
|
|
||||||
|
|
||||||
// Сначала пробуем создать программную иконку с учетом курса
|
|
||||||
android.util.Log.d("YandexMapImpl", "Создаем программную иконку стрелки с курсом " + course + "°...");
|
|
||||||
Bitmap iconBitmap = createVesselIcon(android.graphics.Color.BLUE, course);
|
|
||||||
if (iconBitmap != null) {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Программная иконка с курсом " + course + "° создана, устанавливаем...");
|
|
||||||
marker.setIcon(ImageProvider.fromBitmap(iconBitmap));
|
|
||||||
android.util.Log.d("YandexMapImpl", "Программная иконка с курсом " + course + "° установлена успешно");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Если программная иконка не создалась, пробуем ресурс
|
/**
|
||||||
|
* Устанавливает цветную иконку для маркера с fallback
|
||||||
|
*/
|
||||||
|
private void setMarkerIcon(com.yandex.mapkit.map.PlacemarkMapObject marker, String iconName, double course, int color) {
|
||||||
|
setMarkerIcon(marker, iconName, course, color, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Устанавливает цветную иконку для маркера с поддержкой выделения
|
||||||
|
*/
|
||||||
|
private void setMarkerIcon(com.yandex.mapkit.map.PlacemarkMapObject marker, String iconName, double course, int color, boolean isSelected) {
|
||||||
|
try {
|
||||||
|
// Сначала пробуем использовать ресурс с поворотом
|
||||||
int iconResId = context.getResources().getIdentifier(iconName, "drawable", context.getPackageName());
|
int iconResId = context.getResources().getIdentifier(iconName, "drawable", context.getPackageName());
|
||||||
android.util.Log.d("YandexMapImpl", "ID ресурса " + iconName + ": " + iconResId);
|
|
||||||
|
|
||||||
if (iconResId != 0) {
|
if (iconResId != 0) {
|
||||||
android.util.Log.d("YandexMapImpl", "Устанавливаем иконку из ресурса...");
|
Bitmap rotatedBitmap = createRotatedIconFromResource(iconResId, course, color, isSelected);
|
||||||
marker.setIcon(ImageProvider.fromResource(context, iconResId));
|
if (rotatedBitmap != null) {
|
||||||
android.util.Log.d("YandexMapImpl", "Иконка " + iconName + " установлена успешно");
|
marker.setIcon(ImageProvider.fromBitmap(rotatedBitmap));
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
marker.setIcon(ImageProvider.fromResource(context, iconResId));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Если ресурс не найден, создаем программную иконку с учетом курса
|
||||||
|
Bitmap iconBitmap = createVesselIcon(android.graphics.Color.BLUE, course);
|
||||||
|
if (iconBitmap != null) {
|
||||||
|
marker.setIcon(ImageProvider.fromBitmap(iconBitmap));
|
||||||
} else {
|
} else {
|
||||||
android.util.Log.e("YandexMapImpl", "Не удалось найти ресурс " + iconName);
|
|
||||||
android.util.Log.d("YandexMapImpl", "Используем fallback иконку...");
|
|
||||||
// Создаем простую иконку как fallback
|
// Создаем простую иконку как fallback
|
||||||
marker.setIcon(ImageProvider.fromResource(context, android.R.drawable.ic_menu_compass));
|
marker.setIcon(ImageProvider.fromResource(context, android.R.drawable.ic_menu_compass));
|
||||||
android.util.Log.d("YandexMapImpl", "Fallback иконка установлена");
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
android.util.Log.e("YandexMapImpl", "Ошибка установки иконки " + iconName + ": " + e.getMessage(), e);
|
|
||||||
android.util.Log.d("YandexMapImpl", "Используем fallback иконку после ошибки...");
|
|
||||||
// Создаем простую иконку как fallback
|
// Создаем простую иконку как fallback
|
||||||
marker.setIcon(ImageProvider.fromResource(context, android.R.drawable.ic_menu_compass));
|
marker.setIcon(ImageProvider.fromResource(context, android.R.drawable.ic_menu_compass));
|
||||||
android.util.Log.d("YandexMapImpl", "Fallback иконка установлена после ошибки");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// После установки иконки проверяем, что обработчик клика все еще работает
|
// После установки иконки проверяем, что обработчик клика все еще работает
|
||||||
// Это может помочь с проблемами, когда установка иконки нарушает обработчики
|
// Это может помочь с проблемами, когда установка иконки нарушает обработчики
|
||||||
android.util.Log.d("YandexMapImpl", "Иконка установлена, проверяем обработчик клика...");
|
|
||||||
|
|
||||||
// Дополнительная проверка: если это маркер нашего судна, переустанавливаем обработчик клика
|
// Обработчик клика для нашего судна уже установлен при создании маркера, не добавляем повторно
|
||||||
if (marker == ownVesselMarker && markerClickListener != null) {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Переустанавливаем обработчик клика для маркера нашего судна после установки иконки");
|
// Обработчики кликов уже установлены при создании маркеров, не добавляем повторно
|
||||||
// В Яндекс.Картах нет метода setTapListener(null), поэтому просто добавляем новый обработчик
|
|
||||||
marker.addTapListener((mapObject, point1) -> {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Клик по маркеру нашего судна!");
|
|
||||||
if (markerClickListener != null && ownVessel != null) {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Вызываем callback onOwnVesselClick");
|
|
||||||
markerClickListener.onOwnVesselClick(ownVessel);
|
|
||||||
} else {
|
|
||||||
android.util.Log.e("YandexMapImpl", "markerClickListener == null или ownVessel == null!");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Дополнительная проверка: если это AIS маркер, переустанавливаем обработчик клика
|
/**
|
||||||
|
* Настройка слушателя поворота карты
|
||||||
|
*/
|
||||||
|
private void setupCameraListener() {
|
||||||
|
try {
|
||||||
|
inputListener = new com.yandex.mapkit.map.InputListener() {
|
||||||
|
@Override
|
||||||
|
public void onMapTap(com.yandex.mapkit.map.Map map, com.yandex.mapkit.geometry.Point point) {
|
||||||
|
// Не обрабатываем клики по карте
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMapLongTap(com.yandex.mapkit.map.Map map, com.yandex.mapkit.geometry.Point point) {
|
||||||
|
// Не обрабатываем долгие клики по карте
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Добавляем слушатель к карте
|
||||||
|
mapView.getMap().addInputListener(inputListener);
|
||||||
|
|
||||||
|
// Включаем жесты поворота карты
|
||||||
|
mapView.getMap().setRotateGesturesEnabled(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Ошибка установки слушателя
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Перерисовывает все маркеры с учетом текущего азимута карты
|
||||||
|
* Вызывается при повороте карты
|
||||||
|
*/
|
||||||
|
public void refreshAllMarkers() {
|
||||||
|
// Перерисовываем маркер нашего судна (синий цвет)
|
||||||
|
if (ownVesselMarker != null && ownVessel != null) {
|
||||||
|
setMarkerIcon(ownVesselMarker, "target", ownVessel.getCourse(), android.graphics.Color.BLUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Перерисовываем все AIS маркеры с их цветами
|
||||||
for (Map.Entry<String, com.yandex.mapkit.map.PlacemarkMapObject> entry : aisMarkers.entrySet()) {
|
for (Map.Entry<String, com.yandex.mapkit.map.PlacemarkMapObject> entry : aisMarkers.entrySet()) {
|
||||||
if (entry.getValue() == marker && markerClickListener != null) {
|
|
||||||
String mmsi = entry.getKey();
|
String mmsi = entry.getKey();
|
||||||
|
com.yandex.mapkit.map.PlacemarkMapObject marker = entry.getValue();
|
||||||
AISVessel vessel = aisVessels.get(mmsi);
|
AISVessel vessel = aisVessels.get(mmsi);
|
||||||
if (vessel != null) {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Переустанавливаем обработчик клика для AIS маркера " + mmsi + " после установки иконки");
|
if (marker != null && vessel != null) {
|
||||||
// В Яндекс.Картах нет метода setTapListener(null), поэтому просто добавляем новый обработчик
|
int vesselColor = getVesselColor(vessel);
|
||||||
marker.addTapListener((mapObject, point1) -> {
|
setMarkerIcon(marker, "target", vessel.getCourse(), vesselColor, vessel.isSelected());
|
||||||
android.util.Log.d("YandexMapImpl", "Клик по AIS маркеру: " + mmsi);
|
|
||||||
if (markerClickListener != null) {
|
|
||||||
android.util.Log.d("YandexMapImpl", "Вызываем callback onAISVesselClick");
|
|
||||||
markerClickListener.onAISVesselClick(vessel);
|
|
||||||
} else {
|
|
||||||
android.util.Log.e("YandexMapImpl", "markerClickListener == null!");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Переключает выделение AIS судна
|
||||||
|
*/
|
||||||
|
private void toggleVesselSelection(AISVessel vessel) {
|
||||||
|
vessel.setSelected(!vessel.isSelected());
|
||||||
|
|
||||||
|
// Обновляем иконку маркера с учетом состояния выделения
|
||||||
|
com.yandex.mapkit.map.PlacemarkMapObject marker = aisMarkers.get(vessel.getMmsi());
|
||||||
|
if (marker != null) {
|
||||||
|
int vesselColor = getVesselColor(vessel);
|
||||||
|
setMarkerIcon(marker, "target", vessel.getCourse(), vesselColor, vessel.isSelected());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Получает цвет для AIS судна в зависимости от его статуса
|
||||||
|
*/
|
||||||
|
private int getVesselColor(AISVessel vessel) {
|
||||||
|
// Можно настроить цвета в зависимости от параметров судна
|
||||||
|
// Используем navigation status из AIS данных
|
||||||
|
String navStatus = vessel.getNavigationalStatus();
|
||||||
|
if (navStatus != null) {
|
||||||
|
switch (navStatus.toLowerCase()) {
|
||||||
|
case "under way using engine":
|
||||||
|
case "under way":
|
||||||
|
return android.graphics.Color.GREEN;
|
||||||
|
case "at anchor":
|
||||||
|
return android.graphics.Color.YELLOW;
|
||||||
|
case "moored":
|
||||||
|
return android.graphics.Color.BLUE;
|
||||||
|
case "not under command":
|
||||||
|
case "restricted manoeuvrability":
|
||||||
|
return android.graphics.Color.RED;
|
||||||
|
default:
|
||||||
|
return android.graphics.Color.WHITE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return android.graphics.Color.WHITE; // По умолчанию белый
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class AISVessel {
|
|||||||
private boolean positionAccuracy; // точность позиции
|
private boolean positionAccuracy; // точность позиции
|
||||||
private String vesselClass; // класс судна (Class A, Class B, Extended Class B)
|
private String vesselClass; // класс судна (Class A, Class B, Extended Class B)
|
||||||
private String vendorId; // идентификатор производителя оборудования
|
private String vendorId; // идентификатор производителя оборудования
|
||||||
|
private boolean selected; // выделено ли судно на карте
|
||||||
|
|
||||||
public AISVessel() {
|
public AISVessel() {
|
||||||
this.lastUpdate = LocalDateTime.now();
|
this.lastUpdate = LocalDateTime.now();
|
||||||
@@ -110,6 +111,9 @@ public class AISVessel {
|
|||||||
public String getVendorId() { return vendorId; }
|
public String getVendorId() { return vendorId; }
|
||||||
public void setVendorId(String vendorId) { this.vendorId = vendorId; }
|
public void setVendorId(String vendorId) { this.vendorId = vendorId; }
|
||||||
|
|
||||||
|
public boolean isSelected() { return selected; }
|
||||||
|
public void setSelected(boolean selected) { this.selected = selected; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Обновляет позицию и курс судна
|
* Обновляет позицию и курс судна
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="232.51dp"
|
||||||
|
android:height="232.77dp"
|
||||||
|
android:viewportWidth="232.51"
|
||||||
|
android:viewportHeight="232.77">
|
||||||
|
<group>
|
||||||
|
<clip-path
|
||||||
|
android:pathData="M153.63,0l0,0l78.88,0l0,79.69l-78.88,0l0,-79.69z"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M153.63,4.5L232.51,4.5"
|
||||||
|
android:strokeWidth="9"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<clip-path
|
||||||
|
android:pathData="M153.63,0l0,0l78.88,0l0,79.69l-78.88,0l0,-79.69z"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M227.77,0.82L227.77,79.69"
|
||||||
|
android:strokeWidth="9"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<clip-path
|
||||||
|
android:pathData="M153.63,232.77l0,0l78.88,0l0,-79.69l-78.88,0l0,79.69z"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M153.63,228.27L232.51,228.27"
|
||||||
|
android:strokeWidth="9"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<clip-path
|
||||||
|
android:pathData="M153.63,232.77l0,0l78.88,0l0,-79.69l-78.88,0l0,79.69z"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M227.77,231.95L227.77,153.08"
|
||||||
|
android:strokeWidth="9"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<clip-path
|
||||||
|
android:pathData="M0,79.69l0,0l78.87,0l0,-79.69l-78.87,0l0,79.69z"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M78.87,4.5L0,4.5"
|
||||||
|
android:strokeWidth="9"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<clip-path
|
||||||
|
android:pathData="M0,79.69l0,0l78.87,0l0,-79.69l-78.87,0l0,79.69z"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M4.73,0.82L4.73,79.69"
|
||||||
|
android:strokeWidth="9"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<clip-path
|
||||||
|
android:pathData="M0,153.08l0,0l78.87,0l0,79.69l-78.87,0l0,-79.69z"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M78.87,228.27L0,228.27"
|
||||||
|
android:strokeWidth="9"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<clip-path
|
||||||
|
android:pathData="M0,153.08l0,0l78.87,0l0,79.69l-78.87,0l0,-79.69z"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M4.73,231.95L4.73,153.08"
|
||||||
|
android:strokeWidth="9"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000"/>
|
||||||
|
</group>
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="239.36dp"
|
||||||
|
android:height="239.36dp"
|
||||||
|
android:viewportWidth="239.36"
|
||||||
|
android:viewportHeight="239.36">
|
||||||
|
<path
|
||||||
|
android:pathData="M3.18,3.18L236.18,236.18"
|
||||||
|
android:strokeWidth="9"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M236.18,3.18L3.18,236.18"
|
||||||
|
android:strokeWidth="9"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000"/>
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="165.04dp"
|
||||||
|
android:height="282dp"
|
||||||
|
android:viewportWidth="165.04"
|
||||||
|
android:viewportHeight="282">
|
||||||
|
<path
|
||||||
|
android:pathData="M120.41,4.5l-77.27,0l-38.64,88.31l0,184.69l156,0l-1.46,-184.69l-38.63,-88.31z"
|
||||||
|
android:strokeWidth="9"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000"/>
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="91.38dp"
|
||||||
|
android:height="162.6dp"
|
||||||
|
android:viewportWidth="91.38"
|
||||||
|
android:viewportHeight="162.6">
|
||||||
|
<path
|
||||||
|
android:pathData="M45.69,16.63l-39.75,141.47l79.5,0l-39.75,-141.47z"
|
||||||
|
android:strokeWidth="9"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000"/>
|
||||||
|
</vector>
|
||||||
Reference in New Issue
Block a user