Пример #1
0
 public SimulationVisualPod2D(
     IPodInfo pod,
     DetailLevel detailLevel,
     Transformation2D transformer,
     double strokeThickness,
     Func <bool> heatModeEnabled,
     MouseButtonEventHandler elementClickAction,
     SimulationAnimation2D controller)
     : base(pod, detailLevel, transformer, strokeThickness, elementClickAction, controller)
 {
     _pod             = pod;
     _heatModeEnabled = heatModeEnabled;
     // Build geometry
     _geometry =
         new RectangleGeometry(
             new Rect(
                 new Point(-_transformer.ProjectXLength(_pod.GetInfoRadius()), -_transformer.ProjectYLength(_pod.GetInfoRadius())),
                 new Size(_transformer.ProjectXLength(_pod.GetInfoRadius() * 2), _transformer.ProjectYLength(_pod.GetInfoRadius() * 2))));
     // Paint it
     Fill            = VisualizationConstants.BrushPodVisual;
     Cursor          = System.Windows.Input.Cursors.Hand;
     MouseDown      += _elementClickAction;
     Stroke          = VisualizationConstants.BrushOutline;
     StrokeThickness = StrokeThicknessReference;
     // Initialize
     Init();
 }
Пример #2
0
        public SimulationVisualWaypoint2D(
            IWaypointInfo waypoint,
            DetailLevel detailLevel,
            Transformation2D transformer,
            double strokeThickness,
            MouseButtonEventHandler elementClickAction,
            SimulationAnimation2D controller)
            : base(waypoint, detailLevel, transformer, strokeThickness, elementClickAction, controller)
        {
            _waypoint = waypoint;
            // Create waypoint dot
            EllipseGeometry ellipse =
                new EllipseGeometry(
                    new Point(_transformer.ProjectX(waypoint.GetInfoCenterX()), _transformer.ProjectY(waypoint.GetInfoCenterY())),
                    _transformer.ProjectXLength(waypoint.GetInfoLength() / 2.0), _transformer.ProjectYLength(waypoint.GetInfoLength() / 2.0));

            _geometry.Children.Add(ellipse);
            // Add connections
            foreach (var otherWP in waypoint.GetInfoConnectedWaypoints())
            {
                Point  start  = new Point(_transformer.ProjectX(waypoint.GetInfoCenterX()), _transformer.ProjectY(waypoint.GetInfoCenterY()));
                Point  end    = new Point(_transformer.ProjectX(otherWP.GetInfoCenterX()), _transformer.ProjectY(otherWP.GetInfoCenterY()));
                double length = ArrowLineGeometryGenerator.GetDistanceBetweenPoints(start, end);
                var    geom   = ArrowLineGeometryGenerator.GenerateArrowGeometry(ArrowEnds.End, start, end, 45, 0.2 * length);
                _geometry.Children.Add(geom);
            }
            // Paint it
            Fill            = VisualizationConstants.BrushWaypointVisual;
            Cursor          = System.Windows.Input.Cursors.Hand;
            MouseDown      += _elementClickAction;
            Stroke          = VisualizationConstants.BrushOutline;
            StrokeThickness = StrokeThicknessReference;
        }
Пример #3
0
        public SimulationVisualBot2D(
            IBotInfo bot,
            DetailLevel detailLevel,
            Transformation2D transformer,
            double strokeThickness,
            MouseButtonEventHandler elementClickAction,
            SimulationAnimation2D controller)
            : base(bot, detailLevel, transformer, strokeThickness, elementClickAction, controller)
        {
            _bot = bot;
            // Build geometry
            _geometry.Children.Add(new EllipseGeometry(
                                       new Point(0, 0),
                                       _transformer.ProjectXLength(_bot.GetInfoRadius()), _transformer.ProjectYLength(_bot.GetInfoRadius())));
            // Add orientation marker
            double orientationMarkerX = _transformer.ProjectXLength(_bot.GetInfoRadius()) * Math.Cos(0);
            double orientationMarkerY = _transformer.ProjectXLength(_bot.GetInfoRadius()) * Math.Sin(0);

            _geometry.Children.Add(new LineGeometry(
                                       new Point(0, 0),
                                       new Point(orientationMarkerX, orientationMarkerY)));
            // Paint it
            Fill            = VisualizationConstants.BrushBotVisual;
            Cursor          = System.Windows.Input.Cursors.Hand;
            MouseDown      += _elementClickAction;
            Stroke          = VisualizationConstants.BrushOutline;
            StrokeThickness = StrokeThicknessReference;
            // Initialize
            Init();
        }
Пример #4
0
 public SimulationVisual2D(DetailLevel detailLevel, Transformation2D transformer, double strokeThickness, MouseButtonEventHandler elementClickAction, SimulationAnimation2D controller)
 {
     _detailLevel             = detailLevel;
     _transformer             = transformer;
     StrokeThicknessReference = strokeThickness;
     _elementClickAction      = elementClickAction;
     _animationController     = controller;
 }
Пример #5
0
 public SimulationVisualMovable2D(
     IMovableObjectInfo moveableObject,
     DetailLevel detailLevel,
     Transformation2D transformer,
     double strokeThickness,
     MouseButtonEventHandler elementClickAction,
     SimulationAnimation2D controller)
     : base(detailLevel, transformer, strokeThickness, elementClickAction, controller)
 {
     _moveableObject = moveableObject;
 }
