Ejemplo n.º 1
0
        private bool CheckVisibility(BidirectionalEdge <ISatellite> edge)
        {
            var vessel    = PlanetariumCamera.fetch.target.vessel;
            var satellite = RTCore.Instance.Satellites[vessel];

            if (satellite != null && ShowPath)
            {
                var connections = RTCore.Instance.Network[satellite];
                if (connections.Any() && connections[0].Contains(edge))
                {
                    return(true);
                }
            }
            if (edge.Type == LinkType.Omni && !ShowOmni)
            {
                return(false);
            }
            if (edge.Type == LinkType.Dish && !ShowDish)
            {
                return(false);
            }
            if (!edge.A.Visible || !edge.B.Visible)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
        private void UpdateMesh(BidirectionalEdge <ISatellite> edge)
        {
            var camera = MapView.MapCamera.camera;

            var start = camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(edge.A.Position));
            var end   = camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(edge.B.Position));

            var segment = new Vector3(end.y - start.y, start.x - end.x, 0).normalized *(LineWidth / 2);

            if (!MapView.Draw3DLines)
            {
                var dist = Screen.height / 2 + 0.01f;
                start.z = start.z >= 0.15f ? dist : -dist;
                end.z   = end.z >= 0.15f ? dist : -dist;
            }

            mPoints2D[0] = (start - segment);
            mPoints2D[1] = (start + segment);
            mPoints2D[2] = (end - segment);
            mPoints2D[3] = (end + segment);

            mPoints3D[0] = camera.ScreenToWorldPoint(mPoints2D[0]);
            mPoints3D[1] = camera.ScreenToWorldPoint(mPoints2D[1]);
            mPoints3D[2] = camera.ScreenToWorldPoint(mPoints2D[2]);
            mPoints3D[3] = camera.ScreenToWorldPoint(mPoints2D[3]);

            mMeshFilter.mesh.vertices = MapView.Draw3DLines ? mPoints3D : mPoints2D;
            mMeshFilter.mesh.RecalculateBounds();
            mMeshFilter.mesh.MarkDynamic();
        }
Ejemplo n.º 3
0
        private Color CheckColor(BidirectionalEdge <ISatellite> edge)
        {
            var vessel    = PlanetariumCamera.fetch.target.vessel;
            var satellite = RTCore.Instance.Satellites[vessel];

            if (satellite != null && ShowPath)
            {
                var connections = RTCore.Instance.Network[satellite];
                if (connections.Any() && connections[0].Contains(edge))
                {
                    return(RTSettings.Instance.ActiveConnectionColor);
                }
            }
            if (ShowMultiPath && edge.A.Visible && edge.B.Visible) // purpose of edge-visibility condition is to prevent unnecessary performance off-screen
            {
                var satellites = RTCore.Instance.Network.ToArray();
                for (int i = 0; i < satellites.Length; i++)
                {
                    var connections = RTCore.Instance.Network[satellites[i]]; // get the working-connection path of every satellite
                    if (connections.Any() && connections[0].Contains(edge))
                    {
                        return(RTSettings.Instance.ActiveConnectionColor);
                    }
                }
            }

            if (RTSettings.Instance.SignalRelayEnabled)
            {
                var satA = RTCore.Instance.Satellites[edge.A.Guid];
                var satB = RTCore.Instance.Satellites[edge.B.Guid];
                if ((satA != null && !satA.CanRelaySignal) || (satB != null && !satB.CanRelaySignal))
                {
                    return(RTSettings.Instance.DirectConnectionColor);
                }
            }

            if (edge.Type == LinkType.Omni)
            {
                return(RTSettings.Instance.OmniConnectionColor);
            }
            if (edge.Type == LinkType.Dish)
            {
                return(RTSettings.Instance.DishConnectionColor);
            }

            return(XKCDColors.Grey);
        }
Ejemplo n.º 4
0
        private bool CheckVisibility(BidirectionalEdge <ISatellite> edge)
        {
            var vessel    = PlanetariumCamera.fetch.target.vessel;
            var satellite = RTCore.Instance.Satellites[vessel];

            if (satellite != null && ShowPath)
            {
                var connections = RTCore.Instance.Network[satellite];
                if (connections.Any() && connections[0].Contains(edge))
                {
                    return(true);
                }
            }
            if (ShowMultiPath && edge.A.Visible && edge.B.Visible) // purpose of edge-visibility condition is to prevent unnecessary performance off-screen
            {
                var satellites = RTCore.Instance.Network.ToArray();
                for (int i = 0; i < satellites.Length; i++)
                {
                    var connections = RTCore.Instance.Network[satellites[i]]; // get the working-connection path of every satellite
                    if (connections.Any() && connections[0].Contains(edge))
                    {
                        return(true);
                    }
                }
            }
            if (edge.Type == LinkType.Omni && !ShowOmni)
            {
                return(false);
            }
            if (edge.Type == LinkType.Dish && !ShowDish)
            {
                return(false);
            }
            if (!edge.A.Visible || !edge.B.Visible)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 5
0
        private Color CheckColor(BidirectionalEdge <ISatellite> edge)
        {
            var vessel    = PlanetariumCamera.fetch.target.vessel;
            var satellite = RTCore.Instance.Satellites[vessel];

            if (satellite != null && ShowPath)
            {
                var connections = RTCore.Instance.Network[satellite];
                if (connections.Any() && connections[0].Contains(edge))
                {
                    return(RTSettings.Instance.ActiveConnectionColor);
                }
            }
            if (edge.Type == LinkType.Omni)
            {
                return(RTSettings.Instance.OmniConnectionColor);
            }
            if (edge.Type == LinkType.Dish)
            {
                return(RTSettings.Instance.DishConnectionColor);
            }

            return(XKCDColors.Grey);
        }
Ejemplo n.º 6
0
 public bool Contains(BidirectionalEdge <T> edge)
 {
     if (Links.Count == 0)
     {
         return(false);
     }
     if ((Start.Equals(edge.A) && Links[0].Target.Equals(edge.B)) ||
         (Start.Equals(edge.B) && Links[0].Target.Equals(edge.A)))
     {
         return(true);
     }
     for (int i = 0; i < Links.Count - 1; i++)
     {
         if (Links[i].Target.Equals(edge.A) && Links[i + 1].Target.Equals(edge.B))
         {
             return(true);
         }
         if (Links[i].Target.Equals(edge.B) && Links[i + 1].Target.Equals(edge.A))
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 7
0
 public bool Equals(BidirectionalEdge <T> other)
 {
     return((A.Equals(other.A) || A.Equals(other.B)) &&
            (B.Equals(other.A) || B.Equals(other.B)));
 }