Commit fb32766e authored by Gus Grubba's avatar Gus Grubba

Fix fitMapViewportToMissionItems

parent 901cf22d
...@@ -49,6 +49,7 @@ Map { ...@@ -49,6 +49,7 @@ Map {
property var activeVehicleCoordinate: _activeVehicle ? _activeVehicle.coordinate : QtPositioning.coordinate() property var activeVehicleCoordinate: _activeVehicle ? _activeVehicle.coordinate : QtPositioning.coordinate()
function setVisibleRegion(region) { function setVisibleRegion(region) {
// TODO: Is this still necessary with Qt 5.11?
// This works around a bug on Qt where if you set a visibleRegion and then the user moves or zooms the map // This works around a bug on Qt where if you set a visibleRegion and then the user moves or zooms the map
// and then you set the same visibleRegion the map will not move/scale appropriately since it thinks there // and then you set the same visibleRegion the map will not move/scale appropriately since it thinks there
// is nothing to do. // is nothing to do.
......
...@@ -26,9 +26,9 @@ MapItemView { ...@@ -26,9 +26,9 @@ MapItemView {
line.color: "#be781c" // Hack, can't get palette to work in here line.color: "#be781c" // Hack, can't get palette to work in here
z: QGroundControl.zOrderWaypointLines z: QGroundControl.zOrderWaypointLines
path: [ path: object ? [
object.coordinate1, object.coordinate1,
object.coordinate2, object.coordinate2,
] ] : []
} }
} }
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
import QtQuick 2.3 import QtQuick 2.3
import QtPositioning 5.3 import QtPositioning 5.3
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.FlightMap 1.0
/// Set of functions for fitting the map viewpoer to a specific constraint /// Set of functions for fitting the map viewpoer to a specific constraint
Item { Item {
...@@ -62,38 +63,46 @@ Item { ...@@ -62,38 +63,46 @@ Item {
var south = north var south = north
var east = normalizeLon(coordList[0].longitude) var east = normalizeLon(coordList[0].longitude)
var west = east var west = east
for (var i=1; i<coordList.length; i++) { for (var i = 1; i < coordList.length; i++) {
var lat = normalizeLat(coordList[i].latitude) var lat = normalizeLat(coordList[i].latitude)
var lon = normalizeLon(coordList[i].longitude) var lon = normalizeLon(coordList[i].longitude)
north = Math.max(north, lat) north = Math.max(north, lat)
south = Math.min(south, lat) south = Math.min(south, lat)
east = Math.max(east, lon) east = Math.max(east, lon)
west = Math.min(west, lon) west = Math.min(west, lon)
} }
// Expand the coordinate bounding rect to make room for the tools around the edge of the map // Expand the coordinate bounding rect to make room for the tools around the edge of the map
var latDegreesPerPixel = (north - south) / mapFitViewport.width var latDegreesPerPixel = (north - south) / mapFitViewport.width
var lonDegreesPerPixel = (east - west) / mapFitViewport.height var lonDegreesPerPixel = (east - west) / mapFitViewport.height
north = Math.min(north + (mapFitViewport.y * latDegreesPerPixel), 180) north = Math.min(north + (mapFitViewport.y * latDegreesPerPixel), 180)
south = Math.max(south - ((map.height - mapFitViewport.bottom) * latDegreesPerPixel), 0) south = Math.max(south - ((map.height - mapFitViewport.bottom) * latDegreesPerPixel), 0)
west = Math.max(west - (mapFitViewport.x * lonDegreesPerPixel), 0) west = Math.max(west - (mapFitViewport.x * lonDegreesPerPixel), 0)
east = Math.min(east + ((map.width - mapFitViewport.right) * lonDegreesPerPixel), 360) east = Math.min(east + ((map.width - mapFitViewport.right) * lonDegreesPerPixel), 360)
// Back off on zoom level
east = Math.min(east * 1.0000075, 360)
north = Math.min(north * 1.0000075, 180)
west = west * 0.9999925
south = south * 0.9999925
// Fix the map region to the new bounding rect // Fix the map region to the new bounding rect
var topLeftCoord = QtPositioning.coordinate(north - 90.0, west - 180.0) var topLeftCoord = QtPositioning.coordinate(north - 90.0, west - 180.0)
var bottomRightCoord = QtPositioning.coordinate(south - 90.0, east - 180.0) var bottomRightCoord = QtPositioning.coordinate(south - 90.0, east - 180.0)
map.setVisibleRegion(QtPositioning.rectangle(topLeftCoord, bottomRightCoord)) map.setVisibleRegion(QtPositioning.rectangle(topLeftCoord, bottomRightCoord))
// Back off on zoom level
map.zoomLevel = Math.abs(map.zoomLevel) - 1
} }
function addMissionItemCoordsForFit(coordList) { function addMissionItemCoordsForFit(coordList) {
for (var i=1; i<_missionController.visualItems.count; i++) { for (var i = 1; i < _missionController.visualItems.count; i++) {
var missionItem = _missionController.visualItems.get(i) var missionItem = _missionController.visualItems.get(i)
if (missionItem.specifiesCoordinate && !missionItem.isStandaloneCoordinate) { if (missionItem.specifiesCoordinate && !missionItem.isStandaloneCoordinate) {
coordList.push(missionItem.coordinate) if(missionItem.boundingCube.isValid()) {
coordList.push(missionItem.boundingCube.pointNW)
coordList.push(missionItem.boundingCube.pointSE)
} else {
coordList.push(missionItem.coordinate)
}
} }
} }
} }
...@@ -103,6 +112,19 @@ Item { ...@@ -103,6 +112,19 @@ Item {
// Being called prior to controller.start // Being called prior to controller.start
return return
} }
/*
for (var i=1; i<_missionController.visualItems.count; i++) {
var missionItem = _missionController.visualItems.get(i)
if (missionItem.specifiesCoordinate && !missionItem.isStandaloneCoordinate) {
console.log(missionItem.boundingCube.pointNW)
console.log(missionItem.boundingCube.pointSE)
var loc = QtPositioning.rectangle(missionItem.boundingCube.pointNW, missionItem.boundingCube.pointSE)
console.log(loc)
map.visibleRegion = loc
return
}
}
*/
var coordList = [ ] var coordList = [ ]
addMissionItemCoordsForFit(coordList) addMissionItemCoordsForFit(coordList)
fitMapViewportToAllCoordinates(coordList) fitMapViewportToAllCoordinates(coordList)
......
...@@ -28,10 +28,6 @@ public: ...@@ -28,10 +28,6 @@ public:
/// Signals complexDistanceChanged /// Signals complexDistanceChanged
virtual double complexDistance(void) const = 0; virtual double complexDistance(void) const = 0;
/// @return The item bounding cube
/// Signals boundingCubeChanged
virtual QGCGeoBoundingCube boundingCube(void) const { return QGCGeoBoundingCube(); }
/// Load the complex mission item from Json /// Load the complex mission item from Json
/// @param complexObject Complex mission item json object /// @param complexObject Complex mission item json object
/// @param sequenceNumber Sequence number for first MISSION_ITEM in survey /// @param sequenceNumber Sequence number for first MISSION_ITEM in survey
......
...@@ -23,9 +23,9 @@ class QGCMapCircle : public QObject ...@@ -23,9 +23,9 @@ class QGCMapCircle : public QObject
Q_OBJECT Q_OBJECT
public: public:
QGCMapCircle(QObject* parent = NULL); QGCMapCircle(QObject* parent = nullptr);
QGCMapCircle(const QGeoCoordinate& center, double radius, QObject* parent = NULL); QGCMapCircle(const QGeoCoordinate& center, double radius, QObject* parent = nullptr);
QGCMapCircle(const QGCMapCircle& other, QObject* parent = NULL); QGCMapCircle(const QGCMapCircle& other, QObject* parent = nullptr);
const QGCMapCircle& operator=(const QGCMapCircle& other); const QGCMapCircle& operator=(const QGCMapCircle& other);
......
...@@ -24,8 +24,8 @@ class QGCMapPolygon : public QObject ...@@ -24,8 +24,8 @@ class QGCMapPolygon : public QObject
Q_OBJECT Q_OBJECT
public: public:
QGCMapPolygon(QObject* parent = NULL); QGCMapPolygon(QObject* parent = nullptr);
QGCMapPolygon(const QGCMapPolygon& other, QObject* parent = NULL); QGCMapPolygon(const QGCMapPolygon& other, QObject* parent = nullptr);
const QGCMapPolygon& operator=(const QGCMapPolygon& other); const QGCMapPolygon& operator=(const QGCMapPolygon& other);
......
...@@ -237,6 +237,30 @@ bool StructureScanComplexItem::load(const QJsonObject& complexObject, int sequen ...@@ -237,6 +237,30 @@ bool StructureScanComplexItem::load(const QJsonObject& complexObject, int sequen
void StructureScanComplexItem::_flightPathChanged(void) void StructureScanComplexItem::_flightPathChanged(void)
{ {
// Calc bounding cube
double north = 0.0;
double south = 180.0;
double east = 0.0;
double west = 360.0;
double bottom = 100000.;
double top = 0.;
QList<QGeoCoordinate> vertices = _flightPolygon.coordinateList();
for (int i = 0; i < vertices.count(); i++) {
QGeoCoordinate vertex = vertices[i];
double lat = vertex.latitude() + 90.0;
double lon = vertex.longitude() + 180.0;
north = fmax(north, lat);
south = fmin(south, lat);
east = fmax(east, lon);
west = fmin(west, lon);
bottom = fmin(bottom, vertex.altitude());
top = fmax(top, vertex.altitude());
}
//-- Update bounding cube for airspace management control
_setBoundingCube(QGCGeoBoundingCube(
QGeoCoordinate(north - 90.0, west - 180.0, bottom),
QGeoCoordinate(south - 90.0, east - 180.0, top)));
emit coordinateChanged(coordinate()); emit coordinateChanged(coordinate());
emit exitCoordinateChanged(exitCoordinate()); emit exitCoordinateChanged(exitCoordinate());
emit greatestDistanceToChanged(); emit greatestDistanceToChanged();
...@@ -458,7 +482,7 @@ void StructureScanComplexItem::_recalcCameraShots(void) ...@@ -458,7 +482,7 @@ void StructureScanComplexItem::_recalcCameraShots(void)
return; return;
} }
int cameraShots = distance / triggerDistance; int cameraShots = static_cast<int>(distance / triggerDistance);
_setCameraShots(cameraShots * _layersFact.rawValue().toInt()); _setCameraShots(cameraShots * _layersFact.rawValue().toInt());
} }
......
...@@ -41,14 +41,13 @@ const int TransectStyleComplexItem::_terrainQueryTimeoutMsecs = 1000 ...@@ -41,14 +41,13 @@ const int TransectStyleComplexItem::_terrainQueryTimeoutMsecs = 1000
TransectStyleComplexItem::TransectStyleComplexItem(Vehicle* vehicle, bool flyView, QString settingsGroup, QObject* parent) TransectStyleComplexItem::TransectStyleComplexItem(Vehicle* vehicle, bool flyView, QString settingsGroup, QObject* parent)
: ComplexMissionItem (vehicle, flyView, parent) : ComplexMissionItem (vehicle, flyView, parent)
, _sequenceNumber (0) , _sequenceNumber (0)
, _dirty (false) , _terrainPolyPathQuery (nullptr)
, _terrainPolyPathQuery (NULL)
, _ignoreRecalc (false) , _ignoreRecalc (false)
, _complexDistance (0) , _complexDistance (0)
, _cameraShots (0) , _cameraShots (0)
, _cameraCalc (vehicle, settingsGroup) , _cameraCalc (vehicle, settingsGroup)
, _followTerrain (false) , _followTerrain (false)
, _loadedMissionItemsParent (NULL) , _loadedMissionItemsParent (nullptr)
, _metaDataMap (FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/TransectStyle.SettingsGroup.json"), this)) , _metaDataMap (FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/TransectStyle.SettingsGroup.json"), this))
, _turnAroundDistanceFact (settingsGroup, _metaDataMap[_vehicle->multiRotor() ? turnAroundDistanceMultiRotorName : turnAroundDistanceName]) , _turnAroundDistanceFact (settingsGroup, _metaDataMap[_vehicle->multiRotor() ? turnAroundDistanceMultiRotorName : turnAroundDistanceName])
, _cameraTriggerInTurnAroundFact (settingsGroup, _metaDataMap[cameraTriggerInTurnAroundName]) , _cameraTriggerInTurnAroundFact (settingsGroup, _metaDataMap[cameraTriggerInTurnAroundName])
...@@ -401,14 +400,6 @@ void TransectStyleComplexItem::_rebuildTransects(void) ...@@ -401,14 +400,6 @@ void TransectStyleComplexItem::_rebuildTransects(void)
emit timeBetweenShotsChanged(); emit timeBetweenShotsChanged();
} }
void TransectStyleComplexItem::_setBoundingCube(QGCGeoBoundingCube bc)
{
if (bc != _boundingCube) {
_boundingCube = bc;
emit boundingCubeChanged();
}
}
void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void) void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void)
{ {
_transectsPathHeightInfo.clear(); _transectsPathHeightInfo.clear();
......
...@@ -77,7 +77,6 @@ public: ...@@ -77,7 +77,6 @@ public:
int lastSequenceNumber (void) const final; int lastSequenceNumber (void) const final;
QString mapVisualQML (void) const override = 0; QString mapVisualQML (void) const override = 0;
bool load (const QJsonObject& complexObject, int sequenceNumber, QString& errorString) override = 0; bool load (const QJsonObject& complexObject, int sequenceNumber, QString& errorString) override = 0;
QGCGeoBoundingCube boundingCube (void) const override { return _boundingCube; }
double complexDistance (void) const final { return _complexDistance; } double complexDistance (void) const final { return _complexDistance; }
double greatestDistanceTo (const QGeoCoordinate &other) const final; double greatestDistanceTo (const QGeoCoordinate &other) const final;
...@@ -147,14 +146,11 @@ protected: ...@@ -147,14 +146,11 @@ protected:
double _triggerDistance (void) const; double _triggerDistance (void) const;
bool _hasTurnaround (void) const; bool _hasTurnaround (void) const;
double _turnaroundDistance (void) const; double _turnaroundDistance (void) const;
void _setBoundingCube (QGCGeoBoundingCube bc);
int _sequenceNumber; int _sequenceNumber;
bool _dirty;
QGeoCoordinate _coordinate; QGeoCoordinate _coordinate;
QGeoCoordinate _exitCoordinate; QGeoCoordinate _exitCoordinate;
QGCMapPolygon _surveyAreaPolygon; QGCMapPolygon _surveyAreaPolygon;
QGCGeoBoundingCube _boundingCube;
enum CoordType { enum CoordType {
CoordTypeInterior, ///< Interior waypoint for flight path only CoordTypeInterior, ///< Interior waypoint for flight path only
......
...@@ -45,7 +45,7 @@ VisualMissionItem::VisualMissionItem(Vehicle* vehicle, bool flyView, QObject* pa ...@@ -45,7 +45,7 @@ VisualMissionItem::VisualMissionItem(Vehicle* vehicle, bool flyView, QObject* pa
VisualMissionItem::VisualMissionItem(const VisualMissionItem& other, bool flyView, QObject* parent) VisualMissionItem::VisualMissionItem(const VisualMissionItem& other, bool flyView, QObject* parent)
: QObject (parent) : QObject (parent)
, _vehicle (NULL) , _vehicle (nullptr)
, _flyView (flyView) , _flyView (flyView)
, _isCurrentItem (false) , _isCurrentItem (false)
, _dirty (false) , _dirty (false)
...@@ -203,3 +203,12 @@ void VisualMissionItem::_terrainDataReceived(bool success, QList<double> heights ...@@ -203,3 +203,12 @@ void VisualMissionItem::_terrainDataReceived(bool success, QList<double> heights
emit terrainAltitudeChanged(_terrainAltitude); emit terrainAltitudeChanged(_terrainAltitude);
sender()->deleteLater(); sender()->deleteLater();
} }
void VisualMissionItem::_setBoundingCube(QGCGeoBoundingCube bc)
{
if (bc != _boundingCube) {
_boundingCube = bc;
emit boundingCubeChanged();
}
}
...@@ -68,6 +68,8 @@ public: ...@@ -68,6 +68,8 @@ public:
Q_PROPERTY(double missionVehicleYaw READ missionVehicleYaw NOTIFY missionVehicleYawChanged) ///< Expected vehicle yaw at this point in mission Q_PROPERTY(double missionVehicleYaw READ missionVehicleYaw NOTIFY missionVehicleYawChanged) ///< Expected vehicle yaw at this point in mission
Q_PROPERTY(bool flyView READ flyView CONSTANT) Q_PROPERTY(bool flyView READ flyView CONSTANT)
Q_PROPERTY(QGCGeoBoundingCube* boundingCube READ boundingCube NOTIFY boundingCubeChanged)
// The following properties are calculated/set by the MissionController recalc methods // The following properties are calculated/set by the MissionController recalc methods
Q_PROPERTY(double altDifference READ altDifference WRITE setAltDifference NOTIFY altDifferenceChanged) ///< Change in altitude from previous waypoint Q_PROPERTY(double altDifference READ altDifference WRITE setAltDifference NOTIFY altDifferenceChanged) ///< Change in altitude from previous waypoint
...@@ -121,6 +123,9 @@ public: ...@@ -121,6 +123,9 @@ public:
virtual double specifiedGimbalYaw (void) = 0; virtual double specifiedGimbalYaw (void) = 0;
virtual double specifiedGimbalPitch (void) = 0; virtual double specifiedGimbalPitch (void) = 0;
//-- Default implementation returns an invalid bounding cube
virtual QGCGeoBoundingCube* boundingCube (void) { return &_boundingCube; }
/// Update item to mission flight status at point where this item appears in mission. /// Update item to mission flight status at point where this item appears in mission.
/// IMPORTANT: Overrides must call base class implementation /// IMPORTANT: Overrides must call base class implementation
virtual void setMissionFlightStatus(MissionController::MissionFlightStatus_t& missionFlightStatus); virtual void setMissionFlightStatus(MissionController::MissionFlightStatus_t& missionFlightStatus);
...@@ -192,6 +197,7 @@ signals: ...@@ -192,6 +197,7 @@ signals:
void missionVehicleYawChanged (double missionVehicleYaw); void missionVehicleYawChanged (double missionVehicleYaw);
void terrainAltitudeChanged (double terrainAltitude); void terrainAltitudeChanged (double terrainAltitude);
void additionalTimeDelayChanged (void); void additionalTimeDelayChanged (void);
void boundingCubeChanged (void);
void coordinateHasRelativeAltitudeChanged (bool coordinateHasRelativeAltitude); void coordinateHasRelativeAltitudeChanged (bool coordinateHasRelativeAltitude);
void exitCoordinateHasRelativeAltitudeChanged (bool exitCoordinateHasRelativeAltitude); void exitCoordinateHasRelativeAltitudeChanged (bool exitCoordinateHasRelativeAltitude);
...@@ -214,11 +220,16 @@ protected: ...@@ -214,11 +220,16 @@ protected:
double _missionGimbalYaw; double _missionGimbalYaw;
double _missionVehicleYaw; double _missionVehicleYaw;
QGCGeoBoundingCube _boundingCube; ///< The bounding "cube" of this element.
MissionController::MissionFlightStatus_t _missionFlightStatus; MissionController::MissionFlightStatus_t _missionFlightStatus;
/// This is used to reference any subsequent mission items which do not specify a coordinate. /// This is used to reference any subsequent mission items which do not specify a coordinate.
QmlObjectListModel _childItems; QmlObjectListModel _childItems;
protected:
void _setBoundingCube (QGCGeoBoundingCube bc);
private slots: private slots:
void _updateTerrainAltitude (void); void _updateTerrainAltitude (void);
void _reallyUpdateTerrainAltitude (void); void _reallyUpdateTerrainAltitude (void);
......
...@@ -46,12 +46,12 @@ Rectangle { ...@@ -46,12 +46,12 @@ Rectangle {
property real _smallValueWidth: ScreenTools.defaultFontPixelWidth * 3 property real _smallValueWidth: ScreenTools.defaultFontPixelWidth * 3
property real _labelToValueSpacing: ScreenTools.defaultFontPixelWidth property real _labelToValueSpacing: ScreenTools.defaultFontPixelWidth
property real _rowSpacing: ScreenTools.isMobile ? 1 : 0 property real _rowSpacing: ScreenTools.isMobile ? 1 : 0
property real _distance: _statusValid ? currentMissionItem.distance : NaN property real _distance: _statusValid && currentMissionItem ? currentMissionItem.distance : NaN
property real _altDifference: _statusValid ? currentMissionItem.altDifference : NaN property real _altDifference: _statusValid && currentMissionItem ? currentMissionItem.altDifference : NaN
property real _gradient: _statusValid && currentMissionItem.distance > 0 ? Math.atan(currentMissionItem.altDifference / currentMissionItem.distance) : NaN property real _gradient: _statusValid && currentMissionItem && currentMissionItem.distance > 0 ? Math.atan(currentMissionItem.altDifference / currentMissionItem.distance) : NaN
property real _gradientPercent: isNaN(_gradient) ? NaN : _gradient * 100 property real _gradientPercent: isNaN(_gradient) ? NaN : _gradient * 100
property real _azimuth: _statusValid ? currentMissionItem.azimuth : NaN property real _azimuth: _statusValid && currentMissionItem ? currentMissionItem.azimuth : NaN
property real _heading: _statusValid ? currentMissionItem.missionVehicleYaw : NaN property real _heading: _statusValid && currentMissionItem ? currentMissionItem.missionVehicleYaw : NaN
property real _missionDistance: _missionValid ? missionDistance : NaN property real _missionDistance: _missionValid ? missionDistance : NaN
property real _missionMaxTelemetry: _missionValid ? missionMaxTelemetry : NaN property real _missionMaxTelemetry: _missionValid ? missionMaxTelemetry : NaN
property real _missionTime: _missionValid ? missionTime : NaN property real _missionTime: _missionValid ? missionTime : NaN
......
...@@ -377,6 +377,7 @@ QGCApplication::~QGCApplication() ...@@ -377,6 +377,7 @@ QGCApplication::~QGCApplication()
void QGCApplication::_initCommon(void) void QGCApplication::_initCommon(void)
{ {
static const char* kRefOnly = "Reference only";
QSettings settings; QSettings settings;
// Register our Qml objects // Register our Qml objects
...@@ -384,31 +385,35 @@ void QGCApplication::_initCommon(void) ...@@ -384,31 +385,35 @@ void QGCApplication::_initCommon(void)
qmlRegisterType<QGCPalette> ("QGroundControl.Palette", 1, 0, "QGCPalette"); qmlRegisterType<QGCPalette> ("QGroundControl.Palette", 1, 0, "QGCPalette");
qmlRegisterType<QGCMapPalette> ("QGroundControl.Palette", 1, 0, "QGCMapPalette"); qmlRegisterType<QGCMapPalette> ("QGroundControl.Palette", 1, 0, "QGCMapPalette");
qmlRegisterUncreatableType<CoordinateVector> ("QGroundControl", 1, 0, "CoordinateVector", "Reference only"); qmlRegisterUncreatableType<CoordinateVector> ("QGroundControl", 1, 0, "CoordinateVector", kRefOnly);
qmlRegisterUncreatableType<QmlObjectListModel> ("QGroundControl", 1, 0, "QmlObjectListModel", "Reference only"); qmlRegisterUncreatableType<QmlObjectListModel> ("QGroundControl", 1, 0, "QmlObjectListModel", kRefOnly);
qmlRegisterUncreatableType<MissionCommandTree> ("QGroundControl", 1, 0, "MissionCommandTree", "Reference only"); qmlRegisterUncreatableType<MissionCommandTree> ("QGroundControl", 1, 0, "MissionCommandTree", kRefOnly);
qmlRegisterUncreatableType<CameraCalc> ("QGroundControl", 1, 0, "CameraCalc", "Reference only"); qmlRegisterUncreatableType<CameraCalc> ("QGroundControl", 1, 0, "CameraCalc", kRefOnly);
qmlRegisterUncreatableType<AutoPilotPlugin> ("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Reference only"); qmlRegisterUncreatableType<AutoPilotPlugin> ("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", kRefOnly);
qmlRegisterUncreatableType<VehicleComponent> ("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "Reference only"); qmlRegisterUncreatableType<VehicleComponent> ("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", kRefOnly);
qmlRegisterUncreatableType<Vehicle> ("QGroundControl.Vehicle", 1, 0, "Vehicle", "Reference only"); qmlRegisterUncreatableType<Vehicle> ("QGroundControl.Vehicle", 1, 0, "Vehicle", kRefOnly);
qmlRegisterUncreatableType<MissionItem> ("QGroundControl.Vehicle", 1, 0, "MissionItem", "Reference only"); qmlRegisterUncreatableType<MissionItem> ("QGroundControl.Vehicle", 1, 0, "MissionItem", kRefOnly);
qmlRegisterUncreatableType<MissionManager> ("QGroundControl.Vehicle", 1, 0, "MissionManager", "Reference only"); qmlRegisterUncreatableType<MissionManager> ("QGroundControl.Vehicle", 1, 0, "MissionManager", kRefOnly);
qmlRegisterUncreatableType<ParameterManager> ("QGroundControl.Vehicle", 1, 0, "ParameterManager", "Reference only"); qmlRegisterUncreatableType<ParameterManager> ("QGroundControl.Vehicle", 1, 0, "ParameterManager", kRefOnly);
qmlRegisterUncreatableType<QGCCameraManager> ("QGroundControl.Vehicle", 1, 0, "QGCCameraManager", "Reference only"); qmlRegisterUncreatableType<QGCCameraManager> ("QGroundControl.Vehicle", 1, 0, "QGCCameraManager", kRefOnly);
qmlRegisterUncreatableType<QGCCameraControl> ("QGroundControl.Vehicle", 1, 0, "QGCCameraControl", "Reference only"); qmlRegisterUncreatableType<QGCCameraControl> ("QGroundControl.Vehicle", 1, 0, "QGCCameraControl", kRefOnly);
qmlRegisterUncreatableType<LinkInterface> ("QGroundControl.Vehicle", 1, 0, "LinkInterface", "Reference only"); qmlRegisterUncreatableType<LinkInterface> ("QGroundControl.Vehicle", 1, 0, "LinkInterface", kRefOnly);
qmlRegisterUncreatableType<JoystickManager> ("QGroundControl.JoystickManager", 1, 0, "JoystickManager", "Reference only"); qmlRegisterUncreatableType<JoystickManager> ("QGroundControl.JoystickManager", 1, 0, "JoystickManager", kRefOnly);
qmlRegisterUncreatableType<Joystick> ("QGroundControl.JoystickManager", 1, 0, "Joystick", "Reference only"); qmlRegisterUncreatableType<Joystick> ("QGroundControl.JoystickManager", 1, 0, "Joystick", kRefOnly);
qmlRegisterUncreatableType<QGCPositionManager> ("QGroundControl.QGCPositionManager", 1, 0, "QGCPositionManager", "Reference only"); qmlRegisterUncreatableType<QGCPositionManager> ("QGroundControl.QGCPositionManager", 1, 0, "QGCPositionManager", kRefOnly);
qmlRegisterUncreatableType<QGCMapPolygon> ("QGroundControl.FlightMap", 1, 0, "QGCMapPolygon", "Reference only"); qmlRegisterUncreatableType<MissionController> ("QGroundControl.Controllers", 1, 0, "MissionController", kRefOnly);
qmlRegisterUncreatableType<MissionController> ("QGroundControl.Controllers", 1, 0, "MissionController", "Reference only"); qmlRegisterUncreatableType<GeoFenceController> ("QGroundControl.Controllers", 1, 0, "GeoFenceController", kRefOnly);
qmlRegisterUncreatableType<GeoFenceController> ("QGroundControl.Controllers", 1, 0, "GeoFenceController", "Reference only"); qmlRegisterUncreatableType<RallyPointController>("QGroundControl.Controllers", 1, 0, "RallyPointController", kRefOnly);
qmlRegisterUncreatableType<RallyPointController>("QGroundControl.Controllers", 1, 0, "RallyPointController", "Reference only"); qmlRegisterUncreatableType<VisualMissionItem> ("QGroundControl.Controllers", 1, 0, "VisualMissionItem", kRefOnly);
qmlRegisterUncreatableType<VisualMissionItem> ("QGroundControl.Controllers", 1, 0, "VisualMissionItem", "Reference only"); qmlRegisterUncreatableType<FactValueSliderListModel>("QGroundControl.FactControls", 1, 0, "FactValueSliderListModel", kRefOnly);
qmlRegisterUncreatableType<FactValueSliderListModel>("QGroundControl.FactControls", 1, 0, "FactValueSliderListModel","Reference only");
qmlRegisterUncreatableType<QGCMapPolygon> ("QGroundControl.FlightMap", 1, 0, "QGCMapPolygon", kRefOnly);
qmlRegisterType<QGCGeoBoundingCube> ("QGroundControl", 1, 0, "QGCGeoBoundingCube"); qmlRegisterUncreatableType<QGCGeoBoundingCube> ("QGroundControl.FlightMap", 1, 0, "QGCGeoBoundingCube", kRefOnly);
// qRegisterMetaType<QGCGeoBoundingCube>("QGCGeoBoundingCube");
qmlRegisterType<QGCMapCircle> ("QGroundControl.FlightMap", 1, 0, "QGCMapCircle");
qmlRegisterType<ParameterEditorController> ("QGroundControl.Controllers", 1, 0, "ParameterEditorController"); qmlRegisterType<ParameterEditorController> ("QGroundControl.Controllers", 1, 0, "ParameterEditorController");
qmlRegisterType<ESP8266ComponentController> ("QGroundControl.Controllers", 1, 0, "ESP8266ComponentController"); qmlRegisterType<ESP8266ComponentController> ("QGroundControl.Controllers", 1, 0, "ESP8266ComponentController");
...@@ -421,7 +426,7 @@ void QGCApplication::_initCommon(void) ...@@ -421,7 +426,7 @@ void QGCApplication::_initCommon(void)
qmlRegisterType<LogDownloadController> ("QGroundControl.Controllers", 1, 0, "LogDownloadController"); qmlRegisterType<LogDownloadController> ("QGroundControl.Controllers", 1, 0, "LogDownloadController");
qmlRegisterType<SyslinkComponentController> ("QGroundControl.Controllers", 1, 0, "SyslinkComponentController"); qmlRegisterType<SyslinkComponentController> ("QGroundControl.Controllers", 1, 0, "SyslinkComponentController");
qmlRegisterType<EditPositionDialogController> ("QGroundControl.Controllers", 1, 0, "EditPositionDialogController"); qmlRegisterType<EditPositionDialogController> ("QGroundControl.Controllers", 1, 0, "EditPositionDialogController");
qmlRegisterType<QGCMapCircle> ("QGroundControl.FlightMap", 1, 0, "QGCMapCircle");
#ifndef __mobile__ #ifndef __mobile__
qmlRegisterType<ViewWidgetController> ("QGroundControl.Controllers", 1, 0, "ViewWidgetController"); qmlRegisterType<ViewWidgetController> ("QGroundControl.Controllers", 1, 0, "ViewWidgetController");
qmlRegisterType<CustomCommandWidgetController> ("QGroundControl.Controllers", 1, 0, "CustomCommandWidgetController"); qmlRegisterType<CustomCommandWidgetController> ("QGroundControl.Controllers", 1, 0, "CustomCommandWidgetController");
......
...@@ -18,6 +18,13 @@ double QGCGeoBoundingCube::MaxSouth = -90.0; ...@@ -18,6 +18,13 @@ double QGCGeoBoundingCube::MaxSouth = -90.0;
double QGCGeoBoundingCube::MaxWest = -180.0; double QGCGeoBoundingCube::MaxWest = -180.0;
double QGCGeoBoundingCube::MaxEast = 180.0; double QGCGeoBoundingCube::MaxEast = 180.0;
//-----------------------------------------------------------------------------
QGCGeoBoundingCube::QGCGeoBoundingCube(QObject* parent)
: QObject(parent)
{
reset();
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
QGCGeoBoundingCube::isValid() const QGCGeoBoundingCube::isValid() const
...@@ -30,8 +37,8 @@ QGCGeoBoundingCube::isValid() const ...@@ -30,8 +37,8 @@ QGCGeoBoundingCube::isValid() const
void void
QGCGeoBoundingCube::reset() QGCGeoBoundingCube::reset()
{ {
pointSE = QGeoCoordinate(); pointNW = QGeoCoordinate(MaxSouth, MaxEast, MaxAlt);
pointNW = QGeoCoordinate(); pointSE = QGeoCoordinate(MaxNorth, MaxWest, MinAlt);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
class QGCGeoBoundingCube : public QObject { class QGCGeoBoundingCube : public QObject {
Q_OBJECT Q_OBJECT
public: public:
QGCGeoBoundingCube(QObject* parent = nullptr);
QGCGeoBoundingCube(const QGCGeoBoundingCube& other) QGCGeoBoundingCube(const QGCGeoBoundingCube& other)
: QObject() : QObject()
{ {
...@@ -25,12 +27,6 @@ public: ...@@ -25,12 +27,6 @@ public:
pointSE = other.pointSE; pointSE = other.pointSE;
} }
QGCGeoBoundingCube()
: pointNW(QGeoCoordinate(MaxSouth, MaxEast, MaxAlt))
, pointSE(QGeoCoordinate(MaxNorth, MaxWest, MinAlt))
{
}
QGCGeoBoundingCube(QGeoCoordinate p1, QGeoCoordinate p2) QGCGeoBoundingCube(QGeoCoordinate p1, QGeoCoordinate p2)
: pointNW(p1) : pointNW(p1)
, pointSE(p2) , pointSE(p2)
...@@ -38,7 +34,7 @@ public: ...@@ -38,7 +34,7 @@ public:
} }
Q_PROPERTY(QGeoCoordinate pointNW MEMBER pointNW CONSTANT) Q_PROPERTY(QGeoCoordinate pointNW MEMBER pointNW CONSTANT)
Q_PROPERTY(QGeoCoordinate pointSE MEMBER pointNW CONSTANT) Q_PROPERTY(QGeoCoordinate pointSE MEMBER pointSE CONSTANT)
Q_INVOKABLE void reset (); Q_INVOKABLE void reset ();
Q_INVOKABLE bool isValid () const; Q_INVOKABLE bool isValid () const;
...@@ -64,7 +60,7 @@ public: ...@@ -64,7 +60,7 @@ public:
} }
//-- 2D //-- 2D
QList<QGeoCoordinate> polygon2D(double clipTo = 0.0) const; Q_INVOKABLE QList<QGeoCoordinate> polygon2D(double clipTo = 0.0) const;
Q_INVOKABLE double width () const; Q_INVOKABLE double width () const;
Q_INVOKABLE double height () const; Q_INVOKABLE double height () const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment