Exemplo n.º 1
0
        void MouseUp(object sender, VizComponentMouseEventArgs e)
        {
            const int treshold = 10;

            //Trying to see if mouse was dragged or was it clicked
            if (e.MouseEventArgs.Button == MouseButtons.Left &&
                (iMouseClickPoint.X - treshold < e.MouseEventArgs.Location.X && iMouseClickPoint.X + treshold > e.MouseEventArgs.Location.X) &&
                (iMouseClickPoint.Y - treshold < e.MouseEventArgs.Location.Y && iMouseClickPoint.Y + treshold > e.MouseEventArgs.Location.Y)
                )
            {
                Vector2 v     = choroMap.ConvertScreenCoordinatesToMapCoordinates(e.MouseEventArgs.Location);
                int     index = iMapData.GetRegionId(v);

                List <int> selectedItems = new List <int>();

                // if CTRL is pressed, add the line to the selection
                Keys keys = Control.ModifierKeys;
                bool add  = (keys == Keys.Control);

                bool visibility = false;
                if (index != -1)
                {
                    visibility = polygonLayer.IndexVisibilityHandler.GetVisibility(index);
                    if (visibility)
                    {
                        selectedItems.Add(index);
                        iDoc.SetSelectedItems(selectedItems, add, true);
                    }
                }
                else
                {
                    iDoc.SetSelectedItems(selectedItems, add, true);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void MouseDown(object sender, VizComponentMouseEventArgs e)
 {
     //Store the clik start position
     if (e.MouseEventArgs.Button == MouseButtons.Left)
     {
         iMouseClickPoint = e.MouseEventArgs.Location;
     }
 }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
0
        void choroplethMap_VizComponentMouseUp(object sender, VizComponentMouseEventArgs e)
        {
            if (e.MouseEventArgs.Button == System.Windows.Forms.MouseButtons.Left && !drag_begin)
            { //throw new NotImplementedException();
                this.splitContainer2.Panel1.Focus();

                this.splitContainer2.Focus();
                Point p = e.MouseEventArgs.Location;
                Vector2 mapCoordinates = choroplethMap.ConvertScreenCoordinatesToMapCoordinates(p);
                int index = mapData.GetRegionId(mapCoordinates.X, mapCoordinates.Y);
                int mappedIndex = 0;
                stringIndexMapper.TryMapIndex(index, out mappedIndex);

                //gavToolTip.SetPosition(new Point(0, 0));

                if (index > 0 && mappedIndex != -1)
                {
                    gavToolTip.Hide();

                    this.dataSelectedIndex = mappedIndex;
                    this.mapSelectedIndex = index;

                    List<int> currentSelectedIndexes = mapPolygonLayer.GetSelectedIndexes();

                    List<int> mapSelected = new List<int>() { this.mapSelectedIndex };
                    mapPolygonLayer.SelectedPolygonColor = Color.Yellow;
                    mapPolygonLayer.SetSelectedIndexes(mapSelected);
                    choroplethMap.Invalidate();

                    List<int> dataSelected = new List<int>() { this.dataSelectedIndex };
                    this.component.SetSelectedIndexes(dataSelected);
                    this.component.Invalidate();
                }
            }
            if (e.MouseEventArgs.Button == System.Windows.Forms.MouseButtons.Right && !zoom_begin)
            {
                this.userMenu.Show(this, e.MouseEventArgs.Location);
            }
        }
Exemplo n.º 5
0
        void choroplethMap_VizComponentMouseMove(object sender, VizComponentMouseEventArgs e)
        {
            Point p = e.MouseEventArgs.Location;
            Vector2 mapCoordinates = choroplethMap.ConvertScreenCoordinatesToMapCoordinates(p);
            int index = mapData.GetRegionId(mapCoordinates.X, mapCoordinates.Y);
            int mappedIndex = 0;
            stringIndexMapper.TryMapIndex(index, out mappedIndex);
            if (mappedIndex != -1)
            {
                gavToolTip.Text = excelDataProvider.RowIds[mappedIndex];
                gavToolTip.Text += "\n";
                gavToolTip.Text += excelDataProvider.ColumnHeaders[choroplethMapSelectedIndex] + ":" + yearSliceDataTransformer.GetDataCube().DataArray[choroplethMapSelectedIndex, mappedIndex, 0];

                gavToolTip.Show(p);
            }
            else
                gavToolTip.Hide();
        }
Exemplo n.º 6
0
 void choroplethMap_VizComponentMouseDown(object sender, VizComponentMouseEventArgs e)
 {
     if (e.MouseEventArgs.Button == System.Windows.Forms.MouseButtons.Left)
     {
         this.drag_begin = false;
         this.drag_position = choroplethMap.Position;
     }
     if (e.MouseEventArgs.Button == System.Windows.Forms.MouseButtons.Right)
     {
         this.zoom_begin = false;
         this.zoom_level = choroplethMap.Zoom;
     }
 }