Opened 14 years ago

Closed 14 years ago

#1521 closed enhancement (fixed)

Use mouse wheel to zoom map in the "Digitize" process

Reported by: wuma Owned by: Mars Wu
Priority: low Milestone:
Component: AJAX Viewer Version: 2.2.0
Severity: minor Keywords:
Cc: External ID: 1309956

Description

When it is in "Digitize Polygon" or "Digitize LineString" process, there is no way to zoom in the map. Sometimes to digitize a precise shape, it's necessary to zoom in so that the vertex of the polygon could be digitized as precise as possible.

This patch implements it this way:

  1. Add a ScaleFeedback method for the digitizers. E.g.

PolygonDigitizer.ScaleFeedback = function(scale, origin)

{

for (var i = 0; i < this.xs.length; ++i) {

var x = this.xs[i]; this.xs[i] = origin.X + (scale * (x - origin.X)); var y = this.ys[i]; this.ys[i] = origin.Y + (scale * (y - origin.Y));

}

this.Feedback(origin.X, origin.Y);

}

  1. Modify GotoView function in Ajaxmappane.templ to scale the digitize feedbacks when the view is changed.

function GotoView(x,y,scale,tohistory,moveovimg) {

scale = finscale? GetNearestFiniteScale(scale): NormalizeScale(scale); var zoom; if(zoom = (scale != curScale)) {

HideMapImage(); requestTiles = true;

Update the digitize feedback if (digitizing) {

if (typeof digitizer.ScaleFeedback != "undefined") {

digitizer.ScaleFeedback(curScale / scale, new Point(wheelZoomCursor.X, wheelZoomCursor.Y));

}

}

} else {....

Above change can handle the zoom change. The digitize feedbacks will be changed after the zoom has finished. The reason why we don't provide a "instant" scale feedback (the digitize feedbacks will be updated according to every single mouse wheel change) is because redrawing the digitize feedbacks needs regenerating hundreds of <div> elements which is very CPU consuming.

Attachments (1)

zoom_in_digitize.patch (1.1 KB ) - added by wuma 14 years ago.

Download all attachments as: .zip

Change History (2)

by wuma, 14 years ago

Attachment: zoom_in_digitize.patch added

comment:1 by wuma, 14 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.