[mapguide-commits] r8727 - sandbox/adsk/2.6l/Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Jul 30 21:02:43 PDT 2015
Author: christinebao
Date: 2015-07-30 21:02:43 -0700 (Thu, 30 Jul 2015)
New Revision: 8727
Modified:
sandbox/adsk/2.6l/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp
Log:
Fix ticket: GETFEATUREINFO for line or points on MapGuide 2.2
http://trac.osgeo.org/mapguide/ticket/1858
When GetFeatureInfo for point or line geometry, simply using click point to query cannot get any matching. Expand selection geometry a little to be a linearRing so that can query point and line.
Modified: sandbox/adsk/2.6l/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp
===================================================================
--- sandbox/adsk/2.6l/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp 2015-07-28 06:42:01 UTC (rev 8726)
+++ sandbox/adsk/2.6l/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp 2015-07-31 04:02:43 UTC (rev 8727)
@@ -154,14 +154,29 @@
Ptr<MgCoordinate> mcsLowerLeft = mcsExtent->GetLowerLeftCoordinate();
Ptr<MgCoordinate> mcsUpperRight = mcsExtent->GetUpperRightCoordinate();
+ //When GetFeatureInfo for point or line geometry, simply using click point to query cannot get any matching.
+ //Expand selection geometry a little to be a linearRing so that can query point and line.
+ double margin = 2;
// Convert the pixel coords to MCS coords
- double mcsX = mcsLowerLeft->GetX() + (double)m_iCoord * mcsExtent->GetWidth() / map->GetDisplayWidth();
- double mcsY = mcsUpperRight->GetY() - (double)m_jCoord * mcsExtent->GetHeight() / map->GetDisplayHeight();
+ double mcsMinX = mcsLowerLeft->GetX() + ((double)m_iCoord - margin) * mcsExtent->GetWidth() / map->GetDisplayWidth();
+ double mcsMaxY = mcsUpperRight->GetY() -((double)m_jCoord - margin) * mcsExtent->GetHeight() / map->GetDisplayHeight();
+ double mcsMaxX = mcsLowerLeft->GetX() + ((double)m_iCoord + margin)* mcsExtent->GetWidth() / map->GetDisplayWidth();
+ double mcsMinY = mcsUpperRight->GetY() -((double)m_jCoord + margin) * mcsExtent->GetHeight() / map->GetDisplayHeight();
+
// Create a new MgPoint representing these coordinates
- Ptr<MgCoordinateXY> selectionCoord = new MgCoordinateXY(mcsX, mcsY);
- selectionGeometry = new MgPoint(selectionCoord);
+ Ptr<MgGeometryFactory> geometryFact = new MgGeometryFactory();
+ Ptr<MgCoordinateCollection> linearRingCoords = new MgCoordinateCollection();
+ linearRingCoords->Add(new MgCoordinateXY(mcsMinX, mcsMinY));
+ linearRingCoords->Add(new MgCoordinateXY(mcsMinX, mcsMaxY));
+ linearRingCoords->Add(new MgCoordinateXY(mcsMaxX, mcsMaxY));
+ linearRingCoords->Add(new MgCoordinateXY(mcsMaxX, mcsMinY));
+ linearRingCoords->Add(new MgCoordinateXY(mcsMinX, mcsMinY));
+
+ Ptr<MgLinearRing> linearRing = geometryFact->CreateLinearRing(linearRingCoords);
+ selectionGeometry = geometryFact->CreatePolygon(linearRing, NULL);
+
return selectionGeometry;
}
More information about the mapguide-commits
mailing list