No demasiados avances en importación
parent
9e8f4e6d25
commit
e2ec0d2dc6
|
|
@ -1683,8 +1683,7 @@ namespace OliviaAddInPro.Helper
|
|||
{
|
||||
ArcGIS.Core.Geometry.SpatialReference spatref = GetSpatRef(fc);
|
||||
var environments = Geoprocessing.MakeEnvironmentArray(outputCoordinateSystem: spatref);
|
||||
IGPResult gpResult = Geoprocessing.ExecuteToolAsync("FeatureClassToFeatureClass_conversion", args,
|
||||
environments, null, null).Result;
|
||||
IGPResult gpResult = Geoprocessing.ExecuteToolAsync("FeatureClassToFeatureClass_conversion", args, environments).Result;
|
||||
if (gpResult.IsCanceled)
|
||||
{
|
||||
return res;
|
||||
|
|
@ -1799,5 +1798,27 @@ namespace OliviaAddInPro.Helper
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Abre en el mapa la capa seleccionada, con los parámetros seleccionados
|
||||
*/
|
||||
public static bool OpenLayer(string ftclasspath, string campValUniq, bool visible)
|
||||
{
|
||||
var mapView = MapView.Active;
|
||||
int indexNumber = mapView.Map.Layers.Count;
|
||||
string ftclassname = System.IO.Path.GetFileNameWithoutExtension(ftclasspath);
|
||||
if (mapView != null)//Check if there is a map
|
||||
{
|
||||
System.Uri ftclass_uri = new System.Uri(ftclasspath); //creating uri for the ftclass
|
||||
QueuedTask.Run(() =>
|
||||
{
|
||||
Layer layer = LayerFactory.Instance.CreateLayer(ftclass_uri, mapView.Map, indexNumber, ftclassname);
|
||||
var selectedLayer = mapView.GetSelectedLayers()[0] as FeatureLayer;
|
||||
//Do something with selected layer
|
||||
selectedLayer.SetVisibility(visible);
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,10 +125,13 @@ namespace OliviaAddInPro.Model
|
|||
auxi = auxi.Substring(0, indice);
|
||||
}
|
||||
auxl = indice - aux;
|
||||
if (auxl <= 0)
|
||||
return;
|
||||
if (auxl > 0)
|
||||
{
|
||||
auxili = shapefile.Substring(aux, auxl);
|
||||
ambitos = ambitos + auxili;
|
||||
}
|
||||
//concatena el timestamp
|
||||
ambitos = ambitos + shapefile.Substring(aux);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,11 +146,14 @@ namespace OliviaAddInPro.Model
|
|||
auxi = auxi.Substring(0, indice);
|
||||
}
|
||||
auxl = indice - aux;
|
||||
if (auxl <= 0)
|
||||
return;
|
||||
if (auxl > 0)
|
||||
{
|
||||
auxili = shapefile.Substring(aux, auxl);
|
||||
carga = carga + auxili;
|
||||
}
|
||||
|
||||
//concatena el timestamp
|
||||
carga = carga + shapefile.Substring(aux);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -377,9 +377,15 @@ namespace OliviaAddInPro.Services
|
|||
*/
|
||||
public Respuesta<string> ImportSecto(string GdbFileName)
|
||||
{
|
||||
/*var res = new Respuesta<string> { Value = string.Empty };
|
||||
return res;*/
|
||||
return Import(GdbFileName, 0);
|
||||
var res = new Respuesta<string> { Value = string.Empty };
|
||||
res = Import(GdbFileName, 0);
|
||||
if (res.HasError)
|
||||
return res;
|
||||
//////////////////////////////////////////////////
|
||||
//abre las capas, pintando los sectores
|
||||
HelperGdb.CloseAllLayers();
|
||||
|
||||
return res;
|
||||
}
|
||||
/**
|
||||
* Realiza las funciones de importación, modo 0 secto, modo 1 planif
|
||||
|
|
@ -436,7 +442,10 @@ namespace OliviaAddInPro.Services
|
|||
HelperGlobal.ponMsg(err_spatref +", se ha creado un nuevo dataset "+ datasetNameOut );
|
||||
tratamiento = datasetNameOut;
|
||||
}
|
||||
string dataset = tratamiento;
|
||||
//NO hace falta preguntar ni comprobar el ftclass porque pone el timestamp y el nombre es único
|
||||
|
||||
/*
|
||||
/////////////////////////////////////////
|
||||
//pregunta a ver si se quiere ese nombre u otro
|
||||
bool replace = false;
|
||||
|
|
@ -475,6 +484,8 @@ namespace OliviaAddInPro.Services
|
|||
HelperGlobal.ponMsg(err_spatref);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/////////////////////////////////////////
|
||||
//todo ok, se pone a importar
|
||||
string err_st=string.Empty;
|
||||
|
|
@ -542,7 +553,7 @@ namespace OliviaAddInPro.Services
|
|||
for (i = 0; i < NIMPORT; i++)
|
||||
{
|
||||
//mira a ver si hay que borrar para reemplazar
|
||||
if (replace)
|
||||
/*if (replace)
|
||||
{
|
||||
resp2 = HelperGdb.DeleteFeatureClass(GdbFileName, noms_gdb[i]);
|
||||
if (!resp2.Value)
|
||||
|
|
@ -552,7 +563,7 @@ namespace OliviaAddInPro.Services
|
|||
err_st += " " + resp2.Error.First();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
resp2 = HelperGdb.ImportShp(dir_shp + "\\" + noms_shp[i] + HelperGdb.SHP_EXT, GdbFileName + "\\" + dataset, noms_gdb[i]);
|
||||
if (!resp2.Value)
|
||||
{
|
||||
|
|
@ -588,6 +599,23 @@ namespace OliviaAddInPro.Services
|
|||
public Respuesta<string> ImportPlanif(string GdbFileName)
|
||||
{
|
||||
var res = new Respuesta<string> { Value = string.Empty };
|
||||
res = Import(GdbFileName, 1);
|
||||
if (res.HasError)
|
||||
return res;
|
||||
//abre las capas, pintando por sectores
|
||||
/////////////////////////////////////////////////////
|
||||
//la primera capa que se añade es la de ruta, se le quita la visualización porque lo que interesa
|
||||
//de esa capa es poder acceder si fuera necesario a la tabla de atributos. shape + name_ruta_out
|
||||
/////////////////////////////////////////////////////
|
||||
//la siguiente es la de ruta2, se le quita la visualización porque lo que interesa
|
||||
//de esa capa es poder acceder si fuera necesario a la tabla de atributos. shape + name_ruta2_out
|
||||
/////////////////////////////////////////////////////
|
||||
//se añade la capa de ruta_aux y se pinta por sectores - shape + name_ruta_out + name_aux
|
||||
/////////////////////////////////////////////////////
|
||||
//se añade la capa de ambitos original con la secto, y se pinta por sectores - shape
|
||||
/////////////////////////////////////////////////////
|
||||
//se añade la capa de la ruta a las instalaciones, comprueba si hay configurada coordenadas de la instalación - shape + name_inst_out
|
||||
//se abre la capa de puntos de control y se pintan por el sector al que pertenecen - shape + name_control_out
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,14 +152,14 @@ namespace OliviaAddInPro.Services
|
|||
OliviaGlob.progrDialog.Hide();
|
||||
//muestra la ventana
|
||||
OliviaGlob.ShowHidePane(true);
|
||||
/*var task = ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
||||
var task = ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
|
||||
{
|
||||
//borra los archivos que le toca borrar
|
||||
BorraFiles();
|
||||
});
|
||||
task.Wait();*/
|
||||
task.Wait();
|
||||
//borra los archivos que le toca borrar
|
||||
BorraFiles();
|
||||
//BorraFiles();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue