Añadido ancho via que faltaba en la ventana de limpieza. Cambiada una propiedad a tipo combo.

ConfiguracionSimplificada
Elena 2022-01-28 00:30:42 +01:00
parent 87d0517e08
commit c226ee4cc9
6 changed files with 155 additions and 12 deletions

View File

@ -12,6 +12,15 @@ namespace OliviaAddInPro.Model
[Serializable] [Serializable]
class OliviaConf class OliviaConf
{ {
public enum OpsRecoCont
{
[Description("Contenedor lleno")]
LlenoUsaDensidad,
[Description("Lee campo 'kg a recoger'")]
LeeCampoTabla,
[Description("Usa 'kg defecto'")]
UsaKgDef
}
private string m2s(int min) private string m2s(int min)
{ {
var val = min; var val = min;
@ -994,13 +1003,57 @@ namespace OliviaAddInPro.Model
[Description("Indica los kg a utilizar para todos los contenedores")] [Description("Indica los kg a utilizar para todos los contenedores")]
public int kgrec_val { get; set; } public int kgrec_val { get; set; }
[Category("Campos Recogida")] [Category("Campos Recogida")]
[Browsable(false)]
[DisplayName("¿Lleno?")] [DisplayName("¿Lleno?")]
[Description("Indica si se debe considerar que todos los contenedores están llenos")] [Description("Indica si se debe considerar que todos los contenedores están llenos")]
public bool is_lleno { get; set; } public bool is_lleno { get; set; }
[Category("Campos Recogida")] [Category("Campos Recogida")]
[Browsable(false)]
[DisplayName("¿Lee el campo de kg?")] [DisplayName("¿Lee el campo de kg?")]
[Description("Indica si se deben leer los kg de cada contenedor del campo 'Kg a recoger'")] [Description("Indica si se deben leer los kg de cada contenedor del campo 'Kg a recoger'")]
public bool is_campo { get; set; } public bool is_campo { get; set; }
[Category("Campos Recogida")]
[DisplayName("Kg contenedor")]
[JsonIgnore]
[Description("Indica si se usa contenedor lleno, en cuyo caso se emplea la densidad de la " +
"fracción en contenedor y su capacidad, o bien si se debe usar el valor por defecto 'Kg defecto' o bien se deben leer los kg de cada contenedor del campo 'Kg a recoger'")]
public OpsRecoCont opsRecoCont
{
get
{
if(is_lleno)
{
return OpsRecoCont.LlenoUsaDensidad;
}
else if(is_campo)
{
return OpsRecoCont.LeeCampoTabla;
}
else
{
return OpsRecoCont.UsaKgDef;
}
}
set
{
switch(value)
{
case OpsRecoCont.LlenoUsaDensidad:
is_lleno = true;
is_campo = false;
break;
case OpsRecoCont.LeeCampoTabla:
is_lleno = false;
is_campo = true;
break;
case OpsRecoCont.UsaKgDef:
is_lleno = false;
is_campo = false;
break;
}
}
}
#endregion #endregion
#region AtributosRecogida #region AtributosRecogida

View File

@ -60,7 +60,6 @@ namespace OliviaAddInPro.Services
fue_mal = true; fue_mal = true;
} }
} }
// cps.Value = 80;
//crea el filtro de exportación //crea el filtro de exportación
if (!fue_mal) if (!fue_mal)
{ {
@ -98,7 +97,7 @@ namespace OliviaAddInPro.Services
//amplia la geom para englobar las instalaciones //amplia la geom para englobar las instalaciones
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
//exporta la red navegable //exporta la red navegable (buffer, le quita las restr...)
//guarda los nombres del shape //guarda los nombres del shape
OliviaGlob.Paths.PathNW = OliviaGlob.Paths.DirData + com.NombreShpExportNw; OliviaGlob.Paths.PathNW = OliviaGlob.Paths.DirData + com.NombreShpExportNw;
@ -151,7 +150,7 @@ namespace OliviaAddInPro.Services
//Ahora hace la geometría de los ámbitos que cumplen la consulta //Ahora hace la geometría de los ámbitos que cumplen la consulta
geomAmbits = HelperGdb.GetGeomConvexHull(fc, filtro, cps).Result; geomAmbits = HelperGdb.GetGeomConvexHull(fc, filtro, cps).Result;
if (geomAux == null || geomAux.IsEmpty) if (geomAmbits == null || geomAmbits.IsEmpty)
{ {
ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + HelperGdb.OutStr; ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + HelperGdb.OutStr;
return null; return null;

View File

@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions" xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
xmlns:ui="clr-namespace:OliviaAddInPro" xmlns:ui="clr-namespace:OliviaAddInPro"
mc:Ignorable="d" d:DesignWidth="300" Height="350" mc:Ignorable="d" d:DesignWidth="300" Height="396"
d:DataContext="{Binding Path=ui.PaneLimpiezaSub1ViewModel}" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded" > d:DataContext="{Binding Path=ui.PaneLimpiezaSub1ViewModel}" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded" >
<UserControl.Resources> <UserControl.Resources>
<ResourceDictionary> <ResourceDictionary>
@ -14,7 +14,7 @@
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</UserControl.Resources> </UserControl.Resources>
<StackPanel Orientation="Vertical" Height="Auto"> <StackPanel Orientation="Vertical" Height="Auto" Margin="0,0,0,-44">
<Label Content="Capa de Limpieza" HorizontalAlignment="Left" Margin="15,5,0,0" VerticalAlignment="Top" FontWeight="DemiBold"/> <Label Content="Capa de Limpieza" HorizontalAlignment="Left" Margin="15,5,0,0" VerticalAlignment="Top" FontWeight="DemiBold"/>
<Grid Margin="0,5,0,0"> <Grid Margin="0,5,0,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -36,7 +36,7 @@
<ComboBox x:Name="comboBox_ambitos" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=OpsAmbs, Mode = TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0" <ComboBox x:Name="comboBox_ambitos" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=OpsAmbs, Mode = TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0"
VerticalAlignment="Top" Width="260" SelectionChanged="comboBox_ambitos_SelectionChanged" VerticalAlignment="Top" Width="260" SelectionChanged="comboBox_ambitos_SelectionChanged"
SelectedIndex="{Binding Path=SelOpAmb, Mode = TwoWay}"/> SelectedIndex="{Binding Path=SelOpAmb, Mode = TwoWay}"/>
<ListBox x:Name="listBox_ambitos" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=Ambitos, Mode = TwoWay}" HorizontalAlignment="Left" Height="100" <ListBox x:Name="listBox_ambitos" IsEnabled="{Binding Path=EnableListBoxAmb, Mode = TwoWay}" ItemsSource="{Binding Path=Ambitos, Mode = TwoWay}" HorizontalAlignment="Left" Height="100"
ItemContainerStyle="{DynamicResource Esri_ListBoxItemHighlightBrush}" Margin="20,10,0,0" VerticalAlignment="Top" Width="260"> ItemContainerStyle="{DynamicResource Esri_ListBoxItemHighlightBrush}" Margin="20,10,0,0" VerticalAlignment="Top" Width="260">
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>
@ -69,5 +69,15 @@
<TextBox x:Name="txtBox_tiempotto" Grid.Column="1" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" Margin="10,2,10,4" TextWrapping="Wrap" Text="{Binding Path=TimeTto, Mode = TwoWay}" TextAlignment="Right" MaxLength="4" PreviewTextInput="TextBox_tiempotto_PreviewTextInput"/> <TextBox x:Name="txtBox_tiempotto" Grid.Column="1" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" Margin="10,2,10,4" TextWrapping="Wrap" Text="{Binding Path=TimeTto, Mode = TwoWay}" TextAlignment="Right" MaxLength="4" PreviewTextInput="TextBox_tiempotto_PreviewTextInput"/>
<Label x:Name="label_udstiempotto" Grid.Column="2" Content="{Binding LblUdsTimeTto}" Margin="0,0,0,0"/> <Label x:Name="label_udstiempotto" Grid.Column="2" Content="{Binding LblUdsTimeTto}" Margin="0,0,0,0"/>
</Grid> </Grid>
<Grid Margin="0,5,0,0" Visibility="{Binding Path=VisTextAnchoVia, Mode = TwoWay}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="185"/>
<ColumnDefinition Width="75"/>
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<Label x:Name="label_ancho_via" Margin="15,0,0,0" Content="Ancho medio de la vía"/>
<TextBox x:Name="txtBox_ancho_via" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" Grid.Column="1" Margin="10,2,10,4" TextWrapping="NoWrap" Text="{Binding Path=TextAnchoVia, Mode = TwoWay}" TextAlignment="Right" MaxLength="2" PreviewTextInput="txtBox_ancho_via_PreviewTextInput" />
<Label x:Name="label_ancho_via_uds" Grid.Column="2" Content="m" Margin="0,0,0,0"/>
</Grid>
</StackPanel> </StackPanel>
</UserControl> </UserControl>

View File

@ -41,6 +41,10 @@ namespace OliviaAddInPro
{ {
e.Handled = !PanelGlobal.IsValid(((TextBox)sender).Text + e.Text, 1, 100); e.Handled = !PanelGlobal.IsValid(((TextBox)sender).Text + e.Text, 1, 100);
} }
private void txtBox_ancho_via_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !PanelGlobal.IsValid(((TextBox)sender).Text + e.Text, 1, 50);
}
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)
{ {
@ -98,5 +102,6 @@ namespace OliviaAddInPro
{ {
} }
} }
} }

