Beispiel #1
0
        private void HandleCharacterSelectionChange()
        {
            EVEData.Character c  = CharacterDropDown.SelectedItem as EVEData.Character;
            EVEData.MapRegion rd = RegionDropDown.SelectedItem as EVEData.MapRegion;

            if (c != null && FollowCharacter)
            {
                EVEData.System s = EVEManager.GetEveSystem(c.Location);
                if (s != null)
                {
                    if (s.Region != rd.Name)
                    {
                        // change region
                        SelectRegion(s.Region);
                    }

                    SelectSystem(c.Location);

                    CharacterDropDown.SelectedItem = c;

                    // force the follow as this will be reset by the region change
                    FollowCharacter = true;
                }
            }
        }
Beispiel #2
0
        private void RawIntelBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (RawIntelBox.SelectedItem == null)
            {
                return;
            }

            EVEData.IntelData intel = RawIntelBox.SelectedItem as EVEData.IntelData;

            foreach (string s in intel.IntelString.Split(' '))
            {
                if (EVEManager.Systems.Keys.Contains(s, StringComparer.OrdinalIgnoreCase))
                {
                    EVEData.System sys = EVEManager.GetEveSystem(s);
                    if (sys == null)
                    {
                        return;
                    }

                    EVEData.MapRegion rd = RegionDropDown.SelectedItem as EVEData.MapRegion;
                    if (rd.Name != sys.Region)
                    {
                        SelectRegion(sys.Region);
                    }


                    SelectSystem(s);
                    return;
                }
            }
        }
Beispiel #3
0
        private void RegionCharacter_ShapeMouseOverHandler(object sender, MouseEventArgs e)
        {
            Shape obj = sender as Shape;

            EVEData.MapRegion selectedRegion = obj.DataContext as EVEData.MapRegion;

            if (obj.IsMouseOver)
            {
                RegionCharacterInfo.PlacementTarget  = obj;
                RegionCharacterInfo.VerticalOffset   = 5;
                RegionCharacterInfo.HorizontalOffset = 15;

                RegionCharacterInfoSP.Children.Clear();

                foreach (EVEData.LocalCharacter lc in EVEData.EveManager.Instance.LocalCharacters)
                {
                    EVEData.System s = EVEData.EveManager.Instance.GetEveSystem(lc.Location);
                    if (s != null && s.Region == selectedRegion.Name)
                    {
                        Label l = new Label();
                        l.Content = lc.Name + " (" + lc.Location + ")";
                        RegionCharacterInfoSP.Children.Add(l);
                    }
                }

                RegionCharacterInfo.IsOpen = true;
            }
            else
            {
                RegionCharacterInfo.IsOpen = false;
            }
        }
Beispiel #4
0
        private void SysContexMenuItemZKB_Click(object sender, RoutedEventArgs e)
        {
            EVEData.MapSystem eveSys = ((System.Windows.FrameworkElement)((System.Windows.FrameworkElement)sender).Parent).DataContext as EVEData.MapSystem;
            EVEData.MapRegion rd     = EVEManager.GetRegion(eveSys.Region);

            string uRL = string.Format("https://zkillboard.com/system/{0}", eveSys.ActualSystem.ID);

            System.Diagnostics.Process.Start(uRL);
        }
Beispiel #5
0
        private void SysContexMenuItemDotlan_Click(object sender, RoutedEventArgs e)
        {
            EVEData.MapSystem eveSys = ((System.Windows.FrameworkElement)((System.Windows.FrameworkElement)sender).Parent).DataContext as EVEData.MapSystem;
            EVEData.MapRegion rd     = EVEManager.GetRegion(eveSys.Region);

            string uRL = string.Format("http://evemaps.dotlan.net/map/{0}/{1}", rd.DotLanRef, eveSys.Name);

            System.Diagnostics.Process.Start(uRL);
        }
Beispiel #6
0
        private void AddHighlightToSystem(string name)
        {
            EVEData.MapRegion rd = RegionDropDown.SelectedItem as EVEData.MapRegion;
            if (!rd.MapSystems.Keys.Contains(name))
            {
                return;
            }

            EVEData.MapSystem selectedSys = rd.MapSystems[name];
            if (selectedSys != null)
            {
                double circleSize   = 30;
                double circleOffset = circleSize / 2;

                // add circle for system
                Shape highlightSystemCircle = new Ellipse()
                {
                    Height = circleSize, Width = circleSize
                };
                highlightSystemCircle.Stroke = new SolidColorBrush(MapConf.ActiveColourScheme.SelectedSystemColour);

                highlightSystemCircle.StrokeThickness = 3;

                RotateTransform rt = new RotateTransform();
                rt.CenterX = circleSize / 2;
                rt.CenterY = circleSize / 2;
                highlightSystemCircle.RenderTransform = rt;

                DoubleCollection dashes = new DoubleCollection();
                dashes.Add(1.0);
                dashes.Add(1.0);

                highlightSystemCircle.StrokeDashArray = dashes;

                Canvas.SetLeft(highlightSystemCircle, selectedSys.LayoutX - circleOffset);
                Canvas.SetTop(highlightSystemCircle, selectedSys.LayoutY - circleOffset);
                Canvas.SetZIndex(highlightSystemCircle, 19);

                MainCanvas.Children.Add(highlightSystemCircle);
                DynamicMapElements.Add(highlightSystemCircle);

                DoubleAnimation da = new DoubleAnimation();
                da.From     = 0;
                da.To       = 360;
                da.Duration = new Duration(TimeSpan.FromSeconds(12));

                RotateTransform eTransform = (RotateTransform)highlightSystemCircle.RenderTransform;
                eTransform.BeginAnimation(RotateTransform.AngleProperty, da);
            }
        }
Beispiel #7
0
        private void RegionShape_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Shape obj = sender as Shape;

            EVEData.MapRegion mr = obj.DataContext as EVEData.MapRegion;
            if (mr == null)
            {
                return;
            }

            if (e.ClickCount == 2)
            {
                RoutedEventArgs newEventArgs = new RoutedEventArgs(RequestRegionSelectEvent, mr.Name);
                RaiseEvent(newEventArgs);
            }
        }
