Merge branch 'master' of github.com:mapbox/carto

This commit is contained in:
Will White 2011-09-06 12:52:35 -04:00
commit 3a7f7d4375
11 changed files with 160 additions and 10 deletions

View File

@ -19,6 +19,10 @@ tree.Filter = function Filter(key, op, val, index, filename) {
this.val = val;
}
if (this.op !== '=' && this.op !== '!=') {
this.val = 1 * this.val;
}
this.id = this.key + this.op + this.val;
};
@ -34,15 +38,12 @@ var opXML = {
};
tree.Filter.prototype.toXML = function(env) {
if (this.op !== '=' && this.op !== '!=') {
this.val = 1 * this.val;
if (isNaN(this.val)) {
env.error({
message: 'Cannot use operator "' + this.op + '" with value ' + this.val,
index: this.index,
filename: this.filename
});
}
if (this.op !== '=' && this.op !== '!=' && isNaN(this.val)) {
env.error({
message: 'Cannot use operator "' + this.op + '" with value ' + this.val,
index: this.index,
filename: this.filename
});
}
if (this.val.eval) this._val = this.val.eval(env);
if (this.key.eval) this._key = this.key.eval(env);

View File

@ -23,7 +23,7 @@ helper.files('errorhandling', 'mml', function(file) {
// @TODO for some reason, fs.readFile includes an additional \n
// at the end of read files. Determine why.
fs.readFile(helper.resultFile(file), 'utf8', function(err, data) {
assert.deepEqual(output, data.substr(0, data.length - 1));
if (!err) assert.deepEqual(output, data.substr(0, data.length - 1));
});
});

View File

@ -0,0 +1,16 @@
{
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Stylesheet": [
"multi_stylesheets_b.mss",
"multi_stylesheets_a.mss"
],
"Layer": [{
"id": "world",
"name": "world",
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_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"
}
}]
}

View File

@ -0,0 +1,6 @@
#world {
polygon-opacity: 0.5;
line-width:4;
line-color:#fff;
line-opacity:0.3;
}

View File

@ -0,0 +1,3 @@
#world {
polygonopacity: 0.5;
}

View 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": [
"issue_100_filters.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"
}
}]
}

View File

@ -0,0 +1,16 @@
#world[zoom>10][area>16000000],
#world[zoom>11][area>4000000],
#world[zoom>12][area>1000000],
#world[zoom>13][area>500000],
#world[zoom>14][area>250000],
#world[zoom>15][area>125000],
#world[zoom>16][area>62500],
#world[zoom>17] {
text-name:'[name]';
text-face-name:'Helvetica';
text-halo-fill:#fff;
text-halo-radius:2;
text-placement:interior;
text-size:11;
text-wrap-width:20;
}

View File

@ -0,0 +1,56 @@
<?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">
<Style name="world" filter-mode="first">
<Rule>
<MaxScaleDenominator>400000</MaxScaleDenominator>
<Filter>([area] &gt; 16000000)</Filter>
<TextSymbolizer name="[name]" face-name="Helvetica" halo-fill="#ffffff" halo-radius="2" placement="interior" size="11" wrap-width="20" />
</Rule>
<Rule>
<MaxScaleDenominator>200000</MaxScaleDenominator>
<Filter>([area] &gt; 4000000)</Filter>
<TextSymbolizer name="[name]" face-name="Helvetica" halo-fill="#ffffff" halo-radius="2" placement="interior" size="11" wrap-width="20" />
</Rule>
<Rule>
<MaxScaleDenominator>100000</MaxScaleDenominator>
<Filter>([area] &gt; 1000000)</Filter>
<TextSymbolizer name="[name]" face-name="Helvetica" halo-fill="#ffffff" halo-radius="2" placement="interior" size="11" wrap-width="20" />
</Rule>
<Rule>
<MaxScaleDenominator>50000</MaxScaleDenominator>
<Filter>([area] &gt; 500000)</Filter>
<TextSymbolizer name="[name]" face-name="Helvetica" halo-fill="#ffffff" halo-radius="2" placement="interior" size="11" wrap-width="20" />
</Rule>
<Rule>
<MaxScaleDenominator>25000</MaxScaleDenominator>
<Filter>([area] &gt; 250000)</Filter>
<TextSymbolizer name="[name]" face-name="Helvetica" halo-fill="#ffffff" halo-radius="2" placement="interior" size="11" wrap-width="20" />
</Rule>
<Rule>
<MaxScaleDenominator>12500</MaxScaleDenominator>
<Filter>([area] &gt; 125000)</Filter>
<TextSymbolizer name="[name]" face-name="Helvetica" halo-fill="#ffffff" halo-radius="2" placement="interior" size="11" wrap-width="20" />
</Rule>
<Rule>
<MaxScaleDenominator>5000</MaxScaleDenominator>
<Filter>([area] &gt; 62500)</Filter>
<TextSymbolizer name="[name]" face-name="Helvetica" halo-fill="#ffffff" halo-radius="2" placement="interior" size="11" wrap-width="20" />
</Rule>
<Rule>
<MaxScaleDenominator>2500</MaxScaleDenominator>
<TextSymbolizer name="[name]" face-name="Helvetica" halo-fill="#ffffff" halo-radius="2" placement="interior" size="11" wrap-width="20" />
</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>

View 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 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Stylesheet": [
"nominzoom.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 +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"
}
}]
}

View File

@ -0,0 +1,3 @@
#world[zoom < 5] {
polygon-fill: #000;
}

View File

@ -0,0 +1,21 @@
<?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 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
<Style name="world" filter-mode="first">
<Rule>
<MinScaleDenominator>25000000</MinScaleDenominator>
<PolygonSymbolizer fill="#000000" />
</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 +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>