Commit e43c5064 authored by sugita mamoru's avatar sugita mamoru

Task関連実装

parent fa23994a
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
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 */; };
0227890E2AE245C300A87787 /* ECA.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0227890D2AE245C300A87787 /* ECA.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 */; };
...@@ -134,7 +133,6 @@ ...@@ -134,7 +133,6 @@
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>"; };
0227890D2AE245C300A87787 /* ECA.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ECA.swift; sourceTree = "<group>"; };
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>"; };
...@@ -393,7 +391,6 @@ ...@@ -393,7 +391,6 @@
022789112AE6028800A87787 /* ViewModel */ = { 022789112AE6028800A87787 /* ViewModel */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0227890D2AE245C300A87787 /* ECA.swift */,
); );
path = ViewModel; path = ViewModel;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -605,7 +602,6 @@ ...@@ -605,7 +602,6 @@
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 */,
0227890E2AE245C300A87787 /* ECA.swift in Sources */,
02CD06952AE895F5005F8D8F /* APIError.swift in Sources */, 02CD06952AE895F5005F8D8F /* APIError.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 */,
......
...@@ -17,6 +17,13 @@ struct ContentView: View { ...@@ -17,6 +17,13 @@ struct ContentView: View {
NavigationStack{ NavigationStack{
MainTabView() MainTabView()
.environmentObject(selectedTabModel) .environmentObject(selectedTabModel)
.onAppear(){
if isLogin{
guard sceneDelegate.tabWindow == nil else{ return }
sceneDelegate.addTabBar(selectedTabModel)
selectedTabModel.activeTab = .task
}
}
} }
.fullScreenCover(isPresented: .constant(!isLogin), onDismiss: { .fullScreenCover(isPresented: .constant(!isLogin), onDismiss: {
guard sceneDelegate.tabWindow == nil else{ return } guard sceneDelegate.tabWindow == nil else{ return }
......
...@@ -4335,11 +4335,11 @@ class EcaCoordinatesTable : NSObject { ...@@ -4335,11 +4335,11 @@ class EcaCoordinatesTable : NSObject {
func setEcaData() { func setEcaData() {
for data in ecaDataTable { for data in ecaDataTable {
if !SharingData.Eca.area.keys.contains(data.name) { if !SharingData.shared.ecaArea.keys.contains(data.name) {
let reg = RegisteredEca(ecaName: data.name)! let reg = RegisteredEca(ecaName: data.name)!
reg.color = "0xFF0000" //ライン色(ARGB) reg.color = "0xFF0000" //ライン色(ARGB)
reg.points = data.table reg.points = data.table
SharingData.Eca.area.updateValue(reg, forKey: data.name) SharingData.shared.ecaArea.updateValue(reg, forKey: data.name)
} }
} }
} }
......
...@@ -8,18 +8,37 @@ ...@@ -8,18 +8,37 @@
import Foundation import Foundation
import CoreLocation import CoreLocation
class RegisteredEca { //class RegisteredEca {
var id: UInt32 = 0 // var id: UInt32 = 0
var isEnable: Bool = false //ECA有効 // var isEnable: Bool = false //ECA有効
var isRunning: Bool = false //ECA実行中 // var isRunning: Bool = false //ECA実行中
var name: String = "" //ECA名称 // var name: String = "" //ECA名称
var swNotice: UInt32 = 6 //ECA通知[NM] // var swNotice: UInt32 = 6 //ECA通知[NM]
var swStart: UInt32 = 5 //ECA開始[NM] // var swStart: UInt32 = 5 //ECA開始[NM]
var swFinish: UInt32 = 4 //ECA終了[NM] // var swFinish: UInt32 = 4 //ECA終了[NM]
var datetime: String = "" //時刻(UTC ISO8601準拠) // var datetime: String = "" //時刻(UTC ISO8601準拠)
var color: String = "" //ライン色(ARGB) // var color: String = "" //ライン色(ARGB)
var width: UInt32 = 1 //ライン幅 // var width: UInt32 = 1 //ライン幅
var points: [CLLocationCoordinate2D] = [] // var points: [CLLocationCoordinate2D] = []
//
// init?( ecaName: String ) {
// self.name = ecaName
// }
//}
class RegisteredEca: ObservableObject {
@Published var id: UInt32 = 0
@Published var isEnable: Bool = false //ECA有効
@Published var isRunning: Bool = false //ECA実行中
@Published var name: String = "" //ECA名称
@Published var swNotice: UInt32 = 6 //ECA通知[NM]
@Published var swStart: UInt32 = 5 //ECA開始[NM]
@Published var swFinish: UInt32 = 4 //ECA終了[NM]
@Published var datetime: String = "" //時刻(UTC ISO8601準拠)
@Published var color: String = "" //ライン色(ARGB)
@Published var width: UInt32 = 1 //ライン幅
@Published var points: [CLLocationCoordinate2D] = []
init?( ecaName: String ) { init?( ecaName: String ) {
self.name = ecaName self.name = ecaName
......
...@@ -8,35 +8,22 @@ ...@@ -8,35 +8,22 @@
import SwiftUI import SwiftUI
struct EcaListView: View { struct EcaListView: View {
@ObservedObject var sharingData = SharingData.shared
let ecas = ["America",
"Canada",
"Japan"]
var body: some View {
ForEach(ecas, id: \.self){ data in
AddEcaView(name: data, isRegisterd: .constant(true))
Divider()
}
}
}
struct AddEcaView: View {
let name: String
@Binding var isRegisterd: Bool
var body: some View { var body: some View {
ForEach(sharingData.ecaArea.map{ $0.1 }, id: \.name){ eca in
HStack { HStack {
Text("\(name) ECA") Text(eca.name)
.padding(17) .padding(17)
Spacer() Spacer()
if isRegisterd{ if !eca.isEnable{
Button(action: { Button(action: {
isRegisterd.toggle() eca.isEnable.toggle()
sharingData.editEcaArea(key: eca.name, value: eca)
}, label: { }, label: {
Image("icon_plus") Image("icon_plus")
.padding() .padding()
}) })
// .frame(width: 24, height: 24)
.background(.primaryActiveIcon) .background(.primaryActiveIcon)
.cornerRadius(50) .cornerRadius(50)
.padding() .padding()
...@@ -49,9 +36,14 @@ struct AddEcaView: View { ...@@ -49,9 +36,14 @@ struct AddEcaView: View {
} }
} }
Divider()
}
} }
} }
#Preview { #Preview {
EcaListView() EcaListView()
.environmentObject(SharingData.shared)
} }
...@@ -76,6 +76,8 @@ struct MapTaskView: View { ...@@ -76,6 +76,8 @@ struct MapTaskView: View {
.padding(.leading, 20) .padding(.leading, 20)
.padding(.trailing, 10) .padding(.trailing, 10)
}.onAppear{
EcaCoordinatesTable().setEcaData()
} }
} }
} }
......
...@@ -8,16 +8,34 @@ ...@@ -8,16 +8,34 @@
import SwiftUI import SwiftUI
struct TaskSwitchingMenuView: View { struct TaskSwitchingMenuView: View {
@Binding var viewMode: TaskViewMode @Binding var viewMode: TaskViewMode
@ObservedObject var sharingData = SharingData.shared
var list : [ECA] = [.America]
var body: some View { var body: some View {
VStack{ VStack{
//List ForEach(sharingData.ecaArea.map{ $0.1 }.filter{ $0.isEnable }, id: \.name){ eca in
HStack {
Circle()
.frame(width: 10)
.foregroundColor(eca.isRunning ? .red : .blue)
Text(eca.name)
Spacer()
TaskEcaView() Button(action: {
for running in sharingData.ecaArea.map{ $0.1 }.filter{ $0.isRunning }{
running.isRunning = false
sharingData.editEcaArea(key: running.name, value: running)
}
eca.isRunning = true
sharingData.editEcaArea(key: eca.name, value: eca)
}, label: {
Text("Button")
})
}
}
// TaskEcaView()
//AddECAボタン //AddECAボタン
Button(action: { Button(action: {
viewMode = .EcaList viewMode = .EcaList
...@@ -35,20 +53,26 @@ struct TaskSwitchingMenuView: View { ...@@ -35,20 +53,26 @@ struct TaskSwitchingMenuView: View {
} }
struct TaskEcaView: View { struct TaskEcaView: View {
@Binding var data : RegisteredEca
@State var isPopover: Bool = false
var body: some View { var body: some View {
HStack { HStack {
Circle() Circle()
.frame(width: 10) .frame(width: 10)
Text("America ECA") Text(data.name)
Spacer() Spacer()
Button(action: { Button(action: {
// isPopover = true
}, label: { }, label: {
/*@START_MENU_TOKEN@*/Text("Button")/*@END_MENU_TOKEN@*/ /*@START_MENU_TOKEN@*/Text("Button")/*@END_MENU_TOKEN@*/
}) })
.popover(isPresented: $isPopover, content: {
Text("aaaa")
})
} }
.padding() .padding()
} }
......
...@@ -23,6 +23,8 @@ class Preferences{ ...@@ -23,6 +23,8 @@ class Preferences{
} }
} }
@AppStorage("KEY") static var hogehoge: String = ""
// func getPreferences(key) // func getPreferences(key)
} }
......
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
import Foundation import Foundation
import CoreLocation import CoreLocation
class SharingData{ class SharingData: ObservableObject{
static let shared = SharingData()
class My{ class My{
static var location: CLLocationCoordinate2D? = nil static var location: CLLocationCoordinate2D? = nil
static var speedKnot: Double = 0.0 static var speedKnot: Double = 0.0
...@@ -24,7 +26,11 @@ class SharingData{ ...@@ -24,7 +26,11 @@ class SharingData{
/** /**
* Eca * Eca
*/ */
class Eca { @Published var ecaArea: Dictionary<String, RegisteredEca> = [:]
static var area: Dictionary<String, RegisteredEca> = [:]
func editEcaArea(key: String, value: RegisteredEca){
ecaArea.updateValue(value, forKey: key)
} }
} }
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