public void AddMeasureState(MeasureState state) { int color = ConfigManager.AuxiliaryGroup().Color; measureMap.Add(state.measure, state); AddState(state, measureStates, color); }
private void SetState(MeasureState state) { _State = state; if (state == MeasureState.READY) { _ViveCtrl.MenuButtonRightColorSet(_ReadyStateColor, false); } if (state == MeasureState.CREATING) { _ViveCtrl.MenuButtonRightColorSet(_ReadyStateColor, true); } if (state == MeasureState.SEARCHING_FIRST) { _ViveCtrl.MenuButtonRightColorSet(_ReadyStateColor, true); } if (state == MeasureState.SEARCHING_SECOND) { _ViveCtrl.MenuButtonRightColorSet(_ReadyStateColor, true); } if (state == MeasureState.DONE) { _ViveCtrl.MenuButtonRightColorSet(_DoneStateColor, false); } if (state == MeasureState.OFF) { _ViveCtrl.MenuButtonRightColorReset(); } }
public void Charge(int sensorId, MeasureState state, bool isAlarm = false) { // Check decay params var sensor = AppManager.ListSensor.FirstOrDefault(s => s.SensorId == sensorId); //if (sensor == null || sensor.DecayUpperValue == 0 || sensor.DecayTimeCheck == 0 || sensor.DecayStopTime == 0) return; //if (isDecayRuning && state == MeasureState.Positive) //{ // ShowMsg(MessageBoxIcon.Warning, "Has one device is running. Please waiting!"); // return; //} // Excecute if (blockThreadProcesses != null) { foreach (var item in blockThreadProcesses) { if (item.BlockData.BlockId == BlockActiceId) { processorCharge.Add(new DataCharge { Sensor = sensor, ChargeState = state, BlockThread = item, IsAlarm = isAlarm }); break; } } } //var AppManager.ListSensor.FirstOrDefault(s => s.SensorId == sensorId); //if (s) }
private MeasureState CreateMeasureState(string title, int index) { var measureState = new MeasureState { Id = Guid.NewGuid(), Index = index, Title = title, }; return(measureState); }
private void AddState(Measure measure) { Type type = Type.GetType(tool.Name + "MeasureState"); if (type != null) { MeasureState measureState = (MeasureState)Activator.CreateInstance(type, tool, measure, geometry); measureState.OnClickDelete = () => geoController.RemoveMeasureOperation(measure); stateController.AddMeasureState(measureState); } }
// Double click event public void MouseRightClick(object sender, MouseEventArgs e) { switch(State) { case MeasureState.Measuring: State = MeasureState.Complete; return; case MeasureState.Complete: multiline.Clear(); State = MeasureState.Idle; return; } }
private void CreateMeasureStates(EnergyNetworkDbContext context) { _open = CreateMeasureState("open", 0); _inProgress = CreateMeasureState("inProgress", 1); _closed = CreateMeasureState("finished", 2); _rejected = CreateMeasureState("rejected", 3); }
public void BeginCalibration() { State = MeasureState.READY; DummyRoot.localScale = Vector3.one; DummyLeftShoulder.localScale = Vector3.one; DummyRightShoulder.localScale = Vector3.one; DummyLeftElbow.localScale = Vector3.one; DummyRightElbow.localScale = Vector3.one; MeasuredShoulder = Vector3.zero; MeasuredElbow = Vector3.zero; MeasuredWrist = Vector3.zero; DebugWallLayer.SetActive(true); CircleController.SetActive(true); UpdateText(); }
public static Facility FillFacility() { var fac = new Facility(); var device = new Device(); var device2 = new Device(); var measurepoint = new MeasurePoint(); var measurestate = new MeasureState(); var measurepoint2 = new MeasurePoint(); var measurestate2 = new MeasureState(); var measurepoint3 = new MeasurePoint(); var measurestate3 = new MeasureState(); var device3 = new Device(); fac.FacilityId = "12345678"; measurestate.AccumulDate = DateTime.Now; measurestate.Value = (decimal)10.5; measurepoint.measureState = measurestate; measurepoint.Medium = "Wasser"; measurepoint.Tarif = 0; measurepoint.Unit = "m^3"; device.MeasurePoints.Add(measurepoint); device.SRC_Id = "00001214"; fac.Devices.Add(device); measurestate2.AccumulDate = DateTime.Now; measurestate2.Value = (decimal)19.5; measurepoint2.measureState = measurestate2; measurepoint2.Medium = "Warmwasser"; measurepoint2.Tarif = 1; measurepoint2.Unit = "m^3"; device2.MeasurePoints.Add(measurepoint2); device2.SRC_Id = "00001215"; fac.Devices.Add(device2); measurestate3.AccumulDate = DateTime.Today; measurestate3.Value = (decimal)1254.54; measurepoint3.measureState = measurestate3; measurepoint3.Medium = "Elektrizität"; measurepoint3.Tarif = 2; measurepoint3.Unit = "kWh"; device3.MeasurePoints.Add(measurepoint3); device3.SRC_Id = "00005715"; fac.Devices.Add(device3); return(fac); }
private void MeasureDistance(XRRayInteractor interactor) { if (measureState == MeasureState.TwoPoints) { ResetPoints(); } else if (interactor.GetCurrentRaycastHit(out RaycastHit rayhit)) { if (measureState == MeasureState.NoPoints) { point1 = rayhit.point; measureState = MeasureState.OnePoint; } else if (measureState == MeasureState.OnePoint) { point2 = rayhit.point; lineDrawer.DrawLine(point1, point2); measureState = MeasureState.TwoPoints; } } }
void TriggerClicked(object sender, ClickedEventArgs args) { DebugCursor.transform.position = MeasureReference.position; switch (State) { case MeasureState.OFF: // Do nothing. return; case MeasureState.READY: MeasuredShoulder = MeasureReference.position; State = MeasureState.MEASURED_SHOULDER; UpdateText(); break; case MeasureState.MEASURED_SHOULDER: MeasuredElbow = MeasureReference.position; State = MeasureState.MEASURED_ELBOW; UpdateText(); break; case MeasureState.MEASURED_ELBOW: MeasuredWrist = MeasureReference.position; State = MeasureState.MEASURED_WRIST; UpdateText(); Calibrate(); DebugWallLayer.SetActive(false); CircleController.SetActive(false); break; case MeasureState.MEASURED_WRIST: // For testing, if the button is clicked after calibrating, reset // so that calibration can be repeated. //BeginCalibration(); break; } }
private void ResetPoints() { lineDrawer.ResetLine(); lineDrawer.enabled = false; measureState = MeasureState.NoPoints; }
public void Measure(SteamVR_Action_Boolean fromAction, SteamVR_Input_Sources fromSource, bool newState) { LineRenderer line = _Line.GetComponent <LineRenderer>(); if (_State == MeasureState.READY && _SnapToPoint) { _State = MeasureState.SEARCHING_FIRST; return; } else if (_State == MeasureState.READY && !_SnapToPoint) { _State = MeasureState.SEARCHING_FIRST; } if (_State == MeasureState.SEARCHING_FIRST) { if (_SnapToPoint) { _NearestPointFound = false; _NearestPoint = _ViveCtrl.GetNearestPointPosition(_MeasurePointer.transform.position); _LinePositions[0] = _NearestPoint; line.SetPosition(0, _NearestPoint); line.startWidth = 0.005f; line.endWidth = 0.005f; _FirstPointSet = true; SetState(MeasureState.SEARCHING_SECOND); return; } else { _LinePositions[0] = _MeasurePointer.transform.position; line.SetPosition(0, _MeasurePointer.transform.position); line.startWidth = 0.005f; line.endWidth = 0.005f; _FirstPointSet = true; SetState(MeasureState.SEARCHING_SECOND); return; } } if (_State == MeasureState.SEARCHING_SECOND) { if (_SnapToPoint) { _NearestPointFound = false; // Reset for next possible line with snap _NearestPoint = _ViveCtrl.GetNearestPointPosition(_MeasurePointer.transform.position); _LinePositions[1] = _NearestPoint; line.SetPosition(1, _NearestPoint); _SecondPointSet = true; SetState(MeasureState.DONE); return; } _SecondPointSet = true; SetState(MeasureState.DONE); return; } if (_State == MeasureState.DONE) { Reset(); SetState(MeasureState.READY); return; } }
void IMeasuredProtoOutput <IBufferWriter <byte> > .Serialize <T>(MeasureState <T> measured, IBufferWriter <byte> destination) => measured.Serialize(destination);
void IMeasuredProtoOutput <Stream> .Serialize <T>(MeasureState <T> measured, Stream destination) => measured.Serialize(destination);
public void MouseUp(object sender, MouseEventArgs e ) { if(!isOn) return; // Test if mouse was clicked and dragged if (mouseDragged()) return; // Check if dialog box has been instantiated then get the measure mod // if not, automatically assign the mode to be single if (World.Settings.MeasureMode == MeasureMode.Multi && multiline == null) multiline = new MeasureMultiLine(); // Cancel selection if right mouse button clicked if (e.Button == MouseButtons.Right) { if(State != MeasureState.Idle && World.Settings.MeasureMode == MeasureMode.Multi) MouseRightClick(sender,e); else { multiline.Clear(); IsOn = false; } return; } // Do nothing for all other mouse buttons clicked if (e.Button != MouseButtons.Left) return; // Don't know if this is best way to do things... if (World.Settings.MeasureMode == MeasureMode.Single) { switch(State) { case MeasureState.Idle: State = MeasureState.Measuring; break; case MeasureState.Measuring: State = MeasureState.Complete; return; case MeasureState.Complete: { multiline.Clear(); State = MeasureState.Idle; return; } } } else if (World.Settings.MeasureMode == MeasureMode.Multi) { switch(State) { case MeasureState.Idle: State = MeasureState.Measuring; break; case MeasureState.Measuring: { State = MeasureState.Measuring; if(multiline.Count>0) this.multiline.deleteLine(); MeasureLine line = new MeasureLine(multiline.Count); line.StartLatitude = this.StartLatitude; line.EndLatitude = this.EndLatitude; line.StartLongitude = this.StartLongitude; line.EndLongitude = this.EndLongitude; line.Calculate(this.m_world,false); this.multiline.addLine(line); break; } case MeasureState.Complete: { State = MeasureState.Idle; return; } } } m_drawArgs.WorldCamera.PickingRayIntersection( e.X, e.Y, out StartLatitude, out StartLongitude); EndLatitude = StartLatitude; EndLongitude = StartLongitude; measureLine[0].X = (MathEngine.SphericalToCartesian(StartLatitude, StartLongitude, m_drawArgs.WorldCamera.WorldRadius)).X; measureLine[0].Y = (MathEngine.SphericalToCartesian(StartLatitude, StartLongitude, m_drawArgs.WorldCamera.WorldRadius)).Y; measureLine[0].Z = (MathEngine.SphericalToCartesian(StartLatitude, StartLongitude, m_drawArgs.WorldCamera.WorldRadius)).Z; MeasureLine newline = new MeasureLine(multiline.Count); newline.StartLatitude = this.StartLatitude; newline.EndLatitude = this.EndLatitude; newline.StartLongitude = this.StartLongitude; newline.EndLongitude = this.EndLongitude; newline.Calculate(this.m_world,false); this.multiline.addLine(newline); }