Cambios y arreglos para la entrega v0

Gerardo/Compilacion.net
Elena 2022-07-11 10:30:30 +02:00
parent 41c197b5ea
commit 66c092ecf6
29 changed files with 356 additions and 186 deletions

View File

@ -67,6 +67,7 @@ namespace OliviaAddInPro.Helper
OpenFtrClassPoint = 2, OpenFtrClassPoint = 2,
OpenFtrClassPolygon = 4, OpenFtrClassPolygon = 4,
OpenGdb = 8, OpenGdb = 8,
OpenDataset = 16
} }
private static void ReiniciaOutStr() private static void ReiniciaOutStr()
@ -332,6 +333,11 @@ namespace OliviaAddInPro.Helper
filtro.AddFilter(BrowseProjectFilter.GetFilter("esri_browseDialogFilters_geodatabases")); filtro.AddFilter(BrowseProjectFilter.GetFilter("esri_browseDialogFilters_geodatabases"));
titulo = "Abrir Geodatabase"; titulo = "Abrir Geodatabase";
} }
if ((tipo & TiposOpenFileDlg.OpenDataset) == TiposOpenFileDlg.OpenDataset)
{
filtro.AddFilter(BrowseProjectFilter.GetFilter("esri_browseDialogFilters_featureDatasets_all"));
titulo = "Abrir Dataset";
}
if (tipo == 0) if (tipo == 0)
{ {
filtro.AddFilter(BrowseProjectFilter.GetFilter("")); filtro.AddFilter(BrowseProjectFilter.GetFilter(""));
@ -2024,6 +2030,32 @@ namespace OliviaAddInPro.Helper
return null; return null;
} }
/**
* Comprueva si existe un Dataset, con ruta completa
*/
public static Task<bool> CheckDataset(string datasetName)
{
return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<bool>)(() =>
{
if (string.IsNullOrEmpty(datasetName))
return false;
try
{
Geodatabase gdb = GetGdbSync(datasetName);
if (gdb == null)
return false;
var datname = new System.IO.DirectoryInfo(datasetName).Name;
FeatureDataset ftdst = gdb.OpenDataset<FeatureDataset>(datname);
ftdst.Dispose();
return true;
}
catch
{
return false;
}
}));
}
/** /**
* Comprueva si una GDB contiene un Dataset * Comprueva si una GDB contiene un Dataset
*/ */
@ -2109,7 +2141,6 @@ namespace OliviaAddInPro.Helper
//existe ese nombre, pero con otra ref espacial //existe ese nombre, pero con otra ref espacial
//crea un nuevo dataset y avisa //crea un nuevo dataset y avisa
datasetName = string.Format("{0}_{1}",datasetName,idat); datasetName = string.Format("{0}_{1}",datasetName,idat);
datasetNameOut = datasetName;
idat++; idat++;
} }
else//r==1 else//r==1
@ -2123,6 +2154,7 @@ namespace OliviaAddInPro.Helper
else else
r = 3; //no existe, lo crea con ese nombre r = 3; //no existe, lo crea con ese nombre
}; };
datasetNameOut = datasetName;
if (r!=3) if (r!=3)
return res; return res;
//no existe, lo crea //no existe, lo crea

View File

@ -97,12 +97,13 @@ namespace OliviaAddInPro.Helper
_ProgrSrc.SetProgress(0); _ProgrSrc.SetProgress(0);
_ProgrSrc.SetProceso(stat); _ProgrSrc.SetProceso(stat);
} }
public void IncMessage(uint inc, string mes) public void IncMessage(uint inc, string mes=null)
{ {
var prog = _ProgrSrc.GetProgress() + inc; var prog = _ProgrSrc.GetProgress() + inc;
if (prog > 100) if (prog > 100)
prog = 100; prog = 100;
_ProgrSrc.SetProgress(prog); _ProgrSrc.SetProgress(prog);
if(!string.IsNullOrEmpty(mes))
_ProgrSrc.SetEstado(mes); _ProgrSrc.SetEstado(mes);
} }

View File

