Merge branch 'master' of github.com:mapbox/carto
This commit is contained in:
commit
dc798c0e07
96
bin/carto
96
bin/carto
@ -1,9 +1,13 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
var path = require('path'),
|
var path = require('path');
|
||||||
fs = require('fs'),
|
var fs = require('fs');
|
||||||
util = require('util'),
|
var util = require('util');
|
||||||
carto = require('carto');
|
var carto = require('carto');
|
||||||
|
|
||||||
|
var url = require('url');
|
||||||
|
var _ = require('underscore');
|
||||||
|
var existsSync = require('fs').existsSync || require('path').existsSync
|
||||||
|
|
||||||
var args = process.argv.slice(1);
|
var args = process.argv.slice(1);
|
||||||
var options = { nosymlink:false };
|
var options = { nosymlink:false };
|
||||||
@ -28,7 +32,6 @@ args = args.filter(function (arg) {
|
|||||||
case 'nosymlink':
|
case 'nosymlink':
|
||||||
options.nosymlink = true;
|
options.nosymlink = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
util.puts("Usage: carto <source MML file>");
|
util.puts("Usage: carto <source MML file>");
|
||||||
util.puts("Options:");
|
util.puts("Options:");
|
||||||
@ -54,37 +57,18 @@ if (options.benchmark) {
|
|||||||
var start = +new Date;
|
var start = +new Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
var ext = path.extname(input);
|
||||||
var data = fs.readFileSync(input, 'utf-8');
|
|
||||||
} catch(err) {
|
if (!ext) {
|
||||||
util.puts("carto: " + err.message.replace(/^[A-Z]+, /, ''));
|
util.puts("carto: please pass either a .mml file or .mss file");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (!existsSync(input)) {
|
||||||
data = JSON.parse(data);
|
util.puts("carto: file does not exist: '" + input + "'");
|
||||||
} catch(err) {
|
|
||||||
util.puts("carto: " + err.message.replace(/^[A-Z]+, /, ''));
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var millstone = undefined;
|
|
||||||
|
|
||||||
try {
|
|
||||||
require.resolve('millstone');
|
|
||||||
millstone = require('millstone');
|
|
||||||
} catch (err) {
|
|
||||||
util.puts('carto: Millstone not found. ' + err.message.replace(/^[A-Z]+, /, ''));
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
millstone.resolve({
|
|
||||||
mml: data,
|
|
||||||
base: path.dirname(input),
|
|
||||||
cache: path.join(path.dirname(input), 'cache'),
|
|
||||||
nosymlink: options.nosymlink
|
|
||||||
}, compile);
|
|
||||||
|
|
||||||
function compile(err, data) {
|
function compile(err, data) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
try {
|
try {
|
||||||
@ -113,3 +97,55 @@ function compile(err, data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
var data = fs.readFileSync(input, 'utf-8');
|
||||||
|
} catch(err) {
|
||||||
|
util.puts("carto: " + err.message.replace(/^[A-Z]+, /, ''));
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ext == '.mml') {
|
||||||
|
try {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
} catch(err) {
|
||||||
|
util.puts("carto: " + err.message.replace(/^[A-Z]+, /, ''));
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var millstone = undefined;
|
||||||
|
try {
|
||||||
|
require.resolve('millstone');
|
||||||
|
millstone = require('millstone');
|
||||||
|
} catch (err) {
|
||||||
|
util.puts('carto: Millstone not found. ' + err.message.replace(/^[A-Z]+, /, ''));
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
millstone.resolve({
|
||||||
|
mml: data,
|
||||||
|
base: path.dirname(input),
|
||||||
|
cache: path.join(path.dirname(input), 'cache'),
|
||||||
|
nosymlink: options.nosymlink
|
||||||
|
}, compile);
|
||||||
|
} else if (ext == '.mss') {
|
||||||
|
var env = _({}).defaults({
|
||||||
|
benchmark: false,
|
||||||
|
validation_data: false,
|
||||||
|
effects: []
|
||||||
|
});
|
||||||
|
var output = [];
|
||||||
|
var parser = (carto.Parser(env)).parse(data);
|
||||||
|
var rules = parser.toList(env);
|
||||||
|
var inherited = carto.inheritRules(rules,env);
|
||||||
|
var sorted = carto.sortStyles(inherited,env);
|
||||||
|
_(sorted).each(function(rule) {
|
||||||
|
var style = new carto.tree.Style('layer', rule.attachment, rule);
|
||||||
|
if (style) {
|
||||||
|
// env.effects can be modified by this call
|
||||||
|
output.push(style.toXML(env));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(output.join('\n'));
|
||||||
|
} else {
|
||||||
|
util.puts("carto: please pass either a .mml file or .mss file");
|
||||||
|
}
|
||||||
|
@ -587,11 +587,11 @@ carto.Parser = function Parser(env) {
|
|||||||
// and can be found inside a rule's value.
|
// and can be found inside a rule's value.
|
||||||
//
|
//
|
||||||
entity: function() {
|
entity: function() {
|
||||||
return $(this.entities.literal) ||
|
return $(this.entities.call) ||
|
||||||
|
$(this.entities.literal) ||
|
||||||
$(this.entities.field) ||
|
$(this.entities.field) ||
|
||||||
$(this.entities.variable) ||
|
$(this.entities.variable) ||
|
||||||
$(this.entities.url) ||
|
$(this.entities.url) ||
|
||||||
$(this.entities.call) ||
|
|
||||||
$(this.entities.keyword);
|
$(this.entities.keyword);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -722,7 +722,7 @@ carto.Parser = function Parser(env) {
|
|||||||
var name, value, c = input.charAt(i);
|
var name, value, c = input.charAt(i);
|
||||||
save();
|
save();
|
||||||
|
|
||||||
if (c === '.' || c === '#' || c === '&') { return }
|
if (c === '.' || c === '#') { return; }
|
||||||
|
|
||||||
if (name = $(this.variable) || $(this.property)) {
|
if (name = $(this.variable) || $(this.property)) {
|
||||||
value = $(this.value);
|
value = $(this.value);
|
||||||
|
@ -31,6 +31,9 @@ carto.Renderer.prototype.render = function render(m, callback) {
|
|||||||
// Transform stylesheets into rulesets.
|
// Transform stylesheets into rulesets.
|
||||||
var rulesets = _(m.Stylesheet).chain()
|
var rulesets = _(m.Stylesheet).chain()
|
||||||
.map(function(s) {
|
.map(function(s) {
|
||||||
|
if (typeof s == 'string') {
|
||||||
|
throw new Error("Stylesheet object is expected not a string: '" + s + "'");
|
||||||
|
}
|
||||||
// Passing the environment from stylesheet to stylesheet,
|
// Passing the environment from stylesheet to stylesheet,
|
||||||
// allows frames and effects to be maintained.
|
// allows frames and effects to be maintained.
|
||||||
env = _(env).extend({filename:s.id});
|
env = _(env).extend({filename:s.id});
|
||||||
@ -215,6 +218,9 @@ function inheritRules(definitions, env) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort styles by the minimum index of their rules.
|
||||||
|
// This sorts a slice of the styles, so it returns a sorted
|
||||||
|
// array but does not change the input.
|
||||||
function sortStyles(styles, env) {
|
function sortStyles(styles, env) {
|
||||||
styles.forEach(function(style) {
|
styles.forEach(function(style) {
|
||||||
style.index = Infinity;
|
style.index = Infinity;
|
||||||
@ -270,3 +276,6 @@ function getMapProperties(m, rulesets, env) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = carto;
|
module.exports = carto;
|
||||||
|
module.exports.addRules = addRules;
|
||||||
|
module.exports.inheritRules = inheritRules;
|
||||||
|
module.exports.sortStyles = sortStyles;
|
||||||
|
@ -8,8 +8,9 @@ tree.Ruleset = function Ruleset(selectors, rules) {
|
|||||||
this.is = 'ruleset';
|
this.is = 'ruleset';
|
||||||
};
|
};
|
||||||
tree.Ruleset.prototype = {
|
tree.Ruleset.prototype = {
|
||||||
eval: function(env) {
|
'eval': function(env) {
|
||||||
var ruleset = new tree.Ruleset(this.selectors, this.rules.slice(0));
|
var i,
|
||||||
|
ruleset = new tree.Ruleset(this.selectors, this.rules.slice(0));
|
||||||
ruleset.root = this.root;
|
ruleset.root = this.root;
|
||||||
|
|
||||||
// push the current ruleset to the frames stack
|
// push the current ruleset to the frames stack
|
||||||
@ -17,7 +18,7 @@ tree.Ruleset.prototype = {
|
|||||||
|
|
||||||
// Evaluate imports
|
// Evaluate imports
|
||||||
if (ruleset.root) {
|
if (ruleset.root) {
|
||||||
for (var i = 0; i < ruleset.rules.length; i++) {
|
for (i = 0; i < ruleset.rules.length; i++) {
|
||||||
if (ruleset.rules[i] instanceof tree.Import) {
|
if (ruleset.rules[i] instanceof tree.Import) {
|
||||||
Array.prototype.splice
|
Array.prototype.splice
|
||||||
.apply(ruleset.rules, [i, 1].concat(ruleset.rules[i].eval(env)));
|
.apply(ruleset.rules, [i, 1].concat(ruleset.rules[i].eval(env)));
|
||||||
@ -26,7 +27,7 @@ tree.Ruleset.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Evaluate everything else
|
// Evaluate everything else
|
||||||
for (var i = 0, rule; i < ruleset.rules.length; i++) {
|
for (i = 0, rule; i < ruleset.rules.length; i++) {
|
||||||
rule = ruleset.rules[i];
|
rule = ruleset.rules[i];
|
||||||
ruleset.rules[i] = rule.eval ? rule.eval(env) : rule;
|
ruleset.rules[i] = rule.eval ? rule.eval(env) : rule;
|
||||||
}
|
}
|
||||||
@ -71,7 +72,8 @@ tree.Ruleset.prototype = {
|
|||||||
this.rulesets().forEach(function(rule) {
|
this.rulesets().forEach(function(rule) {
|
||||||
if (rule !== self) {
|
if (rule !== self) {
|
||||||
for (var j = 0; j < rule.selectors.length; j++) {
|
for (var j = 0; j < rule.selectors.length; j++) {
|
||||||
if (match = selector.match(rule.selectors[j])) {
|
match = selector.match(rule.selectors[j]);
|
||||||
|
if (match) {
|
||||||
if (selector.elements.length > 1) {
|
if (selector.elements.length > 1) {
|
||||||
Array.prototype.push.apply(rules, rule.find(
|
Array.prototype.push.apply(rules, rule.find(
|
||||||
new tree.Selector(null, null, selector.elements.slice(1)), self));
|
new tree.Selector(null, null, selector.elements.slice(1)), self));
|
||||||
@ -86,18 +88,21 @@ tree.Ruleset.prototype = {
|
|||||||
return this._lookups[key] = rules;
|
return this._lookups[key] = rules;
|
||||||
},
|
},
|
||||||
flatten: function(result, parents, env) {
|
flatten: function(result, parents, env) {
|
||||||
var selectors = [];
|
var selectors = [], i, j;
|
||||||
if (this.selectors.length === 0) {
|
if (this.selectors.length === 0) {
|
||||||
env.frames = env.frames.concat(this.rules);
|
env.frames = env.frames.concat(this.rules);
|
||||||
}
|
}
|
||||||
for (var i = 0; i < this.selectors.length; i++) {
|
for (i = 0; i < this.selectors.length; i++) {
|
||||||
var child = this.selectors[i];
|
var child = this.selectors[i];
|
||||||
|
|
||||||
// This is an invalid filterset.
|
if (!child.filters) {
|
||||||
if (!child.filters) continue;
|
// TODO: is this internal inconsistency?
|
||||||
|
// This is an invalid filterset.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (parents.length) {
|
if (parents.length) {
|
||||||
for (var j = 0; j < parents.length; j++) {
|
for (j = 0; j < parents.length; j++) {
|
||||||
var parent = parents[j];
|
var parent = parents[j];
|
||||||
|
|
||||||
var mergedFilters = parent.filters.cloneWith(child.filters);
|
var mergedFilters = parent.filters.cloneWith(child.filters);
|
||||||
@ -106,7 +111,8 @@ tree.Ruleset.prototype = {
|
|||||||
// filters. This means that we only have to clone when
|
// filters. This means that we only have to clone when
|
||||||
// the zoom levels or the attachment is different too.
|
// the zoom levels or the attachment is different too.
|
||||||
if (parent.zoom === (parent.zoom & child.zoom) &&
|
if (parent.zoom === (parent.zoom & child.zoom) &&
|
||||||
parent.attachment === child.attachment) {
|
parent.attachment === child.attachment &&
|
||||||
|
parent.elements.join() === child.elements.join()) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
mergedFilters = parent.filters;
|
mergedFilters = parent.filters;
|
||||||
@ -135,7 +141,7 @@ tree.Ruleset.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var rules = [];
|
var rules = [];
|
||||||
for (var i = 0; i < this.rules.length; i++) {
|
for (i = 0; i < this.rules.length; i++) {
|
||||||
var rule = this.rules[i];
|
var rule = this.rules[i];
|
||||||
|
|
||||||
if (rule instanceof tree.Ruleset) {
|
if (rule instanceof tree.Ruleset) {
|
||||||
@ -148,7 +154,7 @@ tree.Ruleset.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var index = rules.length ? rules[0].index : false;
|
var index = rules.length ? rules[0].index : false;
|
||||||
for (var i = 0; i < selectors.length; i++) {
|
for (i = 0; i < selectors.length; i++) {
|
||||||
// For specificity sort, use the position of the first rule to allow
|
// For specificity sort, use the position of the first rule to allow
|
||||||
// defining attachments that are under current element as a descendant
|
// defining attachments that are under current element as a descendant
|
||||||
// selector.
|
// selector.
|
||||||
|
27
test/rendering/combined_class.mml
Normal file
27
test/rendering/combined_class.mml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||||
|
"Stylesheet": [
|
||||||
|
"combined_class.mss"
|
||||||
|
],
|
||||||
|
"Layer": [
|
||||||
|
{
|
||||||
|
"name": "just_land",
|
||||||
|
"class": "land",
|
||||||
|
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||||
|
"Datasource": {
|
||||||
|
"file": "http://tilemill-data.s3.amazonaws.com/test_data/shape_demo.zip",
|
||||||
|
"type": "shape"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "lakes",
|
||||||
|
"id": "lakes",
|
||||||
|
"class": "land",
|
||||||
|
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||||
|
"Datasource": {
|
||||||
|
"file": "http://tilemill-data.s3.amazonaws.com/test_data/shape_demo.zip",
|
||||||
|
"type": "shape"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
11
test/rendering/combined_class.mss
Normal file
11
test/rendering/combined_class.mss
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/* Applies to all layers with .land class */
|
||||||
|
.land {
|
||||||
|
line-color: #ccc;
|
||||||
|
line-width: 0.5;
|
||||||
|
polygon-fill: #eee;
|
||||||
|
}
|
||||||
|
.land#lakes {
|
||||||
|
line-color: #ccc;
|
||||||
|
line-width: 0.5;
|
||||||
|
polygon-fill: #000;
|
||||||
|
}
|
36
test/rendering/combined_class.result
Normal file
36
test/rendering/combined_class.result
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE Map[]>
|
||||||
|
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
|
||||||
|
|
||||||
|
|
||||||
|
<Style name="just_land" filter-mode="first" >
|
||||||
|
<Rule>
|
||||||
|
<LineSymbolizer stroke="#cccccc" stroke-width="0.5" />
|
||||||
|
<PolygonSymbolizer fill="#eeeeee" />
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
<Layer name="just_land"
|
||||||
|
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
||||||
|
<StyleName>just_land</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="file"><![CDATA[[absolute path]]]></Parameter>
|
||||||
|
<Parameter name="type"><![CDATA[shape]]></Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
<Style name="lakes" filter-mode="first" >
|
||||||
|
<Rule>
|
||||||
|
<LineSymbolizer stroke="#cccccc" stroke-width="0.5" />
|
||||||
|
<PolygonSymbolizer fill="#000000" />
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
<Layer name="lakes"
|
||||||
|
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
||||||
|
<StyleName>lakes</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="file"><![CDATA[[absolute path]]]></Parameter>
|
||||||
|
<Parameter name="type"><![CDATA[shape]]></Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
</Map>
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!DOCTYPE Map[]>
|
<!DOCTYPE Map[]>
|
||||||
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
|
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
|
||||||
|
|
||||||
|
|
||||||
<Style name="world" filter-mode="first">
|
<Style name="world" filter-mode="first">
|
||||||
@ -45,22 +45,22 @@
|
|||||||
<Rule>
|
<Rule>
|
||||||
<MinScaleDenominator>12500000</MinScaleDenominator>
|
<MinScaleDenominator>12500000</MinScaleDenominator>
|
||||||
<Filter>([NAME] = 'United States')</Filter>
|
<Filter>([NAME] = 'United States')</Filter>
|
||||||
<PolygonSymbolizer fill="#eeeeee" />
|
|
||||||
<LineSymbolizer stroke="#cccccc" stroke-width="1" />
|
<LineSymbolizer stroke="#cccccc" stroke-width="1" />
|
||||||
|
<PolygonSymbolizer fill="#cccccc" />
|
||||||
</Rule>
|
</Rule>
|
||||||
<Rule>
|
<Rule>
|
||||||
<MaxScaleDenominator>12500000</MaxScaleDenominator>
|
<MaxScaleDenominator>12500000</MaxScaleDenominator>
|
||||||
<PolygonSymbolizer fill="#eeeeee" />
|
|
||||||
<LineSymbolizer stroke-width="0.5" stroke="#cccccc" />
|
<LineSymbolizer stroke-width="0.5" stroke="#cccccc" />
|
||||||
|
<PolygonSymbolizer fill="#cccccc" />
|
||||||
</Rule>
|
</Rule>
|
||||||
<Rule>
|
<Rule>
|
||||||
<MinScaleDenominator>12500000</MinScaleDenominator>
|
<MinScaleDenominator>12500000</MinScaleDenominator>
|
||||||
<PolygonSymbolizer fill="#eeeeee" />
|
|
||||||
<LineSymbolizer stroke="#cccccc" stroke-width="1" />
|
<LineSymbolizer stroke="#cccccc" stroke-width="1" />
|
||||||
|
<PolygonSymbolizer fill="#cccccc" />
|
||||||
</Rule>
|
</Rule>
|
||||||
</Style>
|
</Style>
|
||||||
<Layer name="countries"
|
<Layer name="countries"
|
||||||
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
||||||
<StyleName>countries</StyleName>
|
<StyleName>countries</StyleName>
|
||||||
<Datasource>
|
<Datasource>
|
||||||
<Parameter name="file"><![CDATA[[absolute path]]]></Parameter>
|
<Parameter name="file"><![CDATA[[absolute path]]]></Parameter>
|
||||||
|
14
test/rendering/gray_function.mml
Normal file
14
test/rendering/gray_function.mml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||||
|
"Stylesheet": [
|
||||||
|
"gray_function.mss"
|
||||||
|
],
|
||||||
|
"Layer": [{
|
||||||
|
"name": "world",
|
||||||
|
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||||
|
"Datasource": {
|
||||||
|
"file": "http://tilemill-data.s3.amazonaws.com/test_data/shape_demo.zip",
|
||||||
|
"type": "shape"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
3
test/rendering/gray_function.mss
Normal file
3
test/rendering/gray_function.mss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#world {
|
||||||
|
polygon-fill:gray;
|
||||||
|
}
|
20
test/rendering/gray_function.result
Normal file
20
test/rendering/gray_function.result
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE Map[]>
|
||||||
|
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
|
||||||
|
|
||||||
|
|
||||||
|
<Style name="world" filter-mode="first" >
|
||||||
|
<Rule>
|
||||||
|
<PolygonSymbolizer fill="#808080" />
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
<Layer name="world"
|
||||||
|
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
||||||
|
<StyleName>world</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="file"><![CDATA[[absolute path]]]></Parameter>
|
||||||
|
<Parameter name="type"><![CDATA[shape]]></Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
</Map>
|
27
test/rendering/nesting_class.mml
Normal file
27
test/rendering/nesting_class.mml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||||
|
"Stylesheet": [
|
||||||
|
"nesting_class.mss"
|
||||||
|
],
|
||||||
|
"Layer": [
|
||||||
|
{
|
||||||
|
"name": "foo",
|
||||||
|
"class": "land",
|
||||||
|
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||||
|
"Datasource": {
|
||||||
|
"file": "http://tilemill-data.s3.amazonaws.com/test_data/shape_demo.zip",
|
||||||
|
"type": "shape"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "lakes",
|
||||||
|
"id": "lakes",
|
||||||
|
"class": "land",
|
||||||
|
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
|
||||||
|
"Datasource": {
|
||||||
|
"file": "http://tilemill-data.s3.amazonaws.com/test_data/shape_demo.zip",
|
||||||
|
"type": "shape"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
10
test/rendering/nesting_class.mss
Normal file
10
test/rendering/nesting_class.mss
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/* Applies to all layers with .land class */
|
||||||
|
.land {
|
||||||
|
line-color: #ccc;
|
||||||
|
line-width: 0.5;
|
||||||
|
polygon-fill: #eee;
|
||||||
|
/* Applies to #lakes.land */
|
||||||
|
#lakes {
|
||||||
|
polygon-fill: #000;
|
||||||
|
}
|
||||||
|
}
|
36
test/rendering/nesting_class.result
Normal file
36
test/rendering/nesting_class.result
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE Map[]>
|
||||||
|
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
|
||||||
|
|
||||||
|
|
||||||
|
<Style name="foo" filter-mode="first" >
|
||||||
|
<Rule>
|
||||||
|
<LineSymbolizer stroke="#cccccc" stroke-width="0.5" />
|
||||||
|
<PolygonSymbolizer fill="#eeeeee" />
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
<Layer name="foo"
|
||||||
|
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
||||||
|
<StyleName>foo</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="file"><![CDATA[[absolute path]]]></Parameter>
|
||||||
|
<Parameter name="type"><![CDATA[shape]]></Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
<Style name="lakes" filter-mode="first" >
|
||||||
|
<Rule>
|
||||||
|
<LineSymbolizer stroke="#cccccc" stroke-width="0.5" />
|
||||||
|
<PolygonSymbolizer fill="#000000" />
|
||||||
|
</Rule>
|
||||||
|
</Style>
|
||||||
|
<Layer name="lakes"
|
||||||
|
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
|
||||||
|
<StyleName>lakes</StyleName>
|
||||||
|
<Datasource>
|
||||||
|
<Parameter name="file"><![CDATA[[absolute path]]]></Parameter>
|
||||||
|
<Parameter name="type"><![CDATA[shape]]></Parameter>
|
||||||
|
</Datasource>
|
||||||
|
</Layer>
|
||||||
|
|
||||||
|
</Map>
|
Loading…
Reference in New Issue
Block a user