Merge remote-tracking branch 'origin/Elena/develop' into develop

Gerardo/Compilacion.net
Gerardo 2022-07-06 02:28:20 +02:00
commit 4def578f68
7 changed files with 78 additions and 12 deletions

View File

@ -144,7 +144,7 @@ namespace OliviaAddInPro.Helper
}
public static ArcGIS.Core.Geometry.SpatialReference GetSpatRefSync(string ftclassName)
{
FeatureClass fc = GetFtClassFromShp(ftclassName).Result;
FeatureClass fc = GetFtClassSync(ftclassName);
if (fc == null)
return null;
ArcGIS.Core.Geometry.SpatialReference spatref = null;
@ -1025,6 +1025,29 @@ namespace OliviaAddInPro.Helper
}
}
/**
* Reproyecta la geometría dada a la spatial reference, si son diferentes
*/
public static ArcGIS.Core.Geometry.Geometry ReproyectaGeom(ArcGIS.Core.Geometry.Geometry geom, ArcGIS.Core.Geometry.SpatialReference spatref)
{
ArcGIS.Core.Geometry.Geometry geomSal = null;
try
{
if (geom == null)
return null;
if (geom.SpatialReference == null)
return geom;
if (geom.SpatialReference.Equals(spatref))
return geom;
geomSal = GeometryEngine.Instance.Project(geom, spatref);
return geomSal;
}
catch
{
return null;
}
}
/**
* 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

View File

@ -108,6 +108,9 @@ namespace OliviaAddInPro.Model
[Browsable(false)]
public string path_data { get; set; }
[Browsable(false)]
public string path_cfg_aux { get; set; }
#endregion
#region FILTROS_LIMP
[Browsable(false)]

View File

@ -408,7 +408,7 @@ namespace OliviaAddInPro.Model
public static void IniDefault()
{
var c = ConfigServ.Serv.Leer();
Paths.PathCfg = "";
Paths.PathCfg = c.path_cfg_aux;
Paths.PathWork = c.path_work;
Paths.PathExeOlivia = c.path_exe;
Paths.PathManualOlivia = c.path_manual;

View File

@ -56,6 +56,8 @@ namespace OliviaAddInPro.Services
res.path_manual = pon_path_absoluto(res.path_manual, res.path_work);
res.path_temp = pon_path_absoluto(res.path_temp, res.path_work);
res.path_data = pon_path_absoluto(res.path_data, res.path_work);
res.path_cfg_aux = @"%dir_work%cfg.ini";
res.path_cfg_aux = pon_path_absoluto(res.path_cfg_aux, res.path_work);
return res;
}
@ -65,6 +67,7 @@ namespace OliviaAddInPro.Services
conf.path_manual = pon_path_relativo(conf.path_manual, conf.path_work);
conf.path_temp = pon_path_relativo(conf.path_temp, conf.path_work);
conf.path_data = pon_path_relativo(conf.path_data, conf.path_work);
conf.path_cfg_aux = pon_path_relativo(conf.path_cfg_aux, conf.path_work);
conf.PathGdbGen = pon_path_relativo(conf.PathGdbGen, conf.path_work);
conf.PathSimbVSM = pon_path_relativo(conf.PathSimbVSM, conf.path_work);
@ -78,6 +81,7 @@ namespace OliviaAddInPro.Services
File.WriteAllText(path_cfg, jsonString);
conf.path_exe = pon_path_absoluto(conf.path_exe, conf.path_work);
conf.path_cfg_aux = pon_path_absoluto(conf.path_cfg_aux, conf.path_work);
conf.path_temp = pon_path_absoluto(conf.path_temp, conf.path_work);
conf.path_manual = pon_path_absoluto(conf.path_manual, conf.path_work);
conf.path_data = pon_path_absoluto(conf.path_data, conf.path_work);
@ -164,6 +168,7 @@ namespace OliviaAddInPro.Services
c.Path_Eje_via = "";
c.Path_Gdb_Import = "";
c.Path_Guarda_Csv = "";
c.path_cfg_aux = @"%dir_work%cfg.ini";
/*c.eje_via = "TomTom_Q4_2015___nw";
c.municipios = "TomTom_Q4_2015___a8";*/

View File

