Browse files

visual editor

  • Loading branch information...
1 parent 5708072 commit 019b8af80c7801f181fb8a0228d6036e14d767cf @gka gka committed Mar 18, 2012
Showing with 34 additions and 9 deletions.
  1. +5 −0 css/k.css
  2. +29 −9 showcase/editor/index.html
View
5 css/k.css
@@ -128,6 +128,7 @@ h1 {
}
.k-gui .dg .cr.number input[type="text"] {
color: #356;
+ height: 12px;
}
.k-gui .dg .c .slider {
background-color: #ddd;
@@ -158,4 +159,8 @@ h1 {
.k-gui .dg .closed li.title {
background-image: none;
background-color: #e4e4e4;
+}
+.k-gui .dg .cr.number input[type="text"]:hover,
+.k-gui .dg .cr.number input[type="text"]:focus {
+ color: #eee;
}
View
38 showcase/editor/index.html
@@ -123,7 +123,7 @@
var lons = lon == 0 || lon == 180 ? [lon] : [lon,-lon];
$.each(lons, function(l, lon_) {
var line = [];
- for (lat=-90+(lon % 90 == 0 ? 0 : grat_lon);lat<90-(lon%90 == 0 ? 0 : grat_lon)+1;lat+=0.25) {
+ for (lat=-90+(lon % 90 == 0 ? 0 : grat_lat);lat<90-(lon%90 == 0 ? 0 : grat_lat)+1;lat+=0.25) {
line.push([lon_,lat]);
}
for (var i=0;i<line.length-1;i++) {
@@ -162,19 +162,34 @@
frame = 0,
serializeConfig = function() {
var cfg = {};
+ // projection
cfg['proj'] = { id: globeopt.proj };
$.each(projopts, function(key, val) {
if (kartograph.proj[globeopt.proj].parameters.indexOf(key) >= 0) {
cfg.proj[key] = globeopt[key];
}
});
+ // layers
cfg['layers'] = [];
if (globeopt.graticule) {
var l = { special: 'graticule' };
if (globeopt.latitudes > 0) l.latitudes = globeopt.latitudes;
if (globeopt.longitudes > 0) l.longitudes = globeopt.longitudes;
cfg.layers.push(l);
}
+ if (globeopt.countries) {
+ l = { id: 'countries', src: 'shp/countries.shp' };
+ cfg.layers.push(l);
+ }
+ if (globeopt.lakes) {
+ l = { id: 'lakes', src: 'shp/lakes.shp' };
+ cfg.layers.push(l);
+ }
+ // export
+ cfg['export'] = {
+ width: globeopt.auto_width ? 'auto' : globeopt.width,
+ height: globeopt.auto_height ? 'auto': globeopt.height
+ };
$('#cfg').html(JSON.stringify(cfg));
},
renderFrame = function() {
@@ -249,8 +264,8 @@
location.href = url[0]+'#'+globeopt.proj;
f = grp('Layer');
- f.add(globeopt, 'countries');
- f.add(globeopt, 'lakes');
+ f.add(globeopt, 'countries').onChange(serializeConfig);;
+ f.add(globeopt, 'lakes').onChange(serializeConfig);;
f = grp('Graticule');
@@ -259,14 +274,19 @@
f.add(globeopt, 'latitudes', 0, 60).step(1).onChange(renderFrame);
f = grp('Bounds');
- f.add(globeopt, 'mode');
-
+ f.add(globeopt, 'mode', ['bbox','polygon', 'points']);
+ if (globeopt.mode == 'bbox') {
+ f.add(globeopt, 'min-lat', -90, 90).step(1);
+ f.add(globeopt, 'min-lon', -180, 180).step(1);
+ f.add(globeopt, 'max-lat', -90, 90).step(1);
+ f.add(globeopt, 'min-lon', -180, 180).step(1);
+ }
f = grp('Export');
- f.add(globeopt, 'width', 100, 3000);
- f.add(globeopt, 'auto_width');
- f.add(globeopt, 'height', 100, 3000);
- f.add(globeopt, 'auto_height');
+ f.add(globeopt, 'width', 100, 3000).step(1).onChange(serializeConfig);
+ f.add(globeopt, 'auto_width').onChange(serializeConfig);
+ f.add(globeopt, 'height', 100, 3000).step(1).onChange(serializeConfig);
+ f.add(globeopt, 'auto_height').onChange(serializeConfig);
};

0 comments on commit 019b8af

Please sign in to comment.