From ec850008c0286d64874f9f29e237d70ade6ac602 Mon Sep 17 00:00:00 2001 From: Gerardo Date: Wed, 24 Jan 2024 11:02:41 +0100 Subject: [PATCH] modo eje de calles --- Helper/HelperGdb.cs | 17 ++++++++++++----- Services/EjecServ.cs | 8 ++++++-- Services/LimpiezaServ.cs | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Helper/HelperGdb.cs b/Helper/HelperGdb.cs index f7cd5e3..6894abd 100644 --- a/Helper/HelperGdb.cs +++ b/Helper/HelperGdb.cs @@ -673,7 +673,7 @@ namespace OliviaAddInPro.Helper public static ArcGIS.Core.Data.SpatialQueryFilter CreateFiler(string consulta, ArcGIS.Core.Geometry.Geometry geom, SpatialRelationship rel = SpatialRelationship.Contains) { ArcGIS.Core.Data.SpatialQueryFilter filt = null; - if (geom != null) + if (geom != null && !geom.IsEmpty) { SpatialQueryFilter filtSpat = new SpatialQueryFilter { @@ -1445,7 +1445,7 @@ namespace OliviaAddInPro.Helper if (!System.IO.Directory.Exists(outpath)) System.IO.Directory.CreateDirectory(outpath); FeatureClass fc = null; - bool debug = false; + bool debug = true; ///////////////////////////////////////////////////////// //Prepara una where_clause con las entidades que cumplen el filtro //Abre la featureclass @@ -1467,9 +1467,13 @@ namespace OliviaAddInPro.Helper //Añade a la lista los ids que cumplen el filtro espacial try { - ids = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList(); + var aux = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal); + var aux2 = aux.GetObjectIDs(); + //ids = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList(); + ids = aux2.ToList(); + } - catch(Exception ex) + catch (Exception ex) { OutStr = "Error al seleccionar IDs. "+ex.Message; ids = new List(); @@ -1490,6 +1494,8 @@ namespace OliviaAddInPro.Helper OutStr = "Error al aplicar filtro espacial en exportación: "+ OutStr; return false; } + if (debug) + HelperGlobal.ponMsg("Número de líneas a exportar "+ids.Count); ///////////////////////////////////////////////////////// if (cps.Getcancelled()) { @@ -1499,7 +1505,8 @@ namespace OliviaAddInPro.Helper //convierte la lista de ids a string para la clause de la forma //(id1, id2, id3..) string whereClause = GetWhereClauseFromIds(ids,fc.GetDefinition().GetObjectIDField()); - + if (debug) + HelperGlobal.ponMsg(whereClause); /////////////////////////////////////////////////////////// ///Exporta string[] args = { pathLayerIn, outpath, nameShp, whereClause }; diff --git a/Services/EjecServ.cs b/Services/EjecServ.cs index edee332..ebe4633 100644 --- a/Services/EjecServ.cs +++ b/Services/EjecServ.cs @@ -253,7 +253,7 @@ namespace OliviaAddInPro.Services //a todos los ámbitos y la instalación, ampliada un buffer, mayor si hay //restricciones de circulación geom_export = HelperGdb.BufferGeom(geom_export, com.BuffExport).Value; - if (geom_export == null) + if (geom_export == null || geom_export.IsEmpty) { ErrStr = "Error al añadir buffer a la geometría"; return false; @@ -369,10 +369,13 @@ namespace OliviaAddInPro.Services ErrStr = Resource1.String_cancel_progreso; return false; } + com.ProgrSrc.IncMessage(10, "Termina de exportar red navegable");//60% + com.NombreShpExportNw_C = PREF_NAME_EXPORT_NW_CONJ + fechaHora + EXT_SHP; OliviaGlob.Paths.PathNW_c = OliviaGlob.Paths.DirData + com.NombreShpExportNw_C; if (ComunDef.CamposNW.config.revisa_conjunciones) { + com.ProgrSrc.IncMessage(10, "Revisando conjunciones de la red");//60% if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw_conj, filtroEspacial, com.NombreShpExportNw_C, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatRefData, 100)) { ErrStr = "Error al exportar la red navegable: " + HelperGdb.OutStr; @@ -386,7 +389,8 @@ namespace OliviaAddInPro.Services } //prepara campos estandar - if(!EstandarizaCamposNW(OliviaGlob.Paths.DirData+com.NombreShpExportNw)) + com.ProgrSrc.IncMessage(10, "Estandarizando campos de la red");//60% + if (!EstandarizaCamposNW(OliviaGlob.Paths.DirData+com.NombreShpExportNw)) { ErrStr = "Error al estandarizar campos red navegable: " + HelperGdb.OutStr; return false; diff --git a/Services/LimpiezaServ.cs b/Services/LimpiezaServ.cs index 5255ae6..0395e73 100644 --- a/Services/LimpiezaServ.cs +++ b/Services/LimpiezaServ.cs @@ -74,7 +74,7 @@ namespace OliviaAddInPro.Services { nombFileAmbs = string.Empty; limp.ConsultaAmbs = DameAmbsConsulta(out nombFileAmbs); - if (string.IsNullOrEmpty(limp.ConsultaAmbs)) + if (null==limp.ConsultaAmbs) { return false; }