void GeocoordTypeComboBox::setGeocoordType(GeocoordType geocoordType) { if (geocoordType != getGeocoordType()) { int index = -1; if (geocoordType.isValid() == true) { std::string typeText = StringUtilities::toDisplayString(geocoordType); if (typeText.empty() == false) { index = findText(QString::fromStdString(typeText)); } } setCurrentIndex(index); } }
QWidget* ResultsExporter::getExportOptionsWidget(const PlugInArgList *pInArgList) { const DataDescriptor* pDescriptor = NULL; if (pInArgList != NULL) { RasterElement* pElement = pInArgList->getPlugInArgValue<RasterElement>(Exporter::ExportItemArg()); if (pElement != NULL) { pDescriptor = pElement->getDataDescriptor(); } } if (mpOptionsWidget == NULL) { Service<DesktopServices> pDesktop; VERIFY(pDesktop.get() != NULL); mpOptionsWidget = new ResultsOptionsWidget(pDesktop->getMainWidget()); } if (mpOptionsWidget != NULL) { const string& name = pDescriptor->getName(); const string& type = pDescriptor->getType(); DataElement* pParent = pDescriptor->getParent(); RasterElement* pResults = dynamic_cast<RasterElement*>(mpModel->getElement(name, type, pParent)); if (pResults != NULL) { GeocoordType geocoordType; PassArea passArea = MIDDLE; double dFirstThreshold = 0.0; double dSecondThreshold = 0.0; SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(mpDesktop->getCurrentWorkspaceWindow()); if (pWindow != NULL) { SpatialDataView* pView = pWindow->getSpatialDataView(); if (pView != NULL) { LayerList* pLayerList = pView->getLayerList(); if (pLayerList != NULL) { ThresholdLayer* pThresholdLayer = static_cast<ThresholdLayer*>(pLayerList->getLayer(THRESHOLD, pResults)); if (pThresholdLayer != NULL) { passArea = pThresholdLayer->getPassArea(); dFirstThreshold = pThresholdLayer->getFirstThreshold(); dSecondThreshold = pThresholdLayer->getSecondThreshold(); } else { Statistics* pStatistics = pResults->getStatistics(); if (pStatistics != NULL) { dFirstThreshold = pStatistics->getMin(); dSecondThreshold = pStatistics->getMax(); } } } LatLonLayer* pLatLonLayer = static_cast<LatLonLayer*>(pView->getTopMostLayer(LAT_LONG)); if (pLatLonLayer != NULL) { geocoordType = pLatLonLayer->getGeocoordType(); } } if (geocoordType.isValid() == false) { bool hasGeoData = pResults->isGeoreferenced(); if (hasGeoData == false) { RasterElement* pParent = dynamic_cast<RasterElement*>(mpResults->getParent()); if (pParent != NULL) { hasGeoData = pParent->isGeoreferenced(); } } if (hasGeoData == true) { geocoordType = Georeference::getSettingGeocoordType(); } } } mpOptionsWidget->setGeocoordType(geocoordType); mpOptionsWidget->setPassArea(passArea); mpOptionsWidget->setFirstThreshold(dFirstThreshold); mpOptionsWidget->setSecondThreshold(dSecondThreshold); } } return mpOptionsWidget; }