示例#1
0
        // ReSharper disable once MemberCanBePrivate.Global
        public StressCoordinate PickStressCoordinate(Point loc, StressCoordinate useSc, out List <StressCoordinate> closeList)
        {
            double x, y, lat, lon;

            _getXY(loc, out x, out y);
            _ortho.ToSphere(x, y, out lat, out lon);
            if (!double.IsNaN(lat) && !double.IsNaN(lon))
            {
                StressCoordinate sC;
                if (useSc == null)
                {
                    sC = new StressCoordinate(lat, lon);
                }
                else
                {
                    sC            = useSc;
                    sC.Latitude   = lat;
                    sC.Longitude  = lon;
                    sC.ProjectedX = 0.0;
                    sC.ProjectedY = 0.0;
                }

                sC.Azimuth = _stressTable.GetInterpolatedAzimuth(lat, lon, _pickRadius, _nVect, null, out closeList);
                if (!Double.IsNaN(sC.Azimuth))
                {
                    return(sC);
                }
            }
            closeList = null;
            return(null);
        }
示例#2
0
        // ReSharper disable once MemberCanBePrivate.Global
        public StressCoordinate PickStressCoordinate(StressCoordinate sC)
        {
            List <StressCoordinate> closeList;
            Point            loc   = new Point((int)sC.ProjectedX, (int)sC.ProjectedY);
            StressCoordinate retSc = PickStressCoordinate(loc, sC, out closeList);

            sC.Draw = (retSc != null);
            return(retSc);
        }
示例#3
0
        private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            if (toolStripButtonPICK.Checked)
            {
                if (ModifierKeys == Keys.Control)
                {
                    // use the actual stress coordinate to make a respository
                    // for the input/output so no allocation req in parallel threads
                    // remove bad ones after
                    List <StressCoordinate> buffer = new List <StressCoordinate>();
                    for (int dx = -100; dx <= 100; dx += 20)
                    {
                        for (int dy = -100; dy <= 100; dy += 20)
                        {
                            StressCoordinate sC = new StressCoordinate(0, 0)
                            {
                                ProjectedX = e.X + dx,
                                ProjectedY = e.Y + dy,
                                Draw       = true
                            };
                            buffer.Add(sC);
                        }
                    }

                    Parallel.For(0, buffer.Count,
                                 index =>
                    {
                        PickStressCoordinate(buffer[index]);
                    });
                    buffer.RemoveAll(sC => (!sC.Draw));
                    if (buffer.Count > 0)
                    {
                        _myList.AddRange(buffer);
                    }
                    _closeList = null;
                    _updateProjection();
                }
                else
                {
                    StressCoordinate sC = PickStressCoordinate(e.Location, null, out _closeList);
                    if (sC != null)
                    {
                        _myList.Add(sC);
                    }
                    _updateProjection();
                }
            }
        }