Пример #6
0
 public SimulationVisualPathMarker2D(
     IBotInfo bot,
     DetailLevel detailLevel,
     Transformation2D transformer,
     double strokeThickness,
     MouseButtonEventHandler elementClickAction,
     SimulationAnimation2D controller)
     : base(detailLevel, transformer, strokeThickness, elementClickAction, controller)
 {
     _bot = bot;
     // Init geometry
     Stroke          = VisualizationConstants.BrushGoalMarker;
     StrokeThickness = StrokeThicknessReference * VisualizationConstants.PATH_MARKER_STROKE_THICKNESS_FACTOR;
 }
Пример #7
0
 public SimulationVisualDestinationMarker2D(
     IBotInfo bot,
     DetailLevel detailLevel,
     Transformation2D transformer,
     double strokeThickness,
     MouseButtonEventHandler elementClickAction,
     SimulationAnimation2D controller)
     : base(detailLevel, transformer, strokeThickness, elementClickAction, controller)
 {
     _bot = bot;
     // Init geometry
     _geometry       = new LineGeometry(new Point(0, 0), new Point(0, 0));
     Stroke          = VisualizationConstants.BrushDestinationMarker;
     StrokeThickness = StrokeThicknessReference * VisualizationConstants.DESTINATION_MARKER_STROKE_THICKNESS_FACTOR;
 }
Пример #8
0
 public SimulationVisualGuard2D(
     IGuardInfo guard,
     DetailLevel detailLevel,
     Transformation2D transformer,
     double strokeThickness,
     MouseButtonEventHandler elementClickAction,
     SimulationAnimation2D controller)
     : base(detailLevel, transformer, strokeThickness, elementClickAction, controller)
 {
     _guard = guard;
     // Create waypoint dot
     _geometry =
         new EllipseGeometry(
             new Point(_transformer.ProjectX(guard.GetInfoCenterX()), _transformer.ProjectY(guard.GetInfoCenterY())),
             _transformer.ProjectXLength(guard.GetInfoLength() / 2.0), _transformer.ProjectYLength(guard.GetInfoLength() / 2.0));
     // Paint it
     Fill            = _guard.GetInfoIsBarrier() ? VisualizationConstants.BrushSemaphoreEntry : VisualizationConstants.BrushSemaphoreGuard;
     Cursor          = System.Windows.Input.Cursors.Hand;
     MouseDown      += _elementClickAction;
     Stroke          = VisualizationConstants.BrushOutline;
     StrokeThickness = StrokeThicknessReference;
 }
Пример #9
0
 public SimulationVisualizer(
     Instance instance,
     SimulationAnimation2D animationControl2D,
     SimulationAnimation3D animationControl3D,
     SimulationInfoManager infoControl,
     Func <bool> getDrawMode3D,
     Action <double> setUpdateRate,
     double updateRate,
     Action <double> updateTime,
     Action <string> logger,
     Action finishCallback)
 {
     _animationControl2D = animationControl2D;
     _animationControl3D = animationControl3D;
     _infoControl        = infoControl;
     _getDrawMode3D      = getDrawMode3D;
     _simulationWorld    = instance;
     _setUpdateRate      = setUpdateRate;
     _updateRate         = updateRate;
     _updateTime         = updateTime;
     _logger             = logger;
     _finishCallback     = finishCallback;
 }
Пример #10
0
 public SimulationVisualOutputStation2D(
     IOutputStationInfo oStation,
     DetailLevel detailLevel,
     Transformation2D transformer,
     double strokeThickness,
     MouseButtonEventHandler elementClickAction,
     SimulationAnimation2D controller)
     : base(oStation, detailLevel, transformer, strokeThickness, elementClickAction, controller)
 {
     _oStation = oStation;
     // Build geometry
     _geometry =
         new RectangleGeometry(
             new Rect(
                 new Point(_transformer.ProjectX(_oStation.GetInfoTLX()), _transformer.ProjectY(_oStation.GetInfoTLY())),
                 new Size(_transformer.ProjectXLength(_oStation.GetInfoLength()), _transformer.ProjectYLength(_oStation.GetInfoWidth()))));
     // Paint it
     Fill            = VisualizationConstants.BrushOutputStationVisual;
     Cursor          = System.Windows.Input.Cursors.Hand;
     MouseDown      += _elementClickAction;
     Stroke          = VisualizationConstants.BrushOutline;
     StrokeThickness = StrokeThicknessReference;
 }
Пример #11
0
        public SimulationVisualElevatorEntrance2D(
            IWaypointInfo waypoint,
            DetailLevel detailLevel,
            Transformation2D transformer,
            double strokeThickness,
            MouseButtonEventHandler elementClickAction,
            SimulationAnimation2D controller)
            : base(waypoint, detailLevel, transformer, strokeThickness, elementClickAction, controller)
        {
            _waypoint = waypoint;
            // Create waypoint dot
            EllipseGeometry ellipse =
                new EllipseGeometry(
                    new Point(_transformer.ProjectX(waypoint.GetInfoCenterX()), _transformer.ProjectY(waypoint.GetInfoCenterY())),
                    _transformer.ProjectXLength(waypoint.GetInfoLength() / 2.0 * SIZE_FACTOR), _transformer.ProjectYLength(waypoint.GetInfoLength() / 2.0 * SIZE_FACTOR));

            _geometry.Children.Add(ellipse);
            // Paint it
            Fill            = VisualizationConstants.BrushElevatorEntranceVisual;
            Cursor          = System.Windows.Input.Cursors.Hand;
            MouseDown      += _elementClickAction;
            Stroke          = VisualizationConstants.BrushOutline;
            StrokeThickness = StrokeThicknessReference;
        }