Search Results for

    Show / Hide Table of Contents

    Class MapSelection

    Represents a map selection

    Inheritance
    System.Object
    MapSelection
    Implements
    IBinarySerializable
    System.Collections.Generic.IList<MapSelection.LayerSelection>
    System.Collections.Generic.ICollection<MapSelection.LayerSelection>
    System.Collections.Generic.IEnumerable<MapSelection.LayerSelection>
    System.Collections.IEnumerable
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: OSGeo.MapGuide.MaestroAPI.Mapping
    Assembly: OSGeo.MapGuide.MaestroAPI.dll
    Syntax
    public class MapSelection : IBinarySerializable, IList<MapSelection.LayerSelection>, ICollection<MapSelection.LayerSelection>, IEnumerable<MapSelection.LayerSelection>, IEnumerable
    Examples

    This sample shows how to list selected features in ASP.net. The sample expects 3 parameters:

    1. The session ID (SESSION)
    2. The runtime map name (MAPNAME)
    3. The selection XML (SELECTION)

    string agent = "http://localhost/mapguide/mapagent/mapagent.fcgi";
    IServerConnection conn = ConnectionProviderRegistry.CreateConnection(
               "Maestro.Http",
               "Url", agent,
               "SessionId", Request.Params["SESSION"]);
    
    IMappingService mpSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
    string rtMapId = "Session:" + conn.SessionID + "//" + Request.Params["MAPNAME"] + ".Map";
    RuntimeMap rtMap = mpSvc.OpenMap(rtMapId);
    
    string xml = Request.Params["SELECTION"];
    //The map selection contains one or more layer selections
    //each containing a one or more sets of identity property values
    //(because a feature may have multiple identity properties)
    
    MapSelection selection = new MapSelection(rtMap, System.Web.HttpUtility.UrlDecode(xml));
    if (selection.Count > 0)
    {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < selection.Count; i++)
        {
            MapSelection.LayerSelection layerSel = selection[i];
            sb.Append("<p>Layer: " + layerSel.Layer.Name + " (" + layerSel.Count + " selected item)");
            sb.Append("<table>");
            for (int j = 0; j < layerSel.Count; j++)
            {
                sb.Append("<tr>");
                object[] values = layerSel[j];
                for (int k = 0; k < values.Length; k++)
                {
                    sb.Append("<td>");
                    sb.Append(values[k].ToString());
                    sb.Append("</td>");
                }
                sb.AppendFormat("<td><a href='FeatureInfo.aspx?MAPNAME={0}&SESSION={1}&LAYERID={2}&ID={3}'>More Info</a></td>",
                    rtMap.Name,
                    conn.SessionID,
                    layerSel.Layer.ObjectId,
                    System.Web.HttpUtility.UrlEncode(layerSel.EncodeIDString(values)));
                sb.Append("</tr>");
            }
            sb.Append("</table>");
            Response.WriteLine("<p>Showing IDs of selected features</p>");
            Response.WriteLine(sb.ToString());
        }
    }
    else
    {
        Response.WriteLine("Nothing selected. Select some features first then run this sample again.");
    }

    Constructors

    | Improve this Doc View Source

    MapSelection(RuntimeMap)

    Constructor

    Declaration
    public MapSelection(RuntimeMap map)
    Parameters
    Type Name Description
    RuntimeMap map
    | Improve this Doc View Source

    MapSelection(RuntimeMap, String)

    Constructor

    Declaration
    public MapSelection(RuntimeMap map, string xml)
    Parameters
    Type Name Description
    RuntimeMap map
    System.String xml

    Properties

    | Improve this Doc View Source

    Count

    Gets the number of layers in this selection

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    IsReadOnly

    Gets whether this is read only

    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Item[RuntimeMapLayer]

    Gets the selection layer at a given index

    Declaration
    public MapSelection.LayerSelection this[RuntimeMapLayer index] { get; }
    Parameters
    Type Name Description
    RuntimeMapLayer index

    The index to get or set the item for

    Property Value
    Type Description
    MapSelection.LayerSelection

    The item at the given index

    | Improve this Doc View Source

    Item[Int32]

    Gets or sets the selection layer at a given index

    Declaration
    public MapSelection.LayerSelection this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index

    The index to get or set the item for

    Property Value
    Type Description
    MapSelection.LayerSelection

    The item at the given index

    Methods

    | Improve this Doc View Source

    Add(MapSelection.LayerSelection)

    Adds the specified layer selection

    Declaration
    public void Add(MapSelection.LayerSelection item)
    Parameters
    Type Name Description
    MapSelection.LayerSelection item
    | Improve this Doc View Source

    Add(RuntimeMapLayer)

    Adds the specified layer

    Declaration
    public void Add(RuntimeMapLayer layer)
    Parameters
    Type Name Description
    RuntimeMapLayer layer
    | Improve this Doc View Source

    Clear()

    Clears this selction

    Declaration
    public void Clear()
    | Improve this Doc View Source

    Contains(MapSelection.LayerSelection)

    Gets whether this selection contains the specified layer selection

    Declaration
    public bool Contains(MapSelection.LayerSelection item)
    Parameters
    Type Name Description
    MapSelection.LayerSelection item
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Contains(RuntimeMapLayer)

    Gets whether this selection contains the specified layer

    Declaration
    public bool Contains(RuntimeMapLayer item)
    Parameters
    Type Name Description
    RuntimeMapLayer item
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    CopyTo(MapSelection.LayerSelection[], Int32)

    Copies the elements of the System.Collections.Generic.ICollection<T> to an System.Array, starting at a particular System.Array index.

    Declaration
    public void CopyTo(MapSelection.LayerSelection[] array, int arrayIndex)
    Parameters
    Type Name Description
    MapSelection.LayerSelection[] array

    The one-dimensional System.Array that is the destination of the elements copied from System.Collections.Generic.ICollection<T>. The System.Array must have zero-based indexing.

    System.Int32 arrayIndex

    The zero-based index in array at which copying begins.

    Exceptions
    Type Condition
    System.ArgumentNullException

    array is null.

    System.ArgumentOutOfRangeException

    arrayIndex is less than 0.

    System.ArgumentException

    array is multidimensional. -or- arrayIndex is equal to or greater than the length of array. -or- The number of elements in the source System.Collections.Generic.ICollection<T> is greater than the available space from arrayIndex to the end of the destination array.

    | Improve this Doc View Source

    Deserialize(MgBinaryDeserializer)

    Deserializes this object using the specified deserializer.

    Declaration
    public void Deserialize(MgBinaryDeserializer d)
    Parameters
    Type Name Description
    MgBinaryDeserializer d

    The deserializer.

    | Improve this Doc View Source

    GetEnumerator()

    Gets the layer selection enumerator

    Declaration
    public IEnumerator<MapSelection.LayerSelection> GetEnumerator()
    Returns
    Type Description
    System.Collections.Generic.IEnumerator<MapSelection.LayerSelection>
    | Improve this Doc View Source

    IndexOf(MapSelection.LayerSelection)

    Returns the index of the given layer

    Declaration
    public int IndexOf(MapSelection.LayerSelection item)
    Parameters
    Type Name Description
    MapSelection.LayerSelection item

    The layer to look for

    Returns
    Type Description
    System.Int32

    The index of the layer, or -1 if the layer is not in the collection

    | Improve this Doc View Source

    IndexOf(RuntimeMapLayer)

    Returns the index of the given layer

    Declaration
    public int IndexOf(RuntimeMapLayer layer)
    Parameters
    Type Name Description
    RuntimeMapLayer layer

    The layer.

    Returns
    Type Description
    System.Int32

    The index of the layer, or -1 if the layer is not in the collection

    | Improve this Doc View Source

    Insert(Int32, MapSelection.LayerSelection)

    Inserts a selection layer into the collection

    Declaration
    public void Insert(int index, MapSelection.LayerSelection item)
    Parameters
    Type Name Description
    System.Int32 index

    The index to place the item at

    MapSelection.LayerSelection item

    The item to insert

    | Improve this Doc View Source

    Insert(Int32, RuntimeMapLayer)

    Inserts a selection layer into the collection

    Declaration
    public void Insert(int index, RuntimeMapLayer layer)
    Parameters
    Type Name Description
    System.Int32 index

    The index to place the item at

    RuntimeMapLayer layer

    The layer.

    | Improve this Doc View Source

    LoadXml(String)

    Initialize this selection from the specified xml string

    Declaration
    public void LoadXml(string xml)
    Parameters
    Type Name Description
    System.String xml
    | Improve this Doc View Source

    Remove(MapSelection.LayerSelection)

    Removes the specified layer selection

    Declaration
    public bool Remove(MapSelection.LayerSelection item)
    Parameters
    Type Name Description
    MapSelection.LayerSelection item
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    RemoveAt(Int32)

    Removes the item at the given index

    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index

    The index to remove the item at

    | Improve this Doc View Source

    Serialize(MgBinarySerializer)

    Serializes this instance using the specified serializer.

    Declaration
    public void Serialize(MgBinarySerializer s)
    Parameters
    Type Name Description
    MgBinarySerializer s

    The serializer.

    | Improve this Doc View Source

    ToXml()

    Returns an xml document that represents the current map selection

    Declaration
    public string ToXml()
    Returns
    Type Description
    System.String

    An xml document that represents the current map selection

    | Improve this Doc View Source

    UpdateFrom(FeatureSet)

    Updates this selection from the given input selection set payload

    Declaration
    public void UpdateFrom(FeatureSet featureSet)
    Parameters
    Type Name Description
    FeatureSet featureSet

    Explicit Interface Implementations

    | Improve this Doc View Source

    IEnumerable.GetEnumerator()

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    System.Collections.IEnumerator

    Implements

    IBinarySerializable
    System.Collections.Generic.IList<T>
    System.Collections.Generic.ICollection<T>
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2009 - 2022 Jackie Ng