Разработка специализированной системы визуализации и анализа городской среды

Автор работы: Пользователь скрыл имя, 06 Января 2013 в 23:20, реферат

Краткое описание

Цель работы – анализ методов информационной визуализации и визуального анализа и применение их для разработки прототипа системы поддержки конечного пользователя.
В процессе работы проводился анализ возможностей географических информационных систем как средств визуализации и анализа данных, исследовались различные методы представления географических и семантических данных.

Вложенные файлы: 1 файл

Tekst.docx

— 2.90 Мб (Скачать файл)

                Water.IsVisible = true;

                BigStreet.IsVisible = true;

                Streets.IsVisible = true;

                Buildings.IsVisible = true;

 

                selectedFalse();

                MainStreet.SelectionEnabled = true;

                Water.SelectionEnabled = true;

                BigStreet.SelectionEnabled = true;

                Streets.SelectionEnabled = true;

                Buildings.SelectionEnabled = true;

            }

        }

 

        private void map_2click(object sender, EventArgs e)

        {

            map_click(sender, e);

        }

 

       private void btnFind_Click(object sender, EventArgs e)

           {

               String street;

               int house;

          

               street = textStreet.Text;

               house = int.Parse(textHouse.Text);

                           

               zoomCount = 10;

               map_click(sender,e);

 

               Buildings.IsVisible = true;

               Buildings.SelectByAttribute("[street]= '"+street+"' AND [number]="+house);

               Buildings.ZoomToSelectedFeatures();

             

               Rectangle r = map.MapFrame.View;

               int w = r.Width;

               int h = r.Height;              

               r.Inflate((int)(r.Width / 10),(int)( r.Height / 10));              

               map.MapFrame.View = r;

               map.MapFrame.ResetExtents(); 

           }

 

           private void cmdPrint_Click(object sender, EventArgs e)

           {

               MyLayoutForm1 lf = new MyLayoutForm1();

               lf.MapControl = map;

               lf.Show();                          

           }

 

           private void btnVis2_CheckedChanged(object sender, EventArgs e)

           {

               if (zoomCount==2) Raions.Symbology = scheme2;

               if (zoomCount >= 3)

               {

                   MainStreet.Symbology = road_scheme2;

                   BigStreet.Symbology = road_scheme2;

                   Streets.Symbology = road_scheme2;

               }

           }

 

          private void btnVis1_CheckedChanged(object sender, EventArgs e)

           {

               if (zoomCount == 2) Raions.Symbology = scheme;

               if (zoomCount >= 3)

               {

                   MainStreet.Symbology = road_scheme;

                   BigStreet.Symbology = road_scheme;

                   Streets.Symbology = road_scheme;

               }

           }

 

           private void traffic_CheckedChanged(object sender, EventArgs e)

           {

               if (traffic.Checked) traffic_panel.Enabled = true;

               else traffic_panel.Enabled = false;

           }

 

           private void traffic_find_Click(object sender, EventArgs e)

           {

               MainStreetTraff.IsVisible = true;

               if (day.SelectedItem == "Выходные")

               {

                   if (time.SelectedItem == "1") MainStreetTraff.Symbology = road_vih1;

                   else if (time.SelectedItem == "2") MainStreetTraff.Symbology = road_vih2;

                   else if (time.SelectedItem == "3") MainStreetTraff.Symbology = road_vih3;

               }

               else if (day.SelectedItem == "Бцдни")

               {

                   if (time.SelectedItem == "1") MainStreetTraff.Symbology = road_bud1;

                   else if (time.SelectedItem == "2") MainStreetTraff.Symbology = road_bud2;

                   else if (time.SelectedItem == "3") MainStreetTraff.Symbology = road_bud3;

               }

           }

 

           private void checkLabels_CheckedChanged(object sender, EventArgs e)

           {

               if (checkLabels.Checked)

               {      

                   for (int i = 0; i < mapLayers.Count; i++)

                   {

                       mapLayers[i].ShowLabels = true;

                   }

 

                   map.MapFrame.ResetExtents();

               }

               else

               {              

                   for (int i = 0; i < mapLayers.Count; i++)

                   {

                       mapLayers[i].ShowLabels = false;

                   }

                   map.MapFrame.ResetExtents();

               }

           }

 

           private void checkVisual_CheckedChanged(object sender, EventArgs e)

           {

               if (checkVisual.Checked)

               {               

                   Raions.EditMode = false;

                   MainStreet.EditMode = false;

                   BigStreet.EditMode = false;

                   Streets.EditMode = false;

                   map.MapFrame.ResetExtents();

                   panel1.Visible = true;

               }

 

               else

               {

                   Raions.EditMode = true;

                   MainStreet.EditMode = true;

                   BigStreet.EditMode = true;

                   Streets.EditMode = true;

                   map.MapFrame.ResetExtents();

                   panel1.Visible = false;

               }

           }

 

           private void tram_CheckedChanged(object sender, EventArgs e)

           {

               if (tram.Checked)  tram_panel.Enabled = true;

               else tram_panel.Enabled = false;

           }

 

           private void cmdFind_Click(object sender, EventArgs e)

           {

               MySelectByAttributes sb = new MySelectByAttributes(map.MapFrame);

               sb.Show();

           }

 

           private void cmdExit_Click(object sender, EventArgs e)

           {

               Application.Exit();

           }

 

           private void checkBox5_CheckedChanged(object sender, EventArgs e)

           {

               if (checkSveto.Checked)

               {

                   Svetofor.EditMode = false;

                   Svetofor.IsVisible = true;

                   map.MapFrame.ResetExtents(); 

               }

 

               else

               {

                   Svetofor.IsVisible = false;

                   map.MapFrame.ResetExtents(); 

               }

           }

 

           private void checkBox6_CheckedChanged(object sender, EventArgs e)

           {

               if (checkPesh.Checked)

               {

                   Peshehod.EditMode = false;

                   Peshehod.IsVisible = true;

                  

                   map.MapFrame.ResetExtents();

               }

 

               else

               {

                   Peshehod.IsVisible = false;

                  

                   map.MapFrame.ResetExtents();

               }

           }

 

           private void button1_Click(object sender, EventArgs e)

           {

               MainStreetTraff.IsVisible = false;

           }

 

           private void checIco_CheckedChanged(object sender, EventArgs e)

           {

               if (checkIco.Checked)

               {

                   fi.Show();

               }

               else fi.Visible = false;

              

           }

 

           private void checkPlace_CheckedChanged(object sender, EventArgs e)

           {

               if (checkPlace.Checked)

               {

                   Places.EditMode = false;

                   Places.IsVisible = true;

 

                   map.MapFrame.ResetExtents();

               }

 

               else

               {

                   Places.IsVisible = false;

 

                   map.MapFrame.ResetExtents();

               }

           }

 

 

