Наследование: MonoBehaviour
Пример #1
0
 public override void Update(PointF startP, PointF endP)
 {
     PointsList.Add(endP);
     PointsList[AnglesNumber - 1] = startP;
     PointsList[AnglesNumber]     = endP;
     AnglesNumber++;
 }
Пример #2
0
        public IEnumerable <UIElement> GetDrawing()
        {
            var DrawingElements = new List <UIElement>();

            foreach (var point in PointsList)
            {
                DrawingElements.Add(EllipseExtentions.CanvasPoint(point));
            }

            if (PointsList.Count > 0)
            {
                DrawingElements.Add(new Polyline()
                {
                    Points = new PointCollection(PointsList.Concat(new Point[] { PointsList.First() })), Stroke = Brushes.Black
                });
            }

            if (PointsList.Count() >= 3)
            {
                var path = MakeBezierPath(PointsList.ToArray());
                DrawingElements.Add(path);
            }

            return(DrawingElements);
        }
Пример #3
0
 // Update is called once per frame
 void Update()
 {
     // If mouse button down, remove old line and set its color to green
     if (Input.GetMouseButtonDown(0) && isMousePressed == false)
     {
         currentLine    = Instantiate(lineObject);
         isMousePressed = true;
         line           = currentLine.GetComponent <LineRenderer> ();
         pointsList     = currentLine.GetComponent <PointsList> ();
         line.SetVertexCount(0);
     }
     if (Input.GetMouseButtonUp(0))
     {
         isMousePressed = false;
     }
     // Drawing line when mouse is moving(presses)
     if (isMousePressed)
     {
         mousePos   = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         mousePos.z = 0;
         if (!pointsList.points.Contains(mousePos))
         {
             pointsList.points.Add(mousePos);
             line.SetVertexCount(pointsList.points.Count);
             line.SetPosition(pointsList.points.Count - 1, (Vector3)pointsList.points [pointsList.points.Count - 1]);
         }
     }
 }
Пример #4
0
        public async Task SavePoints(string title)
        {
            var savedLists = await _context.Titles.Include(x => x.PointsLists).OrderBy(x => x.Id).ToListAsync();

            foreach (var item in savedLists)
            {
                if (item.Title == title)
                {
                    _context.Titles.Remove(item);
                }
            }
            var list = await _context.Points.ToListAsync();

            var listToSaveTitle = new PointsListTitle();

            listToSaveTitle.Title       = title;
            listToSaveTitle.PointsLists = new List <PointsList>();

            foreach (var item in list)
            {
                var point = new PointsList();
                point.Xcoordinate = item.Xcoordinate;
                point.Ycoordinate = item.Ycoordinate;
                point.Title       = listToSaveTitle;
                listToSaveTitle.PointsLists.Add(point);
            }
            _context.Titles.Add(listToSaveTitle);
            await _context.SaveChangesAsync();
        }
Пример #5
0
 protected override void SetPointCollection()
 {
     // do zaznaczania prostokata wystarcza dwa rogi
     PointsList.Clear();
     PointsList.Add(rect.TopLeft);       // lewy gorny
     PointsList.Add(rect.BottomRight);   // prawy dolny
 }
Пример #6
0
        private void CreatePoints(NetSegment segment)
        {
            var info           = segment.Info;
            var lanes          = segment.GetLanesId().ToArray();
            var driveLanesIdxs = info.m_sortedLanes.Where(s => Utilities.IsDriveLane(info.m_lanes[s]));

            if (!IsLaneInvert)
            {
                driveLanesIdxs = driveLanesIdxs.Reverse();
            }

            DriveLanes = driveLanesIdxs.Select(d => new DriveLane(this, lanes[d], info.m_lanes[d])).ToArray();
            if (!DriveLanes.Any())
            {
                return;
            }

            Lines = new SegmentMarkupLine[DriveLanes.Length + 1];

            for (int i = 0; i < Lines.Length; i += 1)
            {
                var left       = i - 1 >= 0 ? DriveLanes[i - 1] : null;
                var right      = i < DriveLanes.Length ? DriveLanes[i] : null;
                var markupLine = new SegmentMarkupLine(this, left, right);
                Lines[i] = markupLine;
            }

            foreach (var markupLine in Lines)
            {
                PointsList.AddRange(markupLine.GetMarkupPoints());
            }
        }
Пример #7
0
 protected override void SetPointCollection()
 {
     // do zaznaczenia trojkata potrzebne sa wszystkie 3 wierzcholki
     PointsList.Clear();
     PointsList.Add(PathFigure.StartPoint);    // lewy dolny
     PointsList.Add(line1.Point);              // prawy dolny
     PointsList.Add(line2.Point);              // gorny
 }
Пример #8
0
 internal HorizontalLine(ushort xLeft, ushort xRight, ushort y, char symbol)
 {
     plist = new List <Point>();
     for (ushort x = xLeft; x <= xRight; x++)
     {
         Point p = new Point(x, y, symbol);
         PointsList.Add(p);
     }
 }
Пример #9
0
        protected override void SetPointCollection()
        {
            // do zaznaczania elipsy wystarcza dwa rogi
            Rect rect = ((EllipseGeometry)adaptedGeometry).Bounds;// protokat w ktory jest "wpisana" elipsa

            PointsList.Clear();
            PointsList.Add(rect.TopLeft);     // lewy gorny
            PointsList.Add(rect.BottomRight); // prawy dolny
        }
Пример #10
0
 internal VerticalLine(ushort x, ushort yTop, ushort yBottom, char symbol)
 {
     plist = new List <Point>();
     for (ushort y = yTop; y <= yBottom; y++)
     {
         Point p = new Point(x, y, symbol);
         PointsList.Add(p);
     }
 }
Пример #11
0
 public DicomEllipseGraphic()
 {
     base.Graphics.Add(_ellipse = new EllipsePrimitive());
     _points = new PointsList(this);
     _points.Add(PointF.Empty);
     _points.Add(PointF.Empty);
     _points.Add(PointF.Empty);
     _points.Add(PointF.Empty);
     _points.PointChanged += OnPointChanged;
 }
        /// <summary>
        /// Optics聚类构造函数
        /// </summary>
        /// <param name="eps">邻域半径阈值</param>
        /// <param name="minPts">定义核心对象的最小邻域点数MinPts</param>
        /// <param name="points">样本点数据集</param>
        public OPTICS(double eps, int minPts, PointsList points)
        {
            _points = points._points.ToArray();
            _eps    = eps;
            _minPts = minPts;

            //创建新的结果队列对象
            _outputIndexes = new List <UInt32>(_points.Length);
            //创建长度 = 样本集长度的有序队列
            _seeds = new PriorityQueue.HeapPriorityQueue <Point>(_points.Length);
        }
Пример #13
0
        protected override void SetPointCollection()
        {
            // do zaznaczenia wielokata potrzebne sa wszystkie wierzcholki
            PointsList.Clear();
            PointsList.Add(PathFigure.StartPoint);

            foreach (LineSegment line in Lines)
            {
                PointsList.Add(line.Point);
            }
        }
Пример #14
0
 public void SetUp()
 {
     mockedPointslistObj = new PointsList {
         Id = 1, Points = twoOverlapedSquaresPoints, Squares = twoOverlapedSquares, IsSquaresUpdateNeeded = false
     };
     mockRepository           = new MockRepository(MockBehavior.Strict);
     mockPointsListRepository = this.mockRepository.Create <IPointsListRepository>();
     mockUnitOfWork           = this.mockRepository.Create <IUnitOfWork>();
     mockPointsListRepository.Setup(r => r.Get(It.IsAny <int>())).Returns(mockedPointslistObj);
     mockUnitOfWork.SetupGet(u => u.PointsListRepository).Returns(this.mockPointsListRepository.Object);
     mockUnitOfWork.Setup(u => u.Commit());
 }
Пример #15
0
 public void AddPeak()
 {
     if (Edge.EdgeNumber == 1)
     {
         PointsList.Add(TouchPoint);
     }
     else
     {
         PointsList.Insert(Edge.EdgeNumber - 1, TouchPoint);
     }
     AnglesNumber++;
 }
