Skip to content

GeoCollection<T>

Namespace: ThinkGeo.Core

This class is a collection with some methods specialized for dealing with Layers and other spatial classes.

public class GeoCollection<T> : , , , , System.Collections.IEnumerable, System.Collections.IList, System.Collections.ICollection, , , System.Collections.Specialized.INotifyCollectionChanged, System.ComponentModel.INotifyPropertyChanged

Type Parameters

T
This parameter is the item you want a collection of.

Inheritance Object → Collection<T> → GeoCollection<T>
Implements IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, INotifyCollectionChanged, INotifyPropertyChanged

Remarks:

We have added some helpful methods like MoveUp, MoveDown, etc. These help when you are manipulating Layers.

Properties

Item

public T Item { get; set; }

Property Value

T

Count

public int Count { get; }

Property Value

Int32

Item

public T Item { get; set; }

Property Value

T

Constructors

GeoCollection()

This is the default constructor for the class.

public GeoCollection()

Remarks:

None

Methods

OnInserting(InsertingGeoCollectionEventArgs)

protected void OnInserting(InsertingGeoCollectionEventArgs e)

Parameters

e InsertingGeoCollectionEventArgs

OnInserted(InsertedGeoCollectionEventArgs)

protected void OnInserted(InsertedGeoCollectionEventArgs e)

Parameters

e InsertedGeoCollectionEventArgs

OnRemoving(RemovingGeoCollectionEventArgs)

protected void OnRemoving(RemovingGeoCollectionEventArgs e)

Parameters

e RemovingGeoCollectionEventArgs

OnRemoved(RemovedGeoCollectionEventArgs)

protected void OnRemoved(RemovedGeoCollectionEventArgs e)

Parameters

e RemovedGeoCollectionEventArgs

OnAdding(AddingGeoCollectionEventArgs)

protected void OnAdding(AddingGeoCollectionEventArgs e)

Parameters

e AddingGeoCollectionEventArgs

OnAdded(AddedGeoCollectionEventArgs)

protected void OnAdded(AddedGeoCollectionEventArgs e)

Parameters

e AddedGeoCollectionEventArgs

OnClearingItems(ClearingItemsGeoCollectionEventArgs)

protected void OnClearingItems(ClearingItemsGeoCollectionEventArgs e)

Parameters

e ClearingItemsGeoCollectionEventArgs

OnClearedItems(ClearedItemsGeoCollectionEventArgs)

protected void OnClearedItems(ClearedItemsGeoCollectionEventArgs e)

Parameters

e ClearedItemsGeoCollectionEventArgs

OnMovedItem(MovedItemGeoCollectionEventArgs)

protected void OnMovedItem(MovedItemGeoCollectionEventArgs e)

Parameters

e MovedItemGeoCollectionEventArgs

GetKeys()

This method returns a collection of the keys in the collection.

public Collection<string> GetKeys()

Returns

Collection<String>
This method returns a collection of the keys in the collection.

Remarks:

None

Add(String, T)

This method adds an item to the collection by specifying the item and a key.

public void Add(string key, T item)

Parameters

key String
This parameter is the key to find the item.

item T
This parameter is the item you want added to the collection.

Remarks:

None

Add(T)

This method adds an item to the collection.

public void Add(T item)

Parameters

item T
This parameter is the item you want added to the collection.

Remarks:

This method adds an item to the collection, and the item's key will be a random GUID.

Insert(Int32, T)

Inserts an element into the System.Collections.ObjectModel.Collection<T> at the specified index.

public void Insert(int index, T item)

Parameters

index Int32
The zero-based index at which item should be inserted.

item T
The object to insert. The value can be null for reference types.

Exceptions

ArgumentOutOfRangeException
index is less than zero. -or- index is greater than System.Collections.ObjectModel.Collection.Count.

InsertItem(Int32, T)

protected void InsertItem(int index, T item)

Parameters

index Int32

item T

Insert(Int32, String, T)

Inserts an element into the System.Collections.ObjectModel.Collection<T> at the specified index and key.

public void Insert(int index, string key, T item)

Parameters

index Int32
The zero-based index at which item should be inserted.

key String
The key to find the item.

item T
The object to insert. The value can be null for reference types.

Exceptions

ArgumentOutOfRangeException
index is less than zero. -or- index is greater than System.Collections.ObjectModel.Collection.Count.

Remove(String)

This method removes an item from the collection based on the specified key.

public void Remove(string key)

Parameters

key String
This parameter is the key of the item you want to remove.

Remarks:

None

RemoveItem(Int32)

This method removes an item from the collection based on the specified index.

protected void RemoveItem(int index)

Parameters

index Int32
This parameter is the index of the item you want to remove.

Remarks:

None

MoveUp(Int32)

This method moves an item up in the collection.

public void MoveUp(int index)

Parameters

index Int32
This parameter is the index of the item in the collection.

Remarks:

None

MoveUp(String)

This method moves an item up in the collection.

public void MoveUp(string key)

Parameters

key String
This parameter is the key of the item in the collection.

Remarks:

None

MoveUp(T)

This method moves an item up in the collection.

public void MoveUp(T item)

Parameters

item T
This parameter is the item you want to move up in the collection.

