[mapguide-commits] r8787 - in sandbox/adsk/3.0m: . Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Oct 19 01:44:02 PDT 2015


Author: christinebao
Date: 2015-10-19 01:44:02 -0700 (Mon, 19 Oct 2015)
New Revision: 8787

Modified:
   sandbox/adsk/3.0m/
   sandbox/adsk/3.0m/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.


Property changes on: sandbox/adsk/3.0m
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk:8728
   + /branches/2.4/MgDev:6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/branches/2.6/MgDev:8276-8286,8288-8292,8297,8299,8301,8303,8314-8315,8318,8335,8340,8354-8355,8365,8373
/sandbox/adsk/2.6l:8727
/sandbox/jng/convenience_apis:8262-8268,8271-8363
/sandbox/jng/createruntimemap:7486-7555
/sandbox/jng/dwftk:8321-8324,8328-8329,8331,8352
/sandbox/jng/geos34x:8256-8259
/sandbox/jng/tiling:8174-8208
/sandbox/jng/v30:8212-8227
/sandbox/rfc94:5099-5163
/trunk:8728
/trunk/MgDev:8728

Modified: sandbox/adsk/3.0m/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp
===================================================================
--- sandbox/adsk/3.0m/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp	2015-10-19 08:40:28 UTC (rev 8786)
+++ sandbox/adsk/3.0m/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp	2015-10-19 08:44:02 UTC (rev 8787)
@@ -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