[Mapbender-commits] r9226 - in trunk/mapbender/http: php plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jun 24 04:40:17 PDT 2015


Author: syed
Date: 2015-06-24 04:40:17 -0700 (Wed, 24 Jun 2015)
New Revision: 9226

Added:
   trunk/mapbender/http/php/transformPoint.php
Modified:
   trunk/mapbender/http/plugins/mb_digitize_widget.php
Log:
replace proj4js with a serverside script

Added: trunk/mapbender/http/php/transformPoint.php
===================================================================
--- trunk/mapbender/http/php/transformPoint.php	                        (rev 0)
+++ trunk/mapbender/http/php/transformPoint.php	2015-06-24 11:40:17 UTC (rev 9226)
@@ -0,0 +1,61 @@
+<?php
+# http://www.mapbender.org/index.php/Administration
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+header("Content-Type: application/json");
+
+$point_pos = $_POST["point_pos"];
+$targetProj = json_decode($_POST["targetProj"], true);
+$currentProj = json_decode($_POST["currentProj"], true);
+
+// Return the multipoints and use it on the client-side
+try {
+    $multipoint = "";
+    $points_obj = json_decode($point_pos, true);
+    $last_item = end($points_obj);
+    foreach ($points_obj as $key => $value) {
+        $multipoint .= '(';
+        $multipoint .= $value["pos"]["x"];
+        $multipoint .= ' ';
+        $multipoint .= $value["pos"]["y"];
+        $multipoint .= '),';
+    }
+
+    $multipoint = 'MULTIPOINT (' . rtrim($multipoint, ',') . ')';
+    // var_dump($point_pos);die;
+    // die('<pre>' . print_r($multipoint, 1) . '</pre>');
+    $targetProjSricCode = intval($targetProj["srsProjNumber"]);
+    $currentProjSricCode = intval($currentProj["srsProjNumber"]);
+    $sql = "SELECT ST_AsGeoJson(ST_Transform(ST_GeomFromText($1,$2),$3)) As target_geom";
+    $v = array($multipoint, intval($targetProjSricCode), intval($currentProjSricCode));
+    $t = array('s', 'i', 'i');
+    $res = db_prep_query($sql, $v, $t);
+    db_fetch_row($res);
+    $geom = db_result($res, 0, 'target_geom');
+    // @TODO: Test the sql
+    // die('<pre>' . print_r($geom, 1) . '</pre>');
+    echo($geom);
+    // $geom = json_decode(db_result($res, 0, 'geom'));
+    // $feat->geometry = $geom;
+
+    // transform point json to wkt MULTIPOINT
+} catch (Exception $e) {
+    echo($e);
+    die;
+}

Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php	2015-06-22 20:09:25 UTC (rev 9225)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php	2015-06-24 11:40:17 UTC (rev 9226)
@@ -68,22 +68,22 @@
  * http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
  */
 
-var $digitize = $(this);
+ var $digitize = $(this);
 
