public bool SetMode(MeasureMode mode) { switch (mode) { case MeasureMode.CHARGE: if (GetResponse(Messages.MEASURE_DOSE) == Messages.MEASURE_DOSE) { return(true); } break; case MeasureMode.CHARGE_RATE: if (GetResponse(Messages.MESAURE_DOSERATE) == Messages.MESAURE_DOSERATE) { return(true); } break; case MeasureMode.INT_DOSE_RATE: if (GetResponse(Messages.MESAURE_INTEGRATED) == Messages.MESAURE_INTEGRATED) { return(true); } break; } return(false); }
private bool GetMeasureModeResult(object value, object parameter) { bool result = false; MeasureMode measureMode = (MeasureMode)value; switch (measureMode) { case MeasureMode.Line: switch (parameter.ToString()) { case "MeasureLine": result = true; break; case "MeasurePolygon": result = false; break; } break; case MeasureMode.Polygon: switch (parameter.ToString()) { case "MeasureLine": result = false; break; case "MeasurePolygon": result = true; break; } break; } return(result); }
public async void calibrate(Action func, CancellationToken token, MeasureMode mode, string calibtype) { btnCancelCalibration.Visibility = Visibility.Visible; btnCalibrateIn.Visibility = Visibility.Hidden; btnCalibrateOut.Visibility = Visibility.Hidden; btnCalibrateLo.Visibility = Visibility.Hidden; log("start calibrate: " + mode + ", " + calibtype); var stopwatch = Stopwatch.StartNew(); dataTable = ((DataView)dataGrid.ItemsSource).ToTable(); calibrationTask = Task.Run(func, token); dataGrid.ItemsSource = dataTable.AsDataView(); await calibrationTask; btnCancelCalibration.Visibility = Visibility.Hidden; btnCalibrateIn.Visibility = Visibility.Visible; btnCalibrateOut.Visibility = Visibility.Visible; btnCalibrateLo.Visibility = Visibility.Visible; stopwatch.Stop(); log("end calibrate, run time: " + Math.Round(stopwatch.Elapsed.TotalMilliseconds / 1000, 2) + " sec"); sndAlert?.Play(); MessageBox.Show("Done."); }
protected internal override Vector2 DoMeasure(float desiredWidth, MeasureMode widthMode, float desiredHeight, MeasureMode heightMode) { float measuredWidth = float.NaN; float measuredHeight = float.NaN; Texture current = image; if (current == null) { return(new Vector2(measuredWidth, measuredHeight)); } // covers the MeasureMode.Exactly case Rect rect = sourceRect; bool hasImagePosition = rect != Rect.zero; measuredWidth = hasImagePosition ? rect.width : current.width; measuredHeight = hasImagePosition ? rect.height : current.height; if (widthMode == MeasureMode.AtMost) { measuredWidth = Mathf.Min(measuredWidth, desiredWidth); } if (heightMode == MeasureMode.AtMost) { measuredHeight = Mathf.Min(measuredHeight, desiredHeight); } return(new Vector2(measuredWidth, measuredHeight)); }
protected override void Start() { base.Start(); valueText.text = ""; mode = MeasureMode.line; trackerLetter = "Z"; }
protected internal override Vector2 DoMeasure(float desiredWidth, MeasureMode widthMode, float desiredHeight, MeasureMode heightMode) { float measuredWidth = float.NaN; float measuredHeight = float.NaN; if (widthMode != MeasureMode.Exactly || heightMode != MeasureMode.Exactly) { var evt = new Event { type = EventType.Layout }; var layoutRect = layout; // Make sure the right width/height will be used at the final stage of the calculation switch (widthMode) { case MeasureMode.Exactly: layoutRect.width = desiredWidth; break; } switch (heightMode) { case MeasureMode.Exactly: layoutRect.height = desiredHeight; break; } // When computing layout it's important to not call GetCurrentTransformAndClip // because it will remove the dirty flag on the container transform which might // set the transform in an invalid state. That's why we have to pass // cached transform and clipping state here. It's still important to not // pass Rect.zero for the clipping rect as this eventually sets the // global GUIClip.visibleRect which IMGUI code could be using to influence // size. See case 1111923 and 1158089. DoOnGUI(evt, m_CachedTransform, m_CachedClippingRect, true, layoutRect, onGUIHandler, true); measuredWidth = layoutMeasuredWidth; measuredHeight = layoutMeasuredHeight; } switch (widthMode) { case MeasureMode.Exactly: measuredWidth = desiredWidth; break; case MeasureMode.AtMost: measuredWidth = Mathf.Min(measuredWidth, desiredWidth); break; } switch (heightMode) { case MeasureMode.Exactly: measuredHeight = desiredHeight; break; case MeasureMode.AtMost: measuredHeight = Mathf.Min(measuredHeight, desiredHeight); break; } return(new Vector2(measuredWidth, measuredHeight)); }
protected internal override Vector2 DoMeasure(float width, MeasureMode widthMode, float height, MeasureMode heightMode) { GraphView graphView = GetFirstAncestorOfType <GraphView>(); VisualElement viewport = graphView.contentViewContainer; contentRectInViewportSpace = Rect.zero; // Compute the bounding box of the content of the scope in viewport space (because nodes are not parented by the scope that contains them) foreach (GraphElement subElement in containedElements) { if (subElement.panel != panel) { continue; } Rect boundingRect = new Rect(0, 0, subElement.GetPosition().width, subElement.GetPosition().height); if (Scope.IsValidRect(boundingRect)) { boundingRect = subElement.ChangeCoordinatesTo(viewport, boundingRect); // Use the first element with a valid geometry as reference to compute the bounding box of contained elements if (!Scope.IsValidRect(contentRectInViewportSpace)) { contentRectInViewportSpace = boundingRect; } else { contentRectInViewportSpace = RectUtils.Encompass(contentRectInViewportSpace, boundingRect); } } } return(new Vector2(contentRectInViewportSpace.width, contentRectInViewportSpace.height)); }
private MeasureSpec( float size, MeasureMode mode) { this.Size = size; this.Mode = mode; }
private static SizeF _measureCeil(YogaNode node, float width, MeasureMode widthMode, float height, MeasureMode heightMode) { return(new SizeF(width = 10.5f, height = 10.5f)); }
private static SizeF _measure_90_10(YogaNode node, float width, MeasureMode widthMode, float height, MeasureMode heightMode) { return(new SizeF(width = 90, height = 10)); }
private void cbMeasure_SelectedIndexChanged(object sender, EventArgs e) { chartMain.SeriesVisibilityChanged -= chartMain_SeriesVisibilityChanged; isChangeFromLegend = false; if (_currencies != null) { _measureMode = (MeasureMode)cbMeasure.SelectedIndex; foreach (var currency in _currencies) { switch (_measureMode) { case MeasureMode.ExchangeRate: //Display ExchangeRate if %age change is already visbile if (Utils.IsVisible(currency.PercentageChangeSeries)) { currency.ExchangeRateSeries.Visibility = SeriesVisibility.Visible; } else { currency.ExchangeRateSeries.Visibility = SeriesVisibility.Legend; } //Hide %age Change currency.PercentageChangeSeries.Visibility = SeriesVisibility.Hidden; break; case MeasureMode.PercentageChange: //Display %age Change if the ExchangeRate is already visbile if (Utils.IsVisible(currency.ExchangeRateSeries)) { currency.PercentageChangeSeries.Visibility = SeriesVisibility.Visible; } else { currency.PercentageChangeSeries.Visibility = SeriesVisibility.Legend; } //Hide ExchangeRate currency.ExchangeRateSeries.Visibility = SeriesVisibility.Hidden; break; case MeasureMode.Both: if (Utils.IsVisible(currency.ExchangeRateSeries) || Utils.IsVisible(currency.PercentageChangeSeries)) { currency.PercentageChangeSeries.Visibility = SeriesVisibility.Plot; currency.ExchangeRateSeries.Visibility = SeriesVisibility.Visible; } else { currency.PercentageChangeSeries.Visibility = SeriesVisibility.Hidden; currency.ExchangeRateSeries.Visibility = SeriesVisibility.Legend; } break; } } UpdateChartView(); } isChangeFromLegend = true; chartMain.SeriesVisibilityChanged += chartMain_SeriesVisibilityChanged; }
private static SizeF _measure2( YogaNode node, float width, MeasureMode widthMode, float height, MeasureMode heightMode) { return(new SizeF(width = 279, height = 126)); }
public void UseMeters() { ActiveMeasureMode = MeasureMode.Meter; if (_activeLine != null) { SetLengthText(_activeLine.RawLengthDirty); } }
internal void ResetToDefault() { this.availableHeight = 0; this.availableWidth = 0; this.widthMeasureMode = MeasureMode.Undefined; this.heightMeasureMode = MeasureMode.Undefined; this.computedWidth = -1; this.computedHeight = -1; }
private static SizeF _measure1( YogaNode node, float width, MeasureMode widthMode, float height, MeasureMode heightMode) { return(new SizeF(width = 42, height = 50)); }
protected internal override Vector2 DoMeasure(float width, MeasureMode widthMode, float height, MeasureMode heightMode) { float measuredWidth = float.NaN; float measuredHeight = float.NaN; Font usedFont = style.font; if (text == null || usedFont == null) { return(new Vector2(measuredWidth, measuredHeight)); } var stylePainter = elementPanel.stylePainter; if (widthMode == MeasureMode.Exactly) { measuredWidth = width; } else { var textParams = stylePainter.GetDefaultTextParameters(this); textParams.text = text; textParams.font = usedFont; textParams.wordWrapWidth = 0.0f; textParams.wordWrap = false; textParams.richText = true; measuredWidth = stylePainter.ComputeTextWidth(textParams); if (widthMode == MeasureMode.AtMost) { measuredWidth = Mathf.Min(measuredWidth, width); } } if (heightMode == MeasureMode.Exactly) { measuredHeight = height; } else { var textParams = stylePainter.GetDefaultTextParameters(this); textParams.text = text; textParams.font = usedFont; textParams.wordWrapWidth = measuredWidth; textParams.richText = true; measuredHeight = stylePainter.ComputeTextHeight(textParams); if (heightMode == MeasureMode.AtMost) { measuredHeight = Mathf.Min(measuredHeight, height); } } return(new Vector2(measuredWidth, measuredHeight)); }
private static SizeF _measure_assert_negative(YogaNode node, float width, MeasureMode widthMode, float height, MeasureMode heightMode) { Assert.IsTrue(width >= 0); Assert.IsTrue(height >= 0); return(new SizeF(width = 0, height = 0)); }
protected internal override Vector2 DoMeasure(float desiredWidth, MeasureMode widthMode, float desiredHeight, MeasureMode heightMode) { var textToMeasure = text; if (string.IsNullOrEmpty(textToMeasure)) { textToMeasure = " "; } return(MeasureTextSize(textToMeasure, desiredWidth, widthMode, desiredHeight, heightMode)); }
private static SizeF _measure(YogaNode node, float width, MeasureMode widthMode, float height, MeasureMode heightMode) { return(new SizeF( width = widthMode == MeasureMode.Exactly ? width : 50, height = heightMode == MeasureMode.Exactly ? height : 50 )); }
public PerformanceMonitorBeeper(PerformanceMonitor pm, MonitorMode monitorMode, MeasureMode measureMode, int cpuThreshold, int memoryThreshold) { _pm = pm; _cpuThreshold = cpuThreshold; _memoryThreshold = memoryThreshold; _timer = new Timer(1000) {AutoReset = false}; _timer.Elapsed += (sender, eventArgs) => OnTimer(); InitializeMonitorStrategy(monitorMode, measureMode); }
/// <summary> /// Creates a new instance of MeasureDialog /// </summary> public MeasureDialog() { InitializeComponent(); _measureMode = MeasureMode.Distance; cmbUnits.Items.AddRange(_distanceUnitNames); cmbUnits.SelectedIndex = 1; _distanceUnitIndex = 1; _areaUnitIndex = 2; _distIntoMeters = 1; _areaIntoSquareMeters = 1; }
protected internal override Vector2 DoMeasure(float desiredWidth, MeasureMode widthMode, float desiredHeight, MeasureMode heightMode) { // If the text is empty, we should make sure it returns at least the height/width of 1 character... var textToUse = m_Text; if (string.IsNullOrEmpty(textToUse)) { textToUse = " "; } return(TextElement.MeasureVisualElementTextSize(this, textToUse, desiredWidth, widthMode, desiredHeight, heightMode)); }
public bool ReadNewestData(MeasureMode measureMode, bool rightEye) { data.actualSequence = -1; if (measureMode == MeasureMode.Forward && File.Exists(pathInternal)) // forward only! { ReadSequences(); int recordNo = -1; StreamReader fs = new StreamReader(pathInternal); string csv_line; char[] charSeparators = new char[] { ';' }; while ((csv_line = fs.ReadLine()) != null) { var elements = csv_line.Split(charSeparators, StringSplitOptions.None); try { MeasureMode mode = SettingsViewModel.ParseMeasureMode(elements[3]); if (mode == _measureMode && Boolean.Parse(elements[4]) == rightEye && (elements.Length < 8 || Boolean.Parse(elements[7]) == false)) // not deleted? { recordNo = int.Parse(elements[0]); } } catch (FormatException e) { } } fs.Close(); for (int seqIdx = _sequences.Count - 1; recordNo > 0 && seqIdx >= 0; seqIdx--) { if (_sequences[seqIdx] == recordNo) { data.actualSequence = seqIdx; break; } } if (recordNo >= 0) { ReadData(); return(true); } } return(false); }
private static SizeF _measure_84_49(YogaNode node, float width, MeasureMode widthMode, float height, MeasureMode heightMode) { var measureCount = (int)node.Context; node.Context = ++measureCount; return(new SizeF(width = 84f, height = 49f)); }
void HandleMeasureModesSelectionChanged(object sender, SelectionChangedEventArgs e) { isChangeFromLegend = false; if (_viewModel.Currencies != null) { _measureMode = (MeasureMode)cbMeasureModes.SelectedValue; foreach (var currency in _viewModel.Currencies) { switch (_measureMode) { case MeasureMode.ExchangeRate: if (Utils.IsVisible(currency.PercentageChangeSeries)) { currency.ExchangeRateSeries.Visibility = SeriesVisibility.Visible; } else { currency.ExchangeRateSeries.Visibility = SeriesVisibility.Legend; } currency.PercentageChangeSeries.Visibility = SeriesVisibility.Hidden; break; case MeasureMode.PercentageChange: if (Utils.IsVisible(currency.ExchangeRateSeries)) { currency.PercentageChangeSeries.Visibility = SeriesVisibility.Visible; } else { currency.PercentageChangeSeries.Visibility = SeriesVisibility.Legend; } currency.ExchangeRateSeries.Visibility = SeriesVisibility.Hidden; break; case MeasureMode.Both: if (Utils.IsVisible(currency.ExchangeRateSeries) || Utils.IsVisible(currency.PercentageChangeSeries)) { currency.ExchangeRateSeries.Visibility = SeriesVisibility.Visible; currency.PercentageChangeSeries.Visibility = SeriesVisibility.Plot; } else { currency.PercentageChangeSeries.Visibility = SeriesVisibility.Hidden; currency.ExchangeRateSeries.Visibility = SeriesVisibility.Legend; } break; } } UpdateChartView(); } isChangeFromLegend = true; }
public static bool StringToMeasureMode(string value, out MeasureMode result) { switch (value) { case "undefined": result = MeasureMode.Undefined; return(true); case "exactly": result = MeasureMode.Exactly; return(true); case "at-most": result = MeasureMode.AtMost; return(true); } result = MeasureMode.Undefined; return(false); }
private static SizeF _simulate_wrapping_text(YogaNode node, float width, MeasureMode widthMode, float height, MeasureMode heightMode) { if (widthMode == MeasureMode.Undefined || width >= 68) { return(new SizeF(width = 68, height = 16)); } return(new SizeF(width = 50, height = 32)); }
public bool SetMode(MeasureMode mode) { var success = false; switch (mode) { case MeasureMode.CHARGE: mes.SendMessage("*CHGMAX?", resp => ProcessMax4000Response(resp, out success, this.Logger)); break; case MeasureMode.CHARGE_RATE: mes.SendMessage("*RTCHG?", resp => ProcessMax4000Response(resp, out success, this.Logger)); break; case MeasureMode.TRIGGERED: mes.SendMessage("*CHGTHR?", resp => ProcessMax4000Response(resp, out success, this.Logger)); break; } return(success); }
private static SizeF _measureMin(YogaNode node, float width, MeasureMode widthMode, float height, MeasureMode heightMode) { var measureCount = (int)node.Context; node.Context = ++measureCount; return(new SizeF( width = widthMode == MeasureMode.Undefined || widthMode == MeasureMode.AtMost && width > 10 ? 10 : width, height = heightMode == MeasureMode.Undefined || heightMode == MeasureMode.AtMost && height > 10 ? 10 : height )); }
private void InitializeMonitorStrategy(MonitorMode monitorMode, MeasureMode measureMode) { if (monitorMode == MonitorMode.Instant) { _monitorStrategy = Program.Container.Resolve<InstantMonitorStrategy>(new TypedParameter(typeof(MeasureMode), measureMode)); } else { _monitorStrategy = Program.Container.Resolve<SustainedMonitorStrategy>(new TypedParameter(typeof(MeasureMode), measureMode)); } Console.WriteLine("Set monitor mode to: {0}", monitorMode.Humanize()); Console.WriteLine("Set measure mode to: {0}", measureMode.Humanize()); }
// MeasureModeToString returns string version of MeasureMode enum public static string MeasureModeToString(MeasureMode value) { switch (value) { case MeasureMode.Undefined: return("undefined"); case MeasureMode.Exactly: return("exactly"); case MeasureMode.AtMost: return("at-most"); } return("unknown"); }
private void DistanceButton_Click(object sender, EventArgs e) { if (_measureMode != MeasureMode.Distance) { MeasureMode = MeasureMode.Distance; _areaUnitIndex = cmbUnits.SelectedIndex; cmbUnits.SuspendLayout(); cmbUnits.Items.Clear(); cmbUnits.Items.AddRange(_distanceUnitNames); cmbUnits.SelectedIndex = _distanceUnitIndex; cmbUnits.ResumeLayout(); OnMeasureModeChanged(); Text = "Measure Distance"; lblMeasure.Text = "Distance"; tsbArea.Checked = false; } }
public MainWindowViewModel(WpfMap map) { dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Interval = TimeSpan.FromMilliseconds(5000); dispatcherTimer.Tick += AutoRefreshTimer_Tick; vehicles = new ObservableCollection<VehicleViewModel>(); unitSystems = new Collection<UnitSystem>(); unitSystems.Add(UnitSystem.Imperial); unitSystems.Add(UnitSystem.Metric); selectedUnitSystem = UnitSystem.Metric; autoRefreshMode = AutoRefreshMode.On; autoRefresh = true; drawFenceMode = DrawFenceMode.DrawNewFence; measureMode = MeasureMode.Line; mapMode = ControlMapMode.Pan; measurePanelVisibility = Visibility.Collapsed; editPanelVisibility = Visibility.Collapsed; MapControl = map; dispatcherTimer.Start(); }
public SustainedMonitorStrategy(MeasureMode measureMode) { _measureMode = measureMode; }
public InstantMonitorStrategy(MeasureMode measureMode) { _measureMode = measureMode; }