Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] data driven style implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ivovandongen authored and jfirebaugh committed Feb 1, 2017
1 parent 0637a63 commit 7a37fdc
Show file tree
Hide file tree
Showing 58 changed files with 7,414 additions and 5,188 deletions.
3 changes: 3 additions & 0 deletions platform/android/MapboxGLAndroidSDK/gradle-checkstyle.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ task checkstyle(type: Checkstyle) {
source 'src'
include '**/*.java'
exclude '**/gen/**'
exclude '**/style/layers/Property.java'
exclude '**/style/layers/PropertyFactory.java'
exclude '**/style/layers/*Layer.java'
classpath = files()
ignoreFailures = false
}
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);
}
}
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;
}

}
Loading

0 comments on commit 7a37fdc

Please sign in to comment.