8#include <QPushButton.h>
11void QComboBox::wheelEvent(QWheelEvent* e){}
13void QAbstractSpinBox::wheelEvent(QWheelEvent* e){}
22 this->setWindowFlags(Qt::WindowStaysOnTopHint);
24 this->setContentsMargins(0, 0, 0, 0);
28 auto mainLayout =
new QVBoxLayout;
29 mainLayout->setContentsMargins(0, 0, 0, 0);
30 mainLayout->setAlignment(Qt::AlignLeft);
31 mainLayout->setSpacing(0);
33 this->setLayout(mainLayout);
35 auto title =
new QLabel(QString((std::string(
"<b>") + std::string(
"Rigid Body Name: ") + rigidInfo.
shapeName.
name + std::string(
"</b>")).c_str()),
this);
37 title->setAlignment(Qt::AlignCenter);
38 auto titleLayout =
new QHBoxLayout;
39 titleLayout->addWidget(title);
40 titleLayout->setAlignment(Qt::AlignHCenter);
41 titleLayout->setContentsMargins(0, 10, 0, 15);
42 mainLayout->addItem(titleLayout);
82 QHBoxLayout* motionLayout =
new QHBoxLayout;
83 motionLayout->addWidget(
new QLabel(
"Motion Type",
this));
85 motionLayout->setContentsMargins(9, 0, 8, 0);
86 mainLayout->addItem(motionLayout);
150 QHBoxLayout* rigidGroupLayout =
new QHBoxLayout;
151 rigidGroupLayout->addWidget(
new QLabel(
"Rigidbody Group",
this));
153 rigidGroupLayout->setContentsMargins(9, 0, 8, 0);
156 mainLayout->addItem(rigidGroupLayout);
160 mainLayout->addStretch();
216 this->setFixedWidth(400);
218 this->setWindowFlags(Qt::WindowStaysOnTopHint);
220 this->setContentsMargins(0, 0, 0, 0);
224 auto mainLayout =
new QVBoxLayout;
225 mainLayout->setContentsMargins(0, 0, 0, 0);
226 mainLayout->setAlignment(Qt::AlignLeft);
227 mainLayout->setSpacing(0);
228 this->setLayout(mainLayout);
232 auto title =
new QLabel(QString((std::string(
"<b>") +std::string(
"Joint: ")
235 title->setAlignment(Qt::AlignCenter);
236 auto titleLayout =
new QHBoxLayout;
237 titleLayout->addWidget(title);
238 titleLayout->setAlignment(Qt::AlignHCenter);
239 titleLayout->setContentsMargins(0, 10, 0, 15);
240 mainLayout->addItem(titleLayout);
252 mMinWidget->setRange(-9999999999,99999999999);
253 mMaxWidget->setRange(-9999999999, 99999999999);
257 QHBoxLayout* rangeLayout =
new QHBoxLayout;
258 rangeLayout->setContentsMargins(9, 0, 8, 10);
259 rangeLayout->setAlignment(Qt::AlignLeft);
260 rangeLayout->setSpacing(10);
263 rangeLayout->addStretch();
275 QObject::connect(
mMinWidget, QOverload<double>::of(&QPiecewiseDoubleSpinBox::valueChanged), [=]() {
updateData(); });
276 QObject::connect(
mMaxWidget, QOverload<double>::of(&QPiecewiseDoubleSpinBox::valueChanged), [=]() {
updateData(); });
280 mainLayout->addItem(rangeLayout);
281 mainLayout->addStretch();
301 this->setContentsMargins(0, 0, 0, 0);
304 mIndexLabel =
new QLabel(std::to_string(
id).c_str());
431 this->setContentsMargins(0, 0, 0, 0);
435 mIndex =
new QLabel(std::to_string(
id).c_str());
472 this->addWidget(
mIndex, 0);
481 mIndex->setFixedWidth(25);
494 QObject::connect(
mMoterInput, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](
double value)
496 int intValue =
static_cast<int>(
value);
579 auto titleLayout =
new QVBoxLayout;
581 QLabel* name =
new QLabel();
583 titleLayout->addWidget(name);
587 auto RigidBodyUI =
new QVBoxLayout;
588 RigidBodyUI->setContentsMargins(0, 0, 0, 0);
590 QHBoxLayout* nameLayout =
new QHBoxLayout;
592 QLabel* idLabel =
new QLabel(
"<b>No.</b>",
this);
593 QLabel* rigidNameLabel =
new QLabel(
"<b>Name</b>",
this);
594 QLabel* shapeIdLabel =
new QLabel(
"<b>ShapeID</b>",
this);
595 QLabel* typeLabel =
new QLabel(
"<b>Type</b>",
this);
596 QLabel* offsetLabel =
new QLabel(
"<b>Edit</b>",
this);
598 QPushButton* addItembutton =
new QPushButton(
"Add Item",
this);
599 addItembutton->setFixedSize(80, 30);
601 nameLayout->addWidget(idLabel);
602 nameLayout->addWidget(rigidNameLabel);
603 nameLayout->addWidget(shapeIdLabel);
604 nameLayout->addWidget(typeLabel);
605 nameLayout->addWidget(offsetLabel);
606 nameLayout->addWidget(addItembutton);
608 RigidBodyUI->addLayout(nameLayout);
614 idLabel->setFixedWidth(25);
615 rigidNameLabel->setFixedWidth(100);
616 typeLabel->setFixedWidth(76);
617 shapeIdLabel->setFixedWidth(76);
618 offsetLabel->setFixedWidth(76);
620 idLabel->setAlignment(Qt::AlignCenter);
621 rigidNameLabel->setAlignment(Qt::AlignCenter);
622 typeLabel->setAlignment(Qt::AlignCenter);
623 shapeIdLabel->setAlignment(Qt::AlignCenter);
624 offsetLabel->setAlignment(Qt::AlignCenter);
630 auto jointUI =
new QVBoxLayout;
631 jointUI->setContentsMargins(0, 0, 0, 0);
632 QHBoxLayout* jointLayout =
new QHBoxLayout;
634 QLabel* jointNumLabel =
new QLabel(
"<b>No.</b>",
this);
635 QLabel* actor1 =
new QLabel(
"<b>RigidBody1</b>",
this);
636 QLabel* actor2 =
new QLabel(
"<b>RigidBody2</b>",
this);
637 QLabel* jointTypeLabel =
new QLabel(
"<b>Type</b>",
this);
638 QLabel* moterLabel =
new QLabel(
"<b>Moter</b>",
this);
639 QLabel* anchorOffsetLabel =
new QLabel(
"<b>Edit</b>",
this);
641 QPushButton* addJointItembutton =
new QPushButton(
"Add Item",
this);
642 addJointItembutton->setFixedSize(80, 30);
644 jointLayout->addWidget(jointNumLabel);
645 jointLayout->addWidget(actor1);
646 jointLayout->addWidget(actor2);
647 jointLayout->addWidget(jointTypeLabel);
648 jointLayout->addWidget(moterLabel);
649 jointLayout->addWidget(anchorOffsetLabel);
650 jointLayout->addWidget(addJointItembutton);
652 jointUI->addLayout(jointLayout);
653 jointUI->setContentsMargins(0, 0, 0, 0);
659 jointNumLabel->setFixedWidth(25);
660 actor1->setFixedWidth(90);
661 actor2->setFixedWidth(90);
662 jointTypeLabel->setFixedWidth(65);
663 moterLabel->setFixedWidth(65);
664 anchorOffsetLabel->setFixedWidth(50);
666 jointNumLabel->setAlignment(Qt::AlignCenter);
667 actor1->setAlignment(Qt::AlignCenter);
668 actor2->setAlignment(Qt::AlignCenter);
669 jointTypeLabel->setAlignment(Qt::AlignCenter);
670 moterLabel->setAlignment(Qt::AlignCenter);
671 anchorOffsetLabel->setAlignment(Qt::AlignCenter);
673 QObject::connect(addJointItembutton, SIGNAL(pressed()),
this, SLOT(
addJointItemWidget()));
706 for (
size_t i = 0; i <
mVec.mVehicleRigidBodyInfo.size(); i++)
713 for (
size_t i = 0; i <
mVec.mVehicleJointInfo.size(); i++)
728 mObjID2Name[it->getObjID()] = it->mNameInput->text().toStdString();
729 mName2RigidId[it->mNameInput->text().toStdString()] = it->getRigidID();
743 itemLayout->mNameInput1->blockSignals(
true);
744 itemLayout->mNameInput2->blockSignals(
true);
746 if (itemLayout->mName1_ObjID != -1)
749 if (str == std::string(
""))
756 itemLayout->mNameInput1->setCurrentIndex(index);
760 if (itemLayout->mName2_ObjID != -1)
763 if (str == std::string(
""))
770 itemLayout->mNameInput2->setCurrentIndex(index);
775 if (itemLayout->mName1_ObjID == -1)
780 if (itemLayout->mName2_ObjID == -1)
784 itemLayout->mNameInput1->blockSignals(
false);
785 itemLayout->mNameInput2->blockSignals(
false);
803 else if (select == 2)
823 mVec.mVehicleRigidBodyInfo.clear();
833 mVec.mVehicleJointInfo.clear();
839 mVec.mVehicleJointInfo.push_back(jointItem->value());
840 auto& jointInfo =
mVec.mVehicleJointInfo[i];
842 if (jointInfo.mRigidBodyName_1.name != std::string(
""))
843 jointInfo.mRigidBodyName_1.rigidBodyId =
mName2RigidId[jointInfo.mRigidBodyName_1.name];
845 if (jointInfo.mRigidBodyName_2.name != std::string(
""))
846 jointInfo.mRigidBodyName_2.rigidBodyId =
mName2RigidId[jointInfo.mRigidBodyName_2.name];
870 jointItem->mName1_ObjID =
getRigidItemObjID(jointItem->mNameInput1->currentText().toStdString());
872 jointItem->mName2_ObjID =
getRigidItemObjID(jointItem->mNameInput2->currentText().toStdString());
930 if (pair.second == str) {
947 auto name = it.second;
984 QObject::connect(itemLayout, SIGNAL(valueChange(
int)),
this, SLOT(
updateVector()));
995 QObject::connect(itemLayout, SIGNAL(valueChange(
int)),
this, SLOT(
updateVector()));
void jointChange()
Transmits a signal when data is updated.
QToggleLabel * mNameLabel
ConfigJointType mCurrentType
QPiecewiseDoubleSpinBox * mMinWidget
QPiecewiseDoubleSpinBox * mMaxWidget
QJointBodyDetail(VehicleJointInfo &jointInfo)
void updateData()
Updated when any element parameter is changed.
mVec3fWidget * mAxisWidget
VehicleJointInfo * mJointData
mVec3fWidget * mAnchorPointWidget
QCheckBox * mUseRangeWidget
QRigidBodyDetail(VehicleRigidBodyInfo &rigidInfo)
std::vector< ConfigMotionType > mAllConfigMotionTypes
mVec3fWidget * mRotationWidget
ConfigShapeType mCurrentType
void updateData()
Updated when any element parameter is changed.
mVec3fWidget * mScaleWidget
mVec3fWidget * mTetWidget_1
mVec3fWidget * mHalfLengthWidget
mVec3fWidget * mTetWidget_2
mPiecewiseDoubleSpinBox * mRadiusWidget
mVec3fWidget * mTetWidget_3
mVec3fWidget * mTranslationWidget
mVec3fWidget * mOffsetWidget
VehicleRigidBodyInfo * mRigidBodyData
mVec3fWidget * mTetWidget_0
mPiecewiseDoubleSpinBox * mCapsuleLengthWidget
void rigidChange()
Transmits a signal when data is updated.
QComboBox * mMotionWidget
DYN_FUNC void toEulerAngle(Real &yaw, Real &pitch, Real &roll) const
DYN_FUNC SquareMatrix< Real, 3 > toMatrix3x3() const
void setObjId(int id)
Unique objId used to identify this Item.
const std::vector< ConfigShapeType > mVecShapeType
QPushButton * mRemoveButton
void createRigidDetailWidget()
Create RigidBody Detail Panel.
void emitNameChange(int v)
VehicleRigidBodyInfo value()
Get current RigidBodyInfo.
void setValue(const VehicleRigidBodyInfo &v)
Initialization RigidBodyInfo.
RigidBodyItemLayout(int id)
VehicleRigidBodyInfo mRigidInfo
std::vector< QRigidBodyDetail * > mDetailWidgets
QPushButton * mOffsetButton
The VehicleBind class is used to record information about created rigid bodies and joints....
QDoubleSpinBox * mMoterInput
const std::vector< ConfigJointType > mVecJointType
std::vector< QJointBodyDetail * > mDetailWidgets
void createJointDetailWidget()
Create Joint Detail Panel.
QPushButton * mEditButton
VehicleJointInfo value()
Get current RigidBodyInfo.
QPushButton * mRemoveButton
VehicleJointInfo mJointInfo
void setValue(const VehicleJointInfo &v)
Initialization RigidBodyInfo.
This is an implementation of AdditiveCCD based on peridyno.
QString FormatFieldWidgetName(std::string name)
Transform< float, 3 > Transform3f
The joint information is stored in mVehicleJointInfo.
Vector< Real, 3 > mAnchorPoint
ConfigJointType mJointType
Name_Shape mRigidBodyName_2
Name_Shape mRigidBodyName_1
The Rigid body information is stored in mVehicleJointInfo.
ConfigShapeType shapeType