View File

@ -160,6 +160,34 @@ namespace OliviaAddInPro
base.NotifyPropertyChanged("AmbitosSel"); base.NotifyPropertyChanged("AmbitosSel");
} }
} }
private string textAnchoVia;
public string TextAnchoVia
{
get { return textAnchoVia; }
set { base.SetProperty(ref textAnchoVia, value, () => TextAnchoVia); }
}
private System.Windows.Visibility visTextAnchoVia = System.Windows.Visibility.Hidden;
public System.Windows.Visibility VisTextAnchoVia
{
get { return visTextAnchoVia; }
set { base.SetProperty(ref visTextAnchoVia, value, () => VisTextAnchoVia); }
}
/*private bool enableListBoxAmb;
public bool EnableListBoxAmb
{
get { return (enableListBoxAmb && CapaAbierta); }
set { base.SetProperty(ref enableListBoxAmb, value, () => EnableListBoxAmb); }
}
public override bool CapaAbierta
{
get { return base.CapaAbierta; }
set
{
base.CapaAbierta = value;
base.NotifyPropertyChanged("CapaAbierta");
NotifyPropertyChanged("EnableListBoxAmb");
}
}*/
#endregion Properties #endregion Properties
public PaneLimpiezaSub1ViewModel() public PaneLimpiezaSub1ViewModel()
@ -170,6 +198,7 @@ namespace OliviaAddInPro
lblUdsTimeTto = "min"; lblUdsTimeTto = "min";
lblUdsVeloDespl = "km/h"; lblUdsVeloDespl = "km/h";
limpServ = new LimpiezaServ(null); //no hace falta instancia limp limpServ = new LimpiezaServ(null); //no hace falta instancia limp
textAnchoVia = LimpiezaDef.Parametros.ancho_via.ToString();
} }
/** /**
@ -181,6 +210,7 @@ namespace OliviaAddInPro
CapaElems = string.Empty; CapaElems = string.Empty;
OpsAmbs.Clear(); OpsAmbs.Clear();
Ambitos.Clear(); Ambitos.Clear();
VisTextAnchoVia = System.Windows.Visibility.Hidden;
OliviaGlob.AddFlagTipEjec(TiposEjecucion.Config); //lo reinicia, por si estaba después de planificar OliviaGlob.AddFlagTipEjec(TiposEjecucion.Config); //lo reinicia, por si estaba después de planificar
if (string.IsNullOrEmpty(capa)) if (string.IsNullOrEmpty(capa))
return false; return false;
@ -241,6 +271,7 @@ namespace OliviaAddInPro
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
//rellena el combo de opciones de los ambitos //rellena el combo de opciones de los ambitos
VisTextAnchoVia = System.Windows.Visibility.Hidden;
Ambitos.Clear(); Ambitos.Clear();
OpsAmbs.Clear(); OpsAmbs.Clear();
OpsAmbs.Add("Editable"); OpsAmbs.Add("Editable");
@ -294,12 +325,37 @@ namespace OliviaAddInPro
{ {
if (opAmb < 0) if (opAmb < 0)
return; return;
Ambitos.Clear(); try {
SelOpAmb = opAmb; Ambitos.Clear();
ObservableCollection<AmbitsList> lista; SelOpAmb = opAmb;
lista = pon_ambitos(); ObservableCollection<AmbitsList> lista;
//checkea los ámbitos de esta opción lista = pon_ambitos();
check_ambitos(SelOpAmb, lista); //checkea los ámbitos de esta opción
check_ambitos(SelOpAmb, lista);
if (SelOpAmb == 1)
{
//permite visualizar los elementos del ancho de vía que se activará cuando se seleccione la opción genérica de ejes de calle siempre y cuando el tiempo de tratamiento sea en ml/h
if (UdsTTto != (int)GeneralDef.OlvTiposTto.OlvTipTtoM2h_eje)
{
VisTextAnchoVia = System.Windows.Visibility.Visible;
}
}
else
{
VisTextAnchoVia = System.Windows.Visibility.Hidden;
}
/*if (((TipoTto == (int)LimpiezaDef.TiposTto.TtoBaldMecCalz) && (SelOpAmb >= 2)) ||
((TipoTto == (int)LimpiezaDef.TiposTto.TtoCaidaHoja) && (SelOpAmb >= 2)))
EnableListBoxAmb = false; //si uno de los ámbitos es "eje de calle" no se puede combinar con los demás ámbitos
else
EnableListBoxAmb = true;*/
}
catch (Exception)
{
//MessageBox.Show("Error al seleccionar ámbitos", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
} }
/**Checkea de la lista los ámbitos de trabajo en función del tipo de tratamiento /**Checkea de la lista los ámbitos de trabajo en función del tipo de tratamiento

View File

@ -131,6 +131,26 @@ namespace OliviaAddInPro
limp.Ttto = _subPanel1ViewModel.TimeTto; limp.Ttto = _subPanel1ViewModel.TimeTto;
limp.UdsTTto = _subPanel1ViewModel.UdsTTto; limp.UdsTTto = _subPanel1ViewModel.UdsTTto;
//lee el ancho medio de la vía si está visible (se ha seleccionado la opción genérica Eje de calles)
limp.AnchoVia = LimpiezaDef.Parametros.ancho_via;
if (_subPanel1ViewModel.VisTextAnchoVia == System.Windows.Visibility.Visible)
{
try
{
limp.AnchoVia = Convert.ToDouble(_subPanel1ViewModel.TextAnchoVia);
if ((limp.AnchoVia == 0) || (limp.AnchoVia > LimpiezaDef.Parametros.ancho_viaM) || (limp.AnchoVia < LimpiezaDef.Parametros.ancho_viam))
{
err_str = "El ancho de la vía no está dentro de los límites configurados";
return false;
}
}
catch (FormatException)
{
err_str = "El formato introducido para el ancho de la vía no es válido.";
return false;
}
}
//lee las propiedades comunes a recogida //lee las propiedades comunes a recogida
if (!LeeComun(limp,out err_str)) if (!LeeComun(limp,out err_str))
{ {