Beispiel #8
0
        private void AddSystemIntelOverlay()
        {
            if (!MapConf.ShowIntel)
            {
                return;
            }

            EVEData.MapRegion rd = RegionDropDown.SelectedItem as EVEData.MapRegion;

            foreach (EVEData.IntelData id in EVEManager.IntelDataList)
            {
                foreach (string sysStr in id.Systems)
                {
                    if (rd.IsSystemOnMap(sysStr))
                    {
                        EVEData.MapSystem sys = rd.MapSystems[sysStr];

                        double radiusScale = (DateTime.Now - id.IntelTime).TotalSeconds / (double)MapConf.MaxIntelSeconds;

                        if (radiusScale < 0.0 || radiusScale >= 1.0)
                        {
                            continue;
                        }

                        // add circle to the map
                        double radius       = 100 * (1.0 - radiusScale);
                        double circleOffset = radius / 2;

                        Shape intelShape = new Ellipse()
                        {
                            Height = radius, Width = radius
                        };

                        intelShape.Fill = new SolidColorBrush(MapConf.ActiveColourScheme.IntelOverlayColour);
                        Canvas.SetLeft(intelShape, sys.LayoutX - circleOffset);
                        Canvas.SetTop(intelShape, sys.LayoutY - circleOffset);
                        Canvas.SetZIndex(intelShape, 15);
                        MainCanvas.Children.Add(intelShape);

                        DynamicMapElements.Add(intelShape);
                    }
                }
            }
        }
Beispiel #9
0
        private void RegionShape_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Shape obj = sender as Shape;

            EVEData.MapRegion mr = obj.DataContext as EVEData.MapRegion;
            if (mr == null)
            {
                return;
            }

            if (e.ClickCount == 2)
            {
                RegionRC.SelectRegion(mr.Name);
                if (RegionLayoutDoc != null)
                {
                    RegionLayoutDoc.IsSelected = true;
                }
            }
        }
Beispiel #10
0
        private void RegionThera_ShapeMouseOverHandler(object sender, MouseEventArgs e)
        {
            Shape obj = sender as Shape;

            EVEData.MapRegion selectedRegion = obj.DataContext as EVEData.MapRegion;

            if (obj.IsMouseOver)
            {
                RegionTheraInfo.PlacementTarget  = obj;
                RegionTheraInfo.VerticalOffset   = 5;
                RegionTheraInfo.HorizontalOffset = 15;

                RegionTheraInfoSP.Children.Clear();

                Label header = new Label();
                header.Content    = "Thera Connections";
                header.FontWeight = FontWeights.Bold;
                header.Margin     = new Thickness(1);
                header.Padding    = new Thickness(1);
                RegionTheraInfoSP.Children.Add(header);


                foreach (EVEData.TheraConnection tc in EVEManager.TheraConnections)
                {
                    if (string.Compare(tc.Region, selectedRegion.Name, true) == 0)
                    {
                        Label l = new Label();
                        l.Content = $"    {tc.System}";
                        l.Margin  = new Thickness(1);
                        l.Padding = new Thickness(1);

                        RegionTheraInfoSP.Children.Add(l);
                    }
                }

                RegionTheraInfo.IsOpen = true;
            }
            else
            {
                RegionTheraInfo.IsOpen = false;
            }
        }
Beispiel #11
0
        private void SelectSystem(string name)
        {
            EVEData.MapRegion rd = RegionDropDown.SelectedItem as EVEData.MapRegion;

            foreach (EVEData.MapSystem es in rd.MapSystems.Values.ToList())
            {
                if (es.Name == name)
                {
                    SystemDropDownAC.SelectedItem = es;
                    SelectedSystem = es.Name;
                    AddHighlightToSystem(name);

                    break;
                }
            }

            // now setup the anom data
            EVEData.AnomData system = ANOMManager.GetSystemAnomData(name);
            MainAnomGrid.DataContext = system;
            AnomSigList.ItemsSource  = system.Anoms.Values;
        }
Beispiel #12
0
        private void ShapeMouseOverHandler(object sender, MouseEventArgs e)
        {
            Shape obj = sender as Shape;

            EVEData.MapRegion currentRegion = RegionDropDown.SelectedItem as EVEData.MapRegion;

            EVEData.MapSystem selectedSys = obj.DataContext as EVEData.MapSystem;

            if (obj.IsMouseOver && MapConf.ShowSystemPopup)
            {
                SystemInfoPopup.PlacementTarget  = obj;
                SystemInfoPopup.VerticalOffset   = 5;
                SystemInfoPopup.HorizontalOffset = 15;
                SystemInfoPopup.DataContext      = selectedSys.ActualSystem;

                SystemInfoPopup.IsOpen = true;
            }
            else
            {
                SystemInfoPopup.IsOpen = false;
            }
        }
Beispiel #13
0
        private void OnRegionSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // clear the character selection
            // CharacterDropDown.SelectedItem = null;
            FollowCharacter = false;

            EVEData.MapRegion rd = RegionDropDown.SelectedItem as EVEData.MapRegion;

            EVEManager.UpdateIDsForMapRegion(rd.Name);

            ReDrawMap();
            MapConf.DefaultRegion = rd.Name;

            MainContent.DataContext  = RegionDropDown.SelectedItem;
            MainAnomGrid.DataContext = null;
            AnomSigList.ItemsSource  = null;

            SystemDropDownAC.SelectedItem = null;

            List <EVEData.MapSystem> newList = rd.MapSystems.Values.ToList().OrderBy(o => o.Name).ToList();

            SystemDropDownAC.ItemsSource = newList;
        }
