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

int

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)

Performs on inserting.

protected void OnInserting(InsertingGeoCollectionEventArgs e)

Parameters

e InsertingGeoCollectionEventArgs
The e.

Returns

void

OnInserted(InsertedGeoCollectionEventArgs)

Performs on inserted.

protected void OnInserted(InsertedGeoCollectionEventArgs e)

Parameters

e InsertedGeoCollectionEventArgs
The e.

Returns

void

OnRemoving(RemovingGeoCollectionEventArgs)

Performs on removing.

protected void OnRemoving(RemovingGeoCollectionEventArgs e)

Parameters

e RemovingGeoCollectionEventArgs
The e.

Returns

void

OnRemoved(RemovedGeoCollectionEventArgs)

Performs on removed.

protected void OnRemoved(RemovedGeoCollectionEventArgs e)

Parameters

e RemovedGeoCollectionEventArgs
The e.

Returns

void

OnAdding(AddingGeoCollectionEventArgs)

Performs on adding.

protected void OnAdding(AddingGeoCollectionEventArgs e)

Parameters

e AddingGeoCollectionEventArgs
The e.

Returns

void

OnAdded(AddedGeoCollectionEventArgs)

Performs on added.

protected void OnAdded(AddedGeoCollectionEventArgs e)

Parameters

e AddedGeoCollectionEventArgs
The e.

Returns

void

OnClearingItems(ClearingItemsGeoCollectionEventArgs)

Performs on clearing items.

protected void OnClearingItems(ClearingItemsGeoCollectionEventArgs e)

Parameters

e ClearingItemsGeoCollectionEventArgs
The e.

Returns

void

OnClearedItems(ClearedItemsGeoCollectionEventArgs)

Performs on cleared items.

protected void OnClearedItems(ClearedItemsGeoCollectionEventArgs e)

Parameters

e ClearedItemsGeoCollectionEventArgs
The e.

Returns

void

OnMovedItem(MovedItemGeoCollectionEventArgs)

Performs on moved item.

protected void OnMovedItem(MovedItemGeoCollectionEventArgs e)

Parameters

e MovedItemGeoCollectionEventArgs
The e.

Returns

void

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.

Returns

void
None

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.

Returns

void
None

Remarks:

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

Insert(int, T)

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

public void Insert(int index, T item)

Parameters

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

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

Returns

void

Exceptions

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

InsertItem(int, T)

Performs insert item.

protected void InsertItem(int index, T item)

Parameters

index int
The index.

item T
The item.

Returns

void

Insert(int, 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 int
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.

Returns

void

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.

Returns

void
None

Remarks:

None

RemoveItem(int)

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

protected void RemoveItem(int index)

Parameters

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

Returns

void
None

Remarks:

None

MoveUp(int)

This method moves an item up in the collection.

public void MoveUp(int index)

Parameters

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

Returns

void
None

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.

Returns

void
None

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.

Returns

void
None

Remarks:

None

MoveDown(int)

This method moves an item down in the collection.

public void MoveDown(int index)

Parameters

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

Returns

void
None

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.

Returns

void
None

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.

Returns

void
None

Remarks:

None

MoveToTop(int)

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

public void MoveToTop(int index)

Parameters

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

Returns

void
None

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.

Returns

void
None

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.

Returns

void
None

Remarks:

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

MoveToBottom(int)

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

public void MoveToBottom(int index)

Parameters

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

Returns

void
None

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.

Returns

void
None

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.

Returns

void
None

Remarks:

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

MoveTo(int, int)

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

public void MoveTo(int fromIndex, int toIndex)

Parameters

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

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

Returns

void
None

Remarks:

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

MoveTo(string, int)

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 int
This parameter is the target index that you want to move the item to in the collection.

Returns

void
None

Remarks:

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

MoveTo(T, int)

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 int
This parameter is the target index that you want to move the item to in the collection.

Returns

void
None

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

bool
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()

Returns

void
None

Remarks:

None

SetItem(int, T)

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

protected void SetItem(int index, T item)

Parameters

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

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

Returns

void
None

Remarks:

None

OnCollectionChanged(NotifyCollectionChangedEventArgs)

Performs on collection changed.

protected void OnCollectionChanged(NotifyCollectionChangedEventArgs e)

Parameters

e NotifyCollectionChangedEventArgs
The e.

Returns

void

OnPropertyChanged(PropertyChangedEventArgs)

Performs on property changed.

protected void OnPropertyChanged(PropertyChangedEventArgs e)

Parameters

e PropertyChangedEventArgs
The e.

Returns

void

Events

Inserting

Occurs when the Inserting event is raised.

public event EventHandler<InsertingGeoCollectionEventArgs> Inserting;

Inserted

Occurs when the Inserted event is raised.

public event EventHandler<InsertedGeoCollectionEventArgs> Inserted;

Removing

Occurs when the Removing event is raised.

public event EventHandler<RemovingGeoCollectionEventArgs> Removing;

Removed

Occurs when the Removed event is raised.

public event EventHandler<RemovedGeoCollectionEventArgs> Removed;

Adding

Occurs when the Adding event is raised.

public event EventHandler<AddingGeoCollectionEventArgs> Adding;

Added

Occurs when the Added event is raised.

public event EventHandler<AddedGeoCollectionEventArgs> Added;

ClearingItems

Occurs when the ClearingItems event is raised.

public event EventHandler<ClearingItemsGeoCollectionEventArgs> ClearingItems;

ClearedItems

Occurs when the ClearedItems event is raised.

public event EventHandler<ClearedItemsGeoCollectionEventArgs> ClearedItems;

MovedItem

Occurs when the MovedItem event is raised.

public event EventHandler<MovedItemGeoCollectionEventArgs> MovedItem;

CollectionChanged

Occurs when the CollectionChanged event is raised.

public event NotifyCollectionChangedEventHandler CollectionChanged;

PropertyChanged

Occurs when the PropertyChanged event is raised.

public event PropertyChangedEventHandler PropertyChanged;