Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
0
        public SimulationVisualWaypoint3D(IWaypointInfo waypoint, DetailLevel detailLevel)
            : base(waypoint)
        {
            _waypoint = waypoint;
            var visual = new SphereVisual3D
            {
                Fill   = VisualizationConstants.BrushWaypointVisual,
                Center = new Point3D(waypoint.GetInfoCenterX(), waypoint.GetInfoCenterY(), waypoint.GetInfoCurrentTier().GetInfoZ() + WAYPOINT_LIFT),
                Radius = waypoint.GetInfoLength() / 2.0
            };

            Children.Add(visual);
            // Add connections to other ones (if detailed drawing mode)
            //foreach (var otherWP in waypoint.GetInfoConnectedWaypoints())
            //{
            //    // TODO draw connection to other wp
            //}
        }
Ejemplo n.º 3
0
        public SimulationVisualElevatorEntrance3D(IWaypointInfo elevator, DetailLevel detailLevel)
            : base(elevator)
        {
            _elevator = elevator;
            var visual = new BoxVisual3D
            {
                Fill   = VisualizationConstants.BrushElevatorEntranceVisual,
                Center = new Point3D(
                    _elevator.GetInfoCurrentTier().GetInfoTLX() + _elevator.GetInfoCenterX(),
                    _elevator.GetInfoCurrentTier().GetInfoTLY() + _elevator.GetInfoCenterY(),
                    _elevator.GetInfoCurrentTier().GetInfoZ() + ELEVATOR_HEIGHT / 2.0
                    ),
                Length = _elevator.GetInfoLength() * SIZE_FACTOR,
                Width  = _elevator.GetInfoWidth() * SIZE_FACTOR,
                Height = ELEVATOR_HEIGHT
            };

            Children.Add(visual);
        }
Ejemplo n.º 4
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;
        }