@ -61,17 +61,6 @@ namespace OliviaAddInPro.Model
public override Respuesta<TiposEjecucion> Ejecuta(ModosEjec modo) public override Respuesta<TiposEjecucion> Ejecuta(ModosEjec modo)
{ {
/////////////////////////////
/////
///DEBUG
///
//Respuesta<TiposEjecucion> res1 = new Respuesta<TiposEjecucion> { 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<bool> res = new Respuesta<bool> { Value=false}; Respuesta<bool> res = new Respuesta<bool> { Value=false};
@ -142,7 +131,10 @@ namespace OliviaAddInPro.Model
{ {
auxili = shapefile.Substring(aux, auxl); auxili = shapefile.Substring(aux, auxl);
ambitos = ambitos + auxili; ambitos = ambitos + auxili;
aux = indice; //para coger el timestamp
} }
//concatena el timestamp //concatena el timestamp
ambitos = ambitos + shapefile.Substring(aux); ambitos = ambitos + shapefile.Substring(aux);

View File

@ -1,78 +0,0 @@
using ArcGIS.Core.Geometry;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OliviaAddInPro.Helper;
using System.Collections.ObjectModel;
using ArcGIS.Core.CIM;
using ArcGIS.Core.Data;
using OliviaAddInPro.Services;
using static OliviaAddInPro.Model.ComunDef;
using ArcGIS.Desktop.Framework.Contracts;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using OliviaAddInPro.Services.LanzaSrv;
namespace OliviaAddInPro.Model
{
public class Limpieza : TratamientoComun
{
//**********************************************
//Se recogen en PaneLimpiezaSub1
/**
* Ámbitos de trabajo elegidos
*/
public bool[] AmbitosSel { get; set; } = new bool[(int)LimpiezaDef.AmbitsTra.AmbN];
/**
* Indica si respeta el sentido de circulación o no
*/
public bool RespCirc { get; set; } = false;
/**
* Tipo de unidades del tiempo de tto
*/
public int UdsTTto { get; set; } = (int)GeneralDef.OlvTiposTto.OlvTipTtoNoDef;
/**
* Instancia para las funciones de exportación y demás
*/
public LimpiezaServ Serv { get; set; } = null;
public LanzaLimpSrv LanzaSrv { get; set; } = null;
/**
* Ancho de vía, en metros
*/
public double AnchoVia { get; set; } = LimpiezaDef.Parametros.ancho_via;
public Limpieza()
{
Serv = new LimpiezaServ(this);
LanzaSrv = new LanzaLimpSrv();
<<<<<<< HEAD
=======
ProceSrv = new ProcesoEjecServ();
ProgrSrc = new MyCancelableProgressorSource(OliviaGlob.progrDialog.GetViewModel());
>>>>>>> Gerardo/MarchandoUnaDe
}
public override Respuesta<TiposEjecucion> Ejecuta(ModosEjec modo)
{
Respuesta<bool> res = new Respuesta<bool> { Value=false};
Respuesta<TiposEjecucion> res2 = new Respuesta<TiposEjecucion> (){ Value = TiposEjecucion.FinEjecNOk };
res = Serv.Ejecuta(modo);
if (res.Value)
{
res=LanzaSrv.ejec(this, modo, TipoTtoStr);
if (res.Value)
{
ProceSrv.ConfigConex();
res2 = ProceSrv.start(LanzaSrv.str_cfg, ProgrSrc._ProgrSrc);
}
}
if (res.HasError)
{
res2.Error.AddRange(res.Error);
}
return res2;
}
}
}

View File

@ -93,6 +93,8 @@ namespace OliviaAddInPro.Model
public static int t_descansom; //<Tiempo de descanso mínimo admitido public static int t_descansom; //<Tiempo de descanso mínimo admitido
public static int t_descanso; //<Tiempo de descanso establecido public static int t_descanso; //<Tiempo de descanso establecido
public static int h_inicio; //<Hora de inicio de la jornada de trabajo public static int h_inicio; //<Hora de inicio de la jornada de trabajo
public static int reduc_traf; //<Porcent de reducción por tráfico
public static bool igno_ais;
public static int ancho_viaM; //<Ancho de vía máximo admitido public static int ancho_viaM; //<Ancho de vía máximo admitido
public static int ancho_viam; //<Ancho de vía mínimo admitido public static int ancho_viam; //<Ancho de vía mínimo admitido
public static int ancho_via; //<Ancho de vía establecido public static int ancho_via; //<Ancho de vía establecido

View File

@ -81,11 +81,7 @@ namespace OliviaAddInPro.Model
*/ */
[Browsable(false)] [Browsable(false)]
public string Ip { get; set; } public string Ip { get; set; }
/**
* Puerto local donde va a realizar la conexión a OliviaTask, se inicializa al arrancar
*/
[Browsable(false)]
public int Puerto { get; set; }
/** /**
* Time out de la conexión con OliviaTask, en seg * Time out de la conexión con OliviaTask, en seg
*/ */
@ -249,11 +245,24 @@ namespace OliviaAddInPro.Model
public string Path_Gdb_Import { get; set; } public string Path_Gdb_Import { get; set; }
[Category("General")] [Category("General")]
[PropertyOrder(5)] [PropertyOrder(6)]
[DisplayName("Dataset para Importación")]
[Description("Dataset, dentro de la GDB, en la que se importarán los resultados de la ejecución")]
[Editor(typeof(PropertyGridFilePickerDataset), typeof(PropertyGridFilePickerDataset))]
public string Path_Dataset_Import { get; set; }
[Category("General")]
[PropertyOrder(7)]
[DisplayName("Carpeta para listados (CSV)")] [DisplayName("Carpeta para listados (CSV)")]
[Description("Carpeta en la que se guardarán los listados en CSV de la planificación")] [Description("Carpeta en la que se guardarán los listados en CSV de la planificación")]
[Editor(typeof(PropertyGridFilePickerFolder), typeof(PropertyGridFilePickerFolder))] [Editor(typeof(PropertyGridFilePickerFolder), typeof(PropertyGridFilePickerFolder))]
public string Path_Guarda_Csv { get; set; } public string Path_Guarda_Csv { get; set; }
[Category("General")]
[PropertyOrder(8)]
[DisplayName("Ignorar aislados")]
[Description("Indica si por defecto se van a ignorar elementos aislados")]
public bool Igno_ais { get; set; }
#endregion #endregion
#region 02CamposLimp #region 02CamposLimp
@ -740,15 +749,20 @@ namespace OliviaAddInPro.Model
[Browsable(false)] [Browsable(false)]
public int hora_inicio { get; set; } //ES UNA HORA, SON LOS MINUTOS DESDE LAS 00, PERO TIENE QUE APARECER CON FORMATO DE TIME 07:30, POR EJEMPLO public int hora_inicio { get; set; } //ES UNA HORA, SON LOS MINUTOS DESDE LAS 00, PERO TIENE QUE APARECER CON FORMATO DE TIME 07:30, POR EJEMPLO
[Category("Tiempos de la jornada - Avanzadas")] //OCULTAR [Category("Tiempos de la jornada - Avanzadas")]
[DisplayName("Salida/llegada, en recogida (min)")] [DisplayName("Salida/llegada, en recogida (min)")]
[Description("")] [Description("")]
public int t_llega_sale { get; set; } public int t_llega_sale { get; set; }
[Category("Tiempos de la jornada - Avanzadas")] //OCULTAR [Category("Tiempos de la jornada - Avanzadas")]
[DisplayName("Descarga en planta, en recogida (min)")] [DisplayName("Descarga en planta, en recogida (min)")]
[Description("")] [Description("")]
public int t_descarga { get; set; } public int t_descarga { get; set; }
[Category("Tiempos de la jornada - Avanzadas")]
[DisplayName("Reducción por tráfico %")]
[Description("Reducción de la velocidad por tráfico, %")]
public int reduc_traf { get; set; }
#endregion #endregion
#region 09AnchosLimpAvanz #region 09AnchosLimpAvanz
@ -1213,10 +1227,13 @@ namespace OliviaAddInPro.Model
#endregion #endregion
#region 15GenAvanz #region 15GenAvanz
/**
* Puerto local donde va a realizar la conexión a OliviaTask, se inicializa al arrancar
*/
[Category("General - Avanzadas")] //OCULTAR [Category("General - Avanzadas")] //OCULTAR
[DisplayName("Puerto de conexión")] [DisplayName("Puerto de conexión")]
[Description("Puerto de conexión con el proceso olivia")] [Description("Puerto de conexión con el proceso olivia")]
public int puerto { get; set; } public int Puerto { get; set; }
[Category("General - Avanzadas")] //OCULTAR [Category("General - Avanzadas")] //OCULTAR
[DisplayName("Desviación máxima relativa")] [DisplayName("Desviación máxima relativa")]

View File

@ -51,8 +51,8 @@ namespace OliviaAddInPro.Model
public const int ProgrMax = 100; public const int ProgrMax = 100;
public const int ProgrStep = 5; public const int ProgrStep = 5;
public const int ParamN = 5; public const int ParamN = 5;
public const int ParamLimpN = 37; public const int ParamLimpN = 45;
public const int ParamRecoN = 40; public const int ParamRecoN = 43;
/* /*
* Define el separador entre parámetros de la llamada al proceso oliviatasks * Define el separador entre parámetros de la llamada al proceso oliviatasks
*/ */
@ -522,13 +522,14 @@ namespace OliviaAddInPro.Model
/** /**
* Nombre de los campos que lee en limpieza * Nombre de los campos que lee en limpieza
*/ */
public const string GTO_girmax ="Giro_max_vehiculo";
public const string GTO_anch_peat ="Ancho_peat_def"; public const string GTO_anch_peat ="Ancho_peat_def";
public const string GTO_anch_ace = "Ancho_acera_def"; public const string GTO_anch_ace = "Ancho_acera_def";
public const string GTO_anch_aplin = "Ancho_ap_lin_def"; public const string GTO_anch_aplin = "Ancho_ap_lin_def";
public const string GTO_anch_apbat = "Ancho_ap_bat_def"; public const string GTO_anch_apbat = "Ancho_ap_bat_def";
public const string GTO_anch_bordlib = "Ancho_bord_lib_def"; public const string GTO_anch_bordlib = "Ancho_bord_lib_def";
public const string GTO_desv_max = "Desv_max"; //común
public const string GTO_girmax = "Giro_max_vehiculo";
public const string GTO_desv_max = "Desv_max_rel";
public const string GTO_desv_max_abs = "Desv_max_abs"; public const string GTO_desv_max_abs = "Desv_max_abs";
/** /**
* Define el nombre para mandar a oliviatasks la configuración * Define el nombre para mandar a oliviatasks la configuración

View File

@ -60,6 +60,7 @@ namespace OliviaAddInPro.Model
//paths import //paths import
public static string PathGdbImport; //<Path de la gdb en la que se guardan los resultados public static string PathGdbImport; //<Path de la gdb en la que se guardan los resultados
public static string PathDatasetImport; //<Path del dataset en la que se guardan los resultados
public static string PathGuardCsv; //<Path para guardar CSV de la planificación public static string PathGuardCsv; //<Path para guardar CSV de la planificación
}; };
public struct Conexion public struct Conexion
@ -118,13 +119,6 @@ namespace OliviaAddInPro.Model
{ {
tipoEjec = TiposEjecucion.Ninguno; tipoEjec = TiposEjecucion.Ninguno;
TipoView= TiposEjecucion.Ninguno; TipoView= TiposEjecucion.Ninguno;
IniDefault();
LimpiezaDef.iniciaLimpDef();
RecogidaDef.iniciaRecoDef();
progrDialog = new MarchandoUnaDe();
limp = new Limpieza();
reco = new Recogida();
SpatRef = ArcGIS.Core.Geometry.SpatialReferenceBuilder.CreateSpatialReference(GeneralDef.SpatRefDef);
Respuesta<bool> resp = coge_ip(); Respuesta<bool> resp = coge_ip();
if (!resp.Value && resp.HasError) if (!resp.Value && resp.HasError)
@ -136,6 +130,14 @@ namespace OliviaAddInPro.Model
{ {
HelperGlobal.ponMsg(resp.Error.First()); HelperGlobal.ponMsg(resp.Error.First());
} }
IniDefault();
LimpiezaDef.iniciaLimpDef();
RecogidaDef.iniciaRecoDef();
progrDialog = new MarchandoUnaDe();
limp = new Limpieza();
reco = new Recogida();
SpatRef = ArcGIS.Core.Geometry.SpatialReferenceBuilder.CreateSpatialReference(GeneralDef.SpatRefDef);
} }
public static bool IsLimp() public static bool IsLimp()
@ -288,9 +290,10 @@ namespace OliviaAddInPro.Model
{ {
if (string.IsNullOrEmpty(path)) if (string.IsNullOrEmpty(path))
return false; return false;
if(Directory.Exists(path))
var dir = Path.GetDirectoryName(path); return true;
if (string.IsNullOrEmpty(dir) || !Directory.Exists(path)) //no existe directorio, mira el anterior
if (!Directory.Exists(Path.GetPathRoot(path)))
return false; return false;
return true; return true;
@ -417,6 +420,7 @@ namespace OliviaAddInPro.Model
c.PathCartela = c.PathCartela; c.PathCartela = c.PathCartela;
Paths.PathGdbImport = c.Path_Gdb_Import; Paths.PathGdbImport = c.Path_Gdb_Import;
Paths.PathDatasetImport = c.Path_Dataset_Import;
Paths.PathGuardCsv = c.Path_Guarda_Csv; Paths.PathGuardCsv = c.Path_Guarda_Csv;
HelperGlobal.create_folder(Paths.DirData); HelperGlobal.create_folder(Paths.DirData);
@ -488,6 +492,8 @@ namespace OliviaAddInPro.Model
LimpiezaDef.Parametros.t_descansom = c.t_descanso_min; LimpiezaDef.Parametros.t_descansom = c.t_descanso_min;
LimpiezaDef.Parametros.t_descanso = c.t_descanso; LimpiezaDef.Parametros.t_descanso = c.t_descanso;
LimpiezaDef.Parametros.h_inicio = c.hora_inicio; LimpiezaDef.Parametros.h_inicio = c.hora_inicio;
LimpiezaDef.Parametros.reduc_traf = c.reduc_traf;
LimpiezaDef.Parametros.igno_ais = c.Igno_ais;
LimpiezaDef.Parametros.ancho_viaM = c.ancho_via_max; LimpiezaDef.Parametros.ancho_viaM = c.ancho_via_max;
LimpiezaDef.Parametros.ancho_viam = c.ancho_via_min; LimpiezaDef.Parametros.ancho_viam = c.ancho_via_min;
LimpiezaDef.Parametros.ancho_via = c.ancho_via; LimpiezaDef.Parametros.ancho_via = c.ancho_via;
@ -529,12 +535,12 @@ namespace OliviaAddInPro.Model
LimpiezaDef.Parametros.vdespLS = c.v_desp_LS; LimpiezaDef.Parametros.vdespLS = c.v_desp_LS;
LimpiezaDef.Parametros.umbral_reco = 80; LimpiezaDef.Parametros.umbral_reco = 80;
LimpiezaDef.OtrosParam.giro_max = c.Giro_max_vehiculo;
LimpiezaDef.OtrosParam.anch_peat = c.Ancho_peat_def; LimpiezaDef.OtrosParam.anch_peat = c.Ancho_peat_def;
LimpiezaDef.OtrosParam.anch_ace = c.Ancho_acera_def; LimpiezaDef.OtrosParam.anch_ace = c.Ancho_acera_def;
LimpiezaDef.OtrosParam.anch_aplin = c.Ancho_ap_lin_def; LimpiezaDef.OtrosParam.anch_aplin = c.Ancho_ap_lin_def;
LimpiezaDef.OtrosParam.anch_apbat = c.Ancho_ap_bat_def; LimpiezaDef.OtrosParam.anch_apbat = c.Ancho_ap_bat_def;
LimpiezaDef.OtrosParam.anch_bordlib = c.Ancho_bord_lib_def; LimpiezaDef.OtrosParam.anch_bordlib = c.Ancho_bord_lib_def;
LimpiezaDef.OtrosParam.giro_max = c.Giro_max_vehiculo;
LimpiezaDef.OtrosParam.desv_max = c.Desv_max; LimpiezaDef.OtrosParam.desv_max = c.Desv_max;
LimpiezaDef.OtrosParam.desv_max_abs = c.Desv_max_abs; LimpiezaDef.OtrosParam.desv_max_abs = c.Desv_max_abs;

View File

@ -150,6 +150,8 @@ namespace OliviaAddInPro.Model
{ {
auxili = shapefile.Substring(aux, auxl); auxili = shapefile.Substring(aux, auxl);
carga = carga + auxili; carga = carga + auxili;
aux = indice; //para coger el timestamp
} }
//concatena el timestamp //concatena el timestamp

View File

@ -103,7 +103,7 @@ namespace OliviaAddInPro.Model
/** /**
* Porcentaje de tráfico que se estima, ya que si no los vehículos irían siempre a la velocida máxima permitida por la vía * Porcentaje de tráfico que se estima, ya que si no los vehículos irían siempre a la velocida máxima permitida por la vía
*/ */
public int Trafico { get; set; } = 80; public int Trafico { get; set; } = LimpiezaDef.Parametros.reduc_traf;
/** /**
* Número de puntos de control * Número de puntos de control
*/ */
@ -115,7 +115,7 @@ namespace OliviaAddInPro.Model
/** /**
* Ignorar o noelementos aislados * Ignorar o noelementos aislados
*/ */
public bool IgnoAis { get; set; } = true; public bool IgnoAis { get; set; } = LimpiezaDef.Parametros.igno_ais;
/** /**
* Almacena la consulta para exportar los ámbitos * Almacena la consulta para exportar los ámbitos
*/ */

View File

@ -16,5 +16,7 @@ namespace OliviaAddInPro.Model.contract
bool Getcancelled(); bool Getcancelled();
void Setcancelled(); void Setcancelled();
void Inicia(); void Inicia();
void PonBarColorVerde();
void PonBarColorRojo();
} }
} }

