This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[android] #352 - introduced annotation abstract class, removed multip…
…oint from Polyline/Polygon inheritance.
- Loading branch information
Showing
11 changed files
with
179 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...droid/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
* Contains the Mapbox Maps Android Annotation API classes. | ||
* Contains the Mapbox Maps Android AnnotationDefinition API classes. | ||
*/ | ||
package com.mapbox.mapboxsdk.annotations; |
97 changes: 51 additions & 46 deletions
97
...d/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotationsrework/Annotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,56 @@ | ||
package com.mapbox.mapboxsdk.annotationsrework; | ||
|
||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
import com.mapbox.mapboxsdk.maps.MapboxMap; | ||
|
||
/** | ||
* The Annotation protocol is used to provide annotation-related information | ||
* to a map view. To use this protocol, you adopt it in any custom objects that | ||
* store or represent annotation data. Each object then serves as the source of | ||
* information about a single map annotation and provides critical information, | ||
* such as the annotation’s location on the map. Annotation objects do not provide | ||
* the visual representation of the annotation but typically coordinate (in | ||
* conjunction with the map view’s delegate) the creation of an appropriate | ||
* objects to handle the display. | ||
* <p> | ||
* An object that adopts this protocol must implement the `coordinate` property. | ||
* </p> | ||
* <p> | ||
* The other methods of this protocol are optional. | ||
* </p> | ||
*/ | ||
public interface Annotation { | ||
|
||
// /** | ||
// * Returns the center point (specified as a map coordinate) of the annotation. | ||
// * | ||
// * @return center point for an annotation | ||
// */ | ||
// LatLng getCoordinate(); | ||
// | ||
// /** | ||
// * Returns the title of an annotation. | ||
// * <p> | ||
// * Although this property is optional, if you support the selection of annotations | ||
// * in your map view, you are expected to provide this property. This string is | ||
// * displayed in the {@link com.mapbox.mapboxsdk.annotations.InfoWindow} for the associated annotation. | ||
// * </p> | ||
// * | ||
// * @return title used for an annotation. | ||
// */ | ||
// String getTitle(); | ||
// | ||
// /** | ||
// * Returns the snippet of an annotation. | ||
// * <p> | ||
// * This string is displayed in the {@link com.mapbox.mapboxsdk.annotations.InfoWindow} for the associated annotation. | ||
// * <p/> | ||
// * | ||
// * @return snippet used for an annotation and shown in an InfoWindow | ||
// */ | ||
// String getSnippet(); | ||
public class Annotation implements AnnotationDefinition { | ||
|
||
private long id = -1; | ||
private LatLng coordinate; | ||
private String title; | ||
private String snippet; | ||
private MapboxMap mapboxMap; | ||
|
||
public long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(long id) { | ||
this.id = id; | ||
} | ||
|
||
public void setCoordinate(LatLng coordinate) { | ||
this.coordinate = coordinate; | ||
} | ||
|
||
@Override | ||
public LatLng getCoordinate() { | ||
return coordinate; | ||
} | ||
|
||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
@Override | ||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
@Override | ||
public String getSnippet() { | ||
return snippet; | ||
} | ||
|
||
public void setSnippet(String snippet) { | ||
this.snippet = snippet; | ||
} | ||
|
||
public MapboxMap getMapboxMap() { | ||
return mapboxMap; | ||
} | ||
|
||
public void setMapboxMap(MapboxMap mapboxMap) { | ||
this.mapboxMap = mapboxMap; | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...AndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotationsrework/AnnotationDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.mapbox.mapboxsdk.annotationsrework; | ||
|
||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
|
||
/** | ||
* The AnnotationDefinition protocol is used to provide annotation-related information | ||
* to a map view. To use this protocol, you adopt it in any custom objects that | ||
* store or represent annotation data. Each object then serves as the source of | ||
* information about a single map annotation and provides critical information, | ||
* such as the annotation’s location on the map. AnnotationDefinition objects do not provide | ||
* the visual representation of the annotation but typically coordinate (in | ||
* conjunction with the map view’s delegate) the creation of an appropriate | ||
* objects to handle the display. | ||
* <p> | ||
* An object that adopts this protocol must implement the `coordinate` property. | ||
* </p> | ||
* <p> | ||
* The other methods of this protocol are optional. | ||
* </p> | ||
*/ | ||
public interface AnnotationDefinition { | ||
|
||
/** | ||
* Returns the center point (specified as a map coordinate) of the annotation. | ||
* | ||
* @return center point for an annotation | ||
*/ | ||
LatLng getCoordinate(); | ||
|
||
/** | ||
* Returns the title of an annotation. | ||
* <p> | ||
* Although this property is optional, if you support the selection of annotations | ||
* in your map view, you are expected to provide this property. This string is | ||
* displayed in the {@link com.mapbox.mapboxsdk.annotations.InfoWindow} for the associated annotation. | ||
* </p> | ||
* | ||
* @return title used for an annotation. | ||
*/ | ||
String getTitle(); | ||
|
||
/** | ||
* Returns the snippet of an annotation. | ||
* <p> | ||
* This string is displayed in the {@link com.mapbox.mapboxsdk.annotations.InfoWindow} for the associated annotation. | ||
* <p/> | ||
* | ||
* @return snippet used for an annotation and shown in an InfoWindow | ||
*/ | ||
String getSnippet(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 1 addition & 22 deletions
23
...d/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotationsrework/MultiPoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,5 @@ | ||
package com.mapbox.mapboxsdk.annotationsrework; | ||
|
||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
public abstract class MultiPoint extends MultiShape { | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* The `MultiPoint` class is an abstract superclass used to define shapes | ||
* composed of multiple points. You should not create instances of this class | ||
* directly. Instead, you should create instances of the `Polyline` or | ||
* `Polygon` classes. However, you can use the method and properties of this | ||
* class to access information about the specific points associated with the line | ||
* or polygon. | ||
*/ | ||
public abstract class MultiPoint extends Shape { | ||
|
||
private List<LatLng>coordinates; | ||
|
||
public List<LatLng> getCoordinates() { | ||
return coordinates; | ||
} | ||
|
||
public int getSize(){ | ||
return coordinates.size(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...d/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotationsrework/MultiShape.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.mapbox.mapboxsdk.annotationsrework; | ||
|
||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
|
||
import java.util.List; | ||
|
||
public class MultiShape extends Shape{ | ||
|
||
private List<LatLng> coordinates; | ||
|
||
public List<LatLng> getCoordinates() { | ||
return coordinates; | ||
} | ||
|
||
public int getSize(){ | ||
return coordinates.size(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...roid/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotationsrework/Polygon.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
package com.mapbox.mapboxsdk.annotationsrework; | ||
|
||
public class Polygon { | ||
public class Polygon extends MultiShape{ | ||
|
||
} |
3 changes: 2 additions & 1 deletion
3
...oid/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotationsrework/Polyline.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
package com.mapbox.mapboxsdk.annotationsrework; | ||
|
||
public class Polyline extends MultiPoint{ | ||
public class Polyline extends MultiShape{ | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...ndroid/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotationsrework/Shape.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package com.mapbox.mapboxsdk.annotationsrework; | ||
|
||
public abstract class Shape implements Annotation { | ||
public abstract class Shape implements AnnotationDefinition { | ||
|
||
} |