本文整理汇总了C++中DimensionDescriptor::isActiveNumberValid方法的典型用法代码示例。如果您正苦于以下问题:C++ DimensionDescriptor::isActiveNumberValid方法的具体用法?C++ DimensionDescriptor::isActiveNumberValid怎么用?C++ DimensionDescriptor::isActiveNumberValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DimensionDescriptor
的用法示例。
在下文中一共展示了DimensionDescriptor::isActiveNumberValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setDisplayBands
void PropertiesRasterLayer::setDisplayBands(QAction* pAction)
{
if (mpRasterLayer == NULL)
{
return;
}
RasterElement* pRasterElement = dynamic_cast<RasterElement*>(mpRasterLayer->getDataElement());
if (pRasterElement == NULL)
{
return;
}
const RasterDataDescriptor* pDescriptor =
dynamic_cast<const RasterDataDescriptor*>(pRasterElement->getDataDescriptor());
if (pDescriptor == NULL)
{
return;
}
const std::string name = pAction->text().toStdString();
DimensionDescriptor redBand;
DimensionDescriptor greenBand;
DimensionDescriptor blueBand;
if (RasterUtilities::findColorCompositeDimensionDescriptors(
pDescriptor, name, redBand, greenBand, blueBand) == false)
{
Service<DesktopServices>()->showSuppressibleMsgDlg("Error",
"Unable to display " + name + ": required wavelengths do not exist for all bands. "
"Broaden the wavelength region or specify band numbers in the Raster Layers section of the Options dialog.",
MESSAGE_ERROR, PropertiesRasterLayer::getDisplayAsWarningDialogId());
}
// If at least one of red, green, or blue is valid set display mode to RGB and update the combo boxes appropriately
if (redBand.isActiveNumberValid() || greenBand.isActiveNumberValid() || blueBand.isActiveNumberValid())
{
mpDisplayModeCombo->setCurrentIndex(1);
mpRedBandCombo->setCurrentIndex(redBand.isActiveNumberValid() ? redBand.getActiveNumber() : -1);
mpGreenBandCombo->setCurrentIndex(greenBand.isActiveNumberValid() ? greenBand.getActiveNumber() : -1);
mpBlueBandCombo->setCurrentIndex(blueBand.isActiveNumberValid() ? blueBand.getActiveNumber() : -1);
}
}
示例2: updateDisplayedBandCombo
void PropertiesRasterLayer::updateDisplayedBandCombo(int index)
{
// Get the selected raster element
RasterElement* pElement = NULL;
if ((index > -1) && (static_cast<int>(mRasterElements.size()) > index))
{
pElement = mRasterElements[index];
}
// Get the band names from the element
QStringList strBandNames;
if (pElement != NULL)
{
RasterDataDescriptor* pDescriptor = dynamic_cast<RasterDataDescriptor*>(pElement->getDataDescriptor());
if (pDescriptor != NULL)
{
vector<string> bandNames = RasterUtilities::getBandNames(pDescriptor);
for (vector<string>::iterator iter = bandNames.begin(); iter != bandNames.end(); ++iter)
{
strBandNames.append(QString::fromStdString(*iter));
}
}
}
// Update the display band combo
QComboBox* pCombo = dynamic_cast<QComboBox*>(sender());
if (pCombo == mpGrayElementCombo)
{
mpGrayBandCombo->clear();
mpGrayBandCombo->addItems(strBandNames);
if (strBandNames.isEmpty() == false)
{
mpGrayBandCombo->setCurrentIndex(0);
if ((mpRasterLayer != NULL) && (mpRasterLayer->getDataElement() == pElement))
{
DimensionDescriptor displayedBand = mpRasterLayer->getDisplayedBand(GRAY);
if (displayedBand.isActiveNumberValid() == true)
{
mpGrayBandCombo->setCurrentIndex(displayedBand.getActiveNumber());
}
}
}
}
else if (pCombo == mpRedElementCombo)
{
mpRedBandCombo->clear();
mpRedBandCombo->addItems(strBandNames);
if (strBandNames.isEmpty() == false)
{
mpRedBandCombo->setCurrentIndex(0);
if ((mpRasterLayer != NULL) && (mpRasterLayer->getDataElement() == pElement))
{
DimensionDescriptor displayedBand = mpRasterLayer->getDisplayedBand(RED);
if (displayedBand.isActiveNumberValid() == true)
{
mpRedBandCombo->setCurrentIndex(displayedBand.getActiveNumber());
}
}
}
}
else if (pCombo == mpGreenElementCombo)
{
mpGreenBandCombo->clear();
mpGreenBandCombo->addItems(strBandNames);
if (strBandNames.isEmpty() == false)
{
mpGreenBandCombo->setCurrentIndex(0);
if ((mpRasterLayer != NULL) && (mpRasterLayer->getDataElement() == pElement))
{
DimensionDescriptor displayedBand = mpRasterLayer->getDisplayedBand(GREEN);
if (displayedBand.isActiveNumberValid() == true)
{
mpGreenBandCombo->setCurrentIndex(displayedBand.getActiveNumber());
}
}
}
}
else if (pCombo == mpBlueElementCombo)
{
mpBlueBandCombo->clear();
mpBlueBandCombo->addItems(strBandNames);
if (strBandNames.isEmpty() == false)
{
mpBlueBandCombo->setCurrentIndex(0);
if ((mpRasterLayer != NULL) && (mpRasterLayer->getDataElement() == pElement))
{
DimensionDescriptor displayedBand = mpRasterLayer->getDisplayedBand(BLUE);
if (displayedBand.isActiveNumberValid() == true)
{
mpBlueBandCombo->setCurrentIndex(displayedBand.getActiveNumber());
}
}
}
}
}