Commit 299a6009 authored by shigemi miura's avatar shigemi miura

Merge feature-backlog into master

parents 5eeb60b4 c3dcabeb
{
"images" : [
{
"filename" : "icon_ship_alarm.png",
"idiom" : "universal",
"scale" : "1x"
},
......@@ -9,7 +10,6 @@
"scale" : "2x"
},
{
"filename" : "swStartBack@2x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
{
"images" : [
{
"filename" : "icon_ship_caution.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "icon_ship_emergency.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "icon_ship_necstemergency.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "icon_ship_normal.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "icon_ship_offline.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "icon_ship_unknown.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "icon_ship_warning.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -188,9 +188,9 @@ extension ColorSet{
case .ChatDate:
"ChatDateColor"
case .BackgroundPrimary:
"PrimaryColor"
"BackgroundPrimaryColor"
case .BackgroundSecondary:
"SecondaryColor"
"BackgroundSecondaryColor"
case .BottomNav:
"BottomNavColor"
case .BackgroundTeriary:
......
......@@ -7,15 +7,64 @@
import Foundation
import CoreLocation
import SwiftUI
struct ecaInfo {
var areaId: Int
var name: String
var centerPosition: CLLocationCoordinate2D
var zoomLevel: CGFloat
}
var ecaDataTable:[ecaInfo] = [
ecaInfo(areaId: 1, name: "Iceland", centerPosition: CLLocationCoordinate2D(latitude: 62.56528431, longitude: -18.48170601), zoomLevel: 4.0),
ecaInfo(areaId: 11, name: "North American Atlantic Coasts", centerPosition: CLLocationCoordinate2D(latitude: 17.89000000, longitude: -79.69611111), zoomLevel: 1.0),
ecaInfo(areaId: 12, name: "North American Hawai", centerPosition: CLLocationCoordinate2D(latitude: 15.85444444, longitude: -158.32055556), zoomLevel: 4.0),
ecaInfo(areaId: 13, name: "North American Pacific Coasts", centerPosition: CLLocationCoordinate2D(latitude: 37.22750000, longitude: -128.67277778), zoomLevel: 1.0),
ecaInfo(areaId: 21, name: "North Sea 1", centerPosition: CLLocationCoordinate2D(latitude: 54.00000000, longitude: -4.00000000), zoomLevel: 3.0),
ecaInfo(areaId: 22, name: "North Sea 2", centerPosition: CLLocationCoordinate2D(latitude: 43.50000000, longitude: -4.78333333), zoomLevel: 4.0),
ecaInfo(areaId: 31, name: "Unites States Caribbean", centerPosition: CLLocationCoordinate2D(latitude: 13.37083333, longitude: -64.70083333), zoomLevel: 4.0),
ecaInfo(areaId: 41, name: "China Shore", centerPosition: CLLocationCoordinate2D(latitude: 12.13420000, longitude: 115.21700000), zoomLevel: 2.0),
ecaInfo(areaId: 42, name: "China Hainan", centerPosition: CLLocationCoordinate2D(latitude: 16.21260000, longitude: 110.15700000), zoomLevel: 5.0),
ecaInfo(areaId: 43, name: "China Yangtzi Shuifu,Yunnan", centerPosition: CLLocationCoordinate2D(latitude: 28.60531667, longitude: 104.40085000), zoomLevel: 11.0),
ecaInfo(areaId: 44, name: "China Yangtzi Liuhekou,Jiangsu1", centerPosition: CLLocationCoordinate2D(latitude: 31.52461111, longitude: 121.37808333), zoomLevel: 10.0),
ecaInfo(areaId: 45, name: "China Yangtzi Liuhekou,Jiangsu2", centerPosition: CLLocationCoordinate2D(latitude: 30.20172222, longitude: 121.32094444), zoomLevel: 8.0),
ecaInfo(areaId: 46, name: "China Xijiang Nanning,Guangxi", centerPosition: CLLocationCoordinate2D(latitude: 22.75000000, longitude: 108.31303333), zoomLevel: 11.0),
ecaInfo(areaId: 47, name: "China Xijiang Zhaoqing,Guangdong", centerPosition: CLLocationCoordinate2D(latitude: 23.08005000, longitude: 112.77791667), zoomLevel: 11.0),
ecaInfo(areaId: 51, name: "Korea Incheon, PyeongtaekDangjin Port", centerPosition: CLLocationCoordinate2D(latitude: 36.88996667, longitude: 126.05833333), zoomLevel: 7.0),
ecaInfo(areaId: 52, name: "Korea Yeosu, Gwangyang Port", centerPosition: CLLocationCoordinate2D(latitude: 34.21166667, longitude: 128.00022222), zoomLevel: 8.0),
ecaInfo(areaId: 53, name: "Korea Busan Port", centerPosition: CLLocationCoordinate2D(latitude: 34.81029311, longitude: 128.89994528), zoomLevel: 8.0),
ecaInfo(areaId: 54, name: "Korea Busan Port West", centerPosition: CLLocationCoordinate2D(latitude: 34.82819444, longitude: 128.82208333), zoomLevel: 9.0),
ecaInfo(areaId: 55, name: "Korea Ulsan Port", centerPosition: CLLocationCoordinate2D(latitude: 34.98933675, longitude: 129.52881635), zoomLevel: 8.0),
ecaInfo(areaId: 61, name: "Panama Canal Atlantic Entrance", centerPosition: CLLocationCoordinate2D(latitude: 7.09898818, longitude: -79.99448871), zoomLevel: 6.0),
ecaInfo(areaId: 62, name: "Panama Canal Pacific Entrance", centerPosition: CLLocationCoordinate2D(latitude: 6.65073570, longitude: -79.42740275), zoomLevel: 6.0)
]
class EcaArea {
@ObservedObject var ecaData = SharingData.eca
var sessionEcaArea = SessionEcaArea()
private func tableInit() {
for data in ecaDataTable {
if !ecaData.ecaArea.keys.contains(data.areaId) {
var reg = RegisteredEca(id: data.areaId, ecaName: data.name)!
reg.color = "0xFF0000" //ライン色(ARGB)
reg.centerPosition = data.centerPosition
reg.zoomLevel = data.zoomLevel
SharingData.eca.ecaArea.updateValue(reg, forKey: data.areaId)
}
}
}
func start() {
print(debug: "called")
tableInit()
sessionEcaArea.RequestEcaArea(responseEcaArea)
}
/**
* ECA領域読み込み
*/
private func responseEcaArea(result: Result<Data, APIError>) {
print(debug: "called")
switch result {
......@@ -24,6 +73,18 @@ class EcaArea {
let resjson = serverSession.fromJSON(resultData: resultData, resltType: [ResEcaArea].self)
if let res = resjson {
print(debug: res)
for ecaList in res {
if let position = ecaList.geometry {
var points: [CLLocationCoordinate2D] = []
position.forEach { point in
var ecaPoint: CLLocationCoordinate2D = CLLocationCoordinate2D()
ecaPoint.latitude = CLLocationDegrees(point.lat ?? 0.0)
ecaPoint.longitude = CLLocationDegrees(point.lon ?? 0.0)
points.append(ecaPoint)
}
SharingData.eca.ecaArea[ecaList.areaId]?.points = points
}
}
}
case .failure(let errorCode):
print(debug: errorCode)
......
......@@ -8,7 +8,7 @@
import Foundation
import CoreLocation
#if true
#if false
//ECA Coordinates China
var chinaShore:[CLLocationCoordinate2D] = [
CLLocationCoordinate2D(latitude: 39.82805556, longitude: 124.16833333),
......@@ -4283,7 +4283,7 @@ var panamaCanalAtlanticEntrance:[CLLocationCoordinate2D] = [
CLLocationCoordinate2D(latitude: 9.44860967, longitude: -79.77336823),
CLLocationCoordinate2D(latitude: 9.44550000, longitude: -79.77202778)
]
#endif
var panamaCanalPacificEntrance:[CLLocationCoordinate2D] = [
CLLocationCoordinate2D(latitude: 9.02033333, longitude: -79.36930556),
CLLocationCoordinate2D(latitude: 9.01445114, longitude: -79.36883975),
......@@ -4330,7 +4330,7 @@ var panamaCanalPacificEntrance:[CLLocationCoordinate2D] = [
class EcaCoordinatesTable : NSObject {
struct ecaData {
var id: Int
var areaId: Int
var name: String
var centerPosition: CLLocationCoordinate2D
var zoomLevel: CGFloat
......@@ -4338,39 +4338,40 @@ class EcaCoordinatesTable : NSObject {
}
var ecaDataTable:[ecaData] = [
ecaData(id: 1, name: "Iceland", centerPosition: CLLocationCoordinate2D(latitude: 62.56528431, longitude: -18.48170601), zoomLevel: 4.0, table: iceland),
ecaData(id: 11, name: "North American Atlantic Coasts", centerPosition: CLLocationCoordinate2D(latitude: 17.89000000, longitude: -79.69611111), zoomLevel: 1.0, table: northAmericanAtlanticCoasts),
ecaData(id: 12, name: "North American Hawai", centerPosition: CLLocationCoordinate2D(latitude: 15.85444444, longitude: -158.32055556), zoomLevel: 4.0, table: northAmericanHawai),
ecaData(id: 13, name: "North American Pacific Coasts", centerPosition: CLLocationCoordinate2D(latitude: 37.22750000, longitude: -128.67277778), zoomLevel: 1.0, table: northAmericanPacificCoasts),
ecaData(id: 21, name: "North Sea 1", centerPosition: CLLocationCoordinate2D(latitude: 54.00000000, longitude: -4.00000000), zoomLevel: 3.0, table: northSea1),
ecaData(id: 22, name: "North Sea 2", centerPosition: CLLocationCoordinate2D(latitude: 43.50000000, longitude: -4.78333333), zoomLevel: 4.0, table: northSea2),
ecaData(id: 31, name: "Unites States Caribbean", centerPosition: CLLocationCoordinate2D(latitude: 13.37083333, longitude: -64.70083333), zoomLevel: 4.0, table: unitesStatesCaribbean),
ecaData(id: 41, name: "China Shore", centerPosition: CLLocationCoordinate2D(latitude: 12.13420000, longitude: 115.21700000), zoomLevel: 2.0, table: chinaShore),
ecaData(id: 42, name: "China Hainan", centerPosition: CLLocationCoordinate2D(latitude: 16.21260000, longitude: 110.15700000), zoomLevel: 5.0, table: chinaHainan),
ecaData(id: 43, name: "China Yangtzi Shuifu,Yunnan", centerPosition: CLLocationCoordinate2D(latitude: 28.60531667, longitude: 104.40085000), zoomLevel: 11.0, table: chinaYangtziShuifuYunnan),
ecaData(id: 44, name: "China Yangtzi Liuhekou,Jiangsu1", centerPosition: CLLocationCoordinate2D(latitude: 31.52461111, longitude: 121.37808333), zoomLevel: 10.0, table: chinaYangtziLiuhekouJiangsu1),
ecaData(id: 45, name: "China Yangtzi Liuhekou,Jiangsu2", centerPosition: CLLocationCoordinate2D(latitude: 30.20172222, longitude: 121.32094444), zoomLevel: 8.0, table: chinaYangtziLiuhekouJiangsu2),
ecaData(id: 46, name: "China Xijiang Nanning,Guangxi", centerPosition: CLLocationCoordinate2D(latitude: 22.75000000, longitude: 108.31303333), zoomLevel: 11.0, table: chinaXijiangNanningGuangxi),
ecaData(id: 47, name: "China Xijiang Zhaoqing,Guangdong", centerPosition: CLLocationCoordinate2D(latitude: 23.08005000, longitude: 112.77791667), zoomLevel: 11.0, table: chinaXijiangNanningGuangdong),
ecaData(id: 51, name: "Korea Incheon, PyeongtaekDangjin Port", centerPosition: CLLocationCoordinate2D(latitude: 36.88996667, longitude: 126.05833333), zoomLevel: 7.0, table: incheonPyeongtaekDanjinPort),
ecaData(id: 52, name: "Korea Yeosu, Gwangyang Port", centerPosition: CLLocationCoordinate2D(latitude: 34.21166667, longitude: 128.00022222), zoomLevel: 8.0, table: yeosuGwangyangPort),
ecaData(id: 53, name: "Korea Busan Port", centerPosition: CLLocationCoordinate2D(latitude: 34.81029311, longitude: 128.89994528), zoomLevel: 8.0, table: koreaBusanPort),
ecaData(id: 54, name: "Korea Busan Port West", centerPosition: CLLocationCoordinate2D(latitude: 34.82819444, longitude: 128.82208333), zoomLevel: 9.0, table: koreaBusanPortWest),
ecaData(id: 55, name: "Korea Ulsan Port", centerPosition: CLLocationCoordinate2D(latitude: 34.98933675, longitude: 129.52881635), zoomLevel: 8.0, table: koreaUlsanPort),
ecaData(id: 61, name: "Panama Canal Atlantic Entrance", centerPosition: CLLocationCoordinate2D(latitude: 7.09898818, longitude: -79.99448871), zoomLevel: 6.0, table: panamaCanalAtlanticEntrance),
ecaData(id: 62, name: "Panama Canal Pacific Entrance", centerPosition: CLLocationCoordinate2D(latitude: 6.65073570, longitude: -79.42740275), zoomLevel: 6.0, table: panamaCanalPacificEntrance)
ecaData(areaId: 1, name: "Iceland", centerPosition: CLLocationCoordinate2D(latitude: 62.56528431, longitude: -18.48170601), zoomLevel: 4.0, table: iceland),
ecaData(areaId: 11, name: "North American Atlantic Coasts", centerPosition: CLLocationCoordinate2D(latitude: 17.89000000, longitude: -79.69611111), zoomLevel: 1.0, table: northAmericanAtlanticCoasts),
ecaData(areaId: 12, name: "North American Hawai", centerPosition: CLLocationCoordinate2D(latitude: 15.85444444, longitude: -158.32055556), zoomLevel: 4.0, table: northAmericanHawai),
ecaData(areaId: 13, name: "North American Pacific Coasts", centerPosition: CLLocationCoordinate2D(latitude: 37.22750000, longitude: -128.67277778), zoomLevel: 1.0, table: northAmericanPacificCoasts),
ecaData(areaId: 21, name: "North Sea 1", centerPosition: CLLocationCoordinate2D(latitude: 54.00000000, longitude: -4.00000000), zoomLevel: 3.0, table: northSea1),
ecaData(areaId: 22, name: "North Sea 2", centerPosition: CLLocationCoordinate2D(latitude: 43.50000000, longitude: -4.78333333), zoomLevel: 4.0, table: northSea2),
ecaData(areaId: 31, name: "Unites States Caribbean", centerPosition: CLLocationCoordinate2D(latitude: 13.37083333, longitude: -64.70083333), zoomLevel: 4.0, table: unitesStatesCaribbean),
ecaData(areaId: 41, name: "China Shore", centerPosition: CLLocationCoordinate2D(latitude: 12.13420000, longitude: 115.21700000), zoomLevel: 2.0, table: chinaShore),
ecaData(areaId: 42, name: "China Hainan", centerPosition: CLLocationCoordinate2D(latitude: 16.21260000, longitude: 110.15700000), zoomLevel: 5.0, table: chinaHainan),
ecaData(areaId: 43, name: "China Yangtzi Shuifu,Yunnan", centerPosition: CLLocationCoordinate2D(latitude: 28.60531667, longitude: 104.40085000), zoomLevel: 11.0, table: chinaYangtziShuifuYunnan),
ecaData(areaId: 44, name: "China Yangtzi Liuhekou,Jiangsu1", centerPosition: CLLocationCoordinate2D(latitude: 31.52461111, longitude: 121.37808333), zoomLevel: 10.0, table: chinaYangtziLiuhekouJiangsu1),
ecaData(areaId: 45, name: "China Yangtzi Liuhekou,Jiangsu2", centerPosition: CLLocationCoordinate2D(latitude: 30.20172222, longitude: 121.32094444), zoomLevel: 8.0, table: chinaYangtziLiuhekouJiangsu2),
ecaData(areaId: 46, name: "China Xijiang Nanning,Guangxi", centerPosition: CLLocationCoordinate2D(latitude: 22.75000000, longitude: 108.31303333), zoomLevel: 11.0, table: chinaXijiangNanningGuangxi),
ecaData(areaId: 47, name: "China Xijiang Zhaoqing,Guangdong", centerPosition: CLLocationCoordinate2D(latitude: 23.08005000, longitude: 112.77791667), zoomLevel: 11.0, table: chinaXijiangNanningGuangdong),
ecaData(areaId: 51, name: "Korea Incheon, PyeongtaekDangjin Port", centerPosition: CLLocationCoordinate2D(latitude: 36.88996667, longitude: 126.05833333), zoomLevel: 7.0, table: incheonPyeongtaekDanjinPort),
ecaData(areaId: 52, name: "Korea Yeosu, Gwangyang Port", centerPosition: CLLocationCoordinate2D(latitude: 34.21166667, longitude: 128.00022222), zoomLevel: 8.0, table: yeosuGwangyangPort),
ecaData(areaId: 53, name: "Korea Busan Port", centerPosition: CLLocationCoordinate2D(latitude: 34.81029311, longitude: 128.89994528), zoomLevel: 8.0, table: koreaBusanPort),
ecaData(areaId: 54, name: "Korea Busan Port West", centerPosition: CLLocationCoordinate2D(latitude: 34.82819444, longitude: 128.82208333), zoomLevel: 9.0, table: koreaBusanPortWest),
ecaData(areaId: 55, name: "Korea Ulsan Port", centerPosition: CLLocationCoordinate2D(latitude: 34.98933675, longitude: 129.52881635), zoomLevel: 8.0, table: koreaUlsanPort),
ecaData(areaId: 61, name: "Panama Canal Atlantic Entrance", centerPosition: CLLocationCoordinate2D(latitude: 7.09898818, longitude: -79.99448871), zoomLevel: 6.0, table: panamaCanalAtlanticEntrance),
ecaData(areaId: 62, name: "Panama Canal Pacific Entrance", centerPosition: CLLocationCoordinate2D(latitude: 6.65073570, longitude: -79.42740275), zoomLevel: 6.0, table: panamaCanalPacificEntrance)
]
func setEcaData() {
for data in ecaDataTable {
if !SharingData.eca.ecaArea.keys.contains(data.name) {
var reg = RegisteredEca(id: data.id, ecaName: data.name)!
if !SharingData.eca.ecaArea.keys.contains(data.areaId) {
var reg = RegisteredEca(id: data.areaId, ecaName: data.name)!
reg.color = "0xFF0000" //ライン色(ARGB)
reg.points = data.table
reg.centerPosition = data.centerPosition
reg.zoomLevel = data.zoomLevel
SharingData.eca.ecaArea.updateValue(reg, forKey: data.name)
SharingData.eca.ecaArea.updateValue(reg, forKey: data.areaId)
}
}
}
}
#endif
......@@ -39,6 +39,8 @@ class EcaTask {
let serverSession = ServerSession()
let resjson = serverSession.fromJSON(resultData: resultData, resltType: ResShipStatus.self)
if let res = resjson {
SharingData.location.status = SharingData.location.setShipStatus(status: res.status)
SharingData.location.totalRmsAlarm = SharingData.location.setTotalRmsAlarm(alarm: res.totalRmsAlarm)
SharingData.location.speed = res.speed
SharingData.location.course = res.course
SharingData.location.heading = res.heading
......@@ -47,7 +49,6 @@ class EcaTask {
SharingData.location.setLocation()
print(debug: "Location:\(res)")
checkEca()
}
case .failure(let errorCode):
print(debug: errorCode)
......@@ -58,45 +59,47 @@ class EcaTask {
func checkEca() {
let runningEca = eca.ecaArea.first(where: {(key, value) in value.isRunning == true})
if let eca = runningEca?.value {
if let location = SharingData.location.location {
if let distance = LocationCalculation.checkPolyline(objPos: eca.points, shipPos: location){
if SharingData.my.ecaStatus == nil {
SharingData.my.ecaStatus = EcaState.running
}
// if 0.0 >= Float(distance) && SharingData.my.ecaStatus != EcaState.incomplete{
// SharingData.my.ecaStatus = EcaState.incomplete
// var newData = eca
// newData.isRunning = false
// newData.status = EcaState.incomplete
// SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Incomplete)
// }
if eca.swFinish >= Float(distance) && 0.0 < Float(distance) && SharingData.my.ecaStatus != EcaState.finishPass{
// notificationEca(point: SwitchingEca.Finish)
SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.finishPass
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: eca)
}
if eca.swStart >= Float(distance) && eca.swFinish < Float(distance) && SharingData.my.ecaStatus != EcaState.startPass{
notificationEca(point: SwitchingEca.Start)
SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.startPass
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: eca)
}
if eca.swNotice >= Float(distance) && eca.swStart < Float(distance) && SharingData.my.ecaStatus != EcaState.noticePass{
notificationEca(point: SwitchingEca.Notice)
SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.noticePass
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: eca)
if eca.points.count != 0 {
if let location = SharingData.location.location {
if let distance = LocationCalculation.checkPolyline(objPos: eca.points, shipPos: location){
if SharingData.my.ecaStatus == nil {
SharingData.my.ecaStatus = EcaState.running
}
// if 0.0 >= Float(distance) && SharingData.my.ecaStatus != EcaState.incomplete{
// SharingData.my.ecaStatus = EcaState.incomplete
// var newData = eca
// newData.isRunning = false
// newData.status = EcaState.incomplete
// SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Incomplete)
// }
if eca.swFinish >= Float(distance) && 0.0 < Float(distance) && SharingData.my.ecaStatus != EcaState.finishPass{
// notificationEca(point: SwitchingEca.Finish)
SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.finishPass
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: eca)
}
if eca.swStart >= Float(distance) && eca.swFinish < Float(distance) && SharingData.my.ecaStatus != EcaState.startPass{
notificationEca(point: SwitchingEca.Start)
SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.startPass
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: eca)
}
if eca.swNotice >= Float(distance) && eca.swStart < Float(distance) && SharingData.my.ecaStatus != EcaState.noticePass{
notificationEca(point: SwitchingEca.Notice)
SharingData.eca.isShowEcaAlert = true
SharingData.my.ecaStatus = EcaState.noticePass
let ecaTask = EcaTask()
ecaTask.chengeEcaStatus(eca: eca)
}
}
}
}
......@@ -113,16 +116,16 @@ class EcaTask {
newData.status = status
if status == EcaState.noticePass{ //ECA通知円到達
SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Notice)
SharingData.eca.editEcaArea(key: eca.areaId, value: newData, type: EcaOperation.Notice)
}
if status == EcaState.startPass{ //ECA開始円到達
SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Start)
SharingData.eca.editEcaArea(key: eca.areaId, value: newData, type: EcaOperation.Start)
}
if status == EcaState.finishPass{ //ECAタスク終了円到達
SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Finish)
SharingData.eca.editEcaArea(key: eca.areaId, value: newData, type: EcaOperation.Finish)
}
if status == EcaState.end{ //ECAタスク完了(燃料切替実施済み)
SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.End)
SharingData.eca.editEcaArea(key: eca.areaId, value: newData, type: EcaOperation.End)
}
}
}
......
......@@ -28,10 +28,10 @@ class GetEcaList {
for ares in ecaData.ecaArea {
var eca = ares.value
eca.isEnable = false
ecaAreas.updateValue(eca, forKey: eca.name)
ecaAreas.updateValue(eca, forKey: eca.areaId)
}
for ecaList in res{
if var value = ecaAreas[ecaList.taskName]{
for ecaList in res {
if var value = ecaAreas[ecaList.areaId]{
value.isEnable = true
value.swNotice = ecaList.noticeRange
value.swStart = ecaList.startRange
......@@ -43,11 +43,11 @@ class GetEcaList {
value.isRunning = false
value.status = EcaState.register
}
ecaAreas.updateValue(value, forKey: ecaList.taskName)
ecaAreas.updateValue(value, forKey: ecaList.areaId)
}
}
for ares in ecaAreas{
ecaData.setEcaArea(key: ares.value.name, value: ares.value)
ecaData.setEcaArea(key: ares.value.areaId, value: ares.value)
}
}
case .failure(let errorCode):
......
......@@ -29,7 +29,7 @@ let serverIncomplete = 0x00000200 //ECAタスク未完了 (燃料切替未実
let serverCancel = 0x00000400 //ECAタスクキャンセル (タスク終了・タスク未完了前にキャンセル)
struct RegisteredEca {
var id: Int = 0
var areaId: Int = 0
var isEnable: Bool = false //ECA有効
var isRunning: Bool = false //ECA実行中
var name: String = "" //ECA名称
......@@ -45,7 +45,7 @@ struct RegisteredEca {
var points: [CLLocationCoordinate2D] = []
init?(id: Int, ecaName: String ) {
self.id = id
self.areaId = id
self.name = ecaName
}
}
......@@ -27,10 +27,10 @@ enum HttpRequestType : String {
case HubName = "ssv-canary-sailassist-notification"
case storage = "https://ssvcanarystorage.z1.web.core.windows.net/"
case GetManualUrl = "https://ssv-canary-web.azurewebsites.net/api/constantdata/manual?filter=SailAssist"
case Information = "https://ssv-canary-web.azurewebsites.net/information/4"
case InfVersion = "https://ssv-canary-web.azurewebsites.net/InformationVersion/4"
case ContactPage = "https://www.jmarinecloud.com/eng/contact.php?type=ssv_mobile"
case ApachLicens = "https://raw.githubusercontent.com/Azure/azure-notificationhubs-ios/main/LICENSE"
// case AppStore = "https://apps.apple.com/jp/app/ssv-mobile/id1434022656"
// case AppInfo = "https://itunes.apple.com/lookup?bundleId=com.jrc.tacmi"
case AppStore = "https://apps.apple.com/jp/app/sail-assist/id6473762428"
case AppInfo = "https://itunes.apple.com/lookup?bundleId=com.jrc.sailassist"
}
......@@ -42,7 +42,7 @@ enum HttpRequestType : String {
// case CookiePolicy = "https://ssv-qc-web.azurewebsites.net/cookiepolicy"
// case PrivacyPolicy = "https://ssv-qc-web.azurewebsites.net/inapp?" //+バージョン番号
case TaskList = "https://ssv-qc-web.azurewebsites.net/api/sailassist/tasklist/XXXXX"
case EcaArea = "https://ssv-qc-web.azurewebsites.net/api/sailassist/ecaarea"
case EcaArea = "https://ssv-qc-web.azurewebsites.net/api/sailassist/ecaarea/XXXXX"
case ShipStatus = "https://ssv-qc-web.azurewebsites.net/api/sailassist/shipstatus/XXXXX"
case ShipMonitoringRoute = "https://ssv-qc-web.azurewebsites.net/api/sailassist/shipmonitoringroute/XXXXX"
case GetMessage = "https://ssv-qc-web.azurewebsites.net/api/chatdata/getmessages?shipId=XXXXX"
......@@ -53,6 +53,8 @@ enum HttpRequestType : String {
case HubName = "ssv-qc-sailassist-notification"
case storage = "https://tacmiquaritycheckstorage.z31.web.core.windows.net/"
case GetManualUrl = "https://ssv-qc-web.azurewebsites.net/api/constantdata/manual?filter=SailAssist"
case Information = "https://ssv-qc-web.azurewebsites.net/information/4"
case InfVersion = "https://ssv-qc-web.azurewebsites.net/InformationVersion/4"
case ContactPage = "https://www.jmarinecloud.com/eng/contact.php?type=ssv_mobile"
case ApachLicens = "https://raw.githubusercontent.com/Azure/azure-notificationhubs-ios/main/LICENSE"
case AppStore = "https://apps.apple.com/jp/app/sail-assist/id6473762428"
......@@ -67,7 +69,7 @@ enum HttpRequestType : String {
// case CookiePolicy = "https://ssv.jmarinecloud.com/cookiepolicy"
// case PrivacyPolicy = "https://ssv.jmarinecloud.com/inapp?" //+バージョン番号
case TaskList = "https://ssv.jmarinecloud.com/api/sailassist/tasklist/XXXXX"
case EcaArea = "https://ssv.jmarinecloud.com/api/sailassist/ecaarea"
case EcaArea = "https://ssv.jmarinecloud.com/api/sailassist/ecaarea/XXXXX"
case ShipStatus = "https://ssv.jmarinecloud.com/api/sailassist/shipstatus/XXXXX"
case ShipMonitoringRoute = "https://ssv.jmarinecloud.com/api/sailassist/shipmonitoringroute/XXXXX"
case GetMessage = "https://ssv.jmarinecloud.com/api/chatdata/getmessages?shipId=XXXXX"
......@@ -78,6 +80,8 @@ enum HttpRequestType : String {
case HubName = "ssv-sailassist-notification"
case storage = "https://tacmistorage.z31.web.core.windows.net/"
case GetManualUrl = "https://ssv.jmarinecloud.com/api/constantdata/manual?filter=SailAssist"
case Information = "https://ssv.jmarinecloud.com/information/4"
case InfVersion = "https://ssv.jmarinecloud.com/InformationVersion/4"
case ContactPage = "https://www.jmarinecloud.com/eng/contact.php?type=ssv_mobile"
case ApachLicens = "https://raw.githubusercontent.com/Azure/azure-notificationhubs-ios/main/LICENSE"
case AppStore = "https://apps.apple.com/jp/app/sail-assist/id6473762428"
......
//
// ResInformation.swift
// Sailassist
//
// Created by 三浦薫巳 on 2024/02/29.
//
import Foundation
struct ResInformation: Codable {
var informationId: Int = 0
var ssv: Bool = false
var ssvMobile: Bool = false
var sailAssist: Bool = true
var expirationDate: String = ""
var title: String = ""
var detail: String = ""
var lastUpdateTime: String = ""
}
......@@ -13,4 +13,5 @@ struct ResLogin : Codable {
var shipName: String = ""
var imo: Int = 0
var mmsi: Int = 0
var enableFuelSwitchTask: Bool = false
}
......@@ -8,6 +8,8 @@
import Foundation
struct ResShipStatus : Codable {
var status: Int = 0
var totalRmsAlarm: Int = 0
var dataTime: String = "" //2023-11-02T05:25:49.4362123Z
var speed: Double = 0.0
var course: Double = 0.0
......
......@@ -16,6 +16,9 @@ class LocationViewModel: NSObject, ObservableObject, CLLocationManagerDelegate {
let ecaTask = EcaTask()
override init() {
let ecaArea = EcaArea()
ecaArea.start()
locationManager = CLLocationManager()
authorizationStatus = locationManager.authorizationStatus
......
//
// InformationView.swift
// Sailassist
//
// Created by 三浦薫巳 on 2024/03/01.
//
import SwiftUI
struct InformationView: View {
@ObservedObject var info = SharingData.information
var body: some View {
VStack{
ScrollView{
VStack(spacing: 0){
ForEach(info.content.sorted{ $0.informationId < $1.informationId }, id: \.informationId){ info in
InformationView(title: info.title, bodyStr: info.detail)
}
}
.padding()
.background(.black)
}
.onAppear(perform: {
let information = GetInformation()
information.start()
})
}
}
private struct InformationView: View {
var title: String
var bodyStr: String
@State var isExtend = false
var body: some View {
VStack(alignment: .leading, spacing: 0){
HStack{
Text(title)
.foregroundColor(.white)
Spacer()
Button {
isExtend.toggle()
} label: {
Image(systemName: isExtend ? "minus" : "plus")
.foregroundColor(.white)
}
}
.padding()
.background(.gray)
if isExtend {
Text(bodyStr)
.multilineTextAlignment(.leading)
.padding(EdgeInsets(top: 5, leading: 10, bottom: 5, trailing: 10))
.foregroundColor(.black)
}
}
.background(.white)
}
}
}
#Preview {
MenuInformationView(path: .constant([]))
}
......@@ -28,6 +28,7 @@ class LoginViewParam: ObservableObject{
@Published var password: String = ""
@Published var deviceid: String = ""
@Published var userName: String = ""
@Published var qrCode: Bool = false
}
let TimerInterval = 60.0
......@@ -87,7 +88,12 @@ struct LoginView: View {
VStack(spacing: 40){
VStack(spacing: 30) {
if !isProgressView {
// Link("Information", destination: URL(string: HttpRequestType.SitePolicy.rawValue)!)
NavigationLink {
InformationView()
} label: {
Text("System Information")
}
// Link("Information", destination: URL(string: HttpRequestType.SitePolicy.rawValue)!)
Link("Contact Us", destination: URL(string: HttpRequestType.ContactPage.rawValue)!)
NavigationLink {
AboutAppView()
......@@ -125,7 +131,7 @@ struct LoginView: View {
)
case .Expired:
return Alert(title: Text("Error"),
message: Text("Expired."),
message: Text("This account is expired."),
dismissButton: .default(Text("OK"), action: {viewMode = .SelectType})
)
}
......@@ -147,19 +153,23 @@ struct LoginView: View {
}
}
/**
* QRコードでのログイン
*/
func LoginCheckQR() -> () {
isProgressView = true
loginViewParam.shipId = Preferences.Id
loginViewParam.password = Preferences.Password
loginViewParam.deviceid = Preferences.DeviceId
// loginViewParam.userName = Preferences.UserName
loginViewParam.qrCode = true
viewMode = .InputUserName
isProgressView = false
// let login = ReqLogin(Id: Preferences.Id, Password: Preferences.Password, DeviceId: Preferences.DeviceId, UserName: Preferences.UserName)
// sessionLogin.RequestLogin(login, completion: responseQrLogin)
}
/**
* Autoログイン
*/
func LoginCheck() -> () {
let lastUnixTime = Preferences.lastLoginDate_Int64 ?? 0
let lastDate = DateTextLib.UnixTime2Date(lastUnixTime)
......@@ -174,66 +184,6 @@ struct LoginView: View {
}
}
func responseQrLogin(result: Result<Data, APIError>) {
print(debug: "calld")
switch result {
case .success(let resultData):
let serverSession = ServerSession()
let resjson = serverSession.fromJSON(resultData: resultData, resltType: ResLogin.self)
if let res = resjson {
SharingData.my.id = res.id
SharingData.my.shipName = res.shipName
SharingData.my.imo = res.imo
SharingData.my.mmsi = res.mmsi
Preferences.shipId = res.shipId
let notificationTags = NotificationTags()
notificationTags.addTags()
}
Preferences.lastLoginDate_Int64 = DateTextLib.Date2UnixTime(date: Date())
viewMode = .InputUserName
// let ecaArea = EcaArea()
// ecaArea.start()
timer = Timer.scheduledTimer(withTimeInterval: TimerInterval, repeats: true) { _ in
print(debug: "called timer")
let eca = EcaTask()
eca.start()
let message = GetMessage()
message.start()
let route = MonitoringRoute()
route.start()
let ecaList = GetEcaList()
ecaList.start()
let pushHistory = GetPushHistory()
pushHistory.start()
}
timer?.fire()
case .failure(let errorCode):
print(debug: errorCode)
switch errorCode {
case .clientError:
alertType = .ClientError
case .serverError:
alertType = .QrFailure
default:
alertType = .QrFailure
}
isLogin = false
isAlert = true
break
}
isProgressView = false
}
func responseLogin(result: Result<Data, APIError>) {
print(debug: "calld")
switch result {
......@@ -242,9 +192,11 @@ struct LoginView: View {
let resjson = serverSession.fromJSON(resultData: resultData, resltType: ResLogin.self)
if let res = resjson {
SharingData.my.id = res.id
SharingData.my.shipId = res.shipId
SharingData.my.shipName = res.shipName
SharingData.my.imo = res.imo
SharingData.my.mmsi = res.mmsi
SharingData.my.isFuelSwitchTask = res.enableFuelSwitchTask
Preferences.shipId = res.shipId
......@@ -255,12 +207,6 @@ struct LoginView: View {
Preferences.lastLoginDate_Int64 = DateTextLib.Date2UnixTime(date: Date())
isLogin = true
// let ecaArea = EcaArea()
// ecaArea.start()
let eca = EcaTask()
eca.start()
timer = Timer.scheduledTimer(withTimeInterval: TimerInterval, repeats: true) { _ in
print(debug: "called timer")
let eca = EcaTask()
......@@ -286,7 +232,17 @@ struct LoginView: View {
case .clientError:
alertType = .ClientError
case .serverError:
alertType = .loginFailure
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
if let expiry = dateFormatter.date(from: Preferences.Expiry) {
if Date() < expiry {
alertType = .loginFailure
} else {
alertType = .Expired
}
} else {
alertType = .loginFailure
}
default:
alertType = .loginFailure
}
......
......@@ -64,6 +64,7 @@ struct InputIdPassWordView: View {
Button(action: {
if param.shipId.isEmpty || param.password.isEmpty {
param.qrCode = false
isIdPassWordEmpty = true
} else {
viewMode = .InputUserName
......
......@@ -101,6 +101,7 @@ struct InputUserNameView: View {
SharingData.my.shipName = res.shipName
SharingData.my.imo = res.imo
SharingData.my.mmsi = res.mmsi
SharingData.my.isFuelSwitchTask = res.enableFuelSwitchTask
Preferences.shipId = res.shipId
......@@ -140,10 +141,28 @@ struct InputUserNameView: View {
case .failure(let errorCode):
print(debug: errorCode)
switch errorCode {
case .clientError:
alertType = .ClientError
case .serverError:
if param.qrCode {
alertType = .QrFailure
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
if let expiry = dateFormatter.date(from: Preferences.Expiry) {
if Date() > expiry {
alertType = .Expired
}
}
} else {
alertType = .loginFailure
}
default:
alertType = .loginFailure
}
isProgressView = false
isLogin = false
isAlert = true
alertType = .loginFailure
break
}
}
......
......@@ -23,12 +23,14 @@ class ScannerViewModel: ObservableObject {
Preferences.Id = resjson.id
Preferences.Password = resjson.pass
Preferences.Expiry = resjson.exp
Preferences.lastLoginDate_Int64 = DateTextLib.Date2UnixTime(date: Date())
} catch {
print(debug: "decodeエラー")
Preferences.Id = ""
Preferences.Password = ""
Preferences.Expiry = ""
}
isShowing = false
......
......@@ -29,16 +29,12 @@ struct MapRepresentable: UIViewControllerRepresentable{
mapVC.removeEcaLine()
}
if let focusEcaName = ecaData.focusEca, let focusEca = ecaData.ecaArea[focusEcaName]{
if let focusEcaAreaId = ecaData.focusEca, let focusEca = ecaData.ecaArea[focusEcaAreaId]{
mapVC.updateCamera(location: focusEca.centerPosition, zoomlevel: focusEca.zoomLevel)
mapVC.updateOneTimeEca(eca: focusEca.points)
//10秒後削除
DispatchQueue.main.asyncAfter(deadline: .now() + 15.0) {
do{
mapVC.updateOneTimeEca(eca: nil)
}catch{
print(debug: "called")
}
mapVC.updateOneTimeEca(eca: nil)
}
}
......@@ -50,6 +46,11 @@ struct MapRepresentable: UIViewControllerRepresentable{
}
}
//自船を画面中央に表示
if location.focusOwnShip {
mapVC.updateCamera(location: location.location, zoomlevel: nil)
}
if let mylocation = location.location {
mapVC.updateOwnShip(location: mylocation, bearing: location.heading)
......@@ -79,23 +80,47 @@ class MapViewController : UIViewController{
override func viewDidLoad() {
super.viewDidLoad()
let centerCoordinate = CLLocationCoordinate2D(latitude: 37.8, longitude: -96)
// let url = StyleURI(rawValue: "mapbox://styles/jmarinecloud/cltrwnk5i01j901ra3g4n7dtz")
// let options = MapInitOptions(cameraOptions: CameraOptions(center: centerCoordinate, zoom: 2), styleURI: url)
let options = MapInitOptions(cameraOptions: CameraOptions(center: centerCoordinate, zoom: 2))
mapView = MapView(frame: view.bounds, mapInitOptions: options)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.view.addSubview(mapView)
mapView.mapboxMap.onNext(event: .mapLoaded) { [self] _ in
self.addLayers()
}
}
/**
* 自船アイコンの状態表記
*/
func addImage(){
do{
if let image = UIImage(named: "ownShip"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip.rawValue)
if let image = UIImage(named: "ownShip_normal"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Normal.rawValue)
}
if let image = UIImage(named: "ownShip_alarm"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Alarm.rawValue)
}
if let image = UIImage(named: "ownShip_caution"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Caution.rawValue)
}
if let image = UIImage(named: "ownShip_emergency"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Emergency.rawValue)
}
if let image = UIImage(named: "ownShip_necstemergency"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_NeCST_Emergency.rawValue)
}
if let image = UIImage(named: "ownShip_offline"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Offline.rawValue)
}
if let image = UIImage(named: "ownShip_unknown"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Unknown.rawValue)
}
if let image = UIImage(named: "ownShip_warning"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.OwnShip_Warning.rawValue)
}
if let image = UIImage(named: "swNoticeBack"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.SwNoticeBack.rawValue)
......@@ -106,13 +131,16 @@ class MapViewController : UIViewController{
if let image = UIImage(named: "swFinishBack"){
try mapView.mapboxMap.style.addImage(image, id: IconImage.SwFinisheBack.rawValue)
}
}catch{}
} catch {
print(debug: "called")
}
}
func addLayers(){
addImage()
//自船
let point = Point(LocationCoordinate2D(latitude: 0, longitude: 0))
ownShipSymbol.source.data = .feature(Feature(geometry: point))
var ownShipSymbolLayer = SymbolLayer(id: ownShipSymbol.layerId)
......@@ -129,8 +157,8 @@ class MapViewController : UIViewController{
try! mapView.mapboxMap.style.addSource(ownShipSymbol.source, id: ownShipSymbol.sourceId)
try? mapView.mapboxMap.style.addLayer(ownShipSymbolLayer)
//ECA
let ecaLineString = LineString([LocationCoordinate2D(latitude: 0, longitude: 0)])
let ecaLinefeature = Feature(geometry: ecaLineString)
ecaLine.source.data = .feature(ecaLinefeature)
......@@ -144,6 +172,7 @@ class MapViewController : UIViewController{
try! mapView.mapboxMap.style.addSource(ecaLine.source, id: ecaLine.sourceId)
try? mapView.mapboxMap.style.addLayer(ecaLineLayer)
//
_ = LineString([LocationCoordinate2D(latitude: 0, longitude: 0)])
let oneTimeEcaLinefeature = Feature(geometry: ecaLineString)
oneTimeEca.source.data = .feature(oneTimeEcaLinefeature)
......@@ -157,6 +186,7 @@ class MapViewController : UIViewController{
try! mapView.mapboxMap.style.addSource(oneTimeEca.source, id: oneTimeEca.sourceId)
try? mapView.mapboxMap.style.addLayer(oneTimeEcaLayer)
//
ecaSwitchingLine.source.data = .featureCollection(FeatureCollection(features: []))
var ecaSwitchingLineLayer = LineLayer(id: ecaSwitchingLine.layerId)
ecaSwitchingLineLayer.source = ecaSwitchingLine.sourceId
......@@ -168,6 +198,7 @@ class MapViewController : UIViewController{
try! mapView.mapboxMap.style.addSource(ecaSwitchingLine.source, id: ecaSwitchingLine.sourceId)
try? mapView.mapboxMap.style.addLayer(ecaSwitchingLineLayer)
//ECA ラベル
ecaSwLineLabel.source.data = .featureCollection(FeatureCollection(features: []))
var ecaSwLabelLayer = SymbolLayer(id: ecaSwLineLabel.layerId)
ecaSwLabelLayer.source = ecaSwLineLabel.sourceId
......@@ -186,6 +217,7 @@ class MapViewController : UIViewController{
try! mapView.mapboxMap.style.addSource(ecaSwLineLabel.source, id: ecaSwLineLabel.sourceId)
try? mapView.mapboxMap.style.addLayer(ecaSwLabelLayer)
//航路
wakeLines.source.data = .featureCollection(FeatureCollection(features: []))
var wakeLineLayer = LineLayer(id: wakeLines.layerId)
wakeLineLayer.source = wakeLines.sourceId
......@@ -196,6 +228,7 @@ class MapViewController : UIViewController{
try! mapView.mapboxMap.style.addSource(wakeLines.source, id: wakeLines.sourceId)
try? mapView.mapboxMap.style.addLayer(wakeLineLayer)
//WayPoint
wayPoints.source.data = .featureCollection(FeatureCollection(features: []))
var wayPointsLayer = SymbolLayer(id: wayPoints.layerId)
wayPointsLayer.source = wayPoints.sourceId
......@@ -213,11 +246,34 @@ class MapViewController : UIViewController{
///自船
func updateOwnShip(location: CLLocationCoordinate2D, bearing: Double){
do {
var shipIcon = IconImage.OwnShip_Normal.rawValue
switch SharingData.location.status {
case ShipAlert.Offline:
shipIcon = IconImage.OwnShip_Offline.rawValue
case ShipAlert.Unknown:
shipIcon = IconImage.OwnShip_Unknown.rawValue
case ShipAlert.Normal:
shipIcon = IconImage.OwnShip_Normal.rawValue
case ShipAlert.Caution:
shipIcon = IconImage.OwnShip_Caution.rawValue
case ShipAlert.Warrning:
shipIcon = IconImage.OwnShip_Warning.rawValue
case ShipAlert.Alarm:
shipIcon = IconImage.OwnShip_Alarm.rawValue
case ShipAlert.Emergency:
shipIcon = IconImage.OwnShip_Emergency.rawValue
case ShipAlert.NecstEmergency:
shipIcon = IconImage.OwnShip_NeCST_Emergency.rawValue
}
var geoJSON = Feature(geometry: Point(location))
geoJSON.properties = [PropertyKey.Bearing.rawValue: .number(bearing),
PropertyKey.IconImage.rawValue: .string(IconImage.OwnShip.rawValue)]
PropertyKey.IconImage.rawValue: .string(shipIcon)]
try self.mapView.mapboxMap.style.updateGeoJSONSource(withId: self.ownShipSymbol.sourceId, geoJSON: .feature(geoJSON))
}catch{}
} catch {
print(debug: "called")
}
}
///カメラ
......@@ -233,6 +289,9 @@ class MapViewController : UIViewController{
if SharingData.pushHistory.focusPushHistory != nil {
SharingData.pushHistory.focusPushHistory = nil
}
if SharingData.location.focusOwnShip {
SharingData.location.focusOwnShip = false
}
}
///Ecaの線3本
......@@ -396,8 +455,15 @@ class MapViewController : UIViewController{
case Text
}
enum IconImage: String, CaseIterable{
case OwnShip
enum IconImage: String, CaseIterable {
case OwnShip_Alarm
case OwnShip_Caution
case OwnShip_Emergency
case OwnShip_NeCST_Emergency
case OwnShip_Normal
case OwnShip_Offline
case OwnShip_Unknown
case OwnShip_Warning
case SwNoticeBack
case SwStartBack
case SwFinisheBack
......
......@@ -12,20 +12,20 @@ struct EcaListView: View {
@ObservedObject var ecaData = SharingData.eca
var body: some View {
ForEach(ecaData.ecaArea.map{ $0.1 }.sorted{ $0.id < $1.id }, id: \.name){ eca in
ForEach(ecaData.ecaArea.map{ $0.1 }.sorted{ $0.areaId < $1.areaId }, id: \.name){ eca in
HStack {
Text(eca.name)
.font(FontStyle.DefaultText.font)
.foregroundColor(ColorSet.Body.color)
.onTapGesture {
ecaData.focusEca = eca.name
ecaData.focusEca = eca.areaId
}
Spacer()
if !eca.isEnable{
Button(action: {
var newData = eca
newData.isEnable.toggle()
ecaData.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Insert)
ecaData.editEcaArea(key: eca.areaId, value: newData, type: EcaOperation.Insert)
taskViewModel.viewMode = .SwitchingMenu
taskViewModel.edittingEcaArea = eca
taskViewModel.isShowSettingView = true
......
......@@ -39,7 +39,7 @@ struct EcaSettingView: View {
Button(action: {
var ecaData = edittingEca
ecaData.isEnable = true
SharingData.eca.editEcaArea(key: edittingEca.name, value: ecaData, type: EcaOperation.Change)
SharingData.eca.editEcaArea(key: edittingEca.areaId, value: ecaData, type: EcaOperation.Change)
isShowSettingEca = false
}, label: {
Text("Register")
......
......@@ -21,7 +21,6 @@ enum TaskViewMode{
}
}
struct MapTaskView: View {
@ObservedObject var taskViewModel = TaskViewModel()
@ObservedObject var eca = SharingData.eca
......
......@@ -16,7 +16,7 @@ struct TaskSwitchingMenuView: View {
var body: some View {
VStack{
ForEach(ecaData.ecaArea.map{ $0.1 }.filter{ $0.isEnable }.sorted{ $0.id < $1.id }, id: \.name){ eca in
ForEach(ecaData.ecaArea.map{ $0.1 }.filter{ $0.isEnable }.sorted{ $0.areaId < $1.areaId }, id: \.name){ eca in
VStack {
HStack {
//ECA開始・終了ボタン
......@@ -30,7 +30,7 @@ struct TaskSwitchingMenuView: View {
var newData = eca
newData.isRunning = true
newData.status = EcaState.running
SharingData.eca.editEcaArea(key: eca.name, value: newData, type: EcaOperation.Running)
SharingData.eca.editEcaArea(key: eca.areaId, value: newData, type: EcaOperation.Running)
}
} label: {
HStack {
......@@ -46,7 +46,7 @@ struct TaskSwitchingMenuView: View {
.font(FontStyle.DefaultText.font)
.foregroundColor(ColorSet.Body.color)
.onTapGesture {
ecaData.focusEca = eca.name
ecaData.focusEca = eca.areaId
}
Spacer()
......@@ -82,8 +82,8 @@ struct TaskSwitchingMenuView: View {
newData.isEnable = false
newData.status = EcaState.cancel
ecaData.editEcaArea(key: ecaArea.name, value: newData, type: EcaOperation.Delete)
deleteEcaArea.start(ecaId: ecaArea.id)
ecaData.editEcaArea(key: ecaArea.areaId, value: newData, type: EcaOperation.Delete)
deleteEcaArea.start(ecaId: ecaArea.areaId)
}
taskViewModel.edittingEcaArea = nil
}
......@@ -97,7 +97,7 @@ struct TaskSwitchingMenuView: View {
var newData = ecaArea
newData.isRunning = false
newData.status = EcaState.end
ecaData.editEcaArea(key: ecaArea.name, value: newData, type: EcaOperation.End)
ecaData.editEcaArea(key: ecaArea.areaId, value: newData, type: EcaOperation.End)
}
taskViewModel.edittingEcaArea = nil
}
......
......@@ -21,7 +21,7 @@ enum MenuPath: String, Hashable{
case ManualInmalsatC
case ManualInternationalVHF
case ManualVDR
// case Information
case Information
case Setting
case GpsSelect
case Help
......@@ -53,8 +53,8 @@ enum MenuPath: String, Hashable{
"International VHF"
case .ManualVDR:
"VDR"
// case .Information:
// "Information"
case .Information:
"System Information"
case .Setting:
"Setting"
case .GpsSelect:
......@@ -73,21 +73,29 @@ enum MenuPath: String, Hashable{
var fileIdntifer: String?{
switch self {
case .ManualECDISBasic:
"JAN-7201_9201(E)7ZPNA4449M"
// "JAN-7201_9201(E)7ZPNA4449M"
"9201(E)7ZPNA4449"
case .ManualECDISFunction:
"JAN-7201_9201(E)7ZPNA4450K"
// "JAN-7201_9201(E)7ZPNA4450K"
"9201(E)7ZPNA4450"
case .ManualVDR:
"JCY-1900(E)7ZPNA4384H"
// "JCY-1900(E)7ZPNA4384H"
"JCY-1900(E)7ZPNA4384"
case .ManualAIS:
"JHS-183(E)7ZPJD0553E"
// "JHS-183(E)7ZPJD0553E"
"JHS-183(E)7ZPJD0553"
case .ManualInternationalVHF:
"JHS-800S(E)7ZPJD0714B"
// "JHS-800S(E)7ZPJD0714B"
"JHS-800S(E)7ZPJD0714"
case .ManualRADARBasic:
"JMR-7200_9200(E)7ZPNA4446K"
// "JMR-7200_9200(E)7ZPNA4446K"
"9200(E)7ZPNA4446"
case .ManualRADARFunction:
"JMR-7200_9200(E)7ZPNA4447H"
// "JMR-7200_9200(E)7ZPNA4447H"
"9200(E)7ZPNA4447"
case .ManualInmalsatC:
"JUE-87(E)7ZPSC0444A"
// "JUE-87(E)7ZPSC0444A"
"JUE-87(E)7ZPSC0444"
default:
nil
}
......@@ -140,11 +148,11 @@ struct MenuView: View {
MenuContentView(content: .Manual)
}
// Button{
// path.append(.Information)
// }label: {
// MenuContentView(content: .Information)
// }
Button{
path.append(.Information)
}label: {
MenuContentView(content: .Information)
}
Button{
path.append(.Setting)
......@@ -186,9 +194,9 @@ struct MenuView: View {
if let htmlPath = Bundle.main.path(forResource: "Manual/help", ofType: "html") {
WebView(isLoading: .constant(false), url: htmlPath)
}
// }else if goto == .Information{
// MenuInfomarionView(path: $path)
// .navigationBarHidden(true)
}else if goto == .Information{
MenuInformationView(path: $path)
.navigationBarHidden(true)
}else{
VStack(spacing: 0) {
MenuTitleView(path: $path, title: goto.title)
......
//
// MenuInfomarionView.swift
// MenuInformationView.swift
// Sailassist
//
// Created by Mamoru Sugita on 2023/12/26.
......@@ -7,25 +7,30 @@
import SwiftUI
struct MenuInfomarionView: View {
struct MenuInformationView: View {
@Binding var path : [MenuPath]
@ObservedObject var info = SharingData.information
var body: some View {
VStack{
// MenuTitleView(path: $path, title: MenuPath.Information.title)
MenuTitleView(path: $path, title: MenuPath.Information.title)
ScrollView{
VStack(spacing: 0){
InformationView(title: "半角文字", bodyStr: String(repeating: halfString, count: 157))
InformationView(title: "全角文字", bodyStr: String(repeating: halfString2, count: 82))
ForEach(info.content.sorted{ $0.informationId < $1.informationId }, id: \.informationId){ info in
InformationView(title: info.title, bodyStr: info.detail)
}
}
.padding()
.background(.black)
}
.onAppear(perform: {
let information = GetInformation()
information.start()
})
}
}
private struct InformationView: View {
var title: String
var bodyStr: String
......@@ -35,36 +40,31 @@ struct MenuInfomarionView: View {
HStack{
Text(title)
.foregroundColor(.white)
Spacer()
Button {
isExtend.toggle()
} label: {
Image(systemName: isExtend ? "plus" : "minus")
Image(systemName: isExtend ? "minus" : "plus")
.foregroundColor(.white)
}
}
.padding()
.background(.gray)
if isExtend {
Text(bodyStr)
.multilineTextAlignment(.leading)
.padding(EdgeInsets(top: 5, leading: 10, bottom: 5, trailing: 10))
.foregroundColor(.black)
}
}
.background(.white)
}
}
}
#Preview {
MenuInfomarionView(path: .constant([]))
MenuInformationView(path: .constant([]))
}
let halfString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
let halfString2 = "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん"
......@@ -17,14 +17,14 @@ struct MenuManualECDISView: View {
MenuTitleView(path: $path, title: MenuPath.ManualECDIS.title)
if !isLoadingView {
if let manual = SharingData.my.manualUrls.filter({$0.identifer == MenuPath.ManualECDISBasic.fileIdntifer}).first{
if let manual = SharingData.my.manualUrls.filter({$0.identifer!.contains(MenuPath.ManualECDISBasic.fileIdntifer!)}).first{
ManualDownloadButton(manualType: .ManualECDISBasic, downloadUrl: manual.path,version: Preferences.ECDISBasicManualVer, newVersion: manual.name, isAlert: $isAlert, isLoadingView: $isLoadingView){
path.append(.ManualECDISBasic)
Preferences.ECDISBasicManualVer = manual.name
}
}
if let manual = SharingData.my.manualUrls.filter({$0.identifer == MenuPath.ManualECDISFunction.fileIdntifer}).first{
if let manual = SharingData.my.manualUrls.filter({$0.identifer!.contains(MenuPath.ManualECDISFunction.fileIdntifer!)}).first{
ManualDownloadButton(manualType: .ManualECDISFunction, downloadUrl: manual.path,version: Preferences.ECDISFunctionManualVer, newVersion: manual.name, isAlert: $isAlert, isLoadingView: $isLoadingView){
path.append(.ManualECDISFunction)
Preferences.ECDISFunctionManualVer = manual.name
......
......@@ -17,14 +17,14 @@ struct MenuManualRADARView: View {
MenuTitleView(path: $path, title: MenuPath.ManualRADAR.title)
if !isLoadingView {
if let manual = SharingData.my.manualUrls.filter({$0.identifer == MenuPath.ManualRADARBasic.fileIdntifer}).first{
if let manual = SharingData.my.manualUrls.filter({$0.identifer!.contains(MenuPath.ManualRADARBasic.fileIdntifer!)}).first{
ManualDownloadButton(manualType: .ManualRADARBasic, downloadUrl: manual.path,version: Preferences.RADARBasicManualVer, newVersion: manual.name, isAlert: $isAlert, isLoadingView: $isLoadingView){
path.append(.ManualRADARBasic)
Preferences.RADARBasicManualVer = manual.name
}
}
if let manual = SharingData.my.manualUrls.filter({$0.identifer == MenuPath.ManualRADARFunction.fileIdntifer}).first{
if let manual = SharingData.my.manualUrls.filter({$0.identifer!.contains(MenuPath.ManualRADARFunction.fileIdntifer!)}).first{
ManualDownloadButton(manualType: .ManualRADARFunction, downloadUrl: manual.path,version: Preferences.RADARFunctionManualVer, newVersion: manual.name, isAlert: $isAlert, isLoadingView: $isLoadingView){
path.append(.ManualRADARFunction)
Preferences.RADARFunctionManualVer = manual.name
......@@ -34,7 +34,6 @@ struct MenuManualRADARView: View {
Text("Now Loading...").padding()
ProgressView()
}
Spacer()
}
.background(ColorSet.BackgroundPrimary.color)
......
......@@ -30,28 +30,28 @@ struct MenuManualView: View {
MenuContentView(content: .ManualRADAR)
}
if let manual = SharingData.my.manualUrls.filter({$0.identifer == MenuPath.ManualAIS.fileIdntifer}).first{
if let manual = SharingData.my.manualUrls.filter({$0.identifer!.contains(MenuPath.ManualAIS.fileIdntifer!)}).first{
ManualDownloadButton(manualType: .ManualAIS, downloadUrl: manual.path,version: Preferences.AISManualVer, newVersion: manual.name, isAlert: $isAlert, isLoadingView: $isLoadingView){
path.append(.ManualAIS)
Preferences.AISManualVer = manual.name
}
}
if let manual = SharingData.my.manualUrls.filter({$0.identifer == MenuPath.ManualInmalsatC.fileIdntifer}).first{
if let manual = SharingData.my.manualUrls.filter({$0.identifer!.contains(MenuPath.ManualInmalsatC.fileIdntifer!)}).first{
ManualDownloadButton(manualType: .ManualInmalsatC, downloadUrl: manual.path,version: Preferences.InmalsatCManualVer, newVersion: manual.name, isAlert: $isAlert, isLoadingView: $isLoadingView){
path.append(.ManualInmalsatC)
Preferences.InmalsatCManualVer = manual.name
}
}
if let manual = SharingData.my.manualUrls.filter({$0.identifer == MenuPath.ManualInternationalVHF.fileIdntifer}).first{
if let manual = SharingData.my.manualUrls.filter({$0.identifer!.contains(MenuPath.ManualInternationalVHF.fileIdntifer!)}).first{
ManualDownloadButton(manualType: .ManualInternationalVHF, downloadUrl: manual.path,version: Preferences.InternationalVHFManualVer, newVersion: manual.name, isAlert: $isAlert, isLoadingView: $isLoadingView){
path.append(.ManualInternationalVHF)
Preferences.InternationalVHFManualVer = manual.name
}
}
if let manual = SharingData.my.manualUrls.filter({$0.identifer == MenuPath.ManualVDR.fileIdntifer}).first{
if let manual = SharingData.my.manualUrls.filter({$0.identifer!.contains(MenuPath.ManualVDR.fileIdntifer!)}).first{
ManualDownloadButton(manualType: .ManualVDR, downloadUrl: manual.path,version: Preferences.VDRManualVer, newVersion: manual.name, isAlert: $isAlert, isLoadingView: $isLoadingView){
path.append(.ManualVDR)
Preferences.VDRManualVer = manual.name
......
......@@ -53,6 +53,7 @@ class Preferences{
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.Password.rawValue) static var Password: String
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.DeviceId.rawValue) static var DeviceId: String
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.UserName.rawValue) static var UserName: String
@AppStorage(wrappedValue:"", PreferencesKey.TypeString.Expiry.rawValue) static var Expiry: String
@AppStorage(wrappedValue:0, PreferencesKey.TypeInt.shipId.rawValue) static var shipId: Int
@AppStorage(wrappedValue:0, PreferencesKey.TypeInt.LocationType.rawValue) static var LocationType: Int
......
......@@ -16,6 +16,7 @@ class PreferencesKey{
case Password
case UserName
case DeviceId
case Expiry
//Manual類Version
case ECDISBasic
......
......@@ -66,8 +66,9 @@ class NotificationTags: NSObject {
let bamTag = "bam-" + shipId
let taskAlertTag = "taskalert-" + shipId
let sailassistTag = "sailassist-" + shipId
let emergencyTag = "emergency-" + shipId
// let chatTag = "chat-" + shipId
MSNotificationHub.addTags([routeTag, bamTag, taskAlertTag, sailassistTag])
MSNotificationHub.addTags([routeTag, bamTag, taskAlertTag, sailassistTag, emergencyTag])
}
}
}
......@@ -160,15 +161,15 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
let arrCategory = arrAPS["category"] as? String ?? ""
switch arrCategory {
case "chat":
guard let arrAlert = arrAPS["alert"] as? [String: Any] else {
return
}
// case "chat":
// guard let arrAlert = arrAPS["alert"] as? [String: Any] else {
// return
// }
// let subtitle = arrAlert["subtitle"] as? String ?? "" //送信先名称
// let strTitle = arrAlert["title"] as? String ?? "" //送信内容
// let strBody = arrAlert["body"] as? String ?? "" //船名
let message = GetMessage()
message.start()
// let message = GetMessage()
// message.start()
case "sailassist":
print(debug: "sailassist")
let getPushHistory = GetPushHistory()
......@@ -181,6 +182,10 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
print(debug: "route")
let getPushHistory = GetPushHistory()
getPushHistory.start()
case "emergency":
print(debug: "emergency")
let getPushHistory = GetPushHistory()
getPushHistory.start()
default:
print(debug: "default")
}
......@@ -203,15 +208,15 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
let arrCategory = arrAPS["category"] as? String ?? ""
switch arrCategory {
case "chat":
guard let arrAlert = arrAPS["alert"] as? [String: Any] else {
return
}
// case "chat":
// guard let arrAlert = arrAPS["alert"] as? [String: Any] else {
// return
// }
// let subtitle = arrAlert["subtitle"] as? String ?? "" //送信先名称
// let strTitle = arrAlert["title"] as? String ?? "" //送信内容
// let strBody = arrAlert["body"] as? String ?? "" //船名
let message = GetMessage()
message.start()
// let message = GetMessage()
// message.start()
case "sailassist":
print(debug: "sailassist")
let getPushHistory = GetPushHistory()
......@@ -224,6 +229,10 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
print(debug: "route")
let getPushHistory = GetPushHistory()
getPushHistory.start()
case "emergency":
print(debug: "emergency")
let getPushHistory = GetPushHistory()
getPushHistory.start()
default:
print(debug: "default")
}
......
//
// GetInformation.swift
// Sailassist
//
// Created by 三浦薫巳 on 2024/02/29.
//
import Foundation
class GetInformation {
var sessionInformation = SessionInformation()
func start() {
print(debug: "called")
sessionInformation.RequestInformation(responseInformation)
}
func responseInformation(result: Result<Data, APIError>) {
print(debug: "called")
switch result {
case .success(let resultData):
let serverSession = ServerSession()
let resjson = serverSession.fromJSON(resultData: resultData, resltType: [ResInformation].self)
SharingData.information.content = []
if let res = resjson {
SharingData.information.content = res
}
case .failure(let errorCode):
print(debug: errorCode)
break
}
}
}
//
// SessionInformation.swift
// Sailassist
//
// Created by 三浦薫巳 on 2024/02/29.
//
import Foundation
import SwiftUI
class SessionInformation : ObservableObject {
@Published var status = false
// シングルトン宣言
static let OnlyOne = SessionInformation()
private var serverSession = ServerSession()
private var Calling : Bool = false // 通信中
/**
* System Information取得
*/
func RequestInformation(_ completion: @escaping ((Result<Data, APIError>)) -> Void) {
print(debug: "calld")
if Calling {
return
}
Calling = true
// リクエストURLの組み立て
let url_string : String = HttpRequestType.Information.rawValue
guard let req_url = URL(string : url_string) else {
Calling = false
return
}
serverSession.getJson(req_url, completion: completion)
}
}
......@@ -7,28 +7,17 @@
import Foundation
import CoreLocation
enum EcaOperation {
case Insert
case Delete
case Running
case Notice
case Start
case Finish
case End
case Incomplete
case Change
case Cancel
}
class SharingData{
static var my = My()
class My: ObservableObject {
@Published var id: Int = 0
@Published var shipId: Int = 0
@Published var shipName: String = ""
@Published var imo: Int = 0
@Published var mmsi: Int = 0
@Published var isUpDate: Bool = false
@Published var isFuelSwitchTask: Bool = false
@Published var ecaStatus: EcaState?
......@@ -41,11 +30,15 @@ class SharingData{
@Published var gps: CLLocationCoordinate2D? = nil
@Published var server: CLLocationCoordinate2D? = nil
@Published var status: ShipAlert = ShipAlert.Normal
@Published var totalRmsAlarm: AlertStatusType = AlertStatusType.Normal
@Published var speed: Double = 0.0
@Published var course: Double = 0.0
@Published var heading: Double = 0.0
@Published var dataTime: String = "" //2023-11-02T05:25:49.4362123Z
@Published var focusOwnShip: Bool = false
func setLocation(){
if Preferences.LocationType == 0 {
self.location = self.gps
......@@ -54,6 +47,56 @@ class SharingData{
}
}
func setShipStatus(status: Int) -> ShipAlert {
var shipAlert = ShipAlert.Normal
switch status {
case -1:
shipAlert = ShipAlert.Offline
case 0:
shipAlert = ShipAlert.Unknown
case 1:
shipAlert = ShipAlert.Normal
case 2:
shipAlert = ShipAlert.Caution
case 3:
shipAlert = ShipAlert.Warrning
case 4:
shipAlert = ShipAlert.Alarm
case 5:
shipAlert = ShipAlert.Emergency
case 6:
shipAlert = ShipAlert.NecstEmergency
default:
shipAlert = ShipAlert.Unknown
}
return shipAlert
}
func setTotalRmsAlarm(alarm: Int) -> AlertStatusType {
var rmsAlarm = AlertStatusType.Normal
switch alarm {
case 0:
rmsAlarm = AlertStatusType.Unknown
case 1:
rmsAlarm = AlertStatusType.Normal
case 2:
rmsAlarm = AlertStatusType.Caution
case 3:
rmsAlarm = AlertStatusType.Warrning
case 4:
rmsAlarm = AlertStatusType.Alarm
case 5:
rmsAlarm = AlertStatusType.Emergency
default:
rmsAlarm = AlertStatusType.Unknown
}
return rmsAlarm
}
func reset() {
speed = 0.0
course = 0.0
......@@ -77,26 +120,31 @@ class SharingData{
@Published var messages: [ChatMessage] = []
}
static var information = Information()
class Information: ObservableObject {
@Published var content: [ResInformation] = []
}
/**
* Eca
*/
static var eca = Eca()
class Eca: ObservableObject{
@Published var ecaArea: Dictionary<String, RegisteredEca> = [:]
@Published var focusEca: String? = nil
@Published var ecaArea: Dictionary<Int, RegisteredEca> = [:]
@Published var focusEca: Int? = nil
@Published var isShowEcaAlert: Bool = false
func setEcaArea(key: String, value: RegisteredEca) {
func setEcaArea(key: Int, value: RegisteredEca) {
ecaArea.updateValue(value, forKey: key)
}
func editEcaArea(key: String, value: RegisteredEca, type: EcaOperation) {
func editEcaArea(key: Int, value: RegisteredEca, type: EcaOperation) {
let setEcaArea = SetEcaArea()
var task = ReqTaskList(Id: value.id)
var task = ReqTaskList(Id: value.areaId)
switch type {
case EcaOperation.Running:
task.areaId = value.id
task.areaId = value.areaId
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
......@@ -104,7 +152,7 @@ class SharingData{
task.status = serverRunning
setEcaArea.start(eca: task)
case EcaOperation.Insert:
task.areaId = value.id
task.areaId = value.areaId
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
......@@ -113,9 +161,9 @@ class SharingData{
setEcaArea.start(eca: task)
case EcaOperation.Delete:
let deleteEcaArea = DeleteEcaArea()
deleteEcaArea.start(ecaId: value.id)
deleteEcaArea.start(ecaId: value.areaId)
case EcaOperation.Notice:
task.areaId = value.id
task.areaId = value.areaId
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
......@@ -125,7 +173,7 @@ class SharingData{
}
setEcaArea.start(eca: task)
case EcaOperation.Start:
task.areaId = value.id
task.areaId = value.areaId
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
......@@ -135,7 +183,7 @@ class SharingData{
}
setEcaArea.start(eca: task)
case EcaOperation.Finish:
task.areaId = value.id
task.areaId = value.areaId
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
......@@ -145,7 +193,7 @@ class SharingData{
}
setEcaArea.start(eca: task)
case EcaOperation.End:
task.areaId = value.id
task.areaId = value.areaId
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
......@@ -155,7 +203,7 @@ class SharingData{
}
setEcaArea.start(eca: task)
case EcaOperation.Incomplete:
task.areaId = value.id
task.areaId = value.areaId
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
......@@ -165,7 +213,7 @@ class SharingData{
}
setEcaArea.start(eca: task)
case EcaOperation.Cancel:
task.areaId = value.id
task.areaId = value.areaId
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
......@@ -175,7 +223,7 @@ class SharingData{
}
setEcaArea.start(eca: task)
case EcaOperation.Change:
task.areaId = value.id
task.areaId = value.areaId
task.taskName = value.name
task.noticeRange = value.swNotice
task.startRange = value.swStart
......
//
// StatusEnum.swift
// Sailassist
//
// Created by 三浦薫巳 on 2024/02/28.
//
import Foundation
enum EcaOperation {
case Insert
case Delete
case Running
case Notice
case Start
case Finish
case End
case Incomplete
case Change
case Cancel
}
enum ShipAlert {
case Offline
case Unknown
case Normal
case Caution
case Warrning
case Alarm
case Emergency
case NecstEmergency
}
enum AlertStatusType {
case Unknown
case Normal
case Caution
case Warrning
case Alarm
case Emergency
}
// |status|Ssv.Data.Enum.ShipAlarmStatus.cs (Offline = -1, Unknown = 0, Normal = 1, Caution = 2, Warning = 3, Alarm = 4, Emergency = 5, NecstEmergency = 6)|
// |totalRmsAlarm|Ssv.Data.Enum.AlertStatusType.cs (Unknown = 0, Normal = 1, Caution = 2, Warning = 3, Alarm = 4, Emergency = 5)|
......@@ -24,14 +24,14 @@ struct MainTabView: View {
@EnvironmentObject var selectedTabModel: SelectedTabModel
@EnvironmentObject private var sceneDelegate: SceneDelegate
@State var isSignout = false
@State var isLogin = false
init() {
let appearance: UITabBarAppearance = UITabBarAppearance()
appearance.backgroundColor = .clear
UITabBar.appearance().scrollEdgeAppearance = appearance
UITabBar.appearance().standardAppearance = appearance
EcaCoordinatesTable().setEcaData()
SharingData.location.focusOwnShip = true
// EcaCoordinatesTable().setEcaData()
}
var body: some View {
......@@ -55,7 +55,7 @@ struct MainTabView: View {
.tag(Tab.menu)
}
.hideNativeTabBar()
.sheet(isPresented: .constant(isTaskSel && isTabShow), content: {
.sheet(isPresented: .constant(isTaskSel && isTabShow && SharingData.my.isFuelSwitchTask), content: {
MapTaskView()
.zIndex(0)
.presentationDragIndicator(.hidden)
......@@ -84,7 +84,7 @@ struct MainTabView: View {
.tag(Tab.menu)
}
.hideNativeTabBar()
.popover(isPresented: .constant(isPopover), attachmentAnchor: .point(.bottom)) {
.popover(isPresented: .constant(isPopover && SharingData.my.isFuelSwitchTask), attachmentAnchor: .point(.bottom)) {
MapTaskView()
.presentationCompactAdaptation(.none)
.zIndex(0)
......@@ -104,6 +104,7 @@ struct CustomTabBar: View {
@State var isLocationAlert = false
@Environment(\.openURL) var openURL
@ObservedObject var my = SharingData.my
@ObservedObject var location = SharingData.location
var body: some View {
VStack(spacing: 0){
......@@ -115,6 +116,7 @@ struct CustomTabBar: View {
selectedTabModel.activeTab = tab
if tab == .task {
selectedTabModel.isPoppver.toggle()
location.focusOwnShip = true
} else {
selectedTabModel.isPoppver = false
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment