hide the LocationIndicatorLayer impl
This commit is contained in:
@@ -26,7 +26,7 @@ const lightProperties = Object.keys(spec[`light`]).reduce((memo, name) => {
|
||||
// Collect layer types from spec
|
||||
var layers = Object.keys(spec.layer.type.values).map((type) => {
|
||||
const layoutProperties = Object.keys(spec[`layout_${type}`]).reduce((memo, name) => {
|
||||
if (name !== 'visibility') {
|
||||
if (name !== 'visibility' && type !== 'location-indicator') {
|
||||
spec[`layout_${type}`][name].name = name;
|
||||
memo.push(spec[`layout_${type}`][name]);
|
||||
}
|
||||
@@ -34,8 +34,26 @@ var layers = Object.keys(spec.layer.type.values).map((type) => {
|
||||
}, []);
|
||||
|
||||
const paintProperties = Object.keys(spec[`paint_${type}`]).reduce((memo, name) => {
|
||||
spec[`paint_${type}`][name].name = name;
|
||||
memo.push(spec[`paint_${type}`][name]);
|
||||
if (type !== 'location-indicator') {
|
||||
spec[`paint_${type}`][name].name = name;
|
||||
memo.push(spec[`paint_${type}`][name]);
|
||||
}
|
||||
return memo;
|
||||
}, []);
|
||||
|
||||
const locationLayoutProperties = Object.keys(spec[`layout_${type}`]).reduce((memo, name) => {
|
||||
if (name !== 'visibility' && type === 'location-indicator') {
|
||||
spec[`layout_${type}`][name].name = name;
|
||||
memo.push(spec[`layout_${type}`][name]);
|
||||
}
|
||||
return memo;
|
||||
}, []);
|
||||
|
||||
const locationPaintProperties = Object.keys(spec[`paint_${type}`]).reduce((memo, name) => {
|
||||
if (type === 'location-indicator') {
|
||||
spec[`paint_${type}`][name].name = name;
|
||||
memo.push(spec[`paint_${type}`][name]);
|
||||
}
|
||||
return memo;
|
||||
}, []);
|
||||
|
||||
@@ -44,7 +62,9 @@ var layers = Object.keys(spec.layer.type.values).map((type) => {
|
||||
doc: spec.layer.type.values[type].doc,
|
||||
layoutProperties: layoutProperties,
|
||||
paintProperties: paintProperties,
|
||||
properties: layoutProperties.concat(paintProperties)
|
||||
locationLayoutProperties: locationLayoutProperties,
|
||||
locationPaintProperties: locationPaintProperties,
|
||||
properties: layoutProperties.concat(paintProperties).concat(locationLayoutProperties).concat(locationPaintProperties)
|
||||
};
|
||||
});
|
||||
|
||||
@@ -57,6 +77,8 @@ const uniqueArrayEnum = (prop, enums) => {
|
||||
|
||||
const layoutProperties = _(layers).map('layoutProperties').flatten().value();
|
||||
const paintProperties = _(layers).map('paintProperties').flatten().value();
|
||||
const locationLayoutProperties = _(layers).map('locationLayoutProperties').flatten().value();
|
||||
const locationPaintProperties = _(layers).map('locationPaintProperties').flatten().value();
|
||||
const allProperties = _(layoutProperties).union(paintProperties).union(lightProperties).value();
|
||||
let allEnumProperties = _(allProperties).filter({'type': 'enum'}).value();
|
||||
const uniqueArrayEnumProperties = _(allProperties).filter({'type': 'array'}).filter(prop => uniqueArrayEnum(prop, allEnumProperties)).value();
|
||||
@@ -391,8 +413,15 @@ const layerJava = ejs.compile(fs.readFileSync('MapboxGLAndroidSDK/src/main/java/
|
||||
const layerJavaUnitTests = ejs.compile(fs.readFileSync('MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs', 'utf8'), {strict: true});
|
||||
|
||||
for (const layer of layers) {
|
||||
writeIfModified(`MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/${camelize(layer.type)}Layer.java`, layerJava(layer));
|
||||
writeIfModified(`MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/${camelize(layer.type)}LayerTest.java`, layerJavaUnitTests(layer));
|
||||
var srcDir = 'MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/'
|
||||
var testDir = 'MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/'
|
||||
if (layer.type === 'location-indicator') {
|
||||
srcDir = 'MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/'
|
||||
testDir = 'MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/'
|
||||
}
|
||||
|
||||
writeIfModified(srcDir + `${camelize(layer.type)}Layer.java`, layerJava(layer));
|
||||
writeIfModified(testDir + `${camelize(layer.type)}LayerTest.java`, layerJavaUnitTests(layer));
|
||||
}
|
||||
|
||||
// Jni
|
||||
@@ -407,10 +436,18 @@ for (const layer of layers) {
|
||||
}
|
||||
|
||||
// Java PropertyFactory
|
||||
const propertiesTemplate = ejs.compile(fs.readFileSync('MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs', 'utf8'), {strict: true});
|
||||
const propertyFactoryTemplate = ejs.compile(fs.readFileSync('MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs', 'utf8'), {strict: true});
|
||||
|
||||
var propertyFactorySrcDir = 'MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java'
|
||||
writeIfModified(
|
||||
`MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java`,
|
||||
propertiesTemplate({layoutProperties: layoutProperties, paintProperties: paintProperties})
|
||||
propertyFactorySrcDir,
|
||||
propertyFactoryTemplate({layoutProperties: layoutProperties, paintProperties: paintProperties, locationIndicator: false})
|
||||
);
|
||||
|
||||
var locationPropertyFactorySrcDir = 'MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationPropertyFactory.java'
|
||||
writeIfModified(
|
||||
locationPropertyFactorySrcDir,
|
||||
propertyFactoryTemplate({layoutProperties: locationLayoutProperties, paintProperties: locationPaintProperties, locationIndicator: true})
|
||||
);
|
||||
|
||||
// Java Property
|
||||
|
||||
Reference in New Issue
Block a user