Opened 14 years ago
Closed 14 years ago
#1481 closed defect (fixed)
getselectedfeatures should use more efficient centroid processing
Reported by: | jng | Owned by: | jng |
---|---|---|---|
Priority: | high | Milestone: | 2.2 |
Component: | AJAX Viewer | Version: | 2.2.0 |
Severity: | major | Keywords: | |
Cc: | External ID: |
Description
The current getselectedfeatures.aspx/php/jsp uses MgGeometry.GetCentroid() to calculate the zoom location.
It turns out GetCentroid() does a full scan of the geometry's WKT.
For geometries with an absurd amount of vertices, this is a woefully inefficient method of calculating the centroid.
Since the purpose of this centroid is to be the zoom location, we don't exactly require a *precise* zoom location. Something approximate should suffice. So the centroid processing should change from this:
MgCoordinate pt = geom.Centroid.Coordinate zoom.X = pt.X; zoom.Y = pt.Y;
to this:
MgEnvelope env = geom.Envelope(); MgCoordinate ll = env.GetLowerLeftCoordinate(); MgCoordinate ur = env.GetUpperRightCoordinate(); zoom.X = (ur.X + ll.X) / 2; zoom.Y = (ur.Y + ll.Y) / 2;
Attachments (3)
Change History (5)
by , 14 years ago
Attachment: | getselectedfeaturesaspx.patch added |
---|
by , 14 years ago
Attachment: | getselectedfeaturesjsp.patch added |
---|
by , 14 years ago
Attachment: | getselectedfeaturesphp.patch added |
---|
comment:1 by , 14 years ago
Priority: | low → high |
---|
comment:2 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Fixed in 2.2 (r5312) and trunk (r5314)