void ReportJointForces::OnUpdate(CView* aSenderPtr,LPARAM aHint,CObject* aHintPtr) { C_Hom_Doc* lDocPtr = (C_Hom_Doc*)GetDocument(); //Analysis& lResults = lDocPtr->getResultsRef(); // Determine which data members are relevant to the current posture BOOL enableHips = TRUE; BOOL enableFront = TRUE; BOOL enableBack = TRUE; if(lDocPtr->getPosition() == P_Standing) enableHips = FALSE; if((lDocPtr->getPosition() == P_Standing) || !lDocPtr->hasFrontSeatPanSupport()) // Not seated or front not supported enableFront = FALSE; if((lDocPtr->getPosition() == P_Standing) || !lDocPtr->hasSeatBackRest()) // Not seated or no seat back enableBack = FALSE; mForceUnits = CString("Force (") + lDocPtr->ForceUnits() + ") -- Due to Body Weight and External Applied Loads"; // Retrieve joint force analysis results Vector3 forces[NUM_JOINTS]; lDocPtr->GetSkeleton()->getNetForces(forces); for(int i = 0; i < NUM_JOINTS; ++i) { // *****34 must be replaced by NUM_JOINTS once the locations of hand joints are being handled properly***** if(jointToMember[i]) { for(int j = 0; j < 3; ++j) { jointToMember[i][j].Format("%.1f", forces[i] [j]); if(jointToMember[i][j] == "-0.0") jointToMember[i][j].Format("0.0"); } } } Skeleton* skel = lDocPtr->GetSkeleton(); // L4L5 forces const SpinalForces_s& spinalForces = skel->getSpinalForces(); mL4L5Force[0].Format("%.1f", spinalForces.globalL4L5NoAbdom[0]); mL4L5Force[1].Format("%.1f", spinalForces.globalL4L5NoAbdom[1]); mL4L5Force[2].Format("%.1f", spinalForces.globalL4L5NoAbdom[2]); // Set any irrelevant data to dashes if(!enableBack) { mSeatBack[1] = mSeatBack[2] = "---"; } else { Vector3 seatBackForce = skel->getSeatBackForce(); for(int i = 0; i < 3; i++) { // force applied to the seat back is negative of the value we calculated, // which was the force applied to the back by the seat back mSeatBack[i].Format("%.1f", -seatBackForce[i]); if(mSeatBack[i] == "-0.0") mSeatBack[i].Format("0.0"); } } if(!enableHips) { mLeftIT[0] = mLeftIT[1] = mLeftIT[2] = "---"; mRightIT[0] = mRightIT[1] = mRightIT[2] = "---"; } if(!enableFront) { mSeatFrontRight[0] = mSeatFrontRight[1] = mSeatFrontRight[2] = "---"; mSeatFrontLeft[0] = mSeatFrontLeft[1] = mSeatFrontLeft[2] = "---"; } else { Vector3 frontRightForce = skel->getRightSeatFrontForce(); Vector3 frontLeftForce = skel->getLeftSeatFrontForce(); for(int i = 0; i < 3; i++) { mSeatFrontRight[i].Format("%.1f",frontRightForce[i]); if(mSeatFrontRight[i] == "-0.0") mSeatFrontRight[i].Format("0.0"); mSeatFrontLeft[i].Format("%.1f",frontLeftForce[i]); if(mSeatFrontLeft[i] == "-0.0") mSeatFrontLeft[i] = "0.0"; } } // Gray-out any irrelevent data this->GetDlgItem(IDC_LeftITX)->EnableWindow(enableHips); this->GetDlgItem(IDC_LeftITY)->EnableWindow(enableHips); this->GetDlgItem(IDC_LeftITZ)->EnableWindow(enableHips); this->GetDlgItem(IDC_RightITX)->EnableWindow(enableHips); this->GetDlgItem(IDC_RightITY)->EnableWindow(enableHips); this->GetDlgItem(IDC_RightITZ)->EnableWindow(enableHips); this->GetDlgItem(IDC_SeatFrontRightX)->EnableWindow(enableFront); this->GetDlgItem(IDC_SeatFrontRightY)->EnableWindow(enableFront); this->GetDlgItem(IDC_SeatFrontRightZ)->EnableWindow(enableFront); this->GetDlgItem(IDC_SeatFrontLeftX)->EnableWindow(enableFront); this->GetDlgItem(IDC_SeatFrontLeftY)->EnableWindow(enableFront); this->GetDlgItem(IDC_SeatFrontLeftZ)->EnableWindow(enableFront); this->GetDlgItem(IDC_SeatBackY)->EnableWindow(enableBack); this->GetDlgItem(IDC_SeatBackZ)->EnableWindow(enableBack); mHeader = lDocPtr->ReportHeader(); mFooter = lDocPtr->ReportFooter(); UpdateData(FALSE); UpdateUnits(); Skeleton &lSkeleton = *lDocPtr->GetSkeleton(); mHandForceTxtLVal.Format("%.1f", lSkeleton.getExtForce(JT_LHAND).length()); mHandForceTxtRVal.Format("%.1f", lSkeleton.getExtForce(JT_RHAND).length()); Vector3 offsetCoordinate = lDocPtr->getOffset(); Vector3 LHand = lSkeleton.getJoint(JT_LHAND); mLeftHori.Format("%.1f", (LHand[1] - offsetCoordinate[1])); mLeftLat.Format("%.1f", (LHand[0] - offsetCoordinate[0])); mLeftVert.Format("%.1f", (LHand[2] - offsetCoordinate[2])); Vector3 RHand = lSkeleton.getJoint(JT_RHAND); mRightHori.Format("%.1f", (RHand[1] - offsetCoordinate[1])); mRightLat.Format("%.1f", (RHand[0] - offsetCoordinate[0])); mRightVert.Format("%.1f", (RHand[2] - offsetCoordinate[2])); }