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
1ce12718
Commit
1ce12718
authored
Aug 30, 2017
by
7c00
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实现 ios 热力图接口
parent
c0ba4855
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
0 deletions
+84
-0
HeatMap.js
components/maps/HeatMap.js
+3
-0
AMapHeatMap.h
ios/AMapHeatMap.h
+7
-0
AMapHeatMap.m
ios/AMapHeatMap.m
+43
-0
AMapHeatMapManager.m
ios/AMapHeatMapManager.m
+23
-0
RCTConvert+AMapView.m
ios/RCTConvert+AMapView.m
+8
-0
No files found.
components/maps/HeatMap.js
View file @
1ce12718
...
@@ -2,6 +2,9 @@ import React, {PropTypes, PureComponent} from 'react'
...
@@ -2,6 +2,9 @@ import React, {PropTypes, PureComponent} from 'react'
import
{
PixelRatio
,
Platform
,
requireNativeComponent
,
ViewPropTypes
}
from
'react-native'
import
{
PixelRatio
,
Platform
,
requireNativeComponent
,
ViewPropTypes
}
from
'react-native'
import
{
LatLng
}
from
'../PropTypes'
import
{
LatLng
}
from
'../PropTypes'
/**
* 注意,热力图组件的 props 设置过一次之后便不能再更改
*/
export
default
class
HeatMap
extends
PureComponent
{
export
default
class
HeatMap
extends
PureComponent
{
static
propTypes
=
{
static
propTypes
=
{
...
ViewPropTypes
,
...
ViewPropTypes
,
...
...
ios/AMapHeatMap.h
0 → 100644
View file @
1ce12718
#import <MAMapKit/MAMapKit.h>
#import "AMapModel.h"
#pragma ide diagnostic ignored "OCUnusedPropertyInspection"
@interface
AMapHeatMap
:
AMapModel
@end
ios/AMapHeatMap.m
0 → 100644
View file @
1ce12718
#import "AMapHeatMap.h"
#import "Coordinate.h"
#pragma ide diagnostic ignored "OCUnusedMethodInspection"
@implementation
AMapHeatMap
{
NSArray
<
MAHeatMapNode
*>
*
_data
;
MATileOverlayRenderer
*
_renderer
;
MAHeatMapTileOverlay
*
_heatMap
;
NSInteger
_radius
;
CGFloat
_opacity
;
}
-
(
void
)
setCoordinates
:
(
NSArray
<
MAHeatMapNode
*>
*
)
coordinates
{
_data
=
coordinates
;
}
-
(
void
)
setRadius
:
(
NSInteger
)
radius
{
_radius
=
radius
;
}
-
(
void
)
setOpacity
:
(
CGFloat
)
opacity
{
_opacity
=
opacity
;
}
-
(
MAOverlayRenderer
*
)
renderer
{
if
(
_renderer
==
nil
)
{
if
(
_opacity
==
0
)
{
_opacity
=
0
.
6
;
}
if
(
_radius
==
0
)
{
_radius
=
12
;
}
_heatMap
=
[
MAHeatMapTileOverlay
new
];
_heatMap
.
data
=
_data
;
_heatMap
.
opacity
=
_opacity
;
_heatMap
.
radius
=
_radius
;
_renderer
=
[[
MATileOverlayRenderer
alloc
]
initWithTileOverlay
:
_heatMap
];
}
return
_renderer
;
}
@end
ios/AMapHeatMapManager.m
0 → 100644
View file @
1ce12718
#import <MAMapKit/MAMapView.h>
#import <React/RCTViewManager.h>
#import "AMapHeatMap.h"
#pragma ide diagnostic ignored "OCUnusedClassInspection"
@interface
AMapHeatMapManager
:
RCTViewManager
@end
@implementation
AMapHeatMapManager
{
}
RCT_EXPORT_MODULE
()
-
(
UIView
*
)
view
{
return
[
AMapHeatMap
new
];
}
RCT_EXPORT_VIEW_PROPERTY
(
coordinates
,
MAHeatMapNodeArray
)
RCT_EXPORT_VIEW_PROPERTY
(
radius
,
NSInteger
)
RCT_EXPORT_VIEW_PROPERTY
(
opacity
,
CGFloat
)
@end
ios/RCTConvert+AMapView.m
View file @
1ce12718
...
@@ -24,6 +24,13 @@ RCT_ENUM_CONVERTER(MAPinAnnotationColor, (@{
...
@@ -24,6 +24,13 @@ RCT_ENUM_CONVERTER(MAPinAnnotationColor, (@{
return
[[
Coordinate
alloc
]
initWithCoordinate
:[
self
CLLocationCoordinate2D
:
json
]];
return
[[
Coordinate
alloc
]
initWithCoordinate
:[
self
CLLocationCoordinate2D
:
json
]];
}
}
+
(
MAHeatMapNode
*
)
MAHeatMapNode
:
(
id
)
json
{
MAHeatMapNode
*
node
=
[
MAHeatMapNode
new
];
node
.
coordinate
=
[
self
CLLocationCoordinate2D
:
json
];
node
.
intensity
=
1
;
return
node
;
}
+
(
MACoordinateRegion
)
MACoordinateRegion
:
(
id
)
json
{
+
(
MACoordinateRegion
)
MACoordinateRegion
:
(
id
)
json
{
return
MACoordinateRegionMake
(
return
MACoordinateRegionMake
(
[
self
CLLocationCoordinate2D
:
json
],
[
self
CLLocationCoordinate2D
:
json
],
...
@@ -39,6 +46,7 @@ RCT_ENUM_CONVERTER(MAPinAnnotationColor, (@{
...
@@ -39,6 +46,7 @@ RCT_ENUM_CONVERTER(MAPinAnnotationColor, (@{
}
}
RCT_ARRAY_CONVERTER
(
Coordinate
)
RCT_ARRAY_CONVERTER
(
Coordinate
)
RCT_ARRAY_CONVERTER
(
MAHeatMapNode
)
RCT_ARRAY_CONVERTER
(
AMapNaviPoint
)
RCT_ARRAY_CONVERTER
(
AMapNaviPoint
)
@end
@end
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