void AbstractRenderView::hideDataObjects(const QList<DataObject *> & dataObjects, int subViewIndex) { assert(subViewIndex < 0 || static_cast<unsigned>(subViewIndex) < numberOfSubViews()); if (subViewIndex >= 0 && static_cast<unsigned>(subViewIndex) >= numberOfSubViews()) { qDebug() << "Trying to AbstractRenderView::hideDataObjects on sub-view" << subViewIndex << "while having only" << numberOfSubViews() << "views."; return; } hideDataObjectsImpl(dataObjects, subViewIndex); }
void AbstractDataView::setActiveSubView(unsigned int subViewIndex) { assert(subViewIndex < numberOfSubViews()); if (subViewIndex >= numberOfSubViews()) { return; } if (m_activeSubViewIndex == subViewIndex) { return; } m_activeSubViewIndex = subViewIndex; activeSubViewChangedEvent(m_activeSubViewIndex); emit activeSubViewChanged(m_activeSubViewIndex); }
const QString & AbstractDataView::subViewFriendlyName(unsigned int subViewIndex) { static const QString emptyName = ""; friendlyName(); // trigger update if required assert(subViewIndex <= numberOfSubViews()); return subViewIndex < m_subViewFriendlyNames.size() ? m_subViewFriendlyNames[subViewIndex] : emptyName; }
QList<DataObject *> AbstractRenderView::dataObjects(int subViewIndexOrAll) const { assert(subViewIndexOrAll >= -1); // -1 means all view, all smaller numbers are invalid if (subViewIndexOrAll >= int(numberOfSubViews())) { qDebug() << "Trying to AbstractRenderView::dataObjects on sub-view" << subViewIndexOrAll << "while having only" << numberOfSubViews() << "views."; return{}; } return dataObjectsImpl(subViewIndexOrAll); }
QList<AbstractVisualizedData *> AbstractRenderView::visualizations(int subViewIndex) const { assert(subViewIndex == -1 || (unsigned int)(subViewIndex) < numberOfSubViews()); return visualizationsImpl(subViewIndex); }
void AbstractRenderView::showDataObjects( const QList<DataObject *> & dataObjects, QList<DataObject *> & incompatibleObjects, unsigned int subViewIndex) { assert(subViewIndex < numberOfSubViews()); if (subViewIndex >= numberOfSubViews()) { qDebug() << "Trying to AbstractRenderView::showDataObjects on sub-view" << subViewIndex << "while having only" << numberOfSubViews() << "views."; return; } QList<CoordinateTransformableDataObject *> transformableObjects; bool hasTransformables = false; for (auto dataObject : dataObjects) { auto transformable = dynamic_cast<CoordinateTransformableDataObject *>(dataObject); transformableObjects << transformable; if (transformable && transformable->coordinateSystem().isValid()) { hasTransformables = true; } } if (visualizations().isEmpty()) { setCurrentCoordinateSystem({}); } QList<DataObject *> possibleCompatibleObjects; bool haveValidSystem = currentCoordinateSystem().isValid(); // Once there is a valid coordinate system specification, don't allow to mix incompatible // representations if (hasTransformables || haveValidSystem) { for (int inIdx = 0; inIdx < dataObjects.size(); ++inIdx) { auto transformable = transformableObjects[inIdx]; if (!transformable) { incompatibleObjects << dataObjects[inIdx]; continue; } if (!haveValidSystem) { // set the coordinate system to the system of the first loaded object auto spec = transformable->coordinateSystem(); if (spec.type == CoordinateSystemType::metricGlobal || spec.type == CoordinateSystemType::metricLocal) { spec.unitOfMeasurement = "km"; } setCurrentCoordinateSystem(spec); haveValidSystem = true; possibleCompatibleObjects << dataObjects[inIdx]; continue; } if (!transformable->canTransformTo(currentCoordinateSystem())) { incompatibleObjects << dataObjects[inIdx]; continue; } possibleCompatibleObjects << dataObjects[inIdx]; } } else { possibleCompatibleObjects = dataObjects; } initializeForFirstPaint(); showDataObjectsImpl(possibleCompatibleObjects, incompatibleObjects, subViewIndex); }