This is the code in pm_draw.js:
function measureDrawSymbols(e, clickX, clickY, dblClick) {
// Polyline points number before to add the current click point
if(polyline.isClosed()){
polyline.reset();
}
var nPoints = polyline.getPointsNumber();
var clickPoint = new Point(clickX, clickY);
// Reset everything when last measure ended with double click
if (nPoints == 0) resetMeasure();
// Don't go outside map
if ((clickX < mapW) && (clickY < mapH)) {
// SINGLE CLICK
if (dblClick != 1) {
polyline.addPoint(new Point(clickX,clickY));
// First point for start click
if (nPoints < 1) {
drawLineSegment(jg,new Line(clickPoint, clickPoint));
// Fill distance between clicks with symbol points
}else{
// USE wz_jsgraphics.js TO DRAW LINE. lastSegment is of Line
type
var lastSegment = polyline.getLastSide();
var sidesNumber = polyline.getSidesNumber();
// check for the overlapping of the new side.
// it will never overlap with the previous side
if (sidesNumber > 2){
for (var s = 1 ; s < (sidesNumber-1); s++){
var intersectionPoint =
polyline.getSide(s).intersection(lastSegment);
if (intersectionPoint != null){
alert(localeList['digitize_over']);
polyline.delPoint(polyline.getPointsNumber()-1);
return;
}
}
}
drawLineSegment(jg,lastSegment);
// calls the handler of the side (segment) digitation and pass
it the polyline in px coords
onDigitizedSide(polyline);
}
// DOUBLE CLICK => CALCULATE AREA
} else if (dblClick) {
// Removes the last duplicated point because of the last 2
single
click
polyline.delPoint(polyline.getPointsNumber()-1);
// Closing the polyline to have a polygon
polyline.close();
// fix the last side
var lastSegment = polyline.getLastSide();
var sidesNumber = polyline.getSidesNumber();
// check for the overlapping of the closing side
// it will never overlap with the first and the last side
for (var s = 2 ; s < (sidesNumber-1); s++){
var intersectionPoint =
polyline.getSide(s).intersection(lastSegment);
if (intersectionPoint != null){
alert(localeList['digitize_over']);
polyline.delPoint(polyline.getPointsNumber()-1);
return false;
}
}
if(lastSegment != null){
drawLineSegment(jg,lastSegment);
}
// calls the handler of the polygon digitation before reset the
polygon
onDigitizedPolygon(polyline);
// remove all points from the polygon
//polyline.reset();
}
}
geoPolyline = toGeoPolygon(polyline);
}
Salvator*eL*arosa wrote:
>
> Sorry, the version is 3.1!
>
> thank for reply!
>
>
> Thomas RAFFIN wrote:
>>
>> Hi,
>>
>> What is your pmapper version please ?
>>
>> If you are using v4, you can:
>> - use the "measure2" plugin (see
>> http://svn.pmapper.net/trac/wiki/PluginsDynamicData#Measure2 for
>> documentation)
>> - modifiy the javascript/src/pm.draw.js file.
>>
>> Salvator*eL*arosa a écrit :
>>> Hello everyone,
>>> I need to change the function measure, so that to double click will give
>>> me
>>> the distance of the segment when the number of segments is less than 1.
>>> This is possible by modifying the code?
>>> How can I do?
>>>
>>> When I measure a distance and I double-click gives me double the
>>> distance!
>>>
>>> Thanks!
>>>
>>> -----
>>> Salvatore Larosa
>>> GPG: 0xE504BBE2 (FP: D9B2 CA87 81CD 1B91 E24D 3B42 D0F7 FA01 E504 BBE2)
>>>
>>
>> ------------------------------------------------------------------------------
>> Join us December 9, 2009 for the Red Hat Virtual Experience,
>> a free event focused on virtualization and cloud computing.
>> Attend in-depth sessions from your desk. Your couch. Anywhere.
>> http://p.sf.net/sfu/redhat-sfdev2dev
>> _______________________________________________
>> pmapper-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/pmapper-users
>>
>>
>
>
-----
Salvatore Larosa
GPG: 0xE504BBE2 (FP: D9B2 CA87 81CD 1B91 E24D 3B42 D0F7 FA01 E504 BBE2)
--
View this message in context:
http://old.nabble.com/Measure-Distance-tp26590040p26590910.html
Sent from the pmapper users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
pmapper-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pmapper-users