Compare commits

..

4 Commits

Author SHA1 Message Date
Gerardo 9273611e3f modos de viaje 2024-01-24 13:22:01 +01:00
Gerardo bb62863fab Merge branch 'Gerardo/elevacion' into Gerardo/ModosViaje 2024-01-24 11:04:02 +01:00
Gerardo ec850008c0 modo eje de calles 2024-01-24 11:02:41 +01:00
Gerardo 4b81570591 modos de viaje 2024-01-16 22:40:57 +01:00
14 changed files with 145 additions and 22 deletions

View File

@ -673,7 +673,7 @@ namespace OliviaAddInPro.Helper
public static ArcGIS.Core.Data.SpatialQueryFilter CreateFiler(string consulta, ArcGIS.Core.Geometry.Geometry geom, SpatialRelationship rel = SpatialRelationship.Contains)
{
ArcGIS.Core.Data.SpatialQueryFilter filt = null;
if (geom != null)
if (geom != null && !geom.IsEmpty)
{
SpatialQueryFilter filtSpat = new SpatialQueryFilter
{
@ -1445,7 +1445,7 @@ namespace OliviaAddInPro.Helper
if (!System.IO.Directory.Exists(outpath))
System.IO.Directory.CreateDirectory(outpath);
FeatureClass fc = null;
bool debug = false;
bool debug = true;
/////////////////////////////////////////////////////////
//Prepara una where_clause con las entidades que cumplen el filtro
//Abre la featureclass
@ -1467,7 +1467,11 @@ namespace OliviaAddInPro.Helper
//Añade a la lista los ids que cumplen el filtro espacial
try
{
ids = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList();
var aux = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal);
var aux2 = aux.GetObjectIDs();
//ids = fc.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList();
ids = aux2.ToList();
}
catch (Exception ex)
{
@ -1490,6 +1494,8 @@ namespace OliviaAddInPro.Helper
OutStr = "Error al aplicar filtro espacial en exportación: "+ OutStr;
return false;
}
if (debug)
HelperGlobal.ponMsg("Número de líneas a exportar "+ids.Count);
/////////////////////////////////////////////////////////
if (cps.Getcancelled())
{
@ -1499,7 +1505,8 @@ namespace OliviaAddInPro.Helper
//convierte la lista de ids a string para la clause de la forma
//(id1, id2, id3..)
string whereClause = GetWhereClauseFromIds(ids,fc.GetDefinition().GetObjectIDField());
if (debug)
HelperGlobal.ponMsg(whereClause);
///////////////////////////////////////////////////////////
///Exporta
string[] args = { pathLayerIn, outpath, nameShp, whereClause };

View File

@ -10,8 +10,9 @@ namespace OliviaAddInPro.Model
//*************************************************************************************
//Enums y structs generales
public static int BuffExport = 1000;
//public static int MaxCaracteresBBDD = 10;
//public static int MaxCaracteresBBDD = 10;
public static OliviaConfMV configMV; //configuracion para modos de viaje
/**
* Nombre de los campos de la cartografía de la red navegable que se consultan para la exportación
*/

View File

@ -66,6 +66,8 @@ namespace OliviaAddInPro.Model
Respuesta<bool> res = new Respuesta<bool> { Value=false};
Respuesta<TiposEjecucion> res2 = new Respuesta<TiposEjecucion> (){ Value = TiposEjecucion.FinEjecNOk };
Serv.TipoMv = TipoMV;
res = Serv.Ejecuta(modo);
if (res.Value)
{

View File

@ -12,6 +12,10 @@ namespace OliviaAddInPro.Model
{
public OliviaConfMV()
{
nombre = "default";
filtro_omitir = "";
campo_prioridad = "0";
}
public string nombre { get; set; }

View File

@ -253,7 +253,7 @@ namespace OliviaAddInPro.Services
//a todos los ámbitos y la instalación, ampliada un buffer, mayor si hay
//restricciones de circulación
geom_export = HelperGdb.BufferGeom(geom_export, com.BuffExport).Value;
if (geom_export == null)
if (geom_export == null || geom_export.IsEmpty)
{
ErrStr = "Error al añadir buffer a la geometría";
return false;
@ -340,7 +340,13 @@ namespace OliviaAddInPro.Services
//////////////////////////////////////
///
//Hace el filtro con la geometría final
filtroEspacial = HelperGdb.CreateFiler(String.Empty, geom_export);
//ComunDef.configMV
var where = String.Empty;
if (!String.IsNullOrEmpty(ComunDef.configMV.filtro_omitir))
{
where = "not(" + ComunDef.configMV.filtro_omitir + ")";
}
filtroEspacial = HelperGdb.CreateFiler(where, geom_export);
if (filtroEspacial == null)
{
ErrStr = "Error al crear el filtro de exportacion de la red navegable";
@ -369,10 +375,13 @@ namespace OliviaAddInPro.Services
ErrStr = Resource1.String_cancel_progreso;
return false;
}
com.ProgrSrc.IncMessage(10, "Termina de exportar red navegable");//60%
com.NombreShpExportNw_C = PREF_NAME_EXPORT_NW_CONJ + fechaHora + EXT_SHP;
OliviaGlob.Paths.PathNW_c = OliviaGlob.Paths.DirData + com.NombreShpExportNw_C;
if (ComunDef.CamposNW.config.revisa_conjunciones)
{
com.ProgrSrc.IncMessage(10, "Revisando conjunciones de la red");//60%
if (!HelperGdb.ExportShp2(OliviaGlob.Paths.PathGdbNw_conj, filtroEspacial, com.NombreShpExportNw_C, OliviaGlob.Paths.DirData, com.ProgrSrc._ProgrSrc, spatRefData, 100))
{
ErrStr = "Error al exportar la red navegable: " + HelperGdb.OutStr;
@ -386,6 +395,7 @@ namespace OliviaAddInPro.Services
}
//prepara campos estandar
com.ProgrSrc.IncMessage(10, "Estandarizando campos de la red");//60%
if (!EstandarizaCamposNW(OliviaGlob.Paths.DirData+com.NombreShpExportNw))
{
ErrStr = "Error al estandarizar campos red navegable: " + HelperGdb.OutStr;
@ -473,7 +483,7 @@ namespace OliviaAddInPro.Services
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_ele_f, ComunDef.CamposNW.config.campo_elevacion_from))
return false;
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_evit, "0"))
if (!HelperGdb.CalculateFieldsSync(pathNW, ComunDef.CamposNW.cons_evit, ComunDef.configMV.campo_prioridad))
return false;
return true;
}

View File

@ -2,6 +2,7 @@
using ArcGIS.Core.Geometry;
using ArcGIS.Core.Internal.CIM;
using ArcGIS.Desktop.Framework.Threading.Tasks;*/
using ActiproSoftware.Windows.Extensions;
using OliviaAddInPro.Helper;
using OliviaAddInPro.Model;
using System;
@ -32,6 +33,15 @@ namespace OliviaAddInPro.Services
*/
public Respuesta<bool> Ejecuta(ModosEjec modo)
{
var modos_viaje = ConfigServ.Serv.Leer().ListaMV;
if (modos_viaje != null && modos_viaje.Count > TipoMv)
{
ComunDef.configMV = modos_viaje[TipoMv];
}
else
{
ComunDef.configMV = new OliviaConfMV();
}
var res = new Respuesta<bool>()
{
Value = false
@ -74,7 +84,7 @@ namespace OliviaAddInPro.Services
{
nombFileAmbs = string.Empty;
limp.ConsultaAmbs = DameAmbsConsulta(out nombFileAmbs);
if (string.IsNullOrEmpty(limp.ConsultaAmbs))
if (null==limp.ConsultaAmbs)
{
return false;
}
@ -110,9 +120,11 @@ namespace OliviaAddInPro.Services
{
var conf=ConfigServ.Serv.Leer();
var res = new ObservableCollection<string>();
if (conf.ListaMV==null || conf.ListaMV.Count<=0 )
return new ObservableCollection<string>();
return (ObservableCollection<string>)conf.ListaMV.Select(c => c.nombre);
return res;
res.AddRange(conf.ListaMV.Select(c => c.nombre));
return res;
}
/**
* Comprueba lo necesario para ver si hay campos para la planificación

View File

@ -32,8 +32,12 @@
<ComboBox x:Name="comboBox_tto" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposTto, Mode = TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0"
VerticalAlignment="Top" Width="260" DropDownOpened="ComboBox_DropDownOpened" SelectionChanged="comboBox_tto_SelectionChanged"
SelectedIndex="{Binding Path=TipoTto, Mode = TwoWay}"/>
<Label Content="Modos de viaje" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" FontWeight="DemiBold"/>
<ComboBox x:Name="comboBox_mv" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposMv, Mode = TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0"
VerticalAlignment="Top" Width="260" SelectionChanged="comboBox_mv_SelectionChanged"
SelectedIndex="{Binding Path=TipoMv, Mode = TwoWay}"/>
<Label Content="Ámbitos de Trabajo" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.391,-0.203" FontWeight="DemiBold"/>
<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=tiposMv, Mode = TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0"
VerticalAlignment="Top" Width="260" SelectionChanged="comboBox_ambitos_SelectionChanged"
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"

View File

@ -80,7 +80,20 @@ namespace OliviaAddInPro
}
}
private void comboBox_mv_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int i = -1;
if (sender is System.Windows.Controls.ComboBox combo)
{
i = combo.SelectedIndex;
if (DataContext is PaneLimpiezaSub1ViewModel mod)
{
mod.ComboMvSel(i);
}
}
}
private void comboBox_ambitos_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int i = -1;

View File

@ -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="390"
mc:Ignorable="d" d:DesignWidth="300" Height="422"
d:DataContext="{Binding Path=ui.PaneRecogidaSub1ViewModel}" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded" >
<UserControl.Resources>
<ResourceDictionary>
@ -94,6 +94,10 @@
<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="8" 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="Modos de viaje" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Top" FontWeight="DemiBold"/>
<ComboBox x:Name="comboBox_mv" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposMv, Mode = TwoWay}" HorizontalAlignment="Left" Margin="20,0,0,0"
VerticalAlignment="Top" Width="260" SelectionChanged="comboBox_mv_SelectionChanged"
SelectedIndex="{Binding Path=TipoMv, Mode = TwoWay}"/>
<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>

View File

@ -110,7 +110,20 @@ namespace OliviaAddInPro
}
}
}
private void comboBox_mv_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.ComboMvSel(i);
}
}
}
private void comboBox_tipoCapac_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int i = -1;

View File

@ -27,6 +27,7 @@ namespace OliviaAddInPro
{
private ObservableCollection<string> tiposTto = new ObservableCollection<string>(LimpiezaDef.tipos_tto_str);
private ObservableCollection<string> tiposMv = new ObservableCollection<string>();
private ObservableCollection<string> opsAmbs=new ObservableCollection<string>();
private int selOpAmb = -1;
private ObservableCollection<CheckedListItem<string>> ambitos = new ObservableCollection<CheckedListItem<string>>();
@ -114,6 +115,25 @@ namespace OliviaAddInPro
base.NotifyPropertyChanged("TiposTto");
}
}
public ObservableCollection<string> TiposMv
{
get { return tiposMv; }
set
{
tiposMv = value;
base.NotifyPropertyChanged("TiposMv");
}
}
private int tipoMv = -1;
public int TipoMv
{
get { return tipoMv; }
set
{
tipoMv = value;
base.NotifyPropertyChanged("TipoMv");
}
}
private int tipoTto = -1;
public int TipoTto
{
@ -199,6 +219,8 @@ namespace OliviaAddInPro
lblUdsVeloDespl = "km/h";
limpServ = new LimpiezaServ(null); //no hace falta instancia limp
textAnchoVia = LimpiezaDef.Parametros.ancho_via.ToString();
tiposMv = limpServ.GetNombreModosViajes();
tipoMv = -1;
}
/**
* Realiza las comprobaciones para cuando se ha abierto una capa
@ -244,6 +266,10 @@ namespace OliviaAddInPro
CapaElems = capa;
CapaAbierta = true;
return true;
}
public void ComboMvSel(int tto)
{
tipoMv = tto;
}
/**
* Realiza los cambios en los ámbitos cuando se ha seleccionado un tratamiento

View File

@ -92,6 +92,8 @@ namespace OliviaAddInPro
err_str = "No se ha seleccionado ningún Tipo de Tratamiento";
return false;
}
limp.TipoMV = _subPanel1ViewModel.TipoMv;
limp.TipoTto = _subPanel1ViewModel.TipoTto;
limp.TipoTtoStr = LimpiezaDef.tto_gdb[_subPanel1ViewModel.TipoTto];
//lee el/los ámbito seleccionado

View File

@ -32,7 +32,7 @@ namespace OliviaAddInPro
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í
private ObservableCollection<string> tiposMv = new ObservableCollection<string>();
/**
* Array de booleanos enumerando si se existen en la capa seleccionada los tipos de fracción
*/
@ -47,6 +47,29 @@ namespace OliviaAddInPro
public bool[] tipos_vehic_bool = new bool[(int)RecogidaDef.TiposVehic.N];
#region Properties
public ObservableCollection<string> TiposMv
{
get { return tiposMv; }
set
{
tiposMv = value;
base.NotifyPropertyChanged("TiposMv");
}
}
private int tipoMv = -1;
public int TipoMv
{
get { return tipoMv; }
set
{
tipoMv = value;
base.NotifyPropertyChanged("TipoMv");
}
}
public void ComboMvSel(int tto)
{
tipoMv = tto;
}
public override string DisplayName
{
@ -261,6 +284,7 @@ namespace OliviaAddInPro
{
KgCont = RecogidaDef.kgrec_cont;
}
tiposMv = new LimpiezaServ(null).GetNombreModosViajes();
}
/**
* Realiza las comprobaciones para cuando se ha abierto una capa

View File

@ -112,6 +112,7 @@ namespace OliviaAddInPro
err_str = "No se ha seleccionado ningún Tipo de Fracción";
return false;
}
reco.TipoMV = _subPanel1ViewModel.TipoMv;
reco.TipoFracStr = RecogidaDef.tipos_fracc_str[reco.TipoFrac];
reco.TipoTto = reco.TipoFrac;
reco.TipoTtoStr = RecogidaDef.tipos_fracc_str[reco.TipoFrac];