Пример #16
0
        /// <param name="linguisticVariableName">The name that identifies linguistic variable.</param>
        /// <param name="x0">The value of the (x0, 0) point.</param>
        /// <param name="x1">The value of the (x1, 1) point.</param>
        /// <param name="x2">The value of the (x2, 1) point.</param>
        /// <param name="x3">The value of the (x3, 0) point.</param>
        public TrapezoidalMembershipFunction(string linguisticVariableName, double x0, double x1, double x2, double x3) : base(linguisticVariableName)
        {
            if (x0 > x1 || x1 > x2 || x2 > x3)
            {
                throw new ArgumentException("Points order is violated.");
            }

            PointsList.Add(x0);
            PointsList.Add(x1);
            PointsList.Add(x2);
            PointsList.Add(x3);
        }
        /// <summary>
        /// 传入poiid列表,返回由poiid,经纬度坐标组成的PointList,用于Optics聚类
        /// </summary>
        /// <param name="items">List(poiid)</param>
        /// <returns></returns>
        public PointsList create_points(List <string> items)
        {
            PointsList points = new PointsList();

            foreach (var item in items)
            {
                double[] pointVector = new double[2];
                //传入坐标点的经纬度
                pointVector[0] = POIcategory[item].Item1;
                pointVector[1] = POIcategory[item].Item2;
                //添加点到队列(poiid,[longitude latitude])
                points.AddPoint(item, pointVector);
            }

            return(points);
        }
Пример #18
0
 /// <summary>
 /// Remove point from current points list.
 /// Update bounding box.
 /// </summary>
 /// <param name="old">Points that might be delete</param>
 public void RemovePoints(Data old)
 {
     foreach (var point in old.PointsList)
     {
         int i = 0;
         while (i < PointsList.Count)
         {
             if (DecimalTools.Compare(point, PointsList[i]))
             {
                 PointsList.RemoveAt(i);
                 break;
             }
             i++;
         }
     }
     Update();
 }
Пример #19
0
        public void CreatSubject()
        {
            for (int i = 0; i < NumberOfLine; i++)
            {
                var rectangle = new Rectangle
                {
                    Width  = 10,
                    Height = 110,
                    Fill   = new SolidColorBrush(Colors.White)
                };

                Point = new Point(225, -120);
                Canvas.SetLeft(rectangle, Point.X);
                Canvas.SetTop(rectangle, Point.Y);

                UIElements.Add(rectangle);
                PointsList.Add(Point);
            }
        }
Пример #20
0
        public override void CreatSubject()
        {
            for (int i = 0; i < NumberOfObjects; i++)
            {
                Image coinImage = new Image
                {
                    Width  = 20,
                    Height = 20,
                    Source = new BitmapImage(new Uri("Images/Coins/Coin.png", UriKind.Relative))
                };
                Xpoint = CommonMetheds.NewPoints();

                Point = new Point(Xpoint, 10);
                Canvas.SetLeft(coinImage, Point.X);
                Canvas.SetTop(coinImage, Point.Y);

                UIElements.Add(coinImage);
                PointsList.Add(Point);
            }
        }
Пример #21
0
        public IActionResult CreatePointsList(
            [FromBody] PointsListForCreation pointsList)
        {
            try
            {
                if (pointsList == null)
                {
                    return(BadRequest());
                }

                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                var pointsLists = PointsDataStore.Current.PointsLists;

                var listWithSameName = PointsDataStore.Current.PointsLists.FirstOrDefault(pl => pl.Name == pointsList.Name);

                if (listWithSameName != null)
                {
                    pointsLists.Remove(listWithSameName);
                }

                var finalPointsList = new PointsList()
                {
                    Id     = ++maxId,
                    Name   = pointsList.Name,
                    Points = pointsList.Points
                };

                pointsLists.Add(finalPointsList);

                return(Ok());
            }
            catch (Exception ex)
            {
                _logger.LogCritical($"Exception while creating points list in points list.", ex);
                return(StatusCode(500, "A problem happened while handling your request."));
            }
        }
Пример #22
0
        public override void CreatSubject()
        {
            for (int i = 0; i < NumberOfObjects; i++)
            {
                Point = new Point(CommonMetheds.NewPoints(), 10);

                Image policeImage = new Image
                {
                    Width   = 70,
                    Height  = 70,
                    Stretch = Stretch.Fill,
                    Source  = new BitmapImage(new Uri("Images/Obstacle/PoliceCar.png", UriKind.Relative))
                };

                Canvas.SetLeft(policeImage, Point.X);
                Canvas.SetTop(policeImage, Point.Y);

                UIElements.Add(policeImage);
                PointsList.Add(Point);
            }
        }
