예제 #1
0
        public void Clear_RemovesAllCoordinatesFromList()
        {
            CoordinateList target = new CoordinateList(_coordinates);

            target.Clear();

            Assert.Empty(target.ToArray());
            Assert.Equal(0, target.Count);
        }
예제 #2
0
    public void MoveAlongPath(CursorController.Coordinate[] path, bool turnBased)
    {
        print(path.Length);

        _turnBased   = turnBased;
        _canWalkPath = true;
        _path.Clear();

        foreach (CursorController.Coordinate coordinate in path)
        {
            _path.Add(coordinate);
        }

        ResetCurrentPosition();

        print(path.Length);

        this._unit.SetPosition(path[path.Length - 1].x, _path[path.Length - 1].z);
    }
예제 #3
0
            public void Visit(QuadEdge[] triEdges)
            {
                _coordList.Clear();
                for (int i = 0; i < 3; i++)
                {
                    var v = triEdges[i].Orig;
                    _coordList.Add(v.Coordinate);
                }
                if (_coordList.Count > 0)
                {
                    _coordList.CloseRing();
                    var pts = _coordList.ToCoordinateArray();
                    if (pts.Length != 4)
                    {
                        //CheckTriangleSize(pts);
                        return;
                    }

                    _triCoords.Add(pts);
                }
            }
예제 #4
0
        /// <summary>
        /// 绘制出
        /// </summary>
        /// <param name="records"></param>
        public void drawRoute(List <CmpForm.Record> records)
        {
            ClearMap();
            List <LineString> routes = new List <LineString>();
            List <LineString> stdRoutes = new List <LineString>();
            LineString        route = null;
            LineString        stdRoute = null;
            CoordinateList    routeCoord = new CoordinateList();
            CoordinateList    stdRouteCoord = new CoordinateList();
            List <Point>      points = new List <Point>();
            Edge edge = null, prev_edge = null;
            Edge stdEdge = null, prev_stdEdge = null;

            for (int i = 0; i < records.Count; i++)
            {
                CmpForm.Record r = records[i];
                if (r.EdgeId >= 0)
                {
                    edge = graph.Edges[r.EdgeId];
                    if (edge != prev_edge)
                    {
                        if (prev_edge == null)
                        {
                            routeCoord.Add(edge.Start.Corrdinate);
                            routeCoord.Add(edge.End.Corrdinate);
                        }
                        else if (edge.Start.ID != prev_edge.End.ID)
                        {
                            routes.Add(new LineString(routeCoord.ToArray()));
                            routeCoord.Clear();
                            routeCoord.Add(edge.Start.Corrdinate);
                            routeCoord.Add(edge.End.Corrdinate);
                        }
                        else
                        {
                            routeCoord.Add(edge.End.Corrdinate);
                        }
                    }
                    prev_edge = edge;
                }
                if (r.StdEdgeId >= 0)
                {
                    stdEdge = graph.Edges[r.StdEdgeId];
                    if (stdEdge != prev_stdEdge)
                    {
                        if (prev_stdEdge == null)
                        {
                            stdRouteCoord.Add(stdEdge.Start.Corrdinate);
                            stdRouteCoord.Add(stdEdge.End.Corrdinate);
                        }
                        else if (stdEdge.Start.ID != prev_stdEdge.End.ID)
                        {
                            stdRoutes.Add(new LineString(stdRouteCoord.ToArray()));
                            stdRouteCoord.Add(stdEdge.Start.Corrdinate);
                            stdRouteCoord.Add(stdEdge.End.Corrdinate);
                        }
                        else
                        {
                            stdRouteCoord.Add(stdEdge.End.Corrdinate);
                        }
                        //stdRoutes.Add(stdRoute);
                    }
                    prev_stdEdge = stdEdge;
                }
                Point p = new Point(r.Lng, r.Lat);
                points.Add(p);
            }
            if (routeCoord.Count > 0)
            {
                routes.Add(new LineString(routeCoord.ToArray()));
            }
            if (stdRouteCoord.Count > 0)
            {
                stdRoutes.Add(new LineString(stdRouteCoord.ToArray()));
            }

            foreach (LineString r in routes)
            {
                drawLine(r);
            }
            foreach (LineString r in stdRoutes)
            {
                drawStdLine(r);
            }
            //drawStdLine(stdRoute);
            drawPoint(points);
            RefreshMap();
        }