C# Class RSSWeatherLayer.RSSWeatherLayerClass

Inheritance: BaseDynamicLayer, IIdentify
Afficher le fichier Open project: Esri/arcobjects-sdk-community-samples Class Usage Examples

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
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.

Method Details

AddItem() public méthode

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
Résultat bool

AddItem() public méthode

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
Résultat bool

Connect() public méthode

connects to RSS weather service
public Connect ( ) : void
Résultat void

DeleteItem() public méthode

delete an item from the dataset
public DeleteItem ( long zipCode ) : bool
zipCode long
Résultat bool

Disconnect() public méthode

disconnects from RSS weather service
public Disconnect ( ) : void
Résultat void

Draw() public méthode

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
Résultat void

DrawDynamicLayer() public méthode

Draw the layer while in dynamic mode
public DrawDynamicLayer ( esriDynamicDrawPhase DynamicDrawPhase, IDisplay Display, IDynamicDisplay DynamicDisplay ) : void
DynamicDrawPhase esriDynamicDrawPhase
Display IDisplay
DynamicDisplay IDynamicDisplay
Résultat void

GetCityNames() public méthode

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[]
Résultat string[]

GetWeatherItem() public méthode

This method searches for the record of the given zipcode and retunes the information as a PropertySet.
public GetWeatherItem ( long zipCode ) : IPropertySet
zipCode long
Résultat IPropertySet

GetWeatherItem() public méthode

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
Résultat IPropertySet

Identify() public méthode

Identifying all the weather items falling within the given envelope
public Identify ( IGeometry pGeom ) : IArray
pGeom IGeometry
Résultat IArray

RSSWeatherLayerClass() public méthode

The class has only default CTor.
public RSSWeatherLayerClass ( ) : System
Résultat System

Refresh() public méthode

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
Résultat void

Select() public méthode

select a weather item by its zipCode
public Select ( long zipCode, bool newSelection ) : void
zipCode long
newSelection bool
Résultat void

UnselectAll() public méthode

unselect all weather items
public UnselectAll ( ) : void
Résultat void

ZoomTo() public méthode

Zoom to weather item according to its zipcode
public ZoomTo ( long zipCode ) : void
zipCode long
Résultat void

ZoomTo() public méthode

Zoom to a weather item according to its city name
public ZoomTo ( string cityName ) : void
cityName string
Résultat void

get_TipText() public méthode

Map tip text at the specified mouse location.
public get_TipText ( double X, double Y, double Tolerance ) : string
X double
Y double
Tolerance double
Résultat string