react-native-map4d-map-dtqg 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +88 -41
  3. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  4. package/android/.gradle/8.9/checksums/md5-checksums.bin +0 -0
  5. package/android/.gradle/8.9/checksums/sha1-checksums.bin +0 -0
  6. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  7. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  8. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  9. package/android/.gradle/8.9/gc.properties +0 -0
  10. package/android/.gradle/9.0-milestone-1/checksums/checksums.lock +0 -0
  11. package/android/.gradle/9.0-milestone-1/checksums/md5-checksums.bin +0 -0
  12. package/android/.gradle/9.0-milestone-1/checksums/sha1-checksums.bin +0 -0
  13. package/android/.gradle/9.0-milestone-1/fileChanges/last-build.bin +0 -0
  14. package/android/.gradle/9.0-milestone-1/fileHashes/fileHashes.lock +0 -0
  15. package/android/.gradle/9.0-milestone-1/gc.properties +0 -0
  16. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  17. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  18. package/android/.gradle/config.properties +2 -0
  19. package/android/.gradle/vcs-1/gc.properties +0 -0
  20. package/android/.idea/AndroidProjectSystem.xml +6 -0
  21. package/android/.idea/caches/deviceStreaming.xml +1570 -0
  22. package/android/.idea/copilot.data.migration.ask2agent.xml +6 -0
  23. package/android/.idea/gradle.xml +12 -0
  24. package/android/.idea/migrations.xml +10 -0
  25. package/android/.idea/misc.xml +10 -0
  26. package/android/.idea/runConfigurations.xml +17 -0
  27. package/android/.idea/vcs.xml +6 -0
  28. package/android/build.gradle +60 -60
  29. package/android/local.properties +8 -0
  30. package/android/src/main/AndroidManifest.xml +4 -4
  31. package/android/src/main/java/com/reactnativemap4dmap/ImageUtils.java +87 -87
  32. package/android/src/main/java/com/reactnativemap4dmap/Map4dMapModule.java +298 -298
  33. package/android/src/main/java/com/reactnativemap4dmap/Map4dMapPackage.java +35 -35
  34. package/android/src/main/java/com/reactnativemap4dmap/Map4dMapViewManager.java +31 -31
  35. package/android/src/main/java/com/reactnativemap4dmap/RMFBuilding.java +167 -167
  36. package/android/src/main/java/com/reactnativemap4dmap/RMFBuildingManager.java +121 -121
  37. package/android/src/main/java/com/reactnativemap4dmap/RMFCircle.java +105 -105
  38. package/android/src/main/java/com/reactnativemap4dmap/RMFCircleManager.java +121 -121
  39. package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRenderer.java +502 -502
  40. package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRendererManager.java +143 -143
  41. package/android/src/main/java/com/reactnativemap4dmap/RMFFeature.java +17 -17
  42. package/android/src/main/java/com/reactnativemap4dmap/RMFMapView.java +1172 -1172
  43. package/android/src/main/java/com/reactnativemap4dmap/RMFMapViewManager.java +226 -226
  44. package/android/src/main/java/com/reactnativemap4dmap/RMFMarker.java +412 -412
  45. package/android/src/main/java/com/reactnativemap4dmap/RMFMarkerManager.java +211 -211
  46. package/android/src/main/java/com/reactnativemap4dmap/RMFPOI.java +222 -222
  47. package/android/src/main/java/com/reactnativemap4dmap/RMFPOIManager.java +119 -119
  48. package/android/src/main/java/com/reactnativemap4dmap/RMFPolygon.java +172 -172
  49. package/android/src/main/java/com/reactnativemap4dmap/RMFPolygonManager.java +147 -147
  50. package/android/src/main/java/com/reactnativemap4dmap/RMFPolyline.java +146 -146
  51. package/android/src/main/java/com/reactnativemap4dmap/RMFPolylineManager.java +137 -137
  52. package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlay.java +95 -95
  53. package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlayManager.java +64 -64
  54. package/android/src/main/java/com/reactnativemap4dmap/SizeReportingShadowNode.java +31 -31
  55. package/android/src/main/java/com/reactnativemap4dmap/ViewAttacherGroup.java +31 -31
  56. package/android/src/main/java/com/reactnativemap4dmap/ViewChangesTracker.java +70 -70
  57. package/android/src/main/java/vn/map4d/map/annotations/RMFBitmapDescriptor.java +9 -9
  58. package/ios/Map4dMap.h +7 -7
  59. package/ios/Map4dMap.m +14 -14
  60. package/ios/Map4dMapViewManager.m +34 -34
  61. package/ios/RCTConvert+Map4dMap.h +33 -33
  62. package/ios/RCTConvert+Map4dMap.m +112 -112
  63. package/ios/RMFCircle.h +37 -37
  64. package/ios/RMFCircle.m +100 -100
  65. package/ios/RMFCircleManager.h +18 -18
  66. package/ios/RMFCircleManager.m +155 -155
  67. package/ios/RMFCircleMap4d.h +23 -23
  68. package/ios/RMFCircleMap4d.m +13 -13
  69. package/ios/RMFCoordinate.h +22 -22
  70. package/ios/RMFCoordinate.m +13 -13
  71. package/ios/RMFDirectionsMarkerOptions.h +24 -24
  72. package/ios/RMFDirectionsMarkerOptions.m +23 -23
  73. package/ios/RMFDirectionsRenderer.h +47 -47
  74. package/ios/RMFDirectionsRenderer.m +182 -182
  75. package/ios/RMFDirectionsRendererManager.h +17 -17
  76. package/ios/RMFDirectionsRendererManager.m +84 -84
  77. package/ios/RMFDirectionsRendererMap4d.h +21 -21
  78. package/ios/RMFDirectionsRendererMap4d.m +12 -12
  79. package/ios/RMFDummyView.h +6 -6
  80. package/ios/RMFDummyView.m +12 -12
  81. package/ios/RMFEventResponse.h +39 -39
  82. package/ios/RMFEventResponse.m +98 -98
  83. package/ios/RMFIcon.h +24 -24
  84. package/ios/RMFIcon.m +35 -35
  85. package/ios/RMFMapView.h +84 -84
  86. package/ios/RMFMapView.m +376 -376
  87. package/ios/RMFMapViewManager.h +17 -17
  88. package/ios/RMFMapViewManager.m +493 -493
  89. package/ios/RMFMarker.h +57 -57
  90. package/ios/RMFMarker.m +267 -267
  91. package/ios/RMFMarkerManager.h +17 -17
  92. package/ios/RMFMarkerManager.m +156 -156
  93. package/ios/RMFMarkerMap4d.h +19 -19
  94. package/ios/RMFMarkerMap4d.m +13 -13
  95. package/ios/RMFPOI.h +38 -38
  96. package/ios/RMFPOI.m +123 -123
  97. package/ios/RMFPOIManager.h +18 -18
  98. package/ios/RMFPOIManager.m +168 -168
  99. package/ios/RMFPOIMap4d.h +22 -22
  100. package/ios/RMFPOIMap4d.m +12 -12
  101. package/ios/RMFPolygon.h +41 -41
  102. package/ios/RMFPolygon.m +106 -106
  103. package/ios/RMFPolygonManager.h +18 -18
  104. package/ios/RMFPolygonManager.m +141 -141
  105. package/ios/RMFPolygonMap4d.h +23 -23
  106. package/ios/RMFPolygonMap4d.m +15 -15
  107. package/ios/RMFPolyline.h +38 -38
  108. package/ios/RMFPolyline.m +101 -101
  109. package/ios/RMFPolylineManager.h +18 -18
  110. package/ios/RMFPolylineManager.m +139 -139
  111. package/ios/RMFPolylineMap4d.h +22 -22
  112. package/ios/RMFPolylineMap4d.m +15 -15
  113. package/ios/building/RMFBuilding.h +41 -41
  114. package/ios/building/RMFBuilding.m +104 -104
  115. package/ios/building/RMFBuildingManager.h +19 -19
  116. package/ios/building/RMFBuildingManager.m +133 -133
  117. package/ios/building/RMFBuildingMap4d.h +23 -23
  118. package/ios/building/RMFBuildingMap4d.m +15 -15
  119. package/ios/overlays/RMFTileOverlay.h +36 -36
  120. package/ios/overlays/RMFTileOverlay.m +64 -64
  121. package/ios/overlays/RMFTileOverlayManager.h +17 -17
  122. package/ios/overlays/RMFTileOverlayManager.m +27 -27
  123. package/lib/commonjs/components/MFBuilding.js +26 -26
  124. package/lib/commonjs/components/MFBuilding.js.map +1 -1
  125. package/lib/commonjs/components/MFCircle.js +20 -20
  126. package/lib/commonjs/components/MFCircle.js.map +1 -1
  127. package/lib/commonjs/components/MFDirectionsRenderer.js +32 -32
  128. package/lib/commonjs/components/MFDirectionsRenderer.js.map +1 -1
  129. package/lib/commonjs/components/MFMapView.js +133 -71
  130. package/lib/commonjs/components/MFMapView.js.map +1 -1
  131. package/lib/commonjs/components/MFMarker.js +35 -35
  132. package/lib/commonjs/components/MFMarker.js.map +1 -1
  133. package/lib/commonjs/components/MFPOI.js +20 -20
  134. package/lib/commonjs/components/MFPOI.js.map +1 -1
  135. package/lib/commonjs/components/MFPolygon.js +22 -22
  136. package/lib/commonjs/components/MFPolygon.js.map +1 -1
  137. package/lib/commonjs/components/MFPolyline.js +18 -18
  138. package/lib/commonjs/components/MFPolyline.js.map +1 -1
  139. package/lib/commonjs/components/MFTileOverlay.js +9 -9
  140. package/lib/commonjs/components/MFTileOverlay.js.map +1 -1
  141. package/lib/commonjs/components/Map4dMapView.js.map +1 -1
  142. package/lib/commonjs/components/extends/AreaFocuser.js +311 -0
  143. package/lib/commonjs/components/extends/AreaFocuser.js.map +1 -0
  144. package/lib/commonjs/index.js +8 -0
  145. package/lib/commonjs/index.js.map +1 -1
  146. package/lib/module/components/MFBuilding.js +26 -26
  147. package/lib/module/components/MFBuilding.js.map +1 -1
  148. package/lib/module/components/MFCircle.js +20 -20
  149. package/lib/module/components/MFCircle.js.map +1 -1
  150. package/lib/module/components/MFDirectionsRenderer.js +32 -32
  151. package/lib/module/components/MFDirectionsRenderer.js.map +1 -1
  152. package/lib/module/components/MFMapView.js +131 -71
  153. package/lib/module/components/MFMapView.js.map +1 -1
  154. package/lib/module/components/MFMarker.js +35 -35
  155. package/lib/module/components/MFMarker.js.map +1 -1
  156. package/lib/module/components/MFPOI.js +20 -20
  157. package/lib/module/components/MFPOI.js.map +1 -1
  158. package/lib/module/components/MFPolygon.js +22 -22
  159. package/lib/module/components/MFPolygon.js.map +1 -1
  160. package/lib/module/components/MFPolyline.js +18 -18
  161. package/lib/module/components/MFPolyline.js.map +1 -1
  162. package/lib/module/components/MFTileOverlay.js +9 -9
  163. package/lib/module/components/MFTileOverlay.js.map +1 -1
  164. package/lib/module/components/Map4dMapView.js.map +1 -1
  165. package/lib/module/components/extends/AreaFocuser.js +302 -0
  166. package/lib/module/components/extends/AreaFocuser.js.map +1 -0
  167. package/lib/module/index.js +2 -1
  168. package/lib/module/index.js.map +1 -1
  169. package/lib/typescript/components/Map4dMapView.d.ts +7 -7
  170. package/package.json +152 -152
  171. package/react-native-map4d-map.podspec +20 -20
  172. package/src/components/MFBuilding.js +187 -187
  173. package/src/components/MFCircle.js +173 -173
  174. package/src/components/MFDirectionsRenderer.js +237 -237
  175. package/src/components/MFMapView.js +447 -373
  176. package/src/components/MFMarker.js +246 -246
  177. package/src/components/MFPOI.js +184 -184
  178. package/src/components/MFPolygon.js +186 -186
  179. package/src/components/MFPolyline.js +172 -172
  180. package/src/components/MFTileOverlay.js +45 -45
  181. package/src/components/Map4dMapView.tsx +26 -26
  182. package/src/components/extends/AreaFocuser.js +339 -0
  183. package/src/index.js +23 -21