View File

@ -176,6 +176,9 @@
<Compile Include="View\Configuracion\PropertyGridFilePickerFolder.xaml.cs"> <Compile Include="View\Configuracion\PropertyGridFilePickerFolder.xaml.cs">
<DependentUpon>PropertyGridFilePickerFolder.xaml</DependentUpon> <DependentUpon>PropertyGridFilePickerFolder.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="View\Configuracion\PropertyGridFilePickerDataset.xaml.cs">
<DependentUpon>PropertyGridFilePickerDataset.xaml</DependentUpon>
</Compile>
<Compile Include="View\Configuracion\PropertyGridFilePickerLine.xaml.cs"> <Compile Include="View\Configuracion\PropertyGridFilePickerLine.xaml.cs">
<DependentUpon>PropertyGridFilePickerLine.xaml</DependentUpon> <DependentUpon>PropertyGridFilePickerLine.xaml</DependentUpon>
</Compile> </Compile>
@ -257,6 +260,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="View\Configuracion\PropertyGridFilePickerDataset.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\Configuracion\PropertyGridFilePickerLine.xaml"> <Page Include="View\Configuracion\PropertyGridFilePickerLine.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>

View File

@ -44,6 +44,12 @@ namespace OliviaAddInPro.Services
if(res==null) if(res==null)
res = Default(); res = Default();
//pilla la IP
if(res.Ip.CompareTo("0.0.0.0")==0)
{
//coge la IP local
res.Ip = OliviaGlob.Conexion.Ip;
}
res.PathGdbGen = pon_path_absoluto(res.PathGdbGen, res.path_work); res.PathGdbGen = pon_path_absoluto(res.PathGdbGen, res.path_work);
res.PathSimbVSM = pon_path_absoluto(res.PathSimbVSM, res.path_work); res.PathSimbVSM = pon_path_absoluto(res.PathSimbVSM, res.path_work);
@ -157,8 +163,10 @@ namespace OliviaAddInPro.Services
c.consulta_sector = "SECTOR"; c.consulta_sector = "SECTOR";
c.consulta_secuen = "SECUENCIA"; c.consulta_secuen = "SECUENCIA";
c.Igno_ais = true;
//c.red_carreteras = @"%dir_work%Datos\gdbs\TomTom_Q4_2015.gdb"; //c.red_carreteras = @"%dir_work%Datos\gdbs\TomTom_Q4_2015.gdb";
c.puerto = 19995; c.Puerto = 19995;
c.buffer_export = 1000; c.buffer_export = 1000;
c.path_exe=@"%dir_work%bin\OliviaTasks.exe"; c.path_exe=@"%dir_work%bin\OliviaTasks.exe";
@ -168,6 +176,7 @@ namespace OliviaAddInPro.Services
c.Path_Eje_via = ""; c.Path_Eje_via = "";
c.Path_Gdb_Import = ""; c.Path_Gdb_Import = "";
c.Path_Guarda_Csv = ""; c.Path_Guarda_Csv = "";
c.Path_Dataset_Import = "";
c.path_cfg_aux = @"%dir_work%cfg.ini"; c.path_cfg_aux = @"%dir_work%cfg.ini";
/*c.eje_via = "TomTom_Q4_2015___nw"; /*c.eje_via = "TomTom_Q4_2015___nw";
c.municipios = "TomTom_Q4_2015___a8";*/ c.municipios = "TomTom_Q4_2015___a8";*/
@ -242,6 +251,7 @@ namespace OliviaAddInPro.Services
c.t_carga_desc=40; c.t_carga_desc=40;
c.t_descanso=30; c.t_descanso=30;
c.hora_inicio=420; //ES UNA HORA, SON LOS MINUTOS DESDE LAS 00, PERO TIENE QUE APARECER CON FORMATO DE TIME 07:30, POR EJEMPLO c.hora_inicio=420; //ES UNA HORA, SON LOS MINUTOS DESDE LAS 00, PERO TIENE QUE APARECER CON FORMATO DE TIME 07:30, POR EJEMPLO
c.reduc_traf = 80;
c.ancho_via=2; c.ancho_via=2;
c.t_tratamiento_BarMan=2900; c.t_tratamiento_BarMan=2900;
c.t_tratamiento_BarManMant=2900; c.t_tratamiento_BarManMant=2900;
@ -281,15 +291,6 @@ namespace OliviaAddInPro.Services
c.v_desp_LPip=0; c.v_desp_LPip=0;
c.v_desp_LS=0; c.v_desp_LS=0;
c.Giro_max_vehiculo=175.0000000;
c.Ancho_peat_def=6.0000000;
c.Ancho_acera_def=1.5000000;
c.Ancho_ap_lin_def=2.0000000;
c.Ancho_ap_bat_def=4.0000000;
c.Ancho_bord_lib_def=1.5000000;
c.Desv_max=0.1500000;
c.Desv_max_abs=1800.0000000;
//Reco //Reco
c.id= "OBJECTID"; c.id= "OBJECTID";
c.nomrec= "NOMB_TIP_REC"; c.nomrec= "NOMB_TIP_REC";
@ -371,6 +372,16 @@ namespace OliviaAddInPro.Services
c.atr_FT="FT"; c.atr_FT="FT";
c.atr_N = "N"; c.atr_N = "N";
c.atr_pedes="14"; c.atr_pedes="14";
c.Ancho_peat_def = 6.0000000;
c.Ancho_acera_def = 1.5000000;
c.Ancho_ap_lin_def = 2.0000000;
c.Ancho_ap_bat_def = 4.0000000;
c.Ancho_bord_lib_def = 1.5000000;
c.Giro_max_vehiculo = 175.0000000;
c.Desv_max = 0.1500000;
c.Desv_max_abs = 1800.0000000;
return c; return c;
} }
} }

