/* * Pr黤t, ob ein Element in einem anderen liegt. Dabei nehmen wir an, dass GRASS eine * Fehlermeldung ausgibt, wenn sich zwei Elemente schneiden. Somit reicht es hier aus, * nur einen Punkt zu pr黤en. */ void proofeIntersections(QList<struct element>* eList) { warning("Pr黤e 躡erschneidungen ..."); QList<QRegion> regList; for(unsigned int loop = 0; loop < eList->count() - 1; loop++) { struct element* elA = eList->at(loop); QPointArray pArray(elA->pointList.count()); for(unsigned int pLoop = 0; pLoop < elA->pointList.count(); pLoop++) { pArray.setPoint(pLoop, QPoint(elA->pointList.at(pLoop)->latitude / 2000, elA->pointList.at(pLoop)->longitude / 2000)); } for(unsigned int regLoop = 0; regLoop < regList.count(); regLoop++) { QRegion* testReg = regList.at(regLoop); if(testReg->contains(pArray.point(0))) { // Element ist in fr黨erer Region enthalten ... elA->isValley = !eList->at(regLoop)->isValley; elA->sortID++; } } regList.append(new QRegion(pArray)); } warning(" ... fertig"); }
FCIMPLEND // Return a method info for the method were the exception was thrown FCIMPL1(ReflectMethodObject*, SystemNative::GetMethodFromStackTrace, ArrayBase* pStackTraceUNSAFE) { FCALL_CONTRACT; I1ARRAYREF pArray(static_cast<I1Array *>(pStackTraceUNSAFE)); StackTraceArray stackArray(pArray); if (!stackArray.Size()) return NULL; // The managed stacktrace classes always returns typical method definition, so we don't need to bother providing exact instantiation. // Generics::GetExactInstantiationsOfMethodAndItsClassFromCallInformation(pElements[0].pFunc, pElements[0].pExactGenericArgsToken, pTypeHandle, &pMD); MethodDesc* pFunc = stackArray[0].pFunc; // Strip the instantiation to make sure that the reflection never gets a bad method desc back. REFLECTMETHODREF refRet = NULL; HELPER_METHOD_FRAME_BEGIN_RET_0() pFunc = pFunc->LoadTypicalMethodDefinition(); refRet = pFunc->GetStubMethodInfo(); _ASSERTE(pFunc->IsRuntimeMethodHandle()); HELPER_METHOD_FRAME_END(); return (ReflectMethodObject*)OBJECTREFToObject(refRet); }
bool CPDF_FormField::SetItemSelection(int index, bool bSelected, bool bNotify) { ASSERT(GetType() == ComboBox || GetType() == ListBox); if (index < 0 || index >= CountOptions()) return false; CFX_WideString opt_value = GetOptionValue(index); if (bNotify && !NotifyListOrComboBoxBeforeChange(opt_value)) return false; if (bSelected) { if (GetType() == ListBox) { SelectOption(index, true); if (!(m_Flags & kFormListMultiSelect)) { m_pDict->SetNewFor<CPDF_String>("V", PDF_EncodeText(opt_value), false); } else { CPDF_Array* pArray = m_pDict->SetNewFor<CPDF_Array>("V"); for (int i = 0; i < CountOptions(); i++) { if (i == index || IsItemSelected(i)) { opt_value = GetOptionValue(i); pArray->AddNew<CPDF_String>(PDF_EncodeText(opt_value), false); } } } } else { m_pDict->SetNewFor<CPDF_String>("V", PDF_EncodeText(opt_value), false); CPDF_Array* pI = m_pDict->SetNewFor<CPDF_Array>("I"); pI->AddNew<CPDF_Number>(index); } } else { CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); if (pValue) { if (GetType() == ListBox) { SelectOption(index, false); if (pValue->IsString()) { if (pValue->GetUnicodeText() == opt_value) m_pDict->RemoveFor("V"); } else if (pValue->IsArray()) { std::unique_ptr<CPDF_Array> pArray(new CPDF_Array); for (int i = 0; i < CountOptions(); i++) { if (i != index && IsItemSelected(i)) { opt_value = GetOptionValue(i); pArray->AddNew<CPDF_String>(PDF_EncodeText(opt_value), false); } } if (pArray->GetCount() > 0) m_pDict->SetFor("V", std::move(pArray)); } } else { m_pDict->RemoveFor("V"); m_pDict->RemoveFor("I"); } } } if (bNotify) NotifyListOrComboBoxAfterChange(); return true; }
inline void ShapeCLPolygon::draw( double sf, QPainter& painter ) { QPointArray pArray( numPoints ); for ( int i=0; i<numPoints; i++ ) { int X = Convert::degreeToPixelX( points[i].x(), sf ); int Y = Convert::degreeToPixelY( points[i].y(), sf ); pArray.setPoint( i, X, Y ); } painter.drawPolygon( pArray ); }
int main () { std::unique_ptr< FILE, FileDeleter > pFile( fopen( "test.txt", "wt" ) ); fprintf( pFile.get(), "Hello managed file!\n" ); auto pFile2 = std::unique_ptr< FILE, std::function< void ( FILE * ) > >( fopen( "test2.txt", "wt" ) , [] ( FILE * f ) { fclose( f ); } ); fprintf( pFile2.get(), "Hello another managed file!\n" ); std::unique_ptr< int[] > pArray( new int[ 100 ] ); for ( int i = 0; i < 100; i++ ) pArray[ i ] = rand(); }
FX_BOOL CPDF_FormField::SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify) { ASSERT(GetType() == ComboBox || GetType() == ListBox); if (index < 0 || index >= CountOptions()) return FALSE; CFX_WideString opt_value = GetOptionValue(index); if (bNotify && !NotifyListOrComboBoxBeforeChange(opt_value)) return FALSE; if (bSelected) { if (GetType() == ListBox) { SelectOption(index, TRUE); if (!(m_Flags & kFormListMultiSelect)) { m_pDict->SetStringFor("V", PDF_EncodeText(opt_value)); } else { CPDF_Array* pArray = new CPDF_Array; for (int i = 0; i < CountOptions(); i++) { if (i == index || IsItemSelected(i)) { opt_value = GetOptionValue(i); pArray->AddString(PDF_EncodeText(opt_value)); } } m_pDict->SetFor("V", pArray); } } else { m_pDict->SetStringFor("V", PDF_EncodeText(opt_value)); CPDF_Array* pI = new CPDF_Array; pI->AddInteger(index); m_pDict->SetFor("I", pI); } } else { CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); if (pValue) { if (GetType() == ListBox) { SelectOption(index, FALSE); if (pValue->IsString()) { if (pValue->GetUnicodeText() == opt_value) m_pDict->RemoveFor("V"); } else if (pValue->IsArray()) { std::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray( new CPDF_Array); for (int i = 0; i < CountOptions(); i++) { if (i != index && IsItemSelected(i)) { opt_value = GetOptionValue(i); pArray->AddString(PDF_EncodeText(opt_value)); } } if (pArray->GetCount() > 0) m_pDict->SetFor("V", pArray.release()); // std::move someday } } else { m_pDict->RemoveFor("V"); m_pDict->RemoveFor("I"); } } } if (bNotify) NotifyListOrComboBoxAfterChange(); return TRUE; }