/////////////////////////////////////////////////////////////////////////////// // alle Objekte eines Bereiches suchen HRESULT CSpatialTree::TreeNodeSearch ( double *padfBoundsMin, double *padfBoundsMax, HRESULT (CALLBACK *pFcn)(_DGMGeometry *, UINT_PTR), UINT_PTR dwData, bool fExact) { // Perform the search for likely candidates. These are shapes // that fall into a tree node whose bounding box intersects our // area of interest. int nFeatureCount = 0; _DGMGeometry * *panHits = FindLikelyFeatures (padfBoundsMin, padfBoundsMax, &nFeatureCount); if (NULL == panHits) return S_OK; // nothing found // Read all of these shapes, and establish whether the shape's // bounding box actually intersects the area of interest. Note // that the bounding box could intersect the area of interest, // and the shape itself still not cross it but we don't try to // address that here. HRESULT hr = S_OK; COM_TRY { for (int i = 0; i < nFeatureCount && SUCCEEDED(hr); ++i) { W_DGMGeometry Object (panHits[i]); if (!Object) continue; WTRiASCSGeometryProperties Prop (Object); WTRiASSimpleRectangle Rect; double dBoundsMin[2]; double dBoundsMax[2]; THROW_FAILED_HRESULT(Prop -> get_Envelope(Rect.ppi())); THROW_FAILED_HRESULT(Rect -> GetRect(&dBoundsMin[0], &dBoundsMin[1], &dBoundsMax[0], &dBoundsMax[1])); if (CSpatialTreeNode::CheckBoundsOverlap (padfBoundsMin, padfBoundsMax, dBoundsMin, dBoundsMax)) { if (!fExact || S_OK == CheckRealOverlap (Object, padfBoundsMin, padfBoundsMax)) hr = pFcn (Object, dwData); } } } COM_CATCH_OP(free (panHits)); free (panHits); return hr; }
// Enumerieren aller 'festen' Properties dieses Objektes HRESULT TxEnumPropertyEntries ( _PROPERTYSUPPORT_ENTRY* pEntry, HRESULT (CALLBACK *pFcn)(LPCOLESTR, UINT_PTR), UINT_PTR dwData) { HRESULT hr = S_OK; while (NULL != pEntry->dw) { if (NULL != pEntry->szKey) { hr = pFcn (pEntry->szKey, dwData); if (S_OK != hr) break; } pEntry++; } return hr; }
//***************************************************************************** // This function will handle ignore codes and tell the user what is happening. //***************************************************************************** int _DbgBreakCheck( LPCSTR szFile, int iLine, LPCSTR szExpr) { TCHAR rcBuff[1024+_MAX_PATH]; TCHAR rcPath[_MAX_PATH]; TCHAR rcTitle[64]; _DBGIGNOREDATA *psData; long i; if (DebugBreakOnAssert()) { DebugBreak(); } DBGIGNORE* pDBGIFNORE = GetDBGIGNORE(); // Check for ignore all. for (i=0, psData = pDBGIFNORE->Ptr(); i<pDBGIFNORE->Count(); i++, psData++) { if (psData->iLine == iLine && _stricmp(psData->rcFile, szFile) == 0 && psData->bIgnore == true) return (false); } // Give assert in output for easy access. WszGetModuleFileName(0, rcPath, NumItems(rcPath)); swprintf(rcBuff, L"Assert failure(PID %d [0x%08x], Thread: %d [0x%x]): %hs\n" L" File: %hs, Line: %d Image:\n%s\n", GetCurrentProcessId(), GetCurrentProcessId(), GetCurrentThreadId(), GetCurrentThreadId(), szExpr, szFile, iLine, rcPath); WszOutputDebugString(rcBuff); // Write out the error to the console printf("%S\n", rcBuff); LogAssert(szFile, iLine, szExpr); FlushLogging(); // make certain we get the last part of the log fflush(stdout); if (NoGuiOnAssert()) { TerminateOnAssert(); } if (DebugBreakOnAssert()) { return(true); // like a retry } // Change format for message box. The extra spaces in the title // are there to get around format truncation. swprintf(rcBuff, L"%hs\n\n%hs, Line: %d\n\nAbort - Kill program\nRetry - Debug\nIgnore - Keep running\n" L"\n\nImage:\n%s\n", szExpr, szFile, iLine, rcPath); swprintf(rcTitle, L"Assert Failure (PID %d, Thread %d/%x) ", GetCurrentProcessId(), GetCurrentThreadId(), GetCurrentThreadId()); // Tell user there was an error. _DbgBreakCount++; int ret = WszMessageBoxInternal(NULL, rcBuff, rcTitle, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION | COMPLUS_MB_SERVICE_NOTIFICATION); --_DbgBreakCount; HMODULE hKrnl32; switch(ret) { // For abort, just quit the app. case IDABORT: TerminateProcess(GetCurrentProcess(), 1); // WszFatalAppExit(0, L"Shutting down"); break; // Tell caller to break at the correct loction. case IDRETRY: hKrnl32 = WszLoadLibrary(L"kernel32.dll"); _ASSERTE(hKrnl32 != NULL); if(hKrnl32) { typedef BOOL (WINAPI *t_pDbgPres)(); t_pDbgPres pFcn = (t_pDbgPres) GetProcAddress(hKrnl32, "IsDebuggerPresent"); // If this function is available, use it. if (pFcn) { if (pFcn()) { SetErrorMode(0); } else LaunchJITDebugger(); } FreeLibrary(hKrnl32); } return (true); // If we want to ignore the assert, find out if this is forever. case IDIGNORE: swprintf(rcBuff, L"Ignore the assert for the rest of this run?\nYes - Assert will never fire again.\nNo - Assert will continue to fire.\n\n%hs\nLine: %d\n", szFile, iLine); if (WszMessageBoxInternal(NULL, rcBuff, L"Ignore Assert Forever?", MB_ICONQUESTION | MB_YESNO | COMPLUS_MB_SERVICE_NOTIFICATION) != IDYES) break; if ((psData = pDBGIFNORE->Append()) == 0) return (false); psData->bIgnore = true; psData->iLine = iLine; strcpy(psData->rcFile, szFile); break; } return (false); }