- Implemented multiple labels logic for edges. Now you can display multiple labels across the edge

- Added LabelHorizontalOffset property for labels
This commit is contained in:
panthernet 2018-02-11 11:40:41 +01:00
Родитель f5b89bc51c
Коммит ec55ee147f
23 изменённых файлов: 302 добавлений и 346 удалений

Просмотреть файл

@ -4,9 +4,9 @@ using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("panthernet dev works")]
[assembly: AssemblyProduct("GraphX for .NET")]
[assembly: AssemblyCopyright("Copyright www.panthernet.ru © 2016")]
[assembly: AssemblyCopyright("Copyright www.panthernet.ru © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("2.3.7.0")]
[assembly: AssemblyFileVersion("2.3.7.0")]
[assembly: AssemblyVersion("2.3.8.0")]
[assembly: AssemblyFileVersion("2.3.8.0")]

Просмотреть файл

@ -1,4 +1,36 @@
RELEASE 2.3.7
RELEASE 2.3.8
- Implemented multiple labels logic for edges. Now you can display multiple labels across the edge
- Added LabelHorizontalOffset property for labels which offsets labels along the edge given some offset value in total edge length percent
CODE CHANGES:
- Properties ShowLabel,LabelVerticalOffset,AlignLabelsToEdges moved from EdgeControlBase to EdgeLabelControl class
- Property AlignLabelsToEdges renamed to AlignToEdge
- Property EdgeControlBase.EdgeLabelControl renamed to EdgeLabelControls and now has IList<IEdgeLabelControl> type
- Added new method IList<SysRect> EdgeControlBase.GetLabelSizes()
- Added new method IList<IEdgeLabelControl> EdgeControlBase.GetLabelControls()
- GraphArea.ShowAllEdgesLabels() method now has one-time effect and will not be reapplied after relayout
- GraphArea.ShowAllEdgesLabels() method now has one-time effect and will not be reapplied after relayout
- GraphArea.EdgeLabelFactory is now setup up with default factory generating one AttachableEdgeLabelControl
- Label factory method CreateLabel() now returns IEnumerable<TResult> to accomodate multiple labels generation during single factory pass
OBSOLETE AND REMOVED STUFF:
General
- Old style arrows are now not supported
- Old style edge labels (EdgeLabelControl) are now not supported, make sure to remove it from XAML templates and update your code to use AttachableEdgeLabelControl
EdgeControlBase
- LabelAngle
- GetLabelSize()
- SetCustomLabelSize()
EdgeControl
- LabelMouseDown event removed
Other:
- showLabel parameter has been removed from all EdgeControl constructors and factories
RELEASE 2.3.7
- Added edge drag functionality to be able to reattach edge to another vertex (thanks to LaborJos)
- Fixed SimpleTreeLayout vertex sizes supplement (thanks to edgardozoppi)
- Fixed and improved parallel edge handling (thanks to perturbare)

Просмотреть файл

@ -3,6 +3,8 @@ using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using GraphX.Controls;
using GraphX.Controls.Models;
using GraphX.PCL.Common.Enums;
using ShowcaseApp.WPF.Annotations;
using ShowcaseApp.WPF.Models;
@ -35,6 +37,7 @@ namespace ShowcaseApp.WPF.Pages.Mini
cbEnablePE.Checked += CbMathShapeOnChecked;
cbEnablePE.Unchecked += CbMathShapeOnChecked;
graphArea.EdgeLabelFactory = new DefaultEdgelabelFactory();
}
private void CbMathShapeOnChecked(object sender, RoutedEventArgs routedEventArgs)
@ -88,12 +91,12 @@ namespace ShowcaseApp.WPF.Pages.Mini
zoomControl.MaxZoom = 50;
//manual edge corrections
var eList = graphArea.EdgesList.Values.ToList();
eList[0].LabelVerticalOffset = 12;
eList[1].LabelVerticalOffset = 12;
eList[0].GetLabelControls().FirstOrDefault().LabelVerticalOffset = 12;
eList[1].GetLabelControls().FirstOrDefault().LabelVerticalOffset = 12;
eList[2].ShowLabel = false;
eList[3].LabelVerticalOffset = 12;
eList[4].LabelVerticalOffset = 12;
eList[2].GetLabelControls().FirstOrDefault().ShowLabel = false;
// eList[3].GetLabelControls().FirstOrDefault().LabelVerticalOffset = 12;
// eList[4].GetLabelControls().FirstOrDefault().LabelVerticalOffset = -12;
//PS: to see how parallel edges logic works go to GraphArea::UpdateParallelEdgesData() method

Просмотреть файл

@ -35,15 +35,6 @@
<controls:DefaultEdgePointer NeedRotation="true" x:Name="PART_EdgePointerForTarget" >
<Path Data="M0,0.5 L1,1 1,0" Fill="{TemplateBinding Foreground}" Stretch="Uniform" Width="10" Height="10"/>
</controls:DefaultEdgePointer>
<Path x:Name="PART_SelfLoopedEdge"
Width="10"
Height="10"
Stretch="Uniform"
Fill="Black"
IsHitTestVisible="True"
ToolTip="This vertex has some self looped edges!"
Data="F1 M 17.4167,32.25L 32.9107,32.25L 38,18L 43.0893,32.25L 58.5833,32.25L 45.6798,41.4944L 51.4583,56L 38,48.0833L 26.125,56L 30.5979,41.7104L 17.4167,32.25 Z "/>
<controls:EdgeLabelControl x:Name="PART_edgeLabel" Content="{Binding Edge.ToolTipText, RelativeSource={RelativeSource TemplatedParent}}" />
</Grid>
</ControlTemplate>
</Setter.Value>
@ -51,13 +42,21 @@
</Style>
<!--EDGE LABLE CONTROL -->
<Style TargetType="{x:Type controls:EdgeLabelControl}">
<Style TargetType="{x:Type controls:AttachableEdgeLabelControl}">
<Setter Property="LabelVerticalOffset" Value="0"/>
<Setter Property="ShowLabel" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:EdgeLabelControl}">
<TextBlock Text="{TemplateBinding Content}" FontSize="8" FontStyle="Italic" Margin="1" VerticalAlignment="Center"/>
<ControlTemplate TargetType="{x:Type controls:AttachableEdgeLabelControl}">
<Border BorderBrush="Black" BorderThickness="1" Background="White" CornerRadius="5">
<StackPanel Orientation="Horizontal">
<TextBlock FontWeight="Bold" FontSize="8" Text="ToolTip: " Foreground="Black" Margin="1"/>
<TextBlock FontSize="8" Text="{Binding AttachNode.Edge.ToolTipText}" Foreground="Black" Margin="1"/>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="DisplayForSelfLoopedEdges" Value="False"/>
</Style>
</ResourceDictionary>

