Ejemplo n.º 1
0
        public void updateMapTest()
        {
            MapVizContainer target = new MapVizContainer();
            Map             map    = new Map();

            int childrenCount = map.Children.Count;

            Assert.AreEqual(0, childrenCount);

            Guid guid  = Guid.NewGuid();
            Guid guid2 = Guid.NewGuid();
            Guid guid3 = Guid.NewGuid();
            Guid guid4 = Guid.NewGuid();

            target.Add(guid, new AnnoVizPoly());
            target.Add(guid2, new AnnoVizPushpin());
            target.Add(guid3, new MeteoVizPoly(new Meteorite("", 1, 1, "", "", DateTime.Now, 1.1, 2.2)));
            target.Add(guid4, new MeteoVizPushpin(new Meteorite("", 1, 1, "", "", DateTime.Now, 1.1, 2.2)));

            target.updateMap(map);
            childrenCount = map.Children.Count;
            Assert.AreEqual(4, childrenCount);

            target.Remove(guid);

            target.updateMap(map);
            childrenCount = map.Children.Count;
            Assert.AreEqual(3, childrenCount);
            target.Clear();
            target.updateMap(map);
            childrenCount = map.Children.Count;
            Assert.AreEqual(0, childrenCount);
        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            meteoDB = (MeteoDB)DataFactory.getDataContext(DataFactory.DataType.Meteorite);
            annoDB  = (AnnoDB)DataFactory.getDataContext(DataFactory.DataType.Annotation);
            annoWin = new AnnoWindow(annoDB, meteoDB);
            annoWin.Show();
            //MeteoDataGrid.DataContext = meteoDB;
            //MeteoDataGrid.ItemsSource = meteoDB.MeteoTable;

            mvc = new MapVizContainer();
            mvc.CurrentSelectionChanged += Mvc_CurrentSelectionChanged;

            initializeData(); //this should have been in the presentation. it was missing due to a bad conflict merge on github hence Jason's utter confusion during the presentation
            mvc.updateMap(mainMap);
        }
Ejemplo n.º 3
0
        private void MeteoDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Location  l = new Location();
            DataGrid  currentDataGrid  = (DataGrid)sender;
            Meteorite currentMeteorite = (Meteorite)currentDataGrid.CurrentItem;

            annoWin.gatherMeteoData(currentMeteorite);
            KeyValuePair <Guid, IMapViz> kvp = mvc.getKeyValuePair(currentMeteorite);

            if (mvc.Contains(kvp))
            {
                mvc.Remove(kvp.Key);
            }
            else
            {
                mvc.addMeteorite(currentMeteorite);
            }
            mvc.updateMap(mainMap);

            l.Latitude        = ((Meteorite)MeteoDataGrid.SelectedItem).RectLat;
            l.Longitude       = ((Meteorite)MeteoDataGrid.SelectedItem).RectLong;
            mainMap.Center    = l;
            mainMap.ZoomLevel = 7;
        }