Commit f37540a2 authored by shigemi miura's avatar shigemi miura

iPad対応

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