[mapguide-trac] #1858: GETFEATUREINFO for line or points on MapGuide 2.2

MapGuide Open Source trac_mapguide at osgeo.org
Mon Mar 26 15:50:30 EDT 2012


#1858: GETFEATUREINFO for line or points on MapGuide 2.2
-----------------------------+----------------------------------------------
   Reporter:  mapaquin       |       Owner:                                
       Type:  defect         |      Status:  new                           
   Priority:  high           |   Milestone:                                
  Component:  WMS Interface  |     Version:  2.2.0                         
   Severity:  trivial        |    Keywords:  Point Lines WMS GETFEATUREINFO
External_id:                 |  
-----------------------------+----------------------------------------------

Comment(by beginbenoit):

 Perhaps the following patch would be useful to get this resolved.

 {{{
 MgGeometry* MgHttpWmsGetFeatureInfo::GetSelectionGeometry(MgMap* map)
 {
     MgGeometry* selectionGeometry = NULL;

     // Get the lower left and upper right map coords in MCS
     Ptr<MgEnvelope> mcsExtent = map->GetMapExtent();
     Ptr<MgCoordinate> mcsLowerLeft = mcsExtent->GetLowerLeftCoordinate();
     Ptr<MgCoordinate> mcsUpperRight =
 mcsExtent->GetUpperRightCoordinate();

     // Convert the pixel coords to MCS coords
     double mcsMinX = mcsLowerLeft->GetX() + ((double)m_iCoord - 2) *
 mcsExtent->GetWidth() / map->GetDisplayWidth();
     double mcsMinY = mcsUpperRight->GetY() -((double)m_jCoord - 2) *
 mcsExtent->GetHeight() / map->GetDisplayHeight();

     double mcsMaxX = mcsLowerLeft->GetX() + ((double)m_iCoord + 2)*
 mcsExtent->GetWidth() / map->GetDisplayWidth();
     double mcsMaxY = mcsUpperRight->GetY() -((double)m_jCoord + 2) *
 mcsExtent->GetHeight() / map->GetDisplayHeight();

     // Create a new MgPoint representing these coordinates
     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;
 }
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/mapguide/ticket/1858#comment:5>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals


More information about the mapguide-trac mailing list