/// Returns the data value in the specified cell, or null if the cell /// contains no data internal double?GetCellValue(POV pov) { double amount = 0; int status = 0; if (HFM.HasVariableCustoms) { #if HFM_11_1_2_2 HFM.Try("Getting cell data value for {0}", pov, () => _hsvData.GetCellExtDim(pov.HfmPovCOM, out amount, out status)); #else HFM.ThrowIncompatibleLibraryEx(); #endif } else { HFM.Try("Getting cell data value for {0}", pov, () => _hsvData.GetCell(pov.Scenario.Id, pov.Year.Id, pov.Period.Id, pov.View.Id, pov.Entity.Id, pov.Entity.ParentId, pov.Value.Id, pov.Account.Id, pov.ICP.Id, pov.Custom1.Id, pov.Custom2.Id, pov.Custom3.Id, pov.Custom4.Id, out amount, out status)); } if (ECalcStatus.NoData.IsSet(status)) { return(null); } else { return(amount); } }
protected override void GetHistory(POV pov, IOutput output) { object oDates = null, oUsers = null, oActions = null, oStates = null, oAnnotations = null, oPaths = null, oFiles = null; if (HFM.HasVariableCustoms) { #if HFM_11_1_2_2 HFM.Try("Retrieving process history for {0}", pov, () => _hsvProcessFlow.PhasedSubmissionGetHistory2ExtDim(pov.HfmPovCOM, out oDates, out oUsers, out oActions, out oStates, out oAnnotations, out oPaths, out oFiles)); #else HFM.ThrowIncompatibleLibraryEx(); #endif } else { HFM.Try("Retrieving process history {0}", pov, () => _hsvProcessFlow.PhasedSubmissionGetHistory2(pov.Scenario.Id, pov.Year.Id, pov.Period.Id, pov.Entity.Id, pov.Entity.ParentId, pov.Value.Id, pov.Account.Id, pov.ICP.Id, pov.Custom1.Id, pov.Custom2.Id, pov.Custom3.Id, pov.Custom4.Id, out oDates, out oUsers, out oActions, out oStates, out oAnnotations, out oPaths, out oFiles)); } OutputHistory(output, pov, oDates, oUsers, oActions, oStates, oAnnotations, oPaths, oFiles); }
/// <summary> /// Initialize the device /// </summary> /// <returns>Returns true if initializng was successfully</returns> internal bool Init() { //buttons Button[] buttons = new Button[2]; buttons[0] = new Button(JoystickButtons.Button1, 0); buttons[1] = new Button(JoystickButtons.Button2, 1); //axes Axis[] axes = new Axis[1]; axes[0] = new JoystickInputDevice.Axis(JoystickAxes.X, new Range(-1, 1), false); //povs POV[] povs = new POV[0]; //povs[ 0 ] = new JoystickInputDevice.POV( JoystickPOVs.POV1 ); //sliders Slider[] sliders = new Slider[0]; //sliders[ 0 ] = new Slider( JoystickSliders.Slider1 ); //forceFeedbackController ForceFeedbackController forceFeedbackController = null; //initialize data InitDeviceData(buttons, axes, povs, sliders, forceFeedbackController); return(true); }
/// Returns a bit-field representing the cell metadata etc status internal int GetCellStatus(POV pov) { int status = -1; int extStatus = -1; int valueId = pov.IsSpecified(EDimension.Value) ? pov.Value.Id : pov.Entity.DefaultCurrencyId; if (HFM.HasVariableCustoms) { #if HFM_11_1_2_2 HFM.Try("Retrieving cell status for {0}", pov, () => _hsvData.GetStatusExExtDim(pov.HfmPovCOM, false, out status, out extStatus)); #else HFM.ThrowIncompatibleLibraryEx(); #endif } else { HFM.Try("Retrieving cell status for {0}", pov, () => _hsvData.GetStatusEx(pov.Scenario.Id, pov.Year.Id, pov.Period.Id, pov.View.Id, pov.Entity.Id, pov.Entity.ParentId, valueId, pov.Account.Id, pov.ICP.Id, pov.Custom1.Id, pov.Custom2.Id, pov.Custom3.Id, pov.Custom4.Id, false, out status, out extStatus)); } return(status); }
protected override EProcessState SetProcessState(POV pov, EProcessAction action, EProcessState targetState, string annotation, string[] paths, string[] files) { short newState = 0; if (HFM.HasVariableCustoms) { #if HFM_11_1_2_2 HFM.Try("Setting phased submission state for {0}", pov, () => _hsvProcessFlow.PhasedSubmissionProcessManagementChangeStateForMultipleEntities2ExtDim( pov.HfmSliceCOM, annotation, (int)action, false, false, (short)targetState, paths, files, out newState)); #else HFM.ThrowIncompatibleLibraryEx(); #endif } else { HFM.Try("Setting phased submission state for {0}", pov, () => _hsvProcessFlow.PhasedSubmissionProcessManagementChangeStateForMultipleEntities2( pov.Scenario.Id, pov.Year.Id, pov.Period.Id, new int[] { pov.Entity.Id }, new int[] { pov.Entity.ParentId }, pov.Value.Id, new int[] { pov.Account.Id }, new int[] { pov.ICP.Id }, new int[] { pov.Custom1.Id }, new int[] { pov.Custom2.Id }, new int[] { pov.Custom3.Id }, new int[] { pov.Custom4.Id }, annotation, (int)action, false, false, (short)targetState, paths, files, out newState)); } return((EProcessState)newState); }
internal bool Init() { //buttons Button[] buttons = new Button[ 2 ]; buttons[ 0 ] = new Button( JoystickButtons.Button1, 0 ); buttons[ 1 ] = new Button( JoystickButtons.Button2, 1 ); //axes Axis[] axes = new Axis[ 1 ]; axes[ 0 ] = new JoystickInputDevice.Axis( JoystickAxes.X, new Range( -1, 1 ), false ); //povs POV[] povs = new POV[ 0 ]; //povs[ 0 ] = new JoystickInputDevice.POV( JoystickPOVs.POV1 ); //sliders Slider[] sliders = new Slider[ 0 ]; //sliders[ 0 ] = new Slider( JoystickSliders.Slider1 ); //forceFeedbackController ForceFeedbackController forceFeedbackController = null; //initialize data InitDeviceData( buttons, axes, povs, sliders, forceFeedbackController ); return true; }
protected void GetGroupPhase(POV pov, out int group, out int phase) { string sGroup = null, sPhase = null; if (HFM.HasVariableCustoms) { #if HFM_11_1_2_2 HFM.Try("Retrieving submission group and phase", () => _hsvProcessFlow.GetGroupPhaseFromCellExtDim(pov.HfmPovCOM, out sGroup, out sPhase)); #else HFM.ThrowIncompatibleLibraryEx(); #endif } else { HFM.Try("Retrieving submission group and phase", () => _hsvProcessFlow.GetGroupPhaseFromCell(pov.Scenario.Id, pov.Year.Id, pov.Period.Id, pov.Entity.Id, pov.Entity.ParentId, pov.Value.Id, pov.Account.Id, pov.ICP.Id, pov.Custom1.Id, pov.Custom2.Id, pov.Custom3.Id, pov.Custom4.Id, out sGroup, out sPhase)); } group = int.Parse(sGroup); phase = int.Parse(sPhase); }
/// Calculates a Scenario/Year/Period/Entity combination specified in /// the POV internal void CalculatePOV(POV pov, bool force) { _log.FineFormat("Calculating {0}", pov); HFM.Try(() => _hsvCalculate.ChartLogic(pov.Scenario.Id, pov.Year.Id, pov.Period.Id, pov.Entity.Id, pov.Entity.ParentId, pov.Value.Id, force)); }
void FixedUpdate() { //When both sticks are clicked in, start the transition to the new pov if (currLeftStickState && currRightStickState && (!prevLeftStickState || !prevRightStickState) && acceptInputs && !transitioning) { if (pointOfView == POV.third) { setPOV(POV.first); } else { setPOV(POV.third); } } //If transitioning, move the camera rig closer to the target if (transitioning) { //Move the camera rig cameraRig.transform.position = Vector3.Lerp(cameraRig.transform.position, transitionTarget, transitionSpeed); //Update the target offsets to maintain their local position if (pointOfView == POV.third) { setTargetOffsets(transitionTarget - cameraRig.transform.position); } else { setTargetOffsets((transitionTarget - cameraRig.transform.position) - thirdPersonCameraDisplacement); } //Find the offset between the camera rig and the target Vector3 distance = transitionTarget - cameraRig.transform.position; //If the camera rig is within 0.01 units of the target, switch pov if (distance.magnitude < 0.01f) { //Switch to first person if (pointOfView == POV.third) { setTargetOffsets(Vector3.zero); pointOfView = POV.first; } //Switch to third person else { setTargetOffsets(-thirdPersonCameraDisplacement); pilot.SetActive(true); pointOfView = POV.third; } transitioning = false; } } }
public Gait(Skeleton avgSkeleton, POV pov) { POV = pov; JointType foot = POV == POV.Left ? JointType.FootLeft : JointType.FootRight; JointType ankle = POV == POV.Left ? JointType.AnkleLeft : JointType.AnkleRight; JointType knee = POV == POV.Left ? JointType.KneeLeft : JointType.KneeRight; RelaxedAnkleFlexion = 90 - avgSkeleton.Joints[ankle].Angle(avgSkeleton.Joints[foot], avgSkeleton.Joints[knee]); }
//TODO: Make work public bool GetPOV(POV pov) { switch (pov) { case POV.left: if (controller.GetAxis(6) > 0) { return(true); } else { return(false); } break; /* * case POV.down: * if (controller.GetAxis(6) == 1) * { * return true; * } * else * { * return false; * } * break; */ case POV.right: if (controller.GetAxis(6) < 0) { return(true); } else { return(false); } break; /* * case POV.up: * if (controller.GetAxis(6) == -1) * { * return true; * } * else * { * return false; * } * break; */ default: return(false); break; } }
static void PrintPOV(Extreme3DProService s, int id) { POV pov = POV.POV_NONE; if (!s.GetPOV(id, ref pov)) { pov = POV.POV_NONE; } Console.WriteLine("{0}", povNameMap[pov]); }
static void PrintPOV(Xbox360Service s, int id) { POV pov = POV.POV_NONE; if (!s.GetDpad(id, ref pov)) { pov = POV.POV_NONE; } Console.WriteLine("{0}", povNameMap[pov]); }
/// Returns a bit-field representing the calculation status for a subcube internal int GetCalcStatus(POV pov) { int status = -1; int valueId = pov.IsSpecified(EDimension.Value) ? pov.Value.Id : pov.Entity.DefaultCurrencyId; HFM.Try("Retrieving calc status for {0}", pov, () => _hsvData.GetCalcStatus(pov.Scenario.Id, pov.Year.Id, pov.Period.Id, pov.Entity.Id, pov.Entity.ParentId, valueId, out status)); return(status); }
protected override void GetHistory(POV pu, IOutput output) { object oDates = null, oUsers = null, oActions = null, oStates = null, oAnnotations = null, oPaths = null, oFiles = null; HFM.Try("Retrieving process history for {0}", pu, () => _hsvProcessFlow.GetHistory2(pu.Scenario.Id, pu.Year.Id, pu.Period.Id, pu.Entity.Id, pu.Entity.ParentId, pu.Value.Id, out oDates, out oUsers, out oActions, out oStates, out oAnnotations, out oPaths, out oFiles)); OutputHistory(output, pu, oDates, oUsers, oActions, oStates, oAnnotations, oPaths, oFiles); }
protected override EProcessState SetProcessState(POV pu, EProcessAction action, EProcessState targetState, string annotation, string[] paths, string[] files) { short newState = 0; HFM.Try("Setting process unit state for {0}", pu, () => _hsvProcessFlow.ProcessManagementChangeStateForMultipleEntities2( pu.Scenario.Id, pu.Year.Id, pu.Period.Id, new int[] { pu.Entity.Id }, new int[] { pu.Entity.ParentId }, pu.Value.Id, annotation, (int)action, false, false, (short)targetState, paths, files, out newState)); return((EProcessState)newState); }
// To be able to change the status of a process unit, it needs to be: // unlocked, calculated, and valid protected bool CanAction(EProcessAction action, POV pu, bool consolidateIfNeeded, IOutput output) { bool ok = true; if (action == EProcessAction.Promote || action == EProcessAction.SignOff || action == EProcessAction.Submit || action == EProcessAction.Approve || action == EProcessAction.Publish) { ok = CheckCalcStatus(action, pu, consolidateIfNeeded, output); ok = ok && CheckValidationStatus(action, pu); } return(ok); }
// Check user has sufficient access rights for action protected bool HasSufficientAccess(EProcessAction action, POV pu, EAccessRights access, EProcessState state) { bool ok = false; switch (action) { case EProcessAction.Start: ok = access == EAccessRights.All; break; case EProcessAction.Promote: ok = access == EAccessRights.Promote || access == EAccessRights.All; break; case EProcessAction.Reject: ok = access == EAccessRights.All || ((access == EAccessRights.Read || access == EAccessRights.Promote) && state != EProcessState.Published); break; case EProcessAction.SignOff: ok = access == EAccessRights.Read || access == EAccessRights.Promote || access == EAccessRights.All; break; case EProcessAction.Submit: ok = access == EAccessRights.Promote || access == EAccessRights.All; break; case EProcessAction.Approve: ok = access == EAccessRights.Promote || access == EAccessRights.All; break; case EProcessAction.Publish: ok = access == EAccessRights.All; break; } if (ok) { _log.TraceFormat("User has sufficient privileges to {0} {1} {2}", action, ProcessUnitType, pu); } else { _log.WarnFormat("Insufficient privileges to {0} {1} {2}", action, ProcessUnitType, pu); } return(ok); }
/// Returns true if it is possible to go from start state to end state protected bool IsValidStateTransition(EProcessAction action, POV pu, EProcessState start, EProcessState end) { bool ok = false; switch (action) { case EProcessAction.Start: ok = start == EProcessState.NotStarted; break; case EProcessAction.Promote: ok = start >= EProcessState.FirstPass && start <EProcessState.ReviewLevel10 && end >= EProcessState.ReviewLevel1 && end <= EProcessState.ReviewLevel10 && end> start; break; case EProcessAction.Reject: ok = start != EProcessState.NotStarted; break; case EProcessAction.SignOff: ok = start >= EProcessState.ReviewLevel1; break; case EProcessAction.Submit: ok = start >= EProcessState.FirstPass && start < EProcessState.Submitted; break; case EProcessAction.Approve: ok = start == EProcessState.Submitted; break; case EProcessAction.Publish: ok = start >= EProcessState.Submitted && start < EProcessState.Published; break; } if (ok) { _log.TraceFormat("{0} {1} is in a valid state to {2}", ProcessUnitType.Capitalize(), pu, action); } else { _log.WarnFormat("{0} {1} is in the wrong state ({2}) to {3}", ProcessUnitType.Capitalize(), pu, start, action); } return(ok); }
public void setPOV(POV newPOV) { //When moving to first person, start by hiding the pilot if (newPOV == POV.first) { pilot.SetActive(false); transitionTarget = cameraRig.transform.position - thirdPersonCameraDisplacement; } else { transitionTarget = cameraRig.transform.position + thirdPersonCameraDisplacement; } //Indicate that the transition is taking place transitioning = true; }
protected bool CheckCalcStatus(EProcessAction action, POV pu, bool consolidateIfNeeded, IOutput output) { bool ok = false; var calcStatus = _session.Data.GetCalcStatus(pu); if (_log.IsDebugEnabled) { var cs = StringUtilities.Join(ECalcStatusExtensions.GetCellStatuses(calcStatus), ", "); _log.DebugFormat("Process unit calculation status for {0}: ({1})", pu, cs); } if (ECalcStatus.OK.IsSet(calcStatus) || ECalcStatus.OKButSystemChanged.IsSet(calcStatus) || ECalcStatus.NoData.IsSet(calcStatus)) { if (ECalcStatus.Locked.IsSet(calcStatus)) { _log.ErrorFormat("Cannot {0} {1} {2} as it has been locked", action, ProcessUnitType, pu); } else { _log.TraceFormat("Calculation status check passed for {0} of {1}", action, pu); ok = true; } } else if (consolidateIfNeeded) { if (ECalcStatus.NeedsCalculate.IsSet(calcStatus)) { _session.Calculate.CalculatePOV(pu, false); } else { _session.Calculate.ConsolidatePOV(pu, EConsolidationType.Impacted, output); } ok = true; } else { _log.ErrorFormat("Cannot {0} {1} {2} until it has been consolidated", action, ProcessUnitType, pu); } return(ok); }
protected void OutputHistory(IOutput output, POV pu, object oDates, object oUsers, object oActions, object oStates, object oAnnotations, object oPaths, object oFiles) { var dates = (double[])oDates; var users = HFM.Object2Array <string>(oUsers); var actions = (EProcessAction[])oActions; var states = (EProcessState[])oStates; var annotations = HFM.Object2Array <string>(oAnnotations); var paths = HFM.Object2Array <string>(oPaths); var files = HFM.Object2Array <string>(oFiles); output.WriteLine("Process history for {0} {1}:", ProcessUnitType, pu); output.SetHeader("Date", "User", 30, "Action", 10, "Process State", 14, "Annotation"); for (int i = 0; i < dates.Length; ++i) { output.WriteRecord(DateTime.FromOADate(dates[i]), users[i], actions[i], states[i], annotations[i]); } output.End(true); }
/// Consolidates a Scenario/Year/Period/Entity combination specified in /// the POV internal bool ConsolidatePOV(POV pov, EConsolidationType consolidationType, IOutput output) { var si = _session.SystemInfo; if (consolidationType != EConsolidationType.Impacted || ECalcStatus.NeedsConsolidation.IsSet(_session.Data.GetCalcStatus(pov))) { _log.FineFormat("Consolidating {0}", pov); si.MonitorBlockingTask(output); HFM.Try(() => _hsvCalculate.Consolidate(pov.Scenario.Id, pov.Year.Id, pov.Period.Id, pov.Entity.Id, pov.Entity.ParentId, (short)consolidationType)); si.BlockingTaskComplete(); return(true); } else { _log.FineFormat("Consolidation not needed for {0}", pov); return(false); } }
protected bool CheckValidationStatus(EProcessAction action, POV pu) { bool ok = true; int group, phase; GetGroupPhase(pu, out group, out phase); if (phase == 0) { // Cell does not participate in process management throw new ArgumentException(string.Format("POV {0} is not valid for process management", pu)); } var account = _metadata.GetPhaseValidationAccount(phase); if (account.Id != Member.NOT_USED) { var pov = pu.Copy(); // Set validation account POV pov.Account = account; pov.View = _metadata.View.GetMember("<Scenario View>"); pov.ICP = _metadata.ICP.GetMember("[ICP Top]"); foreach (var id in _metadata.CustomDimIds) { pov[id] = account.GetTopCustomMember(id); } var valAmt = _session.Data.GetCellValue(pov); ok = valAmt == null || valAmt == 0; if (ok) { _log.TraceFormat("Validation status passed for {0}", pu); } else { _log.ErrorFormat("Cannot {0} {1} {2} until it passes validation", action, ProcessUnitType, pu); } } return(ok); }
/// <summary> /// Returns the current user's access rights to the specified process unit /// </summary> public EAccessRights GetProcessUnitAccessRights(POV pov, out EProcessState state) { int accessRights = 0; short currentState = 0; if (_metadata.UsesPhasedSubmissions) { if (HFM.HasVariableCustoms) { #if HFM_11_1_2_2 HFM.Try("Retrieving phased submission access rights", () => HsvDataSecurity.GetProcessUnitAccessRightsAndStateExExtDim(pov.HfmPovCOM, Member.NOT_USED, out accessRights, out currentState)); #else HFM.ThrowIncompatibleLibraryEx(); #endif } else { HFM.Try("Retrieving phased submission access rights", () => HsvDataSecurity.GetProcessUnitAccessRightsAndStateEx(pov.Scenario.Id, pov.Year.Id, pov.Period.Id, pov.Entity.Id, pov.Entity.ParentId, pov.Value.Id, pov.Account.Id, pov.ICP.Id, pov.Custom1.Id, pov.Custom2.Id, pov.Custom3.Id, pov.Custom4.Id, Member.NOT_USED, out accessRights, out currentState)); } } else { HFM.Try("Retrieving process unit access rights", () => HsvDataSecurity.GetProcessUnitAccessRightsAndState(pov.Scenario.Id, pov.Year.Id, pov.Period.Id, pov.Entity.Id, pov.Entity.ParentId, pov.Value.Id, out accessRights, out currentState)); } state = (EProcessState)currentState; return((EAccessRights)accessRights); }
/// <summary> /// Returns the current user's access rights to the specified cell /// </summary> public EAccessRights GetCellLevelAccessRights(POV pov) { int accessRights = 0; if (HFM.HasVariableCustoms) { #if HFM_11_1_2_2 HFM.Try("Retrieving cell access rights", () => HsvDataSecurity.GetCellLevelAccessRightsExtDim(pov.HfmPovCOM, out accessRights)); #else HFM.ThrowIncompatibleLibraryEx(); #endif } else { HFM.Try("Retrieving cell access rights", () => HsvDataSecurity.GetCellLevelAccessRights(pov.Scenario.Id, pov.Year.Id, pov.Period.Id, pov.Entity.Id, pov.Entity.ParentId, pov.Value.Id, pov.Account.Id, pov.ICP.Id, pov.Custom1.Id, pov.Custom2.Id, pov.Custom3.Id, pov.Custom4.Id, out accessRights)); } return((EAccessRights)accessRights); }
internal unsafe bool Init() { GUID devGuid = deviceGuid; void */*IDirectInputDevice8*/ directInputDeviceTemp = null; int hr = IDirectInput.CreateDevice( WindowsInputDeviceManager.Instance.DirectInput, ref devGuid, out directInputDeviceTemp, null); if (Wrapper.FAILED(hr)) { Log.Warning("DirectInputJoystickDevice: Cannot create device \"{0}\" ({1}).", Name, DInput.GetOutString(DInput.DXGetErrorStringW(hr))); return(false); } directInputDevice = (IDirectInputDevice8 *)directInputDeviceTemp; // get capabilities DIDEVCAPS caps = new DIDEVCAPS(); caps.dwSize = (uint)sizeof(DIDEVCAPS); hr = IDirectInputDevice8.GetCapabilities(directInputDevice, ref caps); if (Wrapper.FAILED(hr)) { Log.Warning("DirectInputJoystickDevice: Cannot get device capabilities \"{0}\".", Name); return(false); } //buttons Button[] buttons = new Button[caps.dwButtons]; for (int n = 0; n < buttons.Length; n++) { buttons[n] = new Button((JoystickButtons)n, n); } //povs POV[] povs = new POV[caps.dwPOVs]; for (int n = 0; n < povs.Length; n++) { povs[n] = new JoystickInputDevice.POV((JoystickPOVs)n); } // setup hr = IDirectInputDevice8.SetDataFormat(directInputDevice, DInput.Get_c_dfDIJoystick2()); if (Wrapper.FAILED(hr)) { Log.Warning("DirectInputJoystickDevice: Cannot set device data format \"{0}\".", Name); return(false); } hr = IDirectInputDevice8.SetCooperativeLevel(directInputDevice, WindowsInputDeviceManager.Instance.WindowHandle, DInput.DISCL_EXCLUSIVE | DInput.DISCL_FOREGROUND); if (Wrapper.FAILED(hr)) { Log.Warning("DirectInputJoystickDevice: Cannot set device " + "cooperative level \"{0}\".", Name); return(false); } //------------------------------------------------------------------- // setup size for buffered input DIPROPDWORD dibuf = new DIPROPDWORD(); dibuf.diph.dwSize = (uint)sizeof(DIPROPDWORD); dibuf.diph.dwHeaderSize = (uint)sizeof(DIPROPHEADER); dibuf.diph.dwHow = DInput.DIPH_DEVICE; dibuf.diph.dwObj = 0; dibuf.dwData = BufferSize; GUID *bufferSizeGuid = (GUID *)DInput.getDIPROP_BUFFERSIZE(); hr = IDirectInputDevice8.SetProperty(directInputDevice, bufferSizeGuid, ref dibuf.diph); if (Wrapper.FAILED(hr)) { Log.Warning("DirectInputJoystickDevice: Cannot set device buffer size \"{0}\".", Name); return(false); } deviceDataBuffer = NativeUtility.Alloc(NativeUtility.MemoryAllocationType.Utility, sizeof(DIDEVICEOBJECTDATA) * BufferSize); //-------------------------------------------------------------------- temporarySliderCount = 0; temporaryAxisList = new List <JoystickInputDevice.Axis>(); tempDeviceForEnumerate = this; hr = IDirectInputDevice8.EnumObjects(directInputDevice, EnumDeviceObjectsHandler, null, DInput.DIDFT_ALL); tempDeviceForEnumerate = null; if (Wrapper.FAILED(hr)) { Log.Warning("DirectInputJoystickDevice: Cannot enumerate device objects \"{0}\".", Name); return(false); } //axes Axis[] axes = temporaryAxisList.ToArray(); temporaryAxisList = null; //sliders Slider[] sliders = new Slider[temporarySliderCount]; for (int n = 0; n < sliders.Length; n++) { sliders[n] = new JoystickInputDevice.Slider((JoystickSliders)n); } //forceFeedbackController ForceFeedbackController forceFeedbackController = null; if ((caps.dwFlags & DInput.DIDC_FORCEFEEDBACK) != 0) { forceFeedbackController = new DirectInputForceFeedbackController(directInputDevice, this); } //initialize data InitDeviceData(buttons, axes, povs, sliders, forceFeedbackController); return(true); }
/// Method to be implemented in sub-classes for setting the state of a /// single process unit represented by the POV. protected abstract EProcessState SetProcessState(POV processUnit, EProcessAction action, EProcessState targetState, string annotation, string[] paths, string[] files);
/// Method to be implemented in sub-classes for retrieving the state of /// process unit(s) represented by the ProcessUnits. protected abstract void GetHistory(POV processUnit, IOutput output);
private void MultiSourceFrameReader_MultiSourceFrameArrived(object sender, MultiSourceFrameArrivedEventArgs e) { ColorFrame colorFrame = null; BodyFrame bodyFrame = null; try { MultiSourceFrame parentFrame = e.FrameReference.AcquireFrame(); colorFrame = parentFrame.ColorFrameReference.AcquireFrame(); bodyFrame = parentFrame.BodyFrameReference.AcquireFrame(); if (colorFrame != null && bodyFrame != null) { FPS = (int)(1.0 / colorFrame.ColorCameraSettings.FrameInterval.TotalSeconds); IgnoreFrame = FPS > 16 && Force15FPS ? !IgnoreFrame : false; if (ROI == null) { SetROI(colorFrame.FrameDescription); } if (bodyFrame != null && PositionHelper.HasValue) { Skeleton skeleton = bodyFrame.ToSkeleton(); if (skeleton != null) { if (Gait.POV == POV.Unknown) { if (Math.Abs(PositionHelper.Value) < FPS * 4) { ReferenceSkeletonSequence.Add(skeleton); PositionHelper += (skeleton.Joints[JointType.HandLeft].DistanceFromCamera() > skeleton.Joints[JointType.HandRight].DistanceFromCamera()) ? 1 : -1; } else { POV inferredPosition = PositionHelper < 0 ? POV.Left : POV.Right; Gait = new Gait(ReferenceSkeletonSequence.AvgSkeleton(), inferredPosition); } } else { Gait.Refresh(skeleton); } } } BitmapSource newBitmap = null; if (!IgnoreFrame) { newBitmap = colorFrame.ToCroppedBitmap(ROI); } OnFrameProcessed(newBitmap, DateTime.UtcNow.Ticks, FPS); } } finally { if (colorFrame != null) { colorFrame.Dispose(); } if (bodyFrame != null) { bodyFrame.Dispose(); } } }
public void ChangesPov(POV pov) { }