// RasSink.cpp : implementation file // #include "stdafx.h" #include "ltcdb.h" #include "RasSink.h" #include "OCDBView.h" #include "leadrasterview.h" #include "leadraster.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRasterODBCSink IMPLEMENT_DYNCREATE(CRasterODBCSink, CCmdTarget) CRasterODBCSink::CRasterODBCSink() { EnableAutomation(); } ///////////////////////////////////////////////////////////////////////////// CRasterODBCSink::~CRasterODBCSink() { m_pView = NULL; } ///////////////////////////////////////////////////////////////////////////// void CRasterODBCSink::OnFinalRelease() { // When the last reference for an automation object is released // OnFinalRelease is called. The base class will automatically // deletes the object. Add additional cleanup required for your // object before calling the base class. CCmdTarget::OnFinalRelease(); } ///////////////////////////////////////////////////////////////////////////// BEGIN_MESSAGE_MAP(CRasterODBCSink, CCmdTarget) //{{AFX_MSG_MAP(CRasterODBCSink) //}}AFX_MSG_MAP END_MESSAGE_MAP() BEGIN_DISPATCH_MAP(CRasterODBCSink, CCmdTarget) //{{AFX_DISPATCH_MAP(CRasterODBCSink) DISP_FUNCTION_ID(CRasterODBCSink,"ODBCChanged",1,OnChange,VT_EMPTY,VTS_NONE) //}}AFX_DISPATCH_MAP END_DISPATCH_MAP() // Note: we add support for IID_IRasterODBCSink to support typesafe binding // from VBA. This IID must match the GUID that is attached to the // dispinterface in the .IDL file. ///////////////////////////////////////////////////////////////////////////// BEGIN_INTERFACE_MAP(CRasterODBCSink, CCmdTarget) INTERFACE_PART(CRasterODBCSink, DIID__LEADRasterODBCEvents, Dispatch) END_INTERFACE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRasterODBCSink message handlers void CRasterODBCSink::OnChange() { if (m_pView==NULL) return; if (m_pView->m_RasterView.GetRaster().GetBitmap() == 0) { m_pView->m_RasterView.ForceRepaint(); // So we can see when images are missing. return; } CLtcdbApp * pTheApp = (CLtcdbApp * )AfxGetApp(); pTheApp->m_pRasterAnn->PutAnnContainer(pTheApp->m_pRasterODBC->GetAnnContainer()); m_pView->m_RasterView.SetPaintSizeMode(PAINTSIZEMODE_FIT); m_pView->m_RasterView.ForceRepaint(); } /////////////////////////////////////////////////////////////////////////////