Пример #1
0
        private static List <GridlineScreen> MakeGridX(NuGenScreenTranslate transform, CoordSettings coordSettings, GridMeshSettings gridMeshSettings)
        {
            int                   i;
            int                   xStartS, yStartS, xStopS, yStopS;
            double                xG = gridMeshSettings.startX;
            GridlineScreen        gridline;
            List <GridlineScreen> gridlines = new List <GridlineScreen>();

            for (i = 0; i < gridMeshSettings.countX; i++)
            {
                gridline = new GridlineScreen();
                transform.XThetaYRToScreen(coordSettings, xG, gridMeshSettings.startY, out xStartS, out yStartS);
                transform.XThetaYRToScreen(coordSettings, xG, gridMeshSettings.stopY, out xStopS, out yStopS);

                gridline.Start.X = xStartS;
                gridline.Start.Y = yStartS;
                gridline.Stop.X  = xStopS;
                gridline.Stop.Y  = yStopS;
                gridline.R       = false;

                gridlines.Add(gridline);

                if (coordSettings.xThetaScale == Scale.Linear)
                {
                    xG += gridMeshSettings.stepX;
                }
                else
                {
                    xG *= gridMeshSettings.stepX;
                }
            }

            return(gridlines);
        }
Пример #2
0
        private static List <GridlineScreen> MakeGridR(NuGenScreenTranslate transform, CoordSettings coordSettings, GridMeshSettings gridMeshSettings)
        {
            int                   i;
            int                   xStartS = 0, yStartS = 0, xStopS = 1, yStopS = 1;
            double                rG = gridMeshSettings.startY;
            GridlineScreen        gridline;
            List <GridlineScreen> gridlines = new List <GridlineScreen>();

            for (i = 0; i < gridMeshSettings.countY; i++)
            {
                gridline = new GridlineScreen();
                // for polar coordinates we simply piecewise define the elliptical arc until motivated
                // to implement a better drawing algorithm. segments will be evenly spaced in angle
                // some pdf documents describing alternative algorithms are found in the doc directory.
                // it would have been elegant to use QCanvasEllipses but those are axis-aligned.
                double delta = AngleSpacing(coordSettings.thetaUnits);
                bool   first = true;
                for (double angle = gridMeshSettings.startX; angle < gridMeshSettings.stopX; angle += delta)
                {
                    transform.XThetaYRToScreen(coordSettings, angle, rG, out xStopS, out yStopS);

                    if (first)
                    {
                        xStartS = xStopS;
                        yStartS = yStopS;
                    }
                    else
                    {
                        if (NuGenMath.VectorMagnitude(xStopS - xStartS, yStopS - yStartS, 0.0) >= pixelSpacing)
                        {
                            gridline.Start.X = xStartS;
                            gridline.Start.Y = yStartS;
                            gridline.Stop.X  = xStopS;
                            gridline.Stop.Y  = yStopS;
                            gridline.R       = true;

                            xStartS = xStopS;
                            yStartS = yStopS;
                        }
                    }

                    first = false;
                }

                if (coordSettings.yRScale == Scale.Linear)
                {
                    rG += gridMeshSettings.stepY;
                }
                else
                {
                    rG *= gridMeshSettings.stepY;
                }
            }

            return(gridlines);
        }
Пример #3
0
        private static List<GridlineScreen> MakeGridR(NuGenScreenTranslate transform, CoordSettings coordSettings, GridMeshSettings gridMeshSettings)
        {
            int i;
            int xStartS = 0, yStartS = 0, xStopS = 1, yStopS = 1;
            double rG = gridMeshSettings.startY;
            GridlineScreen gridline;
            List<GridlineScreen> gridlines = new List<GridlineScreen>();
            for (i = 0; i < gridMeshSettings.countY; i++)
            {
                gridline = new GridlineScreen();
                // for polar coordinates we simply piecewise define the elliptical arc until motivated
                // to implement a better drawing algorithm. segments will be evenly spaced in angle
                // some pdf documents describing alternative algorithms are found in the doc directory.
                // it would have been elegant to use QCanvasEllipses but those are axis-aligned.
                double delta = AngleSpacing(coordSettings.thetaUnits);
                bool first = true;
                for (double angle = gridMeshSettings.startX; angle < gridMeshSettings.stopX; angle += delta)
                {
                    transform.XThetaYRToScreen(coordSettings, angle, rG, out xStopS, out yStopS);

                    if (first)
                    {
                        xStartS = xStopS;
                        yStartS = yStopS;
                    }
                    else
                    {
                        if (NuGenMath.VectorMagnitude(xStopS - xStartS, yStopS - yStartS, 0.0) >= pixelSpacing)
                        {
                            gridline.Start.X = xStartS;
                            gridline.Start.Y = yStartS;
                            gridline.Stop.X = xStopS;
                            gridline.Stop.Y = yStopS;
                            gridline.R = true;

                            xStartS = xStopS;
                            yStartS = yStopS;
                        }
                    }

                    first = false;
                }

                if (coordSettings.yRScale == Scale.Linear)
                    rG += gridMeshSettings.stepY;
                else
                    rG *= gridMeshSettings.stepY;
            }

            return gridlines;
        }
Пример #4
0
        private static List<GridlineScreen> MakeGridX(NuGenScreenTranslate transform, CoordSettings coordSettings, GridMeshSettings gridMeshSettings)
        {
            int i;
            int xStartS, yStartS, xStopS, yStopS;
            double xG = gridMeshSettings.startX;
            GridlineScreen gridline;
            List<GridlineScreen> gridlines = new List<GridlineScreen>();
            for (i = 0; i < gridMeshSettings.countX; i++)
            {
                gridline = new GridlineScreen();
                transform.XThetaYRToScreen(coordSettings, xG, gridMeshSettings.startY, out xStartS, out yStartS);
                transform.XThetaYRToScreen(coordSettings, xG, gridMeshSettings.stopY, out xStopS, out yStopS);

                gridline.Start.X = xStartS;
                gridline.Start.Y = yStartS;
                gridline.Stop.X = xStopS;
                gridline.Stop.Y = yStopS;
                gridline.R = false;

                gridlines.Add(gridline);

                if (coordSettings.xThetaScale == Scale.Linear)
                    xG += gridMeshSettings.stepX;
                else
                    xG *= gridMeshSettings.stepX;
            }

            return gridlines;
        }