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
059ce10b
Commit
059ce10b
authored
Jun 21, 2017
by
Qiu Xiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实现 iOS circle 接口
parent
fc80b021
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
4 deletions
+104
-4
AMapCircleManager.kt
...c/main/java/cn/qiuxiang/react/amap3d/AMapCircleManager.kt
+1
-1
Circle.js
components/Circle.js
+7
-3
AMapCircle.h
ios/AMapCircle.h
+11
-0
AMapCircle.m
ios/AMapCircle.m
+60
-0
AMapCircleManager.m
ios/AMapCircleManager.m
+25
-0
No files found.
android/src/main/java/cn/qiuxiang/react/amap3d/AMapCircleManager.kt
View file @
059ce10b
...
...
@@ -16,7 +16,7 @@ internal class AMapCircleManager : ViewGroupManager<AMapCircle>() {
return
AMapCircle
(
reactContext
)
}
@ReactProp
(
name
=
"c
enter
"
)
@ReactProp
(
name
=
"c
oordinate
"
)
fun
setCoordinate
(
circle
:
AMapCircle
,
coordinate
:
ReadableMap
)
{
circle
.
center
=
LatLng
(
coordinate
.
getDouble
(
"latitude"
),
...
...
components/Circle.js
View file @
059ce10b
import
React
,
{
PropTypes
,
Component
}
from
'react'
import
{
requireNativeComponent
,
View
,
PixelRatio
}
from
'react-native'
import
{
requireNativeComponent
,
View
,
PixelRatio
,
Platform
}
from
'react-native'
import
{
LatLng
}
from
'./PropTypes'
class
Circle
extends
Component
{
...
...
@@ -9,7 +9,7 @@ class Circle extends Component {
/**
* 圆点
*/
c
enter
:
LatLng
.
isRequired
,
c
oordinate
:
LatLng
.
isRequired
,
/**
* 半径(米)
...
...
@@ -25,7 +25,11 @@ class Circle extends Component {
render
()
{
const
props
=
{
...
this
.
props
,
strokeWidth
:
PixelRatio
.
getPixelSizeForLayoutSize
(
this
.
props
.
strokeWidth
),
...
Platform
.
select
({
android
:
{
strokeWidth
:
PixelRatio
.
getPixelSizeForLayoutSize
(
this
.
props
.
strokeWidth
),
},
}),
}
return
<
AMapCircle
{...
props
}
/
>
}
...
...
ios/AMapCircle.h
0 → 100644
View file @
059ce10b
#import <MAMapKit/MAMapKit.h>
#import "AMapModel.h"
#pragma ide diagnostic ignored "OCUnusedPropertyInspection"
@interface
AMapCircle
:
AMapModel
@property
(
nonatomic
,
readonly
)
CLLocationCoordinate2D
coordinate
;
@property
(
nonatomic
,
readonly
)
MAMapRect
boundingMapRect
;
@end
ios/AMapCircle.m
0 → 100644
View file @
059ce10b
#import "AMapCircle.h"
#pragma ide diagnostic ignored "OCUnusedMethodInspection"
@implementation
AMapCircle
{
MACircle
*
_circle
;
MACircleRenderer
*
_renderer
;
CGFloat
_strokeWidth
;
UIColor
*
_strokeColor
;
UIColor
*
_fillColor
;
CLLocationCoordinate2D
_coordinate
;
CLLocationDistance
_radius
;
}
-
(
void
)
setCoordinate
:
(
CLLocationCoordinate2D
)
coordinate
{
_coordinate
=
coordinate
;
_circle
.
coordinate
=
coordinate
;
}
-
(
void
)
setRadius
:
(
CLLocationDistance
)
radius
{
_radius
=
radius
;
_circle
.
radius
=
radius
;
}
-
(
void
)
setStrokeWidth
:
(
CGFloat
)
strokeWidth
{
_strokeWidth
=
strokeWidth
;
_renderer
.
lineWidth
=
strokeWidth
;
}
-
(
void
)
setStrokeColor
:
(
UIColor
*
)
strokeColor
{
_strokeColor
=
strokeColor
;
_renderer
.
strokeColor
=
strokeColor
;
}
-
(
void
)
setFillColor
:
(
UIColor
*
)
fillColor
{
_fillColor
=
fillColor
;
_renderer
.
fillColor
=
fillColor
;
}
-
(
CLLocationCoordinate2D
)
coordinate
{
return
_circle
.
coordinate
;
}
-
(
MAMapRect
)
boundingMapRect
{
return
_circle
.
boundingMapRect
;
}
-
(
MAOverlayRenderer
*
)
renderer
{
if
(
_strokeColor
==
nil
)
{
_strokeColor
=
UIColor
.
blackColor
;
}
_circle
=
[
MACircle
circleWithCenterCoordinate
:
_coordinate
radius
:
_radius
];
_renderer
=
[[
MACircleRenderer
alloc
]
initWithCircle
:
_circle
];
_renderer
.
lineWidth
=
_strokeWidth
;
_renderer
.
strokeColor
=
_strokeColor
;
_renderer
.
fillColor
=
_fillColor
;
return
_renderer
;
}
@end
ios/AMapCircleManager.m
0 → 100644
View file @
059ce10b
#import <MAMapKit/MAMapView.h>
#import <React/RCTViewManager.h>
#import "AMapCircle.h"
#pragma ide diagnostic ignored "OCUnusedClassInspection"
@interface
AMapCircleManager
:
RCTViewManager
<
MAMapViewDelegate
>
@end
@implementation
AMapCircleManager
{
}
RCT_EXPORT_MODULE
()
-
(
UIView
*
)
view
{
return
[
AMapCircle
new
];
}
RCT_EXPORT_VIEW_PROPERTY
(
coordinate
,
CLLocationCoordinate2D
)
RCT_EXPORT_VIEW_PROPERTY
(
radius
,
CLLocationDistance
)
RCT_EXPORT_VIEW_PROPERTY
(
strokeWidth
,
CGFloat
)
RCT_EXPORT_VIEW_PROPERTY
(
strokeColor
,
UIColor
)
RCT_EXPORT_VIEW_PROPERTY
(
fillColor
,
UIColor
)
@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