本文整理匯總了C#中System.Windows.Shapes.Path.SetValue方法的典型用法代碼示例。如果您正苦於以下問題:C# Path.SetValue方法的具體用法?C# Path.SetValue怎麽用?C# Path.SetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Shapes.Path
的用法示例。
在下文中一共展示了Path.SetValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: start_path
public void start_path()
{
current_path = new Path();
current_path.Data = new GeometryGroup();
current_path.Stroke = Brushes.Black;
current_path.StrokeThickness = 1;
current_path.SnapsToDevicePixels = true;
current_path.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
}
示例2: AddPipe
/// <summary>
/// 界麵中 增加管道
/// </summary>
/// <param name="pipe"></param>
/// <param name="Start"></param>
/// <param name="End"></param>
public void AddPipe(Pipe pipe, Point Start, Point End)
{
Path path = new Path();
path.Stroke = pipe.GetColorBrush();
path.Data = DrawPipe(Start, End);
path.StrokeThickness = App.StrokeThinkness * 2/3;
path.SetValue(Canvas.ZIndexProperty, -1);
path.ToolTip = pipe;
context.Children.Add(path);
listpath.Add(path);
}
示例3: AddWastePipes
public void AddWastePipes(List<WastePipe> listpipe, List<VectorLine> list)
{
int index = 0;
foreach (WastePipe pipe in listpipe)
{
Path path = new Path();
path.Stroke = pipe.GetColorBrush();
//添加帶方向的管道
path.Data = DrawPipe(list[index].StartPoint, list[index].EndPoint);
index++;
path.StrokeThickness = App.StrokeThinkness;
path.SetValue(Canvas.ZIndexProperty, -1);
path.ToolTip = pipe;
path.SetValue(Canvas.ZIndexProperty, -1);
context.Children.Add(path);
listpath.Add(path);
}
}
示例4: CreateAndPositionChartGrid4CircularAxesY
//.........這裏部分代碼省略.........
Int32 countRectangles = 0; // counts the number of color bands for animating them alternately in opposite direction
Double position = 0; // value of the line position for the running loop cycle
InterlacedPaths = new List<Path>();
InterlacedLines = new List<Line>();
List<Point> previousPoints = new List<Point>();
List<Point> currPoints = new List<Point>();
CircularPlotDetails plotDetails = ParentAxis.CircularPlotDetails;
if (minVal != maxVal)
{
Decimal xValue;
for (xValue = minVal; xValue <= maxVal; )
{
position = Graphics.ValueToPixelPosition(Height, 0, Minimum, Maximum, (Double)xValue);
Double radius = Height - position;
List<Point> points;
if (plotDetails.CircularChartType == RenderAs.Radar)
points = GetGridPoints4Radar(radius, plotDetails.Center, plotDetails.ListOfPoints4CircularAxis.Count);
else
points = GetGridPoints4Polar(radius, plotDetails.Center, plotDetails.AnglesInRadian);
currPoints = points;
Int32 i;
for (i = 0; i < points.Count - 1; i++)
{
Line line = new Line();
InterlacedLines.Add(line);
line.Stroke = LineColor;
line.StrokeThickness = (Double)LineThickness;
line.StrokeDashArray = ExtendedGraphics.GetDashArray(LineStyle);
line.X1 = points[i].X;
line.X2 = points[i + 1].X;
line.Y1 = points[i].Y;
line.Y2 = points[i + 1].Y;
Visual.Children.Add(line);
}
// Create last line
Line lastLine = new Line();
InterlacedLines.Add(lastLine);
lastLine.Stroke = LineColor;
lastLine.StrokeThickness = (Double)LineThickness;
lastLine.StrokeDashArray = ExtendedGraphics.GetDashArray(LineStyle);
lastLine.X1 = points[i].X;
lastLine.X2 = points[0].X;
lastLine.Y1 = points[i].Y;
lastLine.Y2 = points[0].Y;
Visual.Children.Add(lastLine);
if (index % 2 == 1)
{
Path path = new Path();
path.StrokeThickness = 0;
List<Point> listOfPreAndCurrPoints = new List<Point>();
for (Int32 newPointIndex = 0; newPointIndex < currPoints.Count; newPointIndex++)
{
listOfPreAndCurrPoints.Add(currPoints[newPointIndex]);
}
listOfPreAndCurrPoints.Add(currPoints[0]);
for (Int32 prePointIndex = 0; prePointIndex < previousPoints.Count; prePointIndex++)
{
listOfPreAndCurrPoints.Add(previousPoints[prePointIndex]);
}
listOfPreAndCurrPoints.Add(previousPoints[0]);
listOfPreAndCurrPoints.Add(currPoints[0]);
path.Data = ParentAxis.GetPathGeometry(listOfPreAndCurrPoints);
countRectangles++;
path.Fill = InterlacedColor;
path.SetValue(Canvas.ZIndexProperty, 10);
Visual.Children.Add(path);
InterlacedPaths.Add(path);
}
previousPoints = currPoints;
index += (ParentAxis.SkipOffset + 1);
xValue = minVal + index * gap;
}
}
}
示例5: CreateFunnelSlice
/// <summary>
/// Create a slice of a funnel
/// </summary>
/// <param name="isLightingGradientLayer">Whether CreateFunnelSlice() function should create a layer for lighting</param>
/// <param name="topRadius">Top Radius of the funnel</param>
/// <param name="is3D">Whether the chart is a 3D Chart</param>
/// <param name="funnelSlice">FunnelSlice canvas reference</param>
/// <param name="yScaleTop">Top YScale for 3D view</param>
/// <param name="yScaleBottom">Bottom YScale for 3D view</param>
/// <param name="sideFillColor">Side surface fill color</param>
/// <param name="topFillColor">Top surface fill color</param>
/// <param name="topSurfaceStroke">Top surface stroke color</param>
/// <param name="animationEnabled">Whether animation is enabled</param>
/// <returns>Return funnel slice canvas</returns>
private static Canvas CreateFunnelSlice(Boolean isLightingGradientLayer, Double topRadius, Boolean is3D, TriangularChartSliceParms funnelSlice, Double yScaleTop, Double yScaleBottom, Brush sideFillColor, Brush topFillColor, Brush topSurfaceStroke, Boolean animationEnabled)
{
Double SOLID_FUNNEL_EDGE_THICKNESS = 3;
if (funnelSlice.Index == 0 && is3D && isLightingGradientLayer && (funnelSlice.FillType == FillType.Solid))
{
funnelSlice.Height += SOLID_FUNNEL_EDGE_THICKNESS;
}
Canvas sliceCanvas = new Canvas() { Tag = new ElementData() { Element = funnelSlice.DataPoint } };
Canvas visual = new Canvas() { Width = topRadius * 2, Height = funnelSlice.Height, Tag = new ElementData() { Element = funnelSlice.DataPoint } }; // Canvas holds a slice of a funnel chart
Faces faces = null;
// GeometryGroup for for a funnel slice path
GeometryGroup geometryGroup = new GeometryGroup();
// PathGeometry for for a funnel slice path
PathGeometry pathGeometry = new PathGeometry();
// pathFigure for for a funnel slice path
PathFigure pathFigure = new PathFigure() { StartPoint = new Point(topRadius - funnelSlice.TopRadius, 0) }; // PathFigure of a funnel slice
// Path for for a funnel slice
Path path4Slice = new Path() { Fill = sideFillColor };
path4Slice.Tag = new ElementData() { Element = funnelSlice.DataPoint };
// Add PathGeometry to GeometryGroup
geometryGroup.Children.Add(pathGeometry);
// Set path data
path4Slice.Data = geometryGroup;
// Set properties for path
path4Slice.StrokeThickness = 0;
path4Slice.Stroke = new SolidColorBrush(Colors.Black);
// Add path elements to its parent canvas
pathGeometry.Figures.Add(pathFigure);
visual.Children.Add(path4Slice);
if (is3D)
{
#region 3D
geometryGroup.FillRule = FillRule.Nonzero;
// Create top arc left
ArcSegment arcSegment = new ArcSegment();
arcSegment.Point = new Point(topRadius, yScaleTop / 2);
arcSegment.Size = new Size(funnelSlice.TopRadius, yScaleTop / 2);
pathFigure.Segments.Add(arcSegment);
// Create top arc right
arcSegment = new ArcSegment();
arcSegment.Point = new Point(topRadius + funnelSlice.TopRadius, 0);
arcSegment.Size = new Size(funnelSlice.TopRadius, yScaleTop / 2);
pathFigure.Segments.Add(arcSegment);
// Create right Plain
LineSegment lineSegment = new LineSegment() { Point = new Point(topRadius + funnelSlice.BottomRadius, funnelSlice.Height) };
pathFigure.Segments.Add(lineSegment);
lineSegment = new LineSegment() { Point = new Point(topRadius - funnelSlice.BottomRadius, funnelSlice.Height) };
pathFigure.Segments.Add(lineSegment);
// Create left Plain
lineSegment = new LineSegment() { Point = new Point(topRadius - funnelSlice.TopRadius, 0) };
pathFigure.Segments.Add(lineSegment);
EllipseGeometry ellipseGeometry = new EllipseGeometry();
ellipseGeometry.Center = new Point(topRadius, funnelSlice.Height);
ellipseGeometry.RadiusX = funnelSlice.BottomRadius;
ellipseGeometry.RadiusY = yScaleBottom / 2;
geometryGroup.Children.Add(ellipseGeometry);
// Create ellips for the funnel top
Ellipse funnelTopEllipse = new Ellipse() { Height = yScaleTop, Width = funnelSlice.TopRadius * 2, Fill = topFillColor, Tag = new ElementData() { Element = funnelSlice.DataPoint } };
funnelTopEllipse.SetValue(Canvas.TopProperty, -yScaleTop / 2);
funnelTopEllipse.SetValue(Canvas.LeftProperty, topRadius - funnelSlice.TopRadius);
//.........這裏部分代碼省略.........
示例6: GetDoughnutFace
/// <summary>
/// Returns a doughnut face
/// </summary>
/// <param name="doughnutParams">Doughnut parameters</param>
/// <param name="centroid">Centroid</param>
/// <param name="arcInnerStart">Arc inner dateTime point</param>
/// <param name="arcInnerStop">Arc inner stop point</param>
/// <param name="arcOuterStart">Arc outer dateTime point</param>
/// <param name="arcOuterStop">Arc outer stop point</param>
/// <param name="isTopFace">Whether a top face</param>
/// <returns>Path</returns>
private static Path GetDoughnutFace(SectorChartShapeParams doughnutParams, Point3D centroid, Point3D arcInnerStart, Point3D arcInnerStop, Point3D arcOuterStart, Point3D arcOuterStop, Boolean isTopFace)
{
Path pieFace = new Path() { Tag = new ElementData() { Element = doughnutParams.TagReference } };
//pieFace.Fill = doughnutParams.Lighting ? Graphics.GetLightingEnabledBrush(doughnutParams.Background, -75, "Linear", new Double[] { 0.99, 0.854 }) : doughnutParams.Background;
pieFace.Fill = Get3DFaceColor(RenderAs.Doughnut, doughnutParams.Lighting, doughnutParams.Background, PieFaceTypes.Top, Double.NaN, Double.NaN, Double.NaN);
List<PathGeometryParams> pathGeometryList = new List<PathGeometryParams>();
pathGeometryList.Add(new LineSegmentParams(new Point(arcOuterStop.X, arcOuterStop.Y)));
pathGeometryList.Add(new ArcSegmentParams(new Size(doughnutParams.OuterRadius, doughnutParams.OuterRadius * doughnutParams.YAxisScaling), 0, doughnutParams.IsLargerArc, SweepDirection.Counterclockwise, new Point(arcOuterStart.X, arcOuterStart.Y)));
pathGeometryList.Add(new LineSegmentParams(new Point(arcInnerStart.X, arcInnerStart.Y)));
pathGeometryList.Add(new ArcSegmentParams(new Size(doughnutParams.InnerRadius, doughnutParams.InnerRadius * doughnutParams.YAxisScaling), 0, doughnutParams.IsLargerArc, SweepDirection.Clockwise, new Point(arcInnerStop.X, arcInnerStop.Y)));
pieFace.Data = GetPathGeometryFromList(FillRule.Nonzero, new Point(arcInnerStop.X, arcInnerStop.Y), pathGeometryList, true);
Point3D midPoint = GetFaceZIndex(arcInnerStart, arcInnerStop, arcOuterStart, arcOuterStop);
if (isTopFace)
pieFace.SetValue(Canvas.ZIndexProperty, (Int32)(doughnutParams.Height * 200));
else
pieFace.SetValue(Canvas.ZIndexProperty, (Int32)(-doughnutParams.Height * 200));
return pieFace;
}
示例7: GetPie3D
/// <summary>
/// Returns 3D Pie shapes
/// </summary>
/// <param name="faces">Pie faces</param>
/// <param name="pieParams">Pie parameters</param>
/// <param name="zindex">Zindex</param>
/// <param name="unExplodedPoints">UnExploded dataPoints</param>
/// <param name="explodedPoints">Exploded dataPoints</param>
/// <param name="labelLinePath">Label line path</param>
/// <param name="enabledDataPoints">List of enabled dataPoints</param>
/// <returns>List of Shape</returns>
private static List<Shape> GetPie3D(DataSeries currentDataSeries, ref Faces faces, SectorChartShapeParams pieParams, ref Int32 zindex, ref PieDoughnut3DPoints unExplodedPoints, ref PieDoughnut3DPoints explodedPoints, ref Path labelLinePath, List<DataPoint> enabledDataPoints)
{
List<Shape> pieFaces = new List<Shape>();
Shape topFace = null, bottomFace = null, rightFace = null, leftFace = null;
Point center = new Point();
center.X = pieParams.Width / 2;
center.Y = pieParams.Height / 2;
// calculate 3d offsets
Double yOffset = -pieParams.Depth / 2 * pieParams.ZAxisScaling;
// calculate all points
Point3D topFaceCenter = new Point3D();
topFaceCenter.X = center.X;
topFaceCenter.Y = center.Y + yOffset;
topFaceCenter.Z = pieParams.OffsetY * Math.Sin(pieParams.StartAngle) * Math.Cos(pieParams.TiltAngle) + pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);
Point3D topArcStart = new Point3D();
topArcStart.X = topFaceCenter.X + pieParams.OuterRadius * Math.Cos(pieParams.StartAngle);
topArcStart.Y = topFaceCenter.Y + pieParams.OuterRadius * Math.Sin(pieParams.StartAngle) * pieParams.YAxisScaling;
topArcStart.Z = (topFaceCenter.Y + pieParams.OuterRadius) * Math.Sin(pieParams.StartAngle) * Math.Cos(pieParams.TiltAngle) + pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);
Point3D topArcStop = new Point3D();
topArcStop.X = topFaceCenter.X + pieParams.OuterRadius * Math.Cos(pieParams.StopAngle);
topArcStop.Y = topFaceCenter.Y + pieParams.OuterRadius * Math.Sin(pieParams.StopAngle) * pieParams.YAxisScaling;
topArcStop.Z = (topFaceCenter.Y + pieParams.OuterRadius) * Math.Sin(pieParams.StopAngle) * Math.Cos(pieParams.TiltAngle) + pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);
Point3D bottomFaceCenter = new Point3D();
bottomFaceCenter.X = center.X;
bottomFaceCenter.Y = center.Y - yOffset;
bottomFaceCenter.Z = pieParams.OffsetY * Math.Sin(pieParams.StartAngle) * Math.Cos(pieParams.TiltAngle) - pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);
Point3D bottomArcStart = new Point3D();
bottomArcStart.X = bottomFaceCenter.X + pieParams.OuterRadius * Math.Cos(pieParams.StartAngle);
bottomArcStart.Y = bottomFaceCenter.Y + pieParams.OuterRadius * Math.Sin(pieParams.StartAngle) * pieParams.YAxisScaling;
bottomArcStart.Z = (bottomFaceCenter.Y + pieParams.OuterRadius) * Math.Sin(pieParams.StartAngle) * Math.Cos(pieParams.TiltAngle) - pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);
Point3D bottomArcStop = new Point3D();
bottomArcStop.X = bottomFaceCenter.X + pieParams.OuterRadius * Math.Cos(pieParams.StopAngle);
bottomArcStop.Y = bottomFaceCenter.Y + pieParams.OuterRadius * Math.Sin(pieParams.StopAngle) * pieParams.YAxisScaling;
bottomArcStop.Z = (bottomFaceCenter.Y + pieParams.OuterRadius) * Math.Sin(pieParams.StopAngle) * Math.Cos(pieParams.TiltAngle) - pieParams.Depth * Math.Cos(Math.PI / 2 - pieParams.TiltAngle);
Point3D centroid = GetCentroid(topFaceCenter, topArcStart, topArcStop, bottomFaceCenter, bottomArcStart, bottomArcStop);
UpdatePositionLabelInsidePie(pieParams, yOffset);
if (pieParams.StartAngle == pieParams.StopAngle && pieParams.IsLargerArc || enabledDataPoints.Count == 1)
{
// draw singleton pie here
topFace = new Ellipse() { Tag = new ElementData() { Element = pieParams.TagReference } };
// topFace.Fill = pieParams.Lighting ? Graphics.GetLightingEnabledBrush(pieParams.Background, "Radial", new Double[] { 0.99, 0.745 }) : pieParams.Background;
topFace.Fill = pieParams.Lighting ? Graphics.GetLightingEnabledBrush(pieParams.Background, "Linear", new Double[] { 0.99, 0.854 }) : pieParams.Background;
topFace.Width = 2 * pieParams.OuterRadius;
topFace.Height = 2 * pieParams.OuterRadius * pieParams.YAxisScaling;
topFace.SetValue(Canvas.LeftProperty, (Double)(pieParams.Center.X - topFace.Width / 2));
topFace.SetValue(Canvas.TopProperty, (Double)(pieParams.Center.Y - topFace.Height / 2 + yOffset));
pieFaces.Add(topFace);
faces.Parts.Add(topFace);
bottomFace = new Ellipse() { Tag = new ElementData() { Element = pieParams.TagReference } };
bottomFace.Fill = pieParams.Lighting ? Graphics.GetLightingEnabledBrush(pieParams.Background, "Radial", new Double[] { 0.99, 0.745 }) : pieParams.Background;
bottomFace.Width = 2 * pieParams.OuterRadius;
bottomFace.Height = 2 * pieParams.OuterRadius * pieParams.YAxisScaling;
bottomFace.SetValue(Canvas.LeftProperty, (Double)(pieParams.Center.X - topFace.Width / 2));
bottomFace.SetValue(Canvas.TopProperty, (Double)(pieParams.Center.Y - topFace.Height / 2 + yOffset));
pieFaces.Add(bottomFace);
faces.Parts.Add(bottomFace);
}
else
{
topFace = GetPieFace(pieParams, centroid, topFaceCenter, topArcStart, topArcStop);
pieFaces.Add(topFace);
faces.Parts.Add(topFace);
bottomFace = GetPieFace(pieParams, centroid, bottomFaceCenter, bottomArcStart, bottomArcStop);
pieFaces.Add(bottomFace);
faces.Parts.Add(bottomFace);
rightFace = GetPieSide(pieParams, centroid, topFaceCenter, bottomFaceCenter, topArcStart, bottomArcStart);
pieFaces.Add(rightFace);
faces.Parts.Add(rightFace);
leftFace = GetPieSide(pieParams, centroid, topFaceCenter, bottomFaceCenter, topArcStop, bottomArcStop);
pieFaces.Add(leftFace);
faces.Parts.Add(leftFace);
}
//.........這裏部分代碼省略.........
示例8: DrawPathSegments_Clicked
/// <summary>
/// Draw segments and connect them together.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DrawPathSegments_Clicked(object sender, RoutedEventArgs e)
{
// Create a path
Path path = new Path();
path.Stroke = new SolidColorBrush(Colors.Black);
path.StrokeThickness = 2;
var pathGeometry = new PathGeometry();
//create segments
PathSegmentCollection segmentCollection = new PathSegmentCollection();
segmentCollection.Add(new LineSegment() { Point = new Point(300, 400) });
segmentCollection.Add(new LineSegment() { Point = new Point(400, 300) });
segmentCollection.Add(new LineSegment() { Point = new Point(500, 300) });
//create path feature
var pathFigure = new PathFigure() { Segments = segmentCollection };
pathFigure.StartPoint = new Point(150, 10);
pathGeometry.Figures = new PathFigureCollection() { pathFigure };
path.Data = pathGeometry;
//Add drag drop behavior.
path.SetValue(DragDropBehavior.PlacementTarget, this.DrawCanvas);
Canvas.SetLeft(path, 0);
Canvas.SetTop(path, 0);
this.DrawCanvas.Children.Add(path);
}
示例9: GetVisualObjectForAreaChart
/// <summary>
/// Get visual object for area chart
/// </summary>
/// <param name="width">Width of the PlotArea</param>
/// <param name="height">Height of the PlotArea</param>
/// <param name="plotDetails">PlotDetails</param>
/// <param name="seriesList">List of DataSeries with render as area chart</param>
/// <param name="chart">Chart</param>
/// <param name="plankDepth">PlankDepth</param>
/// <param name="animationEnabled">Whether animation is enabled for chart</param>
/// <returns>Area chart canvas</returns>
internal static Canvas GetVisualObjectForAreaChart(Panel preExistingPanel, Double width, Double height, PlotDetails plotDetails, List<DataSeries> seriesList, Chart chart, Double plankDepth, bool animationEnabled)
{
if (Double.IsNaN(width) || Double.IsNaN(height) || width <= 0 || height <= 0)
return null;
DataSeries series = seriesList[0] as DataSeries;
if (animationEnabled)
{
if (series.Storyboard == null)
series.Storyboard = new Storyboard();
}
Canvas visual, labelCanvas, areaCanvas, areaFaceCanvas;
RenderHelper.RepareCanvas4Drawing(preExistingPanel as Canvas, out visual, out labelCanvas, out areaCanvas, width, height);
areaFaceCanvas = new Canvas() { Height = height, Width = width };
Double depth3d = plankDepth / plotDetails.Layer3DCount * (chart.View3D ? 1 : 0);
Double visualOffset = depth3d * (plotDetails.SeriesDrawingIndex[series] + 1);
visual.SetValue(Canvas.TopProperty, visualOffset);
visual.SetValue(Canvas.LeftProperty, -visualOffset);
labelCanvas.SetValue(Canvas.TopProperty, (Double)0);
labelCanvas.SetValue(Canvas.LeftProperty, (Double)0);
areaFaceCanvas.SetValue(Canvas.TopProperty, (Double)0);
areaFaceCanvas.SetValue(Canvas.LeftProperty, (Double)0);
//areaFaceCanvas.SetValue(Canvas.ZIndexProperty, (Int32)1);
DataSeries currentDataSeries;
Double minimumXValue = Double.MaxValue;
Double maximumXValue = Double.MinValue;
if ((Boolean)series.Enabled)
{
if (series.Storyboard == null)
series.Storyboard = new Storyboard();
currentDataSeries = series;
PlotGroup plotGroup = series.PlotGroup;
Double limitingYValue = plotGroup.GetLimitingYValue();
minimumXValue = Math.Min(minimumXValue, plotGroup.MinimumX);
maximumXValue = Math.Max(maximumXValue, plotGroup.MaximumX);
//List<DataPoint> enabledDataPoints = (from datapoint in series.InternalDataPoints where datapoint.Enabled == true select datapoint).ToList();
Faces dataSeriesFaces = new Faces();
dataSeriesFaces.FrontFacePaths = new List<Path>();
dataSeriesFaces.Visual = areaFaceCanvas;
dataSeriesFaces.LabelCanvas = labelCanvas;
series.Faces = dataSeriesFaces;
List<List<DataPoint>> brokenAreaDataPointsCollection = BrokenAreaDataPointsGroup(width, height, series);
DataPoint currentDataPoint;
DataPoint nextDataPoint;
DataPoint previusDataPoint;
Double plankYPos = Graphics.ValueToPixelPosition(height, 0, (Double)plotGroup.AxisY.InternalAxisMinimum, (Double)plotGroup.AxisY.InternalAxisMaximum, limitingYValue);
foreach (List<DataPoint> dataPointList in brokenAreaDataPointsCollection)
{
if (dataPointList.Count <= 0)
continue;
currentDataPoint = dataPointList[0];
previusDataPoint = currentDataPoint;
PointCollection points = new PointCollection();
List<DataPoint> dataPoints = new List<DataPoint>();
Path frontFacePath = null;
PathGeometry frontFacePathGeometry;
PathFigure frontFacePathFigure = null;
Int32 maxZIndex = 0;
for (Int32 i = 0; i < dataPointList.Count - 1; i++)
{
Path areaBase = new Path();
Faces dataPointFaces;
Faces nextDataPointFaces = new Faces();
currentDataPoint = dataPointList[i];
currentDataPoint._parsedToolTipText = currentDataPoint.TextParser(currentDataPoint.ToolTipText);
//.........這裏部分代碼省略.........
示例10: Draw3DArea
/// <summary>
/// Get visual of Area 3D
/// </summary>
/// <param name="faces">Faces</param>
/// <param name="areaParams">AreaParams</param>
/// <returns>ZIndex</returns>
internal static Int32 Draw3DArea(Canvas parentVisual, DataPoint previusDataPoint, DataPoint dataPoint, DataPoint nextDataPoint, ref Faces dataSeriesFaces, ref Faces dataPointFaces, DataSeries dataSeries, Double plankYPos)
{
Brush sideBrush = (Boolean) dataSeries.LightingEnabled ? Graphics.GetRightFaceBrush(dataSeries.Color) : dataSeries.Color;
Brush topBrush = (Boolean)dataSeries.LightingEnabled ? Graphics.GetTopFaceBrush(dataSeries.Color) : dataSeries.Color;
// Int32 pointIndexLimit = dataSeries.IsPositive ? areaParams.Points.Count - 1 : areaParams.Points.Count;
Random rand = new Random(DateTime.Now.Millisecond);
// parentVisual.Background = new SolidColorBrush(Colors.Green);
Boolean isPositive2Negative = false; // DataPoint at -ve, previous DataPoint is positive
//Boolean isNegative2Positive = false; // DataPoint at -ve, next DataPoint is positive
//if (dataPoint.InternalYValue < 0 && previusDataPoint.InternalYValue > 0)
// isPositive2Negative = true;
//if (dataPoint.InternalYValue > 0 && nextDataPoint.InternalYValue < 0)
// isNegative2Positive = true;
Int32 zIndex = GetAreaZIndex(dataPoint._visualPosition.X, dataPoint._visualPosition.Y, dataPoint.InternalYValue > 0 || isPositive2Negative);
//dataPointFaces.da
if (dataPointFaces.Area3DLeftFace != null)
{
Area3DDataPointFace leftFace = dataPointFaces.Area3DLeftFace;
leftFace.CalculateBackFacePoints();
Path sides = new Path() { Tag = new ElementData() { Element = dataSeries } };
sides.SetValue(Canvas.ZIndexProperty, zIndex);
PathGeometry pg = new PathGeometry();
PathFigure pf = new PathFigure() { IsClosed = true };
pg.Figures.Add(pf);
PointCollection facePoints = leftFace.GetFacePoints();
pf.StartPoint = leftFace.FrontFacePoints[0];
// Graphics.DrawPointAt(dataPointFaces.Area3DLeftFace.FrontPointLeft, parentVisual, Colors.Yellow);
foreach (Point point in facePoints)
{
LineSegment ls = new LineSegment() { Point = point };
pf.Segments.Add(ls);
}
sides.Data = pg;
sides.Fill = sideBrush;
sides.Opacity = dataPoint.Parent.Opacity;
ApplyBorderProperties(sides, dataPoint.Parent);
// sides.Fill = new SolidColorBrush(Color.FromArgb(255, (byte)rand.Next(155), (byte)rand.Next(200), (byte)rand.Next(126)));
parentVisual.Children.Add(sides);
leftFace.LeftFace = sides;
//dataPointFaces.VisualComponents.Add(sides);
//dataPointFaces.Parts.Add(sides);
dataSeriesFaces.VisualComponents.Add(sides);
//dataPointFaces.BorderElements.Add(sides);
}
if (dataPointFaces.Area3DLeftTopFace != null)
{
Area3DDataPointFace topFace = dataPointFaces.Area3DLeftTopFace;
if (isPositive2Negative)
{
//Graphics.DrawPointAt(new Point(previusDataPoint._visualPosition.X, plankYPos), parentVisual, Colors.Red);
//Graphics.DrawPointAt(new Point(dataPoint._visualPosition.X, plankYPos), parentVisual, Colors.Red);
//Graphics.DrawPointAt(previusDataPoint._visualPosition, parentVisual, Colors.Red);
//Graphics.DrawPointAt(dataPoint._visualPosition, parentVisual, Colors.Red);
Point midPoint = new Point();
if (dataPointFaces.Area3DRightFace == null)
{
if (Graphics.IntersectionOfTwoStraightLines(new Point(previusDataPoint._visualPosition.X, plankYPos),
new Point(dataPoint._visualPosition.X, plankYPos),
previusDataPoint._visualPosition, dataPoint._visualPosition, ref midPoint))
{
topFace.FrontFacePoints[1] = midPoint;
//Graphics.DrawPointAt(midPoint, parentVisual, Colors.Green);
}
}
//Graphics.DrawPointAt(midPoint, parentVisual, Colors.Green);
}
//.........這裏部分代碼省略.........
示例11: AInfoWindow
/// <summary>
/// 標記物
/// </summary>
public AInfoWindow()
{
parent = new Grid();
_path = new Path();
path1 = new Path();
path2 = new Path();
path3 = new Path();
path4 = new Path();
tileGird = new Grid();
Anchor = new Point(5, 0);
// this.Tapped += ATip_Tapped;
//this.DoubleTapped += ATip_DoubleTapped;
ContentTextBlock = new TextBlock() { VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Left, TextWrapping = TextWrapping.Wrap, FontSize = 15, Margin = new Thickness(0, 0, 0, 0) };
TitleTextBlock = new TextBlock() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, FontSize = 22, Margin = new Thickness(0, 9, 0, 0) };
ContentText = "";
Title = "";
ContentPanel = new StackPanel();
TitlePanel = new StackPanel();
TitleBackgroundColor = HexToColor("#FF2D2D2D");
ContentBackgroundColor = HexToColor("#2F3236");
SetBackgroundColor();
parent.HorizontalAlignment = HorizontalAlignment.Stretch;
parent.VerticalAlignment = VerticalAlignment.Stretch;
parent.Margin = new Thickness(0, 0, 0, 0);
this.Content = parent;
parent.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(10) });
parent.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
parent.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(10) });
parent.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(40) });
parent.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(59) });
//左上邊
var pathGeometry = new PathGeometry();
var figures = pathGeometry.Figures;
PathFigure figure = new PathFigure();
figure.StartPoint = new Point(0, 40);
figure.Segments.Add(new LineSegment() { Point = new Point(0, 10) });
figure.Segments.Add(new LineSegment() { Point = new Point(0, 0) });
figure.Segments.Add(new LineSegment() { Point = new Point(10, 0) });
// Can add other types, e.g. PolyLineSegment, PathSegment, ArcSegment, BezierSegment
//figure.Segments.Add(new QuadraticBezierSegment() { Point1 = new Point(0, 0), Point2 = new Point(8, 0) });
figure.Segments.Add(new LineSegment() { Point = new Point(10, 0) });
figure.Segments.Add(new LineSegment() { Point = new Point(10, 40) });
figure.IsClosed = true;
figures.Add(figure);
_path.Data = pathGeometry;
// _path.Margin = new Thickness(0, 1, 0, -2);
parent.Children.Add(_path);
var pathGeometry1 = new PathGeometry();
var figures1 = pathGeometry1.Figures;
var figure1 = new PathFigure();
figure1.StartPoint = new Point(10, 40);
figure1.Segments.Add(new LineSegment() { Point = new Point(10, 10) });
figure1.Segments.Add(new LineSegment() { Point = new Point(10, 0) });
//figure1.Segments.Add(new QuadraticBezierSegment() { Point1 = new Point(10, 0), Point2 = new Point(2, 0) });
figure1.Segments.Add(new LineSegment() { Point = new Point(0, 0) });
figure1.Segments.Add(new LineSegment() { Point = new Point(0, 40) });
figure1.IsClosed = true;
figures1.Add(figure1);
path1.Data = pathGeometry1;
path1.SetValue(Grid.ColumnProperty, 2);
// path1.Margin = new Thickness(0, 1, 0, -2);
parent.Children.Add(path1);
//標題
TitlePanel.HorizontalAlignment = HorizontalAlignment.Stretch;
TitlePanel.VerticalAlignment = VerticalAlignment.Stretch;
TitlePanel.Children.Add(TitleTextBlock);
tileGird.HorizontalAlignment = HorizontalAlignment.Stretch;
tileGird.VerticalAlignment = VerticalAlignment.Stretch;
tileGird.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
tileGird.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(40) });
tileGird.Children.Add(TitlePanel);
tileGird.Margin = new Thickness(-1, 0, -1, -1);
tileGird.SetValue(Grid.ColumnProperty, 1);
parent.Children.Add(tileGird);
var pathGeometry2 = new PathGeometry();
var figures2 = pathGeometry2.Figures;
var figure2 = new PathFigure();
figure2.StartPoint = new Point(10, 0);
figure2.Segments.Add(new LineSegment() { Point = new Point(0, 0) });
figure2.Segments.Add(new LineSegment() { Point = new Point(0, 50) });
//figure2.Segments.Add(new QuadraticBezierSegment() { Point1 = new Point(0, 50), Point2 = new Point(8, 50) });
figure2.Segments.Add(new LineSegment() { Point = new Point(10, 50) });
figure2.IsClosed = false;
path2.StrokeThickness = 0;
figures2.Add(figure2);
path2.SetValue(Grid.RowProperty, 1);
path2.Data = pathGeometry2;
parent.Children.Add(path2);
//.........這裏部分代碼省略.........
示例12: CreateGridLinesOverPlank
private void CreateGridLinesOverPlank(Double height, Panel plank, Double plankDepth, Double plankThickness)
{
if (plank.Children.Contains(GridLineCanvas4VerticalPlank))
{
plank.Children.Remove(GridLineCanvas4VerticalPlank);
GridLineCanvas4VerticalPlank.Children.Clear();
}
if (AxisY != null && AxisY.Grids.Count > 0)
{
GridLineCanvas4VerticalPlank = new Canvas();
GridLineCanvas4VerticalPlank.Width = plank.Width;
GridLineCanvas4VerticalPlank.Height = plank.Height;
plank.Children.Add(GridLineCanvas4VerticalPlank);
if ((Boolean)AxisY.Grids[0].Enabled)
{
Decimal minVal = (Decimal)AxisY.Grids[0].Minimum;
Decimal maxVal = (Decimal)AxisY.Grids[0].Maximum;
Double interval = (Double)AxisY.Grids[0].Interval;
Decimal index = 0;
Double position = 0;
Double[] newYCoord = new Double[2];
Double[] prevYCoord = new Double[2];
Decimal gap = (Decimal)interval;
Int32 countRectangles = 0;
InterlacedLinesOverVerticalPlank = new List<Line>();
InterlacedPathsOverVerticalPlank = new List<System.Windows.Shapes.Path>();
Storyboard4PlankGridLines = new Storyboard();
if (minVal != maxVal)
{
for (Decimal xValue = minVal; xValue <= maxVal; )
{
Line line = new Line();
Brush lineBrush = AxisY.Grids[0].LineColor;
line.Stroke = lineBrush;
line.StrokeThickness = (Double)AxisY.Grids[0].LineThickness;
line.StrokeDashArray = ExtendedGraphics.GetDashArray(AxisY.Grids[0].LineStyle);
position = Graphics.ValueToPixelPosition(height, 0, AxisY.Grids[0].Minimum, AxisY.Grids[0].Maximum, (Double)xValue);
if (position == 0)
position += (Double)AxisY.Grids[0].LineThickness;
line.X1 = plankDepth;
line.X2 = 0;
line.Y1 = position - plankDepth;
line.Y2 = position - plankThickness;
newYCoord = new Double[] { position - plankDepth, position - plankThickness };
if (Chart._internalAnimationEnabled && AxisY.Grids[0].AnimationEnabled)
{
line.X2 = line.X1;
line.Y2 = line.Y1;
Storyboard4PlankGridLines.Children.Add(AxisY.Grids[0].CreateDoubleAnimation(line, "X2", plankDepth, 0, 0.75, 0.75));
Storyboard4PlankGridLines.Children.Add(AxisY.Grids[0].CreateDoubleAnimation(line, "Y2", position - plankDepth, position - plankThickness, 0.75, 0.75));
}
GridLineCanvas4VerticalPlank.Children.Add(line);
InterlacedLinesOverVerticalPlank.Add(line);
if (index % 2 == 1)
{
System.Windows.Shapes.Path path = new System.Windows.Shapes.Path();
path.StrokeThickness = 0;
if (Chart._internalAnimationEnabled && AxisY.Grids[0].AnimationEnabled)
{
path.Opacity = 0;
Storyboard4PlankGridLines.Children.Add(AxisY.Grids[0].CreateDoubleAnimation(path, "Opacity", 0, 1, 1, 0.75));
}
PointCollection col = new PointCollection();
col.Add(new Point(plankDepth, prevYCoord[0]));
col.Add(new Point(0, prevYCoord[1]));
col.Add(new Point(0, newYCoord[1]));
col.Add(new Point(plankDepth, newYCoord[0]));
col.Add(new Point(plankDepth, prevYCoord[0]));
path.Data = GetPathGeometry(col);
Brush interlacedBrush = AxisY.Grids[0].InterlacedColor;
countRectangles++;
path.Fill = interlacedBrush;
path.SetValue(Canvas.ZIndexProperty, 10);
GridLineCanvas4VerticalPlank.Children.Add(path);
InterlacedPathsOverVerticalPlank.Add(path);
}
index += (AxisY.SkipOffset + 1);
xValue = minVal + index * gap;
prevYCoord = new Double[] { position - plankDepth, position - plankThickness };
//.........這裏部分代碼省略.........
示例13: SetZIndexOf3DLayers
private void SetZIndexOf3DLayers(ref Path path, Pyramid3dLayer pyramid3dFaceType)
{
switch (pyramid3dFaceType)
{
case Pyramid3dLayer.BackLayerLeft:
path.SetValue(Canvas.ZIndexProperty, -1);
break;
case Pyramid3dLayer.BackLayerRight:
path.SetValue(Canvas.ZIndexProperty, -1);
break;
case Pyramid3dLayer.BottomLayer:
path.SetValue(Canvas.ZIndexProperty, -2);
break;
case Pyramid3dLayer.FrontLayerLeft:
path.SetValue(Canvas.ZIndexProperty, 1);
break;
case Pyramid3dLayer.FrontLayerRight:
path.SetValue(Canvas.ZIndexProperty, 1);
break;
case Pyramid3dLayer.TopLayer:
path.SetValue(Canvas.ZIndexProperty, 2);
break;
case Pyramid3dLayer.LightingLayerFront:
path.SetValue(Canvas.ZIndexProperty, 2);
break;
case Pyramid3dLayer.LightingLayerLeft:
path.SetValue(Canvas.ZIndexProperty, 2);
break;
case Pyramid3dLayer.LightingLayerRight:
path.SetValue(Canvas.ZIndexProperty, 2);
break;
}
}
示例14: DrawRubberEdge
public void DrawRubberEdge(EdgeGeometry edgeGeometry)
{
if (RubberEdgePath != null)
MainCanvas.Children.Remove(RubberEdgePath);
RubberEdgePath = new Path() { Stroke = BlackBrush, StrokeThickness = 2.0 };
PathFigure figure = Draw.CreateGraphicsPath(edgeGeometry.Curve);
PathGeometry geometry = new PathGeometry();
geometry.Figures.Add(figure);
RubberEdgePath.Data = geometry;
RubberEdgePath.SetValue(Canvas.LeftProperty, edgeGeometry.BoundingBox.Left);
RubberEdgePath.SetValue(Canvas.TopProperty, edgeGeometry.BoundingBox.Bottom);
geometry.Transform = new MatrixTransform() { Matrix = new Matrix(1.0, 0.0, 0.0, 1.0, -edgeGeometry.BoundingBox.Left, -edgeGeometry.BoundingBox.Bottom) };
MainCanvas.Children.Add(RubberEdgePath);
}
示例15: DrawSegment
private void DrawSegment(Point p1, Point p2, Point p3, Point p4, bool reflexangle, Color clr)
{
// Segment Geometry
PathSegmentCollection segments = new PathSegmentCollection();
// First line segment from pt p1 - pt p2
segments.Add(new LineSegment() { Point = p2 });
//Arc drawn from pt p2 - pt p3 with the RangeIndicatorRadius
segments.Add(new ArcSegment()
{
Size = new Size(arcradius2, arcradius2),
Point = p3,
SweepDirection = SweepDirection.Clockwise,
IsLargeArc = reflexangle
});
// Second line segment from pt p3 - pt p4
segments.Add(new LineSegment() { Point = p4 });
//Arc drawn from pt p4 - pt p1 with the Radius of arcradius1
segments.Add(new ArcSegment()
{
Size = new Size(arcradius1, arcradius1),
Point = p1,
SweepDirection = SweepDirection.Counterclockwise,
IsLargeArc = reflexangle
});
// Defining the segment path properties
Color rangestrokecolor;
if (clr == Colors.Transparent)
{
rangestrokecolor = clr;
}
else
rangestrokecolor = Colors.White;
rangeIndicator = new Path()
{
StrokeLineJoin = PenLineJoin.Round,
Stroke = new SolidColorBrush(rangestrokecolor),
//Color.FromArgb(0xFF, 0xF5, 0x9A, 0x86)
Fill = new SolidColorBrush(clr),
Opacity = 0.65,
StrokeThickness = 0.25,
Data = new PathGeometry()
{
Figures = new PathFigureCollection()
{
new PathFigure()
{
IsClosed = true,
StartPoint = p1,
Segments = segments
}
}
}
};
//Set Z index of range indicator
rangeIndicator.SetValue(Canvas.ZIndexProperty, 150);
// Adding the segment to the root grid
LayoutRoot.Children.Add(rangeIndicator);
}