Esempio n. 1
0
        private void runMap()
        {
            Out.put("Starting drawing agents..");

            List <Agent> agents = MapSync.getProducedAgents();
            Dictionary <int, UIElement> rectangles = null;
            bool init       = true;
            var  copyMap    = master.getMapCopy();
            var  clusterGen = new ClusterGenerator(clusterSize);
            var  clusters   = clusterGen.generateClusters(copyMap);

            //drawPaths(clusters);

            while (simulationRun)
            {
                agents = MapSync.getProducedAgents();
                this.Dispatcher.Invoke((Action)(() =>
                {
                    if (init)
                    {
                        drawClusters(clusters);
                        //drawPaths(clusters);
                        init = false;
                    }
                    rectangles = updateAgents(agents, rectangles);
                }));
            }

            this.Dispatcher.Invoke((Action)(() =>
            {
                disposeAgents();
            }));

            Out.put("Agent drawing stopped...");
        }
Esempio n. 2
0
        private void setupMainWindow()
        {
            this.network = new Network(workerMode, ipAddress);
            master       = new SimulationMaster(this, this.network, this.simplePath);
            master.setClusterSize(clusterSize);
            List <Agent> agents = MapSync.getProducedAgents();

            setWindowSize(master.getMapHeight() + 200, master.getMapWidth() + 100);
            setUpCanvas(master.getMapHeight(), master.getMapWidth());
            numAgents.Text = "" + master.getNumAgents();
            ipTextBox.Text = "" + ipAddress;
        }
 void Awake()
 {
     mInstance = this;
 }