[Mapbender-commits] r8826 - in trunk/mapbender/http: css plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu May 8 02:28:20 PDT 2014
Author: hwbllmnn
Date: 2014-05-08 02:28:20 -0700 (Thu, 08 May 2014)
New Revision: 8826
Added:
trunk/mapbender/http/css/digitize_new.css
Modified:
trunk/mapbender/http/plugins/mb_digitize_widget.php
Log:
added skeleton KML digitizer tools
Added: trunk/mapbender/http/css/digitize_new.css
===================================================================
--- trunk/mapbender/http/css/digitize_new.css (rev 0)
+++ trunk/mapbender/http/css/digitize_new.css 2014-05-08 09:28:20 UTC (rev 8826)
@@ -0,0 +1,57 @@
+.fieldset-auto-width {
+ display: inline-block;
+}
+
+.digitize-image {
+ width: 20px;
+ height: 20px;
+ background-repeat: no-repeat;
+}
+
+.digitize-pencil {
+ background-image: url('../img/pencil.png');
+}
+
+.digitize-cursor {
+ background-image: url('../img/osgeo_graphics/geosilk/cursor.png');
+}
+
+.digitize-cursor.active {
+ background-image: url('../img/osgeo_graphics/geosilk/cursor_selected.png');
+}
+
+.digitize-remove {
+ background-image: url('../img/button_digitize/geomRemove.png');
+}
+
+.digitize-remove.active {
+ background-image: url('../img/button_digitize/geomRemove_selected.png');
+}
+
+.digitize-add {
+ background-image: url('../img/add.png');
+}
+
+.digitize-point {
+ background-image: url('../img/osgeo_graphics/geosilk/flag_red.png');
+}
+
+.digitize-point.active {
+ background-image: url('../img/osgeo_graphics/geosilk/flag_red_selected.png');
+}
+
+.digitize-line {
+ background-image: url('../img/osgeo_graphics/geosilk/line_red.png');
+}
+
+.digitize-line.active {
+ background-image: url('../img/osgeo_graphics/geosilk/line_red_selected.png');
+}
+
+.digitize-polygon {
+ background-image: url('../img/osgeo_graphics/geosilk/shape_square_red.png');
+}
+
+.digitize-polygon.active {
+ background-image: url('../img/osgeo_graphics/geosilk/shape_square_red_selected.png');
+}
Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-07 14:58:28 UTC (rev 8825)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-08 09:28:20 UTC (rev 8826)
@@ -66,78 +66,66 @@
var DigitizeApi = function (o) {
- var digitizeDialog,
- button,
- that = this,
- inProgress = false,
- title = o.title,
- defaultHtml = "<div title='" + title + "'>" +
- "<div class='mb-digitize-text'><?php
- echo nl2br(htmlentities(_mb("Click in the map to start measuring."), ENT_QUOTES, "UTF-8"));
- ?></div></div>",
- informationHtml =
- "<div><?php
- echo nl2br(htmlentities(_mb("Last point: "), ENT_QUOTES, "UTF-8"));
- ?><span class='mb-digitize-clicked-point' /></div>" +
- "<div><?php
- echo nl2br(htmlentities(_mb("Current point: "), ENT_QUOTES, "UTF-8"));
- ?><span class='mb-digitize-current-point' /></div>" +
- "<div><?php
- echo nl2br(htmlentities(_mb("Distance (to last point): "), ENT_QUOTES, "UTF-8"));
- ?><span class='mb-digitize-distance-last' /> <span class='mb-digitize-distance-last-unit' /></div>" +
- "<div><?php
- echo nl2br(htmlentities(_mb("Distance (total): "), ENT_QUOTES, "UTF-8"));
- ?><span class='mb-digitize-distance-total' /> <span class='mb-digitize-distance-total-unit' /></div>" +
- "<div><?php
- echo nl2br(htmlentities(_mb("Perimeter: "), ENT_QUOTES, "UTF-8"));
- ?><span class='mb-digitize-perimeter' /> <span class='mb-digitize-perimeter-unit' /></div>" +
- "<div><?php
- echo nl2br(htmlentities(_mb("Area: "), ENT_QUOTES, "UTF-8"));
- ?><span class='mb-digitize-area' /> <span class='mb-digitize-area-unit' /></div>" +
- "<div><?php
- echo nl2br(htmlentities(_mb("Angle: "), ENT_QUOTES, "UTF-8"));
- ?><span class='mb-digitize-angle' /> <span class='mb-digitize-angle-unit' /></div>";
+ var digitizeHtml = '<div title="Sketch">' +
+ '<button class="digitize-image digitize-pencil"></button>' +
+ '<fieldset class="fieldset-auto-width">' +
+ '<button class="digitize-image digitize-cursor"></button>' +
+ '<button class="digitize-image digitize-remove"></button>' +
+ '</fieldset><br></br>' +
+ '<button class="digitize-image digitize-add"></button>' +
+ '<fieldset class="fieldset-auto-width">' +
+ '<button class="digitize-image digitize-point"></button>' +
+ '<button class="digitize-image digitize-line"></button>' +
+ '<button class="digitize-image digitize-polygon"></button>' +
+ '</fieldset></div>';
- var hideDigitizeData = function () {
- digitizeDialog.find(".mb-digitize-clicked-point").parent().hide();
- digitizeDialog.find(".mb-digitize-current-point").parent().hide();
- digitizeDialog.find(".mb-digitize-distance-last").parent().hide();
- digitizeDialog.find(".mb-digitize-distance-total").parent().hide();
- digitizeDialog.find(".mb-digitize-perimeter").parent().hide();
- digitizeDialog.find(".mb-digitize-area").parent().hide();
+ var digitizeDialog,
+ button,
+ that = this,
+ inProgress = false,
+ title = o.title,
+ defaultHtml = digitizeHtml;
+
+ var hideDigitizeData = function () {
+ digitizeDialog.find(".mb-digitize-clicked-point").parent().hide();
+ digitizeDialog.find(".mb-digitize-current-point").parent().hide();
+ digitizeDialog.find(".mb-digitize-distance-last").parent().hide();
+ digitizeDialog.find(".mb-digitize-distance-total").parent().hide();
+ digitizeDialog.find(".mb-digitize-perimeter").parent().hide();
+ digitizeDialog.find(".mb-digitize-area").parent().hide();
digitizeDialog.find(".mb-digitize-angle").parent().hide();
- };
+ };
- var create = function () {
- //
- // Initialise digitize dialog
- //
- digitizeDialog = $(defaultHtml);
- digitizeDialog.dialog({
- autoOpen: false,
- position: [o.$target.offset().left, o.$target.offset().top]
- }).bind("dialogclose", function () {
- button.stop();
- that.destroy();
- });
+ var create = function () {
+ //
+ // Initialise digitize dialog
+ //
+ digitizeDialog = $(defaultHtml);
+ digitizeDialog.dialog({
+ autoOpen: false,
+ position: [o.$target.offset().left, o.$target.offset().top]
+ }).bind("dialogclose", function () {
+ button.stop();
+ that.destroy();
+ });
- //
- // Initialise button
- //
- button = new Mapbender.Button({
- domElement: $digitize.get(0),
- over: o.src.replace(/_off/, "_over"),
- on: o.src.replace(/_off/, "_on"),
- off: o.src,
- name: o.id,
- go: that.activate,
- stop: that.deactivate
- });
- };
+ //
+ // Initialise button
+ //
+ button = new Mapbender.Button({
+ domElement: $digitize.get(0),
+ over: o.src.replace(/_off/, "_over"),
+ on: o.src.replace(/_off/, "_on"),
+ off: o.src,
+ name: o.id,
+ go: that.activate,
+ stop: that.deactivate
+ });
+ };
- var finishDigitize = function () {
- inProgress = false;
- that.deactivate();
+ var finishDigitize = function () {
+ inProgress = false;
+ that.deactivate();
// TODO experimental
var kml = $('#mapframe1').data('kml');
if(kml) {
@@ -145,60 +133,60 @@
var pts = digit._digitizePoints;
kml.addGeometry(pts);
}
- };
+ };
- var reinitializeDigitize = function () {
- inProgress = false;
- that.deactivate();
- that.activate();
- };
+ var reinitializeDigitize = function () {
+ inProgress = false;
+ that.deactivate();
+ that.activate();
+ };
- this.activate = function () {
+ this.activate = function () {
//remove digitized x and y values from print dialog
$('input[name="digitized_x_values"]').val("");
$('input[name="digitized_y_values"]').val("");
- if (o.$target.size() > 0) {
- o.$target
- .mb_digitize(o)
+ if (o.$target.size() > 0) {
+ o.$target
+ .mb_digitize(o)
// .bind("mb_digitizepointadded", newPoint)
- .bind("mb_digitizelastpointadded", finishDigitize)
- .bind("mb_digitizereinitialize", reinitializeDigitize);
- }
- if (!inProgress) {
- inProgress = true;
- digitizeDialog.html(defaultHtml);
- }
+ .bind("mb_digitizelastpointadded", finishDigitize)
+ .bind("mb_digitizereinitialize", reinitializeDigitize);
+ }
+ if (!inProgress) {
+ inProgress = true;
+ digitizeDialog.html(defaultHtml);
+ }
- digitizeDialog.dialog("open");
- };
+ digitizeDialog.dialog("open");
+ };
- 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);
- }
- hideDigitizeData();
+ .unbind("mb_digitizelastpointadded", finishDigitize)
+ .unbind("mb_digitizereinitialize", reinitializeDigitize);
+ }
+ hideDigitizeData();
- if (digitizeDialog.dialog("isOpen")) {
- digitizeDialog.dialog("close");
- }
- digitizeDialog.html(defaultHtml);
+ if (digitizeDialog.dialog("isOpen")) {
+ digitizeDialog.dialog("close");
+ }
+ digitizeDialog.html(defaultHtml);
//remove digitized x and y values from print dialog
$('input[name="digitized_x_values"]').val("");
$('input[name="digitized_y_values"]').val("");
- };
+ };
- this.deactivate = function () {
- if (o.$target.size() > 0) {
- o.$target.mb_digitize("deactivate");
- }
- };
+ this.deactivate = function () {
+ if (o.$target.size() > 0) {
+ o.$target.mb_digitize("deactivate");
+ }
+ };
- create();
+ create();
};
$digitize.mapbender(new DigitizeApi(options));
More information about the Mapbender_commits
mailing list