Класс MyFeatureIdentifier

 

        public MyFeatureIdentifier()

        {

            InitializeComponent();        

        }

    

        public void Add(IFeatureLayer layer, IFeature f)

        {

                if (f == null) return;

                DataTable dt = new DataTable();

                dt.Columns.Add("Field Name");

                dt.Columns.Add("Value");

 

                if (f.DataRow == null)

                {

                    f.ParentFeatureSet.FillAttributes();

                }

                DataColumn[] columns = f.ParentFeatureSet.GetColumns();

 

                for (int i = 0; i < columns.Length - 2; i++)

                {

                    DataColumn fld = columns[i];

                    DataRow dr = dt.NewRow();

                    dr["Field Name"] = fld.ColumnName;

                    if (f.DataRow != null) dr["Value"] =

 f.DataRow[fld.ColumnName].ToString();

                    dt.Rows.Add(dr);

                }

              

               

                dgvAttributes.DataSource = dt;

                String photo = f.DataRow[columns[columns.Length-2].ColumnName].ToString();

                photo = @"Images\" + photo;

                pictureBox1.ImageLocation = photo;

 

               

                String text_file =

f.DataRow[columns[columns.Length - 1].ColumnName].ToString();

                text_file = @"Texts\" + text_file;

                try

                {

                    StreamReader fs =

new StreamReader(text_file, System.Text.Encoding.Default);

                    String text = fs.ReadToEnd();

                    label1.Text = text;

                }

                catch (ArgumentException)

                {

                    label1.Text = "Описание отсутствует";

                }

                catch (FileNotFoundException)

                {

                    label1.Text = "Описание отсутствует";

                }

                catch (DirectoryNotFoundException)

                {

                    label1.Text = "Описание отсутствует";

                }          

        }

   

        protected override void OnClosing(CancelEventArgs e) 

        {

            e.Cancel = true;

            Hide();

        }

 

 

 

