C# Class RSSWeatherLayer3D.RSSWeatherLayer3DClass

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

Méthodes publiques

Méthode Description
AddItem ( long zipCode ) : bool
AddItem ( long zipCode, double lat, double lon ) : bool
Connect ( ) : void

connects to the RSS weather service

DeleteItem ( long zipCode ) : bool

delete an item from the dataset

Disconnect ( ) : void

disconnects from the RSS weather service

DrawImmediate ( IGlobeViewer pGlobeViewer ) : void

This is where the actual drawing takes place.

Flash ( long zipCode ) : void

specify the item to flash

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.

GetClassID ( System.Guid &pClassID ) : void
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.

Hit ( int hitObjectID, ESRI pHit3D ) : void

Hit method is used to get items by interacting with the display (such as select by area). The mechanism used in here is OpenGL selection buffer. Each object is assigned with a unique id (zipCode) and is loaded to the selection buffer 'glLoadName'. The globe framework will return this ID and we will use it in order to select the items from the table.

Identify ( IGeometry pGeom ) : IArray

Identifying all the weather items falling within the given envelope

Load ( IStream pstm ) : void
RSSWeatherLayer3DClass ( ) : System

The class has only default CTor.

RefreshDB ( ) : void

Run the update thread

calling this method too 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.

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

Méthodes protégées

Méthode Description
OnHandleDestroyed ( EventArgs e ) : void

Private Methods

Méthode Description
AddWeatherItem ( long zipCode, double Lat, double Lon ) : void

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

CreateDisplayLists ( ) : void

Create the display lists used by the layer

the cal to this method must be made from BeforeDraw, AfterDraw or DrawImmidiate. calling this method from anywhere else might end up in unexpected results since OpenGL state is not guaranteed

CreateGeographicSpatialReference ( ) : ISpatialReference

create a WGS1984 geographic coordinate system. In this case, the underlying data is in WGS1984 as well as the input required by the globe. for that reason, there is no need to reproject the data.

CreateTexture ( Bitmap bitmap ) : uint

Given a bitmap (GDI+), create for it an OpenGL texture and return its ID

in order to allow hardware acceleration, texture size must be power of two.

DrawItem ( DataRow r, double dMagnitude ) : void

draw an item on the globe's surface

the magnitude determine whether to draw the item as a dot or with the icon symbol. The determination of the magnitude threshold is empirically.

GetLayerExtent ( ) : IEnvelope

get the overall extent of the items in the layer

InitializeLocations ( ) : void

Initialize the location table. Gets the location from a featureclass

InitializeTables ( ) : void

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

InsideViewport ( double x, double y, double z, double clipNear, uint mode ) : bool

Test whether an item is inside the current viewport

given geocentric coordinate, convert it into window coordinate and then test whether it is within the current viewport

OnRedrawEventHandler ( ) : void

Globe redraw event handler.

since this method is the delegate method of an 'Invoke' call it is guaranteed to run on the main thread and therefore does not end up in making cross apartment COM calls

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

Globe redraw timer event

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

run the thread that does the update of the weather data

OrientBillboard ( ) : void

orient the weather icons so that it'll face the camera

PopulateLocationsTableProc ( ) : void

Load the information from the MajorCities featureclass to the locations table

ThreadProc ( ) : void

the main update thread for the layer.

Sine 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 hand while waiting for respond. 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

public AddItem ( long zipCode ) : bool
zipCode long
Résultat bool

AddItem() public méthode

public AddItem ( long zipCode, double lat, double lon ) : bool
zipCode long
lat double
lon double
Résultat bool

Connect() public méthode

connects to the 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 the RSS weather service
public Disconnect ( ) : void
Résultat void

DrawImmediate() public méthode

This is where the actual drawing takes place.
public DrawImmediate ( IGlobeViewer pGlobeViewer ) : void
pGlobeViewer IGlobeViewer
Résultat void

Flash() public méthode

specify the item to flash
public Flash ( long zipCode ) : void
zipCode long
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[]

GetClassID() public méthode

public GetClassID ( System.Guid &pClassID ) : void
pClassID System.Guid
Résultat void

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

Hit() public méthode

Hit method is used to get items by interacting with the display (such as select by area). The mechanism used in here is OpenGL selection buffer. Each object is assigned with a unique id (zipCode) and is loaded to the selection buffer 'glLoadName'. The globe framework will return this ID and we will use it in order to select the items from the table.
public Hit ( int hitObjectID, ESRI pHit3D ) : void
hitObjectID int
pHit3D ESRI
Résultat void

Identify() public méthode

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

Load() public méthode

public Load ( IStream pstm ) : void
pstm IStream
Résultat void

OnHandleDestroyed() protected méthode

protected OnHandleDestroyed ( EventArgs e ) : void
e System.EventArgs
Résultat void

RSSWeatherLayer3DClass() public méthode

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

RefreshDB() public méthode

Run the update thread
calling this method too 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.
public RefreshDB ( ) : 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