Skip to content

Commit 356b98d

Browse files
committed
fix(android): simplified enums handling
1 parent dcab683 commit 356b98d

File tree

8 files changed

+31
-33
lines changed

8 files changed

+31
-33
lines changed

src/ui-carto/core/index.android.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ export const CartoMapStyle = {
1616

1717
export const ClickType = {
1818
get SINGLE() {
19-
return com.carto.ui.ClickType.CLICK_TYPE_SINGLE.swigValue();
19+
return com.carto.ui.ClickType.CLICK_TYPE_SINGLE;
2020
},
2121
get LONG() {
22-
return com.carto.ui.ClickType.CLICK_TYPE_LONG.swigValue();
22+
return com.carto.ui.ClickType.CLICK_TYPE_LONG;
2323
},
2424
get DOUBLE() {
25-
return com.carto.ui.ClickType.CLICK_TYPE_DOUBLE.swigValue();
25+
return com.carto.ui.ClickType.CLICK_TYPE_DOUBLE;
2626
},
2727
get DUAL() {
28-
return com.carto.ui.ClickType.CLICK_TYPE_DUAL.swigValue();
28+
return com.carto.ui.ClickType.CLICK_TYPE_DUAL;
2929
}
3030
};
3131

src/ui-carto/layers/raster.android.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export abstract class RasterTileLayerCommon<NativeClass extends com.carto.layers
6363
}
6464
return (
6565
this.clickListener.onRasterTileClicked.call(this.clickListener, {
66-
clickType: info.getClickType().swigValue(),
66+
clickType: info.getClickType(),
6767
layer: this,
6868
nearestColor: new Color(info.getNearestColor().getARGB()),
6969
interpolatedColor: new Color(info.getInterpolatedColor().getARGB()),

src/ui-carto/layers/vector.android.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export abstract class BaseVectorTileLayer<T extends com.carto.layers.VectorTileL
140140
};
141141
return (
142142
this.listener.onVectorTileClicked.call(this.listener, {
143-
clickType: info.getClickType().swigValue(),
143+
clickType: info.getClickType(),
144144
layer: this,
145145
feature: geoFeature,
146146
featureId: geoFeature.id,
@@ -236,7 +236,7 @@ export abstract class BaseVectorLayer<T extends com.carto.layers.VectorLayer, U
236236
}
237237
return (
238238
this.elementListener.onVectorElementClicked.call(this.elementListener, {
239-
clickType: info.getClickType().swigValue(),
239+
clickType: info.getClickType(),
240240
layer: this,
241241
element,
242242
metaData: element.metaData,
@@ -323,7 +323,7 @@ export class EditableVectorLayer extends BaseVectorLayer<com.carto.layers.Editab
323323
element: new VectorElement(undefined, dragInfo.getVectorElement()),
324324
position: fromNativeMapPos(dragInfo.getMapPos()),
325325
screenPosition: fromNativeScreenPos(dragInfo.getScreenPos()),
326-
dragMode: dragInfo.getDragMode().swigValue()
326+
dragMode: dragInfo.getDragMode()
327327
});
328328
}
329329
return com.carto.layers.VectorElementDragResult.VECTOR_ELEMENT_DRAG_RESULT_IGNORE;
@@ -336,7 +336,7 @@ export class EditableVectorLayer extends BaseVectorLayer<com.carto.layers.Editab
336336
element: new VectorElement(undefined, dragInfo.getVectorElement()),
337337
position: fromNativeMapPos(dragInfo.getMapPos()),
338338
screenPosition: fromNativeScreenPos(dragInfo.getScreenPos()),
339-
dragMode: dragInfo.getDragMode().swigValue()
339+
dragMode: dragInfo.getDragMode()
340340
});
341341
}
342342
return com.carto.layers.VectorElementDragResult.VECTOR_ELEMENT_DRAG_RESULT_IGNORE;
@@ -349,7 +349,7 @@ export class EditableVectorLayer extends BaseVectorLayer<com.carto.layers.Editab
349349
element: new VectorElement(undefined, dragInfo.getVectorElement()),
350350
position: fromNativeMapPos(dragInfo.getMapPos()),
351351
screenPosition: fromNativeScreenPos(dragInfo.getScreenPos()),
352-
dragMode: dragInfo.getDragMode().swigValue()
352+
dragMode: dragInfo.getDragMode()
353353
});
354354
}
355355
return com.carto.layers.VectorElementDragResult.VECTOR_ELEMENT_DRAG_RESULT_IGNORE;

