Terminada ventana recogida, falta hacer purebas con combos, que funcionan regu.
Empezada lectura de parámetros para exportación.ConfiguracionSimplificada
parent
f793f5bf05
commit
78f9bdce1e
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -29,5 +29,12 @@ namespace OliviaAddInPro.Model
|
|||
public static string atr_N; //<Atributo del campo Oneway que indica NONE
|
||||
public static string atr_pedes; //<Atributo del campo FOW que indica peatonal
|
||||
};
|
||||
|
||||
public class TareaRes
|
||||
{
|
||||
public bool Errores { get; set; }
|
||||
public object data { get; set; }
|
||||
public string msg { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ using System.Collections.ObjectModel;
|
|||
using ArcGIS.Core.CIM;
|
||||
using ArcGIS.Core.Data;
|
||||
using OliviaAddInPro.Services;
|
||||
using static OliviaAddInPro.Model.LimpiezaDef;
|
||||
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
||||
using static OliviaAddInPro.Model.ComunDef;
|
||||
using ArcGIS.Desktop.Framework.Contracts;
|
||||
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
||||
|
||||
namespace OliviaAddInPro.Model
|
||||
{
|
||||
|
|
@ -52,15 +52,6 @@ namespace OliviaAddInPro.Model
|
|||
else if (modo == ModosEjec.Planifica)
|
||||
res = Serv.Planifica(cps);
|
||||
return res;
|
||||
/*if(!res)
|
||||
{
|
||||
string msg;
|
||||
if (Serv.ErrStr.Length > 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<TareaRes> ffin)
|
||||
{
|
||||
|
|
@ -71,7 +62,7 @@ namespace OliviaAddInPro.Model
|
|||
var res = Ejecuta(modo, cps);
|
||||
ffin(res);
|
||||
return res;
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,19 +5,94 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using OliviaAddInPro.Helper;
|
||||
using OliviaAddInPro.Services;
|
||||
using ArcGIS.Core.Geometry;
|
||||
using static OliviaAddInPro.Model.ComunDef;
|
||||
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
||||
|
||||
namespace OliviaAddInPro.Model
|
||||
{
|
||||
class Recogida : TratamientoComun
|
||||
{
|
||||
//**********************************************
|
||||
//Se recogen en PaneRecogidaSub1
|
||||
/**
|
||||
* Tipo de fracción
|
||||
*/
|
||||
public int TipoFrac { get; set; } = -1;
|
||||
/**
|
||||
* Tipo de fracción
|
||||
*/
|
||||
public string TipoFracStr { get; set; } = string.Empty;
|
||||
/**
|
||||
* Tipo de carga
|
||||
*/
|
||||
public int TipoCarg { get; set; } = -1;
|
||||
/**
|
||||
* Tipo de carga
|
||||
*/
|
||||
public string TipoCargStr { get; set; } = string.Empty;
|
||||
/**
|
||||
* Tipo de Vehículo
|
||||
*/
|
||||
public int TipoVehic { get; set; } = -1;
|
||||
/**
|
||||
* Tipo de Lateralidad
|
||||
*/
|
||||
public int TipoLate { get; set; } = -1;
|
||||
/**
|
||||
* kg capac camión
|
||||
*/
|
||||
public int KgMaxVehic { get; set; } = 0;
|
||||
/**
|
||||
* dens contenedor
|
||||
*/
|
||||
public int DensCont { get; set; } = 0;
|
||||
/**
|
||||
* Tiempo de vaciado del contenedor, en seg
|
||||
*/
|
||||
public int TVaciCont { get; set; } = 0;
|
||||
/**
|
||||
* kg de carga en cada contenedor
|
||||
*/
|
||||
public int KgCont { get; set; } = 0;
|
||||
/**
|
||||
* grados en º de giro del vehículo
|
||||
*/
|
||||
public int GiroVehic { get; set; } = 0;
|
||||
/**
|
||||
* Coordenadas de la planta de descarga
|
||||
*/
|
||||
public Coordinate2D CoordsPlanta { get; set; } = new Coordinate2D(0, 0);
|
||||
|
||||
public RecogidaServ Serv { get; set; } = null;
|
||||
public Recogida()
|
||||
{
|
||||
Serv = new RecogidaServ(this);
|
||||
}
|
||||
|
||||
public void Ejecuta(ModosEjec modo)
|
||||
|
||||
public TareaRes Ejecuta(ModosEjec modo, CancelableProgressorSource cps)
|
||||
{
|
||||
TareaRes res = null;
|
||||
if (modo == ModosEjec.Sectoriza)
|
||||
res = Serv.Sectoriza(cps);
|
||||
else if (modo == ModosEjec.Planifica)
|
||||
res = Serv.Planifica(cps);
|
||||
return res;
|
||||
|
||||
}
|
||||
public async void EjecutaAsync(ModosEjec modo, CancelableProgressorSource cps, Action<TareaRes> ffin)
|
||||
{
|
||||
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
||||
{
|
||||
cps.Status = "Procesando";
|
||||
cps.Value = 0;
|
||||
var res = Ejecuta(modo, cps);
|
||||
ffin(res);
|
||||
return res;
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,5 +108,6 @@ namespace OliviaAddInPro.Model
|
|||
}
|
||||
set { err_str = value;}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,5 +216,15 @@ namespace OliviaAddInPro.Services
|
|||
ErrStr = "";
|
||||
return mal;
|
||||
}
|
||||
|
||||
public bool ComprCamposPlanif(string pathCapa)
|
||||
{
|
||||
int NCAMPS = 2;
|
||||
string[] camps;
|
||||
camps = new string[NCAMPS];
|
||||
camps[0] = LimpiezaDef.Campos.consulta_sector;
|
||||
camps[1] = LimpiezaDef.Campos.consulta_secuen;
|
||||
return CompruebaCampos(pathCapa, camps) == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using static OliviaAddInPro.Model.LimpiezaDef;
|
||||
using static OliviaAddInPro.Model.ComunDef;
|
||||
|
||||
namespace OliviaAddInPro.Services
|
||||
{
|
||||
|
|
@ -174,15 +174,6 @@ namespace OliviaAddInPro.Services
|
|||
return true;*/
|
||||
|
||||
}
|
||||
public bool ComprCamposPlanif(string pathCapa)
|
||||
{
|
||||
int NCAMPS = 2;
|
||||
string[] camps;
|
||||
camps = new string[NCAMPS];
|
||||
camps[0] = LimpiezaDef.Campos.consulta_sector;
|
||||
camps[1] = LimpiezaDef.Campos.consulta_secuen;
|
||||
return CompruebaCampos(pathCapa, camps)==0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Lee la capa que se ha seleccionzdo de limpieza y se comprueba que contiene los campos necesarios
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ using System.Threading.Tasks;
|
|||
using OliviaAddInPro.Helper;
|
||||
using OliviaAddInPro.Model;
|
||||
using System.Collections.ObjectModel;
|
||||
using static OliviaAddInPro.Model.ComunDef;
|
||||
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
||||
|
||||
namespace OliviaAddInPro.Services
|
||||
{
|
||||
|
|
@ -53,5 +55,152 @@ namespace OliviaAddInPro.Services
|
|||
return valores;
|
||||
}
|
||||
|
||||
/**
|
||||
* Acciones para comenzar ejecución
|
||||
* Modo 0, sectorizar
|
||||
* Modo 1, planificar
|
||||
*/
|
||||
public TareaRes Sectoriza(CancelableProgressorSource cps)
|
||||
{
|
||||
var res = new TareaRes()
|
||||
{
|
||||
Errores = false,
|
||||
data = null,
|
||||
msg = ""
|
||||
};
|
||||
|
||||
com = (TratamientoComun)reco;
|
||||
string nombFileAmbs = string.Empty;
|
||||
cps.Status = "Preparando filtro para la exportacion";
|
||||
//Prepara consulta
|
||||
ErrStr = string.Empty;
|
||||
|
||||
if (!PreparaConsulta(out nombFileAmbs))
|
||||
{
|
||||
res.msg = "No se ha seleccionado una consulta válida" + reco.ConsultaAmbs;
|
||||
res.Errores = true;
|
||||
return res;
|
||||
}
|
||||
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;
|
||||
|
||||
string msg = "";
|
||||
//comienza ejecucion
|
||||
if (!ComienzaEjec(ModosEjec.Sectoriza, cps, out msg))
|
||||
{
|
||||
res.Errores = true;
|
||||
res.msg = msg;
|
||||
return res;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
public bool PreparaConsulta(out string nombFileAmbs)
|
||||
{
|
||||
nombFileAmbs = string.Empty;
|
||||
reco.ConsultaAmbs = DameAmbsConsulta(out nombFileAmbs);
|
||||
if (string.IsNullOrEmpty(reco.ConsultaAmbs))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public TareaRes Planifica(CancelableProgressorSource cps)
|
||||
{
|
||||
TareaRes res = new TareaRes()
|
||||
{
|
||||
Errores = false,
|
||||
msg = "",
|
||||
data = null
|
||||
};/*
|
||||
//se asegura que tiene todo para planif
|
||||
//ErrStr = string.Empty;
|
||||
if (!CompruebaPlanif())
|
||||
{
|
||||
res.msg = "En la capa de ámbitos seleccionada no se encuentran columnas de SECTOR y/o SECUENCIA, necesarias para planificar";
|
||||
res.Errores = true;
|
||||
return res;
|
||||
}
|
||||
//Prepara consulta
|
||||
string nombFileAmbs = string.Empty;
|
||||
//Prepara consulta
|
||||
if (!PreparaConsulta(out nombFileAmbs))
|
||||
{
|
||||
res.msg = "No se ha seleccionado una consulta válida" + reco.ConsultaAmbs;
|
||||
res.Errores = true;
|
||||
return res;
|
||||
}*/
|
||||
|
||||
return res;
|
||||
}
|
||||
public string DameAmbsConsulta(out string ambs_file)
|
||||
{
|
||||
string consulta, orstr;
|
||||
|
||||
consulta = string.Empty;
|
||||
ambs_file = "";
|
||||
/*orstr = null;
|
||||
var n = reco.AmbitosSel.Length;
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (limp.AmbitosSel[i])
|
||||
{
|
||||
consulta = consulta + orstr + "(" + LimpiezaDef.filtro_str[i] + ")";
|
||||
ambs_file = ambs_file + i.ToString("00");
|
||||
if (orstr == null)
|
||||
orstr = " OR ";
|
||||
}
|
||||
}
|
||||
ambs_file = "_A" + ambs_file;
|
||||
if (consulta == "()")
|
||||
consulta = "";
|
||||
*/
|
||||
return consulta;
|
||||
}
|
||||
/**
|
||||
* Comprueba lo necesario para ver si hay campos para la planificación
|
||||
*/
|
||||
public bool CompruebaPlanif()
|
||||
{
|
||||
|
||||
//si ha importado no hace falta que compruebe, seguro que las tiene
|
||||
if (OliviaGlob.IsConfig2())
|
||||
return true;
|
||||
//no ha importado, comprueba capa
|
||||
if (ComprCamposPlanif(reco.CapaElems))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Rellena el array de filtros en base a la config
|
||||
*/
|
||||
public void RellenaFiltrosReco()
|
||||
{
|
||||
//se rellena el array de filtros
|
||||
RecogidaDef.filtro_str = new string[RecogidaDef.tipos_fracc_str.Length + RecogidaDef.tipos_carg_str.Length];
|
||||
for (int i = 0; i < RecogidaDef.tipos_fracc_str.Length; i++)
|
||||
{
|
||||
//se comprueba que tipo de fracción se ha seleccionado. Si se ha seleccionado una fracción sin nombre (el campo en la capa es NULL, y en el comboBox de fracciiones aparece como "-") hay que modificar el filtro
|
||||
if (RecogidaDef.tipos_fracc_str[i] == "-")
|
||||
RecogidaDef.filtro_str[i] = RecogidaDef.campos_def.cons_fracc + " IS NULL";
|
||||
else
|
||||
RecogidaDef.filtro_str[i] = RecogidaDef.campos_def.cons_fracc + "= '" + RecogidaDef.tipos_fracc_str[i] + "'";
|
||||
}
|
||||
for (int i = RecogidaDef.tipos_fracc_str.Length; i < RecogidaDef.filtro_str.Length; i++)
|
||||
{
|
||||
RecogidaDef.filtro_str[i] = RecogidaDef.campos_def.cons_nomrec + "= '" + RecogidaDef.tipos_carg_str[i - RecogidaDef.tipos_fracc_str.Length] + "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="button_secto" Grid.Column="1" Style="{DynamicResource Esri_Button}" Content="Sectorizar" Margin="10,0,10,0" Click="button_secto_Click"/>
|
||||
<Button x:Name="button_planif" Grid.Column="2" Style="{DynamicResource Esri_Button}" Content="Planificar" Margin="10,0,10,0" Click="button_planif_Click"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ContentPresenter.Content>
|
||||
</ContentPresenter>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
</Button>
|
||||
<Label x:Name="label_caparestr" Content="{Binding Path=LblCapaRestr, Mode = TwoWay}" Grid.Column="1" HorizontalAlignment="Left" Margin="13,0,-33,0" VerticalAlignment="Top" Width="221" Height="30" Grid.ColumnSpan="2"/>
|
||||
</Grid>
|
||||
<Label Margin="15,0,0,0" Content="Niveles" FontWeight="DemiBold"/>
|
||||
<Label Margin="15,0,0,0" Content="{Binding Path=TextLblNiv, Mode = TwoWay}" FontWeight="DemiBold"/>
|
||||
<Grid Margin="0,0,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="45"/>
|
||||
|
|
|
|||
|
|
@ -38,53 +38,10 @@ namespace OliviaAddInPro
|
|||
e.Handled = !PanelGlobal.IsValid(((TextBox)sender).Text + e.Text,0,9999);
|
||||
}
|
||||
|
||||
/*
|
||||
* Saca ventana para seleccionar el campo del que leer para elegir la geometría
|
||||
*/
|
||||
private ArcGIS.Core.Geometry.Geometry SelecLeeGeom(FeatureClass fc, out string _texto, bool multisel)
|
||||
{
|
||||
ArcGIS.Core.Geometry.Geometry geomsal = null;
|
||||
string texto = "";
|
||||
|
||||
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;
|
||||
texto = HelperGdb.TextoSal;
|
||||
}
|
||||
}
|
||||
|
||||
_texto = texto;
|
||||
return geomsal;
|
||||
}
|
||||
|
||||
private ArcGIS.Core.Geometry.Geometry AbreGeom(out string texto)
|
||||
{
|
||||
//inicialmente
|
||||
ArcGIS.Core.Geometry.Geometry geom = null;
|
||||
texto = Resource1.String_selec_capa;
|
||||
|
||||
//abre
|
||||
FeatureClass fc = HelperGdb.OpenFtClassDialog(HelperGdb.TiposOpenFileDlg.OpenFtrClassPolygon);
|
||||
if (fc != null)
|
||||
{
|
||||
//hace geom
|
||||
geom = SelecLeeGeom(fc, out texto, true);
|
||||
if (geom == null && (HelperGdb.OutStr.Length > 0))
|
||||
HelperGlobal.ponMsg(HelperGdb.OutStr, System.Windows.MessageBoxImage.Error);
|
||||
|
||||
HelperGdb.Free(fc);
|
||||
}
|
||||
return geom;
|
||||
}
|
||||
|
||||
private void button_caparestr_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string texto = "";
|
||||
ArcGIS.Core.Geometry.Geometry geom = AbreGeom(out texto);
|
||||
ArcGIS.Core.Geometry.Geometry geom = HelperGdb.OpenGeom(HelperGdb.TiposOpenFileDlg.OpenFtrClassPolygon, out texto);
|
||||
if (DataContext is PaneLimpiezaSub2ViewModel mod)
|
||||
{
|
||||
mod.GeomRestr = geom;
|
||||
|
|
@ -98,7 +55,7 @@ namespace OliviaAddInPro
|
|||
private void button_capaniv_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string texto = "";
|
||||
ArcGIS.Core.Geometry.Geometry geom = AbreGeom(out texto);
|
||||
ArcGIS.Core.Geometry.Geometry geom = HelperGdb.OpenGeom(HelperGdb.TiposOpenFileDlg.OpenFtrClassPolygon, out texto);
|
||||
if (DataContext is PaneLimpiezaSub2ViewModel mod)
|
||||
{
|
||||
mod.GeomNiv = geom;
|
||||
|
|
@ -112,7 +69,7 @@ namespace OliviaAddInPro
|
|||
private void button_capazon_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string texto = "";
|
||||
ArcGIS.Core.Geometry.Geometry geom = AbreGeom(out texto);
|
||||
ArcGIS.Core.Geometry.Geometry geom = HelperGdb.OpenGeom(HelperGdb.TiposOpenFileDlg.OpenFtrClassPolygon, out texto);
|
||||
if (DataContext is PaneLimpiezaSub2ViewModel mod)
|
||||
{
|
||||
mod.GeomZon = geom;
|
||||
|
|
@ -128,7 +85,7 @@ namespace OliviaAddInPro
|
|||
{
|
||||
string texto = "";
|
||||
|
||||
ArcGIS.Core.Geometry.Geometry geomsal = AbreGeom(out texto);
|
||||
ArcGIS.Core.Geometry.Geometry geomsal = HelperGdb.OpenGeom(HelperGdb.TiposOpenFileDlg.OpenFtrClassPoint, out texto);
|
||||
|
||||
if ((DataContext is PaneLimpiezaSub2ViewModel mod) && geomsal != null && geomsal is MapPoint mp)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"
|
||||
xmlns:ui="clr-namespace:OliviaAddInPro"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300"
|
||||
d:DesignHeight="450" d:DesignWidth="300"
|
||||
d:DataContext="{Binding Path=ui.PaneLimpiezaSub4ViewModel}">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
<ColumnDefinition Width="180"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="Carga y Descarga" HorizontalAlignment="Left" Margin="15,5,0,0" VerticalAlignment="Top" Width="177" Height="30" Grid.ColumnSpan="2"/>
|
||||
<Label Content="{Binding TextTCargDesc}" HorizontalAlignment="Left" Margin="15,5,0,0" VerticalAlignment="Top" Width="177" Height="30" Grid.ColumnSpan="2"/>
|
||||
<xctk:DateTimeUpDown Grid.Column="1" Height="20" Format="Custom" FormatString="HH 'h' mm 'm'" Value="{Binding Path=TimeCargDesc, Mode = TwoWay}" Margin="9,8,14,7"/>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,0">
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
<ColumnDefinition Width="180"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="Desplazamiento ini/fin" HorizontalAlignment="Left" Margin="15,5,0,0" VerticalAlignment="Top" Width="177" Height="30" Grid.ColumnSpan="2"/>
|
||||
<Label Content="{Binding TextTDesplIniFin}" HorizontalAlignment="Left" Margin="15,5,0,0" VerticalAlignment="Top" Width="177" Height="30" Grid.ColumnSpan="2"/>
|
||||
<xctk:DateTimeUpDown Grid.Column="1" Height="20" Format="Custom" FormatString="HH 'h' mm 'm'" Value="{Binding Path=TimeDespIniFin, Mode = TwoWay}" Margin="9,8,14,7"/>
|
||||
</Grid>
|
||||
<Grid Margin="0,0,0,0">
|
||||
|
|
|
|||
|
|
@ -63,14 +63,14 @@
|
|||
<ContentPresenter Name="PaneEjecutar">
|
||||
<ContentPresenter.Content>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Margin="0,10,0,0">
|
||||
<Grid Margin="0,10,0,0" Height="40 ">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="30"/>
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="button_secto" Grid.Column="1" Style="{DynamicResource Esri_Button}" Content="Sectorizar" Margin="10,0,10,0" Click="button_secto_Click"/>
|
||||
<Button x:Name="button_planif" Grid.Column="2" Style="{DynamicResource Esri_Button}" Content="Planificar" Margin="10,0,10,0" Click="button_planif_Click"/>
|
||||
<Button x:Name="button_secto" Grid.Column="1" Height="40 " Style="{DynamicResource Esri_Button}" Content="Sectorizar y Planif" Margin="10,0,10,0" Click="button_secto_Click" FontStretch="Condensed"/>
|
||||
<Button x:Name="button_planif" Grid.Column="2" Height="40 " Style="{DynamicResource Esri_Button}" Content="Solo Planificar" Margin="10,0,10,0" Click="button_planif_Click"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ContentPresenter.Content>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
|
||||
xmlns:ui="clr-namespace:OliviaAddInPro"
|
||||
mc:Ignorable="d" d:DesignWidth="300" Height="350"
|
||||
mc:Ignorable="d" d:DesignWidth="300" Height="390"
|
||||
d:DataContext="{Binding Path=ui.PaneRecogidaSub1ViewModel}" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded" >
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
|
|
@ -34,9 +34,9 @@
|
|||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox x:Name="comboBox_frac" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposFrac, Mode = TwoWay}" HorizontalAlignment="Left" Margin="0,0,0,0"
|
||||
<ComboBox x:Name="comboBox_frac" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposFrac}" HorizontalAlignment="Left" Margin="0,0,0,0"
|
||||
VerticalAlignment="Top" Width="150"
|
||||
SelectedIndex="{Binding Path=TipoFrac, Mode = TwoWay}" SelectionChanged="comboBox_frac_SelectionChanged">
|
||||
SelectionChanged="comboBox_frac_SelectionChanged" SelectedIndex="{Binding Path=TipoFrac, Mode = TwoWay}" >
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBoxItem IsEnabled="{Binding IsEnabled}" Content="{Binding Path=Item}"/>
|
||||
|
|
@ -51,9 +51,9 @@
|
|||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox x:Name="comboBox_tipoCarg" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposCarg, Mode = TwoWay}" HorizontalAlignment="Left" Margin="0,0,0,0"
|
||||
<ComboBox x:Name="comboBox_tipoCarg" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposCarg}" HorizontalAlignment="Left" Margin="0,0,0,0"
|
||||
VerticalAlignment="Top" Width="150"
|
||||
SelectedIndex="{Binding Path=TipoCarg, Mode = TwoWay}" SelectionChanged="comboBox_tipoCarg_SelectionChanged">
|
||||
SelectionChanged="comboBox_tipoCarg_SelectionChanged" SelectedIndex="{Binding Path=TipoCarg, Mode = TwoWay}" >
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBoxItem IsEnabled="{Binding IsEnabled}" Content="{Binding Path=Item}"/>
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
<Label Content="Tipo de vehículo" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.391,-0.203" FontWeight="DemiBold"/>
|
||||
<ComboBox x:Name="comboBox_tipoVehic" IsEnabled="{Binding CapaAbierta, Mode=TwoWay}" ItemsSource="{Binding TiposVehic, Mode=TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0"
|
||||
VerticalAlignment="Top" Width="150"
|
||||
SelectedIndex="{Binding TipoVehic, Mode=TwoWay}" SelectionChanged="comboBox_tipoVehic_SelectionChanged"/>
|
||||
SelectedIndex="{Binding TipoVehic}" SelectionChanged="comboBox_tipoVehic_SelectionChanged"/>
|
||||
<Label Content="Capacidad" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.391,-0.203" FontWeight="DemiBold"/>
|
||||
<Grid Margin="20,0,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
|
@ -77,10 +77,31 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
<ComboBox x:Name="comboBox_tipoCapac" IsEnabled="{Binding EnabComboCapac, Mode=TwoWay}" ItemsSource="{Binding TiposCapac, Mode=TwoWay}" HorizontalAlignment="Left" Margin="0,0,0,0"
|
||||
VerticalAlignment="Top" Width="75"
|
||||
SelectedIndex="{Binding TipoCapac, Mode=TwoWay}" SelectionChanged="comboBox_tipoCapac_SelectionChanged"/>
|
||||
<TextBox x:Name="txtBox_kgCapac" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" Grid.Column="1" Margin="5,0,0,8" TextWrapping="NoWrap" Text="{Binding Path=TextKgCapac, Mode = TwoWay}" TextAlignment="Right" MaxLength="4" PreviewTextInput="txtBox_kgCapac_PreviewTextInput"/>
|
||||
<Label x:Name="label_kgmax" Grid.Column="2" Content="kg máx. por viaje" Margin="0,0,0,4"/>
|
||||
SelectedIndex="{Binding TipoCapac}" SelectionChanged="comboBox_tipoCapac_SelectionChanged"/>
|
||||
<TextBox x:Name="txtBox_kgCapac" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" Grid.Column="1" Margin="5,0,0,3" TextWrapping="NoWrap" Text="{Binding Path=TextKgCapac, Mode = TwoWay}" TextAlignment="Right" MaxLength="4" PreviewTextInput="txtBox_kgCapac_PreviewTextInput"/>
|
||||
<Label x:Name="label_kgmax" Grid.Column="2" Content="kg máx. por viaje" Margin="0,-1,0,0"/>
|
||||
</Grid>
|
||||
<Label Content="Tiempo de vaciado de contenedor" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.391,-0.203" FontWeight="DemiBold"/>
|
||||
<Grid Margin="20,0,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" Margin="0,0,0,8" TextWrapping="NoWrap" Text="{Binding Path=TextTVaci, Mode = TwoWay}" TextAlignment="Right" MaxLength="3" PreviewTextInput="TextBox_PreviewTextInput"/>
|
||||
<Label Grid.Column="1" Content="seg." Margin="0,-3,0,8"/>
|
||||
</Grid>
|
||||
<Label Margin="15,0,0,0" Content="Planta de descarga" FontWeight="DemiBold"/>
|
||||
<Grid Margin="0,0,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="45"/>
|
||||
<ColumnDefinition Width="200"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="button_capaplant" Content="" HorizontalAlignment="Left" Margin="20,3,0,0" VerticalAlignment="Top" Width="16" Height="16" BorderThickness="0" Click="button_capaplant_Click">
|
||||
<Button.Background>
|
||||
<ImageBrush ImageSource="../../Images/openfolder.png"/>
|
||||
</Button.Background>
|
||||
</Button>
|
||||
<Label x:Name="label_capaplant" Content="{Binding Path=LblCapaPlant, Mode = TwoWay}" Grid.Column="1" HorizontalAlignment="Left" Margin="13,0,-33,0" VerticalAlignment="Top" Width="221" Height="30" Grid.ColumnSpan="2"/>
|
||||
</Grid>
|
||||
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ using System.Windows.Shapes;
|
|||
using ArcGIS.Desktop.Core;
|
||||
using ArcGIS.Desktop.Internal.Framework.Controls;
|
||||
using OliviaAddInPro.Helper;
|
||||
using ArcGIS.Core.Geometry;
|
||||
|
||||
namespace OliviaAddInPro
|
||||
{
|
||||
|
|
@ -72,7 +73,8 @@ namespace OliviaAddInPro
|
|||
|
||||
if (DataContext is PaneRecogidaSub1ViewModel mod)
|
||||
{
|
||||
mod.ComboFracSel(i);
|
||||
if (!mod.ComboFracSel(i))
|
||||
combo.SelectedIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +89,8 @@ namespace OliviaAddInPro
|
|||
|
||||
if (DataContext is PaneRecogidaSub1ViewModel mod)
|
||||
{
|
||||
mod.ComboCargSel(i);
|
||||
if(!mod.ComboCargSel(i))
|
||||
combo.SelectedIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -122,12 +125,42 @@ namespace OliviaAddInPro
|
|||
|
||||
private void txtBox_densCont_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
|
||||
e.Handled = !PanelGlobal.IsValid(((TextBox)sender).Text + e.Text, 0, 999);
|
||||
}
|
||||
|
||||
private void comboBox_tipoLat_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
int i = -1;
|
||||
if (sender is System.Windows.Controls.ComboBox combo)
|
||||
{
|
||||
i = combo.SelectedIndex;
|
||||
|
||||
if (DataContext is PaneRecogidaSub1ViewModel mod)
|
||||
{
|
||||
mod.ComboLatSel(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
e.Handled = !PanelGlobal.IsValid(((TextBox)sender).Text + e.Text, 0, 999);
|
||||
}
|
||||
|
||||
private void button_capaplant_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string texto = "";
|
||||
|
||||
ArcGIS.Core.Geometry.Geometry geomsal = HelperGdb.OpenGeom(HelperGdb.TiposOpenFileDlg.OpenFtrClassPoint,out texto);
|
||||
|
||||
if ((DataContext is PaneRecogidaSub1ViewModel mod) && geomsal != null && geomsal is MapPoint mp)
|
||||
{
|
||||
mod.CoordsPlanta = mp.Coordinate2D;
|
||||
}
|
||||
if (geomsal != null)
|
||||
label_capaplant.Content = texto;
|
||||
else
|
||||
label_capaplant.Content = Resource1.String_selec_capa;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,12 @@ namespace OliviaAddInPro
|
|||
get { return txtBuffExport; }
|
||||
set { base.SetProperty(ref txtBuffExport, value, () => TxtBuffExport); }
|
||||
}
|
||||
private string textLblNiv = "Niveles";
|
||||
public string TextLblNiv
|
||||
{
|
||||
get { return textLblNiv; }
|
||||
set { base.SetProperty(ref textLblNiv, value, () => TextLblNiv); }
|
||||
}
|
||||
/**
|
||||
* Geometría para el filtro de ámbitos, incluye zonas, se añaden los ámbitos que pertenecen a esa geom
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -104,6 +104,18 @@ namespace OliviaAddInPro
|
|||
base.NotifyPropertyChanged("TimeDescPers");
|
||||
}
|
||||
}
|
||||
private string textTCargDesc="Carga y Descarga";
|
||||
public string TextTCargDesc
|
||||
{
|
||||
get { return textTCargDesc; }
|
||||
set { base.SetProperty(ref textTCargDesc, value, () => textTCargDesc); }
|
||||
}
|
||||
private string textTDesplIniFin = "Desplazamiento Ini/Fin";
|
||||
public string TextTDesplIniFin
|
||||
{
|
||||
get { return textTDesplIniFin; }
|
||||
set { base.SetProperty(ref textTDesplIniFin, value, () => TextTDesplIniFin); }
|
||||
}
|
||||
|
||||
#endregion Properties
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using System.Windows.Media.Imaging;
|
||||
using OliviaAddInPro.Helper;
|
||||
using static OliviaAddInPro.Model.LimpiezaDef;
|
||||
using static OliviaAddInPro.Model.ComunDef;
|
||||
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
||||
using ArcGIS.Desktop.Framework.Contracts;
|
||||
namespace OliviaAddInPro
|
||||
|
|
@ -165,7 +165,6 @@ namespace OliviaAddInPro
|
|||
|
||||
Action<TareaRes> ac = finEjecuta;
|
||||
OliviaGlob.Limp.EjecutaAsync(modo, progSrc, ac);
|
||||
//res.
|
||||
}
|
||||
public void finEjecuta(TareaRes res)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace OliviaAddInPro
|
|||
{
|
||||
private ObservableCollection<EnabledComboBoxItem<string>> tiposFrac = new ObservableCollection<EnabledComboBoxItem<string>>();
|
||||
private ObservableCollection<EnabledComboBoxItem<string>> tiposCarg = new ObservableCollection<EnabledComboBoxItem<string>>();
|
||||
private ObservableCollection<EnabledComboBoxItem<string>> tiposLate = new ObservableCollection<EnabledComboBoxItem<string>>();
|
||||
private ObservableCollection<string> tiposLate = new ObservableCollection<string>();
|
||||
private ObservableCollection<string> tiposVehic = new ObservableCollection<string>();
|
||||
private ObservableCollection<string> tiposCapac = new ObservableCollection<string>();
|
||||
private RecogidaServ recoServ = new RecogidaServ(null); //no hace falta instancia reco aquí
|
||||
|
|
@ -88,7 +88,7 @@ namespace OliviaAddInPro
|
|||
base.NotifyPropertyChanged("TiposCapac");
|
||||
}
|
||||
}
|
||||
public ObservableCollection<EnabledComboBoxItem<string>> TiposLate
|
||||
public ObservableCollection<string> TiposLate
|
||||
{
|
||||
get { return tiposLate; }
|
||||
set
|
||||
|
|
@ -110,7 +110,7 @@ namespace OliviaAddInPro
|
|||
private int tipoCarg = -1;
|
||||
public int TipoCarg
|
||||
{
|
||||
get { return tipoFrac; }
|
||||
get { return tipoCarg; }
|
||||
set
|
||||
{
|
||||
tipoCarg = value;
|
||||
|
|
@ -120,7 +120,7 @@ namespace OliviaAddInPro
|
|||
private int tipoVehic = -1;
|
||||
public int TipoVehic
|
||||
{
|
||||
get { return tipoFrac; }
|
||||
get { return tipoVehic; }
|
||||
set
|
||||
{
|
||||
tipoVehic = value;
|
||||
|
|
@ -147,7 +147,7 @@ namespace OliviaAddInPro
|
|||
base.NotifyPropertyChanged("TipoLate");
|
||||
}
|
||||
}
|
||||
private string textKgCapac;
|
||||
private string textKgCapac="";
|
||||
public string TextKgCapac
|
||||
{
|
||||
get { return textKgCapac; }
|
||||
|
|
@ -213,6 +213,22 @@ namespace OliviaAddInPro
|
|||
base.NotifyPropertyChanged("EnabComboCapac");
|
||||
}
|
||||
}
|
||||
private string textTVaci = "";
|
||||
public string TextTVaci
|
||||
{
|
||||
get { return textTVaci; }
|
||||
set { base.SetProperty(ref textTVaci, value, () => TextTVaci); }
|
||||
}
|
||||
private string lblCapaPlant = Resource1.String_selec_capa;
|
||||
public string LblCapaPlant
|
||||
{
|
||||
get { return lblCapaPlant; }
|
||||
set { base.SetProperty(ref lblCapaPlant, value, () => LblCapaPlant); }
|
||||
}
|
||||
/**
|
||||
* Coordenadas de la planta de descarga
|
||||
*/
|
||||
public Coordinate2D CoordsPlanta { get; set; } = new Coordinate2D(0, 0);
|
||||
/**
|
||||
* kg de carga en cada contenedor.
|
||||
* Si se cogen llenos, vale -1 (los kg son densidad_cont*capac).
|
||||
|
|
@ -298,6 +314,11 @@ namespace OliviaAddInPro
|
|||
{
|
||||
TiposVehic.Add(RecogidaDef.tipos_vehic_str[i]);
|
||||
}
|
||||
TiposLate.Clear();
|
||||
for (int i = 0; i < RecogidaDef.tipos_lateralidad.Length; i++)
|
||||
{
|
||||
TiposLate.Add(RecogidaDef.tipos_lateralidad[i]);
|
||||
}
|
||||
TiposCapac.Clear();
|
||||
|
||||
//hay elementos en la gdb
|
||||
|
|
@ -371,7 +392,6 @@ namespace OliviaAddInPro
|
|||
{
|
||||
System.Array.Resize(ref RecogidaDef.tipos_carg_str, RecogidaDef.tipos_carg_str.Length + 1);
|
||||
System.Array.Resize(ref tipos_carg_bool, tipos_carg_bool.Length + 1);
|
||||
//reco.tipos_carg_bool[i] = false;
|
||||
RecogidaDef.tipos_carg_str[RecogidaDef.tipos_carg_str.Length - 1] = valores[i];
|
||||
tipos_carg_bool[tipos_carg_bool.Length - 1] = true;
|
||||
}
|
||||
|
|
@ -385,11 +405,15 @@ namespace OliviaAddInPro
|
|||
/**
|
||||
* Realiza los cambios en los ámbitos cuando se ha seleccionado una fracción
|
||||
*/
|
||||
public void ComboFracSel(int tto)
|
||||
public bool ComboFracSel(int tto)
|
||||
{
|
||||
if (tto < 0)
|
||||
return;
|
||||
|
||||
return false;
|
||||
if (!tipos_fracc_bool[tto])
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
//cuando se selecciona un item pintado en gris (que no existe en la GDB) se actúa como si no se hubiera seleccionado item
|
||||
|
|
@ -414,8 +438,9 @@ namespace OliviaAddInPro
|
|||
catch (Exception)
|
||||
{
|
||||
HelperGlobal.ponMsg("Error al seleccionar el tipo de fracción");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
/**
|
||||
|
|
@ -492,10 +517,15 @@ namespace OliviaAddInPro
|
|||
/**
|
||||
* Realiza los cambios en los ámbitos cuando se ha seleccionado un tipo de carga
|
||||
*/
|
||||
public void ComboCargSel(int tto)
|
||||
public bool ComboCargSel(int tto)
|
||||
{
|
||||
VisCombLate = Visibility.Hidden;
|
||||
if (tto < 0)
|
||||
return;
|
||||
return false;
|
||||
if (!tipos_carg_bool[tto])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
TipoCarg=tto;
|
||||
|
|
@ -503,12 +533,12 @@ namespace OliviaAddInPro
|
|||
if (TipoCarg == (int)RecogidaDef.TiposCarga.Lateral)
|
||||
VisCombLate = Visibility.Visible;
|
||||
else
|
||||
visCombLate = Visibility.Hidden;
|
||||
VisCombLate = Visibility.Hidden;
|
||||
if (TipoCarg >= 0 && TipoCarg < (int)RecogidaDef.TiposCarga.N - 1)
|
||||
{
|
||||
//cuando se selecciona una carga contemplada en el listado origianl se habilita el comboBox de capacidad ya que sí habrá contemplado datos para tipos de cargas conocidos.
|
||||
enabComboCapacFrac = true;
|
||||
//textBox_t_vaciado.Text = RecogidaDef.t_vaci[TipoCarg].ToString();
|
||||
EnabComboCapacFrac = true;
|
||||
TextTVaci = RecogidaDef.t_vaci[TipoCarg].ToString();
|
||||
if (TipoVehic >= 0)
|
||||
{
|
||||
//si también se ha seleccionado tipo de vehículo, se rellena la lista de capacidades
|
||||
|
|
@ -518,8 +548,8 @@ namespace OliviaAddInPro
|
|||
else if (TipoCarg >= (int)RecogidaDef.TiposCarga.N - 1)
|
||||
{
|
||||
//cuando se selecciona una carga no contemplada en el listado original se deshabilita el comboBox de capacidad porque no tendrá datos contemplado para ese caso
|
||||
enabComboCapacFrac = false;
|
||||
//textBox_t_vaciado.Text = RecogidaDef.t_vaci[(int)RecogidaDef.TiposCarga.Otra].ToString();
|
||||
EnabComboCapacFrac = false;
|
||||
TextTVaci = RecogidaDef.t_vaci[(int)RecogidaDef.TiposCarga.Otra].ToString();
|
||||
if (TipoVehic >= 0)
|
||||
{
|
||||
//si también se ha seleccionado tipo de vehículo, se rellena la lista de capacidades
|
||||
|
|
@ -530,8 +560,9 @@ namespace OliviaAddInPro
|
|||
catch (Exception)
|
||||
{
|
||||
HelperGlobal.ponMsg("Error al seleccionar la carga");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Realiza los cambios en los ámbitos cuando se ha seleccionado un tipo de vehículo
|
||||
|
|
@ -574,5 +605,22 @@ namespace OliviaAddInPro
|
|||
return;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Realiza los cambios en los ámbitos cuando se ha seleccionado el tipo de lateralidad
|
||||
*/
|
||||
public void ComboLatSel(int tto)
|
||||
{
|
||||
if (tto < 0)
|
||||
return;
|
||||
try
|
||||
{
|
||||
TipoLate = tto;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
HelperGlobal.ponMsg("Error al seleccionar el tipo de lateralidad");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,13 +18,15 @@ using ArcGIS.Desktop.Mapping;
|
|||
using OliviaAddInPro.Helper;
|
||||
using OliviaAddInPro.Model;
|
||||
using System.Windows.Media.Imaging;
|
||||
using static OliviaAddInPro.Model.ComunDef;
|
||||
|
||||
|
||||
namespace OliviaAddInPro
|
||||
{
|
||||
internal class PaneRecogidaViewModel : PanelViewModelBase
|
||||
{
|
||||
private PaneRecogidaSub1ViewModel _subPanel1ViewModel;
|
||||
//Recogida reco;
|
||||
Recogida reco;
|
||||
|
||||
public PaneRecogidaViewModel()
|
||||
{
|
||||
|
|
@ -41,7 +43,8 @@ namespace OliviaAddInPro
|
|||
new OptionsMenuItem(new BitmapImage(new Uri("pack://application:,,,/OliviaAddInPro;component/Resources/time.png")), Resource1.String_tiempos, _subPanel4ViewModel)
|
||||
};
|
||||
SelectedOption = OptionsMenu[0];
|
||||
//limp = OliviaGlob.Limp;
|
||||
reco = OliviaGlob.Reco;
|
||||
CambiaParaPlanif();
|
||||
}
|
||||
public override string DisplayName
|
||||
{
|
||||
|
|
@ -75,13 +78,142 @@ namespace OliviaAddInPro
|
|||
{
|
||||
get { return _subPanel1ViewModel; }
|
||||
}
|
||||
|
||||
//cambia algunos textos para adaptarlo a la planificación
|
||||
public void CambiaParaPlanif()
|
||||
{
|
||||
_subPanel2ViewModel.TextLblNiv = "Turnos";
|
||||
_subPanel4ViewModel.TextTCargDesc = "Descarga en planta";
|
||||
_subPanel4ViewModel.TextTDesplIniFin = "Salida/llegada Inst.";
|
||||
}
|
||||
/**
|
||||
* Lee los paneles y sus elementos
|
||||
*/
|
||||
public bool Lee(out string err_str)
|
||||
{
|
||||
err_str = "";
|
||||
return false;
|
||||
try
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
///Lee el panel 1
|
||||
if (!_subPanel1ViewModel.CapaAbierta || string.IsNullOrEmpty(_subPanel1ViewModel.CapaElems))
|
||||
{
|
||||
err_str = "No se ha seleccionado ninguna Capa de Limpieza";
|
||||
return false;
|
||||
}
|
||||
reco.CapaElems = _subPanel1ViewModel.CapaElems;
|
||||
|
||||
//lee la fracción
|
||||
reco.TipoFrac = _subPanel1ViewModel.TipoFrac;
|
||||
if (reco.TipoFrac == -1)
|
||||
{
|
||||
err_str = "No se ha seleccionado ningún Tipo de Fracción";
|
||||
return false;
|
||||
}
|
||||
reco.TipoFracStr = RecogidaDef.tipos_fracc_str[reco.TipoFrac];
|
||||
|
||||
//lee la densidad del contenedor
|
||||
//si se ha seleccionado que se recogen los contenedores llenos hay que comprobar que se ha rellenado la densidad de los contenedores
|
||||
if (RecogidaDef.lleno )
|
||||
{
|
||||
try
|
||||
{
|
||||
reco.DensCont = Convert.ToInt32(_subPanel1ViewModel.TextDensCont);
|
||||
if (reco.DensCont <= 0 || reco.DensCont > 100)
|
||||
{
|
||||
err_str = "El valor introducido para la densidad del contenedor no es válido.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
err_str = "El formato introducido para la densidad del contenedor no es válido.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
reco.DensCont = -1;
|
||||
|
||||
//lee el tipo de carga
|
||||
reco.TipoCarg = _subPanel1ViewModel.TipoCarg;
|
||||
if (reco.TipoCarg == -1)
|
||||
{
|
||||
err_str = "No se ha seleccionado ningún Tipo de Carga";
|
||||
return false;
|
||||
}
|
||||
reco.TipoCargStr=RecogidaDef.tipos_carg_str[reco.TipoCarg];
|
||||
|
||||
//lee la lateralidad
|
||||
reco.TipoLate = -1;
|
||||
if (reco.TipoCarg == (int)RecogidaDef.TiposCarga.Lateral)
|
||||
{
|
||||
reco.TipoLate = _subPanel1ViewModel.TipoLate;
|
||||
if (reco.TipoLate == -1)
|
||||
{
|
||||
err_str = "No se ha seleccionado ningún Tipo de Lateralidad";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//lee el tipo de vehic
|
||||
reco.TipoVehic = _subPanel1ViewModel.TipoVehic;
|
||||
if (reco.TipoVehic == -1)
|
||||
{
|
||||
err_str = "No se ha seleccionado ningún Tipo de Vehículo";
|
||||
return false;
|
||||
}
|
||||
|
||||
reco.GiroVehic = (int)RecogidaDef.giro_vehic[reco.TipoVehic];
|
||||
|
||||
//recoge la carga máxima del vehículo que se ha configurado
|
||||
try
|
||||
{
|
||||
reco.KgMaxVehic = Convert.ToInt32(_subPanel1ViewModel.TextKgCapac);
|
||||
if ((reco.KgMaxVehic <= 0) || (reco.KgMaxVehic > RecogidaDef.Parametros.kgmaxM) || (reco.KgMaxVehic < RecogidaDef.Parametros.kgmaxm))
|
||||
{
|
||||
err_str = "El valor introducido para la carga máxima del vehículo no es válido.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
err_str = "El formato introducido para la carga máxima del vehículo no es válido.";
|
||||
return false;
|
||||
}
|
||||
//recoge el tiempo de vaciado que se ha configurado
|
||||
try
|
||||
{
|
||||
reco.TVaciCont = Convert.ToInt32(_subPanel1ViewModel.TextTVaci);
|
||||
if ((reco.TVaciCont <= 0) || (reco.TVaciCont > RecogidaDef.Parametros.t_vaciM) || (reco.TVaciCont < RecogidaDef.Parametros.t_vacim))
|
||||
{
|
||||
err_str = "El valor introducido para el tiempo de vaciado no es válido.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
err_str = "El formato introducido para el tiempo de vaciado no es válido.";
|
||||
return false;
|
||||
}
|
||||
//revisa las coordenadas de la planta de instalación
|
||||
reco.CoordsPlanta = _subPanel1ViewModel.CoordsPlanta;
|
||||
if (reco.CoordsPlanta.Equals(new Coordinate2D(0, 0)))
|
||||
{
|
||||
err_str = "No se ha seleccionado planta de descarga";
|
||||
return false;
|
||||
}
|
||||
|
||||
//lee las propiedades comunes a recogida
|
||||
if (!LeeComun(reco, out err_str))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -90,14 +222,25 @@ namespace OliviaAddInPro
|
|||
public void Ejecuta(OliviaAddInPro.Services.ModosEjec modo)
|
||||
{
|
||||
string err = "";
|
||||
OliviaGlob.progrDialog.Show();
|
||||
var progSrc = new CancelableProgressorSource(OliviaGlob.progrDialog);
|
||||
if (!Lee(out err))
|
||||
{
|
||||
HelperGlobal.ponMsg(err);
|
||||
return;
|
||||
}
|
||||
|
||||
OliviaGlob.Reco.Ejecuta(modo);
|
||||
Action<TareaRes> ac = finEjecuta;
|
||||
OliviaGlob.Reco.EjecutaAsync(modo, progSrc, ac);
|
||||
|
||||
}
|
||||
public void finEjecuta(TareaRes res)
|
||||
{
|
||||
OliviaGlob.progrDialog.Hide();
|
||||
if (res.Errores)
|
||||
{
|
||||
HelperGlobal.ponMsg(res.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue