I was able to implement the onGesture event on VectorLayer only. Not directly on the CircleDrawable. I created 1000 circles in 1000 vector layers (it wasnt working correctly when I added it to only one vector layer). Now question is how to identify tapped circle when the onGesture event is on VectorLayer?
I want to select a circle and do something e.g. change color... so I need a reference to the CircleDrawable e.g. index...
for (int i = 0; i < 1000; i++) {
VectorLayer vectorLayer = new VectorLayer(mapView.map()) {
@Override
public boolean onGesture(Gesture g, MotionEvent e) {
if (g instanceof Gesture.Tap) {
if (contains(e.getX(), e.getY())) {
Toast.makeText(getApplicationContext(), "VectorLayer tap\n" + mapView.map().viewport().fromScreenPoint(e.getX(), e.getY()), Toast.LENGTH_SHORT).show();
return true;
}
}
return false;
}
};
GeoPoint point = new GeoPoint(48.5 + i/100.0,18.5);
CircleDrawable hillCircle = new CircleDrawable(point, 0.2, c_style);
vectorLayer.add(hillCircle);
Circle_arr.add(hillCircle);
VecLayers_arr.add(vectorLayer);
mapView.map().layers().add(vectorLayer);
}
Circle_arr.get(1).setStyle(b_style);
thank you
Dňa pondelok, 8. júna 2020 16:59:32 UTC+2 Emux napísal(a):