Beispiel #14
0
        private void AddCharactersToMap()
        {
            EVEData.MapRegion rd = RegionDropDown.SelectedItem as EVEData.MapRegion;

            foreach (EVEData.Character c in EVEManager.LocalCharacters)
            {
                if (rd.IsSystemOnMap(c.Location))
                {
                    EVEData.MapSystem ms = rd.MapSystems[c.Location];

                    // add the character to
                    double circleSize   = 26;
                    double circleOffset = circleSize / 2;

                    // add circle for system
                    Shape highlightSystemCircle = new Ellipse()
                    {
                        Height = circleSize, Width = circleSize
                    };

                    highlightSystemCircle.Stroke          = new SolidColorBrush(MapConf.ActiveColourScheme.CharacterHighlightColour);
                    highlightSystemCircle.StrokeThickness = 2;

                    RotateTransform rt = new RotateTransform();
                    rt.CenterX = circleSize / 2;
                    rt.CenterY = circleSize / 2;
                    highlightSystemCircle.RenderTransform = rt;

                    DoubleCollection dashes = new DoubleCollection();
                    dashes.Add(1.0);
                    dashes.Add(1.0);

                    highlightSystemCircle.StrokeDashArray = dashes;

                    Canvas.SetLeft(highlightSystemCircle, ms.LayoutX - circleOffset);
                    Canvas.SetTop(highlightSystemCircle, ms.LayoutY - circleOffset);
                    Canvas.SetZIndex(highlightSystemCircle, 19);

                    MainCanvas.Children.Add(highlightSystemCircle);
                    DynamicMapElements.Add(highlightSystemCircle);

                    // Storyboard s = new Storyboard();
                    DoubleAnimation da = new DoubleAnimation();
                    da.From     = 360;
                    da.To       = 0;
                    da.Duration = new Duration(TimeSpan.FromSeconds(12));

                    RotateTransform eTransform = (RotateTransform)highlightSystemCircle.RenderTransform;
                    eTransform.BeginAnimation(RotateTransform.AngleProperty, da);

                    double textYOffset = -24;
                    double textXOffset = 6;

                    // also add the name of the character above the system
                    Label charText = new Label();
                    charText.Content    = c.Name;
                    charText.Foreground = new SolidColorBrush(MapConf.ActiveColourScheme.CharacterTextColour);

                    if (MapConf.ActiveColourScheme.CharacterTextSize > 0)
                    {
                        charText.FontSize = MapConf.ActiveColourScheme.CharacterTextSize;
                    }

                    Canvas.SetLeft(charText, ms.LayoutX + textXOffset);
                    Canvas.SetTop(charText, ms.LayoutY + textYOffset);
                    Canvas.SetZIndex(charText, 20);
                    MainCanvas.Children.Add(charText);
                    DynamicMapElements.Add(charText);
                }
            }
        }
Beispiel #15
0
        private void AddRegionsToUniverse()
        {
            Brush SysOutlineBrush       = new SolidColorBrush(MapConf.ActiveColourScheme.SystemOutlineColour);
            Brush SysInRegionBrush      = new SolidColorBrush(MapConf.ActiveColourScheme.InRegionSystemColour);
            Brush BackgroundColourBrush = new SolidColorBrush(MapConf.ActiveColourScheme.MapBackgroundColour);

            Brush AmarrBg    = new SolidColorBrush(Color.FromArgb(255, 126, 110, 95));
            Brush MinmatarBg = new SolidColorBrush(Color.FromArgb(255, 143, 120, 120));
            Brush GallenteBg = new SolidColorBrush(Color.FromArgb(255, 127, 139, 137));
            Brush CaldariBg  = new SolidColorBrush(Color.FromArgb(255, 149, 159, 171));


            MainUniverseCanvas.Background = BackgroundColourBrush;
            MainUniverseGrid.Background   = BackgroundColourBrush;

            foreach (EVEData.MapRegion mr in EVEManager.Regions)
            {
                // add circle for system
                Rectangle RegionShape = new Rectangle()
                {
                    Height = 30, Width = 80
                };
                RegionShape.Stroke          = SysOutlineBrush;
                RegionShape.StrokeThickness = 1.5;
                RegionShape.StrokeLineJoin  = PenLineJoin.Round;
                RegionShape.RadiusX         = 5;
                RegionShape.RadiusY         = 5;
                RegionShape.Fill            = SysInRegionBrush;
                RegionShape.MouseDown      += RegionShape_MouseDown;
                RegionShape.DataContext     = mr;

                if (mr.Faction == "Amarr")
                {
                    RegionShape.Fill = AmarrBg;
                }
                if (mr.Faction == "Gallente")
                {
                    RegionShape.Fill = GallenteBg;
                }
                if (mr.Faction == "Minmatar")
                {
                    RegionShape.Fill = MinmatarBg;
                }
                if (mr.Faction == "Caldari")
                {
                    RegionShape.Fill = CaldariBg;
                }


                if (RegionRC.ActiveCharacter != null && RegionRC.ActiveCharacter.ESILinked && MapConf.ShowRegionStandings)
                {
                    float averageStanding = 0.0f;
                    float numSystems      = 0;

                    foreach (EVEData.MapSystem s in mr.MapSystems.Values)
                    {
                        if (s.OutOfRegion)
                        {
                            continue;
                        }

                        numSystems++;


                        if (RegionRC.ActiveCharacter.AllianceID != 0 && RegionRC.ActiveCharacter.AllianceID == s.ActualSystem.SOVAlliance)
                        {
                            averageStanding += 10.0f;
                        }

                        if (s.ActualSystem.SOVCorp != 0 && RegionRC.ActiveCharacter.Standings.Keys.Contains(s.ActualSystem.SOVCorp))
                        {
                            averageStanding += RegionRC.ActiveCharacter.Standings[s.ActualSystem.SOVCorp];
                        }

                        if (s.ActualSystem.SOVAlliance != 0 && RegionRC.ActiveCharacter.Standings.Keys.Contains(s.ActualSystem.SOVAlliance))
                        {
                            averageStanding += RegionRC.ActiveCharacter.Standings[s.ActualSystem.SOVAlliance];
                        }
                    }

                    averageStanding = averageStanding / numSystems;

                    if (averageStanding > 0.5)
                    {
                        Color BlueIsh = Colors.Gray;
                        BlueIsh.B       += (byte)((255 - BlueIsh.B) * (averageStanding / 10.0f));
                        RegionShape.Fill = new SolidColorBrush(BlueIsh);
                    }
                    else if (averageStanding < -0.5)
                    {
                        averageStanding *= -1;
                        Color RedIsh = Colors.Gray;
                        RedIsh.R        += (byte)((255 - RedIsh.R) * (averageStanding / 10.0f));
                        RegionShape.Fill = new SolidColorBrush(RedIsh);
                    }
                    else
                    {
                        RegionShape.Fill = new SolidColorBrush(Colors.Gray);
                    }
                }


                Canvas.SetLeft(RegionShape, mr.RegionX - 40);
                Canvas.SetTop(RegionShape, mr.RegionY - 15);
                Canvas.SetZIndex(RegionShape, 22);
                MainUniverseCanvas.Children.Add(RegionShape);

                Label RegionText = new Label();
                RegionText.Width               = 80;
                RegionText.Height              = 27;
                RegionText.Content             = mr.Name;
                RegionText.Foreground          = SysOutlineBrush;
                RegionText.FontSize            = 10;
                RegionText.HorizontalAlignment = HorizontalAlignment.Center;
                RegionText.VerticalAlignment   = VerticalAlignment.Center;
                RegionText.IsHitTestVisible    = false;

                RegionText.HorizontalContentAlignment = HorizontalAlignment.Center;
                RegionText.VerticalContentAlignment   = VerticalAlignment.Center;


                Canvas.SetLeft(RegionText, mr.RegionX - 40);
                Canvas.SetTop(RegionText, mr.RegionY - 15);
                Canvas.SetZIndex(RegionText, 23);
                MainUniverseCanvas.Children.Add(RegionText);


                if (mr.Faction != "")
                {
                    Label FactionText = new Label();
                    FactionText.Width               = 80;
                    FactionText.Height              = 30;
                    FactionText.Content             = mr.Faction;
                    FactionText.Foreground          = SysOutlineBrush;
                    FactionText.FontSize            = 5;
                    FactionText.HorizontalAlignment = HorizontalAlignment.Center;
                    FactionText.VerticalAlignment   = VerticalAlignment.Center;
                    FactionText.IsHitTestVisible    = false;

                    FactionText.HorizontalContentAlignment = HorizontalAlignment.Center;
                    FactionText.VerticalContentAlignment   = VerticalAlignment.Bottom;

                    Canvas.SetLeft(FactionText, mr.RegionX - 40);
                    Canvas.SetTop(FactionText, mr.RegionY - 15);
                    Canvas.SetZIndex(FactionText, 23);
                    MainUniverseCanvas.Children.Add(FactionText);
                }


                // now add all the region links
                foreach (string s in mr.RegionLinks)
                {
                    EVEData.MapRegion or = EVEManager.GetRegion(s);
                    Line regionLink      = new Line();

                    regionLink.X1 = mr.RegionX;
                    regionLink.Y1 = mr.RegionY;

                    regionLink.X2 = or.RegionX;
                    regionLink.Y2 = or.RegionY;

                    regionLink.Stroke          = SysOutlineBrush;
                    regionLink.StrokeThickness = 1.2;
                    regionLink.Visibility      = Visibility.Visible;

                    Canvas.SetZIndex(regionLink, 21);
                    MainUniverseCanvas.Children.Add(regionLink);
                }
            }
        }