Просмотреть файл

@ -12,70 +12,6 @@
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="PointerOver">
<Storyboard>
<DoubleAnimation To="1.5" Duration="00:00:1"
Storyboard.TargetName="bigEllipse"
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
<DoubleAnimation.EasingFunction>
<BounceEase Bounces="2" EasingMode="EaseOut" Bounciness="2" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation To="1.5" Duration="00:00:1"
Storyboard.TargetName="bigEllipse"
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
<DoubleAnimation.EasingFunction>
<BounceEase Bounces="2" EasingMode="EaseOut" Bounciness="2" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation To="1.5" Duration="00:00:1"
Storyboard.TargetName="smallEllipse"
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
<DoubleAnimation.EasingFunction>
<BounceEase Bounces="4" EasingMode="EaseOut" Bounciness="2" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation To="1.5" Duration="00:00:1"
Storyboard.TargetName="smallEllipse"
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
<DoubleAnimation.EasingFunction>
<BounceEase Bounces="4" EasingMode="EaseOut" Bounciness="2" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</VisualState>
<VisualState x:Name="PointerLeave">
<Storyboard>
<DoubleAnimation To="1" Duration="00:00:1"
Storyboard.TargetName="bigEllipse"
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
<DoubleAnimation.EasingFunction>
<BounceEase Bounces="2" EasingMode="EaseOut" Bounciness="2" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation To="1" Duration="00:00:1"
Storyboard.TargetName="bigEllipse"
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
<DoubleAnimation.EasingFunction>
<BounceEase Bounces="2" EasingMode="EaseOut" Bounciness="2" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation To="1" Duration="00:00:1"
Storyboard.TargetName="smallEllipse"
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)">
<DoubleAnimation.EasingFunction>
<BounceEase Bounces="4" EasingMode="EaseOut" Bounciness="2" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation To="1" Duration="00:00:1"
Storyboard.TargetName="smallEllipse"
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)">
<DoubleAnimation.EasingFunction>
<BounceEase Bounces="4" EasingMode="EaseOut" Bounciness="2" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Ellipse Name="bigEllipse" Width="{Binding VisualDiameter}" Height="{Binding VisualDiameter}"
@ -98,7 +34,6 @@
</Style>
<Style TargetType="controls1:EdgeControl">
<Setter Property="LabelVerticalOffset" Value="10" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls1:EdgeControl">
@ -122,11 +57,6 @@
Stretch="Uniform"
Fill="{TemplateBinding Foreground}"
Data="F1 M 17.4167,32.25L 32.9107,32.25L 38,18L 43.0893,32.25L 58.5833,32.25L 45.6798,41.4944L 51.4583,56L 38,48.0833L 26.125,56L 30.5979,41.7104L 17.4167,32.25 Z "/>
<controls1:EdgeLabelControl x:Name="PART_edgeLabel"
Content="{Binding Text}"
Opacity="{Binding VisualEdgeTransparency}"
/>
</Grid>
</ControlTemplate>
</Setter.Value>
@ -135,19 +65,23 @@
</Style>
<!--EDGE LABLE CONTROL -->
<Style TargetType="controls1:EdgeLabelControl">
<Style TargetType="controls1:AttachableEdgeLabelControl">
<Setter Property="ShowLabel" Value="True"/>
<Setter Property="AlignToEdge" Value="True"/>
<Setter Property="LabelVerticalOffset" Value="10"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Opacity" Value="{Binding AttachNode.Edge.VisualEdgeTransparency}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls1:EdgeLabelControl">
<ControlTemplate TargetType="controls1:AttachableEdgeLabelControl">
<Grid>
<ContentPresenter Margin="3" />
<ContentPresenter Margin="3" Content="{Binding AttachNode.Edge.Text}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="DisplayForSelfLoopedEdges" Value="False"/>
</Style>

Просмотреть файл

@ -163,14 +163,11 @@
<controls1:DefaultEdgePointer x:Name="PART_EdgePointerForTarget" Opacity="239">
<Path Data="M0,0.5 L1,1 1,0" Fill="Yellow" Stretch="Uniform" Width="15" Height="15"/>
</controls1:DefaultEdgePointer>
<controls1:EdgeLabelControl x:Name="PART_edgeLabel" Content="{Binding Edge.Text, RelativeSource={RelativeSource TemplatedParent}}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="LabelVerticalOffset" Value="0"/>
<Setter Property="MinWidth"
Value="1" />
<Setter Property="MinHeight"
@ -185,19 +182,23 @@
<!-- ENDREGION -->
<!-- REGION LABLE CONTROLS -->
<Style TargetType="controls1:EdgeLabelControl">
<Setter Property="DisplayForSelfLoopedEdges" Value="False"/>
<Style TargetType="controls1:AttachableEdgeLabelControl">
<Setter Property="ShowLabel" Value="True"/>
<Setter Property="LabelVerticalOffset" Value="10"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Opacity" Value="{Binding AttachNode.Edge.VisualEdgeTransparency}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls1:EdgeLabelControl">
<Grid>
<ControlTemplate TargetType="controls1:AttachableEdgeLabelControl">
<Border BorderBrush="Black" BorderThickness="1" Background="LightCoral" CornerRadius="8">
<ContentPresenter Margin="3"/>
<ContentPresenter Margin="3" Content="{Binding AttachNode.Edge.Text}"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="DisplayForSelfLoopedEdges" Value="False"/>
</Style>
<!--VERTEX LABEL CONTROL -->

Просмотреть файл

@ -57,7 +57,6 @@
<controls:DefaultEdgePointer NeedRotation="true" x:Name="PART_EdgePointerForTarget" >
<Path Data="M0,0.5 L1,1 1,0" Fill="Black" Stretch="Uniform" Width="15" Height="15"/>
</controls:DefaultEdgePointer>
<controls:EdgeLabelControl x:Name="PART_edgeLabel" Content="{Binding Edge.ToolTipText, RelativeSource={RelativeSource TemplatedParent}}" />
</Grid>
</ControlTemplate>
</Setter.Value>
@ -86,23 +85,18 @@
</Style>
<!--EDGE LABLE CONTROL -->
<Style TargetType="{x:Type controls:EdgeLabelControl}">
<Style TargetType="{x:Type controls:AttachableEdgeLabelControl}">
<Setter Property="ShowLabel" Value="True"/>
<Setter Property="LabelVerticalOffset" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:EdgeLabelControl}">
<Grid>
<Border BorderBrush="Black" BorderThickness="1" Background="LightCoral" CornerRadius="8">
<ContentPresenter Margin="3"/>
</Border>
</Grid>
<ControlTemplate TargetType="{x:Type controls:AttachableEdgeLabelControl}">
<Border BorderBrush="Black" BorderThickness="1" Background="LightCoral" CornerRadius="8">
<ContentPresenter Margin="3"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="RenderTransform">
<Setter.Value>
<RotateTransform CenterX="0.5" CenterY="0.5" Angle="{Binding RelativeSource={RelativeSource AncestorType=controls:EdgeLabelControl} , Path=Angle}"/>
</Setter.Value>
</Setter>
<Setter Property="DisplayForSelfLoopedEdges" Value="False"/>
</Style>
</ResourceDictionary>

Просмотреть файл

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2020
VisualStudioVersion = 15.0.27130.2027
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{D9664367-2C2C-46B2-81A6-26CDCD087B29}"
EndProject
@ -156,6 +156,7 @@ Global
{4BEBC41E-2710-4613-80B1-198E08D10619}.Release|x86.ActiveCfg = Release|x86
{4BEBC41E-2710-4613-80B1-198E08D10619}.Release|x86.Build.0 = Release|x86
{51C7122B-AAD1-4C49-B2E9-1B09B367952F}.Debug|Any CPU.ActiveCfg = Debug|x86
{51C7122B-AAD1-4C49-B2E9-1B09B367952F}.Debug|Any CPU.Build.0 = Debug|x86
{51C7122B-AAD1-4C49-B2E9-1B09B367952F}.Debug|ARM.ActiveCfg = Debug|ARM
{51C7122B-AAD1-4C49-B2E9-1B09B367952F}.Debug|ARM.Build.0 = Debug|ARM
{51C7122B-AAD1-4C49-B2E9-1B09B367952F}.Debug|ARM.Deploy.0 = Debug|ARM
@ -188,7 +189,7 @@ Global
{51C7122B-AAD1-4C49-B2E9-1B09B367952F} = {D9664367-2C2C-46B2-81A6-26CDCD087B29}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9548CBF3-9C1D-4132-B928-475E2AA6A99B}
VisualSVNWorkingCopyRoot = .
SolutionGuid = {9548CBF3-9C1D-4132-B928-475E2AA6A99B}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -12,6 +12,7 @@ using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
#endif
using GraphX.Controls.Models;
using GraphX.PCL.Common;
using GraphX.PCL.Common.Enums;
using GraphX.PCL.Common.Interfaces;
@ -57,26 +58,6 @@ namespace GraphX.Controls
#endregion
public event EdgeLabelEventHandler LabelMouseDown;
protected void OnLabelMouseDown(MouseButtonEventArgs mArgs, ModifierKeys keys)
{
LabelMouseDown?.Invoke(this, new EdgeLabelSelectedEventArgs(EdgeLabelControl, this, mArgs, keys));
}
protected override void OnEdgeLabelUpdated()
{
var ctrl = EdgeLabelControl as Control;
if (ctrl == null) return;
#if WPF
MouseButtonEventHandler func = (sender, args) => OnLabelMouseDown(args, Keyboard.Modifiers);
ctrl.MouseDown -= func;
ctrl.MouseDown += func;
#elif METRO
PointerEventHandler func = (sender, args) => OnLabelMouseDown(args, null);
ctrl.PointerPressed -= func;
ctrl.PointerPressed += func;
#endif
}
#region public Clean()
public override void Clean()
@ -97,11 +78,8 @@ namespace GraphX.Controls
Linegeometry = null;
LinePathObject = null;
SelfLoopIndicator = null;
if (EdgeLabelControl != null)
{
EdgeLabelControl.Dispose();
EdgeLabelControl = null;
}
EdgeLabelControls.ForEach(l=> l.Dispose());
EdgeLabelControls.Clear();
if (EdgePointerForSource != null)
{
@ -338,13 +316,12 @@ namespace GraphX.Controls
{
}
public EdgeControl(VertexControl source, VertexControl target, object edge, bool showLabels = false, bool showArrows = true)
public EdgeControl(VertexControl source, VertexControl target, object edge, bool showArrows = true)
{
DataContext = edge;
Source = source; Target = target;
Edge = edge; DataContext = edge;
this.SetCurrentValue(ShowArrowsProperty, showArrows);
this.SetCurrentValue(ShowLabelProperty, showLabels);
IsHiddenEdgesUpdated = true;
#if METRO

Просмотреть файл

@ -1,11 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using GraphX.Controls.Models;
using GraphX.PCL.Common.Enums;
using GraphX.PCL.Common.Exceptions;
using GraphX.PCL.Common.Interfaces;
using System.Windows.Input;
using GraphX.PCL.Common;
#if WPF
using System.Windows.Controls;
@ -15,7 +16,6 @@ using System.Windows.Shapes;
using SysRect = System.Windows.Rect;
#elif METRO
using GraphX.PCL.Common;
using GraphX.Measure;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@ -30,8 +30,7 @@ namespace GraphX.Controls
{
[TemplatePart(Name = "PART_edgePath", Type = typeof(Path))]
[TemplatePart(Name = "PART_SelfLoopedEdge", Type = typeof(FrameworkElement))]
[TemplatePart(Name = "PART_edgeArrowPath", Type = typeof(Path))]//obsolete, present for exception
[TemplatePart(Name = "PART_edgeLabel", Type = typeof(IEdgeLabelControl))]
[TemplatePart(Name = "PART_edgeLabel", Type = typeof(IEdgeLabelControl))] //obsolete, present for exception
[TemplatePart(Name = "PART_EdgePointerForSource", Type = typeof(IEdgePointer))]
[TemplatePart(Name = "PART_EdgePointerForTarget", Type = typeof(IEdgePointer))]
public abstract class EdgeControlBase : Control, IGraphControl, IDisposable
@ -164,7 +163,7 @@ namespace GraphX.Controls
typeof(EdgeControlBase),
new PropertyMetadata(null));
private double _labelAngle;
/* private double _labelAngle;
/// <summary>
/// Gets or sets vertex label angle
@ -180,7 +179,7 @@ namespace GraphX.Controls
_labelAngle = value;
if (EdgeLabelControl != null) EdgeLabelControl.Angle = _labelAngle;
}
}
}*/
#region DashStyle
@ -290,50 +289,6 @@ namespace GraphX.Controls
/// </summary>
public bool ShowArrows { get { return (bool)GetValue(ShowArrowsProperty); } set { SetValue(ShowArrowsProperty, value); } }
public static readonly DependencyProperty ShowLabelProperty = DependencyProperty.Register("ShowLabel",
typeof(bool),
typeof(EdgeControlBase),
new PropertyMetadata(false, showlabel_changed));
private static void showlabel_changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as EdgeControlBase)?.UpdateEdge();
}
/// <summary>
/// Show edge label.Default value is False.
/// </summary>
public bool ShowLabel { get { return (bool)GetValue(ShowLabelProperty); } set { SetValue(ShowLabelProperty, value); } }
/// <summary>
/// Gets or sets if lables should be aligned to edges and be displayed under the same angle
/// </summary>
public bool AlignLabelsToEdges
{
get { return _alignLabelsToEdges; }
set
{
_alignLabelsToEdges = value;
if (EdgeLabelControl != null)
{
if (value == false) EdgeLabelControl.Angle = 0;
EdgeLabelControl.UpdatePosition();
}
}
}
protected bool _alignLabelsToEdges;
public static readonly DependencyProperty LabelVerticalOffsetProperty = DependencyProperty.Register("LabelVerticalOffset",
typeof(double),
typeof(EdgeControlBase),
new PropertyMetadata(0d));
/// <summary>
/// Offset for labels Y axis to display it above/below the edge
/// </summary>
public double LabelVerticalOffset { get { return (double)GetValue(LabelVerticalOffsetProperty); } set { SetValue(LabelVerticalOffsetProperty, value); } }
/// <summary>
/// Gets or Sets that user controls the path geometry object or it is generated automatically
/// </summary>
@ -349,12 +304,12 @@ namespace GraphX.Controls
/// </summary>
protected Path LinePathObject;
private IEdgeLabelControl _edgeLabelControl;
private IList<IEdgeLabelControl> _edgeLabelControls = new List<IEdgeLabelControl>();
/// <summary>
/// Templated label control to display labels
/// </summary>
protected internal IEdgeLabelControl EdgeLabelControl { get { return _edgeLabelControl; } set { _edgeLabelControl = value; OnEdgeLabelUpdated(); } }
protected internal IList<IEdgeLabelControl> EdgeLabelControls { get { return _edgeLabelControls; } set { _edgeLabelControls = value; OnEdgeLabelUpdated(); } }
protected IEdgePointer EdgePointerForSource;
protected IEdgePointer EdgePointerForTarget;
@ -404,17 +359,29 @@ namespace GraphX.Controls
/// <param name="ctrl"></param>
public void AttachLabel(IEdgeLabelControl ctrl)
{
EdgeLabelControl = ctrl;
UpdateLabelLayout();
EdgeLabelControls.Add(ctrl);
if(!RootArea.Children.Contains((UIElement)ctrl))
RootArea.Children.Add((UIElement)ctrl);
ctrl.Show();
var r = ctrl.GetSize();
if (r == SysRect.Empty)
{
ctrl.UpdateLayout();
ctrl.UpdatePosition();
}
}
/// <summary>
/// Internal method. Detaches label from control.
/// </summary>
public void DetachLabel()
public void DetachLabels(IEdgeLabelControl ctrl = null)
{
(EdgeLabelControl as IAttachableControl<EdgeControl>)?.Detach();
EdgeLabelControl = null;
EdgeLabelControls.Where(l => l is IAttachableControl<EdgeControl>).Cast<IAttachableControl<EdgeControl>>().ForEach(label =>
{
label.Detach();
RootArea.Children.Remove((UIElement)label);
});
EdgeLabelControls.Clear();
}
/// <summary>
@ -422,8 +389,12 @@ namespace GraphX.Controls
/// </summary>
public void UpdateLabel()
{
if (_edgeLabelControl != null && ShowLabel)
UpdateLabelLayout(true);
_edgeLabelControls.Where(l=> l.ShowLabel).ForEach(l =>
{
l.Show();
l.UpdateLayout();
l.UpdatePosition();
});
}
#endregion Properties & Fields
@ -499,7 +470,7 @@ namespace GraphX.Controls
internal virtual void InvalidateChildren()
{
EdgeLabelControl?.UpdateLayout();
EdgeLabelControls.ForEach(l=>l.UpdateLayout());
if (LinePathObject != null)
{
var pos = this.Source.GetPosition();
@ -530,10 +501,10 @@ namespace GraphX.Controls
LinePathObject = GetTemplatePart("PART_edgePath") as Path;
if (LinePathObject == null) throw new GX_ObjectNotFoundException("EdgeControlBase Template -> Edge template must contain 'PART_edgePath' Path object to draw route points!");
LinePathObject.Data = Linegeometry;
if (this.FindDescendantByName("PART_edgeArrowPath") != null)
throw new GX_ObsoleteException("PART_edgeArrowPath is obsolete! Please use new DefaultEdgePointer object in your EdgeControlBase template!");
EdgeLabelControl = EdgeLabelControl ?? GetTemplatePart("PART_edgeLabel") as IEdgeLabelControl;
//EdgeLabelControl = EdgeLabelControl ?? GetTemplatePart("PART_edgeLabel") as IEdgeLabelControl;
if(GetTemplatePart("PART_edgeLabel") != null)
throw new GX_ObsoleteException("PART_edgeLabel is obsolete. Please use attachable labels mechanics!");
EdgePointerForSource = GetTemplatePart("PART_EdgePointerForSource") as IEdgePointer;
EdgePointerForTarget = GetTemplatePart("PART_EdgePointerForTarget") as IEdgePointer;
@ -575,8 +546,11 @@ namespace GraphX.Controls
if (Visibility == Visibility.Visible || IsHiddenEdgesUpdated)
{
//first show label to get DesiredSize
if (EdgeLabelControl != null)
if (ShowLabel) EdgeLabelControl.Show(); else EdgeLabelControl.Hide();
EdgeLabelControls.ForEach(l =>
{
if (l.ShowLabel) l.Show();
else l.Hide();
});
UpdateEdgeRendering(updateLabel);
}
}
@ -889,8 +863,8 @@ namespace GraphX.Controls
GeometryHelper.TryFreeze(lineFigure);
GeometryHelper.TryFreeze(Linegeometry);
#endif
if (ShowLabel && EdgeLabelControl != null && _updateLabelPosition)
EdgeLabelControl.UpdatePosition();
if (_updateLabelPosition)
EdgeLabelControls.Where(l => l.ShowLabel).ForEach(l => l.UpdatePosition());
if (LinePathObject == null) return;
LinePathObject.Data = Linegeometry;
@ -1157,8 +1131,8 @@ namespace GraphX.Controls
GeometryHelper.TryFreeze(lineFigure);
GeometryHelper.TryFreeze(Linegeometry);
#endif
if (ShowLabel && EdgeLabelControl != null && _updateLabelPosition && updateLabel)
EdgeLabelControl.UpdatePosition();
if (_updateLabelPosition && updateLabel)
EdgeLabelControls.Where(l => l.ShowLabel).ForEach(l => l.UpdatePosition());
}
private Point UpdateSourceEpData(Point from, Point to, bool allowUnsuppress = true)
@ -1203,25 +1177,22 @@ namespace GraphX.Controls
#endif
}
public virtual SysRect GetLabelSize()
public virtual IList<SysRect> GetLabelSizes()
{
return EdgeLabelControl.GetSize();
return EdgeLabelControls.Select(l=> l.GetSize()).ToList();
}
public void SetCustomLabelSize(SysRect rect)
/* public void SetCustomLabelSize(SysRect rect)
{
EdgeLabelControl.SetSize(rect);
}
}*/
internal virtual void UpdateLabelLayout(bool force = false)
/// <summary>
/// Returns all edge controls attached to this entity
/// </summary>
public IList<IEdgeLabelControl> GetLabelControls()
{
EdgeLabelControl.Show();
if (EdgeLabelControl.GetSize() == SysRect.Empty || force)
{
EdgeLabelControl.UpdateLayout();
EdgeLabelControl.UpdatePosition();
}
return EdgeLabelControls.ToList();
}
}
}

