<%-- Copyright (C) 2004-2008 by Autodesk, Inc. This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public License as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --%> <%@ Page language="c#" validateRequest="false" %> <%@ Import Namespace="System" %> <%@ Import Namespace="System.IO" %> <%@ Import Namespace="System.Collections" %> <%@ Import Namespace="System.Collections.Specialized" %> <%@ Import Namespace="System.Text" %> <%@ Import Namespace="OSGeo.MapGuide" %> <% Response.Charset = "utf-8"; GetRequestParameters(); try { InitializeWebTier(); MgUserInformation cred = new MgUserInformation(sessionId); //connect to the site and get an instance of each service used in this script // MgSiteConnection site = new MgSiteConnection(); site.Open(cred); MgFeatureService featureSrvc = site.CreateService(MgServiceType.FeatureService) as MgFeatureService; MgRenderingService renderingSrvc = site.CreateService(MgServiceType.RenderingService) as MgRenderingService; MgResourceService resourceSrvc = site.CreateService(MgServiceType.ResourceService) as MgResourceService; //load the map runtime state // MgMap map = new MgMap(); map.Open(resourceSrvc, mapName); String [] layersList = layers.Split(','); if(layersList.Length > 0) { MgStringCollection layerNames = new MgStringCollection(); for(int i = 0; i < layersList.Length; i++) { layerNames.Add(layersList[i]); } // create a multi-polygon or a multi-geometry containing the input selected features // MgGeometry inputGeom = MultiGeometryFromSelection(featureSrvc, map, inputSel); if(inputGeom != null) { // Query all the features belonging the the layer list that intersects with the input geometries // MgFeatureInformation fi = renderingSrvc.QueryFeatures(map, layerNames, inputGeom, MgFeatureSpatialOperations.Intersects, -1); if(fi != null) { MgSelection resultSel = fi.GetSelection(); if(resultSel != null) { // Return XML Response.AddHeader("Content-type", "text/xml"); Response.Write(resultSel.ToXml()); } } } } } catch(MgException exc) { Response.Write("\nException: " + exc.GetDetails()); return; } catch(Exception ne) { return; } %>