-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Feature Description
I am creating QGC custom build, and have to create new pattern in flight plan. Similar to survey but a bit different logic.
In QGCCorePlugin.h is method called complexMissionItemNames() which we can override to add new pattern name.
/// Returns the complex mission items to display in the Plan UI /// @param complexMissionItemNames Default set of complex items /// @return Complex items to be made available to user virtual QStringList complexMissionItemNames(Vehicle *vehicle, const QStringList &complexMissionItemNames) { Q_UNUSED(vehicle); return complexMissionItemNames; }
But logic of adding new patterns is hard-coded in MissionController.cc
`VisualMissionItem* MissionController::insertComplexMissionItem(QString itemName, QGeoCoordinate mapCenterCoordinate, int visualItemIndex, bool makeCurrentItem)
{
ComplexMissionItem* newItem = nullptr;
if (itemName == SurveyComplexItem::name) {
newItem = new SurveyComplexItem(_masterController, _flyView, QString() /* kmlOrShpFile */);
newItem->setCoordinate(mapCenterCoordinate);
double prevAltitude;
QGroundControlQmlGlobal::AltMode prevAltMode;
if (globalAltitudeMode() == QGroundControlQmlGlobal::AltitudeModeMixed) {
// We are in mixed altitude modes, so copy from previous. Otherwise alt mode will be set from global setting in constructor.
if (_findPreviousAltitude(visualItemIndex, &prevAltitude, &prevAltMode)) {
qobject_cast<SurveyComplexItem*>(newItem)->cameraCalc()->setDistanceMode(prevAltMode);
}
}
} else if (itemName == FixedWingLandingComplexItem::name) {
newItem = new FixedWingLandingComplexItem(_masterController, _flyView);
} else if (itemName == VTOLLandingComplexItem::name) {
newItem = new VTOLLandingComplexItem(_masterController, _flyView);
} else if (itemName == StructureScanComplexItem::name) {
newItem = new StructureScanComplexItem(_masterController, _flyView, QString() /* kmlOrShpFile */);
} else if (itemName == CorridorScanComplexItem::name) {
newItem = new CorridorScanComplexItem(_masterController, _flyView, QString() /* kmlOrShpFile */);
} else {
qWarning() << "Internal error: Unknown complex item:" << itemName;
return nullptr;
}
_insertComplexMissionItemWorker(mapCenterCoordinate, newItem, visualItemIndex, makeCurrentItem);
return newItem;
}`
So can I make new pattern and not modify MainLine source code?
Flight Stacks
No response
Vehicle Types
No response