Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
Z
ZhiJi-Overseas
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lmj
ZhiJi-Overseas
Commits
3312d301
Commit
3312d301
authored
Jul 28, 2020
by
lmj_521aiau@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mamap->mkmap
parent
37e55d02
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
68 deletions
+84
-68
project.pbxproj
ZhiJi.xcodeproj/project.pbxproj
+12
-0
ZJBaseMapViewController.m
ZhiJi/Classes/Map/Controller/ZJBaseMapViewController.m
+11
-8
ZJFriendTrackMapViewController.m
...i/Classes/Map/Controller/ZJFriendTrackMapViewController.m
+61
-60
No files found.
ZhiJi.xcodeproj/project.pbxproj
View file @
3312d301
...
...
@@ -157,6 +157,7 @@
A9764A522490EAC600463B78
/* CoreGraphics.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A9764A512490EAC600463B78
/* CoreGraphics.framework */
;
};
A9764A5C2492380D00463B78
/* ZJImagePickerManager.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A9764A5B2492380D00463B78
/* ZJImagePickerManager.m */
;
};
A9C2B61F24CEC0DC00010EAE
/* ZJCustomAnnotation.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A9C2B61E24CEC0DC00010EAE
/* ZJCustomAnnotation.m */
;
};
A9C2B62224CFF5F900010EAE
/* MAMapKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A9C2B62124CFF5F900010EAE
/* MAMapKit.framework */
;
};
A9F91E28249CCA4B006157BF
/* ZJUpgradeAlertView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A9F91E27249CCA4B006157BF
/* ZJUpgradeAlertView.m */
;
};
A9F91E3E249DFC53006157BF
/* BaseWebViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A9F91E3D249DFC53006157BF
/* BaseWebViewController.m */
;
};
D5167D5B2490C87400A79CB6
/* ZJSheZhiView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
D5167D592490C87400A79CB6
/* ZJSheZhiView.m */
;
};
...
...
@@ -468,6 +469,7 @@
A9850D6E2490B9F500810B7D
/* PrefixHeader.pch */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
PrefixHeader.pch
;
path
=
ZhiJi/Classes/Tools/PCH/PrefixHeader.pch
;
sourceTree
=
SOURCE_ROOT
;
};
A9C2B61D24CEC0DC00010EAE
/* ZJCustomAnnotation.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ZJCustomAnnotation.h
;
sourceTree
=
"<group>"
;
};
A9C2B61E24CEC0DC00010EAE
/* ZJCustomAnnotation.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ZJCustomAnnotation.m
;
sourceTree
=
"<group>"
;
};
A9C2B62124CFF5F900010EAE
/* MAMapKit.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
path
=
MAMapKit.framework
;
sourceTree
=
"<group>"
;
};
A9F91E26249CCA4B006157BF
/* ZJUpgradeAlertView.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ZJUpgradeAlertView.h
;
sourceTree
=
"<group>"
;
};
A9F91E27249CCA4B006157BF
/* ZJUpgradeAlertView.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ZJUpgradeAlertView.m
;
sourceTree
=
"<group>"
;
};
A9F91E3C249DFC53006157BF
/* BaseWebViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BaseWebViewController.h
;
sourceTree
=
"<group>"
;
};
...
...
@@ -510,6 +512,7 @@
A96696D924AF518400CF6992
/* libc++.tbd in Frameworks */
,
A96696D724AF517300CF6992
/* libz.tbd in Frameworks */
,
A95BD5B924AE0DEE00962B06
/* libsqlite3.0.tbd in Frameworks */
,
A9C2B62224CFF5F900010EAE
/* MAMapKit.framework in Frameworks */
,
A9764A522490EAC600463B78
/* CoreGraphics.framework in Frameworks */
,
A95F5CC0248F6D25001DB97E
/* libc++.1.tbd in Frameworks */
,
A95F5CBE248F2506001DB97E
/* CoreTelephony.framework in Frameworks */
,
...
...
@@ -826,6 +829,7 @@
A95F5BBC248DDE80001DB97E
/* Tools */
=
{
isa
=
PBXGroup
;
children
=
(
A9C2B62024CFF5F900010EAE
/* MAMAP */
,
A95BD57524AC500A00962B06
/* Vendor */
,
A9619E8D24AB0E90009A2012
/* ZJLoginManager */
,
A9619E8C24AB082D009A2012
/* ShareManager */
,
...
...
@@ -1235,6 +1239,14 @@
path
=
ImagePicker
;
sourceTree
=
"<group>"
;
};
A9C2B62024CFF5F900010EAE
/* MAMAP */
=
{
isa
=
PBXGroup
;
children
=
(
A9C2B62124CFF5F900010EAE
/* MAMapKit.framework */
,
);
path
=
MAMAP
;
sourceTree
=
"<group>"
;
};
D5271EB0248F8D3500F8B107
/* LocationVC */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
ZhiJi/Classes/Map/Controller/ZJBaseMapViewController.m
View file @
3312d301
...
...
@@ -8,6 +8,7 @@
#import "ZJBaseMapViewController.h"
#import <MapKit/MapKit.h>
#import "ZJCustomAnnotation.h"
@interface
ZJBaseMapViewController
()
<
XMPopupListViewDelegate
,
MKMapViewDelegate
>
...
...
@@ -196,10 +197,12 @@
double
lat
=
[
response
[
@"result"
][
@"data"
][
@"lat"
]
doubleValue
];
double
lon
=
[
response
[
@"result"
][
@"data"
][
@"lon"
]
doubleValue
];
MAPointAnnotation
*
pointAnnotation
=
[[
MAPointAnnotation
alloc
]
init
];
ZJCustomAnnotation
*
pointAnnotation
=
[[
ZJCustomAnnotation
alloc
]
init
];
pointAnnotation
.
coordinate
=
CLLocationCoordinate2DMake
(
lat
,
lon
);
pointAnnotation
.
title
=
@"latestLocation"
;
[
_self
.
mapView
addAnnotation
:
(
id
<
MKAnnotation
>
)
pointAnnotation
];
[
_self
.
mapView
addAnnotation
:
pointAnnotation
];
[
_self
.
mapView
setCenterCoordinate
:
pointAnnotation
.
coordinate
animated
:
false
];
}
else
{
...
...
@@ -213,13 +216,13 @@
}
#pragma mark - Map Delegate
-
(
MAAnnotationView
*
)
mapView
:
(
MAMapView
*
)
mapView
viewForAnnotation
:
(
id
<
MAAnnotation
>
)
annotation
{
-
(
nullable
MKAnnotationView
*
)
mapView
:
(
MKMapView
*
)
mapView
viewForAnnotation
:
(
id
<
MKAnnotation
>
)
annotation
{
if
([
annotation
isKindOfClass
:[
MAPoint
Annotation
class
]])
{
if
([
annotation
isKindOfClass
:[
ZJCustom
Annotation
class
]])
{
NSString
*
pointReuseIndetifier
=
@"pointReuseIndetifier3"
;
M
AAnnotationView
*
annotationView
=
(
MAAnnotationView
*
)
[
mapView
dequeueReusableAnnotationViewWithIdentifier
:
pointReuseIndetifier
];
M
KAnnotationView
*
annotationView
=
[
mapView
dequeueReusableAnnotationViewWithIdentifier
:
pointReuseIndetifier
];
if
(
annotationView
==
nil
)
{
annotationView
=
[[
M
A
AnnotationView
alloc
]
initWithAnnotation
:
annotation
reuseIdentifier
:
pointReuseIndetifier
];
annotationView
=
[[
M
K
AnnotationView
alloc
]
initWithAnnotation
:
annotation
reuseIdentifier
:
pointReuseIndetifier
];
annotationView
.
canShowCallout
=
YES
;
}
...
...
@@ -230,7 +233,7 @@
else
if
([
annotation
isKindOfClass
:[
MKUserLocation
class
]]){
NSString
*
pointReuseIndetifier
=
@"pointReuseIndetifier3"
;
MKAnnotationView
*
annotationView
=
(
MKAnnotationView
*
)
[
mapView
dequeueReusableAnnotationViewWithIdentifier
:
pointReuseIndetifier
];
MKAnnotationView
*
annotationView
=
[
mapView
dequeueReusableAnnotationViewWithIdentifier
:
pointReuseIndetifier
];
if
(
annotationView
==
nil
)
{
annotationView
=
[[
MKAnnotationView
alloc
]
initWithAnnotation
:(
id
<
MKAnnotation
>
)
annotation
reuseIdentifier
:
pointReuseIndetifier
];
annotationView
.
canShowCallout
=
YES
;
...
...
@@ -238,7 +241,7 @@
annotationView
.
image
=
[
UIImage
imageNamed
:
@"userPosition"
];
annotationView
.
enabled
=
NO
;
return
(
MAAnnotationView
*
)
annotationView
;
return
annotationView
;
}
return
nil
;
}
...
...
ZhiJi/Classes/Map/Controller/ZJFriendTrackMapViewController.m
View file @
3312d301
...
...
@@ -40,7 +40,7 @@
///全轨迹overlay
@property
(
strong
,
nonatomic
)
MKPolyline
*
commonPolyline
;
@property
(
nonatomic
,
strong
)
MAPoint
Annotation
*
startAnnotation
;
@property
(
nonatomic
,
strong
)
ZJCustom
Annotation
*
startAnnotation
;
@property
(
nonatomic
,
strong
)
MKAnnotationView
*
startAnnotationView
;
@property
(
nonatomic
,
strong
)
MKAnnotationView
*
endAnnotationView
;
...
...
@@ -79,11 +79,11 @@
[
dateComponents
setHour
:
-
5
];
self
.
stratDate
=
[
gregorian
dateByAddingComponents
:
dateComponents
toDate
:
[
NSDate
date
]
options
:
0
];
//
if (self.autoTrack) {
//
[self queryLocationList:_model];
//
} else {
//
[self getLastLocation:_model];
//
}
if
(
self
.
autoTrack
)
{
[
self
queryLocationList
:
_model
];
}
else
{
[
self
getLastLocation
:
_model
];
}
}
-
(
void
)
shareAction
{
...
...
@@ -189,27 +189,6 @@
_trackAnimation
=
YES
;
//动画行动点
endAnnotation
=
[[
ZJCustomAnnotation
alloc
]
init
];
[
_mapView
addAnnotation
:
endAnnotation
];
//动画 路径 数据处理
_smoothTrackCount
=
_locations
.
count
;
_smoothTrackPoints
=
malloc
(
sizeof
(
CLLocationCoordinate2D
)
*
_smoothTrackCount
);
velocity
=
malloc
(
sizeof
(
float
)
*
_smoothTrackCount
);
for
(
int
i
=
0
;
i
<
_smoothTrackCount
;
i
++
){
@autoreleasepool
{
ZJLocationModel
*
model
=
[
self
.
locations
objectAtIndex
:
i
];
CLLocationDegrees
latitude
=
model
.
latitude
;
CLLocationDegrees
longitude
=
model
.
longitude
;
CLLocationCoordinate2D
coordinate
=
CLLocationCoordinate2DMake
(
latitude
,
longitude
);
// velocity[i] = [dic[@"speed"] doubleValue];
velocity
[
i
]
=
0
.
1
;
_smoothTrackPoints
[
i
]
=
coordinate
;
}
}
//构造折线数据对象
CLLocationCoordinate2D
commonPolylineCoords
[
self
.
locations
.
count
];
...
...
@@ -220,14 +199,24 @@
//构造折线对象
MKPolyline
*
commonPolyline
=
[
MKPolyline
polylineWithCoordinates
:
commonPolylineCoords
count
:
self
.
locations
.
count
];
if
(
self
.
commonPolyline
.
boundingMapRect
.
origin
.
x
!=
commonPolyline
.
boundingMapRect
.
origin
.
x
||
self
.
commonPolyline
.
boundingMapRect
.
origin
.
y
!=
commonPolyline
.
boundingMapRect
.
origin
.
y
||
self
.
commonPolyline
.
boundingMapRect
.
size
.
width
!=
commonPolyline
.
boundingMapRect
.
size
.
width
||
self
.
commonPolyline
.
boundingMapRect
.
size
.
height
!=
commonPolyline
.
boundingMapRect
.
size
.
height
)
{
mapPaddle
=
YES
;
}
self
.
commonPolyline
=
commonPolyline
;
//在地图上添加折线对象
[
self
.
mapView
addOverlay
:
self
.
commonPolyline
];
//动画行动点
endAnnotation
=
[[
ZJCustomAnnotation
alloc
]
init
];
endAnnotation
.
title
=
@"end"
;
[
_mapView
addAnnotation
:
endAnnotation
];
MKMapRect
rect
=
MKMapRectMake
(
self
.
commonPolyline
.
boundingMapRect
.
origin
.
x
,
self
.
commonPolyline
.
boundingMapRect
.
origin
.
y
,
self
.
commonPolyline
.
boundingMapRect
.
size
.
width
,
self
.
commonPolyline
.
boundingMapRect
.
size
.
height
);
[
self
.
mapView
setVisibleMapRect
:
rect
edgePadding
:
UIEdgeInsetsMake
(
250
,
50
,
50
,
5
0
)
animated
:
true
];
[
self
.
mapView
setVisibleMapRect
:
rect
edgePadding
:
UIEdgeInsetsMake
(
40
,
40
,
40
,
4
0
)
animated
:
true
];
if
(
!
mapPaddle
)
{
[
self
addAnimation
];
}
...
...
@@ -237,7 +226,24 @@
-
(
void
)
addAnimation
{
_container
=
(
UIView
*
)[
self
.
mapView
.
subviews
firstObject
].
subviews
.
lastObject
;
//动画 路径 数据处理
_smoothTrackCount
=
_locations
.
count
;
_smoothTrackPoints
=
malloc
(
sizeof
(
CLLocationCoordinate2D
)
*
_smoothTrackCount
);
velocity
=
malloc
(
sizeof
(
float
)
*
_smoothTrackCount
);
for
(
int
i
=
0
;
i
<
_smoothTrackCount
;
i
++
){
@autoreleasepool
{
ZJLocationModel
*
model
=
[
self
.
locations
objectAtIndex
:
i
];
CLLocationDegrees
latitude
=
model
.
latitude
;
CLLocationDegrees
longitude
=
model
.
longitude
;
CLLocationCoordinate2D
coordinate
=
CLLocationCoordinate2DMake
(
latitude
,
longitude
);
// velocity[i] = [dic[@"speed"] doubleValue];
velocity
[
i
]
=
0
.
1
;
_smoothTrackPoints
[
i
]
=
coordinate
;
}
}
CGPoint
*
points
=
[
self
pointsForCoordinates
:
_smoothTrackPoints
count
:
_smoothTrackCount
];
CGPathRef
path
=
[
self
pathForPoints
:
points
count
:
_smoothTrackCount
];
...
...
@@ -281,7 +287,7 @@
[
self
.
gradientLayer
removeFromSuperlayer
];
[
self
.
shapeLayer
removeFromSuperlayer
];
_startAnnotation
=
[[
MAPoint
Annotation
alloc
]
init
];
_startAnnotation
=
[[
ZJCustom
Annotation
alloc
]
init
];
_startAnnotation
.
coordinate
=
CLLocationCoordinate2DMake
(
self
.
locations
.
firstObject
.
latitude
,
self
.
locations
.
firstObject
.
longitude
);
_startAnnotation
.
title
=
@"start"
;
[
self
.
mapView
addAnnotation
:(
id
<
MKAnnotation
>
)
_startAnnotation
];
...
...
@@ -298,36 +304,33 @@
-
(
MKAnnotationView
*
)
mapView
:
(
MKMapView
*
)
mapView
viewForAnnotation
:
(
id
<
MKAnnotation
>
)
annotation
{
if
([
annotation
isKindOfClass
:[
ZJCustomAnnotation
class
]])
{
static
NSString
*
key
=
@"startAnnotation"
;
MKAnnotationView
*
annotationView
=
[
mapView
dequeueReusableAnnotationViewWithIdentifier
:
key
];
if
(
!
annotationView
)
{
annotationView
=
[[
MKAnnotationView
alloc
]
initWithAnnotation
:
annotation
reuseIdentifier
:
key
];
annotationView
.
canShowCallout
=
true
;
//允许交互点击
annotationView
.
calloutOffset
=
CGPointMake
(
0
,
0
);
//定义详情视图偏移量
}
annotationView
.
annotation
=
annotation
;
return
annotationView
;
}
else
if
([
annotation
isKindOfClass
:[
MAPointAnnotation
class
]])
{
NSString
*
pointReuseIndetifier
=
@"pointReuseIndetifier2"
;
MKAnnotationView
*
annotationView
=
(
MKAnnotationView
*
)[
mapView
dequeueReusableAnnotationViewWithIdentifier
:
pointReuseIndetifier
];
if
(
annotationView
==
nil
)
{
annotationView
=
[[
MKAnnotationView
alloc
]
initWithAnnotation
:(
id
<
MKAnnotation
>
)
annotation
reuseIdentifier
:
pointReuseIndetifier
];
annotationView
.
canShowCallout
=
YES
;
}
ZJCustomAnnotation
*
ann
=
(
ZJCustomAnnotation
*
)
annotation
;
if
([
ann
.
title
isEqualToString
:
@"start"
])
{
NSString
*
pointReuseIndetifier
=
@"startAnnotation"
;
MKAnnotationView
*
annotationView
=
(
MKAnnotationView
*
)[
mapView
dequeueReusableAnnotationViewWithIdentifier
:
pointReuseIndetifier
];
if
(
annotationView
==
nil
)
{
annotationView
=
[[
MKAnnotationView
alloc
]
initWithAnnotation
:(
id
<
MKAnnotation
>
)
annotation
reuseIdentifier
:
pointReuseIndetifier
];
annotationView
.
canShowCallout
=
YES
;
}
if
([
annotation
.
title
isEqualToString
:
@"start"
])
{
annotationView
.
enabled
=
NO
;
annotationView
.
image
=
[
UIImage
imageNamed
:
kLocalizedString
(
@"map_track_start_icon"
)];
_startAnnotationView
=
(
MKAnnotationView
*
)
annotationView
;
}
else
if
([
annotation
.
title
isEqualToString
:
@"end"
])
{
annotationView
.
enabled
=
NO
;
annotationView
.
image
=
[
UIImage
imageNamed
:
kLocalizedString
(
@"map_track_end_icon"
)];
return
annotationView
;
}
else
{
static
NSString
*
key
=
@"endAnnotation"
;
MKAnnotationView
*
annotationView
=
[
mapView
dequeueReusableAnnotationViewWithIdentifier
:
key
];
if
(
!
annotationView
)
{
annotationView
=
[[
MKAnnotationView
alloc
]
initWithAnnotation
:
annotation
reuseIdentifier
:
key
];
annotationView
.
canShowCallout
=
true
;
//允许交互点击
annotationView
.
calloutOffset
=
CGPointMake
(
0
,
0
);
//定义详情视图偏移量
}
annotationView
.
annotation
=
annotation
;
return
annotationView
;
}
return
(
MKAnnotationView
*
)
annotationView
;
}
else
if
([
annotation
isKindOfClass
:[
MKUserLocation
class
]]){
}
else
if
([
annotation
isKindOfClass
:[
MKUserLocation
class
]]){
NSString
*
pointReuseIndetifier
=
@"pointReuseIndetifier1"
;
MKAnnotationView
*
annotationView
=
(
MKAnnotationView
*
)[
mapView
dequeueReusableAnnotationViewWithIdentifier
:
pointReuseIndetifier
];
...
...
@@ -338,7 +341,6 @@
annotationView
.
enabled
=
NO
;
annotationView
.
image
=
[
UIImage
imageNamed
:
@"userPosition"
];
// [mapView viewForAnnotation:mapView.userLocation]
return
annotationView
;
}
...
...
@@ -352,9 +354,8 @@
MKPolylineRenderer
*
render
=
[[
MKPolylineRenderer
alloc
]
initWithOverlay
:
overlay
];
render
.
lineWidth
=
4
.
f
;
render
.
strokeColor
=
[
UIColor
colorWithHex
:
0x568EFC
];
render
.
lineJoin
=
kMALineJoinRound
;
render
.
lineCap
=
kMALineCapRound
;
render
.
lineJoin
=
kCGLineJoinRound
;
render
.
lineCap
=
kCGLineJoinRound
;
return
render
;
}
return
nil
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment