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] data driven style implementation
- Loading branch information
1 parent
0637a63
commit 7a37fdc
Showing
58 changed files
with
7,414 additions
and
5,188 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
50 changes: 50 additions & 0 deletions
50
...MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CameraFunction.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,50 @@ | ||
package com.mapbox.mapboxsdk.style.functions; | ||
|
||
import android.support.annotation.Keep; | ||
import android.support.annotation.NonNull; | ||
|
||
import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops; | ||
import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops; | ||
import com.mapbox.mapboxsdk.style.functions.stops.Stop; | ||
import com.mapbox.mapboxsdk.style.functions.stops.Stops; | ||
|
||
/** | ||
* Camera function. Functions that take camera properties as input (zoom for now) | ||
* <p> | ||
* Zoom functions allow the appearance of a map feature to change with map’s zoom level. | ||
* Zoom functions can be used to create the illusion of depth and control data density. | ||
* Each stop is an array with two elements: the first is a zoom level and the second is | ||
* a function output value. | ||
* | ||
* @param <I> the input type | ||
* @param <O> the output type | ||
* @see Function#zoom | ||
*/ | ||
public class CameraFunction<I extends Number, O> extends Function<I, O> { | ||
|
||
/** | ||
* Create an exponential camera function | ||
* | ||
* @param stops @see {@link com.mapbox.mapboxsdk.style.functions.stops.Stops#exponential(float, Stop[])} | ||
*/ | ||
CameraFunction(@NonNull ExponentialStops<I, O> stops) { | ||
super(stops); | ||
} | ||
|
||
/** | ||
* Create an interval camera function | ||
* | ||
* @param stops @see {@link com.mapbox.mapboxsdk.style.functions.stops.Stops#interval(Stop[])} | ||
*/ | ||
CameraFunction(@NonNull IntervalStops<I, O> stops) { | ||
super(stops); | ||
} | ||
|
||
/** | ||
* JNI constructor | ||
*/ | ||
@Keep | ||
private CameraFunction(Stops<I, O> stops) { | ||
super(stops); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...boxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/CompositeFunction.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,52 @@ | ||
package com.mapbox.mapboxsdk.style.functions; | ||
|
||
import android.support.annotation.NonNull; | ||
|
||
import com.mapbox.mapboxsdk.style.functions.stops.CompositeStops; | ||
import com.mapbox.mapboxsdk.style.functions.stops.Stops; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Composite functions combine {@link android.graphics.Camera} and {@link SourceFunction}s. | ||
* <p> | ||
* Composite functions allow the appearance of a map feature to change with both its | ||
* properties and zoom. Each stop is an array with two elements, the first is an object | ||
* with a property input value and a zoom, and the second is a function output value. Note | ||
* that support for property functions is not yet complete. | ||
* | ||
* @param <Z> the zoom type (usually Float) | ||
* @param <I> the input type (the feature property type) | ||
* @param <O> the output type (the property type) | ||
* @see Function#composite | ||
*/ | ||
public class CompositeFunction<Z extends Number, I, O> extends Function<I, O> { | ||
|
||
private final String property; | ||
|
||
CompositeFunction(@NonNull String property, | ||
@NonNull CompositeStops<Z, I, O, ? extends Stops<I, O>> stops) { | ||
super(stops); | ||
this.property = property; | ||
} | ||
|
||
/** | ||
* INTERNAL USAGE ONLY | ||
* | ||
* @return the feature property name | ||
*/ | ||
public String getProperty() { | ||
return property; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public Map<String, Object> toValueObject() { | ||
Map<String, Object> valueObject = super.toValueObject(); | ||
valueObject.put("property", property); | ||
return valueObject; | ||
} | ||
|
||
} |
Oops, something went wrong.