Merge branch 'develop' into Elena/reco
commit
f793f5bf05
|
|
@ -25,6 +25,8 @@ namespace OliviaAddInPro
|
||||||
{
|
{
|
||||||
protected override void OnClick()
|
protected override void OnClick()
|
||||||
{
|
{
|
||||||
|
OliviaGlob.progrDialog= new ProgressDialog(
|
||||||
|
"Procesando", "Canceled", 100, false);
|
||||||
if (OliviaGlob.TipoEjec == TiposEjecucion.Ninguno)
|
if (OliviaGlob.TipoEjec == TiposEjecucion.Ninguno)
|
||||||
{
|
{
|
||||||
OliviaGlob.TipoEjec = TiposEjecucion.Limp;
|
OliviaGlob.TipoEjec = TiposEjecucion.Limp;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ using ArcGIS.Desktop.Core.Geoprocessing;
|
||||||
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
||||||
using ArcGIS.Desktop.Editing;
|
using ArcGIS.Desktop.Editing;
|
||||||
using OliviaAddInPro.Model;
|
using OliviaAddInPro.Model;
|
||||||
|
using System.IO;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace OliviaAddInPro.Helper
|
namespace OliviaAddInPro.Helper
|
||||||
{
|
{
|
||||||
|
|
@ -441,13 +443,13 @@ namespace OliviaAddInPro.Helper
|
||||||
* Forma la envolvente convexa, el mínimo polígono,
|
* Forma la envolvente convexa, el mínimo polígono,
|
||||||
* que contiene los ámbitos para exportar, a partir de ahí la red navegable ampliando a un buffer
|
* que contiene los ámbitos para exportar, a partir de ahí la red navegable ampliando a un buffer
|
||||||
*/
|
*/
|
||||||
public static Task<ArcGIS.Core.Geometry.Geometry> GetGeomConvexHull(FeatureClass fclss, ArcGIS.Core.Data.QueryFilter filter)
|
public static Task<ArcGIS.Core.Geometry.Geometry> GetGeomConvexHull(FeatureClass fclss, ArcGIS.Core.Data.QueryFilter filter, CancelableProgressorSource cps)
|
||||||
{
|
{
|
||||||
ArcGIS.Core.Geometry.Geometry geomIni = null;
|
ArcGIS.Core.Geometry.Geometry geomIni = null;
|
||||||
|
|
||||||
return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<ArcGIS.Core.Geometry.Geometry>)(() =>
|
return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<ArcGIS.Core.Geometry.Geometry>)(() =>
|
||||||
{
|
{
|
||||||
geomIni = GetGeomUnica(fclss, filter);
|
geomIni = GetGeomUnica(fclss, filter, cps);
|
||||||
if (geomIni != null)
|
if (geomIni != null)
|
||||||
{
|
{
|
||||||
ArcGIS.Core.Geometry.Geometry geomSal = null;
|
ArcGIS.Core.Geometry.Geometry geomSal = null;
|
||||||
|
|
@ -469,7 +471,7 @@ namespace OliviaAddInPro.Helper
|
||||||
/*
|
/*
|
||||||
* A partir de una capa recorre todos los elementos que cumplen el filtro y los une en una única geometría
|
* A partir de una capa recorre todos los elementos que cumplen el filtro y los une en una única geometría
|
||||||
*/
|
*/
|
||||||
public static ArcGIS.Core.Geometry.Geometry GetGeomUnica(FeatureClass fclss, ArcGIS.Core.Data.QueryFilter filtro)
|
public static ArcGIS.Core.Geometry.Geometry GetGeomUnica(FeatureClass fclss, ArcGIS.Core.Data.QueryFilter filtro, CancelableProgressorSource cps)
|
||||||
{
|
{
|
||||||
ArcGIS.Core.Geometry.Geometry geomsal = null;
|
ArcGIS.Core.Geometry.Geometry geomsal = null;
|
||||||
ReiniciaOutStr();
|
ReiniciaOutStr();
|
||||||
|
|
@ -478,6 +480,7 @@ namespace OliviaAddInPro.Helper
|
||||||
{
|
{
|
||||||
using (RowCursor rowCursor = fclss.Search(filtro))
|
using (RowCursor rowCursor = fclss.Search(filtro))
|
||||||
{
|
{
|
||||||
|
|
||||||
while (rowCursor.MoveNext())
|
while (rowCursor.MoveNext())
|
||||||
{
|
{
|
||||||
using (Row row = rowCursor.Current)
|
using (Row row = rowCursor.Current)
|
||||||
|
|
@ -523,7 +526,7 @@ namespace OliviaAddInPro.Helper
|
||||||
{
|
{
|
||||||
where = $"{fieldName} = {Quote(f)}{selFieldVals[i]}{Quote(f)}";
|
where = $"{fieldName} = {Quote(f)}{selFieldVals[i]}{Quote(f)}";
|
||||||
filtro = new ArcGIS.Core.Data.QueryFilter { WhereClause = where };
|
filtro = new ArcGIS.Core.Data.QueryFilter { WhereClause = where };
|
||||||
geomAux = GetGeomUnica(fclss, filtro);
|
geomAux = GetGeomUnica(fclss, filtro, null);
|
||||||
if(geomAux == null)
|
if(geomAux == null)
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
|
|
@ -647,93 +650,103 @@ namespace OliviaAddInPro.Helper
|
||||||
Free(fc);
|
Free(fc);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
static public bool RenameSHP(string dir, string path, string nameNew)
|
||||||
public static async Task<bool> ExportShp(string pathLayerIn, SpatialQueryFilter filter, string nameShp, string outpath, ProgressDialog progrDialog = null)
|
|
||||||
{
|
{
|
||||||
if (!System.IO.Directory.Exists(outpath))
|
var extensions = new[] { "cpg", "dbf", "prj", "sbn", "sbx", "shp", "shp.xml", "shx" };
|
||||||
System.IO.Directory.CreateDirectory(outpath);
|
string old_ext = System.IO.Path.GetExtension(path);
|
||||||
ReiniciaOutStr();
|
|
||||||
string dirPath;
|
|
||||||
string fclassName = System.IO.Path.GetFileName(pathLayerIn);
|
|
||||||
IReadOnlyList<string> parameters = null;
|
|
||||||
IReadOnlyList<string> parameters2 = null;
|
|
||||||
|
|
||||||
FeatureClass featureClass = null;
|
string name = System.IO.Path.GetFileName(path);
|
||||||
var fin = ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<bool>)(() =>
|
if (!string.IsNullOrEmpty(old_ext))
|
||||||
|
name.Replace(old_ext,"");
|
||||||
|
string _ex =System.IO.Path.GetExtension(nameNew);
|
||||||
|
string nn = nameNew;
|
||||||
|
if (!string.IsNullOrEmpty(_ex))
|
||||||
|
nn.Replace(_ex, "");
|
||||||
|
var res = true;
|
||||||
|
foreach(var ex in extensions)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(fclassName))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (System.IO.Path.GetExtension(pathLayerIn).Equals(".shp"))
|
var po = string.Format("{0}{1}.{2}", dir, name, ex);
|
||||||
{
|
var pn = string.Format("{0}{1}.{2}", dir, nn, ex);
|
||||||
dirPath = System.IO.Path.GetDirectoryName(pathLayerIn);
|
|
||||||
//es un shape de entrada
|
|
||||||
FileSystemConnectionPath fileConnection = new FileSystemConnectionPath(new Uri(dirPath), FileSystemDatastoreType.Shapefile);
|
|
||||||
using (FileSystemDatastore shapefile = new FileSystemDatastore(fileConnection))
|
|
||||||
{
|
|
||||||
featureClass = shapefile.OpenDataset<FeatureClass>(fclassName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dirPath = GetPathGdb(pathLayerIn);
|
|
||||||
//es una feature class de una gdb
|
|
||||||
using (Geodatabase fileGeodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(dirPath))))
|
|
||||||
{
|
|
||||||
featureClass = fileGeodatabase.OpenDataset<FeatureClass>(fclassName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (featureClass == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//Selection selFeatures = featureClass.Select(filter, SelectionType.ObjectID, SelectionOption.Normal);
|
|
||||||
// make a value array of strings to be passed to ExecuteToolAsync
|
|
||||||
parameters = Geoprocessing.MakeValueArray(pathLayerIn, outpath);//, nameShp);
|
|
||||||
var aux = pathLayerIn.Split('\\');
|
|
||||||
parameters2 = Geoprocessing.MakeValueArray(outpath + aux[aux.Length - 1]+".shp", outpath, nameShp);
|
|
||||||
|
|
||||||
|
if (!File.Exists(po))
|
||||||
|
res = false;//no existe
|
||||||
|
if (!File.Exists(pn))
|
||||||
|
File.Delete(pn);
|
||||||
|
File.Move(po,pn );
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
OutStr = "Ha ocurrido un error al convertir a shape";
|
res = false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}));
|
|
||||||
fin.Wait();
|
|
||||||
if(!fin.Result)// || parameters==null)
|
|
||||||
{
|
|
||||||
OutStr = "Ha ocurrido un error al convertir a shape";
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var progSrc = new CancelableProgressorSource(progrDialog);
|
|
||||||
|
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool ExportShp(string pathLayerIn, SpatialQueryFilter filter, string nameShp, string outpath, CancelableProgressorSource cps, out string msgOut, ProgressorSource progrDialog = null)
|
||||||
|
{
|
||||||
|
msgOut = "";
|
||||||
|
if (!System.IO.Directory.Exists(outpath))
|
||||||
|
System.IO.Directory.CreateDirectory(outpath);
|
||||||
|
ReiniciaOutStr();
|
||||||
|
System.Threading.CancellationTokenSource _cts= new System.Threading.CancellationTokenSource();
|
||||||
|
cps.Status = "Guardando geometria a shp";
|
||||||
|
|
||||||
|
var progSrc = new CancelableProgressorSource();
|
||||||
|
string[] args = { pathLayerIn, outpath };
|
||||||
// execute the tool
|
// execute the tool
|
||||||
IGPResult gpResult = Geoprocessing.ExecuteToolAsync("FeatureClassToShapefile_conversion", parameters,
|
IGPResult gpResult = Geoprocessing.ExecuteToolAsync("FeatureClassToShapefile_conversion", args,
|
||||||
null, progSrc.Progressor, GPExecuteToolFlags.GPThread).Result;
|
null, _cts.Token,
|
||||||
|
|
||||||
//renombrar shp
|
(event_name, o) => // implement delegate and handle events
|
||||||
//param2.Add(nameShp);
|
{
|
||||||
IGPResult gpResult2 = Geoprocessing.ExecuteToolAsync("FeatureClassToFeatureClass", parameters2,
|
switch (event_name)
|
||||||
null, progSrc.Progressor, GPExecuteToolFlags.GPThread).Result;
|
{
|
||||||
|
case "OnValidate": // stop execute if any warnings
|
||||||
|
//if ((o as IGPMessage[]).Any(it => it.Type == GPMessageType.Warning))
|
||||||
|
//_cts.Cancel();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "OnProgressMessage":
|
||||||
Free(featureClass);
|
{
|
||||||
if (string.IsNullOrEmpty(gpResult.ReturnValue))
|
string msg = string.Format("{0}: {1}", new object[] { event_name, (string)o });
|
||||||
|
//progrDialog.Message = (string)o;
|
||||||
|
Debug.WriteLine(msg);
|
||||||
|
|
||||||
|
;
|
||||||
|
//System.Windows.MessageBox.Show(msg);
|
||||||
|
//_cts.Cancel();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "OnProgressPos":
|
||||||
|
{
|
||||||
|
string msg2 = string.Format("{0}: {1} %", new object[] { event_name, (int)o });
|
||||||
|
Debug.WriteLine(msg2);
|
||||||
|
var av = (int)0;
|
||||||
|
if (av > 0)
|
||||||
|
{
|
||||||
|
cps.Value = (uint)(80 * av * 0.2);
|
||||||
|
}
|
||||||
|
// if ((int)o < 0)
|
||||||
|
//System.Windows.MessageBox.Show(msg2);
|
||||||
|
//_cts.Cancel();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).Result;
|
||||||
|
cps.Status = "Finalizando exportacion";
|
||||||
|
//renombrado de ficheros:
|
||||||
|
if (!RenameSHP(outpath, pathLayerIn, nameShp))
|
||||||
{
|
{
|
||||||
OutStr = "Ha ocurrido un error en la herramienta de GeoProcesamiento: " + gpResult.ErrorMessages;
|
msgOut = "Error al exportar a shp.";
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return true;
|
||||||
OutStr = "Ok: " + gpResult.ReturnValue;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||||
using ArcGIS.Desktop.Internal.Framework.Controls;
|
using ArcGIS.Desktop.Internal.Framework.Controls;
|
||||||
using ArcGIS.Desktop.Framework.Dialogs;
|
using ArcGIS.Desktop.Framework.Dialogs;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace OliviaAddInPro.Helper
|
namespace OliviaAddInPro.Helper
|
||||||
{
|
{
|
||||||
|
|
@ -50,5 +51,33 @@ namespace OliviaAddInPro.Helper
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void create_folder(string dir)
|
||||||
|
{
|
||||||
|
string[] pathParts = dir.Split('\\');
|
||||||
|
string path = "";
|
||||||
|
foreach (var d in pathParts)
|
||||||
|
{
|
||||||
|
if(string.IsNullOrEmpty(path))
|
||||||
|
path = d;
|
||||||
|
|
||||||
|
else
|
||||||
|
path = path + '\\'+d;
|
||||||
|
|
||||||
|
if (!Directory.Exists(path))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@ using System.Collections.ObjectModel;
|
||||||
using ArcGIS.Core.CIM;
|
using ArcGIS.Core.CIM;
|
||||||
using ArcGIS.Core.Data;
|
using ArcGIS.Core.Data;
|
||||||
using OliviaAddInPro.Services;
|
using OliviaAddInPro.Services;
|
||||||
|
using static OliviaAddInPro.Model.LimpiezaDef;
|
||||||
|
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
||||||
|
using ArcGIS.Desktop.Framework.Contracts;
|
||||||
|
|
||||||
namespace OliviaAddInPro.Model
|
namespace OliviaAddInPro.Model
|
||||||
{
|
{
|
||||||
|
|
@ -39,15 +42,17 @@ namespace OliviaAddInPro.Model
|
||||||
public Limpieza()
|
public Limpieza()
|
||||||
{
|
{
|
||||||
Serv = new LimpiezaServ(this);
|
Serv = new LimpiezaServ(this);
|
||||||
}
|
}
|
||||||
public void Ejecuta(ModosEjec modo)
|
|
||||||
|
public TareaRes Ejecuta(ModosEjec modo, CancelableProgressorSource cps)
|
||||||
{
|
{
|
||||||
bool bien = true;
|
TareaRes res = null;
|
||||||
if (modo == ModosEjec.Sectoriza)
|
if (modo == ModosEjec.Sectoriza)
|
||||||
bien = Serv.Sectoriza();
|
res = Serv.Sectoriza(cps);
|
||||||
else if (modo == ModosEjec.Planifica)
|
else if (modo == ModosEjec.Planifica)
|
||||||
bien=Serv.Planifica();
|
res = Serv.Planifica(cps);
|
||||||
if(!bien)
|
return res;
|
||||||
|
/*if(!res)
|
||||||
{
|
{
|
||||||
string msg;
|
string msg;
|
||||||
if (Serv.ErrStr.Length > 0)
|
if (Serv.ErrStr.Length > 0)
|
||||||
|
|
@ -55,7 +60,20 @@ namespace OliviaAddInPro.Model
|
||||||
else
|
else
|
||||||
msg = "Han ocurrido errores al comenzar la ejeción.";
|
msg = "Han ocurrido errores al comenzar la ejeción.";
|
||||||
HelperGlobal.ponMsg(msg);
|
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;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -788,6 +788,12 @@ namespace OliviaAddInPro.Model
|
||||||
LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbPipi] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_pipi + "'";
|
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 + "'";
|
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; }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||||
using OliviaAddInPro.Services;
|
using OliviaAddInPro.Services;
|
||||||
using ArcGIS.Core.Geometry;
|
using ArcGIS.Core.Geometry;
|
||||||
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
||||||
|
using OliviaAddInPro.Helper;
|
||||||
|
|
||||||
namespace OliviaAddInPro.Model
|
namespace OliviaAddInPro.Model
|
||||||
{
|
{
|
||||||
|
|
@ -155,6 +156,9 @@ namespace OliviaAddInPro.Model
|
||||||
Paths.PathTemp = c.path_temp;
|
Paths.PathTemp = c.path_temp;
|
||||||
c.PathCartela = c.PathCartela;
|
c.PathCartela = c.PathCartela;
|
||||||
|
|
||||||
|
HelperGlobal.create_folder(Paths.DirData);
|
||||||
|
HelperGlobal.create_folder(Paths.PathTemp);
|
||||||
|
|
||||||
Paths.PathGdbGen = c.PathGdbGen;
|
Paths.PathGdbGen = c.PathGdbGen;
|
||||||
Paths.PathGdbNw = c.red_carreteras;
|
Paths.PathGdbNw = c.red_carreteras;
|
||||||
Paths.PathSimbVSM = c.PathSimbVSM;
|
Paths.PathSimbVSM = c.PathSimbVSM;
|
||||||
|
|
@ -272,82 +276,84 @@ namespace OliviaAddInPro.Model
|
||||||
LimpiezaDef.OtrosParam.desv_max = c.Desv_max;
|
LimpiezaDef.OtrosParam.desv_max = c.Desv_max;
|
||||||
LimpiezaDef.OtrosParam.desv_max_abs = c.Desv_max_abs;
|
LimpiezaDef.OtrosParam.desv_max_abs = c.Desv_max_abs;
|
||||||
|
|
||||||
///////////////////////////////////////
|
|
||||||
/////FALTA MACHEAR A CONFIG
|
|
||||||
//Capas, consultas, atributos y filtros de RECOGIDA
|
//Capas, consultas, atributos y filtros de RECOGIDA
|
||||||
|
|
||||||
RecogidaDef.campos_def.cons_id = RecogidaDef.campos.cons_id = "OBJECTID";
|
RecogidaDef.campos_def.cons_id = c.id;
|
||||||
RecogidaDef.campos_def.cons_nomrec = RecogidaDef.campos.cons_nomrec = "NOMB_TIP_REC";
|
RecogidaDef.campos_def.cons_nomrec = c.nomrec;
|
||||||
RecogidaDef.campos_def.cons_lateral = RecogidaDef.campos.cons_lateral = "LATERALIDAD";
|
RecogidaDef.campos_def.cons_lateral = c.lateralidad;
|
||||||
RecogidaDef.campos_def.cons_fracc = RecogidaDef.campos.cons_fracc = "FRACCION";
|
RecogidaDef.campos_def.cons_fracc = c.frac;
|
||||||
RecogidaDef.campos_def.cons_capac = RecogidaDef.campos.cons_capac = "CAPACIDAD";
|
RecogidaDef.campos_def.cons_capac = c.capac;
|
||||||
RecogidaDef.campos_def.cons_uds = RecogidaDef.campos.cons_uds = "UNIDADES";
|
RecogidaDef.campos_def.cons_uds = c.uds;
|
||||||
RecogidaDef.campos_def.cons_kgrec = RecogidaDef.campos.cons_kgrec = "KGRECO";
|
RecogidaDef.campos_def.cons_kgrec = c.kgrec;
|
||||||
RecogidaDef.kgrec_cont = 200;
|
RecogidaDef.kgrec_cont = c.kgrec_val;
|
||||||
|
|
||||||
//Rellena los tipos de fracción
|
//Rellena los tipos de fracción
|
||||||
RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Organica] = "Organica";
|
RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Organica] = c.organica;
|
||||||
RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Resto] = "Resto";
|
RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Resto] = c.resto;
|
||||||
RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Envases] = "Envases";
|
RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Envases] = c.envase;
|
||||||
RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Papel] = "PapelCarton";
|
RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Papel] = c.papel;
|
||||||
RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Vidrio] = "Vidrio";
|
RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Vidrio] = c.vidrio;
|
||||||
//Rellena los tipos de carga
|
//Rellena los tipos de carga
|
||||||
RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Trasera] = "Carga Trasera";
|
RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Trasera] = c.trasera;
|
||||||
RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lateral] = "Carga Lateral";
|
RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lateral] = c.lateral;
|
||||||
RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Superior] = "Carga Superior";
|
RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Superior] = c.superior;
|
||||||
RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Bilateral] = "Carga Bilateral";
|
RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Bilateral] = c.bilat;
|
||||||
RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.BolseoPtaPta] = "Bolseo";
|
RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.BolseoPtaPta] = c.bolseo;
|
||||||
RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lavado] = "Lavado de cont";
|
RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lavado] = c.lavado;
|
||||||
|
|
||||||
RecogidaDef.Parametros.t_vaciM = 40000;
|
RecogidaDef.lleno = c.is_lleno;
|
||||||
RecogidaDef.Parametros.t_vacim = 0;
|
RecogidaDef.kgrec_camp = c.is_campo;
|
||||||
RecogidaDef.Parametros.t_llegsalM = 40000;
|
|
||||||
RecogidaDef.Parametros.t_llegsalm = 0;
|
RecogidaDef.Parametros.t_vaciM = c.t_vaciado_max;
|
||||||
RecogidaDef.Parametros.t_llegsal = 5;
|
RecogidaDef.Parametros.t_vacim = c.t_vaciado_min;
|
||||||
RecogidaDef.Parametros.t_descM = 40000;
|
RecogidaDef.Parametros.t_llegsalM = c.t_llega_sale_max;
|
||||||
RecogidaDef.Parametros.t_descm = 0;
|
RecogidaDef.Parametros.t_llegsalm = c.t_llega_sale_min;
|
||||||
RecogidaDef.Parametros.t_desc = 40;
|
RecogidaDef.Parametros.t_llegsal = c.t_llega_sale;
|
||||||
RecogidaDef.Parametros.t_convM = 40000;
|
RecogidaDef.Parametros.t_descM = c.t_descarga_max;
|
||||||
RecogidaDef.Parametros.t_convm = 0;
|
RecogidaDef.Parametros.t_descm = c.t_descarga_min;
|
||||||
RecogidaDef.Parametros.t_conv = 60 * 8;
|
RecogidaDef.Parametros.t_desc = c.t_descarga;
|
||||||
RecogidaDef.Parametros.t_descansoM = 40000;
|
RecogidaDef.Parametros.t_convM = c.R_t_convenio_max;
|
||||||
RecogidaDef.Parametros.t_descansom = 0;
|
RecogidaDef.Parametros.t_convm = c.R_t_convenio_min;
|
||||||
RecogidaDef.Parametros.t_descanso = 30;
|
RecogidaDef.Parametros.t_conv = c.R_t_convenio;
|
||||||
RecogidaDef.Parametros.h_inicio = 420;
|
RecogidaDef.Parametros.t_descansoM = c.R_t_descanso_max;
|
||||||
RecogidaDef.Parametros.dens_vehi_org = 500;
|
RecogidaDef.Parametros.t_descansom = c.R_t_descanso_min;
|
||||||
RecogidaDef.Parametros.dens_vehi_res = 500;
|
RecogidaDef.Parametros.t_descanso = c.R_t_descanso;
|
||||||
RecogidaDef.Parametros.dens_vehi_env = 120;
|
RecogidaDef.Parametros.h_inicio = c.R_hora_inicio;
|
||||||
RecogidaDef.Parametros.dens_vehi_pap = 250;
|
RecogidaDef.Parametros.dens_vehi_org = c.dens_vehi_org;
|
||||||
RecogidaDef.Parametros.dens_vehi_vid = 350;
|
RecogidaDef.Parametros.dens_vehi_res = c.dens_vehi_res;
|
||||||
RecogidaDef.Parametros.dens_vehi_otr = 100;
|
RecogidaDef.Parametros.dens_vehi_env = c.dens_vehi_env;
|
||||||
RecogidaDef.Parametros.dens_cont_org = 150;
|
RecogidaDef.Parametros.dens_vehi_pap = c.dens_vehi_pap;
|
||||||
RecogidaDef.Parametros.dens_cont_res = 100;
|
RecogidaDef.Parametros.dens_vehi_vid = c.dens_vehi_vid;
|
||||||
RecogidaDef.Parametros.dens_cont_env = 28;
|
RecogidaDef.Parametros.dens_vehi_otr = c.dens_vehi_otr;
|
||||||
RecogidaDef.Parametros.dens_cont_pap = 90;
|
RecogidaDef.Parametros.dens_cont_org = c.dens_cont_org;
|
||||||
RecogidaDef.Parametros.dens_cont_vid = 250;
|
RecogidaDef.Parametros.dens_cont_res = c.dens_cont_res;
|
||||||
RecogidaDef.Parametros.dens_cont_otr = 100;
|
RecogidaDef.Parametros.dens_cont_env = c.dens_cont_env;
|
||||||
RecogidaDef.Parametros.anch_vehi_3 = 2.4;
|
RecogidaDef.Parametros.dens_cont_pap = c.dens_cont_pap;
|
||||||
RecogidaDef.Parametros.anch_vehi_2 = 2.2;
|
RecogidaDef.Parametros.dens_cont_vid = c.dens_cont_vid;
|
||||||
RecogidaDef.Parametros.anch_vehi_s = 2;
|
RecogidaDef.Parametros.dens_cont_otr = c.dens_cont_otr;
|
||||||
RecogidaDef.Parametros.rad_giro_3 = 175;
|
RecogidaDef.Parametros.anch_vehi_3 = c.anch_vehi_3;
|
||||||
RecogidaDef.Parametros.rad_giro_2 = 175;
|
RecogidaDef.Parametros.anch_vehi_2 = c.anch_vehi_2;
|
||||||
RecogidaDef.Parametros.rad_giro_s = 175;
|
RecogidaDef.Parametros.anch_vehi_s = c.anch_vehi_s;
|
||||||
RecogidaDef.Parametros.t_vaci_tra = 30;
|
RecogidaDef.Parametros.rad_giro_3 = c.radio_giro_3;
|
||||||
RecogidaDef.Parametros.t_vaci_lat = 90;
|
RecogidaDef.Parametros.rad_giro_2 = c.radio_giro_2;
|
||||||
RecogidaDef.Parametros.t_vaci_sup = 180;
|
RecogidaDef.Parametros.rad_giro_s = c.radio_giro_s;
|
||||||
RecogidaDef.Parametros.t_vaci_bi = 100;
|
RecogidaDef.Parametros.t_vaci_tra = c.t_vaci_trasera;
|
||||||
RecogidaDef.Parametros.t_vaci_bol = 5;
|
RecogidaDef.Parametros.t_vaci_lat = c.t_vaci_lateral;
|
||||||
RecogidaDef.Parametros.t_vaci_lav = 60;
|
RecogidaDef.Parametros.t_vaci_sup = c.t_vaci_superior;
|
||||||
RecogidaDef.Parametros.t_vaci_otr = 60;
|
RecogidaDef.Parametros.t_vaci_bi = c.t_vaci_bilateral;
|
||||||
RecogidaDef.Parametros.kgmaxM = 20000;
|
RecogidaDef.Parametros.t_vaci_bol = c.t_vaci_bolseo;
|
||||||
RecogidaDef.Parametros.kgmaxm = 0;
|
RecogidaDef.Parametros.t_vaci_lav = c.t_vaci_lavado;
|
||||||
RecogidaDef.Parametros.carga_maxM = 100;
|
RecogidaDef.Parametros.t_vaci_otr = c.t_vaci_otra;
|
||||||
RecogidaDef.Parametros.carga_maxm = 50;
|
RecogidaDef.Parametros.kgmaxM = c.kgmax_max;
|
||||||
|
RecogidaDef.Parametros.kgmaxm = c.kgmax_min;
|
||||||
|
RecogidaDef.Parametros.carga_maxM = c.carga_max_max;
|
||||||
|
RecogidaDef.Parametros.carga_maxm = c.carga_max_min;
|
||||||
|
|
||||||
//Atributos LATERALIDAD
|
//Atributos LATERALIDAD
|
||||||
RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Ambos] = "Ambos";
|
RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Ambos] = c.ambos;
|
||||||
RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Dcha] = "Derecha";
|
RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Dcha] = c.derecha;
|
||||||
RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Izqda] = "Izquierda";
|
RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Izqda] = c.izquierda;
|
||||||
|
|
||||||
|
|
||||||
//Campos de la red navegable que se leen
|
//Campos de la red navegable que se leen
|
||||||
|
|
|
||||||
|
|
@ -35,69 +35,55 @@ namespace OliviaAddInPro.Services
|
||||||
* Modo 0, sectorizar
|
* Modo 0, sectorizar
|
||||||
* Modo 1, planificar
|
* Modo 1, planificar
|
||||||
*/
|
*/
|
||||||
public bool ComienzaEjec(ModosEjec modo)
|
public bool ComienzaEjec(ModosEjec modo, CancelableProgressorSource cps, out string ErrStr)
|
||||||
{
|
{
|
||||||
bool fue_mal = false;
|
bool fue_mal = false;
|
||||||
|
|
||||||
//esconde el pane
|
|
||||||
OliviaGlob.ShowHidePane(false);
|
|
||||||
ErrStr = string.Empty;
|
ErrStr = string.Empty;
|
||||||
|
|
||||||
//Cuenta las filas que cumplen la consulta
|
//Cuenta las filas que cumplen la consulta
|
||||||
int nelems = HelperGdb.GetNumElems(com.CapaElems, com.ConsultaAmbs);
|
int nelems = HelperGdb.GetNumElems(com.CapaElems, com.ConsultaAmbs);
|
||||||
if(nelems<=0)
|
if (nelems <= 0)
|
||||||
{
|
{
|
||||||
ErrStr = "No existen ámbitos que cumplan las condiciones introducidas para la exportación " + com.ConsultaAmbs;
|
ErrStr = "No existen ámbitos que cumplan las condiciones introducidas para la exportación " + com.ConsultaAmbs;
|
||||||
fue_mal = true;
|
fue_mal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cps.Status = "Exportando geometria";
|
||||||
|
|
||||||
//Obtiene la geometría que envuelve a los ámbitos
|
//Obtiene la geometría que envuelve a los ámbitos
|
||||||
Geometry geom_export = null;
|
Geometry geom_export = null;
|
||||||
if (!fue_mal)
|
if (!fue_mal)
|
||||||
{
|
{
|
||||||
geom_export = GetGeomAmbitsExport();
|
geom_export = GetGeomAmbitsExport(cps);
|
||||||
if (geom_export == null || geom_export.IsEmpty)
|
if (geom_export == null || geom_export.IsEmpty)
|
||||||
{
|
{
|
||||||
ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + ErrStr;
|
ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + ErrStr;
|
||||||
fue_mal = true;
|
fue_mal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geom_export == null || geom_export.IsEmpty)
|
|
||||||
{
|
|
||||||
fue_mal = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// cps.Value = 80;
|
||||||
//crea el filtro de exportación
|
//crea el filtro de exportación
|
||||||
if (!fue_mal)
|
if (!fue_mal)
|
||||||
{
|
{
|
||||||
//mira spatialreference de los datos de entrada
|
//mira spatialreference de los datos de entrada
|
||||||
spatRef = geom_export.SpatialReference;
|
spatRef = geom_export.SpatialReference;
|
||||||
filtroEspacial = CreaFiltro(com.ConsultaAmbs, geom_export);
|
filtroEspacial = CreaFiltro(com.ConsultaAmbs, geom_export);
|
||||||
if (filtroEspacial == null)
|
fue_mal = filtroEspacial == null;
|
||||||
{
|
if (fue_mal)
|
||||||
fue_mal = true;
|
ErrStr = "error al crear el filtro de exportacion";
|
||||||
}
|
|
||||||
}
|
cps.Value = 80;
|
||||||
|
|
||||||
|
if (!fue_mal)
|
||||||
|
fue_mal = Ejecuta(modo, cps, out ErrStr);
|
||||||
|
|
||||||
if (!fue_mal)
|
|
||||||
{
|
|
||||||
Ejecuta(modo);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return fue_mal;
|
||||||
//fue mal
|
|
||||||
//muestra pane
|
|
||||||
OliviaGlob.ShowHidePane(true);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepara la geometría para exportar los ámbitos
|
* Prepara la geometría para exportar los ámbitos
|
||||||
*/
|
*/
|
||||||
public Geometry GetGeomAmbitsExport()
|
public Geometry GetGeomAmbitsExport(CancelableProgressorSource cps)
|
||||||
{
|
{
|
||||||
Geometry geomAux = null;
|
Geometry geomAux = null;
|
||||||
ErrStr = string.Empty;
|
ErrStr = string.Empty;
|
||||||
|
|
@ -109,12 +95,13 @@ namespace OliviaAddInPro.Services
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
//Primero hace la geometría de los ámbitos que cumplen la consulta
|
//Primero hace la geometría de los ámbitos que cumplen la consulta
|
||||||
geomAux = HelperGdb.GetGeomConvexHull(fc, filtro).Result;
|
geomAux = HelperGdb.GetGeomConvexHull(fc, filtro, cps).Result;
|
||||||
if (geomAux == null || geomAux.IsEmpty)
|
if (geomAux == null || geomAux.IsEmpty)
|
||||||
{
|
{
|
||||||
ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + HelperGdb.OutStr;
|
ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + HelperGdb.OutStr;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
cps.Value = 60;
|
||||||
//Hace la intersección de dicha geometría con las zonas
|
//Hace la intersección de dicha geometría con las zonas
|
||||||
if (com.GeomZon != null)
|
if (com.GeomZon != null)
|
||||||
{
|
{
|
||||||
|
|
@ -130,7 +117,7 @@ namespace OliviaAddInPro.Services
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cps.Value = 70;
|
||||||
//Hace la intersección de la geometría con los niveles
|
//Hace la intersección de la geometría con los niveles
|
||||||
if (com.GeomNiv != null)
|
if (com.GeomNiv != null)
|
||||||
{
|
{
|
||||||
|
|
@ -146,7 +133,7 @@ namespace OliviaAddInPro.Services
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cps.Value = 75;
|
||||||
//le quita las restricciones
|
//le quita las restricciones
|
||||||
if (com.GeomRestr != null)
|
if (com.GeomRestr != null)
|
||||||
{
|
{
|
||||||
|
|
@ -192,21 +179,15 @@ namespace OliviaAddInPro.Services
|
||||||
/**
|
/**
|
||||||
* Exporta y lanza proceso y ventana de proceso
|
* Exporta y lanza proceso y ventana de proceso
|
||||||
*/
|
*/
|
||||||
public void Ejecuta(ModosEjec modo)
|
public bool Ejecuta(ModosEjec modo, CancelableProgressorSource cps, out string msg)
|
||||||
{
|
{
|
||||||
//lanza ventana de progreso
|
msg = "";
|
||||||
OliviaGlob.progrDialog = new ProgressDialog("Exportando Datos", "Cancelar", 100);
|
|
||||||
OliviaGlob.progrDialog.Show();
|
|
||||||
|
|
||||||
//exporta los datos de entrada
|
//exporta los datos de entrada
|
||||||
bool res=HelperGdb.ExportShp(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, OliviaGlob.progrDialog).Result;
|
return HelperGdb.ExportShp(com.CapaElems, filtroEspacial, com.NombreShpExport, OliviaGlob.Paths.DirData, cps, out msg);
|
||||||
if(!res)
|
|
||||||
{
|
|
||||||
string msg = HelperGdb.OutStr;
|
|
||||||
if (!string.IsNullOrEmpty(msg))
|
|
||||||
msg = "Han ocurrido errores al convertir a shape.";
|
|
||||||
HelperGlobal.ponMsg(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Lee la capa que se ha seleccionzdo de recogida y se comprueba que contiene los campos necesarios
|
* Lee la capa que se ha seleccionzdo de recogida y se comprueba que contiene los campos necesarios
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using ArcGIS.Core.Data;
|
using ArcGIS.Core.Data;
|
||||||
using ArcGIS.Core.Geometry;
|
using ArcGIS.Core.Geometry;
|
||||||
using ArcGIS.Core.Internal.CIM;
|
using ArcGIS.Core.Internal.CIM;
|
||||||
|
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
||||||
using OliviaAddInPro.Helper;
|
using OliviaAddInPro.Helper;
|
||||||
using OliviaAddInPro.Model;
|
using OliviaAddInPro.Model;
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -9,6 +10,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using static OliviaAddInPro.Model.LimpiezaDef;
|
||||||
|
|
||||||
namespace OliviaAddInPro.Services
|
namespace OliviaAddInPro.Services
|
||||||
{
|
{
|
||||||
|
|
@ -25,17 +27,27 @@ namespace OliviaAddInPro.Services
|
||||||
* Modo 0, sectorizar
|
* Modo 0, sectorizar
|
||||||
* Modo 1, planificar
|
* Modo 1, planificar
|
||||||
*/
|
*/
|
||||||
public bool Sectoriza()
|
public TareaRes Sectoriza(CancelableProgressorSource cps)
|
||||||
{
|
{
|
||||||
|
var res = new TareaRes()
|
||||||
|
{
|
||||||
|
Errores = false,
|
||||||
|
data = null,
|
||||||
|
msg = ""
|
||||||
|
};
|
||||||
|
|
||||||
com = (TratamientoComun)limp;
|
com = (TratamientoComun)limp;
|
||||||
string nombFileAmbs = string.Empty;
|
string nombFileAmbs = string.Empty;
|
||||||
|
cps.Status = "Preparando filtro para la exportacion";
|
||||||
//Prepara consulta
|
//Prepara consulta
|
||||||
ErrStr = string.Empty;
|
ErrStr = string.Empty;
|
||||||
if (!PreparaConsulta(out nombFileAmbs))
|
if (!PreparaConsulta(out nombFileAmbs))
|
||||||
{
|
{
|
||||||
ErrStr = "No se ha seleccionado una consulta válida" + limp.ConsultaAmbs;
|
res.msg= "No se ha seleccionado una consulta válida" + limp.ConsultaAmbs;
|
||||||
return false;
|
res.Errores = true;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
cps.Value = 10;
|
||||||
|
|
||||||
//Prepara nombre
|
//Prepara nombre
|
||||||
string fechaHora = string.Empty;
|
string fechaHora = string.Empty;
|
||||||
|
|
@ -44,13 +56,16 @@ namespace OliviaAddInPro.Services
|
||||||
//Pone nombre al shape en función de los ámbitos, el tratamiento, y los polígonos + timestamp
|
//Pone nombre al shape en función de los ámbitos, el tratamiento, y los polígonos + timestamp
|
||||||
limp.NombreShpExport = prefNameExport + "T" + limp.TipoTto.ToString("00") + nombFileAmbs + DameStrPoligs() + "_" + fechaHora + extShp;
|
limp.NombreShpExport = prefNameExport + "T" + limp.TipoTto.ToString("00") + nombFileAmbs + DameStrPoligs() + "_" + fechaHora + extShp;
|
||||||
|
|
||||||
|
string msg = "";
|
||||||
//comienza ejecucion
|
//comienza ejecucion
|
||||||
if(!ComienzaEjec(ModosEjec.Sectoriza))
|
if(!ComienzaEjec(ModosEjec.Sectoriza, cps, out msg))
|
||||||
{
|
{
|
||||||
return false;
|
res.Errores = true;
|
||||||
|
res.msg = msg;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,25 +80,33 @@ namespace OliviaAddInPro.Services
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Planifica()
|
public TareaRes Planifica(CancelableProgressorSource cps)
|
||||||
{
|
{
|
||||||
|
TareaRes res = new TareaRes()
|
||||||
|
{
|
||||||
|
Errores = false,
|
||||||
|
msg = "",
|
||||||
|
data = null
|
||||||
|
};
|
||||||
//se asegura que tiene todo para planif
|
//se asegura que tiene todo para planif
|
||||||
ErrStr = string.Empty;
|
//ErrStr = string.Empty;
|
||||||
if (!CompruebaPlanif())
|
if (!CompruebaPlanif())
|
||||||
{
|
{
|
||||||
//ErrStr = "En la capa de ámbitos seleccionada no se encuentran columnas de SECTOR y/o SECUENCIA, necesarias para planificar";
|
res.msg = "En la capa de ámbitos seleccionada no se encuentran columnas de SECTOR y/o SECUENCIA, necesarias para planificar";
|
||||||
return false;
|
res.Errores = true;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
//Prepara consulta
|
//Prepara consulta
|
||||||
string nombFileAmbs = string.Empty;
|
string nombFileAmbs = string.Empty;
|
||||||
//Prepara consulta
|
//Prepara consulta
|
||||||
if (!PreparaConsulta(out nombFileAmbs))
|
if (!PreparaConsulta(out nombFileAmbs))
|
||||||
{
|
{
|
||||||
ErrStr = "No se ha seleccionado una consulta válida" + limp.ConsultaAmbs;
|
res.msg = "No se ha seleccionado una consulta válida" + limp.ConsultaAmbs;
|
||||||
return false;
|
res.Errores = true;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string DameAmbsConsulta(out string ambs_file)
|
public string DameAmbsConsulta(out string ambs_file)
|
||||||
|
|
@ -93,7 +116,9 @@ namespace OliviaAddInPro.Services
|
||||||
consulta = string.Empty;
|
consulta = string.Empty;
|
||||||
ambs_file = "";
|
ambs_file = "";
|
||||||
orstr = null;
|
orstr = null;
|
||||||
for (int i = 0; i < limp.AmbitosSel.Length; i++)
|
var n = limp.AmbitosSel.Length;
|
||||||
|
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
if (limp.AmbitosSel[i])
|
if (limp.AmbitosSel[i])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using OliviaAddInPro.Helper;
|
using OliviaAddInPro.Helper;
|
||||||
|
using static OliviaAddInPro.Model.LimpiezaDef;
|
||||||
|
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
||||||
|
using ArcGIS.Desktop.Framework.Contracts;
|
||||||
namespace OliviaAddInPro
|
namespace OliviaAddInPro
|
||||||
{
|
{
|
||||||
class PaneLimpiezaViewModel : PanelViewModelBase
|
class PaneLimpiezaViewModel : PanelViewModelBase
|
||||||
|
|
@ -20,8 +22,7 @@ namespace OliviaAddInPro
|
||||||
_subPanel1ViewModel = new PaneLimpiezaSub1ViewModel();
|
_subPanel1ViewModel = new PaneLimpiezaSub1ViewModel();
|
||||||
_subPanel2ViewModel = new PaneLimpiezaSub2ViewModel();
|
_subPanel2ViewModel = new PaneLimpiezaSub2ViewModel();
|
||||||
_subPanel3ViewModel = new PaneLimpiezaSub3ViewModel();
|
_subPanel3ViewModel = new PaneLimpiezaSub3ViewModel();
|
||||||
_subPanel4ViewModel = new PaneLimpiezaSub4ViewModel();
|
_subPanel4ViewModel = new PaneLimpiezaSub4ViewModel();
|
||||||
|
|
||||||
|
|
||||||
OptionsMenu = new ObservableCollection<OptionsMenuItem>
|
OptionsMenu = new ObservableCollection<OptionsMenuItem>
|
||||||
{
|
{
|
||||||
|
|
@ -150,14 +151,29 @@ namespace OliviaAddInPro
|
||||||
public void Ejecuta(OliviaAddInPro.Services.ModosEjec modo)
|
public void Ejecuta(OliviaAddInPro.Services.ModosEjec modo)
|
||||||
{
|
{
|
||||||
string err = "";
|
string err = "";
|
||||||
if(!Lee(out err))
|
|
||||||
|
|
||||||
|
OliviaGlob.progrDialog.Show();
|
||||||
|
var progSrc = new CancelableProgressorSource(OliviaGlob.progrDialog);
|
||||||
|
|
||||||
|
|
||||||
|
if (!Lee(out err))
|
||||||
{
|
{
|
||||||
HelperGlobal.ponMsg(err);
|
HelperGlobal.ponMsg(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OliviaGlob.Limp.Ejecuta(modo);
|
Action<TareaRes> ac = finEjecuta;
|
||||||
|
OliviaGlob.Limp.EjecutaAsync(modo, progSrc, ac);
|
||||||
|
//res.
|
||||||
|
}
|
||||||
|
public void finEjecuta(TareaRes res)
|
||||||
|
{
|
||||||
|
OliviaGlob.progrDialog.Hide();
|
||||||
|
if (res.Errores)
|
||||||
|
{
|
||||||
|
HelperGlobal.ponMsg(res.msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue