// RasterSegmentationSink.cpp : implementation file // #include "stdafx.h" #include "leadRaster.h" #include "RasterMrcSink.h" #include "SegDemo.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CSegDemoApp theApp; ///////////////////////////////////////////////////////////////////////////// // CRasterSegmentationSink IMPLEMENT_DYNCREATE(CRasterSegmentationSink, CCmdTarget) CRasterSegmentationSink::CRasterSegmentationSink() { EnableAutomation(); } CRasterSegmentationSink::~CRasterSegmentationSink() { } void CRasterSegmentationSink::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(CRasterSegmentationSink, CCmdTarget) //{{AFX_MSG_MAP(CRasterSegmentationSink) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() BEGIN_DISPATCH_MAP(CRasterSegmentationSink, CCmdTarget) //{{AFX_DISPATCH_MAP(CRasterSegmentationSink) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_DISPATCH_MAP DISP_FUNCTION_ID(CRasterSegmentationSink,"OnEnumSegments",1,OnEnumSegments,VT_EMPTY,VTS_I4 VTS_I4 VTS_I4 VTS_I4 VTS_I4 VTS_I4) END_DISPATCH_MAP() // Note: we add support for IID_IRasterProcSink to support typesafe binding // from VBA. This IID must match the GUID that is attached to the // dispinterface in the .ODL file. // {FCEC20F1-6B67-4CFC-A652-C2ABCCFC8A8C} static const IID IID_IRasterSegmentationSink = { 0xfcec20f1, 0x6b67, 0x4cfc, { 0xa6, 0x52, 0xc2, 0xab, 0xcc, 0xfc, 0x8a, 0x8c } }; BEGIN_INTERFACE_MAP(CRasterSegmentationSink, CCmdTarget) INTERFACE_PART(CRasterSegmentationSink, DIID__LEADRasterMrcEvents, Dispatch) END_INTERFACE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRasterSegmentationSink message handlers void CRasterSegmentationSink::OnEnumSegments(long nSegId, long SegmentLeft, long SegmentTop, long SegmentRight, long SegmentBottom, MRCSegmentTypeConstants SegType) { CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame(); CSegDemoView *pView = (CSegDemoView *) pChild->GetActiveView(); CSegDemoView::SEGMENTINFO SegInfo; SegInfo.nSegId = nSegId; SetRect(&SegInfo.rcRect, SegmentLeft, SegmentTop, SegmentRight, SegmentBottom); SegInfo.SegType = SegType; SegInfo.bSelected = FALSE; pView->m_SegInfo.Add(SegInfo); }