コード例 #1
0
        public override string GetPath(List <TVIModel> path, Pathtype pt)
        {
            string result = string.Empty;

            for (int i = 0; i < path.Count; i++)
            {
                result += GetPathConcatenationString() + (pt == Pathtype.Id ? path[i].Id : path[i].DisplayName);
            }
            return(result);
        }
コード例 #2
0
        public virtual string GetPath(List <TVIModel> path, Pathtype pt)
        {
            string result = string.Empty;

            foreach (TVIModel node in path)
            {
                result += (pt == Pathtype.DisplayName? node.DisplayName : node.Id) + GetPathConcatenationString();
            }
            return(result);
        }
コード例 #3
0
ファイル: ThemeManager.cs プロジェクト: Creative2/tab_slider
        public static ImageSource imageSourceGnrator(string path,Pathtype pt)
        {
            try
            {
                if (pt == Pathtype.path)
                {
                    return new BitmapImage(new Uri(path));
                }
                else
                {
                    return new BitmapImage(new Uri(path, UriKind.Relative));
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message, "Error in image..");
                return null;

            }
        }
コード例 #4
0
ファイル: Dijkstra.cs プロジェクト: C9Glax/DotMaps
        public static List <Graph.GraphNode> FindPath(Graph.GraphNode start, Graph.GraphNode goal, Pathtype pathtype)
        {
            Queue <Graph.GraphNode> toExplore = new Queue <Graph.GraphNode>();

            toExplore.Enqueue(goal);
            Graph.GraphNode currentNode = toExplore.Peek();
            while (toExplore.Count > 0)
            {
                foreach (Graph.Connection connection in currentNode.connections)
                {
                    switch (pathtype)
                    {
                    case Pathtype.SHORTEST:
                        if (connection.neighbor.weight < currentNode.weight + connection.distance)
                        {
                            connection.neighbor.weight   = currentNode.weight + connection.distance;
                            connection.neighbor.previous = currentNode;
                            if (currentNode != start)
                            {
                                toExplore.Enqueue(connection.neighbor);
                            }
                        }
                        break;

                    case Pathtype.FASTEST:
                        if (connection.neighbor.weight < currentNode.weight + connection.timeNeeded)
                        {
                            connection.neighbor.weight   = currentNode.weight + connection.timeNeeded;
                            connection.neighbor.previous = currentNode;
                            if (currentNode != start)
                            {
                                toExplore.Enqueue(connection.neighbor);
                            }
                        }
                        break;
                    }
                }
                currentNode = toExplore.Dequeue();
            }

            List <Graph.GraphNode> path = new List <Graph.GraphNode>();

            while (currentNode.previous != null)
            {
                path.Add(currentNode);
                currentNode = currentNode.previous;
            }
            return(path);
        }