src/ui-carto/ui/index.android.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export class CartoMap<T = DefaultLatLonKeys> extends CartoViewBase {
171171
};
172172
},
173173
get clickType() {
174-
return mapClickInfo.getClickType().swigValue();
174+
return mapClickInfo.getClickType();
175175
},
176176
get position() {
177177
return fromNativeMapPos(mapClickInfo.getClickPos());

src/ui-carto/vectorelements/index.android.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@ export { BaseVectorElementStyleBuilder };
1111

1212
export const BillboardOrientation = {
1313
get FACE_CAMERA() {
14-
return com.carto.styles.BillboardOrientation.BILLBOARD_ORIENTATION_FACE_CAMERA.swigValue();
14+
return com.carto.styles.BillboardOrientation.BILLBOARD_ORIENTATION_FACE_CAMERA;
1515
},
1616
get FACE_CAMERA_GROUND() {
17-
return com.carto.styles.BillboardOrientation.BILLBOARD_ORIENTATION_FACE_CAMERA_GROUND.swigValue();
17+
return com.carto.styles.BillboardOrientation.BILLBOARD_ORIENTATION_FACE_CAMERA_GROUND;
1818
},
1919
get GROUND() {
20-
return com.carto.styles.BillboardOrientation.BILLBOARD_ORIENTATION_GROUND.swigValue();
20+
return com.carto.styles.BillboardOrientation.BILLBOARD_ORIENTATION_GROUND;
2121
}
2222
};
2323

2424
export const BillboardScaling = {
2525
get CONST_SCREEN_SIZE() {
26-
return com.carto.styles.BillboardScaling.BILLBOARD_SCALING_CONST_SCREEN_SIZE.swigValue();
26+
return com.carto.styles.BillboardScaling.BILLBOARD_SCALING_CONST_SCREEN_SIZE;
2727
},
2828
get SCREEN_SIZE() {
29-
return com.carto.styles.BillboardScaling.BILLBOARD_SCALING_SCREEN_SIZE.swigValue();
29+
return com.carto.styles.BillboardScaling.BILLBOARD_SCALING_SCREEN_SIZE;
3030
},
3131
get WORLD_SIZE() {
32-
return com.carto.styles.BillboardScaling.BILLBOARD_SCALING_WORLD_SIZE.swigValue();
32+
return com.carto.styles.BillboardScaling.BILLBOARD_SCALING_WORLD_SIZE;
3333
}
3434
};
3535

src/ui-carto/vectorelements/line.android.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@ export { MapBounds };
99

1010
export const LineJointType = {
1111
get BEVEL() {
12-
return com.carto.styles.LineJoinType.LINE_JOIN_TYPE_BEVEL.swigValue();
12+
return com.carto.styles.LineJoinType.LINE_JOIN_TYPE_BEVEL;
1313
},
1414
get MITER() {
15-
return com.carto.styles.LineJoinType.LINE_JOIN_TYPE_MITER.swigValue();
15+
return com.carto.styles.LineJoinType.LINE_JOIN_TYPE_MITER;
1616
},
1717
get NONE() {
18-
return com.carto.styles.LineJoinType.LINE_JOIN_TYPE_NONE.swigValue();
18+
return com.carto.styles.LineJoinType.LINE_JOIN_TYPE_NONE;
1919
},
2020
get ROUND() {
21-
return com.carto.styles.LineJoinType.LINE_JOIN_TYPE_ROUND.swigValue();
21+
return com.carto.styles.LineJoinType.LINE_JOIN_TYPE_ROUND;
2222
}
2323
};
2424

2525
export const LineEndType = {
2626
get ROUND() {
27-
return com.carto.styles.LineEndType.LINE_END_TYPE_ROUND.swigValue();
27+
return com.carto.styles.LineEndType.LINE_END_TYPE_ROUND;
2828
},
2929
get SQUARE() {
30-
return com.carto.styles.LineEndType.LINE_END_TYPE_SQUARE.swigValue();
30+
return com.carto.styles.LineEndType.LINE_END_TYPE_SQUARE;
3131
},
3232
get NONE() {
33-
return com.carto.styles.LineEndType.LINE_END_TYPE_NONE.swigValue();
33+
return com.carto.styles.LineEndType.LINE_END_TYPE_NONE;
3434
}
3535
};
3636
export class LineStyleBuilder extends BaseVectorElementStyleBuilder<com.carto.styles.LineStyleBuilder, LineStyleBuilderOptions> {
@@ -40,16 +40,14 @@ export class LineStyleBuilder extends BaseVectorElementStyleBuilder<com.carto.st
4040

4141
@nativeProperty width: number;
4242
@nativeColorProperty color: Color | string;
43-
@nativeAndroidEnumProperty(com.carto.styles.LineJoinType, {
43+
@nativeProperty({
4444
nativeSetterName: 'setLineJoinType',
4545
nativeGetterName: 'getLineJoinType'
46-
})
47-
joinType: ILineJointType;
48-
@nativeAndroidEnumProperty(com.carto.styles.LineEndType, {
46+
}) joinType: ILineJointType;
47+
@nativeProperty({
4948
nativeSetterName: 'setLineEndType',
5049
nativeGetterName: 'getLineEndType'
51-
})
52-
endType: ILineEndType;
50+
}) endType: ILineEndType;
5351
@nativeProperty clickWidth: number;
5452
@nativeProperty stretchFactor: number;
5553

src/ui-carto/vectorelements/marker.android.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export class MarkerStyleBuilder extends BillboardStyleBuilder<com.carto.styles.M
1818
@nativeProperty anchorPointX: number;
1919
@nativeProperty anchorPointY: number;
2020
@nativeProperty clickSize: number;
21-
@nativeAndroidEnumProperty(com.carto.styles.BillboardScaling, {}) scalingMode: BillboardScaling;
22-
@nativeAndroidEnumProperty(com.carto.styles.BillboardOrientation, {}) orientationMode: BillboardOrientation;
21+
@nativeProperty scalingMode: BillboardScaling;
22+
@nativeProperty orientationMode: BillboardOrientation;
2323

2424
mBuildStyle: com.carto.styles.MarkerStyle;
2525
buildStyle() {

src/ui-carto/vectorelements/text.android.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class TextStyleBuilder extends BillboardStyleBuilder<com.carto.styles.Tex
1313
}
1414
@nativeProperty fontSize: number;
1515
@nativeProperty fontName: string;
16-
@nativeAndroidEnumProperty(com.carto.styles.BillboardOrientation, {}) orientationMode: BillboardOrientation;
16+
@nativeProperty orientationMode: BillboardOrientation;
1717
@nativeProperty breakLines: boolean;
1818
@nativeProperty textField: string;
1919
@nativeProperty strokeWidth: number;

0 commit comments

Comments
 (0)