Beispiel #1
0
 void eConsulta(SharpMap.Data.FeatureDataTable resultado)
 {
     try
     {
         if ((resultado as DataTable).Rows.Count > 0)
         {
             SharpMap.Data.FeatureDataRow fdr = TopoUtils.LocatePolygon2(this.ultimaPosicion, resultado);
             Estancia est = AdminMapas.RefrescaCapaInfoEst(this.Mapa, fdr[1].ToString());
             this.actualizarPropiedades(est);
             this.tabControl1.SelectedTab = tpInfo;
             this.miVMapa.Refresh();
         }
     }
     catch (Exception error)
     {
         System.Windows.Forms.MessageBox.Show(error.Message, "Error");
     }
 }
Beispiel #2
0
        private void RefrescarMapa(TreeNode nodo)
        {
            //Comprueba el nodo que está seleccionado
            if (nodo.Tag.GetType() == typeof(BaseOrg))
            {
                this.limpiarPropiedades();
                this.tpLeyenda.Enabled = false;
                this.panelLeyenda.Refresh();
                this.tpPDF.Enabled = false;
                this.Preview.SetRenderEvent(null);
                this.tsbPDFGuardar.Enabled  = false;
                this.tsbPDFImprimir.Enabled = false;
                this.miVMapa.Visible        = false;
                this.toolStrip1.Enabled     = false;
            }

            if (nodo.Tag.GetType() == typeof(Zona))
            {
                this.limpiarPropiedades();
                this.tpLeyenda.Enabled = false;
                this.panelLeyenda.Refresh();
                this.tpPDF.Enabled = false;
                this.Preview.SetRenderEvent(null);
                this.tsbPDFGuardar.Enabled  = false;
                this.tsbPDFImprimir.Enabled = false;
                this.miVMapa.Visible        = false;
                this.toolStrip1.Enabled     = false;
            }

            if (nodo.Tag.GetType() == typeof(Edificio))
            {
                this.limpiarPropiedades();
                this.tpLeyenda.Enabled = false;
                this.panelLeyenda.Refresh();
                this.tpPDF.Enabled = false;
                this.Preview.SetRenderEvent(null);
                this.tsbPDFGuardar.Enabled  = false;
                this.tsbPDFImprimir.Enabled = false;
                this.miVMapa.Visible        = false;
                this.toolStrip1.Enabled     = false;
            }

            // Para la planta del edificio
            if (nodo.Tag.GetType() == typeof(PlantaEdificio))
            {
                PlantaEdificio pe = (PlantaEdificio)nodo.Tag;
                this.limpiarPropiedades();
                this.tpLeyenda.Enabled = true;
                this.tpPDF.Enabled     = true;
                this.Preview.SetRenderEvent(null);
                this.tsbPDFGuardar.Enabled  = false;
                this.tsbPDFImprimir.Enabled = false;

                this.miVMapa.Visible = true;
                // Crear una lista de geometria a partir de los nodos hijos de PlantaEdificio
                List <Geometry> lp = new List <Geometry>();

                foreach (TreeNode n in nodo.Nodes)
                {
                    Estancia estHija;
                    if (n.Tag is Estancia)
                    {
                        estHija = (Estancia)n.Tag;
                        lp.Add(estHija.Geometria);
                    }
                    else if (n.Tag is Ubicacion)
                    {
                        estHija = (n.Tag as Ubicacion).Estancia;
                        lp.Add(estHija.Geometria);
                    }
                }

                AdminMapas.CrearMapa(this.panelLeyenda.CreateGraphics(), this.Mapa,
                                     (IUnidadGeoEstadistica)pe, lp, null,
                                     this._tipoMapa, this._tipoPaleta);

                this.miVMapa.Map = this.Mapa;
            }

            // Si es un nodo de estancia
            if (nodo.Tag.GetType() == typeof(Estancia))
            {
                Estancia est = (Estancia)nodo.Tag;
                this.actualizarPropiedades(est);
                this.tpLeyenda.Enabled = true;
                this.tpPDF.Enabled     = true;
                this.Preview.SetRenderEvent(null);
                this.tsbPDFGuardar.Enabled  = false;
                this.tsbPDFImprimir.Enabled = false;
                this.miVMapa.Visible        = true;
                // Selección de elementos de la consulta
                List <Geometry> lp = new List <Geometry>();
                foreach (TreeNode n in nodo.Parent.Nodes)
                {
                    Estancia estHija = (Estancia)n.Tag;
                    lp.Add(estHija.Geometria);
                }

                AdminMapas.CrearMapa(this.panelLeyenda.CreateGraphics(), this.Mapa,
                                     (IUnidadGeoEstadistica)est.PlantaEdificio, lp, est,
                                     this._tipoMapa, this._tipoPaleta);

                this.miVMapa.Map = this.Mapa;
            }

            // Si es un nodo de ubicacion
            if (nodo.Tag.GetType() == typeof(Ubicacion))
            {
                Estancia est = (nodo.Tag as Ubicacion).Estancia;
                this.actualizarPropiedades(est);
                this.tpLeyenda.Enabled = true;
                this.miVMapa.Visible   = true;
                // Selección de elementos de la consulta
                List <Geometry> lp = new List <Geometry>();
                foreach (TreeNode n in nodo.Parent.Nodes)
                {
                    Estancia estHija = (n.Tag as Ubicacion).Estancia;
                    lp.Add(estHija.Geometria);
                }

                AdminMapas.CrearMapa(this.panelLeyenda.CreateGraphics(), this.Mapa,
                                     (IUnidadGeoEstadistica)est.PlantaEdificio, lp, est,
                                     this._tipoMapa, this._tipoPaleta);

                this.miVMapa.Map = this.Mapa;
            }
        }