示例#1
0
        void _mainChoroplethMap_VizComponentMouseDown(object sender, VizComponentMouseEventArgs e)
        {
            _regionIndex     = _polygonLayer.GetSelectedIndexes();
            _mousePosition.X = e.MouseEventArgs.Location.X;
            _mousePosition.Y = e.MouseEventArgs.Location.Y;
            _mapPosition     = _mainChoroplethMap.ConvertScreenCoordinatesToMapCoordinates(_mousePosition);
            _region          = _mapData.GetRegionId(_mapPosition.X, _mapPosition.Y);

            if (_region != -1)
            {
                if (!_regionIndex.Contains(_region))
                {
                    // can only select several if you hold the control key
                    if (MainWindow.ModifierKeys == System.Windows.Forms.Keys.Control)
                    {
                        _regionIndex.Insert(0, _region);
                        //translate to other comps
                        indexMapper.TryMapIndex(_region, out _mappedRegion);
                        _mappedRegionIndex.Insert(0, _mappedRegion);
                    }
                    else
                    {
                        _regionIndex.Clear();
                        _regionIndex.Insert(0, _region);
                        //translate to other comps
                        _mappedRegionIndex.Clear();
                        indexMapper.TryMapIndex(_region, out _mappedRegion);
                        _mappedRegionIndex.Insert(0, _mappedRegion);
                    }
                }
                else
                {
                    _regionIndex.Remove(_region);
                    indexMapper.TryMapIndex(_region, out _mappedRegion);
                    _mappedRegionIndex.Remove(_mappedRegion);
                }
            }
            //om man trycker utanför något land rensas listan
            else
            {
                _regionIndex.Clear();
                _mappedRegionIndex.Clear();
            }
            //add selection to components
            _polygonLayer.SetSelectedIndexes(_regionIndex);
            _mainWindow.PCHandler._pcPlotVariables.SetSelectedIndexes(_mappedRegionIndex);
            _mainWindow.PCHandler._pcPlotYears.SetSelectedIndexes(_mappedRegionIndex);
            _mainWindow.PlotHandler._scatterplot.SetSelectedIndexes(_mappedRegionIndex);
            _mainWindow.PlotHandler._tableLens.SetSelectedIndexes(_mappedRegionIndex);

            //force repaint on all components
            _mainWindow.ViewManager.InvalidateAll();
        }
示例#2
0
        void iMouseHoverControl_Hover(object sender, EventArgs e)
        {
            Vector2 v     = choroMap.ConvertScreenCoordinatesToMapCoordinates(iMouseHoverControl.HoverPosition);
            int     index = iMapData.GetRegionId(v);

            if (index != -1)
            {
                iToolTip.Hide();
                Country country = (Country)iDoc.GetDatabase().countries[iDoc.GetFilteredAcronyms()[index]];
                iToolTip.Text = iCountryNames[index]
                                + "\nMedian Age: " + country.medianAge
                                + "\nAlbum Releases: " + country.releases.Count
                                + "\nGDP(per capita): " + country.gdbPerCapita + "$"
                                + "\nUnemployment Rate: " + country.unemploymentRate + "%"
                ;
                iToolTip.Show(iMouseHoverControl.HoverPosition);
            }
        }