Dynamic display
CustomLayerBase.h
// Copyright 2010 ESRI
// 
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
// 
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
// 
// See the use restrictions.
// 

  

#ifndef __DYNAMICDISPLAY__CUSTOMLAYERBASE_H__
#define __DYNAMICDISPLAY__CUSTOMLAYERBASE_H__

#include <ArcSDK.h>
#ifdef ESRI_UNIX
#undef _WIN32
#endif

class CustomLayerBase:
  //public IUnknown,
  public IGeoDataset,
  public ILayer,
  public IDynamicLayer
{
public:
  CustomLayerBase();
  ~CustomLayerBase();
  
// IGeoDataset
  HRESULT STDMETHODCALLTYPE get_Extent(IEnvelope** Extent);
  HRESULT STDMETHODCALLTYPE get_SpatialReference(ISpatialReference** SpatialReference);

// ILayer
  HRESULT STDMETHODCALLTYPE get_Name(BSTR* Name);
  HRESULT STDMETHODCALLTYPE put_Name(BSTR Name);
  HRESULT STDMETHODCALLTYPE get_Valid(VARIANT_BOOL* Valid);
  HRESULT STDMETHODCALLTYPE get_AreaOfInterest(IEnvelope** aoi);
  HRESULT STDMETHODCALLTYPE get_MinimumScale(double* MinScale);
  HRESULT STDMETHODCALLTYPE put_MinimumScale(double MinScale);
  HRESULT STDMETHODCALLTYPE get_MaximumScale(double* MaxScale);
  HRESULT STDMETHODCALLTYPE put_MaximumScale(double MaxScale);
  HRESULT STDMETHODCALLTYPE get_Visible(VARIANT_BOOL* Visible);
  HRESULT STDMETHODCALLTYPE put_Visible(VARIANT_BOOL Visible);
  HRESULT STDMETHODCALLTYPE get_ShowTips(VARIANT_BOOL* show);
  HRESULT STDMETHODCALLTYPE put_ShowTips(VARIANT_BOOL show);
  HRESULT STDMETHODCALLTYPE get_TipText(double x, double y, double Tolerance, BSTR* Text);
  HRESULT STDMETHODCALLTYPE get_Cached(VARIANT_BOOL* Cached);
  HRESULT STDMETHODCALLTYPE put_Cached(VARIANT_BOOL Cached);
  HRESULT STDMETHODCALLTYPE get_SupportedDrawPhases(long* drawPhases);
  HRESULT STDMETHODCALLTYPE putref_SpatialReference(ISpatialReference* SpatialReference);
  HRESULT STDMETHODCALLTYPE Draw(esriDrawPhase DrawPhase, IDisplay* Display, ITrackCancel* TrackCancel);

// IDynamicLayer
  virtual HRESULT STDMETHODCALLTYPE get_DynamicLayerDirty(esriDynamicDrawPhase DynamicDrawPhase, VARIANT_BOOL* Dirty) = 0;
  virtual HRESULT STDMETHODCALLTYPE put_DynamicLayerDirty(esriDynamicDrawPhase DynamicDrawPhase, VARIANT_BOOL Dirty) = 0;
  virtual HRESULT STDMETHODCALLTYPE get_DynamicRecompileRate(long* dynamicRecompileRateTimeMS) = 0;
  virtual HRESULT STDMETHODCALLTYPE DrawDynamicLayer(esriDynamicDrawPhase DynamicDrawPhase, IDisplay* Display, IDynamicDisplay* DynamicDisplay) = 0;
  
// IUnknown
  HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppv);
  ULONG   STDMETHODCALLTYPE AddRef(void);
  ULONG   STDMETHODCALLTYPE Release(void);

private:
  IEnvelopePtr         m_ipExtent;  
  ISpatialReferencePtr m_SpatialRef;
  CComBSTR             m_bstrNomeLyr;
  double               m_MinScale;
  double               m_MaxScale;
  VARIANT_BOOL         m_Visibile;
  VARIANT_BOOL         m_ShowTips;
  VARIANT_BOOL         m_Cache;
  ULONG                m_RefCount;
};

#endif /* __DYNAMICDISPLAY__CUSTOMLAYERBASE_H__  */