-var DigitizeApi = function (o) {
+ var DigitizeApi = function (o) {
 
     var digitizeHtml = '<div title="<?php echo _mb("Sketch");?>">' +
-        '<div  title="<?php echo _mb("Digitize new point");?>"class="digitize-image digitize-point"></div>' +
-        '<div  title="<?php echo _mb("Digitize new line");?>"class="digitize-image digitize-line"></div>' +
-        '<div  title="<?php echo _mb("Digitize new polygon");?>"class="digitize-image digitize-polygon"></div>' +
-        '<div  title="<?php echo _mb("Attributes of collection");?>"class="digitize-image digitize-attributes editFeatureCollection"></div>' +
-        '</div>';
+    '<div  title="<?php echo _mb("Digitize new point");?>"class="digitize-image digitize-point"></div>' +
+    '<div  title="<?php echo _mb("Digitize new line");?>"class="digitize-image digitize-line"></div>' +
+    '<div  title="<?php echo _mb("Digitize new polygon");?>"class="digitize-image digitize-polygon"></div>' +
+    '<div  title="<?php echo _mb("Attributes of collection");?>"class="digitize-image digitize-attributes editFeatureCollection"></div>' +
+    '</div>';
 
     var editHtml = '<div title="<?php echo _mb("Edit feature");?>">' +
-        '<div class="digitize-preview"></div>' +
-        '<span>my polygon</span><br></br>' +
-        '<div title="<?php echo _mb("Edit style");?>" class="digitize-image digitize-style"></div>' +
-        '<div title="<?php echo _mb("Edit attributes");?>" class="digitize-image digitize-attributes"></div>' +
+    '<div class="digitize-preview"></div>' +
+    '<span>my polygon</span><br></br>' +
+    '<div title="<?php echo _mb("Edit style");?>" class="digitize-image digitize-style"></div>' +
+    '<div title="<?php echo _mb("Edit attributes");?>" class="digitize-image digitize-attributes"></div>' +
         // '<div class="digitize-image digitize-add"></div>' +
         '<div title="<?php echo _mb("Delete feature");?>" class="digitize-image digitize-remove"></div>' +
         '<div title="<?php echo _mb("Edit geometry");?>" class="digitize-image digitize-pencil"></div>' +
@@ -95,7 +95,7 @@
         '<div title="<?php echo _mb("Export geometry");?>" class="digitize-image digitize-export digitize-export-edit-dialog"></div>' +
         '</div>';
 
-    var editAttributesHtml = '<div title="<?php echo _mb("Feature attributes");?>">' +
+        var editAttributesHtml = '<div title="<?php echo _mb("Feature attributes");?>">' +
         '<div class="digitize-image digitize-style"></div>' +
         '<div class="digitize-preview"></div><br></br>' +
         // '<div class="attrAccordion">' +
@@ -106,7 +106,7 @@
         '<div title="<?php echo _mb("Save object");?>" class="digitize-image digitize-save"></div>' +
         '</div>';
 
-    var tableEditAttributesHtml = '<div title="<?php echo _mb("Feature attributes");?>">' +
+        var tableEditAttributesHtml = '<div title="<?php echo _mb("Feature attributes");?>">' +
         '<div title="<?php echo _mb("Edit style");?>" class="digitize-image digitize-style"></div>' +
         '<div class="digitize-preview"></div><br></br>' +
         '<div class="attrAccordion">' +
@@ -115,7 +115,7 @@
         '<div title="<?php echo _mb("Save object");?>" class="digitize-image digitize-save"></div>' +
         '</div>';
 
-    var editStyleHtml = '<div title="<?php echo _mb("Edit style");?>">' +
+        var editStyleHtml = '<div title="<?php echo _mb("Edit style");?>">' +
         '<div class="digitize-preview"></div>' +
         '<form id="digitize-marker-form"><label><input type="radio" name="marker-type" checked="checked" value="predefined"><?php echo _mb("Predefined");?></input></label>' +
         '<label><input type="radio" name="marker-type" value="custom"><?php echo _mb("Custom");?></input></label></form>' +
@@ -139,7 +139,7 @@
         '<button name="digitize-reset-style"><?php echo _mb("Reset");?></button>' +
         '</div>';
 
-    var folderMenu = '<ul class="digitize-contextmenu">' +
+        var folderMenu = '<ul class="digitize-contextmenu">' +
         '<li><div class="digitize-image digitize-pencil"></div><?php echo _mb("Edit");?></li>' +
         '<li><div class="digitize-image digitize-zoomto"></div><?php echo _mb("Zoom to");?></li>' +
         '<li><div class="digitize-image digitize-add"></div><?php echo _mb("New");?></li>' +
@@ -148,7 +148,7 @@
         '<li><div class="digitize-image digitize-close"></div><?php echo _mb("Close");?></li>' +
         '</ul>';
 
-    var geomMenu = '<ul class="digitize-contextmenu">' +
+        var geomMenu = '<ul class="digitize-contextmenu">' +
         '<li><div class="digitize-image digitize-pencil"></div><?php echo _mb("Edit");?></li>' +
         '<li><div class="digitize-image digitize-zoomto"></div><?php echo _mb("Zoom to");?></li>' +
         // '<li><div class="digitize-image digitize-add"></div><?php echo _mb("New");?></li>' +
@@ -158,7 +158,7 @@
         '<li><div class="digitize-image digitize-close"></div><?php echo _mb("Close");?></li>' +
         '</ul>';
 
-    var geomPartMenu = '<ul class="digitize-contextmenu">' +
+        var geomPartMenu = '<ul class="digitize-contextmenu">' +
         '<li><div class="digitize-image digitize-pencil"></div><?php echo _mb("Edit");?></li>' +
         '<li><div class="digitize-image digitize-zoomto"></div><?php echo _mb("Zoom to");?></li>' +
         '<li><div class="digitize-image digitize-export"></div><?php echo _mb("Export");?></li>' +
@@ -166,16 +166,16 @@
         '<li><div class="digitize-image digitize-close"></div><?php echo _mb("Close");?></li>' +
         '</ul>';
 
-    var exportHtml = '<div id="export-dialog" title="<?php echo _mb("Export my features");?>">'
-                     + '<form>'
-                     + '<label class="export-format-kml">KML<input type="radio" name="export-format" value="kml" checked="checked"></input></label>'
-                     + '<label class="export-format-gpx">GPX<input type="radio" name="export-format" value="gpx"></input></label>'
-                     + '<label class="export-format-geojson">geoJSON<input type="radio" name="export-format" value="geojson"></input></label><br></br>'
-                     + '<a download="myfeatures.kml" href="#" class="digitize-image digitize-export" style="float: left;"></a>'
-                     + '</form>'
-                     + '</div>';
+        var exportHtml = '<div id="export-dialog" title="<?php echo _mb("Export my features");?>">'
+        + '<form>'
+        + '<label class="export-format-kml">KML<input type="radio" name="export-format" value="kml" checked="checked"></input></label>'
+        + '<label class="export-format-gpx">GPX<input type="radio" name="export-format" value="gpx"></input></label>'
+        + '<label class="export-format-geojson">geoJSON<input type="radio" name="export-format" value="geojson"></input></label><br></br>'
+        + '<a download="myfeatures.kml" href="#" class="digitize-image digitize-export" style="float: left;"></a>'
+        + '</form>'
+        + '</div>';
 
-    var digitizeDialog,
+        var digitizeDialog,
         editDialog,
         attributesDialog,
         editStyleDialog,
@@ -188,42 +188,42 @@
         editedFeature = null,
         status = 'none';
 
-    var btnelem = $('body').append('<img id="kml-digitizer-pseudo" style="display: none;"></img>').find('#kml-digitizer-pseudo');
+        var btnelem = $('body').append('<img id="kml-digitizer-pseudo" style="display: none;"></img>').find('#kml-digitizer-pseudo');
 
-    var btn = new Mapbender.Button({
-        domElement: btnelem[0],
-        name: 'kml-digitizer-pseudo',
-        go: $.noop,
-        stop: function() {
-            $('#mapframe1').data('mb_digitize').isPaused = true;
-        }
-    });
+        var btn = new Mapbender.Button({
+            domElement: btnelem[0],
+            name: 'kml-digitizer-pseudo',
+            go: $.noop,
+            stop: function() {
+                $('#mapframe1').data('mb_digitize').isPaused = true;
+            }
+        });
 
-    $('body > img').bind('click', function() {
-        if(!inProgress) {
-            return;
-        }
-        var active = $(this)[0].status == 1 && $(this)[0] != btnelem;
+        $('body > img').bind('click', function() {
+            if(!inProgress) {
+                return;
+            }
+            var active = $(this)[0].status == 1 && $(this)[0] != btnelem;
 
-        var dig = $('#mapframe1').data('mb_digitize');
+            var dig = $('#mapframe1').data('mb_digitize');
 
-        if(active && dig) {
-            dig.isPaused = false;
-        }
-    });
-
-    var create = function() {
-        $.ajax({
-            url: '../extensions/makiicons/selection.json',
-            type: 'GET',
-            dataType: 'json',
-            success: function(data) {
-                icons = data;
-                var kml = $('#mapframe1').data('kml');
-                kml.icons = icons;
+            if(active && dig) {
+                dig.isPaused = false;
             }
         });
 
+        var create = function() {
+            $.ajax({
+                url: '../extensions/makiicons/selection.json',
+                type: 'GET',
+                dataType: 'json',
+                success: function(data) {
+                    icons = data;
+                    var kml = $('#mapframe1').data('kml');
+                    kml.icons = icons;
+                }
+            });
+
         //
         // Initialise digitize dialog
         //
@@ -310,7 +310,7 @@
             var url = item.url;
             $('li[title="' + url + '"] > a').die('contextmenu').live('contextmenu', contextmenuLayer);
             $('li[title="' + url + '"] > ul > li').die('contextmenu').live('contextmenu', contextmenuObject)
-                .die('click').live('click', function(e) {
+            .die('click').live('click', function(e) {
                 if($(e.srcElement).is('button,input')) {
                     return;
                 }
@@ -323,15 +323,35 @@
             $('li[title="' + url + '"] > .digitize-menu-arrow').die('click').live('click', contextmenuLayer);
             $('li[title="' + url + '"] > ul > li > .digitize-menu-arrow').die('click').live('click', contextmenuObject);
         });
-    };
+};
 
-    var exportItem = function(data) {
-        var dlg = $(exportHtml).dialog({ width: 330, height: 165 });
-        $(dlg).find('input').bind('change', function() {
-            if(!$(this).is(':checked')) {
-                return;
-            }
-            var fmt = $(this).val();
+var exportItem = function(data) {
+    var dlg = $(exportHtml).dialog({ width: 330, height: 165 });
+    $(dlg).find('input').bind('change', function() {
+        if(!$(this).is(':checked')) {
+            return;
+        }
+        var fmt = $(this).val();
+        var url;
+        if(fmt === 'kml') {
+            url = tokml(data, {simplestyle: true});
+        }
+        if(fmt === 'gpx') {
+            url = togpx(data, {simplestyle: true});
+        }
+        if(fmt === 'geojson') {
+            url = JSON.stringify(data);
+        }
+        url = 'data:application/octet-stream,' + encodeURIComponent(url);
+
+        var lnk = $(dlg).find('.digitize-export')
+        .attr('download', 'myfeatures.' + fmt)
+        .attr('href', url);
+    }).change();
+
+    $(dlg).find('.digitize-export').bind('click', function() {
+        if(window.chrome) {
+            var fmt = $(dlg).find('input:checked').val();
             var url;
             if(fmt === 'kml') {
                 url = tokml(data, {simplestyle: true});
@@ -340,264 +360,244 @@
                 url = togpx(data, {simplestyle: true});
             }
             if(fmt === 'geojson') {
-                url = JSON.stringify(data);
-            }
-            url = 'data:application/octet-stream,' + encodeURIComponent(url);
+                if (data.type != "Feature") {
 
-            var lnk = $(dlg).find('.digitize-export')
-            .attr('download', 'myfeatures.' + fmt)
-            .attr('href', url);
-        }).change();
+                    url = JSON.stringify(data);
+                } else {
 
-        $(dlg).find('.digitize-export').bind('click', function() {
-            if(window.chrome) {
-                var fmt = $(dlg).find('input:checked').val();
-                var url;
-                if(fmt === 'kml') {
-                    url = tokml(data, {simplestyle: true});
+                    var newFeatureJson = $.extend(true, {}, data);
+                    var jsonFeatureHeader = {"type": "FeatureCollection", "features": [newFeatureJson]};
+                    url = JSON.stringify(jsonFeatureHeader);
                 }
-                if(fmt === 'gpx') {
-                    url = togpx(data, {simplestyle: true});
-                }
-                if(fmt === 'geojson') {
-                    if (data.type != "Feature") {
 
-                        url = JSON.stringify(data);
-                    } else {
+            }
 
-                        var newFeatureJson = $.extend(true, {}, data);
-                        var jsonFeatureHeader = {"type": "FeatureCollection", "features": [newFeatureJson]};
-                        url = JSON.stringify(jsonFeatureHeader);
-                    }
+            var link = document.createElement("a");
+            link.setAttribute('download', 'myfeatures.' + fmt);
+            link.href = URL.createObjectURL(new Blob([url], {type: 'application/octet-stream'}));
+            link.click();
 
-                }
+            return false;
+        }
+        return undefined;
+    });
+};
 
-                var link = document.createElement("a");
-                link.setAttribute('download', 'myfeatures.' + fmt);
-                link.href = URL.createObjectURL(new Blob([url], {type: 'application/octet-stream'}));
-                link.click();
+var editStyle = function($link, menu) {
+    var classPrefix = icons.preferences.fontPref.prefix,
+    iconList = [],
+    search = [];
 
-                return false;
-            }
-            return undefined;
-        });
-    };
+    $.each(icons.icons, function(i, v) {
+        iconList.push( classPrefix + v.properties.name );
+    });
 
-    var editStyle = function($link, menu) {
-        var classPrefix = icons.preferences.fontPref.prefix,
-            iconList = [],
-            search = [];
+    editStyleDialog.find('.digitize-style-predefined input[name="marker-symbol"]').fontIconPicker({source: iconList, hasSearch: false, emptyIcon: false});
 
-        $.each(icons.icons, function(i, v) {
-            iconList.push( classPrefix + v.properties.name );
-        });
+    return function() {
+        editStyleDialog.dialog('open');
+        var idx = $link.attr('idx');
+        var kml = $('#mapframe1').data('kml');
+        var url = $link.parent().parent().attr('title');
+        var feature = kml._kmls[url].data.features[idx];
+        var isline = false;
+        var ispoint = false;
 
-        editStyleDialog.find('.digitize-style-predefined input[name="marker-symbol"]').fontIconPicker({source: iconList, hasSearch: false, emptyIcon: false});
 
-        return function() {
-            editStyleDialog.dialog('open');
-            var idx = $link.attr('idx');
-            var kml = $('#mapframe1').data('kml');
-            var url = $link.parent().parent().attr('title');
-            var feature = kml._kmls[url].data.features[idx];
-            var isline = false;
-            var ispoint = false;
+        kml.zoomToFeature(url, idx);
 
+        if(feature.geometry.type.match(/point/i)) {
+            ispoint = true;
+            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)) {
+            isline = true;
+            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');
+        }
 
-            kml.zoomToFeature(url, idx);
+        $('input[value="predefined"]').bind('click', function() {
+            if($(this).val() == 'predefined') {
+                var cls = $('.digitize-style-predefined .selected-icon i').attr('class');
+                $('.digitize-style-predefined input[name="marker-symbol"]').val(cls).change();
+            }
+        });
 
-            if(feature.geometry.type.match(/point/i)) {
-                ispoint = true;
-                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');
-                }
+        var preview = editStyleDialog.find('.digitize-preview');
+        preview.html('');
+        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;
             }
-            if(feature.geometry.type.match(/line/i)) {
-                isline = true;
-                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');
+            editStyleDialog.find('input[name="' + k + '"],select[name="' + k + '"]').val(v);
+            if(k === 'stroke-opacity') {
+                editStyleDialog.find('.opacity-slider[data-name="stroke-opacity"]').slider('value', v * 100);
             }
-            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');
+            if(k === 'fill-opacity') {
+                editStyleDialog.find('.opacity-slider[data-name="fill-opacity"]').slider('value', v * 100);
             }
+            if(k === 'marker-symbol' && feature.properties['marker-type'] === 'predefined') {
+                editStyleDialog.find('input[name="marker-symbol"]').val('icon-' + v + '-24');
+            }
+        });
 
-            $('input[value="predefined"]').bind('click', function() {
-                if($(this).val() == 'predefined') {
-                    var cls = $('.digitize-style-predefined .selected-icon i').attr('class');
-                    $('.digitize-style-predefined input[name="marker-symbol"]').val(cls).change();
-                }
-            });
+        editStyleDialog.find('form input').bind('change', function() {
+            editStyleDialog.find('.digitize-style-' + $(this).val()).css('display', 'block').siblings('table').css('display', 'none');
+        });
 
-            var preview = editStyleDialog.find('.digitize-preview');
-            preview.html('');
-            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 + '"],select[name="' + k + '"]').val(v);
-                if(k === 'stroke-opacity') {
-                    editStyleDialog.find('.opacity-slider[data-name="stroke-opacity"]').slider('value', v * 100);
-                }
-                if(k === 'fill-opacity') {
-                    editStyleDialog.find('.opacity-slider[data-name="fill-opacity"]').slider('value', v * 100);
-                }
-                if(k === 'marker-symbol' && feature.properties['marker-type'] === 'predefined') {
-                    editStyleDialog.find('input[name="marker-symbol"]').val('icon-' + v + '-24');
-                }
-            });
+        editStyleDialog.find('button[name="digitize-reset-style"]').bind('click', function() {
+            if(ispoint) {
+                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');
+                editStyleDialog.find('.digitize-style-custom input[name="marker-symbol"]').val('../img/marker/red.png');
+                editStyleDialog.find('.digitize-style-custom input[name="marker-size"]').val(20);
+                editStyleDialog.find('.digitize-style-predefined input[name="marker-symbol"]').val('icon-airfield-24');
+                editStyleDialog.find('.digitize-style-predefined input[name="marker-size"]').val('medium');
+                editStyleDialog.find('.digitize-style-predefined input[name="marker-color"]').spectrum('set', 'white');
+            }
+            editStyleDialog.find('input[name="stroke"]').spectrum('set', '#555555');
+            editStyleDialog.find('.opacity-slider').slider('value', 100);
+            editStyleDialog.find('input[name="stroke-width"]').val(1);
+            editStyleDialog.find('input[name="fill"]').spectrum('set', '#555555');
+        });
 
-            editStyleDialog.find('form input').bind('change', function() {
-                editStyleDialog.find('.digitize-style-' + $(this).val()).css('display', 'block').siblings('table').css('display', 'none');
-            });
+editStyleDialog.find('input,select').bind('change', function() {
+    if(isline && $(this).attr('name').match(/fill/)) {
+        return;
+    }
 
-            editStyleDialog.find('button[name="digitize-reset-style"]').bind('click', function() {
-                if(ispoint) {
-                    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');
-                    editStyleDialog.find('.digitize-style-custom input[name="marker-symbol"]').val('../img/marker/red.png');
-                    editStyleDialog.find('.digitize-style-custom input[name="marker-size"]').val(20);
-                    editStyleDialog.find('.digitize-style-predefined input[name="marker-symbol"]').val('icon-airfield-24');
-                    editStyleDialog.find('.digitize-style-predefined input[name="marker-size"]').val('medium');
-                    editStyleDialog.find('.digitize-style-predefined input[name="marker-color"]').spectrum('set', 'white');
-                }
-                editStyleDialog.find('input[name="stroke"]').spectrum('set', '#555555');
-                editStyleDialog.find('.opacity-slider').slider('value', 100);
-                editStyleDialog.find('input[name="stroke-width"]').val(1);
-                editStyleDialog.find('input[name="fill"]').spectrum('set', '#555555');
-            });
+    if(!ispoint && $(this).attr('name').match(/marker/)) {
+        return;
+    }
 
-            editStyleDialog.find('input,select').bind('change', function() {
-                if(isline && $(this).attr('name').match(/fill/)) {
-                    return;
-                }
+    if($(this).attr('name') === 'stroke-width') {
+        var val = $(this).val();
+        if(!(!isNaN(parseFloat(val)) && isFinite(val)) || $(this).val() <= 0) {
+            $(this).css('background-color', 'red');
+            $(this).val(feature.properties['stroke-width']);
+        } else {
+            $(this).css('background-color', '');
+        }
+    }
 
-                if(!ispoint && $(this).attr('name').match(/marker/)) {
-                    return;
-                }
+    feature.properties[$(this).attr('name')] = $(this).val();
 
-                if($(this).attr('name') === 'stroke-width') {
-                    var val = $(this).val();
-                    if(!(!isNaN(parseFloat(val)) && isFinite(val)) || $(this).val() <= 0) {
-                        $(this).css('background-color', 'red');
-                        $(this).val(feature.properties['stroke-width']);
-                    } else {
-                        $(this).css('background-color', '');
-                    }
-                }
+    if($(this).attr('name') === 'marker-symbol' && editStyleDialog.find('input[name="marker-type"]').val() == 'predefined') {
+        var m = $(this).val().match(/^icon-(.+)-24$/);
+        if(m) {
+            feature.properties['marker-symbol'] = m[1];
+        }
+    }
 
-                feature.properties[$(this).attr('name')] = $(this).val();
+    kml.render();
+    var preview = editStyleDialog.find('.digitize-preview').html('').get(0);
+    kml.renderPreview(feature, preview);
+    preview = editDialog.find('.digitize-preview').html('').get(0);
+    kml.renderPreview(feature, preview);
+    preview = attributesDialog.find('.digitize-preview').html('').get(0);
+    kml.renderPreview(feature, preview);
+});
+$('.opacity-slider').slider('option', 'change', function() {
+    if(isline && $(this).attr('data-name') === 'fill-opacity') {
+        return;
+    }
+    feature.properties[$(this).attr('data-name')] = $(this).slider('value') / 100;
+    kml.render();
+    var preview = editStyleDialog.find('.digitize-preview').html('').get(0);
+    kml.renderPreview(feature, preview);
+});
+editStyleDialog.find('.digitize-save').bind('click', function() {
+    editStyleDialog.dialog('close');
+    feature.properties.updated = new Date().toISOString();
+    kml.refresh(url);
+});
+editStyleDialog.find('input[name="fill"]').spectrum({showInput: true});
+editStyleDialog.find('input[name="stroke"]').spectrum({showInput: true});
+editStyleDialog.find('input[name="marker-color"]').spectrum({showInput: true});
+editStyleDialog.find('input').change();
+if(menu)
+    menu.menu('destroy').remove();
+};
+};
 
-                if($(this).attr('name') === 'marker-symbol' && editStyleDialog.find('input[name="marker-type"]').val() == 'predefined') {
-                    var m = $(this).val().match(/^icon-(.+)-24$/);
-                    if(m) {
-                        feature.properties['marker-symbol'] = m[1];
-                    }
-                }
-
-                kml.render();
-                var preview = editStyleDialog.find('.digitize-preview').html('').get(0);
-                kml.renderPreview(feature, preview);
-                preview = editDialog.find('.digitize-preview').html('').get(0);
-                kml.renderPreview(feature, preview);
-                preview = attributesDialog.find('.digitize-preview').html('').get(0);
-                kml.renderPreview(feature, preview);
-            });
-            $('.opacity-slider').slider('option', 'change', function() {
-                if(isline && $(this).attr('data-name') === 'fill-opacity') {
-                    return;
-                }
-                feature.properties[$(this).attr('data-name')] = $(this).slider('value') / 100;
-                kml.render();
-                var preview = editStyleDialog.find('.digitize-preview').html('').get(0);
-                kml.renderPreview(feature, preview);
-            });
-            editStyleDialog.find('.digitize-save').bind('click', function() {
-                editStyleDialog.dialog('close');
-                feature.properties.updated = new Date().toISOString();
-                kml.refresh(url);
-            });
-            editStyleDialog.find('input[name="fill"]').spectrum({showInput: true});
-            editStyleDialog.find('input[name="stroke"]').spectrum({showInput: true});
-            editStyleDialog.find('input[name="marker-color"]').spectrum({showInput: true});
-            editStyleDialog.find('input').change();
-            if(menu)
-                menu.menu('destroy').remove();
-        };
-    };
-
-    var contextmenuObject = function() {
-        var $link = $(this);
-        if($link.attr('idx') === undefined) {
-            $link = $link.parent();
-        }
-        var menu = $(geomMenu);
-        if ( $( '.digitize-contextmenu' ).length != 0 ) {
-            return;
-        }
-        $(document.body).append(menu);
-        var pos = $link.offset();
-        menu.css({position: 'absolute', top: pos.top, left: pos.left, width: "120px"}).menu()
-            .children().addClass('ui-menu-item')
-            .hover(function() {$(this).addClass('ui-state-hover'); },
-                   function() {$(this).removeClass('ui-state-hover'); });
-        menu.children('li:has(.digitize-zoomto)').bind('click', function() {
-            var kml = $('#mapframe1').data('kml');
-            var url = $link.parent().parent().attr('title');
-            kml.zoomToFeature(url, $link.attr('idx'));
-            menu.menu('destroy').remove();
+var contextmenuObject = function() {
+    var $link = $(this);
+    if($link.attr('idx') === undefined) {
+        $link = $link.parent();
+    }
+    var menu = $(geomMenu);
+    if ( $( '.digitize-contextmenu' ).length != 0 ) {
+        return;
+    }
+    $(document.body).append(menu);
+    var pos = $link.offset();
+    menu.css({position: 'absolute', top: pos.top, left: pos.left, width: "120px"}).menu()
+    .children().addClass('ui-menu-item')
+    .hover(function() {$(this).addClass('ui-state-hover'); },
+           function() {$(this).removeClass('ui-state-hover'); });
+    menu.children('li:has(.digitize-zoomto)').bind('click', function() {
+        var kml = $('#mapframe1').data('kml');
+        var url = $link.parent().parent().attr('title');
+        kml.zoomToFeature(url, $link.attr('idx'));
+        menu.menu('destroy').remove();
+    });
+    menu.children('li:has(.digitize-pencil)').bind('click', editObject($link, menu));
+    menu.children('li:has(.digitize-export)').bind('click', function() {
+        var kml  = $('#mapframe1').data('kml');
+        var url  = $link.parent().parent().attr('title');
+        var idx  = $link.attr('idx');
+        var data = kml._kmls[url];
+        exportItem(data.data.features[idx]);
+        menu.menu('destroy').remove();
+    });
+    menu.children('li:has(.digitize-remove)').bind('click', function() {
+        var kml = $('#mapframe1').data('kml');
+        var url = $link.parent().parent().attr('title');
+        var ids = [];
+        var i = 0;
+        $.each($link.siblings(), function(k, v) {
+            ids.push($(v).attr('idx'));
+            $(v).attr('idx', i++);
         });
-        menu.children('li:has(.digitize-pencil)').bind('click', editObject($link, menu));
-        menu.children('li:has(.digitize-export)').bind('click', function() {
-            var kml  = $('#mapframe1').data('kml');
-            var url  = $link.parent().parent().attr('title');
-            var idx  = $link.attr('idx');
-            var data = kml._kmls[url];
-            exportItem(data.data.features[idx]);
-            menu.menu('destroy').remove();
-        });
-        menu.children('li:has(.digitize-remove)').bind('click', function() {
-            var kml = $('#mapframe1').data('kml');
-            var url = $link.parent().parent().attr('title');
-            var ids = [];
-            var i = 0;
-            $.each($link.siblings(), function(k, v) {
-                ids.push($(v).attr('idx'));
-                $(v).attr('idx', i++);
-            });
-            $link.remove();
-            kml.reorderFeatures(url, ids);
+        $link.remove();
+        kml.reorderFeatures(url, ids);
 
-            menu.menu('destroy').remove();
-        });
-        menu.children('li:has(.digitize-style)').bind('click', function() {
-            editDialog.dialog('close');
-            editStyle($link, menu)();
-        });
-        return false;
-    };
+        menu.menu('destroy').remove();
+    });
+    menu.children('li:has(.digitize-style)').bind('click', function() {
+        editDialog.dialog('close');
+        editStyle($link, menu)();
+    });
+    return false;
+};
 
-    var editAttributes = function(feature, kml, url) {
+var editAttributes = function(feature, kml, url) {
 
-        return function() {
+    return function() {
 
-            if ($(this).hasClass('editFeatureCollection')) {
+        if ($(this).hasClass('editFeatureCollection')) {
                     // kml = $('#mapframe1').data('kml');
                     var oldCollectionName;
                     if (feature.hasOwnProperty('@context')) {
@@ -626,12 +626,12 @@
                     });
 
                     var featureCollectionContent = "<div class='digitize-image digitize-style'></div>"+
-                                                    "<br><br>"+
-                                                    "<div><table id='featureCollTbl'>"+
-                                                    "</table></div>"+
-                                                    "<br><br/>"+
-                                                    "<div class='digitize-image digitize-add'></div>"+
-                                                    "<div class='digitize-image digitize-save'></div>";
+                    "<br><br>"+
+                    "<div><table id='featureCollTbl'>"+
+                    "</table></div>"+
+                    "<br><br/>"+
+                    "<div class='digitize-image digitize-add'></div>"+
+                    "<div class='digitize-image digitize-save'></div>";
                     $('#featureCollAttrDlg').append(featureCollectionContent);
                     $.each(feature, function(index, val) {
                         if (index == 'uuid' || index == 'created' || index == 'updated') {
@@ -677,10 +677,10 @@
                         }
                 // var preview = attributesDialog.find('.digitize-preview').html('').get(0);
                 // kml.renderPreview(feature, preview);
-                });
+            });
 
                 // add row
-                    featureCollAttrDlg.find('.digitize-add').bind('click', function() {
+                featureCollAttrDlg.find('.digitize-add').bind('click', function() {
                     var newRow = $('<tr><td><input type="text"></input></td><td><input class="newInputValue" name="" type="text"></input></td></tr>');
                     $(newRow).find('.newInputValue').bind('keyup',function(){
                         $(this).attr('name',$(this).val());
@@ -702,17 +702,17 @@
                 //  differentiate between the geometry-type
                 switch(feature.geometry.type){
                     case "Point":
-                        schemaInstance = instantiate( options.pointAttributesSchema );
-                        geomType = "Point"
-                        break;
+                    schemaInstance = instantiate( options.pointAttributesSchema );
+                    geomType = "Point"
+                    break;
                     case "Polygon":
-                        schemaInstance = instantiate( options.polygonAttributesSchema );
-                        geomType = "Polygon"
-                        break;
+                    schemaInstance = instantiate( options.polygonAttributesSchema );
+                    geomType = "Polygon"
+                    break;
                     case "Polyline":
-                        schemaInstance = instantiate( options.polylineAttributesSchema );
-                        geomType = "Polyline"
-                        break;
+                    schemaInstance = instantiate( options.polylineAttributesSchema );
+                    geomType = "Polyline"
+                    break;
                 }
                 attributesDialog.dialog('open');
                 attributesDialog.find('*').unbind();
@@ -763,7 +763,7 @@
                     //get parent and change updated
                     if($('#mapframe1').data('kml')._kmls[url].data.hasOwnProperty('updated')){
 
-                    	$('#mapframe1').data('kml')._kmls[url].data.updated = new Date().toISOString();
+                        $('#mapframe1').data('kml')._kmls[url].data.updated = new Date().toISOString();
                     }
 
                     attributesDialog.dialog('close');
@@ -850,8 +850,6 @@
                 $(this).addClass('active').siblings().removeClass('active');
             });
             editDialog.find('.digitize-move-vertex').bind('click', function() {
-                console.log( o );
-                console.log( o.$target );
                 o.$target.mb_digitize('moveVertexMode');
                 $(this).addClass('active').siblings().removeClass('active');
             });
@@ -877,9 +875,9 @@
         $(document.body).append(menu);
         var pos = $link.offset();
         menu.css({position: 'absolute', top: pos.top, left: pos.left, width: "120px"}).menu()
-            .children().addClass('ui-menu-item')
-            .hover(function() {$(this).addClass('ui-state-hover'); },
-                   function() {$(this).removeClass('ui-state-hover'); });
+        .children().addClass('ui-menu-item')
+        .hover(function() {$(this).addClass('ui-state-hover'); },
+               function() {$(this).removeClass('ui-state-hover'); });
         menu.children('li:has(.digitize-zoomto)').bind('click', function() {
             $link.click();
             menu.menu('destroy').remove();
@@ -943,178 +941,196 @@
             });
             menu.menu('destroy').remove();
         });
-        return false;
-    };
+return false;
+};
 
-    var finishDigitize = function () {
-        inProgress = false;
-        that.deactivate();
-        status = 'created-new';
+var finishDigitize = function () {
+    inProgress = false;
+    that.deactivate();
+    status = 'created-new';
 
-        var kml = $('#mapframe1').data('kml');
-        if(kml) {
-            var digit = o.$target.data('mb_digitize');
-            var pts = digit._digitizePoints;
+    var kml = $('#mapframe1').data('kml');
+    if(kml) {
+        var digit = o.$target.data('mb_digitize');
+        var pts = digit._digitizePoints;
 
-            attributesDialog.html(editAttributesHtml);
-            attributesDialog.dialog('open');
-                attributesDialog.find('.digitize-add').bind('click', function() {
-                    var newRow = $('<tr><td><input type="text"></input></td><td><input type="text"></input></td></tr>');
-                    attributesDialog.find('table').append(newRow);
-                    newRow.find('input').first().bind('change', function() {
-                        newRow.find('input').last().attr('name', $(this).val());
-                    });
-                });
-            attributesDialog.find('.digitize-save').bind('click', function() {
-                kml.addGeometry(pts, digitizingFor, attributesDialog);
-                attributesDialog.find('.digitize-save').unbind('click');
-                attributesDialog.dialog('close');
+        attributesDialog.html(editAttributesHtml);
+        attributesDialog.dialog('open');
+        attributesDialog.find('.digitize-add').bind('click', function() {
+            var newRow = $('<tr><td><input type="text"></input></td><td><input type="text"></input></td></tr>');
+            attributesDialog.find('table').append(newRow);
+            newRow.find('input').first().bind('change', function() {
+                newRow.find('input').last().attr('name', $(this).val());
             });
-        }
-    };
+        });
+        attributesDialog.find('.digitize-save').bind('click', function() {
+            kml.addGeometry(pts, digitizingFor, attributesDialog);
+            attributesDialog.find('.digitize-save').unbind('click');
+            attributesDialog.dialog('close');
+        });
+    }
+};
 
-    var reinitializeDigitize = function () {
-        inProgress = false;
-        that.deactivate();
-        that.activate();
-    };
+var reinitializeDigitize = function () {
+    inProgress = false;
+    that.deactivate();
+    that.activate();
+};
 //TODO: exchange the use of proj4js with postgis transform funktion!
- var featureModified = function() {
+var featureModified = function() {
 
-        var kml = $('#mapframe1').data('kml');
-        var digit = o.$target.data('mb_digitize');
-        var geom = new Geometry();
-        var geomType = editedFeature.geometry.type.toLowerCase();
+    var kml = $('#mapframe1').data('kml');
+    var digit = o.$target.data('mb_digitize');
+    var geom = new Geometry();
+    var geomType = editedFeature.geometry.type.toLowerCase();
         //digit.modeOff();
-        var pts = $.extend(true, {}, digit._digitizePoints);
-        $.each(pts, function(_, v) {
-            if(!$.isPlainObject(v.pos)) {
-                v.pos = {x: v.pos.x, y: v.pos.y};
+    var pts = $.extend(true, {}, digit._digitizePoints);
+    $.ajax({
+        url: '../php/transformPoint.php',
+        type: 'POST',
+        dataType: 'json',
+        data: {
+            point_pos: JSON.stringify(pts),
+            targetProj: JSON.stringify(kml.targetProj),
+            currentProj: JSON.stringify(kml.wgs84)
+        },
+        success: function(data) {
+
+            $.each(data.coordinates, function(index, val) {
+                if(!$.isPlainObject(pts[index].pos)) {
+                    pts[index].pos = {x: pts[index].pos.x, y: pts[index].pos.y};
+                }
+                pts[index].pos = {x:val[0], y:val[1]};
+                var newPoint = {x:val[0], y:val[1]};
+                geom.addPoint(newPoint);
+            });
+            geom.geomType = geomType;
+            var multi = new MultiGeometry(geomType);
+            multi.add(geom);
+
+
+            if(status === 'edit-point') {
+                editedFeature.geometry.coordinates = [pts[0].pos.x, pts[0].pos.y];
+            } else if(status === 'edit-line') {
+                editedFeature.geometry.coordinates = [];
+                $.each(pts, function(_, v) {
+                    editedFeature.geometry.coordinates.push([v.pos.x, v.pos.y]);
+                });
+            } else if(status === 'edit-polygon') {
+                editedFeature.geometry.coordinates = [[]];
+                $.each(pts, function(_, v) {
+                    editedFeature.geometry.coordinates[0].push([v.pos.x, v.pos.y]);
+                });
             }
-            var newPoint = Proj4js.transform(kml.targetProj, kml.wgs84, v.pos);
-            // Proj4js.transform(kml.targetProj, kml.wgs84, v.pos);
-            geom.addPoint(newPoint);
-        });
-        geom.geomType = geomType;
-        var multi = new MultiGeometry(geomType);
-        multi.add(geom);
+            // cloning the geoms to calculate the area or length
+            var modifiedGeom = $.extend(true, {}, geom);
+            var modifiedData = new MultiGeometry(geomType);
 
+            if (geomType == 'polygon') {
+                modifiedGeom.addPoint(geom.list[0]); // add first point as last point
+                modifiedData.add(modifiedGeom);
 
-        if(status === 'edit-point') {
-            editedFeature.geometry.coordinates = [pts[0].pos.x, pts[0].pos.y];
-        } else if(status === 'edit-line') {
-            editedFeature.geometry.coordinates = [];
-            $.each(pts, function(_, v) {
-                editedFeature.geometry.coordinates.push([v.pos.x, v.pos.y]);
-            });
-        } else if(status === 'edit-polygon') {
-            editedFeature.geometry.coordinates = [[]];
-            $.each(pts, function(_, v) {
-                editedFeature.geometry.coordinates[0].push([v.pos.x, v.pos.y]);
-            });
-        }
-        // cloning the geoms to calculate the area or length
-        var modifiedGeom = $.extend(true, {}, geom);
-        var modifiedData = new MultiGeometry(geomType);
+            } else {
 
-        if (geomType == 'polygon') {
-            modifiedGeom.addPoint(geom.list[0]); // add first point as last point
-            modifiedData.add(modifiedGeom);
+                modifiedData.add(modifiedGeom);
+            }
+            if (status != 'edit-point') {
 
-        } else {
+                // calculate current area (polygon) or length(linestring)
+                $.ajax({
+                    url: '../php/mod_CalculateAreaAndLength.php',
+                    type: 'POST',
+                    dataType: 'json',
+                    data: {
+                        geom_type: geomType,
+                        wkt_geom: modifiedData.toText()
+                    },
+                    success: function(data) {
 
-            modifiedData.add(modifiedGeom);
-        }
-        if (status != 'edit-point') {
+                        if (geom.geomType == 'polygon') {
+                            //TODO: use attributes area and length - not complex strings!
+                            editedFeature.properties['area'] = data[0];
+                            editedFeature.properties['boundary-length'] = data[1];
 
-            // calculate current area (polygon) or length(linestring)
-            $.ajax({
-                url: '../php/mod_CalculateAreaAndLength.php',
-                type: 'POST',
-                dataType: 'json',
-                data: {
-                    geom_type: geomType,
-                    wkt_geom: modifiedData.toText()
-                },
-                success: function(data) {
+                        }   else {
 
-                    if (geom.geomType == 'polygon') {
-			//TODO: use attributes area and length - not complex strings!
-                        editedFeature.properties['area'] = data[0];
-                        editedFeature.properties['boundary-length'] = data[1];
+                            editedFeature.properties['track-length'] = data[0];
+                        }
 
-                    } else {
+                    },
+                    complete: function() {
 
-                        editedFeature.properties['track-length'] = data[0];
-                    }
 
-                },
-                complete: function() {
+                        editedFeature.properties.updated = new Date().toISOString();
+                        kml.refresh(digitizingFor);
 
+                    }
+                });
 
-                    editedFeature.properties.updated = new Date().toISOString();
-                    kml.refresh(digitizingFor);
+            }else{
 
-                }
-            });
+                editedFeature.properties.updated = new Date().toISOString();
+                kml.refresh(digitizingFor);
 
-        }else{
+            }
 
-            editedFeature.properties.updated = new Date().toISOString();
-            kml.refresh(digitizingFor);
-
         }
-    };
+    });
+    // Proj4js.transform(kml.targetProj, kml.wgs84, v.pos);
+    // geom.addPoint(newPoint);
+// });
 
-    this.activate = function () {
-        $('#kml-digitizer-pseudo').click();
+};
 
-        var mode = status.match(/(new|edit)-.+/);
+this.activate = function () {
+    $('#kml-digitizer-pseudo').click();
 
-        if(!mode) {
-            return;
-        };
+    var mode = status.match(/(new|edit)-.+/);
 
-        mode = mode[1];
+    if(!mode) {
+        return;
+    };
 
-        if(mode === 'new') {
-            editDialog.dialog('close');
-            attributesDialog.dialog('close');
-            editStyleDialog.dialog('close');
-            if (o.$target.size() > 0) {
-                o.type = status.match(/new-(.+)/)[1];
-                o.editedFeature = null;
-                o.$target
-                    .mb_digitize(o)
-                    .mb_digitize('modeOff')
-                    .mb_digitize('startDigitizing')
-                    .unbind('mb_digitizelastpointadded')
-                    .unbind('mb_digitizereinitialize')
-                    .bind("mb_digitizelastpointadded", finishDigitize)
-                    .bind("mb_digitizereinitialize", reinitializeDigitize);
-            }
-        } else {
-            if(o.$target.size() > 0) {
-                o.type = status.match(/edit-(.+)/)[1];
-                o.editedFeature = editedFeature;
-                o.$target
-                .mb_digitize(o)
-                .mb_digitize('modeOff')
-                .unbind('mb_digitizefeaturemodified')
-                .bind('mb_digitizefeaturemodified', featureModified);
-            }
+    mode = mode[1];
+
+    if(mode === 'new') {
+        editDialog.dialog('close');
+        attributesDialog.dialog('close');
+        editStyleDialog.dialog('close');
+        if (o.$target.size() > 0) {
+            o.type = status.match(/new-(.+)/)[1];
+            o.editedFeature = null;
+            o.$target
+            .mb_digitize(o)
+            .mb_digitize('modeOff')
+            .mb_digitize('startDigitizing')
+            .unbind('mb_digitizelastpointadded')
+            .unbind('mb_digitizereinitialize')
+            .bind("mb_digitizelastpointadded", finishDigitize)
+            .bind("mb_digitizereinitialize", reinitializeDigitize);
         }
-        if (!inProgress) {
-            inProgress = true;
+    } else {
+        if(o.$target.size() > 0) {
+            o.type = status.match(/edit-(.+)/)[1];
+            o.editedFeature = editedFeature;
+            o.$target
+            .mb_digitize(o)
+            .mb_digitize('modeOff')
+            .unbind('mb_digitizefeaturemodified')
+            .bind('mb_digitizefeaturemodified', featureModified);
         }
-    };
+    }
+    if (!inProgress) {
+        inProgress = true;
+    }
+};
 
-    this.destroy = function () {
-        if (o.$target.size() > 0) {
-            o.$target.mb_digitize("destroy")
+this.destroy = function () {
+    if (o.$target.size() > 0) {
+        o.$target.mb_digitize("destroy")
             //              .unbind("mb_digitizepointadded", newPoint)
-                .unbind("mb_digitizelastpointadded", finishDigitize)
-                .unbind("mb_digitizereinitialize", reinitializeDigitize);
+            .unbind("mb_digitizelastpointadded", finishDigitize)
+            .unbind("mb_digitizereinitialize", reinitializeDigitize);
         }
         if (digitizeDialog.dialog("isOpen")) {
             digitizeDialog.dialog("close");
@@ -1145,7 +1161,7 @@
      * @param  {[type]} mappingSchema [description]
      * @return {[type]}               [description]
      */
-    var mapFeature = function( propertyKey, propertyValue, categories, mappingSchema, geomType, geometryDiv){
+     var mapFeature = function( propertyKey, propertyValue, categories, mappingSchema, geomType, geometryDiv){
 
         if ( propertyKey != "area" && propertyKey != "boundary-length" && propertyKey != "track-length" ) {
             // check if property exists in mappingSchema otherwise put it in custom-data
@@ -1157,11 +1173,11 @@
 
                     categories[featureCategory] += '<tr><td>' + propertyKey + '</td><td><input disabled type="text" name="' + propertyKey + '" value="' + propertyValue + '"></input></td></tr>';
                 // else allow to edit the input
-                } else {
+            } else {
 
-                    categories[featureCategory] += '<tr><td>' + propertyKey + '</td><td><input type="text" name="' + propertyKey + '" value="' + propertyValue + '"></input></td></tr>';
-                }
-            } else {
+                categories[featureCategory] += '<tr><td>' + propertyKey + '</td><td><input type="text" name="' + propertyKey + '" value="' + propertyValue + '"></input></td></tr>';
+            }
+        } else {
                 // put property in custom-data because it doesn't belong to any category
                 categories["Custom-Data"] += '<tr><td>' + propertyKey + '</td><td><input type="text" name="' + propertyKey + '" value="' + propertyValue + '"></input></td></tr>';
 
@@ -1171,14 +1187,14 @@
             // differentiate between the geometry-properties
             switch(propertyKey) {
                 case "area":
-                    header = "<?php echo _mb("Area [m²]");?>";
-                    break;
+                header = "<?php echo _mb("Area [m²]");?>";
+                break;
                 case "boundary-length":
-                    header = "<?php echo _mb("Boundary length [m]");?>";
-                    break;
+                header = "<?php echo _mb("Boundary length [m]");?>";
+                break;
                 case "track-length":
-                    header = "<?php echo _mb("Length [m]");?>";
-                    break;
+                header = "<?php echo _mb("Length [m]");?>";
+                break;
             }
             // append the matchin geometry-property to the geometryDiv
             geometryDiv.append('<div><p class = " geometry-p "name="' + propertyKey + '">'+ header +' : ' + propertyValue + '</p></div>');



More information about the Mapbender_commits mailing list