Beispiel #16
0
        private void AddDataToMap()
        {
            EVEData.MapRegion rd = RegionDropDown.SelectedItem as EVEData.MapRegion;

            foreach (EVEData.MapSystem sys in rd.MapSystems.Values.ToList())
            {
                int nPCKillsLastHour  = sys.ActualSystem.NPCKillsLastHour;
                int podKillsLastHour  = sys.ActualSystem.PodKillsLastHour;
                int shipKillsLastHour = sys.ActualSystem.ShipKillsLastHour;
                int jumpsLastHour     = sys.ActualSystem.JumpsLastHour;

                int             infoValue  = -1;
                SolidColorBrush infoColour = new SolidColorBrush(MapConf.ActiveColourScheme.ESIOverlayColour);
                double          infoSize   = 0.0;
                if (MapConf.ShowNPCKills)
                {
                    infoValue = nPCKillsLastHour;
                    infoSize  = 0.15f * infoValue * MapConf.ESIOverlayScale;
                }

                if (MapConf.ShowPodKills)
                {
                    infoValue = podKillsLastHour;
                    infoSize  = 20.0f * infoValue * MapConf.ESIOverlayScale;
                }

                if (MapConf.ShowShipKills)
                {
                    infoValue = shipKillsLastHour;
                    infoSize  = 20.0f * infoValue * MapConf.ESIOverlayScale;
                }

                if (MapConf.ShowShipJumps)
                {
                    infoValue = sys.ActualSystem.JumpsLastHour;
                    infoSize  = infoValue * MapConf.ESIOverlayScale;
                }


                if (infoValue != -1)
                {
                    Shape infoCircle = new Ellipse()
                    {
                        Height = infoSize, Width = infoSize
                    };
                    infoCircle.Fill = infoColour;

                    Canvas.SetZIndex(infoCircle, 10);
                    Canvas.SetLeft(infoCircle, sys.LayoutX - (infoSize / 2));
                    Canvas.SetTop(infoCircle, sys.LayoutY - (infoSize / 2));
                    MainCanvas.Children.Add(infoCircle);
                    DynamicMapElements.Add(infoCircle);
                }


                if (MapConf.ColourBySov && sys.ActualSystem.SOVAlliance != null)
                {
                    Polygon poly = new Polygon();

                    foreach (Point p in sys.CellPoints)
                    {
                        poly.Points.Add(p);
                    }

                    Color c = stringToColour(sys.ActualSystem.SOVAlliance);
                    c.A                  = 75;
                    poly.Fill            = new SolidColorBrush(c);
                    poly.Stroke          = poly.Fill;
                    poly.StrokeThickness = 0.5;
                    MainCanvas.Children.Add(poly);

                    // save the dynamic map elements
                    DynamicMapElements.Add(poly);
                }
            }
        }
