From 816d618daa0f63a23795a123eef796029f20ee21 Mon Sep 17 00:00:00 2001 From: Elena Date: Tue, 17 Dec 2019 01:15:01 +0100 Subject: [PATCH] =?UTF-8?q?Organizaci=C3=B3n=20por=20carpetas=20y=20a?= =?UTF-8?q?=C3=B1adido=20IniFile=20y=20Socket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OliviaAddIn/{ => Base}/Comun.cs | 0 OliviaAddIn/{ => Base}/ComunDef.cs | 0 OliviaAddIn/Base/Cstr_socket.cs | 140 +++++++ OliviaAddIn/Base/IniFile.cs | 356 ++++++++++++++++++ OliviaAddIn/{ => Base}/Limpieza.cs | 0 OliviaAddIn/{ => Base}/LimpiezaDef.cs | 0 OliviaAddIn/{ => Base}/Maqueta.cs | 2 +- OliviaAddIn/{ => Base}/OliviaGlob.cs | 1 - OliviaAddIn/{ => Base}/Parquimetros.cs | 0 OliviaAddIn/{ => Base}/Recogida.cs | 298 +++++++++++++++ OliviaAddIn/{ => Base}/RecogidaDef.cs | 0 OliviaAddIn/{ => Base}/Settings.cs | 0 OliviaAddIn/Config.Designer.cs | Bin 11528 -> 11462 bytes OliviaAddIn/Config.esriaddinx | 10 +- OliviaAddIn/{ => Dlg}/DatosCsv.Designer.cs | 0 OliviaAddIn/{ => Dlg}/DatosCsv.cs | 0 OliviaAddIn/{ => Dlg}/DatosCsv.resx | 0 .../{ => Dlg}/EditTxtPlant.Designer.cs | 0 OliviaAddIn/{ => Dlg}/EditTxtPlant.cs | 0 OliviaAddIn/{ => Dlg}/EditTxtPlant.resx | 0 OliviaAddIn/{ => Dlg}/FormCampos.Designer.cs | 0 OliviaAddIn/{ => Dlg}/FormCampos.cs | 0 OliviaAddIn/{ => Dlg}/FormCampos.resx | 0 OliviaAddIn/{ => Dlg}/InicioDlg.Designer.cs | 0 OliviaAddIn/{ => Dlg}/InicioDlg.cs | 1 - OliviaAddIn/{ => Dlg}/InicioDlg.resx | 0 OliviaAddIn/{ => Dlg}/LimpCampos.cs | 0 OliviaAddIn/{ => Dlg}/LimpCampos.resx | 0 OliviaAddIn/{ => Dlg}/LimpiezaDlg.Designer.cs | 0 OliviaAddIn/{ => Dlg}/LimpiezaDlg.cs | 2 +- OliviaAddIn/{ => Dlg}/LimpiezaDlg.resx | 0 OliviaAddIn/{ => Dlg}/LimpiezaDlg.yo-NG.resx | 0 OliviaAddIn/{ => Dlg}/ListCamposVal.cs | 0 .../{ => Dlg}/ListCapasMaqueta.Designer.cs | 0 OliviaAddIn/{ => Dlg}/ListCapasMaqueta.cs | 0 OliviaAddIn/{ => Dlg}/ListCapasMaqueta.resx | 0 OliviaAddIn/{ => Dlg}/ListForm.Designer.cs | 0 OliviaAddIn/{ => Dlg}/ListForm.cs | 0 OliviaAddIn/{ => Dlg}/ListForm.resx | 0 .../{ => Dlg}/ProgresoEjec.Designer.cs | 0 OliviaAddIn/{ => Dlg}/ProgresoEjec.cs | 4 +- OliviaAddIn/{ => Dlg}/ProgresoEjec.resx | 0 .../{ => Dlg}/ProgresoInic.Designer.cs | 0 OliviaAddIn/{ => Dlg}/ProgresoInic.cs | 0 OliviaAddIn/{ => Dlg}/ProgresoInic.resx | 0 OliviaAddIn/{ => Dlg}/RecoCampos.cs | 0 OliviaAddIn/{ => Dlg}/RecoCampos.resx | 0 OliviaAddIn/{ => Dlg}/RecogidaDlg.Designer.cs | 0 OliviaAddIn/{ => Dlg}/RecogidaDlg.cs | 0 OliviaAddIn/{ => Dlg}/RecogidaDlg.resx | 0 OliviaAddIn/{ => Dlg}/SensCampos.Designer.cs | 0 OliviaAddIn/{ => Dlg}/SensCampos.cs | 0 OliviaAddIn/{ => Dlg}/SensCampos.resx | 0 OliviaAddIn/{ => Ejecuta}/Ejecuta.cs | 2 - OliviaAddIn/{ => Ejecuta}/EjecutaLimp.cs | 1 - OliviaAddIn/{ => Ejecuta}/EjecutaReco.cs | 0 OliviaAddIn/{ => Gdb}/DatosGDB.cs | 28 +- OliviaAddIn/{ => Gdb}/DatosGDBEx.cs | 0 OliviaAddIn/{ => Gdb}/DatosGDBLimp.cs | 0 OliviaAddIn/{ => Gdb}/DatosGDBReco.cs | 0 OliviaAddIn/{ => Gdb}/FunGDB.cs | 18 +- OliviaAddIn/OliviaAddIn.csproj | 118 +++--- OliviaAddIn/Properties/AssemblyInfo.cs | 8 +- 63 files changed, 902 insertions(+), 87 deletions(-) rename OliviaAddIn/{ => Base}/Comun.cs (100%) rename OliviaAddIn/{ => Base}/ComunDef.cs (100%) create mode 100644 OliviaAddIn/Base/Cstr_socket.cs create mode 100644 OliviaAddIn/Base/IniFile.cs rename OliviaAddIn/{ => Base}/Limpieza.cs (100%) rename OliviaAddIn/{ => Base}/LimpiezaDef.cs (100%) rename OliviaAddIn/{ => Base}/Maqueta.cs (99%) rename OliviaAddIn/{ => Base}/OliviaGlob.cs (99%) rename OliviaAddIn/{ => Base}/Parquimetros.cs (100%) rename OliviaAddIn/{ => Base}/Recogida.cs (69%) rename OliviaAddIn/{ => Base}/RecogidaDef.cs (100%) rename OliviaAddIn/{ => Base}/Settings.cs (100%) rename OliviaAddIn/{ => Dlg}/DatosCsv.Designer.cs (100%) rename OliviaAddIn/{ => Dlg}/DatosCsv.cs (100%) rename OliviaAddIn/{ => Dlg}/DatosCsv.resx (100%) rename OliviaAddIn/{ => Dlg}/EditTxtPlant.Designer.cs (100%) rename OliviaAddIn/{ => Dlg}/EditTxtPlant.cs (100%) rename OliviaAddIn/{ => Dlg}/EditTxtPlant.resx (100%) rename OliviaAddIn/{ => Dlg}/FormCampos.Designer.cs (100%) rename OliviaAddIn/{ => Dlg}/FormCampos.cs (100%) rename OliviaAddIn/{ => Dlg}/FormCampos.resx (100%) rename OliviaAddIn/{ => Dlg}/InicioDlg.Designer.cs (100%) rename OliviaAddIn/{ => Dlg}/InicioDlg.cs (99%) rename OliviaAddIn/{ => Dlg}/InicioDlg.resx (100%) rename OliviaAddIn/{ => Dlg}/LimpCampos.cs (100%) rename OliviaAddIn/{ => Dlg}/LimpCampos.resx (100%) rename OliviaAddIn/{ => Dlg}/LimpiezaDlg.Designer.cs (100%) rename OliviaAddIn/{ => Dlg}/LimpiezaDlg.cs (99%) rename OliviaAddIn/{ => Dlg}/LimpiezaDlg.resx (100%) rename OliviaAddIn/{ => Dlg}/LimpiezaDlg.yo-NG.resx (100%) rename OliviaAddIn/{ => Dlg}/ListCamposVal.cs (100%) rename OliviaAddIn/{ => Dlg}/ListCapasMaqueta.Designer.cs (100%) rename OliviaAddIn/{ => Dlg}/ListCapasMaqueta.cs (100%) rename OliviaAddIn/{ => Dlg}/ListCapasMaqueta.resx (100%) rename OliviaAddIn/{ => Dlg}/ListForm.Designer.cs (100%) rename OliviaAddIn/{ => Dlg}/ListForm.cs (100%) rename OliviaAddIn/{ => Dlg}/ListForm.resx (100%) rename OliviaAddIn/{ => Dlg}/ProgresoEjec.Designer.cs (100%) rename OliviaAddIn/{ => Dlg}/ProgresoEjec.cs (99%) rename OliviaAddIn/{ => Dlg}/ProgresoEjec.resx (100%) rename OliviaAddIn/{ => Dlg}/ProgresoInic.Designer.cs (100%) rename OliviaAddIn/{ => Dlg}/ProgresoInic.cs (100%) rename OliviaAddIn/{ => Dlg}/ProgresoInic.resx (100%) rename OliviaAddIn/{ => Dlg}/RecoCampos.cs (100%) rename OliviaAddIn/{ => Dlg}/RecoCampos.resx (100%) rename OliviaAddIn/{ => Dlg}/RecogidaDlg.Designer.cs (100%) rename OliviaAddIn/{ => Dlg}/RecogidaDlg.cs (100%) rename OliviaAddIn/{ => Dlg}/RecogidaDlg.resx (100%) rename OliviaAddIn/{ => Dlg}/SensCampos.Designer.cs (100%) rename OliviaAddIn/{ => Dlg}/SensCampos.cs (100%) rename OliviaAddIn/{ => Dlg}/SensCampos.resx (100%) rename OliviaAddIn/{ => Ejecuta}/Ejecuta.cs (99%) rename OliviaAddIn/{ => Ejecuta}/EjecutaLimp.cs (99%) rename OliviaAddIn/{ => Ejecuta}/EjecutaReco.cs (100%) rename OliviaAddIn/{ => Gdb}/DatosGDB.cs (99%) rename OliviaAddIn/{ => Gdb}/DatosGDBEx.cs (100%) rename OliviaAddIn/{ => Gdb}/DatosGDBLimp.cs (100%) rename OliviaAddIn/{ => Gdb}/DatosGDBReco.cs (100%) rename OliviaAddIn/{ => Gdb}/FunGDB.cs (99%) diff --git a/OliviaAddIn/Comun.cs b/OliviaAddIn/Base/Comun.cs similarity index 100% rename from OliviaAddIn/Comun.cs rename to OliviaAddIn/Base/Comun.cs diff --git a/OliviaAddIn/ComunDef.cs b/OliviaAddIn/Base/ComunDef.cs similarity index 100% rename from OliviaAddIn/ComunDef.cs rename to OliviaAddIn/Base/ComunDef.cs diff --git a/OliviaAddIn/Base/Cstr_socket.cs b/OliviaAddIn/Base/Cstr_socket.cs new file mode 100644 index 0000000..996284b --- /dev/null +++ b/OliviaAddIn/Base/Cstr_socket.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; + +namespace OliviaAddIn +{ + unsafe public class Cstr_socket + { + //variables------------------------ + private IntPtr sc; + + //---------------------------------- + public Cstr_socket() + { + sc = IntPtr.Zero; + } + ~Cstr_socket() + { + termina(); + } + //funciones----------------------- + //devuelve -1 si no se ha podido crear socket + //0 si no se puede conectar + //1 si conectado + public bool conecta(string ip, int puerto) + { + termina(); + try + { + sc = str_socket_crea(); + } + catch + { + sc = IntPtr.Zero; + } + if (sc == IntPtr.Zero) + return false; + try + { + return str_socket_conecta(sc, ip, puerto) != 0; + } + catch + { + termina(); + return false; + } + } + + public bool envia(string txt) + { + if (sc == IntPtr.Zero) + return false; + try + { + return 0 != str_socket_envia(sc, txt); + } + catch + { + termina(); + return false; + } + } + public string recibe() + { + + int nb = -2; + if (sc == IntPtr.Zero) + return ""; + try + { + nb = str_socket_recive(sc); + if(nb<=0)//error + return ""; + StringBuilder data = new StringBuilder("", nb); + str_socket_dame_buf(sc, data); + return data.ToString(); + + } + catch + { + termina(); + } + return ""; + } + public string dame_error() + { + if (sc == IntPtr.Zero) + return "Socket nulo"; + try + { + StringBuilder data = new StringBuilder("Sin errores", 1024); + str_socket_dame_error(sc,data); + return data.ToString(); + } + catch + { + termina(); + } + return "Error en funciones de la dll igt_base.dll"; + } + public void termina() + { + if (sc != IntPtr.Zero) + { + try + { + str_socket_borra(sc); + } + catch + { + sc = IntPtr.Zero; + } + sc = IntPtr.Zero; + } + } + //funciones auxiliares------------------------------ + [DllImport("igt_base.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] + unsafe public static extern IntPtr str_socket_crea(); + + [DllImport("igt_base.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] + unsafe public static extern int str_socket_conecta(IntPtr soc, String ip, int puerto); + + [DllImport("igt_base.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] + unsafe public static extern int str_socket_envia(IntPtr soc, String txt); + + [DllImport("igt_base.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] + unsafe public static extern int str_socket_recive(IntPtr soc); + + [DllImport("igt_base.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] + unsafe public static extern void str_socket_dame_buf(IntPtr soc, StringBuilder buf); + + [DllImport("igt_base.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] + unsafe public static extern void str_socket_dame_error(IntPtr soc, StringBuilder error);//llamar con 1024 de espacio + + [DllImport("igt_base.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] + unsafe public static extern void str_socket_borra(IntPtr soc); + } +} diff --git a/OliviaAddIn/Base/IniFile.cs b/OliviaAddIn/Base/IniFile.cs new file mode 100644 index 0000000..a92ad8e --- /dev/null +++ b/OliviaAddIn/Base/IniFile.cs @@ -0,0 +1,356 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Text; + +namespace OliviaAddIn +{ + + public class IniFile + { + +#region "Declarations" + + // *** Lock for thread-safe access to file and local cache *** + private object m_Lock = new object(); + + // *** File name *** + private string m_FileName = null; + public string FileName + { + get + { + return m_FileName; + } + } + + // *** Lazy loading flag *** + //private bool m_Lazy = false; + + // *** Local cache *** + public Dictionary> m_Sections = new Dictionary>(); + + // *** Local cache modified flag *** + private bool m_CacheModified = false; + +#endregion + +#region "Methods" + + // *** Constructor *** + public IniFile(string FileName) + { + Initialize(FileName, false); + } + + + //modo_escritura true, modo edición: se escribe desde el principio, false solo lectura o conserva lo que hubiera + public IniFile(string FileName, bool modo_escritura) + { + Initialize(FileName, modo_escritura); + } + + + // *** Initialization *** + private void Initialize(string FileName, bool modo_escritura) + { + m_FileName = FileName; + Refresh(); + + if (modo_escritura) + m_Sections.Clear(); + } + + // *** Read file contents into local cache *** + public void Refresh() + { + lock (m_Lock) + { + StreamReader sr = null; + try + { + // *** Clear local cache *** + m_Sections.Clear(); + + // *** Open the INI file *** + try + { + if (!File.Exists(m_FileName)) + return; + + sr = new StreamReader(m_FileName, Encoding.Default); + } + catch (FileNotFoundException) + { + return; + } + + // *** Read up the file content *** + Dictionary CurrentSection = null; + string s; + while ((s = sr.ReadLine()) != null) + { + s = s.Trim(); + + // *** Check for section names *** + if (s.StartsWith("[") && s.EndsWith("]")) + { + if (s.Length > 2) + { + string SectionName = s.Substring(1,s.Length-2); + + // *** Only first occurrence of a section is loaded *** + if (m_Sections.ContainsKey(SectionName)) + { + CurrentSection = null; + } + else + { + CurrentSection = new Dictionary(); + m_Sections.Add(SectionName,CurrentSection); + } + } + } + else if (CurrentSection != null) + { + // *** Check for key+value pair *** + int i; + if ((i=s.IndexOf('=')) > 0) + { + int j = s.Length - i - 1; + string Key = s.Substring(0,i).Trim(); + if (Key.Length > 0) + { + // *** Only first occurrence of a key is loaded *** + if (!CurrentSection.ContainsKey(Key)) + { + string Value = (j > 0) ? (s.Substring(i+1,j).Trim()) : (""); + CurrentSection.Add(Key,Value); + } + } + } + } + } + } + finally + { + // *** Cleanup: close file *** + if (sr != null) sr.Close(); + sr = null; + } + } + } + + // *** Flush local cache content *** + public void salvar() + { + lock(m_Lock) + { + // *** If local cache was not modified, exit *** + if (!m_CacheModified) return; + m_CacheModified=false; + + // *** Open the file *** + StreamWriter sw = new StreamWriter(m_FileName, false, Encoding.Default); + + try + { + // *** Cycle on all sections *** + bool First = false; + foreach (KeyValuePair> SectionPair in m_Sections) + { + Dictionary Section = SectionPair.Value; + if (First) sw.WriteLine(); + First = true; + + // *** Write the section name *** + sw.Write('['); + sw.Write(SectionPair.Key); + sw.WriteLine(']'); + + // *** Cycle on all key+value pairs in the section *** + foreach (KeyValuePair ValuePair in Section) + { + // *** Write the key+value pair *** + sw.Write(ValuePair.Key); + sw.Write('='); + sw.WriteLine(ValuePair.Value); + } + } + } + finally + { + // *** Cleanup: close file *** + if (sw != null) sw.Close(); + sw = null; + } + } + } + + // *** Read a value from local cache *** + public string GetValue(string SectionName, string Key, string DefaultValue) + { + // *** Lazy loading *** + //if (m_Lazy) + { + // m_Lazy = false; + //Refresh(); + } + + lock (m_Lock) + { + // *** Check if the section exists *** + Dictionary Section; + if (!m_Sections.TryGetValue(SectionName, out Section)) return DefaultValue; + + // *** Check if the key exists *** + string Value; + if (!Section.TryGetValue(Key, out Value)) return DefaultValue; + + // *** Return the found value *** + return Value; + } + } + + // *** Insert or modify a value in local cache *** + public void SetValue(string SectionName, string Key, string Value) + { + // *** Lazy loading *** + //if (m_Lazy) + { + // m_Lazy = false; + //Refresh(); + } + + lock (m_Lock) + { + // *** Flag local cache modification *** + m_CacheModified = true; + + // *** Check if the section exists *** + Dictionary Section; + if (!m_Sections.TryGetValue(SectionName, out Section)) + { + // *** If it doesn't, add it *** + Section = new Dictionary(); + m_Sections.Add(SectionName,Section); + } + + // *** Modify the value *** + if (Section.ContainsKey(Key)) Section.Remove(Key); + Section.Add(Key, Value); + } + } + + // *** Encode byte array *** + private string EncodeByteArray(byte[] Value) + { + if (Value == null) return null; + + StringBuilder sb = new StringBuilder(); + foreach (byte b in Value) + { + string hex = Convert.ToString(b,16); + int l = hex.Length; + if (l > 2) + { + sb.Append(hex.Substring(l-2,2)); + } + else + { + if (l < 2) sb.Append("0"); + sb.Append(hex); + } + } + return sb.ToString(); + } + + // *** Decode byte array *** + private byte[] DecodeByteArray(string Value) + { + if (Value == null) return null; + + int l = Value.Length; + if (l < 2) return new byte[] { }; + + l /= 2; + byte[] Result = new byte[l]; + for (int i=0; iW*%7tDk5kZ-A&;SiA(f$sAstBOGbl`+C?v|LG+9tUe)0zqmB|aZye2>5%n>wX z&|?5$12ApG09Ubj0oMd3B8>5we2h1X-+;lGL7%}0XpA9)CBhJ(H8z{~@o~rj0BRs6 A5dZ)H diff --git a/OliviaAddIn/Config.esriaddinx b/OliviaAddIn/Config.esriaddinx index 6515a80..9945574 100644 --- a/OliviaAddIn/Config.esriaddinx +++ b/OliviaAddIn/Config.esriaddinx @@ -2,11 +2,11 @@ OLIVIA AddIn {0718b3b3-5422-4d80-97ad-f72b18a3e476} Add-In de ArcMap para la herramienta de optimización de la limpieza viaria, OLIVIA. - 1.1.0.12 + 2.0.0.0 Images\OliviaAddIn.png - Intergeo Tecnología - Intergeo Tecnología - 15/03/2019 + VSM + VSM + 15/12/2019 @@ -14,7 +14,7 @@ diff --git a/OliviaAddIn/DatosCsv.Designer.cs b/OliviaAddIn/Dlg/DatosCsv.Designer.cs similarity index 100% rename from OliviaAddIn/DatosCsv.Designer.cs rename to OliviaAddIn/Dlg/DatosCsv.Designer.cs diff --git a/OliviaAddIn/DatosCsv.cs b/OliviaAddIn/Dlg/DatosCsv.cs similarity index 100% rename from OliviaAddIn/DatosCsv.cs rename to OliviaAddIn/Dlg/DatosCsv.cs diff --git a/OliviaAddIn/DatosCsv.resx b/OliviaAddIn/Dlg/DatosCsv.resx similarity index 100% rename from OliviaAddIn/DatosCsv.resx rename to OliviaAddIn/Dlg/DatosCsv.resx diff --git a/OliviaAddIn/EditTxtPlant.Designer.cs b/OliviaAddIn/Dlg/EditTxtPlant.Designer.cs similarity index 100% rename from OliviaAddIn/EditTxtPlant.Designer.cs rename to OliviaAddIn/Dlg/EditTxtPlant.Designer.cs diff --git a/OliviaAddIn/EditTxtPlant.cs b/OliviaAddIn/Dlg/EditTxtPlant.cs similarity index 100% rename from OliviaAddIn/EditTxtPlant.cs rename to OliviaAddIn/Dlg/EditTxtPlant.cs diff --git a/OliviaAddIn/EditTxtPlant.resx b/OliviaAddIn/Dlg/EditTxtPlant.resx similarity index 100% rename from OliviaAddIn/EditTxtPlant.resx rename to OliviaAddIn/Dlg/EditTxtPlant.resx diff --git a/OliviaAddIn/FormCampos.Designer.cs b/OliviaAddIn/Dlg/FormCampos.Designer.cs similarity index 100% rename from OliviaAddIn/FormCampos.Designer.cs rename to OliviaAddIn/Dlg/FormCampos.Designer.cs diff --git a/OliviaAddIn/FormCampos.cs b/OliviaAddIn/Dlg/FormCampos.cs similarity index 100% rename from OliviaAddIn/FormCampos.cs rename to OliviaAddIn/Dlg/FormCampos.cs diff --git a/OliviaAddIn/FormCampos.resx b/OliviaAddIn/Dlg/FormCampos.resx similarity index 100% rename from OliviaAddIn/FormCampos.resx rename to OliviaAddIn/Dlg/FormCampos.resx diff --git a/OliviaAddIn/InicioDlg.Designer.cs b/OliviaAddIn/Dlg/InicioDlg.Designer.cs similarity index 100% rename from OliviaAddIn/InicioDlg.Designer.cs rename to OliviaAddIn/Dlg/InicioDlg.Designer.cs diff --git a/OliviaAddIn/InicioDlg.cs b/OliviaAddIn/Dlg/InicioDlg.cs similarity index 99% rename from OliviaAddIn/InicioDlg.cs rename to OliviaAddIn/Dlg/InicioDlg.cs index ace461f..1f9e266 100644 --- a/OliviaAddIn/InicioDlg.cs +++ b/OliviaAddIn/Dlg/InicioDlg.cs @@ -6,7 +6,6 @@ using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; -using SisNetBase; using OliviaDef; using ESRI.ArcGIS.Geodatabase; using ESRI.ArcGIS.DataSourcesGDB; diff --git a/OliviaAddIn/InicioDlg.resx b/OliviaAddIn/Dlg/InicioDlg.resx similarity index 100% rename from OliviaAddIn/InicioDlg.resx rename to OliviaAddIn/Dlg/InicioDlg.resx diff --git a/OliviaAddIn/LimpCampos.cs b/OliviaAddIn/Dlg/LimpCampos.cs similarity index 100% rename from OliviaAddIn/LimpCampos.cs rename to OliviaAddIn/Dlg/LimpCampos.cs diff --git a/OliviaAddIn/LimpCampos.resx b/OliviaAddIn/Dlg/LimpCampos.resx similarity index 100% rename from OliviaAddIn/LimpCampos.resx rename to OliviaAddIn/Dlg/LimpCampos.resx diff --git a/OliviaAddIn/LimpiezaDlg.Designer.cs b/OliviaAddIn/Dlg/LimpiezaDlg.Designer.cs similarity index 100% rename from OliviaAddIn/LimpiezaDlg.Designer.cs rename to OliviaAddIn/Dlg/LimpiezaDlg.Designer.cs diff --git a/OliviaAddIn/LimpiezaDlg.cs b/OliviaAddIn/Dlg/LimpiezaDlg.cs similarity index 99% rename from OliviaAddIn/LimpiezaDlg.cs rename to OliviaAddIn/Dlg/LimpiezaDlg.cs index 9a3f3ad..091fa00 100644 --- a/OliviaAddIn/LimpiezaDlg.cs +++ b/OliviaAddIn/Dlg/LimpiezaDlg.cs @@ -1030,7 +1030,7 @@ namespace OliviaAddIn pro_inic.Close(); return true; } - catch (Exception) + catch (Exception ex) { if (pro_inic != null) pro_inic.Close(); diff --git a/OliviaAddIn/LimpiezaDlg.resx b/OliviaAddIn/Dlg/LimpiezaDlg.resx similarity index 100% rename from OliviaAddIn/LimpiezaDlg.resx rename to OliviaAddIn/Dlg/LimpiezaDlg.resx diff --git a/OliviaAddIn/LimpiezaDlg.yo-NG.resx b/OliviaAddIn/Dlg/LimpiezaDlg.yo-NG.resx similarity index 100% rename from OliviaAddIn/LimpiezaDlg.yo-NG.resx rename to OliviaAddIn/Dlg/LimpiezaDlg.yo-NG.resx diff --git a/OliviaAddIn/ListCamposVal.cs b/OliviaAddIn/Dlg/ListCamposVal.cs similarity index 100% rename from OliviaAddIn/ListCamposVal.cs rename to OliviaAddIn/Dlg/ListCamposVal.cs diff --git a/OliviaAddIn/ListCapasMaqueta.Designer.cs b/OliviaAddIn/Dlg/ListCapasMaqueta.Designer.cs similarity index 100% rename from OliviaAddIn/ListCapasMaqueta.Designer.cs rename to OliviaAddIn/Dlg/ListCapasMaqueta.Designer.cs diff --git a/OliviaAddIn/ListCapasMaqueta.cs b/OliviaAddIn/Dlg/ListCapasMaqueta.cs similarity index 100% rename from OliviaAddIn/ListCapasMaqueta.cs rename to OliviaAddIn/Dlg/ListCapasMaqueta.cs diff --git a/OliviaAddIn/ListCapasMaqueta.resx b/OliviaAddIn/Dlg/ListCapasMaqueta.resx similarity index 100% rename from OliviaAddIn/ListCapasMaqueta.resx rename to OliviaAddIn/Dlg/ListCapasMaqueta.resx diff --git a/OliviaAddIn/ListForm.Designer.cs b/OliviaAddIn/Dlg/ListForm.Designer.cs similarity index 100% rename from OliviaAddIn/ListForm.Designer.cs rename to OliviaAddIn/Dlg/ListForm.Designer.cs diff --git a/OliviaAddIn/ListForm.cs b/OliviaAddIn/Dlg/ListForm.cs similarity index 100% rename from OliviaAddIn/ListForm.cs rename to OliviaAddIn/Dlg/ListForm.cs diff --git a/OliviaAddIn/ListForm.resx b/OliviaAddIn/Dlg/ListForm.resx similarity index 100% rename from OliviaAddIn/ListForm.resx rename to OliviaAddIn/Dlg/ListForm.resx diff --git a/OliviaAddIn/ProgresoEjec.Designer.cs b/OliviaAddIn/Dlg/ProgresoEjec.Designer.cs similarity index 100% rename from OliviaAddIn/ProgresoEjec.Designer.cs rename to OliviaAddIn/Dlg/ProgresoEjec.Designer.cs diff --git a/OliviaAddIn/ProgresoEjec.cs b/OliviaAddIn/Dlg/ProgresoEjec.cs similarity index 99% rename from OliviaAddIn/ProgresoEjec.cs rename to OliviaAddIn/Dlg/ProgresoEjec.cs index 6a16ff6..c4d4c71 100644 --- a/OliviaAddIn/ProgresoEjec.cs +++ b/OliviaAddIn/Dlg/ProgresoEjec.cs @@ -24,7 +24,7 @@ namespace OliviaAddIn /** * Socket de conexión al OliviaTask */ - Cigt_str_socket soc = null; + Cstr_socket soc = null; Thread m_thread; int m_out; int m_miliseconds; @@ -94,7 +94,7 @@ namespace OliviaAddIn public void start(string cfg) { - soc = new Cigt_str_socket(); + soc = new Cstr_socket(); str_cfg = cfg; diff --git a/OliviaAddIn/ProgresoEjec.resx b/OliviaAddIn/Dlg/ProgresoEjec.resx similarity index 100% rename from OliviaAddIn/ProgresoEjec.resx rename to OliviaAddIn/Dlg/ProgresoEjec.resx diff --git a/OliviaAddIn/ProgresoInic.Designer.cs b/OliviaAddIn/Dlg/ProgresoInic.Designer.cs similarity index 100% rename from OliviaAddIn/ProgresoInic.Designer.cs rename to OliviaAddIn/Dlg/ProgresoInic.Designer.cs diff --git a/OliviaAddIn/ProgresoInic.cs b/OliviaAddIn/Dlg/ProgresoInic.cs similarity index 100% rename from OliviaAddIn/ProgresoInic.cs rename to OliviaAddIn/Dlg/ProgresoInic.cs diff --git a/OliviaAddIn/ProgresoInic.resx b/OliviaAddIn/Dlg/ProgresoInic.resx similarity index 100% rename from OliviaAddIn/ProgresoInic.resx rename to OliviaAddIn/Dlg/ProgresoInic.resx diff --git a/OliviaAddIn/RecoCampos.cs b/OliviaAddIn/Dlg/RecoCampos.cs similarity index 100% rename from OliviaAddIn/RecoCampos.cs rename to OliviaAddIn/Dlg/RecoCampos.cs diff --git a/OliviaAddIn/RecoCampos.resx b/OliviaAddIn/Dlg/RecoCampos.resx similarity index 100% rename from OliviaAddIn/RecoCampos.resx rename to OliviaAddIn/Dlg/RecoCampos.resx diff --git a/OliviaAddIn/RecogidaDlg.Designer.cs b/OliviaAddIn/Dlg/RecogidaDlg.Designer.cs similarity index 100% rename from OliviaAddIn/RecogidaDlg.Designer.cs rename to OliviaAddIn/Dlg/RecogidaDlg.Designer.cs diff --git a/OliviaAddIn/RecogidaDlg.cs b/OliviaAddIn/Dlg/RecogidaDlg.cs similarity index 100% rename from OliviaAddIn/RecogidaDlg.cs rename to OliviaAddIn/Dlg/RecogidaDlg.cs diff --git a/OliviaAddIn/RecogidaDlg.resx b/OliviaAddIn/Dlg/RecogidaDlg.resx similarity index 100% rename from OliviaAddIn/RecogidaDlg.resx rename to OliviaAddIn/Dlg/RecogidaDlg.resx diff --git a/OliviaAddIn/SensCampos.Designer.cs b/OliviaAddIn/Dlg/SensCampos.Designer.cs similarity index 100% rename from OliviaAddIn/SensCampos.Designer.cs rename to OliviaAddIn/Dlg/SensCampos.Designer.cs diff --git a/OliviaAddIn/SensCampos.cs b/OliviaAddIn/Dlg/SensCampos.cs similarity index 100% rename from OliviaAddIn/SensCampos.cs rename to OliviaAddIn/Dlg/SensCampos.cs diff --git a/OliviaAddIn/SensCampos.resx b/OliviaAddIn/Dlg/SensCampos.resx similarity index 100% rename from OliviaAddIn/SensCampos.resx rename to OliviaAddIn/Dlg/SensCampos.resx diff --git a/OliviaAddIn/Ejecuta.cs b/OliviaAddIn/Ejecuta/Ejecuta.cs similarity index 99% rename from OliviaAddIn/Ejecuta.cs rename to OliviaAddIn/Ejecuta/Ejecuta.cs index 576c14c..064969f 100644 --- a/OliviaAddIn/Ejecuta.cs +++ b/OliviaAddIn/Ejecuta/Ejecuta.cs @@ -2,10 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using SisNetBase; using OliviaDef; using System.Diagnostics; -using SisNetBase.Modulos; using System.IO; using System.Threading; using System.Windows.Forms; diff --git a/OliviaAddIn/EjecutaLimp.cs b/OliviaAddIn/Ejecuta/EjecutaLimp.cs similarity index 99% rename from OliviaAddIn/EjecutaLimp.cs rename to OliviaAddIn/Ejecuta/EjecutaLimp.cs index 3bc42c2..78250ea 100644 --- a/OliviaAddIn/EjecutaLimp.cs +++ b/OliviaAddIn/Ejecuta/EjecutaLimp.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using SisNetBase; using OliviaDef; using System.IO; using System.Windows.Forms; diff --git a/OliviaAddIn/EjecutaReco.cs b/OliviaAddIn/Ejecuta/EjecutaReco.cs similarity index 100% rename from OliviaAddIn/EjecutaReco.cs rename to OliviaAddIn/Ejecuta/EjecutaReco.cs diff --git a/OliviaAddIn/DatosGDB.cs b/OliviaAddIn/Gdb/DatosGDB.cs similarity index 99% rename from OliviaAddIn/DatosGDB.cs rename to OliviaAddIn/Gdb/DatosGDB.cs index 53ea822..14fa726 100644 --- a/OliviaAddIn/DatosGDB.cs +++ b/OliviaAddIn/Gdb/DatosGDB.cs @@ -523,6 +523,20 @@ namespace OliviaAddIn public void inicia_coords(string dir, string nomb_class) { OliviaGlob.coorsys_in = FunGDB.dame_factory_code(dir, nomb_class); + + //////////////////////////////////////////////////////////////////////////////////////////// + //comprueba si son proyectadas + ISpatialReferenceFactory3 spatialReferenceFactory = null; + ISpatialReference spatialReference; + spatialReferenceFactory = (ISpatialReferenceFactory3)new SpatialReferenceEnvironment(); + spatialReference = spatialReferenceFactory.CreateSpatialReference(OliviaGlob.coorsys_in); + if (!(spatialReference is IProjectedCoordinateSystem)) + { + //no son proyectadas, proyecta a utm30 + OliviaGlob.coorsys_in = (int)esriSRProjCS4Type.esriSRProjCS_ETRS1989_UTM_Zone_30N; + } + + if (OliviaGlob.coorsys_in < 0) OliviaGlob.coorsys_in = OliviaGlob.coorsys; OliviaGlob.coorsys = OliviaGlob.coorsys_in; @@ -1299,7 +1313,10 @@ namespace OliviaAddIn simbologia.Width = 1; sym = (ISymbol)simbologia; - check_valunic(feat, valor_unico, sym, indice); + if (!check_valunic(feat, valor_unico, sym, indice)) + { + break; + } System.Runtime.InteropServices.Marshal.FinalReleaseComObject(feat); @@ -1334,7 +1351,10 @@ namespace OliviaAddIn simbologia.OutlineColor = color; sym = (ISymbol)simbologia; - check_valunic(feat, valor_unico, sym, indice); + if (!check_valunic(feat, valor_unico, sym, indice)) + { + break; + } System.Runtime.InteropServices.Marshal.FinalReleaseComObject(feat); @@ -1358,7 +1378,7 @@ namespace OliviaAddIn /* * Comprueba si el valor unico existe. Si no existe se añade al array de valores unicos. */ - public void check_valunic(IFeature feat, IUniqueValueRenderer valor_unico, ISymbol simbologia, int indice) + public bool check_valunic(IFeature feat, IUniqueValueRenderer valor_unico, ISymbol simbologia, int indice) { string valor_clase; bool exist_valor; @@ -1383,10 +1403,12 @@ namespace OliviaAddIn valor_unico.set_Label(valor_clase, valor_clase); valor_unico.set_Symbol(valor_clase, (ISymbol)simbologia); } + return true; } catch (Exception) { MessageBox.Show("Error al crear el listado de valores únicos.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; } } diff --git a/OliviaAddIn/DatosGDBEx.cs b/OliviaAddIn/Gdb/DatosGDBEx.cs similarity index 100% rename from OliviaAddIn/DatosGDBEx.cs rename to OliviaAddIn/Gdb/DatosGDBEx.cs diff --git a/OliviaAddIn/DatosGDBLimp.cs b/OliviaAddIn/Gdb/DatosGDBLimp.cs similarity index 100% rename from OliviaAddIn/DatosGDBLimp.cs rename to OliviaAddIn/Gdb/DatosGDBLimp.cs diff --git a/OliviaAddIn/DatosGDBReco.cs b/OliviaAddIn/Gdb/DatosGDBReco.cs similarity index 100% rename from OliviaAddIn/DatosGDBReco.cs rename to OliviaAddIn/Gdb/DatosGDBReco.cs diff --git a/OliviaAddIn/FunGDB.cs b/OliviaAddIn/Gdb/FunGDB.cs similarity index 99% rename from OliviaAddIn/FunGDB.cs rename to OliviaAddIn/Gdb/FunGDB.cs index 7052bb1..5d2449d 100644 --- a/OliviaAddIn/FunGDB.cs +++ b/OliviaAddIn/Gdb/FunGDB.cs @@ -774,23 +774,18 @@ namespace OliviaAddIn { int ind; IFields campos; - ISpatialReferenceFactory3 spatialReferenceFactory; + ISpatialReferenceFactory3 spatialReferenceFactory=null; ISpatialReference spatialReference; String shapeFieldName; IField shapeField; - IGeometryDef geom_def, dest_geom; + IGeometryDef geom_def, dest_geom=null; IClone geom_clon, dest_clon; - IGeometryDefEdit geom_edit; + IGeometryDefEdit geom_edit=null; IProjectedCoordinateSystem coord_proy; try { - campos = fc.Fields; - //se genera un sistema de referencia espacial: de coordenadas proyectadas a coorsys - spatialReferenceFactory = (ISpatialReferenceFactory3)new SpatialReferenceEnvironment(); - coord_proy = spatialReferenceFactory.CreateProjectedCoordinateSystem(coorsys); - spatialReference = (ISpatialReference)coord_proy; - + campos = fc.Fields; //se consigue la forma (shape) de la featureclass de interés shapeFieldName = fc.ShapeFieldName; ind = fc.FindField(shapeFieldName); @@ -809,6 +804,9 @@ namespace OliviaAddIn ISpatialReference spatialReference_aux = (ISpatialReference)coord_proy_aux; geom_edit.SpatialReference_2 = spatialReference_aux; }*/ + //se genera un sistema de referencia espacial: de coordenadas proyectadas a coorsys + spatialReferenceFactory = (ISpatialReferenceFactory3)new SpatialReferenceEnvironment(); + spatialReference = spatialReferenceFactory.CreateProjectedCoordinateSystem(coorsys); geom_edit.SpatialReference_2 = spatialReference;//se modifica el sistema de referencia de coordenadas al generado esriSRProjCS_WGS1984UTM_30N } catch (Exception) @@ -938,6 +936,7 @@ namespace OliviaAddIn { return null; } + //castea la capa a IGeoDataset, de donde obtendrá el envelope gds = (IGeoDataset)capa; //crea un polígono partiendo del rectángulo envelope @@ -945,6 +944,7 @@ namespace OliviaAddIn segcol = (ISegmentCollection)poli; segcol.SetRectangle(gds.Extent); + geom_envelope = (IGeometry)poli; //libera FunGDB.libera(capa); diff --git a/OliviaAddIn/OliviaAddIn.csproj b/OliviaAddIn/OliviaAddIn.csproj index 091b41b..98620c6 100644 --- a/OliviaAddIn/OliviaAddIn.csproj +++ b/OliviaAddIn/OliviaAddIn.csproj @@ -52,6 +52,7 @@ prompt 4 AllRules.ruleset + true @@ -146,82 +147,84 @@ + + - - + + True Config.esriaddinx - + Form - + Form - + FormCampos.cs - + Form - + DatosCsv.cs - - - - - + + + + + Form - + EditTxtPlant.cs - - - - - + + + + + Form - + InicioDlg.cs - - + + Form - + LimpiezaDlg.cs - - + + Form - + ListCapasMaqueta.cs - + Form - + ListForm.cs - - - - - + + + + + Form - + ProgresoEjec.cs - + Form - + ProgresoInic.cs @@ -235,24 +238,24 @@ True Settings.settings - + Form - - - + + + Form - + RecogidaDlg.cs - + Form - + SensCampos.cs - + @@ -289,37 +292,37 @@ - + FormCampos.cs - + DatosCsv.cs - + EditTxtPlant.cs - + InicioDlg.cs - + LimpCampos.cs - + LimpiezaDlg.cs - + LimpiezaDlg.cs - + ListCapasMaqueta.cs - + ListForm.cs - + ProgresoEjec.cs - + ProgresoInic.cs @@ -327,13 +330,13 @@ Designer Resources.Designer.cs - + RecoCampos.cs - + RecogidaDlg.cs - + SensCampos.cs @@ -390,6 +393,7 @@ OliviaDef + esriAddIn Desktop diff --git a/OliviaAddIn/Properties/AssemblyInfo.cs b/OliviaAddIn/Properties/AssemblyInfo.cs index 6af6852..218c88f 100644 --- a/OliviaAddIn/Properties/AssemblyInfo.cs +++ b/OliviaAddIn/Properties/AssemblyInfo.cs @@ -8,9 +8,9 @@ using System.Runtime.InteropServices; [assembly: AssemblyTitle("OliviaAddIn")] [assembly: AssemblyDescription("AddIn para ArcGIS de la herramienta OLIVIA - Optimización de la Limpieza Viaria")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Intergeo Tecnología")] +[assembly: AssemblyCompany("VSM")] [assembly: AssemblyProduct("OliviaAddIn")] -[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.8.0")] -[assembly: AssemblyFileVersion("1.0.8.0")] +[assembly: AssemblyVersion("2.0.0.0")] +[assembly: AssemblyFileVersion("2.0.0.0")]