Skip to content

Commit

Permalink
zoomed out display on the universe view tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
BitBaboonSteve committed Dec 22, 2019
1 parent 9143f91 commit 848fe38
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 24 deletions.
6 changes: 5 additions & 1 deletion MapColours.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ public class MapColours


[Category("General")]
[DisplayName("Region Marker")]
[DisplayName("Region Marker Zoomed")]
public Color RegionMarkerTextColour { get; set; }

[Category("General")]
[DisplayName("Region Marker")]
public Color RegionMarkerTextColourFull { get; set; }


[Category("General")]
[DisplayName("Selected System")]
Expand Down
48 changes: 47 additions & 1 deletion MapConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows.Media;
Expand Down Expand Up @@ -494,6 +495,42 @@ public bool ShowADM
}


private float m_UniverseMaxZoomDisplaySystems;
[Category("Universe View")]
[DisplayName("Systems Max Zoom")]
public float UniverseMaxZoomDisplaySystems
{
get
{
return m_UniverseMaxZoomDisplaySystems;
}

set
{
m_UniverseMaxZoomDisplaySystems = Math.Min(Math.Max(value, 0.5f), 10.0f);
OnPropertyChanged("UniverseMaxZoomDisplaySystems");
}
}


private float m_UniverseMaxZoomDisplaySystemsText;
[Category("Universe View")]
[DisplayName("Systems Text Max Zoom")]
public float UniverseMaxZoomDisplaySystemsText
{
get
{
return m_UniverseMaxZoomDisplaySystemsText;
}

set
{
m_UniverseMaxZoomDisplaySystemsText = Math.Min(Math.Max(value, 0.5f), 10.0f);
OnPropertyChanged("UniverseMaxZoomDisplaySystemsText");
}
}



[Category("Navigation")]
public ObservableCollection<StaticJumpOverlay> StaticJumpPoints;
Expand Down Expand Up @@ -521,6 +558,10 @@ public void SetDefaults()
SOVShowConflicts = true;
SOVBasedITCU = true;

UniverseMaxZoomDisplaySystems = 1.3f;
UniverseMaxZoomDisplaySystemsText = 2.0f;


}

public void SetDefaultColours()
Expand All @@ -541,6 +582,7 @@ public void SetDefaultColours()

defaultColours.MapBackgroundColour = (Color)ColorConverter.ConvertFromString("#5E615E");
defaultColours.RegionMarkerTextColour = (Color)ColorConverter.ConvertFromString("#6E716E");
defaultColours.RegionMarkerTextColourFull = Color.FromRgb(0, 0, 0);
defaultColours.ESIOverlayColour = Color.FromRgb(188, 143, 143);
defaultColours.IntelOverlayColour = Color.FromRgb(178, 34, 34);
defaultColours.IntelClearOverlayColour = Colors.Orange;
Expand Down Expand Up @@ -586,6 +628,7 @@ public void SetDefaultColours()
blueColours.OutRegionSystemTextColour = Color.FromRgb(0, 0, 0);
blueColours.MapBackgroundColour = Color.FromRgb(245, 245, 245);
blueColours.RegionMarkerTextColour = (Color)ColorConverter.ConvertFromString("#6E716E");
blueColours.RegionMarkerTextColourFull = Color.FromRgb(0, 0, 0);
blueColours.ESIOverlayColour = Color.FromRgb(192, 192, 192);
blueColours.IntelOverlayColour = Color.FromRgb(216, 191, 216);
blueColours.IntelClearOverlayColour = Colors.Orange;
Expand Down Expand Up @@ -627,6 +670,7 @@ public void SetDefaultColours()
greyAndRed.OutRegionSystemTextColour = Color.FromRgb(0, 0, 0);
greyAndRed.MapBackgroundColour = Color.FromRgb(245, 245, 245);
greyAndRed.RegionMarkerTextColour = (Color)ColorConverter.ConvertFromString("#6E716E");
greyAndRed.RegionMarkerTextColourFull = Color.FromRgb(0, 0, 0);
greyAndRed.ESIOverlayColour = Color.FromRgb(192, 192, 192);
greyAndRed.IntelOverlayColour = Color.FromRgb(80, 34, 34);
greyAndRed.IntelClearOverlayColour = Colors.Orange;
Expand Down Expand Up @@ -668,6 +712,7 @@ public void SetDefaultColours()
dark.OutRegionSystemTextColour = Color.FromRgb(128, 128, 128);
dark.MapBackgroundColour = Color.FromRgb(20, 20, 20);
dark.RegionMarkerTextColour = (Color)ColorConverter.ConvertFromString("#6E716E");
dark.RegionMarkerTextColourFull = Color.FromRgb(0, 0, 0);
dark.ESIOverlayColour = Color.FromRgb(209, 201, 202);
dark.IntelOverlayColour = Color.FromRgb(205, 92, 92);
dark.IntelClearOverlayColour = Colors.Orange;
Expand Down Expand Up @@ -708,6 +753,7 @@ public void SetDefaultColours()
lateNight.OutRegionSystemTextColour = Color.FromRgb(218, 165, 32);
lateNight.MapBackgroundColour = Color.FromRgb(32, 32, 32);
lateNight.RegionMarkerTextColour = (Color)ColorConverter.ConvertFromString("#6E716E");
lateNight.RegionMarkerTextColourFull = Color.FromRgb(0, 0, 0);
lateNight.ESIOverlayColour = Color.FromRgb(81, 81, 81);
lateNight.IntelOverlayColour = Color.FromRgb(178, 34, 34);
lateNight.IntelClearOverlayColour = Colors.Orange;
Expand Down
81 changes: 59 additions & 22 deletions UniverseControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ public void Init()
VHZKB = new VisualHost();


UniverseMainCanvas.Children.Add(VHRegionNames);
UniverseMainCanvas.Children.Add(VHRangeSpheres);
UniverseMainCanvas.Children.Add(VHDataSpheres);
UniverseMainCanvas.Children.Add(VHZKB);
Expand Down Expand Up @@ -523,6 +522,7 @@ private void UniverseControl_PropertyChanged(object sender, PropertyChangedEvent
private Brush ConstellationColourBrush;
private Brush SystemTextColourBrush;
private Brush RegionTextColourBrush;
private Brush RegionTextZoomedOutColourBrush;
private Brush GateColourBrush;
private Brush JumpBridgeColourBrush;
private Brush DataColourBrush;
Expand All @@ -541,7 +541,6 @@ public void ReDrawMap(bool FullRedraw = false, bool DataRedraw = false, bool Fas
double textYOffset = 2;

double SystemTextSize = 5;
double RegionTextSize = 60;
double CharacterTextSize = 6;

double XScale = (UniverseMainCanvas.Width) / universeWidth;
Expand All @@ -556,6 +555,7 @@ public void ReDrawMap(bool FullRedraw = false, bool DataRedraw = false, bool Fas
ConstellationColourBrush = new SolidColorBrush(MapConf.ActiveColourScheme.ConstellationGateColour);
SystemTextColourBrush = new SolidColorBrush(MapConf.ActiveColourScheme.InRegionSystemTextColour);
RegionTextColourBrush = new SolidColorBrush(MapConf.ActiveColourScheme.RegionMarkerTextColour);
RegionTextZoomedOutColourBrush = new SolidColorBrush(MapConf.ActiveColourScheme.RegionMarkerTextColourFull);
GateColourBrush = new SolidColorBrush(MapConf.ActiveColourScheme.NormalGateColour);
JumpBridgeColourBrush = new SolidColorBrush(MapConf.ActiveColourScheme.FriendlyJumpBridgeColour);
DataColourBrush = new SolidColorBrush(MapConf.ActiveColourScheme.ESIOverlayColour);
Expand All @@ -570,6 +570,7 @@ public void ReDrawMap(bool FullRedraw = false, bool DataRedraw = false, bool Fas
JumpBridgeColourBrush.Freeze();
DataColourBrush.Freeze();
BackgroundColourBrush.Freeze();
RegionTextZoomedOutColourBrush.Freeze();


}
Expand All @@ -593,27 +594,10 @@ public void ReDrawMap(bool FullRedraw = false, bool DataRedraw = false, bool Fas

VHLinks.ClearAllChildren();
VHNames.ClearAllChildren();
VHRegionNames.ClearAllChildren();

foreach (EVEData.MapRegion mr in EM.Regions)
{
double X = (mr.RegionX - universeXMin) * universeScale; ;
double Z = (universeDepth - (mr.RegionZ - universeZMin)) * universeScale;

System.Windows.Media.DrawingVisual SystemTextVisual = new System.Windows.Media.DrawingVisual();

DrawingContext drawingContext = SystemTextVisual.RenderOpen();
ReCreateRegionMarkers(MainZoomControl.Zoom > MapConf.UniverseMaxZoomDisplaySystems);

#pragma warning disable CS0618
FormattedText ft = new FormattedText(mr.Name, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tf, RegionTextSize, RegionTextColourBrush);
ft.TextAlignment = TextAlignment.Center;
drawingContext.DrawText(ft, new Point(X + textXOffset, Z + textYOffset));
#pragma warning restore CS0618

drawingContext.Close();

VHRegionNames.AddChild(SystemTextVisual, mr.Name);
}

foreach (GateHelper gh in universeSysLinksCache)
{
Expand Down Expand Up @@ -900,7 +884,7 @@ public void ReDrawMap(bool FullRedraw = false, bool DataRedraw = false, bool Fas

private void MainZoomControl_ZoomChanged(object sender, RoutedEventArgs e)
{
if (MainZoomControl.Zoom < 1.1)
if (MainZoomControl.Zoom < MapConf.UniverseMaxZoomDisplaySystemsText)
{
VHNames.Visibility = Visibility.Hidden;
}
Expand All @@ -909,16 +893,69 @@ private void MainZoomControl_ZoomChanged(object sender, RoutedEventArgs e)
VHNames.Visibility = Visibility.Visible;
}

if (MainZoomControl.Zoom < 0.8)
if (MainZoomControl.Zoom < MapConf.UniverseMaxZoomDisplaySystems)
{
VHSystems.Visibility = Visibility.Hidden;
ReCreateRegionMarkers(true);

}
else
{
VHSystems.Visibility = Visibility.Visible;
ReCreateRegionMarkers(false);
}


}

private bool RegionZoomed = false;
private void ReCreateRegionMarkers(bool ZoomedOut)
{

if(RegionZoomed == ZoomedOut)
{
return;
}
RegionZoomed = ZoomedOut;

UniverseMainCanvas.Children.Remove(VHRegionNames);
VHRegionNames.ClearAllChildren();



double RegionTextSize = 50;
Typeface tf = new Typeface("Verdana");

Brush rtb = RegionTextColourBrush;
if(ZoomedOut)
{
UniverseMainCanvas.Children.Add(VHRegionNames);
rtb = RegionTextZoomedOutColourBrush;
}
else
{
UniverseMainCanvas.Children.Insert(0,VHRegionNames);
}

foreach (EVEData.MapRegion mr in EM.Regions)
{
double X = (mr.RegionX - universeXMin) * universeScale; ;
double Z = (universeDepth - (mr.RegionZ - universeZMin)) * universeScale;

System.Windows.Media.DrawingVisual SystemTextVisual = new System.Windows.Media.DrawingVisual();

DrawingContext drawingContext = SystemTextVisual.RenderOpen();

#pragma warning disable CS0618
FormattedText ft = new FormattedText(mr.Name, CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, tf, RegionTextSize, rtb);
ft.TextAlignment = TextAlignment.Center;
drawingContext.DrawText(ft, new Point(X, Z));
#pragma warning restore CS0618

drawingContext.Close();

VHRegionNames.AddChild(SystemTextVisual);
}
}

public void ShowSystem(string SystemName)
Expand Down

0 comments on commit 848fe38

Please sign in to comment.