Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
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;
                }
            }
        }
Exemplo n.º 3
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;
                }
            }
        }
Exemplo n.º 4
0
 private void SysContexMenuItemAddWaypoint_Click(object sender, RoutedEventArgs e)
 {
     EVEData.System eveSys = ((System.Windows.FrameworkElement)((System.Windows.FrameworkElement)sender).Parent).DataContext as EVEData.System;
     if (ActiveCharacter != null)
     {
         ActiveCharacter.AddDestination(eveSys.ID, false);
     }
 }
Exemplo n.º 5
0
        private void SysContexMenuShowInRegion_Click(object sender, RoutedEventArgs e)
        {
            EVEData.System s = ((System.Windows.Controls.MenuItem)e.OriginalSource).DataContext as EVEData.System;

            RoutedEventArgs newEventArgs = new RoutedEventArgs(RequestRegionSystemSelectEvent, s.Name);

            RaiseEvent(newEventArgs);
        }
Exemplo n.º 6
0
        /// <summary>
        /// ZKillboard Clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SysContexMenuItemZKB_Click(object sender, RoutedEventArgs e)
        {
            EVEData.System    eveSys = ((System.Windows.FrameworkElement)((System.Windows.FrameworkElement)sender).Parent).DataContext as EVEData.System;
            EVEData.MapRegion rd     = EM.GetRegion(eveSys.Region);

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

            System.Diagnostics.Process.Start(uRL);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Dotlan Clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SysContexMenuItemDotlan_Click(object sender, RoutedEventArgs e)
        {
            EVEData.System    eveSys = ((System.Windows.FrameworkElement)((System.Windows.FrameworkElement)sender).Parent).DataContext as EVEData.System;
            EVEData.MapRegion rd     = EM.GetRegion(eveSys.Region);

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

            System.Diagnostics.Process.Start(uRL);
        }
Exemplo n.º 8
0
        private void GlobalSystemDropDownAC_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            EVEData.System sd = GlobalSystemDropDownAC.SelectedItem as EVEData.System;

            if (sd != null)
            {
                FollowCharacterChk.IsChecked = false;
                ShowSystem(sd.Name);
            }
        }
Exemplo n.º 9
0
        public void ShowSystem(string SystemName)
        {
            EVEData.System sd = EM.GetEveSystem(SystemName);

            if (sd != null)
            {
                // actual
                double X1 = (sd.ActualX - universeXMin) * universeScale;
                double Y1 = (universeDepth - (sd.ActualZ - universeZMin)) * universeScale;
            }
        }
Exemplo n.º 10
0
        private void AddWaypointsBtn_Click(object sender, RoutedEventArgs e)
        {
            if (RegionUC.ActiveCharacter == null)
            {
                return;
            }

            if (RouteSystemDropDownAC.SelectedItem == null)
            {
                return;
            }
            EVEData.System s = RouteSystemDropDownAC.SelectedItem as EVEData.System;

            if (s != null)
            {
                RegionUC.ActiveCharacter.AddDestination(s.ID, false);
            }
        }
Exemplo n.º 11
0
        private void Prefs_OK_Click(object sender, RoutedEventArgs e)
        {
            foreach (EVEData.System s in EM.Systems)
            {
                s.HasJumpBeacon = false;
            }

            foreach (string sys in CynoBeaconSystems)
            {
                EVEData.System es = EM.GetEveSystem(sys);
                if (es != null)
                {
                    es.HasJumpBeacon = true;
                }
            }

            Close();
        }
