Cambios ventana intermedia para elegir nombre de FeatureClass. sin probar.
parent
23cd733c9b
commit
8081d00bbe
|
|
@ -29,8 +29,7 @@ namespace OliviaAddInPro
|
||||||
|
|
||||||
if (OliviaGlob.TipoView == TiposEjecucion.Ninguno)
|
if (OliviaGlob.TipoView == TiposEjecucion.Ninguno)
|
||||||
{
|
{
|
||||||
///Comprueba que existe la red navegable configurada
|
///Comprueba que existe la red navegable configurada
|
||||||
|
|
||||||
if (!OliviaGlob.CompruebaNwYCampos())
|
if (!OliviaGlob.CompruebaNwYCampos())
|
||||||
{
|
{
|
||||||
HelperGlobal.ponMsg("No se encuentra red navegable, cambie Configuración: " + HelperGdb.OutStr,
|
HelperGlobal.ponMsg("No se encuentra red navegable, cambie Configuración: " + HelperGdb.OutStr,
|
||||||
|
|
|
||||||
|
|
@ -2013,7 +2013,6 @@ namespace OliviaAddInPro.Helper
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool? ok = dlg.ShowDialog();
|
bool? ok = dlg.ShowDialog();
|
||||||
|
|
||||||
if ((ok ?? true) && dlg.FilePath.Length > 0)
|
if ((ok ?? true) && dlg.FilePath.Length > 0)
|
||||||
return dlg.FilePath;
|
return dlg.FilePath;
|
||||||
else
|
else
|
||||||
|
|
@ -2318,16 +2317,64 @@ namespace OliviaAddInPro.Helper
|
||||||
/**
|
/**
|
||||||
* Borrar una feature class de un dataset
|
* Borrar una feature class de un dataset
|
||||||
*/
|
*/
|
||||||
public static Respuesta<bool> DeleteFeatureClass(string gdbPath, string featureClassPath)
|
public static Respuesta<bool> DeleteFeatureClassSync(string gdbPath, string featureClassName)
|
||||||
{
|
{
|
||||||
var res = new Respuesta<bool> { Value = false };
|
var res = new Respuesta<bool> { Value = false };
|
||||||
FeatureClass ftclss = GetFtClass(featureClassPath);
|
|
||||||
|
Geodatabase gdb = GetGdbSync(gdbPath);
|
||||||
|
if (gdb == null)
|
||||||
|
return res;
|
||||||
|
|
||||||
|
FeatureClass ftclss = GetFtClassSync(featureClassName, gdb);
|
||||||
if (ftclss == null)
|
if (ftclss == null)
|
||||||
return res;
|
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 = true;
|
||||||
|
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 gdbPath, string featureClassName)
|
||||||
|
{
|
||||||
|
var res = new Respuesta<bool> { Value = false };
|
||||||
|
|
||||||
Geodatabase gdb = GetGdb(gdbPath).Result;
|
Geodatabase gdb = GetGdb(gdbPath).Result;
|
||||||
if (gdb == null)
|
if (gdb == null)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
FeatureClass ftclss = GetFtClass(featureClassName,gdb).Result;
|
||||||
|
if (ftclss == null)
|
||||||
|
return res;
|
||||||
|
|
||||||
var task = ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<Respuesta<bool>>)(() =>
|
var task = ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run((Func<Respuesta<bool>>)(() =>
|
||||||
{
|
{
|
||||||
Respuesta<bool> resp = new Respuesta<bool> { Value = false };
|
Respuesta<bool> resp = new Respuesta<bool> { Value = false };
|
||||||
|
|
|
||||||
|
|
@ -1069,37 +1069,37 @@ namespace OliviaAddInPro.Model
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 12TiemposRecoAvanz
|
#region 12TiemposRecoAvanz
|
||||||
[Category("Tiempos de Tratamiento Recogida (min) - Avanzadas")]//OCULTAR
|
[Category("Tiempos de Tratamiento Recogida (seg) - Avanzadas")]//OCULTAR
|
||||||
[DisplayName("Carga Trasera")]
|
[DisplayName("Carga Trasera")]
|
||||||
[Description("")]
|
[Description("")]
|
||||||
public int t_vaci_trasera { get; set; }
|
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")]
|
[DisplayName("Carga Lateral")]
|
||||||
[Description("")]
|
[Description("")]
|
||||||
public int t_vaci_lateral { get; set; }
|
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")]
|
[DisplayName("Carga superior")]
|
||||||
[Description("")]
|
[Description("")]
|
||||||
public int t_vaci_superior { get; set; }
|
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")]
|
[DisplayName("Carga Bilateral")]
|
||||||
[Description("")]
|
[Description("")]
|
||||||
public int t_vaci_bilateral { get; set; }
|
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")]
|
[DisplayName("Bolseo")]
|
||||||
[Description("")]
|
[Description("")]
|
||||||
public int t_vaci_bolseo { get; set; }
|
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")]
|
[DisplayName("Lavado")]
|
||||||
[Description("")]
|
[Description("")]
|
||||||
public int t_vaci_lavado { get; set; }
|
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")]
|
[DisplayName("Otro tipo de carga")]
|
||||||
[Description("")]
|
[Description("")]
|
||||||
public int t_vaci_otra { get; set; }
|
public int t_vaci_otra { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -356,7 +356,7 @@ namespace OliviaAddInPro.Services
|
||||||
c.t_vaci_lateral=90;
|
c.t_vaci_lateral=90;
|
||||||
c.t_vaci_superior=180;
|
c.t_vaci_superior=180;
|
||||||
c.t_vaci_bilateral=100;
|
c.t_vaci_bilateral=100;
|
||||||
c.t_vaci_bolseo=5;
|
c.t_vaci_bolseo=5*60;
|
||||||
c.t_vaci_lavado=60;
|
c.t_vaci_lavado=60;
|
||||||
c.t_vaci_otra=60;
|
c.t_vaci_otra=60;
|
||||||
c.kgmax_max=20000;
|
c.kgmax_max=20000;
|
||||||
|
|
|
||||||
|
|
@ -734,6 +734,8 @@ namespace OliviaAddInPro.Services
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
/////mira a ver si tiene configurado Dataset
|
/////mira a ver si tiene configurado Dataset
|
||||||
string msg_avisa = string.Empty;
|
string msg_avisa = string.Empty;
|
||||||
|
string amb_aux = string.Empty;
|
||||||
|
bool sobreescribe = false;
|
||||||
if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathDatasetImport))
|
if (!string.IsNullOrEmpty(OliviaGlob.Paths.PathDatasetImport))
|
||||||
{
|
{
|
||||||
var datname = new System.IO.DirectoryInfo(OliviaGlob.Paths.PathDatasetImport).Name;
|
var datname = new System.IO.DirectoryInfo(OliviaGlob.Paths.PathDatasetImport).Name;
|
||||||
|
|
@ -753,10 +755,17 @@ namespace OliviaAddInPro.Services
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
//no tiene un dataset configurado, saca ventana para elegir uno
|
//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
|
//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, seleccione nombre de Feature Class 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");
|
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 = HelperGdb.SaveFileDlg("Seleccione Dataset donde importar", GdbFileName, null, ArcGIS.Desktop.Catalog.ItemFilters.featureDatasets_all);
|
string path_aux = HelperGdb.SaveFileDlg("Introduzca nombre de Feature Class a importar", GdbFileName, null, ArcGIS.Desktop.Catalog.ItemFilters.featureClasses_all);
|
||||||
if (!string.IsNullOrEmpty(path_aux))
|
if (!string.IsNullOrEmpty(path_aux))
|
||||||
|
{
|
||||||
tratamiento = System.IO.Path.GetDirectoryName(path_aux);
|
tratamiento = 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
|
//crea el dataset o comprueba si existe
|
||||||
string datasetNameOut = string.Empty;
|
string datasetNameOut = string.Empty;
|
||||||
|
|
@ -783,9 +792,6 @@ namespace OliviaAddInPro.Services
|
||||||
}
|
}
|
||||||
string dataset = tratamiento;
|
string dataset = tratamiento;
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
//saca ventana para elegir nombre
|
|
||||||
ShowProWindowSaveFileName wndFileName = new ShowProWindowSaveFileName(ambitos);
|
|
||||||
string amb_aux = wndFileName.GetName();
|
|
||||||
if (!string.IsNullOrEmpty(amb_aux))
|
if (!string.IsNullOrEmpty(amb_aux))
|
||||||
ambitos = amb_aux;
|
ambitos = amb_aux;
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
|
|
@ -852,7 +858,18 @@ namespace OliviaAddInPro.Services
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
//se embucla para hacer todas las importaciones necesarias
|
//se embucla para hacer todas las importaciones necesarias
|
||||||
for (i = 0; i < NIMPORT; i++)
|
for (i = 0; i < NIMPORT; i++)
|
||||||
{
|
{
|
||||||
|
//mira a ver si hay que borrar para reemplazar
|
||||||
|
if (sobreescribe)
|
||||||
|
{
|
||||||
|
resp2 = HelperGdb.DeleteFeatureClassSync(GdbFileName, noms_gdb[i]);
|
||||||
|
if (!resp2.Value)
|
||||||
|
{
|
||||||
|
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]);
|
resp2 = HelperGdb.ImportShp(dir_shp + "\\" + noms_shp[i] + HelperGdb.SHP_EXT, GdbFileName + "\\" + dataset, noms_gdb[i]);
|
||||||
if (!resp2.Value)
|
if (!resp2.Value)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue