Permalink
Browse files

First.

  • Loading branch information...
Young Hahn
Young Hahn committed Dec 19, 2011
0 parents commit 2c73f45033bb9d7a567b0287f5058d98ae3338db
@@ -0,0 +1,159 @@
+/* AUTOPILOT */
+.project.autopilot .palette a[href="#fonts"],
+.project.autopilot .palette a[href="#carto"],
+.project.autopilot .palette a[href="#layers"] { display:none; }
+
+.icon.geometry-map,
+.icon.autopilot-fill,
+.icon.autopilot-line,
+.icon.autopilot-text { background-image:url(/assets/tilemill-autopilot/autopilot.png); }
+.icon.geometry-map { background-position:0px 0px; }
+.icon.autopilot-fill { background-position:-20px 0px; }
+.icon.autopilot-line { background-position:-40px 0px; }
+.icon.autopilot-text { background-position:-60px 0px; }
+
+.autopilot-header {
+ padding:9px;
+ margin:0px 10px;
+ height:20px;
+ }
+
+.autopilot-header .add-layer {
+ position:absolute;
+ right:20px;
+ }
+
+ul.autopilot {
+ top:80px;
+ overflow:auto;
+ width:auto;
+ min-height:none;
+ max-height:none;
+ }
+
+.autopilot li {
+ position:relative;
+ background:#eee;
+ padding:10px 30px 0px;
+ border-bottom:1px solid #ccc;
+ min-width:none;
+ max-width:none;
+ }
+
+.autopilot > li > label {
+ display:block;
+ padding-bottom:9px;
+ }
+
+.autopilot .ui-sortable-helper { padding-top:9px; }
+
+.autopilot li .handle,
+.autopilot li .actions,
+.autopilot li .aspects { padding:10px; }
+
+.aspects {
+ display:block;
+ position:absolute;
+ right:70px;
+ top:0px;
+ }
+
+.aspects a {
+ float:left;
+ width:50px;
+ height:20px;
+ margin-left:5px;
+ background:#888 url(/assets/tilemill-autopilot/autopilot.png) -40px -20px;
+ text-indent:-9999px;
+ position:relative;
+ }
+
+.aspects a .icon {
+ border-radius:3px 0px 0px 3px;
+ background-color:#ccc;
+ position:absolute;
+ z-index:1;
+ box-shadow:
+ inset rgba(0,0,0,0.2) 0px 0px 0px 1px,
+ inset rgba(255,255,255,1) 0px 20px 40px -20px,
+ inset rgba(255,255,255,0.4) 0px 2px;
+ }
+
+.aspects a,
+.aspects a .fill {
+ border-radius:3px;
+ box-shadow:inset rgba(0,0,0,0.1) 0px 0px 0px 1px;
+ }
+
+.aspects a .fontview {
+ overflow:hidden;
+ padding-left:25px;
+ text-indent:0px;
+ }
+
+.aspects a .line {
+ position:absolute;
+ left:0px;
+ top:10px;
+ right:0px;
+ border-radius:0px !important;
+ }
+
+.aspect {
+ position:relative;
+ background:#fff;
+ padding:0px 224px 0px 0px;
+ height:0px;
+ margin:0px -30px 0px;
+ box-shadow:inset #ddd 0px 1px;
+ transition:height 100ms;
+ -moz-transition:height 100ms;
+ -webkit-transition:height 100ms;
+ }
+
+.aspect.active { height:240px; }
+
+.aspects a.active:after {
+ content:'';
+ text-indent:-9999px;
+ overflow:hidden;
+ position:absolute;
+ right:10px;
+ bottom:-10px;
+ z-index:2;
+ width:30px;
+ height:15px;
+ background:url(/assets/tilemill-autopilot/autopilot.png) 0px -20px no-repeat;
+ }
+
+.aspect ul.form li { padding-left:100px; }
+.aspect ul.form li.text { padding-left:20px; }
+.aspect ul.form li label { width:70px; margin-left:-80px; text-align:left; }
+
+.aspect .text .joined {
+ position:absolute;
+ top:10px;
+ right:10px;
+ }
+
+.aspect .colorpicker {
+ position:absolute;
+ background:#fff;
+ z-index:1;
+ border-left:1px solid #ddd;
+ box-shadow:inset #ddd 0px 1px;
+ padding:10px;
+ }
+
+.aspect .ui-slider-handle em {
+ position:absolute;
+ font-style:normal;
+ font-size:9px;
+ line-height:10px;
+ width:20px;
+ left:50%;
+ top:-12px;
+ margin-left:-10px;
+ display:block;
+ text-align:center;
+ }
Binary file not shown.
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="300"
+ height="40"
+ id="svg4837"
+ version="1.1"
+ inkscape:version="0.48.2 r9819"
+ sodipodi:docname="autopilot.svg"
+ inkscape:export-filename="./autopilot.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4839" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1"
+ inkscape:cx="17.636886"
+ inkscape:cy="13.131095"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid4860"
+ empspacing="5"
+ visible="true"
+ enabled="true"
+ snapvisiblegridlinesonly="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata4842">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1012.3622)">
+ <g
+ id="g4866"
+ transform="translate(0,260)">
+ <path
+ sodipodi:nodetypes="cccc"
+ inkscape:connector-curvature="0"
+ id="path3879"
+ d="m 29,792.36218 -14,-14.5 -14,14.5 z"
+ style="color:#000000;fill:#cccccc;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+ <path
+ style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 27.7037,792.36218 -12.7037,-13 -12.7037,13 z"
+ id="path4649"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccc" />
+ </g>
+ <path
+ style="color:#000000;fill:#202020;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 30,1016.3622 c -0.846103,1.6922 -1.639325,2.4325 -1.639325,2.4325 l -1.348477,1.3485 c -1.652119,1.6521 -1.652119,4.3235 0,5.9756 1.652119,1.6521 4.323484,1.6521 5.975604,0 1.65212,-1.6521 1.65212,-4.3235 0,-5.9756 l -1.348477,-1.3485 c 0,0 -0.793222,-0.7403 -1.639325,-2.4325 z m -1.269155,4.2305 c 0.700935,0 1.269155,0.5682 1.269155,1.2691 0,0.701 -0.56822,1.2692 -1.269155,1.2692 -0.700935,0 -1.269155,-0.5682 -1.269155,-1.2692 0,-0.7009 0.56822,-1.2691 1.269155,-1.2691 z"
+ id="path4872"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#000000;fill-opacity:0.0627451;stroke:none"
+ d="m 40,1032.3622 0,5 5,0 0,-5 -5,0 z m 5,5 0,5 5,0 0,-5 -5,0 z m 5,0 5,0 0,-5 -5,0 0,5 z m 5,0 0,5 5,0 0,-5 -5,0 z m 5,0 5,0 0,-5 -5,0 0,5 z m 5,0 0,5 5,0 0,-5 -5,0 z m 5,0 5,0 0,-5 -5,0 0,5 z m 5,0 0,5 5,0 0,-5 -5,0 z m 5,0 5,0 0,-5 -5,0 0,5 z m 5,0 0,5 5,0 0,-5 -5,0 z m 5,0 5,0 0,-5 -5,0 0,5 z m 5,0 0,5 5,0 0,-5 -5,0 z m 5,0 5,0 0,-5 -5,0 0,5 z m 5,0 0,5 5,0 0,-5 -5,0 z m 5,0 5,0 0,-5 -5,0 0,5 z m 5,0 0,5 5,0 0,-5 -5,0 z m 5,0 5,0 0,-5 -5,0 0,5 z m 5,0 0,5 5,0 0,-5 -5,0 z m 5,0 5,0 0,-5 -5,0 0,5 z m 5,0 0,5 5,0 0,-5 -5,0 z m 5,0 5,0 0,-5 -5,0 0,5 z m 5,0 0,5 5,0 0,-5 -5,0 z m 5,0 5,0 0,-5 -5,0 0,5 z m 5,0 0,5 5,0 0,-5 -5,0 z m 0,5 -5,0 0,5 5,0 0,-5 z m 0,5 0,5 5,0 0,-5 -5,0 z m -5,0 -5,0 0,5 5,0 0,-5 z m -5,0 0,-5 -5,0 0,5 5,0 z m -5,0 -5,0 0,5 5,0 0,-5 z m -5,0 0,-5 -5,0 0,5 5,0 z m -5,0 -5,0 0,5 5,0 0,-5 z m -5,0 0,-5 -5,0 0,5 5,0 z m -5,0 -5,0 0,5 5,0 0,-5 z m -5,0 0,-5 -5,0 0,5 5,0 z m -5,0 -5,0 0,5 5,0 0,-5 z m -5,0 0,-5 -5,0 0,5 5,0 z m -5,0 -5,0 0,5 5,0 0,-5 z m -5,0 0,-5 -5,0 0,5 5,0 z m -5,0 -5,0 0,5 5,0 0,-5 z m -5,0 0,-5 -5,0 0,5 5,0 z m -5,0 -5,0 0,5 5,0 0,-5 z m -5,0 0,-5 -5,0 0,5 5,0 z m -5,0 -5,0 0,5 5,0 0,-5 z m -5,0 0,-5 -5,0 0,5 5,0 z m -5,0 -5,0 0,5 5,0 0,-5 z m -5,0 0,-5 -5,0 0,5 5,0 z m -5,0 -5,0 0,5 5,0 0,-5 z m -5,0 0,-5 -5,0 0,5 5,0 z"
+ id="rect3962"
+ inkscape:connector-curvature="0" />
+ <path
+ style="color:#000000;fill:#202020;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 45,1025.8622 1.5,1.5 8.5,-8.5 -1.5,-1.5"
+ id="path6189"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="color:#000000;fill:#202020;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 65,1017.3622 0,1.5 0,1.5 1,-1.5 2.875,0 0,6.75 -0.875,1.75 4,0 -0.875,-1.75 0,-6.75 2.875,0 1,1.5 0,-1.5 0,-1.5 z"
+ id="rect6191"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccccccccccccc" />
+ <rect
+ style="color:#000000;fill:#202020;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ id="rect6854"
+ width="12"
+ height="12"
+ x="4"
+ y="1016.3622"
+ rx="2"
+ ry="2" />
+ <path
+ style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 8.375,5.5 c -0.1385,0 -0.25,0.1115 -0.25,0.25 l 0,2.375 -2.375,0 c -0.1385,0 -0.25,0.1115 -0.25,0.25 l 0,0.25 c 0,0.1385 0.1115,0.25 0.25,0.25 l 2.375,0 0,2.25 -2.375,0 c -0.1385,0 -0.25,0.1115 -0.25,0.25 l 0,0.25 c 0,0.1385 0.1115,0.25 0.25,0.25 l 2.375,0 0,2.375 c 0,0.1385 0.1115,0.25 0.25,0.25 l 0.25,0 c 0.1385,0 0.25,-0.1115 0.25,-0.25 l 0,-2.375 2.25,0 0,2.375 c 0,0.1385 0.1115,0.25 0.25,0.25 l 0.25,0 c 0.1385,0 0.25,-0.1115 0.25,-0.25 l 0,-2.375 2.375,0 c 0.1385,0 0.25,-0.1115 0.25,-0.25 l 0,-0.25 c 0,-0.1385 -0.1115,-0.25 -0.25,-0.25 l -2.375,0 0,-2.25 2.375,0 c 0.1385,0 0.25,-0.1115 0.25,-0.25 l 0,-0.25 c 0,-0.1385 -0.1115,-0.25 -0.25,-0.25 l -2.375,0 0,-2.375 c 0,-0.1385 -0.1115,-0.25 -0.25,-0.25 l -0.25,0 c -0.1385,0 -0.25,0.1115 -0.25,0.25 l 0,2.375 -2.25,0 0,-2.375 C 8.875,5.6115 8.7635,5.5 8.625,5.5 z m 0.5,3.375 2.25,0 0,2.25 -2.25,0 z"
+ transform="translate(0,1012.3622)"
+ id="rect6856"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sscssssccsssscssssccsssscssssccsssscssssccsssccccc" />
+ </g>
+</svg>
@@ -0,0 +1,98 @@
+model = Backbone.Model.extend();
+
+model.prototype.compile = function(layer) {
+ if (this.id === 'Map') return this.toCSS(this.compileMap());
+ if (!layer) return '';
+
+ switch (layer.get('geometry')) {
+ case 'polygon':
+ console.warn(this.toCSS(this.compilePolygon(layer)));
+ return this.toCSS(this.compilePolygon(layer));
+ break;
+ case 'line':
+ return this.toCSS(this.compileLine(layer));
+ break;
+ case 'point':
+ return this.toCSS(this.compilePoint(layer));
+ break;
+ case 'raster':
+ return this.toCSS(this.compileRaster(layer));
+ break;
+ default:
+ return '';
+ break;
+ }
+};
+
+model.prototype.compileMap = function(layer) {
+ var rules = {};
+ if (this.get('fill')) rules['background-color'] = this.get('fill');
+ return rules;
+};
+
+model.prototype.compilePolygon = function(layer) {
+ return _(this.toJSON()).reduce(_(function(memo, val, key) {
+ if (key === 'id') return memo;
+ if (key.indexOf('_') === 0) return memo;
+ switch (key.split('-')[0]) {
+ case 'fill':
+ var zoom = this.get('_fill-zoom') || [0,22];
+ var group = _('[zoom>=<%=obj[0]%>][zoom<=<%=obj[1]%>]').template(zoom);
+ memo[group] = memo[group] || {};
+ memo[group]['polygon-fill'] = val;
+ break;
+ case 'line':
+ if (!this.get('line-width')) return memo;
+ var zoom = this.get('_line-zoom') || [0,22];
+ var group = _('::line[zoom>=<%=obj[0]%>][zoom<=<%=obj[1]%>]').template(zoom);
+ memo[group] = memo[group] || {};
+ memo[group][key] = val;
+ break;
+ case 'text':
+ if (!this.get('text-name')) return memo;
+ var zoom = this.get('_text-zoom') || [0,22];
+ var group = _('::text[zoom>=<%=obj[0]%>][zoom<=<%=obj[1]%>]').template(zoom);
+ memo[group] = memo[group] || {};
+ memo[group][key] = val;
+ break;
+ }
+ return memo;
+ }).bind(this), {});
+};
+
+model.prototype.compileLine = function(layer) {
+ var rules = {};
+ return rules;
+};
+
+model.prototype.compilePoint = function(layer) {
+ var rules = {};
+ return rules;
+};
+
+model.prototype.compileRaster = function(layer) {
+ var rules = {};
+ return rules;
+};
+
+model.prototype.toCSS = function(rules, indent) {
+ indent = indent || ' ';
+ return _(rules).map(_(function(val, key) {
+ if (_(val).isObject()) return [
+ indent + key + '{',
+ this.toCSS(val, indent + ' '),
+ indent + '}'].join('\n');
+ // Quoted attributes. @TODO use the Carto reference JSON for this.
+ switch (key) {
+ case 'text-name':
+ return indent + key + ':"[' + val + ']";';
+ break;
+ case 'text-face-name':
+ return indent + key + ':"' + val + '";';
+ break;
+ default:
+ return indent + key + ':' + val + ';';
+ break;
+ }
+ }).bind(this)).join('\n');
+};
@@ -0,0 +1,2 @@
+model = Backbone.Collection.extend();
+model.prototype.model = models.Chart;
@@ -0,0 +1 @@
+{ "name": "tilemill-autopilot" }
@@ -0,0 +1,4 @@
+var assets = servers['Route'].prototype.assets;
+
+assets.styles.push(require.resolve('../assets/autopilot.css'));
+
Oops, something went wrong.

0 comments on commit 2c73f45

Please sign in to comment.