Esempio n. 1
0
        public Drawer(Viewport viewport)
        {
            viewport.Load += viewport_Load;

            LineSmoothing = true;
            AlphaBlending = true;
        }
Esempio n. 2
0
        public Layouter(Viewport viewport, Axis axisX, Axis axisY)
        {
            this.viewport = viewport;
            this.axisX = axisX;
            this.axisY = axisY;

            baseMargin = new Padding(9, 8, 0, 9);
        }
Esempio n. 3
0
        public Dragger(Viewport viewport)
        {
            Button = MouseButtons.Left;

            viewport.MouseDown += viewport_MouseDown;
            viewport.MouseUp += viewport_MouseUp;
            viewport.MouseMove += viewport_MouseMove;
        }
Esempio n. 4
0
        public CoordinateLabel(ToolStripStatusLabel label, Viewport viewport, Diagram diagram)
        {
            this.label = label;
            this.viewport = viewport;
            this.diagram = diagram;

            this.viewport.MouseEnter += viewport_MouseEnter;
            this.viewport.MouseLeave += viewport_MouseLeave;
            this.viewport.MouseMove += viewport_MouseMove;
        }
Esempio n. 5
0
 public Settings(System.Windows.Forms.PropertyGrid propertyGrid, MainWindow mainWindow, Viewport viewport, Drawer drawer, Timer timer, Diagram diagram, RectangleSelector zoomSelector, RectangleSelector unZoomSelector, Dragger panDragger, VisibleFrameCounter frameCounter)
     : base("Settings")
 {
     this.mainWindow = mainWindow;
     this.viewport = new ViewportSettings("ViewportSettings", viewport);
     this.drawer = new DrawerSettings("DrawerSettings", drawer);
     this.diagram = new DiagramSettings("DiagramSettings", propertyGrid, timer, diagram);
     this.zoomSelector = new RectangleSelectorSettings("ZoomSelectorSettings", zoomSelector);
     this.unZoomSelector = new RectangleSelectorSettings("UnZoomSelectorSettings", unZoomSelector);
     this.panDragger = new DraggerSettings("PanDraggerSettings", panDragger);
     this.frameCounter = new FrameCounterSettings("FrameCounterSettings", frameCounter);
 }
Esempio n. 6
0
        public RectangleSelector(Drawer drawer, Viewport viewport)
        {
            this.drawer = drawer;

            IsDrawn = true;
            Button = MouseButtons.Left;
            Color = Color.White;
            Width = 1;

            viewport.MouseDown += viewport_MouseDown;
            viewport.MouseUp += viewport_MouseUp;
            viewport.MouseMove += viewport_MouseMove;
        }
Esempio n. 7
0
        public void InitializeDevice()
        {
            mForm = new Form { Width = mWidth, Height = mHeight };
            mForm.Closing += (sender, args) => IsClosing = true;

            using (var factory = new Factory())
            {
                Device = new Device(factory.GetAdapter(0), DriverType.Hardware, DeviceCreationFlags.None);

                mSwapChain = CreateSwapChain(factory);
            }

            using (var texture = Resource.FromSwapChain<Texture2D>(mSwapChain, 0))
            {
                mRenderTarget = new RenderTargetView(Device, texture);
            }

            var viewport = new Viewport
            {
                X = 0,
                Y = 0,
                Width = mWidth,
                Height = mHeight,
                MinZ = 0.0f,
                MaxZ = 1.0f
            };

            SetRasterizerState();
            CreateDepthBuffer();
            CreateStencilState();

            Device.Rasterizer.SetViewports(viewport);
            Device.OutputMerger.SetTargets(mDepthStencilView, mRenderTarget);
        }