@@ -1,222 +1,222 @@
1
- package com.reactnativemap4dmap;
2
-
3
- import android.content.Context;
4
- import android.graphics.BitmapFactory;
5
- import android.graphics.Canvas;
6
- import android.graphics.Color;
7
- import android.graphics.drawable.Animatable;
8
- import android.graphics.Bitmap;
9
- import android.graphics.drawable.Drawable;
10
- import android.net.Uri;
11
-
12
- import com.facebook.react.bridge.ReadableMap;
13
-
14
- import com.facebook.common.references.CloseableReference;
15
- import com.facebook.datasource.DataSource;
16
- import com.facebook.drawee.backends.pipeline.Fresco;
17
- import com.facebook.drawee.view.DraweeHolder;
18
- import com.facebook.drawee.interfaces.DraweeController;
19
- import com.facebook.drawee.controller.ControllerListener;
20
- import com.facebook.drawee.controller.BaseControllerListener;
21
- import com.facebook.drawee.generic.GenericDraweeHierarchy;
22
- import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
23
- import com.facebook.drawee.drawable.ScalingUtils;
24
- import com.facebook.imagepipeline.image.CloseableImage;
25
- import com.facebook.imagepipeline.image.ImageInfo;
26
- import com.facebook.imagepipeline.request.ImageRequest;
27
- import com.facebook.imagepipeline.request.ImageRequestBuilder;
28
- import com.facebook.imagepipeline.image.CloseableStaticBitmap;
29
- import com.facebook.imagepipeline.core.ImagePipeline;
30
-
31
- import vn.map4d.map.core.*;
32
- import vn.map4d.map.annotations.*;
33
-
34
- import androidx.annotation.ColorInt;
35
-
36
- import vn.map4d.types.MFLocationCoordinate;
37
-
38
- import javax.annotation.Nullable;
39
-
40
- public class RMFPOI extends RMFFeature {
41
- private MFPOIOptions options;
42
- private MFLocationCoordinate position;
43
- private String title;
44
- private @ColorInt int color;
45
- private String subTitle;
46
- private String type;
47
- private MFBitmapDescriptor iconBitmapDescriptor;
48
- private float zIndex;
49
- private MFPOI poi;
50
-
51
- private final DraweeHolder<?> logoHolder;
52
- private DataSource<CloseableReference<CloseableImage>> dataSource;
53
- private final ControllerListener<ImageInfo> mLogoControllerListener =
54
- new BaseControllerListener<ImageInfo>() {
55
- @Override
56
- public void onFinalImageSet(
57
- String id,
58
- @Nullable final ImageInfo imageInfo,
59
- @Nullable Animatable animatable) {
60
- CloseableReference<CloseableImage> imageReference = null;
61
- try {
62
- imageReference = dataSource.getResult();
63
- if (imageReference != null) {
64
- CloseableImage image = imageReference.get();
65
- if (image != null && image instanceof CloseableStaticBitmap) {
66
- CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image;
67
- Bitmap bitmap = closeableStaticBitmap.getUnderlyingBitmap();
68
- if (bitmap != null) {
69
- bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
70
- iconBitmapDescriptor = MFBitmapDescriptorFactory.fromBitmap(bitmap);
71
- }
72
- }
73
- }
74
- } finally {
75
- dataSource.close();
76
- if (imageReference != null) {
77
- CloseableReference.closeSafely(imageReference);
78
- }
79
- }
80
-
81
- if (RMFPOI.this.poi != null) {
82
- RMFPOI.this.poi.setIcon(iconBitmapDescriptor);
83
- }
84
- }
85
- };
86
-
87
- public RMFPOI(Context context) {
88
- super(context);
89
- this.position = new MFLocationCoordinate(0, 0);
90
- this.title = "";
91
- this.subTitle = "";
92
- this.color = Color.BLACK;
93
- this.type = "";
94
- this.zIndex = 0.0f;
95
- logoHolder = DraweeHolder.create(createDraweeHierarchy(), context);
96
- logoHolder.onAttach();
97
- }
98
-
99
- private GenericDraweeHierarchy createDraweeHierarchy() {
100
- return new GenericDraweeHierarchyBuilder(getResources())
101
- .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
102
- .setFadeDuration(0)
103
- .build();
104
- }
105
-
106
- public void setCoordinate(ReadableMap data) {
107
- this.position = new MFLocationCoordinate(data.getDouble("latitude"), data.getDouble("longitude"));
108
- if (poi != null) {
109
- poi.setPosition(this.position);
110
- }
111
- }
112
-
113
- public void setTitle(String title) {
114
- this.title = title;
115
- if (poi != null) {
116
- poi.setTitle(this.title);
117
- }
118
- }
119
-
120
- public void setColor(@ColorInt int color) {
121
- this.color = color;
122
- if (poi != null) {
123
- poi.setColor(this.color);
124
- }
125
- }
126
-
127
- public void setSubTitle(String subTitle) {
128
- this.subTitle = subTitle;
129
- if (poi != null) {
130
- poi.setSubTitle(this.subTitle);
131
- }
132
- }
133
-
134
- public void setType(String type) {
135
- this.type = type;
136
- if (poi != null) {
137
- poi.setType(this.type);
138
- }
139
- }
140
-
141
- public void setIcon(ReadableMap map) {
142
- String uri = null;
143
- if (map.hasKey("uri")) {
144
- uri = map.getString("uri");
145
- }
146
-
147
- if (uri == null) {
148
- iconBitmapDescriptor = null;
149
- }
150
- else if (uri.startsWith("http://") || uri.startsWith("https://") ||
151
- uri.startsWith("file://") || uri.startsWith("asset://") || uri.startsWith("data:")) {
152
- ImageRequest imageRequest = ImageRequestBuilder
153
- .newBuilderWithSource(Uri.parse(uri))
154
- .build();
155
-
156
- ImagePipeline imagePipeline = Fresco.getImagePipeline();
157
- dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
158
- DraweeController controller = Fresco.newDraweeControllerBuilder()
159
- .setImageRequest(imageRequest)
160
- .setControllerListener(mLogoControllerListener)
161
- .setOldController(logoHolder.getController())
162
- .build();
163
- logoHolder.setController(controller);
164
- }
165
- else {
166
- iconBitmapDescriptor = ImageUtils.getBitmapDescriptorByName(this, uri);
167
- if (iconBitmapDescriptor != null) {
168
- int drawableId = ImageUtils.getDrawableResourceByName(this, uri);
169
- Bitmap iconBitmap = BitmapFactory.decodeResource(getResources(), drawableId);
170
- if (iconBitmap == null) { // VectorDrawable or similar
171
- Drawable drawable = getResources().getDrawable(drawableId);
172
- iconBitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
173
- drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
174
- Canvas canvas = new Canvas(iconBitmap);
175
- drawable.draw(canvas);
176
- }
177
- }
178
- }
179
- }
180
-
181
- public void setZIndex(double zIndex) {
182
- this.zIndex = (float) zIndex;
183
- if (poi != null) {
184
- poi.setZIndex(this.zIndex);
185
- }
186
- }
187
-
188
- public void addToMap(Map4D map) {
189
- this.poi = map.addPOI(getOptions());
190
- }
191
-
192
- public void removeFromMap(Map4D map) {
193
- if (poi == null) {
194
- return;
195
- }
196
- poi.remove();
197
- poi = null;
198
- }
199
-
200
- public MFPOIOptions getOptions() {
201
- if (options == null) {
202
- options = new MFPOIOptions();
203
- }
204
- fillOptions(options);
205
- return options;
206
- }
207
-
208
- private MFPOIOptions fillOptions(MFPOIOptions options) {
209
- options.position(position);
210
- options.title(title);
211
- options.color(color);
212
- options.subtitle(subTitle);
213
- options.type(type);
214
- options.zIndex(zIndex);
215
- options.icon(iconBitmapDescriptor);
216
- return options;
217
- }
218
-
219
- public Object getFeature() {
220
- return poi;
221
- }
222
- }
1
+ package com.reactnativemap4dmap;
2
+
3
+ import android.content.Context;
4
+ import android.graphics.BitmapFactory;
5
+ import android.graphics.Canvas;
6
+ import android.graphics.Color;
7
+ import android.graphics.drawable.Animatable;
8
+ import android.graphics.Bitmap;
9
+ import android.graphics.drawable.Drawable;
10
+ import android.net.Uri;
11
+
12
+ import com.facebook.react.bridge.ReadableMap;
13
+
14
+ import com.facebook.common.references.CloseableReference;
15
+ import com.facebook.datasource.DataSource;
16
+ import com.facebook.drawee.backends.pipeline.Fresco;
17
+ import com.facebook.drawee.view.DraweeHolder;
18
+ import com.facebook.drawee.interfaces.DraweeController;
19
+ import com.facebook.drawee.controller.ControllerListener;
20
+ import com.facebook.drawee.controller.BaseControllerListener;
21
+ import com.facebook.drawee.generic.GenericDraweeHierarchy;
22
+ import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
23
+ import com.facebook.drawee.drawable.ScalingUtils;
24
+ import com.facebook.imagepipeline.image.CloseableImage;
25
+ import com.facebook.imagepipeline.image.ImageInfo;
26
+ import com.facebook.imagepipeline.request.ImageRequest;
27
+ import com.facebook.imagepipeline.request.ImageRequestBuilder;
28
+ import com.facebook.imagepipeline.image.CloseableStaticBitmap;
29
+ import com.facebook.imagepipeline.core.ImagePipeline;
30
+
31
+ import vn.map4d.map.core.*;
32
+ import vn.map4d.map.annotations.*;
33
+
34
+ import androidx.annotation.ColorInt;
35
+
36
+ import vn.map4d.types.MFLocationCoordinate;
37
+
38
+ import javax.annotation.Nullable;
39
+
40
+ public class RMFPOI extends RMFFeature {
41
+ private MFPOIOptions options;
42
+ private MFLocationCoordinate position;
43
+ private String title;
44
+ private @ColorInt int color;
45
+ private String subTitle;
46
+ private String type;
47
+ private MFBitmapDescriptor iconBitmapDescriptor;
48
+ private float zIndex;
49
+ private MFPOI poi;
50
+
51
+ private final DraweeHolder<?> logoHolder;
52
+ private DataSource<CloseableReference<CloseableImage>> dataSource;
53
+ private final ControllerListener<ImageInfo> mLogoControllerListener =
54
+ new BaseControllerListener<ImageInfo>() {
55
+ @Override
56
+ public void onFinalImageSet(
57
+ String id,
58
+ @Nullable final ImageInfo imageInfo,
59
+ @Nullable Animatable animatable) {
60
+ CloseableReference<CloseableImage> imageReference = null;
61
+ try {
62
+ imageReference = dataSource.getResult();
63
+ if (imageReference != null) {
64
+ CloseableImage image = imageReference.get();
65
+ if (image != null && image instanceof CloseableStaticBitmap) {
66
+ CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image;
67
+ Bitmap bitmap = closeableStaticBitmap.getUnderlyingBitmap();
68
+ if (bitmap != null) {
69
+ bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
70
+ iconBitmapDescriptor = MFBitmapDescriptorFactory.fromBitmap(bitmap);
71
+ }
72
+ }
73
+ }
74
+ } finally {
75
+ dataSource.close();
76
+ if (imageReference != null) {
77
+ CloseableReference.closeSafely(imageReference);
78
+ }
79
+ }
80
+
81
+ if (RMFPOI.this.poi != null) {
82
+ RMFPOI.this.poi.setIcon(iconBitmapDescriptor);
83
+ }
84
+ }
85
+ };
86
+
87
+ public RMFPOI(Context context) {
88
+ super(context);
89
+ this.position = new MFLocationCoordinate(0, 0);
90
+ this.title = "";
91
+ this.subTitle = "";
92
+ this.color = Color.BLACK;
93
+ this.type = "";
94
+ this.zIndex = 0.0f;
95
+ logoHolder = DraweeHolder.create(createDraweeHierarchy(), context);
96
+ logoHolder.onAttach();
97
+ }
98
+
99
+ private GenericDraweeHierarchy createDraweeHierarchy() {
100
+ return new GenericDraweeHierarchyBuilder(getResources())
101
+ .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
102
+ .setFadeDuration(0)
103
+ .build();
104
+ }
105
+
106
+ public void setCoordinate(ReadableMap data) {
107
+ this.position = new MFLocationCoordinate(data.getDouble("latitude"), data.getDouble("longitude"));
108
+ if (poi != null) {
109
+ poi.setPosition(this.position);
110
+ }
111
+ }
112
+
113
+ public void setTitle(String title) {
114
+ this.title = title;
115
+ if (poi != null) {
116
+ poi.setTitle(this.title);
117
+ }
118
+ }
119
+
120
+ public void setColor(@ColorInt int color) {
121
+ this.color = color;
122
+ if (poi != null) {
123
+ poi.setColor(this.color);
124
+ }
125
+ }
126
+
127
+ public void setSubTitle(String subTitle) {
128
+ this.subTitle = subTitle;
129
+ if (poi != null) {
130
+ poi.setSubTitle(this.subTitle);
131
+ }
132
+ }
133
+
134
+ public void setType(String type) {
135
+ this.type = type;
136
+ if (poi != null) {
137
+ poi.setType(this.type);
138
+ }
139
+ }
140
+
141
+ public void setIcon(ReadableMap map) {
142
+ String uri = null;
143
+ if (map.hasKey("uri")) {
144
+ uri = map.getString("uri");
145
+ }
146
+
147
+ if (uri == null) {
148
+ iconBitmapDescriptor = null;
149
+ }
150
+ else if (uri.startsWith("http://") || uri.startsWith("https://") ||
151
+ uri.startsWith("file://") || uri.startsWith("asset://") || uri.startsWith("data:")) {
152
+ ImageRequest imageRequest = ImageRequestBuilder
153
+ .newBuilderWithSource(Uri.parse(uri))
154
+ .build();
155
+
156
+ ImagePipeline imagePipeline = Fresco.getImagePipeline();
157
+ dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
158
+ DraweeController controller = Fresco.newDraweeControllerBuilder()
159
+ .setImageRequest(imageRequest)
160
+ .setControllerListener(mLogoControllerListener)
161
+ .setOldController(logoHolder.getController())
162
+ .build();
163
+ logoHolder.setController(controller);
164
+ }
165
+ else {
166
+ iconBitmapDescriptor = ImageUtils.getBitmapDescriptorByName(this, uri);
167
+ if (iconBitmapDescriptor != null) {
168
+ int drawableId = ImageUtils.getDrawableResourceByName(this, uri);
169
+ Bitmap iconBitmap = BitmapFactory.decodeResource(getResources(), drawableId);
170
+ if (iconBitmap == null) { // VectorDrawable or similar
171
+ Drawable drawable = getResources().getDrawable(drawableId);
172
+ iconBitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
173
+ drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
174
+ Canvas canvas = new Canvas(iconBitmap);
175
+ drawable.draw(canvas);
176
+ }
177
+ }
178
+ }
179
+ }
180
+
181
+ public void setZIndex(double zIndex) {
182
+ this.zIndex = (float) zIndex;
183
+ if (poi != null) {
184
+ poi.setZIndex(this.zIndex);
185
+ }
186
+ }
187
+
188
+ public void addToMap(Map4D map) {
189
+ this.poi = map.addPOI(getOptions());
190
+ }
191
+
192
+ public void removeFromMap(Map4D map) {
193
+ if (poi == null) {
194
+ return;
195
+ }
196
+ poi.remove();
197
+ poi = null;
198
+ }
199
+
200
+ public MFPOIOptions getOptions() {
201
+ if (options == null) {
202
+ options = new MFPOIOptions();
203
+ }
204
+ fillOptions(options);
205
+ return options;
206
+ }
207
+
208
+ private MFPOIOptions fillOptions(MFPOIOptions options) {
209
+ options.position(position);
210
+ options.title(title);
211
+ options.color(color);
212
+ options.subtitle(subTitle);
213
+ options.type(type);
214
+ options.zIndex(zIndex);
215
+ options.icon(iconBitmapDescriptor);
216
+ return options;
217
+ }
218
+
219
+ public Object getFeature() {
220
+ return poi;
221
+ }
222
+ }
@@ -1,119 +1,119 @@
1
- package com.reactnativemap4dmap;
2
-
3
- import com.facebook.react.uimanager.ViewGroupManager;
4
- import com.facebook.react.uimanager.ThemedReactContext;
5
- import com.facebook.react.bridge.*;
6
- import com.facebook.react.uimanager.annotations.*;
7
- import com.facebook.react.common.MapBuilder;
8
-
9
- import androidx.annotation.Nullable;
10
- import androidx.annotation.ColorInt;
11
-
12
- import java.util.Map;
13
- import java.util.HashMap;
14
-
15
- public class RMFPOIManager extends ViewGroupManager<RMFPOI> {
16
- private static final int k_setCoordinate = 1;
17
- private static final int k_setTitle = k_setCoordinate + 1;
18
- private static final int k_setTitleColor = k_setTitle + 1;
19
- private static final int k_setSubTitle = k_setTitleColor + 1;
20
- private static final int k_setType = k_setSubTitle + 1;
21
- private static final int k_setIcon = k_setType + 1;
22
- private static final int k_setZIndex = k_setIcon + 1;
23
-
24
- @Override
25
- public String getName() {
26
- return "RMFPOI";
27
- }
28
-
29
- @Override
30
- protected RMFPOI createViewInstance(ThemedReactContext reactContext) {
31
- return new RMFPOI(reactContext);
32
- }
33
-
34
- @Override
35
- public void receiveCommand(RMFPOI view, int commandId, @Nullable ReadableArray args) {
36
- ReadableMap data;
37
- switch (commandId) {
38
- case k_setCoordinate:
39
- data = args.getMap(0);
40
- view.setCoordinate(data);
41
- break;
42
- case k_setTitle:
43
- view.setTitle(args.getString(0));
44
- break;
45
- case k_setTitleColor:
46
- view.setColor(args.getInt(0));
47
- break;
48
- case k_setSubTitle:
49
- view.setSubTitle(args.getString(0));
50
- break;
51
- case k_setType:
52
- view.setType(args.getString(0));
53
- break;
54
- case k_setIcon:
55
- view.setIcon(args.getMap(0));
56
- break;
57
- case k_setZIndex:
58
- view.setZIndex(args.getDouble(0));
59
- break;
60
- }
61
- }
62
-
63
- @Override
64
- public Map getExportedCustomDirectEventTypeConstants() {
65
- Map<String, Map<String, String>> map = MapBuilder.of(
66
- "onPress", MapBuilder.of("registrationName", "onPress")
67
- );
68
- return map;
69
- }
70
-
71
- @Nullable
72
- @Override
73
- public Map<String, Integer> getCommandsMap() {
74
- HashMap<String, Integer> map = new HashMap();
75
- map.put("setCoordinate", k_setCoordinate);
76
- map.put("setTitle", k_setTitle);
77
- map.put("setTitleColor", k_setTitleColor);
78
- map.put("setSubTitle", k_setSubTitle);
79
- map.put("setPoiType", k_setType);
80
- map.put("setZIndex", k_setZIndex);
81
- return map;
82
- }
83
-
84
- @ReactProp(name = "coordinate")
85
- public void setCoordinate(RMFPOI view, ReadableMap map) {
86
- view.setCoordinate(map);
87
- }
88
-
89
- @ReactProp(name = "title")
90
- public void setTitle(RMFPOI view, String title) {
91
- view.setTitle(title);
92
- }
93
-
94
- @ReactProp(name = "titleColor", customType = "Color")
95
- public void setTitleColor(RMFPOI view, @ColorInt int titleColor) {
96
- view.setColor(titleColor);
97
- }
98
-
99
- @ReactProp(name = "subtitle")
100
- public void setSubTitle(RMFPOI view, String subTitle) {
101
- view.setSubTitle(subTitle);
102
- }
103
-
104
- @ReactProp(name = "icon")
105
- public void setIcon(RMFPOI view, ReadableMap icon) {
106
- view.setIcon(icon);
107
- }
108
-
109
- @ReactProp(name = "poiType")
110
- public void setType(RMFPOI view, String poiType) {
111
- view.setType(poiType);
112
- }
113
-
114
- @ReactProp(name = "zIndex")
115
- public void setZIndex(RMFPOI view, double zIndex) {
116
- view.setZIndex(zIndex);
117
- }
118
-
119
- }
1
+ package com.reactnativemap4dmap;
2
+
3
+ import com.facebook.react.uimanager.ViewGroupManager;
4
+ import com.facebook.react.uimanager.ThemedReactContext;
5
+ import com.facebook.react.bridge.*;
6
+ import com.facebook.react.uimanager.annotations.*;
7
+ import com.facebook.react.common.MapBuilder;
8
+
9
+ import androidx.annotation.Nullable;
10
+ import androidx.annotation.ColorInt;
11
+
12
+ import java.util.Map;
13
+ import java.util.HashMap;
14
+
15
+ public class RMFPOIManager extends ViewGroupManager<RMFPOI> {
16
+ private static final int k_setCoordinate = 1;
17
+ private static final int k_setTitle = k_setCoordinate + 1;
18
+ private static final int k_setTitleColor = k_setTitle + 1;
19
+ private static final int k_setSubTitle = k_setTitleColor + 1;
20
+ private static final int k_setType = k_setSubTitle + 1;
21
+ private static final int k_setIcon = k_setType + 1;
22
+ private static final int k_setZIndex = k_setIcon + 1;
23
+
24
+ @Override
25
+ public String getName() {
26
+ return "RMFPOI";
27
+ }
28
+
29
+ @Override
30
+ protected RMFPOI createViewInstance(ThemedReactContext reactContext) {
31
+ return new RMFPOI(reactContext);
32
+ }
33
+
34
+ @Override
35
+ public void receiveCommand(RMFPOI view, int commandId, @Nullable ReadableArray args) {
36
+ ReadableMap data;
37
+ switch (commandId) {
38
+ case k_setCoordinate:
39
+ data = args.getMap(0);
40
+ view.setCoordinate(data);
41
+ break;
42
+ case k_setTitle:
43
+ view.setTitle(args.getString(0));
44
+ break;
45
+ case k_setTitleColor:
46
+ view.setColor(args.getInt(0));
47
+ break;
48
+ case k_setSubTitle:
49
+ view.setSubTitle(args.getString(0));
50
+ break;
51
+ case k_setType:
52
+ view.setType(args.getString(0));
53
+ break;
54
+ case k_setIcon:
55
+ view.setIcon(args.getMap(0));
56
+ break;
57
+ case k_setZIndex:
58
+ view.setZIndex(args.getDouble(0));
59
+ break;
60
+ }
61
+ }
62
+
63
+ @Override
64
+ public Map getExportedCustomDirectEventTypeConstants() {
65
+ Map<String, Map<String, String>> map = MapBuilder.of(
66
+ "onPress", MapBuilder.of("registrationName", "onPress")
67
+ );
68
+ return map;
69
+ }
70
+
71
+ @Nullable
72
+ @Override
73
+ public Map<String, Integer> getCommandsMap() {
74
+ HashMap<String, Integer> map = new HashMap();
75
+ map.put("setCoordinate", k_setCoordinate);
76
+ map.put("setTitle", k_setTitle);
77
+ map.put("setTitleColor", k_setTitleColor);
78
+ map.put("setSubTitle", k_setSubTitle);
79
+ map.put("setPoiType", k_setType);
80
+ map.put("setZIndex", k_setZIndex);
81
+ return map;
82
+ }
83
+
84
+ @ReactProp(name = "coordinate")
85
+ public void setCoordinate(RMFPOI view, ReadableMap map) {
86
+ view.setCoordinate(map);
87
+ }
88
+
89
+ @ReactProp(name = "title")
90
+ public void setTitle(RMFPOI view, String title) {
91
+ view.setTitle(title);
92
+ }
93
+
94
+ @ReactProp(name = "titleColor", customType = "Color")
95
+ public void setTitleColor(RMFPOI view, @ColorInt int titleColor) {
96
+ view.setColor(titleColor);
97
+ }
98
+
99
+ @ReactProp(name = "subtitle")
100
+ public void setSubTitle(RMFPOI view, String subTitle) {
101
+ view.setSubTitle(subTitle);
102
+ }
103
+
104
+ @ReactProp(name = "icon")
105
+ public void setIcon(RMFPOI view, ReadableMap icon) {
106
+ view.setIcon(icon);
107
+ }
108
+
109
+ @ReactProp(name = "poiType")
110
+ public void setType(RMFPOI view, String poiType) {
111
+ view.setType(poiType);
112
+ }
113
+
114
+ @ReactProp(name = "zIndex")
115
+ public void setZIndex(RMFPOI view, double zIndex) {
116
+ view.setZIndex(zIndex);
117
+ }
118
+
119
+ }