Commit 6e93098a authored by sugita mamoru's avatar sugita mamoru

地図表示、タスク設定

parent 866c9797
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
022789082AE1FE4C00A87787 /* Turf.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 022788F72AE1FE3C00A87787 /* Turf.xcframework */; }; 022789082AE1FE4C00A87787 /* Turf.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 022788F72AE1FE3C00A87787 /* Turf.xcframework */; };
022789092AE1FE4C00A87787 /* Turf.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 022788F72AE1FE3C00A87787 /* Turf.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 022789092AE1FE4C00A87787 /* Turf.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 022788F72AE1FE3C00A87787 /* Turf.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
0227890C2AE22E0B00A87787 /* SharingData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0227890B2AE22E0B00A87787 /* SharingData.swift */; }; 0227890C2AE22E0B00A87787 /* SharingData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0227890B2AE22E0B00A87787 /* SharingData.swift */; };
022A98202AF8B8960079C55A /* LocationCalculation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 022A981F2AF8B8960079C55A /* LocationCalculation.swift */; };
02CD068F2AE6535F005F8D8F /* MapSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CD068E2AE6535F005F8D8F /* MapSource.swift */; }; 02CD068F2AE6535F005F8D8F /* MapSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CD068E2AE6535F005F8D8F /* MapSource.swift */; };
02CD06912AE6536B005F8D8F /* LayerEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CD06902AE6536B005F8D8F /* LayerEnum.swift */; }; 02CD06912AE6536B005F8D8F /* LayerEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CD06902AE6536B005F8D8F /* LayerEnum.swift */; };
02CD06932AE88970005F8D8F /* ServerSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CD06922AE88970005F8D8F /* ServerSession.swift */; }; 02CD06932AE88970005F8D8F /* ServerSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02CD06922AE88970005F8D8F /* ServerSession.swift */; };
...@@ -61,7 +62,6 @@ ...@@ -61,7 +62,6 @@
D5AE351A2AEBA66A00059889 /* ReqLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AE35182AEBA66A00059889 /* ReqLogin.swift */; }; D5AE351A2AEBA66A00059889 /* ReqLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AE35182AEBA66A00059889 /* ReqLogin.swift */; };
D5AE351B2AEBA66A00059889 /* ResLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AE35192AEBA66A00059889 /* ResLogin.swift */; }; D5AE351B2AEBA66A00059889 /* ResLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AE35192AEBA66A00059889 /* ResLogin.swift */; };
D5AE351D2AEBA6FC00059889 /* SessionLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AE351C2AEBA6FC00059889 /* SessionLogin.swift */; }; D5AE351D2AEBA6FC00059889 /* SessionLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AE351C2AEBA6FC00059889 /* SessionLogin.swift */; };
D5EA864A2AF213C90032E810 /* LocationCalculation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5EA86492AF213C90032E810 /* LocationCalculation.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
...@@ -134,6 +134,7 @@ ...@@ -134,6 +134,7 @@
022788F92AE1FE3D00A87787 /* MapboxCommon.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = MapboxCommon.xcframework; sourceTree = "<group>"; }; 022788F92AE1FE3D00A87787 /* MapboxCommon.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = MapboxCommon.xcframework; sourceTree = "<group>"; };
022788FA2AE1FE3D00A87787 /* MapboxMaps.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = MapboxMaps.xcframework; sourceTree = "<group>"; }; 022788FA2AE1FE3D00A87787 /* MapboxMaps.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = MapboxMaps.xcframework; sourceTree = "<group>"; };
0227890B2AE22E0B00A87787 /* SharingData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingData.swift; sourceTree = "<group>"; }; 0227890B2AE22E0B00A87787 /* SharingData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingData.swift; sourceTree = "<group>"; };
022A981F2AF8B8960079C55A /* LocationCalculation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LocationCalculation.swift; path = Sailassist/Location/LocationCalculation.swift; sourceTree = SOURCE_ROOT; };
02CD068E2AE6535F005F8D8F /* MapSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapSource.swift; sourceTree = "<group>"; }; 02CD068E2AE6535F005F8D8F /* MapSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapSource.swift; sourceTree = "<group>"; };
02CD06902AE6536B005F8D8F /* LayerEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayerEnum.swift; sourceTree = "<group>"; }; 02CD06902AE6536B005F8D8F /* LayerEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayerEnum.swift; sourceTree = "<group>"; };
02CD06922AE88970005F8D8F /* ServerSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSession.swift; sourceTree = "<group>"; }; 02CD06922AE88970005F8D8F /* ServerSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSession.swift; sourceTree = "<group>"; };
...@@ -153,7 +154,6 @@ ...@@ -153,7 +154,6 @@
D5AE35182AEBA66A00059889 /* ReqLogin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ReqLogin.swift; path = Sailassist/Json/ReqLogin.swift; sourceTree = SOURCE_ROOT; }; D5AE35182AEBA66A00059889 /* ReqLogin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ReqLogin.swift; path = Sailassist/Json/ReqLogin.swift; sourceTree = SOURCE_ROOT; };
D5AE35192AEBA66A00059889 /* ResLogin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ResLogin.swift; path = Sailassist/Json/ResLogin.swift; sourceTree = SOURCE_ROOT; }; D5AE35192AEBA66A00059889 /* ResLogin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ResLogin.swift; path = Sailassist/Json/ResLogin.swift; sourceTree = SOURCE_ROOT; };
D5AE351C2AEBA6FC00059889 /* SessionLogin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SessionLogin.swift; path = Sailassist/ServerSession/SessionLogin.swift; sourceTree = SOURCE_ROOT; }; D5AE351C2AEBA6FC00059889 /* SessionLogin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SessionLogin.swift; path = Sailassist/ServerSession/SessionLogin.swift; sourceTree = SOURCE_ROOT; };
D5EA86492AF213C90032E810 /* LocationCalculation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LocationCalculation.swift; path = ../../../../Sailassist_login/Seilassist/Sailassist/Location/LocationCalculation.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -473,7 +473,7 @@ ...@@ -473,7 +473,7 @@
D5EA86482AF2139D0032E810 /* Location */ = { D5EA86482AF2139D0032E810 /* Location */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
D5EA86492AF213C90032E810 /* LocationCalculation.swift */, 022A981F2AF8B8960079C55A /* LocationCalculation.swift */,
); );
path = Location; path = Location;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -613,8 +613,8 @@ ...@@ -613,8 +613,8 @@
02CD06912AE6536B005F8D8F /* LayerEnum.swift in Sources */, 02CD06912AE6536B005F8D8F /* LayerEnum.swift in Sources */,
020B98532AD919180029DE4C /* LoginTypeSelectView.swift in Sources */, 020B98532AD919180029DE4C /* LoginTypeSelectView.swift in Sources */,
D52D213F2AEBB7D700324D58 /* RegisteredEca.swift in Sources */, D52D213F2AEBB7D700324D58 /* RegisteredEca.swift in Sources */,
D5EA864A2AF213C90032E810 /* LocationCalculation.swift in Sources */,
02CD06952AE895F5005F8D8F /* APIError.swift in Sources */, 02CD06952AE895F5005F8D8F /* APIError.swift in Sources */,
022A98202AF8B8960079C55A /* LocationCalculation.swift in Sources */,
02CE4DC82ADF97E8002E79BC /* View+Extensions.swift in Sources */, 02CE4DC82ADF97E8002E79BC /* View+Extensions.swift in Sources */,
020B98412AD8C3810029DE4C /* LoginView.swift in Sources */, 020B98412AD8C3810029DE4C /* LoginView.swift in Sources */,
D5AE351D2AEBA6FC00059889 /* SessionLogin.swift in Sources */, D5AE351D2AEBA6FC00059889 /* SessionLogin.swift in Sources */,
...@@ -828,7 +828,7 @@ ...@@ -828,7 +828,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = test.sugita.sailassist; PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
...@@ -860,7 +860,7 @@ ...@@ -860,7 +860,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = test.sugita.sailassist; PRODUCT_BUNDLE_IDENTIFIER = com.jrc.sailassist;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
......
...@@ -4336,7 +4336,7 @@ class EcaCoordinatesTable : NSObject { ...@@ -4336,7 +4336,7 @@ class EcaCoordinatesTable : NSObject {
func setEcaData() { func setEcaData() {
for data in ecaDataTable { for data in ecaDataTable {
if !SharingData.shared.ecaArea.keys.contains(data.name) { if !SharingData.shared.ecaArea.keys.contains(data.name) {
let reg = RegisteredEca(ecaName: data.name)! var reg = RegisteredEca(ecaName: data.name)!
reg.color = "0xFF0000" //ライン色(ARGB) reg.color = "0xFF0000" //ライン色(ARGB)
reg.points = data.table reg.points = data.table
SharingData.shared.ecaArea.updateValue(reg, forKey: data.name) SharingData.shared.ecaArea.updateValue(reg, forKey: data.name)
......
...@@ -8,18 +8,18 @@ ...@@ -8,18 +8,18 @@
import Foundation import Foundation
import CoreLocation import CoreLocation
class RegisteredEca: ObservableObject { struct RegisteredEca {
@Published var id: UInt32 = 0 var id: UInt32 = 0
@Published var isEnable: Bool = false //ECA有効 var isEnable: Bool = false //ECA有効
@Published var isRunning: Bool = false //ECA実行中 var isRunning: Bool = false //ECA実行中
@Published var name: String = "" //ECA名称 var name: String = "" //ECA名称
@Published var swNotice: UInt32 = 6 //ECA通知[NM] var swNotice: Float = 6 //ECA通知[NM]
@Published var swStart: UInt32 = 5 //ECA開始[NM] var swStart: Float = 5 //ECA開始[NM]
@Published var swFinish: UInt32 = 4 //ECA終了[NM] var swFinish: Float = 4 //ECA終了[NM]
@Published var datetime: String = "" //時刻(UTC ISO8601準拠) var datetime: String = "" //時刻(UTC ISO8601準拠)
@Published var color: String = "" //ライン色(ARGB) var color: String = "" //ライン色(ARGB)
@Published var width: UInt32 = 1 //ライン幅 var width: UInt32 = 1 //ライン幅
@Published var points: [CLLocationCoordinate2D] = [] var points: [CLLocationCoordinate2D] = []
init?( ecaName: String ) { init?( ecaName: String ) {
self.name = ecaName self.name = ecaName
......
...@@ -9,4 +9,5 @@ import Foundation ...@@ -9,4 +9,5 @@ import Foundation
enum LayerEnum: String{ enum LayerEnum: String{
case OwnShip case OwnShip
case EcaLine
} }
...@@ -11,14 +11,17 @@ import MapboxMaps ...@@ -11,14 +11,17 @@ import MapboxMaps
import UIKit import UIKit
struct MapRepresentable: UIViewControllerRepresentable{ struct MapRepresentable: UIViewControllerRepresentable{
@ObservedObject var sharingData = SharingData.shared
let mapVC = MapViewController() @State var mapVC = MapViewController()
func makeUIViewController(context: Context) -> some UIViewController { func makeUIViewController(context: Context) -> some UIViewController {
mapVC mapVC
} }
func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {
if let ecaArea = sharingData.ecaArea.map{ $0.1 }.filter{ $0.isRunning }.first{
mapVC.updateEcaLine(line: ecaArea.points)
}
} }
} }
...@@ -26,7 +29,8 @@ class MapViewController : UIViewController{ ...@@ -26,7 +29,8 @@ class MapViewController : UIViewController{
internal var mapView: MapView! internal var mapView: MapView!
public var ownShipSymbol = MapSource(layer: .OwnShip) var ownShipSymbol = MapSource(layer: .OwnShip)
var ecaLine = MapSource(layer: .EcaLine)
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -43,7 +47,6 @@ class MapViewController : UIViewController{ ...@@ -43,7 +47,6 @@ class MapViewController : UIViewController{
mapView.mapboxMap.onNext(event: .mapLoaded) { [self] _ in mapView.mapboxMap.onNext(event: .mapLoaded) { [self] _ in
self.addLayers() self.addLayers()
self.updateOwnShip(location: CLLocationCoordinate2D(latitude: 45, longitude: 100))
} }
} }
...@@ -71,6 +74,19 @@ class MapViewController : UIViewController{ ...@@ -71,6 +74,19 @@ class MapViewController : UIViewController{
try! mapView.mapboxMap.style.addSource(ownShipSymbol.source, id: ownShipSymbol.sourceId) try! mapView.mapboxMap.style.addSource(ownShipSymbol.source, id: ownShipSymbol.sourceId)
try? mapView.mapboxMap.style.addLayer(ownShipSymbolLayer) try? mapView.mapboxMap.style.addLayer(ownShipSymbolLayer)
let ecaLineString = LineString([LocationCoordinate2D(latitude: 0, longitude: 0)])
var ecaLinefeature = Feature(geometry: ecaLineString)
ecaLine.source.data = .feature(ecaLinefeature)
var ecaLineLayer = LineLayer(id: ecaLine.layerId)
ecaLineLayer.source = ecaLine.sourceId
ecaLineLayer.lineColor = .expression(Exp(.get) {
PropertyKey.Color.rawValue
})
ecaLineLayer.lineDasharray = .constant([2,1])
try! mapView.mapboxMap.style.addSource(ecaLine.source, id: ecaLine.sourceId)
try? mapView.mapboxMap.style.addLayer(ecaLineLayer)
} }
func updateOwnShip(location: CLLocationCoordinate2D){ func updateOwnShip(location: CLLocationCoordinate2D){
...@@ -80,6 +96,18 @@ class MapViewController : UIViewController{ ...@@ -80,6 +96,18 @@ class MapViewController : UIViewController{
try! self.mapView.mapboxMap.style.updateGeoJSONSource(withId: self.ownShipSymbol.sourceId, try! self.mapView.mapboxMap.style.updateGeoJSONSource(withId: self.ownShipSymbol.sourceId,
geoJSON: .feature(geoJSON)) geoJSON: .feature(geoJSON))
} }
func updateEcaLine(line: [CLLocationCoordinate2D]){
do{
var geoJson = Feature(geometry: LineString(line))
geoJson.properties = [PropertyKey.Color.rawValue: .string(Color.blue.description)]
try self.mapView.mapboxMap.style.updateGeoJSONSource(withId: ecaLine.sourceId, geoJSON: .feature(geoJson))
}catch{
}
}
...@@ -87,6 +115,7 @@ class MapViewController : UIViewController{ ...@@ -87,6 +115,7 @@ class MapViewController : UIViewController{
enum PropertyKey : String { enum PropertyKey : String {
case IconImage case IconImage
case Bearing case Bearing
case Color
} }
enum IconImage: String, CaseIterable{ enum IconImage: String, CaseIterable{
......
...@@ -18,8 +18,9 @@ struct EcaListView: View { ...@@ -18,8 +18,9 @@ struct EcaListView: View {
Spacer() Spacer()
if !eca.isEnable{ if !eca.isEnable{
Button(action: { Button(action: {
eca.isEnable.toggle() var newData = eca
sharingData.editEcaArea(key: eca.name, value: eca) newData.isEnable.toggle()
sharingData.editEcaArea(key: eca.name, value: newData)
}, label: { }, label: {
Image("icon_plus") Image("icon_plus")
.padding() .padding()
......
...@@ -8,43 +8,21 @@ ...@@ -8,43 +8,21 @@
import SwiftUI import SwiftUI
struct EcaSettingView: View { struct EcaSettingView: View {
@Binding var isShowSettingEca: Bool
@State var edittingEca: RegisteredEca
// @State var ecaArea: RegisteredEca = RegisteredEca(ecaName: "eca")!
var body: some View { var body: some View {
VStack{ VStack{
SliderView(param: $edittingEca.swFinish, title: "Switching Finish - ECA")
VStack(alignment: .leading){
Text("Switching Finish - ECA")
.foregroundColor(ColorSet.Body.color)
HStack{
Text("17")
Text("NM")
}
.foregroundColor(ColorSet.Body.color)
HStack{
Button(action: {
}, label: {
Image(systemName: "minus.circle")
})
Slider(value: .constant(1))
Button(action: {
}, label: {
Image(systemName: "plus.circle")
})
}
}
Divider() Divider()
SliderView(param: $edittingEca.swStart, title: "Switching Start - ECA")
Divider()
SliderView(param: $edittingEca.swNotice, title: "Switching Notice - ECA")
Button(action: { Button(action: {
SharingData.shared.editEcaArea(key: edittingEca.name, value: edittingEca)
isShowSettingEca = false
}, label: { }, label: {
Text("Register") Text("Register")
.padding() .padding()
...@@ -57,6 +35,42 @@ struct EcaSettingView: View { ...@@ -57,6 +35,42 @@ struct EcaSettingView: View {
} }
} }
fileprivate struct SliderView: View {
@Binding var param: Float
let title: String
var min : Float = 1
var max : Float = 10
var body: some View {
VStack(alignment: .leading){
Text(title)
.foregroundColor(ColorSet.Body.color)
HStack{
Text(String(format: "%d", Int(param)))
Text("NM")
}
.foregroundColor(ColorSet.Body.color)
HStack{
Button(action: {
param -= 1
}, label: {
Image(systemName: "minus.circle")
})
.disabled(param <= min)
Slider(value: $param, in: min...max, step: 1)
Button(action: {
param += 1
}, label: {
Image(systemName: "plus.circle")
})
.disabled(param >= max)
}
}
}
}
#Preview { #Preview {
EcaSettingView() EcaSettingView(isShowSettingEca: .constant(true), edittingEca: RegisteredEca(ecaName: "eca")!)
} }
...@@ -10,7 +10,6 @@ import SwiftUI ...@@ -10,7 +10,6 @@ import SwiftUI
enum TaskViewMode{ enum TaskViewMode{
case SwitchingMenu case SwitchingMenu
case EcaList case EcaList
case EcaSetting
var title: String{ var title: String{
switch self{ switch self{
...@@ -18,8 +17,6 @@ enum TaskViewMode{ ...@@ -18,8 +17,6 @@ enum TaskViewMode{
"Fuel Switching" "Fuel Switching"
case .EcaList: case .EcaList:
"ECA List" "ECA List"
case .EcaSetting:
""
} }
} }
} }
...@@ -27,6 +24,8 @@ enum TaskViewMode{ ...@@ -27,6 +24,8 @@ enum TaskViewMode{
struct MapTaskView: View { struct MapTaskView: View {
@State var viewMode: TaskViewMode = .SwitchingMenu @State var viewMode: TaskViewMode = .SwitchingMenu
@State var edittingEcaArea: RegisteredEca? = nil
@State var isShowSettingView : Bool = false
var body: some View { var body: some View {
VStack{ VStack{
Capsule() Capsule()
...@@ -75,11 +74,13 @@ struct MapTaskView: View { ...@@ -75,11 +74,13 @@ struct MapTaskView: View {
ScrollView(.vertical){ ScrollView(.vertical){
switch viewMode { switch viewMode {
case .SwitchingMenu: case .SwitchingMenu:
TaskSwitchingMenuView(viewMode: $viewMode) if let edittingEcaArea = edittingEcaArea, isShowSettingView{
EcaSettingView(isShowSettingEca: $isShowSettingView, edittingEca: edittingEcaArea)
}else{
TaskSwitchingMenuView(viewMode: $viewMode, edittingEcaArea: $edittingEcaArea, isShowSettingEca: $isShowSettingView)
}
case .EcaList: case .EcaList:
EcaListView() EcaListView()
case .EcaSetting:
EcaSettingView()
} }
} }
...@@ -87,7 +88,7 @@ struct MapTaskView: View { ...@@ -87,7 +88,7 @@ struct MapTaskView: View {
.padding(.trailing, 10) .padding(.trailing, 10)
Spacer() Spacer()
.frame(height: 100) .frame(height: 55)
}.onAppear{ }.onAppear{
EcaCoordinatesTable().setEcaData() EcaCoordinatesTable().setEcaData()
......
...@@ -9,7 +9,11 @@ import SwiftUI ...@@ -9,7 +9,11 @@ import SwiftUI
struct TaskSwitchingMenuView: View { struct TaskSwitchingMenuView: View {
@Binding var viewMode: TaskViewMode @Binding var viewMode: TaskViewMode
@Binding var edittingEcaArea: RegisteredEca?
@Binding var isShowSettingEca : Bool
@ObservedObject var sharingData = SharingData.shared @ObservedObject var sharingData = SharingData.shared
@State var isDeleteAlert : Bool = false
var body: some View { var body: some View {
VStack{ VStack{
ForEach(sharingData.ecaArea.map{ $0.1 }.filter{ $0.isEnable }, id: \.name){ eca in ForEach(sharingData.ecaArea.map{ $0.1 }.filter{ $0.isEnable }, id: \.name){ eca in
...@@ -17,12 +21,14 @@ struct TaskSwitchingMenuView: View { ...@@ -17,12 +21,14 @@ struct TaskSwitchingMenuView: View {
VStack { VStack {
HStack { HStack {
Button { Button {
for running in sharingData.ecaArea.map{ $0.1 }.filter{ $0.isRunning }{ for runningEca in sharingData.ecaArea.map{ $0.1 }.filter{ $0.isRunning }{
running.isRunning = false var newData = runningEca
sharingData.editEcaArea(key: running.name, value: running) newData.isRunning = false
sharingData.editEcaArea(key: runningEca.name, value: newData)
} }
eca.isRunning = true var newData = eca
sharingData.editEcaArea(key: eca.name, value: eca) newData.isRunning = true
sharingData.editEcaArea(key: eca.name, value: newData)
} label: { } label: {
Circle() Circle()
.frame(width: 10) .frame(width: 10)
...@@ -34,38 +40,54 @@ struct TaskSwitchingMenuView: View { ...@@ -34,38 +40,54 @@ struct TaskSwitchingMenuView: View {
Spacer() Spacer()
Menu { Menu {
Label{ Text(eca.name)
Text(eca.name)
} icon: {
Image("closeIcon")
}
Button{ Button{
viewMode = .EcaSetting edittingEcaArea = eca
isShowSettingEca = true
} label: { } label: {
Text("Edit Notice Setting") Text("Edit Notice Setting")
} }
Button{ Button{
edittingEcaArea = eca
isDeleteAlert = true
} label: { } label: {
Text("Delete ECA Task") Text("Delete ECA Task")
} }
} label: { } label: {
Image(systemName: "ellipsis") Image(systemName: "ellipsis")
.padding()
} }
.disabled(eca.isRunning) .disabled(eca.isRunning)
.alert("delete", isPresented: $isDeleteAlert) {
Button(role: .destructive) {
if let ecaArea = edittingEcaArea{
var newData = ecaArea
newData.isEnable = false
sharingData.editEcaArea(key: ecaArea.name, value: newData)
}
edittingEcaArea = nil
} label: {
Text("delete")
}
Button(role: .cancel) {
} label: {
Text("cancel")
}
} message: {
Text("eca delete")
}
} }
.frame(height: 50) .frame(height: 50)
Divider() Divider()
} }
} }
// TaskEcaView()
//AddECAボタン //AddECAボタン
Button(action: { Button(action: {
viewMode = .EcaList viewMode = .EcaList
...@@ -84,5 +106,5 @@ struct TaskSwitchingMenuView: View { ...@@ -84,5 +106,5 @@ struct TaskSwitchingMenuView: View {
#Preview { #Preview {
TaskSwitchingMenuView(viewMode: .constant(.SwitchingMenu)) TaskSwitchingMenuView(viewMode: .constant(.SwitchingMenu), edittingEcaArea: .constant(nil), isShowSettingEca: .constant(false))
} }
...@@ -62,7 +62,7 @@ struct MainTabView: View { ...@@ -62,7 +62,7 @@ struct MainTabView: View {
} }
.zIndex(0) .zIndex(0)
.presentationDragIndicator(.hidden) .presentationDragIndicator(.hidden)
.presentationDetents([.height(100), .medium, .fraction(0.99)]) .presentationDetents([.height(155), .medium, .fraction(0.99)])
.presentationCornerRadius(15) .presentationCornerRadius(15)
.presentationBackgroundInteraction(.enabled(upThrough: .medium)) .presentationBackgroundInteraction(.enabled(upThrough: .medium))
.presentationBackground(ColorSet.ModalWindowBack.color) .presentationBackground(ColorSet.ModalWindowBack.color)
......
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