Exemplo n.º 1
0
        public List<Star> BuildStarCollection(List<StarSystem> systemCollection)
        {
            starCollection = new List<Star>();

            double density = 1000;

            double densityStep = 0;

            densityStep = Math.Ceiling((double)(systemCollection.Count / density));

            int addCount = 0;
            int skipCount = 0;

            if (systemCollection.Count > density) skipCount = (int) density - systemCollection.Count;

            foreach (var starSystem in systemCollection)
            {
                Star star = new Star();

                star.starID = starSystem.ID;
                star.name = starSystem.Name;

                star.originPoint = new Point3D(starSystem.Location.X, starSystem.Location.Y, starSystem.Location.Z);

                star.currentPoint = new Point3D(centerPoint.X - starSystem.Location.X, centerPoint.Y - starSystem.Location.Y, centerPoint.Z - starSystem.Location.Z);

                star.distance = calculateDistance(centerPoint, star.originPoint);

                if (ViewController.selectedStars.Contains(starSystem.ID)) star.selectSystem = true;
                if (ViewController.targetedStars.Contains(starSystem.ID)) star.targetSystem = true;

                if (addCount % densityStep == 0 || star.distance == 0 || skipCount>0 || star.selectSystem || star.targetSystem)
                {
                    starCollection.Add(star);

                }

                else skipCount += 1;

                addCount += 1;
            }

            return starCollection;
        }
Exemplo n.º 2
0
        public List<Star> BuildStarList(List<StarSystem> collection)
        {
            List<Star> tempList = new List<Star>();

            foreach (var starSystem in collection.OrderBy(order => order.Z))
            {
                Star star = new Star();

                star.starID = starSystem.id;
                star.name = starSystem.name;

                star.centerX = 285;
                star.centerY = 285;

                star.zoom = 64;

                star.originPoint = new Point3D(starSystem.X, starSystem.Y, starSystem.Z);

                star.currentPoint = new Point3D(centerPoint.X - starSystem.X, centerPoint.Y - starSystem.Y, centerPoint.Z - starSystem.Z);

                star.distance = calculateDistance(centerPoint, star.originPoint);

                star.BuildName();

                star.InitStar();

               // star.SetSize();

               // star.SetColor();

             //   star.ShowNames();

                tempList.Add(star);

            }

            return tempList;
        }
Exemplo n.º 3
0
        public void Animator_Tick(object sender, EventArgs e)
        {
            if (!starOverlay)
            {

                RenderOverlay.overlayStar.Children.Clear();

                double rotateStep = 0.36;

                renderStarSystems.rotatorPoint.Z += rotateStep;

                if (renderStarSystems.rotatorPoint.Z > 360)
                {
                    renderStarSystems.rotatorPoint.Z = 0;
                }
            }

            if (starOverlay && starOverlayID != -1)
            {
                int index = starSystemCollection.FindIndex(fetchID => fetchID.starID == starOverlayID);

                if (index != -1)
                {
                    Star overlayStar = new Star();

                    overlayStar.starID = starSystemCollection[index].starID;
                    overlayStar.name = starSystemCollection[index].name;

                    overlayStar.centerX = starSystemCollection[index].centerX;
                    overlayStar.centerY = starSystemCollection[index].centerY;

                    overlayStar.currentPoint = starSystemCollection[index].currentPoint;
                    overlayStar.rotaPoint = starSystemCollection[index].rotaPoint;

                    overlayStar.elevation = starSystemCollection[index].elevation;
                    overlayStar.azimuth = starSystemCollection[index].azimuth;

                    overlayStar.zoom = starSystemCollection[index].zoom;

                    overlayStar.InitStar();

                    overlayStar.BuildName();

                    overlayStar.Project3D();

                    overlayStar.size = 32;

                    overlayStar.setOverlay();

                    overlayStar.ShowNames();

                    overlayStar.SetColor();

                    RenderOverlay.overlayStar.Children.Clear();
                    RenderOverlay.overlayStar.Children.Add(overlayStar.starCanvas);

                    renderOverlay.UpdateOverlay(elevation, azimuth);
                    renderStarSystems.headerLabel.Content = overlayStar.originalName;
            }

            starOverlayID = -1;

            }
            renderStarSystems.UpdateRender(starSystemCollection);

            renderOverlay.UpdateOverlay(elevation, azimuth, renderStarSystems.rotatorPoint);
        }