ingo@2853: import ogr
ingo@2853: 
ingo@2853: from importer import Importer
ingo@2853: 
ingo@2853: TABLE_NAME="buildings"
ingo@2853: PATH="Geodaesie/Bauwerke"
ingo@3654: NAME="Buildings"
ingo@2853: 
ingo@2853: 
ingo@2853: class Building(Importer):
ingo@2853: 
ingo@2853:     def getPath(self, base):
ingo@2853:         return "%s/%s" % (base, PATH)
ingo@2853: 
ingo@2853: 
ingo@2853:     def getTablename(self):
ingo@2853:         return TABLE_NAME
ingo@2853: 
ingo@2853: 
ingo@3654:     def getName(self):
ingo@3654:         return NAME
ingo@3654: 
ingo@3654: 
ingo@2853:     def isGeometryValid(self, geomType):
ingo@2853:         return geomType == 2
ingo@2853: 
ingo@2853: 
ingo@2853:     def isShapeRelevant(self, name, path):
ingo@2853:         return True
ingo@2853: 
ingo@2853: 
ingo@2853:     def createNewFeature(self, featureDef, feat, **args):
ingo@2853:         newFeat = ogr.Feature(featureDef)
ingo@2853:         newFeat.SetGeometry(feat.GetGeometryRef())
ingo@2853: 
ingo@2853:         if self.IsFieldSet(feat, "river_id"):
ingo@2853:             newFeat.SetField("river_id", feat.GetField("river_id"))
ingo@2853:         else:
ingo@2853:             newFeat.SetField("river_id", self.river_id)
ingo@2853: 
ingo@2853:         if self.IsFieldSet(feat, "Name"):
ingo@2861:             newFeat.SetField("name", feat.GetField("Name"))
ingo@2861:         elif self.IsFieldSet(feat, "KWNAAM"):
ingo@2861:             newFeat.SetField("name", feat.GetField("KWNAAM"))
ingo@2853: 
ingo@2853:         return newFeat
ingo@2853: