Skip to content

Commit

Permalink
Fix for Intel Size
Browse files Browse the repository at this point in the history
New Jump bridge list
New jump bridge functionality (recalc, remove, disable)
jump bridge re-calc on delete / diable of JB
Disabled jump bridge colour
  • Loading branch information
BitBaboonSteve committed May 12, 2020
1 parent 86b3a64 commit 143b77f
Show file tree
Hide file tree
Showing 8 changed files with 382 additions and 250 deletions.
34 changes: 32 additions & 2 deletions EVEData/JumpBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
// Jump Bridge
//-----------------------------------------------------------------------

using System.ComponentModel;
using System.Xml.Serialization;

namespace SMT.EVEData
{
/// <summary>
/// A Player owned link between systems
/// </summary>
public class JumpBridge
public class JumpBridge : INotifyPropertyChanged
{
/// <summary>
/// Initializes a new instance of the <see cref="JumpBridge" /> class.
Expand All @@ -28,7 +31,24 @@ public JumpBridge(string f, string t)
}



private bool m_Disabled;

[XmlIgnoreAttribute]
public bool Disabled
{
get
{
return m_Disabled;
}
set
{
m_Disabled = value;

OnPropertyChanged("Disabled");
}
}

public event PropertyChangedEventHandler PropertyChanged;


/// <summary>
Expand All @@ -55,5 +75,15 @@ public override string ToString()
{
return $"{From} <==> {To}";
}


protected void OnPropertyChanged(string name)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
}
}
9 changes: 7 additions & 2 deletions EVEData/LocalCharacter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,12 @@ public async Task<List<JumpBridge>> FindJumpGates(string JumpBridgeFilterString
return jbl;
}


public void RecalcRoute()
{
routeNeedsUpdate = true;
esiRouteNeedsUpdate = true;
}

public string GetWayPointText()
{
string ClipboardText = "Waypoints\n==============\n";
Expand Down Expand Up @@ -506,7 +511,7 @@ private async void UpdateActiveRoute()
ActiveRoute.Clear();
}), DispatcherPriority.Normal);

// loop through all the waypoints and query ESI for the route
// loop through all the waypoints
for (int i = 0; i < Waypoints.Count; i++)
{
start = end;
Expand Down
16 changes: 5 additions & 11 deletions EVEData/Navigation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ public static void InitNavigation(List<System> eveSystems, List<JumpBridge> jump
MapNodes[mn.Name] = mn;
}

foreach (JumpBridge jb in jumpBridges)
{
MapNodes[jb.From].JBConnection = jb.To;
MapNodes[jb.To].JBConnection = jb.From;
}
UpdateJumpBridges(jumpBridges);

double MaxRange = 10 * 9460730472580800.0;

Expand Down Expand Up @@ -399,15 +395,13 @@ public static void UpdateJumpBridges(List<JumpBridge> jumpBridges)
{
foreach (JumpBridge jb in jumpBridges)
{
if (jb.FromID != 0)
if(jb.Disabled)
{
MapNodes[jb.From].JBConnection = jb.To;
continue;
}

if (jb.ToID != 0)
{
MapNodes[jb.To].JBConnection = jb.From;
}
MapNodes[jb.From].JBConnection = jb.To;
MapNodes[jb.To].JBConnection = jb.From;
}
}

Expand Down
472 changes: 242 additions & 230 deletions MainWindow.xaml

Large diffs are not rendered by default.

67 changes: 66 additions & 1 deletion MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,8 @@ private void CheckGitHubVersionCallback(IAsyncResult asyncResult)
nw.CurrentVersion = SMTVersion;
nw.NewVersion = releaseInfo.TagName;
nw.ReleaseURL = releaseInfo.HtmlUrl.ToString();
nw.Show();
nw.Owner = this;
nw.ShowDialog();
}), DispatcherPriority.ApplicationIdle);
}
}
Expand Down Expand Up @@ -715,12 +716,24 @@ private void ClearWaypointsBtn_Click(object sender, RoutedEventArgs e)
{
lock (c.ActiveRouteLock)
{

c.ActiveRoute.Clear();
c.Waypoints.Clear();
}
}
}

private void ReCalculateRouteBtn_Click(object sender, RoutedEventArgs e)
{
EVEData.LocalCharacter c = RegionRC.ActiveCharacter as EVEData.LocalCharacter;
if (c != null && c.Waypoints.Count > 0)
{
c.RecalcRoute();
}
}



private void ColoursPropertyGrid_PropertyValueChanged(object sender, Xceed.Wpf.Toolkit.PropertyGrid.PropertyValueChangedEventArgs e)
{
RegionRC.ReDrawMap(true);
Expand Down Expand Up @@ -804,7 +817,9 @@ private async void ImportJumpGatesBtn_Click(object sender, RoutedEventArgs e)
}
}

EVEData.Navigation.ClearJumpBridges();
EVEData.Navigation.UpdateJumpBridges(EVEManager.JumpBridges.ToList());
RegionRC.ReDrawMap(true);

