From dcc3040ceffed29bfcb8af20289ef46c41d2a7a5 Mon Sep 17 00:00:00 2001 From: Gerardo Date: Tue, 16 Jan 2024 22:39:32 +0100 Subject: [PATCH] cambios revisa congunciones --- Helper/HelperGdb.cs | 24 +++---- Model/Limpieza.cs | 1 + Model/OliviaConf.cs | 9 ++- Model/OliviaConfMV.cs | 21 ++++++ Model/OliviaConfNW.cs | 5 +- Model/OliviaDef.cs | 2 + Model/OliviaGlob.cs | 14 ++-- Model/Recogida.cs | 1 + Model/TratamientoComun.cs | 5 ++ Services/ConfigServ.cs | 44 ++++++++++++- Services/EjecServ.cs | 28 +++++++- Services/FinProcServ.cs | 24 +++++-- Services/LanzaSrv/LanzaLimpSrv.cs | 1 + Services/LanzaSrv/LanzaOlvServ.cs | 1 + Services/LanzaSrv/LanzaRecoSrv.cs | 1 + Services/LimpiezaServ.cs | 10 ++- Services/ProcesoEjecServ.cs | 6 +- .../PropertyGridFilePickerPto.xaml | 14 ++++ .../PropertyGridFilePickerPto.xaml.cs | 65 +++++++++++++++++++ 19 files changed, 243 insertions(+), 33 deletions(-) create mode 100644 Model/OliviaConfMV.cs create mode 100644 View/Configuracion/PropertyGridFilePickerPto.xaml create mode 100644 View/Configuracion/PropertyGridFilePickerPto.xaml.cs diff --git a/Helper/HelperGdb.cs b/Helper/HelperGdb.cs index 4fc85cb..f7cd5e3 100644 --- a/Helper/HelperGdb.cs +++ b/Helper/HelperGdb.cs @@ -467,7 +467,7 @@ namespace OliviaAddInPro.Helper { ftclss = dtset.OpenDataset(ftclassName); } - catch (Exception ex) + catch/* (Exception ex)*/ { ftclss = null; } @@ -478,7 +478,7 @@ namespace OliviaAddInPro.Helper { ftclss = gdb.OpenDataset(ftclassName); } - catch (Exception ex) + catch /*(Exception ex)*/ { ftclss = null; } @@ -526,7 +526,7 @@ namespace OliviaAddInPro.Helper { ftclss = dtset.OpenDataset(ftclassName); } - catch (Exception ex) + catch /*(Exception ex)*/ { ftclss = null; } @@ -537,7 +537,7 @@ namespace OliviaAddInPro.Helper { ftclss = gdb.OpenDataset(ftclassName); } - catch (Exception ex) + catch /*(Exception ex)*/ { ftclss = null; } @@ -1759,7 +1759,7 @@ namespace OliviaAddInPro.Helper { Respuesta resp = new Respuesta(); double buffer = 0;//m de distancia desde la instalación - bool repite = true; + //bool repite = true; ArcGIS.Core.Geometry.Geometry geom_pto, geom_sal; try { @@ -2070,7 +2070,7 @@ namespace OliviaAddInPro.Helper MapView.Active.Map.RemoveLayer(lyr); return true; } - catch (Exception ex) + catch/*(Exception ex)*/ { return false; } @@ -2130,7 +2130,7 @@ namespace OliviaAddInPro.Helper else return string.Empty; } - catch(Exception ex) + catch/*(Exception ex)*/ { return string.Empty; } @@ -2218,7 +2218,7 @@ namespace OliviaAddInPro.Helper return 0; return 2; } - catch (Exception ex) + catch /*(Exception ex)*/ { return 1; } @@ -2248,8 +2248,8 @@ namespace OliviaAddInPro.Helper return res; } //comprueba si extiste ya el dataset - bool repite = false; - bool crea = false; + //bool repite = false; + //bool crea = false; int idat = 1; int r = 2; bool refspatdif = false; @@ -2361,7 +2361,7 @@ namespace OliviaAddInPro.Helper var environments = Geoprocessing.MakeEnvironmentArray(outputCoordinateSystem: spatref); //CancelableProgressorSource cps = new CancelableProgressorSource(); var _cts = new System.Threading.CancellationTokenSource(); - var completa = false; + //var completa = false; var gpres = Geoprocessing.ExecuteToolAsync("FeatureClassToFeatureClass_conversion", args, environments, _cts.Token, (event_name, o) => // implement delegate and handle events { @@ -2676,7 +2676,7 @@ namespace OliviaAddInPro.Helper featureLayer.SetRenderer(uniqueValueRenderer); } - catch (Exception ex) + catch /*(Exception ex)*/ { } diff --git a/Model/Limpieza.cs b/Model/Limpieza.cs index 332f799..8d56763 100644 --- a/Model/Limpieza.cs +++ b/Model/Limpieza.cs @@ -65,6 +65,7 @@ namespace OliviaAddInPro.Model Respuesta res = new Respuesta { Value=false}; Respuesta res2 = new Respuesta (){ Value = TiposEjecucion.FinEjecNOk }; + Serv.TipoMv = TipoMV; res = Serv.Ejecuta(modo); if (res.Value) { diff --git a/Model/OliviaConf.cs b/Model/OliviaConf.cs index 7ab85a1..a88f031 100644 --- a/Model/OliviaConf.cs +++ b/Model/OliviaConf.cs @@ -202,6 +202,8 @@ namespace OliviaAddInPro.Model [Browsable(false)] public List ListaNw { get; set; } [Browsable(false)] + public List ListaMV { get; set; } + [Browsable(false)] public int t_vaciado_max { get; set; } [Browsable(false)] public int t_vaciado_min { get; set; } @@ -244,7 +246,12 @@ namespace OliviaAddInPro.Model [Description("Red de carreteras que se usa para la navegación")] [Editor(typeof(PropertyGridFilePickerLine), typeof(PropertyGridFilePickerLine))] public string Path_Eje_via { get; set; } - + [Category("General")] + [DisplayName("Conjunciones red de carreteras")] + [PropertyOrder(1)] + [Description("Conjunciones red de carreteras que se usa para la navegación")] + [Editor(typeof(PropertyGridFilePickerPto), typeof(PropertyGridFilePickerPto))] + public string Path_Conj_Eje_via { get; set; } [Category("General")] [DisplayName("Tipo Red de carreteras")] [PropertyOrder(1)] diff --git a/Model/OliviaConfMV.cs b/Model/OliviaConfMV.cs new file mode 100644 index 0000000..c059889 --- /dev/null +++ b/Model/OliviaConfMV.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; + +namespace OliviaAddInPro.Model +{ + [Serializable] + public class OliviaConfMV + { + public OliviaConfMV() + { + } + + public string nombre { get; set; } + public string filtro_omitir { get; set; } + public string campo_prioridad { get; set; } + } +} diff --git a/Model/OliviaConfNW.cs b/Model/OliviaConfNW.cs index 4ca9f69..62b3577 100644 --- a/Model/OliviaConfNW.cs +++ b/Model/OliviaConfNW.cs @@ -11,8 +11,8 @@ namespace OliviaAddInPro.Model public class OliviaConfNW { public OliviaConfNW() - { - } + { + } public string nombre { get; set; } public string campo_velocidad { get; set; } @@ -24,5 +24,6 @@ namespace OliviaAddInPro.Model public string campo_elevacion_from { get; set; } public bool comprueba_elevacion { get; set; } public bool revisa_topologia { get; set; } + public bool revisa_conjunciones { get; set; } } } diff --git a/Model/OliviaDef.cs b/Model/OliviaDef.cs index c884aea..443cdba 100644 --- a/Model/OliviaDef.cs +++ b/Model/OliviaDef.cs @@ -142,6 +142,7 @@ namespace OliviaAddInPro.Model public const string GG_pt = "path_temp"; public const string GG_pd = "path_data"; public const string GG_pn = "path_nw"; + public const string GG_pnj = "path_cnw"; public const string GG_pcar = "path_cart"; public const string GG_pcfg = "path_cfgeo"; public const string GG_strtto = "str_tto"; @@ -162,6 +163,7 @@ namespace OliviaAddInPro.Model public const string GG_ais = "aislados"; public const string GG_elev = "elevacion"; public const string GG_topo = "reviTopo"; + public const string GG_conj = "reviConj"; /** * Define las propiedades de limpieza a enviar a oliviatasks */ diff --git a/Model/OliviaGlob.cs b/Model/OliviaGlob.cs index 93d1345..ed818c5 100644 --- a/Model/OliviaGlob.cs +++ b/Model/OliviaGlob.cs @@ -51,10 +51,12 @@ namespace OliviaAddInPro.Model public static string DirData; // res = new Respuesta { Value = false }; Respuesta res2 = new Respuesta() { Value = TiposEjecucion.FinEjecNOk }; + Serv.TipoMv = TipoMV; res = Serv.Ejecuta(modo); if (res.Value) { diff --git a/Model/TratamientoComun.cs b/Model/TratamientoComun.cs index 8f291f8..ce6bc6a 100644 --- a/Model/TratamientoComun.cs +++ b/Model/TratamientoComun.cs @@ -25,6 +25,10 @@ namespace OliviaAddInPro.Model * String para Tipo de tratamiento, se guarda como columna en el shp */ public string TipoTtoStr { get; set; } = String.Empty; + /** + * Tipo modo de viaje + */ + public int TipoMV { get; set; } = 1; /** * Capa de ámbitos */ @@ -45,6 +49,7 @@ namespace OliviaAddInPro.Model * Nombre dle shp exportado de nw */ public string NombreShpExportNw { get; set; } = string.Empty; + public string NombreShpExportNw_C { get; set; } = string.Empty; /** * Velocidad de desplazamiento, en km/h. Si es 0, es determinada por la vía */ diff --git a/Services/ConfigServ.cs b/Services/ConfigServ.cs index a1d8136..b7c1cb5 100644 --- a/Services/ConfigServ.cs +++ b/Services/ConfigServ.cs @@ -19,7 +19,7 @@ namespace OliviaAddInPro.Services public const string OlvRegKey = "SOFTWARE\\Narvaling\\Olivia_3_1"; public const string OlvRegName = "workdir"; public const string OlvConfigName = "olv.conf"; - public const string VersionConfiguracion = "1.1.0.0"; + public const string VersionConfiguracion = "1.1.0.2"; public static ConfigServ Serv { get { @@ -411,7 +411,8 @@ namespace OliviaAddInPro.Services campo_elevacion_from= "$feature.F_ELEV", campo_elevacion_to= "$feature.T_ELEV", comprueba_elevacion =true, - revisa_topologia=false + revisa_topologia=false, + revisa_conjunciones = false }); c.ListaNw.Add(new OliviaConfNW() { @@ -424,7 +425,44 @@ namespace OliviaAddInPro.Services campo_elevacion_from = "IIf( $feature.F_ZLEV != null, $feature.F_ZLEV, 0)", campo_elevacion_to = "IIf( $feature.T_ZLEV != null, $feature.T_ZLEV, 0)", comprueba_elevacion = false, - revisa_topologia = true + revisa_topologia = false, + revisa_conjunciones = true + }); + c.ListaMV = new List(); + c.ListaMV.Add(new OliviaConfMV() + { + nombre = "Default", + filtro_omitir = "", + campo_prioridad = "0" + + }); + c.ListaMV.Add(new OliviaConfMV() + { + nombre = "Peaton", + filtro_omitir = "", + campo_prioridad = "0" + + }); + c.ListaMV.Add(new OliviaConfMV() + { + nombre = "Vehiculo pequeño", + filtro_omitir = "", + campo_prioridad = "0" + + }); + c.ListaMV.Add(new OliviaConfMV() + { + nombre = "Vehiculo mediano", + filtro_omitir = "", + campo_prioridad = "0" + + }); + c.ListaMV.Add(new OliviaConfMV() + { + nombre = "Vehiculo grande", + filtro_omitir = "", + campo_prioridad = "0" + }); return c; } diff --git a/Services/EjecServ.cs b/Services/EjecServ.cs index 9bbc75b..edee332 100644 --- a/Services/EjecServ.cs +++ b/Services/EjecServ.cs @@ -28,6 +28,7 @@ namespace OliviaAddInPro.Services public string PREF_NAME_EXPORT = "data_"; public string EXT_SHP = ".shp"; public string PREF_NAME_EXPORT_NW = "nw_"; + public string PREF_NAME_EXPORT_NW_CONJ = "nw_c_"; public string NAME_CSV = "_L"; public string EXT_CSV = ".csv"; public string NAME_RUTA2 = "_R2"; @@ -42,9 +43,10 @@ namespace OliviaAddInPro.Services public string NAME_INSTAL = "_I"; public string NAME_INSTAL_OUT = "_Instalacion"; + public int TipoMv { get; set; } public string ErrStr = ""; SpatialQueryFilter filtroEspacial = null; - SpatialReference spatRef = null; + //SpatialReference spatRef = null; SpatialReference spatRefData = null; public TratamientoComun com; @@ -59,6 +61,7 @@ namespace OliviaAddInPro.Services ErrStr = string.Empty; OliviaGlob.Paths.PathData = string.Empty; OliviaGlob.Paths.PathNW = string.Empty; + OliviaGlob.Paths.PathNW_c= string.Empty; if (com.ProgrSrc._ProgrSrc.Getcancelled()) { ErrStr = Resource1.String_cancel_progreso; @@ -366,6 +369,22 @@ namespace OliviaAddInPro.Services ErrStr = Resource1.String_cancel_progreso; return false; } + 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) + { + 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; + return false; + } + if (com.ProgrSrc._ProgrSrc.Getcancelled()) + { + ErrStr = Resource1.String_cancel_progreso; + return false; + } + } + //prepara campos estandar if(!EstandarizaCamposNW(OliviaGlob.Paths.DirData+com.NombreShpExportNw)) { @@ -685,7 +704,7 @@ namespace OliviaAddInPro.Services { return false; } - return true; + //return true; } } } @@ -1140,6 +1159,11 @@ namespace OliviaAddInPro.Services string capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW); HelperGdb.CloseLayer(capa_principal_nw); } + if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathNW_c)) + { + string capa_principal_nw_c = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW_c); + HelperGdb.CloseLayer(capa_principal_nw_c); + } } } } diff --git a/Services/FinProcServ.cs b/Services/FinProcServ.cs index 1dffe3b..aac20ca 100644 --- a/Services/FinProcServ.cs +++ b/Services/FinProcServ.cs @@ -162,7 +162,7 @@ namespace OliviaAddInPro.Services public static void BorraFiles() { string[] list = null; - string capa_principal, capa_principal_nw; + string capa_principal, capa_principal_nw, capa_principal_nw_c; if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathData)) capa_principal = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData); else @@ -170,8 +170,11 @@ namespace OliviaAddInPro.Services if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathNW)) capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW); else - capa_principal_nw = null; - + capa_principal_nw = null; + if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathNW_c)) + capa_principal_nw_c = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW_c); + else + capa_principal_nw_c = null; try { if (capa_principal != null && HelperGdb.CloseLayer(capa_principal)) @@ -200,6 +203,19 @@ namespace OliviaAddInPro.Services } } } + if (capa_principal_nw_c != null && HelperGdb.CloseLayer(capa_principal_nw_c)) + { + list = System.IO.Directory.GetFiles(OliviaGlob.Paths.DirData, capa_principal_nw_c + "*"); + if (list.Length > 0) + { + foreach (string f in list) + { + if (System.IO.Path.GetExtension(f) == ".lock") + continue; + System.IO.File.Delete(f); + } + } + } } catch (Exception ex) { @@ -218,7 +234,7 @@ namespace OliviaAddInPro.Services System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData) + inst.ServCom.NAME_CSV + ".*"); string Title = "Directorio para guardar Secuencia de la Planificación"; - string Filter = "Secuencia en formato CSV (*.csv)|*.csv"; + //string Filter = "Secuencia en formato CSV (*.csv)|*.csv"; inst.decode_gdb(System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData), out auxi, out nombre); if (!string.IsNullOrEmpty(pathImport)) diff --git a/Services/LanzaSrv/LanzaLimpSrv.cs b/Services/LanzaSrv/LanzaLimpSrv.cs index 3ef8bff..bd83a15 100644 --- a/Services/LanzaSrv/LanzaLimpSrv.cs +++ b/Services/LanzaSrv/LanzaLimpSrv.cs @@ -82,6 +82,7 @@ namespace OliviaAddInPro.Services.LanzaSrv GeneralDef.EjecGeoParamSep + GeneralDef.GG_ais + GeneralDef.EjecGeoParamIgual + (limp.IgnoAis ? 1 : 0) + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_elev + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.comprueba_elevacion ? 1 : 0) + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_topo + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.revisa_topologia ? 1 : 0) + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_conj + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.revisa_conjunciones ? 1 : 0) + " " + //campos del dbf de limpieza para leer GeneralDef.EjecGeoParamSep + GeneralDef.GAA_obser + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Campos.consulta_observ + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GAA_anch_tip + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Campos.consulta_anch_tip + " " + diff --git a/Services/LanzaSrv/LanzaOlvServ.cs b/Services/LanzaSrv/LanzaOlvServ.cs index 63dc230..72ffb2d 100644 --- a/Services/LanzaSrv/LanzaOlvServ.cs +++ b/Services/LanzaSrv/LanzaOlvServ.cs @@ -76,6 +76,7 @@ namespace OliviaAddInPro.Services.LanzaSrv //paths de archivos GeneralDef.EjecGeoParamSep + GeneralDef.GG_pd + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathData + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_pn + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathNW + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_pnj + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathNW_c + " " + //nombres de cols de sector y secuencia GeneralDef.EjecGeoParamSep + GeneralDef.GTO_camp_sector + GeneralDef.EjecGeoParamIgual + ComunDef.CamposCom.consulta_sector + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GTO_camp_secuencia + GeneralDef.EjecGeoParamIgual + ComunDef.CamposCom.consulta_secuen + " " + diff --git a/Services/LanzaSrv/LanzaRecoSrv.cs b/Services/LanzaSrv/LanzaRecoSrv.cs index 4756d7c..d56052d 100644 --- a/Services/LanzaSrv/LanzaRecoSrv.cs +++ b/Services/LanzaSrv/LanzaRecoSrv.cs @@ -93,6 +93,7 @@ namespace OliviaAddInPro.Services.LanzaSrv GeneralDef.EjecGeoParamSep + GeneralDef.GG_ais + GeneralDef.EjecGeoParamIgual + (reco.IgnoAis?1:0) + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_elev + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.comprueba_elevacion ? 1 : 0) + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_topo + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.revisa_topologia ? 1 : 0) + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_conj + GeneralDef.EjecGeoParamIgual + (ComunDef.CamposNW.config.revisa_conjunciones ? 1 : 0) + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GR_lateral + GeneralDef.EjecGeoParamIgual + reco.TipoLate + " " + //mima de la nw GeneralDef.EjecGeoParamSep + GeneralDef.GTO_mima_xmin + GeneralDef.EjecGeoParamIgual + reco.MimaNw.XMin + " " + diff --git a/Services/LimpiezaServ.cs b/Services/LimpiezaServ.cs index 77a92a4..5255ae6 100644 --- a/Services/LimpiezaServ.cs +++ b/Services/LimpiezaServ.cs @@ -6,6 +6,7 @@ using OliviaAddInPro.Helper; using OliviaAddInPro.Model; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -105,7 +106,14 @@ namespace OliviaAddInPro.Services return consulta; } + public ObservableCollection GetNombreModosViajes() + { + var conf=ConfigServ.Serv.Leer(); + if(conf.ListaMV==null || conf.ListaMV.Count<=0 ) + return new ObservableCollection(); + return (ObservableCollection)conf.ListaMV.Select(c => c.nombre); + } /** * Comprueba lo necesario para ver si hay campos para la planificación */ @@ -152,7 +160,7 @@ namespace OliviaAddInPro.Services public bool CompruebaCamposLimp(string pathCapa) { string[] camps = limp.GetCampos(pathCapa); - int res = 1; + //int res = 1; if ((camps == null) || (HelperGdb.CheckFileds(pathCapa, camps) != 0)) { ErrStr = HelperGdb.OutStr; diff --git a/Services/ProcesoEjecServ.cs b/Services/ProcesoEjecServ.cs index 51def5c..96fe28f 100644 --- a/Services/ProcesoEjecServ.cs +++ b/Services/ProcesoEjecServ.cs @@ -14,11 +14,11 @@ namespace OliviaAddInPro.Services public class ProcesoEjecServ { Cstr_socket soc = null; - int m_out=0; + //int m_out=0; int m_miliseconds=200; int m_tm_progr=1000; int modo_fin = 0; - bool cancela = false; + //bool cancela = false; bool cancela_fin = false; bool conectado = false; bool permu = false; @@ -509,7 +509,7 @@ namespace OliviaAddInPro.Services */ private void pon_barstate(TiposActu actu) { - int col = 1; + //int col = 1; if ((actu == TiposActu.ActuMal) || (actu == TiposActu.ActuFinNOk)) diff --git a/View/Configuracion/PropertyGridFilePickerPto.xaml b/View/Configuracion/PropertyGridFilePickerPto.xaml new file mode 100644 index 0000000..26c146a --- /dev/null +++ b/View/Configuracion/PropertyGridFilePickerPto.xaml @@ -0,0 +1,14 @@ + + +