From 8de6d7682e16b10a1d77b5501ff021f8ff0d170c Mon Sep 17 00:00:00 2001 From: Elena Date: Fri, 24 Jun 2022 00:18:21 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Restaura=20nombre=20de=20los=20campos=20a?= =?UTF-8?q?=20m=C3=A1s=20de=2010=20caracteres=20cuando=20importa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Helper/HelperGdb.cs | 30 +++++++++++- Model/Limpieza.cs | 15 ++++++ Model/Recogida.cs | 16 +++++++ Model/TratamientoComun.cs | 60 ++++++++++++++++++++++++ Services/EjecServ.cs | 83 ++++++-------------------------- Services/FinProcServ.cs | 99 +-------------------------------------- 6 files changed, 136 insertions(+), 167 deletions(-) diff --git a/Helper/HelperGdb.cs b/Helper/HelperGdb.cs index 1f40727..ee3f4bd 100644 --- a/Helper/HelperGdb.cs +++ b/Helper/HelperGdb.cs @@ -562,7 +562,7 @@ namespace OliviaAddInPro.Helper return ftclss; } //devuelve el campo dado el nombre - private static ArcGIS.Core.Data.Field GetFieldByNameSinc(FeatureClass ftClss, string fieldName) + private static ArcGIS.Core.Data.Field GetFieldByNameSync(FeatureClass ftClss, string fieldName) { FeatureClassDefinition ftcldef = ftClss.GetDefinition(); ReiniciaOutStr(); @@ -2387,5 +2387,33 @@ namespace OliviaAddInPro.Helper Free(ftcl); return tipo; } + + public static bool RenameField(string fcname, string oldFieldName, string newFieldName, string newFieldAlias) + { + bool res = false; + string[] args = { fcname, oldFieldName, newFieldName,newFieldAlias }; + // execute the tool + try + { + var gpres = Geoprocessing.ExecuteToolAsync("management.AlterField", args); + if (gpres.Result.IsFailed) + { + var gpResult = gpres.Result; + string msg; + if (gpResult.ErrorMessages != null) + msg = gpResult.ErrorMessages.First().Text; + else + msg = "Errores al renombrar campo "+newFieldName; + } + else + res= true; //ha ido bien + return res; + } + catch + { + } + + return res; + } } } diff --git a/Model/Limpieza.cs b/Model/Limpieza.cs index b941142..f580ad4 100644 --- a/Model/Limpieza.cs +++ b/Model/Limpieza.cs @@ -144,5 +144,20 @@ namespace OliviaAddInPro.Model ambitos = ambitos + shapefile.Substring(aux); } + /** + * Restaura el nombre original del campo si se ha truncado a 10 car al exportar a shp + */ + public override string[] GetCamposRestaura() + { + string[] camps = { + LimpiezaDef.Campos.consulta_entidad, + LimpiezaDef.Campos.consulta_mecan, + LimpiezaDef.Campos.consulta_observ, + LimpiezaDef.Campos.consulta_anch_tip, + LimpiezaDef.Campos.consulta_tipolo, + /*LimpiezaDef.Campos.consulta_sector, + LimpiezaDef.Campos.consulta_secuen */}; + return camps; + } } } diff --git a/Model/Recogida.cs b/Model/Recogida.cs index d9c3d75..08e1d7c 100644 --- a/Model/Recogida.cs +++ b/Model/Recogida.cs @@ -155,5 +155,21 @@ namespace OliviaAddInPro.Model //concatena el timestamp carga = carga + shapefile.Substring(aux); } + + /** + * Restaura el nombre original del campo si se ha truncado a 10 car al exportar a shp + */ + public override string[] GetCamposRestaura() + { + string[] camps = { + RecogidaDef.campos_def.cons_id, + RecogidaDef.campos_def.cons_nomrec, + RecogidaDef.campos_def.cons_lateral , + RecogidaDef.campos_def.cons_fracc, + RecogidaDef.campos_def.cons_capac, + RecogidaDef.campos_def.cons_uds, + RecogidaDef.campos_def.cons_kgrec }; + return camps; + } } } diff --git a/Model/TratamientoComun.cs b/Model/TratamientoComun.cs index c902b02..4f25bff 100644 --- a/Model/TratamientoComun.cs +++ b/Model/TratamientoComun.cs @@ -9,6 +9,9 @@ using OliviaAddInPro.Helper; using OliviaAddInPro.Model.contract; using OliviaAddInPro.Services; using static OliviaAddInPro.Model.ComunDef; +using ArcGIS.Core.CIM; +using ArcGIS.Core.Data; +using System.Collections.ObjectModel; namespace OliviaAddInPro.Model { @@ -191,5 +194,62 @@ namespace OliviaAddInPro.Model tratamiento = string.Empty; ambitos = string.Empty; } + /** + * Restaura el nombre original del campo si se ha truncado a 10 car al exportar a shp + */ + public virtual string[] GetCamposRestaura() + { + return null; + } + + /** + * Restaura el nombre original del campo si se ha truncado a 10 car al exportar a shp + */ + public Respuesta RestauraNomCampos(string nombFtClass) + { + int LENGTHCAMPSHP = 10; + Respuesta resp = new Respuesta { Value = false }; + FeatureClass fc = HelperGdb.GetFtClassSync(nombFtClass); + if (fc == null) + return resp; + //////////////////////////////////////////////////////// + string[] camps = GetCamposRestaura(); + + ObservableCollection fields = HelperGdb.GetFieldsSync(fc); + HelperGdb.Free(fc); + if (fields == null) + return resp; + try + { + int i = 0; + int indx; + string campTrunc = string.Empty; + for (i = 0; i < camps.Length; i++) + { + if (camps[i].Length <= LENGTHCAMPSHP) + continue; + campTrunc = camps[i].Substring(0, LENGTHCAMPSHP); + //si tiene más de 10 caracteres, lo ha truncado al exportar + //busca el nombre actual del campo en la fc + indx = fields.IndexOf(campTrunc); + if (indx < 0) + break; + if (!HelperGdb.RenameField(nombFtClass, campTrunc, camps[i],camps[i])) + break; + } + if (i < camps.Length) + { + resp.Error.Add("Error en el campo " + camps[i]); + } + else + resp.Value = true; + } + catch + { + + } + + return resp; + } } } diff --git a/Services/EjecServ.cs b/Services/EjecServ.cs index 3565cff..40b2c2a 100644 --- a/Services/EjecServ.cs +++ b/Services/EjecServ.cs @@ -491,15 +491,7 @@ namespace OliviaAddInPro.Services string tratamiento = string.Empty; string ambitos = string.Empty; com.decode_gdb(shapefile, out tratamiento, out ambitos); //supsuestamente distingue si es limpieza o recogida - /* - if (prefijo == "T") - { - com.decode_gdb(shapefile, out tratamiento, out ambitos); - } - else if (prefijo == "F") - { - com.decode_gdb(shapefile, out tratamiento, out ambitos); - }*/ + if(string.IsNullOrEmpty(tratamiento) || string.IsNullOrEmpty(ambitos)) { res.Error.Add(string.Format("Nombre del archivo a importar erróneo. No se reconoce el prefijo introducido: {0}", prefijo)); @@ -527,49 +519,7 @@ namespace OliviaAddInPro.Services HelperGlobal.ponMsg(err_spatref +", se ha creado un nuevo dataset "+ datasetNameOut ); tratamiento = datasetNameOut; } - string dataset = tratamiento; - - /* - * //YA NO hace falta preguntar ni comprobar el ftclass porque pone el timestamp y el nombre es único - ///////////////////////////////////////// - //pregunta a ver si se quiere ese nombre u otro - bool replace = false; - string dataset = tratamiento; - bool sal = true; - string ambitos_aux; - //repite por si se ha equivocado hasta que elige el nombre de clase - do - { - sal = true; - ambitos_aux = HelperGdb.SaveFileDlg("Guardar Feature Class como...", GdbFileName + "\\" + tratamiento, null, null, - ArcGIS.Desktop.Core.BrowseProjectFilter.GetFilter("esri_browseDialogFilters_featureClasses_all")); - if (string.IsNullOrEmpty(ambitos_aux)) - sal = HelperGlobal.ponMsg("¿Desea cancelar el proceso de imporación?", - MessageBoxImage.Question, "OLIVIA", MessageBoxButton.YesNo); - } while (!sal); - if (!string.IsNullOrEmpty(ambitos_aux)) - { - //sustituye los ámbitos por los elegidos - ambitos = System.IO.Path.GetFileNameWithoutExtension(ambitos_aux); - replace = System.IO.File.Exists(ambitos_aux); - dataset = System.IO.Path.GetFileNameWithoutExtension(System.IO.Path.GetDirectoryName(ambitos_aux)) ; - } - else { - res.Error.Add("Se ha cancelado la importación de resultados. Se cancela la elección de nombre de la Feature Class."); - return res; - } - //comprueba si la proyección es la misma la del dataset que la que llega - if (!dataset.Equals(tratamiento)) - { - //ha cambiado de dataset al elegir - //comprueba las proyecciones - if (!HelperGdb.GetSpatRef(GdbFileName, dataset).Equals(spatRefData)) - { - //avisa - HelperGlobal.ponMsg(err_spatref); - } - } - */ + string dataset = tratamiento; ///////////////////////////////////////// //todo ok, se pone a importar @@ -636,19 +586,7 @@ namespace OliviaAddInPro.Services ///////////////////////////////////////// //se embucla para hacer todas las importaciones necesarias for (i = 0; i < NIMPORT; i++) - { - //mira a ver si hay que borrar para reemplazar - /*if (replace) - { - resp2 = HelperGdb.DeleteFeatureClass(GdbFileName, noms_gdb[i]); - if (!resp2.Value) - { - err_st = "Error al sobreescribir la capa " + noms_gdb[i]; - if (resp2.HasError) - err_st += " " + resp2.Error.First(); - break; - } - }*/ + { resp2 = HelperGdb.ImportShp(dir_shp + "\\" + noms_shp[i] + HelperGdb.SHP_EXT, GdbFileName + "\\" + dataset, noms_gdb[i]); if (!resp2.Value) { @@ -657,13 +595,23 @@ namespace OliviaAddInPro.Services err_st += " " + resp2.Error.First(); break; } - } if (i < NIMPORT) { res.Error.Add("Errores en la importación: "+err_st); return res; } + //cambia el nombre de los campos que había truncado a 10 caracteres al exportar a shp + //solo para la capa original + resp2 = com.RestauraNomCampos(GdbFileName + "\\" + dataset + "\\" + noms_gdb[0]); + if (!resp2.Value) + { + err_st = "Error al renombrar campos " + noms_gdb[i]; + if (resp2.HasError) + err_st += " " + resp2.Error.First(); + res.Error.Add("Errores en la importación: " + err_st); + return res; + } } catch { @@ -676,8 +624,7 @@ namespace OliviaAddInPro.Services } res.Value = path_import; return res; - } - + } /** * Cierra del mapa las capas de trabajo después de la exportación */ diff --git a/Services/FinProcServ.cs b/Services/FinProcServ.cs index 52154c3..8d66c66 100644 --- a/Services/FinProcServ.cs +++ b/Services/FinProcServ.cs @@ -16,105 +16,8 @@ namespace OliviaAddInPro.Services { Application.Current.Dispatcher.BeginInvoke(new Action, TratamientoComun>((p, v) => finEjecuta2(p, v)),res,inst); - //borra los archivos que le toca borrar - //BorraFiles(); - } - public void finEjecuta2_old(Respuesta res, TratamientoComun inst) - { - String msg = string.Empty; - String msg_err = "Errores en el proceso de importación de resultados"; - bool mal = false; - try - { - - - //gestiona los flags, el estado de finok o finnok va en res.Vale - if (res.HasError) - { - msg = res.Error.First(); - //actualiza los flags - OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecNOk); - } - else - { - //actualiza los flags - OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecOk); - //importa resultados - var resp = IniImport(); - if (resp.HasError) - { - msg = resp.Error.First(); - mal = true; - } - else - { - string GdbFileName = resp.Value; - var resp2 = new Respuesta { Value = string.Empty }; - if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecSecto)) //Ha terminado bien la sectorización - { - //actualiza los flags - OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.EjecSecto); - //acciones de importación - resp2 = inst.ServCom.ImportSecto(GdbFileName); - } - else if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecPlanif)) //Ha terminado bien la planificación - { - //actualiza los flags - OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.EjecPlanif); - //guarda csv - GuardaCsv(inst); - //acciones de importación - resp2 = inst.ServCom.ImportPlanif(GdbFileName); - - } - if (string.IsNullOrEmpty(resp2.Value)) - { - if (resp2.HasError) - { - msg = resp2.Error.First(); - } - else - msg = msg_err; - mal = true; - } - else - { - msg = Resource1.String_exito; - //pone modo config2 - OliviaGlob.AddFlagTipEjec(TiposEjecucion.Config2); - //actualiza la capa de la que tiene que leer ahora para planificar - inst.CapaElems = resp.Value; - } - } - } - } - catch (Exception ex) - { - msg = msg_err + ": " + msg + ": " + ex.Message; - mal = true; - } - if (mal) - { - //reinicia flags - if (OliviaGlob.IsLimp()) - OliviaGlob.SetFlagTipEjec(TiposEjecucion.Limp); - else if (OliviaGlob.IsReco()) - OliviaGlob.SetFlagTipEjec(TiposEjecucion.Reco); - - } - HelperGlobal.ponMsg(msg); - OliviaGlob.progrDialog.Hide(); - //muestra la ventana - OliviaGlob.ShowHidePane(true); - var task = ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => - { - //borra los archivos que le toca borrar - BorraFiles(); - }); - //task.Wait(); - //borra los archivos que le toca borrar - //BorraFiles(); } + public void finEjecuta2(Respuesta res, TratamientoComun inst) { String msg = string.Empty; From 663e6f058f604bc57ee45e24ad42b444a4fbceef Mon Sep 17 00:00:00 2001 From: Elena Date: Tue, 28 Jun 2022 00:53:01 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Avances=20en=20planificaci=C3=B3n=20de=20li?= =?UTF-8?q?mpieza.=20Ya=20se=20hace=20si=20la=20capa=20tiene=20columna=20d?= =?UTF-8?q?e=20sector=20y=20secuencia,=20est=C3=A1=20en=20camnio=20de=20ha?= =?UTF-8?q?cerse=20cuando=20no=20la=20tiene?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Helper/HelperGdb.cs | 74 ++++++++++++++++++++++++- Model/OliviaGlob.cs | 4 +- Model/TratamientoComun.cs | 2 +- Services/EjecServ.cs | 111 ++++++++++++++++++++++++++++++++++---- Services/FinProcServ.cs | 14 +++-- Services/LimpiezaServ.cs | 2 +- 6 files changed, 188 insertions(+), 19 deletions(-) diff --git a/Helper/HelperGdb.cs b/Helper/HelperGdb.cs index ee3f4bd..4368a00 100644 --- a/Helper/HelperGdb.cs +++ b/Helper/HelperGdb.cs @@ -2388,7 +2388,10 @@ namespace OliviaAddInPro.Helper return tipo; } - public static bool RenameField(string fcname, string oldFieldName, string newFieldName, string newFieldAlias) + /* + * Renombra un campo de la feature class dada + */ + public static bool RenameFieldSync(string fcname, string oldFieldName, string newFieldName, string newFieldAlias) { bool res = false; string[] args = { fcname, oldFieldName, newFieldName,newFieldAlias }; @@ -2413,6 +2416,75 @@ namespace OliviaAddInPro.Helper { } + return res; + } + public struct FieldToAdd + { + public string Name; + public string Tipo; //LONG, TEXT, ... + public string Alias; + public int Length; + + public FieldToAdd(string nomb, string tip, string al, int len) + { + Name = nomb; //obligatorio + Tipo = tip; //obligatorio + Alias = al; + Length = len; + } + } + /* + * Renombra un campo de la feature class dada + */ + public static bool AddFieldsSync(string fcname, FieldToAdd[] fields) + { + bool res = false; + + // set up the arguments + string fields_str = ""; + for(int i=0;i + //{ + rc_shp = fc_shp.Search(); + rc_secto = fc_secto.Search(); + + if (rc_shp == null || rc_secto == null) + { + HelperGdb.Free(rc_shp); + HelperGdb.Free(rc_secto); + HelperGdb.Free(fc_secto); + HelperGdb.Free(fc_shp); + return false; + } + + while (rc_shp.MoveNext() && rc_secto.MoveNext()) + { + rowsecto = rc_secto.Current; + rowshp = rc_shp.Current; + // modify and execute + modifyOp.Modify(rowshp, LimpiezaDef.Campos.consulta_sector,rowsecto[LimpiezaDef.Campos.consulta_sector]); + modifyOp.Modify(rowshp, LimpiezaDef.Campos.consulta_secuen, rowsecto[LimpiezaDef.Campos.consulta_secuen]); + } + bien = true; + //}, fc_shp.GetFeatureDataset()); + + modifyOp.Execute(); + if (bien) + return true; + else + return false; + } + catch + { + + } + finally + { + HelperGdb.Free(rowsecto); + HelperGdb.Free(rowshp); + HelperGdb.Free(rc_shp); + HelperGdb.Free(rc_secto); + HelperGdb.Free(fc_secto); + HelperGdb.Free(fc_shp); + + } return false; } @@ -390,7 +473,7 @@ namespace OliviaAddInPro.Services //si ha importado seguro que las tiene if (OliviaGlob.IsConfig2() && !string.IsNullOrEmpty(com.CapaPlanif)) - return true; + return true; return false; } @@ -437,22 +520,28 @@ namespace OliviaAddInPro.Services //abre las capas, pintando los sectores string path_import = res.Value; int NOPEN = 6; + int nopen_ = 4; string[] path_lyr_arr = new string[NOPEN]; + //se añade la capa de ambitos original con la secto, y se pinta por sectores - shape + path_lyr_arr[0] = path_import; //la primera capa que se añade es la de ruta, se le quita la visualización porque lo que interesa //de esa capa es poder acceder si fuera necesario a la tabla de atributos. shape + name_ruta_out - path_lyr_arr[0]= path_import + NAME_RUTA_OUT; - //la siguiente es la de ruta2, se le quita la visualización porque lo que interesa - //de esa capa es poder acceder si fuera necesario a la tabla de atributos. shape + name_ruta2_out - path_lyr_arr[1] = path_import + NAME_RUTA2_OUT; + path_lyr_arr[1]= path_import + NAME_RUTA_OUT; //se añade la capa de ruta_aux y se pinta por sectores - shape + name_ruta_out + name_aux path_lyr_arr[2] = path_import + NAME_RUTA_OUT + NAME_AUX; - //se añade la capa de ambitos original con la secto, y se pinta por sectores - shape - path_lyr_arr[3] = path_import; - //se añade la capa de la ruta a las instalaciones, comprueba si hay configurada coordenadas de la instalación - shape + name_inst_out - path_lyr_arr[4] = path_import + NAME_INSTAL_OUT; //se abre la capa de puntos de control y se pintan por el sector al que pertenecen - shape + name_control_out - path_lyr_arr[5] = path_import + NAME_CONTROL_OUT; - bool[] visible_arr = {false,false,true,true,false,false }; + path_lyr_arr[3] = path_import + NAME_CONTROL_OUT; + + //la siguiente es la de ruta2, se le quita la visualización porque lo que interesa + //de esa capa es poder acceder si fuera necesario a la tabla de atributos. shape + name_ruta2_out + if (System.IO.File.Exists(path_import + NAME_RUTA2_OUT)) + path_lyr_arr[nopen_++] = path_import + NAME_RUTA2_OUT; + //se añade la capa de la ruta a las instalaciones, comprueba si hay configurada coordenadas de la instalación - shape + name_inst_out + if (System.IO.File.Exists(path_import + NAME_INSTAL_OUT)) + path_lyr_arr[nopen_++] = path_import + NAME_INSTAL_OUT; + + NOPEN = nopen_; + bool[] visible_arr = {true,false,true,false,false,false }; int i; var resb = new Respuesta(); for(i =0;i Date: Wed, 29 Jun 2022 00:39:15 +0200 Subject: [PATCH 3/3] =?UTF-8?q?Ciclo=20limpieza=20lo=20hace=20completo,=20?= =?UTF-8?q?sectoriza=20y=20planifica.=20Falta=20probar=20instalaci=C3=B3n.?= =?UTF-8?q?=20Recogida=20a=20medias=20de=20probar.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config.daml | 2 +- Helper/HelperGdb.cs | 43 +++++-- Images/config2_olv - copia.png | Bin 0 -> 1789 bytes Images/config2_olv.png | Bin 0 -> 1906 bytes Model/Limpieza.cs | 9 +- Model/Recogida.cs | 21 +++ OliviaAddInPro.csproj | 5 +- Services/EjecServ.cs | 136 +++++++++++++------- Services/FinProcServ.cs | 35 ++--- Services/RecogidaServ.cs | 25 +--- View/PaneEjecutar.xaml.cs | 2 +- ViewModel/Recogida/PaneRecogidaViewModel.cs | 3 + 12 files changed, 183 insertions(+), 98 deletions(-) create mode 100644 Images/config2_olv - copia.png create mode 100644 Images/config2_olv.png diff --git a/Config.daml b/Config.daml index 1e55652..882f6e4 100644 --- a/Config.daml +++ b/Config.daml @@ -38,7 +38,7 @@ Add-In de ArcGIS Pro para la herramienta de optimización de la limpieza viaria, OLIVIA - diff --git a/Helper/HelperGdb.cs b/Helper/HelperGdb.cs index 4368a00..665824f 100644 --- a/Helper/HelperGdb.cs +++ b/Helper/HelperGdb.cs @@ -739,9 +739,10 @@ namespace OliviaAddInPro.Helper if (!fields.Contains(field)) { HelperGdb.OutStr = "No se encuentra el campo " + field; + Free(fc); return false; } - + Free(fc); return true; } /* @@ -757,13 +758,14 @@ namespace OliviaAddInPro.Helper } ObservableCollection fields = GetFieldsSync(fc); + bool encuentra = true; if (!fields.Contains(field)) { HelperGdb.OutStr = "No se encuentra el campo " + field; - return false; + encuentra= false; } - - return true; + Free(fc); + return encuentra; } /* * Lee la capa que se ha seleccionzdo de recogida y se comprueba que contiene los campos necesarios @@ -1942,12 +1944,27 @@ namespace OliviaAddInPro.Helper if (brwsFilt != null) dlg.BrowseFilter = brwsFilt; - bool? ok = dlg.ShowDialog(); + try + { + bool? ok = dlg.ShowDialog(); - if ((ok ?? true) && dlg.FilePath.Length > 0) - return dlg.FilePath; - else + if ((ok ?? true) && dlg.FilePath.Length > 0) + return dlg.FilePath; + else + return string.Empty; + } + catch(Exception ex) + { return string.Empty; + } + } + + /** + * Saca diálogo para elegir directorio + */ + public static string FolderBrowseDlg(string title_, string initloc_) + { + return null; } /** @@ -2438,12 +2455,17 @@ namespace OliviaAddInPro.Helper */ public static bool AddFieldsSync(string fcname, FieldToAdd[] fields) { - bool res = false; + bool res = false; // set up the arguments string fields_str = ""; + int camps = 0; for(int i=0;iE7Jq#@b3StLLe#frtY zsG#*2 zH$g>8*MI^PLqKnu7ga%LFhDk&#$b7~*^K2Nlg?m5bmC@H87$bF4Ksbfsf$c_!;~A~ zP@#Cr7jfc|RXDDPAt*61k(TI1L$NrB!QpUB8cZgYKu`@yI$Um~>I{@=1tDTkU}`6;X^`WacBVX90-!62ht4>4$TQ%ci7sr3J$TI~$lfQKS)bF@4!$F`q8rdolPTk%+^Z<_b|o zf)>%?(_H0SuFtGo(=cfDgl8dwsW%}?F@|cv$)sWR?6I(B)tllfXOG2uRxU&Y1DRU; zuU1c+i1{&XX9kxz%#1#wBjz0=20OF%;RnR`f=YyZnX#ieoUd8HC*{OAu3JT2`(=H{ z4cnhHSjA3|e=na)lJMUR*#LF7J#%V)okmI_Nw^t#@$aPdxS7pA;gRvfx(6pD-<9kL zI?t=v)iBmQR=K*;E4yo`!6y6K@WbmP*HZ4LJZ1Ga4R;=u)VoZyTIgzNg6f5C8<&`no4s@tvDIEb=ayA3h2ER38|)Ndu_bw~v(T zFNoxZ_`?%y*HJcP7U22Z{6KsjzbD~!Oia1h|IC)g?Q!3hj?kkeK2>zf0x&MHZL8y0Vn{Y5L&f?EIxp+^xs1b=EQ2XJ5q9 zJP+-z8Gf|Pa-CrA!K|0!e)k()wn1bjP#a|KX`XS!m6voiYv(*m`(uId8CF%)du65m zoxcz7H=_r4_u4J~s}Qr%ZFy0&Z?v{Txd}chC|-5x%6&`t^v&T;D8$opfOc-cE~UXe zBv)i@WAn5yKrF0gNRHU)N;pTcjvmaL8s__ulv`-!`f*9e=@uo{c>Pu6@?Q#mQ$bX@ zw5$T`%ia|Iryzgl*zJKGns|j~_vWHkt47eF%3JYlYQ#4+_F3;&q+4W=_O5qywB1ve zbgx=;&W#LHEf)A`pzxNG{$E>M9J9m1@7^d@rlzL09^;TmODrQC0$P#uEfdNW8c&M#iwdo+t#9|Wxm7+Hbh~qB-2!CwqOU)TC@CDb+#S|Agw@p4 zT>boF(pB+CrR8<^nhM%Z`z}jXnghd2LSyFW&_`t*z0AeV7b8!`jFap(kqo+Ix~_i}}FgCAYMPiXH^_9nXr++C$$aY<4n}!AG-Bb=O}{cwKRSkt~rC zwlVug^0F=qW7nz^_j%SiK|#Ep@ajf~`Mx^}N>!1Leq|o6ek;!JcYbH*!u|{9(d`G# z?T+N`Umds9@vxuXs<0l+NSyPieQa!`RBTm0_rth!$xx1-Qtek#_Ef?4?TC!umkW)X zCHlD*RHWF&fXgc{j9Oqd+Aj`7)IA>Tcj_E;ap3PQf5O@ZXw08?lvH_ky>z}Cb;>

