public CalculateRow(int xFrom, int xTo, InfluenceCalculator map, int quanta)
 {
     this.x_from = xFrom;
     this.x_to   = xTo;
     this.map    = map;
     prevInf     = new double[quanta];
     curBorder   = new bool[quanta];
     curRow      = new Alliance[quanta];
     prevRow     = new Alliance[quanta];
     sovMap      = new Alliance[MapConstants.HORIZONTAL_SIZE / MapConstants.SAMPLE_RATE,
                                MapConstants.VERTICAL_SIZE / MapConstants.SAMPLE_RATE];
 }
Exemple #2
0
        private void resolveDBInformation()
        {
            //            imagePanel = new JPanel(); //TODO:GUI

//            graphicsManager.setColor(new Color(0, 0, 0x0));
//            graphicsManager.fillRect(0, 0, MapConstants.HORIZONTAL_SIZE, MapConstants.VERTICAL_SIZE);
            alliances = DAL.GetAlliances().ToDictionary(p => p.id, p => p);
            var solarSystems = DAL.GetSystems().Select(p => new GraphicModel.SolarSystem(p));

            systems = solarSystems.ToDictionary(p => p.systemid, p => p);
            var systemJumps = DAL.GetSystemJumps();
            HashSet <GraphicModel.Jump> jumps = new HashSet <Jump>(systemJumps.Select(p => new GraphicModel.Jump(systems[p.fromsystem],
                                                                                                                 systems[p.tosystem])).Distinct());

            foreach (var systemJump in systemJumps)
            {
                if (!jumpsTable.ContainsKey(systemJump.fromsystem))
                {
                    jumpsTable.Add(systemJump.fromsystem, new List <GraphicModel.SolarSystem>());
                }

                jumpsTable[systemJump.fromsystem].Add(systems[systemJump.tosystem]);
            }

            var oldColors = DAL.GetOldSov();

            systemsSov = solarSystems.Where(p => p.allianceid > 0).ToList();

            var ssorig = systemsSov.ToList();

            foreach (var solarSystem in ssorig)
            {
                manageInfluence(solarSystem);
            }
            addNPCAlliances(systems);

            InfluenceCalculator influenceMap = new InfluenceCalculator(this, sovDate, jumps);

            influenceMap.oldColors = oldColors;
            influenceMap.run();
//
//            if (oldColors != null)
//                influenceMap.setOldSysSovs(oldColors);
//            //			System.out.println(Runtime.getRuntime().freeMemory()/1048576 + "MB");
//            new Thread(influenceMap, "Influence Generator Thread").start();
        }