protected override Point GetToolTipPosition(ShapeMap sender, List <ShapeMap> sibilings) { Size desiredSize1 = this.DesiredSize; double width = desiredSize1.Width; desiredSize1 = this.DesiredSize; double height = desiredSize1.Height; Size desiredSize2; double num1; if (width >= height) { desiredSize2 = this.DesiredSize; num1 = desiredSize2.Height; } else { desiredSize2 = this.DesiredSize; num1 = desiredSize2.Width; } double num2 = num1; desiredSize2 = this.DesiredSize; double x = (desiredSize2.Width - num2) / 2.0 + 10.0; desiredSize2 = this.DesiredSize; double y = (desiredSize2.Height - num2) / 2.0 + 10.0; return(new Point(x, y)); }
protected override Point GetToolTipPosition(ShapeMap sender, List <ShapeMap> sibilings) { DataTooltip.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); var unitW = ToPlotArea(1, AxisTags.X) - PlotArea.X + 5; var overflow = unitW - MaxColumnWidth > 0 ? unitW - MaxColumnWidth : 0; unitW = unitW > MaxColumnWidth ? MaxColumnWidth : unitW; var x = sender.ChartPoint.X + 1 > (Min.X + Max.X) / 2 ? ToPlotArea(sender.ChartPoint.X, AxisTags.X) + overflow * .5 - DataTooltip.DesiredSize.Width : ToPlotArea(sender.ChartPoint.X, AxisTags.X) + unitW + overflow * .5; var y = ToPlotArea(sibilings.Where(s => s.Series is StackedBarSeries).Select(s => s.ChartPoint.Y).DefaultIfEmpty(0).Sum() * 0.5, AxisTags.Y); y = y + DataTooltip.DesiredSize.Height > ActualHeight ? y - (y + DataTooltip.DesiredSize.Height - ActualHeight) - 5 : y; return(new Point(x, y)); }
public override void Initialize(Engine.IDirectXProvider directX) { base.Initialize(directX); ShapeMap.BeginDesign(); Rectangle rEnabled = ToDispose(new Rectangle() { Id = string.Format("{0}_{1}_rectangle", Id, ControlStatus.Enabled), BoundingRectangle = BoundingRectangle }); ShapeMap.Add(ControlStatus.Enabled, rEnabled); ShapeMap.EndDesign(directX); ActiveStyle = ShapeMap.GetShapes(ControlStatus.Enabled).ToArray(); shape = ((IShapeMesh)ActiveStyle[0]).Shape; }
protected override Point GetToolTipPosition(ShapeMap sender, List <ShapeMap> sibilings) { DataTooltip.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); var unitW = ToPlotArea(1, AxisTags.X) - System.Windows.Controls.Canvas.GetLeft(DrawMargin) + 5; var overflow = unitW - MaxColumnWidth * 3 > 0 ? unitW - MaxColumnWidth * 3 : 0; unitW = unitW > MaxColumnWidth * 3 ? MaxColumnWidth * 3 : unitW; var targetAxis = Invert ? sender.Series.ScalesYAt : sender.Series.ScalesXAt; var x = sender.ChartPoint.X + 1 > (AxisX[targetAxis].MaxLimit + AxisX[targetAxis].MaxLimit) / 2 ? ToPlotArea(sender.ChartPoint.X, AxisTags.X) + overflow * .5 - DataTooltip.DesiredSize.Width : ToPlotArea(sender.ChartPoint.X, AxisTags.X) + unitW + overflow * .5; var y = ToPlotArea(sibilings.Select(s => s.ChartPoint.Y).DefaultIfEmpty(0).Sum() / sibilings.Count, AxisTags.Y); y = y + DataTooltip.DesiredSize.Height > ActualHeight ? y - (y + DataTooltip.DesiredSize.Height - ActualHeight) - 5 : y; return(new Point(x, y)); }
ShapeMap Test() { var rgbimage = new RGBImage(currentbtmp); var red = new ColorChannelImage(rgbimage, ColorChannel.R); var green = new ColorChannelImage(rgbimage, ColorChannel.G); var blue = new ColorChannelImage(rgbimage, ColorChannel.B); //GrayImage donegreen = null; //GrayImage donered = null; //GrayImage doneblue = null; #if PARALLEL var task1 = Task.Factory.StartNew(() => ApplyEdgeDetection(green)); var task2 = Task.Factory.StartNew(() => ApplyEdgeDetection(red)); var task3 = Task.Factory.StartNew(() => ApplyEdgeDetection(blue)); Task.WaitAll(task1, task2, task3); #else ApplyEdgeDetection(green); ApplyEdgeDetection(red); ApplyEdgeDetection(blue); #endif green = null; blue = null; red = null; var CombinedEdgeImage = rgbimage.GetBinaryImage(); Stage1.Image = CombinedEdgeImage.GetBitmap(); var blobs = CombinedEdgeImage.FindShapes(); Stage2.Image = blobs.GetBitmap(); var shapes = Shape.ShapeFromBinary(blobs); var bitmp2 = new Bitmap(300, 300, System.Drawing.Imaging.PixelFormat.Format24bppRgb); for (int i = 0; i < shapes.Count; i++) { for (int j = 0; j < shapes[i].Length; j++) { var point = shapes[i].GetPoint(j); bitmp2.SetPixel(point.X, point.Y, Color.White); } } Stage3.Image = bitmp2; for (int i = 0; i < shapes.Count; i++) { shapes[i].Reduce(5); } var bitmp = new Bitmap(300, 300, System.Drawing.Imaging.PixelFormat.Format24bppRgb); for (int i = 0; i < shapes.Count; i++) { for (int j = 0; j < shapes[i].Length; j++) { var point = shapes[i].GetPoint(j); bitmp.SetPixel(point.X, point.Y, Color.White); } } Stage4.Image = bitmp; //var targetShapes = shapes; Shape.OrderShapes(shapes); //Shape targetShapes = null; //for (int i = 0; i < shapes.Count; i++) //{ // if (shapes[i].Length >= (int)Shape.form.Circle) // { // targetShapes = shapes[i]; // } //} var targetTriangle = Shape.FindFormInForm(shapes, Shape.form.Circle, Shape.form.Triangle); var targetSquare = Shape.FindFormInForm(shapes, Shape.form.Circle, Shape.form.Square); var targetCircle = Shape.FindFormInForm(shapes, Shape.form.Circle, Shape.form.Circle); var targetShapes = new List <Shape> { targetTriangle, targetSquare, targetCircle }; var map = new ShapeMap(targetShapes); return(map); }
private void Form1_Load(object sender, EventArgs e) { GenerateImage(); startmap = Test(); }