@ -89,6 +89,36 @@ namespace OliviaAddInPro.Services
}
com.ProgrSrc.IncMessage(0, "Exportando geometria");
//////////////////////////////////////////////////////////////
Coordinate2D[] coords = { com.CoordsInstal, com.CoordsPlanta };
//Reproyecta las geometrías si es necesario
SpatialReference spatref = HelperGdb.GetSpatRefSync(com.CapaElems);
if (spatref != null)
{
if (com.GeomNiv != null)
com.GeomNiv = HelperGdb.ReproyectaGeom(com.GeomNiv, spatref);
if (com.GeomZon != null)
com.GeomZon = HelperGdb.ReproyectaGeom(com.GeomZon, spatref);
if (com.GeomRestr != null)
com.GeomRestr = HelperGdb.ReproyectaGeom(com.GeomRestr, spatref);
//ahora las coordenadas
for (int i = 0; i < coords.Length; i++)
{
if (com.ProgrSrc._ProgrSrc.Getcancelled())
{
ErrStr = Resource1.String_cancel_progreso;
return false;
}
if (!coords[i].IsEmpty && (coords[i].X != 0))
{
MapPoint mp = MapPointBuilderEx.CreateMapPoint(coords[i].X, coords[i].Y, spatref);
coords[i].X = mp.X;
coords[i].Y = mp.Y;
}
}
}
//////////////////////////////////////////////////////////////
//Obtiene la geometría que envuelve a los ámbitos
Geometry geom_export = null;
geom_export = GetGeomAmbitsExport();
@ -225,7 +255,6 @@ namespace OliviaAddInPro.Services
}
//////////////////////////////////////////////////////////////
//comprueba si la geometría de exportación contiene a la instalación y a la planta de descarga
Coordinate2D[] coords = { com.CoordsInstal, com.CoordsPlanta };
for (int i = 0; i < coords.Length; i++)
{
if (com.ProgrSrc._ProgrSrc.Getcancelled())
@ -504,16 +533,22 @@ namespace OliviaAddInPro.Services
//prepara el filtro con consulta y espacial
SpatialQueryFilter filtro = HelperGdb.CreateFiler(com.ConsultaAmbs, geomAux);
if (geomAux == null)
//if (geomAux == null)
{
//Ahora hace la geometría de los ámbitos que cumplen la consulta, si no hay ya geometría
//Ahora hace la geometría de los ámbitos que cumplen la consulta
geomAmbits = HelperGdb.GetGeomConvexHullSync(fc, filtro);
if (geomAmbits == null || geomAmbits.IsEmpty)
{
ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + HelperGdb.OutStr;
return null;
}
if (geomAux == null)
geomAux = geomAmbits;
else
{
geomAux = HelperGdb.IntersectGeom(geomAux, geomAmbits);
geomAux = GeometryEngine.Instance.ConvexHull(geomAux);
}
}
//le quita las restricciones
if (com.GeomRestr != null)

View File

@ -99,7 +99,7 @@ namespace OliviaAddInPro.Services.LanzaSrv
GeneralDef.EjecGeoParamSep + GeneralDef.GG_port + GeneralDef.EjecGeoParamIgual + OliviaGlob.Conexion.Puerto + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_tout + GeneralDef.EjecGeoParamIgual + OliviaGlob.Conexion.TiempoOutSocket + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_pt + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathTemp + " " +
GeneralDef.EjecGeoParamSep + GeneralDef.GG_pcfg + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathCfg + " ";
GeneralDef.EjecGeoParamSep + GeneralDef.GG_pcfg + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathCfg;
pfi = new ProcessStartInfo(OliviaGlob.Paths.PathExeOlivia, args);
pfi.UseShellExecute = false;

View File

@ -11,10 +11,10 @@
ResizeMode="NoResize">
<Grid>
<Label Content="{Binding TextProceso}" HorizontalAlignment="Left" Margin="76,10,0,0" VerticalAlignment="Top" Width="303" Height="26"/>
<ProgressBar Minimum="0" Maximum="100" HorizontalAlignment="Left" Value="{Binding Progreso, UpdateSourceTrigger=PropertyChanged}" Height="20" Margin="76,40,0,0" VerticalAlignment="Top" Width="303"/>
<Label Content="{Binding TextProceso}" HorizontalAlignment="Left" Margin="30,10,0,0" VerticalAlignment="Top" Width="350" Height="26"/>
<ProgressBar Minimum="0" Maximum="100" HorizontalAlignment="Left" Value="{Binding Progreso, UpdateSourceTrigger=PropertyChanged}" Height="20" Margin="29,40,0,0" VerticalAlignment="Top" Width="350"/>
<Grid HorizontalAlignment="Left" Margin="76,70,0,0" VerticalAlignment="Top" Width="303" Height="70">
<Grid HorizontalAlignment="Left" Margin="30,70,0,0" VerticalAlignment="Top" Width="350" Height="70">
<ScrollViewer MaxHeight="70" >
<TextBlock Text="{Binding TextEstado}" TextWrapping="WrapWithOverflow" />
</ScrollViewer>