POST
|
The question is how to Call AtlAdvise to subscribe to the document events. For IActiveviewEvents, we can use CLSID_ActiveViewEventsListener, but for IDocumentEvents, what is the Listener? I use "AtlAdvise(m_spDocument, m_spVGEDocumentEvents, __uuidof(IDocumentEvents), &m_dwDocEventsCookie);" sucessful. thankyou
... View more
06-15-2013
07:55 AM
|
0
|
0
|
238
|
POST
|
The class that you are probably looking for is MxDocument: http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/000v/000v000000nn000000.htm Steps: Get IApplication From IApplication call get_Document to get IDocument Call AtlAdvise to subscribe to the document events If the above is not sufficient information then I'd suggest to install and dig through the C++ samples associated with the ArcObjects SDK. In general, programming in C# would be easier but your post indicated that you wanted to use C++. Best of luck! The question is how to Call AtlAdvise to subscribe to the document events. For IActiveviewEvents, we can use CLSID_ActiveViewEventsListener, but for IDocumentEvents, what is the Listener?
... View more
06-15-2013
06:42 AM
|
0
|
0
|
238
|
POST
|
I want to listen to open mxd file event in arcmap extension. I find a interface:IDocumentEvents, but I don't know how to use it in C++ and What is the listener for IDocumentEvents.
... View more
06-15-2013
12:18 AM
|
0
|
3
|
511
|
POST
|
It can be render correct when I using gdi or gdi+ My entire code use aggplus is in attachment
... View more
04-06-2013
12:39 AM
|
0
|
0
|
326
|
POST
|
I write a custom symbol component like logomarker symbol ,but i use agg instead of gdi. When I open shape files in arcmap and use my custom symbol to render the data, It is successful. However , when I open geodatabase files,as the same as shape files, It will be fail. It render blank. When I load this data again. It will render with the default symbol correct. Why? I use aggplus which is encapsulated like GDI+. the main code is follow(full code about main class in attachment): Aggplus::Graphics *m_pGraphics; STDMETHODIMP CCartoSymbolMarker::SetupDC(OLE_HANDLE hDC, ITransformation *Transformation) { m_ipTrans = Transformation; m_pGraphics = Graphics::FromHDC((HDC)hDC); return S_OK; } STDMETHODIMP CCartoSymbolMarker::Draw(IGeometry *Geometry) { if (!Geometry) return E_POINTER; IPointPtr spPoint(Geometry); if (spPoint == NULL) return E_FAIL; double x=0, y=0; FromMapPoint((IDisplayTransformation*)m_ipTrans, spPoint, &x, &y); Pen myPen(Color(255,0,0,255), 1); m_pGraphics->DrawRectangle(&myPen, x, y, 10, 20); return S_OK; } STDMETHODIMP CCartoSymbolMarker::ResetDC() { delete m_pGraphics; m_pGraphics = NULL; return S_OK; } Aggplus Graphics class: Graphics *Graphics::FromHDC(HDC hdc) { return(new Graphics(hdc)); } Graphics::Graphics(HDC hdc) : m_dwConfigFlags(0) { RECT clipBox; ::GetClipBox(hdc, &clipBox); int nW=clipBox.right-clipBox.left; int nH=clipBox.bottom-clipBox.top; ASSERT(nW>0 && nH>0); z_Create(nW, nH, -4*nW, NULL); m_dwConfigFlags|=def_flag_G_FromHDC; m_fromhdc_HDC=hdc; m_fromhdc_X=clipBox.left; m_fromhdc_Y=clipBox.top; } Graphics::~Graphics() { #ifdef def_AP_Update_Dc_at_End if(m_dwConfigFlags & def_flag_G_FromHDC) { BITMAPINFO hDib; memset(&hDib, 0, sizeof(BITMAPINFO)); hDib.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); hDib.bmiHeader.biWidth = m_dwWidth; hDib.bmiHeader.biHeight = m_dwHeight; hDib.bmiHeader.biPlanes = 1; hDib.bmiHeader.biBitCount = 32; hDib.bmiHeader.biCompression = BI_RGB; hDib.bmiHeader.biSizeImage = m_dwWidth * m_dwHeight * 4; #ifndef _X_NODCAlpha_ LPVOID pBits; HBITMAP hBitmap = CreateDIBSection(m_fromhdc_HDC, &hDib, DIB_RGB_COLORS, &pBits, NULL, 0); if(!hBitmap) ASSERT(FALSE); else { memcpy(pBits, buffer, m_dwWidth * m_dwHeight * 4); HDC mdc=CreateCompatibleDC( m_fromhdc_HDC ); if(!mdc) ASSERT(FALSE); else { HBITMAP hbmOld=(HBITMAP)::SelectObject(mdc, hBitmap); BLENDFUNCTION bln; bln.BlendOp=AC_SRC_OVER; bln.BlendFlags=0; bln.SourceConstantAlpha=255; bln.AlphaFormat=AC_SRC_ALPHA; AlphaBlend(m_fromhdc_HDC, m_fromhdc_X, m_fromhdc_Y, m_dwWidth, m_dwHeight, mdc, 0, 0, m_dwWidth, m_dwHeight, bln); //BitBlt(m_fromhdc_HDC, m_fromhdc_X, m_fromhdc_Y, m_dwWidth, m_dwHeight, mdc, 0, 0, SRCCOPY); ::SelectObject(mdc, hbmOld); //::GdiFlush(); DeleteDC(mdc); } ::DeleteObject(hBitmap); } #else SetDIBitsToDevice(m_fromhdc_HDC, m_fromhdc_X, m_fromhdc_Y, m_dwWidth, m_dwHeight, 0, 0, 0, m_dwHeight, buffer, &hDib, DIB_RGB_COLORS); #endif //_X_NODCAlpha_ } #endif //def_AP_Update_Dc_at_End delete(m_agg_pREN); delete(m_agg_ppixf); if(!(m_dwConfigFlags&def_flag_G_ExtBuffer)) { delete(buffer); } } result: custom symbol in arcmap symbol selector [ATTACH=CONFIG]23246[/ATTACH] shape file use my custom symbol, correct [ATTACH=CONFIG]23243[/ATTACH] geodatabase use my custom symbol. fail and blank [ATTACH=CONFIG]23244[/ATTACH] load the data again , it render correct with defalut symbol, but data is twice [ATTACH=CONFIG]23245[/ATTACH]
... View more
04-05-2013
07:22 AM
|
0
|
3
|
2535
|
POST
|
I write an ATL project like logomarkersymbol. I want to read polyline data in Draw function , I use IPointCollectionPtr to read, but failed, the pointcollection is empty. Why??? my code is : IPolylinePtr spPolyline(Geometry); IGeometryCollectionPtr spGeometryCollection(spPolyline); if(NULL == spGeometryCollection) return E_FAIL; long nGeos=0; spGeometryCollection->get_GeometryCount(&nGeos); for (i=0;i<nGeos;i++) { IGeometryPtr spGeometry; spGeometryCollection->get_Geometry(i, &spGeometry); IPointCollectionPtr spCollection(spGeometry); long nPoints=0; nPoints = spPointCollection->get_PointCount(&nPoints); //spPolyline, spGeometry and spPointCollection has values, but npoint is empty. why??? ?????? }
... View more
10-28-2012
05:15 AM
|
0
|
2
|
2667
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|