def relation_from(self, src, type): ''' Add relation type from src to self. ''' ret, idp = CPLDirect.cpl_add_relation(src.id, self.id, type) if not CPLDirect.cpl_is_ok(ret): raise CPLException('Could not add relation: ' + CPLDirect.cpl_error_string(ret), ret) r = cpl_relation(idp, self.id, src.id, type, D_DESCENDANTS) return r
def relation_to(self, dest, type): ''' Add relation type from self to dest. ''' ret, idp = CPLDirect.cpl_add_relation(self.id, dest.id, type) if not CPLDirect.cpl_is_ok(ret): raise CPLException('Could not add relation: ' + CPLDirect.cpl_error_string(ret), ret) r = cpl_relation(idp, dest.id, self.id, type, D_ANCESTORS) return r
def relation_from(self, src, type, bundle): ''' Add relation type from src to self. ''' bundle = bundle.id ret, idp = CPLDirect.cpl_add_relation(src.id, self.id, type, bundle) if not CPLDirect.cpl_is_ok(ret): raise CPLException('Could not add relation: ' + CPLDirect.cpl_error_string(ret), ret) r = cpl_relation(idp, self.id, src.id, type, bundle, D_DESCENDANTS) return r
def relation_to(self, dest, type, bundle): ''' Add relation type from self to dest. ''' bundle = bundle.id ret, idp = CPLDirect.cpl_add_relation(self.id, dest.id, type, bundle) if not CPLDirect.cpl_is_ok(ret): raise CPLException('Could not add relation: ' + CPLDirect.cpl_error_string(ret), ret) r = cpl_relation(idp, dest.id, self.id, type, bundle, D_ANCESTORS) return r