From 939e7a50c810f3f53aaece1e203e7b429b774549 Mon Sep 17 00:00:00 2001 From: Elena Date: Sun, 6 Feb 2022 12:24:53 +0100 Subject: [PATCH] =?UTF-8?q?Correcciones=20y=20=C3=BAltimos=20flecos=20en?= =?UTF-8?q?=20preparar=20exportaci=C3=B3n=20limpieza?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Helper/HelperGdb.cs | 122 +++++++++-- Model/TratamientoComun.cs | 4 + Services/EjecServ.cs | 196 ++++++++++++------ Services/LimpiezaServ.cs | 12 +- Services/RecogidaServ.cs | 8 +- View/Limpieza/PaneLimpiezaSub1.xaml | 2 +- .../Limpieza/PaneLimpiezaSub1ViewModel.cs | 14 +- 7 files changed, 256 insertions(+), 102 deletions(-) diff --git a/Helper/HelperGdb.cs b/Helper/HelperGdb.cs index cc93146..4c5523e 100644 --- a/Helper/HelperGdb.cs +++ b/Helper/HelperGdb.cs @@ -263,18 +263,19 @@ namespace OliviaAddInPro.Helper } //Abre una feature class cuando es un shapefile - public static Task GetFtClassFromShp(string pathShp) + public static async Task GetFtClassFromShp(string pathShp) { FeatureClass ftclss = null; ReiniciaOutStr(); - return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func)(() => + return await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func)(() => { if (pathShp.Contains(SHP_EXT)) { try { string shpname = System.IO.Path.GetFileNameWithoutExtension(pathShp); - var shapeFileConnPath = new FileSystemConnectionPath(new Uri(pathShp), FileSystemDatastoreType.Shapefile); + var shapeFileConnPath = new FileSystemConnectionPath(new Uri(System.IO.Path.GetDirectoryName(pathShp)), + FileSystemDatastoreType.Shapefile); var shapefile = new FileSystemDatastore(shapeFileConnPath); ftclss = shapefile.OpenDataset(shpname); } @@ -311,9 +312,9 @@ namespace OliviaAddInPro.Helper } //Crea un filtro espacial a partir de una consulta y en todo caso, una geometría - public static ArcGIS.Core.Data.QueryFilter CreateFiler(string consulta, ArcGIS.Core.Geometry.Geometry geom, SpatialRelationship rel= SpatialRelationship.Intersects) + public static ArcGIS.Core.Data.SpatialQueryFilter CreateFiler(string consulta, ArcGIS.Core.Geometry.Geometry geom, SpatialRelationship rel= SpatialRelationship.Intersects) { - ArcGIS.Core.Data.QueryFilter filt=null; + ArcGIS.Core.Data.SpatialQueryFilter filt =null; if (geom != null) { SpatialQueryFilter filtSpat = new SpatialQueryFilter @@ -322,12 +323,12 @@ namespace OliviaAddInPro.Helper FilterGeometry = geom, SpatialRelationship = rel, }; - filt = (ArcGIS.Core.Data.QueryFilter)filtSpat; + filt = filtSpat; } else { - filt = new ArcGIS.Core.Data.QueryFilter(); + filt = new ArcGIS.Core.Data.SpatialQueryFilter(); filt.WhereClause = consulta; } return filt; @@ -547,13 +548,13 @@ namespace OliviaAddInPro.Helper * Forma la envolvente convexa, el mínimo polígono, * que contiene los ámbitos para exportar, a partir de ahí la red navegable ampliando a un buffer */ - public static Task GetGeomConvexHull(FeatureClass fclss, ArcGIS.Core.Data.QueryFilter filter, CancelableProgressorSource cps) + public static Task GetGeomConvexHull(FeatureClass fclss, ArcGIS.Core.Data.QueryFilter filter, CancelableProgressorSource cps=null) { ArcGIS.Core.Geometry.Geometry geomIni = null; return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func)(() => { - geomIni = GetGeomUnica(fclss, filter, cps); + geomIni = GetGeomUnique(fclss, filter, cps); if (geomIni != null) { ArcGIS.Core.Geometry.Geometry geomSal = null; @@ -575,7 +576,7 @@ namespace OliviaAddInPro.Helper /* * A partir de una capa recorre todos los elementos que cumplen el filtro y los une en una única geometría */ - public static ArcGIS.Core.Geometry.Geometry GetGeomUnica(FeatureClass fclss, ArcGIS.Core.Data.QueryFilter filtro, CancelableProgressorSource cps) + public static ArcGIS.Core.Geometry.Geometry GetGeomUnique(FeatureClass fclss, ArcGIS.Core.Data.QueryFilter filtro, CancelableProgressorSource cps) { ArcGIS.Core.Geometry.Geometry geomsal = null; ReiniciaOutStr(); @@ -635,7 +636,7 @@ namespace OliviaAddInPro.Helper { where = $"{fieldName} = {Quote(f)}{selFieldVals[i]}{Quote(f)}"; filtro = new ArcGIS.Core.Data.QueryFilter { WhereClause = where }; - geomAux = GetGeomUnica(fclss, filtro, null); + geomAux = GetGeomUnique(fclss, filtro, null); if(geomAux == null) { ok = false; @@ -824,7 +825,7 @@ namespace OliviaAddInPro.Helper //Selection selFeatures = featureClass.Select(filter, SelectionType.ObjectID, SelectionOption.Normal); // make a value array of strings to be passed to ExecuteToolAsync - + /* System.Threading.CancellationTokenSource _cts1 = new System.Threading.CancellationTokenSource(); cps.Status = "Guardando geometria a shp"; @@ -861,18 +862,15 @@ namespace OliviaAddInPro.Helper - - - - - System.Threading.CancellationTokenSource _cts= new System.Threading.CancellationTokenSource(); + + */ cps.Status = "Guardando geometria a shp"; - var progSrc = new CancelableProgressorSource(); + //var progSrc = new CancelableProgressorSource(); string[] args = { pathLayerIn, outpath }; // execute the tool IGPResult gpResult = Geoprocessing.ExecuteToolAsync("FeatureClassToShapefile_conversion", args, - null, _cts.Token, + null, cps.CancellationTokenSource.Token, (event_name, o) => // implement delegate and handle events { @@ -931,6 +929,83 @@ namespace OliviaAddInPro.Helper return true; } + /** + * Comprueba si un punto está contenido en un polígono + */ + public static Respuesta IsPtoInGeom(Coordinate2D pto, ArcGIS.Core.Geometry.Geometry geom) + { + Respuesta resp=new Respuesta(); + try + { + ArcGIS.Core.Geometry.Geometry geom_convexhull = GeometryEngine.Instance.ConvexHull(geom); + ArcGIS.Core.Geometry.Polygon poli = (ArcGIS.Core.Geometry.Polygon)geom_convexhull; + bool contains = GeometryEngine.Instance.Contains(poli, pto.ToMapPoint()); + resp.Value = contains; + return resp; + } + catch + { + resp.Value = false; + resp.Error.Add("Error al comprobar si punto está contenido en polígono"); + return resp; + } + } + + /**Amplía la geometría para que incluya el punto + */ + public static Respuesta AddPtoInGeom(Coordinate2D pto, ArcGIS.Core.Geometry.Geometry geom) + { + Respuesta resp = new Respuesta(); + double buffer = 100;//m de distancia desde la instalación + try + { + ArcGIS.Core.Geometry.Geometry geom_pto = GeometryEngine.Instance.Buffer(pto.ToMapPoint(), buffer); + if(geom_pto==null || geom_pto.IsEmpty) + { + resp.Value = null; + resp.Error.Add("Error al bufferear punto para incluirlo en polígono"); + return resp; + } + ArcGIS.Core.Geometry.Geometry geom_sal = GeometryEngine.Instance.Union(geom_pto, geom); + if (geom_sal == null || geom_sal.IsEmpty) + { + resp.Value = null; + resp.Error.Add("Error al unir punto a polígono"); + return resp; + } + resp.Value = geom_sal; + return resp; + } + catch + { + resp.Value = null; + resp.Error.Add("Error al incluir punto en polígono"); + return resp; + } + } + /* + * Dada una lista de ids de elemento, crea una consulta en la que se llama a todos esos elementos + */ + public static string GetWhereClauseFromIds(List ids) + { + string consulta, orstr; + + consulta = string.Empty; + orstr = string.Empty; + var n = ids.Count; + + for (int i = 0; i < n; i++) + { + consulta = consulta + orstr + "(" + RecogidaDef.campos.cons_id + "=" + ids.ElementAt(i) + ")"; + if (String.IsNullOrEmpty(orstr)) + orstr = " OR "; + } + if (consulta == "()") + consulta = string.Empty; + + return consulta; + } + /** * Elimina las filas indicadas del shp **/ @@ -940,7 +1015,12 @@ namespace OliviaAddInPro.Helper if (fc == null) return false; - string message = String.Empty; + //Crea la consulta + var consulta = GetWhereClauseFromIds(quita); + if (String.IsNullOrEmpty(consulta)) + return false; + + string message = String.Empty; bool deletionResult = false; ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { @@ -952,7 +1032,7 @@ namespace OliviaAddInPro.Helper EditOperation editOperation = new EditOperation(); editOperation.Callback(context => { - ArcGIS.Core.Data.QueryFilter openCutFilter = new ArcGIS.Core.Data.QueryFilter { WhereClause = "ACTION = 'Open Cut'" }; + ArcGIS.Core.Data.QueryFilter openCutFilter = new ArcGIS.Core.Data.QueryFilter { WhereClause = consulta }; using (RowCursor rowCursor = table.Search(openCutFilter, false)) { diff --git a/Model/TratamientoComun.cs b/Model/TratamientoComun.cs index b39f5e9..c3c0b96 100644 --- a/Model/TratamientoComun.cs +++ b/Model/TratamientoComun.cs @@ -26,6 +26,10 @@ namespace OliviaAddInPro.Model * Nombre dle shp exportado de datos */ public string NombreShpExport { get; set; } = string.Empty; + /** + * Nombre dle shp exportado de datos + */ + public string NombreShpExp_PrefTto { get; set; } = string.Empty; /** * Nombre dle shp exportado de nw */ diff --git a/Services/EjecServ.cs b/Services/EjecServ.cs index 982f9f7..4e5bb59 100644 --- a/Services/EjecServ.cs +++ b/Services/EjecServ.cs @@ -24,7 +24,7 @@ namespace OliviaAddInPro.Services //Cadenas de nombres internos para la exportación/importación de los archivos public string prefNameExport = "data_"; public string extShp = ".shp"; - public string name_export_nw = "nw_"; + public string prefNameExportNw = "nw_"; public string ErrStr = ""; SpatialQueryFilter filtroEspacial = null; @@ -35,67 +35,80 @@ namespace OliviaAddInPro.Services * Modo 0, sectorizar * Modo 1, planificar */ - public bool ComienzaEjec(ModosEjec modo, CancelableProgressorSource cps, out string ErrStr) + public bool LanzaEjec(ModosEjec modo, CancelableProgressorSource cps, out string ErrStr) { - bool fue_mal = false; ErrStr = string.Empty; - //Cuenta las filas que cumplen la consulta - int nelems = HelperGdb.GetNumElems(com.CapaElems, com.ConsultaAmbs); - if (nelems <= 0) - { - ErrStr = "No existen ámbitos que cumplan las condiciones introducidas para la exportación " + com.ConsultaAmbs; - fue_mal = true; - } + FeatureClass fc = null; + try + { + //Cuenta las filas que cumplen la consulta + int nelems = HelperGdb.GetNumElems(com.CapaElems, com.ConsultaAmbs); + if (nelems <= 0) + { + ErrStr = "No existen ámbitos que cumplan las condiciones introducidas para la exportación " + com.ConsultaAmbs; + return false; + } - cps.Status = "Exportando geometria"; + cps.Status = "Exportando geometria"; - //Obtiene la geometría que envuelve a los ámbitos - Geometry geom_export = null; - if (!fue_mal) - { + //Obtiene la geometría que envuelve a los ámbitos + Geometry geom_export = null; geom_export = GetGeomAmbitsExport(cps); if (geom_export == null || geom_export.IsEmpty) { ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + ErrStr; - fue_mal = true; + return false; } - } - //crea el filtro de exportación - if (!fue_mal) - { + //crea el filtro de exportación //mira spatialreference de los datos de entrada spatRef = geom_export.SpatialReference; - filtroEspacial = (SpatialQueryFilter) HelperGdb.CreateFiler(com.ConsultaAmbs, geom_export); - fue_mal = filtroEspacial == null; - if (fue_mal) - ErrStr = "Error al crear el filtro de exportacion"; - - if (!fue_mal) - fue_mal = Exporta(modo, cps, out ErrStr); - if (!fue_mal) + filtroEspacial = HelperGdb.CreateFiler(com.ConsultaAmbs, geom_export); + if (filtroEspacial == null) { - //Guarda el nombre - OliviaGlob.Paths.PathData = OliviaGlob.Paths.DirData + com.NombreShpExport; + ErrStr = "Error al crear el filtro de exportacion de los ámbitos"; + return false; + } - } - cps.Value = 80; - if (!fue_mal) - { + //Termina de preparar nombre + //Prepara nombre + string fechaHora = string.Empty; + //se consigue el tiempo en este instante para añadirlo a los nombres de los archivos de salida (shapefiles) + fechaHora = DateTime.Now.ToString("yyyyMMdd_Hmmss"); + //Pone nombre al shape en función de los ámbitos, el tratamiento, y los polígonos + timestamp + com.NombreShpExport = prefNameExport + com.NombreShpExp_PrefTto +"_" + fechaHora + extShp; + + //exporta los datos de entrada + if (!HelperGdb.ExportShp(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, cps, out ErrStr)) + { + ErrStr = ErrStr+"Error al exportar los ámbitos"; + return false; + } + //Guarda el nombre + OliviaGlob.Paths.PathData = OliviaGlob.Paths.DirData + com.NombreShpExport; + if(cps.CancellationTokenSource.IsCancellationRequested) + { + ErrStr = "Se ha cancelado la operación"; + return false; + } + cps.Value = 80; //hace intersecciones espaciales en caso de ámbitos lineales para quitar los que tienen más parte fuera de la zona que dentro - if (geom_export != null && + if (((com.GeomNiv != null) || (com.GeomZon!=null)) && (OliviaGlob.IsReco() || (OliviaGlob.IsLimp() && (com.TipoTto < (int)LimpiezaDef.TiposTto.TtoPapeVaci)))) - { + { if (!HelperGdb.RemoveRowsGeom(OliviaGlob.Paths.PathData, geom_export, 0.4)) { - ErrStr = "Error al quitar los ámbitos que sobresalen: "+HelperGdb.OutStr; + ErrStr = "Error al quitar los ámbitos que sobresalen: " + HelperGdb.OutStr; return false; } } - } - //comprueba que no se haya quedado sin ámbitos - using (FeatureClass fc = HelperGdb.GetFtClassFromShp(OliviaGlob.Paths.PathData).Result) - { - if (fc.GetCount() <= 0) + //comprueba que no se haya quedado sin ámbitos + fc = HelperGdb.GetFtClassFromShp(OliviaGlob.Paths.PathData).Result; + if (fc==null) + { + ErrStr = HelperGdb.OutStr; + return false; + } + if(fc.GetCount() <= 0) { ErrStr = "No quedan ámbitos que cumplan la geometría seleccionada."; return false; @@ -104,30 +117,94 @@ namespace OliviaAddInPro.Services /////////////////////////////////////////////////////////////////////////// //amplia la geom para englobar las instalaciones geom_export = HelperGdb.GetGeomConvexHull(fc, null, cps).Result; - /*if (limp.coords_instala[0] != 0 && limp.coords_instala[1] != 0) + if (!com.CoordsInstal.IsEmpty && (com.CoordsInstal.X!=0)) { //hay instalación - if (!FunGDB.is_pto_in_geom(limp.coords_instala[0], limp.coords_instala[1], geom_ambits)) - geom_ambits = FunGDB.amplia_geom_convexhull(geom_ambits, limp.coords_instala[0], limp.coords_instala[1]); - + Respuesta resp; //comprueba, si hay restricciones de circulación, que la instalación no está en ellas - if (limp.geom_rest_acces != null) + if (com.GeomRestr != null) { - if (FunGDB.is_pto_in_geom(limp.coords_instala[0], limp.coords_instala[1], limp.geom_rest_acces)) + resp = HelperGdb.IsPtoInGeom(com.CoordsInstal, com.GeomRestr); + if (!resp.Value) { - err_st = "Error, la instalación sal/lleg está en la zona restringida a la circulación"; + if (resp.HasError) + ErrStr = "Error al comprobar si la instalación está contenida en el polígono de restricciones: " + resp.Error.ElementAt(0); + else + ErrStr = "Error, la instalación está en la zona restringida a la circulación "; return false; } } - }*/ - } + + //comprueba si la geometría de exportación contiene a la instalación + resp = HelperGdb.IsPtoInGeom(com.CoordsInstal, geom_export); + if (!resp.Value) + { + //ha ido mal + if (resp.HasError) + { + ErrStr = "Error al comprobar si la instalación está contenida en el polígono de exportación: " + resp.Error.ElementAt(0); + return false; + } + else + { + //amplía la geom + Respuesta respGeom = HelperGdb.AddPtoInGeom(com.CoordsInstal, geom_export); + if (respGeom.Value == null) + { + //ha ido mal + if (resp.HasError) + ErrStr = resp.Error.ElementAt(0); + else + ErrStr = "Error al incluir punto de instalación en polígono de exportación."; + return false; + } + //actualiza la geometría + geom_export = respGeom.Value; + } + } + } + if (cps.CancellationTokenSource.IsCancellationRequested) + { + ErrStr = "Se ha cancelado la operación"; + return false; + } /////////////////////////////////////////////////////////////////////////// //exporta la red navegable (buffer, le quita las restr...) + filtroEspacial = HelperGdb.CreateFiler(String.Empty, geom_export); + if (filtroEspacial == null) + { + ErrStr = "Error al crear el filtro de exportacion de la red navegable"; + return false; + } + //Prepara naombre de exportación + com.NombreShpExportNw = prefNameExportNw + fechaHora + extShp; + //exporta los datos de entrada + string capaNw =System.IO.Path.Combine(OliviaGlob.Paths.PathGdbNw, OliviaGlob.Capas.ftclass_ejes); + if (!HelperGdb.ExportShp(capaNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, cps, out ErrStr)) + { + ErrStr = ErrStr + "Error al exportar la red navegable"; + return false; + } //guarda los nombres del shape OliviaGlob.Paths.PathNW = OliviaGlob.Paths.DirData + com.NombreShpExportNw; - - return fue_mal; + + if (cps.CancellationTokenSource.IsCancellationRequested) + { + ErrStr = "Se ha cancelado la operación"; + return false; + } + } + catch (Exception ex) + { + ErrStr = "Errores al comenzar la ejecución: " + ex.Message; + return false; + } + finally + { + HelperGdb.Free(fc); + } + return true; } /** @@ -171,7 +248,7 @@ namespace OliviaAddInPro.Services cps.Value = 30; //prepara el filtro con consulta y espacial - SpatialQueryFilter filtro = (SpatialQueryFilter)HelperGdb.CreateFiler(com.ConsultaAmbs, geomAux); + SpatialQueryFilter filtro = HelperGdb.CreateFiler(com.ConsultaAmbs, geomAux); //Ahora hace la geometría de los ámbitos que cumplen la consulta geomAmbits = HelperGdb.GetGeomConvexHull(fc, filtro, cps).Result; @@ -213,16 +290,7 @@ namespace OliviaAddInPro.Services return str; } - - /** - * Exporta y lanza proceso y ventana de proceso - */ - public bool Exporta(ModosEjec modo, CancelableProgressorSource cps, out string msg) - { - msg = ""; - //exporta los datos de entrada - return HelperGdb.ExportShp(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, cps, out msg); - } + /* * Lee la capa que se ha seleccionzdo de recogida y se comprueba que contiene los campos necesarios * Devuelve 0 si va todo bien, -1 si da error, y num>0 con los campos que no encuentra diff --git a/Services/LimpiezaServ.cs b/Services/LimpiezaServ.cs index 217380e..bf37014 100644 --- a/Services/LimpiezaServ.cs +++ b/Services/LimpiezaServ.cs @@ -47,18 +47,14 @@ namespace OliviaAddInPro.Services res.Errores = true; return res; } - cps.Value = 10; - + cps.Value = 5; + //Prepara nombre - string fechaHora = string.Empty; - //se consigue el tiempo en este instante para añadirlo a los nombres de los archivos de salida (shapefiles) - fechaHora = DateTime.Now.ToString("yyyyMMdd_Hmmss"); - //Pone nombre al shape en función de los ámbitos, el tratamiento, y los polígonos + timestamp - limp.NombreShpExport = prefNameExport + "T" + limp.TipoTto.ToString("00") + nombFileAmbs + DameStrPoligs() + "_" + fechaHora + extShp; + limp.NombreShpExp_PrefTto = "T" + limp.TipoTto.ToString("00") + nombFileAmbs + DameStrPoligs(); string msg = ""; //comienza ejecucion - if(!ComienzaEjec(ModosEjec.Sectoriza, cps, out msg)) + if(!LanzaEjec(ModosEjec.Sectoriza, cps, out msg)) { res.Errores = true; res.msg = msg; diff --git a/Services/RecogidaServ.cs b/Services/RecogidaServ.cs index 9c1289d..11c0888 100644 --- a/Services/RecogidaServ.cs +++ b/Services/RecogidaServ.cs @@ -84,15 +84,13 @@ namespace OliviaAddInPro.Services cps.Value = 10; //Prepara nombre - string fechaHora = string.Empty; - //se consigue el tiempo en este instante para añadirlo a los nombres de los archivos de salida (shapefiles) - fechaHora = DateTime.Now.ToString("yyyyMMdd_Hmmss"); //Pone nombre al shape en función de los ámbitos, el tratamiento, y los polígonos + timestamp - reco.NombreShpExport = prefNameExport + "T" + reco.TipoTto.ToString("00") + nombFileAmbs + DameStrPoligs() + "_" + fechaHora + extShp; + //REVISAR PARA RECO + reco.NombreShpExp_PrefTto = nombFileAmbs + DameStrPoligs(); string msg = ""; //comienza ejecucion - if (!ComienzaEjec(ModosEjec.Sectoriza, cps, out msg)) + if (!LanzaEjec(ModosEjec.Sectoriza, cps, out msg)) { res.Errores = true; res.msg = msg; diff --git a/View/Limpieza/PaneLimpiezaSub1.xaml b/View/Limpieza/PaneLimpiezaSub1.xaml index a33a061..45a601e 100644 --- a/View/Limpieza/PaneLimpiezaSub1.xaml +++ b/View/Limpieza/PaneLimpiezaSub1.xaml @@ -36,7 +36,7 @@ - diff --git a/ViewModel/Limpieza/PaneLimpiezaSub1ViewModel.cs b/ViewModel/Limpieza/PaneLimpiezaSub1ViewModel.cs index c8eb17a..0065dfc 100644 --- a/ViewModel/Limpieza/PaneLimpiezaSub1ViewModel.cs +++ b/ViewModel/Limpieza/PaneLimpiezaSub1ViewModel.cs @@ -364,6 +364,7 @@ namespace OliviaAddInPro private void check_ambitos(int iop, ObservableCollection lista) { bool check = false; + bool enable = false; if (lista == null) return; for (int i = 0; i < lista.Count; i++) @@ -373,6 +374,7 @@ namespace OliviaAddInPro { //para reseteo check=false; + enable = true; } else if (iop == 0) { @@ -399,9 +401,12 @@ namespace OliviaAddInPro } else if (iop == 1) { + //opción genérica, ejes de vía + check = true; + enable = true; //es la opción Genérica que es la opción 2 del TtoCustom, de ahi que el índice sea [iop + 1] - check = LimpiezaDef.ambs_val[(int)LimpiezaDef.TiposTto.TtoCustom].ambs_ops[iop + 1].ambs[(int)((AmbitsList)lista[i]).amb_i] - && amb_tra_gdb[(int)((AmbitsList)lista[i]).amb_i]; + /*LimpiezaDef.ambs_val[(int)LimpiezaDef.TiposTto.TtoCustom].ambs_ops[iop + 1].ambs[(int)((AmbitsList)lista[i]).amb_i] + && amb_tra_gdb[(int)((AmbitsList)lista[i]).amb_i]*/ } else if ((iop - 2) < (LimpiezaDef.ambs_val[TipoTto].n_ops)) { @@ -410,8 +415,11 @@ namespace OliviaAddInPro check = LimpiezaDef.ambs_val[TipoTto].ambs_ops[iop - 2].ambs[(int)((AmbitsList)lista[i]).amb_i] && amb_tra_gdb[(int)((AmbitsList)lista[i]).amb_i]; } + if (iop != 1) + enable = amb_tra_gdb[(int)((AmbitsList)lista[i]).amb_i]; + Ambitos.ElementAt(i).IsChecked = check; - Ambitos.ElementAt(i).IsEnabled = amb_tra_gdb[(int)((AmbitsList)lista[i]).amb_i]; + Ambitos.ElementAt(i).IsEnabled = enable; } } /**