diff --git a/.gitignore b/.gitignore index 93437df..0236349 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ ################################################################################ /OliviaAddIn/bin +/OliviaDef/bin +/OliviaDef/obj/x86 +/.vs/OliviaAddIn/v15 diff --git a/OliviaAddIn.sln b/OliviaAddIn.sln new file mode 100644 index 0000000..4e4f3d2 --- /dev/null +++ b/OliviaAddIn.sln @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OliviaAddIn", "OliviaAddIn\OliviaAddIn.csproj", "{DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OliviaDef", "OliviaDef\OliviaDef.csproj", "{B395D0F3-766D-46C5-BDE9-FBDEE1582259}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7}.Debug|Win32.ActiveCfg = Debug|Any CPU + {DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7}.Debug|x86.ActiveCfg = Debug|Any CPU + {DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7}.Release|Any CPU.Build.0 = Release|Any CPU + {DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7}.Release|Win32.ActiveCfg = Release|Any CPU + {DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7}.Release|x86.ActiveCfg = Release|Any CPU + {B395D0F3-766D-46C5-BDE9-FBDEE1582259}.Debug|Any CPU.ActiveCfg = Debug|x86 + {B395D0F3-766D-46C5-BDE9-FBDEE1582259}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {B395D0F3-766D-46C5-BDE9-FBDEE1582259}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {B395D0F3-766D-46C5-BDE9-FBDEE1582259}.Debug|Win32.ActiveCfg = Debug|x86 + {B395D0F3-766D-46C5-BDE9-FBDEE1582259}.Debug|x86.ActiveCfg = Debug|x86 + {B395D0F3-766D-46C5-BDE9-FBDEE1582259}.Debug|x86.Build.0 = Debug|x86 + {B395D0F3-766D-46C5-BDE9-FBDEE1582259}.Release|Any CPU.ActiveCfg = Release|x86 + {B395D0F3-766D-46C5-BDE9-FBDEE1582259}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {B395D0F3-766D-46C5-BDE9-FBDEE1582259}.Release|Mixed Platforms.Build.0 = Release|x86 + {B395D0F3-766D-46C5-BDE9-FBDEE1582259}.Release|Win32.ActiveCfg = Release|x86 + {B395D0F3-766D-46C5-BDE9-FBDEE1582259}.Release|x86.ActiveCfg = Release|x86 + {B395D0F3-766D-46C5-BDE9-FBDEE1582259}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/OliviaAddIn.suo b/OliviaAddIn.suo new file mode 100644 index 0000000..0b9336b Binary files /dev/null and b/OliviaAddIn.suo differ diff --git a/OliviaAddIn/ButtonInicio.cs b/OliviaAddIn/ButtonInicio.cs new file mode 100644 index 0000000..2f61ffd --- /dev/null +++ b/OliviaAddIn/ButtonInicio.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Windows.Forms; + +namespace OliviaAddIn +{ + + /** + * @file ButtonInicio.cs + * Clase del botón del AddIn OLIVIA para ArcMap. + * Contiene el manejo de sus eventos como el Click o la actualización de su estado. + */ + /** + * Clase del botón del AddIn OLIVIA para ArcMap. + * Contiene el manejo de sus eventos como el Click o la actualización de su estado. + */ + public class ButtonInicio : ESRI.ArcGIS.Desktop.AddIns.Button + { + //************************************************************************************* + //Variables + + //************************************************************************************* + //Métodos + public ButtonInicio() + { + + } + + protected override void OnClick() + { + try + { + bool ini_bien = true; + try + { + string err_str = ""; + if (!OliviaGlob.lee_ini_gen(out err_str)) + { + ini_bien = false; + MessageBox.Show(err_str, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + ini_bien = true; + } + catch (Exception) + { + MessageBox.Show("Error al iniciar Olivia. No se puede acceder al archivo de configuración: cfg.ini. Comprobar accesibilidad a la carpeta.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + if (!ini_bien) + return; + + if (!coge_ip()) + return; //FALTA loguear error... + + if (!comprueba_dlls()) + return; + + //////////////////////////// + + Application.EnableVisualStyles(); + ArcMap.Application.CurrentTool = null; + + //abre la ventana de configuración inicial + OliviaGlob.inidlg = new InicioDlg(); + OliviaGlob.ya_open_app = true; + OliviaGlob.inidlg.Show(); + } + catch (Exception e) + { + MessageBox.Show(e.Message, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + } + + protected override void OnUpdate() + { + Enabled = !OliviaGlob.ya_open_app; + } + + /** + * Coge la ip local para la comunicación con geofoto + */ + protected bool coge_ip() + { + try + { + string[] ips = OliviaGlob.dame_local_ips(); + if (ips != null && ips.Length > 0) + OliviaGlob.ip = ips[0]; + else + OliviaGlob.ip = "127.0.0.1"; + + return true; + } + catch (Exception) + { + MessageBox.Show("Error al coger la IP.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + } + + /** + * La primera vez copia las dlls necesarias en el directorio del arcmap + */ + protected bool comprueba_dlls() + { + string path_dll_dest = null, dll = null; + try + { + //comprueba igt_base.dll + dll = "igt_base.dll"; + + path_dll_dest = Path.Combine(Application.StartupPath, dll); + if (!File.Exists(path_dll_dest)) + { + MessageBox.Show("No se encuentran las librerías necesarias, compruebe la instalación", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + return true; + } + catch (Exception) + { + MessageBox.Show("Error al comprobar las dll " + dll + "ubicada en:" + path_dll_dest, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + } + + + } +} diff --git a/OliviaAddIn/ClassDiagram1.cd b/OliviaAddIn/ClassDiagram1.cd new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/OliviaAddIn/ClassDiagram1.cd @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/OliviaAddIn/Comun.cs b/OliviaAddIn/Comun.cs new file mode 100644 index 0000000..9d06489 --- /dev/null +++ b/OliviaAddIn/Comun.cs @@ -0,0 +1,267 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +using ESRI.ArcGIS.Geodatabase; +using ESRI.ArcGIS.DataSourcesGDB; +using ESRI.ArcGIS.Geometry; +using ESRI.ArcGIS.Catalog; + +namespace OliviaAddIn +{ + /** + * Elementos comunes a Limpieza y Recogida + */ + public class Comun + { + //************************************************************************************* + //Variables + /** + * Texto cuando no se ha seleccionado instalación + */ + public string text_selec_instal = "Instalación de salida/llegada"; + /** + * Coordenadas de la instalación de partida, si las huibiera, 0 si no + */ + public double[] coords_instala = new double[2]; + /** + * Texto cuando no se ha seleccionado capa de restricciones + */ + public string text_selec_rest = "Capa de restric. circ."; + /** + * Geometría que componen las restricciones de acceso, null si nunguna + */ + public IGeometry geom_rest_acces = null; + /** + * Texto cuando no se ha seleccionado capa de zonas + */ + public string text_selec_zonas = "Capa de zonas"; + /** + * Geometría que componen las zonas seleccionadas, null si nunguna + */ + public IGeometry geom_zonas = null; + /** + * Texto cuando no se ha seleccionado capa de limpieza otra + */ + public string text_capa_limp = "Cambiar capa de limpieza..."; + /** + * String de errores de ejecución + */ + public string err_st = null; + /** + * Tiempo de trabajo al día por convenio, en minutos + */ + public double t_conv = LimpiezaDef.Parametros.t_conv; + /** + * Tiempo de descanso del personal, en minutos + */ + public double t_descan = LimpiezaDef.Parametros.t_descanso; + /** + * Tiempo de carga y descarga, en minutos + */ + public double t_descarg = LimpiezaDef.Parametros.t_cardesc; + /** + * Tiempo de desplazamiento inicio/fin a las instalaciones, en minutos + */ + public double t_despl_insta = LimpiezaDef.Parametros.t_desp; + /** + * hora de inicio de la jornada de trabajo, en minutos + */ + public double h_ini = LimpiezaDef.Parametros.h_inicio; + /** + * Porcentaje de tráfico que se estima, ya que si no los vehículos irían siempre a la velocida máxima permitida por la vía + */ + public double trafico = 80; + /** + * Número de puntos de control + */ + public int n_ptsctrl = 3; + /** + * Número de sectores por defecto + */ + public int n_secdef = 3; + /** + * Parámentro que indica si se tendrán en cuenta en el estudio los elementos aislados. Si 1 se descartan aislados. Si 0 se tienen en cuenta en el cálculo. + */ + public int aislados = -1; + /** + * String que almacena qué zonas se han seleccionado + */ + public string text_zon = ""; + /** + * String que almacena qué restricciones se han seleccionado + */ + public string text_restr = ""; + /** + * Path de la clase de los ámbitos + */ + + //************************************************************************************* + //Funciones + /** + * Para la selección de puntos de instalación + * Abre el dialogo de selección de capa y el form para seleccionar campo a leer y valor del campo + */ + public bool selec_instal(string title, int wnd_handle, out string text_sal, out double x, out double y) + { + ListCamposVal list; + IFeature f = null; + IFeatureClass fc = null; + IGeometry geom = null; + + list = new ListCamposVal(title, wnd_handle, esriGeometryType.esriGeometryPoint); + text_sal = ""; + x = y = 0; + + try + { + IPoint instalacion; + string campo, clase_path, st; + int elem; + int[] ids; + + clase_path = null; + campo = st=""; + ids = null; + elem = -1; + + clase_path = list.selec_capa(); + if (clase_path != null) + { + elem = list.selec_campo(out campo); + if (elem > -1 && campo != null) + { + elem = list.selec_valor_campo(campo, out st); + if (elem > -1) + { + ids = FunGDB.dame_ids_consulta(clase_path, ""); //consulta todos + if (ids != null) + { + fc=FunGDB.abre_ftclass(clase_path); + if (fc != null) + { + f = fc.GetFeature(ids[elem]); + geom = f.Shape; + geom = FunGDB.reproyecta(geom, OliviaGlob.coorsys);//reproyecta por si hace falta + instalacion = (IPoint)geom; + x = instalacion.X; + y = instalacion.Y; + text_sal = st; + } + } + } + } + } + } + catch (Exception) + { + x = 0; + } + + FunGDB.libera(fc); + FunGDB.libera(geom); + FunGDB.libera(f); + + if (x==0) //algo ha ido mal + { + MessageBox.Show("Error al seleccionar capa de instalaciones. " + list.err_st, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + return true; + } + + /** + * Para la selección de capas de polígonos + * Abre el dialogo de selección de capa y el form para seleccionar campo a leer y valor del campo + * Permite multiselección + * Tiene que mostrar valores únicos, no repetidos + * Devuelve la geom resultante + * En text_sal van concatenados los valores que se han seleccionado unidos por '_' + */ + public bool selec_polig(string title, int wnd_handle, out string text_sal, out IGeometry geom_sal) + { + ListCamposVal list; + IFeature f = null; + IFeatureClass fc = null; + IGeometry geom = null; + + list = new ListCamposVal(title, wnd_handle, esriGeometryType.esriGeometryPolygon); + text_sal = ""; + geom_sal = null; + + try + { + + string campo, clase_path, consulta; + string[] val_st; + int nval; + int[] ids, val_ids; + int i,j; + bool is_str = true; + + clase_path=null; + campo=consulta=""; + val_st=null; + val_ids=ids=null; + nval=-1; + + clase_path = list.selec_capa(); + if (clase_path != null) + { + nval = list.selec_campo(out campo); + if (nval > -1 && campo != null) + { + //mira a ver si el campo es str + is_str = FunGDB.is_str_field(clase_path,campo); + nval = list.selec_valores_campo(campo,out val_ids, out val_st);//valores únicos + if (nval > 0) + { + //se embucla para unir las geoms + for (i = 0; i < nval; i++) + { + if(is_str) + consulta = campo + " = '" + val_st[i] + "'"; + else + consulta = campo + " = " + val_st[i]; + ids = FunGDB.dame_ids_consulta(clase_path, consulta); + fc = FunGDB.abre_ftclass(clase_path); + if ((ids != null) && (fc != null)) + { + for(j=0;j + 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.8 + Images\OliviaAddIn.png + Intergeo Tecnología + Intergeo Tecnología + 11/12/2018 + + + + + + + + + + + \ No newline at end of file diff --git a/OliviaAddIn/DatosCsv.Designer.cs b/OliviaAddIn/DatosCsv.Designer.cs new file mode 100644 index 0000000..7a8707d --- /dev/null +++ b/OliviaAddIn/DatosCsv.Designer.cs @@ -0,0 +1,243 @@ +namespace OliviaAddIn +{ + partial class DatosCsv + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DatosCsv)); + this.button_abrir = new System.Windows.Forms.Button(); + this.dateTimePicker_fin = new System.Windows.Forms.DateTimePicker(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.comboBox_media = new System.Windows.Forms.ComboBox(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox_id = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.dateTimePicker_ini = new System.Windows.Forms.DateTimePicker(); + this.btn_acept = new System.Windows.Forms.Button(); + this.button_reset = new System.Windows.Forms.Button(); + this.label5 = new System.Windows.Forms.Label(); + this.textBox_llen = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.textBox_fecha = new System.Windows.Forms.TextBox(); + this.lbl_csv = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // button_abrir + // + this.button_abrir.Location = new System.Drawing.Point(29, 22); + this.button_abrir.Name = "button_abrir"; + this.button_abrir.Size = new System.Drawing.Size(75, 23); + this.button_abrir.TabIndex = 1; + this.button_abrir.Text = "Abrir"; + this.button_abrir.UseVisualStyleBackColor = true; + this.button_abrir.Click += new System.EventHandler(this.button_abrir_Click); + // + // dateTimePicker_fin + // + this.dateTimePicker_fin.CustomFormat = "dd/MM/yyyy - H:mm"; + this.dateTimePicker_fin.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker_fin.Location = new System.Drawing.Point(66, 245); + this.dateTimePicker_fin.Name = "dateTimePicker_fin"; + this.dateTimePicker_fin.Size = new System.Drawing.Size(156, 20); + this.dateTimePicker_fin.TabIndex = 20; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(29, 228); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(65, 13); + this.label4.TabIndex = 19; + this.label4.Text = "Fecha Final:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(29, 183); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(68, 13); + this.label3.TabIndex = 18; + this.label3.Text = "Fecha Inicio:"; + // + // comboBox_media + // + this.comboBox_media.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox_media.Location = new System.Drawing.Point(122, 155); + this.comboBox_media.Name = "comboBox_media"; + this.comboBox_media.Size = new System.Drawing.Size(100, 21); + this.comboBox_media.TabIndex = 17; + this.comboBox_media.SelectedIndexChanged += new System.EventHandler(this.comboBox_media_SelectedIndexChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(29, 158); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(36, 13); + this.label2.TabIndex = 16; + this.label2.Text = "Media"; + // + // textBox_id + // + this.textBox_id.Location = new System.Drawing.Point(122, 64); + this.textBox_id.Name = "textBox_id"; + this.textBox_id.Size = new System.Drawing.Size(100, 20); + this.textBox_id.TabIndex = 15; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(26, 66); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(54, 13); + this.label1.TabIndex = 14; + this.label1.Text = "Campo ID"; + // + // dateTimePicker_ini + // + this.dateTimePicker_ini.CustomFormat = "dd/MM/yyyy - H:mm"; + this.dateTimePicker_ini.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker_ini.Location = new System.Drawing.Point(66, 201); + this.dateTimePicker_ini.Name = "dateTimePicker_ini"; + this.dateTimePicker_ini.Size = new System.Drawing.Size(156, 20); + this.dateTimePicker_ini.TabIndex = 13; + // + // btn_acept + // + this.btn_acept.Location = new System.Drawing.Point(115, 271); + this.btn_acept.Name = "btn_acept"; + this.btn_acept.Size = new System.Drawing.Size(75, 23); + this.btn_acept.TabIndex = 12; + this.btn_acept.Text = "Aceptar"; + this.btn_acept.UseVisualStyleBackColor = true; + this.btn_acept.Click += new System.EventHandler(this.btn_acept_Click); + // + // button_reset + // + this.button_reset.Location = new System.Drawing.Point(34, 271); + this.button_reset.Name = "button_reset"; + this.button_reset.Size = new System.Drawing.Size(75, 23); + this.button_reset.TabIndex = 11; + this.button_reset.Text = "Reset"; + this.button_reset.UseVisualStyleBackColor = true; + this.button_reset.Click += new System.EventHandler(this.button_reset_Click); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(26, 93); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(81, 13); + this.label5.TabIndex = 21; + this.label5.Text = "Campo Llenado"; + // + // textBox_llen + // + this.textBox_llen.Location = new System.Drawing.Point(122, 90); + this.textBox_llen.Name = "textBox_llen"; + this.textBox_llen.Size = new System.Drawing.Size(100, 20); + this.textBox_llen.TabIndex = 22; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(29, 126); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(73, 13); + this.label6.TabIndex = 23; + this.label6.Text = "Campo Fecha"; + // + // textBox_fecha + // + this.textBox_fecha.Location = new System.Drawing.Point(122, 123); + this.textBox_fecha.Name = "textBox_fecha"; + this.textBox_fecha.Size = new System.Drawing.Size(100, 20); + this.textBox_fecha.TabIndex = 24; + // + // lbl_csv + // + this.lbl_csv.AutoSize = true; + this.lbl_csv.Location = new System.Drawing.Point(119, 27); + this.lbl_csv.Name = "lbl_csv"; + this.lbl_csv.Size = new System.Drawing.Size(87, 13); + this.lbl_csv.TabIndex = 25; + this.lbl_csv.Text = "Seleccionar CSV"; + // + // DatosCsv + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(284, 313); + this.Controls.Add(this.lbl_csv); + this.Controls.Add(this.textBox_fecha); + this.Controls.Add(this.label6); + this.Controls.Add(this.textBox_llen); + this.Controls.Add(this.label5); + this.Controls.Add(this.dateTimePicker_fin); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.comboBox_media); + this.Controls.Add(this.label2); + this.Controls.Add(this.textBox_id); + this.Controls.Add(this.label1); + this.Controls.Add(this.dateTimePicker_ini); + this.Controls.Add(this.btn_acept); + this.Controls.Add(this.button_reset); + this.Controls.Add(this.button_abrir); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "DatosCsv"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "DatosCsv"; + this.TopMost = true; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.DatosCsv_FormClosed); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button_abrir; + private System.Windows.Forms.DateTimePicker dateTimePicker_fin; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.ComboBox comboBox_media; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox_id; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.DateTimePicker dateTimePicker_ini; + private System.Windows.Forms.Button btn_acept; + private System.Windows.Forms.Button button_reset; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.TextBox textBox_llen; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox textBox_fecha; + private System.Windows.Forms.Label lbl_csv; + } +} \ No newline at end of file diff --git a/OliviaAddIn/DatosCsv.cs b/OliviaAddIn/DatosCsv.cs new file mode 100644 index 0000000..f08ea84 --- /dev/null +++ b/OliviaAddIn/DatosCsv.cs @@ -0,0 +1,351 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Excel = Microsoft.Office.Interop.Excel; +using System.IO; + +namespace OliviaAddIn +{ + public partial class DatosCsv : Form + { + Recogida reco = null; + string id, lleno, csv, fecha, aux, auxi; + string[] combo = new string[] { "No", "Si" }; + DateTime f_ini, f_fin; + public static DateTime fe; + int y, mo, d, h, mi, ind; + public bool acept = false; + + + //////////////////////////////////////////////////// + public DatosCsv(Recogida reco) + { + try + { + InitializeComponent(); + reinicia(); + comboBox_media.Items.AddRange(combo); + dateTimePicker_fin.Enabled = false; + this.reco = reco; + + textBox_id.Enabled = false; + textBox_fecha.Enabled = false; + textBox_llen.Enabled = false; + comboBox_media.Enabled = false; + dateTimePicker_ini.Enabled = false; + dateTimePicker_fin.Enabled = false; + button_reset.Enabled = false; + btn_acept.Enabled = false; + } + catch (Exception) + { + MessageBox.Show("Error al iniciar la ventana de campos de CSV", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + + private void reinicia() + { + id = RecogidaDef.campos.cons_id_csv; + lleno = RecogidaDef.campos.cons_llen_csv; + fecha = RecogidaDef.campos.cons_fecha_csv; + + ind = RecogidaDef.campos.cons_fechai_csv.IndexOf("/"); + auxi = RecogidaDef.campos.cons_fechai_csv.Substring(0, ind); + d = Convert.ToInt32(auxi); + aux = RecogidaDef.campos.cons_fechai_csv.Substring(ind + 1); + ind = aux.IndexOf("/"); + auxi = aux.Substring(0, ind); + mo = Convert.ToInt32(auxi); + aux = aux.Substring(ind + 1); + ind = aux.IndexOf(" "); + auxi = aux.Substring(0, ind); + y = Convert.ToInt32(auxi); + aux = aux.Substring(ind + 1); + ind = aux.IndexOf(":"); + auxi = aux.Substring(0, ind); + h = Convert.ToInt32(auxi); + aux = aux.Substring(ind + 1); + mi = Convert.ToInt32(aux); + + RecogidaDef.campos.fechai_csv = new DateTime(y, mo, d, h, mi, 0); + f_ini = RecogidaDef.campos.fechai_csv; + + ind = RecogidaDef.campos.cons_fechaf_csv.IndexOf("/"); + auxi = RecogidaDef.campos.cons_fechaf_csv.Substring(0, ind); + d = Convert.ToInt32(auxi); + aux = RecogidaDef.campos.cons_fechaf_csv.Substring(ind + 1); + ind = aux.IndexOf("/"); + auxi = aux.Substring(0, ind); + mo = Convert.ToInt32(auxi); + aux = aux.Substring(ind + 1); + ind = aux.IndexOf(" "); + auxi = aux.Substring(0, ind); + y = Convert.ToInt32(auxi); + aux = aux.Substring(ind + 1); + ind = aux.IndexOf(":"); + auxi = aux.Substring(0, ind); + h = Convert.ToInt32(auxi); + aux = aux.Substring(ind + 1); + mi = Convert.ToInt32(aux); + + RecogidaDef.campos.fechaf_csv = new DateTime(y, mo, d, h, mi, 0); + f_fin = RecogidaDef.campos.fechaf_csv; + + //se rellenan los datos en el dialogo + textBox_id.Text = id; + textBox_fecha.Text = fecha; + textBox_llen.Text = lleno; + + dateTimePicker_ini.Value = f_ini; + dateTimePicker_ini.MinDate = new DateTime(0001, 01, 01, 00, 00, 00); + dateTimePicker_ini.MaxDate = new DateTime(2050, 01, 01, 00, 00, 00); + + dateTimePicker_fin.Value = f_fin; + dateTimePicker_fin.MinDate = new DateTime(0001, 01, 01, 00, 00, 00); + dateTimePicker_fin.MaxDate = new DateTime(2050, 01, 01, 00, 00, 00); + } + + + private void button_abrir_Click(object sender, EventArgs e) + { + try + { + System.Windows.Forms.OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); + openFileDialog1.Filter = "CSV(*.csv)|*.csv"; + openFileDialog1.Title = "Abrir tabla de datos"; + + // Show the Dialog. + if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + csv = openFileDialog1.FileName; + textBox_id.Enabled = true; + textBox_fecha.Enabled = true; + textBox_llen.Enabled = true; + comboBox_media.Enabled = true; + dateTimePicker_ini.Enabled = true; + button_reset.Enabled = true; + btn_acept.Enabled = true; + lbl_csv.Text = System.IO.Path.GetFileName(openFileDialog1.FileName); + //dateTimePicker_fin.Enabled = true; + } + else + { + textBox_id.Enabled = false; + textBox_fecha.Enabled = false; + textBox_llen.Enabled = false; + comboBox_media.Enabled = false; + dateTimePicker_ini.Enabled = false; + dateTimePicker_fin.Enabled = false; + button_reset.Enabled = false; + btn_acept.Enabled = false; + lbl_csv.Text = "Seleccionar CSV"; + } + } + catch (Exception) + { + MessageBox.Show("Error al seleccionar el CSV", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + /* + * Se validan los campos modificados y se guarda en memoria los nombres de los nuevos campos. + * También se guardará en el archivo .INI una vez se vaya a ejecutar el proceso. + */ + private void btn_acept_Click(object sender, EventArgs e) + { + List title = new List(); + List time = new List(); + List lectura = new List(); + List num = new List(); + string aux; + int veces = 0, nveces = 0, ind, dia, mon, year, hor, min, col_id = -1, col_lleno = -1, col_fech = -1; + double carg = 0; + + try + { + //se inicializan las listas doned se pondrán los iedntificadores y sus respectivas cargas que cumplan los requisitos de las fechas + reco.id = new List(); + reco.cargas = new List(); + acept = true; + + //se recogen los datos introducidos en el dialogo + RecogidaDef.campos.cons_id_csv = textBox_id.Text; + reco.id_csv = RecogidaDef.campos.cons_id_csv; + + RecogidaDef.campos.cons_llen_csv = textBox_llen.Text; + reco.llen_csv = RecogidaDef.campos.cons_llen_csv; + + RecogidaDef.campos.cons_fecha_csv = textBox_fecha.Text; + reco.fecha_csv = RecogidaDef.campos.cons_fecha_csv; + + f_ini = dateTimePicker_ini.Value; + if (dateTimePicker_fin.Enabled == true) + f_fin = dateTimePicker_fin.Value; + + RecogidaDef.campos.fechai_csv = f_ini; + if (comboBox_media.SelectedIndex == 1) + RecogidaDef.campos.fechaf_csv = f_fin; + else if (comboBox_media.SelectedIndex == 0) + RecogidaDef.campos.fechaf_csv = new DateTime(2049, 01, 01, 00, 01, 00); + else + { + MessageBox.Show("Hay que seleccionar si se requiere hacer la media de fechas", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + if (RecogidaDef.campos.fechai_csv > RecogidaDef.campos.fechaf_csv) + { + MessageBox.Show("La fecha final no puede ser menor que la fecha inicial", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + RecogidaDef.campos.cons_fechai_csv = RecogidaDef.campos.fechai_csv.ToString("dd/MM/yyyy") + " " + RecogidaDef.campos.fechai_csv.ToString("H:mm"); + reco.fechai_csv = RecogidaDef.campos.cons_fechai_csv; + RecogidaDef.campos.cons_fechaf_csv = RecogidaDef.campos.fechaf_csv.ToString("dd/MM/yyyy") + " " + RecogidaDef.campos.fechaf_csv.ToString("H:mm"); + reco.fechaf_csv = RecogidaDef.campos.cons_fechaf_csv; + + + using (var reader = new StreamReader(csv, Encoding.Default)) + { + Encoding enc = reader.CurrentEncoding; + while (!reader.EndOfStream) + { + veces++; + var line = reader.ReadLine(); + var values = line.Split(';'); + if (veces == 1) + { + title.AddRange(values); + for (int i = 0; i < title.Count; i++) + { + if (title[i] == reco.id_csv) + col_id = i; + else if (title[i] == reco.fecha_csv) + col_fech = i; + else if (title[i] == reco.llen_csv) + col_lleno = i; + } + if (col_id == -1) + { + MessageBox.Show(string.Format("El nombre del campo {0} para los indetificadores no es correcto", reco.id_csv), "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (col_fech == -1) + { + MessageBox.Show(string.Format("El nombre del campo {0} para las fechas no es correcto", reco.fecha_csv), "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (col_lleno == -1) + { + MessageBox.Show(string.Format("El nombre del campo {0} para los porcentajes de llenado no es correcto", reco.llen_csv), "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + continue; + } + + time.Add(values[col_fech]); + lectura.Add(values[col_lleno]); + num.Add(values[col_id]); + } + } + if (dateTimePicker_fin.Enabled == true) + { + for (int i = 0; i < time.Count; i++) + { + ind = time[i].IndexOf("/"); + dia = Convert.ToInt32(time[i].Substring(0, ind)); + aux = time[i].Substring(ind + 1); + ind = aux.IndexOf("/"); + mon = Convert.ToInt32(aux.Substring(0, ind)); + aux = aux.Substring(ind + 1); + ind = aux.IndexOf(" "); + year = Convert.ToInt32(aux.Substring(0, ind)); + aux = aux.Substring(ind + 1); + ind = aux.IndexOf(":"); + hor = Convert.ToInt32(aux.Substring(0, ind)); + min = Convert.ToInt32(aux.Substring(ind + 1)); + + fe = new DateTime(year, mon, dia, hor, min, 0); + + if ((fe >= f_ini) && (fe <= f_fin)) + { + nveces++; + if (lectura[i] == "") + lectura[i] = "100"; + carg = carg + Convert.ToDouble(lectura[i], System.Globalization.CultureInfo.InvariantCulture); + } + if ((i == time.Count - 1) || (num[i] != num[i + 1])) + { + reco.id.Add(Convert.ToInt32(num[i])); + reco.cargas.Add(carg / nveces); + nveces = 0; + carg = 0; + } + } + } + else + { + for (int i = 0; i < time.Count; i++) + { + if (time[i] == reco.fechai_csv) + { + reco.id.Add(Convert.ToInt32(num[i])); + if (lectura[i] == "") + lectura[i] = "100"; + + reco.cargas.Add(Convert.ToDouble(lectura[i], System.Globalization.CultureInfo.InvariantCulture)); + continue; + } + } + } + Close(); + } + catch (Exception) + { + MessageBox.Show("Error al validar los datos introducidos en la ventana", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + + private void comboBox_media_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBox_media.SelectedIndex == 1) + dateTimePicker_fin.Enabled = true; + else if (comboBox_media.SelectedIndex == 0) + dateTimePicker_fin.Enabled = false; + else + MessageBox.Show("Hay que seleccionar si se requiere hacer la media de fechas", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void DatosCsv_FormClosed(object sender, FormClosedEventArgs e) + { + if (acept == false) + { + reco.id_csv = null; + reco.llen_csv = null; + reco.fecha_csv = null; + reco.fechai_csv = null; + reco.fechaf_csv = null; + reco.id = null; + reco.cargas = null; + } + } + + private void button_reset_Click(object sender, EventArgs e) + { + try + { + reinicia(); + } + catch (Exception) + { + MessageBox.Show("Error al resetear", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } +} diff --git a/OliviaAddIn/DatosCsv.resx b/OliviaAddIn/DatosCsv.resx new file mode 100644 index 0000000..1bb292f --- /dev/null +++ b/OliviaAddIn/DatosCsv.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA + AAD///8B////Af///wH///8BOoFqBTqBamE6gWq9OoFq7zqBapU6gWq9OoFqvzqBamM6gWoF////Af// + /wH///8B////Af///wH///8BOoFqJTqBatE6gWr/OoFq/zqBav86gWqTOoFq9TqBav86gWr/OoFq0zqB + ain///8B////Af///wH///8BOoFqJTqBaus6gWr/OoFq/zqBav86gWr9OoFqqzqBauk6gWr9OoFq/zqB + av86gWrrOoFqJ////wH///8BOoFqAzqBas86gWr7OoFqzTqBaqk6gWqtOoFqYzqBask6gWpJOoFqXTqB + ass6gWr7OoFq/zqBatE6gWoF////ATqBalc6gWrpOoFq4zqBap86gWoNOoFqCzqBanM6gWrROoFqqzqB + ajk6gWoNOoFqezqBavk6gWr/OoFqW////wE6gWq1OoFqpTqBats6gWp7OoFqOzqBahs6gWrxOoFq8zqB + av86gWqVOoFqFTqBanM6gWqJOoFq0TqBarf///8BOoFq6zqBal86gWqFOoFqezqBais6gWpHOoFq8TqB + av86gWr/OoFqdTqBaj86gWopOoFqhTqBask6gWqF////ATqBauM6gWo1OoFqHzqBamX///8BOoFqiTqB + av86gWrhOoFq/zqBal////8BOoFqYTqBaok6gWrhOoFq/////wE6gWpFOoFqFzqBakU6gWov////ATqB + apk6gWr/OoFq8TqBav86gWrbOoFqE////wE6gWpVOoFqtzqBapv///8BOoFqeTqBaos6gWpj////Af// + /wE6gWpXOoFq+zqBav86gWr/OoFq3TqBahE6gWozOoFqiTqBauU6gWol////ATqBaj86gWoV////Af// + /wH///8BOoFqfTqBaus6gWr3OoFq9zqBajs6gWo7OoFqczqBat86gWphOoFqA////wH///8B////Af// + /wH///8B////ATqBapM6gWr/OoFq/zqBav86gWpbOoFqSTqBatM6gWqVOoFqeTqBahP///8B////Af// + /wH///8B////Af///wE6gWofOoFq1zqBav86gWr/OoFqff///wH///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////ATqBark6gWr/OoFqwzqBagf///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wE6gWo3OoFq6zqBaiP///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// + /wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//w== + + + \ No newline at end of file diff --git a/OliviaAddIn/DatosGDB.cs b/OliviaAddIn/DatosGDB.cs new file mode 100644 index 0000000..e55fdb9 --- /dev/null +++ b/OliviaAddIn/DatosGDB.cs @@ -0,0 +1,2716 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.IO; +using System.Runtime.InteropServices; + +using ESRI.ArcGIS.ArcMap; +using ESRI.ArcGIS.DataSourcesFile; +using ESRI.ArcGIS.DataSourcesGDB; +using ESRI.ArcGIS.esriSystem; +using ESRI.ArcGIS.Geodatabase; +using ESRI.ArcGIS.GeoDatabaseUI; +using ESRI.ArcGIS.Geometry; +using ESRI.ArcGIS.Carto; +using ESRI.ArcGIS.AnalysisTools; +using ESRI.ArcGIS.Geoprocessor; +using ESRI.ArcGIS.Geoprocessing; +using ESRI.ArcGIS.Display; +using ESRI.ArcGIS.Framework; +//using ESRI.ArcGIS.ArcMapUI; + +namespace OliviaAddIn +{ + /** + * @file DatosGDB.cs + * Clase con funciones para lectura de GDB en general. + * Contiene definiciones y funciones necesarias para exportar los datos de GDB a SHP, y viceversa + * concretados con las opciones de configuración de la limpieza viaria. + */ + public class DatosGDB + { + //************************************************************************************* + //Enums + public enum ModsImport + { + ImportNo, + ImportSec1, //capa secto + ImportSec2, //capa secto con ambitos unidos por sector para maqueta + ImportPlan1, //capa planif + ImportPlan2, //capa ptos control + ImportPlan3, //capa ruta + ImportPlan4, //capa instalaciones + ImportPlan5, //capa ruta aux + ImportPlan6,//capa planif con ámbitos unidos por sector para maqueta + } + //************************************************************************************* + //Variables + public string err_st = ""; + public string path_class = null;//path de la feature class que se ha elegido como datos de entrada + public string path_import = null;//path donde se ha importado el resultado + public string path_secto = null;//path de la feature class que contiene la sectorización que se va a emplear para planificar + ///////////////////////////////// + + public string giros = "giro"; + public string relaciones = "relacion"; + public string interseccion = "intersec"; + public string sector = "SECTOR"; + public string secuencia = "SECUENCIA"; + public string tipo_cont = "FRACCION"; + public string tipo_recog = "NOMB_TIP_R"; + public string tipo_entid = "NOM_TIPO_E"; + public string fid = "FID"; + public string[] campo_aux = { "Join_Count", "TARGET_FID", "JOIN_FID", "Join_Cou_1", "TARGET_F_1", "JOIN_FID_1", "Join_Cou_2", "TARGET_F_2" }; + public string carga_conten = "CARGA"; + public string name_export_amb = "data_"; + public string name_export_nw = "nw_"; + public string name_export_suf = "_ok"; + public string name_temp = "_tmp"; + public string name_temp1 = "_tmp1"; + public string name_temp2 = "_tmp2"; + public string name_control_out = "_Control"; + public string name_control = "_C"; + public string name_ruta_out = "_Ruta"; + public string name_ruta2_out = "_Viajes"; + public string name_ruta_aux = "_Raux"; + public string name_ruta = "_R"; + public string name_ruta2 = "_R2"; + public string name_sect = "_Sector"; + public string name_csv = "_L"; + public string name_aux = "_aux"; + public string ext_shp = ".shp"; + public string name_instal = "_I"; + public string name_inst_out = "_Instalacion"; + public string name_map = "mapa"; + public string union_espa = "Join_Count"; + public string union_id = "TARGET_FID"; + public string union_nivel = "NIVEL_LI_1"; + public string municip = "muni_"; + public string ambit = "SECTOR "; + public string cap_calle = "CALLES"; + public string cap_sect = "Sectorizacion"; + public string municipio = "municipio"; + + //************************************************************************************* + //Métodos + public DatosGDB() + { + + } + + /** + * Comprueba que haya una columna de sector y secuencia + */ + public bool comp_campos_planif(string path_class) + { + ITable tabla = FunGDB.dame_tabla_clase(path_class); + if (tabla == null) + return false; + + return comp_campos_planif_(tabla); + } + /** + * Comprueba que haya una columna de sector y secuencia + */ + public bool comp_campos_planif(string path_gdb, string nomb_clas) + { + ITable tabla = FunGDB.dame_tabla_clase(path_gdb, nomb_clas); + if(tabla==null) + return false; + + return comp_campos_planif_(tabla); + } + /** + * Comprueba que haya una columna de sector y secuencia + */ + public bool comp_campos_planif_(ITable tabla) + { + if (tabla.FindField(sector) < 0 || tabla.FindField(secuencia) < 0) + return false; + return true; + } + + /* + * Dado un nombre de featureclass, una consulta y una geometría, interseca entre un poligono dado (geom) y una capa lineal (fc1) + */ + public IQueryFilter dame_filt_inter(IFeatureClass fc, string consulta, IGeometry geom) + { + IQueryFilter filt = null; + ISpatialFilter filtro_espacial = null; + + try + { + if (geom != null) + { + //interseccion espacial entrew el poligono dado y la capa de ambitos o nw dependiendo de cual sea el ambito escogido en el dialogo + filtro_espacial = new SpatialFilterClass(); + filtro_espacial.Geometry = geom; + filtro_espacial.GeometryField = fc.ShapeFieldName; + filtro_espacial.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; + //se incorpora filtro de atributos si se pasa como argumento. De este modo se hará la interseccion espacial sólo de aquellos elementos que cumplan el filtrado de atributos. + if ((consulta != null) || consulta != "") + filtro_espacial.WhereClause = consulta; + filt = (IQueryFilter)filtro_espacial; + } + else + { + //se aplica filtro + filt = new QueryFilterClass(); + filt.WhereClause = consulta; + } + + return filt; + } + catch (Exception) + { + return null; + } + } + + /* + * une las geometrías de una misma capa que cumplen la consulta de atributos indicada (filtro_clause) + * de modo que trata los diversos polígonos como una única geometría (necesario para la intersección entre polígonos) + * si no se hiciera así en la posterior interseccón entre polígonos sólo cogería uno de cada capa para intersecar y se perderían datos. + * Se guarda la featureclass con las geometrías unidas + * importación de la capa secotrizada, de modo que sólo haya una geometría por sector. + * Unificando todos los ámbitos que pertenecen al mismo sector. + */ + public IGeometry une_poligonos(string ftclass, string filtro_clause) + { + string capa, copia = null; + IFeatureClass fc1; + IFeatureWorkspace ft_ws = null; + IWorkspace ws = null; + IQueryFilter filtro = null; + IGeometry queryGeometry = null; + IGeometryDef def_geom = null; + bool mal=false; + + capa = ftclass; + + try + { + IWorkspaceFactory wsf = new ShapefileWorkspaceFactoryClass(); + ws = wsf.OpenFromFile(OliviaGlob.Paths.DirData, 0); + ft_ws = (IFeatureWorkspace)ws; + } + catch (Exception) + { + err_st = "Error al recibir los datos de " + ftclass; + return null; + } + + try + { + if (filtro_clause != null) + { + filtro = new QueryFilterClass(); + filtro.WhereClause = filtro_clause; + } + + fc1 = FunGDB.abre_ftclass(OliviaGlob.Paths.DirData, capa); + if (fc1 == null) + { + err_st = "Error al abrir la capa " + capa; + return null; + } + def_geom = FunGDB.dame_geom_coords(fc1, OliviaGlob.coorsys_in); + } + catch (Exception) + { + err_st = "Error al abrir la capa " + capa; + return null; + } + + try + { + if (fc1.ShapeType == esriGeometryType.esriGeometryPolyline) + { + FunGDB.libera(fc1); + copia = copia_capa(capa); + if (copia == null) + { + err_st = "Error al crear copia de la capa " + capa; + return null; + } + + capa = System.IO.Path.GetFileNameWithoutExtension(copia); + fc1 = FunGDB.abre_ftclass(OliviaGlob.Paths.DirData, capa); + queryGeometry = une_geometria(fc1, filtro); + if (queryGeometry == null) + mal = true; + + } + else if (fc1.ShapeType == esriGeometryType.esriGeometryPoint) + { + FunGDB.libera(fc1); + capa = crea_aux_pto(ftclass, filtro, out queryGeometry); + if (capa == null) + mal = true; + } + else + { + err_st = "El tipo de geometría de entrada no está permitido"; + mal = true; + } + if (mal == true) + { + err_st = "Error al convertir a geometría única. " + err_st; + return null; + } + + } + catch (Exception) + { + err_st = "Error al unir los polígonos que cumplen la consulta: " + filtro.WhereClause + ", de la capa " + ftclass; + return null; + } + finally + { + FunGDB.libera(fc1); + } + + + if (queryGeometry.SpatialReference.FactoryCode != def_geom.SpatialReference.FactoryCode) + queryGeometry.Project(def_geom.SpatialReference); + + return queryGeometry; + } + + /* + * A partir de una capa recorre todos los elementos que cumplen el filtro y los une en una única geometría + */ + public IGeometry une_geometria(IFeatureClass fc1, IQueryFilter filtro) + { + IFeatureCursor fcc = null; + IFeature f1 = null, f2 = null; + IGeometry queryGeometry = null; + ITopologicalOperator union = null; + + try + { + fcc = fc1.Search(filtro, false); + } + catch (Exception) + { + MessageBox.Show("La capa seleccionada no tiene campos o atributos adecuados.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return null; + } + + try + { + f2 = f1 = fcc.NextFeature(); + if (f1 == null) + { + err_st = string.Format("La capa seleccionada: {0} no contiene elementos que cumplan la consulta: {1}", fc1.AliasName, filtro.WhereClause); + return null; + } + f2 = fcc.NextFeature(); + + union = (ITopologicalOperator)f1.Shape; + while (f1 != null && f2 != null) + { + f1.Shape = union.Union(f2.Shape); + union = (ITopologicalOperator)f1.Shape; + f2.Delete(); + FunGDB.libera(f2); + f2 = fcc.NextFeature(); + } + + queryGeometry = f1.Shape; + f1.Store(); + + return queryGeometry; + + } + catch (Exception) + { + err_st = "Error al unir polígonos de la capa" + fc1.AliasName; + return null; + } + finally + { + //libera + FunGDB.libera(f1); + FunGDB.libera(f2); + FunGDB.libera(fcc); + } + + } + + /** + * Recorre los ámbitos lineales del shp viendo qué longitud tienen dentro de la geometría, y si + * es menos de un porcentaje, lo quitan + **/ + public bool quita_amb_sobresalen(string shp_path, IGeometry geom_zon, double porc) + { + + int[] ids = null; + IFeature f = null; + IFeatureClass fc = null; + IGeometry geom_aux = null; + ITopologicalOperator union = null; + IPolyline poli = null; + double longi_zon=0, longi_tot=0; + List quita = new List(); + int j; + + try + { + ids = FunGDB.dame_ids_consulta(shp_path, ""); //consulta todos + if (ids == null) + return false; + fc = FunGDB.abre_ftclass(shp_path); + if (fc == null) + return false; + for (j = 0; j < ids.Length; j++) + { + f = fc.GetFeature(ids[j]); + geom_aux = f.Shape; + poli = (IPolyline)geom_aux; + longi_tot = poli.Length; + union = (ITopologicalOperator)geom_zon; + if (geom_aux == null) + return false; + geom_aux = union.Intersect(geom_aux, esriGeometryDimension.esriGeometry1Dimension);//se realiza la interseccion entre ámbito (linea) y nivel (poligono) + poli = (IPolyline)geom_aux; + longi_zon = poli.Length;//se consigue la longitud de ámbito (linea) que interseca con el nivel) + + if ((longi_zon / longi_tot) < porc) + { + //quita esa línea + quita.Add(ids[j]); + } + FunGDB.libera(f); + } + + + FunGDB.libera(fc); + FunGDB.libera(f); + + if (quita.Count>0) + { + //borra las líneas que se han indicado + if (!FunGDB.quita_filas(shp_path, quita)) + return false; + } + + return true; + } + catch (Exception) + { + return false; + } + finally + { + FunGDB.libera(fc); + FunGDB.libera(f); + } + } + + /** + * Recorre los ámbitos lineales del shp viendo los que están en la zona de restricción + * y los que caen dentro, los quita + * is_lin ==true, interseca poligono con línea + * is_lin ==false, interseca polígono con punto + **/ + public bool quita_amb_restric(string shp_path, IGeometry geom_restr, bool is_lin) + { + + int[] ids = null; + IFeature f = null; + IFeatureClass fc = null; + IGeometry geom_aux = null; + ITopologicalOperator union = null; + List quita = new List(); + int j; + esriGeometryDimension dim = esriGeometryDimension.esriGeometry1Dimension; + + try + { + ids = FunGDB.dame_ids_consulta(shp_path, ""); //consulta todos + if (ids == null) + return false; + fc = FunGDB.abre_ftclass(shp_path); + if (fc == null) + return false; + for (j = 0; j < ids.Length; j++) + { + f = fc.GetFeature(ids[j]); + geom_aux = f.Shape; + union = (ITopologicalOperator)geom_restr; + if (geom_aux == null) + return false; + if (is_lin) + dim = esriGeometryDimension.esriGeometry1Dimension;//se realiza la interseccion entre ámbito (linea) y nivel (poligono) + else + dim = esriGeometryDimension.esriGeometry0Dimension;//se realiza la interseccion entre ámbito (punto) y nivel (poligono) + geom_aux = union.Intersect(geom_aux, dim); + + if(!geom_aux.IsEmpty) + { + //quita esa línea + quita.Add(ids[j]); + } + FunGDB.libera(f); + } + + + FunGDB.libera(fc); + FunGDB.libera(f); + + if (quita.Count > 0) + { + //borra las líneas que se han indicado + if (!FunGDB.quita_filas(shp_path, quita)) + return false; + } + + return true; + } + catch (Exception) + { + return false; + } + finally + { + FunGDB.libera(fc); + FunGDB.libera(f); + } + } + + /** + * PARA DEBUG + * Comprueba si hay locks, hay que llamarla antes de destruir o liberar fc, es solo para ver dónde se crean los locks + */ + public bool check_locks(ISchemaLock sl) + { + int nlocks; + ISchemaLock schemaLock; + ISchemaLockInfo schemaLockInfo; + IEnumSchemaLockInfo enumSchemaLockInfo; + + //comprueba si hay locks + schemaLockInfo = null; + schemaLock = sl; + schemaLock.GetCurrentSchemaLocks(out enumSchemaLockInfo); + enumSchemaLockInfo.Reset(); + nlocks = 0; + schemaLockInfo = enumSchemaLockInfo.Next(); + while (schemaLockInfo != null) + { + schemaLockInfo = enumSchemaLockInfo.Next(); + nlocks++; + } + if (nlocks > 0) + return false; + + return true; + } + + /** + * Exportar la red navegable + * capa streets, intersección con geom_ambits que es donde están los ámbitos + * (previamente se ha intersecado con zonas, niveles, etc, y ampliado para que contenga la instalación), + * ampliado un buffer, y quitándole la geometría de las restricciones + */ + public bool exporta_nw(IGeometry geom_ambits, IGeometry geom_restric, bool restric, string fecha_hora, out IDatasetName shp_data_nw) + { + string name = "", err_str = ""; + ITopologicalOperator union = null; + double buf = 0; + IGeometry geom1 = null; + string nomb_class = ""; + IQueryFilter filtro; + IDatasetName shp_dsn = null; + + shp_data_nw = null; + + /////////////////////////////////////////////////////////// + //prepara el shp donde va a exportar + name = name_export_nw + fecha_hora + ext_shp; + + /////////////////////////////////////////////////////////// + //se obtiene la geometría a intersecar con la red, que será la que contiene + //a todos los ámbitos y la instalación, ampliada un buffer, mayor si hay + //restricciones de circulación + union = (ITopologicalOperator)geom_ambits; + buf = OliviaGlob.buff_export; + if (restric) + { + buf = buf * 2; + } + geom1 = union.Buffer(buf); + + /////////////////////////////////////////////////////////// + //a la geometría resultante le quita las partes por donde no puede circular, + //que son las debidas a restricciones de circulación + geom1 = FunGDB.diferencia_geoms(geom1, geom_restric); + if (geom1 == null) + { + err_st = "Error al diferencias geometrías " + name; + return false; + } + + /////////////////////////////////////////////////////////// + //crea el filtro espacial y el añadido de consulta de atributos si fuera necesario + nomb_class = OliviaGlob.Capas.ftclass_ejes; + IFeatureClass fc = FunGDB.abre_ftclass(OliviaGlob.Paths.PathGdbNw, nomb_class); + filtro = dame_filt_inter(fc, null, geom1); + if (filtro == null) + { + err_st = "Error al crear el filtro de exportación " + name; + return false; + } + FunGDB.libera(fc); + + if (!FunGDB.exporta(OliviaGlob.Paths.PathGdbNw, nomb_class, + OliviaGlob.Paths.DirData, name, filtro, out shp_dsn, out err_str)) + { + err_st = err_str; + return false; + } + + shp_data_nw = (IDatasetName)shp_dsn; + + return true; + } + + /* + * + */ + public void inicia_coords(string dir, string nomb_class) + { + OliviaGlob.coorsys_in = FunGDB.dame_factory_code(dir, nomb_class); + if (OliviaGlob.coorsys_in < 0) + OliviaGlob.coorsys_in = OliviaGlob.coorsys; + OliviaGlob.coorsys = OliviaGlob.coorsys_in; + } + + ////////////////////////////////////// + //REVISAR + + /* + * Abre la capa en el espacio de trabajo de ArcGIS y asigna a cada sector un color y un estilo en el pintado, según la simbología aplicada por VSM. + * Todos los registros que tengan el mismo valor en el campo "sector" se pintarán con el mismo estilo + * Modo = 0 para pintar según la simbología de VSM. Modo = 1 para pintar las rutas al finalizar el proceso de planificación, pintando las felchas que indican el sientido de la misma. + */ + public bool pinta_sect_galeria(IFeatureLayer shape, int modo) + { + int indice1 = -1, indice2, indice = -1; + string valor_clase, name_simbol; + IGeoFeatureLayer geo_layer = null; + IUniqueValueRenderer valor_unico = null; + IDisplayTable tabla_disp = null; + IFeatureCursor fcursor = null; + IFeature feat = null; + IFields campos = null; + IStyleGallery styleGallery = null; + + if (!carga_capa_galeria(shape.Name, modo, out fcursor, out feat, out campos, out tabla_disp, out geo_layer, out styleGallery)) + return false; + try + { + if ((shape.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint) || (shape.FeatureClass.ShapeType == esriGeometryType.esriGeometryMultipoint)) + { + //se pone un valor por defecto + predef_valunic(shape, modo, out valor_unico, campos, out indice, out indice1, out indice2); + while (feat != null) + { + //se identifican si son dos atributos los que hay que tener en cuenta para aplicar la simbología o sólo uno. + if (valor_unico.FieldCount == 1) + valor_clase = feat.get_Value(indice).ToString(); + else + { + valor_clase = feat.get_Value(indice1).ToString(); + valor_clase = valor_clase + "," + feat.get_Value(indice2).ToString(); + } + //se identifica el nombre del simbolo VSM que debe ir asociado al elemento + name_simbol = decode_simbol(valor_clase, modo); + //Se analiza si el valor ha sido añadido como valor único. Si no, se añade. + if (!add_valunic_galeria(valor_unico, styleGallery, valor_clase, name_simbol, "Marker", modo)) + return false; + + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(feat); + feat = fcursor.NextFeature(); + } + } + else if (shape.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline) + { + //se pone un valor por defecto + predef_valunic(shape, modo, out valor_unico, campos, out indice, out indice1, out indice2); + while (feat != null) + { + //se identifican los atributos que hay que tener en cuenta para aplicar la simbología o sólo uno. + valor_clase = feat.get_Value(indice).ToString(); + //se identifica el nombre del simbolo VSM que debe ir asociado al elemento + name_simbol = decode_simbol(valor_clase, modo); + if (name_simbol == null) + { + err_st = string.Format("No se ha encontrado la simbología buscada para {0}", valor_clase); + return false; + } + //Se analiza si el valor ha sido añadido como valor único. Si no, se añade. + if (!add_valunic_galeria(valor_unico, styleGallery, valor_clase, name_simbol, "Line", modo)) + return false; + + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(feat); + feat = fcursor.NextFeature(); + } + if (modo == 1) + { + asigna_color(valor_unico, 1, 1); + } + } + else if (shape.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon) + { + //se pone un valor por defecto + predef_valunic(shape, modo, out valor_unico, campos, out indice, out indice1, out indice2); + while (feat != null) + { + //se identifican los atributos que hay que tener en cuenta para aplicar la simbología o sólo uno. + valor_clase = feat.get_Value(indice1).ToString(); + valor_clase = valor_clase + "," + feat.get_Value(indice2).ToString(); + //se identifica el nombre del simbolo VSM que debe ir asociado al elemento + name_simbol = decode_simbol(valor_clase, modo); + //Se analiza si el valor ha sido añadido como valor único. Si no, se añade. + if (!add_valunic_galeria(valor_unico, styleGallery, valor_clase, name_simbol, "Fill", modo)) + return false; + + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(feat); + feat = fcursor.NextFeature(); + } + } + else + return false; + //Si no ha utilizado una rampa de color predefinida en un estilo, utilice "Custom". + //De lo contrario, utilice el nombre de la rampa de color que ha seleccionado. + actualiza_vista(valor_unico, tabla_disp, geo_layer, indice, indice1); + } + catch (Exception) + { + return false; + } + finally + { + if (feat != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(feat); + if (tabla_disp != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(tabla_disp); + if (fcursor != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(fcursor); + if (campos != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(campos); + } + return true; + } + + /* + * Busca la capa en el espacio de trabajo de ArcGIS y asigna a cada sector un color y un estilo en el pintado. + * Todos los registros que tengan el mismo valor en el campo "sector" se pintarán con el mismo estilo + * Modo 0 para identificar los valores unicos pero no pintar la capa + * Modo 1 para cargar la capa y pintarla en el visor cartográfico. + * Modo 2 para cargar la capa de _Sectores de la GDB de capas importadas. Esto se hará para la maquetación. + * Modo 3 para cargar la capa de sectores en el mapa de localizacion + * Modo 4 para cargar la capa normal y poder editar la sectorización. Antes de la planificación. + * Modo 5 para pintar la capa y no eliminar las ya cargada. Se hace en la recogida de residuos. + */ + public IUniqueValueRenderer pinta_sectores(string path_gdb, string ftclass_nom, int modo) + { + bool encontrado = false; + int indice, nmapas; + string marco = null; + IGeoFeatureLayer geo_layer = null; + IUniqueValueRenderer valor_unico = null; + IDisplayTable tabla_disp = null; + IFeatureCursor fcursor = null; + IFeatureClass f_clase = null; + IFeatureLayer capa = null; + IFields campos = null; + ISpatialReferenceFactory3 spatialReferenceFactory; + IProjectedCoordinateSystem coord_proy; + ESRI.ArcGIS.ArcMapUI.IMxDocument mx_doc; + IApplication app; + IMap map; + + try + { + f_clase = FunGDB.abre_ftclass(path_gdb, ftclass_nom); //crea .sr.lock + if (f_clase == null) + return null; + + capa = new FeatureLayer(); + capa.FeatureClass = f_clase; + + if ((modo == 2) || (modo == 3)) + capa.Name = cap_sect; + else + capa.Name = ftclass_nom; + + geo_layer = (IGeoFeatureLayer)capa; + //se recorre la tabla valor por valor para saber si ya se le ha asignado un color con su estilo de simbología úinico por valor (único por sector) + tabla_disp = (IDisplayTable)geo_layer; + fcursor = (IFeatureCursor)tabla_disp.SearchDisplayTable(null, false);//crea .rd.lock + campos = fcursor.Fields; + indice = campos.FindField(sector); + + add_valunic(fcursor, capa, out valor_unico, indice, modo); + + if (modo != 0) + { + app = ArcMap.Application; + mx_doc = (ESRI.ArcGIS.ArcMapUI.IMxDocument)(app.Document); + + if ((modo != 2) && (modo != 3) && (modo != 5)) + { + //se eliminan las posibles capas que pueda haber abiertas, y si se ha hecho una mquetación anteriormente también se quitan las capas y los mapas + nmapas = mx_doc.Maps.Count; + for (int j = 0; j < nmapas; j++) + { + map = mx_doc.Maps.get_Item(j); + if ((map.Name == OliviaGlob.df_secund) || (map.Name == OliviaGlob.df_secund1)) + { + map.ClearLayers(); + //actuliza la vista del mapa para que se visualice + mx_doc.UpdateContents(); + mx_doc.ActiveView.Refresh(); + } + else if (map.Name == OliviaGlob.df_princip) + { + map.ClearLayers(); + //actuliza la vista del mapa para que se visualice + mx_doc.Maps.Remove(map); + } + } + //se cambia de layout view (con la plantilla de maquetación) al data view (vista normal) + mx_doc.ActiveView = (IActiveView)mx_doc.FocusMap; + } + + map = mx_doc.FocusMap; + spatialReferenceFactory = (ISpatialReferenceFactory3)new SpatialReferenceEnvironment(); + coord_proy = spatialReferenceFactory.CreateProjectedCoordinateSystem(OliviaGlob.coorsys_in);//ETRS89_UTM30N + map.SpatialReference = (ISpatialReference)coord_proy; + if (mx_doc.Maps.Count > 1) + { + if (modo == 2) + marco = OliviaGlob.df_princip; + else if (modo == 3) + marco = OliviaGlob.df_secund; + for (int r = 0; r < mx_doc.Maps.Count; r++) + { + map = mx_doc.Maps.get_Item(r); + if (map.Name == marco) + { + encontrado = true; + break; + } + } + if ((modo == 3) && (encontrado == false)) + { + marco = OliviaGlob.df_secund1; + for (int r = 0; r < mx_doc.Maps.Count; r++) + { + map = mx_doc.Maps.get_Item(r); + if (map.Name == marco) + break; + } + } + } + if ((modo != 1) && (modo != 3) && (modo != 5)) + map.ClearLayers(); + map.AddLayer(capa); + actualiza_vista(valor_unico, tabla_disp, geo_layer, indice, -1); + + if (modo == 3) + { + // hace zoom a losámbitos + IActiveView av = (IActiveView)map; //el mapa sigue siendo el del municipio + av.Extent = map.get_Layer(0).AreaOfInterest; + av.Refresh(); + + //Devuelve el foco al principal + mx_doc = (ESRI.ArcGIS.ArcMapUI.IMxDocument)(app.Document); + for (int r = 0; r < mx_doc.Maps.Count; r++) + { + map = mx_doc.Maps.get_Item(r); + if (map.Name == OliviaGlob.df_princip) + { + break; + } + } + mx_doc.ActiveView.FocusMap = map; + //actuliza la vista del mapa para que se visualice + mx_doc.UpdateContents(); + mx_doc.ActiveView.Refresh(); + + } + } + + return valor_unico; + } + catch (Exception) + { + return null; + } + finally + { + //libera + FunGDB.libera(campos); + FunGDB.libera(fcursor); + FunGDB.libera(f_clase); + FunGDB.libera(capa); + FunGDB.libera(tabla_disp); + } + + } + + /* + * Permite conocer el nombre del simbolo a aplicar según los atributos que tiene. + * Modo 0 para la simbologia de VSM. Modo = 1 para la simbologia de la capa de rutas(sólo para elementos lineales). + */ + public string decode_simbol(string atributos, int modo) + { + string name_simb = null, basura, tip_rec; + int ind; + ind = atributos.IndexOf(","); + + try + { + if (ind > 0) + { + basura = atributos.Substring(0, ind); + ind++; + tip_rec = atributos.Substring(ind); + + for (int i = 0; i < RecogidaDef.simb_rec_vsm.Length - 3; i++) + { + if (tip_rec == RecogidaDef.simb_rec_vsm[i]) + { + name_simb = RecogidaDef.nombre_simbrec_vsm[i]; + return name_simb; + } + } + for (int j = 6; j < RecogidaDef.simb_rec_vsm.Length; j++) + { + if (tip_rec == RecogidaDef.simb_rec_vsm[j]) + { + for (int k = 0; k < RecogidaDef.simb_tipbasura.Length; k++) + { + if (basura == RecogidaDef.simb_tipbasura[k]) + { + if (j == 6) + { + name_simb = RecogidaDef.nombre_simbrec_vsm[j + k]; + return name_simb; + } + else if (j == 7) + { + name_simb = RecogidaDef.nombre_simbrec_vsm[(j + 4) + k]; + return name_simb; + } + if (k > 2) + break; + else + { + name_simb = RecogidaDef.nombre_simbrec_vsm[(j + 8) + k]; + return name_simb; + } + } + } + } + } + if ((tip_rec == "") && (basura == "")) + { + name_simb = "Soterrados"; + return name_simb; + } + if (name_simb == null) + { + MessageBox.Show("No se encuentra el simbolo en la contenerizacion"); + } + } + else + { + if (modo == 0) + { + for (int i = 0; i < LimpiezaDef.simb_tto.Length; i++) + { + if (atributos == LimpiezaDef.simb_tto[i]) + { + name_simb = LimpiezaDef.nombre_simblimp_vsm[i]; + return name_simb; + } + } + } + else if (modo == 1) + { + name_simb = "Arrow Right Middle"; + return name_simb; + } + else + MessageBox.Show("No se reconoce la simbologíua que hay que aplicar"); + } + + return null; + } + catch (Exception) + { + return null; + } + } + + /* + * Une las polilineas de una misma capa que pertenecen al mismo sector. + * Así a posteriori se podrá realizar el datadriven pages dependiendo del sector. + * Habrá un elemento por sector y generará tantos mapas como sectores. + */ + public bool une_sectores(string shape, IUniqueValueRenderer valor_unico) + { + string filtro_clause; + IGeometry geom = null; + + for (int i = 0; i < valor_unico.ValueCount; i++) + { + filtro_clause = sector + "=" + valor_unico.Value[i]; + geom = une_poligonos(shape, filtro_clause); + if (geom == null) + return false; + } + return true; + } + + /* + * Pone por defecto un valor unico extraido del primer valor de la tabla de campos + */ + public void predef_valunic(IFeatureLayer capa, int modo, out IUniqueValueRenderer valor_unico, IFields campos, out int indice, out int indice1, out int indice2) + { + string campo; + indice = -1; + indice1 = -1; + indice2 = -1; + + //Crea la clasificación de valor único + valor_unico = new UniqueValueRendererClass(); + + if (capa.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint) + { + indice1 = campos.FindField(tipo_cont); + indice2 = campos.FindField(tipo_recog); + if (indice1 < 0) + { + indice = campos.FindField(tipo_entid); + campo = tipo_entid; + //se establecen estas propiedades antes de realizar la clasificación por valores únicos. + valor_unico.FieldCount = 1; + valor_unico.set_Field(0, campo); + } + else if (indice2 > 0) + { + //se establecen estas propiedades antes de realizar la clasificación por valores únicos. + valor_unico.FieldCount = 2; + valor_unico.set_Field(0, tipo_cont); + valor_unico.set_Field(1, tipo_recog); + valor_unico.FieldDelimiter = ","; + } + else + { + predef_valunic1(valor_unico, campos); + } + } + else if (capa.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline) + { + if (modo == 0) + campo = tipo_entid; + else if (modo == 1) + campo = sector; + else + campo = null; + indice = campos.FindField(campo); + if (indice > 0) + { + //se establecen estas propiedades antes de realizar la clasificación por valores únicos. + valor_unico.FieldCount = 1; + valor_unico.set_Field(0, campo); + } + else + { + predef_valunic1(valor_unico, campos); + } + } + else if (capa.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon) + { + indice1 = campos.FindField(tipo_cont); + indice2 = campos.FindField(tipo_recog); + if (indice2 > 0) + { + //se establecen estas propiedades antes de realizar la clasificación por valores únicos. + valor_unico.FieldCount = 2; + valor_unico.set_Field(0, tipo_cont); + valor_unico.set_Field(1, tipo_recog); + valor_unico.FieldDelimiter = ","; + } + else + { + predef_valunic1(valor_unico, campos); + } + } + } + + /* + * Pone por defecto un valor unico extraido del primer valor de la tabla de campos + */ + public void predef_valunic1(IUniqueValueRenderer valor_unico, IFields campos) + { + int indice; + + indice = campos.FindField(sector); + if (indice > 0) + { + //se establecen estas propiedades antes de realizar la clasificación por valores únicos. + valor_unico.FieldCount = 1; + valor_unico.set_Field(0, sector); + } + else + MessageBox.Show("No se encuentra referencia en las tablas para elementos puntuales"); + } + + /* + * Crea un array con los valores únicos (en el campo ambito de trabajo) que se encuentran en la capa. + * A esos valores les aplica la simbología correspondiente que aplica VSM en sus cartografias. + * Modo = 0 para añadir a los valores unicos la simbologia de VSM. Modo = 1 para añadir a los valores únicos la simbología referente a la capa de rutas (linea de color con flecha de sentido). + */ + public bool add_valunic_galeria(IUniqueValueRenderer valor_unico, IStyleGallery styleGallery, string valor_clase, string name_simbol, string tipo, int modo) + { + bool exist_valor; + ISymbol symbol = null; + IEnumStyleGalleryItem enumStyleGallery = null; + IStyleGalleryItem estilo_gal = null; + + try + { + if (name_simbol == null) + { + err_st = "No se ha encontrado el símbolo."; + return false; + } + exist_valor = false; + for (int i = 0; i <= valor_unico.ValueCount - 1; i++) + { + if (valor_unico.get_Value(i) == valor_clase) + { + exist_valor = true; + break; //Si el valor se encuentra se sale del bucle. + } + } + //Si el valor (numero de sector) no se ha encontrado como valor_unico, significa que es nuevo y se añade. + if (exist_valor == false) + { + if (modo == 0) + { + if (!File.Exists(OliviaGlob.Paths.PathSimbVSM)) + { + err_st = string.Format("No se encuentra la galería de estilos de VSM en: {0}.\n Modifica el path en el archivo de configuración.", OliviaGlob.Paths.PathSimbVSM); + return false; + } + else + enumStyleGallery = styleGallery.get_Items(tipo + " Symbols", OliviaGlob.Paths.PathSimbVSM, ""); + } + else if (modo == 1) + { + if (!File.Exists(OliviaGlob.Paths.PathSimbESRI)) + { + err_st = string.Format("No se encuentra la galería de estilos de VSM en: {0}.\n Modifica el path en el archivo de configuración.", OliviaGlob.Paths.PathSimbESRI); + return false; + } + else + enumStyleGallery = styleGallery.get_Items(tipo + " Symbols", OliviaGlob.Paths.PathSimbESRI, ""); + } + else + err_st = "No se reconoce la simbología a aplicar"; + enumStyleGallery.Reset(); + estilo_gal = enumStyleGallery.Next(); + while (estilo_gal != null) + { + if (estilo_gal.Name == name_simbol) + { + break; + } + estilo_gal = enumStyleGallery.Next(); + } + if (estilo_gal != null) + { + if (modo == 0) + { + symbol = (ISymbol)estilo_gal.Item; + valor_unico.AddValue(valor_clase, "", symbol); + valor_unico.set_Label(valor_clase, estilo_gal.Name); + valor_unico.set_Symbol(valor_clase, symbol); + } + else if (modo == 1) + { + symbol = (ISymbol)estilo_gal.Item; + valor_unico.AddValue(valor_clase, "", symbol); + valor_unico.set_Label(valor_clase, estilo_gal.Name); + valor_unico.set_Symbol(valor_clase, symbol); + } + return true; + } + } + return true; + + } + catch (Exception) + { + return false; + } + } + + /* + * Carga la capa sobre la que se va a aplicar la simbologia extraida de la galería de estilos + * Modo = 0 para pintar según la simbología de VSM. Modo = 1 para pintar las rutas al finalizar el proceso de planificación. + */ + public bool carga_capa_galeria(string shape, int modo, out IFeatureCursor fcursor, out IFeature feat, out IFields campos, out IDisplayTable tabla_disp, out IGeoFeatureLayer geo_layer, out IStyleGallery styleGallery) + { + IFeatureLayer capa = null; + IStyleGalleryStorage styleStorage = null; + ESRI.ArcGIS.ArcMapUI.IMxDocument mx_doc; + IApplication app; + IMap map; + + if (modo == 0) + { + try + { + styleGallery = new ESRI.ArcGIS.Framework.StyleGalleryClass(); + styleStorage = (IStyleGalleryStorage)styleGallery; + if (!File.Exists(OliviaGlob.Paths.PathSimbVSM)) + { + err_st = string.Format("No se encuentra la galería de estilos de VSM en: {0}.\n Modifica el path en el archivo de configuración.", OliviaGlob.Paths.PathSimbVSM); + fcursor = null; + feat = null; + campos = null; + tabla_disp = null; + geo_layer = null; + styleGallery = null; + return false; + } + else + styleStorage.TargetFile = OliviaGlob.Paths.PathSimbVSM; + } + catch (Exception eexx) + { + MessageBox.Show(eexx.Message); + fcursor = null; + feat = null; + campos = null; + tabla_disp = null; + geo_layer = null; + styleGallery = null; + return false; + } + } + else if (modo == 1) + { + try + { + styleGallery = new ESRI.ArcGIS.Framework.StyleGalleryClass(); + styleStorage = (IStyleGalleryStorage)styleGallery; + if (!File.Exists(OliviaGlob.Paths.PathSimbESRI)) + { + err_st = string.Format("No se encuentra la galería de estilos de ESRI en: {0}.\n Modifica el path en el archivo de configuración.", OliviaGlob.Paths.PathSimbESRI); + fcursor = null; + feat = null; + campos = null; + tabla_disp = null; + geo_layer = null; + styleGallery = null; + return false; + } + else + styleStorage.TargetFile = OliviaGlob.Paths.PathSimbESRI; + } + catch (Exception eexx) + { + MessageBox.Show(eexx.Message); + fcursor = null; + feat = null; + campos = null; + tabla_disp = null; + geo_layer = null; + styleGallery = null; + return false; + } + } + else + { + err_st = "No se reconoce la simbología que hay que aplicar"; + fcursor = null; + feat = null; + campos = null; + tabla_disp = null; + geo_layer = null; + styleGallery = null; + return false; + } + try + { + app = ArcMap.Application; + mx_doc = (ESRI.ArcGIS.ArcMapUI.IMxDocument)(app.Document); + map = mx_doc.FocusMap; + //busca la capa de interés shape en el espacio de trabajo de ArcGIS + for (int i = 0; i < map.LayerCount; i++) + { + if (map.get_Layer(i).Name == shape) + { + capa = (IFeatureLayer)map.get_Layer(i); + break; + } + } + geo_layer = (IGeoFeatureLayer)capa; + //se recorre la tabla valor por valor para saber si ya se le ha asignado un color con su estilo de simbología úinico por valor (único por sector) + tabla_disp = (IDisplayTable)geo_layer; + fcursor = (IFeatureCursor)tabla_disp.SearchDisplayTable(null, false); + feat = fcursor.NextFeature(); + campos = fcursor.Fields; + } + catch (Exception) + { + err_st = "Error al aplicar simbología a los valores únicos."; + fcursor = null; + feat = null; + campos = null; + tabla_disp = null; + geo_layer = null; + styleGallery = null; + return false; + } + return true; + } + + /* + * Acrtualiza la vista cuando se aplica la simbología de representación de catografía + */ + public void actualiza_vista(IUniqueValueRenderer valor_unico, IDisplayTable tabla_disp, IGeoFeatureLayer geo_layer, int indice, int indice1) + { + ITable tabl = null; + bool es_txt; + ESRI.ArcGIS.ArcMapUI.IMxDocument mx_doc; + + try + { + valor_unico.ColorScheme = "Custom"; + valor_unico.UseDefaultSymbol = false; + tabl = (ITable)tabla_disp; + if (indice1 != -1) + es_txt = tabl.Fields.get_Field(indice1).Type == esriFieldType.esriFieldTypeString; + else + es_txt = tabl.Fields.get_Field(indice).Type == esriFieldType.esriFieldTypeString; + valor_unico.set_FieldType(0, es_txt); + geo_layer.Renderer = (IFeatureRenderer)valor_unico; + //actuliza la vista del mapa para que se visualice + mx_doc =(ESRI.ArcGIS.ArcMapUI.IMxDocument)(ArcMap.Application.Document); + mx_doc.UpdateContents(); + mx_doc.ActiveView.Refresh(); + } + catch (Exception) + { + MessageBox.Show("Error al actualizar la vista del mapa", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + public void add_valunic(IFeatureCursor fcursor, IFeatureLayer capa, out IUniqueValueRenderer valor_unico, int indice, int modo) + { + IFeature feat = null; + IColor color; + IRgbColor my_color = null; + ISymbol sym; + + try + { + feat = fcursor.NextFeature(); + valor_unico = new UniqueValueRendererClass(); + //se establecen estas propiedades antes de realizar la clasificación por valores únicos. + valor_unico.FieldCount = 1; + valor_unico.set_Field(0, sector); + + if (capa.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline) + { + ISimpleLineSymbol simbolo = null; + //se aplica una estilo en la simbología + simbolo = new SimpleLineSymbolClass(); + if ((modo == 1) || (modo == 5)) + simbolo.Style = esriSimpleLineStyle.esriSLSDash; + else + simbolo.Style = esriSimpleLineStyle.esriSLSSolid; + simbolo.Width = 1.2; + valor_unico.DefaultSymbol = (ISymbol)simbolo; + valor_unico.UseDefaultSymbol = true; + + while (feat != null) + { + ISimpleLineSymbol simbologia = null; + simbologia = new SimpleLineSymbolClass(); + //simbologia.Style = esriSimpleLineStyle.esriSLSSolid; + if ((modo == 1) || (modo == 5)) + simbologia.Style = esriSimpleLineStyle.esriSLSDash; + else + simbologia.Style = esriSimpleLineStyle.esriSLSSolid; + simbologia.Width = 1; + + sym = (ISymbol)simbologia; + check_valunic(feat, valor_unico, sym, indice); + + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(feat); + + feat = fcursor.NextFeature(); + } + //Una vez que se sabe el número de valor únicos que existen en la tabla, se conoce el tamaño de la rampa de colores y se pueden asignar los colores a cada valor. + asigna_color(valor_unico, 1, 0); + } + else if ((capa.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint) || (capa.FeatureClass.ShapeType == esriGeometryType.esriGeometryMultipoint)) + { + ISimpleMarkerSymbol simbolo = null; + //se aplica una estilo en la simbología + simbolo = new SimpleMarkerSymbolClass(); + simbolo.Style = esriSimpleMarkerStyle.esriSMSCircle; + simbolo.Size = 2; + valor_unico.DefaultSymbol = (ISymbol)simbolo; + valor_unico.UseDefaultSymbol = true; + + while (feat != null) + { + ISimpleMarkerSymbol simbologia = null; + simbologia = new SimpleMarkerSymbolClass(); + simbologia.Style = esriSimpleMarkerStyle.esriSMSCircle; + simbologia.Size = 4; + simbologia.OutlineSize = 1; + color = new RgbColorClass(); + my_color = new RgbColor(); + my_color.Red = 0; + my_color.Blue = 0; + my_color.Green = 0; + color.RGB = my_color.RGB; + simbologia.OutlineColor = color; + + sym = (ISymbol)simbologia; + check_valunic(feat, valor_unico, sym, indice); + + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(feat); + + feat = fcursor.NextFeature(); + } + //Una vez que se sabe el número de valor únicos que existen en la tabla, se conoce el tamaño de la rampa de colores y se pueden asignar los colores a cada valor. + asigna_color(valor_unico, 0, 0); + } + else + { + return; + } + } + catch (Exception) + { + MessageBox.Show("Error al asignar un color a cada valor único de la capa " + capa.Name, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + valor_unico = null; + } + } + + /* + * 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) + { + string valor_clase; + bool exist_valor; + + try + { + valor_clase = feat.get_Value(indice).ToString(); + //Se analiza si el valor ha sido añadido como valor único. Si no, se añade. + exist_valor = false; + for (int i = 0; i <= valor_unico.ValueCount - 1; i++) + { + if (valor_unico.get_Value(i) == valor_clase) + { + exist_valor = true; + break; //Si el valor se encuentra se sale del bucle. + } + } + //Si el valor (numero de sector) no se ha encontrado como valor_unico, significa que es nuevo y se añade. + if (exist_valor == false) + { + valor_unico.AddValue(valor_clase, sector, (ISymbol)simbologia); + valor_unico.set_Label(valor_clase, valor_clase); + valor_unico.set_Symbol(valor_clase, (ISymbol)simbologia); + } + } + catch (Exception) + { + MessageBox.Show("Error al crear el listado de valores únicos.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + /* + * Una vez se tiene todo el listado de valores únicos en el campo sectores, se aplica un color aleatorio a cada valor. + * Modo = 0 para elementos puntuales. Modo = 1 para elementos lineales + * Tipo = 0 para pintar aleatoriamente elementos puntuales y lineales. Tipo = 1 para pintar las capas de rutas con las flechas del sentido de la misma. + */ + public void asigna_color(IUniqueValueRenderer valor_unico, int modo, int tipo) + { + string atribut; + int color_val, seed = 0; + List color_list = null; + IColor color = null; + Random rnd = null; + ISimpleMarkerSymbol simb_pto = null; + ISimpleLineSymbol simb_line = null; + ILineSymbol simb_linea = null; + + try + { + color_list = new List(); + color = new RgbColorClass(); + for (int j = 0; j <= valor_unico.ValueCount - 1; j++) + { + atribut = valor_unico.get_Value(j); + if (atribut != "") + { + if (modo == 0) + { + simb_pto = (ISimpleMarkerSymbol)valor_unico.get_Symbol(atribut); + } + else if (modo == 1 && tipo == 0) + { + simb_line = (ISimpleLineSymbol)valor_unico.get_Symbol(atribut); + } + else + simb_linea = (ILineSymbol)valor_unico.get_Symbol(atribut); + + //Se crea un color aleatorio pos valor_unico. + color_val = 0; + while (true) + { + rnd = new Random(seed); + seed++; + + color_val = rnd.Next(0x00000000, 0x00FFFFFF); + if (color_list.Contains(color_val) == false) + { + color_list.Add(color_val); + break; + } + else + { + err_st = "El color ya ha sido asignado a otro conjunto de registros"; + } + } + //se aplica el color aleatorio al valor_unico correspondiente. + color.RGB = color_val; + + if (modo == 0) + { + simb_pto.Color = color; + valor_unico.set_Symbol(atribut, (ISymbol)simb_pto); + } + else if (modo == 1 && tipo == 0) + { + simb_line.Color = color; + valor_unico.set_Symbol(atribut, (ISymbol)simb_line); + } + else + { + simb_linea.Color = color; + simb_linea.Width = 1.5; + valor_unico.set_Symbol(atribut, (ISymbol)simb_linea); + } + } + } + } + catch (Exception) + { + err_st = "Error al asignar colores, para el pintado, al listado de valores únicos."; + } + } + + /* + * Duplica la capa que se pasa como argumento (si existe) en el mismo directorio en el que se encuentra la capa origen + */ + public string copia_capa(string capa) + { + string ext, copia; + + try + { + string[] list = Directory.GetFiles(OliviaGlob.Paths.DirData, capa + ".*"); + ext = System.IO.Path.GetExtension(list[0]); + copia = System.IO.Path.GetDirectoryName(list[0]) + "\\" + System.IO.Path.GetFileNameWithoutExtension(list[0]) + name_aux + ext; + if (!File.Exists(copia)) + { + foreach (string f in list) + { + if (System.IO.Path.GetExtension(f) == ".lock") + continue; + ext = System.IO.Path.GetExtension(f); + copia = System.IO.Path.GetDirectoryName(f) + "\\" + System.IO.Path.GetFileNameWithoutExtension(f) + name_aux + ext; + File.Copy(f, copia, false); + } + return copia; + } + return copia; + } + catch (Exception) + { + return null; + } + } + + /* + * Crea un shapefile de multipuntos. Cada registro contemplará todos los puntos que cumplen el filtro. + */ + public string crea_aux_pto(string ftclass, IQueryFilter filtro, out IGeometry geom) + { + string campo, nueva_capa = null; + int numm = 0, ind, val_campo; + IPoint[] array_pts = new IPoint[1]; + IFeature dd = null, registo_act, graba; + IFeatureCursor featureCursor; + IPoint point; + IPointCollection4 colec_ptos = new MultipointClass(); + IMultipoint puntos = new MultipointClass(); + IGeometryBridge geom_brid = new GeometryEnvironmentClass(); + ISpatialReference coor = null; + IFeatureClass fc_shape = null; + IFields campos = null; + IField2 camp = null; + IGeometryDef geom_def = null; + IFeatureWorkspace featws_shp; + IFieldsEdit campos_edit; + IFieldEdit2 camp_edit; + IGeometryDefEdit geom_defedit; + IWorkspaceEdit ws_shape; + IWorkspace ws; + IFeatureClass fc; + try + { + + IWorkspaceFactory wsf = new ShapefileWorkspaceFactoryClass(); + ws = wsf.OpenFromFile(OliviaGlob.Paths.DirData, 0); + fc = FunGDB.abre_ftclass(OliviaGlob.Paths.DirData, ftclass); + + featureCursor = fc.Search(filtro, false); + registo_act = graba = featureCursor.NextFeature(); + //se recorren todos los puntos que cumplen la consulta de atributos y se van recolectando en un array de puntos "pointArray" + while (registo_act != null) + { + numm++; + if (numm != 1) + System.Array.Resize(ref array_pts, numm); + point = new PointClass(); + point.PutCoords(registo_act.Shape.Envelope.XMin, registo_act.Shape.Envelope.YMin); + point.SpatialReference = registo_act.Shape.SpatialReference; + coor = registo_act.Shape.SpatialReference; + array_pts[numm - 1] = point; + + FunGDB.libera(registo_act); + + registo_act = featureCursor.NextFeature(); + } + //el array de puntos se copia a la coleccion de puntos "pointCollection" + geom_brid.AddPoints(colec_ptos, ref array_pts); + + featws_shp = (IFeatureWorkspace)ws; + //de la consulta que se desea realizar se extrae el campo y el valor que va a tener el registro de la nueva capa (el multipunto que cumple la consulta del filtro) + ind = filtro.WhereClause.IndexOf("="); + campo = filtro.WhereClause.Substring(0, ind); + val_campo = Convert.ToInt32(filtro.WhereClause.Substring(ind + 1)); + + //libera + FunGDB.libera(registo_act); + FunGDB.libera(featureCursor); + FunGDB.libera(graba); + FunGDB.libera(geom_brid); + + nueva_capa = fc.AliasName + name_aux; + try + { + ws_shape = (IWorkspaceEdit)featws_shp; + ws_shape.StartEditing(true); + ws_shape.StartEditOperation(); + + if (!File.Exists(ws.PathName + "\\" + nueva_capa + ext_shp)) + { + //la primera vez crea el campo de sector + campos = new FieldsClass(); + campos_edit = (IFieldsEdit)campos; + + camp = new FieldClass(); + camp_edit = (IFieldEdit2)camp; + camp_edit.Name_2 = "Shape"; + camp_edit.Type_2 = esriFieldType.esriFieldTypeGeometry; + + geom_def = new GeometryDefClass(); + geom_defedit = (IGeometryDefEdit)geom_def; + + geom_defedit.GeometryType_2 = esriGeometryType.esriGeometryMultipoint; + + geom_defedit.SpatialReference_2 = coor; + camp_edit.GeometryDef_2 = geom_def; + campos_edit.AddField(camp); + + camp = new FieldClass(); + camp_edit = (IFieldEdit2)camp; + camp_edit.Name_2 = campo; + camp_edit.Type_2 = esriFieldType.esriFieldTypeInteger; + camp_edit.Length_2 = 10; + campos_edit.AddField(camp); + + fc_shape = featws_shp.CreateFeatureClass(nueva_capa, campos, null, null, esriFeatureType.esriFTSimple, "Shape", ""); + } + else + fc_shape = featws_shp.OpenFeatureClass(nueva_capa); + //se crea una nuevo campo al que se le añade la geometría de la coleccion de puntos y el campo con elvalor extraido del filtro + dd = fc_shape.CreateFeature(); + puntos = (IMultipoint)colec_ptos; + puntos.SpatialReference = coor; + dd.Shape = puntos; + ind = fc_shape.FindField(campo); + dd.set_Value(ind, val_campo); + dd.Store(); + + ws_shape.StopEditOperation(); + ws_shape.StopEditing(true); + } + catch (Exception cexp2) + { + MessageBox.Show(cexp2.Message); + nueva_capa = null; + } + finally + { + FunGDB.libera(camp); + FunGDB.libera(campos); + FunGDB.libera(dd); + FunGDB.libera(fc_shape); + FunGDB.libera(fc); + //libera variables + } + geom = (IGeometry)array_pts[0]; + return nueva_capa; + + } + catch (Exception) + { + err_st = "Error a la hora de generar una capa de multipuntos a partir de la capa " + ftclass; + throw; + } + } + + /* + * Abre la capa de puntos de control y los pinta de modo que el punto inicial queda representado + * con un color verde, el bocadillo en naranja y el punto final será rojo. + */ + public void ptos_control(string path_capa) + { + int k = 0, ptos = -1, indice1; + bool exist_valor = false; + string dir_shp, shapefile, marco, label = null, valor_clase; + IFeatureWorkspace fw; + IWorkspaceFactory wsf; + IFeatureClass f_clase; + IFeatureLayer capa; + IGeoFeatureLayer geo_layer; + IDisplayTable tabla_disp; + IFeatureCursor fcursor; + IFeature feat; + IFields campos; + IUniqueValueRenderer valor_unico; + IColor color; + IRgbColor my_color; + ISimpleMarkerSymbol simb_pto, simbolo = null; + ESRI.ArcGIS.ArcMapUI.IMxDocument mx_doc; + IApplication app; + IMap map; + IStyleGalleryStorage styleStorage = null; + IStyleGallery styleGallery = new ESRI.ArcGIS.Framework.StyleGalleryClass(); + styleStorage = (IStyleGalleryStorage)styleGallery; + + IEnumStyleGalleryItem enumStyleGallery = null; + IStyleGalleryItem estilo_gal = null; + + dir_shp = System.IO.Path.GetDirectoryName(path_capa); + shapefile = System.IO.Path.GetFileNameWithoutExtension(path_capa); + wsf = new FileGDBWorkspaceFactoryClass(); + fw = (IFeatureWorkspace)wsf.OpenFromFile(dir_shp, 0); + //SE AÑADE AL MARCO DE DATOS PRINCIPAL LA CAPA DE ÁMBITOS PARA CREAR LA VISTA DEL MAPA. + f_clase = fw.OpenFeatureClass(shapefile);//crea .sr.lock + + capa = new FeatureLayer(); + capa.FeatureClass = f_clase; + capa.Name = shapefile; + geo_layer = (IGeoFeatureLayer)capa; + //se recorre la tabla valor por valor para saber si ya se le ha asignado un color con su estilo de simbología úinico por valor (único por sector) + tabla_disp = (IDisplayTable)geo_layer; + fcursor = (IFeatureCursor)tabla_disp.SearchDisplayTable(null, false);//crea .rd.lock + campos = fcursor.Fields; + indice1 = campos.FindField(secuencia); + + valor_unico = new UniqueValueRendererClass(); + simb_pto = new SimpleMarkerSymbolClass(); + simbolo = new SimpleMarkerSymbolClass(); + //se establecen estas propiedades antes de realizar la clasificación por valores únicos. + valor_unico.FieldCount = 1; + valor_unico.set_Field(0, secuencia); + //se aplica una estilo en la simbología + simbolo.Style = esriSimpleMarkerStyle.esriSMSCircle; + simbolo.Size = 2; + valor_unico.DefaultSymbol = (ISymbol)simbolo; + valor_unico.UseDefaultSymbol = true; + //se identifica el numero de pountos de control que se ha programado para que, + //en lugar de recorrer todos los elementos de la tabla, vaya directamente al punto inicial, punto bocadillo y punto final. + if (OliviaGlob.tip_oliv == OliviaDef.GeneralDef.TiposOliv.OlivLimp) + { + ptos = OliviaGlob.inidlg.lim.limp.n_ptsctrl; + } + else if (OliviaGlob.tip_oliv == OliviaDef.GeneralDef.TiposOliv.OlivResi) + { + ptos = OliviaGlob.inidlg.reco.reco.n_ptsctrl; + } + int repe = ptos - 3; + + feat = fcursor.NextFeature(); + + bool exist_symbol=false; + + if (!File.Exists(OliviaGlob.Paths.PathSimbVSM)) + { + err_st = string.Format("No se encuentra la galería de estilos de VSM en: {0}.\n Modifica el path en el archivo de configuración.", OliviaGlob.Paths.PathSimbVSM); + return; + } + else + { + exist_symbol = true; + styleStorage.TargetFile = OliviaGlob.Paths.PathSimbVSM; + enumStyleGallery = styleGallery.get_Items("Marker Symbols", OliviaGlob.Paths.PathSimbVSM, ""); + } + + ISymbol symbol; + string name_simbol; + + while (feat != null) + { + valor_clase = feat.get_Value(indice1).ToString(); + color = new RgbColorClass(); + + for (int i = 0; i <= valor_unico.ValueCount - 1; i++) + { + if (valor_unico.get_Value(i) == valor_clase) + { + exist_valor = true; + break; //Si el valor se encuentra se sale del bucle. + } + } + //Si el valor (numero de sector) no se ha encontrado como valor_unico, significa que es nuevo y se añade. + if (exist_valor == false) + { + simb_pto = new SimpleMarkerSymbolClass(); + symbol=null; + if(exist_symbol && k!=1) + { + if (k == 0) + { + name_simbol = "inicio"; + label = "Inicio"; + } + else + { + name_simbol = "final"; + label = "Fin"; + } + + enumStyleGallery.Reset(); + estilo_gal = enumStyleGallery.Next(); + while (estilo_gal != null) + { + if (estilo_gal.Name == name_simbol) + { + break; + } + estilo_gal = enumStyleGallery.Next(); + } + if (estilo_gal != null) + { + symbol = (ISymbol)estilo_gal.Item; + } + else + symbol=null; + if(symbol!=null && k!=0) + k=-1; + } + if (symbol == null) //o no exist symbol o k==1 o ha dado fallo lo anterior + { + simb_pto.Style = esriSimpleMarkerStyle.esriSMSCircle; + simb_pto.Size = 4; + simb_pto.OutlineSize = 1; + color = new RgbColorClass(); + my_color = new RgbColor(); + //se asigna color al punto inicial + if (k == 0) + { + my_color.Red = 0; + my_color.Blue = 0; + my_color.Green = 255; + label = "Inicio"; + } + //se asigna color al punto bocadillo + else if (k == 1) + { + my_color.Red = 0; + my_color.Blue = 255; + my_color.Green = 0; + label = "Bocadillo"; + } + //se asigna color al punto final + else + { + my_color.Red = 255; + my_color.Blue = 0; + my_color.Green = 0; + label = "Fin"; + k = -1; + } + + color.RGB = my_color.RGB; + simb_pto.Color = color; + symbol = (ISymbol)simb_pto; + } + + valor_unico.AddValue(valor_clase, secuencia, symbol); + valor_unico.set_Label(valor_clase, label); + valor_unico.set_Symbol(valor_clase, symbol); + } + //libera + if (feat != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(feat); + //k será -1 cuando haya procesado un pto final, por loque se quiere ir al siguiente registro de la tabla sin hacer saltos + //si repe >1 quiere decir que hay más de tres ptos de control por lo que se pasarán los registros intermedios entre en pto inicial y el bocadillo + //y entre el pto bocadillo y el pto final. Así se evita procesar innecesariamente los ptos intermedios. + //si repe no es >1 basta con ir al siguiente registro ya que significa que tiene 3 ptos de control y siempre irán inicio.bocadillo y fin, por lo que todos los registros interesan + + if ((k==1) && (repe > 0)) + { + for (int i = 0; i < repe; i++) + { + feat = fcursor.NextFeature(); + } + } + feat = fcursor.NextFeature(); + + k++; + } + app = ArcMap.Application; + mx_doc = (ESRI.ArcGIS.ArcMapUI.IMxDocument)(app.Document); + map = mx_doc.FocusMap; + if (mx_doc.Maps.Count > 1) + { + marco = OliviaGlob.df_princip; + + for (int r = 0; r < mx_doc.Maps.Count; r++) + { + map = mx_doc.Maps.get_Item(r); + if (map.Name == marco) + break; + } + } + map.AddLayer(capa); + //Si no ha utilizado una rampa de color predefinida en un estilo, utilice "Custom". + //De lo contrario, utilice el nombre de la rampa de color que ha seleccionado. + actualiza_vista(valor_unico, tabla_disp, geo_layer, indice1, -1); + + //libera + if (campos != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(campos); + if (fcursor != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(fcursor); + if (f_clase != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(f_clase); + if (capa != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(capa); + } + + /** + * Mira a ver si existe featureclass y pregunta si se quiere sobreescribir, en su caso + */ + private bool comprueba_sobreescribe(string path_gdb, string ftclass_nomb, bool fuerza_sobreescribe) + { + ///////////////////////////////////////// + //mira a ver si existe y se quiere sobreescribir + IWorkspace2 ws_gdb_; + IFeatureWorkspace fws; + IDataset data_delete; + bool sal_mal = true; + DialogResult dlg_result; + + ws_gdb_ = (IWorkspace2)FunGDB.abre_ws(path_gdb); + dlg_result = DialogResult.Cancel; + + if (ws_gdb_.get_NameExists(esriDatasetType.esriDTFeatureClass, ftclass_nomb)) + { + if (!fuerza_sobreescribe)//si no se fuerza desde fuera, se pregunta + { + dlg_result = MessageBox.Show("Ya existe una capa con el mismo nombre, ¿desea sobreescribir? " + + "En caso contrario, se perderá el nuevo cálculo", "Olivia", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + } + if (fuerza_sobreescribe || (dlg_result == DialogResult.Yes)) + { + fws = (IFeatureWorkspace)ws_gdb_; + data_delete = (IDataset)fws.OpenFeatureClass(ftclass_nomb); + if (data_delete.CanDelete()) + { + try + { + data_delete.Delete(); + sal_mal = false; + } + catch + { + sal_mal = true; + err_st = "No se puede borrar la capa a sobreescribir"; + } + } + else + { + sal_mal = true; + err_st = "No se puede borrar la capa a sobreescribir"; + } + } + else + { + sal_mal = true; + err_st = "Se ha cancelado la importación"; + } + if (sal_mal) + { + //no quiere sobreescribir o ha habido error, sale + return false; + } + } + return true; + } + + /** + * Importa a una geodatabase existente el shapefile indicado. Descodificando el nombre de entrada del shapafile para asignarselo + * a un grupo de la GDB según el tratamiento y añadiendo una capa con el nobre de los ámbitos que intervienen. + */ + public bool importa(string path_shape, string path_gdb, out string name, out string dir_shp, int modo) + { + int ind; + string tratamiento = null, ambitos = null, shapefile, prefijo; + IWorkspaceFactory wsfact = null, wsf_shp = null; + IWorkspaceName wsn_shp, wsn_gdb; + IDataset data_shp, data_gdb = null; + IDatasetName dn_shp = null, dn_gdb = null, dname_gdb; + IWorkspace ws_shp, ws_gdb; + IName n_shp, n_gdb; + IFeatureClassName fcn_shp, fcn_gdb; + IFeatureDatasetName fdn_gdb; + IFeatureDataConverter convertidor = null; + IEnumInvalidObject invalido = null; + IUniqueValueRenderer valor_unico; + bool reco_o_limp_con_instala = true; + bool reco_tramos = false; + IGeometryDef geom_dest = null; + IFeatureClass fc = null; + + int NIMPORT; + string[] noms_shp; + string[] noms_gdb; + int i; + + dir_shp = ""; + name = null; + + //////////////////////////////// + //limpia la vista para poder pintar los resultados + OliviaGlob.mapa.limpia_vista(); + + ///////////////////////////////////////// + dir_shp = System.IO.Path.GetDirectoryName(path_shape); + shapefile = System.IO.Path.GetFileNameWithoutExtension(path_shape); + ind = shapefile.IndexOf("_", 0); + prefijo = shapefile.Substring(ind + 1, 1); + + //decodifica el nombre del shapefile para asignarle el correspondiente nombre en la GDB a la que se importa el shape + if (prefijo == "T") + { + OliviaGlob.gdb_limp.decode_gdb(shapefile, out tratamiento, out ambitos); + } + else if (prefijo == "F") + { + OliviaGlob.gdb_reco.decode_gdb(shapefile, out tratamiento, out ambitos); + } + else + { + err_st = string.Format("Nombre del archivo a importar erróneo. No se reconoce el prefijo introducido: {0}", prefijo); + return false; + } + + reco_o_limp_con_instala = (prefijo == "F") || + ((prefijo == "T") && ((OliviaGlob.inidlg.lim.limp.coords_instala[0] != 0) && (OliviaGlob.inidlg.lim.limp.coords_instala[1] != 0))); + reco_tramos = File.Exists(System.IO.Path.Combine(dir_shp, shapefile + name_ruta2 + ext_shp)); + ///////////////////////////////////////// + //crea el dataset si no existe + ISpatialReferenceFactory3 spatialReferenceFactory = (ISpatialReferenceFactory3)new SpatialReferenceEnvironment(); + ISpatialReference spref = (ISpatialReference)spatialReferenceFactory.CreateProjectedCoordinateSystem(OliviaGlob.coorsys_in); + if(! FunGDB.crea_ftdataset(path_gdb, tratamiento, spref)) + { + err_st = "Error al crear el Dataset " + tratamiento; + return false; + } + + ///////////////////////////////////////// + //pregunta a ver si se quiere ese nombre u otro + bool replace = false; + string ambitos_aux = FunGDB.save_ftcls("Guardar Feature Class como...",OliviaGlob.inidlg.Handle.ToInt32(), + path_gdb + "\\" + tratamiento + "\\" + ambitos, out replace); + if(ambitos_aux!=null) + ambitos=System.IO.Path.GetFileNameWithoutExtension(ambitos_aux); + + ///////////////////////////////////////// + //todo ok, se pone a importar + name = ambitos; + path_import = path_gdb + "\\" + tratamiento + "\\" + ambitos; + + if(modo==(int)ModsImport.ImportSec1) //sectoriza + { + NIMPORT=2; + noms_shp = new string[NIMPORT]; + noms_gdb = new string[NIMPORT]; + noms_shp[0]=shapefile; + noms_gdb[0]=ambitos; + noms_shp[1]=shapefile + name_aux; + noms_gdb[1]=ambitos + name_sect; + } + else if(modo==(int)ModsImport.ImportPlan1) //planifica + { + if (reco_o_limp_con_instala) + NIMPORT = 6; + else + NIMPORT=5; + if (reco_tramos) + NIMPORT = 7; + noms_shp = new string[NIMPORT]; + noms_gdb = new string[NIMPORT]; + noms_shp[0]=shapefile; + noms_gdb[0]=ambitos; + noms_shp[1]=shapefile + name_aux; + noms_gdb[1]=ambitos + name_sect; + noms_shp[2]=shapefile + name_control; + noms_gdb[2]=ambitos + name_control_out; + noms_shp[3]=shapefile + name_ruta; + noms_gdb[3] = ambitos + name_ruta_out; + noms_shp[4] = shapefile + name_ruta_aux; + noms_gdb[4] = ambitos + name_ruta_out + name_aux; + if (reco_o_limp_con_instala) + { + noms_shp[5] = shapefile + name_instal; + noms_gdb[5] = ambitos + name_inst_out; + } + if (reco_tramos) + { + noms_shp[6] = shapefile + name_ruta2; + noms_gdb[6] = ambitos + name_ruta2_out; + } + } + else + { + name=null; + return false; + } + + try + { + ///////////////////////////////////////// + //para la capa _sector en la que están las entidades unidas, para la maquetación + valor_unico = pinta_sectores(dir_shp, shapefile, 0); + if (valor_unico == null) + return false; + if (!une_sectores(shapefile, valor_unico)) + return false; + + wsfact = new FileGDBWorkspaceFactoryClass(); + wsf_shp = new ShapefileWorkspaceFactoryClass(); + ws_shp = wsf_shp.OpenFromFile(dir_shp, 0); + ws_gdb = wsfact.OpenFromFile(path_gdb, 0); + + // castea espacios de trabajo a IDataset para poder conseguir el nombre del objeto. + data_shp = (IDataset)ws_shp; + data_gdb = (IDataset)ws_gdb; + n_shp = data_shp.FullName; + n_gdb = data_gdb.FullName; + wsn_shp = (IWorkspaceName)n_shp; + + wsn_gdb = (IWorkspaceName)n_gdb; + + ///////////////////////////////////////// + //se embucla para hacer todas las importaciones necesarias + for(i=0;i 0) + { + amb_gdb[(int)LimpiezaDef.AmbitsTra.AmbEjeCalle] = true; + } + //mira a ver si hay el resto de capas y tienen entidades + for (int i = (int)LimpiezaDef.AmbitsTra.AmbBordLibreMec; i < (int)LimpiezaDef.AmbitsTra.AmbN; i++) + { + consulta = LimpiezaDef.filtro_str[i]; + if (path_class == null) //como tradicionalmente, hay una gdb y los nombres de las feature classes del archivo de configuración + { + ftclass = LimpiezaDef.ftclass[i]; + numero_lin = FunGDB.cuenta_filas_ftclass(OliviaGlob.Paths.PathGdbGen, ftclass, consulta); + } + else + numero_lin = FunGDB.cuenta_filas_ftclass(path_class, consulta); + + if (numero_lin > 0) + { + amb_gdb[i] = true; + } + } + + return amb_gdb; + } + + /* + * Lee la capa que se ha seleccionzdo de limpieza y se comprueba que los campos que se han editado corresponden con la capa + * (es decir, se puede leer la capa con los campos configurados) + */ + public bool comprueba_campos_limp(Limpieza limp) + { + int ind_campo; + string[] camps; + int i; + ITable tabla; + int NCAMPS = 2; + + if(path_class!=null) + tabla = FunGDB.dame_tabla_clase(path_class); + else + tabla = FunGDB.dame_tabla_clase(OliviaGlob.Paths.PathGdbGen, LimpiezaDef.Capas.ftclass_limp_mec); + + //se comprueba que existen todos los campos que se han configurado en la capa seleccionada para la recogida + camps = new string[NCAMPS]; + camps[0] = LimpiezaDef.Campos.consulta_entidad; + camps[1] = LimpiezaDef.Campos.consulta_mecan; + + for (i = 0; i < NCAMPS; i++) + { + ind_campo = tabla.FindField(camps[i]); + if (ind_campo == -1) + { + limp.err_st = "No se encuentra el campo " + camps[i]; + break; + } + } + if (i < NCAMPS) + return false; + return true; + } + + /** + * Devuelve qué consulta hay que hacer, el filtro de los ámbitos y el nombre de la clase donde están + */ + public string dame_consul_amb_clas(Limpieza limp, out string ambitos, out string nom_class) + { + string consulta, orstr; + + consulta = null; + ambitos = ""; + orstr = null; + nom_class = null; + for (int i = 0; i < limp.amb_tra_sel.Length; i++) + { + if (limp.amb_tra_sel[i]) + { + if(nom_class==null) + nom_class = LimpiezaDef.ftclass[i]; + consulta = consulta + orstr + "(" + LimpiezaDef.filtro_str[i] + ")"; + ambitos = ambitos + i.ToString("00"); + if (orstr == null) + orstr = " OR "; + } + } + ambitos = "_A" + ambitos; + if (consulta == "()") + consulta = ""; + + return consulta; + } + + /** + * Descodifica el nombre del sahpefile de entrada identificando el tipo de tratamiento y los ámbitos de trabajo + */ + public void decode_gdb(string shapefile, out string tratamiento, out string ambitos) + { + int aux, auxl, mbito, indice, tratamient; + string auxili, ambi, auxi; + + indice = shapefile.IndexOf("_"); + indice = indice + 2;//para saltarse la T que va antes del identificador del tipo de tratamiento + auxili = shapefile.Substring(indice, 2); + tratamient = Convert.ToInt32(auxili); + tratamiento = LimpiezaDef.tto_gdb[tratamient]; + OliviaGlob.cartela_tto = LimpiezaDef.tipos_tto_str[tratamient]; + indice = shapefile.IndexOf("_", indice); + indice = indice + 2;//para saltarse la A que va antes del identificador de los ámbitos que intervienen + aux = shapefile.IndexOf("_", indice); + auxl = aux - indice; + auxi = ""; + while (auxl > 0) + { + ambi = shapefile.Substring(indice, 2); + mbito = Convert.ToInt32(ambi); + indice = indice + 2; + auxl = auxl - 2; + if (auxl != 0) + auxi = auxi + LimpiezaDef.ambs_gdb[mbito] + "_"; + else + auxi = auxi + LimpiezaDef.ambs_gdb[mbito]; + } + ambitos = LimpiezaDef.preftto_gdb[tratamient] + "_" + auxi; + + //quita los espacios + tratamiento = tratamiento.Replace(" ", "_"); + ambitos = ambitos.Replace(" ", "_"); + + auxi = shapefile; + //para poner la zona cuando es seleccionada + for (int i = 0; i < 2; i++) + { + indice = auxi.LastIndexOf("_"); + auxi = auxi.Substring(0, indice); + } + auxl = indice - aux; + if (auxl <= 0) + return; + auxili = shapefile.Substring(aux, auxl); + ambitos = ambitos + auxili; + + } + + /** + * Exporta a shapefile las red navegable y los ámbitos de trabajo seleccionados. El archivo de salida será el nombre del tratamiento escogido. + */ + public bool exporta(Limpieza limp, bool comp_planif) + { + int cont=0; + string fecha_hora = "", ambitos = ""; + string consulta = ""; + IQueryFilter filtro = null; + IGeometry geom_zonniv = null; + IGeometry geom_ambits = null; + string nomb_class_limp = null; + IDatasetName datasetn=null; + bool hayzonniv = false; + + if (limp == null) + { + err_st = "No se han recibido correctamente los datos para la exportación"; + return false; + } + + ///////////////////////////////////////////// + //lee ambitos de trabajo + consulta = dame_consul_amb_clas(limp, out ambitos, out nomb_class_limp); + if (consulta == null) + { + err_st = "Error al configurar consulta"; + return false; + } + + ///////////////////////////////////////////// + //si va a planificar antes comprueba que estén las columnas de sector y secuencia + if (comp_planif) + { + if (!comprueba_planif(path_class, nomb_class_limp)) + { + err_st = "No existen en la tabla " + path_class + " columna de SECTOR y/o SECUENCIA, necesarias para planificar"; + return false; + } + } + //si path_secto!=null, hay que actualizar la sectorización, si ==null, en los datos de entrada ya hay sectorización + //y secuencia y se van a exportar + ////////////////////////////////////////////////// + + if (path_class == null) //como tradicionalmente, hay una gdb y los nombres de las feature classes del archivo de configuración + { + if(nomb_class_limp==OliviaGlob.Capas.ftclass_ejes) + cont = FunGDB.cuenta_filas_ftclass(OliviaGlob.Paths.PathGdbNw, nomb_class_limp, consulta); + else + cont = FunGDB.cuenta_filas_ftclass(OliviaGlob.Paths.PathGdbGen, nomb_class_limp, consulta); + } + else + cont = FunGDB.cuenta_filas_ftclass(path_class, consulta); + + if (cont <= 0) + { + err_st = "No existen ámbitos que cumplan las condiciones introducidas para la exportación "+consulta; + return false; + } + + ///////////////////////////////////////////// + //consigue el polígono común a las dos geometrías: zonas y niveles + //si no hay zonas ni niveles, es null + geom_zonniv = FunGDB.intersec_geoms(limp.geom_zonas, limp.geom_niveles); + //además, le quita las restricciones + if (geom_zonniv != null && limp.geom_rest_acces != null) + { + geom_zonniv = FunGDB.diferencia_geoms(geom_zonniv, limp.geom_rest_acces); + } + + if (geom_zonniv != null && geom_zonniv.IsEmpty) + { + err_st = "Error, la geometría resultado de intersecar zonas, niveles y restricciones de circulación está vacía"; + return false; + } + if (geom_zonniv == null && comp_planif && (path_secto != null)) + { + //en este caso coge la geom de la secto + //obtiene el polígono que engloba los ámbitos + geom_zonniv = FunGDB.dame_geom_envelope(path_secto); + if (geom_zonniv == null) + { + err_st = "Error al obtener polígono de datos"; + return false; + } + hayzonniv = false; + } + if (geom_zonniv == null && nomb_class_limp == OliviaGlob.Capas.ftclass_ejes) + { + err_st = "Al emplear ejes de calle como ámbitos es necesario indicar polígono de exportación"; + return false; + } + + ///////////////////////////////////////////// + //crea el filtro en base a las consultas configuradas + filtro = crea_filtro(limp, nomb_class_limp, consulta, geom_zonniv); + if (filtro == null) + { + err_st = "Error al crear el filtro para la exportación"; + return false; + } + + ///////////////////////////////////////////// + //se consigue el tiempo en este instante para añadirlo a los nombres de los archivos de salida (shapefiles) + fecha_hora = DateTime.Now.ToString("yyyyMMdd_Hmmss"); + + ///////////////////////////////////////////// + //exporta los ámbitos + if (!exporta_data(limp, filtro, nomb_class_limp, ambitos, fecha_hora, out datasetn)) + { + err_st = "Error al exportar data. "+err_st; + return false; + } + + OliviaGlob.Paths.PathData = OliviaGlob.Paths.DirData + datasetn.Name; + + //hace intersecciones espaciales en caso de ámbitos lineales para quitar los que tienen más parte fuera de la zona que dentro + if (geom_zonniv != null && (limp.tipo_tto < (int)LimpiezaDef.TiposTto.TtoPapeVaci) && hayzonniv) + { + if (!quita_amb_sobresalen(OliviaGlob.Paths.PathData, geom_zonniv,0.4)) + { + err_st = "Error al quitar los ámbitos que sobresalen"; + return false; + } + } + + //quita los ámbitos que caen en la zona de restricciones, si es que no había zonas y no se ha quitado ya + if (geom_zonniv == null && limp.geom_rest_acces != null) + { + if (!quita_amb_restric(OliviaGlob.Paths.PathData, limp.geom_rest_acces, (limp.tipo_tto < (int)LimpiezaDef.TiposTto.TtoPapeVaci))) + { + err_st = "Error al quitar los ámbitos en zona de restricción"; + return false; + } + } + + //comprueba que sigue habiendo ámbitos exportados + cont = FunGDB.cuenta_filas_ftclass(OliviaGlob.Paths.PathData, ""); + if (cont <= 0) + { + err_st = "No existen ámbitos que cumplan las condiciones geométricas introducidas"; + return false; + } + + //ahora si está en modo planificación exporta la sectorización + if (comp_planif && (path_secto!=null)) + { + if (!actualiza_secto(OliviaGlob.Paths.PathData, path_secto)) + { + err_st = "Error al exportar campos de SECTOR y/o SECUENCIA de la capa "+ path_secto + " " + err_st; + return false; + } + } + + /////////////////////////////////////////////////////////////////////////// + //obtiene el polígono que engloba los ámbitos + geom_ambits = FunGDB.dame_geom_envelope(OliviaGlob.Paths.PathData); + if (geom_ambits == null) + { + err_st = "Error al obtener polígono de datos"; + return false; + } + + /////////////////////////////////////////////////////////////////////////// + //amplia el poligono para englobar las instalaciones + if (limp.coords_instala[0] != 0 && limp.coords_instala[1] != 0) + { + //hay instalación + geom_ambits=FunGDB.amplia_geom(geom_ambits, limp.coords_instala[0], limp.coords_instala[1]); + + //comprueba, si hay restricciones de circulación, que la instalación no está en ellas + if (limp.geom_rest_acces != null) + { + if (FunGDB.is_pto_in_geom(limp.coords_instala[0], limp.coords_instala[1], limp.geom_rest_acces)) + { + err_st = "Error, la instalación sal/lleg está en la zona restringida a la circulación"; + return false; + } + } + } + + /////////////////////////////////////////////////////////////////////////// + //exporta la red navegable + if (!exporta_nw(geom_ambits, limp.geom_rest_acces,limp.rest_circ[limp.tipo_tto], fecha_hora, out datasetn)) + { + return false; + } + + //guarda los nombres del shape + OliviaGlob.Paths.PathNW = OliviaGlob.Paths.DirData + datasetn.Name; + + return true; + } + + /* + * Dado un nombre de featureclass, una consulta y una geometría, interseca entre un poligono dado (geom) y una capa lineal (fc1) + */ + public IQueryFilter dame_filt_inter(Limpieza limp, string ftclass, string consulta, IGeometry geom) + { + string dir = null; + IFeatureClass fc = null; + IQueryFilter fil= null; + + if (ftclass == OliviaGlob.Capas.ftclass_ejes) + dir = OliviaGlob.Paths.PathGdbNw; + else if (path_class == null) + dir = OliviaGlob.Paths.PathGdbGen; + + if (dir != null) + fc = FunGDB.abre_ftclass(dir, ftclass); + else + fc = FunGDB.abre_ftclass(path_class); + + if (fc == null) + return null; + + fil=base.dame_filt_inter(fc, consulta, geom); + FunGDB.libera(fc); + + return fil; + } + + /** + * Realiza las intersecciones espaciales de los ámbitos + */ + public IQueryFilter crea_filtro(Limpieza limp, string nomb_class, string consulta, IGeometry geom1) + { + IQueryFilter filtro; + + //crea el filtro espacial y el añadido de consulta de atributos si fuera necesario + filtro = dame_filt_inter(limp,nomb_class, consulta, geom1); + if (filtro == null) + { + err_st = "Error al intersecar el ámbito de limpieza con la zona de estudio"; + return null; + } + + //FALTA REDEFINIR - elena jun 18 + //------------------------------------------------------------------------------------------------------------------- + //Cuando se trate del vaciado de papeleras habrá que verificar si está marca el checkbox que indica si sólo van a recogerse los que superen el umbral de carga. + //De modo que la secotrizacion y la planificacion se realizará sólo sobre los contenedores que superan un porcetaje de carga en la basura. + //Se conocen esos contenedores por el nombre de un campo que indicará si SI(hay que ir a recogerlos) o NO (no tienen suficiente carga y se pueden recoger en otro momento) + if ((limp.tipo_tto == (int)LimpiezaDef.TiposTto.TtoPapeVaci) && (limp.umbral_reco_conten == true)) + { + if (filtro.WhereClause == "") + filtro.WhereClause = carga_conten + " >= " + limp.umbral_basura; + else + filtro.WhereClause = "(" + filtro.WhereClause + ") AND (" + carga_conten + " >= " + limp.umbral_basura + ")"; + } + + return filtro; + } + + + /** + * Devuelve el string a concatenar en el nombre del path dependiendo de los polígonos seleccionados (zonas, turnos... etc) + */ + public string dame_str_poligs(Limpieza limp) + { + string str = ""; + + if (limp.text_niv != "" && limp.geom_niveles != null) + str += "_N" + limp.text_niv; + if(limp.text_zon!="" && limp.geom_zonas!=null) + str += "_Z" + limp.text_zon; + if (limp.text_restr != "" && limp.geom_rest_acces != null) + str += "_R" + limp.text_restr; + + return str; + } + + /** + * Exporta los ámbitos de la gdb a un shape en datasetname + */ + public bool exporta_data(Limpieza limp, IQueryFilter filtro, string nomb_class, string ambitos, string fecha_hora, out IDatasetName shp_data_name) + { + string name="", err_str=""; + string dir = null; + IDatasetName shp_dsn = null; + + shp_data_name = null; + + //Pone nombre al shape en función de los ámbitos, el tratamiento, y los polígonos + timestamp + name = name_export_amb + "T" + limp.tipo_tto.ToString("00") + ambitos + dame_str_poligs(limp) + "_" + fecha_hora + ext_shp; + + if (nomb_class == OliviaGlob.Capas.ftclass_ejes) + dir = OliviaGlob.Paths.PathGdbNw; + else if (path_class == null) + dir = OliviaGlob.Paths.PathGdbGen; + + if (dir == null) + { + dir = path_class; + nomb_class = null; + } + + inicia_coords(dir, nomb_class); + + if (!FunGDB.exporta(dir, nomb_class, OliviaGlob.Paths.DirData, name, filtro, out shp_dsn, out err_str)) + { + err_st = err_str; + return false; + } + + shp_data_name = (IDatasetName)shp_dsn; + return true; + } + } +} diff --git a/OliviaAddIn/DatosGDBReco.cs b/OliviaAddIn/DatosGDBReco.cs new file mode 100644 index 0000000..bd20b31 --- /dev/null +++ b/OliviaAddIn/DatosGDBReco.cs @@ -0,0 +1,627 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using ESRI.ArcGIS.Geometry; +using ESRI.ArcGIS.Geodatabase; +using ESRI.ArcGIS.GeoDatabaseUI; +using ESRI.ArcGIS.Carto; +using System.Windows.Forms; +using ESRI.ArcGIS.esriSystem; +using System.IO; +using ESRI.ArcGIS.DataSourcesGDB; +using ESRI.ArcGIS.DataSourcesFile; + +namespace OliviaAddIn +{ + /** + * @file DatosGDBReco.cs + * Clase con funciones para lectura de GDB relacionado con la recogida de residuos. + * Contiene definiciones y funciones necesarias para exportar los datos de GDB a SHP, y viceversa + * concretados con las opciones de configuración de la recogida de residuos. + */ + /** + * Clase con funciones para lectura de GDB relacionado con la recogida de residuos. + * Contiene definiciones y funciones necesarias para exportar los datos de GDB a SHP, y viceversa + * concretados con las opciones de configuración de la recogida de residuos. + */ + public class DatosGDBReco : DatosGDB + { + //************************************************************************************* + //Variables + /** + * Otro tipo de fracción de recogida de basuras + */ + public string fra_otra = ""; + /** + * otro tipo de carga en la recogida de basuras + */ + public string carg_otra = ""; + + //variables de la GDB de contenedores + public IWorkspaceFactory wsf_gdb_rec; + public IWorkspace gdb_ws_rec; + public IDataset gdb_data_rec; + public IName name_gdb_rec; + public IWorkspaceName name_gdb_ws_rec; + public IFeatureWorkspace feat_ws_rec; + //variables de la capa de turnos + public IWorkspaceFactory wsf_turn; + public IWorkspace ws_turn; + public IDataset data_turn; + public IName name_turn; + public IWorkspaceName name_ws_turn; + public IFeatureWorkspace feat_ws_turn; + //************************************************************************************* + //Constructor + public DatosGDBReco() + { + } + //************************************************************************************* + //Métodos + /* + * Lee la capa que se ha seleccionzdo de recogida de residuos y se comprueba que los campos que se han editado corresponden con la capa (es decir, se puede leer la capa con los campos configurados) + */ + public bool lee_capa_recogida(Recogida reco) + { + int ind_campo; + string[] camps; + int i; + int NCAMPS = 6; + + ITable tabla_recog = FunGDB.dame_tabla_clase(path_class); + + //se comprueba que existen todos los campos que se han configurado en la capa seleccionada para la recogida + camps = new string[NCAMPS]; + camps[0]=RecogidaDef.campos_def.cons_id; + camps[1] = RecogidaDef.campos_def.cons_fracc; + camps[2] = RecogidaDef.campos_def.cons_nomrec; + camps[3] = RecogidaDef.campos_def.cons_lateral; + camps[4] = RecogidaDef.campos_def.cons_uds; + camps[5] = RecogidaDef.campos_def.cons_kgrec; + for (i = 0; i < NCAMPS; i++) + { + if ((i == (NCAMPS-1)) && (reco.rec_kgrec_cont != 0)) + continue; + ind_campo = tabla_recog.FindField(camps[i]); + if (ind_campo == -1) + { + reco.err_st = "No se encuentra el campo "+ camps[i]; + break; + } + } + if (i < NCAMPS) + return false; + return true; + } + + /* + * A partir de los datos leidos de la capa de recogida se rellena el desplegable de fracción a partir de los datos existentes en la capa. + */ + public void lee_frac_gdb(Recogida reco) + { + string[] valores; + int err=0; + int i, j, k; + bool encontrado; + + valores = FunGDB.dame_valunic_consulta(path_class, RecogidaDef.campos_def.cons_fracc, "", out err); + + //se redimensionan los arrays de nuevo por si se ha pinchado varias veces en el botón de leer tabla + System.Array.Resize(ref RecogidaDef.tipos_fracc_str, (int)RecogidaDef.TiposFracción.N - 1); + System.Array.Resize(ref reco.tipos_fracc_bool, (int)RecogidaDef.TiposFracción.N - 1); + + for (i = 0; i < valores.Length; i++) + { + //para que ponga '-' si es un campo vacío + if (valores[i] == "") + valores[i] = "-"; + + encontrado = false; + for (j = 0; j < (int)RecogidaDef.TiposFracción.N - 1; j++) + { + if (RecogidaDef.tipos_fracc_str[j] == valores[i]) + { + reco.tipos_fracc_bool[j] = true; + encontrado = true; + break; + } + } + if (encontrado == false) + { + System.Array.Resize(ref RecogidaDef.tipos_fracc_str, RecogidaDef.tipos_fracc_str.Length + 1); + System.Array.Resize(ref reco.tipos_fracc_bool, reco.tipos_fracc_bool.Length + 1); + RecogidaDef.tipos_fracc_str[RecogidaDef.tipos_fracc_str.Length - 1] = valores[i]; + reco.tipos_fracc_bool[reco.tipos_fracc_bool.Length - 1] = true; + } + } + + } + + /* + * A partir de los datos leidos de la capa de receogida se rellena el desplegable del tipo de carga a partir de los datos existentes en la capa. + */ + public bool lee_tipocarga_gdb(Recogida reco) + { + string[] valores; + int err = 0; + int i, j, k; + bool encontrado; + + valores = FunGDB.dame_valunic_consulta(path_class, RecogidaDef.campos_def.cons_nomrec, "", out err); + + //se redimensionan los arrays de nuevo por si se ha pinchado varias veces en el botón de leer tabla + System.Array.Resize(ref RecogidaDef.tipos_carg_str, (int)RecogidaDef.TiposCarga.N - 1); + System.Array.Resize(ref reco.tipos_carg_bool, (int)RecogidaDef.TiposCarga.N - 1); + + for (i = 0; i < valores.Length; i++) + { + //para que ponga '-' si es un campo vacío + if (valores[i] == "") + valores[i] = "-"; + + encontrado = false; + for (j = 0; j < (int)RecogidaDef.TiposCarga.N - 1; j++) + { + if (RecogidaDef.tipos_carg_str[j] == valores[i]) + { + reco.tipos_carg_bool[j] = true; + encontrado = true; + break; + } + } + if (encontrado == false) + { + System.Array.Resize(ref RecogidaDef.tipos_carg_str, RecogidaDef.tipos_carg_str.Length + 1); + System.Array.Resize(ref reco.tipos_carg_bool, reco.tipos_carg_bool.Length + 1); + //reco.tipos_carg_bool[i] = false; + RecogidaDef.tipos_carg_str[RecogidaDef.tipos_carg_str.Length - 1] = valores[i]; + reco.tipos_carg_bool[reco.tipos_carg_bool.Length - 1] = true; + } + } + + return true; + } + + /* + * Crea la consulta que hay que realizar a la capa de recogida de residuos para la exportación de los datos de interés. + * Devuelve también la abreviatura que se le añadirá a la capa exportada (se identifica la fracción y el tipo de carga del vehículo) + */ + public string dame_consulta(Recogida rec, out string cap_abrev) + { + string consulta, orstr, aux; + + consulta = null; + cap_abrev = ""; + aux = ""; + orstr = null; + + if (rec.tipo_frac != -1) + { + consulta = consulta + orstr + "(" + RecogidaDef.filtro_str[rec.tipo_frac] + ")"; + cap_abrev = rec.tipo_frac.ToString("00"); + cap_abrev = "F" + cap_abrev + "_"; + if (consulta == "()") + consulta = ""; + } + if (orstr == null) + orstr = " AND "; + if (rec.tipo_carg != -1) + { + consulta = consulta + orstr + "(" + RecogidaDef.filtro_str[rec.tipos_fracc_bool.Length + rec.tipo_carg] + ")"; + aux = rec.tipo_carg.ToString("00"); + cap_abrev = cap_abrev + "C" + aux; + if (consulta == "()") + consulta = ""; + } + if (rec.lateralidad > 0) + { + consulta = consulta + orstr + "(" + RecogidaDef.campos_def.cons_lateral + " = '" + RecogidaDef.tipos_lateralidad[rec.lateralidad] + "'" + ")"; + if (consulta == "()") + consulta = ""; + } + return consulta; + } + + /* + * Dado un nombre de featureclass, una consulta y una geometría, interseca entre un poligono dado (geom) y una capa lineal (fc1) + */ + public IQueryFilter dame_filt_inter(string ftclass, string consulta, IGeometry geom) + { + IQueryFilter fil = null; + IFeatureClass fc = FunGDB.abre_ftclass(ftclass); + if (fc == null) + return null; + + fil = base.dame_filt_inter(fc, consulta, geom); + FunGDB.libera(fc); + + return fil; + } + + /** + * Realiza las intersecciones espaciales de los ámbitos + */ + public IQueryFilter crea_filtro(Recogida rec, string consulta, IGeometry geom1) + { + IQueryFilter filtro; + + //crea el filtro espacial y el añadido de consulta de atributos si fuera necesario + filtro = dame_filt_inter(path_class, consulta, geom1); + if (filtro == null) + { + err_st = "Error al intersecar el ámbito de limpieza con la zona de estudio"; + return null; + } + + //FALTA REDEFINIR - elena jun 18 + //Cuando se trate del vaciado de papeleras habrá que verificar si está marcado el checkbox que indica si sólo van a recogerse los que superen el umbral de carga. + //De modo que la secotrizacion y la planificacion se realizará sólo sobre los contenedores que superan un porcetaje de carga en la basura. + //Se conocen esos contenedores por el nombre de un campo que indicará si SI(hay que ir a recogerlos) o NO (no tienen suficiente carga y se pueden recoger en otro momento) + if ((rec.carga_max > 0) && (rec.id == null) && (rec.id_sens == null)) + { + if (filtro.WhereClause == "") + filtro.WhereClause = carga_conten + " >= " + rec.carga_max; + else + filtro.WhereClause = "(" + filtro.WhereClause + ") AND (" + carga_conten + " >= " + rec.carga_max + ")"; + } + return filtro; + } + + /** + * Descodifica el nombre del sahpefile de entrada identificando el tipo de fracción y la carga para la recogida de residuos + */ + public void decode_gdb(string shapefile, out string fraccion, out string carga) + { + int aux, auxl, carg, indice, fracc; + string auxili, fra, auxi; + + indice = shapefile.IndexOf("_"); + indice = indice + 2;//para saltarse la F que va antes del identificador del tipo de fracción + auxili = shapefile.Substring(indice, 2); + fracc = Convert.ToInt32(auxili); + fraccion = RecogidaDef.tipos_fracc_str[fracc]; + indice = shapefile.IndexOf("_", indice); + indice = indice + 2;//para saltarse la C que va antes del identificador de los tipos de carga de los vehículos + aux = shapefile.IndexOf("_", indice); + + auxi = ""; + + fra = shapefile.Substring(indice, 2); + carg = Convert.ToInt32(fra); + + carga = RecogidaDef.tipos_fracc_str[fracc] + "_" + RecogidaDef.tipos_carg_str[carg]; + + //quita los espacios + fraccion = fraccion.Replace(" ", "_"); + carga = carga.Replace(" ", "_"); + //////////////////////// + + auxi = shapefile; + for (int i = 0; i < 2; i++) + { + indice = auxi.LastIndexOf("_"); + auxi = auxi.Substring(0, indice); + } + auxl = indice - aux; + if (auxl <= 0) + return; + auxili = shapefile.Substring(aux, auxl); + carga = carga + auxili; + + } + + /** + * Exporta a shapefile las red navegable y los ámbitos de trabajo seleccionados. + * El archivo de salida será el nombre del tratamiento escogido con el timestampo de la fecha hora + */ + public bool exporta(Recogida rec, bool comp_planif) + { + int cont = 0; + string fecha_hora = "", ambitos = ""; + string consulta = ""; + IQueryFilter filtro = null; + IGeometry geom_zontur = null; + IGeometry geom_ambits = null; + IDatasetName datasetn = null; + + if (rec == null) + { + err_st = "No se han recibido correctamente los datos para la exportación"; + return false; + } + + ///////////////////////////////////////////// + //elabora la consulta a realizar con los parámertos de fracción y tipo de recogida + consulta = dame_consulta(rec, out ambitos); + if (consulta == null) + { + err_st = "Error al configurar consulta"; + return false; + } + + ///////////////////////////////////////////// + //si va a planificar antes comprueba que estén las columnas de sector y secuencia + if (comp_planif) + { + if (!comprueba_planif(path_class, null)) + { + err_st = "No existen en la tabla " + path_class + " columna de SECTOR y/o SECUENCIA, necesarias para planificar"; + return false; + } + + } + + cont = FunGDB.cuenta_filas_ftclass(path_class, consulta); + if (cont <= 0) + { + err_st = "No existen elementos geométricos que cumplan las condiciones introducidas para la exportación"; + return false; + } + + ///////////////////////////////////////////// + //consigue el polígono común a las dos geometrías: zonas y turnos + //si no hay zonas ni turnos, es null + geom_zontur = FunGDB.une_geoms(rec.geom_zonas, rec.geom_turnos); + //además, le quita las restricciones + if (geom_zontur != null && rec.geom_rest_acces != null) + { + geom_zontur = FunGDB.diferencia_geoms(geom_zontur, rec.geom_rest_acces); + } + + if (geom_zontur != null && geom_zontur.IsEmpty) + { + err_st = "Error, la geometría resultado de intersecar zonas, turnos y restricciones de circulación está vacía"; + return false; + } + + ///////////////////////////////////////////// + //crea el filtro en base a las consultas configuradas + filtro = crea_filtro(rec, consulta, geom_zontur); + if (filtro == null) + { + err_st = "Error al crear el filtro para la exportación"; + return false; + } + + ///////////////////////////////////////////// + //se consigue el tiempo en este instante para añadirlo a los nombres de los archivos de salida (shapefiles) + fecha_hora = DateTime.Now.ToString("yyyyMMdd_Hmmss"); + + //exporta los ámbitos + if (!exporta_data(rec, filtro, ambitos, fecha_hora, out datasetn)) + { + err_st = "Error al exportar data. " + err_st; + return false; + } + + OliviaGlob.Paths.PathData = OliviaGlob.Paths.DirData + datasetn.Name; + + //quita los contenedores que caen en la zona de restricciones, si es que no había zonas y no se ha quitado ya + if (geom_zontur == null && rec.geom_rest_acces != null) + { + if (!quita_amb_restric(OliviaGlob.Paths.PathData, rec.geom_rest_acces, false)) + { + err_st = "Error al quitar los ámbitos en zona de restricción"; + return false; + } + } + + //comprueba que sigue habiendo ámbitos exportados + cont = FunGDB.cuenta_filas_ftclass(OliviaGlob.Paths.PathData, ""); + if (cont <= 0) + { + err_st = "No existen ámbitos que cumplan las condiciones geométricas introducidas"; + return false; + } + + if (rec.id != null) + { + int err = 0; + FunGDB.add_campo(OliviaGlob.Paths.PathData, RecogidaDef.campos.cons_kgrec, esriFieldType.esriFieldTypeDouble, out err); + if (!pon_datos_csv(rec, OliviaGlob.Paths.PathData)) + { + err_st = "Error al consultar el CSV con los datos de los contenedores."; + return false; + } + } + + //ahora si está en modo planificación exporta la sectorización + if (comp_planif && (path_secto != null)) + { + if (!actualiza_secto(OliviaGlob.Paths.PathData, path_secto)) + { + err_st = "Error al exportar campos de SECTOR y/o SECUENCIA de la capa " + path_secto + " " + err_st; + return false; + } + } + + /////////////////////////////////////////////////////////////////////////// + //obtiene el polígono que engloba los ámbitos + geom_ambits = FunGDB.dame_geom_envelope(OliviaGlob.Paths.PathData); + if (geom_ambits == null) + { + err_st = "Error al obtener polígono de datos"; + return false; + } + + /////////////////////////////////////////////////////////////////////////// + //amplia el poligono para englobar las instalaciones + if (rec.coords_instala[0] != 0 && rec.coords_instala[1] != 0) + { + //hay instalación + geom_ambits = FunGDB.amplia_geom(geom_ambits, rec.coords_instala[0], rec.coords_instala[1]); + + //comprueba, si hay restricciones de circulación, que la instalación no está en ellas + if (rec.geom_rest_acces != null) + { + if (FunGDB.is_pto_in_geom(rec.coords_instala[0], rec.coords_instala[1], rec.geom_rest_acces)) + { + err_st = "Error, la instalación sal/lleg está en la zona restringida a la circulación"; + return false; + } + } + } + if (rec.coords_descarg[0] != 0 && rec.coords_descarg[1] != 0) + { + //hay instalación de descarga + geom_ambits = FunGDB.amplia_geom(geom_ambits, rec.coords_descarg[0], rec.coords_descarg[1]); + + //comprueba, si hay restricciones de circulación, que la instalación no está en ellas + if (rec.geom_rest_acces != null) + { + if (FunGDB.is_pto_in_geom(rec.coords_descarg[0], rec.coords_descarg[1], rec.geom_rest_acces)) + { + err_st = "Error, la planta de descarga está en la zona restringida a la circulación"; + return false; + } + } + } + + /////////////////////////////////////////////////////////////////////////// + //exporta la red navegable + if (!exporta_nw(geom_ambits, rec.geom_rest_acces, true, fecha_hora, out datasetn)) + { + return false; + } + + //guarda los nombres del shape + OliviaGlob.Paths.PathNW = OliviaGlob.Paths.DirData + datasetn.Name; + + return true; + } + + /** + * Devuelve el string a concatenar en el nombre del path dependiendo de los polígonos seleccionados (zonas, turnos... etc) + */ + public string dame_str_poligs(Recogida rec) + { + string str = ""; + + if (rec.text_turnos != "" && rec.geom_turnos != null) + str += "_T" + rec.text_turnos; + if (rec.text_zon != "" && rec.geom_zonas != null) + str += "_Z" + rec.text_zon; + if (rec.text_restr != "" && rec.geom_rest_acces != null) + str += "_R" + rec.text_restr; + + return str; + } + + /** + * Exporta los ámbitos de la gdb a un shape en datasetname + */ + public bool exporta_data(Recogida rec, IQueryFilter filtro, string ambitos, string fecha_hora, out IDatasetName shp_data_name) + { + string name = "", err_str = ""; + IDatasetName shp_dsn = null; + + shp_data_name = null; + + //Pone nombre al shape en función de los ámbitos, el tratamiento, y los polígonos + timestamp + name = name_export_amb + ambitos + dame_str_poligs(rec) + "_" + fecha_hora + ext_shp; + + + inicia_coords(path_class, null); + + if (!FunGDB.exporta(path_class, null, OliviaGlob.Paths.DirData, name, filtro, out shp_dsn, out err_str)) + { + err_st = err_str; + return false; + } + + shp_data_name = (IDatasetName)shp_dsn; + return true; + } + + /* + * REVISAR + * Modifica el shapefile exportado de modo que elimina aquellos elementos (contenedores) que no contengan un porcentaje de cargaigual o superior al indicado en la ventana de recogida (rec.carga_max). + */ + public bool pon_datos_csv(Recogida rec, string capa) + { + int col_kg = -1, col_capa; + object obj, capacidad; + IFeature feat = null; + IFeatureClass fc = null; + IFeatureCursor cursor = null; + IQueryFilter filtro = new QueryFilterClass(); + ITable tabla = null; + IRow fila = null; + + fc = FunGDB.abre_ftclass(capa); + if (fc == null) + return false; + tabla = FunGDB.dame_tabla_clase(capa); + if (tabla == null) + return false; + col_kg = tabla.FindField(RecogidaDef.campos.cons_kgrec); + col_capa = tabla.FindField(RecogidaDef.campos.cons_capac); + for (int i = 0; i < rec.id.Count; i++) + { + filtro.WhereClause = RecogidaDef.campos.cons_id + "=" + rec.id[i]; + cursor = fc.Search(filtro, false); + feat = cursor.NextFeature(); + if (feat == null) + { + //libera + FunGDB.libera(fila); + FunGDB.libera(cursor); + FunGDB.libera(feat); + break; + } + fila = tabla.GetRow(feat.OID); + //si el procentaje de carga indicado es superior al indicado por el archivo CSV se omite ese elemento a exportar, por lo que se elimina de la lista + if (rec.carga_max > rec.cargas[i]) + { + fila.Delete(); + //libera + FunGDB.libera(fila); + FunGDB.libera(cursor); + FunGDB.libera(feat); + continue; + } + capacidad = fila.get_Value(col_capa); + if (rec.dens_cont >= 0) + fila.set_Value(col_kg, rec.cargas[i] * rec.dens_cont * (int)capacidad / 1000); + else + fila.set_Value(col_kg, rec.cargas[i] * RecogidaDef.dens_frac_cont[rec.tipo_frac] * (int)capacidad / 1000); + fila.Store(); + //libera + FunGDB.libera(fila); + FunGDB.libera(cursor); + FunGDB.libera(feat); + } + cursor = fc.Search(null, false); + feat = cursor.NextFeature(); + while (feat != null) + { + fila = tabla.GetRow(feat.OID); + obj = fila.get_Value(col_kg); + capacidad = fila.get_Value(col_capa); + if ((Double)obj == 0.0) + { + fila.set_Value(col_kg, rec.dens_cont * (int)capacidad/1000); + fila.Store(); + //libera + FunGDB.libera(fila); + FunGDB.libera(feat); + } + //libera + FunGDB.libera(fila); + FunGDB.libera(feat); + + feat = cursor.NextFeature(); + } + //libera + FunGDB.libera(fila); + FunGDB.libera(cursor); + FunGDB.libera(feat); + FunGDB.libera(filtro); + FunGDB.libera(tabla); + FunGDB.libera(fc); + return true; + } + + } +} diff --git a/OliviaAddIn/EditTxtPlant.Designer.cs b/OliviaAddIn/EditTxtPlant.Designer.cs new file mode 100644 index 0000000..fd0f89c --- /dev/null +++ b/OliviaAddIn/EditTxtPlant.Designer.cs @@ -0,0 +1,73 @@ +namespace OliviaAddIn +{ + partial class EditTxtPlant + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.propertyGrid_txtplant = new OliviaAddIn.TabbedPropertyGrid(); + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // propertyGrid_txtplant + // + this.propertyGrid_txtplant.Location = new System.Drawing.Point(12, 12); + this.propertyGrid_txtplant.Name = "propertyGrid_txtplant"; + this.propertyGrid_txtplant.PropertySort = System.Windows.Forms.PropertySort.Categorized; + this.propertyGrid_txtplant.Size = new System.Drawing.Size(404, 332); + this.propertyGrid_txtplant.TabIndex = 0; + this.propertyGrid_txtplant.ToolbarVisible = false; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(341, 356); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 1; + this.button1.Text = "Aceptar"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // EditTxtPlant + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(428, 391); + this.Controls.Add(this.button1); + this.Controls.Add(this.propertyGrid_txtplant); + this.Name = "EditTxtPlant"; + this.Text = "Editor de Textos para la Plantilla"; + this.Resize += new System.EventHandler(this.EditTxtPlant_Resize); + this.ResumeLayout(false); + + } + + #endregion + + private TabbedPropertyGrid propertyGrid_txtplant; + private System.Windows.Forms.Button button1; + } +} \ No newline at end of file diff --git a/OliviaAddIn/EditTxtPlant.cs b/OliviaAddIn/EditTxtPlant.cs new file mode 100644 index 0000000..a342b9d --- /dev/null +++ b/OliviaAddIn/EditTxtPlant.cs @@ -0,0 +1,340 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Drawing.Design; +using System.Windows.Forms.Design; + +namespace OliviaAddIn +{ + public partial class EditTxtPlant : Form + { + ////////////////////////////////////////////////////////////// + //variables para los botones + int top_buttons; + int bottom_props; + int right_props; + public EditTxtPlantProps props; + public EditTxtPlant() + { + props = new EditTxtPlantProps(); + InitializeComponent(); + + top_buttons = ClientSize.Height - button1.Top; + bottom_props = ClientSize.Height - propertyGrid_txtplant.Bottom; + right_props = ClientSize.Width - propertyGrid_txtplant.Right; + + // Assign the form to the propertygrid + propertyGrid_txtplant.SetParent(this); + propertyGrid_txtplant.SelectedObject = props; + + } + + private void button1_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.OK; + Close(); + } + + private void EditTxtPlant_Resize(object sender, EventArgs e) + { + //mover button_aceptar, button_reset, button_guardar, bottom del property + button1.Top = ClientSize.Height - top_buttons; + propertyGrid_txtplant.Size = new Size(ClientSize.Width - right_props, ClientSize.Height - bottom_props); + } + } + + /* + * Clase para los campos multilínea + */ + public class MultiLineTextEditor : UITypeEditor + { + private IWindowsFormsEditorService _editorService; + + public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) + { + return UITypeEditorEditStyle.DropDown; + } + + public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) + { + _editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); + + TextBox textEditorBox = new TextBox(); + textEditorBox.Multiline = true; + textEditorBox.ScrollBars = ScrollBars.Vertical; + textEditorBox.Width = 250; + textEditorBox.Height = 150; + textEditorBox.BorderStyle = BorderStyle.None; + textEditorBox.AcceptsReturn = true; + + textEditorBox.Text = value as string; + + _editorService.DropDownControl(textEditorBox); + + return textEditorBox.Text; + } + } + + /** + * Clase para la estructura de propiedades + */ + public class EditTxtPlantProps + { + public const int N_CAMPOS_PLANT = 7; + public String[] campos_plant = new String[N_CAMPOS_PLANT]; + public Font[] fonts = new Font[N_CAMPOS_PLANT]; + + public EditTxtPlantProps() + { + int[] ss = {10,14,12,8,8,8,7}; + + for (int i = 0; i < N_CAMPOS_PLANT; i++) + { + campos_plant[i]=""; + fonts[i] = new Font("Arial Narrow", ss[i], FontStyle.Regular); + } + } + + [CategoryAttribute("01 Proyecto")] + [DisplayNameAttribute("Texto del Proyecto")] + [DescriptionAttribute("Título del proyecto")] + [Editor(typeof(MultiLineTextEditor), typeof(UITypeEditor))] + public string titulo + { + get { return campos_plant[0]; } + set { campos_plant[0] = value; } + } + [CategoryAttribute("01 Proyecto")] + [DisplayNameAttribute("Fuente del Proyecto")] + [DescriptionAttribute("Fuente para el Título del proyecto")] + public Font titulo_font + { + get { return fonts[0]; } + set { fonts[0] = value; } + } + /// + /// /////////////////////////////////// + /// + [CategoryAttribute("02 Título")] + [DisplayNameAttribute("Texto del título")] + [DescriptionAttribute("Título del servicio")] + [Editor(typeof(MultiLineTextEditor), typeof(UITypeEditor))] + public string titulo_serv + { + get { return campos_plant[1]; } + set { campos_plant[1] = value; } + } + [CategoryAttribute("02 Título")] + [DisplayNameAttribute("Fuente del título")] + [DescriptionAttribute("Fuente para el Título del servicio")] + public Font titulo_serv_font + { + get { return fonts[1]; } + set { fonts[1] = value; } + } + /// + /// /////////////////////////////////// + /// + [CategoryAttribute("03 Tipología")] + [DisplayNameAttribute("Texto de la Tipología")] + [DescriptionAttribute("Tipología del servicio: Recogida de residuos, Limpieza viaria, Mantenimiento zonas verdes, etc.")] + [Editor(typeof(MultiLineTextEditor), typeof(UITypeEditor))] + public string tipo_serv + { + get { return campos_plant[2]; } + set { campos_plant[2] = value; } + } + [CategoryAttribute("03 Tipología")] + [DisplayNameAttribute("Fuente de la Tipología")] + [DescriptionAttribute("Fuente para la Tipología del servicio")] + public Font tipo_serv_font + { + get { return fonts[2]; } + set { fonts[2] = value; } + } + /// + /// /////////////////////////////////// + /// + [CategoryAttribute("04 Frecuencia")] + [DisplayNameAttribute("Texto de la frecuencia")] + [DescriptionAttribute("Frecuencia del servicio")] + [Editor(typeof(MultiLineTextEditor), typeof(UITypeEditor))] + public string frec_serv + { + get { return campos_plant[3]; } + set { campos_plant[3] = value; } + } + [CategoryAttribute("04 Frecuencia")] + [DisplayNameAttribute("Fuente de la frecuencia")] + [DescriptionAttribute("Fuente para la Frecuencia del servicio")] + public Font frec_serv_font + { + get { return fonts[3]; } + set { fonts[3] = value; } + } + /// + /// /////////////////////////////////// + /// + [CategoryAttribute("05 Turno")] + [DisplayNameAttribute("Texto del Turno")] + [DescriptionAttribute("Turno del servicio")] + [Editor(typeof(MultiLineTextEditor), typeof(UITypeEditor))] + public string turno_serv + { + get { return campos_plant[4]; } + set { campos_plant[4] = value; } + } + [CategoryAttribute("05 Turno")] + [DisplayNameAttribute("Fuente del Turno")] + [DescriptionAttribute("Fuente para el Turno del servicio")] + public Font turno_serv_font + { + get { return fonts[4]; } + set { fonts[4] = value; } + } + /// + /// /////////////////////////////////// + /// + [CategoryAttribute("06 Equipo")] + [DisplayNameAttribute("Texto del Equipo")] + [DescriptionAttribute("Equipo del servicio: Conductor, Peón Conductor, Peón, Vehículo")] + [Editor(typeof(MultiLineTextEditor), typeof(UITypeEditor))] + public string equipo_serv + { + get { return campos_plant[5]; } + set { campos_plant[5] = value; } + } + [CategoryAttribute("06 Equipo")] + [DisplayNameAttribute("Fuente del Equipo")] + [DescriptionAttribute("Fuente para el Equipo del servicio")] + public Font equipo_serv_font + { + get { return fonts[5]; } + set { fonts[5] = value; } + } + /// + /// /////////////////////////////////// + /// + [CategoryAttribute("07 Información adicional")] + [DisplayNameAttribute("Texto para Información adicional")] + [DescriptionAttribute("Otra información para el proyecto")] + [Editor(typeof(MultiLineTextEditor), typeof(UITypeEditor))] + public string info_adi + { + get { return campos_plant[6]; } + set { campos_plant[6] = value; } + } + [CategoryAttribute("07 Información adicional")] + [DisplayNameAttribute("Fuente para Información adicional")] + [DescriptionAttribute("Fuente para la Información adicional")] + public Font info_adi_font + { + get { return fonts[6]; } + set { fonts[6] = value; } + } + /// + /// /////////////////////////////////// + /// + } + + + /** + * Para usar el Tabulador para cambiar de propiedad + */ + public class TabbedPropertyGrid : PropertyGrid + { + Form parent; + public TabbedPropertyGrid() : base() { } + public void SetParent(Form form) + { + parent = form; + // Catch null arguments + if (form == null) + { + throw new ArgumentNullException("form"); + } + + // Set this property to intercept all events + form.KeyPreview = true; + + // Listen for keydown event + form.KeyDown += new KeyEventHandler(this.Form_KeyDown); + + } + private void Form_KeyDown(object sender, KeyEventArgs e) + { + // Exit if cursor not in control + if (!this.RectangleToScreen(this.ClientRectangle).Contains(Cursor.Position)) + { + return; + } + + // Handle tab key + if (e.KeyCode != Keys.Tab) { return; } + e.Handled = true; + e.SuppressKeyPress = true; + + // Get selected griditem + GridItem gridItem = this.SelectedGridItem; + if (gridItem == null) { return; } + + // Create a collection all visible child griditems in propertygrid + GridItem root = gridItem; + while (root.GridItemType != GridItemType.Root) + { + root = root.Parent; + } + List gridItems = new List(); + this.FindItems(root, gridItems); + + // Get position of selected griditem in collection + int index = gridItems.IndexOf(gridItem); + + int nextIndex = index + 1; + if (nextIndex >= gridItems.Count) + { + //ha terminado, pasa al siguiente + parent.GetNextControl(this, true).Focus(); + return; + } + // Select next griditem in collection + this.SelectedGridItem = gridItems[nextIndex]; + } + private void FindItems(GridItem item, List gridItems) + { + switch (item.GridItemType) + { + case GridItemType.Root: + case GridItemType.Category: + foreach (GridItem i in item.GridItems) + { + this.FindItems(i, gridItems); + } + break; + case GridItemType.Property: + gridItems.Add(item); + if (item.Expanded) + { + foreach (GridItem i in item.GridItems) + { + this.FindItems(i, gridItems); + } + } + break; + case GridItemType.ArrayValue: + break; + } + } + } + + + + + + +} diff --git a/OliviaAddIn/EditTxtPlant.resx b/OliviaAddIn/EditTxtPlant.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/OliviaAddIn/EditTxtPlant.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OliviaAddIn/Ejecuta.cs b/OliviaAddIn/Ejecuta.cs new file mode 100644 index 0000000..fb3abdb --- /dev/null +++ b/OliviaAddIn/Ejecuta.cs @@ -0,0 +1,129 @@ +using System; +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; + +namespace OliviaAddIn +{ + /** + * @file Ejecuta.cs + * Clase de ejecución del grueso de la herramienta Olivia. + * Guarda en un archivo de configuración la información configurada, + * lanza una ventana de progreso, + * llama al proceso Geofoto, y va leyendo en el archivo de configuración + * el progreso de la ejecución, que actualiza en la ventana. + */ + /** + * Clase de ejecución del grueso de la herramienta Olivia. + * Guarda en un archivo de configuración la información configurada, + * lanza una ventana de progreso, + * llama al proceso Geofoto, y va leyendo en el archivo de configuración + * el progreso de la ejecución, que actualiza en la ventana. + */ + class Ejecuta + { + //************************************************************************************* + //Enums + public enum ModosEjec + { + Secto, + Planif, + SoloPlanif, + } + //************************************************************************************* + //Variables + /** + * Cadena general de escritura de parámetros de configuración para envío por socket + */ + public string str_cfg; + /** + * Cadena general para indicar los errores de ejecución + */ + public string err_str=""; + /** + * Cadena general de escritura de parámetros para envío por socket + */ + public string str; + + //************************************************************************************* + //Métodos + public Ejecuta() + { + str = ""; + } + + ~Ejecuta() // destructor (finalizers) + { + // cleanup statements... + } + + /** + * Comienza las funciones de ejecución + */ + public bool ejec() + { + //lanza ventana marchando que lanza proceso en bucle para actualizar barra progreso + OliviaGlob.progr_eje = new ProgresoEjec(); + + //lanza proceso geofoto + if (!lanza_geofoto()) + { + err_str = "Error al arrancar Geofoto (programa de procesado de datos): No ha arrancado correctamente la instancia Geofoto"; + return false; + } + + OliviaGlob.progr_eje.start(str_cfg); + + return true; + } + + /** + * Arranca el proceso geofoto con los parámetros correspondientes + */ + private bool lanza_geofoto() + { + Process pg; + string args; + ProcessStartInfo pfi; + + try + { + //van ParamN parámetros, sin incluir "/olivia", si se añaden, incrementar ParamN + args = GeneralDef.EjecGeoParamSep + GeneralDef.EjecGeoProgName + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_tipo + GeneralDef.EjecGeoParamIgual + ((int)OliviaGlob.tip_oliv).ToString() + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_ip + GeneralDef.EjecGeoParamIgual + OliviaGlob.ip + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_port + GeneralDef.EjecGeoParamIgual + OliviaGlob.puerto + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_tout + GeneralDef.EjecGeoParamIgual + OliviaGlob.t_out_sock + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_pt + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathTemp + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_pcfg + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathWork + "cfg_geo.ini" + " " ; + + pfi = new ProcessStartInfo(OliviaGlob.Paths.PathGeofoto, args); + System.Diagnostics.Process.Start(pfi); + + //comprueba que haya arrancado geofoto + //le da 2 seg de margen para que arranque + pg = OliviaGlob.progr_eje.esta_geofoto(2, true); + if (pg == null) + { + MessageBox.Show("No está Geofot, args= "+args, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + } + catch (Exception) + { + return false; + } + + return true; + } + + } + +} diff --git a/OliviaAddIn/EjecutaLimp.cs b/OliviaAddIn/EjecutaLimp.cs new file mode 100644 index 0000000..9ad1894 --- /dev/null +++ b/OliviaAddIn/EjecutaLimp.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using SisNetBase; +using OliviaDef; +using System.IO; +using System.Windows.Forms; + +namespace OliviaAddIn +{ + /** + * @file EjecutaLimp.cs + * Clase con funciones para ejecución del programa en modo limpieza viaria. + * Hace la llamada correspondiente a Geofoto con los parámetros seleccionados. + */ + class EjecutaLimp : Ejecuta + { + //************************************************************************************* + //Variables + public Limpieza limp; + //************************************************************************************* + //Métodos + public EjecutaLimp() + { + err_str = ""; + } + + /** + * Comienza las funciones de ejecución + * modo 0 la primera vez, va a sectorizar, modo 1 la segunda vez, planifica + */ + public bool ejec(Limpieza limp, int modo) + { + if (limp == null) + { + err_str = "Error en la recopilación de datos para el procesado"; + return false; + } + + OliviaGlob.tip_oliv = OliviaDef.GeneralDef.TiposOliv.OlivLimp; + + if (!OliviaGlob.gdb_limp.exporta(limp, modo == (int)Ejecuta.ModosEjec.Planif)) + { + err_str = OliviaGlob.gdb_limp.err_st; + return false; + } + + //configura el string de opciones + if (!configura_ops_geo(limp,modo)) + { + err_str = "Error al configurar opciones"; + return false; + } + + this.limp = limp; + + //Llama al ejecuta del padre + return base.ejec(); + + } + + /** + * Configura el str de opciones que va a mandar a geofoto + * modo 0 la primera vez, va a sectorizar, modo 1 la segunda vez, planifica + */ + public bool configura_ops_geo(Limpieza limp, int modo) + { + string str; + string modo_str=""; + int r = 0; + + if ((limp.tipo_tto < 0) || (limp.tipo_tto >= (int)LimpiezaDef.TiposTto.TtoN)) + return false; + + if (limp.rest_circ[(int)limp.tipo_tto]) + r=1; //restricción de circulación + + if(modo==0) + modo_str = GeneralDef.SockConf; + else if(modo==1) + modo_str = GeneralDef.SockConfPlan; + + //van ParamLimpN parámetros, sin incluir "CONFIGURACION", si se añaden, incrementar ParamLimpN + str = GeneralDef.EjecGeoParamSep + modo_str + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GL_tto + GeneralDef.EjecGeoParamIgual + limp.t_tto + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GL_res + GeneralDef.EjecGeoParamIgual + r + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GL_uto + GeneralDef.EjecGeoParamIgual + (int)limp.uds_t_tto + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GL_vdp + GeneralDef.EjecGeoParamIgual + limp.v_despl + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_tco + GeneralDef.EjecGeoParamIgual + limp.t_conv + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_tdc + GeneralDef.EjecGeoParamIgual + limp.t_descan + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GL_tdp + GeneralDef.EjecGeoParamIgual + limp.t_despl_insta + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GL_tca + GeneralDef.EjecGeoParamIgual + limp.t_descarg + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_hini + GeneralDef.EjecGeoParamIgual + limp.h_ini + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_trafic + GeneralDef.EjecGeoParamIgual + limp.trafico + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_npt + GeneralDef.EjecGeoParamIgual + limp.n_ptsctrl + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_sec + GeneralDef.EjecGeoParamIgual + limp.n_secdef + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GL_anc + GeneralDef.EjecGeoParamIgual + limp.ancho_via + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_coox + GeneralDef.EjecGeoParamIgual + limp.coords_instala[0] + " " +//coordenadas + GeneralDef.EjecGeoParamSep + GeneralDef.GG_cooy + GeneralDef.EjecGeoParamIgual + limp.coords_instala[1] + " " +//coordenadas + GeneralDef.EjecGeoParamSep + GeneralDef.GG_ais + GeneralDef.EjecGeoParamIgual + limp.aislados + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_pd + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathData + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_pn + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathNW + " "; + + base.str_cfg = str; + + return true; + } + + } +} diff --git a/OliviaAddIn/EjecutaReco.cs b/OliviaAddIn/EjecutaReco.cs new file mode 100644 index 0000000..edf0972 --- /dev/null +++ b/OliviaAddIn/EjecutaReco.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using OliviaDef; + +namespace OliviaAddIn +{ + class EjecutaReco : Ejecuta + { + //************************************************************************************* + //Variables + public Recogida reco; + //************************************************************************************* + //Métodos + public EjecutaReco() + { + err_str = ""; + } + + /** + * Comienza las funciones de ejecución + * modo 0 la primera vez, va a sectorizar, modo 1 la segunda vez, planifica + */ + public bool ejec(Recogida reco, int modo) + { + if (reco == null) + { + err_str = "Error en la recopilación de datos para el procesado"; + return false; + } + + OliviaGlob.tip_oliv = OliviaDef.GeneralDef.TiposOliv.OlivResi; + + if (!OliviaGlob.gdb_reco.exporta(reco, modo == (int)Ejecuta.ModosEjec.Planif)) + { + err_str = OliviaGlob.gdb_reco.err_st; + return false; + } + + //configura el string de opciones + if (!configura_ops_geo(reco, modo)) + { + err_str = "Error al configurar opciones"; + return false; + } + + this.reco = reco; + + //Llama al ejecuta del padre + return base.ejec(); + + } + + /** + * Configura el str de opciones que va a mandar a geofoto + * modo 0 la primera vez, va a sectorizar, modo 1 la segunda vez, planifica + */ + public bool configura_ops_geo(Recogida reco, int modo) + { + string str, modo_str = ""; + + if (modo == (int)ModosEjec.Secto) + modo_str = GeneralDef.SockConf; + else if (modo == (int)ModosEjec.Planif) + modo_str = GeneralDef.SockConfPlan; + else if (modo == (int)ModosEjec.SoloPlanif) + modo_str = GeneralDef.SockConfTodo; + + //van ParamLimpN parámetros, sin incluir "CONFIGURACION", si se añaden, incrementar ParamLimpN + str = GeneralDef.EjecGeoParamSep + modo_str + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_camp_cap + GeneralDef.EjecGeoParamIgual + reco.rec_capac + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_kgM + GeneralDef.EjecGeoParamIgual + reco.carg_max_vehic + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_camp_kgrec + GeneralDef.EjecGeoParamIgual + reco.rec_kg + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_camp_uds + GeneralDef.EjecGeoParamIgual + reco.rec_uds + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_kgrecog + GeneralDef.EjecGeoParamIgual + reco.rec_kgrec_cont + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_carga_cont + GeneralDef.EjecGeoParamIgual + reco.carga_max + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_dens + GeneralDef.EjecGeoParamIgual + reco.dens_cont + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_tco + GeneralDef.EjecGeoParamIgual + reco.t_conv + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_tdc + GeneralDef.EjecGeoParamIgual + reco.t_descan + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_tvc + GeneralDef.EjecGeoParamIgual + reco.t_vaci + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_tdca + GeneralDef.EjecGeoParamIgual + reco.t_descarg + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_tsal + GeneralDef.EjecGeoParamIgual + reco.t_despl_insta + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_hini + GeneralDef.EjecGeoParamIgual + reco.h_ini + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_trafic + GeneralDef.EjecGeoParamIgual + reco.trafico + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_npt + GeneralDef.EjecGeoParamIgual + reco.n_ptsctrl + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_sec + GeneralDef.EjecGeoParamIgual + reco.n_secdef + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_anc + GeneralDef.EjecGeoParamIgual + reco.anch_vehic + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_gir + GeneralDef.EjecGeoParamIgual + reco.giro_vehic + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_coox + GeneralDef.EjecGeoParamIgual + reco.coords_instala[0] + " " +//coordenadas + GeneralDef.EjecGeoParamSep + GeneralDef.GG_cooy + GeneralDef.EjecGeoParamIgual + reco.coords_instala[1] + " " +//coordenadas + GeneralDef.EjecGeoParamSep + GeneralDef.GR_descx + GeneralDef.EjecGeoParamIgual + reco.coords_descarg[0] + " " +//coordenadas + GeneralDef.EjecGeoParamSep + GeneralDef.GR_descy + GeneralDef.EjecGeoParamIgual + reco.coords_descarg[1] + " " +//coordenadas + GeneralDef.EjecGeoParamSep + GeneralDef.GR_sens_id + GeneralDef.EjecGeoParamIgual + reco.id_sens + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_sens_url + GeneralDef.EjecGeoParamIgual + reco.url_sens + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_sens_fecha + GeneralDef.EjecGeoParamIgual + reco.fecha_sens + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_sens_fechaf + GeneralDef.EjecGeoParamIgual + reco.fechaf_sens + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_sens_modo + GeneralDef.EjecGeoParamIgual + reco.media + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_ais + GeneralDef.EjecGeoParamIgual + reco.aislados + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GR_lateral + GeneralDef.EjecGeoParamIgual + reco.lateralidad + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_pd + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathData + " " + + GeneralDef.EjecGeoParamSep + GeneralDef.GG_pn + GeneralDef.EjecGeoParamIgual + OliviaGlob.Paths.PathNW + " "; + + base.str_cfg = str; + + return true; + } + + + + } +} diff --git a/OliviaAddIn/FormCampos.Designer.cs b/OliviaAddIn/FormCampos.Designer.cs new file mode 100644 index 0000000..178c3af --- /dev/null +++ b/OliviaAddIn/FormCampos.Designer.cs @@ -0,0 +1,109 @@ +namespace OliviaAddIn +{ + partial class FormCampos + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormCampos)); + this.propertyGrid = new System.Windows.Forms.PropertyGrid(); + this.button_reset = new System.Windows.Forms.Button(); + this.btn_acept = new System.Windows.Forms.Button(); + this.button_guardar = new System.Windows.Forms.Button(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.SuspendLayout(); + // + // propertyGrid + // + this.propertyGrid.LineColor = System.Drawing.SystemColors.ControlDark; + this.propertyGrid.Location = new System.Drawing.Point(12, 12); + this.propertyGrid.Name = "propertyGrid"; + this.propertyGrid.PropertySort = System.Windows.Forms.PropertySort.Categorized; + this.propertyGrid.Size = new System.Drawing.Size(268, 249); + this.propertyGrid.TabIndex = 0; + this.propertyGrid.ToolbarVisible = false; + // + // button_reset + // + this.button_reset.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F); + this.button_reset.Location = new System.Drawing.Point(12, 276); + this.button_reset.Name = "button_reset"; + this.button_reset.Size = new System.Drawing.Size(40, 23); + this.button_reset.TabIndex = 1; + this.button_reset.Text = "Reset"; + this.button_reset.UseVisualStyleBackColor = true; + this.button_reset.Click += new System.EventHandler(this.button_reset_Click); + // + // btn_acept + // + this.btn_acept.Location = new System.Drawing.Point(205, 276); + this.btn_acept.Name = "btn_acept"; + this.btn_acept.Size = new System.Drawing.Size(75, 23); + this.btn_acept.TabIndex = 2; + this.btn_acept.Text = "Aceptar"; + this.btn_acept.UseVisualStyleBackColor = true; + this.btn_acept.Click += new System.EventHandler(this.btn_acept_Click); + // + // button_guardar + // + this.button_guardar.Location = new System.Drawing.Point(124, 276); + this.button_guardar.Name = "button_guardar"; + this.button_guardar.Size = new System.Drawing.Size(75, 23); + this.button_guardar.TabIndex = 3; + this.button_guardar.Text = "Guardar"; + this.toolTip1.SetToolTip(this.button_guardar, "Guardar cambios en los campos y atributos en el archivo de configuración"); + this.button_guardar.UseVisualStyleBackColor = true; + this.button_guardar.Click += new System.EventHandler(this.button_guardar_Click); + // + // FormCampos + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(292, 309); + this.Controls.Add(this.button_guardar); + this.Controls.Add(this.btn_acept); + this.Controls.Add(this.button_reset); + this.Controls.Add(this.propertyGrid); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "FormCampos"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Campos a leer"; + this.TopMost = true; + this.Resize += new System.EventHandler(this.FormCampos_Resize); + this.ResumeLayout(false); + + } + + #endregion + + public System.Windows.Forms.PropertyGrid propertyGrid; + private System.Windows.Forms.Button button_reset; + private System.Windows.Forms.Button btn_acept; + private System.Windows.Forms.Button button_guardar; + private System.Windows.Forms.ToolTip toolTip1; + } +} \ No newline at end of file diff --git a/OliviaAddIn/FormCampos.cs b/OliviaAddIn/FormCampos.cs new file mode 100644 index 0000000..2ffe2a5 --- /dev/null +++ b/OliviaAddIn/FormCampos.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Drawing.Design; +using System.Windows.Forms.Design; + +namespace OliviaAddIn +{ + + public partial class FormCampos : Form + { + ////////////////////////////////////////////////////////////// + //variables para los botones + int top_buttons; + int bottom_props; + int right_props; + ////////////////////////////////////////////////////////////// + /** + * Clase para el tipo combo Sí/No de las propiedades + */ + public class Prop_si_no : TypeConverter + { + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + if (sourceType == typeof(string)) + return true; + return base.CanConvertFrom(context, sourceType); + } + + public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + { + if (destinationType == typeof(string)) + return true; + return base.CanConvertTo(context, destinationType); + } + + public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) + { + if (value.GetType() == typeof(string)) + { + if (((string)value).ToLower() == "si") + return true; + if (((string)value).ToLower() == "no") + return false; + throw new Exception("Values must be \"Yes\" or \"No\""); + } + return base.ConvertFrom(context, culture, value); + } + + public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) + { + if (destinationType == typeof(string)) + { + if (value == null) + return false; + else + return (((bool)value) ? "Si" : "No"); + } + return base.ConvertTo(context, culture, value, destinationType); + } + + public override bool GetStandardValuesSupported(ITypeDescriptorContext context) + { + return true; + } + + public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) + { + bool[] bools = new bool[] { true, false }; + System.ComponentModel.TypeConverter.StandardValuesCollection svc = new System.ComponentModel.TypeConverter.StandardValuesCollection(bools); + return svc; + } + + } + + public FormCampos() + { + InitializeComponent(); + top_buttons = ClientSize.Height - button_guardar.Top; + bottom_props = ClientSize.Height - propertyGrid.Bottom; + right_props = ClientSize.Width - propertyGrid.Right; + } + + protected virtual void button_guardar_Click(object sender, EventArgs e) + { + string err_str; + if (!OliviaGlob.guarda_ini_gen(out err_str)) + { + MessageBox.Show(err_str, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + protected virtual void btn_acept_Click(object sender, EventArgs e) + { + + } + + protected virtual void button_reset_Click(object sender, EventArgs e) + { + + } + + private void FormCampos_Resize(object sender, EventArgs e) + { + //mover button_aceptar, button_reset, button_guardar, bottom del property + button_guardar.Top = ClientSize.Height - top_buttons; + button_reset.Top = ClientSize.Height - top_buttons; + btn_acept.Top = ClientSize.Height - top_buttons; + propertyGrid.Size = new Size(ClientSize.Width - right_props, ClientSize.Height - bottom_props); + } + } +} diff --git a/OliviaAddIn/FormCampos.resx b/OliviaAddIn/FormCampos.resx new file mode 100644 index 0000000..f8e442e --- /dev/null +++ b/OliviaAddIn/FormCampos.resx @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA + AAD///8B////Af///wH///8BOoFqBTqBamE6gWq9OoFq7zqBapU6gWq9OoFqvzqBamM6gWoF////Af// + /wH///8B////Af///wH///8BOoFqJTqBatE6gWr/OoFq/zqBav86gWqTOoFq9TqBav86gWr/OoFq0zqB + ain///8B////Af///wH///8BOoFqJTqBaus6gWr/OoFq/zqBav86gWr9OoFqqzqBauk6gWr9OoFq/zqB + av86gWrrOoFqJ////wH///8BOoFqAzqBas86gWr7OoFqzTqBaqk6gWqtOoFqYzqBask6gWpJOoFqXTqB + ass6gWr7OoFq/zqBatE6gWoF////ATqBalc6gWrpOoFq4zqBap86gWoNOoFqCzqBanM6gWrROoFqqzqB + ajk6gWoNOoFqezqBavk6gWr/OoFqW////wE6gWq1OoFqpTqBats6gWp7OoFqOzqBahs6gWrxOoFq8zqB + av86gWqVOoFqFTqBanM6gWqJOoFq0TqBarf///8BOoFq6zqBal86gWqFOoFqezqBais6gWpHOoFq8TqB + av86gWr/OoFqdTqBaj86gWopOoFqhTqBask6gWqF////ATqBauM6gWo1OoFqHzqBamX///8BOoFqiTqB + av86gWrhOoFq/zqBal////8BOoFqYTqBaok6gWrhOoFq/////wE6gWpFOoFqFzqBakU6gWov////ATqB + apk6gWr/OoFq8TqBav86gWrbOoFqE////wE6gWpVOoFqtzqBapv///8BOoFqeTqBaos6gWpj////Af// + /wE6gWpXOoFq+zqBav86gWr/OoFq3TqBahE6gWozOoFqiTqBauU6gWol////ATqBaj86gWoV////Af// + /wH///8BOoFqfTqBaus6gWr3OoFq9zqBajs6gWo7OoFqczqBat86gWphOoFqA////wH///8B////Af// + /wH///8B////ATqBapM6gWr/OoFq/zqBav86gWpbOoFqSTqBatM6gWqVOoFqeTqBahP///8B////Af// + /wH///8B////Af///wE6gWofOoFq1zqBav86gWr/OoFqff///wH///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////ATqBark6gWr/OoFqwzqBagf///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wE6gWo3OoFq6zqBaiP///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// + /wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//w== + + + \ No newline at end of file diff --git a/OliviaAddIn/FunGDB.cs b/OliviaAddIn/FunGDB.cs new file mode 100644 index 0000000..3d670ae --- /dev/null +++ b/OliviaAddIn/FunGDB.cs @@ -0,0 +1,1322 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; +using System.Windows.Forms; +using System.Collections; + +using ESRI.ArcGIS.CatalogUI; +using ESRI.ArcGIS.Catalog; +using ESRI.ArcGIS.Geodatabase; +using ESRI.ArcGIS.Geometry; +using ESRI.ArcGIS.DataSourcesFile; +using ESRI.ArcGIS.DataSourcesGDB; +using ESRI.ArcGIS.esriSystem; +using ESRI.ArcGIS.Geoprocessing; +//using ESRI.ArcGIS.Carto; +//using ESRI.ArcGIS.Display; +//using System.Drawing; +//using ESRI.ArcGIS.ADF.COMSupport; + +/** +* @file FunGDB.cs +* Clase con funciones de tratamiento de la GDB +*/ + +/** +* Clase con funciones de tratamiento de la GDB +*/ +namespace OliviaAddIn +{ + public static class FunGDB + { + //********************************************************************** + + //********************************************************************** + //Variables + + //********************************************************************** + //Funciones + /** + * Lanza browser tipo catalog para seleccionar feature class + * Devuelve el path completo + */ + public static string selec_ftcls(String title, int parentWnd, string ini_loc = null) + { + string path = null; + IGxDialog gxdlg; + IEnumGxObject workspaces; + IGxObject gxobj = null; + + gxdlg = new GxDialogClass(); + gxdlg.ObjectFilter = new GxFilterFeatureClasses(); + gxdlg.AllowMultiSelect = false; + gxdlg.Title = title; + gxdlg.ButtonCaption = "OK"; + if (ini_loc != null) + { + gxdlg.set_StartingLocation(System.IO.Path.GetDirectoryName(ini_loc)); + gxdlg.Name = System.IO.Path.GetFileNameWithoutExtension(ini_loc); + } + if (gxdlg.DoModalOpen(parentWnd, out workspaces) && workspaces != null) + { + gxobj = workspaces.Next(); + path = gxobj.FullName; + } + else + { + path = null; + } + gxdlg.InternalCatalog.Close(); + libera(workspaces); + libera(gxdlg); + + return path; + } + + /** + * Lanza browser tipo catalog para guardar feature class + * Devuelve el path completo + */ + public static string save_ftcls(string title, int parentWnd, string name_ini, out bool replacing) + { + string path = null; + IGxDialog gxdlg; + + replacing = false; + + gxdlg = new GxDialogClass(); + gxdlg.ObjectFilter = new GxFilterFeatureClasses(); + gxdlg.AllowMultiSelect = false; + gxdlg.Title = title; + gxdlg.ButtonCaption = "OK"; + gxdlg.set_StartingLocation(System.IO.Path.GetDirectoryName(name_ini)); + gxdlg.Name=System.IO.Path.GetFileNameWithoutExtension(name_ini); + if (gxdlg.DoModalSave(parentWnd)) + { + path = gxdlg.Name; + } + else + { + path = null; + } + replacing = gxdlg.ReplacingObject; + gxdlg.InternalCatalog.Close(); + libera(gxdlg); + + return path; + } + + /** + * Lanza browser tipo catalog para seleccionar gdb + */ + public static IWorkspace selec_gdb(string title, int parentWnd, string reintentar_text = null) + { + IGxObject gxobj; + IGxDialog gxdlg; + IGxDatabase gxdb; + IEnumGxObject workspaces; + IWorkspace ws = null; + + gxdlg = new GxDialogClass(); + gxdlg.ObjectFilter = new GxFilterFileGeodatabasesClass(); + gxdlg.AllowMultiSelect = false; + gxdlg.Title = title; + gxdlg.ButtonCaption = "OK"; + if (gxdlg.DoModalOpen(parentWnd, out workspaces) && workspaces != null) + { + gxobj = workspaces.Next(); + + if (gxobj is IGxDatabase) + { + gxdb = (IGxDatabase)gxobj; + if (gxdb != null) + ws = gxdb.Workspace; + } + libera(workspaces); + } + else if (reintentar_text!=null) + { + if (DialogResult.Cancel == MessageBox.Show(reintentar_text, "Olivia", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)) + { + ws = selec_gdb(title, parentWnd); + } + else + return null; + } + + gxdlg.InternalCatalog.Close(); + libera(gxdlg); + return ws; + } + + /** + * Devuelve el Feature Workspace dado el path de la clase o del directorio + */ + public static IFeatureWorkspace abre_ftws(string clase_path) + { + IWorkspace ws; + + try + { + + ws = abre_ws(clase_path); + if (ws == null) + return null; + + IFeatureWorkspace feat_ws = (IFeatureWorkspace)ws; + + return feat_ws; + } + catch (Exception) + { + return null; + } + } + + /** + * Devuelve el IWorkspaceName dado el path de la clase o del directorio + */ + public static IWorkspaceName abre_wsn(string clase_path) + { + IWorkspace ws; + IDataset data; + IName name; + IWorkspaceName wsn; + + + try + { + ws = abre_ws(clase_path); + if (ws == null) + return null; + + data = (IDataset)ws; + name = data.FullName; + wsn = (IWorkspaceName)name; + + return wsn; + } + catch (Exception) + { + return null; + } + } + + /** + * Devuelve el IWorkspace dado el path de la clase o del directorio + */ + public static IWorkspace abre_ws(string clase_path) + { + IWorkspaceFactory wsf; + IWorkspace ws; + GPUtilities gp = new GPUtilities(); + string dir = null; + + try + { + IGxObject obj; + + /* + //Información + Category = "File Geodatabase Feature Class" + obj = (IGxObject)gp.GetGxObjectFromLocation("C:\\Olivia\\gdbs\\BASE DE DATOS MADRE.gdb\\Comun\\c_Instalaciones"); + Category = "Shapefile" + obj = (IGxObject)gp.GetGxObjectFromLocation("c:\\Olivia\\otros_data\\data_F01_C00_20180430_154828_I.shp"); + Category = "File Geodatabase" + obj = (IGxObject)gp.GetGxObjectFromLocation("C:\\Olivia\\gdbs\\BASE DE DATOS MADRE.gdb"); + Category = "File Geodatabase Feature Dataset" + obj = (IGxObject)gp.GetGxObjectFromLocation("C:\\Olivia\\gdbs\\BASE DE DATOS MADRE.gdb\\Comun"); + * */ + + obj = (IGxObject)gp.GetGxObjectFromLocation(clase_path); + if (obj.Category == "Shapefile") //clase_path=c://archivos..//capa.shp, por ejemplo + { + wsf = new ShapefileWorkspaceFactoryClass(); + dir = obj.Parent.FullName; + + } + else if (obj.Category == "File Geodatabase Feature Class")//clase_path=c://archivos..//datos.gdb//capa, por ejemplo + { + wsf = new FileGDBWorkspaceFactoryClass(); + if (obj.Parent.Category == "File Geodatabase Feature Dataset")//mira si está en un dataset + dir = obj.Parent.Parent.FullName; + else if (obj.Parent.Category == "File Geodatabase") + dir = obj.Parent.FullName; + } + else if (obj.Category == "File Geodatabase")//clase_path=c://archivos..//datos.gdb, por ejemplo + { + wsf = new FileGDBWorkspaceFactoryClass(); + dir = obj.FullName; + } + else if (obj.Category.Contains("Folder"))//clase_path=c://archivos.., por ejemplo + { + wsf = new ShapefileWorkspaceFactoryClass(); + dir = obj.FullName; + } + else + return null; + + if (dir == null) + return null; + + ws = wsf.OpenFromFile(dir, 0); + + return ws; + } + catch (Exception) + { + return null; + } + } + + /** + * Dado el path completo dels shape a crear, devuelve el IFeatureClassName del shape + */ + public static IFeatureClassName crea_shp(string dir, string nomb) + { + IDatasetName shp_dsn = null; + IWorkspaceName shp_wsn = null; + IFeatureClassName shp_ftcn = null; + try + { + shp_ftcn = new FeatureClassNameClass(); + shp_dsn = (IDatasetName)shp_ftcn; + shp_dsn.Name = nomb; + shp_wsn = abre_wsn(dir); + if (shp_wsn == null) + return null; + shp_dsn.WorkspaceName = shp_wsn; + } + catch (Exception) + { + return null; + } + return shp_ftcn; + } + + /** + * Devuelve la Feature Class dado el path de la clase + * Hay que liberarla después de usarla + */ + public static IFeatureClass abre_ftclass(string clase_path) + { + IFeatureWorkspace feat_ws = abre_ftws(clase_path); + + if (feat_ws == null) + return null; + + IFeatureClass ftclass; + try + { + ftclass = feat_ws.OpenFeatureClass(System.IO.Path.GetFileNameWithoutExtension(clase_path)); + } + catch (Exception) + { + return null; + } + return ftclass; + } + + /** + * Devuelve la Feature Class dado el path de la gdb y el nombre de la clase + * Hay que liberarla después de usarla + */ + public static IFeatureClass abre_ftclass(string gdb_path, string ftclass_st) + { + IFeatureWorkspace feat_ws = abre_ftws(gdb_path); + + if (feat_ws == null) + return null; + + IFeatureClass ftclass; + try + { + ftclass = feat_ws.OpenFeatureClass(ftclass_st); + } + catch (Exception) + { + return null; + } + return ftclass; + } + + /** + * Devuelve la tabla de campos de una clase dado su path + * Hay que liberarla después de usarla + */ + public static ITable dame_tabla_clase(string clase_path) + { + ITable tabla; + + IFeatureWorkspace feat_ws = abre_ftws(clase_path); + if (feat_ws == null) + return null; + + try + { + tabla = feat_ws.OpenTable(System.IO.Path.GetFileNameWithoutExtension(clase_path)); + } + catch (Exception) + { + return null; + } + + return tabla; + } + + /** + * Devuelve la tabla de campos de una clase dado el nombre y la gdb que la contiene + * Hay que liberarla después de usarla + */ + public static ITable dame_tabla_clase(string gdb_path, string ftclass) + { + ITable tabla; + + IFeatureWorkspace feat_ws = abre_ftws(gdb_path); + if (feat_ws == null) + return null; + + try + { + tabla = feat_ws.OpenTable(ftclass); + } + catch (Exception) + { + return null; + } + + return tabla; + } + + /* + * Dado un path de clase y una consulta devuelve cuántas filas contienen datos + */ + public static int cuenta_filas_ftclass(string clase_path, string consulta) + { + int f = -1; + IQueryFilter filter = null; + ITable tabla = null; + + try + { + //se abre la tabla + tabla = dame_tabla_clase(clase_path); + + if (tabla == null) + return -1; + + //se aplica filtro + filter = new QueryFilterClass(); + filter.WhereClause = consulta; + + f = tabla.RowCount(filter); + return f; + } + catch (Exception) + { + return -1; + } + finally + { + libera(filter); + libera(tabla); + } + } + + /* + * Dado el nombre de una clase y la gdb que la contiene, y una consulta devuelve cuántas filas contienen datos + */ + public static int cuenta_filas_ftclass(string gdb_path, string ftclass, string consulta) + { + int f = -1; + IQueryFilter filter = null; + ITable tabla = null; + + try + { + //se abre la tabla + tabla = dame_tabla_clase(gdb_path, ftclass); + + if (tabla == null) + return -1; + + //se aplica filtro + filter = new QueryFilterClass(); + filter.WhereClause = consulta; + + f = tabla.RowCount(filter); + return f; + } + catch (Exception) + { + return -1; + } + finally + { + libera(filter); + libera(tabla); + } + } + + /* + * Devuelve los objectid de los elementos de clase_path que cumplan la consulta + */ + public static int[] dame_ids_consulta(string clase_path, string consulta, IFeatureClass ftclass_=null) + { + IQueryFilter filtro_lin = null; + ISelectionSet selectionSet = null; + IEnumIDs enumIDs = null; + IWorkspace ws = null; + IFeatureWorkspace ft_ws = null; + int n = 0, aux = 0, id = 0; + int[] ids=null; + IFeatureClass ftclass = null; + + //se cuenta el numero de filas (campos) que existen en la tabla. + try + { + if (ftclass_ == null) + { + ft_ws = abre_ftws(clase_path); + if (ft_ws == null) + return null; + ws = (IWorkspace)ft_ws; + ftclass = abre_ftclass(clase_path); + if (ftclass == null) + return null; + } + else + ftclass = ftclass_; + + filtro_lin = new QueryFilterClass(); + filtro_lin.WhereClause = consulta; + + //se hace una seleccion de todos los elementos que conforman la capa de entrada. + selectionSet = ftclass.Select(filtro_lin, esriSelectionType.esriSelectionTypeIDSet, + esriSelectionOption.esriSelectionOptionNormal, ws); + n = selectionSet.Count; + enumIDs = selectionSet.IDs; + //Tiene en enumIDS los objectid de los elementos que cumplen el filtro, lo pasa a un array de enteros + ids = new int[n]; + aux = 0; + id = enumIDs.Next(); + //se hace una rray de enteros conformado por los IDs + while (id != -1) //-1 es devuelto después del último ID válido de enumIDs(que es un array con los IDs de los elementos seleccionados) + { + ids[aux] = id; + aux++; + id = enumIDs.Next(); + } + return ids; + } + catch (Exception) + { + return null; + } + finally + { + libera(filtro_lin); + if (ftclass_ == null) + { + libera(selectionSet); + libera(ftclass); + } + } + } + + /** + * Devuelve los campos de una clase + */ + public static string[] dame_campos_clase(string clase_path, out int err) + { + ITable tabla; + IFields campos; + int ncampos; + string[] elems = null; + err = 0; + + tabla = FunGDB.dame_tabla_clase(clase_path); + if (tabla == null) + { + err = 1; + return null; + } + + try + { + campos = tabla.Fields; + ncampos = campos.FieldCount; + } + catch (Exception) + { + err = 2; + return null; + } + + if (ncampos <= 0) + { + err = 3; + return null; + } + elems = new string[ncampos]; + try + { + //se leen los campos de texto que contiene la capa para mostrarlos en la lista + for (int i = 0; i < ncampos; i++) + { + elems[i] = campos.get_Field(i).Name; + } + return elems; + } + catch (Exception) + { + err = 4; + return null; + } + finally + { + libera(tabla); + } + } + + /* + * Devuelve los atributos de un campo determinado de una tabla y se copian en un array string + */ + public static string[] dame_valores_consulta(string clase_path, string campo, string consulta, out int err) + { + int[] ids=null; + IRow row=null; + ITable tabla = null; + int n=0; + string[] valores = null; + err = 0; + + try + { + ids = dame_ids_consulta(clase_path, consulta); + if (ids == null) + { + err = 1; + return null; + } + + n = ids.Length; + if (n == 0) + { + err = 2; + return null; + } + + tabla = dame_tabla_clase(clase_path); + if (tabla == null) + { + err = 3; + return null; + } + + valores = new string[n]; + for (int i = 0; i < n; i++) + { + row = tabla.GetRow(ids[i]); + valores[i] = (row.get_Value(row.Fields.FindField(campo))).ToString(); + libera(row); + } + + + return valores; + } + catch (Exception) + { + err = 4; + return null; + } + finally + { + libera(tabla); + } + } + + /* + * Devuelve los valores únicos de un campo determinado de una tabla y se copian en un array string + */ + public static string[] dame_valunic_consulta(string clase_path, string campo, string consulta, out int err) + { + ITable tabla = null; + int n = 0; + string[] valores = null; + IDataStatistics dataStats = null; + ICursor cursor = null; + IEnumerator ienum=null; + object ob; + + err = 0; + + try + { + tabla = dame_tabla_clase(clase_path); + if (tabla == null) + { + err = 2; + return null; + } + + cursor = tabla.Search(null, false); + dataStats = new ESRI.ArcGIS.Geodatabase.DataStatisticsClass(); + dataStats.Field = campo; + dataStats.Cursor = cursor; + + ienum = dataStats.UniqueValues; + List val_list = new List(); + ienum.MoveNext(); + ob = ienum.Current; + while (ob!=null) + { + val_list.Add((string)ob); + ienum.MoveNext(); + ob = ienum.Current; + n++; + } + + if (n > 0) + { + valores = new string[n]; + val_list.CopyTo(valores, 0); + } + else + { + err = 3; + } + + return valores; + } + catch (Exception) + { + err = 4; + return null; + } + finally + { + libera(tabla); + libera(cursor); + } + } + + /** + * Libera el objeto + */ + public static IGeometry reproyecta(IGeometry geom, int coorsys = (int)esriSRProjCS4Type.esriSRProjCS_ETRS1989_UTM_Zone_30N) + { + + try + { + IGeometry geom_sal; + ISpatialReference spatialReference; + IProjectedCoordinateSystem coord_proy; + ISpatialReferenceFactory3 spatialReferenceFactory; + spatialReferenceFactory = (ISpatialReferenceFactory3)new SpatialReferenceEnvironment(); + coord_proy = spatialReferenceFactory.CreateProjectedCoordinateSystem(coorsys);//ETRS89_UTM30N 25830 + spatialReference = (ISpatialReference)coord_proy; + geom.Project(spatialReference); + geom_sal = geom; + return geom_sal; + } + catch + { + return null; + } + + } + + /* + * Devuelve la geometría de modificando las coordendas de geograficas a proyectadas WGS84 UTM 30 + */ + public static IGeometryDef dame_geom_coords(IFeatureClass fc, int coorsys = (int)esriSRProjCS4Type.esriSRProjCS_ETRS1989_UTM_Zone_30N)//ETRS89_UTM30N 25830 + { + int ind; + IFields campos; + ISpatialReferenceFactory3 spatialReferenceFactory; + ISpatialReference spatialReference; + String shapeFieldName; + IField shapeField; + IGeometryDef geom_def, dest_geom; + IClone geom_clon, dest_clon; + IGeometryDefEdit geom_edit; + 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; + + //se consigue la forma (shape) de la featureclass de interés + shapeFieldName = fc.ShapeFieldName; + ind = fc.FindField(shapeFieldName); + shapeField = campos.get_Field(ind); + //conseguir la geometria definida por el campo shape + geom_def = shapeField.GeometryDef; + geom_clon = (IClone)geom_def; + dest_clon = geom_clon.Clone(); + dest_geom = (IGeometryDef)dest_clon; + geom_edit = (IGeometryDefEdit)dest_geom; + /*if(geom_edit.SpatialReference.FactoryCode==0) + { + //si no tiene info de proyección, se le dice que viene de coorsys (utm30n) + ISpatialReferenceFactory3 spatialReferenceFactory_aux = (ISpatialReferenceFactory3)new SpatialReferenceEnvironment(); + IProjectedCoordinateSystem coord_proy_aux = spatialReferenceFactory.CreateProjectedCoordinateSystem(OliviaGlob.coorsys); + ISpatialReference spatialReference_aux = (ISpatialReference)coord_proy_aux; + geom_edit.SpatialReference_2 = spatialReference_aux; + }*/ + geom_edit.SpatialReference_2 = spatialReference;//se modifica el sistema de referencia de coordenadas al generado esriSRProjCS_WGS1984UTM_30N + } + catch (Exception) + { + return null; + } + + return dest_geom;//esta clase se pasará como argumento a la hora de la exportacion. De modo que realizará el cambio de coordendas oportuno + } + + /** + * Libera el objeto + */ + public static void libera(object ob) + { + if (ob != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(ob); + ob = null; + } + + /** + * Une las geometrías geom1 y geom2 + */ + public static IGeometry une_geoms(IGeometry geom1, IGeometry geom2) + { + ITopologicalOperator union; + IGeometry geom = null; + + try + { + if (geom1 != null) + { + union = (ITopologicalOperator)geom1; + //'union' contiene a geom1 + if (geom2 != null) + geom = union.Union(geom2); + else + geom = geom1; + } + else if (geom2 != null) + geom = geom2; + } + catch (Exception) + { + return null; + } + return geom; + } + + /** + * Realiza la intersección entre las dos geometrías que se pasan como argumentos. + * Le quita geom_quita a geom_tot + */ + public static IGeometry intersec_geoms(IGeometry geom1, IGeometry geom2) + { + ITopologicalOperator union; + IGeometry geom = null; + + try + { + if (geom1 != null) + { + union = (ITopologicalOperator)geom1; + //'union' contiene a geom1 + if (geom2 != null) + geom = union.Intersect(geom2, esriGeometryDimension.esriGeometry2Dimension); + else + geom = geom1; + } + else if (geom2 != null) + geom = geom2; + } + catch (Exception) + { + return null; + } + return geom; + } + + /** + * Realiza la diferencia simétrica entre las dos geometrías que se pasan como argumentos. + * Le quita geom_quita a geom_tot + */ + public static IGeometry diferencia_geoms(IGeometry geom_tot, IGeometry geom_quita) + { + ITopologicalOperator union; + IGeometry geom = null; + + try + { + if (geom_tot != null) + { + union = (ITopologicalOperator)geom_tot; + //'union' contiene a geom1 + if (geom_quita != null) + geom = union.Difference(geom_quita); + else + geom = geom_tot; + } + else if (geom_quita != null) + geom = geom_quita; + } + catch (Exception) + { + return null; + } + return geom; + } + + /** + * Forma el polígono que contiene los ámbitos para exportar, a partir de ahí la red navegable ampliando a un buffer + */ + public static IGeometry dame_geom_envelope(string path_clase) + { + + IFeatureClass capa; + IGeoDataset gds; + Polygon poli; + ISegmentCollection segcol; + IGeometry geom_envelope = null; + + try + { + capa = abre_ftclass(path_clase); + if (capa == null) + { + return null; + } + //castea la capa a IGeoDataset, de donde obtendrá el envelope + gds = (IGeoDataset)capa; + //crea un polígono partiendo del rectángulo envelope + poli = new PolygonClass(); + segcol = (ISegmentCollection)poli; + segcol.SetRectangle(gds.Extent); + + geom_envelope = (IGeometry)poli; + //libera + FunGDB.libera(capa); + + return geom_envelope; + } + catch + { + return null; + } + } + + /** + * Amplia la geom para que contenga el punto p + */ + public static IGeometry amplia_geom(IGeometry geom, double p_x, double p_y) + { + IEnvelope env = null; + IPoint[] points; + IPolygon poli = new PolygonClass(); + ISegmentCollection segcol; + + env = geom.Envelope; + points = new IPoint[5]; + + points[0] = env.LowerLeft; + points[1] = env.LowerRight; + points[2] = env.UpperLeft; + points[3] = env.UpperRight; + points[4] = new PointClass(); + points[4].PutCoords(p_x, p_y); + + IEnvelopeGEN envelopegen = new EnvelopeClass(); + + try + { + envelopegen.DefineFromPoints(ref points); + + poli = new PolygonClass(); + segcol = (ISegmentCollection)poli; + segcol.SetRectangle((IEnvelope)envelopegen); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + return null; + } + + geom = (IGeometry)poli; + + return geom; + } + + /* + * Añade a la capa de origen la columna que se pasa como argumento + */ + public static bool add_campo(string path_clase, string nombre_campo, esriFieldType tipo_campo, out int err) + { + IFeatureClass fc = null; + IFields oldFields = null, fields = null; + IClone clone_fuente = null, clone_dest = null; + IFieldsEdit fields_edit = null; + ITable tabla = null; + IField field = null; + IFieldEdit field_edit = null; + + err = 0; + + try + { + + fc = abre_ftclass(path_clase); + if (fc == null) + { + err = 1; + return false; + } + + oldFields = fc.Fields; + clone_fuente = (IClone)oldFields; + clone_dest = clone_fuente.Clone(); + fields = (IFields)clone_dest; + //se castea para poder enditar los campos de las tablas + fields_edit = (IFieldsEdit)fields; + tabla = dame_tabla_clase(path_clase); + if (tabla == null) + { + err = 2; + return false; + } + + if (tabla.FindField(nombre_campo) > 0) + { + err = 3; + return false; + } + + //se añade un campo entero + field = new FieldClass(); + field_edit = (IFieldEdit)field; + field_edit.Name_2 = nombre_campo; + field_edit.Type_2 = tipo_campo; + //string_field_edit.Length_2 = 100; + field_edit.Precision_2 = 38; + field_edit.Scale_2 = 0; + fc.AddField(field_edit); + + return true; + } + catch + { + return false; + } + finally + { + libera(fc); + libera(tabla); + } + } + + /* + * Exporta de la gdb src al shp dest + */ + public static bool exporta(string dir_gdb_src, string nom_src, string dir_shp_dest, string nom_dest, IQueryFilter filtro, out IDatasetName shp_data_name, out string err_st) + { + string name = ""; + IFeatureClassName shp_fcn = null; + IGeometryDef dest_geom = null; + ITable tabla = null; + int nfilas; + ESRI.ArcGIS.GeoDatabaseUI.IExportOperation exportOperation; + IFeatureClassName gdb_fcn; + IDatasetName gdb_dsn; + IWorkspaceName gdb_wsn; + + err_st = ""; + shp_data_name = null; + + //prepara el shp donde va a exportar + shp_fcn = FunGDB.crea_shp(dir_shp_dest, nom_dest); + if (shp_fcn == null) + { + err_st = "Error al crear el shape de exportación " + name; + return false; + } + + ///////////////////////////////////////////// + //obtiene la geomdef con las coordenadas proyectadas + IFeatureClass fc; + if (nom_src == null) + fc = abre_ftclass(dir_gdb_src); + else + fc = abre_ftclass(dir_gdb_src, nom_src); + if (fc == null) + return false; + + dest_geom = FunGDB.dame_geom_coords(fc, OliviaGlob.coorsys); + if (dest_geom == null) + { + err_st = "Error al generar el sistema de coordendas proyectadas en la capa " + nom_src; + return false; + } + FunGDB.libera(fc); + + //Inicia la gdb de donde va a exportar + gdb_wsn = FunGDB.abre_wsn(dir_gdb_src); + if (gdb_wsn == null) + { + err_st = "Error al abrir la gdb de exportación " + name; + return false; + } + + try + { + gdb_fcn = new FeatureClassNameClass(); + gdb_dsn = (IDatasetName)gdb_fcn; + if (nom_src == null) + gdb_dsn.Name = System.IO.Path.GetFileNameWithoutExtension(dir_gdb_src); + else + gdb_dsn.Name = nom_src; + gdb_dsn.WorkspaceName = (IWorkspaceName)gdb_wsn; + + //Se prepara para exportar + if (nom_src == null) + tabla = FunGDB.dame_tabla_clase(dir_gdb_src); + else + tabla = FunGDB.dame_tabla_clase(dir_gdb_src, nom_src); + if (tabla == null) + { + err_st = "Error al abrir la tabla de exportación " + name; + return false; + } + nfilas = tabla.RowCount(filtro); + if (nfilas <= 0) + { + err_st = string.Format("No hay elementos que cumplan la condición y se encuentren en el nivel y en la zona seleccionados"); + return false; + } + //se prepara la exportación + exportOperation = new ESRI.ArcGIS.GeoDatabaseUI.ExportOperationClass(); + exportOperation.ExportFeatureClass(gdb_dsn, filtro, null, dest_geom, shp_fcn, 0); + } + catch (Exception) + { + err_st = "Error al exportar el ámbito de trabajo con los datos introducidos"; + return false; + } + finally + { + FunGDB.libera(tabla); + } + + shp_data_name = (IDatasetName)shp_fcn; + return true; + } + + /* + * Devuelve las coordenadas de la feature class + */ + public static int dame_factory_code(string dir_gdb_src, string nom_src) + { + IFeatureClass fc; + int coor = -1; + + if (nom_src == null) + fc = abre_ftclass(dir_gdb_src); + else + fc = abre_ftclass(dir_gdb_src, nom_src); + if (fc == null) + return coor; + + coor = ((IGeoDataset)fc).SpatialReference.FactoryCode; + + FunGDB.libera(fc); + + return coor; + } + + /* + * Devuelve los atributos de un campo determinado de una tabla y se copian en un array string + */ + public static bool quita_filas(string shp_path, List ids_filas) + { + ITable tabla = null; + IRow row = null; + try + { + //borra las líneas que se han indicado + int offset = 0; + + tabla = FunGDB.dame_tabla_clase(shp_path); + if (tabla == null) + return false; + for (int j = 0; j < ids_filas.Count; j++) + { + row = tabla.GetRow(ids_filas[j] - offset); //offset porque según va borrando se van desplazando las filas. + row.Delete(); + offset++; + FunGDB.libera(row); + } + } + catch + { + return false; + } + finally + { + FunGDB.libera(tabla); + FunGDB.libera(row); + } + return true; + } + + /** + * Indica si el punto está en el polígono de la geometría + */ + public static bool is_pto_in_geom(double x, double y, IGeometry geom_poly) + { + Point punto_ins = new Point(); + IGeometry geom_ins, geom; + ITopologicalOperator union; + + try + { + punto_ins.PutCoords(x, y); + geom_ins = (IGeometry)punto_ins; + union = (ITopologicalOperator)geom_poly; + geom = union.Intersect(geom_ins, esriGeometryDimension.esriGeometry0Dimension); + + if (!geom.IsEmpty) + { + return true; + } + return false; + } + catch + { + return false; + } + } + + /** + * Borra la ftclass de la gdb para poder sobreescribir + */ + public static bool borra_ftclass(string path_gdb, string ftclass_nomb) + { + IWorkspace2 ws_gdb_; + IFeatureWorkspace fws; + IDataset data_delete; + + ws_gdb_ = (IWorkspace2)FunGDB.abre_ws(path_gdb); + if (ws_gdb_ == null) + return false; + fws = (IFeatureWorkspace)ws_gdb_; + + if (!ws_gdb_.get_NameExists(esriDatasetType.esriDTFeatureClass, ftclass_nomb)) + return true;//no existe, no hay nada que borrar + + data_delete = (IDataset)fws.OpenFeatureClass(ftclass_nomb); + if ((data_delete != null) && data_delete.CanDelete()) + { + try + { + data_delete.Delete(); + } + catch + { + return false; + } + } + else + { + return false; + } + return true; + } + + /** + *Crea el feature dataset + */ + public static bool crea_ftdataset(string path_gdb, string dataset_nomb, ISpatialReference spref) + { + IWorkspace2 ws_gdb_; + IFeatureWorkspace fws; + IFeatureDataset ft_dataset=null; + + try + { + + ws_gdb_ = (IWorkspace2)FunGDB.abre_ws(path_gdb); + if (ws_gdb_ == null) + return false; + fws = (IFeatureWorkspace)ws_gdb_; + + if (ws_gdb_.get_NameExists(esriDatasetType.esriDTFeatureDataset, dataset_nomb)) + return true;//existe, no hay nada que crear + + ft_dataset = fws.CreateFeatureDataset(dataset_nomb, spref); + if (ft_dataset == null) + { + return false; + } + return true; + } + catch + { + return false; + } + } + + /** + * Indica si la capa contiene puntuales + */ + public static bool is_ftclass_punt(IFeatureClass clase) + { + return clase.ShapeType == esriGeometryType.esriGeometryPoint || + clase.ShapeType == esriGeometryType.esriGeometryMultipoint; + } + + /** + * Indica si la capa contiene superficiales + */ + public static bool is_ftclass_sup(IFeatureClass clase) + { + return clase.ShapeType == esriGeometryType.esriGeometryPolygon; + } + + /** + * Indica si la capa contiene lineales + */ + public static bool is_ftclass_lin(IFeatureClass clase) + { + return clase.ShapeType == esriGeometryType.esriGeometryPolyline; + } + + /** + * Indica si el campo es string + */ + public static bool is_str_field(string clase_path,string campo) + { + int ind=-1; + ITable tabla = dame_tabla_clase(clase_path); + if(tabla!=null) + ind=tabla.FindField(campo); + if (ind >= 0) + return tabla.Fields.get_Field(ind).Type == esriFieldType.esriFieldTypeString; + else + return false; + } + + } + + +} diff --git a/OliviaAddIn/Images/Asset-tracking-and-management.png b/OliviaAddIn/Images/Asset-tracking-and-management.png new file mode 100644 index 0000000..912f215 Binary files /dev/null and b/OliviaAddIn/Images/Asset-tracking-and-management.png differ diff --git a/OliviaAddIn/Images/ButtonInicio.png b/OliviaAddIn/Images/ButtonInicio.png new file mode 100644 index 0000000..89a857a Binary files /dev/null and b/OliviaAddIn/Images/ButtonInicio.png differ diff --git a/OliviaAddIn/Images/CLEANAIR-5-front.png b/OliviaAddIn/Images/CLEANAIR-5-front.png new file mode 100644 index 0000000..7e597fe Binary files /dev/null and b/OliviaAddIn/Images/CLEANAIR-5-front.png differ diff --git a/OliviaAddIn/Images/Map.png b/OliviaAddIn/Images/Map.png new file mode 100644 index 0000000..d0cee67 Binary files /dev/null and b/OliviaAddIn/Images/Map.png differ diff --git a/OliviaAddIn/Images/Map2.png b/OliviaAddIn/Images/Map2.png new file mode 100644 index 0000000..d71a8b2 Binary files /dev/null and b/OliviaAddIn/Images/Map2.png differ diff --git a/OliviaAddIn/Images/Wooden-Map.png b/OliviaAddIn/Images/Wooden-Map.png new file mode 100644 index 0000000..8c699a3 Binary files /dev/null and b/OliviaAddIn/Images/Wooden-Map.png differ diff --git a/OliviaAddIn/Images/areas.gif b/OliviaAddIn/Images/areas.gif new file mode 100644 index 0000000..d3f2037 Binary files /dev/null and b/OliviaAddIn/Images/areas.gif differ diff --git a/OliviaAddIn/Images/back.png b/OliviaAddIn/Images/back.png new file mode 100644 index 0000000..5ac9abf Binary files /dev/null and b/OliviaAddIn/Images/back.png differ diff --git a/OliviaAddIn/Images/barridomec.gif b/OliviaAddIn/Images/barridomec.gif new file mode 100644 index 0000000..fc5ef2a Binary files /dev/null and b/OliviaAddIn/Images/barridomec.gif differ diff --git a/OliviaAddIn/Images/camion-de-basura-tsr-6000.png b/OliviaAddIn/Images/camion-de-basura-tsr-6000.png new file mode 100644 index 0000000..fceb0ec Binary files /dev/null and b/OliviaAddIn/Images/camion-de-basura-tsr-6000.png differ diff --git a/OliviaAddIn/Images/carrito.png b/OliviaAddIn/Images/carrito.png new file mode 100644 index 0000000..73ac8da Binary files /dev/null and b/OliviaAddIn/Images/carrito.png differ diff --git a/OliviaAddIn/Images/clock.png b/OliviaAddIn/Images/clock.png new file mode 100644 index 0000000..013779b Binary files /dev/null and b/OliviaAddIn/Images/clock.png differ diff --git a/OliviaAddIn/Images/contenedor.png b/OliviaAddIn/Images/contenedor.png new file mode 100644 index 0000000..765af6d Binary files /dev/null and b/OliviaAddIn/Images/contenedor.png differ diff --git a/OliviaAddIn/Images/document-open-data.png b/OliviaAddIn/Images/document-open-data.png new file mode 100644 index 0000000..69685ba Binary files /dev/null and b/OliviaAddIn/Images/document-open-data.png differ diff --git a/OliviaAddIn/Images/documentinfo.png b/OliviaAddIn/Images/documentinfo.png new file mode 100644 index 0000000..f6af9f8 Binary files /dev/null and b/OliviaAddIn/Images/documentinfo.png differ diff --git a/OliviaAddIn/Images/electrical_sensor1600.png b/OliviaAddIn/Images/electrical_sensor1600.png new file mode 100644 index 0000000..41d4033 Binary files /dev/null and b/OliviaAddIn/Images/electrical_sensor1600.png differ diff --git a/OliviaAddIn/Images/favicon.ico b/OliviaAddIn/Images/favicon.ico new file mode 100644 index 0000000..df53e93 Binary files /dev/null and b/OliviaAddIn/Images/favicon.ico differ diff --git a/OliviaAddIn/Images/folder-gdb.png b/OliviaAddIn/Images/folder-gdb.png new file mode 100644 index 0000000..4c84231 Binary files /dev/null and b/OliviaAddIn/Images/folder-gdb.png differ diff --git a/OliviaAddIn/Images/folder-important.png b/OliviaAddIn/Images/folder-important.png new file mode 100644 index 0000000..90994c2 Binary files /dev/null and b/OliviaAddIn/Images/folder-important.png differ diff --git a/OliviaAddIn/Images/folder-nw.png b/OliviaAddIn/Images/folder-nw.png new file mode 100644 index 0000000..3b4eb45 Binary files /dev/null and b/OliviaAddIn/Images/folder-nw.png differ diff --git a/OliviaAddIn/Images/garden.png b/OliviaAddIn/Images/garden.png new file mode 100644 index 0000000..c879160 Binary files /dev/null and b/OliviaAddIn/Images/garden.png differ diff --git a/OliviaAddIn/Images/mapa.jpg b/OliviaAddIn/Images/mapa.jpg new file mode 100644 index 0000000..b8bde0c Binary files /dev/null and b/OliviaAddIn/Images/mapa.jpg differ diff --git a/OliviaAddIn/Images/parquimetro.png b/OliviaAddIn/Images/parquimetro.png new file mode 100644 index 0000000..c22a2b2 Binary files /dev/null and b/OliviaAddIn/Images/parquimetro.png differ diff --git a/OliviaAddIn/Images/plan.png b/OliviaAddIn/Images/plan.png new file mode 100644 index 0000000..bac028b Binary files /dev/null and b/OliviaAddIn/Images/plan.png differ diff --git a/OliviaAddIn/Images/play.png b/OliviaAddIn/Images/play.png new file mode 100644 index 0000000..f04ee9d Binary files /dev/null and b/OliviaAddIn/Images/play.png differ diff --git a/OliviaAddIn/Images/resorig/119_control.png b/OliviaAddIn/Images/resorig/119_control.png new file mode 100644 index 0000000..374a73e Binary files /dev/null and b/OliviaAddIn/Images/resorig/119_control.png differ diff --git a/OliviaAddIn/Images/resorig/Asset-tracking-and-management.png b/OliviaAddIn/Images/resorig/Asset-tracking-and-management.png new file mode 100644 index 0000000..912f215 Binary files /dev/null and b/OliviaAddIn/Images/resorig/Asset-tracking-and-management.png differ diff --git a/OliviaAddIn/Images/resorig/ButtonInicio.png b/OliviaAddIn/Images/resorig/ButtonInicio.png new file mode 100644 index 0000000..89a857a Binary files /dev/null and b/OliviaAddIn/Images/resorig/ButtonInicio.png differ diff --git a/OliviaAddIn/Images/resorig/CLEANAIR-5-front.png b/OliviaAddIn/Images/resorig/CLEANAIR-5-front.png new file mode 100644 index 0000000..7e597fe Binary files /dev/null and b/OliviaAddIn/Images/resorig/CLEANAIR-5-front.png differ diff --git a/OliviaAddIn/Images/resorig/Map.png b/OliviaAddIn/Images/resorig/Map.png new file mode 100644 index 0000000..d0cee67 Binary files /dev/null and b/OliviaAddIn/Images/resorig/Map.png differ diff --git a/OliviaAddIn/Images/resorig/Map2.png b/OliviaAddIn/Images/resorig/Map2.png new file mode 100644 index 0000000..d71a8b2 Binary files /dev/null and b/OliviaAddIn/Images/resorig/Map2.png differ diff --git a/OliviaAddIn/Images/resorig/Wooden-Map.png b/OliviaAddIn/Images/resorig/Wooden-Map.png new file mode 100644 index 0000000..8c699a3 Binary files /dev/null and b/OliviaAddIn/Images/resorig/Wooden-Map.png differ diff --git a/OliviaAddIn/Images/resorig/area.png b/OliviaAddIn/Images/resorig/area.png new file mode 100644 index 0000000..82f63c8 Binary files /dev/null and b/OliviaAddIn/Images/resorig/area.png differ diff --git a/OliviaAddIn/Images/resorig/back.png b/OliviaAddIn/Images/resorig/back.png new file mode 100644 index 0000000..195bd73 Binary files /dev/null and b/OliviaAddIn/Images/resorig/back.png differ diff --git a/OliviaAddIn/Images/resorig/barridomec.png b/OliviaAddIn/Images/resorig/barridomec.png new file mode 100644 index 0000000..2c4eddd Binary files /dev/null and b/OliviaAddIn/Images/resorig/barridomec.png differ diff --git a/OliviaAddIn/Images/resorig/camion-de-basura-tsr-6000.png b/OliviaAddIn/Images/resorig/camion-de-basura-tsr-6000.png new file mode 100644 index 0000000..fceb0ec Binary files /dev/null and b/OliviaAddIn/Images/resorig/camion-de-basura-tsr-6000.png differ diff --git a/OliviaAddIn/Images/resorig/carrito.png b/OliviaAddIn/Images/resorig/carrito.png new file mode 100644 index 0000000..a6562a2 Binary files /dev/null and b/OliviaAddIn/Images/resorig/carrito.png differ diff --git a/OliviaAddIn/Images/resorig/clean.png b/OliviaAddIn/Images/resorig/clean.png new file mode 100644 index 0000000..c06ba90 Binary files /dev/null and b/OliviaAddIn/Images/resorig/clean.png differ diff --git a/OliviaAddIn/Images/resorig/clock.png b/OliviaAddIn/Images/resorig/clock.png new file mode 100644 index 0000000..013779b Binary files /dev/null and b/OliviaAddIn/Images/resorig/clock.png differ diff --git a/OliviaAddIn/Images/resorig/configure.png b/OliviaAddIn/Images/resorig/configure.png new file mode 100644 index 0000000..71deb5a Binary files /dev/null and b/OliviaAddIn/Images/resorig/configure.png differ diff --git a/OliviaAddIn/Images/resorig/contenedor.png b/OliviaAddIn/Images/resorig/contenedor.png new file mode 100644 index 0000000..0e261b2 Binary files /dev/null and b/OliviaAddIn/Images/resorig/contenedor.png differ diff --git a/OliviaAddIn/Images/resorig/dialog-cancel.png b/OliviaAddIn/Images/resorig/dialog-cancel.png new file mode 100644 index 0000000..45f8949 Binary files /dev/null and b/OliviaAddIn/Images/resorig/dialog-cancel.png differ diff --git a/OliviaAddIn/Images/resorig/document-open-data.png b/OliviaAddIn/Images/resorig/document-open-data.png new file mode 100644 index 0000000..69685ba Binary files /dev/null and b/OliviaAddIn/Images/resorig/document-open-data.png differ diff --git a/OliviaAddIn/Images/resorig/documentinfo.png b/OliviaAddIn/Images/resorig/documentinfo.png new file mode 100644 index 0000000..f6af9f8 Binary files /dev/null and b/OliviaAddIn/Images/resorig/documentinfo.png differ diff --git a/OliviaAddIn/Images/resorig/electrical_sensor1600.png b/OliviaAddIn/Images/resorig/electrical_sensor1600.png new file mode 100644 index 0000000..41d4033 Binary files /dev/null and b/OliviaAddIn/Images/resorig/electrical_sensor1600.png differ diff --git a/OliviaAddIn/Images/resorig/favicon.ico b/OliviaAddIn/Images/resorig/favicon.ico new file mode 100644 index 0000000..df53e93 Binary files /dev/null and b/OliviaAddIn/Images/resorig/favicon.ico differ diff --git a/OliviaAddIn/Images/resorig/folder-important.png b/OliviaAddIn/Images/resorig/folder-important.png new file mode 100644 index 0000000..90994c2 Binary files /dev/null and b/OliviaAddIn/Images/resorig/folder-important.png differ diff --git a/OliviaAddIn/Images/resorig/folder-remote.png b/OliviaAddIn/Images/resorig/folder-remote.png new file mode 100644 index 0000000..4c84231 Binary files /dev/null and b/OliviaAddIn/Images/resorig/folder-remote.png differ diff --git a/OliviaAddIn/Images/resorig/folder-virtualbox.png b/OliviaAddIn/Images/resorig/folder-virtualbox.png new file mode 100644 index 0000000..3b4eb45 Binary files /dev/null and b/OliviaAddIn/Images/resorig/folder-virtualbox.png differ diff --git a/OliviaAddIn/Images/resorig/garden.png b/OliviaAddIn/Images/resorig/garden.png new file mode 100644 index 0000000..790c1bd Binary files /dev/null and b/OliviaAddIn/Images/resorig/garden.png differ diff --git a/OliviaAddIn/Images/resorig/green_area.ico b/OliviaAddIn/Images/resorig/green_area.ico new file mode 100644 index 0000000..e244ddb Binary files /dev/null and b/OliviaAddIn/Images/resorig/green_area.ico differ diff --git a/OliviaAddIn/Images/resorig/icon-help.png b/OliviaAddIn/Images/resorig/icon-help.png new file mode 100644 index 0000000..11b2dd0 Binary files /dev/null and b/OliviaAddIn/Images/resorig/icon-help.png differ diff --git a/OliviaAddIn/Images/resorig/mapa.jpg b/OliviaAddIn/Images/resorig/mapa.jpg new file mode 100644 index 0000000..b8bde0c Binary files /dev/null and b/OliviaAddIn/Images/resorig/mapa.jpg differ diff --git a/OliviaAddIn/Images/resorig/niveles.png b/OliviaAddIn/Images/resorig/niveles.png new file mode 100644 index 0000000..07cf2bf Binary files /dev/null and b/OliviaAddIn/Images/resorig/niveles.png differ diff --git a/OliviaAddIn/Images/resorig/parquimetro.png b/OliviaAddIn/Images/resorig/parquimetro.png new file mode 100644 index 0000000..3159bfb Binary files /dev/null and b/OliviaAddIn/Images/resorig/parquimetro.png differ diff --git a/OliviaAddIn/Images/resorig/plan.png b/OliviaAddIn/Images/resorig/plan.png new file mode 100644 index 0000000..bac028b Binary files /dev/null and b/OliviaAddIn/Images/resorig/plan.png differ diff --git a/OliviaAddIn/Images/resorig/play.png b/OliviaAddIn/Images/resorig/play.png new file mode 100644 index 0000000..f04ee9d Binary files /dev/null and b/OliviaAddIn/Images/resorig/play.png differ diff --git a/OliviaAddIn/Images/resorig/road_sweeper.ico b/OliviaAddIn/Images/resorig/road_sweeper.ico new file mode 100644 index 0000000..f40d9f2 Binary files /dev/null and b/OliviaAddIn/Images/resorig/road_sweeper.ico differ diff --git a/OliviaAddIn/Images/resorig/run-build-clean.png b/OliviaAddIn/Images/resorig/run-build-clean.png new file mode 100644 index 0000000..589986f Binary files /dev/null and b/OliviaAddIn/Images/resorig/run-build-clean.png differ diff --git a/OliviaAddIn/Images/resorig/sand.png b/OliviaAddIn/Images/resorig/sand.png new file mode 100644 index 0000000..f7157dc Binary files /dev/null and b/OliviaAddIn/Images/resorig/sand.png differ diff --git a/OliviaAddIn/Images/resorig/save.png b/OliviaAddIn/Images/resorig/save.png new file mode 100644 index 0000000..8072aea Binary files /dev/null and b/OliviaAddIn/Images/resorig/save.png differ diff --git a/OliviaAddIn/Images/resorig/user-busy.png b/OliviaAddIn/Images/resorig/user-busy.png new file mode 100644 index 0000000..cdcf944 Binary files /dev/null and b/OliviaAddIn/Images/resorig/user-busy.png differ diff --git a/OliviaAddIn/Images/restr.png b/OliviaAddIn/Images/restr.png new file mode 100644 index 0000000..45f8949 Binary files /dev/null and b/OliviaAddIn/Images/restr.png differ diff --git a/OliviaAddIn/Images/restricc.png b/OliviaAddIn/Images/restricc.png new file mode 100644 index 0000000..cdcf944 Binary files /dev/null and b/OliviaAddIn/Images/restricc.png differ diff --git a/OliviaAddIn/Images/sand.png b/OliviaAddIn/Images/sand.png new file mode 100644 index 0000000..f7157dc Binary files /dev/null and b/OliviaAddIn/Images/sand.png differ diff --git a/OliviaAddIn/Images/save.png b/OliviaAddIn/Images/save.png new file mode 100644 index 0000000..8072aea Binary files /dev/null and b/OliviaAddIn/Images/save.png differ diff --git a/OliviaAddIn/Images/system-help.png b/OliviaAddIn/Images/system-help.png new file mode 100644 index 0000000..75ebaf7 Binary files /dev/null and b/OliviaAddIn/Images/system-help.png differ diff --git a/OliviaAddIn/InicioDlg.Designer.cs b/OliviaAddIn/InicioDlg.Designer.cs new file mode 100644 index 0000000..687f08e --- /dev/null +++ b/OliviaAddIn/InicioDlg.Designer.cs @@ -0,0 +1,158 @@ +namespace OliviaAddIn +{ + partial class InicioDlg + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InicioDlg)); + this.button_maqueta = new System.Windows.Forms.Button(); + this.button_resi = new System.Windows.Forms.Button(); + this.button_limp = new System.Windows.Forms.Button(); + this.button_gdb = new System.Windows.Forms.Button(); + this.button_nw = new System.Windows.Forms.Button(); + this.btn_help = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // button_maqueta + // + this.button_maqueta.Font = new System.Drawing.Font("Calibri", 10F); + this.button_maqueta.Image = global::OliviaAddIn.Properties.Resources.Wooden_Map; + this.button_maqueta.Location = new System.Drawing.Point(445, 33); + this.button_maqueta.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button_maqueta.Name = "button_maqueta"; + this.button_maqueta.Size = new System.Drawing.Size(165, 85); + this.button_maqueta.TabIndex = 6; + this.button_maqueta.Text = "Maquetación de Datos"; + this.button_maqueta.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.button_maqueta.UseVisualStyleBackColor = true; + this.button_maqueta.Click += new System.EventHandler(this.button_maqueta_Click); + // + // button_resi + // + this.button_resi.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.button_resi.Image = global::OliviaAddIn.Properties.Resources.contenedor; + this.button_resi.Location = new System.Drawing.Point(229, 33); + this.button_resi.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button_resi.Name = "button_resi"; + this.button_resi.Size = new System.Drawing.Size(165, 85); + this.button_resi.TabIndex = 1; + this.button_resi.Text = "Recogida de Residuos "; + this.button_resi.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.button_resi.UseVisualStyleBackColor = true; + this.button_resi.Click += new System.EventHandler(this.button_resi_Click); + // + // button_limp + // + this.button_limp.BackColor = System.Drawing.SystemColors.Control; + this.button_limp.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.button_limp.Image = global::OliviaAddIn.Properties.Resources.carrito; + this.button_limp.Location = new System.Drawing.Point(14, 33); + this.button_limp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button_limp.Name = "button_limp"; + this.button_limp.Size = new System.Drawing.Size(165, 85); + this.button_limp.TabIndex = 0; + this.button_limp.Text = "Limpieza Viaria"; + this.button_limp.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.button_limp.UseVisualStyleBackColor = true; + this.button_limp.Click += new System.EventHandler(this.button_limp_Click); + // + // button_gdb + // + this.button_gdb.AutoSize = true; + this.button_gdb.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.button_gdb.Image = global::OliviaAddIn.Properties.Resources.folder_gdb; + this.button_gdb.Location = new System.Drawing.Point(14, 133); + this.button_gdb.Name = "button_gdb"; + this.button_gdb.Size = new System.Drawing.Size(115, 23); + this.button_gdb.TabIndex = 7; + this.button_gdb.Text = "Seleccionar GDB"; + this.button_gdb.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.button_gdb.UseVisualStyleBackColor = true; + this.button_gdb.Click += new System.EventHandler(this.button_gdb_Click); + // + // button_nw + // + this.button_nw.AutoSize = true; + this.button_nw.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.button_nw.Image = global::OliviaAddIn.Properties.Resources.folder_nw; + this.button_nw.Location = new System.Drawing.Point(14, 165); + this.button_nw.Name = "button_nw"; + this.button_nw.Size = new System.Drawing.Size(114, 23); + this.button_nw.TabIndex = 8; + this.button_nw.Text = "Seleccionar NW "; + this.button_nw.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.button_nw.UseVisualStyleBackColor = true; + this.button_nw.Click += new System.EventHandler(this.button_nw_Click); + // + // btn_help + // + this.btn_help.Image = global::OliviaAddIn.Properties.Resources.system_help; + this.btn_help.Location = new System.Drawing.Point(581, 165); + this.btn_help.Name = "btn_help"; + this.btn_help.Size = new System.Drawing.Size(29, 23); + this.btn_help.TabIndex = 9; + this.btn_help.UseVisualStyleBackColor = true; + this.btn_help.Click += new System.EventHandler(this.btn_help_Click); + // + // InicioDlg + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.Control; + this.ClientSize = new System.Drawing.Size(627, 200); + this.Controls.Add(this.btn_help); + this.Controls.Add(this.button_nw); + this.Controls.Add(this.button_gdb); + this.Controls.Add(this.button_maqueta); + this.Controls.Add(this.button_resi); + this.Controls.Add(this.button_limp); + this.Cursor = System.Windows.Forms.Cursors.Default; + this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.MaximizeBox = false; + this.Name = "InicioDlg"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "OLIVIA | Inicio"; + this.TopMost = true; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.InicioDlg_FormClosed); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button_limp; + private System.Windows.Forms.Button button_resi; + private System.Windows.Forms.Button button_maqueta; + private System.Windows.Forms.Button button_gdb; + private System.Windows.Forms.Button button_nw; + private System.Windows.Forms.Button btn_help; + } +} \ No newline at end of file diff --git a/OliviaAddIn/InicioDlg.cs b/OliviaAddIn/InicioDlg.cs new file mode 100644 index 0000000..ddabbb2 --- /dev/null +++ b/OliviaAddIn/InicioDlg.cs @@ -0,0 +1,312 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +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; +using System.IO; +using ESRI.ArcGIS.Carto; +using ESRI.ArcGIS.Controls; +using ESRI.ArcGIS.Display; +using ESRI.ArcGIS.ADF.COMSupport; +using ESRI.ArcGIS.ADF; +using ESRI.ArcGIS.esriSystem; + +using System.Runtime.InteropServices; +using ESRI.ArcGIS.DataSourcesFile; +using System.Diagnostics; + + +namespace OliviaAddIn +{ + /** + * @file InicioDlg.cs + * Clase de la ventana inicial de OLIVIA. + * Contiene el manejo de sus eventos como el Click o la actualización de su estado. + */ + /** + * Clase de la ventana inicial de OLIVIA. + * Contiene el manejo de sus eventos como el Click o la actualización de su estado. + */ + public partial class InicioDlg : Form + { + //Variables + /** + * Texto para cuando no se ha seleccionado GDB + */ + string text_selec_gdb = "Seleccionar GDB"; + /** + * Texto para cuando sí se ha seleccionado GDB + */ + string text_si_gdb = "GDB : "; + /** + * Texto para cuando no se ha seleccionado nw + */ + string text_selec_nw = "Seleccionar NW "; + /** + * Texto para cuando sí se ha seleccionado nw + */ + string text_si_nw = "Red Navegable : "; + /** + * Ventana de configuración de la limpieza viaria + */ + public LimpiezaDlg lim = null; + /** + * Ventana de configuración de la recogida de residuos + */ + public RecogidaDlg reco = null; + //************************************************************************************* + //Métodos + public InicioDlg() + { + try + { + Application.EnableVisualStyles(); + InitializeComponent(); + enable_buttons(false); + + if (!Directory.Exists(OliviaGlob.Paths.PathGdbGen)) + OliviaGlob.Paths.PathGdbGen = null; + if (!Directory.Exists(OliviaGlob.Paths.PathGdbNw)) + OliviaGlob.Paths.PathGdbNw = null; + + //si lee el archivo de configuracion y ya tiene paths asignados a las GDBs lo pone en los botones + if (OliviaGlob.Paths.PathGdbGen != null) + { + pon_text_bt_gdb(); + } + if (OliviaGlob.Paths.PathGdbNw != null) + { + pon_text_bt_nw(); + } + + if (OliviaGlob.demo_id) + { + Point pto; + + //si es modo demo para i+D, se quitan los botones menos el de limpieza y el de recogida + pto = button_gdb.Location; + pto.Y = pto.Y + button_gdb.Height; + button_nw.Location = pto; + Height = Height + button_nw.Height * 2; + Width = Width + 100; + } + } + catch (Exception) + { + MessageBox.Show("Error al iniciar la ventana de Inicio", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void enable_buttons(bool en, bool gdb_tambien=false) + { + button_limp.Enabled = button_resi.Enabled = button_maqueta.Enabled = en; + if (gdb_tambien) + { + button_gdb.Enabled = en; + button_nw.Enabled = en; + } + } + + //************************************************************************************* + //Eventos de elementos de la ventana + private void button_limp_Click(object sender, EventArgs e) + { + try + { + enable_buttons(false, true); + OliviaGlob.gdb_limp = new DatosGDBLimp(); + OliviaGlob.gdb = (DatosGDB)OliviaGlob.gdb_limp; + + //abre la ventana de configuración de limpieza + lim = new LimpiezaDlg(); + Hide(); + enable_buttons(true, true); + string err_str = ""; + if (!OliviaGlob.guarda_ini_gen(out err_str)) + { + MessageBox.Show(err_str, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + Close(); + return; + } + lim.Show(); + } + catch (Exception) + { + MessageBox.Show("Error al iniciar la ventana de Limpieza", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void button_resi_Click(object sender, EventArgs e) + { + try + { + enable_buttons(false, true); + OliviaGlob.gdb_reco = new DatosGDBReco(); + OliviaGlob.gdb = (DatosGDB)OliviaGlob.gdb_reco; + + //abre la ventana de configuración de recogida + reco = new RecogidaDlg(); + Hide(); + enable_buttons(true, true); + string err_str = ""; + if (!OliviaGlob.guarda_ini_gen(out err_str)) + { + MessageBox.Show(err_str, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + Close(); + return; + } + reco.Show(); + } + catch (Exception) + { + MessageBox.Show("Error al iniciar la ventana de Recogida", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void InicioDlg_FormClosed(object sender, FormClosedEventArgs e) + { + OliviaGlob.ya_open_app = false; + if (OliviaGlob.demo_id) + return; + //borra los archivos al terminar... + OliviaGlob.borra_files(); + } + + private void button_maqueta_Click(object sender, EventArgs e) + { + try + { + Hide(); + OliviaGlob.gdb = new DatosGDB(); + if (!OliviaGlob.mapa.maqueta(this.Handle)) + { + MessageBox.Show(OliviaGlob.mapa.err_str, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + Close(); + return; + } + Close();//cierro el dialogo de inicio + } + catch (Exception) + { + MessageBox.Show("Error al iniciar la ventana de Maquetación", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + /** + * Permite seleccionar una GDB que contenga los ámbitos sobre los que se realizará la sectorización. + */ + private void button_gdb_Click(object sender, EventArgs e) + { + IWorkspace ws = null; + try + { + string text_reint = "¿Desea cancelar el proceso?"; + ws = FunGDB.selec_gdb("Seleccionar GDB de trabajo", this.Handle.ToInt32(), text_reint); + if (ws != null) + { + //pone path y quita bordes e imagen + OliviaGlob.Paths.PathGdbGen = ws.PathName; + pon_text_bt_gdb(); + } + else + { + //quita path y pone bordes e imagen + button_gdb.Text = text_selec_gdb; + button_gdb.Image = global::OliviaAddIn.Properties.Resources.folder_gdb; + enable_buttons(false); + } + } + catch (Exception) + { + return; + } + } + + /** + * Permite seleccionar una GDB que contenga la red navegable sobre la que se realizará el cálculo de rutas óptimas. + */ + private void button_nw_Click(object sender, EventArgs e) + { + IWorkspace ws = null; + try + { + string text_reint = "¿Desea cancelar el proceso?"; + ws = FunGDB.selec_gdb("Seleccionar la red navegable", this.Handle.ToInt32(), text_reint); + if (ws != null) + { + //pone path y quita bordes e imagen + OliviaGlob.Paths.PathGdbNw = ws.PathName; + pon_text_bt_nw(); + } + else + { + //quita path y pone bordes e imagen + button_nw.Text = text_selec_nw; + button_nw.Image = global::OliviaAddIn.Properties.Resources.folder_nw; + enable_buttons(false); + } + } + catch (Exception) + { + return; + } + } + + /*private void InicioDlg_VisibleChanged(object sender, EventArgs e) + { + int a = 5; + }*/ + + /** + * Cuando se picnha en el botón de ayuda se abre el manual de Olivia + */ + private void btn_help_Click(object sender, EventArgs e) + { + string[] archivos = null; + + try + { + archivos = Directory.GetFiles(OliviaGlob.Paths.PathWork, OliviaGlob.manual + ".pdf"); + if (archivos.Length <= 0) + MessageBox.Show("No se encuentra el archivo " + OliviaGlob.manual + ".pdf en la ubicación " + OliviaGlob.Paths.PathWork, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + + foreach (string f in archivos) + { + Process.Start(f); + } + } + catch (Exception) + { + MessageBox.Show("Error al abrir el manual de ayuda " + OliviaGlob.manual + ".pdf", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void pon_text_bt_gdb() + { + button_gdb.Text = text_si_gdb + OliviaGlob.Paths.PathGdbGen; + button_gdb.Image = null; + if (button_nw.Text != text_selec_nw) + enable_buttons(true); + } + + private void pon_text_bt_nw() + { + button_nw.Text = text_si_nw + OliviaGlob.Paths.PathGdbNw; + button_nw.Image = null; + if (button_gdb.Text != text_selec_gdb) + enable_buttons(true); + } + } +} diff --git a/OliviaAddIn/InicioDlg.resx b/OliviaAddIn/InicioDlg.resx new file mode 100644 index 0000000..1bb292f --- /dev/null +++ b/OliviaAddIn/InicioDlg.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA + AAD///8B////Af///wH///8BOoFqBTqBamE6gWq9OoFq7zqBapU6gWq9OoFqvzqBamM6gWoF////Af// + /wH///8B////Af///wH///8BOoFqJTqBatE6gWr/OoFq/zqBav86gWqTOoFq9TqBav86gWr/OoFq0zqB + ain///8B////Af///wH///8BOoFqJTqBaus6gWr/OoFq/zqBav86gWr9OoFqqzqBauk6gWr9OoFq/zqB + av86gWrrOoFqJ////wH///8BOoFqAzqBas86gWr7OoFqzTqBaqk6gWqtOoFqYzqBask6gWpJOoFqXTqB + ass6gWr7OoFq/zqBatE6gWoF////ATqBalc6gWrpOoFq4zqBap86gWoNOoFqCzqBanM6gWrROoFqqzqB + ajk6gWoNOoFqezqBavk6gWr/OoFqW////wE6gWq1OoFqpTqBats6gWp7OoFqOzqBahs6gWrxOoFq8zqB + av86gWqVOoFqFTqBanM6gWqJOoFq0TqBarf///8BOoFq6zqBal86gWqFOoFqezqBais6gWpHOoFq8TqB + av86gWr/OoFqdTqBaj86gWopOoFqhTqBask6gWqF////ATqBauM6gWo1OoFqHzqBamX///8BOoFqiTqB + av86gWrhOoFq/zqBal////8BOoFqYTqBaok6gWrhOoFq/////wE6gWpFOoFqFzqBakU6gWov////ATqB + apk6gWr/OoFq8TqBav86gWrbOoFqE////wE6gWpVOoFqtzqBapv///8BOoFqeTqBaos6gWpj////Af// + /wE6gWpXOoFq+zqBav86gWr/OoFq3TqBahE6gWozOoFqiTqBauU6gWol////ATqBaj86gWoV////Af// + /wH///8BOoFqfTqBaus6gWr3OoFq9zqBajs6gWo7OoFqczqBat86gWphOoFqA////wH///8B////Af// + /wH///8B////ATqBapM6gWr/OoFq/zqBav86gWpbOoFqSTqBatM6gWqVOoFqeTqBahP///8B////Af// + /wH///8B////Af///wE6gWofOoFq1zqBav86gWr/OoFqff///wH///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////ATqBark6gWr/OoFqwzqBagf///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wE6gWo3OoFq6zqBaiP///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// + /wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//w== + + + \ No newline at end of file diff --git a/OliviaAddIn/LimpCampos.cs b/OliviaAddIn/LimpCampos.cs new file mode 100644 index 0000000..717d904 --- /dev/null +++ b/OliviaAddIn/LimpCampos.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Drawing.Design; +using System.Windows.Forms.Design; + +namespace OliviaAddIn +{ + + public class LimpCampos : FormCampos + { + /** + * @file RecoCampos.cs + * Archivo de la clase ventana para la edición de los campos a leer en la planificación de recogida de residuos + */ + /** + * Clase ventana para la edición de los campos a leer en la planificación de recogida de residuos + */ + Limpieza limp = null; + + //////////////////////////////////////////// + /** + * Clase para la estructura de propiedades + */ + public class LimpCamposProps + { + [DisplayNameAttribute("Nombre entidad")] + [DescriptionAttribute("Campo donde leer el nombre de la entidad.")] + [Category("Campos")] + public string camp_nom_tipo_ent + { + get { return LimpiezaDef.Campos.consulta_entidad; } + set { LimpiezaDef.Campos.consulta_entidad = value; } + } + [DisplayNameAttribute("Mecanizable")] + [DescriptionAttribute("Campo donde leer si la entidad es mecanizable.")] + [Category("Campos")] + public string camp_mecaniz + { + get { return LimpiezaDef.Campos.consulta_mecan; } + set { LimpiezaDef.Campos.consulta_mecan = value; } + } + //////////////////////////////////////////// + //Atributos + [DisplayNameAttribute("Bordillos libres")] + [DescriptionAttribute("Atributo a consultar para los Bordillos libres.")] + [Category("Atributos")] + public string atr_bord + { + get { return LimpiezaDef.Atributos.atr_bord; } + set { LimpiezaDef.Atributos.atr_bord = value; } + } + [DisplayNameAttribute("Bandas de Aparcamiento")] + [DescriptionAttribute("Atributo a consultar para las Bandas de Aparcamiento.")] + [Category("Atributos")] + public string atr_aparc + { + get { return LimpiezaDef.Atributos.atr_aparc; } + set { LimpiezaDef.Atributos.atr_aparc = value; } + } + [DisplayNameAttribute("Aceras")] + [DescriptionAttribute("Atributo a consultar para las Aceras.")] + [Category("Atributos")] + public string atr_acera + { + get { return LimpiezaDef.Atributos.atr_acera; } + set { LimpiezaDef.Atributos.atr_acera = value; } + } + [DisplayNameAttribute("Peatonales")] + [DescriptionAttribute("Atributo a consultar para las Peatonales.")] + [Category("Atributos")] + public string atr_peat + { + get { return LimpiezaDef.Atributos.atr_peat; } + set { LimpiezaDef.Atributos.atr_peat = value; } + } + [DisplayNameAttribute("Caida de Hoja")] + [DescriptionAttribute("Atributo a consultar para la Caida de Hoja.")] + [Category("Atributos")] + public string atr_hoja + { + get { return LimpiezaDef.Atributos.atr_hoja; } + set { LimpiezaDef.Atributos.atr_hoja = value; } + } + [DisplayNameAttribute("Zonas Infantiles")] + [DescriptionAttribute("Atributo a consultar para las Zonas Infantiles.")] + [Category("Atributos")] + public string atr_infan + { + get { return LimpiezaDef.Atributos.atr_infan; } + set { LimpiezaDef.Atributos.atr_infan = value; } + } + [DisplayNameAttribute("Papeleras")] + [DescriptionAttribute("Atributo a consultar para las Papeleras.")] + [Category("Atributos")] + public string atr_pape + { + get { return LimpiezaDef.Atributos.atr_pape; } + set { LimpiezaDef.Atributos.atr_pape = value; } + } + [DisplayNameAttribute("Pipicanes")] + [DescriptionAttribute("Atributo a consultar para los Pipicanes.")] + [Category("Atributos")] + public string atr_pipi + { + get { return LimpiezaDef.Atributos.atr_pipi; } + set { LimpiezaDef.Atributos.atr_pipi = value; } + } + [DisplayNameAttribute("Sanecanes")] + [DescriptionAttribute("Atributo a consultar para los Sanecanes.")] + [Category("Atributos")] + public string atr_sane + { + get { return LimpiezaDef.Atributos.atr_sane; } + set { LimpiezaDef.Atributos.atr_sane = value; } + } + } + //////////////////////////////////////////////////// + public LimpCamposProps props; + public LimpCampos(Limpieza limp) + { + props = new LimpCamposProps(); + Text = "Campos de la capa de Limpieza"; + reinicia(); + propertyGrid.SelectedObject = props; + this.limp = limp; + } + + private void reinicia() + { + props.camp_nom_tipo_ent = LimpiezaDef.Campos.consulta_entidad; + props.camp_mecaniz = LimpiezaDef.Campos.consulta_mecan; + + props.atr_bord = LimpiezaDef.Atributos.atr_bord; + props.atr_aparc = LimpiezaDef.Atributos.atr_aparc; + props.atr_acera = LimpiezaDef.Atributos.atr_acera; + props.atr_peat = LimpiezaDef.Atributos.atr_peat; + props.atr_hoja = LimpiezaDef.Atributos.atr_hoja; + props.atr_infan = LimpiezaDef.Atributos.atr_infan; + props.atr_pape = LimpiezaDef.Atributos.atr_pape; + props.atr_pipi = LimpiezaDef.Atributos.atr_pipi; + props.atr_sane = LimpiezaDef.Atributos.atr_sane; + } + + protected override void button_reset_Click(object sender, EventArgs e) + { + reinicia(); + propertyGrid.Refresh(); + } + + /* + * Se validan los campos modificados y se guarda en memoria los nombres de los nuevos campos. + */ + protected override void btn_acept_Click(object sender, EventArgs e) + { + LimpiezaDef.Campos.consulta_entidad = props.camp_nom_tipo_ent; + LimpiezaDef.Campos.consulta_mecan = props.camp_mecaniz; + + LimpiezaDef.Atributos.atr_bord = props.atr_bord; + LimpiezaDef.Atributos.atr_aparc = props.atr_aparc; + LimpiezaDef.Atributos.atr_acera = props.atr_acera; + LimpiezaDef.Atributos.atr_peat = props.atr_peat; + LimpiezaDef.Atributos.atr_hoja = props.atr_hoja; + LimpiezaDef.Atributos.atr_infan = props.atr_infan; + LimpiezaDef.Atributos.atr_pape = props.atr_pape; + LimpiezaDef.Atributos.atr_pipi = props.atr_pipi; + LimpiezaDef.Atributos.atr_sane = props.atr_sane; + + OliviaGlob.forma_filtros_limp(); + + DialogResult = DialogResult.OK; + + base.Close(); + } + + private void InitializeComponent() + { + this.SuspendLayout(); + // + // LimpCampos + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.ClientSize = new System.Drawing.Size(292, 309); + this.Name = "LimpCampos"; + this.ResumeLayout(false); + + } + + protected override void button_guardar_Click(object sender, EventArgs e) + { + OliviaGlob.forma_filtros_limp(); + base.button_guardar_Click(sender, e); + } + } +} diff --git a/OliviaAddIn/LimpCampos.resx b/OliviaAddIn/LimpCampos.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/OliviaAddIn/LimpCampos.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OliviaAddIn/Limpieza.cs b/OliviaAddIn/Limpieza.cs new file mode 100644 index 0000000..59e3425 --- /dev/null +++ b/OliviaAddIn/Limpieza.cs @@ -0,0 +1,388 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using OliviaDef; + +using ESRI.ArcGIS.Geometry; + +namespace OliviaAddIn +{ + /** + * @file Limpieza.cs + * Clase de las variables asociadas a la limpieza viaria. + * Contiene definiciones, nombres de campos, y las opciones configuradas en la ventana. + */ + + //************************************************************************************* + /** + * Clase de las variables asociadas a la limpieza viaria. + * Contiene definiciones, nombres de campos, y las opciones configuradas en la ventana. + */ + public class Limpieza : Comun + { + //************************************************************************************* + //Variables + /** + * Ámbitos de trabajo elegidos + */ + public bool[] amb_tra_sel = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; + /** + * Texto cuando no se ha seleccionado capa de niveles + */ + public string text_selec_nive = "Capa de niveles"; + /** + * Geometría que componen la selección de niveles, null si ninguno + */ + public IGeometry geom_niveles = null; + /** + * String que almacena qué niveles se han seleccionado + */ + public string text_niv = ""; + //************************************************************************************* + /** + * Tipo de tratamiento elegidos + */ + public int tipo_tto = -1; + /** + * Ancho de vía, en metros + */ + public double ancho_via = LimpiezaDef.Parametros.ancho_via; + /** + * Tiempo de tratamiento, en minutos + */ + public double t_tto = 5; + /** + * Tipo de unidades del tiempo de tto + */ + public int uds_t_tto = (int)GeneralDef.OlvTiposTto.OlvTipTtoNoDef; + /** + * Velocidad de desplazamiento, en km/h. Si es 0, es determinada por la vía + */ + public double v_despl = 0; + /** + * Umbral predeterminado para la recogida de basuras + */ + public double umbral_basura = LimpiezaDef.Parametros.umbral_reco; + /** + * Matriz que da si los tratamientos tienen en cuenta las restricciones de circulación o no + */ + public bool[] rest_circ; + /** + * Matriz que da si los tratamientos tienen en cuenta las restricciones de circulación o no + */ + public bool[] t_carg_desc; + /** + * Indica si se ha marcado el checkbox para que se recojan únicamente aquellos contendores que superan un umbral de carga. + */ + public bool umbral_reco_conten = false; + /** + * Array que indica qué ámbitos tiene cada opción, mediante true en las posiciones de los ámbitos válidos + */ + public struct AmbsValOps + { + public bool[] ambs; + }; + /** + * Definición de tipo para la matriz que da los ámbitos + * Donde hay n opciones y cada opción un array de booleanos que indican con true si esa opción tiene ese ámbito + */ + public struct AmbsVal + { + public int n_ops; + public AmbsValOps[] ambs_ops; + }; + /** + * Matriz que da los ámbitos correspondientes a los tipos de tratamiento + */ + public AmbsVal[] ambs_val; + //************************************************************************************* + //Métodos + public Limpieza() + { + inicia_matr_amb(); + inicia_matr_restr(); + inicia_matr_carg_desc(); + } + + /**Devuelve el array de los ámbitos comunes y no comunes de las opciones de un tratamiento tto + * Es un array de longitud el número de ámbitos totales, con true en las posiciones en los que el ámbito sea común o + * no común en las opciones + */ + public bool[] dame_amb(int tto) + { + int i; + bool sig; + bool[] amb_com = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; + + for (int j = 0; j < (int)LimpiezaDef.AmbitsTra.AmbN; j++) + { + sig = false; + for (i = 0; i < ambs_val[tto].n_ops && !sig; i++) + { + if (ambs_val[tto].ambs_ops[i].ambs[j]) //con que encuentre uno true lo pone y pasa al siguiente + { + amb_com[j] = sig = true; + } + } + } + return amb_com; + } + + /** + * Inicializa la matriz que da las restricciones de circulación de los tipos de tratamiento + */ + private void inicia_matr_restr() + { + rest_circ = new bool[(int)LimpiezaDef.TiposTto.TtoN];//se inician a false + rest_circ[(int)LimpiezaDef.TiposTto.TtoBarrMecCalz] = true; + rest_circ[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz] = true; + rest_circ[(int)LimpiezaDef.TiposTto.TtoBaldMecCalz] = true; + rest_circ[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz] = true; + rest_circ[(int)LimpiezaDef.TiposTto.TtoCaidaHoja] = true; + rest_circ[(int)LimpiezaDef.TiposTto.TtoPapeVaci] = true; + rest_circ[(int)LimpiezaDef.TiposTto.TtoPapeLimp] = true; + rest_circ[(int)LimpiezaDef.TiposTto.TtoLimpCont] = true; + rest_circ[(int)LimpiezaDef.TiposTto.TtoLimpZInf] = true; + rest_circ[(int)LimpiezaDef.TiposTto.TtoLimpPipi] = true; + rest_circ[(int)LimpiezaDef.TiposTto.TtoLimpSane] = true; + } + + /** + * Inicializa la matriz que da los ámbitos correspondientes a los tipos de tratamiento + */ + private void inicia_matr_amb() + { + //crea la matriz + ambs_val = new AmbsVal[(int)LimpiezaDef.TiposTto.TtoN]; + + //va creando los arrays de cada elemento de la matriz correspondiente a un tipo de tratamiento + + //Barrido manual + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMan].n_ops = 1; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMan].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMan].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMan].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMan].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMan].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMan].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbCallePeatMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMan].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbCallePeatNoMec] = true; + + //Barrido manual de mantenimiento + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMant].n_ops = 1; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMant].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMant].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMant].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMant].ambs_ops[0].ambs = ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMan].ambs_ops[0].ambs;//igual que el manual + //igual que el manual + + //Barrido manual motorizado + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMot].n_ops = 1; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMot].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMot].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMot].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMot].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMot].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMot].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMot].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbCallePeatMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMot].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbCallePeatNoMec] = true; + + //Barrido mecánico de calzadas + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMecCalz].n_ops = 1; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMecCalz].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMecCalz].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMecCalz].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMecCalz].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordLibreMec] = true; + + //Barrido mecánico de aceras y calzadas peatonales + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMecAcYCalzP].n_ops = 1; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMecAcYCalzP].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMecAcYCalzP].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMecAcYCalzP].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMecAcYCalzP].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMecAcYCalzP].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbCallePeatMec] = true; + + //Barrido mixto de aceras y calzadas + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].n_ops = 4; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordAparc] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = true; + + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[1].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[1].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordAparc] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[1].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[1].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = true; + + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[2].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[2].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordAparc] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[2].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordLibreMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[2].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = true; + + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[3].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[3].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordAparc] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[3].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordLibreMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[3].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBarrMixAcYCalz].ambs_ops[3].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = true; + + //Baldeo manual + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMan].n_ops = 1; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMan].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMan].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMan].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMan].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMan].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbCallePeatMec] = true; + + //Baldeo mecánico de calzadas + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecCalz].n_ops = 2; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecCalz].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecCalz].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecCalz].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecCalz].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordAparc] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecCalz].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordLibreMec] = true; + + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecCalz].ambs_ops[1].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecCalz].ambs_ops[1].ambs[(int)LimpiezaDef.AmbitsTra.AmbEjeCalle] = true; + + //Baldeo mecánico de aceras y calzadas peatonales + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecAcYCalzP].n_ops = 1; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecAcYCalzP].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecAcYCalzP].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecAcYCalzP].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecAcYCalzP].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMecAcYCalzP].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbCallePeatMec] = true; + + //Baldeo mixto de aceras y calzadas + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].n_ops = 4; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordAparc] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = true; + + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[1].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[1].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordAparc] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[1].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[1].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = true; + + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[2].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[2].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordAparc] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[2].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordLibreMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[2].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = true; + + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[3].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[3].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordAparc] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[3].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordLibreMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[3].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoBaldMixAcYCalz].ambs_ops[3].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = true; + + //Fregado mecánico de aceras y calzadas peatonales + ambs_val[(int)LimpiezaDef.TiposTto.TtoFregMecAcYCalzP].n_ops = 1; + ambs_val[(int)LimpiezaDef.TiposTto.TtoFregMecAcYCalzP].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoFregMecAcYCalzP].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoFregMecAcYCalzP].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoFregMecAcYCalzP].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoFregMecAcYCalzP].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbCallePeatMec] = true; + + + //Caída de la hoja + ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].n_ops = 3; + ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + //No están especififacadas las características de la opción 1 ? + ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbEjeCalle] = true; + + ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].ambs_ops[1].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].ambs_ops[1].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordAparc] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].ambs_ops[1].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordLibreMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].ambs_ops[1].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = true; + + ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].ambs_ops[2].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].ambs_ops[2].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordAparc] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].ambs_ops[2].ambs[(int)LimpiezaDef.AmbitsTra.AmbBordLibreMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].ambs_ops[2].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceMec] = true; + ambs_val[(int)LimpiezaDef.TiposTto.TtoCaidaHoja].ambs_ops[2].ambs[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = true; + + //Vaciado de papeleras + ambs_val[(int)LimpiezaDef.TiposTto.TtoPapeVaci].n_ops = 1; + ambs_val[(int)LimpiezaDef.TiposTto.TtoPapeVaci].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoPapeVaci].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoPapeVaci].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoPapeVaci].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbPape] = true; + + //Limpieza de papeleras + ambs_val[(int)LimpiezaDef.TiposTto.TtoPapeLimp].n_ops = 1; + ambs_val[(int)LimpiezaDef.TiposTto.TtoPapeLimp].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoPapeLimp].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoPapeLimp].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoPapeLimp].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbPape] = true; + + //Limpieza de ubicación de contenedores + ambs_val[(int)LimpiezaDef.TiposTto.TtoLimpCont].n_ops = 1; + ambs_val[(int)LimpiezaDef.TiposTto.TtoLimpCont].ambs_ops = new AmbsValOps[ambs_val[(int)LimpiezaDef.TiposTto.TtoLimpCont].n_ops]; + ambs_val[(int)LimpiezaDef.TiposTto.TtoLimpCont].ambs_ops[0].ambs = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //se inicializa todo a false + ambs_val[(int)LimpiezaDef.TiposTto.TtoLimpCont].ambs_ops[0].ambs[(int)LimpiezaDef.AmbitsTra.AmbConte] = true; + + // + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LimpiezaDlg)); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.button_capa_limp = new System.Windows.Forms.Button(); + this.label_capa_limp = new System.Windows.Forms.Label(); + this.button_edit_camp = new System.Windows.Forms.Button(); + this.tbox_umbral_recog = new System.Windows.Forms.TextBox(); + this.label_umbral_recog = new System.Windows.Forms.Label(); + this.checkBox_papelera = new System.Windows.Forms.CheckBox(); + this.label_uds_anch_med = new System.Windows.Forms.Label(); + this.textBox_ancho_medio = new System.Windows.Forms.TextBox(); + this.label_ancho_medio = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label_checkambs = new System.Windows.Forms.Label(); + this.checkedListBox_amb = new OliviaAddIn.LimpiezaDlg.CheckedListBoxEx(); + this.comboBox_amb = new System.Windows.Forms.ComboBox(); + this.label5 = new System.Windows.Forms.Label(); + this.checkBox_restr = new System.Windows.Forms.CheckBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.comboBox_tto = new System.Windows.Forms.ComboBox(); + this.label_restric = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.label22 = new System.Windows.Forms.Label(); + this.label21 = new System.Windows.Forms.Label(); + this.label20 = new System.Windows.Forms.Label(); + this.bt_restric_circ = new System.Windows.Forms.Button(); + this.pictureBox2 = new System.Windows.Forms.PictureBox(); + this.bt_zonas = new System.Windows.Forms.Button(); + this.label_zon = new System.Windows.Forms.Label(); + this.bt_niveles = new System.Windows.Forms.Button(); + this.instal_sel = new System.Windows.Forms.Label(); + this.bt_instalaciones = new System.Windows.Forms.Button(); + this.label_niv = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.label19 = new System.Windows.Forms.Label(); + this.textBox_traf = new System.Windows.Forms.TextBox(); + this.label15 = new System.Windows.Forms.Label(); + this.dateTimePicker_h_inicio = new System.Windows.Forms.DateTimePicker(); + this.label_h_inicio = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.label4 = new System.Windows.Forms.Label(); + this.dateTimePicker_t_desc = new System.Windows.Forms.DateTimePicker(); + this.label7 = new System.Windows.Forms.Label(); + this.dateTimePicker_t_conv = new System.Windows.Forms.DateTimePicker(); + this.label6 = new System.Windows.Forms.Label(); + this.pictureBox3 = new System.Windows.Forms.PictureBox(); + this.label13 = new System.Windows.Forms.Label(); + this.textBox_v_despl = new System.Windows.Forms.TextBox(); + this.label14 = new System.Windows.Forms.Label(); + this.dateTimePicker_despl = new System.Windows.Forms.DateTimePicker(); + this.dateTimePicker_carg = new System.Windows.Forms.DateTimePicker(); + this.label8 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label_t_tto = new System.Windows.Forms.Label(); + this.textBox_t_tto = new System.Windows.Forms.TextBox(); + this.label_t_tto_def = new System.Windows.Forms.Label(); + this.numericUpDown_sectores = new System.Windows.Forms.NumericUpDown(); + this.label16 = new System.Windows.Forms.Label(); + this.numericUpDown_pctrl = new System.Windows.Forms.NumericUpDown(); + this.label10 = new System.Windows.Forms.Label(); + this.toolTip = new System.Windows.Forms.ToolTip(this.components); + this.bt_planifica = new System.Windows.Forms.Button(); + this.button_eje = new System.Windows.Forms.Button(); + this.label11 = new System.Windows.Forms.Label(); + this.label17 = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.groupBox7 = new System.Windows.Forms.GroupBox(); + this.pictureBox4 = new System.Windows.Forms.PictureBox(); + this.checkBox_ajust_sec = new System.Windows.Forms.CheckBox(); + this.checkBox_sector_autom = new System.Windows.Forms.CheckBox(); + this.groupBox_edits = new System.Windows.Forms.GroupBox(); + this.checkBox_aislados = new System.Windows.Forms.CheckBox(); + this.btn_help = new System.Windows.Forms.Button(); + this.textBox_buff = new System.Windows.Forms.TextBox(); + this.label23 = new System.Windows.Forms.Label(); + this.label24 = new System.Windows.Forms.Label(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.groupBox2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); + this.groupBox3.SuspendLayout(); + this.groupBox6.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_sectores)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_pctrl)).BeginInit(); + this.groupBox7.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); + this.groupBox_edits.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.BackColor = System.Drawing.SystemColors.Control; + this.groupBox1.Controls.Add(this.button_capa_limp); + this.groupBox1.Controls.Add(this.label_capa_limp); + this.groupBox1.Controls.Add(this.button_edit_camp); + this.groupBox1.Controls.Add(this.tbox_umbral_recog); + this.groupBox1.Controls.Add(this.label_umbral_recog); + this.groupBox1.Controls.Add(this.checkBox_papelera); + this.groupBox1.Controls.Add(this.label_uds_anch_med); + this.groupBox1.Controls.Add(this.textBox_ancho_medio); + this.groupBox1.Controls.Add(this.label_ancho_medio); + this.groupBox1.Controls.Add(this.label12); + this.groupBox1.Controls.Add(this.label_checkambs); + this.groupBox1.Controls.Add(this.checkedListBox_amb); + this.groupBox1.Controls.Add(this.comboBox_amb); + this.groupBox1.Controls.Add(this.label5); + this.groupBox1.Controls.Add(this.checkBox_restr); + this.groupBox1.Controls.Add(this.pictureBox1); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.comboBox_tto); + this.groupBox1.ForeColor = System.Drawing.SystemColors.ControlText; + this.groupBox1.Location = new System.Drawing.Point(10, 10); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(661, 235); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Tipo de tratamiento"; + // + // button_capa_limp + // + this.button_capa_limp.Image = global::OliviaAddIn.Properties.Resources.document_open_data; + this.button_capa_limp.Location = new System.Drawing.Point(190, 25); + this.button_capa_limp.Name = "button_capa_limp"; + this.button_capa_limp.Size = new System.Drawing.Size(38, 23); + this.button_capa_limp.TabIndex = 28; + this.button_capa_limp.UseVisualStyleBackColor = true; + this.button_capa_limp.Click += new System.EventHandler(this.button_capa_limp_Click); + // + // label_capa_limp + // + this.label_capa_limp.AutoEllipsis = true; + this.label_capa_limp.Location = new System.Drawing.Point(234, 30); + this.label_capa_limp.Name = "label_capa_limp"; + this.label_capa_limp.Size = new System.Drawing.Size(160, 13); + this.label_capa_limp.TabIndex = 27; + this.label_capa_limp.Text = "Seleccionar Datos de entrada ..."; + // + // button_edit_camp + // + this.button_edit_camp.Location = new System.Drawing.Point(407, 24); + this.button_edit_camp.Name = "button_edit_camp"; + this.button_edit_camp.Size = new System.Drawing.Size(87, 23); + this.button_edit_camp.TabIndex = 26; + this.button_edit_camp.Text = "Editar campos"; + this.button_edit_camp.UseVisualStyleBackColor = true; + this.button_edit_camp.Click += new System.EventHandler(this.button_edit_camp_Click); + // + // tbox_umbral_recog + // + this.tbox_umbral_recog.Location = new System.Drawing.Point(280, 191); + this.tbox_umbral_recog.Name = "tbox_umbral_recog"; + this.tbox_umbral_recog.Size = new System.Drawing.Size(83, 20); + this.tbox_umbral_recog.TabIndex = 21; + // + // label_umbral_recog + // + this.label_umbral_recog.AutoSize = true; + this.label_umbral_recog.Location = new System.Drawing.Point(184, 194); + this.label_umbral_recog.Name = "label_umbral_recog"; + this.label_umbral_recog.Size = new System.Drawing.Size(85, 13); + this.label_umbral_recog.TabIndex = 20; + this.label_umbral_recog.Text = "Umbral de carga"; + // + // checkBox_papelera + // + this.checkBox_papelera.AutoSize = true; + this.checkBox_papelera.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; + this.checkBox_papelera.Location = new System.Drawing.Point(184, 161); + this.checkBox_papelera.Name = "checkBox_papelera"; + this.checkBox_papelera.Size = new System.Drawing.Size(174, 17); + this.checkBox_papelera.TabIndex = 19; + this.checkBox_papelera.Text = "Sectorizar sólo papeleras llenas"; + this.checkBox_papelera.UseVisualStyleBackColor = true; + this.checkBox_papelera.Visible = false; + this.checkBox_papelera.CheckedChanged += new System.EventHandler(this.checkBox_papelera_CheckedChanged); + // + // label_uds_anch_med + // + this.label_uds_anch_med.AutoSize = true; + this.label_uds_anch_med.Location = new System.Drawing.Point(370, 194); + this.label_uds_anch_med.Name = "label_uds_anch_med"; + this.label_uds_anch_med.Size = new System.Drawing.Size(15, 13); + this.label_uds_anch_med.TabIndex = 18; + this.label_uds_anch_med.Text = "m"; + // + // textBox_ancho_medio + // + this.textBox_ancho_medio.Location = new System.Drawing.Point(280, 191); + this.textBox_ancho_medio.Name = "textBox_ancho_medio"; + this.textBox_ancho_medio.Size = new System.Drawing.Size(83, 20); + this.textBox_ancho_medio.TabIndex = 17; + this.textBox_ancho_medio.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // label_ancho_medio + // + this.label_ancho_medio.AutoSize = true; + this.label_ancho_medio.Location = new System.Drawing.Point(157, 194); + this.label_ancho_medio.Name = "label_ancho_medio"; + this.label_ancho_medio.Size = new System.Drawing.Size(120, 13); + this.label_ancho_medio.TabIndex = 16; + this.label_ancho_medio.Text = "Ancho medio de la calle"; + this.label_ancho_medio.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label12 + // + this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label12.ForeColor = System.Drawing.SystemColors.HotTrack; + this.label12.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label12.Location = new System.Drawing.Point(364, 98); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(21, 21); + this.label12.TabIndex = 9; + this.toolTip.SetToolTip(this.label12, "La selección de ámbitos se habilitará al seleccionar una opción"); + // + // label_checkambs + // + this.label_checkambs.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label_checkambs.ForeColor = System.Drawing.SystemColors.HotTrack; + this.label_checkambs.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label_checkambs.Location = new System.Drawing.Point(626, 98); + this.label_checkambs.Name = "label_checkambs"; + this.label_checkambs.Size = new System.Drawing.Size(22, 21); + this.label_checkambs.TabIndex = 8; + // + // checkedListBox_amb + // + this.checkedListBox_amb.FormattingEnabled = true; + this.checkedListBox_amb.Location = new System.Drawing.Point(390, 98); + this.checkedListBox_amb.Name = "checkedListBox_amb"; + this.checkedListBox_amb.Size = new System.Drawing.Size(232, 109); + this.checkedListBox_amb.TabIndex = 7; + // + // comboBox_amb + // + this.comboBox_amb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox_amb.FormattingEnabled = true; + this.comboBox_amb.Location = new System.Drawing.Point(283, 98); + this.comboBox_amb.Name = "comboBox_amb"; + this.comboBox_amb.Size = new System.Drawing.Size(77, 21); + this.comboBox_amb.TabIndex = 6; + this.comboBox_amb.SelectedIndexChanged += new System.EventHandler(this.comboBox_amb_SelectedIndexChanged); + // + // label5 + // + this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.ForeColor = System.Drawing.SystemColors.HotTrack; + this.label5.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label5.Location = new System.Drawing.Point(626, 65); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(22, 18); + this.label5.TabIndex = 0; + this.toolTip.SetToolTip(this.label5, "Al seleccionar el tipo de tratamiento se actualizará la lista de ámbitos de traba" + + "jo con los ámbitos aplicables a dicho tratamiento"); + // + // checkBox_restr + // + this.checkBox_restr.AutoSize = true; + this.checkBox_restr.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; + this.checkBox_restr.Location = new System.Drawing.Point(186, 134); + this.checkBox_restr.Name = "checkBox_restr"; + this.checkBox_restr.Size = new System.Drawing.Size(172, 17); + this.checkBox_restr.TabIndex = 4; + this.checkBox_restr.Text = "Respeta sentido de circulación"; + this.checkBox_restr.UseVisualStyleBackColor = true; + // + // pictureBox1 + // + this.pictureBox1.Image = global::OliviaAddIn.Properties.Resources.CLEANAIR_5_front; + this.pictureBox1.InitialImage = null; + this.pictureBox1.Location = new System.Drawing.Point(8, 42); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(153, 141); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox1.TabIndex = 4; + this.pictureBox1.TabStop = false; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(186, 101); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(93, 13); + this.label2.TabIndex = 2; + this.label2.Text = "Ámbito de Trabajo"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(186, 68); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(87, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Tipo Tratamiento"; + // + // comboBox_tto + // + this.comboBox_tto.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox_tto.FormattingEnabled = true; + this.comboBox_tto.Location = new System.Drawing.Point(281, 65); + this.comboBox_tto.MaxDropDownItems = 20; + this.comboBox_tto.Name = "comboBox_tto"; + this.comboBox_tto.Size = new System.Drawing.Size(341, 21); + this.comboBox_tto.TabIndex = 1; + this.comboBox_tto.SelectedIndexChanged += new System.EventHandler(this.comboBox_tto_SelectedIndexChanged); + // + // label_restric + // + this.label_restric.AutoEllipsis = true; + this.label_restric.Location = new System.Drawing.Point(213, 18); + this.label_restric.Name = "label_restric"; + this.label_restric.Size = new System.Drawing.Size(145, 14); + this.label_restric.TabIndex = 11; + this.label_restric.Text = "Restricciones de acceso"; + // + // groupBox2 + // + this.groupBox2.BackColor = System.Drawing.SystemColors.Control; + this.groupBox2.Controls.Add(this.textBox_buff); + this.groupBox2.Controls.Add(this.label23); + this.groupBox2.Controls.Add(this.label24); + this.groupBox2.Controls.Add(this.label22); + this.groupBox2.Controls.Add(this.label21); + this.groupBox2.Controls.Add(this.label20); + this.groupBox2.Controls.Add(this.bt_restric_circ); + this.groupBox2.Controls.Add(this.pictureBox2); + this.groupBox2.Controls.Add(this.bt_zonas); + this.groupBox2.Controls.Add(this.label_zon); + this.groupBox2.Controls.Add(this.bt_niveles); + this.groupBox2.Controls.Add(this.instal_sel); + this.groupBox2.Controls.Add(this.bt_instalaciones); + this.groupBox2.Controls.Add(this.label_restric); + this.groupBox2.Controls.Add(this.label_niv); + this.groupBox2.ForeColor = System.Drawing.SystemColors.ControlText; + this.groupBox2.Location = new System.Drawing.Point(10, 253); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(660, 107); + this.groupBox2.TabIndex = 1; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Zonificación"; + // + // label22 + // + this.label22.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label22.ForeColor = System.Drawing.SystemColors.HotTrack; + this.label22.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label22.Location = new System.Drawing.Point(364, 73); + this.label22.Name = "label22"; + this.label22.Size = new System.Drawing.Size(25, 18); + this.label22.TabIndex = 26; + this.toolTip.SetToolTip(this.label22, "Delimita los ámbitos a trabajar, pero no la circulación"); + // + // label21 + // + this.label21.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label21.ForeColor = System.Drawing.SystemColors.HotTrack; + this.label21.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label21.Location = new System.Drawing.Point(364, 44); + this.label21.Name = "label21"; + this.label21.Size = new System.Drawing.Size(25, 18); + this.label21.TabIndex = 25; + this.toolTip.SetToolTip(this.label21, "Delimita los ámbitos a trabajar, pero no la circulación"); + // + // label20 + // + this.label20.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label20.ForeColor = System.Drawing.SystemColors.HotTrack; + this.label20.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label20.Location = new System.Drawing.Point(364, 15); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(25, 18); + this.label20.TabIndex = 24; + this.toolTip.SetToolTip(this.label20, "Restringe el acceso a la red navegable"); + // + // bt_restric_circ + // + this.bt_restric_circ.Image = ((System.Drawing.Image)(resources.GetObject("bt_restric_circ.Image"))); + this.bt_restric_circ.Location = new System.Drawing.Point(170, 13); + this.bt_restric_circ.Name = "bt_restric_circ"; + this.bt_restric_circ.Size = new System.Drawing.Size(33, 24); + this.bt_restric_circ.TabIndex = 23; + this.bt_restric_circ.UseVisualStyleBackColor = true; + this.bt_restric_circ.Click += new System.EventHandler(this.bt_restric_circ_Click); + // + // pictureBox2 + // + this.pictureBox2.Image = global::OliviaAddIn.Properties.Resources.areas; + this.pictureBox2.InitialImage = null; + this.pictureBox2.Location = new System.Drawing.Point(6, 19); + this.pictureBox2.Name = "pictureBox2"; + this.pictureBox2.Size = new System.Drawing.Size(128, 78); + this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox2.TabIndex = 8; + this.pictureBox2.TabStop = false; + // + // bt_zonas + // + this.bt_zonas.Image = ((System.Drawing.Image)(resources.GetObject("bt_zonas.Image"))); + this.bt_zonas.Location = new System.Drawing.Point(170, 69); + this.bt_zonas.Name = "bt_zonas"; + this.bt_zonas.Size = new System.Drawing.Size(33, 24); + this.bt_zonas.TabIndex = 22; + this.bt_zonas.UseVisualStyleBackColor = true; + this.bt_zonas.Click += new System.EventHandler(this.bt_zonas_Click); + // + // label_zon + // + this.label_zon.AutoEllipsis = true; + this.label_zon.Location = new System.Drawing.Point(213, 75); + this.label_zon.Name = "label_zon"; + this.label_zon.Size = new System.Drawing.Size(145, 13); + this.label_zon.TabIndex = 21; + this.label_zon.Text = "Seleccionar capa de zonas"; + this.toolTip.SetToolTip(this.label_zon, "Permite seleccionar una capa de zonas diferente a la proporcionada por la geodata" + + "base."); + // + // bt_niveles + // + this.bt_niveles.Image = ((System.Drawing.Image)(resources.GetObject("bt_niveles.Image"))); + this.bt_niveles.Location = new System.Drawing.Point(170, 41); + this.bt_niveles.Name = "bt_niveles"; + this.bt_niveles.Size = new System.Drawing.Size(33, 24); + this.bt_niveles.TabIndex = 20; + this.toolTip.SetToolTip(this.bt_niveles, "Permite seleccionar una capa de niveles diferente a la proporcionada por la geoda" + + "tabase."); + this.bt_niveles.UseVisualStyleBackColor = true; + this.bt_niveles.Click += new System.EventHandler(this.bt_niveles_Click); + // + // instal_sel + // + this.instal_sel.AutoEllipsis = true; + this.instal_sel.Location = new System.Drawing.Point(468, 19); + this.instal_sel.Name = "instal_sel"; + this.instal_sel.Size = new System.Drawing.Size(154, 13); + this.instal_sel.TabIndex = 19; + this.instal_sel.Text = "Seleccionar Instalación"; + // + // bt_instalaciones + // + this.bt_instalaciones.Image = global::OliviaAddIn.Properties.Resources.document_open_data; + this.bt_instalaciones.Location = new System.Drawing.Point(428, 13); + this.bt_instalaciones.Name = "bt_instalaciones"; + this.bt_instalaciones.Size = new System.Drawing.Size(33, 24); + this.bt_instalaciones.TabIndex = 18; + this.toolTip.SetToolTip(this.bt_instalaciones, "Permite seleeccionar una de las instalaciones."); + this.bt_instalaciones.UseVisualStyleBackColor = true; + this.bt_instalaciones.Click += new System.EventHandler(this.bt_instalaciones_Click); + // + // label_niv + // + this.label_niv.AutoEllipsis = true; + this.label_niv.Location = new System.Drawing.Point(213, 47); + this.label_niv.Name = "label_niv"; + this.label_niv.Size = new System.Drawing.Size(145, 13); + this.label_niv.TabIndex = 19; + this.label_niv.Text = "Seleccionar capa de niveles"; + // + // groupBox3 + // + this.groupBox3.BackColor = System.Drawing.SystemColors.Control; + this.groupBox3.Controls.Add(this.label19); + this.groupBox3.Controls.Add(this.textBox_traf); + this.groupBox3.Controls.Add(this.label15); + this.groupBox3.Controls.Add(this.dateTimePicker_h_inicio); + this.groupBox3.Controls.Add(this.label_h_inicio); + this.groupBox3.Controls.Add(this.label3); + this.groupBox3.Controls.Add(this.groupBox6); + this.groupBox3.Controls.Add(this.pictureBox3); + this.groupBox3.Controls.Add(this.label13); + this.groupBox3.Controls.Add(this.textBox_v_despl); + this.groupBox3.Controls.Add(this.label14); + this.groupBox3.Controls.Add(this.dateTimePicker_despl); + this.groupBox3.Controls.Add(this.dateTimePicker_carg); + this.groupBox3.Controls.Add(this.label8); + this.groupBox3.Controls.Add(this.label9); + this.groupBox3.Controls.Add(this.label_t_tto); + this.groupBox3.Controls.Add(this.textBox_t_tto); + this.groupBox3.Controls.Add(this.label_t_tto_def); + this.groupBox3.ForeColor = System.Drawing.SystemColors.ControlText; + this.groupBox3.Location = new System.Drawing.Point(10, 479); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(661, 170); + this.groupBox3.TabIndex = 2; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Tiempos"; + // + // label19 + // + this.label19.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label19.Location = new System.Drawing.Point(624, 79); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(25, 18); + this.label19.TabIndex = 21; + this.toolTip.SetToolTip(this.label19, "Porcentaje de tráfico que se estima en las vías. Si 100 el vehículo circulará a l" + + "a velocidad máxima permitida por la vía."); + // + // textBox_traf + // + this.textBox_traf.Location = new System.Drawing.Point(537, 79); + this.textBox_traf.Name = "textBox_traf"; + this.textBox_traf.Size = new System.Drawing.Size(84, 20); + this.textBox_traf.TabIndex = 20; + this.textBox_traf.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point(486, 82); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(40, 13); + this.label15.TabIndex = 19; + this.label15.Text = "Tráfico"; + // + // dateTimePicker_h_inicio + // + this.dateTimePicker_h_inicio.CustomFormat = "HH\' h\' mm\' m\'"; + this.dateTimePicker_h_inicio.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker_h_inicio.Location = new System.Drawing.Point(282, 79); + this.dateTimePicker_h_inicio.MaxDate = new System.DateTime(2017, 1, 2, 0, 0, 0, 0); + this.dateTimePicker_h_inicio.MinDate = new System.DateTime(2017, 1, 1, 0, 0, 0, 0); + this.dateTimePicker_h_inicio.Name = "dateTimePicker_h_inicio"; + this.dateTimePicker_h_inicio.ShowUpDown = true; + this.dateTimePicker_h_inicio.Size = new System.Drawing.Size(83, 20); + this.dateTimePicker_h_inicio.TabIndex = 18; + this.dateTimePicker_h_inicio.Value = new System.DateTime(2017, 1, 2, 0, 0, 0, 0); + // + // label_h_inicio + // + this.label_h_inicio.AutoSize = true; + this.label_h_inicio.Location = new System.Drawing.Point(163, 82); + this.label_h_inicio.Name = "label_h_inicio"; + this.label_h_inicio.Size = new System.Drawing.Size(110, 13); + this.label_h_inicio.TabIndex = 17; + this.label_h_inicio.Text = "Hora de inicio jornada"; + // + // label3 + // + this.label3.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label3.Location = new System.Drawing.Point(363, 44); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(26, 26); + this.label3.TabIndex = 16; + this.toolTip.SetToolTip(this.label3, "El tiempo de desplazamiento incluye ida al punto inicial y vuelta a la instalació" + + "n."); + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.label4); + this.groupBox6.Controls.Add(this.dateTimePicker_t_desc); + this.groupBox6.Controls.Add(this.label7); + this.groupBox6.Controls.Add(this.dateTimePicker_t_conv); + this.groupBox6.Controls.Add(this.label6); + this.groupBox6.Location = new System.Drawing.Point(145, 108); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(510, 51); + this.groupBox6.TabIndex = 11; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "Tiempos convenio"; + // + // label4 + // + this.label4.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label4.Location = new System.Drawing.Point(479, 20); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(25, 18); + this.label4.TabIndex = 11; + this.toolTip.SetToolTip(this.label4, "El tiempo se reparte entre los puntos de control intermedios"); + // + // dateTimePicker_t_desc + // + this.dateTimePicker_t_desc.CustomFormat = "HH \'h\' mm \'m\'"; + this.dateTimePicker_t_desc.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker_t_desc.Location = new System.Drawing.Point(395, 20); + this.dateTimePicker_t_desc.MaxDate = new System.DateTime(2017, 1, 2, 0, 0, 0, 0); + this.dateTimePicker_t_desc.MinDate = new System.DateTime(2017, 1, 1, 0, 0, 0, 0); + this.dateTimePicker_t_desc.Name = "dateTimePicker_t_desc"; + this.dateTimePicker_t_desc.ShowUpDown = true; + this.dateTimePicker_t_desc.Size = new System.Drawing.Size(83, 20); + this.dateTimePicker_t_desc.TabIndex = 10; + this.dateTimePicker_t_desc.Value = new System.DateTime(2017, 1, 1, 0, 0, 0, 0); + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(277, 23); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(109, 13); + this.label7.TabIndex = 9; + this.label7.Text = "T. descanso personal"; + // + // dateTimePicker_t_conv + // + this.dateTimePicker_t_conv.CustomFormat = "HH \'h\' mm \'m\'"; + this.dateTimePicker_t_conv.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker_t_conv.Location = new System.Drawing.Point(137, 20); + this.dateTimePicker_t_conv.MaxDate = new System.DateTime(2017, 1, 2, 0, 0, 0, 0); + this.dateTimePicker_t_conv.MinDate = new System.DateTime(2017, 1, 1, 0, 0, 0, 0); + this.dateTimePicker_t_conv.Name = "dateTimePicker_t_conv"; + this.dateTimePicker_t_conv.ShowUpDown = true; + this.dateTimePicker_t_conv.Size = new System.Drawing.Size(83, 20); + this.dateTimePicker_t_conv.TabIndex = 6; + this.dateTimePicker_t_conv.Value = new System.DateTime(2017, 1, 1, 0, 0, 0, 0); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(30, 23); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(99, 13); + this.label6.TabIndex = 5; + this.label6.Text = "T. trabajo convenio"; + // + // pictureBox3 + // + this.pictureBox3.Image = global::OliviaAddIn.Properties.Resources.sand; + this.pictureBox3.Location = new System.Drawing.Point(14, 31); + this.pictureBox3.Name = "pictureBox3"; + this.pictureBox3.Size = new System.Drawing.Size(113, 125); + this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox3.TabIndex = 0; + this.pictureBox3.TabStop = false; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(626, 19); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(32, 13); + this.label13.TabIndex = 15; + this.label13.Text = "km/h"; + // + // textBox_v_despl + // + this.textBox_v_despl.Location = new System.Drawing.Point(537, 19); + this.textBox_v_despl.Name = "textBox_v_despl"; + this.textBox_v_despl.Size = new System.Drawing.Size(83, 20); + this.textBox_v_despl.TabIndex = 14; + this.textBox_v_despl.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(397, 22); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(130, 13); + this.label14.TabIndex = 13; + this.label14.Text = "Velocidad desplazamiento"; + // + // dateTimePicker_despl + // + this.dateTimePicker_despl.CustomFormat = "HH \'h\' mm \'m\'"; + this.dateTimePicker_despl.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker_despl.Location = new System.Drawing.Point(282, 49); + this.dateTimePicker_despl.MaxDate = new System.DateTime(2017, 1, 2, 0, 0, 0, 0); + this.dateTimePicker_despl.MinDate = new System.DateTime(2017, 1, 1, 0, 0, 0, 0); + this.dateTimePicker_despl.Name = "dateTimePicker_despl"; + this.dateTimePicker_despl.ShowUpDown = true; + this.dateTimePicker_despl.Size = new System.Drawing.Size(83, 20); + this.dateTimePicker_despl.TabIndex = 8; + this.dateTimePicker_despl.Value = new System.DateTime(2017, 1, 1, 0, 0, 0, 0); + // + // dateTimePicker_carg + // + this.dateTimePicker_carg.CustomFormat = "HH \'h\' mm \'m\'"; + this.dateTimePicker_carg.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker_carg.Location = new System.Drawing.Point(282, 19); + this.dateTimePicker_carg.MaxDate = new System.DateTime(2017, 1, 2, 0, 0, 0, 0); + this.dateTimePicker_carg.MinDate = new System.DateTime(2017, 1, 1, 0, 0, 0, 0); + this.dateTimePicker_carg.Name = "dateTimePicker_carg"; + this.dateTimePicker_carg.ShowUpDown = true; + this.dateTimePicker_carg.Size = new System.Drawing.Size(83, 20); + this.dateTimePicker_carg.TabIndex = 4; + this.dateTimePicker_carg.Value = new System.DateTime(2017, 1, 1, 0, 0, 0, 0); + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(185, 53); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(88, 13); + this.label8.TabIndex = 7; + this.label8.Text = "T. desplaz. ini/fin"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(171, 22); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(102, 13); + this.label9.TabIndex = 3; + this.label9.Text = "T. carga y descarga"; + // + // label_t_tto + // + this.label_t_tto.AutoSize = true; + this.label_t_tto.Location = new System.Drawing.Point(627, 52); + this.label_t_tto.Name = "label_t_tto"; + this.label_t_tto.Size = new System.Drawing.Size(23, 13); + this.label_t_tto.TabIndex = 2; + this.label_t_tto.Text = "min"; + // + // textBox_t_tto + // + this.textBox_t_tto.Location = new System.Drawing.Point(537, 49); + this.textBox_t_tto.Name = "textBox_t_tto"; + this.textBox_t_tto.Size = new System.Drawing.Size(83, 20); + this.textBox_t_tto.TabIndex = 1; + this.textBox_t_tto.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // label_t_tto_def + // + this.label_t_tto_def.AutoSize = true; + this.label_t_tto_def.Location = new System.Drawing.Point(414, 52); + this.label_t_tto_def.Name = "label_t_tto_def"; + this.label_t_tto_def.Size = new System.Drawing.Size(112, 13); + this.label_t_tto_def.TabIndex = 0; + this.label_t_tto_def.Text = "Tiempo de tratamiento"; + // + // numericUpDown_sectores + // + this.numericUpDown_sectores.Location = new System.Drawing.Point(555, 24); + this.numericUpDown_sectores.Maximum = new decimal(new int[] { + 50, + 0, + 0, + 0}); + this.numericUpDown_sectores.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDown_sectores.Name = "numericUpDown_sectores"; + this.numericUpDown_sectores.ReadOnly = true; + this.numericUpDown_sectores.Size = new System.Drawing.Size(60, 20); + this.numericUpDown_sectores.TabIndex = 17; + this.numericUpDown_sectores.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.numericUpDown_sectores.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(468, 26); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(77, 13); + this.label16.TabIndex = 16; + this.label16.Text = "Nº de sectores"; + // + // numericUpDown_pctrl + // + this.numericUpDown_pctrl.Location = new System.Drawing.Point(313, 23); + this.numericUpDown_pctrl.Maximum = new decimal(new int[] { + 50, + 0, + 0, + 0}); + this.numericUpDown_pctrl.Minimum = new decimal(new int[] { + 3, + 0, + 0, + 0}); + this.numericUpDown_pctrl.Name = "numericUpDown_pctrl"; + this.numericUpDown_pctrl.ReadOnly = true; + this.numericUpDown_pctrl.Size = new System.Drawing.Size(46, 20); + this.numericUpDown_pctrl.TabIndex = 12; + this.numericUpDown_pctrl.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.numericUpDown_pctrl.Value = new decimal(new int[] { + 3, + 0, + 0, + 0}); + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(209, 28); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(90, 13); + this.label10.TabIndex = 11; + this.label10.Text = "Puntos de control"; + // + // bt_planifica + // + this.bt_planifica.Image = global::OliviaAddIn.Properties.Resources.plan; + this.bt_planifica.Location = new System.Drawing.Point(585, 670); + this.bt_planifica.Name = "bt_planifica"; + this.bt_planifica.Size = new System.Drawing.Size(110, 32); + this.bt_planifica.TabIndex = 19; + this.bt_planifica.Text = "Planificar"; + this.bt_planifica.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.toolTip.SetToolTip(this.bt_planifica, "Calcular planificación"); + this.bt_planifica.UseVisualStyleBackColor = true; + this.bt_planifica.Click += new System.EventHandler(this.bt_planifica_Click); + // + // button_eje + // + this.button_eje.Image = global::OliviaAddIn.Properties.Resources.play; + this.button_eje.Location = new System.Drawing.Point(468, 670); + this.button_eje.Name = "button_eje"; + this.button_eje.Size = new System.Drawing.Size(110, 32); + this.button_eje.TabIndex = 5; + this.button_eje.Text = "Sectorizar"; + this.button_eje.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.toolTip.SetToolTip(this.button_eje, "Calcular sectorización"); + this.button_eje.UseVisualStyleBackColor = true; + this.button_eje.Click += new System.EventHandler(this.button_eje_Click); + // + // label11 + // + this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label11.ForeColor = System.Drawing.SystemColors.HotTrack; + this.label11.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label11.Location = new System.Drawing.Point(364, 23); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(25, 18); + this.label11.TabIndex = 5; + this.toolTip.SetToolTip(this.label11, "Al menos son Inicio, Fin y Bocadillo, y se reparten equidistantes en la ruta"); + // + // label17 + // + this.label17.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label17.ForeColor = System.Drawing.SystemColors.HotTrack; + this.label17.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label17.Location = new System.Drawing.Point(364, 57); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(25, 18); + this.label17.TabIndex = 25; + this.toolTip.SetToolTip(this.label17, "El programa calcula el número de sectores en base a los tiempos configurados de j" + + "ornada, etc."); + // + // label18 + // + this.label18.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label18.Location = new System.Drawing.Point(622, 57); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(25, 18); + this.label18.TabIndex = 26; + this.toolTip.SetToolTip(this.label18, "Dado el número de sectores elegido, en vez de calcularlos para que tengan la mism" + + "a duración, se elgien los primeros ajustados a la jornada, y el último con el re" + + "sto de ámbitos"); + // + // groupBox7 + // + this.groupBox7.Controls.Add(this.label18); + this.groupBox7.Controls.Add(this.label17); + this.groupBox7.Controls.Add(this.pictureBox4); + this.groupBox7.Controls.Add(this.checkBox_ajust_sec); + this.groupBox7.Controls.Add(this.checkBox_sector_autom); + this.groupBox7.Controls.Add(this.numericUpDown_sectores); + this.groupBox7.Controls.Add(this.label16); + this.groupBox7.Controls.Add(this.numericUpDown_pctrl); + this.groupBox7.Controls.Add(this.label10); + this.groupBox7.Controls.Add(this.label11); + this.groupBox7.Location = new System.Drawing.Point(10, 367); + this.groupBox7.Name = "groupBox7"; + this.groupBox7.Size = new System.Drawing.Size(660, 108); + this.groupBox7.TabIndex = 18; + this.groupBox7.TabStop = false; + this.groupBox7.Text = "Control"; + // + // pictureBox4 + // + this.pictureBox4.Image = global::OliviaAddIn.Properties.Resources.Asset_tracking_and_management; + this.pictureBox4.InitialImage = null; + this.pictureBox4.Location = new System.Drawing.Point(14, 12); + this.pictureBox4.Name = "pictureBox4"; + this.pictureBox4.Size = new System.Drawing.Size(120, 90); + this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox4.TabIndex = 24; + this.pictureBox4.TabStop = false; + // + // checkBox_ajust_sec + // + this.checkBox_ajust_sec.AutoSize = true; + this.checkBox_ajust_sec.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; + this.checkBox_ajust_sec.Location = new System.Drawing.Point(466, 58); + this.checkBox_ajust_sec.Name = "checkBox_ajust_sec"; + this.checkBox_ajust_sec.Size = new System.Drawing.Size(151, 17); + this.checkBox_ajust_sec.TabIndex = 22; + this.checkBox_ajust_sec.Text = "Ajustar sectores a jornada "; + this.checkBox_ajust_sec.UseVisualStyleBackColor = true; + // + // checkBox_sector_autom + // + this.checkBox_sector_autom.AutoSize = true; + this.checkBox_sector_autom.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; + this.checkBox_sector_autom.Location = new System.Drawing.Point(208, 59); + this.checkBox_sector_autom.Name = "checkBox_sector_autom"; + this.checkBox_sector_autom.Size = new System.Drawing.Size(151, 17); + this.checkBox_sector_autom.TabIndex = 21; + this.checkBox_sector_autom.Text = "Nº de sectores automático"; + this.checkBox_sector_autom.UseVisualStyleBackColor = true; + this.checkBox_sector_autom.CheckedChanged += new System.EventHandler(this.checkBox_sector_autom_CheckedChanged); + // + // groupBox_edits + // + this.groupBox_edits.Controls.Add(this.groupBox7); + this.groupBox_edits.Controls.Add(this.groupBox2); + this.groupBox_edits.Controls.Add(this.groupBox3); + this.groupBox_edits.Controls.Add(this.groupBox1); + this.groupBox_edits.Location = new System.Drawing.Point(14, 2); + this.groupBox_edits.Name = "groupBox_edits"; + this.groupBox_edits.Size = new System.Drawing.Size(681, 662); + this.groupBox_edits.TabIndex = 20; + this.groupBox_edits.TabStop = false; + // + // checkBox_aislados + // + this.checkBox_aislados.AutoSize = true; + this.checkBox_aislados.Location = new System.Drawing.Point(280, 679); + this.checkBox_aislados.Name = "checkBox_aislados"; + this.checkBox_aislados.Size = new System.Drawing.Size(164, 17); + this.checkBox_aislados.TabIndex = 21; + this.checkBox_aislados.Text = "Descartar elementos aislados"; + this.checkBox_aislados.UseVisualStyleBackColor = true; + // + // btn_help + // + this.btn_help.Image = global::OliviaAddIn.Properties.Resources.system_help; + this.btn_help.Location = new System.Drawing.Point(14, 675); + this.btn_help.Name = "btn_help"; + this.btn_help.Size = new System.Drawing.Size(29, 23); + this.btn_help.TabIndex = 22; + this.btn_help.UseVisualStyleBackColor = true; + this.btn_help.Click += new System.EventHandler(this.btn_help_Click); + // + // textBox_buff + // + this.textBox_buff.Location = new System.Drawing.Point(534, 73); + this.textBox_buff.Name = "textBox_buff"; + this.textBox_buff.Size = new System.Drawing.Size(83, 20); + this.textBox_buff.TabIndex = 29; + // + // label23 + // + this.label23.AutoSize = true; + this.label23.Location = new System.Drawing.Point(455, 77); + this.label23.Name = "label23"; + this.label23.Size = new System.Drawing.Size(73, 13); + this.label23.TabIndex = 28; + this.label23.Text = "Buffer de exp."; + // + // label24 + // + this.label24.AutoSize = true; + this.label24.Location = new System.Drawing.Point(630, 77); + this.label24.Name = "label24"; + this.label24.Size = new System.Drawing.Size(15, 13); + this.label24.TabIndex = 27; + this.label24.Text = "m"; + // + // LimpiezaDlg + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScroll = true; + this.BackColor = System.Drawing.SystemColors.Control; + this.ClientSize = new System.Drawing.Size(704, 722); + this.Controls.Add(this.btn_help); + this.Controls.Add(this.checkBox_aislados); + this.Controls.Add(this.bt_planifica); + this.Controls.Add(this.button_eje); + this.Controls.Add(this.groupBox_edits); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.HelpButton = true; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.Name = "LimpiezaDlg"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "OLIVIA | Limpieza Viaria"; + this.TopMost = true; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.LimpiezaDlg_FormClosed); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.groupBox6.ResumeLayout(false); + this.groupBox6.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_sectores)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_pctrl)).EndInit(); + this.groupBox7.ResumeLayout(false); + this.groupBox7.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit(); + this.groupBox_edits.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.ComboBox comboBox_tto; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.PictureBox pictureBox2; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.Label label_t_tto_def; + private System.Windows.Forms.TextBox textBox_t_tto; + private System.Windows.Forms.Label label_t_tto; + private System.Windows.Forms.DateTimePicker dateTimePicker_t_conv; + private System.Windows.Forms.DateTimePicker dateTimePicker_t_desc; + private System.Windows.Forms.DateTimePicker dateTimePicker_despl; + private System.Windows.Forms.DateTimePicker dateTimePicker_carg; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.NumericUpDown numericUpDown_pctrl; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.CheckBox checkBox_restr; + private System.Windows.Forms.ToolTip toolTip; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Button button_eje; + private System.Windows.Forms.ComboBox comboBox_amb; + private CheckedListBoxEx checkedListBox_amb; + private System.Windows.Forms.Label label_checkambs; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.TextBox textBox_v_despl; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.Label label_restric; + private System.Windows.Forms.Label label_uds_anch_med; + private System.Windows.Forms.TextBox textBox_ancho_medio; + private System.Windows.Forms.Label label_ancho_medio; + private System.Windows.Forms.Button bt_niveles; + private System.Windows.Forms.Label label_niv; + private System.Windows.Forms.Button bt_zonas; + private System.Windows.Forms.Label label_zon; + private System.Windows.Forms.NumericUpDown numericUpDown_sectores; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.PictureBox pictureBox3; + private System.Windows.Forms.GroupBox groupBox7; + private System.Windows.Forms.Button bt_instalaciones; + private System.Windows.Forms.Label instal_sel; + private System.Windows.Forms.CheckBox checkBox_papelera; + private System.Windows.Forms.TextBox tbox_umbral_recog; + private System.Windows.Forms.Label label_umbral_recog; + private System.Windows.Forms.CheckBox checkBox_sector_autom; + private System.Windows.Forms.Button bt_planifica; + private System.Windows.Forms.GroupBox groupBox_edits; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.CheckBox checkBox_ajust_sec; + private System.Windows.Forms.PictureBox pictureBox4; + private System.Windows.Forms.DateTimePicker dateTimePicker_h_inicio; + private System.Windows.Forms.Label label_h_inicio; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.TextBox textBox_traf; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.CheckBox checkBox_aislados; + private System.Windows.Forms.Button btn_help; + private System.Windows.Forms.Button bt_restric_circ; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.Label label22; + private System.Windows.Forms.Label label21; + private System.Windows.Forms.Label label20; + private System.Windows.Forms.Button button_capa_limp; + private System.Windows.Forms.Label label_capa_limp; + private System.Windows.Forms.Button button_edit_camp; + private System.Windows.Forms.TextBox textBox_buff; + private System.Windows.Forms.Label label23; + private System.Windows.Forms.Label label24; + } +} \ No newline at end of file diff --git a/OliviaAddIn/LimpiezaDlg.cs b/OliviaAddIn/LimpiezaDlg.cs new file mode 100644 index 0000000..1cf417d --- /dev/null +++ b/OliviaAddIn/LimpiezaDlg.cs @@ -0,0 +1,1183 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Collections; + +using OliviaDef; +using ESRI.ArcGIS.Geodatabase; +using ESRI.ArcGIS.DataSourcesFile; +using ESRI.ArcGIS.esriSystem; +using ESRI.ArcGIS.Carto; +using ESRI.ArcGIS.DataSourcesGDB; +using System.Diagnostics; +using ESRI.ArcGIS.Geometry; + +namespace OliviaAddIn +{ + /** + * @file LimpiezaDlg.cs + * Clase de la ventana de configuración de la herramienta de Limpieza Viaria. + * Contiene el manejo de sus eventos como el Click o la actualización de su estado. + */ + /** + * Clase de la ventana de configuración de la herramienta de Limpieza Viaria. + * Contiene el manejo de sus eventos como el Click o la actualización de su estado. + */ + public partial class LimpiezaDlg : Form + { + //************************************************************************************* + //Variables + /** + * Modos de selección de los niveles y zonas. + */ + public enum ModosNiv + { + ModTodos, //= 0) && + (!m_ambs_gdb[(int)m_ambs_list[e.Index].amb_i])) + { + System.Windows.Forms.VisualStyles.CheckBoxState state = System.Windows.Forms.VisualStyles.CheckBoxState.UncheckedDisabled; + Size glyphSize = CheckBoxRenderer.GetGlyphSize(e.Graphics, state); + CheckBoxRenderer.DrawCheckBox( + e.Graphics, + new System.Drawing.Point(e.Bounds.X + 1, e.Bounds.Y + 1), // add one pixel to align the check gliph properly + new Rectangle( + new System.Drawing.Point(e.Bounds.X + glyphSize.Width + 3, e.Bounds.Y), // add three pixels to align text properly + new Size(e.Bounds.Width - glyphSize.Width, e.Bounds.Height)), + m_ambs_list[e.Index].amb_str, + this.Font, + TextFormatFlags.Left, // text is centered by default + false, + state); + } + else + { + base.OnDrawItem(e); + } + } + } + /** + * Array de variables de tipo AmbitsList para mostrar en la lista, se rellena al elegir el tipo de tratamiento + */ + ArrayList ambs_list = null; + /** + * Array de variables de tipo AmbitsList para mostrar en la lista, para la opción editable (puedes elegir cualquier ámbito) + */ + ArrayList ambs_list_tod_lin = null; + /** + * Array de variables de tipo AmbitsList para mostrar en la lista, para la opción editable (puedes elegir cualquier ámbito) + */ + ArrayList ambs_list_tod_pto = null; + /** + * Array de variables de tipo AmbitsList para mostrar en la lista, para la opción genérica (puedes elegir los ejes de las calles) + */ + ArrayList ambs_list_eje = null; + /** + * Matriz que da true aquellos ámbitos de trabajo que están contemplados en .gdb una vez leida + */ + bool[] amb_tra_gdb = null; + /** + * Instancia que contiene las variables de la clase + */ + public Limpieza limp = null; + /** + * Cadena general para indicar los errores + */ + public String err_str = ""; + //************************************************************************************* + //Métodos + public LimpiezaDlg() + { + InitializeComponent(); + limp = new Limpieza(); + inicia(); + } + + /** + * Inicializa los elementos de la ventana: rellena los boxes etc + */ + private void inicia() + { + try + { + //rellena los checkboxes y listboxes + LimpiezaDef.rellena_matrs(); + if (OliviaGlob.demo_id == true) + { + LimpiezaDef.tipos_tto_str = new string[1]; + LimpiezaDef.tipos_tto_str[0] = "Vaciado de papeleras"; + } + comboBox_tto.Items.Clear(); + comboBox_tto.Items.AddRange(LimpiezaDef.tipos_tto_str); + checkedListBox_amb.Items.Clear(); + amb_tra_gdb = OliviaGlob.gdb_limp.lee_amb_gdb(limp); + checkedListBox_amb.pon_ambs_gdb(amb_tra_gdb); + + //habilita y deshabilita botones + textBox_v_despl.Enabled = false; + //no permite visualizar los elementos del ancho de vía que se acivará cuando se seleccione la opción genérica de ejes de calle + label_ancho_medio.Visible = false; + textBox_ancho_medio.Visible = false; + label_uds_anch_med.Visible = false; + //no permite visualizar los elementos del umbral de recogida de basuras + label_umbral_recog.Visible = false; + tbox_umbral_recog.Visible = false; + //pone el numero de sectores por defecto + numericUpDown_sectores.Value = (decimal)limp.n_secdef; + //rellena los tiempos + inicia_timepickers(); + //rellena el factor de tráfico + textBox_traf.Text = limp.trafico.ToString(); + textBox_buff.Text = OliviaGlob.buff_export.ToString(); + + //////////////////////////////////////////////////////////////// + //pone los textos iniciales + instal_sel.Text = limp.text_selec_instal; + label_niv.Text = limp.text_selec_nive; + label_restric.Text = limp.text_selec_rest; + label_zon.Text = limp.text_selec_zonas; + label_capa_limp.Text = limp.text_capa_limp; + + if (!OliviaGlob.gdb_limp.comprueba_campos_limp(limp)) + { + MessageBox.Show(limp.err_st, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + catch (Exception) + { + MessageBox.Show("Error al iniciar la ventana de Limpieza", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + /** + * Inicializa los controles de los tiempos + */ + public void inicia_timepickers() + { + int[] hm; + DateTime tmin = new DateTime(2017,01,01,0,0,0); + DateTime tmax = new DateTime(2017,01,02,0,0,0); + + //t tratamiento + cambia_tiempo_tto(); + + //t convenio + hm = OliviaGlob.dame_h_m(limp.t_conv); + dateTimePicker_t_conv.MinDate = tmin; + dateTimePicker_t_conv.MaxDate = tmax; + dateTimePicker_t_conv.Value = new DateTime(2017,01,01,hm[0],hm[1],0); + + //t descanso del personal + hm = OliviaGlob.dame_h_m(limp.t_descan); + dateTimePicker_t_desc.MinDate = tmin; + dateTimePicker_t_desc.MaxDate = tmax; + dateTimePicker_t_desc.Value = new DateTime(2017, 01, 01, hm[0], hm[1], 0); + + //t carga y descarga + hm = OliviaGlob.dame_h_m(limp.t_descarg); + dateTimePicker_carg.MinDate = tmin; + dateTimePicker_carg.MaxDate = tmax; + dateTimePicker_carg.Value = new DateTime(2017, 01, 01, hm[0], hm[1], 0); + + //t desplazamiento inicio/fin + hm = OliviaGlob.dame_h_m(limp.t_despl_insta); + dateTimePicker_despl.MinDate = tmin; + dateTimePicker_despl.MaxDate = tmax; + dateTimePicker_despl.Value = new DateTime(2017, 01, 01, hm[0], hm[1], 0); + + //hora de inicio de la jornada + hm = OliviaGlob.dame_h_m(limp.h_ini); + dateTimePicker_h_inicio.MinDate = tmin; + dateTimePicker_h_inicio.MaxDate = tmax; + dateTimePicker_h_inicio.Value = new DateTime(2017, 01, 01, hm[0], hm[1], 0); + } + + /**Pone en la lista los ámbitos de trabajo en función del tipo de tratamiento + * Los comunes y no comunes a sus opciones. Luego checkea los correspondientes a la opción + */ + private ArrayList pon_ambitos() + { + ArrayList lista = null; + try + { + if (limp.tipo_tto == (int)LimpiezaDef.TiposTto.TtoNoDef) + { + checkedListBox_amb.Items.Clear(); + return lista; + } + + rellena_amb_list(); + if ((comboBox_amb.SelectedIndex == 0) && ((limp.tipo_tto < (int)LimpiezaDef.TiposTto.TtoPapeVaci) || (limp.tipo_tto >= (int)LimpiezaDef.TiposTto.TtoCustom))) + { + checkedListBox_amb.DataSource = ambs_list_tod_lin; + checkedListBox_amb.DisplayMember = "amb_str"; + lista = ambs_list_tod_lin; + } + else if ((comboBox_amb.SelectedIndex == 0) && (limp.tipo_tto > (int)LimpiezaDef.TiposTto.TtoCaidaHoja)) + { + checkedListBox_amb.DataSource = ambs_list_tod_pto; + checkedListBox_amb.DisplayMember = "amb_str"; + lista = ambs_list_tod_pto; + } + else if (comboBox_amb.SelectedIndex == 1) + { + checkedListBox_amb.DataSource = ambs_list_eje; + checkedListBox_amb.DisplayMember = "amb_str"; + lista = ambs_list_eje; + } + else + { + checkedListBox_amb.DataSource = ambs_list; + checkedListBox_amb.DisplayMember = "amb_str"; + lista = ambs_list; + } + checkedListBox_amb.Enabled = false; //se inicia deshabilitado + check_ambitos(-1, lista); //para resetear los checks + + //comprueba si están en la gdb, avisa al listbox para que pinte los que no + hay_alguno_des = false; + checkedListBox_amb.pon_ambs_list(lista.Cast().ToArray()); + for (int i = 0; i < lista.Count; i++) + { + if (!amb_tra_gdb[(int)((AmbitsList)lista[i]).amb_i]) + { + hay_alguno_des = true; + break; + } + } + //si hay algún ámbito que no está en la gdb, pone el tooltip + if (hay_alguno_des) + { + label_checkambs.ForeColor = System.Drawing.SystemColors.HotTrack; + toolTip.SetToolTip(label_checkambs, "Aparecen deshabilitados los ámbitos que no tienen entidades en la base de datos"); + } + else + { + label_checkambs.ForeColor = System.Drawing.SystemColors.Control; + toolTip.SetToolTip(label_checkambs, ""); + } + return lista; + } + catch (Exception) + { + MessageBox.Show("Error al poner los ámbitos", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return null; + } + + } + + /** + * Rellena una lista con los ámbitos comunes y no comunes para mostrar en el listbox en función del tipo de tratamiento + */ + private void rellena_amb_list() + { + bool[] amb_val; + bool[] amb_val_tod; + bool[] amb_val_eje; + + //lo hace para todos los tratamientos excepto para el Customizble ya que sólo se quieren mostrar las opciones alternaitvas al tratamiento + if (limp.tipo_tto < (int)LimpiezaDef.TiposTto.TtoCustom) + { + //pide un array de booleanos donde es true en las posiciones de los ámbitos comunes + amb_val = limp.dame_amb(limp.tipo_tto); + //crea un array con el número de elementos del array anterior que sean true + ambs_list = new ArrayList(amb_val.Count(x => x));//cuenta los trues + //rellena el array apuntando los índices y los textos correspondientes a los trues + for (int i = 0; i < amb_val.Length; i++) + { + if (amb_val[i]) + { + ambs_list.Add(new AmbitsList((LimpiezaDef.AmbitsTra)i,LimpiezaDef.ambits_tra_str[i])); + } + } + } + + //se hace lo mismo para la opción que da la posibilidad de seleccionar cualquier ámbito lineal + amb_val_tod = limp.ambs_val[(int)LimpiezaDef.TiposTto.TtoCustom].ambs_ops[0].ambs; + ambs_list_tod_lin = new ArrayList(amb_val_tod.Count(x => x)); + for (int i = 0; i < amb_val_tod.Length; i++) + { + if (amb_val_tod[i]) + { + ambs_list_tod_lin.Add(new AmbitsList((LimpiezaDef.AmbitsTra)i, LimpiezaDef.ambits_tra_str[i])); + } + } + + //se hace lo mismo para la opción que da la posibilidad de seleccionar cualquier ámbito puntual + amb_val_tod = limp.ambs_val[(int)LimpiezaDef.TiposTto.TtoCustom].ambs_ops[1].ambs; + ambs_list_tod_pto = new ArrayList(amb_val_tod.Count(x => x)); + for (int i = 0; i < amb_val_tod.Length; i++) + { + if (amb_val_tod[i]) + { + ambs_list_tod_pto.Add(new AmbitsList((LimpiezaDef.AmbitsTra)i, LimpiezaDef.ambits_tra_str[i])); + } + } + + //se hace lo mismo para la opción que permite seleccionar únicamente los ejes de calle + amb_val_eje = limp.ambs_val[(int)LimpiezaDef.TiposTto.TtoCustom].ambs_ops[2].ambs; + ambs_list_eje = new ArrayList(amb_val_eje.Count(x => x)); + for (int i = 0; i < amb_val_eje.Length; i++) + { + if (amb_val_eje[i]) + { + ambs_list_eje.Add(new AmbitsList((LimpiezaDef.AmbitsTra)i, LimpiezaDef.ambits_tra_str[i])); + } + } + } + + /**Checkea de la lista los ámbitos de trabajo en función del tipo de tratamiento + * y la opción elegida + */ + private void check_ambitos(int iop, ArrayList lista) + { + bool check = false; + if (lista == null) + return; + for (int i = 0; i < lista.Count; i++) + { + check = false; + if (iop < 0) + { + //para reseteo + checkedListBox_amb.SetItemChecked(i,false); + } + else if (iop == 0) + { + //dependiendo del tratamiento seleccionado en la opción 0(Editable) se seleccionarán diferentes opciones del TtoCustom(diferenciando entre ttos lineales o puntuales) + //para ámbitos lineales + if (limp.tipo_tto < (int)LimpiezaDef.TiposTto.TtoPapeVaci) + { + check = limp.ambs_val[(int)LimpiezaDef.TiposTto.TtoCustom].ambs_ops[iop].ambs[(int)((AmbitsList)lista[i]).amb_i] + && amb_tra_gdb[(int)((AmbitsList)lista[i]).amb_i]; + checkedListBox_amb.SetItemChecked(i, check); + } + //para ámbitos puntuales + else if ((limp.tipo_tto > (int)LimpiezaDef.TiposTto.TtoCaidaHoja) && (limp.tipo_tto < (int)LimpiezaDef.TiposTto.TtoCustom)) + { + //es la opción Genérica que es la opción 1 del TtoCustom, de ahi que el índice sea [iop + 1] + check = limp.ambs_val[(int)LimpiezaDef.TiposTto.TtoCustom].ambs_ops[iop + 1].ambs[(int)((AmbitsList)lista[i]).amb_i] + && amb_tra_gdb[(int)((AmbitsList)lista[i]).amb_i]; + checkedListBox_amb.SetItemChecked(i, check); + } + //para ámbito custom + else + { + check = limp.ambs_val[(int)LimpiezaDef.TiposTto.TtoCustom].ambs_ops[iop].ambs[(int)((AmbitsList)lista[i]).amb_i] + && amb_tra_gdb[(int)((AmbitsList)lista[i]).amb_i]; + checkedListBox_amb.SetItemChecked(i, check); + } + } + else if (iop == 1) + { + //es la opción Genérica que es la opción 2 del TtoCustom, de ahi que el índice sea [iop + 1] + check = limp.ambs_val[(int)LimpiezaDef.TiposTto.TtoCustom].ambs_ops[iop + 1].ambs[(int)((AmbitsList)lista[i]).amb_i] + && amb_tra_gdb[(int)((AmbitsList)lista[i]).amb_i]; + checkedListBox_amb.SetItemChecked(i, check); + } + else if ((iop - 2) < (limp.ambs_val[(int)limp.tipo_tto].n_ops)) + { + //pone el check si el elemento que aparece en la lista porque es común o no común + //esa opción en concreto le tiene + check = limp.ambs_val[(int)limp.tipo_tto].ambs_ops[iop-2].ambs[(int)((AmbitsList)lista[i]).amb_i] + && amb_tra_gdb[(int)((AmbitsList)lista[i]).amb_i]; + checkedListBox_amb.SetItemChecked(i, check); + } + + } + } + + /** + * Añade a la lista de ambitos seleccionados los que están checkeados de la lista de posibles + */ + private bool lee_ambitos() + { + limp.amb_tra_sel = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //reinicia los ambitos seleccionados + if (checkedListBox_amb.CheckedItems.Count == 0) + return false; + else if ((comboBox_amb.SelectedIndex == 0) && (limp.tipo_tto < (int)LimpiezaDef.TiposTto.TtoPapeVaci)) + { + for (int i = 0; i < checkedListBox_amb.Items.Count; i++) + { + //lo pone a true si ese elemento está checkeado, para lo que coge el índice al array de ámbitos de ese elemento + if (checkedListBox_amb.GetItemChecked(i)) + limp.amb_tra_sel[(int)((AmbitsList)ambs_list_tod_lin[i]).amb_i] = true; + } + } + else if ((comboBox_amb.SelectedIndex == 0) && (limp.tipo_tto >= (int)LimpiezaDef.TiposTto.TtoPapeVaci)) + { + for (int i = 0; i < checkedListBox_amb.Items.Count; i++) + { + //lo pone a true si ese elemento está checkeado, para lo que coge el índice al array de ámbitos de ese elemento + if (checkedListBox_amb.GetItemChecked(i)) + limp.amb_tra_sel[(int)((AmbitsList)ambs_list_tod_pto[i]).amb_i] = true; + } + } + else if (comboBox_amb.SelectedIndex == 1) + { + for (int i = 0; i < checkedListBox_amb.Items.Count; i++) + { + //lo pone a true si ese elemento está checkeado, para lo que coge el índice al array de ámbitos de ese elemento + if (checkedListBox_amb.GetItemChecked(i)) + limp.amb_tra_sel[(int)((AmbitsList)ambs_list_eje[i]).amb_i] = true; + } + } + else + { + for (int i = 0; i < checkedListBox_amb.Items.Count; i++) + { + //lo pone a true si ese elemento está checkeado, para lo que coge el índice al array de ámbitos de ese elemento + if (checkedListBox_amb.GetItemChecked(i)) + limp.amb_tra_sel[(int)((AmbitsList)ambs_list[i]).amb_i] = true; + } + } + if (limp.amb_tra_sel[(int)LimpiezaDef.AmbitsTra.AmbEjeCalle])//si es ámbito tipo eje de calle + { + if (limp.uds_t_tto == (int)GeneralDef.OlvTiposTto.OlvTipTtoMh) + limp.uds_t_tto = (int)GeneralDef.OlvTiposTto.OlvTipTtoMh_eje; + else if (limp.uds_t_tto == (int)GeneralDef.OlvTiposTto.OlvTipTtoM2h) + limp.uds_t_tto = (int)GeneralDef.OlvTiposTto.OlvTipTtoM2h_eje; + } + return true; + } + + /** + * Cambio el tiempo del tratamiento en función del tipo de tratamiento seleccionado + */ + private void cambia_tiempo_tto() + { + if (limp.tipo_tto == (int)LimpiezaDef.TiposTto.TtoNoDef) + { + //no está definido + label_t_tto.Text = ""; + textBox_t_tto.Text = ""; + textBox_t_tto.Enabled = false; + label_t_tto_def.Text = "Tiempo de tratamiento"; + return; + } + else if (limp.tipo_tto >= (int)LimpiezaDef.TiposTto.TtoPapeVaci) + { + //tipo puntual, el tiempo es en minutos + label_t_tto.Text = "min"; + label_t_tto_def.Text = "Tiempo de tratamiento"; + limp.uds_t_tto = (int)OliviaDef.GeneralDef.OlvTiposTto.OlvTipTtoMin; + } + else if ((limp.tipo_tto == (int)LimpiezaDef.TiposTto.TtoBarrMecCalz) || + (limp.tipo_tto == (int)LimpiezaDef.TiposTto.TtoBaldMecCalz)) + { + //tipo lineal, es velocidad en m/h + label_t_tto.Text = "m/h"; + label_t_tto_def.Text = "Veloci. de tratamiento"; + limp.uds_t_tto = (int)OliviaDef.GeneralDef.OlvTiposTto.OlvTipTtoMh; + } + else + { + //tipo lineal, es velocidad en m2/h + label_t_tto.Text = "m2/h"; + label_t_tto_def.Text = "Veloci. de tratamiento"; + limp.uds_t_tto = (int)OliviaDef.GeneralDef.OlvTiposTto.OlvTipTtoM2h; + } + + textBox_t_tto.Enabled = true; + textBox_t_tto.Text = LimpiezaDef.tiempos_tto[(int)limp.tipo_tto].ToString(); + } + + /** + * Lee los elementos de la ventana y guarda los parámetros + */ + private bool lee() + { + string str_aux; + + try + { + //lee el tipo de tratamiento + if (OliviaGlob.demo_id == true) + { + if (comboBox_tto.SelectedIndex != -1) + limp.tipo_tto = (int)LimpiezaDef.TiposTto.TtoPapeVaci; + } + else + limp.tipo_tto = comboBox_tto.SelectedIndex; + + if (limp.tipo_tto == (int)LimpiezaDef.TiposTto.TtoNoDef) + { + err_str = "No se ha seleccionado ningún Tipo de Tratamiento"; + return false; + } + + //lee el ámbito seleccionado + if (!lee_ambitos()) + { + err_str = "No se ha seleccionado ningún Ámbito de trabajo"; + return false; + } + + //lee el ancho medio de la vía si está visible (se ha seleccionado la opción genérica Eje de calles) + limp.ancho_via = LimpiezaDef.Parametros.ancho_via; + if (textBox_ancho_medio.Visible) + { + try + { + str_aux = textBox_ancho_medio.Text; + limp.ancho_via = Convert.ToDouble(str_aux); + if ((limp.ancho_via == 0) || (limp.ancho_via > LimpiezaDef.Parametros.ancho_viaM) || (limp.ancho_via < LimpiezaDef.Parametros.ancho_viam)) + { + err_str = "El ancho de la vía no está dentro de los límites configurados"; + return false; + } + } + catch (FormatException) + { + err_str = "El formato introducido para el ancho de la vía no es válido."; + return false; + } + } + + //cuando se ejecuta el proceso se compurueba si se va a tener en cuenta el umbral de carga de los contendores en su recogida + if ((checkBox_papelera.Visible == true) && (checkBox_papelera.Checked == true)) + { + limp.umbral_reco_conten = true; + try + { + limp.umbral_basura = Convert.ToDouble(tbox_umbral_recog.Text); + if (limp.umbral_basura < 0 || limp.umbral_basura>100) + { + err_str = "El umbral de carga de papeleras no está dentro de los límites configurados"; + return false; + } + } + catch (FormatException) + { + err_str = "El formato introducido para el umbral de carga de papeleras no es válido."; + return false; + } + } + else + limp.umbral_reco_conten = false; + + //lee el tiempo de tratamiento + try + { + str_aux = textBox_t_tto.Text; + limp.t_tto = Convert.ToDouble(str_aux); + if ((limp.t_tto == 0) || (limp.t_tto > LimpiezaDef.Parametros.t_ttoM) || (limp.t_tto < LimpiezaDef.Parametros.t_ttom)) + { + err_str = "El tiempo de tratamiento no está dentro de los límites configurados"; + return false; + } + } + catch (FormatException) + { + err_str = "El formato introducido para el tiempo de tratamiento no es válido."; + return false; + } + + //lee la velocidad de desplazamiento + try + { + str_aux = textBox_v_despl.Text; + if (str_aux != vel_nodef) + { + limp.v_despl = Convert.ToDouble(str_aux); + if ((limp.v_despl == 0) || (limp.v_despl > LimpiezaDef.Parametros.v_despM) || (limp.v_despl < LimpiezaDef.Parametros.v_despm)) + { + err_str = "La velocidad de desplazamiento no está dentro de los límites configurados"; + return false; + } + } + } + catch (FormatException) + { + err_str = "El formato introducido para la velocidad de desplazamiento no es válido."; + return false; + } + + //recoge el porcentaje de tráfico que se estima en las vías + try + { + limp.trafico = Convert.ToDouble(textBox_traf.Text); + if ((limp.trafico < 0) || (limp.trafico > 100)) + { + err_str = "El porcentaje de tráfico en las vías no está dentro de los límites configurados"; + return false; + } + } + catch (Exception) + { + err_str = "El formato introducido para el porcentaje de tráfico en las vías no es válido."; + return false; + } + + //lee el buffer de exportación + try + { + OliviaGlob.buff_export = Convert.ToInt32(textBox_buff.Text); + if ((OliviaGlob.buff_export < 0) || (OliviaGlob.buff_export > 10000)) + { + err_str = "El buffer de exportación no está dentro de los límites configurados"; + return false; + } + } + catch (Exception) + { + err_str = "El formato introducido para el buffer de exportación no es válido."; + return false; + } + + //lee el tiempo de trabajo al día por convenio + int[] hm = { 0, 0 }; + hm[0] = dateTimePicker_t_conv.Value.Hour; + hm[1] = dateTimePicker_t_conv.Value.Minute; + limp.t_conv = OliviaGlob.dame_min(hm); + if ((limp.t_conv == 0) || (limp.t_conv > LimpiezaDef.Parametros.t_convM) || (limp.t_conv < LimpiezaDef.Parametros.t_convm)) + { + err_str = "El valor introducido para el tiempo de trabajo por convenio no es válido."; + return false; + } + + //lee el tiempo de descanso del personal + hm[0] = dateTimePicker_t_desc.Value.Hour; + hm[1] = dateTimePicker_t_desc.Value.Minute; + limp.t_descan = OliviaGlob.dame_min(hm); + if ((limp.t_descan == 0) || (limp.t_descan > LimpiezaDef.Parametros.t_descansoM) || (limp.t_descan < LimpiezaDef.Parametros.t_descansom)) + { + err_str = "El valor introducido para el tiempo de descanso no es válido."; + return false; + } + + //lee el tiempo de carga y descarga + hm[0] = dateTimePicker_carg.Value.Hour; + hm[1] = dateTimePicker_carg.Value.Minute; + limp.t_descarg = OliviaGlob.dame_min(hm); + if ((limp.t_descarg == 0) || (limp.t_descarg > LimpiezaDef.Parametros.t_cardescM) || (limp.t_descarg < LimpiezaDef.Parametros.t_cardescm)) + { + err_str = "El valor introducido para el tiempo de carga y descarga no es válido."; + return false; + } + + //lee el tiempo de desplazamiento inicio/fin + hm[0] = dateTimePicker_despl.Value.Hour; + hm[1] = dateTimePicker_despl.Value.Minute; + limp.t_despl_insta = OliviaGlob.dame_min(hm); + if ((limp.t_despl_insta == 0) || (limp.t_despl_insta > LimpiezaDef.Parametros.t_despM) || (limp.t_despl_insta < LimpiezaDef.Parametros.t_despm)) + { + err_str = "El valor introducido para el tiempo de desplazamiento no es válido."; + return false; + } + + //lee la hora de inicio de la jornada + hm[0] = dateTimePicker_h_inicio.Value.Hour; + hm[1] = dateTimePicker_h_inicio.Value.Minute; + limp.h_ini = OliviaGlob.dame_min(hm); + + //se lee el número de puntos de control + limp.n_ptsctrl = (int)numericUpDown_pctrl.Value; + if (limp.n_ptsctrl == 0) + { + err_str = "No puede haber 0 puntos de control."; + return false; + } + + //se lee el número de sectores si se ha puesto algún valor + if (checkBox_sector_autom.Checked == true) + limp.n_secdef = 0; + else + { + limp.n_secdef = (int)numericUpDown_sectores.Value; + if (checkBox_ajust_sec.Checked == true) + limp.n_secdef = limp.n_secdef * (-1);//lo envía negativo si es modo ajusta a jornada, + } + + //lee si se va a tener en cuenta los elementos asilados o no + if (checkBox_aislados.Checked == true) + limp.aislados = 1; + else + limp.aislados = 0; + + return true; + } + catch (Exception) + { + return false; + } + } + + //************************************************************************************* + //Eventos de elementos de la ventana + /** + * Desplegable para seleccionar el tipo de tratamiento + */ + private void comboBox_tto_SelectedIndexChanged(object sender, EventArgs e) + { + try + { + textBox_v_despl.Enabled = true; + if (OliviaGlob.demo_id == true) + { + if (comboBox_tto.SelectedIndex != -1) + limp.tipo_tto = (int)LimpiezaDef.TiposTto.TtoPapeVaci; + } + else + limp.tipo_tto = comboBox_tto.SelectedIndex; + limp.amb_tra_sel = new bool[(int)LimpiezaDef.AmbitsTra.AmbN]; //reinicia los ambitos seleccionados + + cambia_tiempo_tto(); + + //////////////////////////////////////// + //Otros cambios que dependen del tratamiento + if (limp.tipo_tto != (int)LimpiezaDef.TiposTto.TtoNoDef) + { + checkBox_restr.Checked = limp.rest_circ[(int)limp.tipo_tto]; + if (limp.t_carg_desc[(int)limp.tipo_tto] == true) + dateTimePicker_carg.Enabled = true; + else + dateTimePicker_carg.Enabled = false; + + if (LimpiezaDef.v_desplazamiento[(int)limp.tipo_tto] > 0) + textBox_v_despl.Text = Convert.ToString(LimpiezaDef.v_desplazamiento[(int)limp.tipo_tto]); + else + textBox_v_despl.Text = vel_nodef; + } + else + { + checkBox_restr.Checked = false; + dateTimePicker_carg.Enabled = false; + textBox_v_despl.Text = vel_nodef; + } + + //si se selecciona el tratamiento de VACIADO DE PAPELERAS se muestra el checkbox que permite sectorizar sólo las papeleras llenas. + if (limp.tipo_tto == (int)LimpiezaDef.TiposTto.TtoPapeVaci) + checkBox_papelera.Visible = true; + else if (limp.tipo_tto != (int)LimpiezaDef.TiposTto.TtoNoDef) + { + checkBox_papelera.Visible = false; + limp.umbral_reco_conten = false; + label_umbral_recog.Visible = false; + tbox_umbral_recog.Visible = false; + } + + checkedListBox_amb.DataSource = null; + //permite visualizar los elementos del ancho de vía que se activará cuando se seleccione la opción genérica de ejes de calle + //siempre y cuando el tiempo de tratamiento sea en m2/h + label_ancho_medio.Visible = false; + textBox_ancho_medio.Visible = false; + label_uds_anch_med.Visible = false; + + //rellena el combo de opciones de los ambitos + comboBox_amb.Items.Clear(); + comboBox_amb.Items.Add("Editable"); + comboBox_amb.Items.Add("Genérico"); + //en el caso del tratamiento customizable no se pondrán sus opciones particulares, sólo interesan las opciones globales a todos los tratamientos. + //las opciones particulares del tratamiento customizable, son realemnte las opciones globales a todos los ttos. + if ((limp.tipo_tto != (int)LimpiezaDef.TiposTto.TtoNoDef) && (limp.tipo_tto < (int)LimpiezaDef.TiposTto.TtoCustom)) + { + for (int i = 0; i < (limp.ambs_val[(int)limp.tipo_tto].n_ops); i++) + comboBox_amb.Items.Add("Opción " + (i + 1)); + } + } + catch (Exception) + { + MessageBox.Show("Error al seleccionar tratamiento", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + /** + * El botón cerrar cierra la aplicación Olivia + */ + private void LimpiezaDlg_FormClosed(object sender, FormClosedEventArgs e) + { + OliviaGlob.borra_files(); + OliviaGlob.inidlg.Show(); + } + + /** + * El botón ejecutar lanza el proceso de secotrización y de cálculo de rutas + */ + private void button_eje_Click(object sender, EventArgs e) + { + Hide(); + if (!ejecuta((int)Ejecuta.ModosEjec.Secto)) + { + MessageBox.Show("Error al comenzar la ejecución. " + err_str, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + OliviaGlob.borra_files(); + Show(); + } + } + + /** + * Desplegable que permite seleccionar las opciones de ámbitos de trabajo según el tipo de tratamiento seleccionado. + */ + private void comboBox_amb_SelectedIndexChanged(object sender, EventArgs e) + { + try + { + ArrayList lista; + lista = pon_ambitos(); + //checkea los ámbitos de esta opción + check_ambitos(comboBox_amb.SelectedIndex, lista); + checkedListBox_amb.Enabled = true; + if (comboBox_amb.SelectedIndex == 1) + { + //permite visualizar los elementos del ancho de vía que se activará cuando se seleccione la opción genérica de ejes de calle siempre y cuando el tiempo de tratamiento sea en ml/h + if (limp.uds_t_tto != (int)GeneralDef.OlvTiposTto.OlvTipTtoM2h_eje) + { + label_ancho_medio.Visible = true; + label_ancho_medio.Text = "Ancho medio de la calle"; + textBox_ancho_medio.Visible = true; + textBox_ancho_medio.Text = limp.ancho_via.ToString(); + label_uds_anch_med.Visible = true; + } + } + else + { + label_ancho_medio.Visible = false; + textBox_ancho_medio.Visible = false; + label_uds_anch_med.Visible = false; + } + if (((limp.tipo_tto == (int)LimpiezaDef.TiposTto.TtoBaldMecCalz) && (comboBox_amb.SelectedIndex >= 2)) || + ((limp.tipo_tto == (int)LimpiezaDef.TiposTto.TtoCaidaHoja) && (comboBox_amb.SelectedIndex >= 2))) + checkedListBox_amb.Enabled = false; //si uno de los ámbitos es "eje de calle" no se puede combinar con los demás ámbitos + } + catch (Exception) + { + MessageBox.Show("Error al seleccionar ámbitos", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + /** + * Se aplica restricciones en la circulación en el cálculo de la sectorización + */ + private void bt_restric_circ_Click(object sender, EventArgs e) + { + string text_sal; + Hide();//esconde el dialogo + if (limp.selec_polig("Seleccionar capa de restricciones de circulación", this.Handle.ToInt32(), out text_sal, out limp.geom_rest_acces)) + { + label_restric.Text = text_sal; + limp.text_restr = text_sal; + } + else + { + label_restric.Text = limp.text_selec_rest; + limp.text_restr = ""; + } + Show(); + } + + /** + * Para añadir una capa de niveles, en el cálculo de la sectorización, diferente a la existente en la GDB seleccionada al comienzo de la aplicación. + */ + private void bt_niveles_Click(object sender, EventArgs e) + { + string text_sal; + Hide();//esconde el dialogo + if (limp.selec_polig("Seleccionar capa de niveles", this.Handle.ToInt32(), out text_sal, out limp.geom_niveles)) + { + label_niv.Text = text_sal; + limp.text_niv = text_sal; + } + else + { + label_niv.Text = limp.text_selec_nive; + limp.text_niv = ""; + } + Show(); + } + + /** + * Para añadir una capa de zonas, en el cálculo de la sectorización, diferente a la existente en la GDB seleccionada al comienzo de la aplicación. + */ + private void bt_zonas_Click(object sender, EventArgs e) + { + string text_sal; + Hide();//esconde el dialogo + if (limp.selec_polig("Seleccionar capa de zonas", this.Handle.ToInt32(), out text_sal, out limp.geom_zonas)) + { + label_zon.Text = text_sal; + limp.text_zon = text_sal; + } + else + { + label_zon.Text = limp.text_selec_zonas; + limp.text_zon = ""; + } + Show(); + } + + /** + * Para añadir una capa de instalaciones, en el cálculo de la sectorización. + * De modo que se conozca la ubicación de la instalación a la que tendrán que ir los camiones a descargar. + */ + private void bt_instalaciones_Click(object sender, EventArgs e) + { + string text_sal; + Hide();//esconde el dialogo + if (limp.selec_instal("Seleccionar capa de instalaciones de salida/llegada", this.Handle.ToInt32(), out text_sal, + out limp.coords_instala[0], out limp.coords_instala[1])) + instal_sel.Text = text_sal; + else + instal_sel.Text = limp.text_selec_instal; + Show(); + } + + /* + * Una vez se ha realizado la sectorización se recibe el shapefile y, si fuera necesario, se modifica la sectorizacion. + * Una vez esté todo al gusto del usuario se realiza la planificación de la ruta. + */ + private void bt_planifica_Click(object sender, EventArgs e) + { + Hide(); + + if (!ejecuta((int)Ejecuta.ModosEjec.Planif)) + { + MessageBox.Show("Error al comenzar la ejecución: " + err_str, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + OliviaGlob.borra_files(); + Show(); + } + } + + /* + * Comienza la ejecución, secto o planif + */ + private bool ejecuta(int modo) + { + ProgresoInic pro_inic = null; + try + { + err_str = ""; + OliviaGlob.gdb_limp.err_st = ""; + + button_eje.Enabled = bt_planifica.Enabled = false; + + //lee el dialogo de limpieza para recoger los parámetros que intervienen en el cálculo de la planificación + if (!lee()) + { + return false; + } + + pro_inic = new ProgresoInic(); + pro_inic.Show(); + + EjecutaLimp eje_limp = new EjecutaLimp(); + if (!eje_limp.ejec(limp, modo)) + { + pro_inic.Close(); + err_str = eje_limp.err_str; + return false; + } + pro_inic.Close(); + return true; + } + catch (Exception) + { + if (pro_inic != null) + pro_inic.Close(); + return false; + } + finally + { + button_eje.Enabled = bt_planifica.Enabled = true; + } + } + + /** + * Permite seleccionar el cálculo autmático de sectores en función de la zona de trabajo, teniendo en cuenta las jornadas de trabajo marcadas + */ + private void checkBox_sector_autom_CheckedChanged(object sender, EventArgs e) + { + numericUpDown_sectores.Enabled = checkBox_ajust_sec.Enabled = !checkBox_sector_autom.Checked; + } + + /*revisar borrar + * private void LimpiezaDlg_VisibleChanged(object sender, EventArgs e) + { + try + { + if (OliviaGlob.estado == TiposEstado.Inicio) + { + groupBox_edits.Enabled = true; + bt_planifica.Enabled = false; + button_eje.Enabled = true; + checkBox_aislados.Enabled = true; + Show(); + } + else if (OliviaGlob.estado == TiposEstado.PreparadoPlanif || + OliviaGlob.estado == TiposEstado.FinPlanif) + { + groupBox_edits.Enabled = false; + bt_planifica.Enabled = true; + button_eje.Enabled = false; + checkBox_aislados.Enabled = false; + Show(); + } + } + catch (Exception) + { + MessageBox.Show("Error al mostrar la ventana de Limpieza", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + }*/ + + /* + * Al pulsar en el check box de tener en cuenta un umbral de llenado para el vaciado de las papeleras + */ + private void checkBox_papelera_CheckedChanged(object sender, EventArgs e) + { + if (checkBox_papelera.Checked == true) + { + label_umbral_recog.Visible = true; + tbox_umbral_recog.Visible = true; + tbox_umbral_recog.Text = limp.umbral_basura.ToString(); + limp.umbral_reco_conten = false; + } + else + { + limp.umbral_reco_conten = false; + label_umbral_recog.Visible = false; + tbox_umbral_recog.Visible = false; + } + } + + /** + * Cuando se picnha en el botón de ayuda se abre el manual de Olivia + */ + private void btn_help_Click(object sender, EventArgs e) + { + string[] archivos; + + try + { + archivos = Directory.GetFiles(OliviaGlob.Paths.PathWork, OliviaGlob.manual + ".pdf"); + if (archivos.Length <= 0) + MessageBox.Show("No se encuentra el archivo " + OliviaGlob.manual + ".pdf en la ubicación " + OliviaGlob.Paths.PathWork, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + + foreach (string f in archivos) + { + Process.Start(f); + } + } + catch (Exception) + { + MessageBox.Show("Error al abrir el manual de ayuda " + OliviaGlob.manual + ".pdf", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void button_capa_limp_Click(object sender, EventArgs e) + { + string path_limp; + + //se despliega el dialogo para seleccionar ua capa de la que se recogerán los datos. + path_limp = FunGDB.selec_ftcls("Seleccionar capa de limpieza", this.Handle.ToInt32()); + + if (path_limp != null) + { + OliviaGlob.gdb_limp.path_class = path_limp; + if (OliviaGlob.gdb_limp.comprueba_campos_limp(limp)) + { + label_capa_limp.Text = System.IO.Path.GetFileNameWithoutExtension(path_limp); + amb_tra_gdb = OliviaGlob.gdb_limp.lee_amb_gdb(limp); + checkedListBox_amb.pon_ambs_gdb(amb_tra_gdb); + } + else + { + MessageBox.Show("Error en la capa " + path_limp + " " + limp.err_st, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + label_capa_limp.Text = limp.text_capa_limp; + OliviaGlob.gdb_limp.path_class = null; + } + } + else + { + label_capa_limp.Text = limp.text_capa_limp; + OliviaGlob.gdb_limp.path_class = null; + } + comboBox_tto.SelectedIndex = -1; + OliviaGlob.gdb_limp.path_import = null; + } + + private void button_edit_camp_Click(object sender, EventArgs e) + { + try + { + LimpCampos camps = new LimpCampos(limp); + if (camps.ShowDialog() == DialogResult.OK) + { + if (OliviaGlob.gdb_limp.comprueba_campos_limp(limp)) + { + amb_tra_gdb = OliviaGlob.gdb_limp.lee_amb_gdb(limp); + checkedListBox_amb.pon_ambs_gdb(amb_tra_gdb); + } + else + { + MessageBox.Show(limp.err_st, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + comboBox_tto.SelectedIndex = -1; + } + catch (Exception) + { + MessageBox.Show("Error al editar los campos de la capa de recogida de residuos", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } +} diff --git a/OliviaAddIn/LimpiezaDlg.resx b/OliviaAddIn/LimpiezaDlg.resx new file mode 100644 index 0000000..0c405e4 --- /dev/null +++ b/OliviaAddIn/LimpiezaDlg.resx @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAAbrQAAG60AXJX/ekAAAAGYktHRAD/AP8A/6C9p5MAAAAHdElNRQfZChYNADoI871E + AAAB00lEQVQ4T5WTPUhbYRiFPydRyCAZpC5C61ZwsZZYROjStQ4OhUxdFbsVBFtQIxUnWxqcSurQodok + GIyBRkHJD4lRkkL9ixeE0Egh9FZrWwuae4/vuTT1h9yiBw4f3Pd53nzkclUlDofDKccNaZNNG6U1Uts0 + wyaGYSCZTM4J0yK9uOT+mAbXsIbbgxpZM5VKIZPJgGcloVDIOuOJRFgU3uYsruH88UbxCGu7vyzofEzT + tM5CoWCdzLv0T7QP7aDDo4E/ru6N5E8iuX3MpHULqHYDn8+HQCCAcDgMs/wH89l9xDYP0TGSlwWefPnD + yje8jZX+4mep3OByyPrFEddaYPhX9H8Lqt3g8jOyAXGsBZ2jmhn5dIBpeXDVkKUjLtTNviU4H0fhdM+i + 9tE86t0fUWdTzsiQpUNX3eqPnbwIlfBkclXexG9EPx9iwaackSFLh65qfZouD7zfQ9fAMoIZHd5oCZM2 + 5YwMWTp01d1nWeO5/yu6PQlEct/lD9IxFa9ezsiQpUNXdXnWjZdRHb3eVSS2DxDf+oGYTTkjQ5YOXfVg + fNsMZo/wZvELJoIbeDW79d+SIUuHrurxFvDwdRHdXnbvii1aDl1+Dg3SNumda1Yc1XAKo6KvDnHu2l4A + AAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAAbrQAAG60AXJX/ekAAAAGYktHRAD/AP8A/6C9p5MAAAAHdElNRQfZChYNADoI871E + AAAB00lEQVQ4T5WTPUhbYRiFPydRyCAZpC5C61ZwsZZYROjStQ4OhUxdFbsVBFtQIxUnWxqcSurQodok + GIyBRkHJD4lRkkL9ixeE0Egh9FZrWwuae4/vuTT1h9yiBw4f3Pd53nzkclUlDofDKccNaZNNG6U1Uts0 + wyaGYSCZTM4J0yK9uOT+mAbXsIbbgxpZM5VKIZPJgGcloVDIOuOJRFgU3uYsruH88UbxCGu7vyzofEzT + tM5CoWCdzLv0T7QP7aDDo4E/ru6N5E8iuX3MpHULqHYDn8+HQCCAcDgMs/wH89l9xDYP0TGSlwWefPnD + yje8jZX+4mep3OByyPrFEddaYPhX9H8Lqt3g8jOyAXGsBZ2jmhn5dIBpeXDVkKUjLtTNviU4H0fhdM+i + 9tE86t0fUWdTzsiQpUNX3eqPnbwIlfBkclXexG9EPx9iwaackSFLh65qfZouD7zfQ9fAMoIZHd5oCZM2 + 5YwMWTp01d1nWeO5/yu6PQlEct/lD9IxFa9ezsiQpUNXdXnWjZdRHb3eVSS2DxDf+oGYTTkjQ5YOXfVg + fNsMZo/wZvELJoIbeDW79d+SIUuHrurxFvDwdRHdXnbvii1aDl1+Dg3SNumda1Yc1XAKo6KvDnHu2l4A + AAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAAbrQAAG60AXJX/ekAAAAGYktHRAD/AP8A/6C9p5MAAAAHdElNRQfZChYNADoI871E + AAAB00lEQVQ4T5WTPUhbYRiFPydRyCAZpC5C61ZwsZZYROjStQ4OhUxdFbsVBFtQIxUnWxqcSurQodok + GIyBRkHJD4lRkkL9ixeE0Egh9FZrWwuae4/vuTT1h9yiBw4f3Pd53nzkclUlDofDKccNaZNNG6U1Uts0 + wyaGYSCZTM4J0yK9uOT+mAbXsIbbgxpZM5VKIZPJgGcloVDIOuOJRFgU3uYsruH88UbxCGu7vyzofEzT + tM5CoWCdzLv0T7QP7aDDo4E/ru6N5E8iuX3MpHULqHYDn8+HQCCAcDgMs/wH89l9xDYP0TGSlwWefPnD + yje8jZX+4mep3OByyPrFEddaYPhX9H8Lqt3g8jOyAXGsBZ2jmhn5dIBpeXDVkKUjLtTNviU4H0fhdM+i + 9tE86t0fUWdTzsiQpUNX3eqPnbwIlfBkclXexG9EPx9iwaackSFLh65qfZouD7zfQ9fAMoIZHd5oCZM2 + 5YwMWTp01d1nWeO5/yu6PQlEct/lD9IxFa9ezsiQpUNXdXnWjZdRHb3eVSS2DxDf+oGYTTkjQ5YOXfVg + fNsMZo/wZvELJoIbeDW79d+SIUuHrurxFvDwdRHdXnbvii1aDl1+Dg3SNumda1Yc1XAKo6KvDnHu2l4A + AAAASUVORK5CYII= + + + + 25 + + + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA + AAD///8B////Af///wH///8BOoFqBTqBamE6gWq9OoFq7zqBapU6gWq9OoFqvzqBamM6gWoF////Af// + /wH///8B////Af///wH///8BOoFqJTqBatE6gWr/OoFq/zqBav86gWqTOoFq9TqBav86gWr/OoFq0zqB + ain///8B////Af///wH///8BOoFqJTqBaus6gWr/OoFq/zqBav86gWr9OoFqqzqBauk6gWr9OoFq/zqB + av86gWrrOoFqJ////wH///8BOoFqAzqBas86gWr7OoFqzTqBaqk6gWqtOoFqYzqBask6gWpJOoFqXTqB + ass6gWr7OoFq/zqBatE6gWoF////ATqBalc6gWrpOoFq4zqBap86gWoNOoFqCzqBanM6gWrROoFqqzqB + ajk6gWoNOoFqezqBavk6gWr/OoFqW////wE6gWq1OoFqpTqBats6gWp7OoFqOzqBahs6gWrxOoFq8zqB + av86gWqVOoFqFTqBanM6gWqJOoFq0TqBarf///8BOoFq6zqBal86gWqFOoFqezqBais6gWpHOoFq8TqB + av86gWr/OoFqdTqBaj86gWopOoFqhTqBask6gWqF////ATqBauM6gWo1OoFqHzqBamX///8BOoFqiTqB + av86gWrhOoFq/zqBal////8BOoFqYTqBaok6gWrhOoFq/////wE6gWpFOoFqFzqBakU6gWov////ATqB + apk6gWr/OoFq8TqBav86gWrbOoFqE////wE6gWpVOoFqtzqBapv///8BOoFqeTqBaos6gWpj////Af// + /wE6gWpXOoFq+zqBav86gWr/OoFq3TqBahE6gWozOoFqiTqBauU6gWol////ATqBaj86gWoV////Af// + /wH///8BOoFqfTqBaus6gWr3OoFq9zqBajs6gWo7OoFqczqBat86gWphOoFqA////wH///8B////Af// + /wH///8B////ATqBapM6gWr/OoFq/zqBav86gWpbOoFqSTqBatM6gWqVOoFqeTqBahP///8B////Af// + /wH///8B////Af///wE6gWofOoFq1zqBav86gWr/OoFqff///wH///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////ATqBark6gWr/OoFqwzqBagf///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wE6gWo3OoFq6zqBaiP///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// + /wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//w== + + + \ No newline at end of file diff --git a/OliviaAddIn/LimpiezaDlg.yo-NG.resx b/OliviaAddIn/LimpiezaDlg.yo-NG.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/OliviaAddIn/LimpiezaDlg.yo-NG.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OliviaAddIn/ListCamposVal.cs b/OliviaAddIn/ListCamposVal.cs new file mode 100644 index 0000000..01e062e --- /dev/null +++ b/OliviaAddIn/ListCamposVal.cs @@ -0,0 +1,260 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using ESRI.ArcGIS.Geodatabase; +using ESRI.ArcGIS.Geometry; +using ESRI.ArcGIS.Catalog; + +namespace OliviaAddIn +{ + class ListCamposVal + { + //********************************************************************** + //Variables + ListForm listDlg=null; + string clase_path=null; + esriGeometryType mi_tipogeom = esriGeometryType.esriGeometryPoint; + string mi_title = "Seleccionar capa"; + int mi_parwnd = 0; + public string err_st = ""; + + //********************************************************************** + //Funciones + public ListCamposVal(string title, int parentWnd, esriGeometryType tipogeom) + { + mi_tipogeom = tipogeom; + mi_title = title; + mi_parwnd = parentWnd; + } + + /** + * Abre diálogo para seleccionar una feature class a leer + */ + public string selec_capa() + { + clase_path = FunGDB.selec_ftcls(mi_title, mi_parwnd); + if (clase_path == null) + { + err_st = "No se ha seleccionado ninguna capa"; + } + return clase_path; + } + + /** + * De la feature class, obtiene el listado de los campos y muestra el dlg + */ + public int selec_campo(out string campo_str) + { + string[] elems = null; + IFeatureClass ftclass=null; + campo_str = null; + int err = 0; + + try + { + //rellena los elementos a imprimir en el listado, en este caso, + //los campos disponibles para elegir + if (clase_path == null) + { + err_st = "No se ha seleccionado ninguna capa"; + return -1; + } + + ftclass=FunGDB.abre_ftclass(clase_path); + if(ftclass==null) + { + err_st = "Error al abrir capa " + clase_path; + return -1; + } + if (ftclass.ShapeType != mi_tipogeom) + { + err_st = "La geometría de la capa seleccionada " + clase_path + + " no es " + mi_tipogeom.ToString(); + return -1; + } + + elems = FunGDB.dame_campos_clase(clase_path, out err); + + if (err > 0) + { + switch (err) + { + case 1: + err_st = "Error al abrir tabla de atributos de la capa " + clase_path; + break; + case 2: + err_st = "Error al consultar la tabla de atributos de la capa " + clase_path; + break; + case 3: + err_st = "Error al consultar la tabla de atributos de la capa, no hay campos " + clase_path; + break; + case 4: + err_st = "Error al rellenar lista de atributos de la capa " + clase_path; + break; + } + return -1; + } + + //crea el dialogo con el listado + listDlg = new ListForm(elems, "Seleccionar campo para leer", false); + + //recoge el id del elemento seleccionado + if (listDlg.nelem > 0) + { + campo_str = listDlg.elem_str[0]; + return listDlg.elem_id[0]; + } + else + { + err_st = "No se ha seleccionado ningún elemento"; + campo_str = ""; + return -1; + } + + } + catch (Exception) + { + err_st = "Error al seleccionar campo en la capa " + clase_path; + return -1; + } + finally + { + FunGDB.libera(ftclass); + } + } + + /** + * De la feature class, permite seleccionar el valor de un campo determinado + */ + public int selec_valor_campo(string campo, out string valor_str) + { + string[] elems = null; + valor_str=null; + int err; + + //rellena los elementos a imprimir en el listado, en este caso, + //todos los valores posibles de un campo dado + if (clase_path == null) + { + err_st = "No se ha seleccionado ninguna capa"; + return -1; + } + + try + { + + elems = FunGDB.dame_valores_consulta(clase_path, campo, "", out err); //consulta todos: consulta = campo + " LIKE '%'"; + if (err > 0) + { + switch (err) + { + case 1: + err_st = "Error al obtener los IDs de la capa " + clase_path; + break; + case 2: + err_st = "Error al abrir la tabla de atributos de la capa, no hay entidades " + clase_path; + break; + case 3: + err_st = "Error al abrir la tabla de atributos de la capa " + clase_path; + break; + case 4: + err_st = "Errores en la consulta de la tabla de atributos de la capa " + clase_path; + break; + } + return -1; + + } + + //crea el dialogo con el listado + listDlg = new ListForm(elems, "Seleccionar valor del campo para leer", false); + + //recoge el id del elemento seleccionado + if (listDlg.nelem > 0) + { + valor_str = listDlg.elem_str[0]; + return listDlg.elem_id[0]; + } + else + { + valor_str = ""; + err_st = "No se ha seleccionado ningún elemento"; + return -1;//no se ha seleccionado + } + } + catch (Exception) + { + err_st = "Error al seleccionar valor del campo en la capa " + clase_path; + return -1; + } + } + + /** + * De la feature class, permite seleccionar varios valores de un campo determinado + */ + public int selec_valores_campo(string campo, out int[] valor_ids, out string[] valor_str) + { + string[] elems = null; + valor_str = null; + valor_ids = null; + int err; + + //rellena los elementos a imprimir en el listado, en este caso, + //todos los valores posibles de un campo dado + if (clase_path == null) + { + err_st = "No se ha seleccionado ninguna capa"; + return -1; + } + + try + { + elems = FunGDB.dame_valunic_consulta(clase_path, campo, "", out err); //consulta todos + if (elems == null) + { + switch (err) + { + case 1: + err_st = "Error al obtener los IDs de la capa " + clase_path; + break; + case 2: + err_st = "Error al abrir la tabla de atributos de la capa " + clase_path; + break; + case 3: + err_st = "Errores en la consulta de valores únicos de la capa " + clase_path; + break; + case 4: + err_st = "Errores en la consulta de la tabla de atributos de la capa " + clase_path; + break; + } + return -1; + + } + + //crea el dialogo con el listado + listDlg = new ListForm(elems, "Seleccionar valor del campo para leer", true); + + //recoge el id del elemento/s seleccionado + if (listDlg.nelem > 0) + { + valor_str = listDlg.elem_str; + valor_ids = listDlg.elem_id; + return listDlg.nelem; + } + else + { + valor_str = null; + valor_ids = null; + err_st = "No se ha seleccionado ningún elemento"; + return -1;//no se ha seleccionado + } + } + catch (Exception) + { + err_st = "Error al seleccionar valor del campo en la capa " + clase_path; + return -1; + } + } + } +} diff --git a/OliviaAddIn/ListCapasMaqueta.Designer.cs b/OliviaAddIn/ListCapasMaqueta.Designer.cs new file mode 100644 index 0000000..43fa24f --- /dev/null +++ b/OliviaAddIn/ListCapasMaqueta.Designer.cs @@ -0,0 +1,91 @@ +namespace OliviaAddIn +{ + partial class ListCapasMaqueta + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ListCapasMaqueta)); + this.listBox_maqueta = new System.Windows.Forms.ListBox(); + this.bt_cancel = new System.Windows.Forms.Button(); + this.bt_acept = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // listBox_maqueta + // + this.listBox_maqueta.FormattingEnabled = true; + this.listBox_maqueta.Location = new System.Drawing.Point(2, 5); + this.listBox_maqueta.Name = "listBox_maqueta"; + this.listBox_maqueta.Size = new System.Drawing.Size(417, 160); + this.listBox_maqueta.TabIndex = 0; + // + // bt_cancel + // + this.bt_cancel.Location = new System.Drawing.Point(213, 171); + this.bt_cancel.Name = "bt_cancel"; + this.bt_cancel.Size = new System.Drawing.Size(75, 23); + this.bt_cancel.TabIndex = 1; + this.bt_cancel.Text = "Cancelar"; + this.bt_cancel.UseVisualStyleBackColor = true; + this.bt_cancel.Click += new System.EventHandler(this.bt_cancel_Click); + // + // bt_acept + // + this.bt_acept.Location = new System.Drawing.Point(132, 171); + this.bt_acept.Name = "bt_acept"; + this.bt_acept.Size = new System.Drawing.Size(75, 23); + this.bt_acept.TabIndex = 2; + this.bt_acept.Text = "Aceptar"; + this.bt_acept.UseVisualStyleBackColor = true; + this.bt_acept.Click += new System.EventHandler(this.bt_acept_Click); + // + // ListCapasMaqueta + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(421, 200); + this.Controls.Add(this.bt_acept); + this.Controls.Add(this.bt_cancel); + this.Controls.Add(this.listBox_maqueta); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "ListCapasMaqueta"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Capas para maquetar"; + this.TopMost = true; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ListCapasMaqueta_FormClosing); + this.Shown += new System.EventHandler(this.ListCapasMaqueta_Shown); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ListBox listBox_maqueta; + private System.Windows.Forms.Button bt_cancel; + private System.Windows.Forms.Button bt_acept; + } +} \ No newline at end of file diff --git a/OliviaAddIn/ListCapasMaqueta.cs b/OliviaAddIn/ListCapasMaqueta.cs new file mode 100644 index 0000000..c3fff8b --- /dev/null +++ b/OliviaAddIn/ListCapasMaqueta.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using ESRI.ArcGIS.Geodatabase; + +namespace OliviaAddIn +{ + public partial class ListCapasMaqueta : Form + { + //************************************************************************************* + //Variables + /** + * Matriz que contiene las instalaciones que están contemplados en .gdb una vez leida + */ + public String[] capas_maquetar = null; + public String[] capas = null; + public List capas_l = null; + public List grupo_l = null; + public String[] grupo_maquetar = null; + + public bool aceptar = false; + + //************************************************************************************* + + public ListCapasMaqueta() + { + InitializeComponent(); + } + + /* + * Inicializa los elementos de la ventana: rellena la listbox + * Se listan aquellas capas que pertenecen a la GDB y que terminan con el sufijo "Sector", + * que serán aquellas que cada sector es una única geometría de modo que a la hora de emplear DataDrive Pages facilitará el centrado de la vista por cada sector + */ + public void inicia(IEnumDatasetName grupos) + { + IDatasetName grupo, element; + IEnumDatasetName elementos; + + try + { + grupo = grupos.Next(); + + capas_l = new List(); + grupo_l = new List(); + while (grupo != null) + { + elementos = grupo.SubsetNames; + element = elementos.Next(); + while (element != null) + { + if (element.Name.EndsWith(OliviaGlob.gdb.name_sect) || + element.Name.EndsWith(OliviaGlob.gdb.name_ruta_out)) + { + capas_l.Add(element.Name); + grupo_l.Add(grupo.Name); + } + element = elementos.Next(); + } + grupo = grupos.Next(); + } + } + catch (Exception) + { + MessageBox.Show("Error al mostrar las capas que contiene la GDB para maquetar", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + /* + * Al hacer click en el boton cancelar se rechaza seleccionar capas para la maquetación. + */ + private void bt_cancel_Click(object sender, EventArgs e) + { + capas_maquetar = null; + Close(); + } + + /* + * Cuando se muestra el dialogo se añade a la lista aquellas capas que componen el array capas (capas que cumplen con que terminan en "_Sector") + */ + private void ListCapasMaqueta_Shown(object sender, EventArgs e) + { + listBox_maqueta.Items.Clear(); + if (capas_l[0] != null) + { + capas = new string[capas_l.Count]; + capas_l.CopyTo(capas); + listBox_maqueta.Items.AddRange(capas); + } + } + + /* + * Cuando se clicka en Aceptar se hace un listado String con el nombre de los grupos que contienen las capas seleccionadas + */ + private void bt_acept_Click(object sender, EventArgs e) + { + object obj; + ListBox.SelectedObjectCollection seleccionados; + ListBox.SelectedIndexCollection indices; + + try + { + //se pone aceptar a true para que a la hora de cerrar el dialogo pueda verificar si ha pasado por aceptar para no poner las variables a null + aceptar = true; + + indices = listBox_maqueta.SelectedIndices; + seleccionados = listBox_maqueta.SelectedItems; + int num = seleccionados.Count; + if (num == 0) + { + MessageBox.Show("No se ha seleccionado ninguna capa para maquetar", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + //una vez se conoce el numero de elementos seleccionados de la lista se crea el array string de los grupos que contienen dichas capas. + capas_maquetar = new String[num]; + for (int i = 0; i < num; i++) + { + obj = seleccionados[i]; + capas_maquetar[i] = obj.ToString(); + } + num = indices.Count; + grupo_maquetar = new String[num]; + for (int i = 0; i < num; i++) + { + grupo_maquetar[i] = grupo_l[indices[i]]; + } + Close(); + } + catch (Exception) + { + MessageBox.Show("Error al aceptar las capas a maquetar.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + /* + * Al hacer click en el boton cerrar se rechaza seleccionar capas para la maquetación. + */ + private void ListCapasMaqueta_FormClosing(object sender, FormClosingEventArgs e) + { + if (aceptar == false) + capas_maquetar = null; + } + + } +} diff --git a/OliviaAddIn/ListCapasMaqueta.resx b/OliviaAddIn/ListCapasMaqueta.resx new file mode 100644 index 0000000..1bb292f --- /dev/null +++ b/OliviaAddIn/ListCapasMaqueta.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA + AAD///8B////Af///wH///8BOoFqBTqBamE6gWq9OoFq7zqBapU6gWq9OoFqvzqBamM6gWoF////Af// + /wH///8B////Af///wH///8BOoFqJTqBatE6gWr/OoFq/zqBav86gWqTOoFq9TqBav86gWr/OoFq0zqB + ain///8B////Af///wH///8BOoFqJTqBaus6gWr/OoFq/zqBav86gWr9OoFqqzqBauk6gWr9OoFq/zqB + av86gWrrOoFqJ////wH///8BOoFqAzqBas86gWr7OoFqzTqBaqk6gWqtOoFqYzqBask6gWpJOoFqXTqB + ass6gWr7OoFq/zqBatE6gWoF////ATqBalc6gWrpOoFq4zqBap86gWoNOoFqCzqBanM6gWrROoFqqzqB + ajk6gWoNOoFqezqBavk6gWr/OoFqW////wE6gWq1OoFqpTqBats6gWp7OoFqOzqBahs6gWrxOoFq8zqB + av86gWqVOoFqFTqBanM6gWqJOoFq0TqBarf///8BOoFq6zqBal86gWqFOoFqezqBais6gWpHOoFq8TqB + av86gWr/OoFqdTqBaj86gWopOoFqhTqBask6gWqF////ATqBauM6gWo1OoFqHzqBamX///8BOoFqiTqB + av86gWrhOoFq/zqBal////8BOoFqYTqBaok6gWrhOoFq/////wE6gWpFOoFqFzqBakU6gWov////ATqB + apk6gWr/OoFq8TqBav86gWrbOoFqE////wE6gWpVOoFqtzqBapv///8BOoFqeTqBaos6gWpj////Af// + /wE6gWpXOoFq+zqBav86gWr/OoFq3TqBahE6gWozOoFqiTqBauU6gWol////ATqBaj86gWoV////Af// + /wH///8BOoFqfTqBaus6gWr3OoFq9zqBajs6gWo7OoFqczqBat86gWphOoFqA////wH///8B////Af// + /wH///8B////ATqBapM6gWr/OoFq/zqBav86gWpbOoFqSTqBatM6gWqVOoFqeTqBahP///8B////Af// + /wH///8B////Af///wE6gWofOoFq1zqBav86gWr/OoFqff///wH///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////ATqBark6gWr/OoFqwzqBagf///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wE6gWo3OoFq6zqBaiP///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// + /wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//w== + + + \ No newline at end of file diff --git a/OliviaAddIn/ListForm.Designer.cs b/OliviaAddIn/ListForm.Designer.cs new file mode 100644 index 0000000..8cae6b2 --- /dev/null +++ b/OliviaAddIn/ListForm.Designer.cs @@ -0,0 +1,76 @@ +namespace OliviaAddIn +{ + partial class ListForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ListForm)); + this.listBox = new System.Windows.Forms.ListBox(); + this.bt_aceptar = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // listBox + // + this.listBox.FormattingEnabled = true; + this.listBox.Location = new System.Drawing.Point(12, 12); + this.listBox.Name = "listBox"; + this.listBox.Size = new System.Drawing.Size(355, 173); + this.listBox.TabIndex = 0; + this.listBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listBox_MouseDoubleClick); + // + // bt_aceptar + // + this.bt_aceptar.Location = new System.Drawing.Point(292, 193); + this.bt_aceptar.Name = "bt_aceptar"; + this.bt_aceptar.Size = new System.Drawing.Size(75, 23); + this.bt_aceptar.TabIndex = 1; + this.bt_aceptar.Text = "Aceptar"; + this.bt_aceptar.UseVisualStyleBackColor = true; + this.bt_aceptar.Click += new System.EventHandler(this.bt_aceptar_Click); + // + // ListForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(379, 228); + this.Controls.Add(this.bt_aceptar); + this.Controls.Add(this.listBox); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "ListForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ListForm_FormClosed); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ListBox listBox; + private System.Windows.Forms.Button bt_aceptar; + } +} \ No newline at end of file diff --git a/OliviaAddIn/ListForm.cs b/OliviaAddIn/ListForm.cs new file mode 100644 index 0000000..3ebd596 --- /dev/null +++ b/OliviaAddIn/ListForm.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace OliviaAddIn +{ + public partial class ListForm : Form + { + private bool selec = false; + public int nelem = 0; + public string[] elem_str=null; + public int[] elem_id = null; + + public ListForm(string[] elems, string title, bool multiselec) + { + InitializeComponent(); + listBox.Items.Clear(); + listBox.Items.AddRange(elems); + selec = false; + Text = title; + if (multiselec) + listBox.SelectionMode = SelectionMode.MultiExtended; + else + listBox.SelectionMode = SelectionMode.One; + + ShowDialog(); + + } + + private void ListForm_FormClosed(object sender, FormClosedEventArgs e) + { + if (!selec) + { + nelem = 0; + elem_str = null; + elem_id = null; + } + } + + private void listBox_MouseDoubleClick(object sender, MouseEventArgs e) + { + selec_item(); + } + + private void bt_aceptar_Click(object sender, EventArgs e) + { + selec_item(); + } + + void selec_item() + { + ListBox.SelectedIndexCollection selindexs = listBox.SelectedIndices; + + nelem = selindexs.Count; + if (nelem>0) + { + selec = true; + elem_id = new int[nelem]; + for (int i = 0; i < nelem; i++) + elem_id[i] = selindexs[i]; + + ListBox.SelectedObjectCollection selitems = listBox.SelectedItems; + elem_str = new string[nelem]; + for (int i = 0; i < nelem; i++) + { + elem_str[i] = (string)selitems[i]; + } + + Close(); + } + } + } +} diff --git a/OliviaAddIn/ListForm.resx b/OliviaAddIn/ListForm.resx new file mode 100644 index 0000000..1bb292f --- /dev/null +++ b/OliviaAddIn/ListForm.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA + AAD///8B////Af///wH///8BOoFqBTqBamE6gWq9OoFq7zqBapU6gWq9OoFqvzqBamM6gWoF////Af// + /wH///8B////Af///wH///8BOoFqJTqBatE6gWr/OoFq/zqBav86gWqTOoFq9TqBav86gWr/OoFq0zqB + ain///8B////Af///wH///8BOoFqJTqBaus6gWr/OoFq/zqBav86gWr9OoFqqzqBauk6gWr9OoFq/zqB + av86gWrrOoFqJ////wH///8BOoFqAzqBas86gWr7OoFqzTqBaqk6gWqtOoFqYzqBask6gWpJOoFqXTqB + ass6gWr7OoFq/zqBatE6gWoF////ATqBalc6gWrpOoFq4zqBap86gWoNOoFqCzqBanM6gWrROoFqqzqB + ajk6gWoNOoFqezqBavk6gWr/OoFqW////wE6gWq1OoFqpTqBats6gWp7OoFqOzqBahs6gWrxOoFq8zqB + av86gWqVOoFqFTqBanM6gWqJOoFq0TqBarf///8BOoFq6zqBal86gWqFOoFqezqBais6gWpHOoFq8TqB + av86gWr/OoFqdTqBaj86gWopOoFqhTqBask6gWqF////ATqBauM6gWo1OoFqHzqBamX///8BOoFqiTqB + av86gWrhOoFq/zqBal////8BOoFqYTqBaok6gWrhOoFq/////wE6gWpFOoFqFzqBakU6gWov////ATqB + apk6gWr/OoFq8TqBav86gWrbOoFqE////wE6gWpVOoFqtzqBapv///8BOoFqeTqBaos6gWpj////Af// + /wE6gWpXOoFq+zqBav86gWr/OoFq3TqBahE6gWozOoFqiTqBauU6gWol////ATqBaj86gWoV////Af// + /wH///8BOoFqfTqBaus6gWr3OoFq9zqBajs6gWo7OoFqczqBat86gWphOoFqA////wH///8B////Af// + /wH///8B////ATqBapM6gWr/OoFq/zqBav86gWpbOoFqSTqBatM6gWqVOoFqeTqBahP///8B////Af// + /wH///8B////Af///wE6gWofOoFq1zqBav86gWr/OoFqff///wH///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////ATqBark6gWr/OoFqwzqBagf///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wE6gWo3OoFq6zqBaiP///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// + /wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//w== + + + \ No newline at end of file diff --git a/OliviaAddIn/Maqueta.cs b/OliviaAddIn/Maqueta.cs new file mode 100644 index 0000000..f5e76b9 --- /dev/null +++ b/OliviaAddIn/Maqueta.cs @@ -0,0 +1,992 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Drawing; +using System.IO; + +using ESRI.ArcGIS.Geodatabase; +using ESRI.ArcGIS.Geometry; +using ESRI.ArcGIS.GeoDatabaseUI; +using ESRI.ArcGIS.DataSourcesGDB; +using ESRI.ArcGIS.DataSourcesFile; +using ESRI.ArcGIS.Carto; +using ESRI.ArcGIS.Display; +using ESRI.ArcGIS.ADF.COMSupport; +using ESRI.ArcGIS.Output; +using ESRI.ArcGIS.Controls; +using ESRI.ArcGIS.Framework; + +namespace OliviaAddIn +{ + public class Maqueta + { + public String err_str = ""; + public String nomb_plantilla = "Plantilla.mxd"; + + /** + * Crea una capa en la GDB de trabajo con el municipio que contiene la capa de ámbitos de la que se ha realizado la sectorización. + * De modo que se pueda incorporar en el mapa de localización. + */ + public IDatasetName municipio(string dir_shp, string capa, out string muni) + { + int campo, numero; + IWorkspace ws = null; + IQueryFilter filt = null; + IDataset data, grupo, element; + ESRI.ArcGIS.esriSystem.IName name; + IWorkspaceName ws_name; + IWorkspaceFactory wsf; + IFeatureWorkspace fws; + IFeatureClass fc1, fc2; + IFeatureClassName gdb_clase_lin = null, shp_clase; + IFeatureWorkspace feat_ws_nw; + IDatasetName gdb_data_name_lin, shp_data_name_lin, data_entrada, dname_gdb; + IFeatureDatasetName fdn_gdb; + ISpatialFilter filtro_espacial; + ITable tab; + IFeature f1, registro; + IFeatureCursor cursor; + ITopologicalOperator union; + IGeometry geometria; + IFeatureDataConverter convertidor = null; + IEnumInvalidObject invalido = null; + IEnumDataset grupos, elementos; + IWorkspaceFactory wsf_nw; + + wsf_nw = new FileGDBWorkspaceFactoryClass(); + feat_ws_nw = (IFeatureWorkspace)wsf_nw.OpenFromFile(OliviaGlob.Paths.PathGdbNw, 0); + gdb_clase_lin = new FeatureClassNameClass(); + gdb_data_name_lin = (IDatasetName)gdb_clase_lin; + gdb_data_name_lin.Name = OliviaGlob.Capas.ftclass_muni; + + gdb_data_name_lin.WorkspaceName = FunGDB.abre_wsn(OliviaGlob.Paths.PathGdbNw); + fc1 = feat_ws_nw.OpenFeatureClass(gdb_data_name_lin.Name); + //se unen todos los elementos (polilineas) que conforman el shapefile de ámbitos para generar el mapa. + //Esto se hace para que considere como una geometría todas las polilineas que intersecará con la capa de municipios + wsf = new FileGDBWorkspaceFactoryClass(); + ws = wsf.OpenFromFile(dir_shp, 0); + fws = (IFeatureWorkspace)ws; + data = (IDataset)ws; + name = data.FullName; + ws_name = (IWorkspaceName)name; + fc2 = fws.OpenFeatureClass(capa); + tab = fws.OpenTable(capa); + f1 = fc2.GetFeature(1);//se coge un úico elemento de la capa ya que bastará con comprobar a qué municipio pertenece esa carretera. + union = (ESRI.ArcGIS.Geometry.ITopologicalOperator)f1.Shape; + geometria = f1.Shape; + + //INTERSECCIÓN ESPACIAL ENTRE LA GEOMETRÍA DEL SHAPEFILE DE ENTRADA Y LA CAPA DE MUNICIPIOS EXTRAÍDA DE LA GDB DE TOMTOM + //se consigue el municpio sobre el que se está trabajando + filtro_espacial = new SpatialFilterClass(); + filtro_espacial.Geometry = geometria; + filtro_espacial.GeometryField = fc1.ShapeFieldName; + filtro_espacial.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; + filt = (IQueryFilter)filtro_espacial; + + //se recoge el nombre del municipio que interseca con los ambitos y que se incorporará al mapa de localización + cursor = fc1.Search(filt, false); + registro = cursor.NextFeature(); + tab = feat_ws_nw.OpenTable(gdb_data_name_lin.Name); + campo = tab.FindField("NAME"); + muni = (string)registro.get_Value(campo); + + //cREAR EL NOMBRE DEL GRUPO EN EL QUE SE GUARDAN LAS CAPAS DE MUNICIPIOS QUE INTERVIENEN EN LA MAQUETACIÓN + fdn_gdb = new FeatureDatasetNameClass(); + dname_gdb = (IDatasetName)fdn_gdb; + dname_gdb.WorkspaceName = ws_name; + dname_gdb.Name = OliviaGlob.gdb.municipio; + //se pone el espacio de trabajo para la capa que se quiere importar a la GDB. Será el mismo que el del grupo donde irá la capa importada + shp_clase = new FeatureClassNameClass(); + shp_data_name_lin = (IDatasetName)shp_clase; + shp_data_name_lin.Name = muni; + shp_data_name_lin.WorkspaceName = ws_name; + + //comprueba si existe la capa referente al municipio en la GDB + grupos = ws.get_Datasets(esriDatasetType.esriDTFeatureDataset); + grupo = grupos.Next(); + while (grupo != null) + { + if (grupo.Name == OliviaGlob.gdb.municipio) + { + elementos = grupo.Subsets; + element = elementos.Next(); + while (element != null) + { + if (element.Name == muni) + { + //si ya existe la capa se vuelve sin importarla de nuevo + return shp_data_name_lin; + } + element = elementos.Next(); + } + break; + } + grupo = grupos.Next(); + } + //EXPORTACIÓN DEL MUNICIPIO/S QUE INTERSECA CON LA CAPA DE ÁMBITOS (SHAPEFILE DE ENTRADA) + numero = tab.RowCount(filt); + if (numero > 0) + { + data_entrada = (IDatasetName)gdb_clase_lin; + try + { + //se crea el convertidor y se aplica la conversión. + convertidor = new FeatureDataConverterClass(); + invalido = convertidor.ConvertFeatureClass(gdb_clase_lin, filt, fdn_gdb, shp_clase, null, null, "", 1000, 0); + } + catch (Exception except) + { + MessageBox.Show(except.Message); + throw; + } + } + else + { + err_str = "No se encuentra el municipio sobre el que se está realizando el estudio"; + return null; + } + return shp_data_name_lin; + } + + /** + * Carga la plantilla para la creación de mapas y activa el modo de vista de diseño (Layout) + */ + public IPageLayout pon_plantilla(out string name_plant) + { + ESRI.ArcGIS.ArcMapUI.IMxDocument mx_doc; + IMap map; + + //SE CARGA LA PLANTILLA DE MAPA Cartela_Valoriza.mxd + name_plant = ""; + string plant; + ESRI.ArcGIS.Catalog.IGxFile pGxFile; + pGxFile = new ESRI.ArcGIS.Catalog.GxMapClass(); + plant = OliviaGlob.Paths.PathCartela;//OliviaGlob.mapa.selec_plantilla(); + if (plant == null) + return null; + pGxFile.Path = plant; + name_plant = pGxFile.Path; + ESRI.ArcGIS.Catalog.IGxMapPageLayout pGxPageLayout; + pGxPageLayout = (ESRI.ArcGIS.Catalog.IGxMapPageLayout)pGxFile; + ESRI.ArcGIS.Carto.IPageLayout pPageLayout; + pPageLayout = pGxPageLayout.PageLayout; + + ///////////////////////////////////////////////////////////// + //pone las opciones de impresión a A3 y horizontal + pPageLayout.Page.Orientation = 2; + pPageLayout.Page.PutCustomSize(42,29.7); + /////////////////////////////////////////// + + //COGE EL FOCO DE LA VISTA DEL MAPA EL MODO DE VISTA LAYOUT (EL MODO DE VISTA CON LA PLANTILLA INCORPORADA) + mx_doc = (ESRI.ArcGIS.ArcMapUI.IMxDocument)(ArcMap.Application.Document); + map = mx_doc.FocusMap; + mx_doc.PageLayout = pPageLayout; + + ////////////////// + + return pPageLayout; + } + + /** + * Carga la imagen que corresponde al cliente(modo 0) o al licitador(modo1) que precisa de la limpieza viaria, recogida de residuos, etc + * tipo 0 (cartela IGT) + * tipo 1 (cartela Formato tipo_Limpieza_DatosInformativos) + */ + public string pon_imag(string title, int modo, int tipo) + { + string foto = null; + double ratio, ancho, alto; + IElement elem; + IEnvelope env; + ESRI.ArcGIS.ArcMapUI.IMxDocument mx_docu; + IPictureElement pic_elem; + IActiveView vista_activa; + IPoint pto; + + mx_docu = (ESRI.ArcGIS.ArcMapUI.IMxDocument)ArcMap.Application.Document; + // Displays an OpenFileDialog so the user can select a Cursor. + System.Windows.Forms.OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); + openFileDialog1.Filter = "Imágenes(*.jpg)|*.jpg|Imágenes(*.bmp)|*.bmp|Imágenes(*.tiff)|*.tiff|Imágenes(*.png)|*.png"; + openFileDialog1.Title = title; + + // Show the Dialog. + if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + foto = openFileDialog1.FileName; + pic_elem = new JpgPictureElementClass(); + pic_elem.ImportPictureFromFile(foto); + ratio = pic_elem.PictureAspectRatio; + env = new EnvelopeClass(); + if (tipo == 0) + { + if (modo == 0) + { + //se incorpora la imagen manteniendo las proporciones de ancho y alto para que no se deformen al incorporarlas + pto = new PointClass(); + pto.X = 9.5; + pto.Y = 7.4; + env.PutCoords(8.3, 6.7, 10.7, 8.1); + ancho = env.Width; + alto = env.Height; + if (ratio < 1) + { + env.Width = env.Height * ratio; + if (env.Width > ancho) + { + env.Width = ancho; + env.Height = env.Width / ratio; + } + } + else + { + env.Height = env.Width / ratio; + if (env.Height > alto) + { + env.Height = alto; + env.Width = env.Height * ratio; + } + } + env.CenterAt(pto); + } + else + { + //se incorpora la imagen manteniendo las proporciones de ancho y alto para que no se deformen al incorporarlas + pto = new PointClass(); + pto.X = 9.6; + pto.Y = 6.2; + env.PutCoords(9, 5.6, 10.3, 6.8); + ancho = env.Width; + alto = env.Height; + if (ratio < 1) + { + env.Width = env.Height * ratio; + if (env.Width > ancho) + { + env.Width = ancho; + env.Height = env.Width / ratio; + } + } + else + { + env.Height = env.Width / ratio; + if (env.Height > alto) + { + env.Height = alto; + env.Width = env.Height * ratio; + } + } + env.CenterAt(pto); + } + } + else if (tipo == 1) + { + if (modo == 0) + { + //se incorpora la imagen manteniendo las proporciones de ancho y alto para que no se deformen al incorporarlas + pto = new PointClass(); + pto.X = 37.9; + pto.Y = 26.9; + env.PutCoords(36.2, 24.7, 39.5, 28.6); + ancho = env.Width; + alto = env.Height; + if (ratio < 1) + { + env.Width = env.Height * ratio; + if (env.Width > ancho) + { + env.Width = ancho; + env.Height = env.Width / ratio; + } + } + else + { + env.Height = env.Width / ratio; + if (env.Height > alto) + { + env.Height = alto; + env.Width = env.Height * ratio; + } + } + env.CenterAt(pto); + } + else + { + //se incorpora la imagen manteniendo las proporciones de ancho y alto para que no se deformen al incorporarlas + pto = new PointClass(); + pto.X = 37.6; + pto.Y = 22.8; + env.PutCoords(34.3, 21.4, 40.9, 24.1); + ancho = env.Width; + alto = env.Height; + if (ratio < 1) + { + env.Width = env.Height * ratio; + if (env.Width > ancho) + { + env.Width = ancho; + env.Height = env.Width / ratio; + } + } + else + { + env.Height = env.Width / ratio; + if (env.Height > alto) + { + env.Height = alto; + env.Width = env.Height * ratio; + } + } + env.CenterAt(pto); + } + } + pic_elem.MaintainAspectRatio = true; + elem = (IElement)pic_elem; + elem.Geometry = env; + ESRI.ArcGIS.Carto.IGraphicsContainer graph; + graph = (IGraphicsContainer)mx_docu.PageLayout; + graph.AddElement(elem, 0); + if (modo == 1) + { + IGraphicsContainerSelect graphicsSelection = (IGraphicsContainerSelect)graph; + graphicsSelection.UnselectAllElements(); + graphicsSelection.SelectElement(elem); + graph.SendToBack(graphicsSelection.SelectedElements); + graphicsSelection.UnselectElement(elem); + } + + vista_activa = (IActiveView)graph; + vista_activa.PartialRefresh(esriViewDrawPhase.esriViewGraphics, elem, env); + return foto; + } + return foto; + } + + /** + * Rellena la plantilla con aquellos elementos dinámicos que varía en cada mapa que se quiera exportar. + * Los elementos dinámicos son: + * - Título del mapa: compuesto por el tipo de tratmiento y ámbitos que intervienen + * - Fecha de la creación del mapa + * - Numeración en hojas de los mapas impresos. Se crea un mapa general con toda la sectorización y luego uno específico para cada sector.ç + * - Escala gráfica + * - Escala en formato texto + * - Nombre del municipio al que pertenecen los ámbitos estudiados + */ + public bool rellena_plantilla(ESRI.ArcGIS.Carto.IPageLayout pPageLayout, IDatasetName shp_data_name_lin, string name_plantilla, int i) + { + IWorkspaceFactory wsf; + IActiveView vista_activa, vis_act; + IRgbColor color; + EditTxtPlant txtplant; + + wsf = new FileGDBWorkspaceFactoryClass(); + vista_activa = ArcMap.Document.ActiveView; + if (vista_activa is IPageLayout) + { + //Reusable color object + color = new RgbColorClass(); + color.Red = 0; + color.Green = 0; + color.Blue = 0; + + try + { + pon_escala_txt(pPageLayout, vista_activa); + + //SE CONSIGUE EL NOMBRE DEL MUNICIPIO SOBRE EL QUE SE HACE LA LIMPIEZA VIARIA PARA + //PONERLO EN UNA CAJA DE TEXTO SOBRE EL MAPA Y PARA LLAMAR A LA CAPA CORRESPONDIENTE IGUAL. + txtplant = new EditTxtPlant(); + txtplant.ShowDialog(); + + if (txtplant.DialogResult != DialogResult.OK) + { + err_str = "Se ha forzado la salida del editor"; + return false; + } + + for (int k = 0; k < EditTxtPlantProps.N_CAMPOS_PLANT; k++) + pon_txt_prop(shp_data_name_lin.Name, vista_activa, k, + txtplant.props.campos_plant[k], txtplant.props.fonts[k]); + + + //AÑADE EL TEXTO DE LA FECHA DE CREACIÓN DEL MAPA + pon_fecha(color, vista_activa); + + ////AÑADE LA LEYENDA RESPECTO A LAS CAPAS A MOSTRAR + ESRI.ArcGIS.ArcMapUI.IMxDocument pMxDoc = (ESRI.ArcGIS.ArcMapUI.IMxDocument)ArcMap.Application.Document; + vis_act = (IActiveView)pMxDoc.PageLayout; + vis_act.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); + vis_act.Refresh(); + + return true; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + + } + + return false; + } + + /* + * Añade la fecha de creación del mapa + */ + private void pon_fecha(IRgbColor color, IActiveView vista_activa) + { + ITextElement text_el, txt_el; + IFrameProperties frameProperties; + IElement elm; + ISimpleTextSymbol txt_smb; + Font fuent; + IEnvelope envolv; + + color.Red = 0; + color.Green = 0; + color.Blue = 0; + + text_el = new ParagraphTextElementClass(); + txt_el = (ITextElement)text_el; + elm = (IElement)text_el; + frameProperties = (IFrameProperties)text_el; + frameProperties.Background = null; + frameProperties.Border = null; + txt_smb = new TextSymbolClass(); + fuent = new Font("Arial Narrow", 8, FontStyle.Regular); + txt_smb.Font = (stdole.IFontDisp)OLE.GetIFontDispFromFont(fuent); + txt_smb.Color = color; + txt_smb.HorizontalAlignment = esriTextHorizontalAlignment.esriTHACenter; + txt_smb.VerticalAlignment = esriTextVerticalAlignment.esriTVACenter; + //se incorpora al elemento de texto la simbologia creada + txt_el.Symbol = txt_smb; + txt_el.Text = DateTime.Today.ToString("MMMM/yyyy").ToUpper(); + //Se pone el tamaño y la ubicación de la caja de texto (ie. inches) + envolv = new ESRI.ArcGIS.Geometry.EnvelopeClass(); + envolv.PutCoords(34, 0.6, 37, 1.3); + elm.Geometry = envolv; + //añadir la caja de texto a la plantilla del mapa + pon_grafico(elm, vista_activa); + } + + /** + * Crea el mapa de localización sobre la plantilla del mapa. Estará compuesto por la cpaa de ámbitos sectorizados y el municipio sobre el que se sitúan dichos ámbitos. + */ + public void mapa_localizacion(IMap map,IFeatureWorkspace feat_wrk,string ambitos, string municipio, string path_gdb, string ftclass_nom) + { + ESRI.ArcGIS.ArcMapUI.IMxDocument mx_doc; + + try + { + mx_doc = (ESRI.ArcGIS.ArcMapUI.IMxDocument)(ArcMap.Application.Document); + //se añade la capa del municipio + ESRI.ArcGIS.Geodatabase.IFeatureClass fCl; + fCl = feat_wrk.OpenFeatureClass(ambitos); + ESRI.ArcGIS.Carto.IFeatureLayer lyr1; + lyr1 = new FeatureLayer(); + lyr1.FeatureClass = fCl; + lyr1.Name = municipio; + map.AddLayer(lyr1); + //se añade la capa de ámbitos sobre la del municipio agregada anteriormente + OliviaGlob.gdb.pinta_sectores(path_gdb, ftclass_nom, 3); + //actualiza vista + mx_doc.UpdateContents(); + mx_doc.ActiveView.Refresh(); + } + catch (Exception e) + { + MessageBox.Show(e.Message); + } + + } + + + /** + * A partir de un nombre indicado, imprime la vista actual que exista en ArcGIS en formato .pdf. Esta función se empleará cuando se ahaya cargado la plantilla de mapas correspondiente. + */ + public void print_map(string nombre) + { + string path; + IActiveView vista_activa; + ESRI.ArcGIS.esriSystem.tagRECT export_rect; + System.Int32 hdc; + IEnvelope envelope; + ESRI.ArcGIS.Output.IExport export; + path = OliviaGlob.Paths.DirData + nombre + ".pdf"; + vista_activa = ArcMap.Document.ActiveView; + try + { + //parameter check + if (vista_activa == null || !(path.EndsWith(".pdf"))) + { + return; + } + export = new ESRI.ArcGIS.Output.ExportPDFClass(); + export.ExportFileName = path; + + // Microsoft Windows default DPI resolution + export.Resolution = 96; + export_rect = vista_activa.ExportFrame; + envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass(); + envelope.PutCoords(export_rect.left, export_rect.top, export_rect.right, export_rect.bottom); + export.PixelBounds = envelope; + hdc = export.StartExporting(); + vista_activa.Output(hdc, (System.Int16)export.Resolution, ref export_rect, null, null); + + //Termina de escribir el archivo exportado y limpia cualquier archivo intermedio que se haya creado + export.FinishExporting(); + export.Cleanup(); + } + catch (Exception e) + { + MessageBox.Show(e.Message); + } + } + + /* + * Guarda archivo de trabajo en formato .mxd + */ + public void guarda_mxd(string title) + { + System.Windows.Forms.SaveFileDialog dlg; + ESRI.ArcGIS.ArcMapUI.IMxDocument mxdoc; + IDocumentInfo2 doc_info; + try + { + mxdoc = (ESRI.ArcGIS.ArcMapUI.IMxDocument)ArcMap.Application.Document; + doc_info = (IDocumentInfo2)mxdoc; + doc_info.Author = "VSM"; + doc_info.Comments += "Guardado en " + DateTime.Now.ToLongTimeString() + "\r\n"; + doc_info.Subject = "Maquetado"; + doc_info.RelativePaths = true; + doc_info.DocumentTitle = title; + //Se abre el dialogo para guardar un archivo .mxd + dlg = new System.Windows.Forms.SaveFileDialog(); + dlg.Title = "Guardar Documento de Mapa Como"; + dlg.Filter = "Documentos de Mapa (*.mxd)|*.mxd"; + dlg.FileName = title; + dlg.ShowDialog(); + //Si no se ha seleecionado un nombre de guardado para el .mxd se sale de la función + string sFilePath = dlg.FileName; + if (sFilePath == "") + return; + + ArcMap.Application.SaveAsDocument(sFilePath); + doc_info.DocumentTitle = sFilePath; + } + catch (Exception e) + { + MessageBox.Show(e.Message); + throw; + } + } + + /* + * Con una Toolbox ya generada se arranca el proceso de python para generar mapas ordenados según Data Driven Pages + */ + public void print_map_py() + { + ESRI.ArcGIS.Geoprocessing.IGeoProcessor2 gp = new ESRI.ArcGIS.Geoprocessing.GeoProcessorClass(); + gp.AddToolbox(@"C:\olivia\Maqueta.tbx"); + ESRI.ArcGIS.esriSystem.IVariantArray parameters = new ESRI.ArcGIS.esriSystem.VarArrayClass(); + object sev = null; + + try + { + gp.Execute("DDP", parameters, null); + Console.WriteLine(gp.GetMessages(ref sev)); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + string errorMsgs = gp.GetMessages(ref sev); + Console.WriteLine(errorMsgs); + } + } + + /* + * Dilogo que permite seleccionar la plantilla de interés para la maquetación + */ + public string selec_plantilla() + { + System.Windows.Forms.OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); + openFileDialog1.InitialDirectory = OliviaGlob.Paths.DirData; + openFileDialog1.Filter = "Plantillas(*.mxd)|*.mxd"; + openFileDialog1.Title = "Selecciona la plantilla para la maquetación"; + + //Muestra el diálogo para abri una plantilla que viene en formato .mxd + if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + //comprueba que sea del tipo valido + if (openFileDialog1.SafeFileName == nomb_plantilla) + { + return openFileDialog1.FileName; + } + else + { + err_str = "No se ha seleccionado una plantilla válida" ; + return null; + } + } + else + { + err_str = "No se ha seleccionado ninguna plantilla"; + return null; + } + } + + /* + * Añade la escala de texto a la cartela seleccionada en la maquetación + */ + public void pon_escala_txt(ESRI.ArcGIS.Carto.IPageLayout pPageLayout, IActiveView vista_activa) + { + int escala; + IElement element; + ITextSymbol txtsimb = null; + IEnvelope envelope; + IGraphicsContainer graphics; + IMapDocument map_doc; + IFrameElement frame_elm; + IMapFrame map_frame; + IMapSurroundFrame map_sf; + IMapSurround map_surround; + ESRI.ArcGIS.esriSystem.UID carto_uid; + IScaleText2 scale_txt; + Font font; + ESRI.ArcGIS.Geometry.IPoint pto; + ESRI.ArcGIS.esriSystem.INumericFormat numeric_format; + IMap map = ((ESRI.ArcGIS.ArcMapUI.IMxDocument)(ArcMap.Application.Document)).FocusMap; + + //INCORPORA LAS ESCALAS A LA PLANTILLA DEL MAPA + map_doc = (IMapDocument)ArcMap.Application.Document; + graphics = (IGraphicsContainer)pPageLayout; + frame_elm = graphics.FindFrame(map); + map_frame = (IMapFrame)frame_elm; + + carto_uid = new ESRI.ArcGIS.esriSystem.UID(); + carto_uid.Value = "esriCarto.ScaleText"; + map_sf = map_frame.CreateSurroundFrame(carto_uid, null); //Crear el nuevo MapSurroundFrame asociado con el MapFrame + map_surround = map_sf.MapSurround; + + //AÑADE LA ESCALA EN FORMATO TEXTO. LA ESCALA HAY QUE REDONDEARLA POR LO QUE LO PIRMERO ES CONOCER LA ESCALA DE VISUALIZACION Y REDONDEARLA. SE MODIFICARÁ TAMBIÉN LA ESCALA DE VISUALIZACIÓN. + //se redondea la escala en formato texto. + if (map.MapScale < 1000) + { + escala = ((int)(map.MapScale + 100) / 100) * 100;//se utiliza la cifra 100 porque es el numero al que se redondea (ej de escalas: 100, 300,400,500...900) + map.MapScale = escala; + } + else if (map.MapScale < 10000) + { + escala = ((int)(map.MapScale + 500) / 500) * 500;//se utiliza la cifra 500 porque es el numero al que se redondea (ej de escalas: 1500, 2000, 2500, 3000...9500) + map.MapScale = escala; + } + else if (map.MapScale < 100000) + { + escala = ((int)(map.MapScale + 5000) / 5000) * 5000;//se utiliza la cifra 5000 porque es el numero al que se redondea (ej de escalas: 50000, 55000, 60000, 65000...95000) + map.MapScale = escala; + } + else if (map.MapScale < 1000000) + { + escala = ((int)(map.MapScale + 50000) / 50000) * 50000;//se utiliza la cifra 50000 porque es el numero al que se redondea (ej de escalas: 150000, 200000, 250000, 300000...950000) + map.MapScale = escala; + } + //SE AÑADE LA ESCALA DE TEXTO + scale_txt = (IScaleText2)map_surround; + scale_txt.Name = "Scale Text"; + numeric_format = new ESRI.ArcGIS.esriSystem.NumericFormatClass(); + numeric_format.UseSeparator = true; + numeric_format.RoundingValue = 0; + //se indican las características que tiene la escala de texto + scale_txt.Style = esriScaleTextStyleEnum.esriScaleTextAbsolute; + scale_txt.NumberFormat = (ESRI.ArcGIS.esriSystem.INumberFormat)numeric_format; //se indica formato numérico. + scale_txt.Separator = "/"; + txtsimb = scale_txt.Symbol; + font = new Font("Arial Narrow", 10, FontStyle.Regular); + txtsimb.Font = (stdole.IFontDisp)OLE.GetIFontDispFromFont(font); + txtsimb.HorizontalAlignment = esriTextHorizontalAlignment.esriTHACenter; + txtsimb.VerticalAlignment = esriTextVerticalAlignment.esriTVACenter; + scale_txt.Symbol = txtsimb; + scale_txt.Refresh(); + + element = (IElement)map_sf; + envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass(); + pto = new ESRI.ArcGIS.Geometry.PointClass(); + pto.PutCoords(36.1, 1.8); + envelope.PutCoords(35.2, 1.6, 37, 2); + envelope.CenterAt(pto); + element.Geometry = envelope; //poner la geometría del map surround frame + + pon_grafico(element, vista_activa); + } + + /* + * Añade a la plantilla seleccionada el texto correpondiente del propertygrid del editor de textos + */ + public void pon_txt_prop(string capa, IActiveView vista_activa, int modo, String texto, Font fuente) + { + ITextElement txt_elm; + IFrameProperties frameProperties; + ITextElement textElement; + IElement element; + ISimpleTextSymbol txt_simb; + IEnvelope envelope; + + txt_elm = new ParagraphTextElementClass(); + //castear + frameProperties = (IFrameProperties)txt_elm; + textElement = (ITextElement)txt_elm; + element = (IElement)txt_elm; + frameProperties.Background = null; + frameProperties.Border = null; + //se pone la simbologia que se ha indicado en el dialogo. + //Si no se ha modificado la simbología se pone la por defecto para cada caso. + txt_simb = new TextSymbolClass(); + txt_simb.Font = (stdole.IFontDisp)OLE.GetIFontDispFromFont(fuente); + if (modo < 3) + txt_simb.HorizontalAlignment = esriTextHorizontalAlignment.esriTHACenter; + else if (modo > 2) + txt_simb.HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft; + + txt_simb.VerticalAlignment = esriTextVerticalAlignment.esriTVACenter; + //se incorpora al elemento de texto la simbologia creada + textElement.Symbol = txt_simb; + textElement.Text = "- " + texto; + //Se pone el tamaño y la ubicación de la caja de texto (ie. inches) + envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass(); + if (modo == 0) + envelope.PutCoords(33.9, 19.4, 41.3, 21.1); + else if (modo == 1) + envelope.PutCoords(33.9, 18.2, 41.3, 19.3); + else if (modo == 2) + envelope.PutCoords(33.9, 16.4, 41.3, 18.3); + else if (modo == 3) //frecuencia + envelope.PutCoords(35.08, 14.20, 35.08 + 3.1, 14.20 + 0.75); + else if (modo == 4) //turno + envelope.PutCoords(35.08, 13.36, 35.08 + 3.1, 13.36 + 0.75); + else if (modo == 5) //equipo + envelope.PutCoords(37.52, 14.20, 37.52 + 3.1, 14.20 + 0.75); + else if (modo == 6) //info adi + envelope.PutCoords(37.52, 13.36, 37.52 + 3.1, 13.36 + 0.75); + element.Geometry = envelope; + + //añadir la caja de texto a la plantilla del mapa + pon_grafico(element, vista_activa); + } + + /* + * añade a la plantilla seleccionada un recuadro donde se situarán la Frecuencia del servicio, el turno y el Equipo encragado + */ + public void pon_recuadro(IRgbColor color, IActiveView vista_activa) + { + IElement elme; + ILineElement lineElement; + ISimpleLineSymbol simpleLineSymbol; + IPolyline pPolyline; + IPoint p1, p2, p3, p4, p5; + IPointCollection pPointColl; + //se marcan las coordenadas donde irá el recuadro + p1 = new PointClass(); + p1.X = 34.1; p1.Y = 10.1; + p2 = new PointClass(); + p2.X = 34.1; p2.Y = 15.5; + p3 = new PointClass(); + p3.X = 41.2; p3.Y = 15.5; + p4 = new PointClass(); + p4.X = 41.2; p4.Y = 10.1; + p5 = new PointClass(); + p5.X = 34.1; p5.Y = 10.1; + //se añade a una coleccion de puntos + pPolyline = new PolylineClass(); + pPointColl = (IPointCollection)pPolyline; + pPointColl.AddPoint(p1); + pPointColl.AddPoint(p2); + pPointColl.AddPoint(p3); + pPointColl.AddPoint(p4); + pPointColl.AddPoint(p5); + //se indica la simbología con la que se representará el recuadro + elme = new LineElement(); + lineElement = (ILineElement)elme; + simpleLineSymbol = new SimpleLineSymbolClass(); + color.Red = 0; + color.Green = 38; + color.Blue = 115; + simpleLineSymbol.Color = color; + simpleLineSymbol.Width = 1; + lineElement.Symbol = simpleLineSymbol; + //Se pone el tamaño y la ubicación del recuadro (ie. inches) + elme.Geometry = pPolyline; + //añadir el recuadro la plantilla del mapa + pon_grafico(elme, vista_activa); + } + + /* + * Añade en la plantilla los distintos elemenots que sae quieren incorporar (titulo, escala, fecha, etc) + */ + public void pon_grafico(IElement element, IActiveView vista_activa) + { + IGraphicsContainer grafico; + IGraphicsContainerSelect graph_sel; + + grafico = (IGraphicsContainer)ArcMap.Document.PageLayout; + grafico.AddElement(element, 0); + graph_sel = (IGraphicsContainerSelect)grafico; + graph_sel.UnselectAllElements(); + vista_activa.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); + } + + /* + * Realiza el proceso completo de maquetación. Permite la selección de las capas que se quieren maquetar, la plantilla que se va a utlizar, los t´tilos e informaciones adicionales que se quieren añadir, etc. + */ + public bool maqueta(IntPtr handle) + { + int seleccionados, n_mapas, i; + string muni, foto, dir_plant, name_plant; + IPageLayout pPageLayout; + IUniqueValueRenderer valor_unico; + IDatasetName shp_dname; + IWorkspace wspace; + IWorkspaceFactory wsf; + IEnumDatasetName grupos; + ListCapasMaqueta lista; + IMapDocument map_doc; + IApplication app; + IFeatureWorkspace feat_wrk = null; + IMap map; + + app = ArcMap.Application; + //se importa algún shape si fuera necesario a la GDB de interés + //se seleeciona la GDB de donde se extraerán las capas que se quieren maquetar + string text_reint = "¿Desea cancelar el proceso de maquetación?"; + wspace = FunGDB.selec_gdb("Seleccionar GDB que contiene las capas a maquetar", handle.ToInt32(), text_reint); + if (wspace == null) + { + err_str = "No se ha seleccionado ninguna GDB. Se cancela el proceso de maquetación."; + return false; + } + //se genera un listado con los grupos de la GDB existentes + lista = new ListCapasMaqueta(); + grupos = wspace.get_DatasetNames(esriDatasetType.esriDTFeatureDataset); + //se muestra un listado con las capas que pertenecen a la GDB que terminan por "_Sector" o "_Ruta" + lista.inicia(grupos); + lista.ShowDialog(); + if ((lista.capas_maquetar == null) || (lista.capas_maquetar.Length == 0)) + { + err_str = "No se ha seleccionado ninguna capa para la maquetación"; + return false; + } + else + { + //se maqueta cada capa seleccionada + seleccionados = lista.capas_maquetar.Length; + for (i = 0; i < seleccionados; i++) + { + try + { + //hay que eliminar las posibles capas que se encuentren abiertas para realizar bien la maquetación + limpia_vista(); + + shp_dname = OliviaGlob.mapa.municipio(wspace.PathName, lista.capas_maquetar[i], out muni); + wsf = new FileGDBWorkspaceFactoryClass(); + feat_wrk = (IFeatureWorkspace)wsf.OpenFromFile(wspace.PathName, 0); + + pPageLayout = OliviaGlob.mapa.pon_plantilla(out dir_plant); + if (pPageLayout == null) + return false; + + valor_unico = OliviaGlob.gdb.pinta_sectores(wspace.PathName, lista.capas_maquetar[i], 2); + if (valor_unico == null) + { + limpia_vista(); + return false; + } + + //si es capa de ruta, pinta los puntos de control + if (lista.capas_maquetar[i].EndsWith(OliviaGlob.gdb.name_ruta_out)) + { + //se abre la capa de puntos de control y se pintan por el sector al que pertenecen. + string shape = lista.capas_maquetar[i].Substring(0, lista.capas_maquetar[i].IndexOf(OliviaGlob.gdb.name_ruta_out)); + OliviaGlob.gdb.ptos_control(wspace.PathName + "\\" + shape + OliviaGlob.gdb.name_control_out); + } + + name_plant = System.IO.Path.GetFileName(dir_plant); + //INSERTAR IMAGEN DEL CLIENTE + foto = OliviaGlob.mapa.pon_imag("Selecciona la imagen del cliente", 0, 1); + foto = OliviaGlob.mapa.pon_imag("Selecciona la imagen del licitador", 1, 1); + + //RELLENA LOS ELEMENTOS DE LA CARTELA + if (!OliviaGlob.mapa.rellena_plantilla(pPageLayout, shp_dname, name_plant, 0)) + { + limpia_vista(); + return false; + } + + //SE AÑADEN LAS CAPAS QUE CONFORMAN EL MAPA DE SITUACIÓN (CAPA CON EL MUNICIPIO AL QUE PERTENECEN LOS ÁMBITOS Y LA CAPA DE ÁMBITOS SUPERPUESTA + ESRI.ArcGIS.ArcMapUI.IMxDocument mx_doc = (ESRI.ArcGIS.ArcMapUI.IMxDocument)(ArcMap.Application.Document); + n_mapas = mx_doc.Maps.Count; + //se pasa el foco al grupo de capas (Data Frame) del mapa de situación + //Así cuando añadamos nuevas capas se añadirán al marco de datos que compone el mapa de situación. + map = ((ESRI.ArcGIS.ArcMapUI.IMxDocument)(ArcMap.Application.Document)).FocusMap; + for (int j = 0; j < n_mapas; j++) + { + map = mx_doc.Maps.get_Item(j); + if ((map.Name == OliviaGlob.df_secund) || (map.Name == OliviaGlob.df_secund1)) + break; + } + OliviaGlob.mapa.mapa_localizacion(map, feat_wrk, shp_dname.Name, muni, wspace.PathName, lista.capas_maquetar[i]); + + map_doc = (IMapDocument)app.Document; + + guarda_mxd(lista.capas_maquetar[i]); + + } + catch (Exception ex) + { + OliviaGlob.borra_files(); + MessageBox.Show(ex.Message); + limpia_vista(); + FunGDB.libera(feat_wrk); + return false; + } + } + } + FunGDB.libera(feat_wrk); + return true; + } + + /* + * Elimina las capas que se puedan encontrar abiertas en el espacio de trabajo + */ + public void limpia_vista() + { + int nmapas; + ESRI.ArcGIS.ArcMapUI.IMxDocument mx_doc; + IApplication app; + IMap map; + + app = ArcMap.Application; + mx_doc = (ESRI.ArcGIS.ArcMapUI.IMxDocument)(app.Document); + + nmapas = mx_doc.Maps.Count; + for (int j = 0; j < nmapas; j++) + { + map = mx_doc.Maps.get_Item(j); + if ((map.Name == OliviaGlob.df_secund) || (map.Name == OliviaGlob.df_secund1)) + { + map.ClearLayers(); + //actuliza la vista del mapa para que se visualice + mx_doc.UpdateContents(); + mx_doc.ActiveView.Refresh(); + } + else if (map.Name == OliviaGlob.df_princip) + { + map.ClearLayers(); + //actuliza la vista del mapa para que se visualice + mx_doc.UpdateContents(); + mx_doc.ActiveView.Refresh(); + } + } + } + + } +} diff --git a/OliviaAddIn/OliviaAddIn.csproj b/OliviaAddIn/OliviaAddIn.csproj new file mode 100644 index 0000000..4bb0f77 --- /dev/null +++ b/OliviaAddIn/OliviaAddIn.csproj @@ -0,0 +1,406 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {DB9A28BA-37A9-4D46-8CFF-06A444FCDEF7} + Library + Properties + OliviaAddIn + OliviaAddIn + v4.0 + 512 + + + 3.5 + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + true + AllRules.ruleset + x86 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + AllRules.ruleset + + + + + + True + + + False + + + False + + + False + False + + + False + False + + + False + + + False + + + False + + + False + + + False + + + False + + + False + + + False + + + False + + + False + + + False + + + + False + + + False + False + + + True + + + False + + + True + + + + + ..\SisNetBase\SisNetBase.dll + + + False + + + + + + + + + + + + + + + + + + + + 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 + + + + True + True + Resources.resx + + + Form + + + + + Form + + + RecogidaDlg.cs + + + Form + + + SensCampos.cs + + + + + ArcGISAddInHostGenerator + Config.Designer.cs + Designer + + + + + False + + + + + False + Microsoft .NET Framework 4 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 3.1 + true + + + + + FormCampos.cs + + + DatosCsv.cs + + + EditTxtPlant.cs + + + InicioDlg.cs + + + LimpCampos.cs + + + LimpiezaDlg.cs + + + LimpiezaDlg.cs + + + ListCapasMaqueta.cs + + + ListForm.cs + + + ProgresoEjec.cs + + + ProgresoInic.cs + + + ResXFileCodeGenerator + Designer + Resources.Designer.cs + + + RecoCampos.cs + + + RecogidaDlg.cs + + + SensCampos.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {B395D0F3-766D-46C5-BDE9-FBDEE1582259} + OliviaDef + + + + esriAddIn + Desktop + 10.2 + + + + + + + + + + + + ArcMap + + + + + + + \ No newline at end of file diff --git a/OliviaAddIn/OliviaAddIn.csproj.user b/OliviaAddIn/OliviaAddIn.csproj.user new file mode 100644 index 0000000..fd18fb1 --- /dev/null +++ b/OliviaAddIn/OliviaAddIn.csproj.user @@ -0,0 +1,23 @@ + + + + Program + C:\Program Files\ArcGIS\Desktop10.2\bin\ArcMap.exe + C:\Program Files\ArcGIS\Desktop10.2\bin + + + Program + C:\Program Files\ArcGIS\Desktop10.2\bin\ArcMap.exe + + + + + + + + + en-US + false + ShowAllFiles + + \ No newline at end of file diff --git a/OliviaAddIn/OliviaGlob.cs b/OliviaAddIn/OliviaGlob.cs new file mode 100644 index 0000000..ca25f84 --- /dev/null +++ b/OliviaAddIn/OliviaGlob.cs @@ -0,0 +1,1329 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using SisNetBase; +using OliviaDef; +using System.Runtime.InteropServices; +using Microsoft.Win32; +using System.Net; +using System.Net.Sockets; +using System.IO; + +using ESRI.ArcGIS.CatalogUI; +using ESRI.ArcGIS.Catalog; +using ESRI.ArcGIS.Geodatabase; +using ESRI.ArcGIS.Carto; +using ESRI.ArcGIS.Display; +using System.Drawing; +using ESRI.ArcGIS.ADF.COMSupport; +using ESRI.ArcGIS.Geometry; + +namespace OliviaAddIn +{ + /** + * @file OliviaGlob.cs + * Clase de variables globales de la herramienta. + * Contiene las definiciones e instancias globales accesibles desde + * cualquier otra clase de la herramienta. + */ + + /** + * Para Indicar si la ventana se cierra porque se ha dado a cerrar, o a ejecutar sectorización, o planificación + */ + public enum TiposEstado + { + Inicio, + Secto, + FinOkSecto, + PreparadoPlanif, + Planif, + FinOkPlanif, + FinPlanif, + RePlanif, + FinNOk + } + + /** + * Clase de variables globales de la herramienta. + * Contiene las definiciones e instancias globales accesibles desde + * cualquier otra clase de la herramienta. + */ + class OliviaGlob + { + /** + * Nombre de las capas que se van a necesitar para la exportación de datos para la limpieza + */ + public struct Capas + { + public static string ftclass_ejes; // 0) + { + str = (String)rkprg.GetValue("path_cfg"); + if (!string.IsNullOrEmpty(str)) + Paths.PathCfg = str; + } + if(str==null) + Paths.PathCfg = "C:\\Olivia\\cfg.ini"; //por defecto + + ini = new IniFile(Paths.PathCfg, false); + if (ini == null) + { + err_str = "Error al leer el archivo de configuración"; + return false; + } + + try + { + + //inicializa las variables por defecto + ini_default(); + + //para el grupo de opciones generales + Paths.PathWork = ini.GetValue(GeneralDef.GrupoGen, GeneralDef.GG_pw, Paths.PathWork); + dir = Paths.PathWork; + + //para el grupo GDB + aux = ini.GetValue(GeneralDef.GrupoGDB, GeneralDef.GDB_gen, Paths.PathGdbGen); + Paths.PathGdbGen = pon_path_absoluto(aux, dir); + aux = ini.GetValue(GeneralDef.GrupoGDB, GeneralDef.GDB_nw, Paths.PathGdbNw); + Paths.PathGdbNw = pon_path_absoluto(aux, dir); + aux = ini.GetValue(GeneralDef.GrupoGDB, GeneralDef.simb_vsm, Paths.PathSimbVSM); + Paths.PathSimbVSM = pon_path_absoluto(aux, dir); + aux = ini.GetValue(GeneralDef.GrupoGDB, GeneralDef.simb_esri, Paths.PathSimbESRI); + Paths.PathSimbESRI = pon_path_absoluto(aux, dir); + puerto = ini.GetValue(GeneralDef.GrupoGDB, GeneralDef.GDB_puerto, puerto); + OliviaGlob.buff_export = ini.GetValue(GeneralDef.GrupoGDB, GeneralDef.GG_buff, 1000); //para el buffer + + //para el grupo de opciones generales + aux = ini.GetValue(GeneralDef.GrupoGen, GeneralDef.GG_pg, Paths.PathGeofoto); + Paths.PathGeofoto = pon_path_absoluto(aux, dir); + aux = ini.GetValue(GeneralDef.GrupoGen, GeneralDef.GG_pt, Paths.PathTemp); + Paths.PathTemp = pon_path_absoluto(aux, dir); + aux = ini.GetValue(GeneralDef.GrupoGen, GeneralDef.GG_pd, Paths.DirData); + Paths.DirData = pon_path_absoluto(aux, dir); + aux = ini.GetValue(GeneralDef.GrupoGDB, GeneralDef.GDB_nw, Paths.PathGdbNw); + Paths.PathGdbNw = pon_path_absoluto(aux, dir); + aux = ini.GetValue(GeneralDef.GrupoGen, GeneralDef.GG_pcar, Paths.PathCartela); + Paths.PathCartela = pon_path_absoluto(aux, dir); + + //para el grupo de CAPAS GENERALES + OliviaGlob.Capas.ftclass_ejes = ini.GetValue(GeneralDef.GrupoCapa, GeneralDef.GC_eje, OliviaGlob.Capas.ftclass_ejes); + OliviaGlob.Capas.ftclass_zonas = ini.GetValue(GeneralDef.GrupoCapa, GeneralDef.GC_zon, OliviaGlob.Capas.ftclass_zonas); + OliviaGlob.Capas.ftclass_restri = ini.GetValue(GeneralDef.GrupoCapa, GeneralDef.GC_rest, OliviaGlob.Capas.ftclass_restri); + OliviaGlob.Capas.ftclass_muni = ini.GetValue(GeneralDef.GrupoCapa, GeneralDef.GC_muni, OliviaGlob.Capas.ftclass_muni); + + //para el grupo CAPAS de LIMPIEZA + LimpiezaDef.Capas.ftclass_niveles = ini.GetValue(GeneralDef.GrupoCapaLImp, GeneralDef.GCA_niv, LimpiezaDef.Capas.ftclass_niveles); + LimpiezaDef.Capas.ftclass_cont = ini.GetValue(GeneralDef.GrupoCapaLImp, GeneralDef.GCA_cont, LimpiezaDef.Capas.ftclass_cont); + LimpiezaDef.Capas.ftclass_mobi = ini.GetValue(GeneralDef.GrupoCapaLImp, GeneralDef.GCA_mobi, LimpiezaDef.Capas.ftclass_mobi); + LimpiezaDef.Capas.ftclass_limp_mec = ini.GetValue(GeneralDef.GrupoCapaLImp, GeneralDef.GCA_limp, LimpiezaDef.Capas.ftclass_limp_mec); + LimpiezaDef.Capas.ftclass_instala = ini.GetValue(GeneralDef.GrupoCapaLImp, GeneralDef.GCA_inst, LimpiezaDef.Capas.ftclass_instala); + + //para el grupo CAMPOS de LIMPIEZA + LimpiezaDef.Campos.consulta_entidad = ini.GetValue(GeneralDef.GrupoCampoLimp, GeneralDef.GAA_entid, LimpiezaDef.Campos.consulta_entidad); + LimpiezaDef.Campos.consulta_mecan = ini.GetValue(GeneralDef.GrupoCampoLimp, GeneralDef.GAA_mecan, LimpiezaDef.Campos.consulta_mecan); + + //para el grupo de ATRIBUTOS de LIMPIEZA + LimpiezaDef.Atributos.atr_esca = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_esc, LimpiezaDef.Atributos.atr_esca); + LimpiezaDef.Atributos.atr_fuent = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_fuent, LimpiezaDef.Atributos.atr_fuent); + LimpiezaDef.Atributos.atr_infan = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_infan, LimpiezaDef.Atributos.atr_infan); + LimpiezaDef.Atributos.atr_pape = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_pape, LimpiezaDef.Atributos.atr_pape); + LimpiezaDef.Atributos.atr_paso_niv = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_paso_niv, LimpiezaDef.Atributos.atr_paso_niv); + LimpiezaDef.Atributos.atr_pipi = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_pipi, LimpiezaDef.Atributos.atr_pipi); + LimpiezaDef.Atributos.atr_sane = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_sane, LimpiezaDef.Atributos.atr_sane); + LimpiezaDef.Atributos.atr_acera = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_acera, LimpiezaDef.Atributos.atr_acera); + LimpiezaDef.Atributos.atr_aparc = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_aparc, LimpiezaDef.Atributos.atr_aparc); + LimpiezaDef.Atributos.atr_bord = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_bord, LimpiezaDef.Atributos.atr_bord); + LimpiezaDef.Atributos.atr_hoja = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_hoja, LimpiezaDef.Atributos.atr_hoja); + LimpiezaDef.Atributos.atr_peat = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_peat, LimpiezaDef.Atributos.atr_peat); + LimpiezaDef.Atributos.atr_terri = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_terri, LimpiezaDef.Atributos.atr_terri); + LimpiezaDef.Atributos.atr_ocio = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_ocio, LimpiezaDef.Atributos.atr_ocio); + LimpiezaDef.Atributos.atr_org_ofi = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_org_ofi, LimpiezaDef.Atributos.atr_org_ofi); + LimpiezaDef.Atributos.atr_parq = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_parq, LimpiezaDef.Atributos.atr_parq); + LimpiezaDef.Atributos.atr_park = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_park, LimpiezaDef.Atributos.atr_park); + LimpiezaDef.Atributos.atr_play = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_play, LimpiezaDef.Atributos.atr_play); + LimpiezaDef.Atributos.atr_polid = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_polid, LimpiezaDef.Atributos.atr_polid); + LimpiezaDef.Atributos.atr_turis = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_turis, LimpiezaDef.Atributos.atr_turis); + LimpiezaDef.Atributos.atr_solar = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_solar, LimpiezaDef.Atributos.atr_solar); + LimpiezaDef.Atributos.atr_suelo = ini.GetValue(GeneralDef.GrupoAtribLimp, GeneralDef.GAL_suelo, LimpiezaDef.Atributos.atr_suelo); + + //para el grupo FILTROS de LIMPIEZA + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbEjeCalle] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_eje, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbEjeCalle]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordLibreMec] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_blm, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordLibreMec]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordLibreNoMec] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_blnm, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordLibreNoMec]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordAparc] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_ba, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordAparc]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbAceMec] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_bam, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbAceMec]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_banm, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbCallePeatMec] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_cpm, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbCallePeatMec]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbCallePeatNoMec] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_cpnm, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbCallePeatNoMec]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordHojaMec] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_chm, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordHojaMec]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordHojaNoMec] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_chnm, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordHojaNoMec]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbConte] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_cont, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbConte]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbPape] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_pap, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbPape]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbZInf] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_inf, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbZInf]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbPipi] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_pipi, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbPipi]); + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbSane] = + ini.GetValue(GeneralDef.GrupoFiltLimp, GeneralDef.GFA_sane, LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbSane]); + + //para el grupo PARAMETROS de LIMPIEZA + LimpiezaDef.Parametros.t_ttoM = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoM, LimpiezaDef.Parametros.t_ttoM); + LimpiezaDef.Parametros.t_ttom = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttom, LimpiezaDef.Parametros.t_ttom); + LimpiezaDef.Parametros.v_despM = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_v_despM, LimpiezaDef.Parametros.v_despM); + LimpiezaDef.Parametros.v_despm = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_v_despm, LimpiezaDef.Parametros.v_despm); + LimpiezaDef.Parametros.t_cardescM = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_cardescM, LimpiezaDef.Parametros.t_cardescM); + LimpiezaDef.Parametros.t_cardescm = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_cardescm, LimpiezaDef.Parametros.t_cardescm); + LimpiezaDef.Parametros.t_cardesc = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_cardesc, LimpiezaDef.Parametros.t_cardesc); + LimpiezaDef.Parametros.t_despM = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_t_despM, LimpiezaDef.Parametros.t_despM); + LimpiezaDef.Parametros.t_despm = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_t_despm, LimpiezaDef.Parametros.t_despm); + LimpiezaDef.Parametros.t_desp = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_t_desp, LimpiezaDef.Parametros.t_desp); + LimpiezaDef.Parametros.t_convM = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_convM, LimpiezaDef.Parametros.t_convM); + LimpiezaDef.Parametros.t_convm = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_convm, LimpiezaDef.Parametros.t_convm); + LimpiezaDef.Parametros.t_conv = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_conv, LimpiezaDef.Parametros.t_conv); + LimpiezaDef.Parametros.t_descansoM = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_descM, LimpiezaDef.Parametros.t_descansoM); + LimpiezaDef.Parametros.t_descansom = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_descm, LimpiezaDef.Parametros.t_descansom); + LimpiezaDef.Parametros.t_descanso = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_desc, LimpiezaDef.Parametros.t_descanso); + LimpiezaDef.Parametros.h_inicio = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_h_inicio, LimpiezaDef.Parametros.h_inicio); + LimpiezaDef.Parametros.ancho_viaM = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_anchM, LimpiezaDef.Parametros.ancho_viaM); + LimpiezaDef.Parametros.ancho_viam = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_anchm, LimpiezaDef.Parametros.ancho_viam); + LimpiezaDef.Parametros.ancho_via = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_anch, LimpiezaDef.Parametros.ancho_via); + LimpiezaDef.Parametros.ttoBarMan = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoBarMan, LimpiezaDef.Parametros.ttoBarMan); + LimpiezaDef.Parametros.ttoBarManMant = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoBarManMant, LimpiezaDef.Parametros.ttoBarManMant); + LimpiezaDef.Parametros.ttoBarMMot = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoBarMMot, LimpiezaDef.Parametros.ttoBarMMot); + LimpiezaDef.Parametros.ttoBarMC = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoBarMC, LimpiezaDef.Parametros.ttoBarMC); + LimpiezaDef.Parametros.ttoBarMAP = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoBarMAP, LimpiezaDef.Parametros.ttoBarMAP); + LimpiezaDef.Parametros.ttoBarMix = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoBarMix, LimpiezaDef.Parametros.ttoBarMix); + LimpiezaDef.Parametros.ttoBalMan = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoBalMan, LimpiezaDef.Parametros.ttoBalMan); + LimpiezaDef.Parametros.ttoBalMC = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoBalMC, LimpiezaDef.Parametros.ttoBalMC); + LimpiezaDef.Parametros.ttoBalMAP = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoBalMAP, LimpiezaDef.Parametros.ttoBalMAP); + LimpiezaDef.Parametros.ttoBalMix = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoBalMix, LimpiezaDef.Parametros.ttoBalMix); + LimpiezaDef.Parametros.ttoBL = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoBL, LimpiezaDef.Parametros.ttoBL); + LimpiezaDef.Parametros.ttoCH = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoCH, LimpiezaDef.Parametros.ttoCH); + LimpiezaDef.Parametros.ttoVPap = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoVPap, LimpiezaDef.Parametros.ttoVPap); + LimpiezaDef.Parametros.ttoLPap = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoLPap, LimpiezaDef.Parametros.ttoLPap); + LimpiezaDef.Parametros.ttoLC = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoLC, LimpiezaDef.Parametros.ttoLC); + LimpiezaDef.Parametros.ttoLZI = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoLZI, LimpiezaDef.Parametros.ttoLZI); + LimpiezaDef.Parametros.ttoLPip = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoLPip, LimpiezaDef.Parametros.ttoLPip); + LimpiezaDef.Parametros.ttoLS = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_ttoLS, LimpiezaDef.Parametros.ttoLS); + LimpiezaDef.Parametros.vdespBarMan = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespBarMan, LimpiezaDef.Parametros.vdespBarMan); + LimpiezaDef.Parametros.vdespBarManMant = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespBarManMant, LimpiezaDef.Parametros.vdespBarManMant); + LimpiezaDef.Parametros.vdespBarMMot = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespBarMMot, LimpiezaDef.Parametros.vdespBarMMot); + LimpiezaDef.Parametros.vdespBarMC = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespBarMC, LimpiezaDef.Parametros.vdespBarMC); + LimpiezaDef.Parametros.vdespBarMAP = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespBarMAP, LimpiezaDef.Parametros.vdespBarMAP); + LimpiezaDef.Parametros.vdespBarMix = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespBarMix, LimpiezaDef.Parametros.vdespBarMix); + LimpiezaDef.Parametros.vdespBalMan = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespBalMan, LimpiezaDef.Parametros.vdespBalMan); + LimpiezaDef.Parametros.vdespBalMC = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespBalMC, LimpiezaDef.Parametros.vdespBalMC); + LimpiezaDef.Parametros.vdespBalMAP = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespBalMAP, LimpiezaDef.Parametros.vdespBalMAP); + LimpiezaDef.Parametros.vdespBalMix = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespBalMix, LimpiezaDef.Parametros.vdespBalMix); + LimpiezaDef.Parametros.vdespBL = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespBL, LimpiezaDef.Parametros.vdespBL); + LimpiezaDef.Parametros.vdespCH = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespCH, LimpiezaDef.Parametros.vdespCH); + LimpiezaDef.Parametros.vdespVPap = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespVPap, LimpiezaDef.Parametros.vdespVPap); + LimpiezaDef.Parametros.vdespLPap = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespLPap, LimpiezaDef.Parametros.vdespLPap); + LimpiezaDef.Parametros.vdespLC = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespLC, LimpiezaDef.Parametros.vdespLC); + LimpiezaDef.Parametros.vdespLZI = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespLZI, LimpiezaDef.Parametros.vdespLZI); + LimpiezaDef.Parametros.vdespLPip = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespLPip, LimpiezaDef.Parametros.vdespLPip); + LimpiezaDef.Parametros.vdespLS = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_vdespLS, LimpiezaDef.Parametros.vdespLS); + LimpiezaDef.Parametros.umbral_reco = ini.GetValue(GeneralDef.GrupoParamLimp, GeneralDef.GPA_umbral_reco, LimpiezaDef.Parametros.umbral_reco); + + //////////////////////// + //para el grupo CAMPOS de RECOGIDA + RecogidaDef.campos_def.cons_id = ini.GetValue(GeneralDef.GrupoCampoReco, GeneralDef.GAR_id, RecogidaDef.campos_def.cons_id); + RecogidaDef.campos_def.cons_nomrec = ini.GetValue(GeneralDef.GrupoCampoReco, GeneralDef.GAR_nomrec, RecogidaDef.campos_def.cons_nomrec); + RecogidaDef.campos_def.cons_lateral = ini.GetValue(GeneralDef.GrupoCampoReco, GeneralDef.GAR_lateral, RecogidaDef.campos_def.cons_lateral); + RecogidaDef.campos_def.cons_fracc = ini.GetValue(GeneralDef.GrupoCampoReco, GeneralDef.GAR_frac, RecogidaDef.campos_def.cons_fracc); + RecogidaDef.campos_def.cons_capac = ini.GetValue(GeneralDef.GrupoCampoReco, GeneralDef.GAR_capac, RecogidaDef.campos_def.cons_capac); + RecogidaDef.campos_def.cons_uds = ini.GetValue(GeneralDef.GrupoCampoReco, GeneralDef.GAR_uds, RecogidaDef.campos_def.cons_uds); + RecogidaDef.campos_def.cons_kgrec = ini.GetValue(GeneralDef.GrupoCampoReco, GeneralDef.GAR_kgrec, RecogidaDef.campos_def.cons_kgrec); + RecogidaDef.kgrec_cont = ini.GetValue(GeneralDef.GrupoCampoReco, GeneralDef.GAR_kgrec_val, RecogidaDef.kgrec_cont); + RecogidaDef.lleno = ini.GetValue(GeneralDef.GrupoCampoReco, GeneralDef.GAR_is_lleno, RecogidaDef.lleno); + RecogidaDef.kgrec_camp = ini.GetValue(GeneralDef.GrupoCampoReco, GeneralDef.GAR_is_campo, RecogidaDef.kgrec_camp); + + //para el grupo de ATRIBUTOS de RECOGIDA + //Rellena los tipos de fracción + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Organica] = ini.GetValue(GeneralDef.GrupoAtribReco, GeneralDef.GAT_organica, RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Organica]); + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Resto] = ini.GetValue(GeneralDef.GrupoAtribReco, GeneralDef.GAT_resto, RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Resto]); + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Envases] = ini.GetValue(GeneralDef.GrupoAtribReco, GeneralDef.GAT_envase, RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Envases]); + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Papel] = ini.GetValue(GeneralDef.GrupoAtribReco, GeneralDef.GAT_papel, RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Papel]); + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Vidrio] = ini.GetValue(GeneralDef.GrupoAtribReco, GeneralDef.GAT_vidrio, RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Vidrio]); + //Rellena los tipos de carga + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Trasera] = ini.GetValue(GeneralDef.GrupoAtribReco, GeneralDef.GAT_trasera, RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Trasera]); + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lateral] = ini.GetValue(GeneralDef.GrupoAtribReco, GeneralDef.GAT_lateral, RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lateral]); + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Superior] = ini.GetValue(GeneralDef.GrupoAtribReco, GeneralDef.GAT_superior, RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Superior]); + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Bilateral] = ini.GetValue(GeneralDef.GrupoAtribReco, GeneralDef.GAT_bilat, RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Bilateral]); + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.BolseoPtaPta] = ini.GetValue(GeneralDef.GrupoAtribReco, GeneralDef.GAT_bolseo, RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.BolseoPtaPta]); + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lavado] = ini.GetValue(GeneralDef.GrupoAtribReco, GeneralDef.GAT_lavado, RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lavado]); + + //para el grupo PARAMETROS de RECOGIDA + RecogidaDef.Parametros.t_vaciM = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_vaciM, RecogidaDef.Parametros.t_vaciM); + RecogidaDef.Parametros.t_vacim = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_vacim, RecogidaDef.Parametros.t_vacim); + RecogidaDef.Parametros.t_llegsalM = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_llegsalM, RecogidaDef.Parametros.t_llegsalM); + RecogidaDef.Parametros.t_llegsalm = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_llegsalm, RecogidaDef.Parametros.t_llegsalm); + RecogidaDef.Parametros.t_llegsal = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_llegsal, RecogidaDef.Parametros.t_llegsal); + RecogidaDef.Parametros.t_descM = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_descM, RecogidaDef.Parametros.t_descM); + RecogidaDef.Parametros.t_descm = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_descm, RecogidaDef.Parametros.t_descm); + RecogidaDef.Parametros.t_desc = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_desc, RecogidaDef.Parametros.t_desc); + RecogidaDef.Parametros.t_convM = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_convM, RecogidaDef.Parametros.t_convM); + RecogidaDef.Parametros.t_convm = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_convm, RecogidaDef.Parametros.t_convm); + RecogidaDef.Parametros.t_conv = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_conv, RecogidaDef.Parametros.t_conv); + RecogidaDef.Parametros.t_descansoM = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_descansoM, RecogidaDef.Parametros.t_descansoM); + RecogidaDef.Parametros.t_descansom = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_descansom, RecogidaDef.Parametros.t_descansom); + RecogidaDef.Parametros.t_descanso = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_descanso, RecogidaDef.Parametros.t_descanso); + RecogidaDef.Parametros.h_inicio = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_h_inicio, RecogidaDef.Parametros.h_inicio); + RecogidaDef.Parametros.dens_vehi_org = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_dv_org, RecogidaDef.Parametros.dens_vehi_org); + RecogidaDef.Parametros.dens_vehi_res = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_dv_res, RecogidaDef.Parametros.dens_vehi_res); + RecogidaDef.Parametros.dens_vehi_env = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_dv_env, RecogidaDef.Parametros.dens_vehi_env); + RecogidaDef.Parametros.dens_vehi_pap = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_dv_pap, RecogidaDef.Parametros.dens_vehi_pap); + RecogidaDef.Parametros.dens_vehi_vid = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_dv_vid, RecogidaDef.Parametros.dens_vehi_vid); + RecogidaDef.Parametros.dens_vehi_otr = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_dv_otr, RecogidaDef.Parametros.dens_vehi_otr); + RecogidaDef.Parametros.dens_cont_org = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_dc_org, RecogidaDef.Parametros.dens_cont_org); + RecogidaDef.Parametros.dens_cont_res = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_dc_res, RecogidaDef.Parametros.dens_cont_res); + RecogidaDef.Parametros.dens_cont_env = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_dc_env, RecogidaDef.Parametros.dens_cont_env); + RecogidaDef.Parametros.dens_cont_pap = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_dc_pap, RecogidaDef.Parametros.dens_cont_pap); + RecogidaDef.Parametros.dens_cont_vid = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_dc_vid, RecogidaDef.Parametros.dens_cont_vid); + RecogidaDef.Parametros.dens_cont_otr = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_dc_otr, RecogidaDef.Parametros.dens_cont_otr); + RecogidaDef.Parametros.anch_vehi_3 = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_anchv_3, RecogidaDef.Parametros.anch_vehi_3); + RecogidaDef.Parametros.anch_vehi_2 = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_anchv_2, RecogidaDef.Parametros.anch_vehi_2); + RecogidaDef.Parametros.anch_vehi_s = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_anchv_s, RecogidaDef.Parametros.anch_vehi_s); + RecogidaDef.Parametros.rad_giro_3 = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_rgiro_3, RecogidaDef.Parametros.rad_giro_3); + RecogidaDef.Parametros.rad_giro_2 = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_rgiro_2, RecogidaDef.Parametros.rad_giro_2); + RecogidaDef.Parametros.rad_giro_s = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_rgiro_s, RecogidaDef.Parametros.rad_giro_s); + RecogidaDef.Parametros.t_vaci_tra = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_tv_tra, RecogidaDef.Parametros.t_vaci_tra); + RecogidaDef.Parametros.t_vaci_lat = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_tv_lat, RecogidaDef.Parametros.t_vaci_lat); + RecogidaDef.Parametros.t_vaci_sup = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_tv_sup, RecogidaDef.Parametros.t_vaci_sup); + RecogidaDef.Parametros.t_vaci_bi = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_tv_bi, RecogidaDef.Parametros.t_vaci_bi); + RecogidaDef.Parametros.t_vaci_bol = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_tv_bol, RecogidaDef.Parametros.t_vaci_bol); + RecogidaDef.Parametros.t_vaci_lav = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_tv_lav, RecogidaDef.Parametros.t_vaci_lav); + RecogidaDef.Parametros.t_vaci_otr = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_tv_otr, RecogidaDef.Parametros.t_vaci_otr); + RecogidaDef.Parametros.kgmaxM = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_kgmaxM, RecogidaDef.Parametros.kgmaxM); + RecogidaDef.Parametros.kgmaxm = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_kgmaxm, RecogidaDef.Parametros.kgmaxm); + RecogidaDef.Parametros.carga_maxM = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_carga_maxM, RecogidaDef.Parametros.carga_maxM); + RecogidaDef.Parametros.carga_maxm = ini.GetValue(GeneralDef.GrupoParamReco, GeneralDef.GPR_carga_maxm, RecogidaDef.Parametros.carga_maxm); + + //para el grupo ATRIBUTOS de LATERALIDAD + RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Ambos] = ini.GetValue(GeneralDef.GrupoCampoLater, GeneralDef.GAL_amb, RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Ambos]); + RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Dcha] = ini.GetValue(GeneralDef.GrupoCampoLater, GeneralDef.GAL_dcha, RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Dcha]); + RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Izqda] = ini.GetValue(GeneralDef.GrupoCampoLater, GeneralDef.GAL_izq, RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Izqda]); + + //para el grupo CAMPOS de SENSORES + RecogidaDef.campos_def.cons_id_sens = ini.GetValue(GeneralDef.GrupoCampoSens, GeneralDef.GSR_id, RecogidaDef.campos_def.cons_id_sens); + RecogidaDef.campos_def.cons_url_sens = ini.GetValue(GeneralDef.GrupoCampoSens, GeneralDef.GSR_url, RecogidaDef.campos_def.cons_url_sens); + RecogidaDef.campos_def.cons_fecha_sens = ini.GetValue(GeneralDef.GrupoCampoSens, GeneralDef.GSR_fecha, RecogidaDef.campos_def.cons_fecha_sens); + RecogidaDef.campos_def.cons_fechaf_sens = ini.GetValue(GeneralDef.GrupoCampoSens, GeneralDef.GSR_fechaf, RecogidaDef.campos_def.cons_fechaf_sens); + + //para el grupo CAMPOS de DATOS EXTERNOS + RecogidaDef.campos_def.cons_id_csv = ini.GetValue(GeneralDef.GrupoCampoCsv, GeneralDef.GCR_id, RecogidaDef.campos_def.cons_id_csv); + RecogidaDef.campos_def.cons_llen_csv = ini.GetValue(GeneralDef.GrupoCampoCsv, GeneralDef.GCR_llen, RecogidaDef.campos_def.cons_llen_csv); + RecogidaDef.campos_def.cons_fecha_csv = ini.GetValue(GeneralDef.GrupoCampoCsv, GeneralDef.GCR_fecha, RecogidaDef.campos_def.cons_fecha_csv); + RecogidaDef.campos_def.cons_fechai_csv = ini.GetValue(GeneralDef.GrupoCampoSens, GeneralDef.GSR_fecha, RecogidaDef.campos_def.cons_fechai_csv); + RecogidaDef.campos_def.cons_fechaf_csv = ini.GetValue(GeneralDef.GrupoCampoSens, GeneralDef.GSR_fechaf, RecogidaDef.campos_def.cons_fechaf_csv); + + //para el grupo de NOMBRES de SIMBOLOGIA de VSM + //Nombre de simbolos VSM + RecogidaDef.nombre_simbrec_vsm[0] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_auto, RecogidaDef.nombre_simbrec_vsm[0]); + RecogidaDef.nombre_simbrec_vsm[1] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_bil, RecogidaDef.nombre_simbrec_vsm[1]); + RecogidaDef.nombre_simbrec_vsm[2] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_bol, RecogidaDef.nombre_simbrec_vsm[2]); + RecogidaDef.nombre_simbrec_vsm[3] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_abi, RecogidaDef.nombre_simbrec_vsm[3]); + RecogidaDef.nombre_simbrec_vsm[4] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_neu, RecogidaDef.nombre_simbrec_vsm[4]); + RecogidaDef.nombre_simbrec_vsm[5] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_pil, RecogidaDef.nombre_simbrec_vsm[5]); + RecogidaDef.nombre_simbrec_vsm[6] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_lenv, RecogidaDef.nombre_simbrec_vsm[6]); + RecogidaDef.nombre_simbrec_vsm[7] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_lpap, RecogidaDef.nombre_simbrec_vsm[7]); + RecogidaDef.nombre_simbrec_vsm[8] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_lvid, RecogidaDef.nombre_simbrec_vsm[8]); + RecogidaDef.nombre_simbrec_vsm[9] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_lorg, RecogidaDef.nombre_simbrec_vsm[9]); + RecogidaDef.nombre_simbrec_vsm[10] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_lrest, RecogidaDef.nombre_simbrec_vsm[10]); + RecogidaDef.nombre_simbrec_vsm[11] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_tenv, RecogidaDef.nombre_simbrec_vsm[11]); + RecogidaDef.nombre_simbrec_vsm[12] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_tpap, RecogidaDef.nombre_simbrec_vsm[12]); + RecogidaDef.nombre_simbrec_vsm[13] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_tvid, RecogidaDef.nombre_simbrec_vsm[13]); + RecogidaDef.nombre_simbrec_vsm[14] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_torg, RecogidaDef.nombre_simbrec_vsm[14]); + RecogidaDef.nombre_simbrec_vsm[15] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_trest, RecogidaDef.nombre_simbrec_vsm[15]); + RecogidaDef.nombre_simbrec_vsm[16] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_ienv, RecogidaDef.nombre_simbrec_vsm[16]); + RecogidaDef.nombre_simbrec_vsm[17] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_ipap, RecogidaDef.nombre_simbrec_vsm[17]); + RecogidaDef.nombre_simbrec_vsm[18] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_ivid, RecogidaDef.nombre_simbrec_vsm[18]); + RecogidaDef.nombre_simbrec_vsm[19] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_sot, RecogidaDef.nombre_simbrec_vsm[19]); + LimpiezaDef.nombre_simblimp_vsm[0] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_esc, LimpiezaDef.nombre_simblimp_vsm[0]); + LimpiezaDef.nombre_simblimp_vsm[1] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_fuen, LimpiezaDef.nombre_simblimp_vsm[1]); + LimpiezaDef.nombre_simblimp_vsm[2] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_jinf, LimpiezaDef.nombre_simblimp_vsm[2]); + LimpiezaDef.nombre_simblimp_vsm[3] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_pap, LimpiezaDef.nombre_simblimp_vsm[3]); + LimpiezaDef.nombre_simblimp_vsm[4] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_pniv, LimpiezaDef.nombre_simblimp_vsm[4]); + LimpiezaDef.nombre_simblimp_vsm[5] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_pip, LimpiezaDef.nombre_simblimp_vsm[5]); + LimpiezaDef.nombre_simblimp_vsm[6] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_san, LimpiezaDef.nombre_simblimp_vsm[6]); + LimpiezaDef.nombre_simblimp_vsm[7] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_ace, LimpiezaDef.nombre_simblimp_vsm[7]); + LimpiezaDef.nombre_simblimp_vsm[8] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_apar, LimpiezaDef.nombre_simblimp_vsm[8]); + LimpiezaDef.nombre_simblimp_vsm[9] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_bor, LimpiezaDef.nombre_simblimp_vsm[9]); + LimpiezaDef.nombre_simblimp_vsm[10] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_hoj, LimpiezaDef.nombre_simblimp_vsm[10]); + LimpiezaDef.nombre_simblimp_vsm[11] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_pea, LimpiezaDef.nombre_simblimp_vsm[11]); + LimpiezaDef.nombre_simblimp_vsm[12] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_terr, LimpiezaDef.nombre_simblimp_vsm[12]); + LimpiezaDef.nombre_simblimp_vsm[13] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_oci, LimpiezaDef.nombre_simblimp_vsm[13]); + LimpiezaDef.nombre_simblimp_vsm[14] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_ofi, LimpiezaDef.nombre_simblimp_vsm[14]); + LimpiezaDef.nombre_simblimp_vsm[15] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_par, LimpiezaDef.nombre_simblimp_vsm[15]); + LimpiezaDef.nombre_simblimp_vsm[16] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_park, LimpiezaDef.nombre_simblimp_vsm[16]); + LimpiezaDef.nombre_simblimp_vsm[17] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_pla, LimpiezaDef.nombre_simblimp_vsm[17]); + LimpiezaDef.nombre_simblimp_vsm[18] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_pol, LimpiezaDef.nombre_simblimp_vsm[18]); + LimpiezaDef.nombre_simblimp_vsm[19] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_tur, LimpiezaDef.nombre_simblimp_vsm[19]); + LimpiezaDef.nombre_simblimp_vsm[20] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_sol, LimpiezaDef.nombre_simblimp_vsm[20]); + LimpiezaDef.nombre_simblimp_vsm[21] = ini.GetValue(GeneralDef.GrupoSimbVsm, GeneralDef.GSV_sue, LimpiezaDef.nombre_simblimp_vsm[21]); + + //se inicializa aqui gdb_limp porque si se hace en el constructor iniciliza tambien la clase DatosGDBLimp. + //En el constructor de DatosGDBLimp hay una función (rellena_ftclass()) que depende de esta (lee_ini_gen()). + //se accederia antes a rellena_ftclass() que a esta funcion (lee_ini_gen()) y habría errores. + + } + catch + { + err_str = "Error al coger información del archivo de configuración"; + return false; + } + + return true; + } + + /** + * Inicializa los nombres por defecto de las variables, para debug por si no hay instalador + */ + public static void ini_default() + { + Paths.PathWork = "C:\\Olivia\\"; + Paths.PathGeofoto = "C:\\Desa\\geobin\\Debug\\geofoto.exe"; + Paths.DirData = "C:\\Olivia\\data\\"; + Paths.PathTemp = "C:\\Olivia\\temp\\"; + Paths.PathCartela = "C:\\olivia\\data\\Plantilla.mxd"; + + Paths.PathGdbGen="C:\\Olivia\\gdb\\BASE DE DATOS.gdb"; + Paths.PathGdbNw = "C:\\Datos ejemplo\\BUENO\\Multinet_Q4_2015\\TomTom_Q4_2015.gdb"; + Paths.PathSimbVSM = "C:\\Olivia\\styles\\Simbologia.style"; + Paths.PathSimbESRI = "C:\\Olivia\\styles\\ESRI.style"; + puerto = 19995; + buff_export = 1000; + + /////////////////////////////////////// + //Capas, consultas y filtros GENERALES + Capas.ftclass_ejes = "TomTom_Q4_2015___nw"; + Capas.ftclass_zonas = "SubNiveles"; + Capas.ftclass_restri = "TomTom_Q4_2015___rs"; + Capas.ftclass_muni = "TomTom_Q4_2015___a8"; + + /////////////////////////////////////// + //Capas, consultas, atributos y filtros de LIMPIEZA + LimpiezaDef.Capas.ftclass_niveles = "a2_Niveles_Limpieza"; + LimpiezaDef.Capas.ftclass_cont = "a_Contendores"; + LimpiezaDef.Capas.ftclass_mobi = "a_Mobiliario"; + LimpiezaDef.Capas.ftclass_limp_mec = "b_LimpMececanica"; + LimpiezaDef.Capas.ftclass_instala = "c_Instalaciones"; + + LimpiezaDef.Campos.consulta_entidad = "NOM_TIPO_ENTIDAD"; + LimpiezaDef.Campos.consulta_mecan = "MECANIZABLE"; + + LimpiezaDef.Atributos.atr_esca = "Escaleras"; + LimpiezaDef.Atributos.atr_fuent = "Fuentes"; + LimpiezaDef.Atributos.atr_infan = "JuegosInfantiles"; + LimpiezaDef.Atributos.atr_pape = "Papelera"; + LimpiezaDef.Atributos.atr_paso_niv = "Paso_Dist_Nivel"; + LimpiezaDef.Atributos.atr_pipi = "Pipican"; + LimpiezaDef.Atributos.atr_sane = "Sanecan"; + LimpiezaDef.Atributos.atr_acera = "Aceras"; + LimpiezaDef.Atributos.atr_aparc = "Banda_Aparcamiento"; + LimpiezaDef.Atributos.atr_bord = "Bordillo_Libre"; + LimpiezaDef.Atributos.atr_hoja = "Caida_Hoja"; + LimpiezaDef.Atributos.atr_peat = "Peatonales"; + LimpiezaDef.Atributos.atr_terri = "Areas Terrizas"; + LimpiezaDef.Atributos.atr_ocio = "Ocio"; + LimpiezaDef.Atributos.atr_org_ofi = "Organismos_Oficiales"; + LimpiezaDef.Atributos.atr_parq = "Parques"; + LimpiezaDef.Atributos.atr_park = "Parquin"; + LimpiezaDef.Atributos.atr_play = "Playa"; + LimpiezaDef.Atributos.atr_polid = "Polideportivo"; + LimpiezaDef.Atributos.atr_turis = "Puntos_Interes_Turistico"; + LimpiezaDef.Atributos.atr_solar = "Solares"; + LimpiezaDef.Atributos.atr_suelo = "Uso_Suelos"; + + forma_filtros_limp(); + + //para el grupo PARAMETROS de LIMPIEZA + LimpiezaDef.Parametros.t_ttoM = 40000; + LimpiezaDef.Parametros.t_ttom = 0; + LimpiezaDef.Parametros.v_despM = 40000; + LimpiezaDef.Parametros.v_despm = 0; + LimpiezaDef.Parametros.t_cardescM = 40000; + LimpiezaDef.Parametros.t_cardescm = 0; + LimpiezaDef.Parametros.t_cardesc = 40; + LimpiezaDef.Parametros.t_despM = 40000; + LimpiezaDef.Parametros.t_despm = 0; + LimpiezaDef.Parametros.t_desp = 25; + LimpiezaDef.Parametros.t_convM = 40000; + LimpiezaDef.Parametros.t_convm = 0; + LimpiezaDef.Parametros.t_conv = 60 * 8; + LimpiezaDef.Parametros.t_descansoM = 40000; + LimpiezaDef.Parametros.t_descansom = 0; + LimpiezaDef.Parametros.t_descanso = 30; + LimpiezaDef.Parametros.h_inicio = 420; + LimpiezaDef.Parametros.ancho_viaM = 2000; + LimpiezaDef.Parametros.ancho_viam = 0; + LimpiezaDef.Parametros.ancho_via = 2; + LimpiezaDef.Parametros.ttoBarMan = 2900; + LimpiezaDef.Parametros.ttoBarManMant = 2900; + LimpiezaDef.Parametros.ttoBarMMot = 3500; + LimpiezaDef.Parametros.ttoBarMC = 4000; + LimpiezaDef.Parametros.ttoBarMAP = 4200; + LimpiezaDef.Parametros.ttoBarMix = 5600; + LimpiezaDef.Parametros.ttoBalMan = 4000; + LimpiezaDef.Parametros.ttoBalMC = 5000; + LimpiezaDef.Parametros.ttoBalMAP = 4200; + LimpiezaDef.Parametros.ttoBalMix = 5600; + LimpiezaDef.Parametros.ttoBL = 4000; + LimpiezaDef.Parametros.ttoCH = 5600; + LimpiezaDef.Parametros.ttoVPap = 1; + LimpiezaDef.Parametros.ttoLPap = 5; + LimpiezaDef.Parametros.ttoLC = 5; + LimpiezaDef.Parametros.ttoLZI = 30; + LimpiezaDef.Parametros.ttoLPip = 30; + LimpiezaDef.Parametros.ttoLS = 5; + LimpiezaDef.Parametros.vdespBarMan = 5; + LimpiezaDef.Parametros.vdespBarManMant = 5; + LimpiezaDef.Parametros.vdespBarMMot = 25; + LimpiezaDef.Parametros.vdespBarMC = 15; + LimpiezaDef.Parametros.vdespBarMAP = 15; + LimpiezaDef.Parametros.vdespBarMix = 15; + LimpiezaDef.Parametros.vdespBalMan = 15; + LimpiezaDef.Parametros.vdespBalMC = 0; + LimpiezaDef.Parametros.vdespBalMAP = 15; + LimpiezaDef.Parametros.vdespBalMix = 15; + LimpiezaDef.Parametros.vdespBL = 5; + LimpiezaDef.Parametros.vdespCH = 15; + LimpiezaDef.Parametros.vdespVPap = 0; + LimpiezaDef.Parametros.vdespLPap = 0; + LimpiezaDef.Parametros.vdespLC = 0; + LimpiezaDef.Parametros.vdespLZI = 0; + LimpiezaDef.Parametros.vdespLPip = 0; + LimpiezaDef.Parametros.vdespLS = 0; + LimpiezaDef.Parametros.umbral_reco = 80; + + /////////////////////////////////////// + //Capas, consultas, atributos y filtros de RECOGIDA + + RecogidaDef.campos_def.cons_id = RecogidaDef.campos.cons_id = "OBJECTID"; + RecogidaDef.campos_def.cons_nomrec = RecogidaDef.campos.cons_nomrec = "NOMB_TIP_REC"; + RecogidaDef.campos_def.cons_lateral = RecogidaDef.campos.cons_lateral = "LATERALIDAD"; + RecogidaDef.campos_def.cons_fracc = RecogidaDef.campos.cons_fracc = "FRACCION"; + RecogidaDef.campos_def.cons_capac = RecogidaDef.campos.cons_capac = "CAPACIDAD"; + RecogidaDef.campos_def.cons_uds = RecogidaDef.campos.cons_uds = "UNIDADES"; + RecogidaDef.campos_def.cons_kgrec = RecogidaDef.campos.cons_kgrec = "KGRECO"; + RecogidaDef.kgrec_cont = RecogidaDef.kgrec_cont = 200; + + //Rellena los tipos de fracción + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Organica] = "Organica"; + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Resto] = "Resto"; + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Envases] = "Envases"; + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Papel] = "PapelCarton"; + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Vidrio] = "Vidrio"; + //Rellena los tipos de carga + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Trasera] = "Carga_Trasera"; + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lateral] = "Carga_Lateral"; + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Superior] = "Carga_Superior"; + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Bilateral] = "Carga_Bilateral"; + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.BolseoPtaPta] = "Bolseo"; + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lavado] = "Lavado de cont"; + + RecogidaDef.Parametros.t_vaciM = 40000; + RecogidaDef.Parametros.t_vacim = 0; + RecogidaDef.Parametros.t_llegsalM = 40000; + RecogidaDef.Parametros.t_llegsalm = 0; + RecogidaDef.Parametros.t_llegsal = 5; + RecogidaDef.Parametros.t_descM = 40000; + RecogidaDef.Parametros.t_descm = 0; + RecogidaDef.Parametros.t_desc = 40; + RecogidaDef.Parametros.t_convM = 40000; + RecogidaDef.Parametros.t_convm = 0; + RecogidaDef.Parametros.t_conv = 60 * 8; + RecogidaDef.Parametros.t_descansoM = 40000; + RecogidaDef.Parametros.t_descansom = 0; + RecogidaDef.Parametros.t_descanso = 30; + RecogidaDef.Parametros.h_inicio = 420; + RecogidaDef.Parametros.dens_vehi_org = 500; + RecogidaDef.Parametros.dens_vehi_res = 500; + RecogidaDef.Parametros.dens_vehi_env = 120; + RecogidaDef.Parametros.dens_vehi_pap = 250; + RecogidaDef.Parametros.dens_vehi_vid = 350; + RecogidaDef.Parametros.dens_vehi_otr = 100; + RecogidaDef.Parametros.dens_cont_org = 150; + RecogidaDef.Parametros.dens_cont_res = 100; + RecogidaDef.Parametros.dens_cont_env = 28; + RecogidaDef.Parametros.dens_cont_pap = 90; + RecogidaDef.Parametros.dens_cont_vid = 250; + RecogidaDef.Parametros.dens_cont_otr = 100; + RecogidaDef.Parametros.anch_vehi_3 = 2.4; + RecogidaDef.Parametros.anch_vehi_2 = 2.2; + RecogidaDef.Parametros.anch_vehi_s = 2; + RecogidaDef.Parametros.rad_giro_3 = 175; + RecogidaDef.Parametros.rad_giro_2 = 175; + RecogidaDef.Parametros.rad_giro_s = 175; + RecogidaDef.Parametros.t_vaci_tra = 30; + RecogidaDef.Parametros.t_vaci_lat = 90; + RecogidaDef.Parametros.t_vaci_sup = 180; + RecogidaDef.Parametros.t_vaci_bi = 100; + RecogidaDef.Parametros.t_vaci_bol = 5; + RecogidaDef.Parametros.t_vaci_lav = 60; + RecogidaDef.Parametros.t_vaci_otr = 60; + RecogidaDef.Parametros.kgmaxM = 20000; + RecogidaDef.Parametros.kgmaxm = 0; + RecogidaDef.Parametros.carga_maxM = 100; + RecogidaDef.Parametros.carga_maxm = 50; + + //Atributos LATERALIDAD + RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Ambos] = "Ambos"; + RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Dcha] = "Derecha"; + RecogidaDef.tipos_lateralidad[(int)RecogidaDef.Lateralidad.Izqda] = "Izquierda"; + + //Campos de SENSORES + RecogidaDef.campos_def.cons_id_sens = RecogidaDef.campos.cons_id_sens = "OBJECTID"; + RecogidaDef.campos_def.cons_url_sens = RecogidaDef.campos.cons_url_sens = "http://localiza.info/Utilidades/APIManager.aspx"; + RecogidaDef.campos_def.cons_fecha_sens = RecogidaDef.campos.cons_fecha_sens = "2000-01-01T00:00:00"; + RecogidaDef.campos_def.cons_fechaf_sens = RecogidaDef.campos.cons_fechaf_sens = "2050-01-01T00:00:00"; + + //Campos de CSV + RecogidaDef.campos_def.cons_id_csv = RecogidaDef.campos.cons_id_csv = "Nº"; + RecogidaDef.campos_def.cons_llen_csv = RecogidaDef.campos.cons_llen_csv = "Lectura"; + RecogidaDef.campos_def.cons_fecha_csv = RecogidaDef.campos.cons_fecha_csv = "Fecha"; + RecogidaDef.campos_def.cons_fechai_csv = RecogidaDef.campos.cons_fechai_csv = "01/01/2000 0:01"; + RecogidaDef.campos_def.cons_fechaf_csv = RecogidaDef.campos.cons_fechaf_csv = "01/01/2049 0:00"; + + //Nombre de simbolos VSM + RecogidaDef.rellena_simbrec_vsm(); + LimpiezaDef.rellena_simblimp_vsm(); + + //rellena nombres + LimpiezaDef.rellena_tto_gdb(); + LimpiezaDef.rellena_amb_gdb(); + LimpiezaDef.rellena_preftto_gdb(); + LimpiezaDef.rellena_simb_tiptto(); + LimpiezaDef.inicia_tiempos(); + } + + /** + * Forma los filtros con las consultas y atributos + */ + public static void forma_filtros_limp() + { + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbEjeCalle] = ""; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordLibreMec] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_bord + "' AND " + LimpiezaDef.Campos.consulta_mecan + " = 'Si'"; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordLibreNoMec] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_bord + "' AND " + LimpiezaDef.Campos.consulta_mecan + " = 'No'"; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordAparc] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_aparc + "'"; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbAceMec] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_acera + "' AND " + LimpiezaDef.Campos.consulta_mecan + " = 'Si'"; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbAceNoMec] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_acera + "' AND " + LimpiezaDef.Campos.consulta_mecan + " = 'No'"; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbCallePeatMec] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_peat + "' AND " + LimpiezaDef.Campos.consulta_mecan + " = 'Si'"; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbCallePeatNoMec] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_peat + "' AND " + LimpiezaDef.Campos.consulta_mecan + " = 'No'"; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordHojaMec] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_hoja + "' AND " + LimpiezaDef.Campos.consulta_mecan + " = 'Si'"; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbBordHojaNoMec] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_hoja + "' AND " + LimpiezaDef.Campos.consulta_mecan + " = 'No'"; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbConte] = ""; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbPape] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_pape + "'"; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbZInf] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_infan + "'"; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbPipi] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_pipi + "'"; + LimpiezaDef.filtro_str[(int)LimpiezaDef.AmbitsTra.AmbSane] = LimpiezaDef.Campos.consulta_entidad + " = '" + LimpiezaDef.Atributos.atr_sane + "'"; + } + + /** + * Devuelve una lista de las ips locales + */ + public static string[] dame_local_ips() + { + IPHostEntry host; + List host_str = new List(); + + if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()) + { + return null; + } + + host = Dns.GetHostEntry(Dns.GetHostName()); + foreach (var ip in host.AddressList) + { + if (ip.AddressFamily == AddressFamily.InterNetwork) + { + host_str.Add(ip.ToString()); + } + } + return host_str.ToArray(); + } + + /** + * Cambia el color de la progressbar a rojo si es error o amarillo si es warning + */ + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] + static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr w, IntPtr l); + public static void ProgressBarSetState(ProgressBar pBar, int state) + { + uint WM_USER = 0x400; + uint PBM_SETSTATE = WM_USER + 16; + + /*enum ProgressBarState{ + PBST_NORMAL = 1, //green + PBST_ERROR, //red + PBST_PAUSED //yellow + };*/ + + SendMessage(pBar.Handle, PBM_SETSTATE, (IntPtr)state, IntPtr.Zero); + } + + [DllImport("user32.dll")] + public static extern bool PostMessage(IntPtr hWnd, uint Msg, int wParam, int lParam); + + /** + * Borra los archivos exportados para el proceso + */ + public static void borra_files() + { + string[] list = null; + string capa_principal = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData); + string capa_principal_nw = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathNW); + + try + { + if (capa_principal == null) + return; + list = Directory.GetFiles(Paths.DirData, capa_principal + "*"); + if (list.Length>0) + { + foreach (string f in list) + { + if (System.IO.Path.GetExtension(f) == ".lock") + continue; + File.Delete(f); + } + } + if (capa_principal_nw == null) + return; + list = Directory.GetFiles(Paths.DirData, capa_principal_nw + "*"); + if (list.Length > 0) + { + foreach (string f in list) + { + File.Delete(f); + } + } + } + catch(Exception ex) + { + MessageBox.Show(ex.Message); + } + } + + /** + * Hace las tareas posteriores a finalizar un proceso, bien porque se ha cancelado o porque se ha terminado + * modo 1, lanza ventana de selección de gdb para importar resultados + */ + public static void fin_proceso(TiposEstado modo) + { + bool mal = true; + string err = ""; + + if (modo == TiposEstado.FinOkSecto) + { + if (gdb.import_secto_ini()) + { + mal = false; + } + else + { + mal = true; + err = gdb.err_st; + } + } + else if (modo == TiposEstado.FinOkPlanif) + { + guarda_csv(); + if (gdb.import_planif()) + { + mal = false; + } + else + { + mal = true; + err = gdb.err_st; + } + } + else if (modo == TiposEstado.FinNOk) + { + mal = true; + err = progr_eje.err_str; + } + + borra_files(); + if (mal) + { + MessageBox.Show(err, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + + /*if (tip_oliv == OliviaDef.GeneralDef.TiposOliv.OlivLimp) + inidlg.lim.Close(); + else if (tip_oliv == OliviaDef.GeneralDef.TiposOliv.OlivResi) + inidlg.reco.Close(); + inidlg.Show();*/ + } + + if (tip_oliv == OliviaDef.GeneralDef.TiposOliv.OlivLimp) + inidlg.lim.Show();//PostMessage(inidlg.lim.Handle, 0x0018, 1, 0); + else if (tip_oliv == OliviaDef.GeneralDef.TiposOliv.OlivResi) + inidlg.reco.Show();//PostMessage(inidlg.reco.Handle, 0x0018, 1, 0); + + } + + /** + * cambia la carpeta referida a directorio de trabajo por los caracteres OliviaDirWork (%dir_work%) + */ + static string pon_path_relativo(string path, string dir_work) + { + int aux, aux1; + string s2 = null, s1 = path, dir = null; + + if (dir_work == null || dir_work[0] == 0) + return path; + int indice = path.IndexOf(dir_work); + if (indice == -1) + return path; + + if (indice != -1) + { + int largo = dir_work.Length; + aux = path.Length; + aux1 = aux - indice - largo; + aux = aux - aux1; + dir = path.Substring(indice, largo);//directorio de trabajo. Se sustituirá por OliviaDef.GeneralDef.OliviaDirWork para que el en .ini aparezca en lugar del path completa %dir_work% en lo que es la parte del path correspondiente al directorio de trabajo + s1 = path.Substring(0, indice);//parte primera del path que no coincide con el directorio de trabajo (dir_work). Generalmente será null + s2 = path.Substring(aux, aux1);//parte findel del path. El final del path que va después de dir_work + } + path = string.Concat(string.Concat(s1, OliviaDef.GeneralDef.OliviaDirWork), s2); + + return path; + } + + /** + * cambia los caracteres OliviaDirWork (%dir_work%) por la ruta correspondiente en el disco duro + */ + static string pon_path_absoluto(string path, string dir_work) + { + string res = null; + string s2 = null, s1 = path; + int largo; + + if (dir_work == null || dir_work[0] == 0) + return path; + + int indice = path.IndexOf("%"); + if (indice == -1) + return path; + + while (indice != -1) + { + res = path.Substring(0, indice); + indice = indice + 1; + largo = path.Length - indice; + s1 = path.Substring(indice, largo); + + indice = s1.IndexOf("%"); + indice = indice + 1; + largo = s1.Length - indice; + s2 = s1.Substring(indice, largo); + + indice = s2.IndexOf("%"); + } + path = string.Concat(string.Concat(res, dir_work), s2); + return path; + } + + /* + * Permite guardar el archivo CSV que contiene la secuencia qeu se ha llevado a cabo en las rutas en la planificación. + */ + public static void guarda_csv() + { + string auxi, nombre = null; + DialogResult dialogResult; + string[] nameDokL; + + nameDokL = Directory.GetFiles(Paths.DirData, + System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData) + gdb.name_csv + ".*"); + System.Windows.Forms.SaveFileDialog dlg = new System.Windows.Forms.SaveFileDialog(); + dlg.Title = "Guardar Secuencia de la Planificación"; + dlg.Filter = "Secuencia en formato CSV (*.csv)|*.csv"; + dlg.InitialDirectory = Paths.DirData; + + if (tip_oliv == OliviaDef.GeneralDef.TiposOliv.OlivLimp) + gdb_limp.decode_gdb(System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData), + out auxi, out nombre); + else if (tip_oliv == OliviaDef.GeneralDef.TiposOliv.OlivResi) + gdb_reco.decode_gdb(System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData), + out auxi, out nombre); + else + nombre = System.IO.Path.GetFileNameWithoutExtension(OliviaGlob.Paths.PathData); + + dlg.FileName = nombre; + + if (dlg.ShowDialog() != DialogResult.OK && dlg.FileName.Length > 0) + { + dialogResult = MessageBox.Show("Se va a perder el archivo que contiene la secuencia en planificación, ¿está seguro?", "Olivia", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (dialogResult == DialogResult.No) + guarda_csv(); + } + else + { + if(File.Exists(dlg.FileName)) + File.Delete(dlg.FileName); + File.Move(nameDokL[0], dlg.FileName); + } + } + + /** + * Dado un tiempo en horas y minutos devuelve los minutos resultantes + */ + public static double dame_min(int[] h_m) + { + double t_min; + + t_min = h_m[0] * 60 + h_m[1]; + return t_min; + } + + /** + * Dado un tiempo en minutos devuelve las horas modulo 60 y los minutos restantes + */ + public static int[] dame_h_m(double t) + { + int[] hm = { 0, 0 }; + + hm[0] = (int)(t / 60); + hm[1] = (int)(t - hm[0] * 60); + + return hm; + } + + } +} diff --git a/OliviaAddIn/Parquimetros.cs b/OliviaAddIn/Parquimetros.cs new file mode 100644 index 0000000..55c71e8 --- /dev/null +++ b/OliviaAddIn/Parquimetros.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using ESRI.ArcGIS.Geodatabase; +using ESRI.ArcGIS.Geometry; +using System.Windows.Forms; + +namespace OliviaAddIn +{ + public class Parquimetros + { + + //************************************************************************************* + //Enums + //Variables + /** + * Cadena general para indicar los errores + */ + public String err_str = ""; + + + //************************************************************************************* + //Métodos + public Parquimetros() + { + + + } + + public void genera_plazas_aparcar(string capa) + { + /* double distancia; + int campo, nplazas, ind, uno = 1; + string nueva_capa; + IFeatureClass fclass, fc_shape; + IFeatureCursor cursor; + IFeature feat, nueva; + IFeatureWorkspace featws_shp; + IWorkspaceEdit ws_shape; + IFields campos; + //IField nplazas; + IPoint plaza; + IGeometry geom; + ISpatialReference coor = null; + IPolyline linea_aparca; + ITopologicalOperator divide; + + fclass = feat_ws_lin.OpenFeatureClass(capa); + cursor = fclass.Search(null, false); + campo = fclass.FindField("Numero"); + campos = fclass.Fields; + feat = cursor.NextFeature(); + nplazas = (int)feat.get_Value(campo); + geom = feat.Shape; + coor = geom.SpatialReference; + featws_shp = (IFeatureWorkspace)gdb_ws; + + linea_aparca = (IPolyline)geom; + distancia = linea_aparca.Length; + + try + { + ws_shape = (IWorkspaceEdit)featws_shp; + ws_shape.StartEditing(true); + ws_shape.StartEditOperation(); + nueva_capa = fclass.AliasName + "_pto"; + //se genera la nueva capa la primera vez que pasa porla función + //if (!File.Exists(ws.PathName + "\\" + nueva_capa + ".shp")) + fc_shape = featws_shp.CreateFeatureClass(nueva_capa, campos, null, null, esriFeatureType.esriFTSimple, "FeatureClass", ""); + //else + // fc_shape = featws_shp.OpenFeatureClass(nueva_capa); + //se crea una nuevo campo al que se le añade la geometría de la coleccion de puntos y el campo con elvalor extraido del filtro + nueva = fc_shape.CreateFeature(); + puntos = (IMultipoint)colec_ptos; + puntos.SpatialReference = coor; + nueva.Shape = puntos; + ind = fc_shape.FindField("Numero"); + nueva.set_Value(ind, uno); + nueva.Store(); + + ws_shape.StopEditOperation(); + ws_shape.StopEditing(true); + } + catch (Exception cexp2) + { + MessageBox.Show(cexp2.Message); + } + finally + { + //libera variables + if (cursor != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(cursor); + //if (camp != null) + // System.Runtime.InteropServices.Marshal.FinalReleaseComObject(camp); + if (campos != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(campos); + if (nueva != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(nueva); + if (fc_shape != null) + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(fc_shape); + }*/ + } + + } +} diff --git a/OliviaAddIn/ProgresoEjec.Designer.cs b/OliviaAddIn/ProgresoEjec.Designer.cs new file mode 100644 index 0000000..866de1b --- /dev/null +++ b/OliviaAddIn/ProgresoEjec.Designer.cs @@ -0,0 +1,96 @@ +namespace OliviaAddIn +{ + partial class ProgresoEjec + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProgresoEjec)); + this.button_canc = new System.Windows.Forms.Button(); + this.progressBar_ejec = new System.Windows.Forms.ProgressBar(); + this.label_progr = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // button_canc + // + this.button_canc.Location = new System.Drawing.Point(300, 191); + this.button_canc.Name = "button_canc"; + this.button_canc.Size = new System.Drawing.Size(93, 23); + this.button_canc.TabIndex = 0; + this.button_canc.Text = "Cancelar"; + this.button_canc.UseVisualStyleBackColor = true; + this.button_canc.Click += new System.EventHandler(this.button_canc_Click); + // + // progressBar_ejec + // + this.progressBar_ejec.Location = new System.Drawing.Point(29, 23); + this.progressBar_ejec.Name = "progressBar_ejec"; + this.progressBar_ejec.Size = new System.Drawing.Size(364, 21); + this.progressBar_ejec.Step = 5; + this.progressBar_ejec.Style = System.Windows.Forms.ProgressBarStyle.Marquee; + this.progressBar_ejec.TabIndex = 1; + this.progressBar_ejec.Value = 10; + // + // label_progr + // + this.label_progr.AutoEllipsis = true; + this.label_progr.AutoSize = true; + this.label_progr.Location = new System.Drawing.Point(26, 63); + this.label_progr.Name = "label_progr"; + this.label_progr.Size = new System.Drawing.Size(74, 13); + this.label_progr.TabIndex = 2; + this.label_progr.Text = "Conectando..."; + // + // ProgresoEjec + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(405, 226); + this.ControlBox = false; + this.Controls.Add(this.label_progr); + this.Controls.Add(this.progressBar_ejec); + this.Controls.Add(this.button_canc); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.Name = "ProgresoEjec"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "OLIVIA | Progreso de la Ejecución"; + this.TopMost = true; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ProgresoEjec_FormClosing); + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ProgresoEjec_FormClosed); + this.Resize += new System.EventHandler(this.ProgresoEjec_Resize); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button_canc; + private System.Windows.Forms.ProgressBar progressBar_ejec; + private System.Windows.Forms.Label label_progr; + } +} \ No newline at end of file diff --git a/OliviaAddIn/ProgresoEjec.cs b/OliviaAddIn/ProgresoEjec.cs new file mode 100644 index 0000000..38a9f31 --- /dev/null +++ b/OliviaAddIn/ProgresoEjec.cs @@ -0,0 +1,746 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Threading; +using OliviaDef; +using SisNetBase; +using System.Diagnostics; +using SisNetBase.Modulos; + +namespace OliviaAddIn +{ + /** + * Clase para realizar las tareas del progreso de la ejecución + */ + public partial class ProgresoEjec : Form + { + //************************************************************************************* + //Variables + /** + * Socket de conexión al geofoto + */ + Cigt_str_socket soc = null; + Thread m_thread; + int m_out; + int m_miliseconds; + int m_tm_progr; + int modo_fin = 0; + bool cancela = false; + bool cancela_fin = false; + bool conectado = false; + bool permu = false; + bool cancela_permu = false; + int progr = 0; + string args =""; + string str_cfg = ""; + string tarea = ""; + public string err_str = ""; + double x, y; + + enum TiposActu + { + ActuMal, + ActuNoActu, + ActuBien, + ActuPermu, + ActuFinOk, + ActuSect, + ActuPlan, + ActuFinNOk, + ActuN, + } + + //************************************************************************************* + //Métodos + public ProgresoEjec() + { + err_str = ""; + try + { + InitializeComponent(); + + //inicia la barra de proceso + progressBar_ejec.Step = GeneralDef.ProgrStep; + progressBar_ejec.Maximum = GeneralDef.ProgrMax; + //se recoge la distancia que hay entre el borde del botón cancelar y el diálogo, para que cuando se modifique el tamaño de la ventana, el botón se mueva. + Rectangle r = this.ClientRectangle; + Rectangle rb = this.button_canc.ClientRectangle; + r = this.RectangleToScreen(r); + rb = this.button_canc.RectangleToScreen(rb); + x = (r.X + r.Width) - (rb.X + rb.Width); + y = (r.Y + r.Height) - (rb.Y + rb.Height); + } + catch (Exception) + { + MessageBox.Show("Error al iniciar el progreso de ejecucución.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + ~ProgresoEjec() + { + + } + + /** + * Lanza el proceso de control de la ventana + */ + public void start(string cfg) + { + + soc = new Cigt_str_socket(); + + str_cfg = cfg; + + Show(); + + //lanza el proceso + m_out = 0; + m_miliseconds = 200; + m_tm_progr = 1000; //tiempo cada el que pide el progreso + m_thread = new Thread(new ThreadStart(run)); + m_thread.Name = "ProgresoEjec"; + m_thread.Start(); + } + + /** + * Función principal del bucle + */ + private void run() + { + int nint = 0; + int nint_max = 10; + bool sal = false; + bool first_send_cfg = true; + bool fin = false; + int lastprog =0; + TiposActu pp; + + try + { + do + { + Thread.Sleep(m_miliseconds); + + if (first_send_cfg)//a continuación envía la configuración + { + Thread.Sleep(500); + if (!envia_cfg()) + { + if (nint >= nint_max) + { + err_str = "Error en la comunicación con Geofoto"; + actualiza(TiposActu.ActuMal); + } + else + nint++; + } + else + first_send_cfg = false; + } + + if (Interlocked.Equals(m_out, 1)) //mira a ver si ha cancelado el usuario + { + //se ha cancelado, lo envía al geofoto + envia_cancel(); + if (!cancela_permu) + sal = true; + else + { + Interlocked.Exchange(ref m_out, (int)0); + cancela_permu = false; + } + } + else if (!first_send_cfg && ((Environment.TickCount - lastprog) >= m_tm_progr) && !fin) //en caso normal, todo va bien, pide el progreso y la tarea + { + //solo pide la programación cada m_tm_progr milis + pp = pide_progr(); + if (pp > TiposActu.ActuFinOk) + fin = true; + actualiza(pp); + lastprog = Environment.TickCount; + } + + } while (!sal); + + //manda cerrar la ventana porque ha terminado + cierra(); + } + catch (Exception) + { + MessageBox.Show("Error durante el proceso.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + /** + * Termina el proceso porque se ha dado a cancelar + */ + public void cancela_thr() + { + Interlocked.Exchange(ref m_out, (int)1); + } + + /* + * Cierra la ventana desde el thread + */ + private void cierra() + { + MethodInvoker inv = delegate() + { + Close(); + }; + + if (InvokeRequired) + BeginInvoke(inv); + } + + /* + * Cuando el thread avisa de que ha salido, termina de cerrar + */ + private void fin_thr() + { + if (m_thread == null) + return; + + m_thread.Join(); + m_thread = null; + } + + /** + * Envía la información de la configuración por socket a geofoto + */ + public bool envia_cfg() + { + string args; + + try + { + if (!conectado) + { + if (!soc.conecta(OliviaGlob.ip, OliviaGlob.puerto)) + { + conectado = false; + return false; + } + conectado = true; + } + + if (str_cfg == null || str_cfg.Length == 0) + return false; + + if (!soc.envia(str_cfg)) + { + conectado = false; + return false; + } + + args = soc.recibe(); + if ((args.Length == 0) || (args != OliviaDef.GeneralDef.SockConfOk)) + return false; + + return true; + } + catch (Exception) + { + return false; + } + } + + /** + * Pide por socket la información de sectorización a geofoto + */ + private bool pide_sect() + { + //pide sectorización porque ya ha sido avisado de que ha terminado + try + { + if (!conectado) + { + if (!soc.conecta(OliviaGlob.ip, OliviaGlob.puerto)) + { + conectado = false; + return false; + } + conectado = true; + } + + //pide secto + if (!soc.envia(OliviaDef.GeneralDef.SockSect)) + { + conectado = false; + return false; + } + + //recibe sectorización + args = soc.recibe(); + if (args.Length == 0) + return false; + + return true; + } + catch (Exception) + { + return false; + } + } + + /** + * Pide por socket la información de progreso a geofoto + * Devuelve 0 si ha ido mal, 1 si ha ido bien, 2 si ha recibido que hay que pedir sectorización + */ + private TiposActu pide_progr() + { + TiposActu tt; + int i; + //pide progreso y tarea por la que va + try + { + if (!conectado) + { + if (!soc.conecta(OliviaGlob.ip, OliviaGlob.puerto)) + { + conectado = false; + err_str = "Error en la comunicación con Geofoto"; + return TiposActu.ActuMal; + } + conectado = true; + } + + //pide progreso + if (!soc.envia(OliviaDef.GeneralDef.SockProgr)) + { + conectado = false; + err_str = "Error en la comunicación con Geofoto"; + return TiposActu.ActuMal; + } + + //recibe progreso + args = soc.recibe(); + if (args.Length == 0) + { + return TiposActu.ActuNoActu; + } + + //comprueba progreso + try + { + progr = Convert.ToInt32(args); + if (progr < 0 || progr > OliviaDef.GeneralDef.ProgrMax) + { + return TiposActu.ActuNoActu; + } + } + catch + { + return TiposActu.ActuNoActu; + } + + //pide tarea + if (!soc.envia(OliviaDef.GeneralDef.SockTarea)) + { + err_str = "Error en la comunicación con Geofoto"; + return TiposActu.ActuMal; + } + + //recibe tarea + args = soc.recibe(); + if (args.Length == 0) + { + err_str = "Error recibe tarea mal"; + return TiposActu.ActuMal; + } + if(args=="0") //se ha mezclado el progreso, vuelve a recibir la tarea + args = soc.recibe(); + if (args.Length == 0) + { + err_str = "Error recibe tarea mal"; + return TiposActu.ActuMal; + } + + i = 0; + tt = TiposActu.ActuBien; + //comprueba tarea + if (args.StartsWith(OliviaDef.GeneralDef.SockSectFin)) + { + i = OliviaDef.GeneralDef.SockSectFin.Length; + tt = TiposActu.ActuSect; + } + else if (args.StartsWith(OliviaDef.GeneralDef.SockPlanFin)) + { + i = OliviaDef.GeneralDef.SockPlanFin.Length; + tt = TiposActu.ActuPlan; + } + else if (args.StartsWith(OliviaDef.GeneralDef.SockFinOk)) + { + i = OliviaDef.GeneralDef.SockFinOk.Length; + tt = TiposActu.ActuFinOk; + } + else if (args.StartsWith(OliviaDef.GeneralDef.SockFinNOk)) + { + i = OliviaDef.GeneralDef.SockFinNOk.Length; + tt = TiposActu.ActuFinNOk; + } + else if (args.Contains("permutaciones")) + { + tt = TiposActu.ActuPermu; + } + modo_fin = (int)tt; + + tarea = args.Substring(i); + + return tt; + } + catch (Exception) + { + MessageBox.Show("Error al preguntar por el progreso.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return tt = TiposActu.ActuMal; + } + } + + /** + * Envía a geofoto la orden de cancelar el proceso + */ + private bool envia_cancel() + { + try + { + if (!conectado) + return false; + + //envía cancel + if (!soc.envia(OliviaDef.GeneralDef.SockCanc)) + return false; + + //recibe respuesta + args = soc.recibe(); + if (args.Length == 0) + return false; + + //comprueba que ok + if (args != OliviaDef.GeneralDef.SockCancOk) + return false; + + return true; + } + catch (Exception) + { + MessageBox.Show("Error al cancelar el progreso.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + } + + /** + * Actualiza la barra de progreso + * bool fallo_soc : indica si ha habido fallo en el socket + */ + private void actualiza(TiposActu actu) + { + + try + { + permu = false; + //actualiza la barra de tarea y el texto + switch (actu) + { + case TiposActu.ActuBien: + { + pon_progr(progr); + pon_texto(tarea); + break; + } + case TiposActu.ActuMal: + { + if (err_str.Length > 0) + { + pon_texto(err_str); + err_str = ""; + } + else + pon_texto(tarea); + break; + } + case TiposActu.ActuFinOk: + { + pon_progr(100); + pon_texto("Finalizado proceso con éxito"); + break; + } + case TiposActu.ActuFinNOk: + { + pon_progr(100); + err_str = "Finalizado proceso con fallos\n" + tarea; + pon_texto(err_str); + break; + } + case TiposActu.ActuSect: + { + pon_progr(100); + pon_texto("Finalizada sectorización\n" + tarea); + break; + } + case TiposActu.ActuPlan: + { + pon_progr(100); + pon_texto("Finalizada planificación\n" + tarea); + break; + } + case TiposActu.ActuPermu: + { + permu = true; + pon_texto(tarea); + pon_estilo(ProgressBarStyle.Marquee); + break; + } + default: + return; + } + + if (actu != TiposActu.ActuPermu) + pon_estilo(ProgressBarStyle.Continuous); + pon_barstate(actu); + } + catch (Exception) + { + MessageBox.Show("Error al actualizar el progreso.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + /* + * Para poder actualizar el texto de la ventana de progreso hay que llamar a invoke + * porque está desde otro thread + */ + private void pon_texto(String txt) + { + MethodInvoker inv = delegate() + { + label_progr.Text = txt; + }; + + if (InvokeRequired) + BeginInvoke(inv); + } + + /* + * Para poder actualizar la barra de progreso hay que llamar a invoke + * porque está desde otro thread + * Actualiza el tipo de progreso y el texto + */ + private void pon_estilo(ProgressBarStyle style) + { + MethodInvoker inv = delegate() + { + progressBar_ejec.Style = style; + }; + + if (InvokeRequired) + BeginInvoke(inv); + } + + /* + * Para poder actualizar la barra de progreso hay que llamar a invoke + * porque está desde otro thread + * Actualiza el estilo para indicar que ha habido error + */ + private void pon_barstate(TiposActu actu) + { + int col=1; + + MethodInvoker inv = delegate() + { + if ((actu == TiposActu.ActuMal) || (actu ==TiposActu.ActuFinNOk)) + col = 2; + else + col = 1; + OliviaGlob.ProgressBarSetState(progressBar_ejec, col); + + if (actu > TiposActu.ActuFinOk) + button_canc.Text = "Finalizar"; + if ((actu == TiposActu.ActuPermu) && !cancela) + button_canc.Text = "Parar permu."; + }; + + if (InvokeRequired) + BeginInvoke(inv); + } + + /* + * Para poder actualizar la barra de progreso hay que llamar a invoke + * porque está desde otro thread + * Actualiza el progreso + */ + private void pon_progr(int pro) + { + MethodInvoker inv = delegate() + { + progressBar_ejec.Value = pro; + }; + + if (InvokeRequired) + BeginInvoke(inv); + } + + /** + * Itera para comprobar que ha arrancado bien geofoto + * int t_max : seg espera + * bool espera_start : si true, se quiere esperar t_max a que arranque, + * si false, se quiere esperar a que se cierre + * Devuelve el proceso si está, para cancelarlo, y null si no está + */ + public Process esta_geofoto(int t_max, bool espera_start) + { + bool esta_geo = !espera_start; + int veces = 0; + int veces_max; + int milis_sleep = 50; + + if (t_max <= 0) + t_max = 1; + veces_max = t_max * 1000 / milis_sleep; + + Process[] pg = new Process[0]; + + //si ya está arrancado y se quiere esperar a que se cierre, esta_geo=true y espera_start=false; + //por lo que se cumple !espera_start && esta_geo + //tiene que esperar si esta_geo==true + //cuando se quiere esperar a que arranque, esta_geo=false y espera_start=true + //por lo que se cumple (espera_start && !esta_geo) + //en este caso, tiene que esperar si esta_geo==False + while (((espera_start && !esta_geo) || (!espera_start && esta_geo)) && (veces < veces_max)) + { + try + { + pg = Process.GetProcessesByName("geofoto"); + if (pg.Length == 0) + esta_geo = false; + else + esta_geo = true; + } + catch (InvalidOperationException) + { + esta_geo = false; + } + + if (((espera_start && !esta_geo) || (!espera_start && esta_geo))) + { + veces++; + Thread.Sleep(milis_sleep); + } + } + + if (esta_geo) + return pg[0]; + else + return null; + } + + /** + * Comprueba si geofoto ha salido y le espera durante T seg. Si no, para la tarea + * return true si ha terminado, false si no + */ + private bool espera_geofoto() + { + bool esta_geo = true; + Process pg; + + //le da 3 seg de margen para que se cierre + pg = esta_geofoto(2, false); + esta_geo = (pg != null); + + if (esta_geo) + { + //mata a la fuerza la tarea + try + { + pg.Kill(); + if (pg.WaitForExit(1000)) + esta_geo = false; + } + catch (Exception) + { + esta_geo = false; + } + } + return !esta_geo; + + } + + //************************************************************************************* + //Eventos de la ventana + private void ProgresoEjec_FormClosing(object sender, FormClosingEventArgs e) + { + //también hay que cerrar cuando se haya terminado el proceso y llamar a fin_proceso() + if (cancela_fin) + { + //ha terminado el thread, continua cerrando + fin_thr(); + if (!espera_geofoto()) + { + //no ha podido cerrarlo + MessageBox.Show("No se ha podido cerrar GeoFoto", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + e.Cancel = false; + Hide(); + } + else if (cancela) + { + //si sí se le ha dado a cancelar + cancela_thr(); + e.Cancel = true; + if (cancela_permu) //si está en modo permu no cancela, fuerza salida + { + button_canc.Text = "Cancelar";//para dejar cancelar después + } + else + { + button_canc.Enabled = false; + cancela_fin = true; + err_str = "Se ha cancelado la ejecución"; + } + } + else//si no se le ha dado a "cancelar" no cierra la ventana, cancela el evento + { + e.Cancel = true; + } + } + + private void button_canc_Click(object sender, EventArgs e) + { + cancela = true; + if (permu) + cancela_permu=!cancela_permu; + Close(); + } + + private void ProgresoEjec_FormClosed(object sender, FormClosedEventArgs e) + { + if (modo_fin == (int)TiposActu.ActuSect) + OliviaGlob.fin_proceso(TiposEstado.FinOkSecto); + else if (modo_fin == (int)TiposActu.ActuPlan) + OliviaGlob.fin_proceso(TiposEstado.FinOkPlanif); + else + OliviaGlob.fin_proceso(TiposEstado.FinNOk); + } + + private void ProgresoEjec_Resize(object sender, EventArgs e) + { + Rectangle r = this.ClientRectangle; + Rectangle rb = this.button_canc.ClientRectangle; + r = this.RectangleToScreen(r); + rb = this.button_canc.RectangleToScreen(rb); + rb.X = (r.X + r.Width) - (int)x - rb.Width; + rb.Y = (r.Y + r.Height) - (int)y - rb.Height; + Point p = new Point(); + p.X = rb.X - r.X; + p.Y = rb.Y - r.Y; + + rb.Location = p; + button_canc.Location = p; + } + } +} diff --git a/OliviaAddIn/ProgresoEjec.resx b/OliviaAddIn/ProgresoEjec.resx new file mode 100644 index 0000000..1bb292f --- /dev/null +++ b/OliviaAddIn/ProgresoEjec.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA + AAD///8B////Af///wH///8BOoFqBTqBamE6gWq9OoFq7zqBapU6gWq9OoFqvzqBamM6gWoF////Af// + /wH///8B////Af///wH///8BOoFqJTqBatE6gWr/OoFq/zqBav86gWqTOoFq9TqBav86gWr/OoFq0zqB + ain///8B////Af///wH///8BOoFqJTqBaus6gWr/OoFq/zqBav86gWr9OoFqqzqBauk6gWr9OoFq/zqB + av86gWrrOoFqJ////wH///8BOoFqAzqBas86gWr7OoFqzTqBaqk6gWqtOoFqYzqBask6gWpJOoFqXTqB + ass6gWr7OoFq/zqBatE6gWoF////ATqBalc6gWrpOoFq4zqBap86gWoNOoFqCzqBanM6gWrROoFqqzqB + ajk6gWoNOoFqezqBavk6gWr/OoFqW////wE6gWq1OoFqpTqBats6gWp7OoFqOzqBahs6gWrxOoFq8zqB + av86gWqVOoFqFTqBanM6gWqJOoFq0TqBarf///8BOoFq6zqBal86gWqFOoFqezqBais6gWpHOoFq8TqB + av86gWr/OoFqdTqBaj86gWopOoFqhTqBask6gWqF////ATqBauM6gWo1OoFqHzqBamX///8BOoFqiTqB + av86gWrhOoFq/zqBal////8BOoFqYTqBaok6gWrhOoFq/////wE6gWpFOoFqFzqBakU6gWov////ATqB + apk6gWr/OoFq8TqBav86gWrbOoFqE////wE6gWpVOoFqtzqBapv///8BOoFqeTqBaos6gWpj////Af// + /wE6gWpXOoFq+zqBav86gWr/OoFq3TqBahE6gWozOoFqiTqBauU6gWol////ATqBaj86gWoV////Af// + /wH///8BOoFqfTqBaus6gWr3OoFq9zqBajs6gWo7OoFqczqBat86gWphOoFqA////wH///8B////Af// + /wH///8B////ATqBapM6gWr/OoFq/zqBav86gWpbOoFqSTqBatM6gWqVOoFqeTqBahP///8B////Af// + /wH///8B////Af///wE6gWofOoFq1zqBav86gWr/OoFqff///wH///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////ATqBark6gWr/OoFqwzqBagf///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wE6gWo3OoFq6zqBaiP///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// + /wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//w== + + + \ No newline at end of file diff --git a/OliviaAddIn/ProgresoInic.Designer.cs b/OliviaAddIn/ProgresoInic.Designer.cs new file mode 100644 index 0000000..5db0f0e --- /dev/null +++ b/OliviaAddIn/ProgresoInic.Designer.cs @@ -0,0 +1,78 @@ +namespace OliviaAddIn +{ + partial class ProgresoInic + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProgresoInic)); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // progressBar1 + // + this.progressBar1.Location = new System.Drawing.Point(12, 12); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(229, 23); + this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee; + this.progressBar1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(10, 49); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(232, 16); + this.label1.TabIndex = 1; + this.label1.Text = "Preparando datos para la ejecución..."; + // + // ProgresoInic + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(256, 88); + this.ControlBox = false; + this.Controls.Add(this.label1); + this.Controls.Add(this.progressBar1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "ProgresoInic"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "OLIVIA"; + this.TopMost = true; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ProgressBar progressBar1; + private System.Windows.Forms.Label label1; + } +} \ No newline at end of file diff --git a/OliviaAddIn/ProgresoInic.cs b/OliviaAddIn/ProgresoInic.cs new file mode 100644 index 0000000..1cfefbd --- /dev/null +++ b/OliviaAddIn/ProgresoInic.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace OliviaAddIn +{ + public partial class ProgresoInic : Form + { + public ProgresoInic() + { + InitializeComponent(); + } + } +} diff --git a/OliviaAddIn/ProgresoInic.resx b/OliviaAddIn/ProgresoInic.resx new file mode 100644 index 0000000..1bb292f --- /dev/null +++ b/OliviaAddIn/ProgresoInic.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA + AAD///8B////Af///wH///8BOoFqBTqBamE6gWq9OoFq7zqBapU6gWq9OoFqvzqBamM6gWoF////Af// + /wH///8B////Af///wH///8BOoFqJTqBatE6gWr/OoFq/zqBav86gWqTOoFq9TqBav86gWr/OoFq0zqB + ain///8B////Af///wH///8BOoFqJTqBaus6gWr/OoFq/zqBav86gWr9OoFqqzqBauk6gWr9OoFq/zqB + av86gWrrOoFqJ////wH///8BOoFqAzqBas86gWr7OoFqzTqBaqk6gWqtOoFqYzqBask6gWpJOoFqXTqB + ass6gWr7OoFq/zqBatE6gWoF////ATqBalc6gWrpOoFq4zqBap86gWoNOoFqCzqBanM6gWrROoFqqzqB + ajk6gWoNOoFqezqBavk6gWr/OoFqW////wE6gWq1OoFqpTqBats6gWp7OoFqOzqBahs6gWrxOoFq8zqB + av86gWqVOoFqFTqBanM6gWqJOoFq0TqBarf///8BOoFq6zqBal86gWqFOoFqezqBais6gWpHOoFq8TqB + av86gWr/OoFqdTqBaj86gWopOoFqhTqBask6gWqF////ATqBauM6gWo1OoFqHzqBamX///8BOoFqiTqB + av86gWrhOoFq/zqBal////8BOoFqYTqBaok6gWrhOoFq/////wE6gWpFOoFqFzqBakU6gWov////ATqB + apk6gWr/OoFq8TqBav86gWrbOoFqE////wE6gWpVOoFqtzqBapv///8BOoFqeTqBaos6gWpj////Af// + /wE6gWpXOoFq+zqBav86gWr/OoFq3TqBahE6gWozOoFqiTqBauU6gWol////ATqBaj86gWoV////Af// + /wH///8BOoFqfTqBaus6gWr3OoFq9zqBajs6gWo7OoFqczqBat86gWphOoFqA////wH///8B////Af// + /wH///8B////ATqBapM6gWr/OoFq/zqBav86gWpbOoFqSTqBatM6gWqVOoFqeTqBahP///8B////Af// + /wH///8B////Af///wE6gWofOoFq1zqBav86gWr/OoFqff///wH///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////ATqBark6gWr/OoFqwzqBagf///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wE6gWo3OoFq6zqBaiP///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// + /wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//w== + + + \ No newline at end of file diff --git a/OliviaAddIn/Properties/AssemblyInfo.cs b/OliviaAddIn/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6af6852 --- /dev/null +++ b/OliviaAddIn/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[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: AssemblyProduct("OliviaAddIn")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("60d0ceba-2073-4808-9b09-249ea342896c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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")] diff --git a/OliviaAddIn/Properties/Resources.Designer.cs b/OliviaAddIn/Properties/Resources.Designer.cs new file mode 100644 index 0000000..ac51140 --- /dev/null +++ b/OliviaAddIn/Properties/Resources.Designer.cs @@ -0,0 +1,333 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OliviaAddIn.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OliviaAddIn.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap areas { + get { + object obj = ResourceManager.GetObject("areas", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Asset_tracking_and_management { + get { + object obj = ResourceManager.GetObject("Asset-tracking-and-management", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap back { + get { + object obj = ResourceManager.GetObject("back", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap barridomec { + get { + object obj = ResourceManager.GetObject("barridomec", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap camion_de_basura_tsr_6000 { + get { + object obj = ResourceManager.GetObject("camion-de-basura-tsr-6000", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap carrito { + get { + object obj = ResourceManager.GetObject("carrito", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap CLEANAIR_5_front { + get { + object obj = ResourceManager.GetObject("CLEANAIR-5-front", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap clock1 { + get { + object obj = ResourceManager.GetObject("clock1", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap clock2 { + get { + object obj = ResourceManager.GetObject("clock2", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap contenedor { + get { + object obj = ResourceManager.GetObject("contenedor", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap document_open_data { + get { + object obj = ResourceManager.GetObject("document-open-data", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap documentinfo { + get { + object obj = ResourceManager.GetObject("documentinfo", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap electrical_sensor1600 { + get { + object obj = ResourceManager.GetObject("electrical_sensor1600", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap folder_gdb { + get { + object obj = ResourceManager.GetObject("folder-gdb", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap folder_important { + get { + object obj = ResourceManager.GetObject("folder-important", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap folder_nw { + get { + object obj = ResourceManager.GetObject("folder-nw", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap garden { + get { + object obj = ResourceManager.GetObject("garden", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap mapa { + get { + object obj = ResourceManager.GetObject("mapa", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap parquimetro { + get { + object obj = ResourceManager.GetObject("parquimetro", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap plan { + get { + object obj = ResourceManager.GetObject("plan", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap play { + get { + object obj = ResourceManager.GetObject("play", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap restr { + get { + object obj = ResourceManager.GetObject("restr", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap restricc { + get { + object obj = ResourceManager.GetObject("restricc", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap sand { + get { + object obj = ResourceManager.GetObject("sand", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap save { + get { + object obj = ResourceManager.GetObject("save", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap system_help { + get { + object obj = ResourceManager.GetObject("system-help", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Wooden_Map { + get { + object obj = ResourceManager.GetObject("Wooden-Map", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/OliviaAddIn/Properties/Resources.resx b/OliviaAddIn/Properties/Resources.resx new file mode 100644 index 0000000..9eec3ab --- /dev/null +++ b/OliviaAddIn/Properties/Resources.resx @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Images\document-open-data.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\carrito.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\folder-nw.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\parquimetro.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\camion-de-basura-tsr-6000.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\documentinfo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\play.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\Wooden-Map.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\clock.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\electrical_sensor1600.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\clock.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\back.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\restr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\save.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\mapa.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\folder-important.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\CLEANAIR-5-front.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\restricc.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\areas.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\sand.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\contenedor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\Asset-tracking-and-management.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\garden.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\plan.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\folder-gdb.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\barridomec.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Images\system-help.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/OliviaAddIn/RecoCampos.cs b/OliviaAddIn/RecoCampos.cs new file mode 100644 index 0000000..a0edbfe --- /dev/null +++ b/OliviaAddIn/RecoCampos.cs @@ -0,0 +1,424 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Drawing.Design; +using System.Windows.Forms.Design; + +namespace OliviaAddIn +{ + + public class RecoCampos : FormCampos + { + /** + * @file RecoCampos.cs + * Archivo de la clase ventana para la edición de los campos a leer en la planificación de recogida de residuos + */ + /** + * Clase ventana para la edición de los campos a leer en la planificación de recogida de residuos + */ + Recogida reco = null; + + ////////////////////////////////////////////////////////////// + + //////////////////////////////////////////// + /** + * Clase para la estructura de propiedades + */ + public class RecoCamposProps + { + bool is_kgrec_camp = true;//si es false, se introduce un valor fijo + bool is_lleno = true;//si es false, se habilita is_kgrec_camp + + [DisplayNameAttribute("ID")] + [DescriptionAttribute("Campo donde leer el identificador del contenedor.")] + [Category("Campos")] + public string id + { + get { return RecogidaDef.campos.cons_id; } + set { RecogidaDef.campos.cons_id = value; } + } + [DisplayNameAttribute("Tipo de recogida")] + [DescriptionAttribute("Campo donde leer el nombre del tipo de recogida.")] + [Category("Campos")] + public string nomrec + { + get { return RecogidaDef.campos.cons_nomrec; } + set { RecogidaDef.campos.cons_nomrec = value; } + } + [DisplayNameAttribute("Lateralidad recogida")] + [DescriptionAttribute("Campo donde leer la lateralidad de recogida.")] + [Category("Campos")] + public string lateral + { + get { return RecogidaDef.campos.cons_lateral; } + set { RecogidaDef.campos.cons_lateral = value; } + } + [DisplayNameAttribute("Fracción")] + [DescriptionAttribute("Campo donde leer la fracción de residuos.")] + [Category("Campos")] + public string fracc + { + get { return RecogidaDef.campos.cons_fracc; } + set { RecogidaDef.campos.cons_fracc = value; } + } + [DisplayNameAttribute("Capacidad")] + [DescriptionAttribute("Campo donde leer la capacidad de los contenedores.")] + [Category("Campos")] + public string capac + { + get { return RecogidaDef.campos.cons_capac; } + set { RecogidaDef.campos.cons_capac = value; } + } + [DisplayNameAttribute("Unidades")] + [DescriptionAttribute("Campo donde leer el número de contenedores de la ubicación.")] + [Category("Campos")] + public string uds + { + get { return RecogidaDef.campos.cons_uds; } + set { RecogidaDef.campos.cons_uds = value; } + } + //---------------------------------------------------------------- + [DisplayNameAttribute("Orgánica")] + [DescriptionAttribute("Atributo de fracción Orgánica.")] + [Category("Atributos de Fracción")] + public string atr_frac_org + { + get { return RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Organica]; } + set { RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Organica] = value; } + } + [DisplayNameAttribute("Resto")] + [DescriptionAttribute("Atributo de fracción Resto.")] + [Category("Atributos de Fracción")] + public string atr_frac_res + { + get { return RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Resto]; } + set { RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Resto] = value; } + } + [DisplayNameAttribute("Envases")] + [DescriptionAttribute("Atributo de fracción Envases.")] + [Category("Atributos de Fracción")] + public string atr_frac_env + { + get { return RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Envases]; } + set { RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Envases] = value; } + } + [DisplayNameAttribute("Papel")] + [DescriptionAttribute("Atributo de fracción Papel.")] + [Category("Atributos de Fracción")] + public string atr_frac_pap + { + get { return RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Papel]; } + set { RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Papel] = value; } + } + [DisplayNameAttribute("Vidrio")] + [DescriptionAttribute("Atributo de fracción Vidrio.")] + [Category("Atributos de Fracción")] + public string atr_frac_vid + { + get { return RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Vidrio]; } + set { RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Vidrio] = value; } + } + [DisplayNameAttribute("Trasera")] + [DescriptionAttribute("Atributo de carga Trasera.")] + [Category("Atributos de Tipo de Carga")] + public string atr_carg_tras + { + get { return RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Trasera]; } + set { RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Trasera] = value; } + } + [DisplayNameAttribute("Lateral")] + [DescriptionAttribute("Atributo de carga Lateral.")] + [Category("Atributos de Tipo de Carga")] + public string atr_carg_lat + { + get { return RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lateral]; } + set { RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lateral] = value; } + } + [DisplayNameAttribute("Superior")] + [DescriptionAttribute("Atributo de carga Superior.")] + [Category("Atributos de Tipo de Carga")] + public string atr_varg_sup + { + get { return RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Superior]; } + set { RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Superior] = value; } + } + [DisplayNameAttribute("Bilateral")] + [DescriptionAttribute("Atributo de carga Bilateral.")] + [Category("Atributos de Tipo de Carga")] + public string atr_varg_bil + { + get { return RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Bilateral]; } + set { RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Bilateral] = value; } + } + [DisplayNameAttribute("Bolseo")] + [DescriptionAttribute("Atributo de carga Bolseo.")] + [Category("Atributos de Tipo de Carga")] + public string atr_varg_bol + { + get { return RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.BolseoPtaPta]; } + set { RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.BolseoPtaPta] = value; } + } + [DisplayNameAttribute("Lavado")] + [DescriptionAttribute("Atributo de carga Lavado.")] + [Category("Atributos de Tipo de Carga")] + public string atr_varg_lav + { + get { return RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lavado]; } + set { RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lavado] = value; } + } + //---------------------------------------------------------------- + [DisplayNameAttribute("Cont. lleno o info sens")] + [ReadOnly(false)] + [RefreshProperties(System.ComponentModel.RefreshProperties.All)] + [DescriptionAttribute("SÍ: Se recogen contenedores llenos o se va a emplear la información externa de sensores (se necesita "+ + "información de densidad). NO: Se pone un valor fijo de carga en kg o se bsuca en la tabla el campo especificado en Kg/recogida.")] + [Category("Otras opciones")] + [TypeConverter(typeof(Prop_si_no))] + public bool kgrec_lleno + { + get { return is_lleno; } + set + { + is_lleno = value; + + //Coge la propiedad de cuando es kg/reco en nombre del campo + PropertyDescriptor descriptor_combo = TypeDescriptor.GetProperties(this.GetType())["kgrec_selec"]; + ReadOnlyAttribute attribute_combo = (ReadOnlyAttribute) + descriptor_combo.Attributes[typeof(ReadOnlyAttribute)]; + + //Coge la propiedad de cuando es kg/reco en nombre del campo + PropertyDescriptor descriptor_camp = TypeDescriptor.GetProperties(this.GetType())["kgrec_camp"]; + ReadOnlyAttribute attribute_camp = (ReadOnlyAttribute) + descriptor_camp.Attributes[typeof(ReadOnlyAttribute)]; + + //Coge la propiedad de cuando es kg/reco en valor fijo + PropertyDescriptor descriptor_val = TypeDescriptor.GetProperties(this.GetType())["kgrec_val"]; + ReadOnlyAttribute attribute_val = (ReadOnlyAttribute) + descriptor_val.Attributes[typeof(ReadOnlyAttribute)]; + + if (attribute_combo != null && attribute_camp != null && attribute_val != null) + { + //Pone la propiedad kgrec_selec, kgrec_camp y la propiedad kgrec_val a modo, sólo lectura para que no se pueda editar + //o modo editable, en función de is_kgrec_camp + System.Reflection.FieldInfo aField_combo = attribute_combo.GetType().GetField("isReadOnly", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + + aField_combo.SetValue(attribute_combo, is_lleno); + if (is_lleno) + { + System.Reflection.FieldInfo aField_camp = attribute_camp.GetType().GetField("isReadOnly", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + + aField_camp.SetValue(attribute_camp, is_lleno); + + System.Reflection.FieldInfo aField_val = attribute_val.GetType().GetField("isReadOnly", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + + aField_val.SetValue(attribute_val, is_lleno); + } + else + { + System.Reflection.FieldInfo aField_camp = attribute_camp.GetType().GetField("isReadOnly", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + + aField_camp.SetValue(attribute_camp, !is_kgrec_camp); + + System.Reflection.FieldInfo aField_val = attribute_val.GetType().GetField("isReadOnly", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + + aField_val.SetValue(attribute_val, is_kgrec_camp); + } + + + } + + + } + } + //----------------------------------------------------------------------- + [DisplayNameAttribute("Campo Kg/recogida")] + [ReadOnly(false)] + [RefreshProperties(System.ComponentModel.RefreshProperties.All)] + [DescriptionAttribute("SÍ: Editar el nombre del campo. NO: Introducir un valor fijo.")] + [Category("Otras opciones")] + [TypeConverter(typeof(Prop_si_no))] + public bool kgrec_selec + { + get { return is_kgrec_camp; } + set + { + is_kgrec_camp = value; + + //Coge la propiedad de cuando es kg/reco en nombre del campo + PropertyDescriptor descriptor_camp = TypeDescriptor.GetProperties(this.GetType())["kgrec_camp"]; + ReadOnlyAttribute attribute_camp = (ReadOnlyAttribute) + descriptor_camp.Attributes[typeof(ReadOnlyAttribute)]; + + //Coge la propiedad de cuando es kg/reco en valor fijo + PropertyDescriptor descriptor_val = TypeDescriptor.GetProperties(this.GetType())["kgrec_val"]; + ReadOnlyAttribute attribute_val = (ReadOnlyAttribute) + descriptor_val.Attributes[typeof(ReadOnlyAttribute)]; + + if (attribute_camp != null && attribute_val != null) + { + //Pone la propiedad kgrec_camp a modo solo lectura para que no se pueda editar + //y la propiedad kgrec_val a editable, o viceversa, en función de is_kgrec_camp + System.Reflection.FieldInfo aField_camp = attribute_camp.GetType().GetField("isReadOnly", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + + aField_camp.SetValue(attribute_camp, !is_kgrec_camp); + + System.Reflection.FieldInfo aField_val = attribute_val.GetType().GetField("isReadOnly", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + + aField_val.SetValue(attribute_val, is_kgrec_camp); + } + + + } + } + + [DisplayNameAttribute("Kg/recogida (Campo)")] + [ReadOnly(false)] + [DescriptionAttribute("Campo donde leer los kg de recogida de los contenedores.")] + [Category("Otras opciones")] + public string kgrec_camp + { + get { return RecogidaDef.campos.cons_kgrec; } + set { RecogidaDef.campos.cons_kgrec = value; } + } + [DisplayNameAttribute("Kg/recogida (Valor)")] + [ReadOnly(true)] + [DescriptionAttribute("Valor fijo a emplear como kg de recogida de los contenedores.")] + [Category("Otras opciones")] + public int kgrec_val + { + get { return RecogidaDef.kgrec_cont; } + set { RecogidaDef.kgrec_cont = value; } + } + } + //////////////////////////////////////////////////// + public RecoCamposProps props; + public RecoCampos(Recogida reco) + { + props = new RecoCamposProps(); + Text = "Campos de la capa de Recogida"; + reinicia(); + propertyGrid.SelectedObject = props; + this.reco = reco; + } + + private void reinicia() + { + props.id = RecogidaDef.campos_def.cons_id; + props.nomrec = RecogidaDef.campos_def.cons_nomrec; + props.lateral = RecogidaDef.campos_def.cons_lateral; + props.fracc = RecogidaDef.campos_def.cons_fracc; + props.capac = RecogidaDef.campos_def.cons_capac; + props.uds = RecogidaDef.campos_def.cons_uds; + props.kgrec_selec = RecogidaDef.kgrec_camp; + props.kgrec_lleno = RecogidaDef.lleno; + props.kgrec_camp = RecogidaDef.campos_def.cons_kgrec; + props.kgrec_val = RecogidaDef.kgrec_cont; + + //---------------------------------------------------------------- + props.atr_frac_org = RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Organica]; + props.atr_frac_res = RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Resto]; + props.atr_frac_env = RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Envases]; + props.atr_frac_pap = RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Papel]; + props.atr_frac_vid = RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Vidrio]; + + props.atr_carg_tras = RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Trasera]; + props.atr_carg_lat = RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lateral]; + props.atr_varg_sup = RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Superior]; + props.atr_varg_bil = RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Bilateral]; + props.atr_varg_bol = RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.BolseoPtaPta]; + props.atr_varg_lav = RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lavado]; + + } + + protected override void button_reset_Click(object sender, EventArgs e) + { + reinicia(); + propertyGrid.Refresh(); + } + + /* + * Se validan los campos modificados y se guarda en memoria los nombres de los nuevos campos. + * También se guardará en el archivo .INI una vez se vaya a ejecutar el proceso. + */ + protected override void btn_acept_Click(object sender, EventArgs e) + { + RecogidaDef.campos_def.cons_id = props.id; + RecogidaDef.campos_def.cons_nomrec = props.nomrec; + RecogidaDef.campos_def.cons_lateral = props.lateral; + RecogidaDef.campos_def.cons_fracc = props.fracc; + RecogidaDef.campos_def.cons_capac = props.capac; + reco.rec_capac = RecogidaDef.campos_def.cons_capac; + RecogidaDef.campos_def.cons_uds = props.uds; + reco.rec_uds = RecogidaDef.campos_def.cons_uds; + RecogidaDef.campos_def.cons_kgrec = props.kgrec_camp; + reco.rec_kg = RecogidaDef.campos_def.cons_kgrec; + RecogidaDef.lleno = props.kgrec_lleno; + RecogidaDef.kgrec_camp = props.kgrec_selec; + RecogidaDef.kgrec_cont = props.kgrec_val; + + if (RecogidaDef.lleno) + { + reco.rec_kgrec_cont = -1; + } + else if (RecogidaDef.kgrec_camp) + { + reco.rec_kgrec_cont = 0; + } + else + { + reco.rec_kgrec_cont = props.kgrec_val; + } + + + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Organica] = props.atr_frac_org ; + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Resto] = props.atr_frac_res ; + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Envases] = props.atr_frac_env ; + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Papel] = props.atr_frac_pap ; + RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Vidrio] = props.atr_frac_vid ; + + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Trasera] = props.atr_carg_tras ; + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lateral] = props.atr_carg_lat ; + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Superior] = props.atr_varg_sup; + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Bilateral] = props.atr_varg_bil; + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.BolseoPtaPta] = props.atr_varg_bol; + RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lavado] = props.atr_varg_lav; + + + //que se lea la tabla otra vez.. + DialogResult = DialogResult.OK; + Close(); + } + + private void InitializeComponent() + { + this.SuspendLayout(); + // + // RecoCampos + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.ClientSize = new System.Drawing.Size(292, 309); + this.Name = "RecoCampos"; + this.ResumeLayout(false); + + } + + protected override void button_guardar_Click(object sender, EventArgs e) + { + base.button_guardar_Click(sender, e); + } + + + } +} diff --git a/OliviaAddIn/RecoCampos.resx b/OliviaAddIn/RecoCampos.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/OliviaAddIn/RecoCampos.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OliviaAddIn/Recogida.cs b/OliviaAddIn/Recogida.cs new file mode 100644 index 0000000..400f2de --- /dev/null +++ b/OliviaAddIn/Recogida.cs @@ -0,0 +1,483 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using ESRI.ArcGIS.Geodatabase; +using ESRI.ArcGIS.Geometry; + +namespace OliviaAddIn +{ + /** + * @file Recogida.cs + * Clase de las variables asociadas a la recogida de residuos. + * Contiene definiciones, nombres de campos, y las opciones configuradas en la ventana. + */ + + //************************************************************************************* + /** + * Clase de las variables asociadas a la recogida de residuos. + * Contiene definiciones, nombres de campos, y las opciones configuradas en la ventana. + */ + public class Recogida : Comun + { + //************************************************************************************* + //Enums y structs + public struct CargaMax + { + public int n; // id = null;//valores unicos de ids que cumplen con las fechas marcadas + public List cargas = null;//valor de la carga si solo tiene fecha inicial o Valor medio de las cargas que se encuentran entre fecha inicial y final + + //************************************************************************************* + //Constructor + public Recogida() + { + rellena_matrs(); + rellena_preffracc_gdb(); + rellena_prefcarg_gdb(); + rellena_simbol_rec(); + rellena_simb_tipbasura(); + } + //************************************************************************************* + //Métodos + /** + * Rellena las matrices de datos + */ + private void rellena_matrs() + { + //Rellena los tipos de vehículo + RecogidaDef.tipos_vehic_str[(int)RecogidaDef.TiposVehic.Ejes3] = "3 Ejes"; + RecogidaDef.tipos_vehic_str[(int)RecogidaDef.TiposVehic.Ejes2] = "2 Ejes"; + RecogidaDef.tipos_vehic_str[(int)RecogidaDef.TiposVehic.Satelite] = "Satélite"; + + //Rellena las densidades en camión + RecogidaDef.dens_frac_cami[(int)RecogidaDef.TiposFracción.Organica] = RecogidaDef.Parametros.dens_vehi_org; + RecogidaDef.dens_frac_cami[(int)RecogidaDef.TiposFracción.Resto] = RecogidaDef.Parametros.dens_vehi_res; + RecogidaDef.dens_frac_cami[(int)RecogidaDef.TiposFracción.Envases] = RecogidaDef.Parametros.dens_vehi_env; + RecogidaDef.dens_frac_cami[(int)RecogidaDef.TiposFracción.Papel] = RecogidaDef.Parametros.dens_vehi_pap; + RecogidaDef.dens_frac_cami[(int)RecogidaDef.TiposFracción.Vidrio] = RecogidaDef.Parametros.dens_vehi_vid; + RecogidaDef.dens_frac_cami[(int)RecogidaDef.TiposFracción.Otra] = RecogidaDef.Parametros.dens_vehi_otr; + + //Rellena las densidades en contenedor + RecogidaDef.dens_frac_cont[(int)RecogidaDef.TiposFracción.Organica] = RecogidaDef.Parametros.dens_cont_org; + RecogidaDef.dens_frac_cont[(int)RecogidaDef.TiposFracción.Resto] = RecogidaDef.Parametros.dens_cont_res; + RecogidaDef.dens_frac_cont[(int)RecogidaDef.TiposFracción.Envases] = RecogidaDef.Parametros.dens_cont_env; + RecogidaDef.dens_frac_cont[(int)RecogidaDef.TiposFracción.Papel] = RecogidaDef.Parametros.dens_cont_pap; + RecogidaDef.dens_frac_cont[(int)RecogidaDef.TiposFracción.Vidrio] = RecogidaDef.Parametros.dens_cont_vid; + RecogidaDef.dens_frac_cont[(int)RecogidaDef.TiposFracción.Otra] = RecogidaDef.Parametros.dens_cont_otr; + + //Rellena las anchuras de los vehículos + RecogidaDef.ancho_vehic[(int)RecogidaDef.TiposVehic.Ejes3] = RecogidaDef.Parametros.anch_vehi_3; + RecogidaDef.ancho_vehic[(int)RecogidaDef.TiposVehic.Ejes2] = RecogidaDef.Parametros.anch_vehi_2; + RecogidaDef.ancho_vehic[(int)RecogidaDef.TiposVehic.Satelite] = RecogidaDef.Parametros.anch_vehi_s; + + //Rellena los ángulos de giro de los vehículos + RecogidaDef.giro_vehic[(int)RecogidaDef.TiposVehic.Ejes3] = RecogidaDef.Parametros.rad_giro_3; + RecogidaDef.giro_vehic[(int)RecogidaDef.TiposVehic.Ejes2] = RecogidaDef.Parametros.rad_giro_2; + RecogidaDef.giro_vehic[(int)RecogidaDef.TiposVehic.Satelite] = RecogidaDef.Parametros.rad_giro_s; + + //Rellena los tiempos de vaciado + RecogidaDef.t_vaci[(int)RecogidaDef.TiposCarga.Trasera] = RecogidaDef.Parametros.t_vaci_tra; + RecogidaDef.t_vaci[(int)RecogidaDef.TiposCarga.Lateral] = RecogidaDef.Parametros.t_vaci_lat; + RecogidaDef.t_vaci[(int)RecogidaDef.TiposCarga.Superior] = RecogidaDef.Parametros.t_vaci_sup; + RecogidaDef.t_vaci[(int)RecogidaDef.TiposCarga.Bilateral] = RecogidaDef.Parametros.t_vaci_bi; + RecogidaDef.t_vaci[(int)RecogidaDef.TiposCarga.BolseoPtaPta] = RecogidaDef.Parametros.t_vaci_bol; + RecogidaDef.t_vaci[(int)RecogidaDef.TiposCarga.Lavado] = RecogidaDef.Parametros.t_vaci_lav; + RecogidaDef.t_vaci[(int)RecogidaDef.TiposCarga.Otra] = RecogidaDef.Parametros.t_vaci_otr; + + + //Rellena las matrices de carga máxima por tipo de vehículo y tipo de carga + rellena_matrs_carg(); + } + + /** + * Función general para rellenar campos de la matriz de cargas máximas por tipo de carga y de vehículo + */ + private void rellena_carg(int icar, int iveh, int n, int i_def, int[] info) + { + cargas_max_vehic[icar, iveh].n = n; + cargas_max_vehic[icar, iveh].i_def = i_def; + cargas_max_vehic[icar, iveh].vol = null; + cargas_max_vehic[icar, iveh].offset = null; + if (n <= 0) + return; + cargas_max_vehic[icar, iveh].vol = new int[n]; + for (int i = 0; i < n; i++) + { + cargas_max_vehic[icar, iveh].vol[i] = info[i]; + } + + } + + /** + * Función general para rellenar campos de la matriz de cargas máximas por tipo de carga y de vehículo + */ + private void rellena_carg_offset(int icar, int iveh, int ifrac, int n, int[] info) + { + cargas_max_vehic[icar, iveh].offset = new int[n,(int)RecogidaDef.TiposFracción.N]; + for (int i = 0; i < n; i++) + { + cargas_max_vehic[icar, iveh].offset[i,ifrac] = info[i]; + } + } + + /** + * Rellena la matriz de las opciones de vehículos que hay de cada tipo de carga + * y dimensión + */ + private void rellena_matrs_carg() + { + int[] info = new int[10]; + int n, i_def, icar, iveh; + + //Rellena las opciones de carga máxima por vehículo + //Trasera-satelite + n = 4; + i_def = 2; + info[0] = 2; + info[1] = 3; + info[2] = 5; + info[3] = 7; + rellena_carg((int)RecogidaDef.TiposCarga.Trasera, + (int)RecogidaDef.TiposVehic.Satelite, n, i_def, info); + //rellena la corrección de la carga máxima + info[0] = info[1] = -500; + info[2] = info[3] = 0; + rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera, + (int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Resto, n, info); + rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera, + (int)RecogidaDef.TiposVehic.Satelite, (int)RecogidaDef.TiposFracción.Organica, n, info); + + //Trasera-2 ejes + n = 6; + i_def = 2; + info[0] = 8; + info[1] = 10; + info[2] = 12; + info[3] = 14; + info[4] = 16; + info[5] = 17; + rellena_carg((int)RecogidaDef.TiposCarga.Trasera, + (int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info); + //rellena la corrección de la carga máxima + info[1] = -500; + info[2] = -1000; + info[3] = -1500; + info[4] = -2000; + info[0] = info[5] = 0; + rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera, + (int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Resto, n, info); + rellena_carg_offset((int)RecogidaDef.TiposCarga.Trasera, + (int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Organica, n, info); + + //Trasera-3ejes + n = 4; + i_def = 3; + info[0] = 18; + info[1] = 20; + info[2] = 22; + info[3] = 23; + rellena_carg((int)RecogidaDef.TiposCarga.Trasera, + (int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info); + + //Lateral-satelite, no hay + rellena_carg((int)RecogidaDef.TiposCarga.Lateral, + (int)RecogidaDef.TiposVehic.Satelite, 0, 0, null); + + //Lateral - 2 ejes + n = 2; + i_def = 1; + info[0] = 15; + info[1] = 17; + rellena_carg((int)RecogidaDef.TiposCarga.Lateral, + (int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info); + //rellena la corrección de la carga máxima + info[0] = -500; + info[1] = -1000; + rellena_carg_offset((int)RecogidaDef.TiposCarga.Lateral, + (int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Resto, n, info); + rellena_carg_offset((int)RecogidaDef.TiposCarga.Lateral, + (int)RecogidaDef.TiposVehic.Ejes2, (int)RecogidaDef.TiposFracción.Organica, n, info); + + //Lateral - 3 ejes + n = 3; + i_def = 2; + info[0] = 21; + info[1] = 23; + info[2] = 26; + rellena_carg((int)RecogidaDef.TiposCarga.Lateral, + (int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info); + + //Superior - satelite, no hay + rellena_carg((int)RecogidaDef.TiposCarga.Superior, + (int)RecogidaDef.TiposVehic.Satelite, 0, 0, null); + + //Superior - 2 ejes + n = 2; + i_def = 0; + info[0] = 16; + info[1] = 17; + rellena_carg((int)RecogidaDef.TiposCarga.Superior, + (int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info); + + //Superior - 3 ejes + n = 3; + i_def = 2; + info[0] = 20; + info[1] = 23; + info[2] = 25; + rellena_carg((int)RecogidaDef.TiposCarga.Superior, + (int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info); + + //Bilateral - satelite, no hay + rellena_carg((int)RecogidaDef.TiposCarga.Bilateral, + (int)RecogidaDef.TiposVehic.Satelite, 0, 0, null); + + //Superior - 2 ejes + n = 3; + i_def = 1; + info[0] = 14; + info[1] = 16; + info[2] = 18; + rellena_carg((int)RecogidaDef.TiposCarga.Bilateral, + (int)RecogidaDef.TiposVehic.Ejes2, n, i_def, info); + + //Superior - 3 ejes + n = 3; + i_def = 1; + info[0] = 20; + info[1] = 23; + info[2] = 26; + rellena_carg((int)RecogidaDef.TiposCarga.Bilateral, + (int)RecogidaDef.TiposVehic.Ejes3, n, i_def, info); + + //Bolseo - todas, no hay + //Lavado - todas, no hay + //Otra - todas, no hay + for (icar = (int)RecogidaDef.TiposCarga.BolseoPtaPta; icar < (int)RecogidaDef.TiposCarga.N; icar++) + { + for (iveh = (int)RecogidaDef.TiposVehic.Ejes3; iveh < (int)RecogidaDef.TiposVehic.N; iveh++) + { + rellena_carg(icar, iveh, 0, 0, null); + } + } + } + + /** + * Inicializa la matriz de strings con los prefijos (fracción) que llevarán los featureclass de la geodatabase importada a ArcGIS una vez realizada la planificación + */ + public void rellena_preffracc_gdb() + { + RecogidaDef.preffracc_gdb[(int)RecogidaDef.TiposFracción.Organica] = "Org"; + RecogidaDef.preffracc_gdb[(int)RecogidaDef.TiposFracción.Resto] = "R"; + RecogidaDef.preffracc_gdb[(int)RecogidaDef.TiposFracción.Envases] = "E"; + RecogidaDef.preffracc_gdb[(int)RecogidaDef.TiposFracción.Papel] = "P"; + RecogidaDef.preffracc_gdb[(int)RecogidaDef.TiposFracción.Vidrio] = "V"; + RecogidaDef.preffracc_gdb[(int)RecogidaDef.TiposFracción.Otra] = "Otr_" + OliviaGlob.gdb_reco.fra_otra; + } + + /** + * Inicializa la matriz de strings con los prefijos (fracción) que llevarán los featureclass de la geodatabase importada a ArcGIS una vez realizada la planificación + */ + public void rellena_prefcarg_gdb() + { + RecogidaDef.prefcarg_gdb[(int)RecogidaDef.TiposFracción.Organica] = "Tra"; + RecogidaDef.prefcarg_gdb[(int)RecogidaDef.TiposFracción.Resto] = "Lat"; + RecogidaDef.prefcarg_gdb[(int)RecogidaDef.TiposFracción.Envases] = "BiLat"; + RecogidaDef.prefcarg_gdb[(int)RecogidaDef.TiposFracción.Papel] = "Bols"; + RecogidaDef.prefcarg_gdb[(int)RecogidaDef.TiposFracción.Vidrio] = "Lav"; + RecogidaDef.prefcarg_gdb[(int)RecogidaDef.TiposFracción.Otra] = "Otr_" + OliviaGlob.gdb_reco.carg_otra; + } + + /** + * Inicializa la matriz de strings con los tipos de recogida + */ + public void rellena_simbol_rec() + { + RecogidaDef.simb_rec_vsm[0] = RecogidaDef.nombre_simbrec_vsm[0]; + RecogidaDef.simb_rec_vsm[1] = RecogidaDef.nombre_simbrec_vsm[1]; + RecogidaDef.simb_rec_vsm[2] = RecogidaDef.nombre_simbrec_vsm[2]; + RecogidaDef.simb_rec_vsm[3] = RecogidaDef.nombre_simbrec_vsm[3]; + RecogidaDef.simb_rec_vsm[4] = RecogidaDef.nombre_simbrec_vsm[4]; + RecogidaDef.simb_rec_vsm[5] = RecogidaDef.nombre_simbrec_vsm[5]; + RecogidaDef.simb_rec_vsm[6] = RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Lateral]; + RecogidaDef.simb_rec_vsm[7] = RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Trasera]; + RecogidaDef.simb_rec_vsm[8] = RecogidaDef.tipos_carg_str[(int)RecogidaDef.TiposCarga.Superior]; + } + + /** + * Inicializa la matriz de strings con los tipos de recogida + */ + public void rellena_simb_tipbasura() + { + RecogidaDef.simb_tipbasura[0] = RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Envases]; + RecogidaDef.simb_tipbasura[1] = RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Papel]; + RecogidaDef.simb_tipbasura[2] = RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Vidrio]; + RecogidaDef.simb_tipbasura[3] = RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Organica]; + RecogidaDef.simb_tipbasura[4] = RecogidaDef.tipos_fracc_str[(int)RecogidaDef.TiposFracción.Resto]; + } + } +} diff --git a/OliviaAddIn/RecogidaDef.cs b/OliviaAddIn/RecogidaDef.cs new file mode 100644 index 0000000..433afe1 --- /dev/null +++ b/OliviaAddIn/RecogidaDef.cs @@ -0,0 +1,257 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace OliviaAddIn +{ + + /** + * @file RecogidaDef.cs + * Clase con definiciones de recogida comunes al proyecto Olivia y a Geofoto. + */ + /** + * Clase con definiciones de recogida comunes al proyecto Olivia y a Geofoto. + */ + + class RecogidaDef + { + //************************************************************************************* + //Enums y structs generales + /** + * Nombre de los campos (de las capas) sobre los que se realizarán consultas para la recogida + */ + public struct Campos + { + public string cons_id; // + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RecogidaDlg)); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.groupBox_tiporeco = new System.Windows.Forms.GroupBox(); + this.comboBox_lateralidad = new System.Windows.Forms.ComboBox(); + this.label_dens_cont = new System.Windows.Forms.Label(); + this.textBox_dens_cont = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label21 = new System.Windows.Forms.Label(); + this.textBox_kgmax = new System.Windows.Forms.TextBox(); + this.comboBox_capac = new System.Windows.Forms.ComboBox(); + this.label11 = new System.Windows.Forms.Label(); + this.comboBox_vehic = new System.Windows.Forms.ComboBox(); + this.comboBox_carga = new System.Windows.Forms.ComboBox(); + this.comboBox_fraccion = new System.Windows.Forms.ComboBox(); + this.label4 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.button_dat_entrada = new System.Windows.Forms.Button(); + this.label_dat_entrada = new System.Windows.Forms.Label(); + this.button_edit_camp = new System.Windows.Forms.Button(); + this.textBox_carga_max = new System.Windows.Forms.TextBox(); + this.label19 = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.btn_csv = new System.Windows.Forms.Button(); + this.btn_edit_camp_sensor = new System.Windows.Forms.Button(); + this.checkBox_sens = new System.Windows.Forms.CheckBox(); + this.groupBox_sens = new System.Windows.Forms.GroupBox(); + this.label24 = new System.Windows.Forms.Label(); + this.pictureBox5 = new System.Windows.Forms.PictureBox(); + this.label20 = new System.Windows.Forms.Label(); + this.textBox_url = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.label28 = new System.Windows.Forms.Label(); + this.label27 = new System.Windows.Forms.Label(); + this.label25 = new System.Windows.Forms.Label(); + this.bt_capa_zonas = new System.Windows.Forms.Button(); + this.lbl_capa_zona = new System.Windows.Forms.Label(); + this.lbl_turno = new System.Windows.Forms.Label(); + this.button_capa_turno = new System.Windows.Forms.Button(); + this.pictureBox2 = new System.Windows.Forms.PictureBox(); + this.lbl_capa_restricc = new System.Windows.Forms.Label(); + this.button_cap_restricc = new System.Windows.Forms.Button(); + this.lbl_pto_descarg = new System.Windows.Forms.Label(); + this.button_pto_desc = new System.Windows.Forms.Button(); + this.instal_sel = new System.Windows.Forms.Label(); + this.bt_nave_sal = new System.Windows.Forms.Button(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.label18 = new System.Windows.Forms.Label(); + this.textBox_traf = new System.Windows.Forms.TextBox(); + this.label15 = new System.Windows.Forms.Label(); + this.dateTimePicker_h_inicio = new System.Windows.Forms.DateTimePicker(); + this.label_t_inicio = new System.Windows.Forms.Label(); + this.label22 = new System.Windows.Forms.Label(); + this.textBox_descar = new System.Windows.Forms.TextBox(); + this.label23 = new System.Windows.Forms.Label(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.label12 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.dateTimePicker_t_desc = new System.Windows.Forms.DateTimePicker(); + this.label7 = new System.Windows.Forms.Label(); + this.dateTimePicker_t_conv = new System.Windows.Forms.DateTimePicker(); + this.label6 = new System.Windows.Forms.Label(); + this.pictureBox3 = new System.Windows.Forms.PictureBox(); + this.label13 = new System.Windows.Forms.Label(); + this.textBox_t_sal = new System.Windows.Forms.TextBox(); + this.label14 = new System.Windows.Forms.Label(); + this.label_t_vac_seg = new System.Windows.Forms.Label(); + this.textBox_t_vaciado = new System.Windows.Forms.TextBox(); + this.label_t_vaciado = new System.Windows.Forms.Label(); + this.groupBox7 = new System.Windows.Forms.GroupBox(); + this.pictureBox4 = new System.Windows.Forms.PictureBox(); + this.label5 = new System.Windows.Forms.Label(); + this.checkBox_ajust_sec = new System.Windows.Forms.CheckBox(); + this.checkBox_sector_autom = new System.Windows.Forms.CheckBox(); + this.label17 = new System.Windows.Forms.Label(); + this.numericUpDown_sectores = new System.Windows.Forms.NumericUpDown(); + this.label16 = new System.Windows.Forms.Label(); + this.numericUpDown_pctrl = new System.Windows.Forms.NumericUpDown(); + this.label10 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.checkBox_aislados = new System.Windows.Forms.CheckBox(); + this.btn_help = new System.Windows.Forms.Button(); + this.bt_planifica = new System.Windows.Forms.Button(); + this.groupBox_edits = new System.Windows.Forms.GroupBox(); + this.button_eje = new System.Windows.Forms.Button(); + this.textBox_buff = new System.Windows.Forms.TextBox(); + this.label26 = new System.Windows.Forms.Label(); + this.label29 = new System.Windows.Forms.Label(); + this.groupBox1.SuspendLayout(); + this.groupBox_tiporeco.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.groupBox2.SuspendLayout(); + this.groupBox_sens.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); + this.groupBox3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); + this.groupBox4.SuspendLayout(); + this.groupBox6.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); + this.groupBox7.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_sectores)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_pctrl)).BeginInit(); + this.groupBox_edits.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.groupBox_tiporeco); + this.groupBox1.Controls.Add(this.pictureBox1); + this.groupBox1.Controls.Add(this.button_dat_entrada); + this.groupBox1.Controls.Add(this.label_dat_entrada); + this.groupBox1.Controls.Add(this.button_edit_camp); + this.groupBox1.Location = new System.Drawing.Point(6, 7); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(659, 165); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Tipo de recogida"; + // + // groupBox_tiporeco + // + this.groupBox_tiporeco.Controls.Add(this.comboBox_lateralidad); + this.groupBox_tiporeco.Controls.Add(this.label_dens_cont); + this.groupBox_tiporeco.Controls.Add(this.textBox_dens_cont); + this.groupBox_tiporeco.Controls.Add(this.label2); + this.groupBox_tiporeco.Controls.Add(this.label21); + this.groupBox_tiporeco.Controls.Add(this.textBox_kgmax); + this.groupBox_tiporeco.Controls.Add(this.comboBox_capac); + this.groupBox_tiporeco.Controls.Add(this.label11); + this.groupBox_tiporeco.Controls.Add(this.comboBox_vehic); + this.groupBox_tiporeco.Controls.Add(this.comboBox_carga); + this.groupBox_tiporeco.Controls.Add(this.comboBox_fraccion); + this.groupBox_tiporeco.Controls.Add(this.label4); + this.groupBox_tiporeco.Controls.Add(this.label3); + this.groupBox_tiporeco.Location = new System.Drawing.Point(249, 45); + this.groupBox_tiporeco.Name = "groupBox_tiporeco"; + this.groupBox_tiporeco.Size = new System.Drawing.Size(404, 114); + this.groupBox_tiporeco.TabIndex = 15; + this.groupBox_tiporeco.TabStop = false; + // + // comboBox_lateralidad + // + this.comboBox_lateralidad.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox_lateralidad.FormattingEnabled = true; + this.comboBox_lateralidad.Location = new System.Drawing.Point(276, 37); + this.comboBox_lateralidad.Name = "comboBox_lateralidad"; + this.comboBox_lateralidad.Size = new System.Drawing.Size(122, 21); + this.comboBox_lateralidad.TabIndex = 26; + this.comboBox_lateralidad.Visible = false; + this.comboBox_lateralidad.SelectedIndexChanged += new System.EventHandler(this.comboBox_lateralidad_SelectedIndexChanged); + // + // label_dens_cont + // + this.label_dens_cont.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label_dens_cont.Location = new System.Drawing.Point(375, 12); + this.label_dens_cont.Name = "label_dens_cont"; + this.label_dens_cont.Size = new System.Drawing.Size(25, 18); + this.label_dens_cont.TabIndex = 25; + this.toolTip1.SetToolTip(this.label_dens_cont, "Densidad de los contenedores en Kg/m3"); + // + // textBox_dens_cont + // + this.textBox_dens_cont.Location = new System.Drawing.Point(274, 12); + this.textBox_dens_cont.Name = "textBox_dens_cont"; + this.textBox_dens_cont.Size = new System.Drawing.Size(100, 20); + this.textBox_dens_cont.TabIndex = 24; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(11, 15); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(48, 13); + this.label2.TabIndex = 14; + this.label2.Text = "Fracción"; + // + // label21 + // + this.label21.AutoSize = true; + this.label21.Location = new System.Drawing.Point(273, 91); + this.label21.Name = "label21"; + this.label21.Size = new System.Drawing.Size(87, 13); + this.label21.TabIndex = 23; + this.label21.Text = "kg máx. por viaje"; + // + // textBox_kgmax + // + this.textBox_kgmax.Location = new System.Drawing.Point(200, 88); + this.textBox_kgmax.Name = "textBox_kgmax"; + this.textBox_kgmax.Size = new System.Drawing.Size(67, 20); + this.textBox_kgmax.TabIndex = 22; + this.textBox_kgmax.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // comboBox_capac + // + this.comboBox_capac.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox_capac.FormattingEnabled = true; + this.comboBox_capac.Location = new System.Drawing.Point(122, 88); + this.comboBox_capac.Name = "comboBox_capac"; + this.comboBox_capac.Size = new System.Drawing.Size(73, 21); + this.comboBox_capac.TabIndex = 21; + this.comboBox_capac.DropDown += new System.EventHandler(this.comboBox_capac_DropDown); + this.comboBox_capac.SelectedIndexChanged += new System.EventHandler(this.comboBox_capac_SelectedIndexChanged); + this.comboBox_capac.DropDownClosed += new System.EventHandler(this.comboBox_capac_DropDownClosed); + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(11, 91); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(81, 13); + this.label11.TabIndex = 20; + this.label11.Text = "Capacidad (m3)"; + // + // comboBox_vehic + // + this.comboBox_vehic.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox_vehic.FormattingEnabled = true; + this.comboBox_vehic.Location = new System.Drawing.Point(122, 62); + this.comboBox_vehic.Name = "comboBox_vehic"; + this.comboBox_vehic.Size = new System.Drawing.Size(145, 21); + this.comboBox_vehic.TabIndex = 19; + this.comboBox_vehic.SelectedIndexChanged += new System.EventHandler(this.comboBox_vehic_SelectedIndexChanged); + // + // comboBox_carga + // + this.comboBox_carga.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox_carga.FormattingEnabled = true; + this.comboBox_carga.Location = new System.Drawing.Point(122, 37); + this.comboBox_carga.Name = "comboBox_carga"; + this.comboBox_carga.Size = new System.Drawing.Size(145, 21); + this.comboBox_carga.TabIndex = 18; + this.comboBox_carga.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.comboBox_carga_DrawItem); + this.comboBox_carga.SelectedIndexChanged += new System.EventHandler(this.comboBox_carga_SelectedIndexChanged); + // + // comboBox_fraccion + // + this.comboBox_fraccion.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox_fraccion.FormattingEnabled = true; + this.comboBox_fraccion.Location = new System.Drawing.Point(122, 12); + this.comboBox_fraccion.Name = "comboBox_fraccion"; + this.comboBox_fraccion.Size = new System.Drawing.Size(145, 21); + this.comboBox_fraccion.TabIndex = 17; + this.comboBox_fraccion.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.comboBox_fraccion_DrawItem); + this.comboBox_fraccion.SelectedIndexChanged += new System.EventHandler(this.comboBox_fraccion_SelectedIndexChanged); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(11, 65); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(88, 13); + this.label4.TabIndex = 16; + this.label4.Text = "Tipo de vehículo"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(11, 40); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(73, 13); + this.label3.TabIndex = 15; + this.label3.Text = "Tipo de carga"; + // + // pictureBox1 + // + this.pictureBox1.Image = global::OliviaAddIn.Properties.Resources.camion_de_basura_tsr_6000; + this.pictureBox1.InitialImage = null; + this.pictureBox1.Location = new System.Drawing.Point(2, 28); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(205, 117); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox1.TabIndex = 9; + this.pictureBox1.TabStop = false; + // + // button_dat_entrada + // + this.button_dat_entrada.Image = global::OliviaAddIn.Properties.Resources.document_open_data; + this.button_dat_entrada.Location = new System.Drawing.Point(249, 16); + this.button_dat_entrada.Name = "button_dat_entrada"; + this.button_dat_entrada.Size = new System.Drawing.Size(38, 23); + this.button_dat_entrada.TabIndex = 2; + this.button_dat_entrada.UseVisualStyleBackColor = true; + this.button_dat_entrada.Click += new System.EventHandler(this.button_dat_entrada_Click); + // + // label_dat_entrada + // + this.label_dat_entrada.AutoEllipsis = true; + this.label_dat_entrada.Location = new System.Drawing.Point(293, 21); + this.label_dat_entrada.Name = "label_dat_entrada"; + this.label_dat_entrada.Size = new System.Drawing.Size(160, 13); + this.label_dat_entrada.TabIndex = 1; + this.label_dat_entrada.Text = "Seleccionar Datos de entrada ..."; + // + // button_edit_camp + // + this.button_edit_camp.Location = new System.Drawing.Point(466, 15); + this.button_edit_camp.Name = "button_edit_camp"; + this.button_edit_camp.Size = new System.Drawing.Size(87, 23); + this.button_edit_camp.TabIndex = 0; + this.button_edit_camp.Text = "Editar campos"; + this.button_edit_camp.UseVisualStyleBackColor = true; + this.button_edit_camp.Click += new System.EventHandler(this.button_edit_camp_Click); + // + // textBox_carga_max + // + this.textBox_carga_max.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.textBox_carga_max.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.RecentlyUsedList; + this.textBox_carga_max.Location = new System.Drawing.Point(527, 21); + this.textBox_carga_max.Name = "textBox_carga_max"; + this.textBox_carga_max.Size = new System.Drawing.Size(82, 20); + this.textBox_carga_max.TabIndex = 4; + this.textBox_carga_max.Text = "67"; + this.textBox_carga_max.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // label19 + // + this.label19.AutoSize = true; + this.label19.Location = new System.Drawing.Point(454, 24); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(67, 13); + this.label19.TabIndex = 3; + this.label19.Text = "% de llenado"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.btn_csv); + this.groupBox2.Controls.Add(this.btn_edit_camp_sensor); + this.groupBox2.Controls.Add(this.checkBox_sens); + this.groupBox2.Controls.Add(this.groupBox_sens); + this.groupBox2.Location = new System.Drawing.Point(8, 178); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(659, 102); + this.groupBox2.TabIndex = 1; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Sensores de llenado"; + // + // btn_csv + // + this.btn_csv.Enabled = false; + this.btn_csv.Location = new System.Drawing.Point(371, 18); + this.btn_csv.Name = "btn_csv"; + this.btn_csv.Size = new System.Drawing.Size(111, 23); + this.btn_csv.TabIndex = 28; + this.btn_csv.Text = "Datos CSV"; + this.btn_csv.UseVisualStyleBackColor = true; + this.btn_csv.Click += new System.EventHandler(this.btn_csv_Click); + // + // btn_edit_camp_sensor + // + this.btn_edit_camp_sensor.Enabled = false; + this.btn_edit_camp_sensor.Location = new System.Drawing.Point(249, 18); + this.btn_edit_camp_sensor.Name = "btn_edit_camp_sensor"; + this.btn_edit_camp_sensor.Size = new System.Drawing.Size(111, 23); + this.btn_edit_camp_sensor.TabIndex = 27; + this.btn_edit_camp_sensor.Text = "Campos Sensores"; + this.btn_edit_camp_sensor.UseVisualStyleBackColor = true; + this.btn_edit_camp_sensor.Click += new System.EventHandler(this.btn_edit_camp_sensor_Click); + // + // checkBox_sens + // + this.checkBox_sens.AutoSize = true; + this.checkBox_sens.Location = new System.Drawing.Point(21, 22); + this.checkBox_sens.Name = "checkBox_sens"; + this.checkBox_sens.Size = new System.Drawing.Size(159, 17); + this.checkBox_sens.TabIndex = 0; + this.checkBox_sens.Text = "Emplear información externa"; + this.checkBox_sens.UseVisualStyleBackColor = true; + this.checkBox_sens.CheckedChanged += new System.EventHandler(this.checkBox_sens_CheckedChanged); + // + // groupBox_sens + // + this.groupBox_sens.Controls.Add(this.label24); + this.groupBox_sens.Controls.Add(this.pictureBox5); + this.groupBox_sens.Controls.Add(this.label20); + this.groupBox_sens.Controls.Add(this.textBox_url); + this.groupBox_sens.Controls.Add(this.label8); + this.groupBox_sens.Controls.Add(this.textBox_carga_max); + this.groupBox_sens.Controls.Add(this.label19); + this.groupBox_sens.Enabled = false; + this.groupBox_sens.Location = new System.Drawing.Point(9, 43); + this.groupBox_sens.Name = "groupBox_sens"; + this.groupBox_sens.Size = new System.Drawing.Size(644, 53); + this.groupBox_sens.TabIndex = 26; + this.groupBox_sens.TabStop = false; + // + // label24 + // + this.label24.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label24.Location = new System.Drawing.Point(407, 21); + this.label24.Name = "label24"; + this.label24.Size = new System.Drawing.Size(25, 18); + this.label24.TabIndex = 26; + this.toolTip1.SetToolTip(this.label24, "La URL tiene que introducirse sin http:"); + // + // pictureBox5 + // + this.pictureBox5.Image = global::OliviaAddIn.Properties.Resources.electrical_sensor1600; + this.pictureBox5.Location = new System.Drawing.Point(14, 13); + this.pictureBox5.Name = "pictureBox5"; + this.pictureBox5.Size = new System.Drawing.Size(36, 33); + this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox5.TabIndex = 25; + this.pictureBox5.TabStop = false; + // + // label20 + // + this.label20.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label20.Location = new System.Drawing.Point(615, 22); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(25, 18); + this.label20.TabIndex = 24; + this.toolTip1.SetToolTip(this.label20, "Se recogerán los contenedores con al menos ese porcentaje de llenado"); + // + // textBox_url + // + this.textBox_url.Location = new System.Drawing.Point(106, 19); + this.textBox_url.Name = "textBox_url"; + this.textBox_url.Size = new System.Drawing.Size(296, 20); + this.textBox_url.TabIndex = 2; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label8.Location = new System.Drawing.Point(72, 23); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(30, 13); + this.label8.TabIndex = 0; + this.label8.Text = "URL:"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.textBox_buff); + this.groupBox3.Controls.Add(this.label26); + this.groupBox3.Controls.Add(this.label29); + this.groupBox3.Controls.Add(this.label28); + this.groupBox3.Controls.Add(this.label27); + this.groupBox3.Controls.Add(this.label25); + this.groupBox3.Controls.Add(this.bt_capa_zonas); + this.groupBox3.Controls.Add(this.lbl_capa_zona); + this.groupBox3.Controls.Add(this.lbl_turno); + this.groupBox3.Controls.Add(this.button_capa_turno); + this.groupBox3.Controls.Add(this.pictureBox2); + this.groupBox3.Controls.Add(this.lbl_capa_restricc); + this.groupBox3.Controls.Add(this.button_cap_restricc); + this.groupBox3.Controls.Add(this.lbl_pto_descarg); + this.groupBox3.Controls.Add(this.button_pto_desc); + this.groupBox3.Controls.Add(this.instal_sel); + this.groupBox3.Controls.Add(this.bt_nave_sal); + this.groupBox3.Location = new System.Drawing.Point(8, 284); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(660, 117); + this.groupBox3.TabIndex = 2; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Zonificación"; + // + // label28 + // + this.label28.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label28.Location = new System.Drawing.Point(376, 26); + this.label28.Name = "label28"; + this.label28.Size = new System.Drawing.Size(25, 18); + this.label28.TabIndex = 34; + this.toolTip1.SetToolTip(this.label28, "Restringe el acceso a la red navegable según el tipo de vehículo"); + // + // label27 + // + this.label27.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label27.Location = new System.Drawing.Point(376, 55); + this.label27.Name = "label27"; + this.label27.Size = new System.Drawing.Size(25, 18); + this.label27.TabIndex = 33; + this.toolTip1.SetToolTip(this.label27, "Delimita los contenedores a recoger, pero no la circulación"); + // + // label25 + // + this.label25.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label25.Location = new System.Drawing.Point(376, 84); + this.label25.Name = "label25"; + this.label25.Size = new System.Drawing.Size(25, 18); + this.label25.TabIndex = 31; + this.toolTip1.SetToolTip(this.label25, "Delimita los contenedores a recoger, pero no la circulación"); + // + // bt_capa_zonas + // + this.bt_capa_zonas.Image = ((System.Drawing.Image)(resources.GetObject("bt_capa_zonas.Image"))); + this.bt_capa_zonas.Location = new System.Drawing.Point(179, 80); + this.bt_capa_zonas.Name = "bt_capa_zonas"; + this.bt_capa_zonas.Size = new System.Drawing.Size(33, 24); + this.bt_capa_zonas.TabIndex = 20; + this.bt_capa_zonas.UseVisualStyleBackColor = true; + this.bt_capa_zonas.Click += new System.EventHandler(this.bt_capa_zonas_Click); + // + // lbl_capa_zona + // + this.lbl_capa_zona.AutoEllipsis = true; + this.lbl_capa_zona.Location = new System.Drawing.Point(218, 86); + this.lbl_capa_zona.Name = "lbl_capa_zona"; + this.lbl_capa_zona.Size = new System.Drawing.Size(166, 13); + this.lbl_capa_zona.TabIndex = 19; + this.lbl_capa_zona.Text = "Seleccionar capa de zonas"; + // + // lbl_turno + // + this.lbl_turno.AutoEllipsis = true; + this.lbl_turno.Location = new System.Drawing.Point(218, 56); + this.lbl_turno.Name = "lbl_turno"; + this.lbl_turno.Size = new System.Drawing.Size(166, 13); + this.lbl_turno.TabIndex = 28; + this.lbl_turno.Text = "Capa de zonificación por turno"; + // + // button_capa_turno + // + this.button_capa_turno.Image = global::OliviaAddIn.Properties.Resources.document_open_data; + this.button_capa_turno.Location = new System.Drawing.Point(179, 50); + this.button_capa_turno.Name = "button_capa_turno"; + this.button_capa_turno.Size = new System.Drawing.Size(33, 24); + this.button_capa_turno.TabIndex = 27; + this.button_capa_turno.UseVisualStyleBackColor = true; + this.button_capa_turno.Click += new System.EventHandler(this.button_capa_turno_Click); + // + // pictureBox2 + // + this.pictureBox2.Image = global::OliviaAddIn.Properties.Resources.areas; + this.pictureBox2.InitialImage = null; + this.pictureBox2.Location = new System.Drawing.Point(22, 24); + this.pictureBox2.Name = "pictureBox2"; + this.pictureBox2.Size = new System.Drawing.Size(106, 80); + this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox2.TabIndex = 26; + this.pictureBox2.TabStop = false; + // + // lbl_capa_restricc + // + this.lbl_capa_restricc.AutoEllipsis = true; + this.lbl_capa_restricc.Location = new System.Drawing.Point(218, 27); + this.lbl_capa_restricc.Name = "lbl_capa_restricc"; + this.lbl_capa_restricc.Size = new System.Drawing.Size(166, 13); + this.lbl_capa_restricc.TabIndex = 24; + this.lbl_capa_restricc.Text = "Capa de restricciones de acceso"; + // + // button_cap_restricc + // + this.button_cap_restricc.Image = global::OliviaAddIn.Properties.Resources.document_open_data; + this.button_cap_restricc.Location = new System.Drawing.Point(179, 21); + this.button_cap_restricc.Name = "button_cap_restricc"; + this.button_cap_restricc.Size = new System.Drawing.Size(33, 24); + this.button_cap_restricc.TabIndex = 23; + this.button_cap_restricc.UseVisualStyleBackColor = true; + this.button_cap_restricc.Click += new System.EventHandler(this.button_cap_restricc_Click); + // + // lbl_pto_descarg + // + this.lbl_pto_descarg.AutoEllipsis = true; + this.lbl_pto_descarg.Location = new System.Drawing.Point(457, 56); + this.lbl_pto_descarg.Name = "lbl_pto_descarg"; + this.lbl_pto_descarg.Size = new System.Drawing.Size(160, 13); + this.lbl_pto_descarg.TabIndex = 22; + this.lbl_pto_descarg.Text = "Selec. Punto de descarga"; + // + // button_pto_desc + // + this.button_pto_desc.Image = global::OliviaAddIn.Properties.Resources.document_open_data; + this.button_pto_desc.Location = new System.Drawing.Point(418, 50); + this.button_pto_desc.Name = "button_pto_desc"; + this.button_pto_desc.Size = new System.Drawing.Size(33, 24); + this.button_pto_desc.TabIndex = 21; + this.button_pto_desc.UseVisualStyleBackColor = true; + this.button_pto_desc.Click += new System.EventHandler(this.button_pto_desc_Click); + // + // instal_sel + // + this.instal_sel.AutoEllipsis = true; + this.instal_sel.Location = new System.Drawing.Point(457, 27); + this.instal_sel.Name = "instal_sel"; + this.instal_sel.Size = new System.Drawing.Size(160, 13); + this.instal_sel.TabIndex = 19; + this.instal_sel.Text = "Selec. Instalación salida/llegada"; + // + // bt_nave_sal + // + this.bt_nave_sal.Image = global::OliviaAddIn.Properties.Resources.document_open_data; + this.bt_nave_sal.Location = new System.Drawing.Point(418, 21); + this.bt_nave_sal.Name = "bt_nave_sal"; + this.bt_nave_sal.Size = new System.Drawing.Size(33, 24); + this.bt_nave_sal.TabIndex = 18; + this.bt_nave_sal.UseVisualStyleBackColor = true; + this.bt_nave_sal.Click += new System.EventHandler(this.bt_nave_sal_Click); + // + // groupBox4 + // + this.groupBox4.BackColor = System.Drawing.SystemColors.Control; + this.groupBox4.Controls.Add(this.label18); + this.groupBox4.Controls.Add(this.textBox_traf); + this.groupBox4.Controls.Add(this.label15); + this.groupBox4.Controls.Add(this.dateTimePicker_h_inicio); + this.groupBox4.Controls.Add(this.label_t_inicio); + this.groupBox4.Controls.Add(this.label22); + this.groupBox4.Controls.Add(this.textBox_descar); + this.groupBox4.Controls.Add(this.label23); + this.groupBox4.Controls.Add(this.groupBox6); + this.groupBox4.Controls.Add(this.pictureBox3); + this.groupBox4.Controls.Add(this.label13); + this.groupBox4.Controls.Add(this.textBox_t_sal); + this.groupBox4.Controls.Add(this.label14); + this.groupBox4.Controls.Add(this.label_t_vac_seg); + this.groupBox4.Controls.Add(this.textBox_t_vaciado); + this.groupBox4.Controls.Add(this.label_t_vaciado); + this.groupBox4.ForeColor = System.Drawing.SystemColors.ControlText; + this.groupBox4.Location = new System.Drawing.Point(8, 508); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(659, 147); + this.groupBox4.TabIndex = 20; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Tiempos"; + // + // label18 + // + this.label18.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label18.Location = new System.Drawing.Point(365, 110); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(19, 18); + this.label18.TabIndex = 24; + this.toolTip1.SetToolTip(this.label18, "Porcentaje de tráfico que se estima en las vías. Si 100 el vehículo circulará a l" + + "a velocidad máxima permitida por la vía."); + // + // textBox_traf + // + this.textBox_traf.Location = new System.Drawing.Point(274, 109); + this.textBox_traf.Name = "textBox_traf"; + this.textBox_traf.Size = new System.Drawing.Size(81, 20); + this.textBox_traf.TabIndex = 23; + this.textBox_traf.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point(228, 112); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(40, 13); + this.label15.TabIndex = 22; + this.label15.Text = "Tráfico"; + // + // dateTimePicker_h_inicio + // + this.dateTimePicker_h_inicio.CustomFormat = "HH \'h\' mm \'m\'"; + this.dateTimePicker_h_inicio.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker_h_inicio.Location = new System.Drawing.Point(532, 108); + this.dateTimePicker_h_inicio.MaxDate = new System.DateTime(2017, 1, 2, 0, 0, 0, 0); + this.dateTimePicker_h_inicio.MinDate = new System.DateTime(2017, 1, 1, 0, 0, 0, 0); + this.dateTimePicker_h_inicio.Name = "dateTimePicker_h_inicio"; + this.dateTimePicker_h_inicio.ShowUpDown = true; + this.dateTimePicker_h_inicio.Size = new System.Drawing.Size(83, 20); + this.dateTimePicker_h_inicio.TabIndex = 21; + this.dateTimePicker_h_inicio.Value = new System.DateTime(2017, 1, 2, 0, 0, 0, 0); + // + // label_t_inicio + // + this.label_t_inicio.AutoSize = true; + this.label_t_inicio.Location = new System.Drawing.Point(416, 112); + this.label_t_inicio.Name = "label_t_inicio"; + this.label_t_inicio.Size = new System.Drawing.Size(110, 13); + this.label_t_inicio.TabIndex = 20; + this.label_t_inicio.Text = "Hora de inicio jornada"; + // + // label22 + // + this.label22.AutoSize = true; + this.label22.Location = new System.Drawing.Point(363, 81); + this.label22.Name = "label22"; + this.label22.Size = new System.Drawing.Size(23, 13); + this.label22.TabIndex = 19; + this.label22.Text = "min"; + // + // textBox_descar + // + this.textBox_descar.Location = new System.Drawing.Point(274, 77); + this.textBox_descar.Name = "textBox_descar"; + this.textBox_descar.Size = new System.Drawing.Size(83, 20); + this.textBox_descar.TabIndex = 18; + this.textBox_descar.Text = "20"; + this.textBox_descar.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // label23 + // + this.label23.AutoSize = true; + this.label23.Location = new System.Drawing.Point(136, 80); + this.label23.Name = "label23"; + this.label23.Size = new System.Drawing.Size(133, 13); + this.label23.TabIndex = 17; + this.label23.Text = "Tiempo descarga en plant."; + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.label12); + this.groupBox6.Controls.Add(this.label1); + this.groupBox6.Controls.Add(this.dateTimePicker_t_desc); + this.groupBox6.Controls.Add(this.label7); + this.groupBox6.Controls.Add(this.dateTimePicker_t_conv); + this.groupBox6.Controls.Add(this.label6); + this.groupBox6.Location = new System.Drawing.Point(404, 17); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(244, 81); + this.groupBox6.TabIndex = 11; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "Tiempos convenio"; + // + // label12 + // + this.label12.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label12.Location = new System.Drawing.Point(213, 51); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(25, 18); + this.label12.TabIndex = 12; + this.toolTip1.SetToolTip(this.label12, "El tiempo se reparte entre los puntos de control intermedios"); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label1.Location = new System.Drawing.Point(217, 62); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(0, 13); + this.label1.TabIndex = 11; + // + // dateTimePicker_t_desc + // + this.dateTimePicker_t_desc.CustomFormat = "HH \'h\' mm \'m\'"; + this.dateTimePicker_t_desc.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker_t_desc.Location = new System.Drawing.Point(128, 50); + this.dateTimePicker_t_desc.MaxDate = new System.DateTime(2017, 1, 2, 0, 0, 0, 0); + this.dateTimePicker_t_desc.MinDate = new System.DateTime(2017, 1, 1, 0, 0, 0, 0); + this.dateTimePicker_t_desc.Name = "dateTimePicker_t_desc"; + this.dateTimePicker_t_desc.ShowUpDown = true; + this.dateTimePicker_t_desc.Size = new System.Drawing.Size(83, 20); + this.dateTimePicker_t_desc.TabIndex = 10; + this.dateTimePicker_t_desc.Value = new System.DateTime(2017, 1, 1, 0, 30, 0, 0); + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(13, 53); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(109, 13); + this.label7.TabIndex = 9; + this.label7.Text = "T. descanso personal"; + // + // dateTimePicker_t_conv + // + this.dateTimePicker_t_conv.CustomFormat = "HH \'h\' mm \'m\'"; + this.dateTimePicker_t_conv.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker_t_conv.Location = new System.Drawing.Point(128, 21); + this.dateTimePicker_t_conv.MaxDate = new System.DateTime(2017, 1, 2, 0, 0, 0, 0); + this.dateTimePicker_t_conv.MinDate = new System.DateTime(2017, 1, 1, 0, 0, 0, 0); + this.dateTimePicker_t_conv.Name = "dateTimePicker_t_conv"; + this.dateTimePicker_t_conv.ShowUpDown = true; + this.dateTimePicker_t_conv.Size = new System.Drawing.Size(83, 20); + this.dateTimePicker_t_conv.TabIndex = 6; + this.dateTimePicker_t_conv.Value = new System.DateTime(2017, 1, 1, 8, 0, 0, 0); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(24, 24); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(99, 13); + this.label6.TabIndex = 5; + this.label6.Text = "T. trabajo convenio"; + // + // pictureBox3 + // + this.pictureBox3.Image = global::OliviaAddIn.Properties.Resources.sand; + this.pictureBox3.Location = new System.Drawing.Point(31, 19); + this.pictureBox3.Name = "pictureBox3"; + this.pictureBox3.Size = new System.Drawing.Size(89, 101); + this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox3.TabIndex = 0; + this.pictureBox3.TabStop = false; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(363, 51); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(23, 13); + this.label13.TabIndex = 15; + this.label13.Text = "min"; + // + // textBox_t_sal + // + this.textBox_t_sal.Location = new System.Drawing.Point(274, 48); + this.textBox_t_sal.Name = "textBox_t_sal"; + this.textBox_t_sal.Size = new System.Drawing.Size(83, 20); + this.textBox_t_sal.TabIndex = 14; + this.textBox_t_sal.Text = "5"; + this.textBox_t_sal.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(136, 51); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(133, 13); + this.label14.TabIndex = 13; + this.label14.Text = "Tiempo salida/llegada inst."; + // + // label_t_vac_seg + // + this.label_t_vac_seg.AutoSize = true; + this.label_t_vac_seg.Location = new System.Drawing.Point(363, 22); + this.label_t_vac_seg.Name = "label_t_vac_seg"; + this.label_t_vac_seg.Size = new System.Drawing.Size(24, 13); + this.label_t_vac_seg.TabIndex = 2; + this.label_t_vac_seg.Text = "seg"; + // + // textBox_t_vaciado + // + this.textBox_t_vaciado.Location = new System.Drawing.Point(274, 19); + this.textBox_t_vaciado.Name = "textBox_t_vaciado"; + this.textBox_t_vaciado.Size = new System.Drawing.Size(83, 20); + this.textBox_t_vaciado.TabIndex = 1; + this.textBox_t_vaciado.Text = "30"; + this.textBox_t_vaciado.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + // + // label_t_vaciado + // + this.label_t_vaciado.AutoSize = true; + this.label_t_vaciado.Location = new System.Drawing.Point(171, 22); + this.label_t_vaciado.Name = "label_t_vaciado"; + this.label_t_vaciado.Size = new System.Drawing.Size(98, 13); + this.label_t_vaciado.TabIndex = 0; + this.label_t_vaciado.Text = "Tiempo de vaciado"; + // + // groupBox7 + // + this.groupBox7.Controls.Add(this.pictureBox4); + this.groupBox7.Controls.Add(this.label5); + this.groupBox7.Controls.Add(this.checkBox_ajust_sec); + this.groupBox7.Controls.Add(this.checkBox_sector_autom); + this.groupBox7.Controls.Add(this.label17); + this.groupBox7.Controls.Add(this.numericUpDown_sectores); + this.groupBox7.Controls.Add(this.label16); + this.groupBox7.Controls.Add(this.numericUpDown_pctrl); + this.groupBox7.Controls.Add(this.label10); + this.groupBox7.Controls.Add(this.label9); + this.groupBox7.Location = new System.Drawing.Point(8, 407); + this.groupBox7.Name = "groupBox7"; + this.groupBox7.Size = new System.Drawing.Size(660, 102); + this.groupBox7.TabIndex = 23; + this.groupBox7.TabStop = false; + this.groupBox7.Text = "Control"; + // + // pictureBox4 + // + this.pictureBox4.Image = global::OliviaAddIn.Properties.Resources.Asset_tracking_and_management; + this.pictureBox4.InitialImage = null; + this.pictureBox4.Location = new System.Drawing.Point(12, 15); + this.pictureBox4.Name = "pictureBox4"; + this.pictureBox4.Size = new System.Drawing.Size(127, 80); + this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox4.TabIndex = 24; + this.pictureBox4.TabStop = false; + // + // label5 + // + this.label5.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label5.Location = new System.Drawing.Point(614, 59); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(25, 18); + this.label5.TabIndex = 23; + this.toolTip1.SetToolTip(this.label5, "Dado el número de sectores elegido, en vez de calcularlos para que tengan la mism" + + "a duración, se elgien los primeros ajustados a la jornada, y el último con el re" + + "sto de ámbitos"); + // + // checkBox_ajust_sec + // + this.checkBox_ajust_sec.AutoSize = true; + this.checkBox_ajust_sec.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; + this.checkBox_ajust_sec.Location = new System.Drawing.Point(459, 61); + this.checkBox_ajust_sec.Name = "checkBox_ajust_sec"; + this.checkBox_ajust_sec.Size = new System.Drawing.Size(148, 17); + this.checkBox_ajust_sec.TabIndex = 22; + this.checkBox_ajust_sec.Text = "Ajustar sectores a jornada"; + this.checkBox_ajust_sec.UseVisualStyleBackColor = true; + // + // checkBox_sector_autom + // + this.checkBox_sector_autom.AutoSize = true; + this.checkBox_sector_autom.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; + this.checkBox_sector_autom.Location = new System.Drawing.Point(221, 61); + this.checkBox_sector_autom.Name = "checkBox_sector_autom"; + this.checkBox_sector_autom.Size = new System.Drawing.Size(151, 17); + this.checkBox_sector_autom.TabIndex = 21; + this.checkBox_sector_autom.Text = "Nº de sectores automático"; + this.checkBox_sector_autom.UseVisualStyleBackColor = true; + this.checkBox_sector_autom.CheckedChanged += new System.EventHandler(this.checkBox_sector_autom_CheckedChanged); + // + // label17 + // + this.label17.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label17.Location = new System.Drawing.Point(376, 59); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(25, 18); + this.label17.TabIndex = 20; + this.toolTip1.SetToolTip(this.label17, "El programa calcula el número de sectores en base a los tiempos configurados de j" + + "ornada, etc."); + // + // numericUpDown_sectores + // + this.numericUpDown_sectores.Location = new System.Drawing.Point(547, 23); + this.numericUpDown_sectores.Maximum = new decimal(new int[] { + 50, + 0, + 0, + 0}); + this.numericUpDown_sectores.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDown_sectores.Name = "numericUpDown_sectores"; + this.numericUpDown_sectores.ReadOnly = true; + this.numericUpDown_sectores.Size = new System.Drawing.Size(60, 20); + this.numericUpDown_sectores.TabIndex = 17; + this.numericUpDown_sectores.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.numericUpDown_sectores.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(461, 27); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(77, 13); + this.label16.TabIndex = 16; + this.label16.Text = "Nº de sectores"; + // + // numericUpDown_pctrl + // + this.numericUpDown_pctrl.Location = new System.Drawing.Point(326, 23); + this.numericUpDown_pctrl.Maximum = new decimal(new int[] { + 50, + 0, + 0, + 0}); + this.numericUpDown_pctrl.Minimum = new decimal(new int[] { + 3, + 0, + 0, + 0}); + this.numericUpDown_pctrl.Name = "numericUpDown_pctrl"; + this.numericUpDown_pctrl.ReadOnly = true; + this.numericUpDown_pctrl.Size = new System.Drawing.Size(46, 20); + this.numericUpDown_pctrl.TabIndex = 12; + this.numericUpDown_pctrl.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.numericUpDown_pctrl.Value = new decimal(new int[] { + 3, + 0, + 0, + 0}); + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(223, 28); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(90, 13); + this.label10.TabIndex = 11; + this.label10.Text = "Puntos de control"; + // + // label9 + // + this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label9.ForeColor = System.Drawing.SystemColors.HotTrack; + this.label9.Image = global::OliviaAddIn.Properties.Resources.documentinfo; + this.label9.Location = new System.Drawing.Point(376, 24); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(25, 18); + this.label9.TabIndex = 5; + this.toolTip1.SetToolTip(this.label9, "Al menos son Inicio, Fin y Bocadillo, y se reparten equidistantes en la ruta"); + // + // checkBox_aislados + // + this.checkBox_aislados.AutoSize = true; + this.checkBox_aislados.Location = new System.Drawing.Point(252, 691); + this.checkBox_aislados.Name = "checkBox_aislados"; + this.checkBox_aislados.Size = new System.Drawing.Size(164, 17); + this.checkBox_aislados.TabIndex = 24; + this.checkBox_aislados.Text = "Descartar elementos aislados"; + this.checkBox_aislados.UseVisualStyleBackColor = true; + // + // btn_help + // + this.btn_help.Image = global::OliviaAddIn.Properties.Resources.system_help; + this.btn_help.Location = new System.Drawing.Point(13, 687); + this.btn_help.Name = "btn_help"; + this.btn_help.Size = new System.Drawing.Size(29, 23); + this.btn_help.TabIndex = 25; + this.btn_help.UseVisualStyleBackColor = true; + this.btn_help.Click += new System.EventHandler(this.btn_help_Click); + // + // bt_planifica + // + this.bt_planifica.Image = global::OliviaAddIn.Properties.Resources.plan; + this.bt_planifica.Location = new System.Drawing.Point(586, 682); + this.bt_planifica.Name = "bt_planifica"; + this.bt_planifica.Size = new System.Drawing.Size(110, 32); + this.bt_planifica.TabIndex = 22; + this.bt_planifica.Text = "Solo Planificar"; + this.bt_planifica.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.bt_planifica.UseVisualStyleBackColor = true; + this.bt_planifica.Click += new System.EventHandler(this.bt_planifica_Click); + // + // groupBox_edits + // + this.groupBox_edits.Controls.Add(this.groupBox1); + this.groupBox_edits.Controls.Add(this.groupBox2); + this.groupBox_edits.Controls.Add(this.groupBox3); + this.groupBox_edits.Controls.Add(this.groupBox7); + this.groupBox_edits.Controls.Add(this.groupBox4); + this.groupBox_edits.Location = new System.Drawing.Point(13, 12); + this.groupBox_edits.Name = "groupBox_edits"; + this.groupBox_edits.Size = new System.Drawing.Size(683, 664); + this.groupBox_edits.TabIndex = 26; + this.groupBox_edits.TabStop = false; + // + // button_eje + // + this.button_eje.Image = global::OliviaAddIn.Properties.Resources.play; + this.button_eje.Location = new System.Drawing.Point(439, 682); + this.button_eje.Name = "button_eje"; + this.button_eje.Size = new System.Drawing.Size(133, 32); + this.button_eje.TabIndex = 27; + this.button_eje.Text = "Sectorizar y Planificar"; + this.button_eje.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.button_eje.UseVisualStyleBackColor = true; + this.button_eje.Click += new System.EventHandler(this.button_eje_Click); + // + // textBox_buff + // + this.textBox_buff.Location = new System.Drawing.Point(532, 83); + this.textBox_buff.Name = "textBox_buff"; + this.textBox_buff.Size = new System.Drawing.Size(83, 20); + this.textBox_buff.TabIndex = 37; + // + // label26 + // + this.label26.AutoSize = true; + this.label26.Location = new System.Drawing.Point(453, 87); + this.label26.Name = "label26"; + this.label26.Size = new System.Drawing.Size(73, 13); + this.label26.TabIndex = 36; + this.label26.Text = "Buffer de exp."; + // + // label29 + // + this.label29.AutoSize = true; + this.label29.Location = new System.Drawing.Point(628, 87); + this.label29.Name = "label29"; + this.label29.Size = new System.Drawing.Size(15, 13); + this.label29.TabIndex = 35; + this.label29.Text = "m"; + // + // RecogidaDlg + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScroll = true; + this.ClientSize = new System.Drawing.Size(704, 722); + this.Controls.Add(this.button_eje); + this.Controls.Add(this.groupBox_edits); + this.Controls.Add(this.btn_help); + this.Controls.Add(this.checkBox_aislados); + this.Controls.Add(this.bt_planifica); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.Name = "RecogidaDlg"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "OLIVIA | Recogida de Residuos"; + this.TopMost = true; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.RecogidaDlg_FormClosed); + this.groupBox1.ResumeLayout(false); + this.groupBox_tiporeco.ResumeLayout(false); + this.groupBox_tiporeco.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox_sens.ResumeLayout(false); + this.groupBox_sens.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + this.groupBox6.ResumeLayout(false); + this.groupBox6.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); + this.groupBox7.ResumeLayout(false); + this.groupBox7.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_sectores)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_pctrl)).EndInit(); + this.groupBox_edits.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button button_edit_camp; + private System.Windows.Forms.Label label_dat_entrada; + private System.Windows.Forms.Button button_dat_entrada; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.Label instal_sel; + private System.Windows.Forms.Button bt_nave_sal; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.DateTimePicker dateTimePicker_t_desc; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.DateTimePicker dateTimePicker_t_conv; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.PictureBox pictureBox3; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.TextBox textBox_t_sal; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label label_t_vac_seg; + private System.Windows.Forms.TextBox textBox_t_vaciado; + private System.Windows.Forms.Label label_t_vaciado; + private System.Windows.Forms.Button bt_capa_zonas; + private System.Windows.Forms.Label lbl_capa_zona; + private System.Windows.Forms.Label lbl_pto_descarg; + private System.Windows.Forms.Button button_pto_desc; + private System.Windows.Forms.Label lbl_capa_restricc; + private System.Windows.Forms.Button button_cap_restricc; + private System.Windows.Forms.PictureBox pictureBox2; + private System.Windows.Forms.Button bt_planifica; + private System.Windows.Forms.Label label22; + private System.Windows.Forms.TextBox textBox_descar; + private System.Windows.Forms.Label label23; + private System.Windows.Forms.GroupBox groupBox7; + private System.Windows.Forms.PictureBox pictureBox4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.CheckBox checkBox_ajust_sec; + private System.Windows.Forms.CheckBox checkBox_sector_autom; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.NumericUpDown numericUpDown_sectores; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.CheckBox checkBox_sens; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.Label label20; + private System.Windows.Forms.TextBox textBox_carga_max; + private System.Windows.Forms.GroupBox groupBox_tiporeco; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label21; + private System.Windows.Forms.TextBox textBox_kgmax; + private System.Windows.Forms.ComboBox comboBox_capac; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.ComboBox comboBox_vehic; + private System.Windows.Forms.ComboBox comboBox_carga; + private System.Windows.Forms.ComboBox comboBox_fraccion; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.PictureBox pictureBox5; + private System.Windows.Forms.TextBox textBox_url; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.GroupBox groupBox_sens; + private System.Windows.Forms.Label lbl_turno; + private System.Windows.Forms.Button button_capa_turno; + private System.Windows.Forms.DateTimePicker dateTimePicker_h_inicio; + private System.Windows.Forms.Label label_t_inicio; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ToolTip toolTip1; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.TextBox textBox_dens_cont; + private System.Windows.Forms.Label label_dens_cont; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.TextBox textBox_traf; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Button btn_edit_camp_sensor; + private System.Windows.Forms.Button btn_csv; + private System.Windows.Forms.CheckBox checkBox_aislados; + private System.Windows.Forms.Label label24; + private System.Windows.Forms.Button btn_help; + private System.Windows.Forms.ComboBox comboBox_lateralidad; + private System.Windows.Forms.GroupBox groupBox_edits; + private System.Windows.Forms.Label label28; + private System.Windows.Forms.Label label27; + private System.Windows.Forms.Label label25; + private System.Windows.Forms.NumericUpDown numericUpDown_pctrl; + private System.Windows.Forms.Button button_eje; + private System.Windows.Forms.TextBox textBox_buff; + private System.Windows.Forms.Label label26; + private System.Windows.Forms.Label label29; + } +} \ No newline at end of file diff --git a/OliviaAddIn/RecogidaDlg.cs b/OliviaAddIn/RecogidaDlg.cs new file mode 100644 index 0000000..d26e5dd --- /dev/null +++ b/OliviaAddIn/RecogidaDlg.cs @@ -0,0 +1,1234 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Net.Sockets; +using System.IO; +using System.Diagnostics; + +using ESRI.ArcGIS.Geodatabase; +using ESRI.ArcGIS.DataSourcesGDB; +using ESRI.ArcGIS.Geometry; + +namespace OliviaAddIn +{ + /** + * @file RecogidaDlg.cs + * Clase de la ventana de configuración de la herramienta de Recogida de Residuos. + * Contiene el manejo de sus eventos como el Click o la actualización de su estado. + */ + /** + * Clase de la ventana de configuración de la herramienta de Recogida de Residuos. + * Contiene el manejo de sus eventos como el Click o la actualización de su estado. + */ + public partial class RecogidaDlg : Form + { + //************************************************************************************* + //Variables + + /** + * Instancia que contiene las variables de la clase + */ + public Recogida reco = null; + /** + * Variable para indicar los errores que pueden ir surgiendo + */ + string err_str = null; + //************************************************************************************* + //Constructor + public RecogidaDlg() + { + InitializeComponent(); + reco = new Recogida(); + inicia(); + } + //************************************************************************************* + //Métodos + + /** + * Inicia los elementos de la ventana, rellenando los textos y los combos + */ + private void inicia() + { + try + { + checkBox_sens.Enabled = false; + checkBox_sens.Checked = false; + groupBox_tiporeco.Enabled = false; + button_edit_camp.Enabled = false; + + //se habilita la posibilidad de pintar los items con gris y con negro + comboBox_fraccion.DrawMode = DrawMode.OwnerDrawFixed; + comboBox_carga.DrawMode = DrawMode.OwnerDrawFixed; + + //inicia los tiempos + inicia_timepickers(); + //rellena el factor de tráfico + textBox_traf.Text = reco.trafico.ToString(); + + textBox_dens_cont.Visible = false; + label_dens_cont.Visible = false; + //se reinicia los arrays de fracciones y tipos de carga por si ya se hubiera realizado algún proceso de recogida de residuos. + if ((RecogidaDef.tipos_fracc_str.Length > (int)RecogidaDef.TiposFracción.N - 1) || (RecogidaDef.tipos_carg_str.Length > (int)RecogidaDef.TiposCarga.N - 1)) + { + System.Array.Resize(ref RecogidaDef.tipos_fracc_str, (int)RecogidaDef.TiposFracción.N - 1); + System.Array.Resize(ref RecogidaDef.tipos_carg_str, (int)RecogidaDef.TiposCarga.N - 1); + } + numericUpDown_sectores.Value = reco.n_secdef; + + ///////////////////////////////////////////////// + //pone los textos iniciales + instal_sel.Text = reco.text_selec_instal; + lbl_pto_descarg.Text = reco.text_selec_descarg; + lbl_turno.Text = reco.text_selec_turno; + lbl_capa_restricc.Text = reco.text_selec_rest; + lbl_capa_zona.Text = reco.text_selec_zonas; + + reco.rec_capac = RecogidaDef.campos_def.cons_capac; + reco.rec_uds = RecogidaDef.campos_def.cons_uds; + reco.rec_kg = RecogidaDef.campos_def.cons_kgrec; + textBox_buff.Text = OliviaGlob.buff_export.ToString(); + + if (RecogidaDef.lleno) + { + reco.rec_kgrec_cont = -1; + } + else if (RecogidaDef.kgrec_camp) + { + reco.rec_kgrec_cont = 0; + } + else + { + reco.rec_kgrec_cont = RecogidaDef.kgrec_cont; + } + + } + catch (Exception) + { + MessageBox.Show("Error al iniciar la ventana de Recogida", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + /** + * Inicializa los controles de los tiempos + */ + public void inicia_timepickers() + { + int[] hm; + DateTime tmin = new DateTime(2017, 01, 01, 0, 0, 0); + DateTime tmax = new DateTime(2017, 01, 02, 0, 0, 0); + + //t convenio + hm = OliviaGlob.dame_h_m(reco.t_conv); + dateTimePicker_t_conv.MinDate = tmin; + dateTimePicker_t_conv.MaxDate = tmax; + dateTimePicker_t_conv.Value = new DateTime(2017, 01, 01, hm[0], hm[1], 0); + + //t descanso del personal + hm = OliviaGlob.dame_h_m(reco.t_descan); + dateTimePicker_t_desc.MinDate = tmin; + dateTimePicker_t_desc.MaxDate = tmax; + dateTimePicker_t_desc.Value = new DateTime(2017, 01, 01, hm[0], hm[1], 0); + + //hora de inicio de la jornada + hm = OliviaGlob.dame_h_m(reco.h_ini); + dateTimePicker_h_inicio.MinDate = tmin; + dateTimePicker_h_inicio.MaxDate = tmax; + dateTimePicker_h_inicio.Value = new DateTime(2017, 01, 01, hm[0], hm[1], 0); + } + + /** + * Rellena la lista de capacidades de vehículos disponibles + */ + private void rellena_capac() + { + if (reco.tipo_vehic >= 0 && reco.tipo_vehic < (int)RecogidaDef.TiposVehic.N && + reco.tipo_carg >= 0 && reco.tipo_carg < (int)RecogidaDef.TiposCarga.N) + { + comboBox_capac.Items.Clear(); + textBox_kgmax.Text = ""; + if (reco.cargas_max_vehic[reco.tipo_carg, reco.tipo_vehic].n > 0) + { + for (int i = 0; i < reco.cargas_max_vehic[reco.tipo_carg, reco.tipo_vehic].n; i++) + comboBox_capac.Items.Add(reco.cargas_max_vehic[reco.tipo_carg, reco.tipo_vehic].vol[i] + " m3"); + } + } + + else if (reco.tipo_vehic >= 0 && reco.tipo_vehic < (int)RecogidaDef.TiposVehic.N && + reco.tipo_carg >= (int)RecogidaDef.TiposCarga.N) + { + comboBox_capac.Items.Clear(); + textBox_kgmax.Text = ""; + if (reco.cargas_max_vehic[(int)RecogidaDef.TiposCarga.Otra, reco.tipo_vehic].n > 0) + { + for (int i = 0; i < reco.cargas_max_vehic[(int)RecogidaDef.TiposCarga.Otra, reco.tipo_vehic].n; i++) + comboBox_capac.Items.Add(reco.cargas_max_vehic[(int)RecogidaDef.TiposCarga.Otra, reco.tipo_vehic].vol[i] + " m3"); + } + } + } + + /** + * Rellena la caja de texto con la capacidad en kg máxima del vehículo seleccionado + */ + private void rellena_kgmax() + { + int kgmax,off; + + if (reco.tipo_vehic >= 0 && reco.tipo_vehic < (int)RecogidaDef.TiposVehic.N && + reco.tipo_carg >= 0 && reco.tipo_carg < (int)RecogidaDef.TiposCarga.N && + reco.tipo_capa >= 0 && reco.tipo_capa < (int)reco.cargas_max_vehic[reco.tipo_carg, reco.tipo_vehic].n) + { + if ((reco.cargas_max_vehic[reco.tipo_carg, reco.tipo_vehic].offset != null) && (reco.tipo_frac < (int)RecogidaDef.TiposFracción.N)) + off = reco.cargas_max_vehic[reco.tipo_carg, reco.tipo_vehic].offset[reco.tipo_capa,reco.tipo_frac]; + else if ((reco.cargas_max_vehic[reco.tipo_carg, reco.tipo_vehic].offset != null) && (reco.tipo_frac >= (int)RecogidaDef.TiposFracción.N)) + off = reco.cargas_max_vehic[reco.tipo_carg, reco.tipo_vehic].offset[reco.tipo_capa, (int)RecogidaDef.TiposFracción.Otra]; + else + off = 0; + if (reco.tipo_frac < (int)RecogidaDef.TiposFracción.N) + kgmax = reco.cargas_max_vehic[reco.tipo_carg, reco.tipo_vehic].vol[reco.tipo_capa] * RecogidaDef.dens_frac_cami[reco.tipo_frac] + off; + else + kgmax = reco.cargas_max_vehic[reco.tipo_carg, reco.tipo_vehic].vol[reco.tipo_capa] * RecogidaDef.dens_frac_cami[(int)RecogidaDef.TiposFracción.Otra] + off; + textBox_kgmax.Text = kgmax.ToString(); + } + + else if (reco.tipo_vehic >= 0 && reco.tipo_vehic < (int)RecogidaDef.TiposVehic.N && + reco.tipo_carg >= (int)RecogidaDef.TiposCarga.N && + reco.tipo_capa >= 0 && reco.tipo_capa < (int)reco.cargas_max_vehic[(int)RecogidaDef.TiposCarga.Otra, reco.tipo_vehic].n) + { + if ((reco.cargas_max_vehic[(int)RecogidaDef.TiposCarga.Otra, reco.tipo_vehic].offset != null) && (reco.tipo_frac < (int)RecogidaDef.TiposFracción.N)) + off = reco.cargas_max_vehic[(int)RecogidaDef.TiposCarga.Otra, reco.tipo_vehic].offset[reco.tipo_capa, reco.tipo_frac]; + else if ((reco.cargas_max_vehic[(int)RecogidaDef.TiposCarga.Otra, reco.tipo_vehic].offset != null) && (reco.tipo_frac >= (int)RecogidaDef.TiposFracción.N)) + off = reco.cargas_max_vehic[(int)RecogidaDef.TiposCarga.Otra, reco.tipo_vehic].offset[reco.tipo_capa, (int)RecogidaDef.TiposFracción.Otra]; + else + off = 0; + if (reco.tipo_frac < (int)RecogidaDef.TiposFracción.N) + kgmax = reco.cargas_max_vehic[(int)RecogidaDef.TiposCarga.Otra, reco.tipo_vehic].vol[reco.tipo_capa] * RecogidaDef.dens_frac_cami[reco.tipo_frac] + off; + else + kgmax = reco.cargas_max_vehic[(int)RecogidaDef.TiposCarga.Otra, reco.tipo_vehic].vol[reco.tipo_capa] * RecogidaDef.dens_frac_cami[(int)RecogidaDef.TiposFracción.Otra] + off; + textBox_kgmax.Text = kgmax.ToString(); + } + } + + /** + * Lee los datos seleccionados en el diálogo + */ + private bool lee() + { + int ind; + int[] hm = { 0, 0 }; + string aux = null; + + //////////////////////////////////////////////// + reco.rellena_simbol_rec(); + reco.rellena_simb_tipbasura(); + //se rellena el array de filtros + RecogidaDef.filtro_str = new string[RecogidaDef.tipos_fracc_str.Length + RecogidaDef.tipos_carg_str.Length]; + for (int i = 0; i < RecogidaDef.tipos_fracc_str.Length; i++) + { + //se comprueba que tipo de fracción se ha seleccionado. Si se ha seleccionado una fracción sin nombre (el campo en la capa es NULL, y en el comboBox de fracciiones aparece como "-") hay que modificar el filtro + if (RecogidaDef.tipos_fracc_str[i] == "-") + RecogidaDef.filtro_str[i] = RecogidaDef.campos_def.cons_fracc + " IS NULL"; + else + RecogidaDef.filtro_str[i] = RecogidaDef.campos_def.cons_fracc + "= '" + RecogidaDef.tipos_fracc_str[i] + "'"; + } + for (int i = RecogidaDef.tipos_fracc_str.Length; i < RecogidaDef.filtro_str.Length; i++) + { + RecogidaDef.filtro_str[i] = RecogidaDef.campos_def.cons_nomrec + "= '" + RecogidaDef.tipos_carg_str[i - RecogidaDef.tipos_fracc_str.Length] + "'"; + } + + reco.tipo_frac = comboBox_fraccion.SelectedIndex; + if (reco.tipo_frac == -1) + { + err_str = "No se ha seleccionado ningún Tipo de Fracción"; + return false; + } + if (reco.tipo_frac >= (int)RecogidaDef.TiposFracción.N - 1) + OliviaGlob.gdb_reco.fra_otra = RecogidaDef.tipos_fracc_str[reco.tipo_frac]; + + //si se ha seleccionado que se recogen los contenedores llenos hay que comprobar que se ha rellenado la densidad de los contenedores + if (RecogidaDef.lleno /*&& textBox_dens_cont.Visible == true*/) + { + try + { + reco.dens_cont = Convert.ToDouble(textBox_dens_cont.Text); + if (reco.dens_cont <= 0 || reco.dens_cont>100) + { + err_str = "El valor introducido para la densidad del contenedor no es válido."; + return false; + } + } + catch (Exception) + { + err_str = "El formato introducido para la densidad del contenedor no es válido."; + return false; + } + } + else + reco.dens_cont = -1; + + + reco.tipo_carg = comboBox_carga.SelectedIndex; + if (reco.tipo_carg == -1) + { + err_str = "No se ha seleccionado ningún Tipo de Carga"; + return false; + } + if (reco.tipo_carg >= (int)RecogidaDef.TiposCarga.N - 1) + { + OliviaGlob.gdb_reco.carg_otra = RecogidaDef.tipos_carg_str[reco.tipo_carg]; + } + if (comboBox_lateralidad.Visible == true) + { + reco.lateralidad = comboBox_lateralidad.SelectedIndex; + if (reco.lateralidad == -1) + { + err_str = "No se ha seleccionado ningún Tipo de Lateralidad"; + return false; + } + } + reco.tipo_vehic = comboBox_vehic.SelectedIndex; + if (reco.tipo_vehic == -1) + { + err_str = "No se ha seleccionado ningún Tipo de Vehículo"; + return false; + } + + reco.giro_vehic = RecogidaDef.giro_vehic[reco.tipo_vehic]; + + //a la hora de leer la capacidad hay que tener en cuenta que cuando se selecciona una carga no contemplada en la enumeracion RecogidaDef.TiposCarga, es decir, + //>= a RecogidaDef.TiposCarga.Otra no hay que leer la capacidad porque se deshanbilita al no tener información de densidades, etc + if (reco.tipo_carg < (int)RecogidaDef.TiposCarga.N - 1) + { + reco.tipo_capa = comboBox_capac.SelectedIndex; + if (reco.tipo_capa == -1) + { + err_str = "No se ha seleccionado ningún Tipo de Capacidad"; + return false; + } + } + + //se verifica que se haya seleccionado una capa de instalación de llegada y salida. + if ((reco.coords_instala[0] == 0) && (reco.coords_instala[1] == 0)) + { + err_str = "No se ha seleccionado ninguna capa de Instalación de salida y llegada."; + return false; + } + + //se verifica que se ha seleccionado una capa de lugar de descarga de los vehículos. + if ((reco.coords_descarg[0] == 0) && (reco.coords_descarg[1] == 0)) + { + err_str = "No se ha seleccionado ninguna capa de Instalación de descarga de los vehículos."; + return false; + } + + //recoge la carga máxima del vehículo que se ha configurado + try + { + reco.carg_max_vehic = Convert.ToInt32(textBox_kgmax.Text); + if ((reco.carg_max_vehic <= 0) || (reco.carg_max_vehic > RecogidaDef.Parametros.kgmaxM) || (reco.carg_max_vehic < RecogidaDef.Parametros.kgmaxm)) + { + err_str = "El valor introducido para la carga máxima del vehículo no es válido."; + return false; + } + } + catch (Exception) + { + err_str = "El formato introducido para la carga máxima del vehículo no es válido."; + return false; + } + + //recoge el porcentaje de tráfico que se estima en las vías + try + { + reco.trafico = Convert.ToDouble(textBox_traf.Text); + if ((reco.trafico < 0) || (reco.trafico > 100)) + { + err_str = "El valor introducido para el procentaje de tráfico en las vías no es válido."; + return false; + } + } + catch (Exception) + { + err_str = "El formato introducido para el procentaje de tráfico en las vías no es válido."; + return false; + } + + //lee el buffer de exportación + try + { + OliviaGlob.buff_export = Convert.ToInt32(textBox_buff.Text); + if ((OliviaGlob.buff_export < 0) || (OliviaGlob.buff_export > 10000)) + { + err_str = "El buffer de exportación no está dentro de los límites configurados"; + return false; + } + } + catch (Exception) + { + err_str = "El formato introducido para el buffer de exportación no es válido."; + return false; + } + + //lee la información de los sensores + if (checkBox_sens.Checked == true) + { + if (groupBox_sens.Enabled == true ) + { + try + { + if (textBox_url.Text != "") + { + //se lee la url de los sensores si el chekbox se encuentra habilitado + ind = textBox_url.Text.IndexOf("/"); + if (textBox_url.Text.StartsWith("http")) + { + aux = textBox_url.Text.Substring(ind + 2); + ind = aux.IndexOf("/"); + aux = aux.Substring(0, ind); + } + else + aux = textBox_url.Text.Substring(0, ind); + if ((aux == "") || (aux.StartsWith("http")) || (aux.Contains("/")) || (aux.Contains(" "))) + { + err_str = "No se ha introducido una URL correcta"; + return false; + } + RecogidaDef.campos.cons_url_sens = textBox_url.Text; + reco.url_sens = RecogidaDef.campos.cons_url_sens; + //se comprueba que se ha escrito un URL y uq esta es correcta + TcpClient tcpClientB = new TcpClient(); + try + { + tcpClientB.Connect(aux, 80); + } + catch (Exception e) + { + err_str = "Error al generar la conexión: " + e.Message; + //por si geofoto sí funciona la conexión + } + } + //se lee la carga maxima indicada en la caja de texto + reco.carga_max = Convert.ToInt32(textBox_carga_max.Text); + if ((reco.carga_max <= 0) || (reco.carga_max > RecogidaDef.Parametros.carga_maxM) || (reco.carga_max < RecogidaDef.Parametros.carga_maxm)) + { + err_str = "No se ha introducido un valor correcto para el umbral de recogida de basuras"; + return false; + } + } + catch (FormatException) + { + err_str = "Error al leer los datos referentes a los umbrales de carga para recoger los contendores."; + return false; + } + } + else + { + err_str = "Si se quiere recibir información externa, hay que se seleccionar si proviene de sensores o de csv."; + return false; + } + } + + //se lee el número de puntos de control + reco.n_ptsctrl = (int)numericUpDown_pctrl.Value; + if (reco.n_ptsctrl == 0) + { + err_str = "No puede haber 0 puntos de control."; + return false; + } + + //se lee el número de sectores si se ha puesto algún valor + if (checkBox_sector_autom.Checked == true) + reco.n_secdef = 0; + else + { + reco.n_secdef = (int)numericUpDown_sectores.Value; + if (checkBox_ajust_sec.Checked == true) + reco.n_secdef = reco.n_secdef * (-1);//lo envía negativo si es modo ajusta a jornada, + } + + //recoge el tiempo de vaciado que se ha configurado + try + { + reco.t_vaci = Convert.ToInt32(textBox_t_vaciado.Text); + if ((reco.t_vaci <= 0) || (reco.t_vaci > RecogidaDef.Parametros.t_vaciM) || (reco.t_vaci < RecogidaDef.Parametros.t_vacim)) + { + err_str = "El valor introducido para el tiempo de vaciado no es válido."; + return false; + } + } + catch (FormatException) + { + err_str = "El formato introducido para el tiempo de vaciado no es válido."; + return false; + } + + //lee el tiempo en llegar a las instalaciones o en salir y llegar al destino de trabajo + try + { + reco.t_despl_insta = Convert.ToInt32(textBox_t_sal.Text); + if ((reco.t_despl_insta <= 0) || (reco.t_despl_insta > RecogidaDef.Parametros.t_llegsalM) || (reco.t_despl_insta < RecogidaDef.Parametros.t_llegsalm)) + { + err_str = "El valor introducido para el tiempo de desplazamiento a la instalación no es válido."; + return false; + } + } + catch (FormatException) + { + err_str = "El formato introducido para el tiempo de desplazamiento a la instalación no es válido."; + return false; + } + + //recoge invertido en descargar el vehículo lleno de residuos en la planta + try + { + reco.t_descarg = Convert.ToInt32(textBox_descar.Text); + if ((reco.t_descarg <= 0) || (reco.t_descarg > RecogidaDef.Parametros.t_descM) || (reco.t_descarg < RecogidaDef.Parametros.t_descm)) + { + err_str = "El valor introducido para el tiempo de descarga no es válido."; + return false; + } + } + catch (FormatException) + { + err_str = "El formato introducido para el tiempo de descarga no es válido."; + return false; + } + + //lee el tiempo de trabajo al día por convenio + hm[0] = dateTimePicker_t_conv.Value.Hour; + hm[1] = dateTimePicker_t_conv.Value.Minute; + reco.t_conv = OliviaGlob.dame_min(hm); + if ((reco.t_conv == 0) || (reco.t_conv > RecogidaDef.Parametros.t_convM) || (reco.t_conv < RecogidaDef.Parametros.t_convm)) + { + err_str = "El formato o valor introducido para el tiempo de trabajo por convenio no es válido."; + return false; + } + + //lee el tiempo de descanso del personal + hm[0] = dateTimePicker_t_desc.Value.Hour; + hm[1] = dateTimePicker_t_desc.Value.Minute; + reco.t_descan = OliviaGlob.dame_min(hm); + if ((reco.t_descan == 0) || (reco.t_descan > RecogidaDef.Parametros.t_descansoM) || (reco.t_descan < RecogidaDef.Parametros.t_descansom)) + { + err_str = "El formato o valor introducido para el tiempo de descanso no es válido."; + return false; + } + + //lee la hora de inicio de la jornada + hm[0] = dateTimePicker_h_inicio.Value.Hour; + hm[1] = dateTimePicker_h_inicio.Value.Minute; + reco.h_ini = OliviaGlob.dame_min(hm); + + //lee si se va a tener en cuenta los elementos asilados o no + if (checkBox_aislados.Checked == true) + reco.aislados = 1; + else + reco.aislados = 0; + + return true; + } + + //************************************************************************************* + //Eventos de ventana + private void comboBox_carga_SelectedIndexChanged(object sender, EventArgs e) + { + try + { + reco.tipo_carg = comboBox_carga.SelectedIndex; + if (comboBox_carga.SelectedIndex == -1) + { + reco.tipo_carg = -1; + return; + } + if (!reco.tipos_carg_bool[reco.tipo_carg]) + { + comboBox_fraccion.SelectedIndex = -1; + return; + } + if (comboBox_carga.SelectedIndex == (int)RecogidaDef.TiposCarga.Lateral) + comboBox_lateralidad.Visible = true; + else + comboBox_lateralidad.Visible = false; + if (reco.tipo_carg >= 0 && reco.tipo_carg < (int)RecogidaDef.TiposCarga.N - 1) + { + //cuando se selecciona una carga contemplada en el listado origianl se habilita el comboBox de capacidad ya que sí habrá contemplado datos para tipos de cargas conocidos. + comboBox_capac.Enabled = true; + textBox_t_vaciado.Text = RecogidaDef.t_vaci[reco.tipo_carg].ToString(); + if (reco.tipo_vehic >= 0) + { + //si también se ha seleccionado tipo de vehículo, se rellena la lista de capacidades + rellena_capac(); + } + } + else if (reco.tipo_carg >= (int)RecogidaDef.TiposCarga.N - 1) + { + //cuando se selecciona una carga no contemplada en el listado original se deshabilita el comboBox de capacidad porque no tendrá datos contemplado para ese caso + comboBox_capac.Enabled = false; + textBox_t_vaciado.Text = RecogidaDef.t_vaci[(int)RecogidaDef.TiposCarga.Otra].ToString(); + if (reco.tipo_vehic >= 0) + { + //si también se ha seleccionado tipo de vehículo, se rellena la lista de capacidades + rellena_capac(); + } + } + } + catch (Exception) + { + MessageBox.Show("Error al seleccionar la carga", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void comboBox_vehic_SelectedIndexChanged(object sender, EventArgs e) + { + try + { + reco.tipo_vehic = comboBox_vehic.SelectedIndex; + if (reco.tipo_carg >= 0) + { + //si también se ha seleccionado tipo de carga, se rellena la lista de capacidades + rellena_capac(); + } + } + catch (Exception) + { + MessageBox.Show("Error al seleccionar el tipo de vehículo", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void comboBox_capac_SelectedIndexChanged(object sender, EventArgs e) + { + try + { + reco.tipo_capa = comboBox_capac.SelectedIndex; + rellena_kgmax(); + } + catch (Exception) + { + MessageBox.Show("Error al seleccionar la capacidad", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void bt_planifica_Click(object sender, EventArgs e) + { + Hide(); + + if (!ejecuta((int)Ejecuta.ModosEjec.Planif)) + { + MessageBox.Show("Error al comenzar la ejecución: " + err_str, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + OliviaGlob.borra_files(); + Show(); + } + } + + private void button_eje_Click(object sender, EventArgs e) + { + Hide(); + + if (!ejecuta((int)Ejecuta.ModosEjec.SoloPlanif)) + { + MessageBox.Show("Error al comenzar la ejecución: " + err_str, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + OliviaGlob.borra_files(); + Show(); + } + } + + /* + * Comienza la ejecución, secto o planif + */ + private bool ejecuta(int modo) + { + ProgresoInic pro_inic = null; + try + { + err_str = ""; + OliviaGlob.gdb_reco.err_st = ""; + + button_eje.Enabled = bt_planifica.Enabled = false; + + //lee el dialogo de limpieza para recoger los parámetros que intervienen en el cálculo de la planificación + if (!lee()) + { + return false; + } + + pro_inic = new ProgresoInic(); + pro_inic.Show(); + + EjecutaReco eje_reco = new EjecutaReco(); + if (!eje_reco.ejec(reco, modo)) + { + pro_inic.Close(); + err_str = eje_reco.err_str; + return false; + } + pro_inic.Close(); + return true; + } + catch (Exception) + { + if (pro_inic != null) + pro_inic.Close(); + return false; + } + finally + { + button_eje.Enabled = bt_planifica.Enabled = true; + } + } + + private void comboBox_fraccion_SelectedIndexChanged(object sender, EventArgs e) + { + try + { + //cuando se selecciona un item pintado en gris (que no existe en la GDB) se actúa como si no se hubiera seleccionado item + reco.tipo_frac = comboBox_fraccion.SelectedIndex; + if (comboBox_fraccion.SelectedIndex == -1) + { + reco.tipo_frac = -1; + return; + } + if (!reco.tipos_fracc_bool[reco.tipo_frac]) + { + comboBox_fraccion.SelectedIndex = -1; + return; + } + if ((reco.tipo_vehic >= 0) && (reco.tipo_carg >= 0)) + { + //si también se ha seleccionado tipo de carga y de vehículo, se rellena la lista de capacidades + rellena_capac(); + } + if (RecogidaDef.lleno) + { + if (reco.tipo_frac < (int)RecogidaDef.TiposFracción.Otra) + { + textBox_dens_cont.Text = RecogidaDef.dens_frac_cont[reco.tipo_frac].ToString(); + } + else + { + textBox_dens_cont.Text = ""; + } + } + } + catch (Exception) + { + MessageBox.Show("Error al seleccionar el tipo de fracción", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void button_edit_camp_Click(object sender, EventArgs e) + { + try + { + RecoCampos camps = new RecoCampos(reco); + if (camps.ShowDialog() == DialogResult.OK) + { + click_edit_camps_sin_show(); + button_leer_tbl_Click(null, null); + } + } + catch (Exception) + { + MessageBox.Show("Error al editar los campos de la capa de recogida de residuos", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void click_edit_camps_sin_show() + { + groupBox_tiporeco.Enabled = false; + textBox_dens_cont.Text = ""; + textBox_dens_cont.Visible = false; + checkBox_sens.Enabled = true; + if (RecogidaDef.lleno == true) + { + if (checkBox_sens.Checked == true) + { + checkBox_sens.Checked = false; + } + checkBox_sens.Enabled = true; + } + else + { + if (checkBox_sens.Checked == true) + { + checkBox_sens.Checked = false; + } + checkBox_sens.Enabled = false; + btn_csv.Enabled = false; + btn_edit_camp_sensor.Enabled = false; + } + comboBox_fraccion.Items.Clear(); + comboBox_carga.Items.Clear(); + comboBox_vehic.Items.Clear(); + comboBox_capac.Items.Clear(); + comboBox_lateralidad.Items.Clear(); + comboBox_lateralidad.Visible = false; + textBox_kgmax.Text = ""; + } + + private void checkBox_sens_CheckedChanged(object sender, EventArgs e) + { + if (checkBox_sens.Checked == true) + { + btn_edit_camp_sensor.Enabled = checkBox_sens.Checked; + btn_csv.Enabled = checkBox_sens.Checked; + groupBox_sens.Enabled = checkBox_sens.Checked; + textBox_url.Enabled = false; + textBox_carga_max.Enabled = checkBox_sens.Checked; + label20.Enabled = checkBox_sens.Checked; + textBox_url.Text = ""; + } + else + { + btn_edit_camp_sensor.Enabled = checkBox_sens.Checked; + btn_csv.Enabled = checkBox_sens.Checked; + groupBox_sens.Enabled = checkBox_sens.Checked; + textBox_carga_max.Enabled = checkBox_sens.Checked; + label20.Enabled = checkBox_sens.Checked; + textBox_url.Text = ""; + } + } + + private void RecogidaDlg_FormClosed(object sender, FormClosedEventArgs e) + { + OliviaGlob.borra_files(); + OliviaGlob.inidlg.Cursor = Cursors.Default; + OliviaGlob.inidlg.Show(); + } + + private void comboBox_capac_DropDown(object sender, EventArgs e) + { + if (comboBox_capac.Items.Count == 0) + toolTip1.Show("No hay información de capacidad para ese tipo de vehículo y ese tipo de carga", comboBox_capac); + } + + private void comboBox_capac_DropDownClosed(object sender, EventArgs e) + { + if (comboBox_capac.Items.Count == 0) + toolTip1.Hide(comboBox_capac); + } + + /* + * Lee en la capa seleccionada, a partir de los campos configurados el dialogo de editar campos, aquellos tipos de de basura (FRACCION), el tipo de carga y elt ipo de vehúclo. + * De modo que sólo muestra en los desplegables correspondientes los datos existentes en la capa. + */ + private void button_leer_tbl_Click(object sender, EventArgs e) + { + try + { + //se borra el listado que pudiera estar ya puesto para evitar duplicados + comboBox_capac.Items.Clear(); + comboBox_carga.Items.Clear(); + comboBox_fraccion.Items.Clear(); + comboBox_lateralidad.Items.Clear(); + comboBox_vehic.Items.Clear(); + comboBox_lateralidad.Visible = false; + + //leer los campos de la tabla... si todo va bien: existe la tabla y los campos que se han editado + if (!OliviaGlob.gdb_reco.lee_capa_recogida(reco)) + { + err_str = reco.err_st; + MessageBox.Show(err_str, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + //se rellena el array que se incorpora al desplegable relacionado con el tipo de basura + OliviaGlob.gdb_reco.lee_frac_gdb(reco); + + //se rellena el array que se incorpora al desplegable relacionado con el tipo de carga + if (!OliviaGlob.gdb_reco.lee_tipocarga_gdb(reco)) + { + MessageBox.Show("Error al leer los tipos de carga en la capa seleccionada", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + //se rellena los desplegables relacionados con el tipo de contenedor (FRACCION) y desde dónde se recogen (tipo de carga) + comboBox_fraccion.Items.AddRange(RecogidaDef.tipos_fracc_str); + comboBox_carga.Items.AddRange(RecogidaDef.tipos_carg_str); + comboBox_vehic.Items.AddRange(RecogidaDef.tipos_vehic_str); + comboBox_lateralidad.Items.AddRange(RecogidaDef.tipos_lateralidad); + + //si se pasa la verificación de la lectura + groupBox_tiporeco.Enabled = true; + if (RecogidaDef.lleno) + { + textBox_dens_cont.Visible = true; + label_dens_cont.Visible = true; + } + else + { + textBox_dens_cont.Visible = false; + label_dens_cont.Visible = false; + } + //se eliminan los datos que pudiera haber ya introducidos en la zona de sensores y datos externos de CSV + groupBox_sens.Enabled = false; + textBox_url.Enabled = false; + label24.Enabled = false; + textBox_carga_max.Enabled = false; + label20.Enabled = false; + textBox_url.Text = ""; + } + catch (Exception) + { + MessageBox.Show("Error al leer la capa seleccionada", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + /* + * Permite seleccionar la capa sobre la que se van a extraer los datos para el cálculo de la recogida de basuras. + */ + private void button_dat_entrada_Click(object sender, EventArgs e) + { + string path_recogida; + IFeatureClass fc; + + try + { + RecogidaDef.filtro_str = null; + + //se despliega el dialogo para seleccionar ua capa de la que se recogerán los datos de la recogida. + path_recogida = FunGDB.selec_ftcls("Seleccionar datos de entrada para la recogida de residuos", this.Handle.ToInt32()); + + if (path_recogida == null) + { + err_str = "No se ha seleccionado ninguna capa para la recogida de residuos"; + MessageBox.Show(err_str, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + label_dat_entrada.Text = "Seleccionar Datos de entrada ..."; + + //Si se ha seleccionado unos datos de entrada que existen y todo ok, true, si no, false + button_edit_camp.Enabled = false; + groupBox_tiporeco.Enabled = false; + textBox_dens_cont.Visible = false; + label_dens_cont.Visible = false; + comboBox_fraccion.Items.Clear(); + comboBox_carga.Items.Clear(); + comboBox_vehic.Items.Clear(); + comboBox_capac.Items.Clear(); + comboBox_lateralidad.Items.Clear(); + comboBox_lateralidad.Visible = false; + textBox_kgmax.Text = ""; + groupBox_sens.Enabled = false; + textBox_url.Enabled = false; + label24.Enabled = false; + textBox_carga_max.Enabled = false; + label20.Enabled = false; + textBox_url.Text = ""; + + return; + } + + //guarda el path completo de la clase + OliviaGlob.gdb_reco.path_class = path_recogida; + + //se comprueba que la capa seleccionada sea de puntos + fc = FunGDB.abre_ftclass(OliviaGlob.gdb_reco.path_class); + if (fc==null || !FunGDB.is_ftclass_punt(fc)) + { + MessageBox.Show("La capa seleccionada debe contener elementos puntuales.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + FunGDB.libera(fc); + return; + } + + //Si se ha seleccionado unos datos de entrada que existen y todo ok, true, si no, false + label_dat_entrada.Text = System.IO.Path.GetFileNameWithoutExtension(path_recogida); + button_edit_camp.Enabled = true; + groupBox_tiporeco.Enabled = false; + textBox_dens_cont.Visible = false; + label_dens_cont.Visible = false; + comboBox_fraccion.Items.Clear(); + comboBox_carga.Items.Clear(); + comboBox_vehic.Items.Clear(); + comboBox_capac.Items.Clear(); + textBox_kgmax.Text = ""; + groupBox_sens.Enabled = false; + textBox_url.Enabled = false; + label24.Enabled = false; + textBox_carga_max.Enabled = false; + label20.Enabled = false; + textBox_url.Text = ""; + + //se manda click a los campos y leer tabla + click_edit_camps_sin_show(); + button_leer_tbl_Click(null, null); + } + catch (Exception) + { + MessageBox.Show("Error al abrir la capa de recogida de residuos.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void checkBox_sector_autom_CheckedChanged(object sender, EventArgs e) + { + numericUpDown_sectores.Enabled = checkBox_ajust_sec.Enabled = !checkBox_sector_autom.Checked; + } + + /** + * Para añadir una capa de zonas, en el cálculo de la sectorización, diferente a la existente en la GDB seleccionada al comienzo de la aplicación. + */ + private void bt_capa_zonas_Click(object sender, EventArgs e) + { + string text_sal; + Hide();//esconde el dialogo + if (reco.selec_polig("Seleccionar capa de zonas", this.Handle.ToInt32(), out text_sal, out reco.geom_zonas)) + { + lbl_capa_zona.Text = text_sal; + reco.text_zon = text_sal; + } + else + { + lbl_capa_zona.Text = reco.text_selec_zonas; + reco.text_zon = ""; + } + Show(); + } + + /** + * Para añadir una capa de instalaciones, en el cálculo de la sectorización. De modo que se conozca la ubicación de la instalación a la que tendrán que ir los camiones a descargar. + */ + private void bt_nave_sal_Click(object sender, EventArgs e) + { + string text_sal; + Hide();//esconde el dialogo + if (reco.selec_instal("Seleccionar capa de instalaciones de salida/llegada", this.Handle.ToInt32(), out text_sal, + out reco.coords_instala[0], out reco.coords_instala[1])) + instal_sel.Text = text_sal; + else + instal_sel.Text = reco.text_selec_instal; + Show(); + } + + /** + * Se aplican restricciones de acceso a la circulación en determinados polígonos, + * dependiendo del tipo de vehículo + */ + private void button_cap_restricc_Click(object sender, EventArgs e) + { + string text_sal; + Hide();//esconde el dialogo + if (reco.selec_polig("Seleccionar capa de restricciones de acceso", this.Handle.ToInt32(), out text_sal, out reco.geom_rest_acces)) + { + lbl_capa_restricc.Text = text_sal; + reco.text_restr = text_sal; + } + else + { + lbl_capa_restricc.Text = reco.text_selec_rest; + reco.text_restr = ""; + } + Show(); + } + + /* + * Seleccionada una capa se selecciona el lugar donde se va a descargar y se guardan las coordenadas del punto. + */ + private void button_pto_desc_Click(object sender, EventArgs e) + { + string text_sal; + Hide();//esconde el dialogo + if (reco.selec_instal("Seleccionar capa de instalaciones de descarga", this.Handle.ToInt32(), out text_sal, + out reco.coords_descarg[0], out reco.coords_descarg[1])) + lbl_pto_descarg.Text = text_sal; + else + lbl_pto_descarg.Text = reco.text_selec_descarg; + Show(); + } + + /* + * Se aplica capapara restricciones por zonificación en función de los turnos + */ + private void button_capa_turno_Click(object sender, EventArgs e) + { + string text_sal; + Hide();//esconde el dialogo + if (reco.selec_polig("Seleccionar capa de zonificación por turnos", this.Handle.ToInt32(), out text_sal, out reco.geom_turnos)) + { + lbl_turno.Text = text_sal; + reco.text_turnos = text_sal; + } + else + { + lbl_turno.Text = reco.text_selec_turno; + reco.text_turnos = ""; + } + Show(); + } + + /* + * Se van a colorear en gris aquellos items que no se encuentran en la GDB y en negro los que sí se han encontrado. + */ + private void comboBox_fraccion_DrawItem(object sender, DrawItemEventArgs e) + { + Font myFont = new Font("Arial", 10, FontStyle.Regular); + int items = comboBox_fraccion.Items.Count; + if (e.Index >= 0 && items != 0) + { + if (!reco.tipos_fracc_bool[e.Index])//si no se ha encontrado en la GDB se pinta de gris clarito + { + e.Graphics.DrawString(comboBox_fraccion.Items[e.Index].ToString(), e.Font, Brushes.LightGray, e.Bounds); + } + else + { + e.Graphics.DrawString(comboBox_fraccion.Items[e.Index].ToString(), e.Font, Brushes.Black, e.Bounds); + } + } + } + + /* + * Se van a colorear en gris aquellos items que no se encuentran en la GDB y en negro los que sí se han encontrado. + */ + private void comboBox_carga_DrawItem(object sender, DrawItemEventArgs e) + { + Font myFont = new Font("Arial", 10, FontStyle.Regular); + int items = comboBox_carga.Items.Count; + if (e.Index >= 0 && items != 0) + { + if (!reco.tipos_carg_bool[e.Index])//si no se ha encontrado en la GDB se pinta de gris clarito + { + e.Graphics.DrawString(comboBox_carga.Items[e.Index].ToString(), e.Font, Brushes.LightGray, e.Bounds); + } + else + { + e.Graphics.DrawString(comboBox_carga.Items[e.Index].ToString(), e.Font, Brushes.Black, e.Bounds); + } + } + } + + /** + * Abre una ventana para la selección de las fechas que se quieren consultar en la URL marcada, donde se recogerán los datos de los sensores. + */ + private void btn_edit_camp_sensor_Click(object sender, EventArgs e) + { + try + { + SensCampos camps = new SensCampos(reco); + camps.ShowDialog(); + if (camps.acept == true) + { + groupBox_sens.Enabled = true; + textBox_url.Enabled = true; + label24.Enabled = true; + textBox_carga_max.Enabled = true; + label20.Enabled = true; + textBox_url.Text = RecogidaDef.campos.cons_url_sens; + } + else + { + groupBox_sens.Enabled = false; + textBox_url.Enabled = false; + label24.Enabled = false; + textBox_carga_max.Enabled = false; + label20.Enabled = false; + textBox_url.Text = ""; + } + } + catch (Exception) + { + MessageBox.Show("Error con la ventana de edición de los campos para la lectura de sensores.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + /** + * Abre un diálogo para seleccionar el CSV del que se leerán los datos de carga de los contenedores a partir de los campos marcados que deberán existir en el CSV + */ + private void btn_csv_Click(object sender, EventArgs e) + { + try + { + DatosCsv csv = new DatosCsv(reco); + csv.ShowDialog(); + if (csv.acept == true) + { + groupBox_sens.Enabled = true; + reco.rec_kgrec_cont = 0; + textBox_carga_max.Enabled = true; + label20.Enabled = true; + textBox_url.Text = ""; + textBox_url.Enabled = false; + label24.Enabled = false; + } + else + { + groupBox_sens.Enabled = false; + reco.rec_kgrec_cont = -1; + textBox_carga_max.Enabled = false; + label20.Enabled = false; + textBox_url.Text = ""; + textBox_url.Enabled = false; + label24.Enabled = false; + } + } + catch (Exception) + { + MessageBox.Show("Error con la ventana de edición de los campos para la lectura de datos a partir de un CSV.", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + /** + * Cuando se picnha en el botón de ayuda se abre el manual de Olivia + */ + private void btn_help_Click(object sender, EventArgs e) + { + string[] archivos; + + try + { + archivos = Directory.GetFiles(OliviaGlob.Paths.PathWork, OliviaGlob.manual + ".pdf"); + if (archivos.Length <= 0) + MessageBox.Show("No se encuentra el archivo " + OliviaGlob.manual + ".pdf en la ubicación " + OliviaGlob.Paths.PathWork, "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + + foreach (string f in archivos) + { + Process.Start(f); + } + } + catch (Exception) + { + MessageBox.Show("Error al abrir el manual de ayuda " + OliviaGlob.manual + ".pdf", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + private void comboBox_lateralidad_SelectedIndexChanged(object sender, EventArgs e) + { + try + { + reco.lateralidad = comboBox_lateralidad.SelectedIndex; + if (reco.lateralidad < 0) + { + MessageBox.Show("Hay que seleccionar un tipo de lateralidad para la carga", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + catch (Exception) + { + MessageBox.Show("Error al seleccionar el tipo lateralidad de la carga del vehículo", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + /*revisar borrar + * private void RecogidaDlg_VisibleChanged(object sender, EventArgs e) + { + if (OliviaGlob.estado == TiposEstado.FinPlanif) + { + groupBox_edits.Enabled = false; + bt_planifica.Enabled = true; + checkBox_aislados.Enabled = false; + Show(); + } + }*/ + + } +} diff --git a/OliviaAddIn/RecogidaDlg.resx b/OliviaAddIn/RecogidaDlg.resx new file mode 100644 index 0000000..11363b4 --- /dev/null +++ b/OliviaAddIn/RecogidaDlg.resx @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAAbrQAAG60AXJX/ekAAAAGYktHRAD/AP8A/6C9p5MAAAAHdElNRQfZChYNADoI871E + AAAB00lEQVQ4T5WTPUhbYRiFPydRyCAZpC5C61ZwsZZYROjStQ4OhUxdFbsVBFtQIxUnWxqcSurQodok + GIyBRkHJD4lRkkL9ixeE0Egh9FZrWwuae4/vuTT1h9yiBw4f3Pd53nzkclUlDofDKccNaZNNG6U1Uts0 + wyaGYSCZTM4J0yK9uOT+mAbXsIbbgxpZM5VKIZPJgGcloVDIOuOJRFgU3uYsruH88UbxCGu7vyzofEzT + tM5CoWCdzLv0T7QP7aDDo4E/ru6N5E8iuX3MpHULqHYDn8+HQCCAcDgMs/wH89l9xDYP0TGSlwWefPnD + yje8jZX+4mep3OByyPrFEddaYPhX9H8Lqt3g8jOyAXGsBZ2jmhn5dIBpeXDVkKUjLtTNviU4H0fhdM+i + 9tE86t0fUWdTzsiQpUNX3eqPnbwIlfBkclXexG9EPx9iwaackSFLh65qfZouD7zfQ9fAMoIZHd5oCZM2 + 5YwMWTp01d1nWeO5/yu6PQlEct/lD9IxFa9ezsiQpUNXdXnWjZdRHb3eVSS2DxDf+oGYTTkjQ5YOXfVg + fNsMZo/wZvELJoIbeDW79d+SIUuHrurxFvDwdRHdXnbvii1aDl1+Dg3SNumda1Yc1XAKo6KvDnHu2l4A + AAAASUVORK5CYII= + + + + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA + AAD///8B////Af///wH///8BOoFqBTqBamE6gWq9OoFq7zqBapU6gWq9OoFqvzqBamM6gWoF////Af// + /wH///8B////Af///wH///8BOoFqJTqBatE6gWr/OoFq/zqBav86gWqTOoFq9TqBav86gWr/OoFq0zqB + ain///8B////Af///wH///8BOoFqJTqBaus6gWr/OoFq/zqBav86gWr9OoFqqzqBauk6gWr9OoFq/zqB + av86gWrrOoFqJ////wH///8BOoFqAzqBas86gWr7OoFqzTqBaqk6gWqtOoFqYzqBask6gWpJOoFqXTqB + ass6gWr7OoFq/zqBatE6gWoF////ATqBalc6gWrpOoFq4zqBap86gWoNOoFqCzqBanM6gWrROoFqqzqB + ajk6gWoNOoFqezqBavk6gWr/OoFqW////wE6gWq1OoFqpTqBats6gWp7OoFqOzqBahs6gWrxOoFq8zqB + av86gWqVOoFqFTqBanM6gWqJOoFq0TqBarf///8BOoFq6zqBal86gWqFOoFqezqBais6gWpHOoFq8TqB + av86gWr/OoFqdTqBaj86gWopOoFqhTqBask6gWqF////ATqBauM6gWo1OoFqHzqBamX///8BOoFqiTqB + av86gWrhOoFq/zqBal////8BOoFqYTqBaok6gWrhOoFq/////wE6gWpFOoFqFzqBakU6gWov////ATqB + apk6gWr/OoFq8TqBav86gWrbOoFqE////wE6gWpVOoFqtzqBapv///8BOoFqeTqBaos6gWpj////Af// + /wE6gWpXOoFq+zqBav86gWr/OoFq3TqBahE6gWozOoFqiTqBauU6gWol////ATqBaj86gWoV////Af// + /wH///8BOoFqfTqBaus6gWr3OoFq9zqBajs6gWo7OoFqczqBat86gWphOoFqA////wH///8B////Af// + /wH///8B////ATqBapM6gWr/OoFq/zqBav86gWpbOoFqSTqBatM6gWqVOoFqeTqBahP///8B////Af// + /wH///8B////Af///wE6gWofOoFq1zqBav86gWr/OoFqff///wH///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////ATqBark6gWr/OoFqwzqBagf///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wE6gWo3OoFq6zqBaiP///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// + /wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//w== + + + \ No newline at end of file diff --git a/OliviaAddIn/SensCampos.Designer.cs b/OliviaAddIn/SensCampos.Designer.cs new file mode 100644 index 0000000..d1a9cd5 --- /dev/null +++ b/OliviaAddIn/SensCampos.Designer.cs @@ -0,0 +1,161 @@ +namespace OliviaAddIn +{ + partial class SensCampos + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SensCampos)); + this.btn_acept = new System.Windows.Forms.Button(); + this.dateTimePicker_ini = new System.Windows.Forms.DateTimePicker(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox_id = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.comboBox_media = new System.Windows.Forms.ComboBox(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.dateTimePicker_fin = new System.Windows.Forms.DateTimePicker(); + this.SuspendLayout(); + // + // btn_acept + // + this.btn_acept.Location = new System.Drawing.Point(63, 227); + this.btn_acept.Name = "btn_acept"; + this.btn_acept.Size = new System.Drawing.Size(75, 23); + this.btn_acept.TabIndex = 2; + this.btn_acept.Text = "Aceptar"; + this.btn_acept.UseVisualStyleBackColor = true; + this.btn_acept.Click += new System.EventHandler(this.btn_acept_Click); + // + // dateTimePicker_ini + // + this.dateTimePicker_ini.CustomFormat = "dd/MM/yyyy - HH:mm:ss"; + this.dateTimePicker_ini.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker_ini.Location = new System.Drawing.Point(21, 132); + this.dateTimePicker_ini.Name = "dateTimePicker_ini"; + this.dateTimePicker_ini.Size = new System.Drawing.Size(156, 20); + this.dateTimePicker_ini.TabIndex = 3; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(13, 34); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(54, 13); + this.label1.TabIndex = 4; + this.label1.Text = "Campo ID"; + // + // textBox_id + // + this.textBox_id.Location = new System.Drawing.Point(79, 31); + this.textBox_id.Name = "textBox_id"; + this.textBox_id.Size = new System.Drawing.Size(100, 20); + this.textBox_id.TabIndex = 5; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(16, 75); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(36, 13); + this.label2.TabIndex = 6; + this.label2.Text = "Media"; + // + // comboBox_media + // + this.comboBox_media.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox_media.Location = new System.Drawing.Point(79, 72); + this.comboBox_media.Name = "comboBox_media"; + this.comboBox_media.Size = new System.Drawing.Size(100, 21); + this.comboBox_media.TabIndex = 7; + this.comboBox_media.SelectedIndexChanged += new System.EventHandler(this.comboBox_media_SelectedIndexChanged); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(16, 113); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(68, 13); + this.label3.TabIndex = 8; + this.label3.Text = "Fecha Inicio:"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(16, 159); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(65, 13); + this.label4.TabIndex = 9; + this.label4.Text = "Fecha Final:"; + // + // dateTimePicker_fin + // + this.dateTimePicker_fin.CustomFormat = "dd/MM/yyyy - HH:mm:ss"; + this.dateTimePicker_fin.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker_fin.Location = new System.Drawing.Point(21, 176); + this.dateTimePicker_fin.Name = "dateTimePicker_fin"; + this.dateTimePicker_fin.Size = new System.Drawing.Size(156, 20); + this.dateTimePicker_fin.TabIndex = 10; + // + // SensCampos + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(199, 262); + this.Controls.Add(this.dateTimePicker_fin); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.comboBox_media); + this.Controls.Add(this.label2); + this.Controls.Add(this.textBox_id); + this.Controls.Add(this.label1); + this.Controls.Add(this.dateTimePicker_ini); + this.Controls.Add(this.btn_acept); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "SensCampos"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Sensor"; + this.TopMost = true; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SensCampos_FormClosed); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button btn_acept; + private System.Windows.Forms.DateTimePicker dateTimePicker_ini; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox_id; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ComboBox comboBox_media; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.DateTimePicker dateTimePicker_fin; + } +} \ No newline at end of file diff --git a/OliviaAddIn/SensCampos.cs b/OliviaAddIn/SensCampos.cs new file mode 100644 index 0000000..bebae27 --- /dev/null +++ b/OliviaAddIn/SensCampos.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace OliviaAddIn +{ + public partial class SensCampos : Form + { + /** + * @file SensCampos.cs + * Archivo de la clase ventana para la edición de los campos a leer en los datos recibidos por los sensores + */ + /** + * Clase ventana para la edición de los campos a leer cuando se van a recoger los contenedores en funciónde del porcentaje de llenado recogidos por los sensores. + */ + /** + * Clase para la estructura de propiedades + */ + Recogida reco = null; + string id; + string[] combo = new string[] { "No", "Si" }; + DateTime f_ini, f_fin; + public bool acept = false; + + //////////////////////////////////////////////////// + public SensCampos(Recogida reco) + { + try + { + InitializeComponent(); + reinicia(); + textBox_id.Enabled = false; + comboBox_media.Items.AddRange(combo); + dateTimePicker_fin.Enabled = false; + this.reco = reco; + } + catch (Exception) + { + MessageBox.Show("Error al iniciar la ventana de campos de los Sensores", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void reinicia() + { + id = RecogidaDef.campos_def.cons_id;//se pone el mismo ID que se ha puesto en el dialogo de editar Campos para la capa de recogida + + RecogidaDef.campos.fecha_sens = DateTime.Now - DateTime.Now.TimeOfDay; + f_ini = RecogidaDef.campos.fecha_sens; + + RecogidaDef.campos.fechaf_sens = DateTime.Now; + f_fin = RecogidaDef.campos.fechaf_sens; + + //se rellenan los datos en el dialogo + textBox_id.Text = id; + + dateTimePicker_ini.Value = f_ini; + dateTimePicker_ini.MinDate = new DateTime(0001, 01, 01, 00, 00, 00); + dateTimePicker_ini.MaxDate = new DateTime(2050, 01, 01, 00, 00, 00); + + dateTimePicker_fin.Value = f_fin; + dateTimePicker_fin.MinDate = new DateTime(0001, 01, 01, 00, 00, 00); + dateTimePicker_fin.MaxDate = new DateTime(2050, 01, 01, 00, 00, 00); + } + + private void button_reset_Click(object sender, EventArgs e) + { + try + { + reinicia(); + } + catch (Exception) + { + MessageBox.Show("Error al resetear", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + /* + * Se validan los campos modificados y se guarda en memoria los nombres de los nuevos campos. + * También se guardará en el archivo .INI una vez se vaya a ejecutar el proceso. + */ + private void btn_acept_Click(object sender, EventArgs e) + { + try + { + acept = true; + reco.id_sens = RecogidaDef.campos.cons_id_sens = RecogidaDef.campos_def.cons_id; + + f_ini = dateTimePicker_ini.Value; + if (dateTimePicker_fin.Enabled == true) + f_fin = dateTimePicker_fin.Value; + + RecogidaDef.campos.fecha_sens = f_ini; + if (comboBox_media.SelectedIndex == 1) + { + RecogidaDef.campos.fechaf_sens = f_fin; + reco.media = 1; + } + else if (comboBox_media.SelectedIndex == 0) + { + RecogidaDef.campos.fecha_sens = RecogidaDef.campos.fecha_sens.AddHours(-1); + RecogidaDef.campos.fechaf_sens = f_ini.AddSeconds(1); + reco.media = 0; + } + else + { + MessageBox.Show("Hay que seleccionar si se requiere hacer la media de fechas", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + reco.media = -1; + return; + } + RecogidaDef.campos.cons_fecha_sens = RecogidaDef.campos.fecha_sens.ToString("yyyy-MM-dd") + "T" + RecogidaDef.campos.fecha_sens.ToString("HH:mm:ss"); + reco.fecha_sens = RecogidaDef.campos.cons_fecha_sens; + reco.fecha_sens = reco.fecha_sens.Replace(":", "%%3A00"); + RecogidaDef.campos.cons_fechaf_sens = RecogidaDef.campos.fechaf_sens.ToString("yyyy-MM-dd") + "T" + RecogidaDef.campos.fechaf_sens.ToString("HH:mm:ss"); + reco.fechaf_sens = RecogidaDef.campos.cons_fechaf_sens; + reco.fechaf_sens = reco.fechaf_sens.Replace(":", "%%3A00"); + + Close(); + } + catch (Exception) + { + MessageBox.Show("Error al validar los datos instroducidos en la ventana de Sensores", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void comboBox_media_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBox_media.SelectedIndex == 1) + dateTimePicker_fin.Enabled = true; + else if (comboBox_media.SelectedIndex == 0) + dateTimePicker_fin.Enabled = false; + else + MessageBox.Show("Hay que seleccionar si se requiere hacer la media de fechas", "Olivia", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + private void SensCampos_FormClosed(object sender, FormClosedEventArgs e) + { + if (acept == false) + { + reco.id_sens = null; + reco.fecha_sens = null; + reco.fechaf_sens = null; + } + } + } +} diff --git a/OliviaAddIn/SensCampos.resx b/OliviaAddIn/SensCampos.resx new file mode 100644 index 0000000..1bb292f --- /dev/null +++ b/OliviaAddIn/SensCampos.resx @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA + AAD///8B////Af///wH///8BOoFqBTqBamE6gWq9OoFq7zqBapU6gWq9OoFqvzqBamM6gWoF////Af// + /wH///8B////Af///wH///8BOoFqJTqBatE6gWr/OoFq/zqBav86gWqTOoFq9TqBav86gWr/OoFq0zqB + ain///8B////Af///wH///8BOoFqJTqBaus6gWr/OoFq/zqBav86gWr9OoFqqzqBauk6gWr9OoFq/zqB + av86gWrrOoFqJ////wH///8BOoFqAzqBas86gWr7OoFqzTqBaqk6gWqtOoFqYzqBask6gWpJOoFqXTqB + ass6gWr7OoFq/zqBatE6gWoF////ATqBalc6gWrpOoFq4zqBap86gWoNOoFqCzqBanM6gWrROoFqqzqB + ajk6gWoNOoFqezqBavk6gWr/OoFqW////wE6gWq1OoFqpTqBats6gWp7OoFqOzqBahs6gWrxOoFq8zqB + av86gWqVOoFqFTqBanM6gWqJOoFq0TqBarf///8BOoFq6zqBal86gWqFOoFqezqBais6gWpHOoFq8TqB + av86gWr/OoFqdTqBaj86gWopOoFqhTqBask6gWqF////ATqBauM6gWo1OoFqHzqBamX///8BOoFqiTqB + av86gWrhOoFq/zqBal////8BOoFqYTqBaok6gWrhOoFq/////wE6gWpFOoFqFzqBakU6gWov////ATqB + apk6gWr/OoFq8TqBav86gWrbOoFqE////wE6gWpVOoFqtzqBapv///8BOoFqeTqBaos6gWpj////Af// + /wE6gWpXOoFq+zqBav86gWr/OoFq3TqBahE6gWozOoFqiTqBauU6gWol////ATqBaj86gWoV////Af// + /wH///8BOoFqfTqBaus6gWr3OoFq9zqBajs6gWo7OoFqczqBat86gWphOoFqA////wH///8B////Af// + /wH///8B////ATqBapM6gWr/OoFq/zqBav86gWpbOoFqSTqBatM6gWqVOoFqeTqBahP///8B////Af// + /wH///8B////Af///wE6gWofOoFq1zqBav86gWr/OoFqff///wH///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////ATqBark6gWr/OoFqwzqBagf///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wE6gWo3OoFq6zqBaiP///8B////Af///wH///8B////Af// + /wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af///wH///8B////Af// + /wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA + //8AAP//AAD//w== + + + \ No newline at end of file diff --git a/OliviaAddIn/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/OliviaAddIn/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..dd8c047 Binary files /dev/null and b/OliviaAddIn/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.DatosCsv.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.DatosCsv.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.DatosCsv.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.EditTxtPlant.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.EditTxtPlant.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.EditTxtPlant.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.FormCampos.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.FormCampos.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.FormCampos.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.InicioDlg.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.InicioDlg.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.InicioDlg.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.LimpCampos.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.LimpCampos.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.LimpCampos.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.LimpiezaDlg.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.LimpiezaDlg.resources new file mode 100644 index 0000000..55a4ccd Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.LimpiezaDlg.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.LimpiezaDlg.yo-NG.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.LimpiezaDlg.yo-NG.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.LimpiezaDlg.yo-NG.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.ListCapasMaqueta.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.ListCapasMaqueta.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.ListCapasMaqueta.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.ListForm.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.ListForm.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.ListForm.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.ProgresoEjec.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.ProgresoEjec.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.ProgresoEjec.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.ProgresoInic.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.ProgresoInic.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.ProgresoInic.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.Properties.Resources.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.Properties.Resources.resources new file mode 100644 index 0000000..778fd79 Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.Properties.Resources.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.RecoCampos.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.RecoCampos.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.RecoCampos.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.RecogidaDlg.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.RecogidaDlg.resources new file mode 100644 index 0000000..4397ca3 Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.RecogidaDlg.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.SensCampos.resources b/OliviaAddIn/obj/Debug/OliviaAddIn.SensCampos.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.SensCampos.resources differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.csproj.FileListAbsolute.txt b/OliviaAddIn/obj/Debug/OliviaAddIn.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..dee8ff5 --- /dev/null +++ b/OliviaAddIn/obj/Debug/OliviaAddIn.csproj.FileListAbsolute.txt @@ -0,0 +1,27 @@ +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Debug\OliviaAddIn.dll +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Debug\OliviaAddIn.pdb +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Debug\yo-NG\OliviaAddIn.resources.dll +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Debug\OliviaDef.dll +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Debug\SisNetBase.dll +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Debug\OliviaDef.pdb +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.csprojResolveAssemblyReference.cache +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.FormCampos.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.DatosCsv.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.EditTxtPlant.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.InicioDlg.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.LimpCampos.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.LimpiezaDlg.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.ListCapasMaqueta.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.ListForm.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.ProgresoEjec.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.ProgresoInic.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.Properties.Resources.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.RecoCampos.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.RecogidaDlg.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.SensCampos.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.LimpiezaDlg.yo-NG.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.csproj.GenerateResource.Cache +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\yo-NG\OliviaAddIn.resources.dll +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.dll +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Debug\OliviaAddIn.pdb +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Debug\OliviaAddIn.esriAddIn diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.csproj.GenerateResource.Cache b/OliviaAddIn/obj/Debug/OliviaAddIn.csproj.GenerateResource.Cache new file mode 100644 index 0000000..aa1de71 Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.csproj.GenerateResource.Cache differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.csprojResolveAssemblyReference.cache b/OliviaAddIn/obj/Debug/OliviaAddIn.csprojResolveAssemblyReference.cache new file mode 100644 index 0000000..0f5b336 Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.csprojResolveAssemblyReference.cache differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.dll b/OliviaAddIn/obj/Debug/OliviaAddIn.dll new file mode 100644 index 0000000..3502328 Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.dll differ diff --git a/OliviaAddIn/obj/Debug/OliviaAddIn.pdb b/OliviaAddIn/obj/Debug/OliviaAddIn.pdb new file mode 100644 index 0000000..41ef464 Binary files /dev/null and b/OliviaAddIn/obj/Debug/OliviaAddIn.pdb differ diff --git a/OliviaAddIn/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll b/OliviaAddIn/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll new file mode 100644 index 0000000..2eeeda0 Binary files /dev/null and b/OliviaAddIn/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/OliviaAddIn/obj/Debug/esriAddIn/AddInID.txt b/OliviaAddIn/obj/Debug/esriAddIn/AddInID.txt new file mode 100644 index 0000000..c974550 --- /dev/null +++ b/OliviaAddIn/obj/Debug/esriAddIn/AddInID.txt @@ -0,0 +1 @@ +{0718b3b3-5422-4d80-97ad-f72b18a3e476} diff --git a/OliviaAddIn/obj/Debug/yo-NG/OliviaAddIn.resources.dll b/OliviaAddIn/obj/Debug/yo-NG/OliviaAddIn.resources.dll new file mode 100644 index 0000000..c3c9af9 Binary files /dev/null and b/OliviaAddIn/obj/Debug/yo-NG/OliviaAddIn.resources.dll differ diff --git a/OliviaAddIn/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache b/OliviaAddIn/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..760952c Binary files /dev/null and b/OliviaAddIn/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.DatosCsv.resources b/OliviaAddIn/obj/Release/OliviaAddIn.DatosCsv.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.DatosCsv.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.EditTxtPlant.resources b/OliviaAddIn/obj/Release/OliviaAddIn.EditTxtPlant.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.EditTxtPlant.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.FormCampos.resources b/OliviaAddIn/obj/Release/OliviaAddIn.FormCampos.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.FormCampos.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.InicioDlg.resources b/OliviaAddIn/obj/Release/OliviaAddIn.InicioDlg.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.InicioDlg.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.LimpCampos.resources b/OliviaAddIn/obj/Release/OliviaAddIn.LimpCampos.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.LimpCampos.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.LimpiezaDlg.resources b/OliviaAddIn/obj/Release/OliviaAddIn.LimpiezaDlg.resources new file mode 100644 index 0000000..55a4ccd Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.LimpiezaDlg.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.LimpiezaDlg.yo-NG.resources b/OliviaAddIn/obj/Release/OliviaAddIn.LimpiezaDlg.yo-NG.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.LimpiezaDlg.yo-NG.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.ListCapasMaqueta.resources b/OliviaAddIn/obj/Release/OliviaAddIn.ListCapasMaqueta.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.ListCapasMaqueta.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.ListForm.resources b/OliviaAddIn/obj/Release/OliviaAddIn.ListForm.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.ListForm.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.ProgresoEjec.resources b/OliviaAddIn/obj/Release/OliviaAddIn.ProgresoEjec.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.ProgresoEjec.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.ProgresoInic.resources b/OliviaAddIn/obj/Release/OliviaAddIn.ProgresoInic.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.ProgresoInic.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.Properties.Resources.resources b/OliviaAddIn/obj/Release/OliviaAddIn.Properties.Resources.resources new file mode 100644 index 0000000..778fd79 Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.Properties.Resources.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.RecoCampos.resources b/OliviaAddIn/obj/Release/OliviaAddIn.RecoCampos.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.RecoCampos.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.RecogidaDlg.resources b/OliviaAddIn/obj/Release/OliviaAddIn.RecogidaDlg.resources new file mode 100644 index 0000000..4397ca3 Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.RecogidaDlg.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.SensCampos.resources b/OliviaAddIn/obj/Release/OliviaAddIn.SensCampos.resources new file mode 100644 index 0000000..42b8c9c Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.SensCampos.resources differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.csproj.CoreCompileInputs.cache b/OliviaAddIn/obj/Release/OliviaAddIn.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..2907aa0 --- /dev/null +++ b/OliviaAddIn/obj/Release/OliviaAddIn.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +f9a3bf847e79c0ed0dbaa7e9cf510caea0b67536 diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.csproj.FileListAbsolute.txt b/OliviaAddIn/obj/Release/OliviaAddIn.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..956427b --- /dev/null +++ b/OliviaAddIn/obj/Release/OliviaAddIn.csproj.FileListAbsolute.txt @@ -0,0 +1,27 @@ +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Release\OliviaAddIn.dll +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Release\OliviaAddIn.pdb +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Release\yo-NG\OliviaAddIn.resources.dll +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Release\OliviaDef.dll +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Release\SisNetBase.dll +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Release\OliviaDef.pdb +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.csprojResolveAssemblyReference.cache +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.FormCampos.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.DatosCsv.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.EditTxtPlant.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.InicioDlg.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.LimpCampos.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.LimpiezaDlg.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.ListCapasMaqueta.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.ListForm.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.ProgresoEjec.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.ProgresoInic.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.Properties.Resources.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.RecoCampos.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.RecogidaDlg.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.SensCampos.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.LimpiezaDlg.yo-NG.resources +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.csproj.GenerateResource.Cache +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\yo-NG\OliviaAddIn.resources.dll +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.dll +C:\desa\V2010\OliviaAddIn\OliviaAddIn\obj\Release\OliviaAddIn.pdb +C:\desa\V2010\OliviaAddIn\OliviaAddIn\bin\Release\OliviaAddIn.esriAddIn diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.csproj.GenerateResource.Cache b/OliviaAddIn/obj/Release/OliviaAddIn.csproj.GenerateResource.Cache new file mode 100644 index 0000000..aa1de71 Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.csproj.GenerateResource.Cache differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.csprojAssemblyReference.cache b/OliviaAddIn/obj/Release/OliviaAddIn.csprojAssemblyReference.cache new file mode 100644 index 0000000..aa45e8e Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.csprojAssemblyReference.cache differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.csprojResolveAssemblyReference.cache b/OliviaAddIn/obj/Release/OliviaAddIn.csprojResolveAssemblyReference.cache new file mode 100644 index 0000000..cbb7157 Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.csprojResolveAssemblyReference.cache differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.dll b/OliviaAddIn/obj/Release/OliviaAddIn.dll new file mode 100644 index 0000000..1da485c Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.dll differ diff --git a/OliviaAddIn/obj/Release/OliviaAddIn.pdb b/OliviaAddIn/obj/Release/OliviaAddIn.pdb new file mode 100644 index 0000000..7d44b40 Binary files /dev/null and b/OliviaAddIn/obj/Release/OliviaAddIn.pdb differ diff --git a/OliviaAddIn/obj/Release/TempPE/Properties.Resources.Designer.cs.dll b/OliviaAddIn/obj/Release/TempPE/Properties.Resources.Designer.cs.dll new file mode 100644 index 0000000..0d12380 Binary files /dev/null and b/OliviaAddIn/obj/Release/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/OliviaAddIn/obj/Release/esriAddIn/AddInID.txt b/OliviaAddIn/obj/Release/esriAddIn/AddInID.txt new file mode 100644 index 0000000..c974550 --- /dev/null +++ b/OliviaAddIn/obj/Release/esriAddIn/AddInID.txt @@ -0,0 +1 @@ +{0718b3b3-5422-4d80-97ad-f72b18a3e476} diff --git a/OliviaAddIn/obj/Release/yo-NG/OliviaAddIn.resources.dll b/OliviaAddIn/obj/Release/yo-NG/OliviaAddIn.resources.dll new file mode 100644 index 0000000..e10f981 Binary files /dev/null and b/OliviaAddIn/obj/Release/yo-NG/OliviaAddIn.resources.dll differ diff --git a/OliviaDef/OliviaDef.cs b/OliviaDef/OliviaDef.cs new file mode 100644 index 0000000..b78610c --- /dev/null +++ b/OliviaDef/OliviaDef.cs @@ -0,0 +1,571 @@ +/** +* @file GeneralDef.cs +* Clase con definiciones globales comunes al proyecto Olivia y a Geofoto. +*/ +/** +* Clase con definiciones globales comunes al proyecto Olivia y a Geofoto. +*/ +namespace OliviaDef +{ + public static class GeneralDef + { + //************************************************************************************* + //Enums y structs generales + /** + * Tipos de ejecución de la herramienta Olivia + */ + public enum TiposOliv + { + OlivNoDef = -1, + OlivLimp, // + + + Debug + x86 + 8.0.30703 + 2.0 + {B395D0F3-766D-46C5-BDE9-FBDEE1582259} + Library + Properties + OliviaDef + OliviaDef + v4.0 + + + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + xcopy "$(ProjectDir)OliviaDef.cs" "..\..\..\..\..\geoincludes\" /y + + + \ No newline at end of file diff --git a/SisNetBase/SisNetBase.dll b/SisNetBase/SisNetBase.dll new file mode 100644 index 0000000..8738dd9 Binary files /dev/null and b/SisNetBase/SisNetBase.dll differ diff --git a/limpia.bat b/limpia.bat new file mode 100644 index 0000000..e98b37c --- /dev/null +++ b/limpia.bat @@ -0,0 +1,23 @@ +@echo off + +Echo Borra archivos bak y aps +del /s "%~dp0"\OliviaAddIn\*.bak +del /s "%~dp0"\OliviaAddIn\*.aps +del /s "%~dp0"\OliviaDef\*.bak +del /s "%~dp0"\OliviaDef\*.aps +del /s "%~dp0"\*.sdf +del /s "%~dp0"\*.suo + +Echo Borra bin +for /d /r "%~dp0" %%d in (bin) do @if exist "%%d" rd /s/q "%%d" + +Echo Borra obj +for /d /r "%~dp0" %%d in (obj) do @if exist "%%d" rd /s/q "%%d" + +Echo Borra debug +for /d /r "%~dp0" %%d in (debug) do @if exist "%%d" rd /s/q "%%d" + +Echo Borra release +for /d /r "%~dp0" %%d in (release) do @if exist "%%d" rd /s/q "%%d" + +pause \ No newline at end of file