From 977bb792cbc5ba067b10df9161feaafec009a033 Mon Sep 17 00:00:00 2001 From: Keith Wansbrough Date: Thu, 12 Nov 2015 23:33:38 +0000 Subject: [PATCH] Expose new s= URL parameter in MWMPoint. --- README.html | 2 +- README.md | 2 +- lib/src/com/mapswithme/maps/api/MWMPoint.java | 23 ++++++++++++++++++- .../com/mapswithme/maps/api/MwmRequest.java | 1 + 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/README.html b/README.html index 69c0475..f22c6e3 100644 --- a/README.html +++ b/README.html @@ -38,7 +38,7 @@ You don't need any additional permissions in your AndroidManifest.xml to use diff --git a/README.md b/README.md index 22d328c..8463169 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ You don't need any additional permissions in your AndroidManifest.xml to use API Core classes you will work with are: * [com.mapswithme.maps.api.MapsWithMeApi][linkApiClass] - static class with methods such as `showPointOnMap(Activity, double, double, String)` etc. -* [com.mapswithme.maps.api.MWMPoint][linkPointClass] - model of POI, includes lat, lon, name, and id data. +* [com.mapswithme.maps.api.MWMPoint][linkPointClass] - model of POI, includes lat, lon, name, id, and style data. * [com.mapswithme.maps.api.MWMResponse][linkRespClass] - helps you to extract response from MapsWithMe by applying `MWMResponse.extractFromIntent(Intent)` to Intent. Contains MWMPoint data. ### Show Points on the Map diff --git a/lib/src/com/mapswithme/maps/api/MWMPoint.java b/lib/src/com/mapswithme/maps/api/MWMPoint.java index 86fa39a..698038f 100644 --- a/lib/src/com/mapswithme/maps/api/MWMPoint.java +++ b/lib/src/com/mapswithme/maps/api/MWMPoint.java @@ -37,6 +37,7 @@ public final class MWMPoint implements Serializable final private double mLon; final private String mName; private String mId; + private String mStyle; public MWMPoint(double lat, double lon, String name) { @@ -51,10 +52,20 @@ public final class MWMPoint implements Serializable this.mId = id; } + public MWMPoint(double lat, double lon, String name, String id, String style) + { + this.mLat = lat; + this.mLon = lon; + this.mName = name; + this.mId = id; + this.mStyle = style; + } + public double getLat() { return mLat; } public double getLon() { return mLon; } public String getName() { return mName; } public String getId() { return mId; } + public String getStyle() { return mStyle; } /** * Sets string ID for this point. Internally it is not used to distinguish point, @@ -63,10 +74,20 @@ public final class MWMPoint implements Serializable */ public void setId(String id) { mId = id; } + /** + * Sets the style (appearance) for this point. Null, empty-string or unrecognized appears as a + * violet circle. Styles known to MAPS.ME appear with the appropriate symbol. At the time of + * writing, supported styles are "placemark-red", "placemark-blue", "placemark-purple", + * "placemark-yellow", "placemark-pink", "placemark-brown", "placemark-green", "placemark-orange", + * all of which are displayed as a small flag of the indicated colour. + * @param style + */ + public void setStyle(String style) { mId = style; } + @Override public String toString() { - return "MWMPoint [lat=" + mLat + ", lon=" + mLon + ", name=" + mName + ", id=" + mId + "]"; + return "MWMPoint [lat=" + mLat + ", lon=" + mLon + ", name=" + mName + ", id=" + mId + ", style=" + mStyle + "]"; } @Override diff --git a/lib/src/com/mapswithme/maps/api/MwmRequest.java b/lib/src/com/mapswithme/maps/api/MwmRequest.java index 7a2335d..7cf2eba 100644 --- a/lib/src/com/mapswithme/maps/api/MwmRequest.java +++ b/lib/src/com/mapswithme/maps/api/MwmRequest.java @@ -137,6 +137,7 @@ public class MwmRequest appendIfNotNull(urlBuilder, "n", point.getName()); appendIfNotNull(urlBuilder, "id", point.getId()); + appendIfNotNull(urlBuilder, "s", point.getStyle()); } }