コード例 #1
0
ファイル: POI.py プロジェクト: codingforfun/pymagellan
    def addToTable(self, id, db, cattable):
        row = Row(cattable)
        row.setColumnUInt(cattable.getColumnIndex('ID'), id)
        row.setColumnString(cattable.getColumnIndex('NAME'), self.name)
        row.setColumnUInt(cattable.getColumnIndex('POICOUNT'),self.poicount)
        row.setColumnUInt(cattable.getColumnIndex('COMM_SLOT'), 0)
        row.setColumnUIntVector(cattable.getColumnIndex('FIRSTCHSLOT'), self.first_char_slots)
        if 'SLOTFIRST' in cattable.getColumnNames():
            row.setColumnUInt(cattable.getColumnIndex('SLOTFIRST'), self.firstslot)
            row.setColumnUInt(cattable.getColumnIndex('SLOTLAST'), self.lastslot)

        catcursor = cattable.writeRow(row)

        # Add subcategories
        all_subcatg = db.getSetByName('ALL_SUBCATG_')
        subcatmember = all_subcatg.getMemberByIndex(0)
        subcattable = subcatmember.table
        for subcatindex,subcat in enumerate(self.subcategories):
            subcatid = subcatindex+1
            subcatcursor = subcat.addToTable(subcatid, db, subcattable)
            catcursor.addSetItem(subcatmember, subcatcursor)

        # Add fields
        fieldinfo_set = db.getSetByName(self.fieldinfo_setname)
        fieldinfomember = fieldinfo_set.getMemberByIndex(0)
        fieldtable = fieldinfomember.table
        for name,type in zip(self.fieldnames, self.fieldtypes):
            fieldrow = Row(fieldtable)
            fieldrow.setColumnString(fieldtable.getColumnIndex('NAME'), name)
            fieldrow.setColumnUInt(fieldtable.getColumnIndex('AUX_TYPE'), type)
            fieldcursor = fieldtable.writeRow(fieldrow)
            catcursor.addSetItem(fieldinfomember, fieldcursor)
                    
        return catcursor
コード例 #2
0
ファイル: POI.py プロジェクト: codingforfun/pymagellan
    def addToTable(self, id, db, cattable):
        row = Row(cattable)
        row.setColumnUInt(cattable.getColumnIndex('ID'), id)
        row.setColumnString(cattable.getColumnIndex('NAME'), self.name)
        row.setColumnUInt(cattable.getColumnIndex('POICOUNT'), self.poicount)
        row.setColumnUInt(cattable.getColumnIndex('COMM_SLOT'), 0)
        row.setColumnUIntVector(cattable.getColumnIndex('FIRSTCHSLOT'),
                                self.first_char_slots)
        if 'SLOTFIRST' in cattable.getColumnNames():
            row.setColumnUInt(cattable.getColumnIndex('SLOTFIRST'),
                              self.firstslot)
            row.setColumnUInt(cattable.getColumnIndex('SLOTLAST'),
                              self.lastslot)

        catcursor = cattable.writeRow(row)

        # Add subcategories
        all_subcatg = db.getSetByName('ALL_SUBCATG_')
        subcatmember = all_subcatg.getMemberByIndex(0)
        subcattable = subcatmember.table
        for subcatindex, subcat in enumerate(self.subcategories):
            subcatid = subcatindex + 1
            subcatcursor = subcat.addToTable(subcatid, db, subcattable)
            catcursor.addSetItem(subcatmember, subcatcursor)

        # Add fields
        fieldinfo_set = db.getSetByName(self.fieldinfo_setname)
        fieldinfomember = fieldinfo_set.getMemberByIndex(0)
        fieldtable = fieldinfomember.table
        for name, type in zip(self.fieldnames, self.fieldtypes):
            fieldrow = Row(fieldtable)
            fieldrow.setColumnString(fieldtable.getColumnIndex('NAME'), name)
            fieldrow.setColumnUInt(fieldtable.getColumnIndex('AUX_TYPE'), type)
            fieldcursor = fieldtable.writeRow(fieldrow)
            catcursor.addSetItem(fieldinfomember, fieldcursor)

        return catcursor