Remarks:

None

MoveDown(Int32)

This method moves an item down in the collection.

public void MoveDown(int index)

Parameters

index Int32
This parameter is the index of the item in the collection.

Remarks:

None

MoveDown(String)

This method moves an item down in the collection.

public void MoveDown(string key)

Parameters

key String
This parameter is the key of the item in the dictionary.

Remarks:

None

MoveDown(T)

This method moves an item down in the collection.

public void MoveDown(T item)

Parameters

item T
This parameter is the item you want to move down in the dictionary.

Remarks:

None

MoveToTop(Int32)

This method moves the item at the specified index to the top of the collection.

public void MoveToTop(int index)

Parameters

index Int32
This parameter is the index of the item you want move to the top of the collection.

Remarks:

This method moves the item at the specified index to the top of the collection.

MoveToTop(String)

This method moves the item with the specified key to the top of the collection.

public void MoveToTop(string key)

Parameters

key String
This parameter is the key of the item you want move to the top of the collection.

Remarks:

This method moves the item with the specified key to the top of the collection.

MoveToTop(T)

This method moves the item specified to the top of the collection.

public void MoveToTop(T item)

Parameters

item T
This parameter is the item you want move to the top of the collection.

Remarks:

This method moves the item specified to the top of the collection.

MoveToBottom(Int32)

This method moves the item at the specified index to the bottom of the collection.

public void MoveToBottom(int index)

Parameters

index Int32
This parameter is the index of the item you want move to the bottom of the collection.

Remarks:

This method moves the item at the specified index to the bottom of the collection.

MoveToBottom(String)

This method moves the item with the specified key to the bottom of the collection.

public void MoveToBottom(string key)

Parameters

key String
This parameter is the key of the item you want move to the bottom of the collection.

Remarks:

This method moves the item with the specified key to the bottom of the collection.

MoveToBottom(T)

This method moves the item specified key to the bottom of the collection.

public void MoveToBottom(T item)

Parameters

item T
This parameter is the item you want move to the bottom of the collection.

Remarks:

This method moves the item specified key to the bottom of the collection.

MoveTo(Int32, Int32)

This method moves the item at fromIndex to the location of toIndex in the collection.

public void MoveTo(int fromIndex, int toIndex)

Parameters

fromIndex Int32
This parameter is the index of the item you want move from in the collection.

toIndex Int32
This parameter is the target index that you want to move the item to in the collection.

Remarks:

This method moves the item at fromIndex to the location of toIndex in the collection.

MoveTo(String, Int32)

This method moves the item with the key you specified to the location of toIndex in the collection.

public void MoveTo(string key, int toIndex)

Parameters

key String
This parameter is the key of item you want to move in the collection.

toIndex Int32
This parameter is the target index that you want to move the item to in the collection.

Remarks:

This method moves the item with the key you specified to the location of toIndex in the collection.

MoveTo(T, Int32)

This method moves the item you specified to the location of toIndex in the collection.

public void MoveTo(T item, int toIndex)

Parameters

item T
This parameter is the item you want to move in the collection.

toIndex Int32
This parameter is the target index that you want to move the item to in the collection.

Remarks:

This method moves the item you specified to the location of toIndex in the collection.

Contains(String)

This method returns whether an item is in the collection based on the specified key.

public bool Contains(string key)

Parameters

key String
This parameter is the key of the item you are searching for.

Returns

Boolean
This method returns whether an item is in the collection based on the specified key.

Remarks:

None

ClearItems()

This method clears the items from the collection.

protected void ClearItems()

Remarks:

None

SetItem(Int32, T)

This method allows you to set an item based on the index.

protected void SetItem(int index, T item)

Parameters

index Int32
This parameter is the index of the item you want to set.

item T
This parameter is the item you want to set.

Remarks:

None

OnCollectionChanged(NotifyCollectionChangedEventArgs)

protected void OnCollectionChanged(NotifyCollectionChangedEventArgs e)

Parameters

e NotifyCollectionChangedEventArgs

OnPropertyChanged(PropertyChangedEventArgs)

protected void OnPropertyChanged(PropertyChangedEventArgs e)

Parameters

e PropertyChangedEventArgs

Events

Inserting

public event EventHandler<InsertingGeoCollectionEventArgs> Inserting;

Inserted

public event EventHandler<InsertedGeoCollectionEventArgs> Inserted;

Removing

public event EventHandler<RemovingGeoCollectionEventArgs> Removing;

Removed

public event EventHandler<RemovedGeoCollectionEventArgs> Removed;

Adding

public event EventHandler<AddingGeoCollectionEventArgs> Adding;

Added

public event EventHandler<AddedGeoCollectionEventArgs> Added;

ClearingItems

public event EventHandler<ClearingItemsGeoCollectionEventArgs> ClearingItems;

ClearedItems

public event EventHandler<ClearedItemsGeoCollectionEventArgs> ClearedItems;

MovedItem

public event EventHandler<MovedItemGeoCollectionEventArgs> MovedItem;

CollectionChanged

public event NotifyCollectionChangedEventHandler CollectionChanged;

PropertyChanged

public event PropertyChangedEventHandler PropertyChanged;