コード例 #1
0
ファイル: LineGeometries.cs プロジェクト: irriss/IronPlot.net
 public static StreamGeometry StreamGeometryFromCurve(Curve curve, MatrixTransform graphToCanvas)
 {
     double[] tempX;
     double[] tempY;
     if (graphToCanvas != null)
     {
         tempX = curve.xTransformed.MultiplyBy(graphToCanvas.Matrix.M11).SumWith(graphToCanvas.Matrix.OffsetX);
         tempY = curve.yTransformed.MultiplyBy(graphToCanvas.Matrix.M22).SumWith(graphToCanvas.Matrix.OffsetY);
     }
     else
     {
         tempX = curve.xTransformed; tempY = curve.yTransformed;
     }
     StreamGeometry streamGeometry = new StreamGeometry();
     StreamGeometryContext context = streamGeometry.Open();
     int lines = 0;
     for (int i = 0; i < curve.x.Count(); ++i)
     {
         if (i == 0)
         {
             context.BeginFigure(new Point(tempX[i], tempY[i]), false, false);
         }
         else
         {
             if (curve.includeLinePoint[i])
             {
                 context.LineTo(new Point(tempX[i], tempY[i]), true, false);
                 lines++;
             }
         }
     }
     context.Close();
     return streamGeometry;
 }
コード例 #2
0
ファイル: LineGeometries.cs プロジェクト: irriss/IronPlot.net
        public static PathGeometry PathGeometryFromCurve(Curve curve, MatrixTransform graphToCanvas)
        {
            double xScale, xOffset, yScale, yOffset;
            if (graphToCanvas != null)
            {
                xScale = graphToCanvas.Matrix.M11;
                xOffset = graphToCanvas.Matrix.OffsetX;
                yScale = graphToCanvas.Matrix.M22;
                yOffset = graphToCanvas.Matrix.OffsetY;
            }
            else
            {
                xScale = 1; xOffset = 0;
                yScale = 1; yOffset = 0;
            }

            PathGeometry pathGeometry = new PathGeometry();

            if (curve.x.Count() == 0)
                return pathGeometry;

            PathFigure pathFigure = new PathFigure();
            LineSegment lineSegment;
            double xCanvas = curve.xTransformed[0] * xScale + xOffset;
            double yCanvas = curve.yTransformed[0] * yScale + yOffset;
            pathFigure.StartPoint = new Point(xCanvas, yCanvas);
            for (int i = 1; i < curve.x.Count(); ++i)
            {
                if (curve.includeLinePoint[i])
                {
                    lineSegment = new LineSegment();
                    xCanvas = curve.xTransformed[i] * xScale + xOffset;
                    yCanvas = curve.yTransformed[i] * yScale + yOffset;
                    lineSegment.Point = new Point(xCanvas, yCanvas);
                    pathFigure.Segments.Add(lineSegment);
                }
            }
            pathFigure.IsClosed = false;
            pathGeometry.Figures.Add(pathFigure);
            return pathGeometry;
        }
コード例 #3
0
 internal static Geometry MarkersAsGeometry(Curve curve, MatrixTransform graphToCanvas, MarkersType markersType, double markersSize)
 {
     double xScale = graphToCanvas.Matrix.M11;
     double xOffset = graphToCanvas.Matrix.OffsetX;
     double yScale = graphToCanvas.Matrix.M22;
     double yOffset = graphToCanvas.Matrix.OffsetY;
     GeometryGroup markers = new GeometryGroup();
     double width = Math.Abs(markersSize);
     double height = Math.Abs(markersSize);
     Geometry markerGeometry = LegendMarkerGeometry(markersType, markersSize);
     if (markerGeometry == null) return null;
     markerGeometry.Freeze();
     for (int i = 0; i < curve.xTransformed.Length; ++i)
     {
         if (!curve.includeMarker[i]) continue;
         double xCanvas = curve.xTransformed[i] * xScale + xOffset;
         double yCanvas = curve.yTransformed[i] * yScale + yOffset;
         Geometry newMarker = markerGeometry.Clone();
         newMarker.Transform = new TranslateTransform(xCanvas, yCanvas);
         markers.Children.Add(newMarker);
     }
     markers.Freeze();
     return markers;
 }
コード例 #4
0
ファイル: ColourMap.cs プロジェクト: goutkannan/ironlab
 public void HSV()
 {
     colourMapMode = ColourMapMode.HSV;
     interpPoints = new double[] { 0.0, 0.25, 0.5, 0.75, 1.0 };
     hue = new Curve(interpPoints, new double[] { 0.0, 0.25, 0.5, 0.75, 1.0 });
     saturation = new Curve(interpPoints, new double[] { 1.0, 1.0, 1.0, 1.0, 1.0 });
     value = new Curve(interpPoints, new double[] { 1.0, 1.0, 1.0, 1.0, 1.0 });
 }
コード例 #5
0
ファイル: ColourMap.cs プロジェクト: goutkannan/ironlab
 public void Jet()
 {
     // RGB format used
     // Assume that pixel color is colour at pixel centre
     // 0 Dark blue (0,0,0.5) to blue (0,0,1) 1/8
     // 1 Blue (0,0,1) to cyan (0,1,1) 2/8
     // 2 Cyan (0,1,1) to yellow (1,1,0) 2/8
     // 3 Yellow (1,1,0) to red (1,0,0) 2/8
     // 4 Red (1,0,0) to dark red (0.5,0,0) 1/8
     // Dark Blue, blue, cyan, yellow, red, dark red
     colourMapMode = ColourMapMode.RGB;
     interpPoints = new double[] { 0.0, 0.01, 0.125, 0.375, 0.625, 0.875, 0.99, 1.0 };
     red = new Curve(interpPoints, new double[] { 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.5, 0.5 });
     green = new Curve(interpPoints, new double[] { 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0 });
     blue = new Curve(interpPoints, new double[] { 0.5, 0.5, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0 });
 }
コード例 #6
0
ファイル: ColourMap.cs プロジェクト: goutkannan/ironlab
 public void Gray()
 {
     colourMapMode = ColourMapMode.RGB;
     interpPoints = new double[] { 0.0, 0.125, 0.375, 0.625, 0.875, 1.0 };
     red = new Curve(interpPoints, new double[] { 0.0, 0.125, 0.375, 0.625, 0.875, 1.0 });
     green = new Curve(interpPoints, new double[] { 0.0, 0.125, 0.375, 0.625, 0.875, 1.0 });
     blue = new Curve(interpPoints, new double[] { 0.0, 0.125, 0.375, 0.625, 0.875, 1.0 });
 }
コード例 #7
0
ファイル: VisualHost.cs プロジェクト: goutkannan/ironlab
 public void Add(Curve curve)
 {
     this.curveList.Add(curve);
 }
コード例 #8
0
ファイル: Plot2DCurve.cs プロジェクト: goutkannan/ironlab
 public Plot2DCurve(object x, object y)
 {
     this.curve = new Curve(Plotting.Array(x), Plotting.Array(y));
     Initialize();
 }
コード例 #9
0
ファイル: Plot2DCurve.cs プロジェクト: goutkannan/ironlab
 public Plot2DCurve(Curve curve)
 {
     this.curve = curve;
     Initialize();
 }
コード例 #10
0
ファイル: Plot2D.xaml.cs プロジェクト: goutkannan/ironlab
 public Plot2DCurve AddLine(object x, object y)
 {
     Curve curve = new Curve(Plotting.Array(x), Plotting.Array(y));
     Plot2DCurve plot2DCurve = new Plot2DCurve(curve);
     this.Children.Add(plot2DCurve);
     return plot2DCurve;
 }
コード例 #11
0
ファイル: Plot2D.xaml.cs プロジェクト: goutkannan/ironlab
 public Plot2DCurve AddLine(double[] x, double[] y)
 {
     Curve curve = new Curve(x, y);
     Plot2DCurve plot2DCurve = new Plot2DCurve(curve);
     this.Children.Add(plot2DCurve);
     return plot2DCurve;
 }