Просмотреть файл

@ -57,6 +57,7 @@ namespace GraphX.Controls
AttachNode.IsVisibleChanged += AttachNode_IsVisibleChanged;
#elif METRO
AttachNode = node;
#endif
node.AttachLabel(this);
}
@ -76,7 +77,7 @@ namespace GraphX.Controls
#if WPF
void AttachNode_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if(AttachNode.IsVisible && AttachNode.ShowLabel)
if(AttachNode.IsVisible && ShowLabel)
base.Show();
else if (!AttachNode.IsVisible)
{

Просмотреть файл

@ -31,9 +31,60 @@ namespace GraphX.Controls
//hack to fix weird METRO error when it can't find this class
[Bindable]
#endif
public class EdgeLabelControl : ContentControl, IEdgeLabelControl
public abstract class EdgeLabelControl : ContentControl, IEdgeLabelControl
{
public static readonly DependencyProperty AlignToEdgeProperty = DependencyProperty.Register("AlignToEdge",
typeof(bool),
typeof(EdgeLabelControl),
new PropertyMetadata(false, (o, e) =>
{
var ctrl = (EdgeLabelControl) o;
if ((bool)e.NewValue == false) ctrl.Angle = 0;
ctrl.UpdatePosition();
} ));
/// <summary>
/// Gets or sets if lables should be aligned to edges and be displayed under the same angle
/// </summary>
public bool AlignToEdge { get { return (bool)GetValue(AlignToEdgeProperty); } set { SetValue(AlignToEdgeProperty, value); }}
public static readonly DependencyProperty LabelVerticalOffsetProperty = DependencyProperty.Register("LabelVerticalOffset",
typeof(double),
typeof(EdgeLabelControl),
new PropertyMetadata(0d));
/// <summary>
/// Offset for label Y axis to display it above/below the edge
/// </summary>
public double LabelVerticalOffset { get { return (double)GetValue(LabelVerticalOffsetProperty); } set { SetValue(LabelVerticalOffsetProperty, value); } }
public static readonly DependencyProperty LabelHorizontalOffsetProperty = DependencyProperty.Register("LabelHorizontalOffset",
typeof(double),
typeof(EdgeLabelControl),
new PropertyMetadata(0d));
/// <summary>
/// Offset for label X axis to display it along the edge
/// </summary>
public double LabelHorizontalOffset { get { return (double)GetValue(LabelHorizontalOffsetProperty); } set { SetValue(LabelHorizontalOffsetProperty, value); } }
public static readonly DependencyProperty ShowLabelProperty = DependencyProperty.Register("ShowLabel",
typeof(bool),
typeof(EdgeLabelControl),
new PropertyMetadata(false, showlabel_changed));
private static void showlabel_changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as EdgeControlBase)?.UpdateEdge();
}
/// <summary>
/// Show edge label.Default value is False.
/// </summary>
public bool ShowLabel { get { return (bool)GetValue(ShowLabelProperty); } set { SetValue(ShowLabelProperty, value); } }
public static readonly DependencyProperty DisplayForSelfLoopedEdgesProperty = DependencyProperty.Register("DisplayForSelfLoopedEdges",
typeof(bool),
typeof(EdgeLabelControl),
@ -228,12 +279,14 @@ namespace GraphX.Controls
var desiredSize = DesiredSize;
bool flipAxis = p1.X > p2.X; // Flip axis if source is "after" target
ApplyLabelHorizontalOffset(edgeLength, LabelHorizontalOffset);
// Calculate the center point of the edge
var centerPoint = new Point(p1.X + edgeLength * Math.Cos(angleBetweenPoints), p1.Y - edgeLength * Math.Sin(angleBetweenPoints));
if (EdgeControl.AlignLabelsToEdges)
if (AlignToEdge)
{
// If we're aligning labels to the edges make sure add the label vertical offset
var yEdgeOffset = EdgeControl.LabelVerticalOffset;
var yEdgeOffset = LabelVerticalOffset;
if (FlipOnRotation && flipAxis && !EdgeControl.IsParallel) // If we've flipped axis, move the offset to the other side of the edge
yEdgeOffset = -yEdgeOffset;
@ -250,7 +303,19 @@ namespace GraphX.Controls
UpdateFinalPosition(centerPoint, desiredSize);
#if METRO
GraphAreaBase.SetX(this, LastKnownRectSize.X, true);
GraphAreaBase.SetY(this, LastKnownRectSize.Y, true);
#else
Arrange(LastKnownRectSize);
#endif
}
protected virtual double ApplyLabelHorizontalOffset(double edgeLength, double offset)
{
if (offset == 0) return edgeLength;
edgeLength += edgeLength / 100 * offset;
return edgeLength;
}
/// <summary>
@ -314,7 +379,7 @@ namespace GraphX.Controls
void EdgeLabelControl_LayoutUpdated(object sender, DefaultEventArgs e)
{
if (EdgeControl == null || !EdgeControl.ShowLabel) return;
if (EdgeControl == null || !ShowLabel) return;
if (LastKnownRectSize == SysRect.Empty || double.IsNaN(LastKnownRectSize.Width) || LastKnownRectSize.Width == 0)
{
UpdateLayout();

Просмотреть файл

@ -169,7 +169,8 @@ namespace GraphX.Controls
/// <param name="control"></param>
public virtual void AddCustomChildControl(UIElement control)
{
Children.Add(control);
if(!Children.Contains(control))
Children.Add(control);
SetX(control, 0);
SetY(control, 0);
}
@ -242,7 +243,7 @@ namespace GraphX.Controls
{
EnableVisualPropsRecovery = true;
EnableVisualPropsApply = true;
//EdgeLabelFactory = new DefaultLabelFactory<AttachableEdgeLabelControl, IEdgeLabelControl>();
EdgeLabelFactory = new DefaultEdgelabelFactory();
//VertexLabelFactory = new DefaultLabelFactory<AttachableVertexLabelControl, IVertexLabelControl>();
#region Designer Data
@ -434,11 +435,8 @@ namespace GraphX.Controls
private void RemoveEdgeInternal(EdgeControlBase ctrl, bool removeEdgeFromDataGraph = false)
{
if (ctrl.EdgeLabelControl != null)
{
Children.Remove((UIElement)ctrl.EdgeLabelControl);
ctrl.DetachLabel();
}
ctrl.DetachLabels();
Children.Remove(ctrl);
if (removeEdgeFromDataGraph && LogicCore?.Graph != null && LogicCore.Graph.ContainsEdge(ctrl.Edge as TEdge))
LogicCore.Graph.RemoveEdge(ctrl.Edge as TEdge);
@ -659,14 +657,18 @@ namespace GraphX.Controls
protected virtual void GenerateVertexLabel(VertexControl vertexControl)
{
var label = VertexLabelFactory.CreateLabel(vertexControl);
if (!(label is IVertexLabelControl))
var labels = VertexLabelFactory.CreateLabel(vertexControl);
if (labels == null) return;
if (labels.Any(l=> !(l is IVertexLabelControl)))
throw new GX_InvalidDataException("Generated vertex label should implement IVertexLabelControl interface");
if (_svVertexLabelShow == false || vertexControl.Visibility != Visibility.Visible)
label.Visibility = Visibility.Collapsed;
AddCustomChildControl(label);
label.Measure(new USize(double.MaxValue, double.MaxValue));
((IVertexLabelControl)label).UpdatePosition();
labels.ForEach(l =>
{
if (_svVertexLabelShow == false || vertexControl.Visibility != Visibility.Visible)
l.Visibility = Visibility.Collapsed;
AddCustomChildControl(l);
l.Measure(new USize(double.MaxValue, double.MaxValue));
((IVertexLabelControl)l).UpdatePosition();
});
}
protected virtual void GenerateEdgeLabels()
@ -681,14 +683,17 @@ namespace GraphX.Controls
protected virtual void GenerateEdgeLabel(EdgeControl edgeControl)
{
var label = EdgeLabelFactory.CreateLabel(edgeControl);
if (!(label is IEdgeLabelControl))
var labels = EdgeLabelFactory.CreateLabel(edgeControl);
if (labels == null) return;
if (labels.Any(a=> !(a is IEdgeLabelControl)))
throw new GX_InvalidDataException("Generated edge label should implement IEdgeLabelControl interface");
if (_svShowEdgeLabels == false || edgeControl.Visibility != Visibility.Visible)
label.Visibility = Visibility.Collapsed;
AddCustomChildControl(label);
label.Measure(new USize(double.MaxValue, double.MaxValue));
((IEdgeLabelControl)label).UpdatePosition();
labels.ForEach(l =>
{
AddCustomChildControl(l);
l.Measure(new USize(double.MaxValue, double.MaxValue));
((IEdgeLabelControl)l).UpdatePosition();
});
}
#endregion
@ -1330,8 +1335,8 @@ namespace GraphX.Controls
if (this._edgesDragEnabled != null) DragBehaviour.SetIsDragEnabled(item, this._edgesDragEnabled.Value);
if (_svEdgeDashStyle != null) item.DashStyle = _svEdgeDashStyle.Value;
if (_svShowEdgeArrows != null) item.SetCurrentValue(EdgeControlBase.ShowArrowsProperty, _svShowEdgeArrows.Value);
if (_svShowEdgeLabels != null) item.ShowLabel = _svShowEdgeLabels.Value;
if (_svAlignEdgeLabels != null) item.AlignLabelsToEdges = _svAlignEdgeLabels.Value;
//if (_svShowEdgeLabels != null) item.ShowLabel = _svShowEdgeLabels.Value;
//if (_svAlignEdgeLabels != null) item.AlignLabelsToEdges = _svAlignEdgeLabels.Value;
if (_svUpdateLabelPosition != null) item.UpdateLabelPosition = _svUpdateLabelPosition.Value;
if (_svEdgeHlEnabled != null) HighlightBehaviour.SetIsHighlightEnabled(item, _svEdgeHlEnabled.Value);
if (_svEdgeHlObjectType != null) HighlightBehaviour.SetHighlightControl(item, _svEdgeHlObjectType.Value);
@ -1371,16 +1376,16 @@ namespace GraphX.Controls
item.SetCurrentValue(EdgeControlBase.ShowArrowsProperty, isEnabled);
}
private bool? _svShowEdgeLabels;
//private bool? _svShowEdgeLabels;
/// <summary>
/// Show or hide all edges labels
/// </summary>
/// <param name="isEnabled">Boolean value</param>
public void ShowAllEdgesLabels(bool isEnabled = true)
{
_svShowEdgeLabels = isEnabled;
//_svShowEdgeLabels = isEnabled;
foreach (var item in _edgeslist.Values)
item.SetCurrentValue(EdgeControlBase.ShowLabelProperty, isEnabled);
item.EdgeLabelControls.Cast<FrameworkElement>().ForEach(l=> l.SetCurrentValue(EdgeLabelControl.ShowLabelProperty, isEnabled));
#if WPF
InvalidateVisual();
#endif
@ -1401,18 +1406,16 @@ namespace GraphX.Controls
#endif
}
private bool? _svAlignEdgeLabels;
//private bool? _svAlignEdgeLabels;
/// <summary>
/// Aligns all labels with edges or displays them horizontaly
/// </summary>
/// <param name="isEnabled">Boolean value</param>
public void AlignAllEdgesLabels(bool isEnabled = true)
{
_svAlignEdgeLabels = isEnabled;
//_svAlignEdgeLabels = isEnabled;
foreach (var item in _edgeslist.Values)
{
item.AlignLabelsToEdges = isEnabled;
}
item.EdgeLabelControls.ForEach(l=> l.AlignToEdge = isEnabled);
#if WPF
InvalidateVisual();
#endif
@ -1541,11 +1544,9 @@ namespace GraphX.Controls
if (item.Source == null || item.Target == null) continue;
if (!_vertexlist.ContainsKey(item.Source) || !_vertexlist.ContainsKey(item.Target)) continue;
var edgectrl = ControlFactory.CreateEdgeControl(_vertexlist[item.Source], _vertexlist[item.Target],
item, _svShowEdgeLabels ?? false, _svShowEdgeArrows ?? true, defaultVisibility);
item, _svShowEdgeArrows ?? true, defaultVisibility);
InternalInsertEdge(item, edgectrl);
//setup path
if (_svShowEdgeLabels == true)
edgectrl.SetCurrentValue(EdgeControlBase.ShowLabelProperty, true);
}
if (LogicCore.EnableParallelEdges)
@ -1659,7 +1660,7 @@ namespace GraphX.Controls
foreach (var item in inlist)
{
if (gotSelfLoop) continue;
var ctrl = ControlFactory.CreateEdgeControl(_vertexlist[item.Source], vc, item, _svShowEdgeLabels ?? false, _svShowEdgeArrows ?? true,
var ctrl = ControlFactory.CreateEdgeControl(_vertexlist[item.Source], vc, item, _svShowEdgeArrows ?? true,
defaultVisibility);
InsertEdge(item, ctrl);
ctrl.PrepareEdgePath();
@ -1669,7 +1670,7 @@ namespace GraphX.Controls
foreach (var item in outlist)
{
if (gotSelfLoop) continue;
var ctrl = ControlFactory.CreateEdgeControl(vc, _vertexlist[item.Target], item, _svShowEdgeLabels ?? false, _svShowEdgeArrows ?? true,
var ctrl = ControlFactory.CreateEdgeControl(vc, _vertexlist[item.Target], item, _svShowEdgeArrows ?? true,
defaultVisibility);
InsertEdge(item, ctrl);
ctrl.PrepareEdgePath();
@ -1866,7 +1867,7 @@ namespace GraphX.Controls
foreach (var item in EdgesList)
{
// item.Key.RoutingPoints = new Point[] { new Point(0, 123), new Point(12, 12), new Point(10, 234.5) };
dlist.Add(new GraphSerializationData { Position = new Measure.Point(), Data = item.Key, IsVisible = item.Value.Visibility == Visibility.Visible, HasLabel = item.Value.EdgeLabelControl != null });
dlist.Add(new GraphSerializationData { Position = new Measure.Point(), Data = item.Key, IsVisible = item.Value.Visibility == Visibility.Visible, HasLabel = item.Value.EdgeLabelControls.Count > 0 });
if (item.Key.ID == -1) throw new GX_InvalidDataException("ExtractSerializationData() -> All edge datas must have positive unique ID!");
}
return dlist;
@ -1916,7 +1917,7 @@ namespace GraphX.Controls
if (datasource == null || datatarget == null)
throw new GX_SerializationException("DeserializeFromFile() -> Serialization logic is broken! Vertex not found. All vertices must be processed before edges!");
var ecc = ControlFactory.CreateEdgeControl(_vertexlist[datasource], _vertexlist[datatarget], edgedata, false, true, item.IsVisible ? Visibility.Visible : Visibility.Collapsed);
var ecc = ControlFactory.CreateEdgeControl(_vertexlist[datasource], _vertexlist[datatarget], edgedata, true, item.IsVisible ? Visibility.Visible : Visibility.Collapsed);
InsertEdge(edgedata, ecc);
LogicCore.Graph.AddEdge(edgedata);
if (item.HasLabel)
@ -2214,9 +2215,19 @@ namespace GraphX.Controls
UIElement element = null;
if (vResult?.VertexLabelControl != null)
element = (UIElement)vResult.VertexLabelControl;
if (eResult?.EdgeLabelControl != null)
element = (UIElement)eResult.EdgeLabelControl;
if (element != null && Children.Contains(element))
if (eResult?.EdgeLabelControls.Count > 0)
{
eResult.EdgeLabelControls.ForEach(l =>
{
if (Children.Contains((UIElement)l))
{
Children.Remove((UIElement)l);
if (toFront) Children.Add((UIElement)l);
else Children.Insert(0, (UIElement)l);
}
});
}
else if (element != null && Children.Contains(element))
{
Children.Remove(element);
if (toFront) Children.Add(element);

Просмотреть файл

@ -9,6 +9,22 @@ namespace GraphX.Controls
{
public interface IEdgeLabelControl: IDisposable
{
/// <summary>
/// Gets or sets if label should be aligned with the edge
/// </summary>
bool AlignToEdge { get; set; }
/// <summary>
/// Gets or sets if label is visible
/// </summary>
bool ShowLabel { get; set; }
/// <summary>
/// Gets or sets label vertical offset
/// </summary>
double LabelVerticalOffset { get; set; }
/// <summary>
/// Gets or sets label horizontal offset
/// </summary>
double LabelHorizontalOffset { get; set; }
/// <summary>
/// Gets or sets label drawing angle in degrees
/// </summary>

Просмотреть файл

@ -1,4 +1,5 @@
using System.Windows;
using System.Collections.Generic;
using System.Windows;
#if METRO
using Windows.UI.Xaml;
#endif
@ -16,12 +17,12 @@ namespace GraphX.Controls.Models
/// Returns newly generated label for parent control. Attachable labels will be auto attached if derived from IAttachableControl<TCtrl>
/// </summary>
/// <param name="control">Parent control</param>
public virtual TLabel CreateLabel<TCtrl>(TCtrl control)
public virtual IEnumerable<TLabel> CreateLabel<TCtrl>(TCtrl control)
{
var label = new TLabel();
var aLabel = label as IAttachableControl<TCtrl>;
aLabel?.Attach(control);
return label;
return new List<TLabel> {label};
}
}

Просмотреть файл

@ -16,9 +16,9 @@ namespace GraphX.Controls.Models
FactoryRootArea = graphArea;
}
public virtual EdgeControl CreateEdgeControl(VertexControl source, VertexControl target, object edge, bool showLabels = false, bool showArrows = true, Visibility visibility = Visibility.Visible)
public virtual EdgeControl CreateEdgeControl(VertexControl source, VertexControl target, object edge, bool showArrows = true, Visibility visibility = Visibility.Visible)
{
var edgectrl = new EdgeControl(source, target, edge, showLabels, showArrows) { RootArea = FactoryRootArea};
var edgectrl = new EdgeControl(source, target, edge, showArrows) { RootArea = FactoryRootArea};
edgectrl.SetCurrentValue(UIElement.VisibilityProperty, visibility);
return edgectrl;

Просмотреть файл

@ -8,7 +8,7 @@ namespace GraphX.Controls.Models
{
public interface IGraphControlFactory
{
EdgeControl CreateEdgeControl(VertexControl source, VertexControl target, object edge, bool showLabels = false, bool showArrows = true, Visibility visibility = Visibility.Visible);
EdgeControl CreateEdgeControl(VertexControl source, VertexControl target, object edge, bool showArrows = true, Visibility visibility = Visibility.Visible);
VertexControl CreateVertexControl(object vertexData);
/// <summary>
/// Root graph area for the factory

Просмотреть файл

@ -1,4 +1,5 @@
using System.Windows;
using System.Collections.Generic;
using System.Windows;
#if METRO
using Windows.UI.Xaml;
#endif
@ -15,6 +16,6 @@ namespace GraphX.Controls.Models
/// Returns newly generated label for parent control. Attachable labels will be auto attached if derived from IAttachableControl<T>
/// </summary>
/// <param name="control">Parent control</param>
TResult CreateLabel<TCtrl>(TCtrl control);
IEnumerable<TResult> CreateLabel<TCtrl>(TCtrl control);
}
}

Просмотреть файл

@ -503,7 +503,6 @@
Height="10"/>
</graphx:DefaultEdgePointer>
<graphx:EdgeLabelControl x:Name="PART_edgeLabel" Content="{Binding Edge, RelativeSource={RelativeSource TemplatedParent}}" />
<Path x:Name="PART_SelfLoopedEdge"
Width="10"
Height="10"
@ -517,9 +516,8 @@
<!-- AVAILABLE CUSTOM PROPERTIES -->
<!--
<Setter Property="LabelVerticalOffset" Value="30"/>
<Setter Property="DashStyle" Value="Solid"/>
<Setter Property="ShowLabel" Value="True"/> -->
-->
<Setter Property="Foreground"
Value="Black" />
@ -529,23 +527,10 @@
<!-- ENDREGION -->
<!-- REGION EDGE LABLE CONTROL -->
<Style TargetType="{x:Type graphx:EdgeLabelControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type graphx:EdgeLabelControl}">
<Grid>
<Border BorderBrush="Black" BorderThickness="1" Background="White" CornerRadius="8">
<ContentPresenter Margin="3"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="DisplayForSelfLoopedEdges" Value="False"/>
</Style>
<Style TargetType="{x:Type graphx:AttachableEdgeLabelControl}">
<Setter Property="ShowLabel" Value="True"/>
<Setter Property="LabelVerticalOffset" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type graphx:AttachableEdgeLabelControl}">

Просмотреть файл

@ -106,6 +106,9 @@
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Documents\AIV.cs">
<Link>Properties\AIV.cs</Link>
</Compile>
<Compile Include="..\GraphX.Controls\Animations\DeleteFadeAnimation.cs">
<Link>Animations\DeleteFadeAnimation.cs</Link>
</Compile>

Просмотреть файл

@ -1,29 +1,5 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GraphX.UAP.Controls")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GraphX.UAP.Controls")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

Просмотреть файл

@ -163,7 +163,6 @@
<ctrls:DefaultEdgePointer NeedRotation="true" x:Name="PART_EdgePointerForTarget" >
<Path Data="M0,0.5 L1,1 1,0" Fill="Black" Stretch="Uniform" Width="10" Height="10"/>
</ctrls:DefaultEdgePointer>
<ctrls:EdgeLabelControl x:Name="PART_edgeLabel" Content="{Binding Edge.Text, RelativeSource={RelativeSource TemplatedParent}}" />
<Path x:Name="PART_SelfLoopedEdge"
Width="10"
Height="10"
@ -175,7 +174,6 @@
</Setter.Value>
</Setter>
<Setter Property="LabelVerticalOffset" Value="0"/>
<Setter Property="MinWidth"
Value="1" />
<Setter Property="MinHeight"
@ -189,23 +187,9 @@
</Style>
<!-- ENDREGION -->
<!-- REGION EDGE LABEL CONTROL -->
<Style TargetType="ctrls:EdgeLabelControl">
<Setter Property="DisplayForSelfLoopedEdges" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrls:EdgeLabelControl">
<Grid>
<Border BorderBrush="Black" BorderThickness="1" Background="LightCoral" CornerRadius="8">
<ContentPresenter Margin="3"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ctrls:AttachableEdgeLabelControl">
<Setter Property="ShowLabel" Value="True"/>
<Setter Property="LabelVerticalOffset" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrls:AttachableEdgeLabelControl">

Просмотреть файл

@ -13,6 +13,8 @@ GraphX for .NET is an advanced open-source graph layout and visualization librar
**Any Requirements?**
Due to C#6.0 compliance GraphX requires **Visual Studio 2015 Comunity Edition** or above.
For UAP development Visual Studio 2017 Community Edition is required.
**QuickGraphPCL** nuget project is required for GraphX to operate. Also it is worth noting that it uses partial code from:
* Graph#
* WPFExtensions
@ -29,9 +31,8 @@ And library showcase uses:
We're aim to support as much platforms as possible and we already made our logic core with algorithms to support wide range of platforms.
Our library supports following platforms:
* Windows Desktop (WPF & WinForms on Windows XP SP3 using .NET4.0)
* Universal Windows Platform (UWP) using .NET 4.5
* Windows Metro 8.1 using .NET 4.5
* Windows Desktop (WPF & WinForms on Windows XP SP3 using .NET4.0+)
* Universal Windows Platform (UWP or UAP) using .NET 4.5
* Microsoft Silverlight 5 (WIP, only logic core is available)
* Windows Phone 8/10 (WIP, only logic core is available)
* Xamarin (WIP, only logic core is available)