diff --git a/Button/ButtonConfig.cs b/Button/ButtonConfig.cs index 5cf9a36..113febf 100644 --- a/Button/ButtonConfig.cs +++ b/Button/ButtonConfig.cs @@ -27,7 +27,7 @@ namespace OliviaAddInPro { if (OliviaGlob.TipoEjec == TiposEjecucion.Ninguno) { - OliviaGlob.TipoEjec = TiposEjecucion.Props; + OliviaGlob.SetFlagTipEjec(TiposEjecucion.Props); DockpaneConfigViewModel.Reset(); DockpaneConfigViewModel.Show(); } diff --git a/Button/ButtonLimp.cs b/Button/ButtonLimp.cs index 49258f1..51565d6 100644 --- a/Button/ButtonLimp.cs +++ b/Button/ButtonLimp.cs @@ -29,7 +29,7 @@ namespace OliviaAddInPro "Procesando", "Canceled", 100, false); if (OliviaGlob.TipoEjec == TiposEjecucion.Ninguno) { - OliviaGlob.TipoEjec = TiposEjecucion.Limp; + OliviaGlob.SetFlagTipEjec(TiposEjecucion.Limp); OliviaGlob.Limp = new Limpieza(); DockpaneLimpiezaViewModel.Reset(); DockpaneLimpiezaViewModel.Show(); diff --git a/Button/ButtonRec.cs b/Button/ButtonRec.cs index f6a51e6..5131d2a 100644 --- a/Button/ButtonRec.cs +++ b/Button/ButtonRec.cs @@ -25,10 +25,13 @@ namespace OliviaAddInPro { protected override void OnClick() { - if(OliviaGlob.TipoEjec==TiposEjecucion.Ninguno) + OliviaGlob.progrDialog = new ProgressDialog( + "Procesando", "Canceled", 100, false); + if (OliviaGlob.TipoEjec==TiposEjecucion.Ninguno) { - OliviaGlob.TipoEjec = TiposEjecucion.Reco; - //OliviaGlob.Reco=new + OliviaGlob.SetFlagTipEjec(TiposEjecucion.Reco); + OliviaGlob.Reco = new Recogida(); + DockpaneRecogidaViewModel.Reset(); DockpaneRecogidaViewModel.Show(); } else diff --git a/Config.daml b/Config.daml index e6f696b..1e55652 100644 --- a/Config.daml +++ b/Config.daml @@ -16,27 +16,29 @@ + - + - - diff --git a/Helper/HelperGdb.cs b/Helper/HelperGdb.cs index c22eeed..bb16e53 100644 --- a/Helper/HelperGdb.cs +++ b/Helper/HelperGdb.cs @@ -20,6 +20,7 @@ using ArcGIS.Desktop.Editing; using OliviaAddInPro.Model; using System.IO; using System.Diagnostics; +using OliviaAddInPro.View; namespace OliviaAddInPro.Helper { @@ -66,6 +67,47 @@ namespace OliviaAddInPro.Helper out_str = string.Empty; } + //Proceso para sacar un diálogo y seleccionar una o varias geometrías de dentro de una fclass + public static ArcGIS.Core.Geometry.Geometry OpenGeom(TiposOpenFileDlg tipo, out string txt_sal, string initialLoc = "") + { + //inicialmente + ArcGIS.Core.Geometry.Geometry geom = null; + txt_sal = Resource1.String_selec_capa; + + //abre + FeatureClass fc = HelperGdb.OpenFtClassDialog(tipo); + if (fc != null) + { + //hace geom + geom = SelecLeeGeom(fc, out txt_sal, true); + if (geom == null && (HelperGdb.OutStr.Length > 0)) + HelperGlobal.ponMsg(HelperGdb.OutStr, System.Windows.MessageBoxImage.Error); + + HelperGdb.Free(fc); + } + return geom; + } + /* + * Saca ventana para seleccionar el campo del que leer para elegir la geometría + */ + private static ArcGIS.Core.Geometry.Geometry SelecLeeGeom(FeatureClass fc, out string text_sal, bool multisel) + { + ArcGIS.Core.Geometry.Geometry geomsal = null; + text_sal = ""; + if (fc != null) + { + //saca la ventana de selección de campo + ShowProWndSelectFields selfwnd = new ShowProWndSelectFields(fc, multisel); + if (selfwnd.SelFieldVals.Count > 0) + { + geomsal = HelperGdb.GetGeomSel(fc, selfwnd.SelField, selfwnd.SelFieldVals).Result; + text_sal = HelperGdb.TextoSal; + } + } + + return geomsal; + } + //Dado el tipo de FtClass y una posición inicial abre un diálogo de búsqueda de ftclass //si se cancela o no es una feature class lo que se ha abierto devuelve null //si no, devuelve la featureclass directamente abierta @@ -828,5 +870,76 @@ namespace OliviaAddInPro.Helper return true; } + /** + * Recorre los ámbitos lineales del shp viendo qué longitud tienen dentro de la geometría, y si + * es menos de un porcentaje, lo quitan del shp + **/ + public static bool RemoveRowsGeom(string shp_path, ArcGIS.Core.Geometry.Geometry geom_zon, double porc) + { + + /*int[] ids = null; + IFeature f = null; + IFeatureClass fc = null; + IGeometry geom_aux = null; + ITopologicalOperator union = null; + IPolyline poli = null; + double longi_zon = 0, longi_tot = 0; + List quita = new List(); + int j; + + try + { + ids = FunGDB.dame_ids_consulta(shp_path, ""); //consulta todos + if (ids == null) + return false; + fc = FunGDB.abre_ftclass(shp_path); + if (fc == null) + return false; + for (j = 0; j < ids.Length; j++) + { + f = fc.GetFeature(ids[j]); + geom_aux = f.Shape; + poli = (IPolyline)geom_aux; + longi_tot = poli.Length; + union = (ITopologicalOperator)geom_zon; + if (geom_aux == null) + return false; + geom_aux = union.Intersect(geom_aux, esriGeometryDimension.esriGeometry1Dimension);//se realiza la interseccion entre ámbito (linea) y nivel (poligono) + poli = (IPolyline)geom_aux; + longi_zon = poli.Length;//se consigue la longitud de ámbito (linea) que interseca con el nivel) + + if ((longi_zon / longi_tot) < porc) + { + //quita esa línea + quita.Add(ids[j]); + } + FunGDB.libera(f); + } + + + FunGDB.libera(fc); + FunGDB.libera(f); + + if (quita.Count > 0) + { + //borra las líneas que se han indicado + if (!FunGDB.quita_filas(shp_path, quita)) + return false; + } + + return true; + } + catch (Exception) + { + return false; + } + finally + { + FunGDB.libera(fc); + FunGDB.libera(f); + }*/ + return true; + } + } } diff --git a/Images/Tiporeco.png b/Images/Tiporeco.png deleted file mode 100644 index fceb0ec..0000000 Binary files a/Images/Tiporeco.png and /dev/null differ diff --git a/Images/carrito.png b/Images/carrito.png deleted file mode 100644 index 73ac8da..0000000 Binary files a/Images/carrito.png and /dev/null differ diff --git a/Images/carrito2.png b/Images/carrito2.png new file mode 100644 index 0000000..603ea65 Binary files /dev/null and b/Images/carrito2.png differ diff --git a/Images/config2.png b/Images/config2.png index cec6441..de7e0b2 100644 Binary files a/Images/config2.png and b/Images/config2.png differ diff --git a/Images/config2_.png b/Images/config2_.png new file mode 100644 index 0000000..cec6441 Binary files /dev/null and b/Images/config2_.png differ diff --git a/Images/contenedor.png b/Images/contenedor.png deleted file mode 100644 index 765af6d..0000000 Binary files a/Images/contenedor.png and /dev/null differ diff --git a/Images/maqueta.png b/Images/maqueta.png deleted file mode 100644 index 8c699a3..0000000 Binary files a/Images/maqueta.png and /dev/null differ diff --git a/Images/reco2.png b/Images/reco2.png new file mode 100644 index 0000000..653b605 Binary files /dev/null and b/Images/reco2.png differ diff --git a/Images/resReco/Tiporeco.png b/Images/resReco/Tiporeco.png deleted file mode 100644 index 110d08b..0000000 Binary files a/Images/resReco/Tiporeco.png and /dev/null differ diff --git a/Images/resReco/control.png b/Images/resReco/control.png deleted file mode 100644 index 912f215..0000000 Binary files a/Images/resReco/control.png and /dev/null differ diff --git a/Images/resReco/tiempos.png b/Images/resReco/tiempos.png deleted file mode 100644 index f7157dc..0000000 Binary files a/Images/resReco/tiempos.png and /dev/null differ diff --git a/Images/resReco/zonificación.gif b/Images/resReco/zonificación.gif deleted file mode 100644 index d3f2037..0000000 Binary files a/Images/resReco/zonificación.gif and /dev/null differ diff --git a/Model/ComunDef.cs b/Model/ComunDef.cs index 2ca1200..e4d7475 100644 --- a/Model/ComunDef.cs +++ b/Model/ComunDef.cs @@ -29,5 +29,12 @@ namespace OliviaAddInPro.Model public static string atr_N; // 0) - msg = Serv.ErrStr; - else - msg = "Han ocurrido errores al comenzar la ejeción."; - HelperGlobal.ponMsg(msg); - }*/ } public async void EjecutaAsync(ModosEjec modo, CancelableProgressorSource cps, Action ffin) { @@ -76,7 +67,7 @@ namespace OliviaAddInPro.Model var res = Ejecuta(modo, cps); ffin(res); return res; - + }); } diff --git a/Model/LimpiezaDef.cs b/Model/LimpiezaDef.cs index 8aa7f32..d647f94 100644 --- a/Model/LimpiezaDef.cs +++ b/Model/LimpiezaDef.cs @@ -788,12 +788,6 @@ namespace OliviaAddInPro.Model LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbPipi] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_pipi + "'"; LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbSane] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_sane + "'"; } - public class TareaRes - { - public bool Errores { get; set; } - public object data { get; set; } - public string msg { get; set; } - } } } diff --git a/Model/OliviaGlob.cs b/Model/OliviaGlob.cs index 454b715..f7a0f74 100644 --- a/Model/OliviaGlob.cs +++ b/Model/OliviaGlob.cs @@ -13,21 +13,22 @@ namespace OliviaAddInPro.Model { [Flags] /** - * 2 primeros bit indican si es nada (0), limp (1), reco(2), u otros (3) - * 3er bit indica si es config - * 4º bit indica ejec + * */ public enum TiposEjecucion { Ninguno = 0, Limp=1, Reco=2, - Config = 4, //está configurando por primera vez - Ejec=8,//está ejecutando por primera vez - Config2=16,//está configurando después de haber planificado ya al menos una primera vez - Ejec2=32,//está ejecutando después de haber planificado ya al menos una primera vez - Props = 64,//está editando propiedades - Maqueta=128, + Props = 4,//está editando propiedades + Config = 8, //está configurando la ventana de limpieza o recogida por primera vez + EjecSecto=16,//está ejecutando por primera vez + EjecPlanif = 32,//está ejecutando después de haber planificado ya al menos una primera vez + FinEjecOk = 64, //ha terminado de ejecutar Bien + FinEjecNOk = 128,//ha terminado de ejecutar y ha habido errores + Config2 =256,//está configurando la ventana de limpieza o recogida después de haber sectorizado + //ya al menos una primera vez + //se pone este estado cuando ha terminado ya la primera vez } static class OliviaGlob { @@ -65,7 +66,14 @@ namespace OliviaAddInPro.Model */ public static int TiempoOutSocket; }; - + /** + * Nombre de las capas que se van a necesitar para la exportación de datos + */ + public struct Capas + { + public static string ftclass_ejes; // ffin) + { + await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => + { + cps.Status = "Procesando"; + cps.Value = 0; + var res = Ejecuta(modo, cps); + ffin(res); + return res; + + }); + } } } diff --git a/Model/TratamientoComun.cs b/Model/TratamientoComun.cs index 0900481..b39f5e9 100644 --- a/Model/TratamientoComun.cs +++ b/Model/TratamientoComun.cs @@ -10,6 +10,14 @@ namespace OliviaAddInPro.Model { public class TratamientoComun { + /** + * Tipo de tratamiento, en limpieza es sobre LimpiezaDef.TiposTto y en reco sobre RecogidaDef.tipos_fracc_str + */ + public int TipoTto { get; set; } = (int)LimpiezaDef.TiposTto.TtoNoDef; + /** + * String para Tipo de tratamiento, se guarda como columna en el shp + */ + public string TipoTtoStr { get; set; } = String.Empty; /** * Capa de ámbitos */ @@ -108,5 +116,6 @@ namespace OliviaAddInPro.Model } set { err_str = value;} } + } } diff --git a/OliviaAddInPro.csproj b/OliviaAddInPro.csproj index dfe447f..e12cb60 100644 --- a/OliviaAddInPro.csproj +++ b/OliviaAddInPro.csproj @@ -150,6 +150,7 @@ + @@ -297,11 +298,6 @@ Resource1.Designer.cs - - - - - @@ -311,9 +307,6 @@ - - - @@ -332,7 +325,13 @@ - + + + + + + + - + @@ -72,7 +72,7 @@