[fusion-trac] #366: Measure: wrong length and segments
displayed when measure with a line
Fusion
trac_fusion at osgeo.org
Mon Mar 8 22:39:01 EST 2010
#366: Measure: wrong length and segments displayed when measure with a line
---------------------+------------------------------------------------------
Reporter: liuar | Owner: madair
Type: defect | Status: new
Priority: P2 | Milestone: 2.0
Component: Widgets | Version: 2.0 - beta
Severity: Major | Resolution:
Keywords: | External_id: 1307260,1394066
State: New | Browser: All
Os: All |
---------------------+------------------------------------------------------
Changes (by liuar):
* cc: jennyhe (removed)
* cc: jie.tan at autodesk.com (added)
* version: 1.1.1 => 2.0 - beta
* external_id: 1307260,1272713 => 1307260,1394066
* milestone: Future => 2.0
Comment:
[Analysis][[BR]]
If the measure type is set to Area, a polygon will e created no matter how
many point are added. For instance, if user adds two points Point(0,0) and
Point(1,1) into the map, measure widget will create a polygon
Polygon((0,0) (1,1) (0,0))) which is not a valid polygon at all.[[BR]]
In Measure.js, var cg = geom.getCentroid(), which used the polygon's area
as a divisor in the implement. The cg.x and cg.y will be NaN and cause the
exception in Bing map.[[BR]]
[Solution][[BR]]
Check the geom's area before calcaulate the centroid. If the area equals
to zero, that means that the geom is invalid, and we just ignore the
followed opertionations.
--
Ticket URL: <http://trac.osgeo.org/fusion/ticket/366#comment:1>
Fusion <http://trac.osgeo.org/fusion>
Fusion is a web-mapping application development framework for MapServer and MapGuide OS.
More information about the fusion-trac
mailing list