J'ai actuellement quelques formes de polygones comme indiqué ci-dessous qui est en cours d'élaboration sur mon MapView avec le code suivantAndroid Trouver l'intersection du polygone?
CustomPolygon customPolygon= data.getCustomPolygonList().get(i);
Path path = new Path();
path.setFillType(Path.FillType.EVEN_ODD);
for(int n=0;n<customPolygon.getCorrdinateList().size();n++)
{
GeoPoint sector1 = new GeoPoint((int)(customPolygon.getCorrdinateList().get(n).getLatitude()*1e6), (int)((customPolygon.getCorrdinateList().get(n).getLongitude())*1e6));
if(n==0){
mapView.getProjection().toPixels(sector1, point1_draw);
path.moveTo(point1_draw.x,point1_draw.y);
}else
{
mapView.getProjection().toPixels(sector1, point1_draw);
path.lineTo(point1_draw.x,point1_draw.y);
}
}
path.close();
canvas.drawPath(path, paint);
En ce moment je suis figurant sur comment puis-je savoir si le ONTAP le bouton coupe l'un des polygones. Par exemple, s'il croise l'un des polygones, un message affichera le polygone actuel.
Je suis bloqué à la partie ontap pour la superposition.
@Override
public boolean onTap(GeoPoint p, MapView) {
Point point1_draw = new Point();
mapView.getProjection().toPixels(p, point1_draw);
for (int i =0;i<data.getCustomPolygonList().size();i++)
{
CustomPolygon customPolygon= data.getCustomPolygonList().get(i);
for(int n=0;n<customPolygon.getCorrdinateList().size();n++)
{
}
}
return true;
}
Vous avez un type: 'getCorrdinateList' devrait être' getCoordinateList'. Pour le réparer, cliquez dessus et appuyez sur Ctrl-Maj-R dans la plupart des EDI. –
oh typo, c'est une classe personnalisée pour stocker le polygone coordiner – ericlee