Beispiel #17
0
        private void AddSystemsToMap()
        {
            EVEData.MapRegion rd = RegionDropDown.SelectedItem as EVEData.MapRegion;

            foreach (EVEData.Link jump in rd.Jumps)
            {
                Line sysLink = new Line();

                EVEData.MapSystem from = rd.MapSystems[jump.From];
                EVEData.MapSystem to   = rd.MapSystems[jump.To];
                sysLink.X1 = from.LayoutX;
                sysLink.Y1 = from.LayoutY;

                sysLink.X2 = to.LayoutX;
                sysLink.Y2 = to.LayoutY;

                if (jump.ConstelationLink)
                {
                    sysLink.Stroke = new SolidColorBrush(MapConf.ActiveColourScheme.ConstellationGateColour);
                }
                else
                {
                    sysLink.Stroke = new SolidColorBrush(MapConf.ActiveColourScheme.NormalGateColour);
                }

                sysLink.StrokeThickness = 1;
                sysLink.Visibility      = Visibility.Visible;

                Canvas.SetZIndex(sysLink, 19);
                MainCanvas.Children.Add(sysLink);
            }

            if (MapConf.ShowJumpBridges || MapConf.ShowHostileJumpBridges)
            {
                foreach (EVEData.JumpBridge jb in EVEManager.JumpBridges)
                {
                    if (rd.IsSystemOnMap(jb.From) && rd.IsSystemOnMap(jb.To))
                    {
                        if ((jb.Friendly && !MapConf.ShowJumpBridges) || (!jb.Friendly && !MapConf.ShowHostileJumpBridges))
                        {
                            continue;
                        }

                        // jbLink.Data
                        EVEData.MapSystem from = rd.MapSystems[jb.From];
                        EVEData.MapSystem to   = rd.MapSystems[jb.To];

                        Point startPoint = new Point(from.LayoutX, from.LayoutY);
                        Point endPoint   = new Point(to.LayoutX, to.LayoutY);

                        Vector dir = Point.Subtract(startPoint, endPoint);

                        double jbDistance = Point.Subtract(startPoint, endPoint).Length;

                        Size arcSize = new Size(jbDistance + 50, jbDistance + 50);

                        ArcSegment arcseg = new ArcSegment(endPoint, arcSize, 100, false, SweepDirection.Clockwise, true);

                        PathSegmentCollection pscollection = new PathSegmentCollection();
                        pscollection.Add(arcseg);

                        PathFigure pf = new PathFigure();
                        pf.Segments   = pscollection;
                        pf.StartPoint = startPoint;

                        PathFigureCollection pfcollection = new PathFigureCollection();
                        pfcollection.Add(pf);

                        PathGeometry pathGeometry = new PathGeometry();
                        pathGeometry.Figures = pfcollection;

                        System.Windows.Shapes.Path path = new System.Windows.Shapes.Path();
                        path.Data = pathGeometry;

                        if (jb.Friendly)
                        {
                            path.Stroke = new SolidColorBrush(MapConf.ActiveColourScheme.FriendlyJumpBridgeColour);
                        }
                        else
                        {
                            path.Stroke = new SolidColorBrush(MapConf.ActiveColourScheme.HostileJumpBridgeColour);
                        }

                        path.StrokeThickness = 2;

                        DoubleCollection dashes = new DoubleCollection();
                        dashes.Add(1.0);
                        dashes.Add(1.0);

                        path.StrokeDashArray = dashes;

                        Canvas.SetZIndex(path, 19);

                        MainCanvas.Children.Add(path);
                    }
                }
            }

            foreach (EVEData.MapSystem sys in rd.MapSystems.Values.ToList())
            {
                double circleSize   = 15;
                double circleOffset = circleSize / 2;
                double textXOffset  = 5;
                double textYOffset  = -8;
                double textYOffset2 = 6;


                // add circle for system
                Shape systemShape;

                if (sys.ActualSystem.HasNPCStation)
                {
                    systemShape = new Rectangle()
                    {
                        Height = circleSize, Width = circleSize
                    };
                }
                else
                {
                    systemShape = new Ellipse()
                    {
                        Height = circleSize, Width = circleSize
                    };
                }

                systemShape.Stroke = new SolidColorBrush(MapConf.ActiveColourScheme.SystemOutlineColour);

                if (sys.OutOfRegion)
                {
                    systemShape.Fill = new SolidColorBrush(MapConf.ActiveColourScheme.OutRegionSystemColour);
                }
                else
                {
                    systemShape.Fill = new SolidColorBrush(MapConf.ActiveColourScheme.InRegionSystemColour);
                }

                // override with sec status colours
                if (MapConf.ShowSystemSecurity)
                {
                    systemShape.Fill = new SolidColorBrush(MapColours.GetSecStatusColour(sys.ActualSystem.Security));
                }


                systemShape.DataContext = sys;
                systemShape.MouseDown  += ShapeMouseDownHandler;
                systemShape.MouseEnter += ShapeMouseOverHandler;
                systemShape.MouseLeave += ShapeMouseOverHandler;

                Canvas.SetLeft(systemShape, sys.LayoutX - circleOffset);
                Canvas.SetTop(systemShape, sys.LayoutY - circleOffset);
                Canvas.SetZIndex(systemShape, 20);
                MainCanvas.Children.Add(systemShape);

                // add text
                Label sysText = new Label();
                sysText.Content = sys.Name;
                if (MapConf.ActiveColourScheme.SystemTextSize > 0)
                {
                    sysText.FontSize = MapConf.ActiveColourScheme.SystemTextSize;
                }

                if (sys.OutOfRegion)
                {
                    sysText.Foreground = new SolidColorBrush(MapConf.ActiveColourScheme.OutRegionSystemTextColour);
                }
                else
                {
                    sysText.Foreground = new SolidColorBrush(MapConf.ActiveColourScheme.InRegionSystemTextColour);
                }

                Canvas.SetLeft(sysText, sys.LayoutX + textXOffset);
                Canvas.SetTop(sysText, sys.LayoutY + textYOffset);
                Canvas.SetZIndex(sysText, 20);

                MainCanvas.Children.Add(sysText);



                double regionMarkerOffset = textYOffset2;

                if ((MapConf.ShowSystemSovName | MapConf.ShowSystemSovTicker) && sys.ActualSystem.SOVAlliance != null && EVEManager.AllianceIDToName.Keys.Contains(sys.ActualSystem.SOVAlliance))
                {
                    Label sysRegionText = new Label();

                    string content        = "";
                    string allianceName   = EVEManager.GetAllianceName(sys.ActualSystem.SOVAlliance);
                    string allianceTicker = EVEManager.GetAllianceTicker(sys.ActualSystem.SOVAlliance);

                    if (MapConf.ShowSystemSovName)
                    {
                        content = allianceName;
                    }

                    if (MapConf.ShowSystemSovTicker)
                    {
                        content = allianceTicker;
                    }

                    if (MapConf.ShowSystemSovTicker && MapConf.ShowSystemSovName && allianceName != string.Empty && allianceTicker != String.Empty)
                    {
                        content = allianceName + " (" + allianceTicker + ")";
                    }



                    sysRegionText.Content    = content;
                    sysRegionText.FontSize   = 7;
                    sysRegionText.Foreground = new SolidColorBrush(MapConf.ActiveColourScheme.OutRegionSystemTextColour);

                    Canvas.SetLeft(sysRegionText, sys.LayoutX + textXOffset);
                    Canvas.SetTop(sysRegionText, sys.LayoutY + textYOffset2);
                    Canvas.SetZIndex(sysRegionText, 20);

                    MainCanvas.Children.Add(sysRegionText);

                    regionMarkerOffset += 8;
                }



                if (MapConf.ShowJumpDistance && SelectedSystem != null && sys.Name != SelectedSystem)
                {
                    double Distance = EVEManager.GetRange(SelectedSystem, sys.Name);
                    Distance = Distance / 9460730472580800.0;

                    double Max = 0.1f;

                    switch (MapConf.JumpShipType)
                    {
                    case MapConfig.JumpShip.Super: { Max = 6.0; } break;

                    case MapConfig.JumpShip.Titan: { Max = 6.0; } break;

                    case MapConfig.JumpShip.Dread: { Max = 7.0; } break;

                    case MapConfig.JumpShip.Carrier: { Max = 7.0; } break;

                    case MapConfig.JumpShip.FAX: { Max = 7.0; } break;

                    case MapConfig.JumpShip.Blops: { Max = 8.0; } break;

                    case MapConfig.JumpShip.JF: { Max = 10.0; } break;
                    }

                    if (Distance < Max && Distance > 0.0)
                    {
                        systemShape.Fill = new SolidColorBrush(MapConf.ActiveColourScheme.JumpRangeInColour);

                        string JD = Distance.ToString("0.00") + " LY";

                        Label DistanceText = new Label();

                        DistanceText.Content    = JD;
                        DistanceText.FontSize   = 9;
                        DistanceText.Foreground = new SolidColorBrush(MapConf.ActiveColourScheme.OutRegionSystemTextColour);
                        regionMarkerOffset     += 8;

                        Canvas.SetLeft(DistanceText, sys.LayoutX + textXOffset);
                        Canvas.SetTop(DistanceText, sys.LayoutY + textYOffset2);


                        Canvas.SetZIndex(DistanceText, 20);
                        MainCanvas.Children.Add(DistanceText);
                    }
                    else
                    {
                        systemShape.Fill = new SolidColorBrush(MapConf.ActiveColourScheme.JumpRangeOutColour);
                    }
                }



                if (sys.OutOfRegion)
                {
                    Label sysRegionText = new Label();
                    sysRegionText.Content    = "(" + sys.Region + ")";
                    sysRegionText.FontSize   = 7;
                    sysRegionText.Foreground = new SolidColorBrush(MapConf.ActiveColourScheme.OutRegionSystemTextColour);

                    Canvas.SetLeft(sysRegionText, sys.LayoutX + textXOffset);
                    Canvas.SetTop(sysRegionText, sys.LayoutY + regionMarkerOffset);
                    Canvas.SetZIndex(sysRegionText, 20);

                    MainCanvas.Children.Add(sysRegionText);
                }
            }
        }
