diff --git a/Helper/HelperGdb.cs b/Helper/HelperGdb.cs index b681650..daef88c 100644 --- a/Helper/HelperGdb.cs +++ b/Helper/HelperGdb.cs @@ -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 diff --git a/Model/OliviaConf.cs b/Model/OliviaConf.cs index 8138962..449aa1d 100644 --- a/Model/OliviaConf.cs +++ b/Model/OliviaConf.cs @@ -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)] diff --git a/Model/OliviaGlob.cs b/Model/OliviaGlob.cs index f22bfda..8adc142 100644 --- a/Model/OliviaGlob.cs +++ b/Model/OliviaGlob.cs @@ -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; diff --git a/Services/ConfigServ.cs b/Services/ConfigServ.cs index 653760a..8e3d979 100644 --- a/Services/ConfigServ.cs +++ b/Services/ConfigServ.cs @@ -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";*/ diff --git a/Services/EjecServ.cs b/Services/EjecServ.cs index 4bfd4d7..0297759 100644 --- a/Services/EjecServ.cs +++ b/Services/EjecServ.cs @@ -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(); @@ -224,8 +254,7 @@ namespace OliviaAddInPro.Services return false; } ////////////////////////////////////////////////////////////// - //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 }; + //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++) { if (com.ProgrSrc._ProgrSrc.Getcancelled()) @@ -477,7 +506,7 @@ namespace OliviaAddInPro.Services { ErrStr = "No se ha podido abrir la clase " + com.CapaElems; return null; - } + } //Hace la intersección de zonas y niveles geomAux = null; @@ -513,9 +542,13 @@ namespace OliviaAddInPro.Services ErrStr = "No se ha podido generar geometría de los ámbitos" + com.ConsultaAmbs + HelperGdb.OutStr; return null; } - //geomAux = geomAmbits; - geomAux = HelperGdb.IntersectGeom(geomAux, geomAmbits); - geomAux = GeometryEngine.Instance.ConvexHull(geomAux); + if (geomAux == null) + geomAux = geomAmbits; + else + { + geomAux = HelperGdb.IntersectGeom(geomAux, geomAmbits); + geomAux = GeometryEngine.Instance.ConvexHull(geomAux); + } } //le quita las restricciones if (com.GeomRestr != null) diff --git a/Services/LanzaSrv/LanzaOlvServ.cs b/Services/LanzaSrv/LanzaOlvServ.cs index 789b31c..1c73c17 100644 --- a/Services/LanzaSrv/LanzaOlvServ.cs +++ b/Services/LanzaSrv/LanzaOlvServ.cs @@ -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; diff --git a/View/Comun/MarchandoUnaDe.xaml b/View/Comun/MarchandoUnaDe.xaml index b6d86ce..801208c 100644 --- a/View/Comun/MarchandoUnaDe.xaml +++ b/View/Comun/MarchandoUnaDe.xaml @@ -11,10 +11,10 @@ ResizeMode="NoResize"> -