C# Класс RSSWeatherLayer.RSSWeatherLayerClass

Наследование: BaseDynamicLayer, IIdentify
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddItem ( long zipCode ) : bool

add a new item given only a zipcode (will use the default location given by the service) should the item exists, it will get updated

AddItem ( long zipCode, double lat, double lon ) : bool

adds a new item given a zipcode and a coordinate. Should the item already exists, it will get updated and will move to the new coordinate.

Connect ( ) : void

connects to RSS weather service

DeleteItem ( long zipCode ) : bool

delete an item from the dataset

Disconnect ( ) : void

disconnects from RSS weather service

Draw ( esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel ) : void

Draws the layer to the specified display for the given draw phase.

the draw method is set as an abstract method and therefore must be overridden

DrawDynamicLayer ( esriDynamicDrawPhase DynamicDrawPhase, IDisplay Display, IDynamicDisplay DynamicDisplay ) : void

Draw the layer while in dynamic mode

GetCityNames ( ) : string[]

get a list of all citynames currently in the dataset.

Please note that since the unique ID is zipCode, it is possible to have a city name appearing more than once.

GetWeatherItem ( long zipCode ) : IPropertySet

This method searches for the record of the given zipcode and retunes the information as a PropertySet.

GetWeatherItem ( string cityName ) : IPropertySet

get a weather item given a city name.

a city might have more than one zipCode and therefore this method will return the first zipcOde found for the specified city name.

Identify ( IGeometry pGeom ) : IArray

Identifying all the weather items falling within the given envelope

RSSWeatherLayerClass ( ) : System

The class has only default CTor.

Refresh ( ) : void

Run the update thread

calling this method to frequently might end up in blockage of RSS service. The service will interpret the excessive calls as an offence and thus would block the service for a while.

Select ( long zipCode, bool newSelection ) : void

select a weather item by its zipCode

UnselectAll ( ) : void

unselect all weather items

ZoomTo ( long zipCode ) : void

Zoom to weather item according to its zipcode

ZoomTo ( string cityName ) : void

Zoom to a weather item according to its city name

get_TipText ( double X, double Y, double Tolerance ) : string

Map tip text at the specified mouse location.

Приватные методы

Метод Описание
AddWeatherItem ( long zipCode, double Lat, double Lon ) : void

Makes a request against RSS Weather service and add update the layer's table

CreateGeographicSpatialReference ( ) : ISpatialReference

create a WGS1984 geographic coordinate system. In this case, the underlying data provided by the service is in WGS1984.

DownloadIcon ( string iconPath, int &width, int &height ) : Bitmap

given a bitmap url, saves it on the local machine and returns its size

GetDynamicGlyph ( IDynamicGlyphFactory2 dynamicGlyphFactory, int iconCode, DataRow dbr, int &originalIconSize ) : IDynamicGlyph
GetLayerExtent ( ) : IEnvelope

get the overall extent of the items in the layer

GetSymbol ( int iconCode, DataRow dbr ) : ISymbol

get the specified symbol from the symbols table.

GetSymbolSize ( IDisplay display, int symbolCode ) : double
InitializeLocations ( ) : void

Initialize the location table. Gets the location from a featureclass

InitializeSelectionSymbol ( ) : void

Initialize the symbol that would use to highlight selected items

InitializeSymbol ( string iconPath, int &iconWidth, int &iconHeight, Bitmap &bitmap ) : ISymbol

Initialize a character marker symbol for a given bitmap path

InitializeTables ( ) : void

initialize the main table used by the layer as well as the symbols table. The base class calles new on the table and adds a default ID field.

OnUpdateTimer ( object sender, System.Timers.ElapsedEventArgs e ) : void

run the thread that does the update of the weather data

PopulateLocationsTableProc ( ) : void

Load the information from the MajorCities featureclass to the locations table

SetSymbolSize ( int newSize ) : void
ThreadProc ( ) : void

the main update thread for the layer.

Since the layer gets the weather information from a web service which might take a while to respond, it is not logical to let the application hang while waiting for response. Therefore, running the request on a different thread frees the application to continue working while waiting for a response. Please note that in this case, synchronization of shared resources must be addressed, otherwise you might end up getting unexpected results.

Описание методов

AddItem() публичный Метод

add a new item given only a zipcode (will use the default location given by the service) should the item exists, it will get updated
public AddItem ( long zipCode ) : bool
zipCode long
Результат bool

AddItem() публичный Метод

adds a new item given a zipcode and a coordinate. Should the item already exists, it will get updated and will move to the new coordinate.
public AddItem ( long zipCode, double lat, double lon ) : bool
zipCode long
lat double
lon double
Результат bool

Connect() публичный Метод

connects to RSS weather service
public Connect ( ) : void
Результат void

DeleteItem() публичный Метод

delete an item from the dataset
public DeleteItem ( long zipCode ) : bool
zipCode long
Результат bool

Disconnect() публичный Метод

disconnects from RSS weather service
public Disconnect ( ) : void
Результат void

Draw() публичный Метод

Draws the layer to the specified display for the given draw phase.
the draw method is set as an abstract method and therefore must be overridden
public Draw ( esriDrawPhase drawPhase, IDisplay Display, ITrackCancel trackCancel ) : void
drawPhase esriDrawPhase
Display IDisplay
trackCancel ITrackCancel
Результат void

DrawDynamicLayer() публичный Метод

Draw the layer while in dynamic mode
public DrawDynamicLayer ( esriDynamicDrawPhase DynamicDrawPhase, IDisplay Display, IDynamicDisplay DynamicDisplay ) : void
DynamicDrawPhase esriDynamicDrawPhase
Display IDisplay
DynamicDisplay IDynamicDisplay
Результат void

GetCityNames() публичный Метод

get a list of all citynames currently in the dataset.
Please note that since the unique ID is zipCode, it is possible to have a city name appearing more than once.
public GetCityNames ( ) : string[]
Результат string[]

GetWeatherItem() публичный Метод

This method searches for the record of the given zipcode and retunes the information as a PropertySet.
public GetWeatherItem ( long zipCode ) : IPropertySet
zipCode long
Результат IPropertySet

GetWeatherItem() публичный Метод

get a weather item given a city name.
a city might have more than one zipCode and therefore this method will return the first zipcOde found for the specified city name.
public GetWeatherItem ( string cityName ) : IPropertySet
cityName string
Результат IPropertySet

Identify() публичный Метод

Identifying all the weather items falling within the given envelope
public Identify ( IGeometry pGeom ) : IArray
pGeom IGeometry
Результат IArray

RSSWeatherLayerClass() публичный Метод

The class has only default CTor.
public RSSWeatherLayerClass ( ) : System
Результат System

Refresh() публичный Метод

Run the update thread
calling this method to frequently might end up in blockage of RSS service. The service will interpret the excessive calls as an offence and thus would block the service for a while.
public Refresh ( ) : void
Результат void

Select() публичный Метод

select a weather item by its zipCode
public Select ( long zipCode, bool newSelection ) : void
zipCode long
newSelection bool
Результат void

UnselectAll() публичный Метод

unselect all weather items
public UnselectAll ( ) : void
Результат void

ZoomTo() публичный Метод

Zoom to weather item according to its zipcode
public ZoomTo ( long zipCode ) : void
zipCode long
Результат void

ZoomTo() публичный Метод

Zoom to a weather item according to its city name
public ZoomTo ( string cityName ) : void
cityName string
Результат void

get_TipText() публичный Метод

Map tip text at the specified mouse location.
public get_TipText ( double X, double Y, double Tolerance ) : string
X double
Y double
Tolerance double
Результат string