85 lines
2.6 KiB
C#
85 lines
2.6 KiB
C#
using ArcGIS.Core.Geometry;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using OliviaAddInPro.Helper;
|
|
using System.Collections.ObjectModel;
|
|
using ArcGIS.Core.CIM;
|
|
using ArcGIS.Core.Data;
|
|
using OliviaAddInPro.Services;
|
|
using static OliviaAddInPro.Model.LimpiezaDef;
|
|
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
|
using ArcGIS.Desktop.Framework.Contracts;
|
|
|
|
namespace OliviaAddInPro.Model
|
|
{
|
|
public class Limpieza : TratamientoComun
|
|
{
|
|
//**********************************************
|
|
//Se recogen en PaneLimpiezaSub1
|
|
/**
|
|
* Tipo de tratamiento elegidos
|
|
*/
|
|
public int TipoTto { get; set; } = -1;
|
|
/**
|
|
* Ámbitos de trabajo elegidos
|
|
*/
|
|
public bool[] AmbitosSel { get; set; } = new bool[(int)LimpiezaDef.AmbitsTra.AmbN];
|
|
/**
|
|
* Indica si respeta el sentido de circulación o no
|
|
*/
|
|
public bool RespCirc { get; set; } = false;
|
|
/**
|
|
* Tipo de unidades del tiempo de tto
|
|
*/
|
|
public int UdsTTto { get; set; } = (int)GeneralDef.OlvTiposTto.OlvTipTtoNoDef;
|
|
/**
|
|
* Instancia para las funciones de exportación y demás
|
|
*/
|
|
|
|
public LimpiezaServ Serv { get; set; } = null;
|
|
/**
|
|
* Ancho de vía, en metros
|
|
*/
|
|
public double AnchoVia { get; set; } = LimpiezaDef.Parametros.ancho_via;
|
|
public Limpieza()
|
|
{
|
|
Serv = new LimpiezaServ(this);
|
|
}
|
|
|
|
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;
|
|
/*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)
|
|
{
|
|
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
|
{
|
|
cps.Status = "Procesando";
|
|
cps.Value = 0;
|
|
var res = Ejecuta(modo, cps);
|
|
ffin(res);
|
|
return res;
|
|
|
|
});
|
|
|
|
}
|
|
}
|
|
}
|