Commit e43c5064 authored by sugita mamoru's avatar sugita mamoru

Task関連実装

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