Ejemplo n.º 1
0
 public LinkRender(NodeCollectionStorage <FullConnectedGraph> nodeCollectionStorage, Canvas canvas, LineCreator lineCreator)
 {
     _nodeCollectionStorage = nodeCollectionStorage;
     _canvas = canvas;
     _nodeCollectionStorage.CollectionChanged += NodeCollectionChangerHandler;
     _lineCreator = lineCreator;
 }
 public static NodeRender GetNodeRender(NodeCollectionStorage<FullConnectedGraph> storage, Canvas canvas)
 {
     var nodeEllipseCreator = new EllipseCreator(Brushes.Black, Brushes.DarkGray, 5, 0.7);
     var startNodeEllipseCreator = new EllipseCreator(Brushes.Blue, Brushes.Transparent, 8, 0.9);
     var endNodeEllipseCreator = new EllipseCreator(Brushes.Red, Brushes.Transparent, 8, 0.9);
     return new NodeRender(storage,canvas,nodeEllipseCreator,startNodeEllipseCreator,endNodeEllipseCreator);
 }
 public LinkRender(NodeCollectionStorage<FullConnectedGraph> nodeCollectionStorage, Canvas canvas, LineCreator lineCreator)
 {
     _nodeCollectionStorage = nodeCollectionStorage;
     _canvas = canvas;
     _nodeCollectionStorage.CollectionChanged += NodeCollectionChangerHandler;
     _lineCreator = lineCreator;
 }
 public Render(Canvas canvas, NodeCollectionStorage<FullConnectedGraph> nodeCollectionStorage, SolversHolder solversHolder)
 {
     _canvas = canvas;
     _nodeCollectionStorage = nodeCollectionStorage;
     _nodeRender = RenderFactory.GetNodeRender(nodeCollectionStorage, canvas);
     _linkRender = RenderFactory.GetLinkRender(nodeCollectionStorage, canvas);
     _routeRender = RenderFactory.GetRouteRender(canvas);
 }
        public static NodeRender GetNodeRender(NodeCollectionStorage <FullConnectedGraph> storage, Canvas canvas)
        {
            var nodeEllipseCreator      = new EllipseCreator(Brushes.Black, Brushes.DarkGray, 5, 0.7);
            var startNodeEllipseCreator = new EllipseCreator(Brushes.Blue, Brushes.Transparent, 8, 0.9);
            var endNodeEllipseCreator   = new EllipseCreator(Brushes.Red, Brushes.Transparent, 8, 0.9);

            return(new NodeRender(storage, canvas, nodeEllipseCreator, startNodeEllipseCreator, endNodeEllipseCreator));
        }
 public Render(Canvas canvas, NodeCollectionStorage <FullConnectedGraph> nodeCollectionStorage, SolversHolder solversHolder)
 {
     _canvas = canvas;
     _nodeCollectionStorage = nodeCollectionStorage;
     _nodeRender            = RenderFactory.GetNodeRender(nodeCollectionStorage, canvas);
     _linkRender            = RenderFactory.GetLinkRender(nodeCollectionStorage, canvas);
     _routeRender           = RenderFactory.GetRouteRender(canvas);
 }
        public static ResultRender GetResultRender(Canvas canvas, SolversHolder solversHolder,
                                                   NodeCollectionStorage <FullConnectedGraph> storage)
        {
            var          ellipseCreator   = new EllipseCreator(Brushes.Black, Brushes.SlateGray, 4, 0.5);
            var          polyLinesCreator = new PolylineCreator(Brushes.Blue, 1, 1);
            const double border           = 5;

            return(new ResultRender(canvas, solversHolder, ellipseCreator, polyLinesCreator, border, storage));
        }
 public ResultRender(Canvas canvas, SolversHolder solversHolder, EllipseCreator ellipseCreator,
                     PolylineCreator polylineCreator, double border, NodeCollectionStorage <FullConnectedGraph> storage)
 {
     _canvas                       = canvas;
     _canvas.SizeChanged          += CanvasChangedHanler;
     _ellipseCreator               = ellipseCreator;
     _polylineCreator              = polylineCreator;
     _border                       = border;
     storage.CollectionChanged    += StorageOnChangeHandler;
     storage.PointPropertyChanged += StorageOnChangeHandler;
 }
 public static ResultRender GetResultRender(Canvas canvas, SolversHolder solversHolder, 
     NodeCollectionStorage<FullConnectedGraph> storage)
 {
     var ellipseCreator = new EllipseCreator(Brushes.Black, Brushes.SlateGray, 4, 0.5);
     var minPointEllipseCreator = new EllipseCreator(Brushes.Red, Brushes.Transparent, 6, 0.7);
     var polyLinesCreator = new PolylineCreator(Brushes.Blue, 1, 1);
     var step = 0.005;
     var scalarizator = new WeightedSumScalarizator<Route>(step);
     const double border = 5;
     return new ResultRender(canvas, ellipseCreator, minPointEllipseCreator, polyLinesCreator, border, storage, scalarizator);
 }
 public SolversHolder(NodeCollectionStorage<FullConnectedGraph> storage, GeneticSolverBuilder geneticSolverBuilder, 
     BruteForceSolverBuilder bruteForceSolverBuilder, OptionsWindow optionsWindow)
 {
     _storage = storage;
     _geneticSolverBuilder = geneticSolverBuilder;
     _bruteForceSolverBuilder = bruteForceSolverBuilder;
     _storage.CollectionChanged += StorageChangedHandler;
     optionsWindow.Changed += OptionsChangedHandler;
     InitializeSolvers();
     InitializeFlagDictionarys();
 }
 public ResultsWindow(SolversHolder solversHolder, NodeCollectionStorage <FullConnectedGraph> storage)
 {
     InitializeComponent();
     Loaded += delegate
     {
         var t = ResultsCanvas.Width;
     };
     Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
     Arrange(new Rect(0, 0, Width, Height));
     _render = RenderFactory.GetResultRender(ResultsCanvas, solversHolder, storage);
     //solversHolder.Solved += SolvedHandler;
 }
 public ResultsWindow(SolversHolder solversHolder, NodeCollectionStorage<FullConnectedGraph> storage )
 {
     InitializeComponent();
     Loaded += delegate
     {
         var t = ResultsCanvas.Width;
     };
     Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
     Arrange(new Rect(0, 0, Width, Height));
     _render = RenderFactory.GetResultRender(ResultsCanvas, solversHolder, storage);
     //solversHolder.Solved += SolvedHandler;
 }
 public ResultRender(Canvas canvas, EllipseCreator pointsEllipseCreator,EllipseCreator minPointsEllipseCreator, 
     PolylineCreator polylineCreator, double border, NodeCollectionStorage<FullConnectedGraph> storage, 
     IScalarizator<Route,Route> scalarizator)
 {
     _canvas = canvas;
     _canvas.SizeChanged += CanvasChangedHanler;
     _pointsEllipseCreator = pointsEllipseCreator;
     _polylineCreator = polylineCreator;
     _border = border;
     _scalarizator = scalarizator;
     _minPointsEllipseCreator = minPointsEllipseCreator;
     storage.CollectionChanged += StorageOnChangeHandler;
     storage.PointPropertyChanged += StorageOnChangeHandler;
 }
 public NodeRender(NodeCollectionStorage<FullConnectedGraph> nodeCollectionStorage, Canvas canvas, 
     EllipseCreator nodeEllipseCreator, EllipseCreator startNodeEllipseCreator, EllipseCreator endNodeEllipseCreator)
 {
     _canvas = canvas;
     _nodeEllipseCreator = nodeEllipseCreator;
     _startNodeEllipseCreator = startNodeEllipseCreator;
     _endNodeEllipseCreator = endNodeEllipseCreator;
     _canvas.MouseLeftButtonUp += Canvas_MouseLeftButtonUp;
     _nodeCollectionStorage = nodeCollectionStorage;
     _nodeCollectionStorage.CollectionChanged += NodeCollectionChangeHandler;
     _nodeCollectionStorage.PointPropertyChanged += PointPropertyChangedHandler;
     _nodeEllipseCreator.ContextMenu = NodeContextMenuCreator.NodeContextMenu(StartPointMenuItem_OnClick,
         EndPointMenuItem_OnClick, RemovePointMenuItem_OnClick);
     var startEndContextMenu =
         NodeContextMenuCreator.StartAndEndNodeContextMenu(RemoveStartOrEndPointMenuItem_OnClick);
     _endNodeEllipseCreator.ContextMenu = startEndContextMenu;
     _startNodeEllipseCreator.ContextMenu = startEndContextMenu;
 }
        public NodeRender(NodeCollectionStorage <FullConnectedGraph> nodeCollectionStorage, Canvas canvas,
                          EllipseCreator nodeEllipseCreator, EllipseCreator startNodeEllipseCreator, EllipseCreator endNodeEllipseCreator)
        {
            _canvas                    = canvas;
            _nodeEllipseCreator        = nodeEllipseCreator;
            _startNodeEllipseCreator   = startNodeEllipseCreator;
            _endNodeEllipseCreator     = endNodeEllipseCreator;
            _canvas.MouseLeftButtonUp += Canvas_MouseLeftButtonUp;
            _nodeCollectionStorage     = nodeCollectionStorage;
            _nodeCollectionStorage.CollectionChanged    += NodeCollectionChangeHandler;
            _nodeCollectionStorage.PointPropertyChanged += PointPropertyChangedHandler;
            _nodeEllipseCreator.ContextMenu              = NodeContextMenuCreator.NodeContextMenu(StartPointMenuItem_OnClick,
                                                                                                  EndPointMenuItem_OnClick, RemovePointMenuItem_OnClick);
            var startEndContextMenu =
                NodeContextMenuCreator.StartAndEndNodeContextMenu(RemoveStartOrEndPointMenuItem_OnClick);

            _endNodeEllipseCreator.ContextMenu   = startEndContextMenu;
            _startNodeEllipseCreator.ContextMenu = startEndContextMenu;
        }
        public static LinkRender GetLinkRender(NodeCollectionStorage <FullConnectedGraph> storage, Canvas canvas)
        {
            var lineCreator = new LineCreator(Brushes.DimGray, 1, 0.5);

            return(new LinkRender(storage, canvas, lineCreator));
        }
 public static LinkRender GetLinkRender(NodeCollectionStorage<FullConnectedGraph> storage, Canvas canvas)
 {
     var lineCreator = new LineCreator(Brushes.DimGray,1,0.5);
     return new LinkRender(storage,canvas,lineCreator);
 }