S(_`g8%^e{{R4h=l}px2mk>USO5SzmjD14Z`WEM zkN^M%_(?=TRCwCNR%=XK=NW#^&9~UZ#>Rj#m_tlR1SF>6E4*Qu%!{*($WKP0ce!juTBnGx(p+mnw|C1 zi(M-K2LR`uS8dM0?zRS*{lcXG`_c%sj|9*qli!^H3;~3q3 zNzcU9AbB`0(57Z*holpZXliy2r(oUVZgcD?e-7Hfg+?YZDQYAhj#q=R@UNLmT&i{Hf5>;iiG zzDoCTpN|_E8R3#bysRKCD?}tgV3kURXf%p&B#KBh27&WqSgrZ_NJ+`>H?J+OwzDjb zd^X;n943K}z}NdRvJGmySm6MG{yeLdb+@}%02PwwSa-XNO)N-p4`i9Lu(hfR{=hs= zd3!)J3?PbF9gE@S#toOE`kRr^Y zFv1hm(U-Su^^W*Pf3WvAzXqSV9%@5M)q9t+NU{u&_4fUt!TY1b+X;}XBH;*PTmZ9L%`dp}H3nJ;V0W87C4qS{_6J6;@t_{qcl`Sv`k%~nusGv=uhdPaYmfyFV{-PW;;07;U8siCo}1HLbF2%VCqX;lHk zFwkf;D7LSIbN61nX?h9k=2c)6DgbCa`r*4C6{FlpZpb~aWpiwyS^q>*%An(R7I+h0Dw}*8i=9@ilXq# z{RbV=_*6K2|1Qp7`8Z%H(v6EzoC^n|b6G}1pGu)V&5J@n res1 = new Respuesta { Value = TiposEjecucion.FinEjecOk }; - HelperGdb.OpenLayer(@"C:\Users\Elena\Documents\ArcGIS\Projects\MyProject3\MyProject3.gdb\Barrido_man\BarMan_AceM_AceNM_20220529_134336", "SECTOR", true); - return res1;*/ + //Respuesta res1 = new Respuesta { Value = TiposEjecucion.FinEjecOk }; + //HelperGdb.OpenLayer(@"C:\Users\Elena\Documents\ArcGIS\Projects\MyProject3\MyProject3.gdb\Barrido_man\BarMan_AceM_AceNM_20220529_134336", "SECTOR", true); + //Serv.ActualizaSecto(@"D:\Proyectos\Olivia\Instal2.0\data\data_T00_A0405_20220628_214902.shp", @"C:\\Users\\Elena\\Documents\\ArcGIS\\Projects\\MyProject3\\MyProject3.gdb\\Barrido_man\\BarMan_AceM_AceNM_20220628_214613"); + //return res1; + + ////////////////// ///////////////////////////// Respuesta res = new Respuesta { Value=false}; diff --git a/Model/Recogida.cs b/Model/Recogida.cs index 08e1d7c..bfee6f4 100644 --- a/Model/Recogida.cs +++ b/Model/Recogida.cs @@ -171,5 +171,26 @@ namespace OliviaAddInPro.Model RecogidaDef.campos_def.cons_kgrec }; return camps; } + + /** + * Rellena el array de filtros en base a la config + */ + public void RellenaFiltrosReco() + { + //se rellena el array de filtros + RecogidaDef.filtro_str = new string[RecogidaDef.tipos_fracc_str.Length + RecogidaDef.tipos_carg_str.Length]; + for (int i = 0; i < RecogidaDef.tipos_fracc_str.Length; i++) + { + //se comprueba que tipo de fracción se ha seleccionado. Si se ha seleccionado una fracción sin nombre (el campo en la capa es NULL, y en el comboBox de fracciiones aparece como "-") hay que modificar el filtro + if (RecogidaDef.tipos_fracc_str[i] == "-") + RecogidaDef.filtro_str[i] = RecogidaDef.campos_def.cons_fracc + " IS NULL"; + else + RecogidaDef.filtro_str[i] = RecogidaDef.campos_def.cons_fracc + "= '" + RecogidaDef.tipos_fracc_str[i] + "'"; + } + for (int i = RecogidaDef.tipos_fracc_str.Length; i < RecogidaDef.filtro_str.Length; i++) + { + RecogidaDef.filtro_str[i] = RecogidaDef.campos_def.cons_nomrec + "= '" + RecogidaDef.tipos_carg_str[i - RecogidaDef.tipos_fracc_str.Length] + "'"; + } + } } } diff --git a/OliviaAddInPro.csproj b/OliviaAddInPro.csproj index afe5a47..e8f1d77 100644 --- a/OliviaAddInPro.csproj +++ b/OliviaAddInPro.csproj @@ -25,7 +25,7 @@ bin\Debug\ DEBUG;TRACE prompt - 4 + 0 Program $(ArcGISFolder)\bin\ArcGISPro.exe x64 @@ -357,6 +357,9 @@ + + +