Пример #1
0
 private void ShiftStart(Point point)
 {
     foreach (var polygon in _polygons)
     {
         var vertex = polygon.DetectVertex(point);
         if (vertex != null)
         {
             _shiftedPolygon = polygon;
             _shiftedVertex  = vertex;
             _isShifting     = true;
             _what           = WhatIsShifted.Vertex;
             return;
         }
     }
 }
Пример #2
0
 private void ShapeShiftStart(Point intPoint)
 {
     foreach (var polygon in _polygons)
     {
         foreach (var edge in polygon.Edges)
         {
             for (int i = 0; i < edge.Points.Count; i++)
             {
                 var point = edge.Points[i];
                 if (point.Length(intPoint) < 10)
                 {
                     _lastPoint      = point;
                     _isShifting     = true;
                     _what           = WhatIsShifted.Polygon;
                     _shiftedPolygon = polygon;
                     return;
                 }
             }
         }
     }
 }
Пример #3
0
        private void ShiftStart(Point point)
        {
            foreach (var polygon in _polygons)
            {
                var vertex = polygon.DetectVertex(point);
                if (vertex != null)
                {
                    bool breaks = false;
                    foreach (var pair in polygon.ParallelPairs)
                    {
                        var verts1 = polygon.Edges.First(e => e.Id == pair.Edges[0]).Vertices;
                        var verts2 = polygon.Edges.First(e => e.Id == pair.Edges[1]).Vertices;
                        if (verts1.Any(v => v.Id == vertex.Id) && verts2.Any(v => v.Id == vertex.Id))
                        {
                            breaks = true;
                            break;
                        }
                    }

                    if (breaks)
                    {
                        break;
                    }

                    _shiftedPolygon = polygon;
                    _shiftedVertex  = vertex;
                    _isShifting     = true;
                    _what           = WhatIsShifted.Vertex;
                    return;
                }
            }

            foreach (var polygon in _polygons)
            {
                var(edgePoint, edge) = polygon.DetectEdge(point);
                if (edge != null)
                {
                    _lastPoint      = point;
                    _shiftedPolygon = polygon;
                    _shiftedEdge    = edge;
                    _isShifting     = true;
                    _what           = WhatIsShifted.Edge;
                    return;
                }
            }

            foreach (var circle in _circles)
            {
                for (int i = 0; i < circle.Points.Count; i++)
                {
                    var circlePoint = circle.Points[i];
                    if (circlePoint.Length(point) < 10)
                    {
                        _lastPoint     = circlePoint;
                        _isShifting    = true;
                        _what          = WhatIsShifted.Radius;
                        _shiftedCircle = circle;
                        return;
                    }
                }
            }
        }