Пример #1
0
 /// <summary>
 /// AStar Constructor.
 /// </summary>
 /// <param name="G">The graph on which AStar will perform the search.</param>
 public SimMovement(SimGlobalRoutes G)
 {
     _Graph                   = G;
     _Open                    = new SortableList();
     _Closed                  = new SortableList();
     ChoosenHeuristic         = EuclidianHeuristic;
     DijkstraHeuristicBalance = 0.5f;
 }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pathName"></param>
        /// <returns></returns>
        internal bool LoadFile(string pathName)
        {
            Stream StreamRead = (new FileInfo(pathName)).OpenRead();

            if (StreamRead != null)
            {
                BinaryFormatter BinaryRead = new BinaryFormatter();
                SimGlobalRoutes G          = (SimGlobalRoutes)BinaryRead.Deserialize(StreamRead);
                StreamRead.Close();
                Clear();
                //   RegionFileName = pathName;
                SimRoutes    = G.SimRoutes;
                SimWaypoints = G.SimWaypoints;
                //  Logger.Log("Loaded file " + RegionFileName, OpenMetaverse.Helpers.LogLevel.Info);
                return(true);
            }
            // Logger.Log("Error loading file " + RegionFileName, OpenMetaverse.Helpers.LogLevel.Error);
            return(false);
        }
Пример #3
0
        /// <summary>
        /// Constructor.
        /// </summary>       
        private SimGlobalRoutes(String simName,int regionX,int regionY, int size)
        {
            Instance = this;
            RegionX = regionX;
            SimsSize = size;
            RegionY = regionY;
            RegionFileName = simName;
            SimWaypoints = new List<SimWaypoint>();
            SimRoutes = new List<SimRoute>();
            StartX = RegionX * 256;
            StartY = RegionY * 256;
            Bigness = SimsSize * 256;

            EndX = Bigness + StartX;
            EndY = Bigness + StartY;
            TotalX = (EndX - StartX) / StepSize;
            TotalY = (EndY - StartY) / StepSize;
            saved = new SimWaypoint[TotalX+1, TotalY+1];
            CreateDefaultRoutes();
            LoadFromFile();
        }
Пример #4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        private SimGlobalRoutes(String simName, int regionX, int regionY, int size)
        {
            Instance       = this;
            RegionX        = regionX;
            SimsSize       = size;
            RegionY        = regionY;
            RegionFileName = simName;
            SimWaypoints   = new List <SimWaypoint>();
            SimRoutes      = new List <SimRoute>();
            StartX         = RegionX * 256;
            StartY         = RegionY * 256;
            Bigness        = SimsSize * 256;

            EndX   = Bigness + StartX;
            EndY   = Bigness + StartY;
            TotalX = (EndX - StartX) / StepSize;
            TotalY = (EndY - StartY) / StepSize;
            saved  = new SimWaypoint[TotalX + 1, TotalY + 1];
            CreateDefaultRoutes();
            LoadFromFile();
        }
Пример #5
0
 /// <summary>
 /// AStar Constructor.
 /// </summary>
 /// <param name="G">The graph on which AStar will perform the search.</param>
 public SimMovement(SimGlobalRoutes G)
 {
     _Graph = G;
     _Open = new SortableList();
     _Closed = new SortableList();
     ChoosenHeuristic = EuclidianHeuristic;
     DijkstraHeuristicBalance = 0.5f;
 }
Пример #6
0
        public GraphFormer(SimGlobalRoutes SPS)
        {
            DEBUGGER = this;
            StartX = SPS.StartX;
            StartY = SPS.StartY;
            MenuContextuel = new ContextMenu();
            MenuContextuel.MenuItems.Add(new MenuItem("Automatic", new EventHandler(ChoixAutomatique)));
            MenuContextuel.MenuItems.Add(new MenuItem("Step by step", new EventHandler(ChoixPasAPas)));
            InitializeComponent();
            BoutonAEtoile.DropDownMenu = MenuContextuel;

            G = SPS;// SimPathStore.Default;
            NouveauGraphe();
            Mode = Action.Dessiner;
        }