C# Class RSSWeatherLayer.RSSWeatherLayerClass

Inheritance: BaseDynamicLayer, IIdentify
ファイルを表示 Open project: Esri/arcobjects-sdk-community-samples Class Usage Examples

Public Methods

Method 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

Method 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 method

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
return bool

AddItem() public method

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
return bool

Connect() public method

connects to RSS weather service
public Connect ( ) : void
return void

DeleteItem() public method

delete an item from the dataset
public DeleteItem ( long zipCode ) : bool
zipCode long
return bool

Disconnect() public method

disconnects from RSS weather service
public Disconnect ( ) : void
return void

Draw() public method

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
return void

DrawDynamicLayer() public method

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

GetCityNames() public method

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[]
return string[]

GetWeatherItem() public method

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

GetWeatherItem() public method

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
return IPropertySet

Identify() public method

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

RSSWeatherLayerClass() public method

The class has only default CTor.
public RSSWeatherLayerClass ( ) : System
return System

Refresh() public method

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
return void

Select() public method

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

UnselectAll() public method

unselect all weather items
public UnselectAll ( ) : void
return void

ZoomTo() public method

Zoom to weather item according to its zipcode
public ZoomTo ( long zipCode ) : void
zipCode long
return void

ZoomTo() public method

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

get_TipText() public method

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