Esempio n. 8
0
        static Diagram CreateDiagram(Viewport viewport, Drawer drawer, Data.Timer timer, Parameters parameters)
        {
            Diagram diagram = new Diagram();

            diagram.Graphs = new List<Graph>();

            diagram.GraphSettings = new GraphSettings();
            if (parameters.ExtendGraphs != null) diagram.GraphSettings.ExtendGraphs = parameters.ExtendGraphs.Value;
            if (parameters.LineWidth != null) diagram.GraphSettings.LineWidth = parameters.LineWidth.Value;

            switch (parameters.TimeManagerType)
            {
                case TimeManagerType.Continuous:
                    diagram.TimeManager = new ContinuousTimeManager(timer);
                    break;
                case TimeManagerType.Shiftting:
                    diagram.TimeManager = new ShiftingTimeManager(timer);
                    if (parameters.TimeManagerParameter != null) ((ShiftingTimeManager)diagram.TimeManager).ShiftLength = parameters.TimeManagerParameter.Value;
                    break;
                case TimeManagerType.Wrapping:
                    diagram.TimeManager = new WrappingTimeManager(timer);
                    if (parameters.TimeManagerParameter != null) ((WrappingTimeManager)diagram.TimeManager).GapLength = parameters.TimeManagerParameter.Value;
                    break;
                default: throw new InvalidOperationException();
            }
            if (parameters.DiagramWidth != null) diagram.TimeManager.Width = parameters.DiagramWidth.Value;

            switch (parameters.ValueManagerType)
            {
                case ValueManagerType.Fitting:
                    diagram.ValueManager = new FittingValueManager(diagram);
                    break;
                case ValueManagerType.Fixed:
                    diagram.ValueManager = new FixedValueManager();
                    if (parameters.ValueRange != null) ((FixedValueManager)diagram.ValueManager).FixedRange = parameters.ValueRange.Value;
                    break;
                default: throw new InvalidOperationException();
            }

            diagram.DataManager = new PerPixelDataManager(diagram);
            if (parameters.ClearData != null) diagram.DataManager.ClearData = parameters.ClearData.Value;

            diagram.AxisX = new AxisX(drawer, diagram);
            if (parameters.MarkerCountX != null) diagram.AxisX.MarkerCount = parameters.MarkerCountX.Value;
            if (parameters.DiagramColor != null) diagram.AxisX.Color = parameters.DiagramColor.Value;

            diagram.AxisY = new AxisY(drawer, diagram);
            if (parameters.MarkerCountY != null) diagram.AxisY.MarkerCount = parameters.MarkerCountY.Value;
            if (parameters.DiagramColor != null) diagram.AxisY.Color = parameters.DiagramColor.Value;

            diagram.Layouter = new Layouter(viewport, diagram.AxisX, diagram.AxisY);

            return diagram;
        }
Esempio n. 9
0
 public Vector3[] GetCornersFromRectangle(Viewport viewport, System.Drawing.Point topLeft, System.Drawing.Point bottomRight)
 {
     return(GetCornersFromRectangle(viewport, topLeft, bottomRight, ViewProjection));
 }
Esempio n. 10
0
 public Ray Unproject(Vector2 screenPosition, Viewport viewport, Matrix world)
 {
     return(UnprojectWVP(screenPosition, viewport, world * View * Projection));
 }
Esempio n. 11
0
 public Ray Unproject(Vector2 screenPosition, Viewport viewport)
 {
     return(Unproject(screenPosition, viewport, Matrix.Identity));
 }
Esempio n. 12
0
 public Vector3 Project(Vector3 worldPosition, Viewport viewport)
 {
     return(Vector3.Project(worldPosition, viewport.X, viewport.Y, viewport.Width, viewport.Height,
                            viewport.MinZ, viewport.MaxZ, ViewProjection));
 }
Esempio n. 13
0
 public bool MouseXYPlaneIntersect(System.Drawing.Point mouse, Viewport viewport, out Vector3 position)
 {
     return(MouseXYPlaneIntersect(mouse, viewport, 0, out position));
 }
Esempio n. 14
0
 public Vector3[] Frustum2DFromRectangle(Viewport viewport, System.Drawing.Point topLeft, System.Drawing.Point bottomRight)
 {
     Vector3[] corners = GetCornersFromRectangle(viewport, topLeft, bottomRight);
     return(TriangleFromQuad(corners[2], corners[6], corners[3], corners[7]));
 }
Esempio n. 15
0
 public ViewportSettings(string xElementName, Viewport viewport)
     : base(xElementName)
 {
     this.viewport = viewport;
 }