/// <summary> /// Retorna o OID da classe do tipo Linha informado no parâmetro nomeClasseTipoLinha /// </summary> /// <param name="oidDaClassePontual">OID da feição da classe que contém o ponto de referência</param> /// <param name="nomeClassePontual">Nome da Feature Class de ponto</param> /// <param name="nomeClasseTipoLinha"></param> /// <param name="geodatabase"></param> /// <returns></returns> public static int GetLinhaMaisProximaDoPonto(int oidDaClassePontual, string nomeClassePontual, string nomeClasseTipoLinha, Geodatabase geodatabase) { int r = -1; IFeatureClass classePonto = geodatabase.GetFeatureClass(nomeClassePontual); IFeatureClass classeLinha = geodatabase.GetFeatureClass(nomeClasseTipoLinha); IFeature ftrPonto = classePonto.GetFeature(oidDaClassePontual); if (ftrPonto != null) { IFeature ftrLinha = GetLinhaMaisProxima(ftrPonto.Shape as IPoint, classeLinha); r = ftrLinha.OID; } return r; }
public void CriarRelationShipPorObjecto(String tableNameOrign, int oidOrign, String tableNameDestination, int oidDestination, string relName, Geodatabase geodatabase) { ITable tableOring = GetTable(tableNameOrign); ITable tableDestin = GetTable(tableNameDestination); IRow rowOrign = tableOring.GetRow(oidOrign); IRow rowDestin = tableDestin.GetRow(oidDestination); IRelationshipClass relationship = (Geodatabase.ws as IFeatureWorkspace).OpenRelationshipClass(relName); relationship.CreateRelationship(rowOrign as IObject, rowDestin as IObject); }