ImportJumpGatesBtn.IsEnabled = true;
ClearJumpGatesBtn.IsEnabled = true;
Expand Down Expand Up @@ -846,6 +861,11 @@ private void ImportPasteJumpGatesBtn_Click(object sender, RoutedEventArgs e)
}
} while (line != null);
}

EVEData.Navigation.ClearJumpBridges();
EVEData.Navigation.UpdateJumpBridges(EVEManager.JumpBridges.ToList());
RegionRC.ReDrawMap(true);

}

private void MainWindow_Closed(object sender, EventArgs e)
Expand Down Expand Up @@ -1423,6 +1443,51 @@ private void FullScreenToggle_MenuItem_Click(object sender, RoutedEventArgs e)
}
}

private void DeleteJumpBridgeMenuItem_Click(object sender, RoutedEventArgs e)
{
if (JumpBridgeList.SelectedIndex == -1)
{
return;
}

EVEData.JumpBridge jb = JumpBridgeList.SelectedItem as EVEData.JumpBridge;

EVEManager.JumpBridges.Remove(jb);

EVEData.Navigation.ClearJumpBridges();
EVEData.Navigation.UpdateJumpBridges(EVEManager.JumpBridges.ToList());
RegionRC.ReDrawMap(true);

EVEData.LocalCharacter c = RegionRC.ActiveCharacter as EVEData.LocalCharacter;
if (c != null && c.Waypoints.Count > 0)
{
c.RecalcRoute();
}
}

private void EnableDisableJumpBridgeMenuItem_Click(object sender, RoutedEventArgs e)
{
if (JumpBridgeList.SelectedIndex == -1)
{
return;
}

EVEData.JumpBridge jb = JumpBridgeList.SelectedItem as EVEData.JumpBridge;

jb.Disabled = !jb.Disabled;

EVEData.Navigation.ClearJumpBridges();
EVEData.Navigation.UpdateJumpBridges(EVEManager.JumpBridges.ToList());
RegionRC.ReDrawMap(true);

EVEData.LocalCharacter c = RegionRC.ActiveCharacter as EVEData.LocalCharacter;
if (c != null && c.Waypoints.Count > 0)
{
c.RecalcRoute();
}
}




/*
Expand Down
5 changes: 5 additions & 0 deletions MapColours.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public class MapColours
[DisplayName("Friendly")]
public Color FriendlyJumpBridgeColour { get; set; }

[Category("Jump Bridges")]
[DisplayName("Disabled")]
public Color DisabledJumpBridgeColour { get; set; }


[Category("Systems")]
[DisplayName("In Region")]
public Color InRegionSystemColour { get; set; }
Expand Down
1 change: 1 addition & 0 deletions MapConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ public void SetDefaultColours()
Name = "Default",
UserEditable = false,
FriendlyJumpBridgeColour = Color.FromRgb(102, 205, 170),
DisabledJumpBridgeColour = Color.FromRgb(205, 55, 50),
SystemOutlineColour = Color.FromRgb(0, 0, 0),
InRegionSystemColour = Color.FromRgb(255, 239, 213),
InRegionSystemTextColour = Color.FromRgb(0, 0, 0),
Expand Down
28 changes: 24 additions & 4 deletions RegionControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,7 @@ private void AddSystemsToMap()
Brush SysOutRegionTextBrush = new SolidColorBrush(MapConf.ActiveColourScheme.OutRegionSystemTextColour);

Brush FriendlyJumpBridgeBrush = new SolidColorBrush(MapConf.ActiveColourScheme.FriendlyJumpBridgeColour);
Brush DisabledJumpBridgeBrush = new SolidColorBrush(MapConf.ActiveColourScheme.DisabledJumpBridgeColour);

Brush JumpInRange = new SolidColorBrush(MapConf.ActiveColourScheme.JumpRangeInColour);

Expand Down Expand Up @@ -2153,7 +2154,14 @@ private void AddSystemsToMap()

MainCanvas.Children.Add(jbOutofSystemBlob);

jbOutofSystemBlob.Stroke = new SolidColorBrush(MapConf.ActiveColourScheme.FriendlyJumpBridgeColour);
if(jb.Disabled)
{
jbOutofSystemBlob.Stroke = DisabledJumpBridgeBrush;
}
else
{
jbOutofSystemBlob.Stroke = FriendlyJumpBridgeBrush;
}
jbOutofSystemBlob.Fill = jbOutofSystemBlob.Stroke;
}
else
Expand Down Expand Up @@ -2186,13 +2194,25 @@ private void AddSystemsToMap()
System.Windows.Shapes.Path path = new System.Windows.Shapes.Path();
path.Data = pathGeometry;

path.Stroke = new SolidColorBrush(MapConf.ActiveColourScheme.FriendlyJumpBridgeColour);


path.StrokeThickness = 2;

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

if(!jb.Disabled)
{
dashes.Add(1.0);
dashes.Add(1.0);
path.Stroke = FriendlyJumpBridgeBrush;

}
else
{
dashes.Add(1.0);
dashes.Add(3.0);
path.Stroke = DisabledJumpBridgeBrush;
}

path.StrokeDashArray = dashes;

Expand Down

0 comments on commit 143b77f

Please sign in to comment.