Merge branch 'Elena/reco' into Gerardo/AñadirPinvoke
# Conflicts: # Model/OliviaGlob.cs # OliviaAddInPro.csproj # ViewModel/Limpieza/PaneLimpiezaViewModel.csConfiguracionSimplificada
|
|
@ -27,7 +27,7 @@ namespace OliviaAddInPro
|
|||
{
|
||||
if (OliviaGlob.TipoEjec == TiposEjecucion.Ninguno)
|
||||
{
|
||||
OliviaGlob.TipoEjec = TiposEjecucion.Props;
|
||||
OliviaGlob.SetFlagTipEjec(TiposEjecucion.Props);
|
||||
DockpaneConfigViewModel.Reset();
|
||||
DockpaneConfigViewModel.Show();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace OliviaAddInPro
|
|||
"Procesando", "Canceled", 100, false);
|
||||
if (OliviaGlob.TipoEjec == TiposEjecucion.Ninguno)
|
||||
{
|
||||
OliviaGlob.TipoEjec = TiposEjecucion.Limp;
|
||||
OliviaGlob.SetFlagTipEjec(TiposEjecucion.Limp);
|
||||
OliviaGlob.Limp = new Limpieza();
|
||||
DockpaneLimpiezaViewModel.Reset();
|
||||
DockpaneLimpiezaViewModel.Show();
|
||||
|
|
|
|||
|
|
@ -25,10 +25,13 @@ namespace OliviaAddInPro
|
|||
{
|
||||
protected override void OnClick()
|
||||
{
|
||||
if(OliviaGlob.TipoEjec==TiposEjecucion.Ninguno)
|
||||
OliviaGlob.progrDialog = new ProgressDialog(
|
||||
"Procesando", "Canceled", 100, false);
|
||||
if (OliviaGlob.TipoEjec==TiposEjecucion.Ninguno)
|
||||
{
|
||||
OliviaGlob.TipoEjec = TiposEjecucion.Reco;
|
||||
//OliviaGlob.Reco=new
|
||||
OliviaGlob.SetFlagTipEjec(TiposEjecucion.Reco);
|
||||
OliviaGlob.Reco = new Recogida();
|
||||
DockpaneRecogidaViewModel.Reset();
|
||||
DockpaneRecogidaViewModel.Show();
|
||||
}
|
||||
else
|
||||
|
|
|
|||
16
Config.daml
|
|
@ -16,27 +16,29 @@
|
|||
<tabs>
|
||||
<tab id="OliviaAddInPro_Tab1" caption="Olivia Pro">
|
||||
<group refID="OliviaAddInPro_Group1" />
|
||||
<group refID="OliviaAddInPro_Group2" />
|
||||
</tab>
|
||||
</tabs>
|
||||
<groups>
|
||||
<group id="OliviaAddInPro_Group1" caption="Olivia" appearsOnAddInTab="false">
|
||||
<group id="OliviaAddInPro_Group2" caption=" " appearsOnAddInTab="false">
|
||||
<button refID="OliviaAddInPro_ButtonLimp" size="large" />
|
||||
<button refID="OliviaAddInPro_ButtonRec" size="large" />
|
||||
<button refID="OliviaAddInPro_ButtonConfig" size="large" />
|
||||
<button refID="OliviaAddInPro_ViewModel_Recogida_PaneRecogida_OpenButton" size="large" />
|
||||
<button refID="OliviaAddInPro_ButtonRec" size="large" />
|
||||
</group>
|
||||
<group id="OliviaAddInPro_Group1" caption=" " appearsOnAddInTab="false">
|
||||
<button refID="OliviaAddInPro_ButtonConfig" size="large" />
|
||||
</group>
|
||||
</groups>
|
||||
<controls>
|
||||
<!-- add your controls here -->
|
||||
<button id="OliviaAddInPro_ButtonLimp" caption="Limpieza" className="ButtonLimp" loadOnClick="true" largeImage="Images/carrito.png">
|
||||
<button id="OliviaAddInPro_ButtonLimp" caption=" Limpieza " className="ButtonLimp" loadOnClick="true" largeImage="Images/carrito2.png">
|
||||
<tooltip heading="OLIVIA - Limpieza Viaria">
|
||||
Add-In de ArcGIS Pro para la herramienta de optimización de la limpieza viaria, OLIVIA<disabledText /></tooltip>
|
||||
</button>
|
||||
<button id="OliviaAddInPro_ButtonRec" caption="Recogida" className="ButtonRec" loadOnClick="true" largeImage="Images/contenedor.png">
|
||||
<button id="OliviaAddInPro_ButtonRec" caption=" Recogida " className="ButtonRec" loadOnClick="true" largeImage="Images/reco2.png">
|
||||
<tooltip heading="OLIVIA - Recogida de Residuos">
|
||||
Add-In de ArcGIS Pro para la herramienta de optimización de la limpieza viaria, OLIVIA<disabledText /></tooltip>
|
||||
</button>
|
||||
<button id="OliviaAddInPro_ButtonConfig" caption="Configuración" className="ButtonConfig" loadOnClick="true" largeImage="Images/config.png">
|
||||
<button id="OliviaAddInPro_ButtonConfig" caption="Configuración" className="ButtonConfig" loadOnClick="true" largeImage="Images/config2.png">
|
||||
<tooltip heading="OLIVIA - Configuración">
|
||||
Add-In de ArcGIS Pro para la herramienta de optimización de la limpieza viaria, OLIVIA<disabledText /></tooltip>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ using ArcGIS.Desktop.Editing;
|
|||
using OliviaAddInPro.Model;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using OliviaAddInPro.View;
|
||||
|
||||
namespace OliviaAddInPro.Helper
|
||||
{
|
||||
|
|
@ -66,6 +67,47 @@ namespace OliviaAddInPro.Helper
|
|||
out_str = string.Empty;
|
||||
}
|
||||
|
||||
//Proceso para sacar un diálogo y seleccionar una o varias geometrías de dentro de una fclass
|
||||
public static ArcGIS.Core.Geometry.Geometry OpenGeom(TiposOpenFileDlg tipo, out string txt_sal, string initialLoc = "")
|
||||
{
|
||||
//inicialmente
|
||||
ArcGIS.Core.Geometry.Geometry geom = null;
|
||||
txt_sal = Resource1.String_selec_capa;
|
||||
|
||||
//abre
|
||||
FeatureClass fc = HelperGdb.OpenFtClassDialog(tipo);
|
||||
if (fc != null)
|
||||
{
|
||||
//hace geom
|
||||
geom = SelecLeeGeom(fc, out txt_sal, true);
|
||||
if (geom == null && (HelperGdb.OutStr.Length > 0))
|
||||
HelperGlobal.ponMsg(HelperGdb.OutStr, System.Windows.MessageBoxImage.Error);
|
||||
|
||||
HelperGdb.Free(fc);
|
||||
}
|
||||
return geom;
|
||||
}
|
||||
/*
|
||||
* Saca ventana para seleccionar el campo del que leer para elegir la geometría
|
||||
*/
|
||||
private static ArcGIS.Core.Geometry.Geometry SelecLeeGeom(FeatureClass fc, out string text_sal, bool multisel)
|
||||
{
|
||||
ArcGIS.Core.Geometry.Geometry geomsal = null;
|
||||
text_sal = "";
|
||||
if (fc != null)
|
||||
{
|
||||
//saca la ventana de selección de campo
|
||||
ShowProWndSelectFields selfwnd = new ShowProWndSelectFields(fc, multisel);
|
||||
if (selfwnd.SelFieldVals.Count > 0)
|
||||
{
|
||||
geomsal = HelperGdb.GetGeomSel(fc, selfwnd.SelField, selfwnd.SelFieldVals).Result;
|
||||
text_sal = HelperGdb.TextoSal;
|
||||
}
|
||||
}
|
||||
|
||||
return geomsal;
|
||||
}
|
||||
|
||||
//Dado el tipo de FtClass y una posición inicial abre un diálogo de búsqueda de ftclass
|
||||
//si se cancela o no es una feature class lo que se ha abierto devuelve null
|
||||
//si no, devuelve la featureclass directamente abierta
|
||||
|
|
@ -828,5 +870,76 @@ namespace OliviaAddInPro.Helper
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recorre los ámbitos lineales del shp viendo qué longitud tienen dentro de la geometría, y si
|
||||
* es menos de un porcentaje, lo quitan del shp
|
||||
**/
|
||||
public static bool RemoveRowsGeom(string shp_path, ArcGIS.Core.Geometry.Geometry geom_zon, double porc)
|
||||
{
|
||||
|
||||
/*int[] ids = null;
|
||||
IFeature f = null;
|
||||
IFeatureClass fc = null;
|
||||
IGeometry geom_aux = null;
|
||||
ITopologicalOperator union = null;
|
||||
IPolyline poli = null;
|
||||
double longi_zon = 0, longi_tot = 0;
|
||||
List<int> quita = new List<int>();
|
||||
int j;
|
||||
|
||||
try
|
||||
{
|
||||
ids = FunGDB.dame_ids_consulta(shp_path, ""); //consulta todos
|
||||
if (ids == null)
|
||||
return false;
|
||||
fc = FunGDB.abre_ftclass(shp_path);
|
||||
if (fc == null)
|
||||
return false;
|
||||
for (j = 0; j < ids.Length; j++)
|
||||
{
|
||||
f = fc.GetFeature(ids[j]);
|
||||
geom_aux = f.Shape;
|
||||
poli = (IPolyline)geom_aux;
|
||||
longi_tot = poli.Length;
|
||||
union = (ITopologicalOperator)geom_zon;
|
||||
if (geom_aux == null)
|
||||
return false;
|
||||
geom_aux = union.Intersect(geom_aux, esriGeometryDimension.esriGeometry1Dimension);//se realiza la interseccion entre ámbito (linea) y nivel (poligono)
|
||||
poli = (IPolyline)geom_aux;
|
||||
longi_zon = poli.Length;//se consigue la longitud de ámbito (linea) que interseca con el nivel)
|
||||
|
||||
if ((longi_zon / longi_tot) < porc)
|
||||
{
|
||||
//quita esa línea
|
||||
quita.Add(ids[j]);
|
||||
}
|
||||
FunGDB.libera(f);
|
||||
}
|
||||
|
||||
|
||||
FunGDB.libera(fc);
|
||||
FunGDB.libera(f);
|
||||
|
||||
if (quita.Count > 0)
|
||||
{
|
||||
//borra las líneas que se han indicado
|
||||
if (!FunGDB.quita_filas(shp_path, quita))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
FunGDB.libera(fc);
|
||||
FunGDB.libera(f);
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 156 KiB |
|
Before Width: | Height: | Size: 7.9 KiB |
|
|
@ -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
|
||||
{
|
||||
|
|
@ -22,7 +22,7 @@ namespace OliviaAddInPro.Model
|
|||
/**
|
||||
* Tipo de tratamiento elegidos
|
||||
*/
|
||||
public int TipoTto { get; set; } = -1;
|
||||
//public int TipoTto { get; set; } = -1; //En la clase TratamientoComun
|
||||
/**
|
||||
* Ámbitos de trabajo elegidos
|
||||
*/
|
||||
|
|
@ -57,15 +57,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)
|
||||
{
|
||||
|
|
@ -76,7 +67,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; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,21 +13,22 @@ namespace OliviaAddInPro.Model
|
|||
{
|
||||
[Flags]
|
||||
/**
|
||||
* 2 primeros bit indican si es nada (0), limp (1), reco(2), u otros (3)
|
||||
* 3er bit indica si es config
|
||||
* 4º bit indica ejec
|
||||
*
|
||||
*/
|
||||
public enum TiposEjecucion
|
||||
{
|
||||
Ninguno = 0,
|
||||
Limp=1,
|
||||
Reco=2,
|
||||
Config = 4, //está configurando por primera vez
|
||||
Ejec=8,//está ejecutando por primera vez
|
||||
Config2=16,//está configurando después de haber planificado ya al menos una primera vez
|
||||
Ejec2=32,//está ejecutando después de haber planificado ya al menos una primera vez
|
||||
Props = 64,//está editando propiedades
|
||||
Maqueta=128,
|
||||
Props = 4,//está editando propiedades
|
||||
Config = 8, //está configurando la ventana de limpieza o recogida por primera vez
|
||||
EjecSecto=16,//está ejecutando por primera vez
|
||||
EjecPlanif = 32,//está ejecutando después de haber planificado ya al menos una primera vez
|
||||
FinEjecOk = 64, //ha terminado de ejecutar Bien
|
||||
FinEjecNOk = 128,//ha terminado de ejecutar y ha habido errores
|
||||
Config2 =256,//está configurando la ventana de limpieza o recogida después de haber sectorizado
|
||||
//ya al menos una primera vez
|
||||
//se pone este estado cuando ha terminado ya la primera vez
|
||||
}
|
||||
static class OliviaGlob
|
||||
{
|
||||
|
|
@ -65,7 +66,14 @@ namespace OliviaAddInPro.Model
|
|||
*/
|
||||
public static int TiempoOutSocket;
|
||||
};
|
||||
|
||||
/**
|
||||
* Nombre de las capas que se van a necesitar para la exportación de datos
|
||||
*/
|
||||
public struct Capas
|
||||
{
|
||||
public static string ftclass_ejes; //<Nombre de la capa de ejes de carretera
|
||||
public static string ftclass_muni; //<Nombre de la capa de municipios de TOMTOM
|
||||
};
|
||||
private static TiposEjecucion tipoEjec = TiposEjecucion.Ninguno;
|
||||
public static Limpieza limp = new Limpieza();
|
||||
private static Recogida reco = new Recogida();
|
||||
|
|
@ -103,19 +111,38 @@ namespace OliviaAddInPro.Model
|
|||
|
||||
public static bool IsLimp()
|
||||
{
|
||||
return (OliviaGlob.TipoEjec & TiposEjecucion.Limp) == TiposEjecucion.Limp;
|
||||
return HasFlagTipEjec(TiposEjecucion.Limp);
|
||||
}
|
||||
public static bool IsReco()
|
||||
{
|
||||
return (OliviaGlob.TipoEjec & TiposEjecucion.Reco) == TiposEjecucion.Reco;
|
||||
return HasFlagTipEjec(TiposEjecucion.Reco);
|
||||
}
|
||||
public static bool IsProps()
|
||||
{
|
||||
return (OliviaGlob.TipoEjec & TiposEjecucion.Props) == TiposEjecucion.Props;
|
||||
return HasFlagTipEjec(TiposEjecucion.Props);
|
||||
}
|
||||
public static bool IsConfig2()
|
||||
{
|
||||
return (OliviaGlob.TipoEjec & TiposEjecucion.Config2) == TiposEjecucion.Config2;
|
||||
return HasFlagTipEjec(TiposEjecucion.Config2);
|
||||
}
|
||||
public static bool HasFlagTipEjec(TiposEjecucion flag)
|
||||
{
|
||||
return (OliviaGlob.TipoEjec & flag) == flag;
|
||||
}
|
||||
public static void SetFlagTipEjec(TiposEjecucion flag)
|
||||
{
|
||||
//pone el tipo de ejecución igual al flag
|
||||
OliviaGlob.TipoEjec = flag;
|
||||
}
|
||||
public static void AddFlagTipEjec(TiposEjecucion flag)
|
||||
{
|
||||
//añade el flag al tipo de ejecución
|
||||
OliviaGlob.TipoEjec = OliviaGlob.TipoEjec | flag;
|
||||
}
|
||||
public static void RemoveFlagTipEjec(TiposEjecucion flag)
|
||||
{
|
||||
//quita el flag al tipo de ejecución
|
||||
OliviaGlob.TipoEjec = OliviaGlob.TipoEjec & ~flag;
|
||||
}
|
||||
/**
|
||||
* Habilita Sh=true
|
||||
|
|
@ -186,10 +213,8 @@ namespace OliviaAddInPro.Model
|
|||
|
||||
///////////////////////////////////////
|
||||
//Capas, consultas y filtros GENERALES
|
||||
/*Capas.ftclass_ejes = c.eje_via;
|
||||
Capas.ftclass_zonas = "SubNiveles";
|
||||
Capas.ftclass_restri = "TomTom_Q4_2015___rs";
|
||||
Capas.ftclass_muni = c.municipios;*/
|
||||
Capas.ftclass_ejes = c.eje_via;
|
||||
Capas.ftclass_muni = c.municipios;
|
||||
|
||||
///////////////////////////////////////
|
||||
//Capas, consultas, atributos y filtros de LIMPIEZA
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,14 @@ namespace OliviaAddInPro.Model
|
|||
{
|
||||
public class TratamientoComun
|
||||
{
|
||||
/**
|
||||
* Tipo de tratamiento, en limpieza es sobre LimpiezaDef.TiposTto y en reco sobre RecogidaDef.tipos_fracc_str
|
||||
*/
|
||||
public int TipoTto { get; set; } = (int)LimpiezaDef.TiposTto.TtoNoDef;
|
||||
/**
|
||||
* String para Tipo de tratamiento, se guarda como columna en el shp
|
||||
*/
|
||||
public string TipoTtoStr { get; set; } = String.Empty;
|
||||
/**
|
||||
* Capa de ámbitos
|
||||
*/
|
||||
|
|
@ -108,5 +116,6 @@ namespace OliviaAddInPro.Model
|
|||
}
|
||||
set { err_str = value;}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@
|
|||
<Compile Include="Model\OliviaConf.cs" />
|
||||
<Compile Include="Model\OliviaDef.cs" />
|
||||
<Compile Include="Services\ConfigServ.cs" />
|
||||
<Compile Include="Services\ImportaResServ.cs" />
|
||||
<Compile Include="Services\LanzaSrv\LanzaLimpSrv.cs" />
|
||||
<Compile Include="Services\LanzaSrv\LanzaOlvServ.cs" />
|
||||
<Compile Include="Services\LanzaSrv\LanzaRecoSrv.cs" />
|
||||
|
|
@ -297,11 +298,6 @@
|
|||
<LastGenOutput>Resource1.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AddInContent Include="Images\carrito.png" />
|
||||
<AddInContent Include="Images\contenedor.png" />
|
||||
<AddInContent Include="Images\maqueta.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AddInContent Include="Images\config.png" />
|
||||
</ItemGroup>
|
||||
|
|
@ -311,9 +307,6 @@
|
|||
<ItemGroup>
|
||||
<AddInContent Include="DarkImages\GenericButtonGreen32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AddInContent Include="Images\Tiporeco.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="View\OliviaIconPro16.png" />
|
||||
</ItemGroup>
|
||||
|
|
@ -332,7 +325,13 @@
|
|||
<ItemGroup>
|
||||
<Resource Include="Images\openfolder.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<AddInContent Include="Images\config2.png" />
|
||||
<AddInContent Include="Images\reco2.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AddInContent Include="Images\carrito2.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!--
|
||||
PackageAction can be:
|
||||
|
|
|
|||
|
|
@ -74,9 +74,35 @@ namespace OliviaAddInPro.Services
|
|||
cps.Value = 80;
|
||||
|
||||
if (!fue_mal)
|
||||
fue_mal = Ejecuta(modo, cps, out ErrStr);
|
||||
fue_mal = Exporta(modo, cps, out ErrStr); //Falta pasar el filtro espacial
|
||||
|
||||
}
|
||||
if (!fue_mal)
|
||||
{
|
||||
OliviaGlob.Paths.PathData = OliviaGlob.Paths.DirData + com.NombreShpExport;
|
||||
//hace intersecciones espaciales en caso de ámbitos lineales para quitar los que tienen más parte fuera de la zona que dentro
|
||||
if (geom_export != null &&
|
||||
(OliviaGlob.IsReco() || (OliviaGlob.IsLimp() && (com.TipoTto < (int)LimpiezaDef.TiposTto.TtoPapeVaci))))
|
||||
{
|
||||
//FALTA RELLENAR
|
||||
if (!HelperGdb.RemoveRowsGeom(OliviaGlob.Paths.PathData, geom_export, 0.4))
|
||||
{
|
||||
ErrStr = "Error al quitar los ámbitos que sobresalen";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
//comprueba que no se haya quedado sin ámbitos
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//amplia la geom para englobar las instalaciones
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//exporta la red navegable
|
||||
|
||||
//guarda los nombres del shape
|
||||
OliviaGlob.Paths.PathNW = OliviaGlob.Paths.DirData + com.NombreShpExportNw;
|
||||
|
||||
return fue_mal;
|
||||
}
|
||||
|
||||
|
|
@ -86,54 +112,52 @@ namespace OliviaAddInPro.Services
|
|||
public Geometry GetGeomAmbitsExport(CancelableProgressorSource cps)
|
||||
{
|
||||
Geometry geomAux = null;
|
||||
Geometry geomAmbits = null;
|
||||
|
||||
ErrStr = string.Empty;
|
||||
FeatureClass fc = HelperGdb.GetFtClass(com.CapaElems);
|
||||
QueryFilter filtro = new QueryFilter { WhereClause = com.ConsultaAmbs };
|
||||
FeatureClass fc = HelperGdb.GetFtClass(com.CapaElems);
|
||||
if (fc == null)
|
||||
{
|
||||
ErrStr = "No se ha podido abrir la clase " + com.CapaElems;
|
||||
return null;
|
||||
}
|
||||
|
||||
//Hace la intersección de zonas y niveles
|
||||
geomAux = null;
|
||||
if (com.GeomNiv != null || com.GeomZon != null)
|
||||
{
|
||||
geomAux = HelperGdb.IntersectGeom(com.GeomNiv, com.GeomZon);
|
||||
if (geomAux == null)
|
||||
{
|
||||
ErrStr = "Error al intersecar zonas y/o niveles.";
|
||||
return null;
|
||||
}
|
||||
if (geomAux.IsEmpty)
|
||||
{
|
||||
ErrStr = "No existen ámbitos en la intersección entre zonas y/o niveles.";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//Primero hace la geometría de los ámbitos que cumplen la consulta
|
||||
geomAux = HelperGdb.GetGeomConvexHull(fc, filtro, cps).Result;
|
||||
//comprueba que, en el caso de ejes de vía, hayan metido polígono de exportación
|
||||
if ((geomAux == null) && (com.CapaElems == OliviaGlob.Capas.ftclass_ejes))
|
||||
{
|
||||
ErrStr = "Al emplear ejes de calle como ámbitos es necesario indicar polígono de exportación";
|
||||
return null;
|
||||
}
|
||||
cps.Value = 30;
|
||||
|
||||
//prepara el filtro con consulta y espacial
|
||||
SpatialQueryFilter filtro = CreaFiltro(com.ConsultaAmbs, geomAux);
|
||||
|
||||
//Ahora hace la geometría de los ámbitos que cumplen la consulta
|
||||
geomAmbits = HelperGdb.GetGeomConvexHull(fc, filtro, cps).Result;
|
||||
if (geomAux == null || geomAux.IsEmpty)
|
||||
{
|
||||
ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + HelperGdb.OutStr;
|
||||
return null;
|
||||
}
|
||||
geomAux = geomAmbits;
|
||||
cps.Value = 60;
|
||||
//Hace la intersección de dicha geometría con las zonas
|
||||
if (com.GeomZon != null)
|
||||
{
|
||||
geomAux = HelperGdb.IntersectGeom(geomAux, com.GeomZon);
|
||||
if (geomAux == null)
|
||||
{
|
||||
ErrStr = "Error al intersecar con las zonas.";
|
||||
return null;
|
||||
}
|
||||
if(geomAux.IsEmpty)
|
||||
{
|
||||
ErrStr = "No existen ámbitos en la intersección con las zonas.";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
cps.Value = 70;
|
||||
//Hace la intersección de la geometría con los niveles
|
||||
if (com.GeomNiv != null)
|
||||
{
|
||||
geomAux = HelperGdb.IntersectGeom(geomAux, com.GeomNiv);
|
||||
if (geomAux == null)
|
||||
{
|
||||
ErrStr = "Error al intersecar con los niveles.";
|
||||
return null;
|
||||
}
|
||||
if (geomAux.IsEmpty)
|
||||
{
|
||||
ErrStr = "No existen ámbitos en la intersección con los niveles.";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
cps.Value = 75;
|
||||
//le quita las restricciones
|
||||
if (com.GeomRestr != null)
|
||||
{
|
||||
|
|
@ -144,6 +168,7 @@ namespace OliviaAddInPro.Services
|
|||
return null;
|
||||
}
|
||||
}
|
||||
cps.Value = 75;
|
||||
HelperGdb.Free(fc);
|
||||
return geomAux;
|
||||
}
|
||||
|
|
@ -179,15 +204,11 @@ namespace OliviaAddInPro.Services
|
|||
/**
|
||||
* Exporta y lanza proceso y ventana de proceso
|
||||
*/
|
||||
public bool Ejecuta(ModosEjec modo, CancelableProgressorSource cps, out string msg)
|
||||
public bool Exporta(ModosEjec modo, CancelableProgressorSource cps, out string msg)
|
||||
{
|
||||
msg = "";
|
||||
//exporta los datos de entrada
|
||||
return HelperGdb.ExportShp(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, cps, out msg);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* Lee la capa que se ha seleccionzdo de recogida y se comprueba que contiene los campos necesarios
|
||||
|
|
@ -216,5 +237,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,111 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using OliviaAddInPro.Model;
|
||||
using OliviaAddInPro.Helper;
|
||||
|
||||
namespace OliviaAddInPro.Services
|
||||
{
|
||||
class ImportaResServ
|
||||
{
|
||||
//se le llama cuando ha terminado el proceso de ejecución en Olivia Tasks
|
||||
//puede haber ido bien, haberse cancelado, etc. En función de ello se realizan
|
||||
//unas tareas u otras
|
||||
public void FinProceso()
|
||||
{
|
||||
bool mal = true;
|
||||
string err = "";
|
||||
|
||||
if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.FinEjecOk)) //ha terminado bien
|
||||
{
|
||||
if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecSecto)) //Ha terminado bien la sectorización
|
||||
{
|
||||
/*if (gdb.import_secto_ini())
|
||||
{
|
||||
mal = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mal = true;
|
||||
err = gdb.err_st;
|
||||
}*/
|
||||
}
|
||||
else if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecPlanif)) //Ha terminado bien la planificación
|
||||
{
|
||||
/*guarda_csv();
|
||||
if (gdb.import_planif())
|
||||
{
|
||||
mal = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mal = true;
|
||||
err = gdb.err_st;
|
||||
}*/
|
||||
}
|
||||
//actualiza los flags
|
||||
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecOk);
|
||||
OliviaGlob.AddFlagTipEjec(TiposEjecucion.Config2);
|
||||
}
|
||||
else if(OliviaGlob.HasFlagTipEjec(TiposEjecucion.FinEjecNOk)) //ha habido error
|
||||
{
|
||||
/*mal = true;
|
||||
err = progr_eje.err_str;*/
|
||||
//actualiza los flags
|
||||
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecNOk);
|
||||
}
|
||||
|
||||
borra_files();
|
||||
if (mal)
|
||||
{
|
||||
HelperGlobal.ponMsg(err, System.Windows.MessageBoxImage.Error);
|
||||
|
||||
}
|
||||
|
||||
OliviaGlob.ShowHidePane(true);
|
||||
|
||||
}
|
||||
/**
|
||||
* Borra los archivos exportados para el proceso
|
||||
*/
|
||||
public static void borra_files()
|
||||
{
|
||||
string[] list = null;
|
||||
string capa_principal = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData);
|
||||
string capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW);
|
||||
|
||||
try
|
||||
{
|
||||
if (capa_principal == null)
|
||||
return;
|
||||
list = Directory.GetFiles(OliviaGlob.Paths.DirData, capa_principal + "*");
|
||||
if (list.Length > 0)
|
||||
{
|
||||
foreach (string f in list)
|
||||
{
|
||||
if (System.IO.Path.GetExtension(f) == ".lock")
|
||||
continue;
|
||||
File.Delete(f);
|
||||
}
|
||||
}
|
||||
if (capa_principal_nw == null)
|
||||
return;
|
||||
list = Directory.GetFiles(OliviaGlob.Paths.DirData, capa_principal_nw + "*");
|
||||
if (list.Length > 0)
|
||||
{
|
||||
foreach (string f in list)
|
||||
{
|
||||
File.Delete(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HelperGlobal.ponMsg(ex.Message, System.Windows.MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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] + "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
</ResourceDictionary.MergedDictionaries>
|
||||
<!--Datatemplate to view the items in the Sub Panel Indicator list box control-->
|
||||
<DataTemplate x:Key="SubPanelListItem" DataType="{x:Type localMenu:OptionsMenuItem}">
|
||||
<Image Stretch="None" Width="32" Height="32" Source="{Binding Path=ImageSource}" >
|
||||
<Image Stretch="Fill" Width="24" Height="24" Source="{Binding Path=ImageSource}" >
|
||||
<Image.ToolTip>
|
||||
<ToolTip Content="{Binding Path=OptionString}"/>
|
||||
</Image.ToolTip>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@
|
|||
<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"
|
||||
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=CapaAbierta, 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">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ListBoxItem IsEnabled="{Binding IsEnabled}">
|
||||
<ListBoxItem IsEnabled="{Binding IsEnabled}" >
|
||||
<CheckBox IsChecked="{Binding IsChecked}" Content="{Binding Path=Item}" />
|
||||
</ListBoxItem>
|
||||
</DataTemplate>
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
</ResourceDictionary.MergedDictionaries>
|
||||
<!--Datatemplate to view the items in the Sub Panel Indicator list box control-->
|
||||
<DataTemplate x:Key="SubPanelListItem" DataType="{x:Type localMenu:OptionsMenuItem}">
|
||||
<Image Stretch="Fill" Width="32" Height="32" Source="{Binding Path=ImageSource}" >
|
||||
<Image Stretch="Fill" Width="24" Height="24" Source="{Binding Path=ImageSource}" >
|
||||
<Image.ToolTip>
|
||||
<ToolTip Content="{Binding Path=OptionString}"/>
|
||||
</Image.ToolTip>
|
||||
|
|
@ -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,14 +34,19 @@
|
|||
<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"
|
||||
VerticalAlignment="Top" Width="150"
|
||||
SelectedIndex="{Binding Path=TipoFrac, Mode = TwoWay}" SelectionChanged="comboBox_frac_SelectionChanged">
|
||||
<ComboBox.ItemTemplate>
|
||||
<ComboBox x:Name="comboBox_frac" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" ItemsSource="{Binding Path=TiposFrac}" HorizontalAlignment="Left" Margin="0,0,0,0" Width="150"
|
||||
SelectionChanged="comboBox_frac_SelectionChanged" SelectedIndex="{Binding Path=TipoFrac, Mode = TwoWay}"
|
||||
DisplayMemberPath="Item">
|
||||
<ComboBox.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type ComboBoxItem}">
|
||||
<Setter Property="IsEnabled" Value="{Binding IsEnabled}"/>
|
||||
</Style>
|
||||
</ComboBox.ItemContainerStyle>
|
||||
<!--ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBoxItem IsEnabled="{Binding IsEnabled}"/>
|
||||
<ComboBoxItem IsEnabled="{Binding IsEnabled}" Content="{Binding Path=Item}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</-->
|
||||
</ComboBox>
|
||||
<TextBox x:Name="txtBox_densCont" Width="90" ToolTip="{Binding ToolTip_TextDensCont}" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" Visibility="{Binding Path=VisTextDens, Mode = TwoWay}" Grid.Column="1" Margin="10,0" TextWrapping="NoWrap" Text="{Binding Path=TextDensCont, Mode = TwoWay}" TextAlignment="Right" MaxLength="5" PreviewTextInput="txtBox_densCont_PreviewTextInput"/>
|
||||
</Grid>
|
||||
|
|
@ -51,9 +56,21 @@
|
|||
<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}"
|
||||
DisplayMemberPath="Item">
|
||||
<ComboBox.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type ComboBoxItem}">
|
||||
<Setter Property="IsEnabled" Value="{Binding IsEnabled}"/>
|
||||
</Style>
|
||||
</ComboBox.ItemContainerStyle>
|
||||
<!--ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBoxItem IsEnabled="{Binding IsEnabled}" Content="{Binding Path=Item}"/>
|
||||
</DataTemplate>
|
||||
</-->
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="comboBox_tipoLat" IsEnabled="{Binding Path=CapaAbierta, Mode = TwoWay}" Visibility="{Binding Path=VisCombLate, Mode = TwoWay}" Grid.Column="1" ItemsSource="{Binding Path=TiposLate, Mode = TwoWay}" HorizontalAlignment="Left" Margin="10,0,0,0"
|
||||
VerticalAlignment="Top" Width="90"
|
||||
SelectedIndex="{Binding Path=TipoLate, Mode = TwoWay}" SelectionChanged="comboBox_tipoLat_SelectionChanged"/>
|
||||
|
|
@ -61,7 +78,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>
|
||||
|
|
@ -71,10 +88,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
|
||||
{
|
||||
|
|
@ -70,9 +71,11 @@ namespace OliviaAddInPro
|
|||
{
|
||||
i = combo.SelectedIndex;
|
||||
|
||||
if (DataContext is PaneRecogidaSub1ViewModel mod)
|
||||
if (i >= 0 && DataContext is PaneRecogidaSub1ViewModel mod)
|
||||
{
|
||||
mod.ComboFracSel(i);
|
||||
/*if (!mod.ComboFracSel(i))
|
||||
combo.SelectedIndex = -1;*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -84,10 +87,12 @@ namespace OliviaAddInPro
|
|||
if (sender is System.Windows.Controls.ComboBox combo)
|
||||
{
|
||||
i = combo.SelectedIndex;
|
||||
|
||||
if (DataContext is PaneRecogidaSub1ViewModel mod)
|
||||
|
||||
if (i>=0 && DataContext is PaneRecogidaSub1ViewModel mod)
|
||||
{
|
||||
mod.ComboCargSel(i);
|
||||
/*if (!mod.ComboCargSel(i))
|
||||
combo.SelectedIndex = -1;*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -99,7 +104,7 @@ namespace OliviaAddInPro
|
|||
{
|
||||
i = combo.SelectedIndex;
|
||||
|
||||
if (DataContext is PaneRecogidaSub1ViewModel mod)
|
||||
if (i >= 0 && DataContext is PaneRecogidaSub1ViewModel mod)
|
||||
{
|
||||
mod.ComboVehicSel(i);
|
||||
}
|
||||
|
|
@ -113,7 +118,7 @@ namespace OliviaAddInPro
|
|||
{
|
||||
i = combo.SelectedIndex;
|
||||
|
||||
if (DataContext is PaneRecogidaSub1ViewModel mod)
|
||||
if (i >= 0 && DataContext is PaneRecogidaSub1ViewModel mod)
|
||||
{
|
||||
mod.ComboCapacSel(i);
|
||||
}
|
||||
|
|
@ -122,12 +127,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 (i >= 0 && 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace OliviaAddInPro
|
|||
if (isVisible == false && !firstTimeShow)
|
||||
{
|
||||
//avisa de cerrar la ventana
|
||||
OliviaGlob.TipoEjec = TiposEjecucion.Ninguno;
|
||||
OliviaGlob.SetFlagTipEjec(TiposEjecucion.Ninguno);
|
||||
}
|
||||
if (firstTimeShow)
|
||||
firstTimeShow = false;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace OliviaAddInPro
|
|||
if (isVisible == false && !firstTimeShow && !hideTemp)
|
||||
{
|
||||
//avisa de cerrar la ventana
|
||||
OliviaGlob.TipoEjec = TiposEjecucion.Ninguno;
|
||||
OliviaGlob.SetFlagTipEjec(TiposEjecucion.Ninguno);
|
||||
}
|
||||
if (firstTimeShow)
|
||||
firstTimeShow = false;
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace OliviaAddInPro
|
|||
set
|
||||
{
|
||||
ambitos = value;
|
||||
base.NotifyPropertyChanged("OpsAmbs");
|
||||
base.NotifyPropertyChanged("Ambitos");
|
||||
}
|
||||
}
|
||||
public bool[] AmbitosSel
|
||||
|
|
@ -181,7 +181,7 @@ namespace OliviaAddInPro
|
|||
CapaElems = string.Empty;
|
||||
OpsAmbs.Clear();
|
||||
Ambitos.Clear();
|
||||
OliviaGlob.TipoEjec = OliviaGlob.TipoEjec | 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))
|
||||
return false;
|
||||
//comprueba los campos de limpieza
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -15,7 +15,8 @@ namespace OliviaAddInPro
|
|||
class PaneLimpiezaViewModel : PanelViewModelBase
|
||||
{
|
||||
private PaneLimpiezaSub1ViewModel _subPanel1ViewModel;
|
||||
|
||||
Limpieza limp;
|
||||
|
||||
public PaneLimpiezaViewModel()
|
||||
{
|
||||
_subPanel1ViewModel = new PaneLimpiezaSub1ViewModel();
|
||||
|
|
@ -30,8 +31,8 @@ namespace OliviaAddInPro
|
|||
new OptionsMenuItem(new BitmapImage(new Uri("pack://application:,,,/OliviaAddInPro;component/Resources/ptosctrl.png")), Resource1.String_ctrol, _subPanel3ViewModel),
|
||||
new OptionsMenuItem(new BitmapImage(new Uri("pack://application:,,,/OliviaAddInPro;component/Resources/time.png")), Resource1.String_tiempos, _subPanel4ViewModel)
|
||||
};
|
||||
SelectedOption = OptionsMenu[0];
|
||||
// OliviaGlob.limp = OliviaGlob.Limp;
|
||||
SelectedOption = OptionsMenu[0];
|
||||
limp = OliviaGlob.Limp;
|
||||
}
|
||||
public override string DisplayName
|
||||
{
|
||||
|
|
@ -77,7 +78,7 @@ namespace OliviaAddInPro
|
|||
err_str = "No se ha seleccionado ninguna Capa de Limpieza";
|
||||
return false;
|
||||
}
|
||||
OliviaGlob.limp.CapaElems = _subPanel1ViewModel.CapaElems;
|
||||
limp.CapaElems = _subPanel1ViewModel.CapaElems;
|
||||
|
||||
//lee el tipo tto
|
||||
if (_subPanel1ViewModel.TipoTto == (int)LimpiezaDef.TiposTto.TtoNoDef)
|
||||
|
|
@ -85,26 +86,26 @@ namespace OliviaAddInPro
|
|||
err_str = "No se ha seleccionado ningún Tipo de Tratamiento";
|
||||
return false;
|
||||
}
|
||||
OliviaGlob.limp.TipoTto = _subPanel1ViewModel.TipoTto;
|
||||
|
||||
limp.TipoTto = _subPanel1ViewModel.TipoTto;
|
||||
limp.TipoTtoStr = LimpiezaDef.tto_gdb[_subPanel1ViewModel.TipoTto];
|
||||
//lee el/los ámbito seleccionado
|
||||
if (!_subPanel1ViewModel.lee_ambitos())
|
||||
{
|
||||
err_str = "No se ha seleccionado ningún Ámbito de trabajo";
|
||||
return false;
|
||||
}
|
||||
OliviaGlob.limp.AmbitosSel = _subPanel1ViewModel.AmbitosSel;
|
||||
limp.AmbitosSel = _subPanel1ViewModel.AmbitosSel;
|
||||
int i = 0;
|
||||
for (i = 0; i < OliviaGlob.limp.AmbitosSel.Length; i++)
|
||||
if (OliviaGlob.limp.AmbitosSel[i])
|
||||
for (i = 0; i < limp.AmbitosSel.Length; i++)
|
||||
if (limp.AmbitosSel[i])
|
||||
break;
|
||||
if(i>= OliviaGlob.limp.AmbitosSel.Length)
|
||||
if(i>= limp.AmbitosSel.Length)
|
||||
{
|
||||
err_str = "No se ha seleccionado ningún Ámbito de trabajo";
|
||||
return false;
|
||||
}
|
||||
//lee si respeta circulacion
|
||||
OliviaGlob.limp.RespCirc = _subPanel1ViewModel.RespCirc;
|
||||
limp.RespCirc = _subPanel1ViewModel.RespCirc;
|
||||
|
||||
//lee velo de desplazamiento
|
||||
int vv = -1;
|
||||
|
|
@ -118,7 +119,7 @@ namespace OliviaAddInPro
|
|||
err_str = "La velocidad de desplazamiento no está dentro de los límites configurados";
|
||||
return false;
|
||||
}
|
||||
OliviaGlob.limp.VDespl = vv;
|
||||
limp.VDespl = vv;
|
||||
|
||||
//lee tiempo de tto
|
||||
if ((_subPanel1ViewModel.TimeTto == 0) ||
|
||||
|
|
@ -127,11 +128,11 @@ namespace OliviaAddInPro
|
|||
err_str = "El tiempo de tratamiento no está dentro de los límites configurados";
|
||||
return false;
|
||||
}
|
||||
OliviaGlob.limp.Ttto = _subPanel1ViewModel.TimeTto;
|
||||
OliviaGlob.limp.UdsTTto = _subPanel1ViewModel.UdsTTto;
|
||||
limp.Ttto = _subPanel1ViewModel.TimeTto;
|
||||
limp.UdsTTto = _subPanel1ViewModel.UdsTTto;
|
||||
|
||||
//lee las propiedades comunes a recogida
|
||||
if (!LeeComun(OliviaGlob.limp,out err_str))
|
||||
if (!LeeComun(limp,out err_str))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -164,7 +165,6 @@ namespace OliviaAddInPro
|
|||
|
||||
Action<TareaRes> ac = finEjecuta;
|
||||
OliviaGlob.Limp.EjecutaAsync(modo, progSrc, ac);
|
||||
//res.
|
||||
}
|
||||
public void finEjecuta(TareaRes res)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace OliviaAddInPro
|
|||
if (isVisible == false && !firstTimeShow && !hideTemp)
|
||||
{
|
||||
//avisa de cerrar la ventana
|
||||
OliviaGlob.TipoEjec = TiposEjecucion.Ninguno;
|
||||
OliviaGlob.SetFlagTipEjec(TiposEjecucion.Ninguno);
|
||||
}
|
||||
if (firstTimeShow)
|
||||
firstTimeShow = false;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -143,11 +143,11 @@ namespace OliviaAddInPro
|
|||
get { return tipoLate; }
|
||||
set
|
||||
{
|
||||
tipoCapac = value;
|
||||
tipoLate = value;
|
||||
base.NotifyPropertyChanged("TipoLate");
|
||||
}
|
||||
}
|
||||
private string textKgCapac;
|
||||
private string textKgCapac="";
|
||||
public string TextKgCapac
|
||||
{
|
||||
get { return textKgCapac; }
|
||||
|
|
@ -202,16 +202,33 @@ namespace OliviaAddInPro
|
|||
base.NotifyPropertyChanged("EnabComboCapac");
|
||||
}
|
||||
}
|
||||
private bool enabComboCapacFrac
|
||||
private bool enabComboCapacFrac = true;
|
||||
public bool EnabComboCapacFrac
|
||||
{
|
||||
get { return enabComboCapacFrac; }
|
||||
set
|
||||
{
|
||||
enabComboCapacFrac = value;
|
||||
base.NotifyPropertyChanged("EnabComboCapac");
|
||||
base.NotifyPropertyChanged("EnabComboCapacFrac");
|
||||
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).
|
||||
|
|
@ -256,7 +273,7 @@ namespace OliviaAddInPro
|
|||
TiposCarg.Clear();
|
||||
TiposVehic.Clear();
|
||||
TiposCapac.Clear();
|
||||
OliviaGlob.TipoEjec = OliviaGlob.TipoEjec | 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))
|
||||
return false;
|
||||
|
||||
|
|
@ -297,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
|
||||
|
|
@ -337,7 +359,8 @@ namespace OliviaAddInPro
|
|||
}
|
||||
for(i=0;i< RecogidaDef.tipos_fracc_str.Length;i++)
|
||||
{
|
||||
TiposFrac.Add(new EnabledComboBoxItem<string>(RecogidaDef.tipos_fracc_str[i], tipos_fracc_bool[i]));
|
||||
TiposFrac.Add(new EnabledComboBoxItem<string>(RecogidaDef.tipos_fracc_str[i]));
|
||||
TiposFrac.ElementAt(i).IsEnabled= tipos_fracc_bool[i];
|
||||
}
|
||||
}
|
||||
public void rellenaCarg(ObservableCollection<string> valores)
|
||||
|
|
@ -369,24 +392,28 @@ 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;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < RecogidaDef.tipos_carg_str.Length; i++)
|
||||
{
|
||||
TiposCarg.Add(new EnabledComboBoxItem<string>(RecogidaDef.tipos_carg_str[i], tipos_carg_bool[i]));
|
||||
TiposCarg.Add(new EnabledComboBoxItem<string>(RecogidaDef.tipos_carg_str[i]));
|
||||
TiposCarg.ElementAt(i).IsEnabled =tipos_carg_bool[i];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
|
|
@ -411,8 +438,9 @@ namespace OliviaAddInPro
|
|||
catch (Exception)
|
||||
{
|
||||
HelperGlobal.ponMsg("Error al seleccionar el tipo de fracción");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
/**
|
||||
|
|
@ -489,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;
|
||||
|
|
@ -500,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
|
||||
|
|
@ -515,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
|
||||
|
|
@ -527,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
|
||||
|
|
@ -571,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,143 @@ 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;
|
||||
reco.TipoTto = reco.TipoFrac;
|
||||
reco.TipoTtoStr= RecogidaDef.tipos_fracc_str[reco.TipoFrac];
|
||||
//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 +223,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||