[Mapbender-commits] r8910 - in trunk/mapbender: http/plugins lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue May 27 02:37:26 PDT 2014


Author: hwbllmnn
Date: 2014-05-27 02:37:26 -0700 (Tue, 27 May 2014)
New Revision: 8910

Modified:
   trunk/mapbender/http/plugins/mb_digitize_widget.php
   trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
Log:
prepared proper handling of marker-type


Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php	2014-05-27 07:28:38 UTC (rev 8909)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php	2014-05-27 09:37:26 UTC (rev 8910)
@@ -107,12 +107,22 @@
 
     var editStyleHtml = '<div title="Edit style">' +
         '<div class="digitize-preview"></div>' +
-        '<table><tr><td>Symbol:</td><td><input type="text" name="marker-symbol" value=""></input></td></tr>' +
+        '<form id="digitize-marker-form"><label><input type="radio" name="marker-type" checked="checked" value="predefined">Predefined</input></label>' +
+        '<label><input type="radio" name="marker-type" value="custom">Custom</input></label></form>' +
+        '<table class="digitize-style-custom"><tr><td>Symbol:</td><td><input type="text" name="marker-symbol" value=""></input></td></tr>' +
         '<tr><td>Symbolgröße:</td><td><input type="text" name="marker-size" value=""></input></td></tr>' +
         '<tr><td>Linienfarbe</td><td><input type="color" name="stroke" value="#000000"></input></td></tr>' +
         '<tr><td>Liniendeckkraft:</td><td><div class="opacity-slider" data-name="stroke-opacity"></div></td></tr>' +
         '<tr><td>Liniendicke:</td><td><input type="text" name="stroke-width" value="1"></input></td></tr>' +
         '<tr><td>Flächenfarbe:</td><td><input type="color" name="fill" value="#ff0000"></input></td></tr>' +
+        '<tr><td>Flächendeckkraft:</td><td><div class="opacity-slider" data-name="fill-opacity"></div></td></tr></table>' +
+        '<table class="digitize-style-predefined"><tr><td>Symbol:</td><td><input type="text" name="marker-symbol" value=""></input></td></tr>' +
+        '<tr><td>Symbolgröße:</td><td><input type="text" name="marker-size" value=""></input></td></tr>' +
+        '<tr><td>Symbolfarbe:</td><td><input type="color" name="marker-color" value=""></input></td></tr>' +
+        '<tr><td>Linienfarbe</td><td><input type="color" name="stroke" value="#000000"></input></td></tr>' +
+        '<tr><td>Liniendeckkraft:</td><td><div class="opacity-slider" data-name="stroke-opacity"></div></td></tr>' +
+        '<tr><td>Liniendicke:</td><td><input type="text" name="stroke-width" value="1"></input></td></tr>' +
+        '<tr><td>Flächenfarbe:</td><td><input type="color" name="fill" value="#ff0000"></input></td></tr>' +
         '<tr><td>Flächendeckkraft:</td><td><div class="opacity-slider" data-name="fill-opacity"></div></td></tr>' +
         '</table><br></br>' +
         '<div class="digitize-image digitize-save"></div>' +
@@ -249,14 +259,27 @@
             if(feature.geometry.type.match(/point/i)) {
                 editStyleDialog.find('input[name*="fill"],input[name*="stroke"],.opacity-slider').parent().parent().css('display', 'none');
                 editStyleDialog.find('input[name*="marker"]').parent().parent().css('display', 'table-row');
+                if(feature.properties['marker-type'] === 'custom') {
+                    editStyleDialog.find('.digitize-style-custom,form').css('display', 'block');
+                    editStyleDialog.find('.digitize-style-predefined').css('display', 'none');
+                    editStyleDialog.find('input[value="custom"]').attr('checked', 'checked');
+                } else {
+                    editStyleDialog.find('.digitize-style-predefined,form').css('display', 'block');
+                    editStyleDialog.find('.digitize-style-custom').css('display', 'none');
+                    editStyleDialog.find('input[value="predefined"]').attr('checked', 'checked');
+                }
             }
             if(feature.geometry.type.match(/line/i)) {
                 editStyleDialog.find('input[name*="fill"],input[name*="marker"],.opacity-slider[data-name="fill-opacity"]').parent().parent().css('display', 'none');
                 editStyleDialog.find('input[name*="stroke"],.opacity-slider[data-name="stroke-opacity"]').parent().parent().css('display', 'table-row');
+                editStyleDialog.find('.digitize-style-custom').css('display', 'block');
+                editStyleDialog.find('.digitize-style-predefined,form').css('display', 'none');
             }
             if(feature.geometry.type.match(/polygon/i)) {
                 editStyleDialog.find('input[name*="fill"],input[name*="stroke"],.opacity-slider').parent().parent().css('display', 'table-row');
                 editStyleDialog.find('input[name*="marker"]').parent().parent().css('display', 'none');
+                editStyleDialog.find('.digitize-style-custom').css('display', 'block');
+                editStyleDialog.find('.digitize-style-predefined,form').css('display', 'none');
             }
 
             var preview = editStyleDialog.find('.digitize-preview');
@@ -264,6 +287,10 @@
             preview = preview.get(0);
             kml.renderPreview(feature, preview);
             $.each(feature.properties, function(k, v) {
+                if(editStyleDialog.find('input[name="' + k + '"]').is(':radio')) {
+                    editStyleDialog.find('input[value="' + k + '"]').attr('checked', 'checked');
+                    return;
+                }
                 editStyleDialog.find('input[name="' + k + '"]').val(v);
                 if(k === 'stroke-opacity') {
                     editStyleDialog.find('.opacity-slider[data-name="stroke-opacity"]').slider('value', v * 100);
@@ -272,6 +299,11 @@
                     editStyleDialog.find('.opacity-slider[data-name="fill-opacity"]').slider('value', v * 100);
                 }
             });
+
+            editStyleDialog.find('form input').bind('change', function() {
+                editStyleDialog.find('.digitize-style-' + $(this).val()).css('display', 'block').siblings('table').css('display', 'none');
+            });
+
             editStyleDialog.find('input').bind('change', function() {
                 if(isline && $(this).attr('name').match(/fill/)) {
                     return;

Modified: trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
===================================================================
--- trunk/mapbender/lib/mb.ui.displayKmlFeatures.js	2014-05-27 07:28:38 UTC (rev 8909)
+++ trunk/mapbender/lib/mb.ui.displayKmlFeatures.js	2014-05-27 09:37:26 UTC (rev 8910)
@@ -350,6 +350,7 @@
         // is this the right place and way to fix it?
         if(feature.properties['Mapbender:icon']) {
             feature.properties['marker-symbol'] = feature.properties['Mapbender:icon'];
+            feature.properties['marker-type'] = 'custom';
             feature.properties['Mapbender:icon'] = null;
         }
         if(feature.properties['marker-symbol']) {



More information about the Mapbender_commits mailing list