0
Je suis nouveau dans le développement d'applications Android. J'ai WKT (POLYGON) Comment dessiner un polygone sur google map depuis wkt?Android. Google Map. Comment dessiner un polygone à partir du tableau
J'essaie
String str;
ArrayList<String> coordinates = new ArrayList<String>();
str = tvwkt.getText().toString();
str = str.replaceAll("\\(", "");
str = str.replaceAll("\\)", "");
str = str.replaceAll("POLYGON", "");
str = str.replaceAll("POINT", "");
str = str.replaceAll(", ", ",");
str = str.replaceAll(" ", ",");
str = str.replaceAll(",,", ",");
String[] commatokens = str.split(",");
for (String commatoken : commatokens) {
coordinates.add(commatoken);
}
for (int i = 0; i < coordinates.size(); i++) {
String[] tokens = coordinates.get(i).split("\\s");
for (String token : tokens) {
listPoints.add(token);
}
}
PolygonOptions rectOptions = new PolygonOptions().addAll(listPoints).strokeColor(Color.BLUE).fillColor(Color.CYAN).strokeWidth(7);
polygon = mMap.addPolygon(rectOptions);
Mais son travail ne. Hepl moi s'il vous plaît. merci.
Pouvez-vous s'il vous plaît poster la sortie que vous avez, ou plus précisément ce qui a fait ne fonctionne pas? – Loren