[mapguide-commits] r8729 - in branches/3.0/MgDev: . Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jul 31 07:02:53 PDT 2015


Author: jng
Date: 2015-07-31 07:02:53 -0700 (Fri, 31 Jul 2015)
New Revision: 8729

Modified:
   branches/3.0/MgDev/
   branches/3.0/MgDev/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp
Log:
Merged revision(s) 8728 from trunk/MgDev:
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: branches/3.0/MgDev
___________________________________________________________________
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/adsk/3.0m:8563,8584,8607,8625,8694-8695
/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/MgDev:8595,8616-8618,8626,8682,8700
   + /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/adsk/3.0m:8563,8584,8607,8625,8694-8695
/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/MgDev:8595,8616-8618,8626,8682,8700,8728

Modified: branches/3.0/MgDev/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp
===================================================================
--- branches/3.0/MgDev/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp	2015-07-31 06:59:37 UTC (rev 8728)
+++ branches/3.0/MgDev/Web/src/HttpHandler/HttpWmsGetFeatureInfo.cpp	2015-07-31 14:02:53 UTC (rev 8729)
@@ -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