View File

@ -56,6 +56,8 @@ namespace OliviaAddInPro.Services
{ {
ErrStr = string.Empty; ErrStr = string.Empty;
OliviaGlob.Paths.PathData = string.Empty;
OliviaGlob.Paths.PathNW = string.Empty;
if (com.ProgrSrc._ProgrSrc.Getcancelled()) if (com.ProgrSrc._ProgrSrc.Getcancelled())
{ {
ErrStr = Resource1.String_cancel_progreso; ErrStr = Resource1.String_cancel_progreso;
@ -157,6 +159,8 @@ namespace OliviaAddInPro.Services
com.ProgrSrc.IncMessage(10, "Exportando ámbitos de trabajo");//10% com.ProgrSrc.IncMessage(10, "Exportando ámbitos de trabajo");//10%
//Guarda el nombre
OliviaGlob.Paths.PathData = OliviaGlob.Paths.DirData + com.NombreShpExport;
//exporta los datos de entrada //exporta los datos de entrada
if (!HelperGdb.ExportShp2(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, null, 50)) if (!HelperGdb.ExportShp2(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, null, 50))
{ {
@ -169,8 +173,6 @@ namespace OliviaAddInPro.Services
ErrStr = Resource1.String_cancel_progreso; ErrStr = Resource1.String_cancel_progreso;
return false; return false;
} }
//Guarda el nombre
OliviaGlob.Paths.PathData = OliviaGlob.Paths.DirData + com.NombreShpExport;
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
//ahora si está en modo planificación y la capa no tiene esa columna, exporta la sectorización //ahora si está en modo planificación y la capa no tiene esa columna, exporta la sectorización
@ -332,14 +334,14 @@ namespace OliviaAddInPro.Services
//Prepara nombre de exportación //Prepara nombre de exportación
com.NombreShpExportNw = PREF_NAME_EXPORT_NW + fechaHora + EXT_SHP; com.NombreShpExportNw = PREF_NAME_EXPORT_NW + fechaHora + EXT_SHP;
//guarda los nombres del shape
OliviaGlob.Paths.PathNW = OliviaGlob.Paths.DirData + com.NombreShpExportNw;
//exporta los datos de entrada //exporta los datos de entrada
if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatRefData,100)) if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw, filtroEspacial, com.NombreShpExportNw, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatRefData,100))
{ {
ErrStr = "Error al exportar la red navegable: " + HelperGdb.OutStr; ErrStr = "Error al exportar la red navegable: " + HelperGdb.OutStr;
return false; return false;
} }
//guarda los nombres del shape
OliviaGlob.Paths.PathNW = OliviaGlob.Paths.DirData + com.NombreShpExportNw;
if (com.ProgrSrc._ProgrSrc.Getcancelled()) if (com.ProgrSrc._ProgrSrc.Getcancelled())
{ {
ErrStr = Resource1.String_cancel_progreso; ErrStr = Resource1.String_cancel_progreso;
@ -596,6 +598,10 @@ namespace OliviaAddInPro.Services
*/ */
public bool CompruebaPlanif() public bool CompruebaPlanif()
{ {
//si ha importado seguro que las tiene
if (OliviaGlob.IsConfig2() && !string.IsNullOrEmpty(com.CapaPlanif))
return true;
//comprueba capa //comprueba capa
if (ComprCamposPlanif(com.CapaElems)) if (ComprCamposPlanif(com.CapaElems))
{ {
@ -603,10 +609,6 @@ namespace OliviaAddInPro.Services
return true; return true;
} }
//si ha importado seguro que las tiene
if (OliviaGlob.IsConfig2() && !string.IsNullOrEmpty(com.CapaPlanif))
return true;
return false; return false;
} }
@ -615,12 +617,14 @@ namespace OliviaAddInPro.Services
*/ */
public Respuesta<string> ImportSecto(string GdbFileName) public Respuesta<string> ImportSecto(string GdbFileName)
{ {
com.ProgrSrc.IncMessage(10,"Importando capas");
var res = Import(GdbFileName, 0); var res = Import(GdbFileName, 0);
if (res.HasError || string.IsNullOrEmpty(res.Value)) if (res.HasError || string.IsNullOrEmpty(res.Value))
{ {
return res; return res;
} }
////////////////////////////////////////////////// //////////////////////////////////////////////////
com.ProgrSrc.IncMessage(50, "Pintando capas con valores únicos");
//abre las capas, pintando los sectores //abre las capas, pintando los sectores
bool mal = false; bool mal = false;
string path_import = res.Value; string path_import = res.Value;
@ -642,6 +646,7 @@ namespace OliviaAddInPro.Services
*/ */
public Respuesta<string> ImportPlanif(string GdbFileName) public Respuesta<string> ImportPlanif(string GdbFileName)
{ {
com.ProgrSrc.IncMessage(10, "Importando capas");
var res = Import(GdbFileName, 1); var res = Import(GdbFileName, 1);
if (res.HasError || string.IsNullOrEmpty(res.Value)) if (res.HasError || string.IsNullOrEmpty(res.Value))
{ {
@ -649,6 +654,7 @@ namespace OliviaAddInPro.Services
return res; return res;
} }
////////////////////////////////////////////////// //////////////////////////////////////////////////
com.ProgrSrc.IncMessage(30, "Pintando capas con valores únicos");
//abre las capas, pintando los sectores //abre las capas, pintando los sectores
string path_import = res.Value; string path_import = res.Value;
int NOPEN = 6; int NOPEN = 6;
@ -678,6 +684,7 @@ namespace OliviaAddInPro.Services
var resb = new Respuesta<bool>(); var resb = new Respuesta<bool>();
for(i =0;i<NOPEN;i++) for(i =0;i<NOPEN;i++)
{ {
com.ProgrSrc.IncMessage((uint)(60 / NOPEN));
resb = HelperGdb.OpenLayerUniqueValue(path_lyr_arr[i], LimpiezaDef.Campos.consulta_sector, visible_arr[i]); resb = HelperGdb.OpenLayerUniqueValue(path_lyr_arr[i], LimpiezaDef.Campos.consulta_sector, visible_arr[i]);
if (!resb.Value) if (!resb.Value)
break; break;
@ -725,6 +732,22 @@ namespace OliviaAddInPro.Services
///////////////////////////////////////// /////////////////////////////////////////
/////mira a ver si tiene configurado Dataset
string msg_avisa = string.Empty;
if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathDatasetImport))
{
var datname = new System.IO.DirectoryInfo(OliviaGlob.Paths.PathDatasetImport).Name;
var task1 = HelperGdb.CheckDataset(OliviaGlob.Paths.PathDatasetImport);
task1.Wait();
if (task1.Result)
{
tratamiento = datname;
}
else
{
msg_avisa = "No se encuentra el Dataset " + datname + ". ";
}
}
//crea el dataset o comprueba si existe //crea el dataset o comprueba si existe
string datasetNameOut = string.Empty; string datasetNameOut = string.Empty;
var resp = HelperGdb.CreateDataset(GdbFileName, tratamiento, spatRefData, out datasetNameOut); var resp = HelperGdb.CreateDataset(GdbFileName, tratamiento, spatRefData, out datasetNameOut);
@ -732,7 +755,8 @@ namespace OliviaAddInPro.Services
if(resp.Value==0) if(resp.Value==0)
{ {
//avisa //avisa
HelperGlobal.ponMsg("Se importan los archivos en "+ GdbFileName+"\\"+ datasetNameOut); msg_avisa += "Se importan los archivos en " + GdbFileName + "\\" + datasetNameOut;
//HelperGlobal.ponMsg("Se importan los archivos en "+ GdbFileName+"\\"+ datasetNameOut);
tratamiento = datasetNameOut; tratamiento = datasetNameOut;
} }
else if (resp.Value == 1) else if (resp.Value == 1)
@ -743,7 +767,8 @@ namespace OliviaAddInPro.Services
else if (resp.Value == 2) else if (resp.Value == 2)
{ {
//avisa //avisa
HelperGlobal.ponMsg(err_spatref +", se ha creado un nuevo dataset "+ datasetNameOut ); msg_avisa = err_spatref + ", se ha creado un nuevo dataset " + datasetNameOut;
//HelperGlobal.ponMsg(err_spatref +", se ha creado un nuevo dataset "+ datasetNameOut );
tratamiento = datasetNameOut; tratamiento = datasetNameOut;
} }
string dataset = tratamiento; string dataset = tratamiento;
@ -828,6 +853,10 @@ namespace OliviaAddInPro.Services
res.Error.Add("Errores en la importación: "+err_st); res.Error.Add("Errores en la importación: "+err_st);
return res; return res;
} }
//avisa ahora para dar tiempo?
if(!string.IsNullOrEmpty(msg_avisa))
HelperGlobal.ponMsg(msg_avisa);
//cambia el nombre de los campos que había truncado a 10 caracteres al exportar a shp //cambia el nombre de los campos que había truncado a 10 caracteres al exportar a shp
//solo para la capa original //solo para la capa original
resp2 = com.RestauraNomCampos(GdbFileName + "\\" + dataset + "\\" + noms_gdb[0]); resp2 = com.RestauraNomCampos(GdbFileName + "\\" + dataset + "\\" + noms_gdb[0]);
@ -856,11 +885,17 @@ namespace OliviaAddInPro.Services
* Cierra del mapa las capas de trabajo después de la exportación * Cierra del mapa las capas de trabajo después de la exportación
*/ */
public void CierraCapas() public void CierraCapas()
{
if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathData))
{ {
string capa_principal = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData); string capa_principal = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData);
string capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW);
HelperGdb.CloseLayer(capa_principal); HelperGdb.CloseLayer(capa_principal);
}
if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathNW))
{
string capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW);
HelperGdb.CloseLayer(capa_principal_nw); HelperGdb.CloseLayer(capa_principal_nw);
} }
} }
} }
}

