Commit f37540a2 authored by shigemi miura's avatar shigemi miura

iPad対応

parent b4e5721a
...@@ -169,7 +169,6 @@ class MapViewController : UIViewController { ...@@ -169,7 +169,6 @@ class MapViewController : UIViewController {
@objc func handleMapDrug(sender: UIPanGestureRecognizer) { @objc func handleMapDrug(sender: UIPanGestureRecognizer) {
let spot = sender.location(in: mapView) let spot = sender.location(in: mapView)
let coordinate = mapView.mapboxMap.coordinate(for: spot) let coordinate = mapView.mapboxMap.coordinate(for: spot)
print(debug: "test: handleMapDrug \(coordinate)")
mapDrug(point: spot, coordinate: coordinate) mapDrug(point: spot, coordinate: coordinate)
if SharingData.nga.editType == EditNgaType.movePoint { if SharingData.nga.editType == EditNgaType.movePoint {
...@@ -413,6 +412,7 @@ class MapViewController : UIViewController { ...@@ -413,6 +412,7 @@ class MapViewController : UIViewController {
var editTargetSymbolLayer = SymbolLayer(id: editTargetSymbol.layerId) var editTargetSymbolLayer = SymbolLayer(id: editTargetSymbol.layerId)
editTargetSymbolLayer.source = editTargetSymbol.sourceId editTargetSymbolLayer.source = editTargetSymbol.sourceId
editTargetSymbolLayer.iconSize = .expression(Exp(.get) {PropertyKey.Size.rawValue})
editTargetSymbolLayer.iconImage = .expression(Exp(.get) {PropertyKey.IconImage.rawValue}) editTargetSymbolLayer.iconImage = .expression(Exp(.get) {PropertyKey.IconImage.rawValue})
editTargetSymbolLayer.iconColor = .expression(Exp(.get) {PropertyKey.Color.rawValue}) editTargetSymbolLayer.iconColor = .expression(Exp(.get) {PropertyKey.Color.rawValue})
try? mapView.mapboxMap.style.addLayer(editTargetSymbolLayer) try? mapView.mapboxMap.style.addLayer(editTargetSymbolLayer)
...@@ -701,7 +701,8 @@ class MapViewController : UIViewController { ...@@ -701,7 +701,8 @@ class MapViewController : UIViewController {
if remove == false { if remove == false {
var feature = Feature(geometry: Point(point)) var feature = Feature(geometry: Point(point))
feature.properties = [PropertyKey.IconImage.rawValue: .string(IconImage.Target.rawValue), feature.properties = [PropertyKey.IconImage.rawValue: .string(IconImage.Target.rawValue),
PropertyKey.Color.rawValue: .string("#EF6135")] PropertyKey.Color.rawValue: .string("#EF6135"),
PropertyKey.Size.rawValue: 1.0]
features.append(feature) features.append(feature)
} }
...@@ -819,9 +820,9 @@ class MapViewController : UIViewController { ...@@ -819,9 +820,9 @@ class MapViewController : UIViewController {
PropertyKey.Color.rawValue: .string("#EF6135")] PropertyKey.Color.rawValue: .string("#EF6135")]
features.append(feature) features.append(feature)
id += 1 id += 1
print(debug: "Test: point \(id)")
} }
} }
try self.mapView.mapboxMap.style.updateGeoJSONSource(withId: editAreaSymbol.sourceId, geoJSON: .featureCollection(FeatureCollection(features: features))) try self.mapView.mapboxMap.style.updateGeoJSONSource(withId: editAreaSymbol.sourceId, geoJSON: .featureCollection(FeatureCollection(features: features)))
} catch { } catch {
print(debug: "called") print(debug: "called")
...@@ -901,8 +902,8 @@ class MapViewController : UIViewController { ...@@ -901,8 +902,8 @@ class MapViewController : UIViewController {
* NGA 更新処理 * NGA 更新処理
*/ */
func updateAlertArea() { func updateAlertArea() {
updateAlertAreaLine(area: SharingData.nga.ngaArea) updateAlertAreaLine(area: SharingData.nga.ngaArea, edit: SharingData.nga.editNga, type: SharingData.nga.editType)
updateAlertAreaFill(area: SharingData.nga.ngaArea) updateAlertAreaFill(area: SharingData.nga.ngaArea, edit: SharingData.nga.editNga, type: SharingData.nga.editType)
} }
/** /**
...@@ -931,11 +932,19 @@ class MapViewController : UIViewController { ...@@ -931,11 +932,19 @@ class MapViewController : UIViewController {
/** /**
* NGAライン更新処理 * NGAライン更新処理
*/ */
private func updateAlertAreaLine(area: Dictionary<UUID, RegisteredNga>) { private func updateAlertAreaLine(area: Dictionary<UUID, RegisteredNga>,
edit: RegisteredNga?,
type: EditNgaType) {
do{ do{
var features : [Feature] = [] var features : [Feature] = []
for (_, value) in area { for (_, value) in area {
if value.isRunning == true { var isEdit = true
if let editId = edit?.areaId {
if value.areaId == editId && type != EditNgaType.nonEdit {
isEdit = false
}
}
if value.isRunning == true && isEdit == true {
if value.points.count >= 3 { if value.points.count >= 3 {
var areaPoints = value.points var areaPoints = value.points
let firstPoint = value.points[0] let firstPoint = value.points[0]
...@@ -962,11 +971,19 @@ class MapViewController : UIViewController { ...@@ -962,11 +971,19 @@ class MapViewController : UIViewController {
/** /**
* NGA エリア更新処理 * NGA エリア更新処理
*/ */
private func updateAlertAreaFill(area: Dictionary<UUID, RegisteredNga>) { private func updateAlertAreaFill(area: Dictionary<UUID, RegisteredNga>,
edit: RegisteredNga?,
type: EditNgaType) {
do{ do{
var features : [Feature] = [] var features : [Feature] = []
for (_, value) in area { for (_, value) in area {
if value.points.count >= 3 { var isEdit = true
if let editId = edit?.areaId {
if value.areaId == editId && type != EditNgaType.nonEdit {
isEdit = false
}
}
if value.points.count >= 3 && isEdit == true {
var cnvPoints: Array<Array<CLLocationCoordinate2D>> = [] var cnvPoints: Array<Array<CLLocationCoordinate2D>> = []
var areaPoints = value.points var areaPoints = value.points
...@@ -1106,7 +1123,6 @@ class MapViewController : UIViewController { ...@@ -1106,7 +1123,6 @@ class MapViewController : UIViewController {
*/ */
private func clickSymbolLayer(tatchPoint: CGPoint, coordinate: CLLocationCoordinate2D) { private func clickSymbolLayer(tatchPoint: CGPoint, coordinate: CLLocationCoordinate2D) {
if let targetFeature = self.touchedFeatures { if let targetFeature = self.touchedFeatures {
print(debug: "Test: clickSymbolLayer \(coordinate)")
guard let type = targetFeature.properties?[PropertyKey.Dtype.rawValue] else {return} guard let type = targetFeature.properties?[PropertyKey.Dtype.rawValue] else {return}
switch type! { switch type! {
...@@ -1128,7 +1144,6 @@ class MapViewController : UIViewController { ...@@ -1128,7 +1144,6 @@ class MapViewController : UIViewController {
updateEditTargetSymbol(point: coordinate) updateEditTargetSymbol(point: coordinate)
} }
case Turf.JSONValue.string(DataType.add.rawValue): case Turf.JSONValue.string(DataType.add.rawValue):
print(debug: "Test: clickSymbolLayer(add) \(coordinate)")
guard let jsonData = targetFeature.properties?[PropertyKey.Id.rawValue] else {return} guard let jsonData = targetFeature.properties?[PropertyKey.Id.rawValue] else {return}
guard let Id = jsonData?.rawValue else {return} guard let Id = jsonData?.rawValue else {return}
...@@ -1198,7 +1213,6 @@ class MapViewController : UIViewController { ...@@ -1198,7 +1213,6 @@ class MapViewController : UIViewController {
private func longClickSymbolLayer(tatchPoint: CGPoint, coordinate: CLLocationCoordinate2D) { private func longClickSymbolLayer(tatchPoint: CGPoint, coordinate: CLLocationCoordinate2D) {
if SharingData.nga.editType == EditNgaType.addPoint { if SharingData.nga.editType == EditNgaType.addPoint {
if let targetFeature = self.touchedFeatures { if let targetFeature = self.touchedFeatures {
print(debug: "Test: longClickSymbolLayer \(coordinate)")
guard let type = targetFeature.properties?[PropertyKey.Dtype.rawValue] else {return} guard let type = targetFeature.properties?[PropertyKey.Dtype.rawValue] else {return}
if type! == Turf.JSONValue.string(DataType.point.rawValue) { if type! == Turf.JSONValue.string(DataType.point.rawValue) {
...@@ -1228,7 +1242,6 @@ class MapViewController : UIViewController { ...@@ -1228,7 +1242,6 @@ class MapViewController : UIViewController {
self.touchedFeatures = nil self.touchedFeatures = nil
var features : [Feature] = [] var features : [Feature] = []
let option = RenderedQueryOptions(layerIds: layers, filter: nil) let option = RenderedQueryOptions(layerIds: layers, filter: nil)
print(debug: "Test: (Drug) \(coordinate)")
mapView.mapboxMap.queryRenderedFeatures(with: point, options: option) { [self] result in mapView.mapboxMap.queryRenderedFeatures(with: point, options: option) { [self] result in
switch result { switch result {
......
...@@ -18,7 +18,7 @@ enum TaskViewMode { ...@@ -18,7 +18,7 @@ enum TaskViewMode {
var title: String { var title: String {
switch self { switch self {
case .MenuList: case .MenuList:
"Menu Functions" "Map Functions"
case .FuelSwitching: case .FuelSwitching:
"Fuel Switching" "Fuel Switching"
case .EcaList: case .EcaList:
...@@ -66,7 +66,32 @@ struct MenuTaskView: View { ...@@ -66,7 +66,32 @@ struct MenuTaskView: View {
let appVersionModel = AppVersionModel() let appVersionModel = AppVersionModel()
appVersionModel.start() appVersionModel.start()
nga.editType = EditNgaType.registered if UIDevice.current.userInterfaceIdiom == .phone {
nga.editType = EditNgaType.registered
} else if UIDevice.current.userInterfaceIdiom == .pad {
switch nga.editType {
case EditNgaType.nonEdit:
print(debug: "Test: nonEdit")
nga.editType = EditNgaType.registered
break
case EditNgaType.registered:
print(debug: "Test: registered")
taskViewModel.viewMode = .NgaNotification
break
case EditNgaType.addPoint:
print(debug: "Test: addPoint")
taskViewModel.viewMode = .NgaSetting
break
case EditNgaType.movePoint:
print(debug: "Test: movePoint")
taskViewModel.viewMode = .NgaSetting
break
case EditNgaType.deletePoint:
print(debug: "Test: deletePoint")
taskViewModel.viewMode = .NgaSetting
break
}
}
} }
.alert("", isPresented: $eca.isShowEcaAlert) { .alert("", isPresented: $eca.isShowEcaAlert) {
// if let ecaArea = eca.ecaArea.map({ $0.1 }).filter({ $0.isRunning }).first{ // if let ecaArea = eca.ecaArea.map({ $0.1 }).filter({ $0.isRunning }).first{
......
...@@ -10,7 +10,7 @@ import SwiftUI ...@@ -10,7 +10,7 @@ import SwiftUI
struct MenuTitleView: View { struct MenuTitleView: View {
@Binding var path : [MenuPath] @Binding var path : [MenuPath]
var title = "Menu Functions" var title = "Map Functions"
var body: some View { var body: some View {
VStack { VStack {
HStack{ HStack{
......
...@@ -20,7 +20,6 @@ class GetNgaList { ...@@ -20,7 +20,6 @@ class GetNgaList {
private func responseGetNgaList(result: Result<Data, APIError>) { private func responseGetNgaList(result: Result<Data, APIError>) {
print(debug: "called") print(debug: "called")
print(debug: "Test: GetNgaList")
switch result { switch result {
case .success(let resultData): case .success(let resultData):
let serverSession = ServerSession() let serverSession = ServerSession()
...@@ -30,7 +29,6 @@ class GetNgaList { ...@@ -30,7 +29,6 @@ class GetNgaList {
for ngaList in res { for ngaList in res {
if let id = NSUUID(uuidString: ngaList.id) { if let id = NSUUID(uuidString: ngaList.id) {
if var nga = ngaAreas[id as UUID] { if var nga = ngaAreas[id as UUID] {
print(debug: "Test: 1\(nga)")
nga.name = ngaList.name nga.name = ngaList.name
nga.isLock = ngaList.lock nga.isLock = ngaList.lock
nga.points.removeAll() nga.points.removeAll()
...@@ -39,7 +37,6 @@ class GetNgaList { ...@@ -39,7 +37,6 @@ class GetNgaList {
nga.points.append(point) nga.points.append(point)
} }
ngaAreas.updateValue(nga, forKey: nga.areaId) ngaAreas.updateValue(nga, forKey: nga.areaId)
print(debug: "Test: 2\(nga)")
} else { } else {
if var nga = RegisteredNga(areaName: "test dammy") { //TODO: 名称はダミー if var nga = RegisteredNga(areaName: "test dammy") { //TODO: 名称はダミー
nga.areaId = id as UUID nga.areaId = id as UUID
......
...@@ -41,8 +41,6 @@ class NgaTask { ...@@ -41,8 +41,6 @@ class NgaTask {
if isInside { if isInside {
//通過中 //通過中
area.passingCnt += 1 area.passingCnt += 1
let test = area.passingCnt
print(debug: "Test: \(test)")
ngaData.editNgaArea(value: area, type: NgaOperation.Passing) ngaData.editNgaArea(value: area, type: NgaOperation.Passing)
if area.passingCnt == 1 { if area.passingCnt == 1 {
let areaName = nga.value.name let areaName = nga.value.name
......
...@@ -178,7 +178,6 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M ...@@ -178,7 +178,6 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
} }
private func handleChatMessage(message: ResChatMessage) { private func handleChatMessage(message: ResChatMessage) {
print(debug: "test:called")
let ownMsg = ChatMessage(shipId: message.shipId, messageId: message.messageId, type: message.type, time: message.time, location: message.location, from: message.from, message: message.message, stampId: message.stampId, viewer: []) let ownMsg = ChatMessage(shipId: message.shipId, messageId: message.messageId, type: message.type, time: message.time, location: message.location, from: message.from, message: message.message, stampId: message.stampId, viewer: [])
self.msg.messages.append(ownMsg) self.msg.messages.append(ownMsg)
...@@ -187,7 +186,6 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M ...@@ -187,7 +186,6 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
} }
private func handleAckMessage(message: ResAckMessage) { private func handleAckMessage(message: ResAckMessage) {
print(debug: "test:called")
let msgIndex = self.msg.messages.firstIndex(where: {$0.messageId == message.messageId}) let msgIndex = self.msg.messages.firstIndex(where: {$0.messageId == message.messageId})
if let index = msgIndex { if let index = msgIndex {
let viewer = Viewer(time: message.time, location: message.location, id: message.fromId) let viewer = Viewer(time: message.time, location: message.location, id: message.fromId)
...@@ -199,7 +197,6 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M ...@@ -199,7 +197,6 @@ class AppDelegate: NSObject, UIApplicationDelegate ,MSNotificationHubDelegate, M
} }
private func handleChatMode(message: ResChatMode) { private func handleChatMode(message: ResChatMode) {
print(debug: "test:called")
if message.mode == 1 { if message.mode == 1 {
self.msg.mode = true self.msg.mode = true
} else { } else {
...@@ -219,7 +216,6 @@ class SignalR: NSObject { ...@@ -219,7 +216,6 @@ class SignalR: NSObject {
@ObservedObject var msg = SharingData.message @ObservedObject var msg = SharingData.message
func chatMessage(message: String) { func chatMessage(message: String) {
print(debug: "test:called")
var request = ReqMessage(shipId: Preferences.shipId, messageId: UUID().uuidString.lowercased()) var request = ReqMessage(shipId: Preferences.shipId, messageId: UUID().uuidString.lowercased())
request.type = 0 //0:テキスト, 1:スタンプ request.type = 0 //0:テキスト, 1:スタンプ
request.time = DateTextLib.Date2ISO8601Text(Date()) request.time = DateTextLib.Date2ISO8601Text(Date())
...@@ -241,7 +237,6 @@ class SignalR: NSObject { ...@@ -241,7 +237,6 @@ class SignalR: NSObject {
} }
func ackMessage(messageId: String) { func ackMessage(messageId: String) {
print(debug: "test:called")
var request = ReqAckMessage(shipId: Preferences.shipId, messageId: messageId) var request = ReqAckMessage(shipId: Preferences.shipId, messageId: messageId)
request.time = DateTextLib.Date2ISO8601Text(Date()) request.time = DateTextLib.Date2ISO8601Text(Date())
request.location = 2 //1:Shore , 2:Ship request.location = 2 //1:Shore , 2:Ship
......
...@@ -72,9 +72,12 @@ struct MainTabView: View { ...@@ -72,9 +72,12 @@ struct MainTabView: View {
ChatView() ChatView()
.tag(Tab.chat) .tag(Tab.chat)
MapRepresentable() ZStack {
.ignoresSafeArea() MapRepresentable()
.tag(Tab.task) MapInformation()
}
.ignoresSafeArea()
.tag(Tab.task)
NotificationView() NotificationView()
.tag(Tab.alert) .tag(Tab.alert)
...@@ -85,9 +88,9 @@ struct MainTabView: View { ...@@ -85,9 +88,9 @@ struct MainTabView: View {
.hideNativeTabBar() .hideNativeTabBar()
.popover(isPresented: .constant(isPopover && SharingData.my.isFuelSwitchTask), attachmentAnchor: .point(.bottom)) { .popover(isPresented: .constant(isPopover && SharingData.my.isFuelSwitchTask), attachmentAnchor: .point(.bottom)) {
MenuTaskView() MenuTaskView()
.presentationCompactAdaptation(.none) .presentationCompactAdaptation(.popover)
.zIndex(0) .zIndex(0)
.frame(minWidth: 300, maxHeight: 500) .frame(minWidth: 500, maxHeight: 500)
.aspectRatio(contentMode: .fit) .aspectRatio(contentMode: .fit)
.presentationCornerRadius(15) .presentationCornerRadius(15)
.presentationBackgroundInteraction(.enabled(upThrough: .medium)) .presentationBackgroundInteraction(.enabled(upThrough: .medium))
......
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