Fix for winforms example edge labels

This commit is contained in:
panthernet 2016-04-02 14:17:07 +03:00
Родитель 32384552f2
Коммит 2a4b75620a
3 изменённых файлов: 9 добавлений и 23 удалений

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

@ -3,7 +3,7 @@ DETAILED CHANGELOG:
- Added StateStorage::ImportState() method to allow state import/export logic between several graphs
- Added GraphArea::IsDisposed property that indicated that GraphArea object has been disposed and shouldn't be used anymore
- Added GraphArea::CreateNewStateStorage() protected method to be able to implement custom state storage logic for GraphArea
- Fixed edge label positioningm now it is more accurate for pathed edges
- Fixed edge label positioning, now it is more accurate for pathed edges
- Made StateStorage class extensible by adding virtual modifiers to methods
- Improved algorithm factory logic to avoid graph type cast exceptions in some class declaration cases

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

@ -6,6 +6,7 @@ using GraphX.PCL.Common.Enums;
using GraphX.PCL.Logic.Algorithms.OverlapRemoval;
using GraphX.PCL.Logic.Models;
using GraphX.Controls;
using GraphX.Controls.Models;
using QuickGraph;
namespace WindowsFormsProject
@ -33,7 +34,13 @@ namespace WindowsFormsProject
ZoomControl.SetViewFinderVisibility(_zoomctrl, Visibility.Visible);
/* ENABLES WINFORMS HOSTING MODE --- >*/
var logic = new GXLogicCore<DataVertex, DataEdge, BidirectionalGraph<DataVertex, DataEdge>>();
_gArea = new GraphAreaExample() { EnableWinFormsHostingMode = true, LogicCore = logic };
_gArea = new GraphAreaExample
{
EnableWinFormsHostingMode = true,
LogicCore = logic,
EdgeLabelFactory = new DefaultEdgelabelFactory()
};
_gArea.ShowAllEdgesLabels(true);
logic.Graph = GenerateGraph();
logic.DefaultLayoutAlgorithm = LayoutAlgorithmTypeEnum.LinLog;
logic.DefaultLayoutAlgorithmParams = logic.AlgorithmFactory.CreateLayoutParameters(LayoutAlgorithmTypeEnum.LinLog);

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

@ -56,7 +56,6 @@
<controls:DefaultEdgePointer NeedRotation="true" x:Name="PART_EdgePointerForTarget" >
<Path Data="M0,0.5 L1,1 1,0" Fill="Black" Stretch="Uniform" Width="10" Height="10"/>
</controls:DefaultEdgePointer>
<controls:EdgeLabelControl x:Name="PART_edgeLabel" Content="{Binding Edge, RelativeSource={RelativeSource TemplatedParent}}" />
</Grid>
</ControlTemplate>
</Setter.Value>
@ -84,24 +83,4 @@
</Style.Triggers>
</Style>
<!--EDGE LABLE CONTROL -->
<Style TargetType="{x:Type controls:EdgeLabelControl}">
<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>
</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>
</Style>
</ResourceDictionary>