View File

@ -38,6 +38,7 @@ namespace OliviaAddInPro.Services
} }
else else
{ {
inst.ProgrSrc.Init("Importando resultados");
//actualiza los flags //actualiza los flags
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecOk); OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecOk);
//importa resultados //importa resultados
@ -158,8 +159,15 @@ namespace OliviaAddInPro.Services
public static void BorraFiles() public static void BorraFiles()
{ {
string[] list = null; string[] list = null;
string capa_principal = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData); string capa_principal, capa_principal_nw;
string capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW); if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathData))
capa_principal = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData);
else
capa_principal = null;
if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathNW))
capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW);
else
capa_principal_nw = null;
try try
{ {

View File

@ -91,7 +91,14 @@ namespace OliviaAddInPro.Services.LanzaSrv
GeneralDef.EjecGeoParamSep + GeneralDef.GAL_acera + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Atributos.atr_acera + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GAL_acera + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Atributos.atr_acera + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GAL_peat + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Atributos.atr_peat + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GAL_peat + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Atributos.atr_peat + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GAL_ap_lin + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Atributos.atr_ap_lin + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GAL_ap_lin + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Atributos.atr_ap_lin + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GAL_ap_bat + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Atributos.atr_ap_bat + " "; GeneralDef.EjecGeoParamSep + GeneralDef.GAL_ap_bat + GeneralDef.EjecGeoParamIgual + LimpiezaDef.Atributos.atr_ap_bat + " " +
//campos de anchos de entidades de limpieza
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_anch_peat + GeneralDef.EjecGeoParamIgual + LimpiezaDef.OtrosParam.anch_peat+ " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_anch_ace + GeneralDef.EjecGeoParamIgual + LimpiezaDef.OtrosParam.anch_ace + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_anch_aplin + GeneralDef.EjecGeoParamIgual + LimpiezaDef.OtrosParam.anch_aplin + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_anch_apbat + GeneralDef.EjecGeoParamIgual + LimpiezaDef.OtrosParam.anch_apbat + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_anch_bordlib + GeneralDef.EjecGeoParamIgual + LimpiezaDef.OtrosParam.anch_bordlib + " ";
base.str_cfg = str; base.str_cfg = str;

View File

@ -73,7 +73,11 @@ namespace OliviaAddInPro.Services.LanzaSrv
GeneralDef.EjecGeoParamSep + GeneralDef.GG_strtto + GeneralDef.EjecGeoParamIgual + NombreTratamiento + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_strtto + GeneralDef.EjecGeoParamIgual + NombreTratamiento + " " +
//paths de archivos //paths de archivos
GeneralDef.EjecGeoParamSep + GeneralDef.GG_pd + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathData + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_pd + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathData + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_pn + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathNW + " "; GeneralDef.EjecGeoParamSep + GeneralDef.GG_pn + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathNW + " " +
//giro max y desv
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_girmax + GeneralDef.EjecGeoParamIgual + LimpiezaDef.OtrosParam.giro_max + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_desv_max + GeneralDef.EjecGeoParamIgual + LimpiezaDef.OtrosParam.desv_max + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_desv_max_abs + GeneralDef.EjecGeoParamIgual + LimpiezaDef.OtrosParam.desv_max_abs + " ";
} }
/** /**
@ -99,7 +103,7 @@ namespace OliviaAddInPro.Services.LanzaSrv
GeneralDef.EjecGeoParamSep + GeneralDef.GG_port + GeneralDef.EjecGeoParamIgual + OliviaGlob.Conexion.Puerto + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_port + GeneralDef.EjecGeoParamIgual + OliviaGlob.Conexion.Puerto + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_tout + GeneralDef.EjecGeoParamIgual + OliviaGlob.Conexion.TiempoOutSocket + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_tout + GeneralDef.EjecGeoParamIgual + OliviaGlob.Conexion.TiempoOutSocket + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_pt + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathTemp + " " + GeneralDef.EjecGeoParamSep + GeneralDef.GG_pt + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathTemp + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_pcfg + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathCfg; GeneralDef.EjecGeoParamSep + GeneralDef.GG_pcfg + GeneralDef.EjecGeoParamIgual + "";
pfi = new ProcessStartInfo(OliviaGlob.Paths.PathExeOlivia, args); pfi = new ProcessStartInfo(OliviaGlob.Paths.PathExeOlivia, args);
pfi.UseShellExecute = false; pfi.UseShellExecute = false;

View File

@ -55,6 +55,8 @@ namespace OliviaAddInPro.Services
if(!ExportaEjec(modo, out msg)) if(!ExportaEjec(modo, out msg))
{ {
res.Error.Add(msg); res.Error.Add(msg);
//cierra y borra las capas si le ha dado tiempo a exportar
FinProcServ.BorraFiles();
return res; return res;
} }

View File

@ -498,6 +498,7 @@ namespace OliviaAddInPro.Services
{ {
//cps.Status //cps.Status
} }
/* /*
* Para poder actualizar la barra de progreso hay que llamar a invoke * Para poder actualizar la barra de progreso hay que llamar a invoke
* porque está desde otro thread * porque está desde otro thread
@ -513,18 +514,16 @@ namespace OliviaAddInPro.Services
else if(actu == TiposActu.ActuFinOk) else if(actu == TiposActu.ActuFinOk)
cps.SetProceso("Proceso Finalizado."); cps.SetProceso("Proceso Finalizado.");
//FALTA CAMBIAR EL NOMBRE DEL BOTÓN DE CANCELAR if ((actu == TiposActu.ActuMal) || (actu == TiposActu.ActuFinNOk))
cps.PonBarColorRojo();
else
cps.PonBarColorVerde();
/*if (actu > TiposActu.ActuFinOk) /*if (actu > TiposActu.ActuFinOk)
cps.SetEstado("Calculando..."); cps.SetEstado("Calculando...");
if ((actu == TiposActu.ActuPermu) && !cancela) if ((actu == TiposActu.ActuPermu) && !cancela)
cps.SetEstado("Calculando Permutaciones..."); cps.SetEstado("Calculando Permutaciones...");
if ((actu == TiposActu.ActuMal) || (actu == TiposActu.ActuFinNOk))
col = 2;
else
col = 1;
if (actu > TiposActu.ActuFinOk) if (actu > TiposActu.ActuFinOk)
button_canc.Text = "Finalizar"; button_canc.Text = "Finalizar";
if ((actu == TiposActu.ActuPermu) && !cancela) if ((actu == TiposActu.ActuPermu) && !cancela)

View File

@ -8,17 +8,17 @@
mc:Ignorable="d" mc:Ignorable="d"
Title="Olivia" Height="227" Width="449" Title="Olivia" Height="227" Width="449"
d:DataContext="{Binding Path=ui.MarchandoUnaDeViewModel}" d:DataContext="{Binding Path=ui.MarchandoUnaDeViewModel}"
WindowStartupLocation="CenterOwner" Icon="../OliviaIconPro.ico"
ResizeMode="NoResize"> ResizeMode="NoResize">
<Grid> <Grid>
<Label Content="{Binding TextProceso}" HorizontalAlignment="Left" Margin="30,10,0,0" VerticalAlignment="Top" Width="350" Height="26"/> <Label Content="{Binding TextProceso}" HorizontalAlignment="Left" Margin="30,10,0,0" VerticalAlignment="Top" Width="350" Height="26"/>
<ProgressBar Minimum="0" Maximum="100" HorizontalAlignment="Left" Value="{Binding Progreso, UpdateSourceTrigger=PropertyChanged}" Height="20" Margin="29,40,0,0" VerticalAlignment="Top" Width="350"/> <ProgressBar Minimum="0" Maximum="100" HorizontalAlignment="Left" Value="{Binding Progreso, UpdateSourceTrigger=PropertyChanged}" Height="20" Margin="29,40,0,0" VerticalAlignment="Top" Width="350" Foreground="{Binding ColorBar}">
</ProgressBar>
<Grid HorizontalAlignment="Left" Margin="30,70,0,0" VerticalAlignment="Top" Width="350" Height="70"> <Grid HorizontalAlignment="Left" Margin="30,70,0,0" VerticalAlignment="Top" Width="350" Height="70">
<ScrollViewer MaxHeight="70" > <ScrollViewer MaxHeight="70" >
<TextBlock Text="{Binding TextEstado}" TextWrapping="WrapWithOverflow" /> <TextBlock Text="{Binding TextEstado}" TextWrapping="WrapWithOverflow" />
</ScrollViewer> </ScrollViewer>
</Grid> </Grid>
<Button Content="{Binding TextBtn}" HorizontalAlignment="Left" Margin="304,155,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click"/> <Button Content="{Binding TextBtn}" HorizontalAlignment="Left" Margin="304,155,0,0" VerticalAlignment="Top" Width="75" IsEnabled ="{Binding EnabBtn}" Click="Button_Click"/>
</Grid> </Grid>
</Window> </Window>

View File

@ -0,0 +1,14 @@
<UserControl x:Class="OliviaAddInPro.View.Configuracion.PropertyGridFilePickerDataset"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:OliviaAddInPro.View.Configuracion"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
x:Name="TheControl">
<DockPanel>
<Button x:Name="PickFileButton" Content="…" Click="PickFileButton_Click" DockPanel.Dock="Right" Width="15" />
<TextBox Text="{Binding ElementName=TheControl, Path=Value}" />
</DockPanel>
</UserControl>

View File

@ -0,0 +1,63 @@
using Microsoft.Win32;
using OliviaAddInPro.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Xceed.Wpf.Toolkit.PropertyGrid;
using Xceed.Wpf.Toolkit.PropertyGrid.Editors;
using static OliviaAddInPro.Helper.HelperGdb;
namespace OliviaAddInPro.View.Configuracion
{
/// <summary>
/// Lógica de interacción para PropertyGridFilePicker.xaml
/// </summary>
public partial class PropertyGridFilePickerDataset : ITypeEditor
{
public PropertyGridFilePickerDataset()
{
InitializeComponent();
}
public string Value
{
get { return (string)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
// Using a DependencyProperty as the backing store for Value. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(string), typeof(PropertyGridFilePickerDataset), new PropertyMetadata(null));
public FrameworkElement ResolveEditor(PropertyItem propertyItem)
{
Binding binding = new Binding("Value");
binding.Source = propertyItem;
binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
BindingOperations.SetBinding(this, ValueProperty, binding);
return this;
}
private void PickFileButton_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog fd = new OpenFileDialog();
var st = HelperGdb.OpenFileDialog(TiposOpenFileDlg.OpenDataset, Value);
if (!string.IsNullOrEmpty(st))
{
Value = st;
}
}
}
}

View File

@ -47,7 +47,7 @@
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</ListBox> </ListBox>
<CheckBox x:Name="checkBox_sentidocirc" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" <CheckBox x:Name="checkBox_sentidocirc" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}"
Content="Respeta el sentido de circulación" IsChecked="{Binding RespSentCirc}" HorizontalAlignment="Left" Margin="20,5,0,0" VerticalAlignment="Top"/> Content="Respeta el sentido de circulación" IsChecked="{Binding RespCirc}" HorizontalAlignment="Left" Margin="20,5,0,0" VerticalAlignment="Top"/>
<Grid Margin="0,5,0,0"> <Grid Margin="0,5,0,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>

View File

@ -3,6 +3,7 @@ using OliviaAddInPro.Model.contract;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -11,10 +12,19 @@ namespace OliviaAddInPro
{ {
public class MarchandoUnaDeViewModel : PropertyChangedBase, IprocessManager public class MarchandoUnaDeViewModel : PropertyChangedBase, IprocessManager
{ {
string[] barColors = {"Green","Red","Yellow" };
enum barColorNum
{
BarColorsVerde=0,
BarColorsRojo,
BarColorsAmarillo
}
public MarchandoUnaDeViewModel() public MarchandoUnaDeViewModel()
{ {
Cancelado = false; Cancelado = false;
textBtn = "Cancelar"; textBtn = "Cancelar";
enabBtn = true;
colorBar = System.Windows.Media.Brushes.Green;
} }
public bool Cancelado { get; set; } public bool Cancelado { get; set; }
@ -38,14 +48,28 @@ namespace OliviaAddInPro
set { base.SetProperty(ref textBtn, value, () => TextBtn); } set { base.SetProperty(ref textBtn, value, () => TextBtn); }
} }
private double progreso; private bool enabBtn;
public bool EnabBtn
{
get { return enabBtn; }
set { base.SetProperty(ref enabBtn, value, () => EnabBtn); }
}
private double progreso;
public double Progreso public double Progreso
{ {
get { return progreso; } get { return progreso; }
set { base.SetProperty(ref progreso, value, () => Progreso); } set { base.SetProperty(ref progreso, value, () => Progreso); }
} }
private System.Windows.Media.Brush colorBar;
public System.Windows.Media.Brush ColorBar
{
get { return colorBar; }
set { base.SetProperty(ref colorBar, value, () => ColorBar);
}
}
void IprocessManager.SetProceso(string proceso) void IprocessManager.SetProceso(string proceso)
{ {
TextProceso = proceso; TextProceso = proceso;
@ -53,6 +77,10 @@ namespace OliviaAddInPro
void IprocessManager.Inicia() void IprocessManager.Inicia()
{ {
Cancelado = false; Cancelado = false;
TextBtn = "Cancelar";
EnabBtn = true;
ColorBar = System.Windows.Media.Brushes.Green;
} }
void IprocessManager.SetEstado(string estado) void IprocessManager.SetEstado(string estado)
{ {
@ -88,6 +116,18 @@ namespace OliviaAddInPro
else else
TextProceso = "Proceso finalizado."; TextProceso = "Proceso finalizado.";
Cancelado = true; Cancelado = true;
//deshabilita el botón
EnabBtn = false;
}
void IprocessManager.PonBarColorVerde()
{
ColorBar = System.Windows.Media.Brushes.Green;
}
void IprocessManager.PonBarColorRojo()
{
Progreso = 100;
ColorBar = System.Windows.Media.Brushes.Red;
} }
} }

View File

@ -14,6 +14,7 @@ using ArcGIS.Desktop.Framework.Contracts;
using ArcGIS.Desktop.Framework.Dialogs; using ArcGIS.Desktop.Framework.Dialogs;
using ArcGIS.Desktop.Framework.Threading.Tasks; using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Desktop.Mapping; using ArcGIS.Desktop.Mapping;
using OliviaAddInPro.Model;
namespace OliviaAddInPro namespace OliviaAddInPro
{ {
@ -23,7 +24,7 @@ namespace OliviaAddInPro
{ {
numPtosCtrl = numSect = 3; numPtosCtrl = numSect = 3;
checkAjustSect = checkSectAuto = false; checkAjustSect = checkSectAuto = false;
checkIgnoAis = false; checkIgnoAis = LimpiezaDef.Parametros.igno_ais;
enableNSect = true; enableNSect = true;
} }

View File

@ -14,6 +14,7 @@ using ArcGIS.Desktop.Framework.Contracts;
using ArcGIS.Desktop.Framework.Dialogs; using ArcGIS.Desktop.Framework.Dialogs;
using ArcGIS.Desktop.Framework.Threading.Tasks; using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Desktop.Mapping; using ArcGIS.Desktop.Mapping;
using OliviaAddInPro.Model;
namespace OliviaAddInPro namespace OliviaAddInPro
{ {
@ -21,12 +22,12 @@ namespace OliviaAddInPro
{ {
public PaneLimpiezaSub4ViewModel() public PaneLimpiezaSub4ViewModel()
{ {
textPercentTrafico = 80; textPercentTrafico = LimpiezaDef.Parametros.reduc_traf;
timeCargDesc = 40; timeCargDesc = LimpiezaDef.Parametros.t_cardesc;
timeDespIniFin = 25; timeDespIniFin = LimpiezaDef.Parametros.t_desp;
timeIniJornada = 7 * 60 + 30; timeIniJornada = LimpiezaDef.Parametros.h_inicio;
timeJornadaConv = 8 * 60; timeJornadaConv = LimpiezaDef.Parametros.t_conv;
timeDescPers = 30; timeDescPers = LimpiezaDef.Parametros.t_descanso;
} }

View File

@ -194,7 +194,7 @@ namespace OliviaAddInPro
OliviaGlob.Limp.ProgrSrc._ProgrSrc.SetEstado(""); OliviaGlob.Limp.ProgrSrc._ProgrSrc.SetEstado("");
OliviaGlob.Limp.ProgrSrc._ProgrSrc.SetProgress(0); OliviaGlob.Limp.ProgrSrc._ProgrSrc.SetProgress(0);
OliviaGlob.Limp.ProgrSrc._ProgrSrc.SetTextBtn("Cancelar"); OliviaGlob.Limp.ProgrSrc._ProgrSrc.SetTextBtn("Cancelar");
OliviaGlob.Limp.ProgrSrc._ProgrSrc.PonBarColorVerde();
//oculta la ventana //oculta la ventana
OliviaGlob.ShowHidePane(false); OliviaGlob.ShowHidePane(false);

View File

@ -247,6 +247,7 @@ namespace OliviaAddInPro
OliviaGlob.Limp.ProgrSrc._ProgrSrc.SetEstado(""); OliviaGlob.Limp.ProgrSrc._ProgrSrc.SetEstado("");
OliviaGlob.Limp.ProgrSrc._ProgrSrc.SetProgress(0); OliviaGlob.Limp.ProgrSrc._ProgrSrc.SetProgress(0);
OliviaGlob.Limp.ProgrSrc._ProgrSrc.SetTextBtn("Cancelar"); OliviaGlob.Limp.ProgrSrc._ProgrSrc.SetTextBtn("Cancelar");
OliviaGlob.Limp.ProgrSrc._ProgrSrc.PonBarColorVerde();
//oculta la ventana //oculta la ventana
OliviaGlob.ShowHidePane(false); OliviaGlob.ShowHidePane(false);