|
1 | | -import { AltitudeKey, DefaultLatLonKeys, GenericMapPos, LatitudeKey, LongitudeKey, MapPos, MapRange, MapVec, ScreenBounds, ScreenPos, setMapPosKeys } from './index.common'; |
2 | | -import { BaseNative, _createImageSourceFromSrc } from '../index.common'; |
3 | | -import { Color } from '@nativescript/core'; |
| 1 | +import { BaseNative } from '../index.common'; |
| 2 | +import { AltitudeKey, DefaultLatLonKeys, GenericMapPos, LatitudeKey, LongitudeKey, MapPos, MapVec, ScreenBounds, ScreenPos, setMapPosKeys } from './index.common'; |
4 | 3 | export { LatitudeKey, LongitudeKey, MapPos, ScreenBounds, ScreenPos, setMapPosKeys }; |
5 | 4 |
|
6 | 5 | export const CartoMapStyle = { |
@@ -102,82 +101,6 @@ export function toNativeScreenPos(position: ScreenPos) { |
102 | 101 | return new com.carto.core.ScreenPos(position.x, position.y); |
103 | 102 | } |
104 | 103 |
|
105 | | -// export class Converter { |
106 | | -// NColor = { |
107 | | -// fromNative(value) { |
108 | | -// if (typeof value === 'string') { |
109 | | -// return value; |
110 | | -// } |
111 | | -// return value; |
112 | | -// }, |
113 | | -// toNative(value): android.graphics.Color { |
114 | | -// const theColor = value instanceof Color ? value : value._argb ? new Color(value._argb) : new Color(value); |
115 | | -// return theColor.ios; |
116 | | -// }, |
117 | | -// }; |
118 | | -// Color = { |
119 | | -// fromNative(value) { |
120 | | -// if (typeof value === 'string') { |
121 | | -// return value; |
122 | | -// } |
123 | | -// return new Color((value as com.carto.graphics.Color).getARGB()); |
124 | | -// }, |
125 | | -// toNative(value) { |
126 | | -// const theColor = value instanceof Color ? value : value._argb ? new Color(value._argb) : new Color(value); |
127 | | -// return new com.carto.graphics.Color(theColor.r, theColor.g, theColor.b, theColor.a); |
128 | | -// }, |
129 | | -// }; |
130 | | -// MapRange = { |
131 | | -// fromNative(value) { |
132 | | -// return value; |
133 | | -// }, |
134 | | -// toNative(value) { |
135 | | -// const theColor = value instanceof Color ? value : value._argb ? new Color(value._argb) : new Color(value); |
136 | | -// return theColor.ios; |
137 | | -// }, |
138 | | -// }; |
139 | | -// Font = { |
140 | | -// fromNative(value) { |
141 | | -// // no easy from typeface to Font |
142 | | -// return value; |
143 | | -// }, |
144 | | -// toNative(value) { |
145 | | -// return value?.getAndroidTypeface(); |
146 | | -// }, |
147 | | -// }; |
148 | | -// CartoImage = { |
149 | | -// fromNative(value) { |
150 | | -// // no easy from typeface to Font |
151 | | -// return value; |
152 | | -// }, |
153 | | -// toNative(value) { |
154 | | -// value = _createImageSourceFromSrc(value); |
155 | | -// return com.carto.utils.BitmapUtils.createBitmapFromAndroidBitmap(value.android as android.graphics.Bitmap); |
156 | | -// }, |
157 | | -// }; |
158 | | -// AndroidEnum(androidEnum) { |
159 | | -// return { |
160 | | -// fromNative(value) { |
161 | | -// // no easy from typeface to Font |
162 | | -// return value.swigValue(); |
163 | | -// }, |
164 | | -// toNative(value) { |
165 | | -// return androidEnum.swigToEnum(value); |
166 | | -// }, |
167 | | -// }; |
168 | | -// } |
169 | | -// } |
170 | | -export function fromNativeMapRange(value: com.carto.core.MapRange) { |
171 | | - return [value.getMax(), value.getMin()] as MapRange; |
172 | | -} |
173 | | -export function toNativeMapRange(value: MapRange) { |
174 | | - if (value instanceof com.carto.core.MapRange) { |
175 | | - return value; |
176 | | - } |
177 | | - // ignore z for now as points can get under the map! |
178 | | - return new com.carto.core.MapRange(value[0], value[1]); |
179 | | -} |
180 | | - |
181 | 104 | export function toNativeMapVec(value: MapVec | [number, number, number]) { |
182 | 105 | if (Array.isArray(value)) { |
183 | 106 | return new com.carto.core.MapVec(value[0], value[1], value[2]); |
|
0 commit comments