Пример #23
0
        public PointsList Create(CreatePointsListRequest model)
        {
            var newPointsList = new PointsList
            {
                Points = new List <Point>()
            };

            if (model.Points != null && model.Points.Any())
            {
                foreach (var point in model.Points)
                {
                    if (!newPointsList.Points.Contains(point))
                    {
                        newPointsList.Points.Add(point);
                    }
                }
            }
            _unitOfWork.PointsListRepository.Add(newPointsList);
            _unitOfWork.Commit();
            return(newPointsList);
        }
Пример #24
0
        public void Notify_IncreaseSize()
        {
            Point[] bounds = new Point[PointsList.Count];
            PointsList.CopyTo(bounds, 0);

            foreach (Figure figure in Observers)
            {
                double figureThicknessHalf = figure.GetBorderThickness() / 2;
                bounds[0].X += figureThicknessHalf;//
                bounds[1].X -= figureThicknessHalf;
                bounds[0].Y += figureThicknessHalf;
                bounds[1].Y -= figureThicknessHalf;


                if (figure.GetPointCollection().Any(point => point.X < bounds[0].X || point.X > bounds[1].X || point.Y <bounds[0].Y || point.Y> bounds[1].Y))
                {
                    continue;
                }

                figure.IncreaseSize();
            }
        }
        public void SetUp()
        {
            mockedPointsListEmpty = new PointsList {
                Id = 1, Points = new List <Point>(), Squares =
                    new List <Square>(), IsSquaresUpdateNeeded = false
            };
            mockedPointsListOneSquare = new PointsList {
                Id = 2, Points = simpleSquare, Squares =
                    new List <Square>()
                {
                    new Square {
                        Points = simpleSquare
                    }
                }, IsSquaresUpdateNeeded = false
            };
            validCreatePointsListRequest = new CreatePointsListRequest {
                Points = simpleSquare
            };
            this.mockRepository = new MockRepository(MockBehavior.Strict);

            this.mockPointsListService = this.mockRepository.Create <IPointsListService>();
        }
Пример #26
0
            public ShowAnglesToolGraphic()
            {
                base.Graphics.Add(_angleCalloutGraphic1 = new AngleCalloutGraphic());
                base.Graphics.Add(_angleCalloutGraphic2 = new AngleCalloutGraphic());
                base.Graphics.Add(_extenderLine1        = new LinePrimitive());
                base.Graphics.Add(_extenderLine2        = new LinePrimitive());
                base.Graphics.Add(_riserLine1           = new LinePrimitive());
                base.Graphics.Add(_riserLine2           = new LinePrimitive());

                _angleCalloutGraphic1.ShowArrowhead = _angleCalloutGraphic2.ShowArrowhead = false;
                _angleCalloutGraphic1.LineStyle     = _angleCalloutGraphic2.LineStyle = LineStyle.Dash;
                _angleCalloutGraphic1.Name          = "callout1";
                _angleCalloutGraphic2.Name          = "callout2";
                _extenderLine1.Name = "extender1";
                _extenderLine2.Name = "extender2";
                _riserLine1.Name    = "riser1";
                _riserLine2.Name    = "riser2";

                _endPoints = new PointsList(new PointF[] { PointF.Empty, PointF.Empty, PointF.Empty, PointF.Empty }, this);

                this.Color     = Color.Coral;
                this.LineStyle = LineStyle.Dot;
            }
Пример #27
0
 public void AddSquares(PointsList entity, List <Square> squares)
 {
     entity.Squares.AddRange(squares);
     entity.IsSquaresUpdateNeeded = false;
 }
Пример #28
0
 public TexturePoint GetPointSlow(Point point)
 {
     return(PointsList.FirstOrDefault(p => p.Position == point));
 }
Пример #29
0
 protected DicomEllipseGraphic(DicomEllipseGraphic source, ICloningContext context) : base()
 {
     context.CloneFields(source, this);
     _points = new PointsList(source._points, this);
     _points.PointChanged += OnPointChanged;
 }
Пример #30
0
            /// <summary>
            /// Cloning constructor.
            /// </summary>
            /// <param name="source">The source object from which to clone.</param>
            /// <param name="context">The cloning context object.</param>
            protected ShowAnglesToolGraphic(ShowAnglesToolGraphic source, ICloningContext context) : base()
            {
                context.CloneFields(source, this);

                _endPoints = new PointsList(source._endPoints, this);
            }