integracion con cambios debelop
commit
114abcccc2
|
|
@ -30,7 +30,6 @@ namespace OliviaAddInPro
|
|||
if (OliviaGlob.TipoView == TiposEjecucion.Ninguno)
|
||||
{
|
||||
///Comprueba que existe la red navegable configurada
|
||||
|
||||
if (!OliviaGlob.CompruebaNwYCampos())
|
||||
{
|
||||
HelperGlobal.ponMsg("No se encuentra red navegable, cambie Configuración: " + HelperGdb.OutStr,
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ using ArcGIS.Core.Data;
|
|||
using ArcGIS.Desktop.Mapping;
|
||||
using ArcGIS.Core.Internal.CIM;
|
||||
using ArcGIS.Desktop.Internal.Layouts.Utilities;
|
||||
|
||||
using ArcGIS.Desktop.Core.Geoprocessing;
|
||||
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
||||
using ArcGIS.Desktop.Editing;
|
||||
|
|
@ -25,6 +26,7 @@ using ArcGIS.Core.Data.DDL;
|
|||
using ArcGIS.Core.CIM;
|
||||
using System.Threading;
|
||||
using ArcGIS.Core.Data.Exceptions;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace OliviaAddInPro.Helper
|
||||
{
|
||||
|
|
@ -434,44 +436,123 @@ namespace OliviaAddInPro.Helper
|
|||
|
||||
}
|
||||
|
||||
//Dado un path de una feature class devuelve la ftclass abierta directamente,
|
||||
//o null si ha habido algún problema o no lo ha encontrado
|
||||
public static FeatureClass GetFtClass(string pathFtClss)
|
||||
{
|
||||
FeatureClass ftclss = null;
|
||||
if (string.IsNullOrEmpty(pathFtClss))
|
||||
return null;
|
||||
Geodatabase gdb = GetGdb(pathFtClss).Result;
|
||||
ReiniciaOutStr();
|
||||
if (gdb != null)
|
||||
{
|
||||
ftclss = GetFtClass(System.IO.Path.GetFileNameWithoutExtension(pathFtClss), gdb).Result;
|
||||
}
|
||||
else //mira a ver si es shapefile
|
||||
{
|
||||
ftclss = GetFtClassFromShp(pathFtClss).Result;
|
||||
}
|
||||
Free(gdb);
|
||||
return ftclss;
|
||||
}
|
||||
//Dado un path de una feature class devuelve la ftclass abierta directamente,
|
||||
//o null si ha habido algún problema o no lo ha encontrado
|
||||
public static FeatureClass GetFtClassSync(string pathFtClss)
|
||||
{
|
||||
FeatureClass ftclss = null;
|
||||
FeatureDataset dtset = null;
|
||||
if (string.IsNullOrEmpty(pathFtClss))
|
||||
return null;
|
||||
Geodatabase gdb = GetGdbSync(pathFtClss);
|
||||
ReiniciaOutStr();
|
||||
if (gdb != null)
|
||||
{
|
||||
ftclss = GetFtClassSync(System.IO.Path.GetFileNameWithoutExtension(pathFtClss), gdb);
|
||||
string dtsetName = new DirectoryInfo(System.IO.Path.GetDirectoryName(pathFtClss)).Name;
|
||||
try
|
||||
{
|
||||
dtset = gdb.OpenDataset<FeatureDataset>(dtsetName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HelperGdb.OutStr = "Error al abrir Dataset " + dtsetName + ": " + ex.Message;
|
||||
dtset= null;
|
||||
}
|
||||
|
||||
string ftclassName = System.IO.Path.GetFileNameWithoutExtension(pathFtClss);
|
||||
if (dtset != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
ftclss = dtset.OpenDataset<FeatureClass>(ftclassName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ftclss = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
ftclss = gdb.OpenDataset<FeatureClass>(ftclassName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ftclss = null;
|
||||
}
|
||||
}
|
||||
if(ftclss==null)
|
||||
HelperGdb.OutStr = "Error al abrir Feature Class " + ftclassName;
|
||||
}
|
||||
else //mira a ver si es shapefile
|
||||
{
|
||||
ftclss = GetFtClassFromShpSync(pathFtClss);
|
||||
ftclss = GetFtClassFromShpSync(pathFtClss).Result;
|
||||
}
|
||||
Free(gdb);
|
||||
Free(dtset);
|
||||
return ftclss;
|
||||
}
|
||||
//Dado un path de una feature class devuelve la ftclass abierta directamente,
|
||||
//o null si ha habido algún problema o no lo ha encontrado
|
||||
public static FeatureClass GetFtClass(string pathFtClss)
|
||||
{
|
||||
FeatureClass ftclss = null;
|
||||
FeatureDataset dtset = null;
|
||||
if (string.IsNullOrEmpty(pathFtClss))
|
||||
return null;
|
||||
Geodatabase gdb = GetGdb(pathFtClss).Result;
|
||||
ReiniciaOutStr();
|
||||
if (gdb != null)
|
||||
{
|
||||
var task = ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<FeatureClass>)(() =>
|
||||
{
|
||||
string dtsetName = new DirectoryInfo(System.IO.Path.GetDirectoryName(pathFtClss)).Name;
|
||||
try
|
||||
{
|
||||
dtset = gdb.OpenDataset<FeatureDataset>(dtsetName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HelperGdb.OutStr = "Error al abrir Dataset " + dtsetName + ": " + ex.Message;
|
||||
dtset = null;
|
||||
}
|
||||
|
||||
string ftclassName = System.IO.Path.GetFileNameWithoutExtension(pathFtClss);
|
||||
if (dtset != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
ftclss = dtset.OpenDataset<FeatureClass>(ftclassName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ftclss = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
ftclss = gdb.OpenDataset<FeatureClass>(ftclassName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ftclss = null;
|
||||
}
|
||||
}
|
||||
if (ftclss == null)
|
||||
HelperGdb.OutStr = "Error al abrir Feature Class " + ftclassName;
|
||||
return ftclss;
|
||||
}));
|
||||
task.Wait();
|
||||
}
|
||||
else //mira a ver si es shapefile
|
||||
{
|
||||
ftclss = GetFtClassFromShp(pathFtClss).Result;
|
||||
}
|
||||
Free(gdb);
|
||||
Free(dtset);
|
||||
return ftclss;
|
||||
}
|
||||
//Dado el path de una gdb y el nombre de una feature class, devuelve la
|
||||
|
|
@ -2005,12 +2086,13 @@ namespace OliviaAddInPro.Helper
|
|||
if (!string.IsNullOrEmpty(ext_))
|
||||
dlg.DefaultExt = ext_;
|
||||
if (brwsFilt != null)
|
||||
{
|
||||
brwsFilt.BrowsingFilesMode = true;
|
||||
dlg.BrowseFilter = brwsFilt;
|
||||
|
||||
}
|
||||
try
|
||||
{
|
||||
bool? ok = dlg.ShowDialog();
|
||||
|
||||
if ((ok ?? true) && dlg.FilePath.Length > 0)
|
||||
return dlg.FilePath;
|
||||
else
|
||||
|
|
@ -2088,7 +2170,8 @@ namespace OliviaAddInPro.Helper
|
|||
try
|
||||
{
|
||||
FeatureDatasetDefinition featureDatasetDefinition = gdb.GetDefinition<FeatureDatasetDefinition>(datasetName);
|
||||
if(featureDatasetDefinition.GetSpatialReference().Equals(spatref))
|
||||
ArcGIS.Core.Geometry.SpatialReference entr = featureDatasetDefinition.GetSpatialReference();
|
||||
if (entr.Wkid==spatref.Wkid)
|
||||
return 0;
|
||||
return 2;
|
||||
}
|
||||
|
|
@ -2101,7 +2184,10 @@ namespace OliviaAddInPro.Helper
|
|||
|
||||
/**
|
||||
* Crea un FeatureDataset con el nombre dado y la spatialrefernece dada en la gdb dada
|
||||
* Devuelve 0 si no hay que crear nada o si lo ha creado bien, 2 si existe el dataset pero con otra referencia espacial, 1 si da error
|
||||
* Devuelve 0 si no hay que crear nada, existe y coincide ref espac
|
||||
* 2 si existe el dataset pero con otra referencia espacial, así que se crea otro
|
||||
* 1 si da error
|
||||
* 4 si no existe así que se crea
|
||||
*/
|
||||
public static Respuesta<int> CreateDataset(string gdbPath, string datasetName, ArcGIS.Core.Geometry.SpatialReference spatref, out string datasetNameOut)
|
||||
{
|
||||
|
|
@ -2123,6 +2209,7 @@ namespace OliviaAddInPro.Helper
|
|||
bool crea = false;
|
||||
int idat = 1;
|
||||
int r = 2;
|
||||
bool refspatdif = false;
|
||||
while(r==2)
|
||||
{
|
||||
var task1 = CheckDataset(gdb, datasetName);
|
||||
|
|
@ -2141,6 +2228,7 @@ namespace OliviaAddInPro.Helper
|
|||
//existe ese nombre, pero con otra ref espacial
|
||||
//crea un nuevo dataset y avisa
|
||||
datasetName = string.Format("{0}_{1}",datasetName,idat);
|
||||
refspatdif = true;
|
||||
idat++;
|
||||
}
|
||||
else//r==1
|
||||
|
|
@ -2186,10 +2274,11 @@ namespace OliviaAddInPro.Helper
|
|||
task.Wait();
|
||||
if (task.Result.Value)//ha ido bien
|
||||
{
|
||||
if (string.IsNullOrEmpty(datasetNameOut))
|
||||
res.Value = 0;
|
||||
//avisa
|
||||
if (refspatdif)
|
||||
res.Value = 2;
|
||||
else
|
||||
res.Value = 2;//avisa
|
||||
res.Value = 4;
|
||||
//actualiza la gdb
|
||||
Refresh(gdbPath);
|
||||
}
|
||||
|
|
@ -2314,17 +2403,73 @@ namespace OliviaAddInPro.Helper
|
|||
|
||||
/**
|
||||
* Borrar una feature class de un dataset
|
||||
* Devuelve -1 si da error al abrir la gdb, -2 si da error al abrir el ftclass (igual porque no existe)
|
||||
* y 0 si da error el proceso de borrar, y 1 si va todo bien
|
||||
*/
|
||||
public static Respuesta<bool> DeleteFeatureClass(string gdbPath, string featureClassPath)
|
||||
public static Respuesta<int> DeleteFeatureClassSync(string gdbPathDataset, string featureClassName)
|
||||
{
|
||||
var res = new Respuesta<int> { Value = 0 };
|
||||
|
||||
Geodatabase gdb = GetGdbSync(gdbPathDataset);
|
||||
if (gdb == null)
|
||||
{
|
||||
res.Value = -1;
|
||||
return res;
|
||||
}
|
||||
|
||||
FeatureClass ftclss = GetFtClassSync(gdbPathDataset + " \\"+ featureClassName);
|
||||
if (ftclss == null)
|
||||
{
|
||||
res.Value = -2;
|
||||
return res;
|
||||
}
|
||||
|
||||
Respuesta<bool> resp = new Respuesta<bool> { Value = false };
|
||||
SchemaBuilder schemaBuilder = null;
|
||||
try
|
||||
{
|
||||
// Create a FeatureClassDescription object
|
||||
FeatureClassDescription featureClassDescription = new FeatureClassDescription(ftclss.GetDefinition());
|
||||
// Create a SchemaBuilder object
|
||||
schemaBuilder = new SchemaBuilder(gdb);
|
||||
// Add the deletion fo the feature class to our list of DDL tasks
|
||||
schemaBuilder.Delete(featureClassDescription);
|
||||
// Execute the DDL
|
||||
resp.Value = schemaBuilder.Build();
|
||||
if (!resp.Value && schemaBuilder.ErrorMessages.Count > 0)
|
||||
resp.Error.Add(schemaBuilder.ErrorMessages.FirstOrDefault());
|
||||
}
|
||||
catch
|
||||
{
|
||||
resp.Error.Add(schemaBuilder.ErrorMessages.FirstOrDefault());
|
||||
}
|
||||
|
||||
if (resp.Value)
|
||||
res.Value = 1;
|
||||
else
|
||||
{
|
||||
res.Error.Add(resp.Error.FirstOrDefault());
|
||||
}
|
||||
Free(gdb);
|
||||
Free(ftclss);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Borrar una feature class de un dataset
|
||||
*/
|
||||
public static Respuesta<bool> DeleteFeatureClass(string gdbPathDataset, string featureClassName)
|
||||
{
|
||||
var res = new Respuesta<bool> { Value = false };
|
||||
FeatureClass ftclss = GetFtClass(featureClassPath);
|
||||
if (ftclss == null)
|
||||
return res;
|
||||
Geodatabase gdb = GetGdb(gdbPath).Result;
|
||||
|
||||
Geodatabase gdb = GetGdb(gdbPathDataset).Result;
|
||||
if (gdb == null)
|
||||
return res;
|
||||
|
||||
FeatureClass ftclss = GetFtClass(gdbPathDataset + " \\" + featureClassName);
|
||||
if (ftclss == null)
|
||||
return res;
|
||||
|
||||
var task = ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<Respuesta<bool>>)(() =>
|
||||
{
|
||||
Respuesta<bool> resp = new Respuesta<bool> { Value = false };
|
||||
|
|
|
|||
|
|
@ -33,5 +33,18 @@ namespace OliviaAddInPro.Model
|
|||
public static string atr_pedes; //<Atributo del campo FOW que indica peatonal
|
||||
};
|
||||
|
||||
/**
|
||||
* Campos comunes a la capa de entidades
|
||||
*/
|
||||
public struct CamposCom
|
||||
{
|
||||
public static string camp_oid; //<Campo de la tabla de entidades que indica el objectid
|
||||
public static string consulta_sector; //<Campo de la tabla donde se guarda info de sector
|
||||
public static string consulta_secuen; //<Campo de la tabla donde se guarda info de secuencia
|
||||
public static double giro_max;
|
||||
public static double desv_max;
|
||||
public static double desv_max_abs;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ namespace OliviaAddInPro.Model
|
|||
public static string consulta_observ; //<Campo a consultar de la capa de limpieza, observaciones
|
||||
public static string consulta_anch_tip; //<Campo a consultar de la capa de limpieza, ancho tipo
|
||||
public static string consulta_tipolo; //<Campo a consultar de la capa de limpieza, tipología
|
||||
public static string consulta_sector; //<Campo a consultar de la capa planificada, sector
|
||||
public static string consulta_secuen; //<Campo a consultar de la capa planificada, planificacion
|
||||
};
|
||||
/**
|
||||
* Nombre de los atributos (de las capas) sobre los que se realizarán consultas para la limpieza
|
||||
|
|
@ -138,14 +136,11 @@ namespace OliviaAddInPro.Model
|
|||
};
|
||||
public struct OtrosParam
|
||||
{
|
||||
public static double giro_max;
|
||||
public static double anch_peat;
|
||||
public static double anch_ace;
|
||||
public static double anch_aplin;
|
||||
public static double anch_apbat;
|
||||
public static double anch_bordlib;
|
||||
public static double desv_max;
|
||||
public static double desv_max_abs;
|
||||
};
|
||||
//*************************************************************************************
|
||||
//Enums globales limpieza
|
||||
|
|
|
|||
|
|
@ -263,6 +263,12 @@ namespace OliviaAddInPro.Model
|
|||
[DisplayName("Ignorar aislados")]
|
||||
[Description("Indica si por defecto se van a ignorar elementos aislados")]
|
||||
public bool Igno_ais { get; set; }
|
||||
|
||||
[Category("General")]
|
||||
[PropertyOrder(9)]
|
||||
[DisplayName("Campo para exportar ID")]
|
||||
[Description("Nombre del campo que indica el ID del ámbito")]
|
||||
public string id { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 02CamposLimp
|
||||
|
|
@ -378,11 +384,6 @@ namespace OliviaAddInPro.Model
|
|||
#endregion
|
||||
|
||||
#region 04CamposRecogida
|
||||
[Category("Campos Recogida")]
|
||||
[DisplayName("ID")]
|
||||
[Description("Nombre del campo que indica el ID del contenedor")]
|
||||
public string id { get; set; }
|
||||
|
||||
[Category("Campos Recogida")]
|
||||
[DisplayName("Tipo de carga")]
|
||||
[Description("Nombre del campo que indica el tipo de carga")]
|
||||
|
|
@ -1069,37 +1070,37 @@ namespace OliviaAddInPro.Model
|
|||
#endregion
|
||||
|
||||
#region 12TiemposRecoAvanz
|
||||
[Category("Tiempos de Tratamiento Recogida (min) - Avanzadas")]//OCULTAR
|
||||
[Category("Tiempos de Tratamiento Recogida (seg) - Avanzadas")]//OCULTAR
|
||||
[DisplayName("Carga Trasera")]
|
||||
[Description("")]
|
||||
public int t_vaci_trasera { get; set; }
|
||||
|
||||
[Category("Tiempos de Tratamiento Recogida (min) - Avanzadas")]//OCULTAR
|
||||
[Category("Tiempos de Tratamiento Recogida (seg) - Avanzadas")]//OCULTAR
|
||||
[DisplayName("Carga Lateral")]
|
||||
[Description("")]
|
||||
public int t_vaci_lateral { get; set; }
|
||||
|
||||
[Category("Tiempos de Tratamiento Recogida (min) - Avanzadas")]//OCULTAR
|
||||
[Category("Tiempos de Tratamiento Recogida (seg) - Avanzadas")]//OCULTAR
|
||||
[DisplayName("Carga superior")]
|
||||
[Description("")]
|
||||
public int t_vaci_superior { get; set; }
|
||||
|
||||
[Category("Tiempos de Tratamiento Recogida (min) - Avanzadas")]//OCULTAR
|
||||
[Category("Tiempos de Tratamiento Recogida (seg) - Avanzadas")]//OCULTAR
|
||||
[DisplayName("Carga Bilateral")]
|
||||
[Description("")]
|
||||
public int t_vaci_bilateral { get; set; }
|
||||
|
||||
[Category("Tiempos de Tratamiento Recogida (min) - Avanzadas")]//OCULTAR
|
||||
[Category("Tiempos de Tratamiento Recogida (seg) - Avanzadas")]//OCULTAR
|
||||
[DisplayName("Bolseo")]
|
||||
[Description("")]
|
||||
public int t_vaci_bolseo { get; set; }
|
||||
|
||||
[Category("Tiempos de Tratamiento Recogida (min) - Avanzadas")]//OCULTAR
|
||||
[Category("Tiempos de Tratamiento Recogida (seg) - Avanzadas")]//OCULTAR
|
||||
[DisplayName("Lavado")]
|
||||
[Description("")]
|
||||
public int t_vaci_lavado { get; set; }
|
||||
|
||||
[Category("Tiempos de Tratamiento Recogida (min) - Avanzadas")]//OCULTAR
|
||||
[Category("Tiempos de Tratamiento Recogida (seg) - Avanzadas")]//OCULTAR
|
||||
[DisplayName("Otro tipo de carga")]
|
||||
[Description("")]
|
||||
public int t_vaci_otra { get; set; }
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ namespace OliviaAddInPro.Model
|
|||
public const int ProgrMax = 100;
|
||||
public const int ProgrStep = 5;
|
||||
public const int ParamN = 5;
|
||||
public const int ParamLimpN = 45;
|
||||
public const int ParamRecoN = 43;
|
||||
public const int ParamLimpN = 48;
|
||||
public const int ParamRecoN = 46;
|
||||
/*
|
||||
* Define el separador entre parámetros de la llamada al proceso oliviatasks
|
||||
*/
|
||||
|
|
@ -60,7 +60,6 @@ namespace OliviaAddInPro.Model
|
|||
public const string EjecGeoProgName = "olivia";
|
||||
public const string EjecGeoParamIgual = ":";
|
||||
public const string NombOlvTasks = "OliviaTasks";
|
||||
public const string NombColSector = "SECTOR";
|
||||
/**
|
||||
* Define el nombre del grupo de propiedades generales
|
||||
*/
|
||||
|
|
@ -531,6 +530,10 @@ namespace OliviaAddInPro.Model
|
|||
public const string GTO_girmax = "Giro_max_vehiculo";
|
||||
public const string GTO_desv_max = "Desv_max_rel";
|
||||
public const string GTO_desv_max_abs = "Desv_max_abs";
|
||||
public const string GTO_camp_objectid = "Camp_objectid";
|
||||
public const string GTO_camp_sector = "Camp_sector";
|
||||
public const string GTO_camp_secuencia = "Camp_secuencia";
|
||||
|
||||
/**
|
||||
* Define el nombre para mandar a oliviatasks la configuración
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -446,8 +446,6 @@ namespace OliviaAddInPro.Model
|
|||
LimpiezaDef.Campos.consulta_observ = c.cons_obser;
|
||||
LimpiezaDef.Campos.consulta_anch_tip = c.cons_anch_tip;
|
||||
LimpiezaDef.Campos.consulta_tipolo = c.cons_tipolo;
|
||||
LimpiezaDef.Campos.consulta_sector = c.consulta_sector;
|
||||
LimpiezaDef.Campos.consulta_secuen = c.consulta_secuen;
|
||||
|
||||
LimpiezaDef.Atributos.atr_esca = c.atr_esca;
|
||||
LimpiezaDef.Atributos.atr_fuent = c.atr_fuent;
|
||||
|
|
@ -540,10 +538,6 @@ namespace OliviaAddInPro.Model
|
|||
LimpiezaDef.OtrosParam.anch_aplin = c.Ancho_ap_lin_def;
|
||||
LimpiezaDef.OtrosParam.anch_apbat = c.Ancho_ap_bat_def;
|
||||
LimpiezaDef.OtrosParam.anch_bordlib = c.Ancho_bord_lib_def;
|
||||
LimpiezaDef.OtrosParam.giro_max = c.Giro_max_vehiculo;
|
||||
LimpiezaDef.OtrosParam.desv_max = c.Desv_max;
|
||||
LimpiezaDef.OtrosParam.desv_max_abs = c.Desv_max_abs;
|
||||
|
||||
|
||||
//Capas, consultas, atributos y filtros de RECOGIDA
|
||||
|
||||
|
|
@ -635,6 +629,13 @@ namespace OliviaAddInPro.Model
|
|||
ComunDef.AtributosNW.atr_N = c.atr_N;
|
||||
ComunDef.AtributosNW.atr_pedes = c.atr_pedes;
|
||||
|
||||
ComunDef.CamposCom.camp_oid = c.id;
|
||||
ComunDef.CamposCom.consulta_sector = c.consulta_sector;
|
||||
ComunDef.CamposCom.consulta_secuen = c.consulta_secuen;
|
||||
ComunDef.CamposCom.giro_max = c.Giro_max_vehiculo;
|
||||
ComunDef.CamposCom.desv_max = c.Desv_max;
|
||||
ComunDef.CamposCom.desv_max_abs = c.Desv_max_abs;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ namespace OliviaAddInPro.Model
|
|||
public override string[] GetCampos(string capa=null)
|
||||
{
|
||||
string[] camps = {
|
||||
RecogidaDef.campos_def.cons_id,
|
||||
//RecogidaDef.campos_def.cons_id,
|
||||
RecogidaDef.campos_def.cons_nomrec,
|
||||
RecogidaDef.campos_def.cons_lateral ,
|
||||
RecogidaDef.campos_def.cons_fracc,
|
||||
|
|
|
|||
|
|
@ -137,6 +137,8 @@ namespace OliviaAddInPro.Model
|
|||
set { err_str = value; }
|
||||
}
|
||||
|
||||
private ObservableCollection<string> nombCamposOrig = new ObservableCollection<string>();
|
||||
|
||||
/**
|
||||
* Para la ventana de progreso
|
||||
*/
|
||||
|
|
@ -202,10 +204,30 @@ namespace OliviaAddInPro.Model
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restaura el nombre original del campo si se ha truncado a 10 car al exportar a shp
|
||||
*/
|
||||
public Respuesta<bool> RestauraNomCampos(string nombFtClass)
|
||||
public virtual string[] GetCamposOrig()
|
||||
{
|
||||
string[] camps = null;
|
||||
|
||||
if (nombCamposOrig.Count > 0)
|
||||
{
|
||||
camps = new string[nombCamposOrig.Count];
|
||||
for (int i=0;i<nombCamposOrig.Count;i++)
|
||||
{
|
||||
camps[i] = nombCamposOrig[i];
|
||||
}
|
||||
}
|
||||
|
||||
return camps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restaura el nombre original del campo si se ha truncado a 10 car al exportar a shp
|
||||
*/
|
||||
public Respuesta<bool> RestauraNomCampos(string nombFtClass)
|
||||
{
|
||||
int LENGTHCAMPSHP = 10;
|
||||
Respuesta<bool> resp = new Respuesta<bool> { Value = false };
|
||||
|
|
@ -213,7 +235,9 @@ namespace OliviaAddInPro.Model
|
|||
if (fc == null)
|
||||
return resp;
|
||||
////////////////////////////////////////////////////////
|
||||
string[] camps = GetCampos();
|
||||
string[] camps = GetCamposOrig();
|
||||
if (camps == null)
|
||||
return resp;
|
||||
|
||||
ObservableCollection<string> fields = HelperGdb.GetFieldsSync(fc);
|
||||
HelperGdb.Free(fc);
|
||||
|
|
@ -228,6 +252,8 @@ namespace OliviaAddInPro.Model
|
|||
{
|
||||
if (camps[i].Length <= LENGTHCAMPSHP)
|
||||
continue;
|
||||
if (EstaRepeNomb(fields, camps[i]))
|
||||
continue;
|
||||
campTrunc = camps[i].Substring(0, LENGTHCAMPSHP);
|
||||
//si tiene más de 10 caracteres, lo ha truncado al exportar
|
||||
//busca el nombre actual del campo en la fc
|
||||
|
|
@ -251,5 +277,30 @@ namespace OliviaAddInPro.Model
|
|||
|
||||
return resp;
|
||||
}
|
||||
|
||||
private bool EstaRepeNomb(ObservableCollection<string> fields, string nomb)
|
||||
{
|
||||
foreach( string fnomb in fields)
|
||||
{
|
||||
if (string.Compare(fnomb, nomb, true)==0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Guarda el nombre de los campos originales para luego restaurarlos
|
||||
*/
|
||||
public void GuardaNombCamposOrig(string pathFtClass)
|
||||
{
|
||||
FeatureClass fc = HelperGdb.GetFtClassSync(pathFtClass);
|
||||
if (fc != null)
|
||||
{
|
||||
nombCamposOrig = HelperGdb.GetFieldsSync(fc);
|
||||
}
|
||||
else
|
||||
nombCamposOrig = new ObservableCollection<string>();
|
||||
HelperGdb.Free(fc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ namespace OliviaAddInPro.Services
|
|||
c.t_vaci_lateral=90;
|
||||
c.t_vaci_superior=180;
|
||||
c.t_vaci_bilateral=100;
|
||||
c.t_vaci_bolseo=5;
|
||||
c.t_vaci_bolseo=5*60;
|
||||
c.t_vaci_lavado=60;
|
||||
c.t_vaci_otra=60;
|
||||
c.kgmax_max=20000;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using OliviaAddInPro.Helper;
|
|||
using ArcGIS.Core.Internal.Data;
|
||||
using ArcGIS.Desktop.Framework.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.IO;
|
||||
|
||||
namespace OliviaAddInPro.Services
|
||||
{
|
||||
|
|
@ -77,6 +78,12 @@ namespace OliviaAddInPro.Services
|
|||
ErrStr = Resource1.String_cancel_progreso;
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
///Se guarda el nombre de los campos originales
|
||||
///
|
||||
com.GuardaNombCamposOrig(com.CapaElems);
|
||||
|
||||
//Cuenta las filas que cumplen la consulta
|
||||
var nelems = HelperGdb.GetNumElemsSync(com.CapaElems, com.ConsultaAmbs);
|
||||
if (nelems <= 0)
|
||||
|
|
@ -174,9 +181,17 @@ namespace OliviaAddInPro.Services
|
|||
return false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
///Comprueba si está la columna de ObjectId y si no, la crea
|
||||
if(!ComprCreaColOid(OliviaGlob.Paths.PathData, com.CapaElems, filtroEspacial))
|
||||
{
|
||||
ErrStr = "Error al exportar columna " + ComunDef.CamposCom.camp_oid;
|
||||
return false;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//ahora si está en modo planificación y la capa no tiene esa columna, exporta la sectorización
|
||||
if (modo==ModosEjec.Planifica && !string.IsNullOrEmpty(com.CapaPlanif))
|
||||
//ahora si está en modo planificación, ya ha hecho una ejec antes y la capa no tiene esa columna pero la tiene guardada de la ejec anterior, exporta la sectorización
|
||||
if (modo==ModosEjec.Planifica && !string.IsNullOrEmpty(com.CapaPlanif) && OliviaGlob.IsConfig2())
|
||||
{
|
||||
string capa_principal = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData);
|
||||
HelperGdb.CloseLayer(capa_principal);
|
||||
|
|
@ -240,21 +255,6 @@ namespace OliviaAddInPro.Services
|
|||
ErrStr = "Error al añadir buffer a la geometría";
|
||||
return false;
|
||||
}
|
||||
//quita las restricciones
|
||||
if (com.GeomRestr != null)
|
||||
{
|
||||
geom_export = HelperGdb.QuitaGeom(geom_export, com.GeomRestr);
|
||||
if (geom_export == null)
|
||||
{
|
||||
ErrStr = "Error al intersecar con las restricciones.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (com.ProgrSrc._ProgrSrc.Getcancelled())
|
||||
{
|
||||
ErrStr = Resource1.String_cancel_progreso;
|
||||
return false;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////
|
||||
//comprueba si la geometría de exportación contiene a la instalación y a la planta de descarga
|
||||
for (int i = 0; i < coords.Length; i++)
|
||||
|
|
@ -294,6 +294,21 @@ namespace OliviaAddInPro.Services
|
|||
}
|
||||
}
|
||||
}
|
||||
//quita las restricciones de circ
|
||||
if (com.GeomRestr != null)
|
||||
{
|
||||
geom_export = HelperGdb.QuitaGeom(geom_export, com.GeomRestr);
|
||||
if (geom_export == null)
|
||||
{
|
||||
ErrStr = "Error al intersecar con las restricciones.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (com.ProgrSrc._ProgrSrc.Getcancelled())
|
||||
{
|
||||
ErrStr = Resource1.String_cancel_progreso;
|
||||
return false;
|
||||
}
|
||||
|
||||
//mira spatialreference del nw
|
||||
/*FeatureClass fc = HelperGdb.GetFtClass(OliviaGlob.Paths.PathGdbNw);
|
||||
|
|
@ -365,13 +380,13 @@ namespace OliviaAddInPro.Services
|
|||
//Añade al shp exportado la columna de sector y secuencia
|
||||
HelperGdb.FieldToAdd[] fields = new HelperGdb.FieldToAdd[2];
|
||||
//campo SECTOR
|
||||
fields[0].Name = LimpiezaDef.Campos.consulta_sector;
|
||||
fields[0].Alias = LimpiezaDef.Campos.consulta_sector;
|
||||
fields[0].Name = ComunDef.CamposCom.consulta_sector;
|
||||
fields[0].Alias = ComunDef.CamposCom.consulta_sector;
|
||||
fields[0].Tipo = "LONG";
|
||||
fields[0].Length = 0;
|
||||
//campo SECUENCIA
|
||||
fields[1].Name = LimpiezaDef.Campos.consulta_secuen;
|
||||
fields[1].Alias = LimpiezaDef.Campos.consulta_secuen;
|
||||
fields[1].Name = ComunDef.CamposCom.consulta_secuen;
|
||||
fields[1].Alias = ComunDef.CamposCom.consulta_secuen;
|
||||
fields[1].Tipo = "LONG";
|
||||
fields[1].Length = 0;
|
||||
|
||||
|
|
@ -412,8 +427,8 @@ namespace OliviaAddInPro.Services
|
|||
{
|
||||
//context.Invalidate(rowshp);
|
||||
// modify and execute
|
||||
modifyOp.Modify(rowshp, LimpiezaDef.Campos.consulta_sector, rowsecto[LimpiezaDef.Campos.consulta_sector]);
|
||||
modifyOp.Modify(rowshp, LimpiezaDef.Campos.consulta_secuen, rowsecto[LimpiezaDef.Campos.consulta_secuen]);
|
||||
modifyOp.Modify(rowshp, ComunDef.CamposCom.consulta_sector, rowsecto[ComunDef.CamposCom.consulta_sector]);
|
||||
modifyOp.Modify(rowshp, ComunDef.CamposCom.consulta_secuen, rowsecto[ComunDef.CamposCom.consulta_secuen]);
|
||||
rowshp.Store();
|
||||
//context.Invalidate(rowshp);
|
||||
}
|
||||
|
|
@ -495,8 +510,107 @@ namespace OliviaAddInPro.Services
|
|||
}
|
||||
|
||||
/**
|
||||
* Prepara la geometría para exportar los ámbitos
|
||||
* Comrpueba si existe la columna de oid y si no, la crea y la rellena
|
||||
*/
|
||||
public bool ComprCreaColOid(string pathCapa, string pathCapaOrig, SpatialQueryFilter filter)
|
||||
{
|
||||
//comprueba si está el campo
|
||||
int NCAMPS = 1;
|
||||
string[] camps;
|
||||
camps = new string[NCAMPS];
|
||||
camps[0] = ComunDef.CamposCom.camp_oid;
|
||||
int compCamp = HelperGdb.CheckFileds(pathCapa, camps);
|
||||
ErrStr = HelperGdb.OutStr;
|
||||
if (compCamp == 0)
|
||||
return true; //tiene el campo
|
||||
|
||||
//no lo tiene, lo crea
|
||||
//Añade al shp exportado la columna de sector y secuencia
|
||||
HelperGdb.FieldToAdd[] fields = new HelperGdb.FieldToAdd[1];
|
||||
//campo
|
||||
fields[0].Name = ComunDef.CamposCom.camp_oid;
|
||||
fields[0].Alias = ComunDef.CamposCom.camp_oid;
|
||||
fields[0].Tipo = "LONG";
|
||||
fields[0].Length = 0;
|
||||
|
||||
if (!HelperGdb.AddFieldsSync(pathCapa, fields))
|
||||
return false;
|
||||
//vuelve a cerrar la capa
|
||||
string capa_principal = System.IO.Path.GetFileNameWithoutExtension(pathCapa);
|
||||
HelperGdb.CloseLayer(capa_principal);
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//Coge los ids de la capa de la que ha exportado
|
||||
using (FeatureClass fc_orig = HelperGdb.GetFtClassSync(pathCapaOrig))
|
||||
{
|
||||
if (fc_orig == null)
|
||||
return false;
|
||||
List<long> ids = new List<long>();
|
||||
//Añade a la lista los ids que cumplen el filtro espacial
|
||||
try
|
||||
{
|
||||
ids = fc_orig.Select(filter, SelectionType.ObjectID, SelectionOption.Normal).GetObjectIDs().ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
ids = new List<long>();
|
||||
}
|
||||
//Comprueba que hay tantos ids como elementos en el shp
|
||||
using (FeatureClass fc_shp = HelperGdb.GetFtClassSync(pathCapa))
|
||||
{
|
||||
if (fc_shp == null)
|
||||
return false;
|
||||
int nelem_shp = HelperGdb.GetNumElemsSync(fc_shp);
|
||||
if (nelem_shp != ids.Count)
|
||||
return false;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//ahora rellena las columnas
|
||||
try
|
||||
{
|
||||
using (RowCursor rc_shp = fc_shp.Search())
|
||||
{
|
||||
if (rc_shp == null)
|
||||
return false;
|
||||
|
||||
var modifyOp = new ArcGIS.Desktop.Editing.EditOperation();
|
||||
modifyOp.Name = "Actualiza OID";
|
||||
bool ex = false;
|
||||
//modifyOp.Callback((context) =>
|
||||
//{
|
||||
int i = 0;
|
||||
while (rc_shp.MoveNext() && i < ids.Count)
|
||||
{
|
||||
using (Row rowshp = rc_shp.Current)
|
||||
{
|
||||
//context.Invalidate(rowshp);
|
||||
// modify and execute
|
||||
modifyOp.Modify(rowshp, ComunDef.CamposCom.camp_oid, ids[i++]);
|
||||
rowshp.Store();
|
||||
//context.Invalidate(rowshp);
|
||||
}
|
||||
}
|
||||
//}, fc_shp);
|
||||
ex = modifyOp.Execute();
|
||||
ArcGIS.Desktop.Core.Project.Current.SaveEditsAsync();
|
||||
if (ex && modifyOp.IsDone)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepara la geometría para exportar los ámbitos
|
||||
*/
|
||||
public Geometry GetGeomAmbitsExport()
|
||||
{
|
||||
Geometry geomAux = null;
|
||||
|
|
@ -538,7 +652,7 @@ namespace OliviaAddInPro.Services
|
|||
//if (geomAux == null)
|
||||
{
|
||||
//Ahora hace la geometría de los ámbitos que cumplen la consulta
|
||||
geomAmbits = HelperGdb.GetGeomConvexHullSync(fc, filtro);
|
||||
geomAmbits = HelperGdb.GetGeomUnique(fc, filtro);
|
||||
if (geomAmbits == null || geomAmbits.IsEmpty)
|
||||
{
|
||||
ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + HelperGdb.OutStr;
|
||||
|
|
@ -549,7 +663,7 @@ namespace OliviaAddInPro.Services
|
|||
else
|
||||
{
|
||||
geomAux = HelperGdb.IntersectGeom(geomAux, geomAmbits);
|
||||
geomAux = GeometryEngine.Instance.ConvexHull(geomAux);
|
||||
//geomAux = GeometryEngine.Instance.ConvexHull(geomAux);
|
||||
}
|
||||
}
|
||||
//le quita las restricciones
|
||||
|
|
@ -588,8 +702,8 @@ namespace OliviaAddInPro.Services
|
|||
int NCAMPS = 2;
|
||||
string[] camps;
|
||||
camps = new string[NCAMPS];
|
||||
camps[0] = LimpiezaDef.Campos.consulta_sector;
|
||||
camps[1] = LimpiezaDef.Campos.consulta_secuen;
|
||||
camps[0] = ComunDef.CamposCom.consulta_sector;
|
||||
camps[1] = ComunDef.CamposCom.consulta_secuen;
|
||||
return HelperGdb.CheckFiledsSync(pathCapa, camps) == 0;
|
||||
}
|
||||
|
||||
|
|
@ -615,10 +729,10 @@ namespace OliviaAddInPro.Services
|
|||
/**
|
||||
* Realiza las funciones de importación de la sectorización
|
||||
*/
|
||||
public Respuesta<string> ImportSecto(string GdbFileName)
|
||||
public Respuesta<string> ImportSecto(string GdbFileName, string FtClssName)
|
||||
{
|
||||
com.ProgrSrc.IncMessage(10,"Importando capas");
|
||||
var res = Import(GdbFileName, 0);
|
||||
var res = Import(GdbFileName, 0, FtClssName);
|
||||
if (res.HasError || string.IsNullOrEmpty(res.Value))
|
||||
{
|
||||
return res;
|
||||
|
|
@ -630,7 +744,7 @@ namespace OliviaAddInPro.Services
|
|||
string path_import = res.Value;
|
||||
//abre con valor único
|
||||
string path_lyr = path_import;
|
||||
var resb = HelperGdb.OpenLayerUniqueValue(path_lyr, LimpiezaDef.Campos.consulta_sector);
|
||||
var resb = HelperGdb.OpenLayerUniqueValue(path_lyr, ComunDef.CamposCom.consulta_sector);
|
||||
if (!resb.Value)
|
||||
{
|
||||
res.Error.Add("Error al abrir capa "+ path_lyr + " con Valor único. " + resb.Error.FirstOrDefault());
|
||||
|
|
@ -644,10 +758,10 @@ namespace OliviaAddInPro.Services
|
|||
/**
|
||||
* Realiza las funciones de importación de la planificación
|
||||
*/
|
||||
public Respuesta<string> ImportPlanif(string GdbFileName)
|
||||
public Respuesta<string> ImportPlanif(string GdbFileName, string FtClssName)
|
||||
{
|
||||
com.ProgrSrc.IncMessage(10, "Importando capas");
|
||||
var res = Import(GdbFileName, 1);
|
||||
var res = Import(GdbFileName, 1, FtClssName);
|
||||
if (res.HasError || string.IsNullOrEmpty(res.Value))
|
||||
{
|
||||
res.Value = string.Empty;
|
||||
|
|
@ -685,7 +799,7 @@ namespace OliviaAddInPro.Services
|
|||
for(i =0;i<NOPEN;i++)
|
||||
{
|
||||
com.ProgrSrc.IncMessage((uint)(60 / NOPEN));
|
||||
resb = HelperGdb.OpenLayerUniqueValue(path_lyr_arr[i], LimpiezaDef.Campos.consulta_sector, visible_arr[i]);
|
||||
resb = HelperGdb.OpenLayerUniqueValue(path_lyr_arr[i], ComunDef.CamposCom.consulta_sector, visible_arr[i]);
|
||||
if (!resb.Value)
|
||||
break;
|
||||
}
|
||||
|
|
@ -703,7 +817,7 @@ namespace OliviaAddInPro.Services
|
|||
/**
|
||||
* Realiza las funciones de importación, modo 0 secto, modo 1 planif
|
||||
*/
|
||||
public Respuesta<string> Import(string GdbFileName, int modo)
|
||||
public Respuesta<string> Import(string GdbFileName, int modo, string FtClssName="")
|
||||
{
|
||||
var res = new Respuesta<string> { Value = string.Empty };
|
||||
|
||||
|
|
@ -734,6 +848,8 @@ namespace OliviaAddInPro.Services
|
|||
/////////////////////////////////////////
|
||||
/////mira a ver si tiene configurado Dataset
|
||||
string msg_avisa = string.Empty;
|
||||
string amb_aux = string.Empty;
|
||||
bool sobreescribe = false;
|
||||
if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathDatasetImport))
|
||||
{
|
||||
var datname = new System.IO.DirectoryInfo(OliviaGlob.Paths.PathDatasetImport).Name;
|
||||
|
|
@ -748,10 +864,29 @@ namespace OliviaAddInPro.Services
|
|||
msg_avisa = "No se encuentra el Dataset " + datname + ". ";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/////////////////////////////////////////
|
||||
//no tiene un dataset configurado, saca ventana para elegir uno
|
||||
//saca ventana para elegir Dataset, si se cancela, se guarda en el nombre por defecto en función del tratamiento y los ámbitos
|
||||
//HelperGlobal.ponMsg("A continuación, introduzca nombre de Feature Class y ubicación (Dataset) para importación. Si cancela el proceso, se establecerán el nombre y Dataset por defecto en función de los ámbitos y el tratamiento");
|
||||
string path_aux = FtClssName;
|
||||
//HelperGdb.SaveFileDlg("Introduzca nombre de Feature Class a importar", GdbFileName, null, ArcGIS.Desktop.Catalog.ItemFilters.featureClasses_all);
|
||||
if (!string.IsNullOrEmpty(path_aux))
|
||||
{
|
||||
tratamiento = new DirectoryInfo(System.IO.Path.GetDirectoryName(path_aux)).Name;
|
||||
//tratamiento = System.IO.Path.GetFileName(System.IO.Path.GetDirectoryName(path_aux));
|
||||
amb_aux = System.IO.Path.GetFileNameWithoutExtension(path_aux);
|
||||
//comprueba si ya existe ese ft class
|
||||
FeatureClass ft = HelperGdb.GetFtClass(path_aux);
|
||||
if (ft != null)
|
||||
sobreescribe = true;
|
||||
}
|
||||
}
|
||||
//crea el dataset o comprueba si existe
|
||||
string datasetNameOut = string.Empty;
|
||||
var resp = HelperGdb.CreateDataset(GdbFileName, tratamiento, spatRefData, out datasetNameOut);
|
||||
string err_spatref = "Atención, no coincide la proyección de las FeatureClass del Dataset ya creado con la del FeatureClass a importar";
|
||||
|
||||
if(resp.Value==0)
|
||||
{
|
||||
//avisa
|
||||
|
|
@ -764,19 +899,33 @@ namespace OliviaAddInPro.Services
|
|||
res.Error.Add("Error al crear el Dataset para importar " + tratamiento);
|
||||
return res;
|
||||
}
|
||||
else if (resp.Value == 2)
|
||||
else //2 o 4 if (resp.Value == 2)
|
||||
{
|
||||
//avisa
|
||||
msg_avisa = err_spatref + ", se ha creado un nuevo dataset " + datasetNameOut;
|
||||
string err_spatref = string.Empty;
|
||||
if (resp.Value==2)
|
||||
err_spatref = "Atención, no coincide la proyección de las FeatureClass del Dataset ya creado con la del FeatureClass a importar. ";
|
||||
msg_avisa = err_spatref + "Se ha creado un nuevo dataset " + datasetNameOut;
|
||||
//HelperGlobal.ponMsg(err_spatref +", se ha creado un nuevo dataset "+ datasetNameOut );
|
||||
tratamiento = datasetNameOut;
|
||||
}
|
||||
string dataset = tratamiento;
|
||||
//avisa ahora para dar tiempo?
|
||||
if (!string.IsNullOrEmpty(msg_avisa))
|
||||
{
|
||||
if(!HelperGlobal.ponMsg(msg_avisa, MessageBoxImage.Question, "OLIVIA", MessageBoxButton.OKCancel))
|
||||
{
|
||||
res.Error.Add("Proceso de importación Cancelado por el usuario");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
string dataset = tratamiento;
|
||||
/////////////////////////////////////////
|
||||
if (!string.IsNullOrEmpty(amb_aux))
|
||||
ambitos = amb_aux;
|
||||
/////////////////////////////////////////
|
||||
//todo ok, se pone a importar
|
||||
string err_st =string.Empty;
|
||||
string name = ambitos;
|
||||
string path_import = GdbFileName + "\\" + dataset + "\\" + ambitos;
|
||||
int NIMPORT;
|
||||
string[] noms_shp = null;
|
||||
|
|
@ -839,6 +988,17 @@ namespace OliviaAddInPro.Services
|
|||
//se embucla para hacer todas las importaciones necesarias
|
||||
for (i = 0; i < NIMPORT; i++)
|
||||
{
|
||||
//mira a ver si hay que borrar para reemplazar
|
||||
if (sobreescribe)
|
||||
{
|
||||
resp = HelperGdb.DeleteFeatureClassSync(GdbFileName + "\\" + dataset, noms_gdb[i]);
|
||||
if (resp.Value!=-2 && resp.Value!=1) //-2 porque puede ser que no pueda abrir la capa porque no existe
|
||||
{
|
||||
err_st = "Error al sobreescribir la capa " + noms_gdb[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
resp2 = HelperGdb.ImportShp(dir_shp + "\\" + noms_shp[i] + HelperGdb.SHP_EXT, GdbFileName + "\\" + dataset, noms_gdb[i]);
|
||||
if (!resp2.Value)
|
||||
{
|
||||
|
|
@ -853,9 +1013,6 @@ namespace OliviaAddInPro.Services
|
|||
res.Error.Add("Errores en la importación: "+err_st);
|
||||
return res;
|
||||
}
|
||||
//avisa ahora para dar tiempo?
|
||||
if(!string.IsNullOrEmpty(msg_avisa))
|
||||
HelperGlobal.ponMsg(msg_avisa);
|
||||
|
||||
//cambia el nombre de los campos que había truncado a 10 caracteres al exportar a shp
|
||||
//solo para la capa original
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ namespace OliviaAddInPro.Services
|
|||
//actualiza los flags
|
||||
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.FinEjecOk);
|
||||
//importa resultados
|
||||
resp = IniImport();
|
||||
string FtClssName = "";
|
||||
resp = IniImport(out FtClssName);
|
||||
if (resp.HasError)
|
||||
{
|
||||
msg = resp.Error.First();
|
||||
|
|
@ -59,7 +60,7 @@ namespace OliviaAddInPro.Services
|
|||
//actualiza los flags
|
||||
//OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.EjecSecto);
|
||||
//acciones de importación
|
||||
resp2 = inst.ServCom.ImportSecto(GdbFileName);
|
||||
resp2 = inst.ServCom.ImportSecto(GdbFileName, FtClssName);
|
||||
}
|
||||
else if (OliviaGlob.HasFlagTipEjec(TiposEjecucion.EjecPlanif)) //Ha terminado bien la planificación
|
||||
{
|
||||
|
|
@ -68,7 +69,7 @@ namespace OliviaAddInPro.Services
|
|||
//guarda csv
|
||||
//GuardaCsv(inst); en finEjecuta3
|
||||
//acciones de importación
|
||||
resp2 = inst.ServCom.ImportPlanif(GdbFileName);
|
||||
resp2 = inst.ServCom.ImportPlanif(GdbFileName, FtClssName);
|
||||
|
||||
}
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action<Respuesta<string>, Respuesta<string>, bool, string, TratamientoComun>((p, v, x, u, w) => finEjecuta3(p, v, x, u, w)), resp, resp2, mal, msg, inst);
|
||||
|
|
@ -110,6 +111,8 @@ namespace OliviaAddInPro.Services
|
|||
{
|
||||
if (string.IsNullOrEmpty(resp2.Value))
|
||||
{
|
||||
//quita modo config2
|
||||
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.Config2);
|
||||
if (resp2.HasError)
|
||||
{
|
||||
msg = resp2.Error.First();
|
||||
|
|
@ -246,9 +249,10 @@ namespace OliviaAddInPro.Services
|
|||
/*
|
||||
* Inicializa la importación
|
||||
*/
|
||||
public Respuesta<string> IniImport()
|
||||
public Respuesta<string> IniImport(out string FtClssName)
|
||||
{
|
||||
var res = new Respuesta<string>() { Value = string.Empty };
|
||||
FtClssName = string.Empty;
|
||||
//Lanza ventana para elegir gdb a la que importar resultados
|
||||
string GdbFileName="";
|
||||
if (OliviaGlob.CompruebaExistePath(OliviaGlob.Paths.PathGdbImport))
|
||||
|
|
@ -273,6 +277,12 @@ namespace OliviaAddInPro.Services
|
|||
return res;
|
||||
}
|
||||
res.Value = GdbFileName;
|
||||
|
||||
if (string.IsNullOrEmpty(OliviaGlob.Paths.PathDatasetImport))
|
||||
{ //ahora pide elegir nombre de ftclass
|
||||
FtClssName = HelperGdb.SaveFileDlg("Seleccione ubicación e introduzca nombre de Feature Class a importar", GdbFileName, null, ArcGIS.Desktop.Catalog.ItemFilters.featureClasses_all);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,10 +74,15 @@ namespace OliviaAddInPro.Services.LanzaSrv
|
|||
//paths de archivos
|
||||
GeneralDef.EjecGeoParamSep + GeneralDef.GG_pd + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathData + " " +
|
||||
GeneralDef.EjecGeoParamSep + GeneralDef.GG_pn + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathNW + " " +
|
||||
//nombres de cols de sector y secuencia
|
||||
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_camp_sector + GeneralDef.EjecGeoParamIgual + ComunDef.CamposCom.consulta_sector + " " +
|
||||
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_camp_secuencia + GeneralDef.EjecGeoParamIgual + ComunDef.CamposCom.consulta_secuen + " " +
|
||||
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_camp_objectid + GeneralDef.EjecGeoParamIgual + ComunDef.CamposCom.camp_oid + " " +
|
||||
//giro max y desv
|
||||
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_girmax + GeneralDef.EjecGeoParamIgual + LimpiezaDef.OtrosParam.giro_max + " " +
|
||||
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_desv_max + GeneralDef.EjecGeoParamIgual + LimpiezaDef.OtrosParam.desv_max + " " +
|
||||
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_desv_max_abs + GeneralDef.EjecGeoParamIgual + LimpiezaDef.OtrosParam.desv_max_abs + " ";
|
||||
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_girmax + GeneralDef.EjecGeoParamIgual + ComunDef.CamposCom.giro_max + " " +
|
||||
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_desv_max + GeneralDef.EjecGeoParamIgual + ComunDef.CamposCom.desv_max + " " +
|
||||
GeneralDef.EjecGeoParamSep + GeneralDef.GTO_desv_max_abs + GeneralDef.EjecGeoParamIgual + ComunDef.CamposCom.desv_max_abs + " ";
|
||||
//LimpiezaDef.Campos.consulta_sector;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace OliviaAddInPro.Services.LanzaSrv
|
|||
else if (modo == ModosEjec.SoloPlanifica)
|
||||
modo_str = GeneralDef.SockConfTodo;
|
||||
var conf = ConfigServ.Serv.Leer();
|
||||
//van ParamLimpN parámetros, sin incluir "CONFIGURACION", si se añaden, incrementar ParamLimpN
|
||||
//van ParamLimpN parámetros, sin incluir "CONFIGURACION", si se añaden, incrementar ParamRecoN
|
||||
str = GeneralDef.EjecGeoParamSep + modo_str + " " +
|
||||
GeneralDef.EjecGeoParamSep + GeneralDef.GR_camp_cap + GeneralDef.EjecGeoParamIgual + conf.capac + " " +
|
||||
GeneralDef.EjecGeoParamSep + GeneralDef.GR_kgM + GeneralDef.EjecGeoParamIgual + reco.KgMaxVehic + " " +
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ namespace OliviaAddInPro.Services
|
|||
}
|
||||
}
|
||||
|
||||
int result = Environment.TickCount & Int32.MaxValue; //para que el tickcount no sea negativo
|
||||
if (cps.Getcancelled()) //mira a ver si ha cancelado el usuario
|
||||
{
|
||||
//se ha cancelado, lo envía al OliviaTask
|
||||
|
|
@ -137,11 +138,11 @@ namespace OliviaAddInPro.Services
|
|||
if(!fin) //si no ha finalizado normal, el usuario lo ha cancelado
|
||||
res.Error.Add("Proceso Cancelado por el usuario");
|
||||
}
|
||||
else if (!first_send_cfg && ((Math.Abs(Environment.TickCount) - lastprog) >= m_tm_progr) && !fin) //en caso normal, todo va bien, pide el progreso y la tarea
|
||||
else if (!first_send_cfg && ((result - lastprog) >= m_tm_progr) && !fin) //en caso normal, todo va bien, pide el progreso y la tarea
|
||||
{
|
||||
//solo pide la programación cada m_tm_progr milis
|
||||
var pp = pide_progr();
|
||||
if (pp .Value> TiposActu.ActuFinOk)
|
||||
if (pp.Value> TiposActu.ActuFinOk)
|
||||
fin = true;
|
||||
if(pp.HasError)
|
||||
{
|
||||
|
|
@ -153,8 +154,10 @@ namespace OliviaAddInPro.Services
|
|||
else
|
||||
nint++;
|
||||
}
|
||||
if (pp.Value == TiposActu.ActuFinNOk)
|
||||
res.Error.Add("Finalizado proceso con fallos");
|
||||
actualiza(pp);
|
||||
lastprog = Environment.TickCount;
|
||||
lastprog = result;
|
||||
}
|
||||
|
||||
} while (!sal);
|
||||
|
|
|
|||
|
|
@ -28,15 +28,16 @@ namespace OliviaAddInPro.Services
|
|||
*/
|
||||
public int CompruebaCamposReco(string pathCapa)
|
||||
{
|
||||
int NCAMPS = 6;
|
||||
int NCAMPS = 5;
|
||||
string[] camps;
|
||||
camps = new string[NCAMPS];
|
||||
camps[0] = RecogidaDef.campos_def.cons_id;
|
||||
camps[1] = RecogidaDef.campos_def.cons_fracc;
|
||||
camps[2] = RecogidaDef.campos_def.cons_nomrec;
|
||||
camps[3] = RecogidaDef.campos_def.cons_lateral;
|
||||
camps[4] = RecogidaDef.campos_def.cons_uds;
|
||||
camps[5] = RecogidaDef.campos_def.cons_kgrec;
|
||||
|
||||
camps[0] = RecogidaDef.campos_def.cons_fracc;
|
||||
camps[1] = RecogidaDef.campos_def.cons_nomrec;
|
||||
camps[2] = RecogidaDef.campos_def.cons_lateral;
|
||||
camps[3] = RecogidaDef.campos_def.cons_uds;
|
||||
camps[4] = RecogidaDef.campos_def.cons_kgrec;
|
||||
//camps[5] = RecogidaDef.campos_def.cons_id;
|
||||
int compCamp = HelperGdb.CheckFileds(pathCapa, camps);
|
||||
ErrStr = HelperGdb.OutStr;
|
||||
if (compCamp == 0)
|
||||
|
|
|
|||
|
|
@ -213,6 +213,7 @@ namespace OliviaAddInPro
|
|||
TipoTto = -1;
|
||||
VisTextAnchoVia = System.Windows.Visibility.Hidden;
|
||||
OliviaGlob.AddFlagTipEjec(TiposEjecucion.Config); //lo reinicia, por si estaba después de planificar
|
||||
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.Config2);
|
||||
if (string.IsNullOrEmpty(capa))
|
||||
return false;
|
||||
//comprueba los campos de limpieza
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ namespace OliviaAddInPro
|
|||
TiposVehic.Clear();
|
||||
TiposCapac.Clear();
|
||||
OliviaGlob.AddFlagTipEjec(TiposEjecucion.Config); //lo reinicia, por si estaba después de planificar
|
||||
OliviaGlob.RemoveFlagTipEjec(TiposEjecucion.Config2);
|
||||
if (string.IsNullOrEmpty(capa))
|
||||
return false;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue