private void button4_Click(object sender, EventArgs e) { AutoRescale = false; try { YMax = Double.Parse(textBox2.Text); } catch (System.FormatException) { textBox2.Text = YMax.ToString("F0"); } try { YMin = Double.Parse(textBox3.Text); } catch (System.FormatException) { textBox3.Text = YMin.ToString("F0"); } try { XMin = Double.Parse(textBox4.Text); } catch (System.FormatException) { textBox4.Text = XMin.ToString("F0"); } try { XMax = Double.Parse(textBox5.Text); } catch (System.FormatException) { textBox5.Text = XMax.ToString("F0"); } PlotRescale(); }
public override int GetHashCode() => XMin.GetHashCode() ^ YMin.GetHashCode() ^ XMax.GetHashCode() ^ YMax.GetHashCode() ^ ZMin.GetHashCode() ^ ZMax.GetHashCode() ^ MMin.GetHashCode() ^ MMax.GetHashCode();
protected override IEnumerator ProcessPayload(VisualPayload payload) { //payload.ClearBoundVisualizer(); var volume = VisualizerFactory.InstantiateRectangularVolume(); //payload.GetTargetBound().ChildWithinBound(volume.transform); //.BoundedVisual = volume; volume.Initialize(this, payload); volume.SetOpaqueMaterial(UseOpaqueMaterial.GetFirstValue(payload.Data)); var xProportion = XAxis.GetFirstValue(payload.Data); if (XMax.CouldResolve(payload.Data) && XMax.GetFirstValue(payload.Data) > .001f) { xProportion = xProportion / XMax.GetFirstValue(payload.Data); } var yProportion = YAxis.GetFirstValue(payload.Data); if (YMax.CouldResolve(payload.Data) && YMax.GetFirstValue(payload.Data) > .001f) { yProportion = yProportion / YMax.GetFirstValue(payload.Data); } var zProportion = ZAxis.GetFirstValue(payload.Data); if (ZMax.CouldResolve(payload.Data) && ZMax.GetFirstValue(payload.Data) > .001f) { zProportion = zProportion / ZMax.GetFirstValue(payload.Data); } volume.Xscale = xProportion; volume.Yscale = yProportion; volume.Zscale = zProportion; volume.Color = Color.GetFirstValue(payload.Data); var newPayload = new VisualPayload(payload.Data, new VisualDescription(volume.Bound)); var iterator = Router.TransmitAll(newPayload); while (iterator.MoveNext()) { yield return(null); } }
private void UpdateGraph() { if (Curve != null) { if (Curve.IsVirtual) {//We can't display this IsEnabled = false; ShowDisabled(); canvas.Visibility = Visibility.Visible; return; } var doubleMinX = Curve.XData.Min(); var doubleMaxX = Curve.XData.Max(); double xScale = canvas.ActualWidth / (doubleMaxX - doubleMinX); var doubleMinY = YMin.GetValueOrDefault(Math.Min(Curve.YData.Min(), 0)); var doubleMaxY = YMax.GetValueOrDefault(Curve.YData.Max()); double yScale = canvas.ActualHeight / (doubleMaxY - doubleMinY); myLine.Points.Clear(); foreach (var tuple in Curve.GetData()) { var x = (tuple.Item1 - doubleMinX) * xScale; var y = canvas.ActualHeight - ((tuple.Item2 - doubleMinY) * yScale); myLine.Points.Add(new Point(x, y)); } xAxis.X1 = 0; xAxis.X2 = canvas.ActualWidth; xAxis.Y1 = canvas.ActualHeight - ((-doubleMinY) * yScale); xAxis.Y2 = xAxis.Y1; yAxis.X1 = 0; yAxis.X2 = 0; yAxis.Y1 = canvas.ActualHeight; yAxis.Y2 = 0; IsEnabled = true; canvas.Visibility = Visibility.Visible; } else { canvas.Visibility = Visibility.Hidden; } nameGroup.Visibility = canvas.Visibility; }
// Start is called before the first frame update void Start() { Camera myCamera = Camera.main; XMin = myCamera.ViewportToWorldPoint(new Vector3(0, 0, 0)).x + padding; Debug.Log("XMin: " + XMin.ToString()); XMax = myCamera.ViewportToWorldPoint(new Vector3(1, 0, 0)).x - padding; Debug.Log("XMax: " + XMax.ToString()); YMin = myCamera.ViewportToWorldPoint(new Vector3(0, 0, 0)).y + padding; Debug.Log("YMin: " + YMin.ToString()); YMax = myCamera.ViewportToWorldPoint(new Vector3(0, 1, 0)).y - padding; Debug.Log("YMax: " + YMax.ToString()); // myCirclePrefab = (GameObject)Resources.Load("Circle"); Instantiate(myCirclePrefab, new Vector3(XMin, YMin, 0), Quaternion.identity); Instantiate(myCirclePrefab, new Vector3(XMin, YMax, 0), Quaternion.identity); Instantiate(myCirclePrefab, new Vector3(XMax, YMin, 0), Quaternion.identity); Instantiate(myCirclePrefab, new Vector3(XMax, YMax, 0), Quaternion.identity); }
public virtual void Grid(System.Windows.Forms.PaintEventArgs e) { try { SolidBrush.Color = GridColor; e.Graphics.FillRectangle(SolidBrush, XPos, YPos, Width, Height); if (ShowMinMax) { bool fontcreated = false; System.Globalization.NumberFormatInfo nfi = System.Globalization.NumberFormatInfo.CurrentInfo; System.Globalization.RegionInfo ri = System.Globalization.RegionInfo.CurrentRegion; if (TextFont == null) { TextFont = new System.Drawing.Font(System.Drawing.FontFamily.GenericSansSerif.Name, 7, System.Drawing.FontStyle.Bold); fontcreated = true; } if (IsCurrency) { e.Graphics.DrawString(YMax.ToString("n", nfi) + " " + ri.ISOCurrencySymbol, TextFont, TextBrush, XPos, YPos); e.Graphics.DrawString(YMin.ToString("n", nfi) + " " + ri.ISOCurrencySymbol, TextFont, TextBrush, XPos, YPos + Height - TextFont.Height); } else { e.Graphics.DrawString(YMax.ToString("n", nfi), TextFont, TextBrush, XPos, YPos); e.Graphics.DrawString(YMin.ToString("n", nfi), TextFont, TextBrush, XPos, YPos + Height - TextFont.Height); } if (fontcreated) { TextFont.Dispose(); TextFont = null; } } } catch (System.Exception ex) { throw ex; } }
public override string ToString() { return($"{XMin.ToString(CultureInfo.InvariantCulture)},{YMin.ToString(CultureInfo.InvariantCulture)},{ZMin.ToString(CultureInfo.InvariantCulture)},{XMax.ToString((CultureInfo.InvariantCulture))},{YMax.ToString((CultureInfo.InvariantCulture))},{ZMax.ToString((CultureInfo.InvariantCulture))}"); }
public override string ToString() { return(XMin.ToString() + "," + YMin.ToString() + "," + XMax.ToString() + "," + YMax.ToString()); }
get => new Int32Rect(XMin, YMin, XMax - XMin, YMax - YMin);
private void ChangeOperationMode(int NewMode) { if (OperationMode == NewMode) { return; } if (NewMode == MODE_IDLE) { if (OutputFile != null) { OutputFile.Close(); } button2.Enabled = false; button3.Enabled = false; textBox1.Enabled = true; timer1.Enabled = false; OperationMode = MODE_IDLE; } if (NewMode == MODE_MAIN) { SerialWriteBuffer[0] = 'm'; StartExperiment = DateTime.Now; FileName = String.Format("polar{0,4:0000}_{1,2:00}_{2,2:00}-{3,2:00}_{4,2:00}_{5,2:00}.out", StartExperiment.Year, StartExperiment.Month, StartExperiment.Day, StartExperiment.Hour, StartExperiment.Minute, StartExperiment.Second); if (OutputFile != null) { OutputFile.Close(); } OutputFile = new StreamWriter(FileName); // create file OutputFile.Close(); label1.Text = FileName; YMIN = 0; YMAX = 0; NPlot1 = new LinePlot(); NPoints = 0; AutoRescale = true; XX = new double[1]; YY = new double[1]; NPlot1.AbscissaData = XX; NPlot1.DataSource = YY; plotSurface2D1.Clear(); plotSurface2D1.Add(NPlot1); button2.Enabled = true; button3.Enabled = true; button3.Text = "Scan"; timer1.Interval = 100; timer1.Enabled = true; textBox1.Enabled = false; OperationMode = MODE_MAIN; TakeEachPoint = 1; TakeEachPointNow = 0; } if (NewMode == SCAN_CELL) { //SerialWriteBuffer[0] = 'm'; StartExperiment = DateTime.Now; AutoRescale = true; FileName = String.Format("scan{0,4:0000}_{1,2:00}_{2,2:00}-{3,2:00}_{4,2:00}_{5,2:00}.out", StartExperiment.Year, StartExperiment.Month, StartExperiment.Day, StartExperiment.Hour, StartExperiment.Minute, StartExperiment.Second); if (OutputFile != null) { OutputFile.Close(); } OutputFile = new StreamWriter(FileName); OutputFile.Close(); label1.Text = FileName; YMIN = -3.0; YMAX = 3.0; NPlot1 = new LinePlot(); NPoints = 0; XX = new double[1]; YY = new double[1]; NPlot1.AbscissaData = XX; NPlot1.DataSource = YY; plotSurface2D1.Clear(); plotSurface2D1.Add(NPlot1); plotSurface2D1.XAxis1.WorldMin = -0.5; plotSurface2D1.XAxis1.WorldMax = 10.5; plotSurface2D1.YAxis1.WorldMin = -3.0; plotSurface2D1.YAxis1.WorldMax = 0.5; XMin = -0.5; XMax = 10.5; YMin = -2.5; YMax = 0.5; textBox2.Text = YMax.ToString(); textBox3.Text = YMin.ToString(); textBox4.Text = XMin.ToString(); textBox5.Text = XMax.ToString(); plotSurface2D1.Refresh(); button2.Enabled = true; button3.Enabled = true; button3.Text = "Stop Scan"; timer1.Interval = 100; timer1.Enabled = true; textBox1.Enabled = false; OperationMode = SCAN_CELL; } }
private void PlotRescale() { if (AutoRescale) { if (OperationMode == MODE_MAIN) { plotSurface2D1.XAxis1.WorldMin = 0; plotSurface2D1.XAxis1.WorldMax = time; plotSurface2D1.YAxis1.WorldMin = YMIN; plotSurface2D1.YAxis1.WorldMax = YMAX; plotSurface2D1.XAxis1.WorldMin -= plotSurface2D1.XAxis1.WorldLength * 0.1; plotSurface2D1.XAxis1.WorldMax += plotSurface2D1.XAxis1.WorldLength * 0.5; plotSurface2D1.YAxis1.WorldMin -= plotSurface2D1.YAxis1.WorldLength * 0.1; plotSurface2D1.YAxis1.WorldMax += plotSurface2D1.YAxis1.WorldLength * 0.1; textBox2.Text = plotSurface2D1.YAxis1.WorldMax.ToString("F0"); textBox3.Text = plotSurface2D1.YAxis1.WorldMin.ToString("F0"); textBox4.Text = plotSurface2D1.XAxis1.WorldMin.ToString("F0"); textBox5.Text = plotSurface2D1.XAxis1.WorldMax.ToString("F0"); XMin = plotSurface2D1.XAxis1.WorldMin; XMax = plotSurface2D1.XAxis1.WorldMax; YMin = plotSurface2D1.YAxis1.WorldMin; YMax = plotSurface2D1.YAxis1.WorldMax; textBox2.BackColor = SystemColors.Menu; textBox3.BackColor = SystemColors.Menu; textBox4.BackColor = SystemColors.Menu; textBox5.BackColor = SystemColors.Menu; plotSurface2D1.Refresh(); } if (OperationMode == SCAN_CELL) { plotSurface2D1.XAxis1.WorldMin = 0; plotSurface2D1.XAxis1.WorldMax = time; plotSurface2D1.YAxis1.WorldMin = YMIN; plotSurface2D1.YAxis1.WorldMax = YMAX; plotSurface2D1.XAxis1.WorldMin -= plotSurface2D1.XAxis1.WorldLength * 0.1; plotSurface2D1.XAxis1.WorldMax += plotSurface2D1.XAxis1.WorldLength * 0.5; plotSurface2D1.YAxis1.WorldMin -= plotSurface2D1.YAxis1.WorldLength * 0.1; plotSurface2D1.YAxis1.WorldMax += plotSurface2D1.YAxis1.WorldLength * 0.1; plotSurface2D1.XAxis1.WorldMin -= plotSurface2D1.XAxis1.WorldLength * 0.1; plotSurface2D1.XAxis1.WorldMax += plotSurface2D1.XAxis1.WorldLength * 0.5; plotSurface2D1.YAxis1.WorldMin -= plotSurface2D1.YAxis1.WorldLength * 0.1; plotSurface2D1.YAxis1.WorldMax += plotSurface2D1.YAxis1.WorldLength * 0.1; textBox2.Text = YMax.ToString("F0"); textBox3.Text = YMin.ToString("F0"); textBox4.Text = XMin.ToString("F0"); textBox5.Text = XMax.ToString("F0"); textBox2.BackColor = SystemColors.Menu; textBox3.BackColor = SystemColors.Menu; textBox4.BackColor = SystemColors.Menu; textBox5.BackColor = SystemColors.Menu; plotSurface2D1.Refresh(); } } else { plotSurface2D1.XAxis1.WorldMin = XMin; plotSurface2D1.XAxis1.WorldMax = XMax; plotSurface2D1.YAxis1.WorldMin = YMin; plotSurface2D1.YAxis1.WorldMax = YMax; textBox2.BackColor = SystemColors.Window; textBox3.BackColor = SystemColors.Window; textBox4.BackColor = SystemColors.Window; textBox5.BackColor = SystemColors.Window; plotSurface2D1.Refresh(); } }
public bool Equals(FreeTypeBounds other) => XMin.Equals(other.XMin) && YMin.Equals(other.YMin) && XMax.Equals(other.XMax) && YMax.Equals(other.YMax);