About the RSS weather layer Sample
[C#]
RSSWeatherIdentifyObject.cs
using System;
using System.Collections;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.Display;
namespace RSSWeatherLayer
{
/// <summary>
/// Summary description for GlobeWeatherIdentifyObject.
/// </summary>
public class RSSWeatherIdentifyObject : IIdentifyObj, IIdentifyObject, IDisposable
{
private RSSWeatherLayerClass m_weatherLayer = null;
private IPropertySet m_propset = null;
private IdentifyDlg m_identifyDlg = null;
#region Ctor
/// <summary>
/// Class Ctor
/// </summary>
public RSSWeatherIdentifyObject()
{
}
#endregion
#region IIdentifyObject Members
/// <summary>
/// PropertySet of the identify object
/// </summary>
/// <remarks>The information passed by the layer to the identify dialog is encapsulated
/// in a PropertySet</remarks>
public IPropertySet PropertySet
{
get
{
return m_propset;
}
set
{
m_propset = value;
}
}
/// <summary>
/// Name of the identify object.
/// </summary>
public string Name
{
get
{
return "WeatherInfo";
}
set
{
// TODO: Add GlobeWeatherIdentifyObject.Name setter implementation
}
}
#endregion
#region IIdentifyObj Members
/// <summary>
/// Flashes the identified object on the screen.
/// </summary>
/// <param name="pDisplay"></param>
public void Flash(IScreenDisplay pDisplay)
{
}
/// <summary>
/// Indicates if the object can identify the specified layer
/// </summary>
/// <param name="pLayer"></param>
/// <returns></returns>
public bool CanIdentify(ILayer pLayer)
{
if(!(pLayer is RSSWeatherLayerClass))
return false;
//cache the layer
m_weatherLayer = (RSSWeatherLayerClass)pLayer;
return true;;
}
/// <summary>
/// The window handle.
/// </summary>
public int hWnd
{
get
{
if(null == m_identifyDlg || m_identifyDlg.Handle.ToInt32() == 0)
{
m_identifyDlg = new IdentifyDlg();
m_identifyDlg.CreateControl();
m_identifyDlg.SetProperties(m_propset);
}
return m_identifyDlg.Handle.ToInt32();
}
}
/// <summary>
/// Name of the identify object.
/// </summary>
string ESRI.ArcGIS.Carto.IIdentifyObj.Name
{
get
{
return "WeatherInfo";
}
}
/// <summary>
/// Target layer for identification.
/// </summary>
public ILayer Layer
{
get
{
return m_weatherLayer;
}
}
/// <summary>
/// Displays a context sensitive popup menu at the specified location.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public void PopUpMenu(int x, int y)
{
}
#endregion
#region IDisposable Members
public void Dispose()
{
if(!m_identifyDlg.IsDisposed)
m_identifyDlg.Dispose();
m_weatherLayer = null;
m_propset = null;
}
#endregion
}
}
[Visual Basic .NET]
RSSWeatherIdentifyObject.vb
Imports Microsoft.VisualBasic Imports System Imports System.Collections Imports System.Runtime.InteropServices Imports ESRI.ArcGIS.Geometry Imports ESRI.ArcGIS.Carto Imports ESRI.ArcGIS.esriSystem Imports ESRI.ArcGIS.Geodatabase Imports ESRI.ArcGIS.DataSourcesFile Imports ESRI.ArcGIS.Display ''' <summary> ''' Summary description for GlobeWeatherIdentifyObject. ''' </summary> Public Class RSSWeatherIdentifyObject : Implements IIdentifyObj, IIdentifyObject, IDisposable Private m_weatherLayer As RSSWeatherLayerClass = Nothing Private m_propset As IPropertySet = Nothing Private m_identifyDlg As IdentifyDlg = Nothing #Region "Ctor" ''' <summary> ''' Class Ctor ''' </summary> Public Sub New() End Sub #End Region #Region "IIdentifyObject Members" ''' <summary> ''' PropertySet of the identify object ''' </summary> ''' <remarks>The information passed by the layer to the identify dialog is encapsulated ''' in a PropertySet</remarks> Public Property PropertySet() As IPropertySet Implements IIdentifyObject.PropertySet Get Return m_propset End Get Set m_propset = Value End Set End Property ''' <summary> ''' Name of the identify object. ''' </summary> Public Property Name1() As String Implements IIdentifyObject.Name Get Return "WeatherInfo" End Get Set (ByVal value as String) ' TODO: Add GlobeWeatherIdentifyObject.Name setter implementation End Set End Property #End Region #Region "IIdentifyObj Members" ''' <summary> ''' Flashes the identified object on the screen. ''' </summary> ''' <param name="pDisplay"></param> Public Sub Flash(ByVal pDisplay As IScreenDisplay) Implements IIdentifyObj.Flash End Sub ''' <summary> ''' Indicates if the object can identify the specified layer ''' </summary> ''' <param name="pLayer"></param> ''' <returns></returns> Public Function CanIdentify(ByVal pLayer As ILayer) As Boolean Implements IIdentifyObj.CanIdentify If Not(TypeOf pLayer Is RSSWeatherLayerClass) Then Return False End If 'cache the layer m_weatherLayer = CType(pLayer, RSSWeatherLayerClass) Return True End Function ''' <summary> ''' The window handle. ''' </summary> Public ReadOnly Property hWnd() As Integer Implements IIdentifyObj.hWnd Get If Nothing Is m_identifyDlg OrElse m_identifyDlg.Handle.ToInt32() = 0 Then m_identifyDlg = New IdentifyDlg() m_identifyDlg.CreateControl() m_identifyDlg.SetProperties(m_propset) End If Return m_identifyDlg.Handle.ToInt32() End Get End Property ''' <summary> ''' Name of the identify object. ''' </summary> Private ReadOnly Property Name() As String Implements ESRI.ArcGIS.Carto.IIdentifyObj.Name Get Return "WeatherInfo" End Get End Property ''' <summary> ''' Target layer for identification. ''' </summary> Public ReadOnly Property Layer() As ILayer Implements IIdentifyObj.Layer Get Return m_weatherLayer End Get End Property ''' <summary> ''' Displays a context sensitive popup menu at the specified location. ''' </summary> ''' <param name="x"></param> ''' <param name="y"></param> Public Sub PopUpMenu(ByVal x As Integer, ByVal y As Integer) Implements IIdentifyObj.PopUpMenu End Sub #End Region #Region "IDisposable Members" Public Sub Dispose() Implements IDisposable.Dispose If (Not m_identifyDlg.IsDisposed) Then m_identifyDlg.Dispose() End If m_weatherLayer = Nothing m_propset = Nothing End Sub #End Region End Class