Exemplo n.º 12
0
        private void ExportJumpGatesBtn_Click(object sender, RoutedEventArgs e)
        {
            string ExportText = "";

            foreach (EVEData.MapRegion mr in EVEManager.Regions)
            {
                ExportText += "# " + mr.Name + "\n";

                foreach (EVEData.JumpBridge jb in EVEManager.JumpBridges)
                {
                    EVEData.System es = EVEManager.GetEveSystem(jb.From);
                    if (es.Region == mr.Name)
                    {
                        ExportText += $"{jb.FromID} {jb.From} --> {jb.To}\n";
                    }

                    es = EVEManager.GetEveSystem(jb.To);
                    if (es.Region == mr.Name)
                    {
                        ExportText += $"{jb.ToID} {jb.To} --> {jb.From}\n";
                    }
                }

                ExportText += "\n";
            }


            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter = "Text file (*.txt)|*.txt";
            if (saveFileDialog.ShowDialog() == true)
            {
                try
                {
                    File.WriteAllText(saveFileDialog.FileName, ExportText);
                }
                catch { }
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Update the active route for the character
        /// </summary>
        private async void UpdateActiveRoute()
        {
            if (esiSendRouteClear)
            {
                esiSendRouteClear   = false;
                esiRouteNeedsUpdate = false;

                System s = EveManager.Instance.GetEveSystem(Location);
                if (s != null)
                {
                    ESI.NET.EsiClient esiClient = EveManager.Instance.ESIClient;
                    esiClient.SetCharacterData(ESIAuthData);

                    ESI.NET.EsiResponse <string> esr = await esiClient.UserInterface.Waypoint(s.ID, false, true);

                    if (EVEData.ESIHelpers.ValidateESICall <string>(esr))
                    {
                        // failed to clear route
                    }
                }

                return;
            }



            if (Waypoints.Count == 0)
            {
                return;
            }

            {
                // new routing
                string start = string.Empty;
                string end   = Location;

                Application.Current.Dispatcher.Invoke((Action)(() =>
                {
                    lock (ActiveRouteLock)
                    {
                        if (Location == Waypoints[0])
                        {
                            Waypoints.RemoveAt(0);
                        }
                    }

                    ActiveRoute.Clear();
                }), DispatcherPriority.Normal);

                // loop through all the waypoints
                for (int i = 0; i < Waypoints.Count; i++)
                {
                    start = end;
                    end   = Waypoints[i];

                    List <Navigation.RoutePoint> sysList = Navigation.Navigate(start, end, UseAnsiblexGates, false, NavigationMode);

                    if (sysList != null)
                    {
                        Application.Current.Dispatcher.Invoke((Action)(() =>
                        {
                            lock (ActiveRouteLock)
                            {
                                foreach (Navigation.RoutePoint s in sysList)
                                {
                                    ActiveRoute.Add(s);
                                }
                            }
                        }), DispatcherPriority.Normal, null);
                    }
                }
            }

            if (esiRouteNeedsUpdate && !esiRouteUpdating)
            {
                esiRouteNeedsUpdate = false;
                esiRouteUpdating    = true;

                List <long> WayPointsToAdd = new List <long>();

                lock (ActiveRouteLock)
                {
                    foreach (Navigation.RoutePoint rp in ActiveRoute)
                    {
                        // explicitly add interim waypoints for ansiblex gates or actual waypoints
                        if (rp.GateToTake == Navigation.GateType.Ansibex || Waypoints.Contains(rp.SystemName))
                        {
                            long wayPointSysID = EveManager.Instance.GetEveSystem(rp.SystemName).ID;

                            if (rp.GateToTake == Navigation.GateType.Ansibex)
                            {
                                foreach (JumpBridge jb in EveManager.Instance.JumpBridges)
                                {
                                    if (jb.From == rp.SystemName)
                                    {
                                        if (jb.FromID != 0)
                                        {
                                            wayPointSysID = jb.FromID;
                                        }
                                        break;
                                    }

                                    if (jb.To == rp.SystemName)
                                    {
                                        if (jb.ToID != 0)
                                        {
                                            wayPointSysID = jb.ToID;
                                        }
                                        break;
                                    }
                                }
                            }
                            WayPointsToAdd.Add(wayPointSysID);
                        }
                    }
                }

                bool firstRoute = true;

                foreach (long SysID in WayPointsToAdd)
                {
                    ESI.NET.EsiClient esiClient = EveManager.Instance.ESIClient;
                    esiClient.SetCharacterData(ESIAuthData);

                    ESI.NET.EsiResponse <string> esr = await esiClient.UserInterface.Waypoint(SysID, false, firstRoute);

                    if (EVEData.ESIHelpers.ValidateESICall <string>(esr))
                    {
                        //                        routeNeedsUpdate = true;
                    }
                    firstRoute = false;

                    // with a shorter wait, ive found the occasional out of order route
                    Thread.Sleep(200);
                }

                esiRouteUpdating = false;
            }
        }
Exemplo n.º 14
0
        public void Init()
        {
            EM = EVEData.EveManager.Instance;

            universeSysLinksCache = new List <GateHelper>();


            universeXMin = 0.0;
            universeXMax = 336522971264518000.0;

            universeZMin = -484452845697854000;
            universeZMax = 472860102256057000.0;

            foreach (EVEData.System sys in EM.Systems)
            {
                foreach (string jumpTo in sys.Jumps)
                {
                    EVEData.System to = EM.GetEveSystem(jumpTo);

                    bool NeedsAdd = true;
                    foreach (GateHelper gh in universeSysLinksCache)
                    {
                        if (((gh.from == sys) || (gh.to == sys)) && ((gh.from == to) || (gh.to == to)))
                        {
                            NeedsAdd = false;
                            break;
                        }
                    }

                    if (NeedsAdd)
                    {
                        GateHelper g = new GateHelper();
                        g.from = sys;
                        g.to   = to;
                        universeSysLinksCache.Add(g);
                    }
                }

                if (sys.ActualX < universeXMin)
                {
                    universeXMin = sys.ActualX;
                }

                if (sys.ActualX > universeXMax)
                {
                    universeXMax = sys.ActualX;
                }

                if (sys.ActualZ < universeZMin)
                {
                    universeZMin = sys.ActualZ;
                }

                if (sys.ActualZ > universeZMax)
                {
                    universeZMax = sys.ActualZ;
                }
            }


            universeWidth = universeXMax - universeXMin;
            universeDepth = universeZMax - universeZMin;

            ReDrawMap(true);
        }
Exemplo n.º 15
0
        public void Init()
        {
            EM = EVEData.EveManager.Instance;

            universeSysLinksCache = new List <GateHelper>();
            activeJumpSpheres     = new List <KeyValuePair <string, double> >();

            universeXMin = 0;
            universeXMax = 0;

            universeZMin = 0;
            universeZMax = 0;


            universeYMin = 0;
            universeYMax = 0;


            uiRefreshTimer          = new System.Windows.Threading.DispatcherTimer();
            uiRefreshTimer.Tick    += UiRefreshTimer_Tick;
            uiRefreshTimer.Interval = new TimeSpan(0, 0, 5);
            uiRefreshTimer.Start();

            PropertyChanged += Universe3DControl_PropertyChanged;

            DataContext = this;

            foreach (EVEData.System sys in EM.Systems)
            {
                foreach (string jumpTo in sys.Jumps)
                {
                    EVEData.System to = EM.GetEveSystem(jumpTo);

                    bool NeedsAdd = true;
                    foreach (GateHelper gh in universeSysLinksCache)
                    {
                        if (((gh.from == sys) || (gh.to == sys)) && ((gh.from == to) || (gh.to == to)))
                        {
                            NeedsAdd = false;
                            break;
                        }
                    }

                    if (NeedsAdd)
                    {
                        GateHelper g = new GateHelper();
                        g.from         = sys;
                        g.to           = to;
                        g.RegionalGate = sys.Region != to.Region;
                        universeSysLinksCache.Add(g);
                    }
                }

                if (sys.ActualX < universeXMin)
                {
                    universeXMin = sys.ActualX;
                }

                if (sys.ActualX > universeXMax)
                {
                    universeXMax = sys.ActualX;
                }

                if (sys.ActualZ < universeZMin)
                {
                    universeZMin = sys.ActualZ;
                }

                if (sys.ActualZ > universeZMax)
                {
                    universeZMax = sys.ActualZ;
                }

                if (sys.ActualY < universeYMin)
                {
                    universeYMin = sys.ActualY;
                }

                if (sys.ActualY > universeYMax)
                {
                    universeYMax = sys.ActualY;
                }
            }

            universeWidth  = universeXMax - universeXMin;
            universeDepth  = universeZMax - universeZMin;
            universeHeight = universeYMax - universeYMin;

            List <EVEData.System> globalSystemList = new List <EVEData.System>(EM.Systems);

            globalSystemList.Sort((a, b) => string.Compare(a.Name, b.Name));
            GlobalSystemDropDownAC.ItemsSource = globalSystemList;


            UniverseMain3DViewPort.EffectsManager = new DefaultEffectsManager();



            HelixToolkit.Wpf.SharpDX.PerspectiveCamera pc = new HelixToolkit.Wpf.SharpDX.PerspectiveCamera();
            pc.NearPlaneDistance = 0.1;
            pc.FarPlaneDistance  = 100000;

            pc.Position = new Point3D(4000, 4000, 10000);

            pc.UpDirection   = new Vector3D(0, 0, 1);
            pc.LookDirection = new Vector3D(-1, 0, 0);

            pc.LookAt(new Point3D(4000, 4000, 4000), 1);


            UniverseMain3DViewPort.Camera = pc;


            ReDrawMap(true);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Add Data to the Universe (Thera, Characters etc)
        /// </summary>
        private void AddDataToUniverse()
        {
            Brush sysOutlineBrush = new SolidColorBrush(MapConf.ActiveColourScheme.SystemOutlineColour);
            Brush theraBrush      = new SolidColorBrush(MapConf.ActiveColourScheme.TheraEntranceRegion);
            Brush characterBrush  = new SolidColorBrush(MapConf.ActiveColourScheme.CharacterHighlightColour);

            foreach (EVEData.MapRegion mr in EVEData.EveManager.Instance.Regions)
            {
                bool addTheraConnection = false;
                foreach (EVEData.TheraConnection tc in EVEData.EveManager.Instance.TheraConnections)
                {
                    if (string.Compare(tc.Region, mr.Name, true) == 0)
                    {
                        addTheraConnection = true;
                        break;
                    }
                }

                if (addTheraConnection)
                {
                    Rectangle theraShape = new Rectangle()
                    {
                        Width = 8, Height = 8
                    };

                    theraShape.Stroke          = sysOutlineBrush;
                    theraShape.StrokeThickness = 1;
                    theraShape.StrokeLineJoin  = PenLineJoin.Round;
                    theraShape.RadiusX         = 2;
                    theraShape.RadiusY         = 2;
                    theraShape.Fill            = theraBrush;

                    theraShape.DataContext = mr;
                    theraShape.MouseEnter += RegionThera_ShapeMouseOverHandler;
                    theraShape.MouseLeave += RegionThera_ShapeMouseOverHandler;

                    Canvas.SetLeft(theraShape, mr.UniverseViewX + 28);
                    Canvas.SetTop(theraShape, mr.UniverseViewY + 3);
                    Canvas.SetZIndex(theraShape, 22);
                    MainUniverseCanvas.Children.Add(theraShape);
                    dynamicRegionsViewElements.Add(theraShape);
                }

                bool addCharacter = false;

                foreach (EVEData.LocalCharacter lc in EVEData.EveManager.Instance.LocalCharacters)
                {
                    EVEData.System s = EVEData.EveManager.Instance.GetEveSystem(lc.Location);
                    if (s != null && s.Region == mr.Name)
                    {
                        addCharacter = true;
                    }
                }

                if (addCharacter)
                {
                    Rectangle characterShape = new Rectangle()
                    {
                        Width = 8, Height = 8
                    };

                    characterShape.Stroke          = sysOutlineBrush;
                    characterShape.StrokeThickness = 1;
                    characterShape.StrokeLineJoin  = PenLineJoin.Round;
                    characterShape.RadiusX         = 2;
                    characterShape.RadiusY         = 2;
                    characterShape.Fill            = characterBrush;

                    characterShape.DataContext = mr;
                    characterShape.MouseEnter += RegionCharacter_ShapeMouseOverHandler;
                    characterShape.MouseLeave += RegionCharacter_ShapeMouseOverHandler;

                    Canvas.SetLeft(characterShape, mr.UniverseViewX + 28);
                    Canvas.SetTop(characterShape, mr.UniverseViewY - 11);
                    Canvas.SetZIndex(characterShape, 23);
                    MainUniverseCanvas.Children.Add(characterShape);
                    dynamicRegionsViewElements.Add(characterShape);
                }
            }
        }
Exemplo n.º 17
0
        private void AddDataToUniverse()
        {
            Brush SysOutlineBrush = new SolidColorBrush(MapConf.ActiveColourScheme.SystemOutlineColour);
            Brush TheraBrush      = new SolidColorBrush(MapConf.ActiveColourScheme.TheraEntranceRegion);
            Brush CharacterBrush  = new SolidColorBrush(MapConf.ActiveColourScheme.CharacterHighlightColour);

            foreach (EVEData.MapRegion mr in EVEManager.Regions)
            {
                bool AddTheraConnection = false;
                foreach (EVEData.TheraConnection tc in EVEManager.TheraConnections)
                {
                    if (string.Compare(tc.Region, mr.Name, true) == 0)
                    {
                        AddTheraConnection = true;
                        break;
                    }
                }

                if (AddTheraConnection)
                {
                    Rectangle TheraShape = new Rectangle()
                    {
                        Width = 8, Height = 8
                    };

                    TheraShape.Stroke          = SysOutlineBrush;
                    TheraShape.StrokeThickness = 1;
                    TheraShape.StrokeLineJoin  = PenLineJoin.Round;
                    TheraShape.RadiusX         = 2;
                    TheraShape.RadiusY         = 2;
                    TheraShape.Fill            = TheraBrush;

                    TheraShape.DataContext = mr;
                    TheraShape.MouseEnter += RegionThera_ShapeMouseOverHandler;
                    TheraShape.MouseLeave += RegionThera_ShapeMouseOverHandler;

                    Canvas.SetLeft(TheraShape, mr.RegionX + 28);
                    Canvas.SetTop(TheraShape, mr.RegionY + 3);
                    Canvas.SetZIndex(TheraShape, 22);
                    MainUniverseCanvas.Children.Add(TheraShape);
                    DynamicUniverseElements.Add(TheraShape);
                }


                bool AddCharacter = false;

                foreach (EVEData.LocalCharacter lc in EVEManager.LocalCharacters)
                {
                    EVEData.System s = EVEManager.GetEveSystem(lc.Location);
                    if (s != null && s.Region == mr.Name)
                    {
                        AddCharacter = true;
                    }
                }

                if (AddCharacter)
                {
                    Rectangle CharacterShape = new Rectangle()
                    {
                        Width = 8, Height = 8
                    };

                    CharacterShape.Stroke          = SysOutlineBrush;
                    CharacterShape.StrokeThickness = 1;
                    CharacterShape.StrokeLineJoin  = PenLineJoin.Round;
                    CharacterShape.RadiusX         = 2;
                    CharacterShape.RadiusY         = 2;
                    CharacterShape.Fill            = CharacterBrush;

                    CharacterShape.DataContext = mr;
                    CharacterShape.MouseEnter += RegionCharacter_ShapeMouseOverHandler;
                    CharacterShape.MouseLeave += RegionCharacter_ShapeMouseOverHandler;


                    Canvas.SetLeft(CharacterShape, mr.RegionX + 28);
                    Canvas.SetTop(CharacterShape, mr.RegionY - 11);
                    Canvas.SetZIndex(CharacterShape, 23);
                    MainUniverseCanvas.Children.Add(CharacterShape);
                    DynamicUniverseElements.Add(CharacterShape);
                }
            }
        }
Exemplo n.º 18
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));

            Brush TheraBrush     = new SolidColorBrush(Colors.YellowGreen);
            Brush CharacterBrush = new SolidColorBrush(MapConf.ActiveColourScheme.CharacterHighlightColour);

            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)
                {
                    float averageStanding = 0.0f;
                    float numSystems      = 0;

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

                        numSystems++;


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

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

                        if (s.ActualSystem.SOVAlliance != null && 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);
                }

                bool AddTheraConnection = false;
                foreach (EVEData.TheraConnection tc in EVEManager.TheraConnections)
                {
                    if (string.Compare(tc.Region, mr.Name, true) == 0)
                    {
                        AddTheraConnection = true;
                        break;
                    }
                }

                if (AddTheraConnection)
                {
                    Rectangle TheraShape = new Rectangle()
                    {
                        Width = 8, Height = 8
                    };

                    TheraShape.Stroke           = SysOutlineBrush;
                    TheraShape.StrokeThickness  = 1;
                    TheraShape.StrokeLineJoin   = PenLineJoin.Round;
                    TheraShape.RadiusX          = 2;
                    TheraShape.RadiusY          = 2;
                    TheraShape.Fill             = TheraBrush;
                    TheraShape.IsHitTestVisible = false;

                    Canvas.SetLeft(TheraShape, mr.RegionX + 28);
                    Canvas.SetTop(TheraShape, mr.RegionY + 3);
                    Canvas.SetZIndex(TheraShape, 22);
                    MainUniverseCanvas.Children.Add(TheraShape);
                }


                bool AddCharacter = false;

                foreach (EVEData.LocalCharacter lc in EVEManager.LocalCharacters)
                {
                    EVEData.System s = EVEManager.GetEveSystem(lc.Location);
                    if (s != null && s.Region == mr.Name)
                    {
                        AddCharacter = true;
                    }
                }

                if (AddCharacter)
                {
                    Rectangle CharacterShape = new Rectangle()
                    {
                        Width = 8, Height = 8
                    };

                    CharacterShape.Stroke          = SysOutlineBrush;
                    CharacterShape.StrokeThickness = 1;
                    CharacterShape.StrokeLineJoin  = PenLineJoin.Round;
                    CharacterShape.RadiusX         = 2;
                    CharacterShape.RadiusY         = 2;
                    CharacterShape.Fill            = CharacterBrush;

                    CharacterShape.DataContext = mr;
                    CharacterShape.MouseEnter += RegionCharacter_ShapeMouseOverHandler;
                    CharacterShape.MouseLeave += RegionCharacter_ShapeMouseOverHandler;


                    Canvas.SetLeft(CharacterShape, mr.RegionX + 28);
                    Canvas.SetTop(CharacterShape, mr.RegionY - 11);
                    Canvas.SetZIndex(CharacterShape, 23);
                    MainUniverseCanvas.Children.Add(CharacterShape);
                }
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// Redraw the map
        /// </summary>
        /// <param name="FullRedraw">Clear all the static items or not</param>
        public void ReDrawMap(bool FullRedraw = false)
        {
            double Padding     = -3;
            double textXOffset = 1;
            double textYOffset = 1;

            double XScale = (8000) / universeWidth;
            double ZScale = (8000) / universeDepth;
            double scale  = Math.Min(XScale, ZScale);

            Brush SysCol       = new SolidColorBrush(Colors.Black);
            Brush ConstGateCol = new SolidColorBrush(Colors.Gray);
            Brush TextCol      = new SolidColorBrush(Colors.DarkGray);
            Brush JBCol        = new SolidColorBrush(Colors.Blue);

            UniverseMainCanvas.Visibility = Visibility.Hidden;



            foreach (EVEData.System sys in EM.Systems)
            {
                double size     = 8.0;
                double halfSize = size / 2.0;

                Shape systemShape = new Rectangle()
                {
                    Height = 6, Width = 6
                };
                systemShape.Fill = SysCol;

                double X = (sys.ActualX - universeXMin) * scale;

                // need to invert Z
                double Z = (universeDepth - (sys.ActualZ - universeZMin)) * scale;

                Canvas.SetLeft(systemShape, Padding + X);
                Canvas.SetTop(systemShape, Padding + Z);
                Canvas.SetZIndex(systemShape, 20);

                UniverseMainCanvas.Children.Add(systemShape);

                // add text
                Label sysText = new Label();
                sysText.Content    = sys.Name;
                sysText.FontSize   = 6;
                sysText.Foreground = TextCol;

                Canvas.SetLeft(sysText, X + textXOffset);
                Canvas.SetTop(sysText, Z + textYOffset);
                Canvas.SetZIndex(sysText, 20);

                UniverseMainCanvas.Children.Add(sysText);
            }

            foreach (GateHelper gh in universeSysLinksCache)
            {
                Line sysLink = new Line();

                sysLink.X1 = (gh.from.ActualX - universeXMin) * scale;
                sysLink.Y1 = (universeDepth - (gh.from.ActualZ - universeZMin)) * scale;

                sysLink.X2 = (gh.to.ActualX - universeXMin) * scale;
                sysLink.Y2 = (universeDepth - (gh.to.ActualZ - universeZMin)) * scale;

                if (gh.from.Region != gh.to.Region || gh.from.ConstellationID != gh.to.ConstellationID)
                {
                    sysLink.Stroke = ConstGateCol;
                }
                else
                {
                    sysLink.Stroke = SysCol;
                }

                sysLink.StrokeThickness = 1;

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


            foreach (EVEData.JumpBridge jb in EM.JumpBridges)
            {
                Line jbLink = new Line();

                EVEData.System from = EM.GetEveSystem(jb.From);
                EVEData.System to   = EM.GetEveSystem(jb.To);


                jbLink.X1 = (from.ActualX - universeXMin) * scale;
                jbLink.Y1 = (universeDepth - (from.ActualZ - universeZMin)) * scale;

                jbLink.X2 = (to.ActualX - universeXMin) * scale;
                jbLink.Y2 = (universeDepth - (to.ActualZ - universeZMin)) * scale;

                jbLink.StrokeThickness = 1;
                jbLink.Visibility      = Visibility.Visible;

                jbLink.Stroke = JBCol;


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

                jbLink.StrokeDashArray = dashes;

                Canvas.SetZIndex(jbLink, 19);
                UniverseMainCanvas.Children.Add(jbLink);
            }



            UniverseMainCanvas.Visibility = Visibility.Visible;
        }
Exemplo n.º 20
0
        private void VHSystems_MouseClicked(object sender, RoutedEventArgs e)
        {
            EVEData.System sys = (EVEData.System)e.OriginalSource;

            ContextMenu cm = this.FindResource("SysRightClickContextMenu") as ContextMenu;

            cm.DataContext = sys;
            cm.IsOpen      = true;

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

            if (ActiveCharacter != null && ActiveCharacter.ESILinked)
            {
                setDesto.IsEnabled    = true;
                addWaypoint.IsEnabled = true;
            }

            // update SOV
            MenuItem SovHeader = cm.Items[6] as MenuItem;

            SovHeader.Items.Clear();
            SovHeader.IsEnabled = false;

            if (sys.SOVAllianceIHUB != 0)
            {
                MenuItem mi = new MenuItem();
                mi.Header           = "IHUB: " + EM.GetAllianceTicker(sys.SOVAllianceIHUB);
                mi.DataContext      = sys.SOVAllianceIHUB;
                mi.Click           += VHSystems_SOV_Clicked;
                SovHeader.IsEnabled = true;
                SovHeader.Items.Add(mi);
            }

            if (sys.SOVAllianceTCU != 0)
            {
                MenuItem mi = new MenuItem();
                mi.DataContext      = sys.SOVAllianceTCU;
                mi.Header           = "TCU : " + EM.GetAllianceTicker(sys.SOVAllianceTCU);
                mi.Click           += VHSystems_SOV_Clicked;
                SovHeader.IsEnabled = true;
                SovHeader.Items.Add(mi);
            }

            // update stats
            MenuItem StatsHeader = cm.Items[7] as MenuItem;

            StatsHeader.Items.Clear();
            StatsHeader.IsEnabled = false;

            if (sys.HasNPCStation)
            {
                MenuItem mi = new MenuItem();
                mi.Header             = "NPC Station(s)";
                StatsHeader.IsEnabled = true;
                StatsHeader.Items.Add(mi);
            }

            if (sys.HasIceBelt)
            {
                MenuItem mi = new MenuItem();
                mi.Header             = "Ice Belts";
                StatsHeader.IsEnabled = true;
                StatsHeader.Items.Add(mi);
            }

            if (sys.HasJoveObservatory)
            {
                MenuItem mi = new MenuItem();
                mi.Header             = "Jove Observatory";
                StatsHeader.IsEnabled = true;
                StatsHeader.Items.Add(mi);
            }

            if (sys.JumpsLastHour > 0)
            {
                MenuItem mi = new MenuItem();
                mi.Header             = "Jumps : " + sys.JumpsLastHour;
                StatsHeader.IsEnabled = true;
                StatsHeader.Items.Add(mi);
            }

            if (sys.ShipKillsLastHour > 0)
            {
                MenuItem mi = new MenuItem();
                mi.Header             = "Ship Kills : " + sys.ShipKillsLastHour;
                StatsHeader.IsEnabled = true;
                StatsHeader.Items.Add(mi);
            }

            if (sys.PodKillsLastHour > 0)
            {
                MenuItem mi = new MenuItem();
                mi.Header             = "Pod Kills : " + sys.PodKillsLastHour;
                StatsHeader.IsEnabled = true;
                StatsHeader.Items.Add(mi);
            }

            if (sys.NPCKillsLastHour > 0)
            {
                MenuItem mi = new MenuItem();
                mi.Header             = "NPC Kills : " + sys.NPCKillsLastHour + " (Delta: " + sys.NPCKillsDeltaLastHour + ")";
                StatsHeader.IsEnabled = true;
                StatsHeader.Items.Add(mi);
            }

            if (sys.RadiusAU > 0)
            {
                MenuItem mi = new MenuItem();
                mi.Header             = "Radius : " + sys.RadiusAU.ToString("#.##") + " (AU)";
                StatsHeader.IsEnabled = true;
                StatsHeader.Items.Add(mi);
            }
        }