Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
react-native-amap3d
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
放牛的园子
react-native-amap3d
Commits
2b481e32
Commit
2b481e32
authored
Oct 21, 2018
by
放牛的园子
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成SmoothMoveMarker动画插件开发
parent
8d4247e8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
70 deletions
+28
-70
AMapSmoothMoveMarker.m
lib/ios/AMap3D/maps/AMapSmoothMoveMarker.m
+16
-50
AMapSmoothMoveMarkerManager.m
lib/ios/AMap3D/maps/AMapSmoothMoveMarkerManager.m
+1
-13
AMapView.h
lib/ios/AMap3D/maps/AMapView.h
+3
-1
AMapView.m
lib/ios/AMap3D/maps/AMapView.m
+4
-3
AMapViewManager.m
lib/ios/AMap3D/maps/AMapViewManager.m
+4
-3
No files found.
lib/ios/AMap3D/maps/AMapSmoothMoveMarker.m
View file @
2b481e32
#import <React/UIView+React.h>
#import "AMapSmoothMoveMarker.h"
#import "Coordinate.h"
#pragma ide diagnostic ignored "OCUnusedMethodInspection"
#pragma clang diagnostic ignored "-Woverriding-method-mismatch"
...
...
@@ -8,6 +9,7 @@
MAAnimatedAnnotation
*
_annotation
;
//贴图标注
MAAnnotationView
*
_annotationView
;
//标注视图
MACustomCalloutView
*
_calloutView
;
//气泡视图
NSMutableArray
<
Coordinate
*>
*
_coordinates
;
//
UIView
*
_customView
;
__weak
AMapView
*
_mapView
;
MAPinAnnotationColor
_pinColor
;
...
...
@@ -23,43 +25,17 @@
-
(
instancetype
)
init
{
_annotation
=
[
MAAnimatedAnnotation
new
];
_coordinates
=
[[
NSMutableArray
alloc
]
init
];
_enabled
=
YES
;
_canShowCallout
=
YES
;
self
=
[
super
init
];
return
self
;
}
-
(
NSString
*
)
title
{
return
_annotation
.
title
;
}
-
(
NSString
*
)
subtitle
{
return
_annotation
.
subtitle
;
}
-
(
void
)
setTitle
:
(
NSString
*
)
title
{
_annotation
.
title
=
title
;
}
-
(
void
)
setDuration
:
(
NSInteger
)
duration
{
_duration
=
duration
;
}
-
(
void
)
setColor
:
(
MAPinAnnotationColor
)
color
{
_pinColor
=
color
;
((
MAPinAnnotationView
*
)
_annotationView
).
pinColor
=
color
;
}
-
(
void
)
setDraggable
:
(
BOOL
)
draggable
{
_draggable
=
draggable
;
_annotationView
.
draggable
=
draggable
;
}
-
(
void
)
setCenterOffset
:
(
CGPoint
)
centerOffset
{
_centerOffset
=
centerOffset
;
_annotationView
.
centerOffset
=
centerOffset
;
}
-
(
void
)
setImage
:
(
NSString
*
)
name
{
_image
=
[
UIImage
imageNamed
:
name
];
if
(
_image
!=
nil
)
{
...
...
@@ -67,17 +43,18 @@
}
}
-
(
void
)
setDescription
:
(
NSString
*
)
description
{
_annotation
.
subtitle
=
description
;
}
-
(
void
)
setCoordinates
:
(
NSArray
<
Coordinate
*>
*
)
coordinates
{
[
_coordinates
removeAllObjects
];
[
_coordinates
addObjectsFromArray
:
coordinates
];
CLLocationCoordinate2D
coords
[
coordinates
.
count
];
for
(
NSUInteger
i
=
0
;
i
<
coordinates
.
count
;
i
++
)
{
coords
[
i
]
=
coordinates
[
i
].
coordinate
;
}
[
_annotation
addMoveAnimationWithKeyCoordinates
coordinates
:
coords
count
:
coordinates
.
count
withDuration
:
_duration
withName
:
nil
completeCallback
:^
(
BOOL
isFinished
)
{
}];
_annotation
.
coordinate
=
coords
[
0
];
_annotation
.
title
=
@"I can fly!"
;
if
(
_annotationView
!=
nil
)
{
[
_annotation
addMoveAnimationWithKeyCoordinates
:
coords
count
:
coordinates
.
count
withDuration
:
_duration
withName
:
nil
completeCallback
:^
(
BOOL
isFinished
)
{
}];
}
}
-
(
void
)
setActive
:
(
BOOL
)
active
{
...
...
@@ -91,21 +68,6 @@
});
}
-
(
void
)
setInfoWindowDisabled
:
(
BOOL
)
disabled
{
_canShowCallout
=
!
disabled
;
_annotationView
.
canShowCallout
=
!
disabled
;
}
-
(
void
)
setClickDisabled
:
(
BOOL
)
disabled
{
_enabled
=
!
disabled
;
_annotationView
.
enabled
=
!
disabled
;
}
-
(
void
)
setZIndex
:
(
NSInteger
)
zIndex
{
_zIndex
=
zIndex
;
_annotationView
.
zIndex
=
zIndex
;
}
-
(
MAAnimatedAnnotation
*
)
annotation
{
return
_annotation
;
}
...
...
@@ -145,8 +107,12 @@
if
(
_image
!=
nil
)
{
_annotationView
.
image
=
_image
;
}
[
self
setActive
:
_active
];
CLLocationCoordinate2D
coords
[
_coordinates
.
count
];
for
(
NSUInteger
i
=
0
;
i
<
_coordinates
.
count
;
i
++
)
{
coords
[
i
]
=
_coordinates
[
i
].
coordinate
;
}
[
_annotation
addMoveAnimationWithKeyCoordinates
:
coords
count
:
_coordinates
.
count
withDuration
:
_duration
withName
:
nil
completeCallback
:^
(
BOOL
isFinished
)
{
}];
[
self
setActive
:
_active
];
}
return
_annotationView
;
}
...
...
lib/ios/AMap3D/maps/AMapSmoothMoveMarkerManager.m
View file @
2b481e32
...
...
@@ -17,22 +17,10 @@ RCT_EXPORT_MODULE()
RCT_EXPORT_VIEW_PROPERTY
(
coordinates
,
CoordinateArray
)
RCT_EXPORT_VIEW_PROPERTY
(
duration
,
NSInteger
)
RCT_EXPORT_VIEW_PROPERTY
(
centerOffset
,
CGPoint
)
RCT_EXPORT_VIEW_PROPERTY
(
title
,
NSString
)
RCT_EXPORT_VIEW_PROPERTY
(
description
,
NSString
)
RCT_EXPORT_VIEW_PROPERTY
(
active
,
BOOL
)
RCT_EXPORT_VIEW_PROPERTY
(
draggable
,
BOOL
)
RCT_EXPORT_VIEW_PROPERTY
(
clickDisabled
,
BOOL
)
RCT_EXPORT_VIEW_PROPERTY
(
infoWindowDisabled
,
BOOL
)
RCT_EXPORT_VIEW_PROPERTY
(
zIndex
,
NSInteger
)
RCT_EXPORT_VIEW_PROPERTY
(
color
,
MAPinAnnotationColor
)
RCT_EXPORT_VIEW_PROPERTY
(
image
,
NSString
)
RCT_EXPORT_VIEW_PROPERTY
(
onPress
,
RCTBubblingEventBlock
)
RCT_EXPORT_VIEW_PROPERTY
(
onInfoWindowPress
,
RCTBubblingEventBlock
)
RCT_EXPORT_VIEW_PROPERTY
(
onDragStart
,
RCTBubblingEventBlock
)
RCT_EXPORT_VIEW_PROPERTY
(
onDrag
,
RCTBubblingEventBlock
)
RCT_EXPORT_VIEW_PROPERTY
(
onDragEnd
,
RCTBubblingEventBlock
)
RCT_EXPORT_METHOD
(
lockToScreen
:
(
nonnull
NSNumber
*
)
reactTag
x
:
(
int
)
x
y
:
(
int
)
y
)
{
[
self
.
bridge
.
uiManager
addUIBlock
:
^
(
__unused
RCTUIManager
*
uiManager
,
NSDictionary
<
NSNumber
*
,
UIView
*>
*
viewRegistry
)
{
...
...
lib/ios/AMap3D/maps/AMapView.h
View file @
2b481e32
#import <MAMapKit/MAMapKit.h>
@class
AMapMarker
;
@class
AMapSmoothMoveMarker
;
@interface
AMapView
:
MAMapView
...
...
@@ -14,5 +15,5 @@
@property
(
nonatomic
)
MACoordinateRegion
initialRegion
;
-
(
AMapMarker
*
)
getMarker
:(
id
<
MAAnnotation
>
)
annotation
;
-
(
AMapSmoothMoveMarker
*
)
getSmoothMarker
:(
id
<
MAAnnotation
>
)
annotation
;
@end
\ No newline at end of file
lib/ios/AMap3D/maps/AMapView.m
View file @
2b481e32
#import <React/UIView+React.h>
#import "AMapView.h"
#import "AMapMarker.h"
#import "AMapSmoothMoveMarker.h"
#import "AMapPolyline.h"
#import "LocationStyle.h"
...
...
@@ -78,8 +79,8 @@
}
if
([
subview
isKindOfClass
:[
AMapSmoothMoveMarker
class
]]){
AMapSmoothMoveMarker
*
smoothmarker
=
(
AMapSmoothMoveMarker
*
)
subview
;
marker
.
mapView
=
self
;
_smoothmarker
[[
@
(
smoothmarker
.
annotation
.
hash
)
stringValue
]]
=
smoothmarker
;
smooth
marker
.
mapView
=
self
;
_smoothmarker
s
[[
@
(
smoothmarker
.
annotation
.
hash
)
stringValue
]]
=
smoothmarker
;
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[
self
addAnnotation
:
smoothmarker
.
annotation
];
});
...
...
@@ -108,7 +109,7 @@
return
_markers
[[
@
(
annotation
.
hash
)
stringValue
]];
}
-
(
AMapSmoothMoveMarker
*
)
getSmoothMarker
:
(
id
<
MAAn
imatedAn
notation
>
)
annotation
{
-
(
AMapSmoothMoveMarker
*
)
getSmoothMarker
:
(
id
<
MAAnnotation
>
)
annotation
{
return
_smoothmarkers
[[
@
(
annotation
.
hash
)
stringValue
]];
}
...
...
lib/ios/AMap3D/maps/AMapViewManager.m
View file @
2b481e32
...
...
@@ -106,12 +106,13 @@ RCT_EXPORT_METHOD(animateTo:(nonnull NSNumber *)reactTag params:(NSDictionary *)
}
-
(
MAAnnotationView
*
)
mapView
:
(
AMapView
*
)
mapView
viewForAnnotation
:
(
id
<
MAAnnotation
>
)
annotation
{
if
([
annotation
isKindOfClass
:[
MAAnimatedAnnotation
class
]])
{
AMapSmoothMoveMarker
*
marker
=
[
mapView
getSmoothMarker
:
annotation
];
return
marker
.
annotationView
;
}
if
([
annotation
isKindOfClass
:[
MAPointAnnotation
class
]])
{
AMapMarker
*
marker
=
[
mapView
getMarker
:
annotation
];
return
marker
.
annotationView
;
}
else
if
([
annotation
isKindOfClass
:[
MAAnimatedAnnotation
class
]])
{
AMapSmoothMoveMarker
*
marker
=
[
mapView
getSmoothMarker
:
annotation
];
return
marker
.
annotationView
;
}
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