Exemplo n.º 1
0
void sosicon::ConverterSosiStat::
printElementData( ISosiElement* e, sosi::SosiElementSearch src, int padding ) {
    while( e->getChild( src ) ) {
        ISosiElement* child = src.element();
        if( !child->getData().empty() ) {
            std::string label = child->getName();
            label.resize( padding, '.' );
            std::cout << " " << label << ": " << child->getData() << "\n";
        }
    }
}
Exemplo n.º 2
0
void sosicon::ConverterSosi2psql::
extractData( ISosiElement* parent,
             FieldsList& hdr,
             std::map<std::string,std::string>*& row ) {

    sosi::SosiElementSearch srcData;
    while( parent->getChild( srcData ) ) {

        ISosiElement* dataElement = srcData.element();

        extractData( dataElement, hdr, row );

        std::string fieldName = utils::toFieldname( dataElement->getName() );
        std::string data = dataElement->getData();
        
        if( data.empty() ) {
            continue;
        }

        if( hdr.find( fieldName ) == hdr.end() ) {
            hdr[ fieldName ] = Field( data );
        }
        else {
          hdr[ fieldName ].expand( data );
        }

        if( row ) {
            ( *row )[ fieldName ] = data;
        }
    }
}
Exemplo n.º 3
0
void sosicon::shape::Shapefile::
extractDbfFields( ISosiElement* sosi, DbfRecord& rec ) {

    std::string field;
    std::string data;
    ISosiElement* child = 0;
    sosi::SosiElementSearch src;

    while( sosi->getChild( src ) ) {
        child = src.element();
        if( child->getType() != sosi::sosi_element_ne ) {
            data = utils::trim( child->getData() );
            saveToDbf( rec, child->getName(), data );
            extractDbfFields( child, rec );
        }
    }
}