Example #1
0
        public void Reset(Geometry.Box src_box, float viewWidth, float viewHeight, bool fill)
        {
            float w = viewWidth;
            float h = viewHeight;

            dst_orig_w = w;
            dst_orig_h = h;
            dst_x0     = w / 2;
            dst_y0     = h / 2;
            float dst_w = w * viewScale;
            float dst_h = h * viewScale;

            double src_w = src_box.Dim(0);
            double src_h = src_box.Dim(1);

            if (src_w < 0 || src_h < 0)
            {
                throw new System.Exception("Invalid box dimensions.");
            }

            src_x0 = src_box.Min[0] + src_w / 2;
            src_y0 = src_box.Min[1] + src_h / 2;

            // point or 1 value
            if (src_w == 0 && src_h == 0)
            {
                scale_x = dst_w / 2;
                scale_y = dst_h / 2;
            }
            // vertical segment or N 1-value plots
            else if (src_w == 0)
            {
                scale_x = dst_w / 2;
                scale_y = dst_h / src_h;
            }
            // horizontal segment or equal values
            else if (src_h == 0)
            {
                scale_x = dst_w / src_w;
                scale_y = dst_h / 2;
            }
            else
            {
                scale_x = dst_w / src_w;
                scale_y = dst_h / src_h;
                if (!fill)
                {
                    scale_x = scale_y = Math.Min(scale_x, scale_y);
                }
            }
        }
Example #2
0
        public LocalCS(Geometry.Box src_box, Graphics dst_graphics)
        {
            float w = dst_graphics.VisibleClipBounds.Width;
            float h = dst_graphics.VisibleClipBounds.Height;

            dst_x0 = w / 2;
            dst_y0 = h / 2;
            float dst_w = w * 0.9f;
            float dst_h = h * 0.9f;

            double src_w = src_box.Dim(0);
            double src_h = src_box.Dim(1);

            if (src_w < 0 || src_h < 0)
            {
                throw new System.Exception("Invalid box dimensions.");
            }

            src_x0 = src_box.Min[0] + src_w / 2;
            src_y0 = src_box.Min[1] + src_h / 2;

            if (src_w == 0 && src_h == 0)
            {
                scale = 1; // point
            }
            else if (src_w == 0)
            {
                scale = (h * 0.9f) / src_h;
            }
            else if (src_h == 0)
            {
                scale = (w * 0.9f) / src_w;
            }
            else
            {
                double scale_w = (w * 0.9f) / src_w;
                double scale_h = (h * 0.9f) / src_h;
                scale = Math.Min(scale_w, scale_h);
            }
        }
Example #3
0
            public void Draw(Geometry.Box box, Graphics graphics, Settings settings, Geometry.Traits traits)
            {
                // Esstimate the distance between samples, uniform distribution, 2 samples per X
                Geometry.Box originalBox = this.Aabb(traits, false);
                int          count       = Math.Max(points.Count, 1);
                double       diffX       = Math.Abs(originalBox.Dim(0)) / count * 2.0;

                if (settings.pointPlot_enableLines)
                {
                    DrawLines(box, graphics, settings, traits, diffX);
                }

                if (settings.pointPlot_enablePoints)
                {
                    DrawPoints(box, graphics, settings, traits, diffX);
                }
            }