Beispiel #18
0
        public void UpdateStructureInfoForRegion(string Region)
        {
            if (!ESILinked)
            {
                return;
            }

            MapRegion mr = EveManager.Instance.GetRegion(Region);

            // somethings gone wrong
            if (mr == null)
            {
                return;
            }

            // iterate over each structure and search for structres containing the text for each system
            foreach (MapSystem ms in mr.MapSystems.Values.ToList())
            {
                // skip systems we've already checked
                if (DockableStructures.Keys.Contains(ms.Name))
                {
                    continue;
                }

                List <StructureIDs.StructureIdData> SystemStructureList = new List <StructureIDs.StructureIdData>();

                UriBuilder urlBuilder = new UriBuilder(@"https://esi.evetech.net/latest/characters/" + ID + "/search/");

                var esiQuery = HttpUtility.ParseQueryString(urlBuilder.Query);
                esiQuery["datasource"] = "tranquility";
                esiQuery["token"]      = ESIAccessToken;
                esiQuery["categories"] = "structure";
                esiQuery["search"]     = ms.Name;
                esiQuery["strict"]     = "false";

                urlBuilder.Query = esiQuery.ToString();

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlBuilder.ToString());
                request.Method      = WebRequestMethods.Http.Get;
                request.ContentType = "application/json";
                request.Timeout     = 20000;
                request.Proxy       = null;

                try
                {
                    HttpWebResponse esiResult = (HttpWebResponse)request.GetResponse();

                    if (esiResult.StatusCode != HttpStatusCode.OK)
                    {
                        continue;
                    }

                    Stream responseStream = esiResult.GetResponseStream();
                    using (StreamReader sr = new StreamReader(responseStream))
                    {
                        // Need to return this response
                        string strContent = sr.ReadToEnd();

                        StructureSearches.StructureSearch ss = StructureSearches.StructureSearch.FromJson(strContent);

                        if (ss == null || ss.Structure == null)
                        {
                            continue;
                        }


                        foreach (long l in ss.Structure)
                        {
                            // now search on each structure
                            UriBuilder urlStructureIDBuilder = new UriBuilder(@"https://esi.evetech.net/v1/universe/structures/" + l.ToString() + "/");

                            var esiStructureIDQuery = HttpUtility.ParseQueryString(urlStructureIDBuilder.Query);
                            esiStructureIDQuery["datasource"] = "tranquility";
                            esiStructureIDQuery["token"]      = ESIAccessToken;

                            urlStructureIDBuilder.Query = esiStructureIDQuery.ToString();

                            HttpWebRequest sid_request = (HttpWebRequest)WebRequest.Create(urlStructureIDBuilder.ToString());
                            sid_request.Method      = WebRequestMethods.Http.Get;
                            sid_request.ContentType = "application/json";
                            sid_request.Timeout     = 20000;
                            sid_request.Proxy       = null;

                            try
                            {
                                HttpWebResponse esi_sid_Result = (HttpWebResponse)sid_request.GetResponse();

                                Stream sid_responseStream = esi_sid_Result.GetResponseStream();
                                using (StreamReader sr2 = new StreamReader(sid_responseStream))
                                {
                                    // Need to return this response
                                    string strSIDContent = sr2.ReadToEnd();
                                    StructureIDs.StructureIdData sidd = StructureIDs.StructureIdData.FromJson(strSIDContent);
                                    if (sidd.Name != "")
                                    {
                                        SystemStructureList.Add(sidd);
                                    }
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                catch (Exception)
                {
                }

                DockableStructures.Add(ms.Name, SystemStructureList);
                Thread.Sleep(10);
            }
        }
Beispiel #19
0
        /// <summary>
        /// Add the regions to the universe view
        /// </summary>
        private void AddRegions()
        {
            Brush sysOutlineBrush       = new SolidColorBrush(MapConf.ActiveColourScheme.SystemOutlineColour);
            Brush sysInRegionBrush      = new SolidColorBrush(MapConf.ActiveColourScheme.InRegionSystemColour);
            Brush backgroundColourBrush = new SolidColorBrush(MapConf.ActiveColourScheme.MapBackgroundColour);

            Brush amarrBg    = new SolidColorBrush(Color.FromArgb(255, 126, 110, 95));
            Brush minmatarBg = new SolidColorBrush(Color.FromArgb(255, 143, 120, 120));
            Brush gallenteBg = new SolidColorBrush(Color.FromArgb(255, 127, 139, 137));
            Brush caldariBg  = new SolidColorBrush(Color.FromArgb(255, 149, 159, 171));

            MainUniverseCanvas.Background = backgroundColourBrush;
            MainUniverseGrid.Background   = backgroundColourBrush;

            foreach (EVEData.MapRegion mr in EVEData.EveManager.Instance.Regions)
            {
                // add circle for system
                Rectangle regionShape = new Rectangle()
                {
                    Height = 30, Width = 80
                };
                regionShape.Stroke          = sysOutlineBrush;
                regionShape.StrokeThickness = 1.5;
                regionShape.StrokeLineJoin  = PenLineJoin.Round;
                regionShape.RadiusX         = 5;
                regionShape.RadiusY         = 5;
                regionShape.Fill            = sysInRegionBrush;
                regionShape.MouseDown      += RegionShape_MouseDown;
                regionShape.DataContext     = mr;

                if (mr.Faction == "Amarr")
                {
                    regionShape.Fill = amarrBg;
                }
                if (mr.Faction == "Gallente")
                {
                    regionShape.Fill = gallenteBg;
                }
                if (mr.Faction == "Minmatar")
                {
                    regionShape.Fill = minmatarBg;
                }
                if (mr.Faction == "Caldari")
                {
                    regionShape.Fill = caldariBg;
                }

                if (mr.HasHighSecSystems)
                {
                    regionShape.StrokeThickness = 2.0;
                }


                if (ActiveCharacter != null && ActiveCharacter.ESILinked && MapConf.ShowRegionStandings)
                {
                    float averageStanding = 0.0f;
                    float numSystems      = 0;

                    foreach (EVEData.MapSystem s in mr.MapSystems.Values)
                    {
                        if (s.OutOfRegion)
                        {
                            continue;
                        }

                        numSystems++;

                        if (MapConf.SOVBasedITCU)
                        {
                            if (ActiveCharacter.AllianceID != 0 && ActiveCharacter.AllianceID == s.ActualSystem.SOVAllianceTCU)
                            {
                                averageStanding += 10.0f;
                            }

                            if (s.ActualSystem.SOVAllianceTCU != 0 && ActiveCharacter.Standings.Keys.Contains(s.ActualSystem.SOVAllianceTCU))
                            {
                                averageStanding += ActiveCharacter.Standings[s.ActualSystem.SOVAllianceTCU];
                            }
                        }
                        else
                        {
                            if (ActiveCharacter.AllianceID != 0 && ActiveCharacter.AllianceID == s.ActualSystem.SOVAllianceIHUB)
                            {
                                averageStanding += 10.0f;
                            }

                            if (s.ActualSystem.SOVAllianceTCU != 0 && ActiveCharacter.Standings.Keys.Contains(s.ActualSystem.SOVAllianceIHUB))
                            {
                                averageStanding += ActiveCharacter.Standings[s.ActualSystem.SOVAllianceIHUB];
                            }
                        }

                        if (s.ActualSystem.SOVCorp != 0 && ActiveCharacter.Standings.Keys.Contains(s.ActualSystem.SOVCorp))
                        {
                            averageStanding += ActiveCharacter.Standings[s.ActualSystem.SOVCorp];
                        }
                    }

                    averageStanding = averageStanding / numSystems;

                    if (averageStanding > 0.5)
                    {
                        Color blueIsh = Colors.Gray;
                        blueIsh.B       += (byte)((255 - blueIsh.B) * (averageStanding / 10.0f));
                        regionShape.Fill = new SolidColorBrush(blueIsh);
                    }
                    else if (averageStanding < -0.5)
                    {
                        averageStanding *= -1;
                        Color redIsh = Colors.Gray;
                        redIsh.R        += (byte)((255 - redIsh.R) * (averageStanding / 10.0f));
                        regionShape.Fill = new SolidColorBrush(redIsh);
                    }
                    else
                    {
                        regionShape.Fill = new SolidColorBrush(Colors.Gray);
                    }

                    if (mr.HasHighSecSystems)
                    {
                        regionShape.Fill = new SolidColorBrush(Colors.LightGray);
                    }
                }

                if (MapConf.ShowUniverseRats)
                {
                    double numRatkills = 0.0f;

                    foreach (EVEData.MapSystem s in mr.MapSystems.Values)
                    {
                        if (s.OutOfRegion)
                        {
                            continue;
                        }

                        numRatkills += s.ActualSystem.NPCKillsLastHour;
                    }
                    byte b = 255;

                    double ratScale = numRatkills / (15000 * MapConf.UniverseDataScale);
                    ratScale = Math.Min(Math.Max(0.0, ratScale), 1.0);
                    b        = (byte)(255.0 * (ratScale));

                    Color c = new Color();
                    c.A = b;
                    c.B = b;
                    c.G = b;
                    c.A = 255;

                    regionShape.Fill = new SolidColorBrush(c);
                }

                if (MapConf.ShowUniversePods)
                {
                    float numPodKills = 0.0f;

                    foreach (EVEData.MapSystem s in mr.MapSystems.Values)
                    {
                        if (s.OutOfRegion)
                        {
                            continue;
                        }

                        numPodKills += s.ActualSystem.PodKillsLastHour;
                    }
                    byte b = 255;

                    double podScale = numPodKills / (50 * MapConf.UniverseDataScale);
                    podScale = Math.Min(Math.Max(0.0, podScale), 1.0);
                    b        = (byte)(255.0 * (podScale));

                    Color c = new Color();
                    c.A = b;
                    c.R = b;
                    c.G = b;
                    c.A = 255;

                    regionShape.Fill = new SolidColorBrush(c);
                }

                if (MapConf.ShowUniverseKills)
                {
                    float numShipKills = 0.0f;

                    foreach (EVEData.MapSystem s in mr.MapSystems.Values)
                    {
                        if (s.OutOfRegion)
                        {
                            continue;
                        }

                        numShipKills += s.ActualSystem.ShipKillsLastHour;
                    }
                    byte   b         = 255;
                    double shipScale = numShipKills / (100 * MapConf.UniverseDataScale);
                    shipScale = Math.Min(Math.Max(0.0, shipScale), 1.0);
                    b         = (byte)(255.0 * (shipScale));

                    Color c = new Color();
                    c.A = b;
                    c.R = b;
                    c.B = b;
                    c.A = 255;
                    regionShape.Fill = new SolidColorBrush(c);
                }

                Canvas.SetLeft(regionShape, mr.UniverseViewX - 40);
                Canvas.SetTop(regionShape, mr.UniverseViewY - 15);
                Canvas.SetZIndex(regionShape, 22);
                MainUniverseCanvas.Children.Add(regionShape);

                Label regionText = new Label();
                regionText.Width               = 80;
                regionText.Height              = 27;
                regionText.Content             = mr.Name;
                regionText.Foreground          = sysOutlineBrush;
                regionText.FontSize            = 10;
                regionText.HorizontalAlignment = HorizontalAlignment.Center;
                regionText.VerticalAlignment   = VerticalAlignment.Center;
                regionText.IsHitTestVisible    = false;

                regionText.HorizontalContentAlignment = HorizontalAlignment.Center;
                regionText.VerticalContentAlignment   = VerticalAlignment.Center;

                Canvas.SetLeft(regionText, mr.UniverseViewX - 40);
                Canvas.SetTop(regionText, mr.UniverseViewY - 15);
                Canvas.SetZIndex(regionText, 23);
                MainUniverseCanvas.Children.Add(regionText);

                if (!string.IsNullOrEmpty(mr.Faction))
                {
                    Label factionText = new Label();
                    factionText.Width               = 80;
                    factionText.Height              = 30;
                    factionText.Content             = mr.Faction;
                    factionText.Foreground          = sysOutlineBrush;
                    factionText.FontSize            = 6;
                    factionText.HorizontalAlignment = HorizontalAlignment.Center;
                    factionText.VerticalAlignment   = VerticalAlignment.Center;
                    factionText.IsHitTestVisible    = false;

                    factionText.HorizontalContentAlignment = HorizontalAlignment.Center;
                    factionText.VerticalContentAlignment   = VerticalAlignment.Bottom;

                    Canvas.SetLeft(factionText, mr.UniverseViewX - 40);
                    Canvas.SetTop(factionText, mr.UniverseViewY - 15);
                    Canvas.SetZIndex(factionText, 23);
                    MainUniverseCanvas.Children.Add(factionText);
                }

                // now add all the region links : TODO :  this will end up adding 2 lines, region a -> b and b -> a
                foreach (string s in mr.RegionLinks)
                {
                    EVEData.MapRegion or = EVEData.EveManager.Instance.GetRegion(s);
                    Line regionLink      = new Line();

                    regionLink.X1 = mr.UniverseViewX;
                    regionLink.Y1 = mr.UniverseViewY;

                    regionLink.X2 = or.UniverseViewX;
                    regionLink.Y2 = or.UniverseViewY;

                    regionLink.Stroke          = sysOutlineBrush;
                    regionLink.StrokeThickness = 1;
                    regionLink.Visibility      = Visibility.Visible;

                    Canvas.SetZIndex(regionLink, 21);
                    MainUniverseCanvas.Children.Add(regionLink);
                }
            }
        }
Beispiel #20
0
        private void ShapeMouseDownHandler(object sender, MouseButtonEventArgs e)
        {
            Shape obj = sender as Shape;

            EVEData.MapRegion currentRegion = RegionDropDown.SelectedItem as EVEData.MapRegion;

            EVEData.MapSystem selectedSys = obj.DataContext as EVEData.MapSystem;

            if (e.ChangedButton == MouseButton.Left)
            {
                if (e.ClickCount == 1)
                {
                    bool redraw = false;
                    if (MapConf.ShowJumpDistance)
                    {
                        redraw = true;
                    }
                    SelectSystem(selectedSys.Name);

                    ReDrawMap(redraw);
                }

                if (e.ClickCount == 2 && selectedSys.Region != currentRegion.Name)
                {
                    foreach (EVEData.MapRegion rd in EVEManager.Regions)
                    {
                        if (rd.Name == selectedSys.Region)
                        {
                            RegionDropDown.SelectedItem = rd;

                            ReDrawMap();
                            SelectSystem(selectedSys.Name);
                            break;
                        }
                    }
                }
            }

            if (e.ChangedButton == MouseButton.Right)
            {
                ContextMenu cm = this.FindResource("SysRightClickContextMenu") as ContextMenu;
                cm.PlacementTarget = obj;
                cm.DataContext     = selectedSys;

                MenuItem setDesto    = cm.Items[2] as MenuItem;
                MenuItem addWaypoint = cm.Items[3] as MenuItem;


                setDesto.IsEnabled    = false;
                addWaypoint.IsEnabled = false;

                EVEData.Character c = CharacterDropDown.SelectedItem as EVEData.Character;
                if (c != null && c.ESILinked)
                {
                    setDesto.IsEnabled    = true;
                    addWaypoint.IsEnabled = true;
                }



                cm.IsOpen = true;
            }
        }