#include "WimaGlobalMeasurementPolygon.h" WimaGlobalMeasurementPolygon::WimaGlobalMeasurementPolygon(QObject *parent): WimaPolygon (parent) { } WimaGlobalMeasurementPolygon::WimaGlobalMeasurementPolygon(QGCMapPolygon *other, QObject *parent): WimaPolygon (other, parent) { } void WimaGlobalMeasurementPolygon::addVehicle(Vehicle *vehicle) { if(vehicle != nullptr){ _vehicleList.append(vehicle); emit vehicleListChanged(_vehicleList); } } void WimaGlobalMeasurementPolygon::removeVehicle(int vehicleIndex) { if(vehicleIndex >= 0 && vehicleIndex < _vehicleList.count()){ _vehicleList.removeAt(vehicleIndex); emit vehicleListChanged(_vehicleList); } } void WimaGlobalMeasurementPolygon::recalculatesubPolygons() { int vehicleCount = _vehicleList->count(); WimaVehicleMeasurementPolygon* newPolygon = new WimaVehicleMeasurementPolygon(this); _subPolygons = this->splitPolygonArea(vehicleCount); } void WimaGlobalMeasurementPolygon::removeAllVehicles() { int counter = _vehicleList->count()-1; while(counter >= 0){ _vehicleList->removeAt(0); counter--; } emit vehicleListChanged(_vehicleList); } void WimaGlobalMeasurementPolygon::setBottomLayerAltitude(double altitude) { if(altitude > 0 && altitude != _bottomLayerAltitude){ _bottomLayerAltitude = altitude; emit bottomLayerAltitudeChanged(altitude); } } void WimaGlobalMeasurementPolygon::setNumberOfLayers(int numberOfLayers) { if(numberOfLayers > 0 && _numberOfLayers != numberOfLayers){ _numberOfLayers = numberOfLayers; emit numberOfLayersChanged(numberOfLayers); } } void WimaGlobalMeasurementPolygon::setLayerDistance(double distance) { if(distance > 0 && distance != _layerDistance){ _layerDistance = distance; emit layerDistanceChanged(distance); } }