Click here to Skip to main content
15,889,116 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhow to include minizip code into vc++ 2010 SDI application Pin
syam0718-Apr-13 3:29
syam0718-Apr-13 3:29 
QuestionRe: how to include minizip code into vc++ 2010 SDI application Pin
David Crow8-Apr-13 5:54
David Crow8-Apr-13 5:54 
QuestionUnicode CString and fopen problem Pin
DSPCottage7-Apr-13 18:45
DSPCottage7-Apr-13 18:45 
AnswerRe: Unicode CString and fopen problem Pin
tagopi7-Apr-13 20:21
tagopi7-Apr-13 20:21 
GeneralRe: Unicode CString and fopen problem Pin
DSPCottage4-May-13 18:38
DSPCottage4-May-13 18:38 
AnswerRe: Unicode CString and fopen problem Pin
Jochen Arndt7-Apr-13 21:00
professionalJochen Arndt7-Apr-13 21:00 
GeneralRe: Unicode CString and fopen problem Pin
DSPCottage4-May-13 18:38
DSPCottage4-May-13 18:38 
Questionquestion about custom symbol in arcmap Pin
ts_chen6-Apr-13 15:40
ts_chen6-Apr-13 15:40 
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:raw(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);
}
:eleteObject(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);
}
}
QuestionIf this fires you have a mixed DEBUG/RETAIL build - now what ? Pin
Vaclav_6-Apr-13 8:34
Vaclav_6-Apr-13 8:34 
AnswerRe: If this fires you have a mixed DEBUG/RETAIL build - now what ? Pin
pasztorpisti6-Apr-13 10:23
pasztorpisti6-Apr-13 10:23 
Questionutf to ascii conversion Pin
khushboo gupta5-Apr-13 23:12
khushboo gupta5-Apr-13 23:12 
AnswerRe: utf to ascii conversion Pin
Richard MacCutchan6-Apr-13 1:47
mveRichard MacCutchan6-Apr-13 1:47 
GeneralRe: utf to ascii conversion Pin
khushboo gupta6-Apr-13 2:39
khushboo gupta6-Apr-13 2:39 
GeneralRe: utf to ascii conversion Pin
Richard MacCutchan6-Apr-13 3:28
mveRichard MacCutchan6-Apr-13 3:28 
GeneralRe: utf to ascii conversion Pin
khushboo gupta7-Apr-13 18:30
khushboo gupta7-Apr-13 18:30 
GeneralRe: utf to ascii conversion Pin
khushboo gupta9-Apr-13 2:35
khushboo gupta9-Apr-13 2:35 
GeneralRe: utf to ascii conversion Pin
Richard MacCutchan9-Apr-13 5:03
mveRichard MacCutchan9-Apr-13 5:03 
AnswerRe: utf to ascii conversion Pin
MicroVirus6-Apr-13 6:52
MicroVirus6-Apr-13 6:52 
GeneralRe: utf to ascii conversion Pin
khushboo gupta7-Apr-13 18:33
khushboo gupta7-Apr-13 18:33 
QuestionT13 Secure Erase Pin
RomTibi5-Apr-13 11:46
RomTibi5-Apr-13 11:46 
AnswerRe: T13 Secure Erase Pin
dusty_dex5-Apr-13 21:08
dusty_dex5-Apr-13 21:08 
GeneralRe: T13 Secure Erase Pin
RomTibi6-Apr-13 2:18
RomTibi6-Apr-13 2:18 
GeneralRe: T13 Secure Erase Pin
dusty_dex6-Apr-13 7:53
dusty_dex6-Apr-13 7:53 
GeneralRe: T13 Secure Erase Pin
RomTibi6-Apr-13 8:39
RomTibi6-Apr-13 8:39 
AnswerRe: T13 Secure Erase Pin
Randor 6-Apr-13 17:56
professional Randor 6-Apr-13 17:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.