Класс MyLayoutForm

 

       private void toolStripMap_Click(object sender, EventArgs e)

        {

            _layoutControl1.AddElementWithMouse(_layoutControl1.CreateMapElement());

 

        }

 

        private void toolStripRect_Click(object sender, EventArgs e)

        {

            _layoutControl1.AddElementWithMouse(new Layout.Elements.LayoutRectangle());

        }

 

        private void toolStripNorth_Click(object sender, EventArgs e)

        {

            _layoutControl1.AddElementWithMouse(new Layout.Elements.LayoutNorthArrow());

        }

 

        private void toolStripImg_Click(object sender, EventArgs e)

        {

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Images (*.png, *.jpg, *.bmp, *.gif, *.tif)|*.png;*.jpg;*.bmp;*.gif;*.tif";

            ofd.FilterIndex = 1;

            ofd.CheckFileExists = true;

            if (ofd.ShowDialog() == DialogResult.OK)

            {

                Layout.Elements.LayoutBitmap newBitmap = new Layout.Elements.LayoutBitmap();

                newBitmap.Size = new System.Drawing.SizeF(100, 100);

                newBitmap.Filename = ofd.FileName;

                _layoutControl1.AddElementWithMouse(newBitmap);

            }

        }

 

 

 

Класс MySelectByAttributes

 

       public MySelectByAttributes()

        {

            InitializeComponent();

            Configure();

        }

 

        public MySelectByAttributes(IFrame mapFrame)

        {

            _mapFrame = mapFrame;

            InitializeComponent();

            Configure();

        }

 

        private void Configure()

        {

            DataTable dt = new DataTable();

            dt.Columns.Add("Name", typeof(string));

            dt.Columns.Add("Value", typeof(IFeatureLayer));

 

            foreach(ILayer layer in _mapFrame)

            {

                IFeatureLayer fl = layer as IFeatureLayer;

                if (fl != null)

                {

                    DataRow dr = dt.NewRow();

                    dr["Name"] = fl.LegendText;

                    dr["Value"] = fl;

                    dt.Rows.Add(dr);

                }

            }

            cmbLayers.DataSource = dt;

            cmbLayers.DisplayMember = "Name";

            cmbLayers.ValueMember = "Value";

            cmbMethod.SelectedIndex = 0;

            if(cmbLayers.Items.Count > 0) cmbLayers.SelectedIndex = 0;

        }

 

        public IFrame MapFrame

        {

            get { return _mapFrame; }

            set

            {

                _mapFrame = value;

                Configure();

            }

        }

 

        protected override void Dispose(bool disposing)

        {

            if (disposing && (components != null))

            {

                components.Dispose();

            }

            base.Dispose(disposing);

        }

 

        private void cmbLayers_SelectedIndexChanged(object sender, EventArgs e)

        {

            DataRowView drv = cmbLayers.SelectedValue as DataRowView;

            if (drv != null)

            {

                _activeLayer = drv.Row["Value"] as IFeatureLayer;

            }

            else

            {

                _activeLayer = cmbLayers.SelectedValue as IFeatureLayer;

            }

            if (_activeLayer == null) return;

            if(!_activeLayer.DataSet.AttributesPopulated && _activeLayer.DataSet.NumRows() < 50000)

            {

                _activeLayer.DataSet.FillAttributes();

            }

            if(_activeLayer.EditMode || _activeLayer.DataSet.AttributesPopulated)

            {

                sqlQueryControl1.Table = _activeLayer.DataSet.DataTable;

            }

            else

            {

                sqlQueryControl1.AttributeSource = _activeLayer.DataSet;

            }

        }

 

        private void btnApply_Click(object sender, EventArgs e)

        {

            ApplyFilter();

        }

 

        private void ApplyFilter()

        {

            string filter = sqlQueryControl1.ExpressionText;

            if (_activeLayer != null)

            {

                try

                {

                    _activeLayer.SelectByAttribute(filter, GetSelectMode());

                }

                catch(Exception ex)

                {

                    Debug.WriteLine(ex.ToString());

                    MessageBox.Show("There was an error attempting to apply this expression.");

                }

            }

        }

 

 

        ModifySelectionModes GetSelectMode()

        {

            switch (cmbMethod.SelectedIndex)

            {

                case 0: return ModifySelectionModes.Replace;

                case 1: return ModifySelectionModes.Append;

                case 2: return ModifySelectionModes.Subtract;

                case 3: return ModifySelectionModes.SelectFrom;

            }

            return ModifySelectionModes.Replace;

        }

 

        private void btnOk_Click(object sender, EventArgs e)

        {

            ApplyFilter();

            Close();

        }

 

        private void btnClose_Click(object sender, EventArgs e)

        {

            Close();

        }

 

Класс MyZoomInFunction

 

protected override void OnMouseUp(GeoMouseArgs e)

        {

            _currentPoint = e.Location;

 

            Map.Invalidate();

 

            Rectangle r = e.Map.MapFrame.View;

            int w = r.Width;

            int h = r.Height;

 

            if (e.Button == MouseButtons.Left)

            {

                r.Inflate(-r.Width / 10, -r.Height / 10);

Информация о работе Разработка специализированной системы визуализации и анализа городской среды