BOOL CxString :: Teilen( CString& h, CString& r, char c, BOOL trimmen ) { int i = Find( c ); CxString head = h; CxString rest = r; BOOL result = FALSE; if( i > 0 ) { head = Left( i ); rest = Mid( i + 1 ); result = TRUE; } else if( i == 0 ) { // c ist erstes Zeichen head.Empty(); rest = Mid( 1 ); } else { // Zeichen nicht gefunden! head = *this; rest.Empty(); } if ( trimmen ) { head.TrimAll(); rest.TrimAll(); } h = head; r = rest; return result; } // Teilen
BOOL CxString :: Teilen( CString& h, CString& r, const char* pat, BOOL trimmen ) { CxString head = h; CxString rest = r; BOOL result = FALSE; ASSERT( AfxIsValidString( pat )); if ( *pat == '\0' ) { head = *this; rest = ""; if ( trimmen ) { head.TrimAll(); rest.TrimAll(); } h = head; r = rest; return TRUE; } if ( *(pat + 1 ) == '\0' ) return Teilen( h, r, *pat, trimmen ); int i = Find( pat ); int len = lstrlen( pat ); if ( len >= GetLength()) return FALSE; if ( i >= 0 ) { if ( i == 0 ) // pat steht am Anfang { head.Empty(); rest = Mid( len ); } else { head = Left( i ); if (( i + len ) < GetLength()) rest = Mid( i + len ); else rest = ""; result = TRUE; } } else { // pat nicht gefunden! head = *this; rest.Empty(); } if ( trimmen ) { head.TrimAll(); rest.TrimAll(); } h = head; r = rest; return result; } // Teilen
void CObjektPool::WriteBack(bool fStatus) { CTriasObjekt *pTO; CGeoObj *pGO; CPunktFolge *pPF; CPunkt *pPT; CString text, id, key; POSITION pos, posMM; int a, j, nr, anzahl; long l, z, max, kp = 1L; long *pkp = NULL; CString strPrepared; VERIFY(strPrepared.LoadString(IDS_OBJECTSPREPARED)); anzahl = m_omGeoObjekte.GetCount(); ((CEDBSExtension*)g_pTE) -> SetDefaultStatusTexte(strPrepared, NULL, NULL, " "); CString strPrepare; VERIFY(strPrepare.LoadString(IDS_PREPAREOBJECTS)); ((CEDBSExtension*)g_pTE) -> InitStatusDialog(strPrepare, (ULONG)anzahl, NULL ); if (PrepareObjTeile()) { // nicht abgebrochen CString strSaved; VERIFY(strSaved.LoadString(IDS_OBJECTSSAVED)); ((CEDBSExtension*)g_pTE) -> SetDefaultStatusTexte(strSaved, NULL, NULL, " "); CString strSave; VERIFY(strSave.LoadString(IDS_SAVEOBJECTS)); nr = 0; anzahl = m_omGeoObjekte.GetCount(); // sind jetzt u.U. weniger ((CEDBSExtension*)g_pTE) -> InitStatusDialog(strSave, (ULONG)anzahl, NULL ); for (pos = m_omGeoObjekte.GetStartPosition(); pos != NULL; /**/) { m_omGeoObjekte.GetNextAssoc(pos, id, (CObject *&)pGO); // ------------------------------------------------------------------------------------ // Hier ansetzen um Objekte mit Löchern zu identifizieren! // ------------------------------------------------------------------------------------ ((CEDBSExtension *)g_pTE) -> SetupStatus((ULONG)nr++); if (((CEDBSExtension *)g_pTE) -> NutzerAbbruch()) break; // abgebrochen // ------------------------------------------------------------------------------------ // Fallunterscheidung: Linienobjekte mit mehreren, nicht verbundenen Linienabschnitten // werden in mehrere Objekte gesplittet! // ------------------------------------------------------------------------------------ if (( pGO -> AnzahlLinien() == 1 ) && ( pGO -> ObjTyp() != 'L' )) if ( pGO -> Punkte(0) -> Geschlossen()) pGO -> ObjTyp() = 'F'; if (( pGO -> ObjTyp() == 'F' ) && ( pGO -> AnzahlLinien() > 1 )) { // Flächen mit nicht geschlossenen Konturen aussondern! for ( j = 0; j < pGO -> AnzahlLinien(); j++ ) if ( !pGO -> Punkte( j ) -> Geschlossen()) pGO -> ObjTyp() = 'L'; } if (( pGO -> ObjTyp() == 'L' ) && ( pGO -> AnzahlLinien() > 1 )) { CxString strUID; for (int loop = 0; loop < pGO -> AnzahlLinien(); loop++) { pTO = new CTriasObjekt(); pkp = &kp; if ( pTO ) { pTO -> ONr() = 0L; // neues Objekt! pTO -> Neu() = TRUE; pTO -> Ident() = g_pTriasInterface -> GetIdent (pGO -> Folie(), pGO -> ObjektArt(), pGO -> Merkmale()); max = z = 0L; a = 0; z = pGO -> AnzahlPunkte( loop ); pTO -> AnzahlPunkte() = z; pTO -> XKoord( new double[z+1]); pTO -> YKoord( new double[z+1]); pTO -> KonturPunkte( pkp ); pkp[0] = z; z = 0L; pPF = pGO -> Punkte( loop ); for ( l = 0; l < pPF -> GetSize(); l++ ) { pPT = (CPunkt*)pPF -> GetAt( (int)l ); *((double*)pTO -> XKoord() + z) = pPT -> Rechts(); *((double*)pTO -> YKoord() + z) = pPT -> Hoch(); z++; } pTO -> ObjTyp() = OGLinie; pTO -> AnzahlKonturen() = 1; strUID.Empty(); strUID.printf( "%s_%d", (const char*)pGO -> UniqueIdent(), loop ); pTO -> UniqueIdent() = strUID; if (!pGO -> Folie().IsEmpty()) pTO -> AddTextMerkmal ("ATKIS-Folie", pGO -> Folie()); if (!pGO -> ObjektArt().IsEmpty()) pTO -> AddTextMerkmal ("ATKIS-Objektart", pGO -> ObjektArt()); pTO -> AddTextMerkmal ("ATKIS-Dateiname", g_pTriasInterface -> GetActFileName()); posMM = pGO -> GetMMStartPos(); while ( posMM ) { pGO -> GetMMNext( posMM, key, text ); pTO -> AddTextMerkmal( key, text ); } pTO -> WriteBack(); pTO -> KonturPunkte( NULL ); // weil: &kp nicht freigeben!!! delete pTO; } } } else { pTO = new CTriasObjekt(); if ( pGO -> AnzahlLinien() || pGO -> ObjNr()) { if ( pGO -> AnzahlLinien() > 1 ) pkp = new long[pGO -> AnzahlLinien()]; else pkp = &kp; if ( pTO ) { if ( pGO -> ObjNr()) pTO -> ONr() = pGO -> ObjNr(); else pTO -> ONr() = 0L; // neues Objekt! pTO -> Ident() = g_pTriasInterface -> GetIdent(pGO -> Folie(), pGO -> ObjektArt(), pGO -> Merkmale()); max = z = 0L; a = 0; // Gesamtzahl Punkte und Hypothese für Aussenkontur ermitteln for ( j = 0; j < pGO -> AnzahlLinien(); j++) { z += pGO -> AnzahlPunkte( j ); if (pGO -> AnzahlPunkte(j) > max) { max = pGO -> AnzahlPunkte( j ); a = j; } } pTO -> AnzahlPunkte() = z; pTO -> XKoord(new double[z+1]); pTO -> YKoord(new double[z+1]); pTO -> KonturPunkte(pkp); z = 0L; if (pGO -> AnzahlLinien()) { // zuerst die Aussenkontur eintragen! pPF = pGO -> Punkte( a ); for ( l = 0; l < pPF -> GetSize(); l++ ) { pPT = (CPunkt*)pPF -> GetAt( (int)l ); *((double*)pTO -> XKoord() + z) = pPT -> Rechts(); *((double*)pTO -> YKoord() + z) = pPT -> Hoch(); z++; } } pkp[0] = max; if ( pGO -> ObjTyp() == 'F' ) { if ( pGO -> AnzahlLinien()) { if ( pGO -> AnzahlPunkte( 0 ) == 1 ) pTO -> ObjTyp() = OGPunkt; else pTO -> ObjTyp() = OGFlaeche; } } else if (pGO -> ObjTyp() == 'L') pTO -> ObjTyp() = OGLinie; else if (pGO -> ObjTyp() == 'P') { // ggf. Textobjekt draus machen if (!g_pTriasInterface -> MakeText(pGO -> ObjektArt())) pTO -> ObjTyp() = OGPunkt; else ConvertToText (pGO, pTO); } else if (pGO -> AnzahlLinien()) { if (pGO -> AnzahlPunkte( 0 ) == 1) { // ggf. Textobjekt draus machen if (!g_pTriasInterface -> MakeText(pGO -> ObjektArt())) pTO -> ObjTyp() = OGPunkt; else ConvertToText (pGO, pTO); } else { if (pGO -> Punkte(0) -> Geschlossen()) pTO -> ObjTyp() = OGFlaeche; else pTO -> ObjTyp() = OGLinie; } } pTO -> AnzahlKonturen() = pGO -> AnzahlLinien(); pTO -> UniqueIdent() = pGO -> UniqueIdent(); // Standard-Attribute erzeugen if (!pGO -> ObjNr()) { pTO -> Neu() = TRUE; if (!pGO -> Folie().IsEmpty()) pTO -> AddTextMerkmal ("ATKIS-Folie", pGO -> Folie()); if (!pGO -> ObjektArt().IsEmpty()) pTO -> AddTextMerkmal ("ATKIS-Objektart", pGO -> ObjektArt()); pTO -> AddTextMerkmal ("ATKIS-Dateiname", g_pTriasInterface -> GetActFileName()); } // alle sonstigen Attribute übernehmen posMM = pGO -> GetMMStartPos(); while ( posMM ) { text.Empty(); pGO -> GetMMNext( posMM, key, text ); pTO -> AddTextMerkmal( key, text ); } for ( j = 0; j < pGO -> AnzahlLinien(); j++ ) { if ( j != a ) { if ( j < a ) pkp[j+1] = pGO -> AnzahlPunkte( j ); else pkp[j] = pGO -> AnzahlPunkte( j ); pPF = pGO -> Punkte( j ); for ( l = 0; l < pPF -> GetSize(); l++ ) { pPT = (CPunkt*)pPF -> GetAt( (int)l ); *((double*)pTO -> XKoord() + z) = pPT -> Rechts(); *((double*)pTO -> YKoord() + z) = pPT -> Hoch(); z++; } } } } } else if (pGO -> IsFloeDelta()) { HOBJECT lONr = g_pTriasInterface -> FindObject(pGO -> UniqueIdent()); if (INVALID_HOBJECT != lONr) { // ggf. reine Attributkorrektur (#HK011114) // war in einem FLOE-Satz (DLTA1001) und muß Bezug haben pTO -> UniqueIdent() = pGO -> UniqueIdent(); // Standard-Attribute erzeugen // pTO -> ONr() = pGO -> ObjNr(); if (!pGO -> Folie().IsEmpty()) pTO -> AddTextMerkmal ("ATKIS-Folie", pGO -> Folie()); if (!pGO -> ObjektArt().IsEmpty()) pTO -> AddTextMerkmal ("ATKIS-Objektart", pGO -> ObjektArt()); pTO -> AddTextMerkmal ("ATKIS-Dateiname", g_pTriasInterface -> GetActFileName()); // alle sonstigen Attribute übernehmen posMM = pGO -> GetMMStartPos(); while (posMM) { text.Empty(); pGO -> GetMMNext( posMM, key, text ); pTO -> AddTextMerkmal( key, text ); } pTO -> ONr() = lONr; pTO -> Neu() = FALSE; } } if ((pTO -> ObjTyp() == OGLinie) && (pTO -> AnzahlKonturen() > 1)) { CString text = "Nicht verbundene Linienabschnitte! UID: "; text += pTO -> UniqueIdent(); AfxMessageBox(text); } pTO -> WriteBack(); pTO -> KonturPunkte( NULL ); // weil: &kp nicht freigeben!!! if ( pGO -> AnzahlLinien() > 1 ) delete pkp; delete pTO; } } } for (pos = m_omGeoObjekte.GetStartPosition(); pos != NULL; ) { m_omGeoObjekte.GetNextAssoc( pos, id, (CObject*&)pGO ); delete pGO; } m_omGeoObjekte.RemoveAll(); } // WriteBack
void CObjektPool::WriteBack( bool fStatus ) { CTriasObjekt *pTO; // CObjectClassEDBS *pOCE; CGeoObj *pGO; CPunktFolge *pPF; CPunkt *pPT; CString text, id, key; POSITION pos; int a, j, nr, anzahl; long l, z, max, kp = 1L; long *pkp = NULL; g_pTriasInterface->UpdateHeaders(); nr = 0; anzahl = m_omGeoObjekte.GetCount(); text = "Gelesene Objekte zu %d%% in "; text += ((CEDBSExtension*)g_pTE)->Configuration.m_strTRiASName; text += " gespeichert!"; ((CEDBSExtension*)g_pTE) -> SetDefaultStatusTexte( text, NULL, "Datei:", NULL ); ((CEDBSExtension*)g_pTE) -> InitStatusDialog( g_pTriasInterface->strImportFullFileName, (ULONG)anzahl, NULL ); for ( pos = m_omGeoObjekte.GetStartPosition(); pos != NULL; ) { m_omGeoObjekte.GetNextAssoc( pos, id, (CObject*&)pGO ); ((CEDBSExtension*)g_pTE) -> SetupStatus( (ULONG)++nr ); if( !g_pMetaData->ClassifyGeoObject( *pGO ) ) { delete pGO; continue; } /* pOCE = g_pMetaData->GetObjectClassEDBS(pGO->Objektart()); if( pOCE ) if( pOCE->Ignored() ) continue; if( g_pMetaData->IgnoreFolie( pGO->Folie() ) ) continue; */ if( !g_pMetaData->Filter.IsEmpty() ) if( strcmp(pGO -> UniqueIdent().Left(g_pMetaData->Filter.GetLength()), g_pMetaData->Filter) ) { delete pGO; continue; } // ------------------------------------------------------------------------------------ // Hier ansetzen um Objekte mit Löchern zu identifizieren! // ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------ // Fallunterscheidung: Linienobjekte mit mehreren, nicht verbundenen Linienabschnitten // werden in mehrere Objekte gesplittet! // ------------------------------------------------------------------------------------ if (( pGO -> AnzahlLinien() == 1 ) && ( pGO -> ObjTyp() != 'L' )) if ( pGO -> Punkte(0) -> Geschlossen()) pGO -> ObjTyp() = 'F'; if (( pGO -> ObjTyp() == 'F' ) && ( pGO -> AnzahlLinien() > 1 )) { // Flächen mit nicht geschlossenen Konturen aussondern! for ( j = 0; j < pGO -> AnzahlLinien(); j++ ) if ( !pGO -> Punkte( j ) -> Geschlossen()) pGO -> ObjTyp() = 'L'; } if (( pGO -> ObjTyp() == 'L' ) && ( pGO -> AnzahlLinien() > 1 )) { CxString strUID; for ( short loop = 0; loop < pGO -> AnzahlLinien(); loop++ ) { pTO = new CTriasObjekt( pGO ); pkp = &kp; if ( pTO ) { pTO -> Neu() = TRUE; pTO -> ONr() = -1; // neues Objekt! pTO -> Ident() = pGO->ObjectClassTRiAS()->ClassIdentTRiAS(); max = z = 0L; a = 0; z = pGO -> AnzahlPunkte( loop ); pTO -> AnzahlPunkte() = z; pTO -> XKoord( new double[z+1]); pTO -> YKoord( new double[z+1]); pTO -> KonturPunkte( pkp ); pkp[0] = z; z = 0L; pPF = pGO -> Punkte( loop ); for ( l = 0; l < pPF -> GetSize(); l++ ) { pPT = (CPunkt*)pPF -> GetAt( (int)l ); *((double*)pTO -> XKoord() + z) = pPT -> Rechts(); *((double*)pTO -> YKoord() + z) = pPT -> Hoch(); z++; } pTO -> ObjTyp() = OGLinie; pTO -> AnzahlKonturen() = 1; strUID.Empty(); strUID.printf( "%s_%d", (const char*)pGO -> UniqueIdent(), loop ); pTO -> UniqueIdent() = strUID; pTO -> WriteBack(); pTO -> KonturPunkte( NULL ); // weil: &kp nicht freigeben!!! delete pTO; } } } else { pTO = new CTriasObjekt( pGO ); if ( pGO -> AnzahlLinien() || pGO -> ObjNr()) { if ( pGO -> AnzahlLinien() > 1 ) pkp = new long[pGO -> AnzahlLinien()]; else pkp = &kp; if ( pTO ) { if ( pGO -> ObjNr()) { pTO->Neu() = FALSE; pTO -> ONr() = pGO -> ObjNr(); } else { // neues Objekt! pTO->Neu() = TRUE; pTO -> ONr() = -1; } pTO -> Ident() = pGO->ObjectClassTRiAS()->ClassIdentTRiAS(); max = z = 0L; a = 0; // Gesamtzahl Punkte und Hypothese für Aussenkontur ermitteln for ( j = 0; j < pGO -> AnzahlLinien(); j++ ) { z += pGO -> AnzahlPunkte( j ); if ( pGO -> AnzahlPunkte( j ) > max ) { max = pGO -> AnzahlPunkte( j ); a = j; } } pTO -> AnzahlPunkte() = z; pTO -> XKoord( new double[z+1] ); pTO -> YKoord( new double[z+1] ); pTO -> KonturPunkte( pkp ); z = 0L; if ( pGO -> AnzahlLinien()) { // zuerst die Aussenkontur eintragen! pPF = pGO -> Punkte( a ); for ( l = 0; l < pPF -> GetSize(); l++ ) { pPT = (CPunkt*)pPF -> GetAt( (int)l ); *((double*)pTO -> XKoord() + z) = pPT -> Rechts(); *((double*)pTO -> YKoord() + z) = pPT -> Hoch(); z++; } } pkp[0] = max; if ( pGO -> ObjTyp() == 'F' ) { if ( pGO -> AnzahlLinien()) { if ( pGO -> AnzahlPunkte( 0 ) == 1 ) pTO -> ObjTyp() = OGPunkt; else pTO -> ObjTyp() = OGFlaeche; } } else if ( pGO -> ObjTyp() == 'L' ) pTO -> ObjTyp() = OGLinie; else if ( pGO -> ObjTyp() == 'P' ) pTO -> ObjTyp() = OGPunkt; else if ( pGO -> ObjTyp() == 'T' ) { pTO -> ObjTyp() = OGText; } else if ( pGO -> AnzahlLinien()) { if ( pGO -> AnzahlPunkte( 0 ) == 1 ) pTO -> ObjTyp() = OGPunkt; else if ( pGO -> Punkte(0) -> Geschlossen()) pTO -> ObjTyp() = OGFlaeche; else pTO -> ObjTyp() = OGLinie; } pTO -> AnzahlKonturen() = pGO -> AnzahlLinien(); pTO -> UniqueIdent() = pGO -> UniqueIdent(); for ( j = 0; j < pGO -> AnzahlLinien(); j++ ) { if ( j != a ) { if ( j < a ) pkp[j+1] = pGO -> AnzahlPunkte( j ); else pkp[j] = pGO -> AnzahlPunkte( j ); pPF = pGO -> Punkte( j ); for ( l = 0; l < pPF -> GetSize(); l++ ) { pPT = (CPunkt*)pPF -> GetAt( (int)l ); // *((double*)pTO -> XKoord() + z) = double( pPT -> Rechts() / 100.0 ); // *((double*)pTO -> YKoord() + z) = double( pPT -> Hoch() / 100.0 ); *((double*)pTO -> XKoord() + z) = pPT -> Rechts(); *((double*)pTO -> YKoord() + z) = pPT -> Hoch(); z++; } } } } } /*#fje if (( pTO -> ObjTyp() == OGLinie ) && ( pTO -> AnzahlKonturen() > 1 )) { CString text = "Nicht verbundene Linienabschnitte! UID: "; text += pTO -> UniqueIdent(); AfxMessageBox( text ); } */ pTO -> WriteBack(); pTO -> KonturPunkte( NULL ); // weil: &kp nicht freigeben!!! if ( pGO -> AnzahlLinien() > 1 ) delete pkp; delete pTO; } delete pGO; if (((CEDBSExtension*)g_pTE) -> NutzerAbbruch()) { if ( AfxMessageBox( "Alle bisher gelesenen Informationen gehen beim Abbruch verloren!\nTatsächlich abbrechen?", MB_ICONQUESTION|MB_YESNO ) == IDYES ) { break; } else ((CEDBSExtension*)g_pTE) -> ResetAbbruch(); } } /* for ( pos = m_omGeoObjekte.GetStartPosition(); pos != NULL; ) { m_omGeoObjekte.GetNextAssoc( pos, id, (CObject*&)pGO ); delete pGO; } */ m_omGeoObjekte.RemoveAll(); } // WriteBack
void CEditPage7::InitData() { short i, n; CWnd *pWnd; CEigentuemer *pSatz; CxString text; for ( i = 0; i < 4; i++ ) { m_lNenn[i] = 1000; m_lZaehl[i] = 1000; m_bHer[i] = TRUE; m_strTeil[i] = ""; m_strOrt[i] = ""; m_strPLZ[i] = ""; m_strStr[i] = ""; m_strName[i] = ""; } m_iEigZahl = m_parrEigent -> GetSize(); n = m_iEigZahl - m_iOffset; if ( n > 4 ) n = 4; for ( i = 0; i < n; i++ ) { pSatz = (CEigentuemer*)m_parrEigent -> GetAt( i + m_iOffset ); text.Empty(); text.printf( "Eigentümer %d", int( i + m_iOffset + 1 )); m_strEig[i] = text; m_strName[i] = pSatz -> m_NFP4_ENA; m_strStr[i] = pSatz -> m_NFP4_EAN; m_strPLZ[i] = pSatz -> m_NFP4_EPL; m_strOrt[i] = pSatz -> m_NFP4_EOR; m_lNenn[i] = pSatz -> m_NFP4_PN; m_lZaehl[i] = pSatz -> m_NFP4_PZ; m_bHer[i] = TestYES( pSatz -> m_NFP4_HER ); } pWnd = GetDlgItem( IDC_BUTTON2 ); ASSERT( pWnd ); pWnd -> EnableWindow( m_iEigZahl > 0 ); pWnd = GetDlgItem( IDC_BUTTON3 ); ASSERT( pWnd ); pWnd -> EnableWindow(( m_iEigZahl - m_iOffset ) > 4 ); pWnd = GetDlgItem( IDC_BUTTON4 ); ASSERT( pWnd ); pWnd -> EnableWindow( m_iOffset > 0 ); pWnd = GetDlgItem( IDC_RADIO1 ); ASSERT( pWnd ); if ( m_iEigZahl > 1 ) { ((CButton*)pWnd) -> SetCheck( m_bMiteigentum ? 1 : 0 ); pWnd -> EnableWindow( TRUE ); } else { ((CButton*)pWnd) -> SetCheck( 0 ); pWnd -> EnableWindow( FALSE ); } pWnd = GetDlgItem( IDC_RADIO2 ); ASSERT( pWnd ); if ( m_iEigZahl > 1 ) { ((CButton*)pWnd) -> SetCheck( m_bMiteigentum ? 0 : 1 ); pWnd -> EnableWindow( TRUE ); } else { ((CButton*)pWnd) -> SetCheck( 0 ); pWnd -> EnableWindow( FALSE ); } }