本文整理汇总了C++中DimensionDescriptor::getOriginalNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ DimensionDescriptor::getOriginalNumber方法的具体用法?C++ DimensionDescriptor::getOriginalNumber怎么用?C++ DimensionDescriptor::getOriginalNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DimensionDescriptor
的用法示例。
在下文中一共展示了DimensionDescriptor::getOriginalNumber方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getBandNames
QStringList ReplaceBandInputWizard::getBandNames(const RasterDataDescriptor* pDesc) const
{
const DynamicObject* pMetadata = pDesc->getMetadata();
const std::vector<DimensionDescriptor>& bands = pDesc->getBands();
std::vector<std::string> bandNames;
std::string pNamesPath[] = { SPECIAL_METADATA_NAME, BAND_METADATA_NAME, NAMES_METADATA_NAME, END_METADATA_NAME };
const std::vector<std::string>* pBandNames = dv_cast<std::vector<std::string> >(&pMetadata->getAttributeByPath(pNamesPath));
if ((pBandNames != NULL) && (pBandNames->size() == bands.size()))
{
bandNames = *pBandNames;
}
else
{
std::string pPrefixPath[] = { SPECIAL_METADATA_NAME, BAND_NAME_PREFIX_METADATA_NAME, END_METADATA_NAME };
const std::string* pBandPrefix = dv_cast<std::string>(&pMetadata->getAttributeByPath(pPrefixPath));
if (pBandPrefix != NULL)
{
std::string bandNamePrefix = *pBandPrefix;
for (std::vector<DimensionDescriptor>::const_iterator band = bands.begin(); band != bands.end(); ++band)
{
bandNames.push_back(bandNamePrefix + " " + StringUtilities::toDisplayString(band->getOriginalNumber() + 1));
}
}
}
QStringList qBandNames;
for (unsigned int i = 0; i < bands.size(); i++)
{
DimensionDescriptor bandDim = bands[i];
QString name;
if ((i < bandNames.size()) && (bands.size() == bandNames.size()))
{
name = QString::fromStdString(bandNames[i]);
}
else
{
name = "Band ";
if (bandDim.isOriginalNumberValid())
{
unsigned int originalNumber = bandDim.getOriginalNumber() + 1;
name.append(QString::number(originalNumber));
}
}
qBandNames.append(name);
}
return qBandNames;
}
示例2: createView
void ChippingWindow::createView()
{
if (mpChippingWidget == NULL)
{
return;
}
RasterElement* pRaster = getRasterElement();
if (pRaster == NULL)
{
return;
}
// Create the new raster element from the primary element of the source.
// Note that this does not chip displayed elements if they differ from the primary element.
// This causes a special case below where the stretch values are being applied to the chipped layer.
RasterElement* pRasterChip = pRaster->createChip(pRaster->getParent(), "_chip",
mpChippingWidget->getChipRows(), mpChippingWidget->getChipColumns(), mpChippingWidget->getChipBands());
if (pRasterChip == NULL)
{
QMessageBox::critical(this, windowTitle(), "Unable to create a new cube!");
return;
}
const RasterDataDescriptor* pDescriptor =
dynamic_cast<const RasterDataDescriptor*>(pRasterChip->getDataDescriptor());
VERIFYNRV(pDescriptor != NULL);
// Create a view for the new chip
SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(
Service<DesktopServices>()->createWindow(pRasterChip->getName(), SPATIAL_DATA_WINDOW));
if (pWindow == NULL)
{
return;
}
SpatialDataView* pView = pWindow->getSpatialDataView();
if (pView == NULL)
{
Service<DesktopServices>()->deleteWindow(pWindow);
return;
}
UndoLock lock(pView);
if (pView->setPrimaryRasterElement(pRasterChip) == false)
{
Service<DesktopServices>()->deleteWindow(pWindow);
return;
}
// RasterLayerImp is needed for the call to setCurrentStretchAsOriginalStretch().
RasterLayerImp* pLayer = dynamic_cast<RasterLayerImp*>(pView->createLayer(RASTER, pRasterChip));
if (pLayer == NULL)
{
Service<DesktopServices>()->deleteWindow(pWindow);
return;
}
string origName = pRaster->getName();
SpatialDataWindow* pOrigWindow = dynamic_cast<SpatialDataWindow*>(
Service<DesktopServices>()->getWindow(origName, SPATIAL_DATA_WINDOW));
if (pOrigWindow != NULL)
{
SpatialDataView* pOrigView = pOrigWindow->getSpatialDataView();
if (pOrigView != NULL)
{
LayerList* pLayerList = pOrigView->getLayerList();
if (pLayerList != NULL)
{
RasterLayer* pOrigLayer = static_cast<RasterLayer*>(pLayerList->getLayer(RASTER, pRaster));
if (pOrigLayer != NULL)
{
// Set the stretch type first so that stretch values are interpreted correctly.
pLayer->setStretchType(GRAYSCALE_MODE, pOrigLayer->getStretchType(GRAYSCALE_MODE));
pLayer->setStretchType(RGB_MODE, pOrigLayer->getStretchType(RGB_MODE));
pLayer->setDisplayMode(pOrigLayer->getDisplayMode());
// Set the properties of the cube layer in the new view.
// For each channel, display the first band if the previously displayed band was chipped.
vector<RasterChannelType> channels = StringUtilities::getAllEnumValues<RasterChannelType>();
for (vector<RasterChannelType>::const_iterator iter = channels.begin(); iter != channels.end(); ++iter)
{
bool bandCopied = true;
DimensionDescriptor newBand;
DimensionDescriptor oldBand = pOrigLayer->getDisplayedBand(*iter);
if (oldBand.isOriginalNumberValid() == true)
{
newBand = pDescriptor->getOriginalBand(oldBand.getOriginalNumber());
}
if (newBand.isValid() == false)
{
bandCopied = false;
newBand = pDescriptor->getBands().front();
}
// No need to explicitly set the RasterElement here since the new view only has one RasterElement.
pLayer->setDisplayedBand(*iter, newBand);
//.........这里部分代码省略.........
示例3: createRasterLayer
RasterLayer* RasterElementImporterShell::createRasterLayer(SpatialDataView* pView, Step* pStep) const
{
if ((pView == NULL) || (mpRasterElement == NULL))
{
return NULL;
}
RasterLayer* pLayer = static_cast<RasterLayer*>(pView->createLayer(RASTER, mpRasterElement));
if (pLayer != NULL)
{
// Log the initial cube layer properties
const RasterDataDescriptor* pDescriptor =
dynamic_cast<RasterDataDescriptor*>(mpRasterElement->getDataDescriptor());
VERIFYRV(pDescriptor != NULL, NULL);
if (pStep != NULL)
{
DimensionDescriptor grayBand = pDescriptor->getDisplayBand(GRAY);
DimensionDescriptor redBand = pDescriptor->getDisplayBand(RED);
DimensionDescriptor greenBand = pDescriptor->getDisplayBand(GREEN);
DimensionDescriptor blueBand = pDescriptor->getDisplayBand(BLUE);
DisplayMode displayMode = pDescriptor->getDisplayMode();
if (grayBand.isOriginalNumberValid())
{
pStep->addProperty("Gray Band", grayBand.getOriginalNumber());
}
if (redBand.isOriginalNumberValid())
{
pStep->addProperty("Red Band", redBand.getOriginalNumber());
}
else
{
pStep->addProperty("Red Band", "No Band Displayed");
}
if (greenBand.isOriginalNumberValid())
{
pStep->addProperty("Green Band", greenBand.getOriginalNumber());
}
else
{
pStep->addProperty("Green Band", "No Band Displayed");
}
if (blueBand.isOriginalNumberValid())
{
pStep->addProperty("Blue Band", blueBand.getOriginalNumber());
}
else
{
pStep->addProperty("Blue Band", "No Band Displayed");
}
pStep->addProperty("Display Mode", StringUtilities::toDisplayString(displayMode));
}
}
else
{
string message = "Could not create the raster layer.";
if (mpProgress != NULL)
{
mpProgress->updateProgress(message, 0, WARNING);
}
if (pStep != NULL)
{
pStep->addMessage(message, "app", "3F06A978-3F1A-4E03-BBA7-E295A8B7CF72");
}
}
return pLayer;
}
示例4: validate
bool RasterElementImporterShell::validate(const DataDescriptor* pDescriptor,
const vector<const DataDescriptor*>& importedDescriptors,
string& errorMessage) const
{
bool isValid = ImporterShell::validate(pDescriptor, importedDescriptors, errorMessage);
if (isValid == false)
{
ValidationTest errorTest = getValidationError();
if (errorTest == NO_PRE_POST_BAND_BYTES)
{
errorMessage += " Preband and postband bytes are not supported for interleave formats other than BSQ.";
}
else if (errorTest == NO_BAND_FILES)
{
errorMessage += " Bands in multiple files are not supported for interleave formats other than BSQ.";
}
else if ((errorTest == NO_INTERLEAVE_CONVERSIONS) || (errorTest == NO_ROW_SKIP_FACTOR) ||
(errorTest == NO_COLUMN_SKIP_FACTOR) || (errorTest == NO_BAND_SUBSETS))
{
errorMessage = errorMessage.substr(0, errorMessage.length() - 1);
errorMessage += " with on-disk read-only processing.";
}
}
else
{
// Check for display bands that are not loaded
const RasterDataDescriptor* pRasterDescriptor = dynamic_cast<const RasterDataDescriptor*>(pDescriptor);
VERIFY(pRasterDescriptor != NULL);
DimensionDescriptor grayBand = pRasterDescriptor->getDisplayBand(GRAY);
if (grayBand.isOriginalNumberValid() == true)
{
DimensionDescriptor band = pRasterDescriptor->getOriginalBand(grayBand.getOriginalNumber());
if (band.isValid() == false)
{
if (errorMessage.empty() == false)
{
errorMessage += "\n";
}
errorMessage += "The gray display band is not available. The first loaded band will be displayed instead.";
}
}
DimensionDescriptor redBand = pRasterDescriptor->getDisplayBand(RED);
if (redBand.isOriginalNumberValid() == true)
{
DimensionDescriptor band = pRasterDescriptor->getOriginalBand(redBand.getOriginalNumber());
if (band.isValid() == false)
{
if (errorMessage.empty() == false)
{
errorMessage += "\n";
}
errorMessage += "The red display band is not available. The first loaded band will be displayed instead.";
}
}
DimensionDescriptor greenBand = pRasterDescriptor->getDisplayBand(GREEN);
if (greenBand.isOriginalNumberValid() == true)
{
DimensionDescriptor band = pRasterDescriptor->getOriginalBand(greenBand.getOriginalNumber());
if (band.isValid() == false)
{
if (errorMessage.empty() == false)
{
errorMessage += "\n";
}
errorMessage += "The green display band is not available. The first loaded band will be "
"displayed instead.";
}
}
DimensionDescriptor blueBand = pRasterDescriptor->getDisplayBand(BLUE);
if (blueBand.isOriginalNumberValid() == true)
{
DimensionDescriptor band = pRasterDescriptor->getOriginalBand(blueBand.getOriginalNumber());
if (band.isValid() == false)
{
if (errorMessage.empty() == false)
{
errorMessage += "\n";
}
errorMessage += "The blue display band is not available. The first loaded band will be displayed instead.";
}
}
}
return isValid;
}
示例5: createReturnValue
bool BandMath::createReturnValue(string partialResultsName)
{
// Set the short and long result names
FactoryResource<Filename> pFilename;
string shortResultsName;
string longResultsName;
if (pFilename.get() != NULL)
{
pFilename->setFullPathAndName(mpCube->getFilename());
shortResultsName = pFilename->getTitle() + " = " + partialResultsName;
longResultsName = pFilename->getPath() + "/" + pFilename->getTitle() + " = " + partialResultsName;
}
mResultsName = longResultsName;
const RasterDataDescriptor* pOrigDescriptor = dynamic_cast<RasterDataDescriptor*>(mpCube->getDataDescriptor());
const vector<DimensionDescriptor>& origRows = pOrigDescriptor->getRows();
const vector<DimensionDescriptor>& origColumns = pOrigDescriptor->getColumns();
mpResultData = NULL;
unsigned int bandCount = mCubeBands;
if (mbCubeMath == false)
{
bandCount = 1;
}
RasterElement* pParent = NULL;
if (mbAsLayerOnExistingView)
{
pParent = mpCube;
}
RasterElement* pRaster = RasterUtilities::createRasterElement(mResultsName, origRows.size(),
origColumns.size(), bandCount, FLT4BYTES, BIP, pOrigDescriptor->getProcessingLocation() == IN_MEMORY, pParent);
if (pRaster == NULL)
{
mstrProgressString = "Error creating result raster element";
meGabbiness = ERRORS;
displayErrorMessage();
mbError = true;
return false;
}
if (!mbAsLayerOnExistingView)
{
// need to copy classification since parent was NULL in call to createRasterElement
pRaster->copyClassification(mpCube);
// make copies of existing GcpLists only if going into a new view
vector<DataElement*> gcps = mpDataModel->getElements(mpCube, "GcpList");
if (!gcps.empty())
{
vector<DataElement*>::iterator iter;
for (iter = gcps.begin(); iter != gcps.end(); ++iter)
{
GcpList* theGcp = dynamic_cast<GcpList*>(*iter);
theGcp->copy(theGcp->getName(), pRaster);
}
}
}
mpResultData = pRaster;
RasterDataDescriptor* pDescriptor = dynamic_cast<RasterDataDescriptor*>
(mpResultData->getDataDescriptor());
if (pDescriptor != NULL)
{
// Rows
vector<DimensionDescriptor> rows = pDescriptor->getRows();
for (unsigned int i = 0; i < origRows.size(); ++i)
{
// Original number
DimensionDescriptor origRow = origRows[i];
if (origRow.isOriginalNumberValid() == true)
{
rows[i].setOriginalNumber(origRow.getOriginalNumber());
}
}
pDescriptor->setRows(rows);
// Columns
vector<DimensionDescriptor> columns = pDescriptor->getColumns();
for (unsigned int i = 0; i < origColumns.size(); ++i)
{
// Original number
DimensionDescriptor origColumn = origColumns[i];
if (origColumn.isOriginalNumberValid() == true)
{
columns[i].setOriginalNumber(origColumn.getOriginalNumber());
}
}
pDescriptor->setColumns(columns);
}
return true;
}
示例6: execute
bool EditDataDescriptor::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
StepResource pStep("Execute Wizard Item", "app", "055486F4-A9DB-4FDA-9AA7-75D1917E2C87");
pStep->addProperty("Item", getName());
mpStep = pStep.get();
if (extractInputArgs(pInArgList) == false)
{
return false;
}
// Set the values in the data descriptor
VERIFY(mpDescriptor != NULL);
// File descriptor
if (mpFileDescriptor != NULL)
{
mpDescriptor->setFileDescriptor(mpFileDescriptor);
}
// Processing location
if (mpProcessingLocation != NULL)
{
mpDescriptor->setProcessingLocation(*mpProcessingLocation);
}
RasterDataDescriptor* pRasterDescriptor = dynamic_cast<RasterDataDescriptor*>(mpDescriptor);
RasterFileDescriptor* pRasterFileDescriptor = dynamic_cast<RasterFileDescriptor*>(mpFileDescriptor);
SignatureDataDescriptor* pSignatureDescriptor = dynamic_cast<SignatureDataDescriptor*>(mpDescriptor);
SignatureFileDescriptor* pSignatureFileDescriptor = dynamic_cast<SignatureFileDescriptor*>(mpFileDescriptor);
if (pRasterDescriptor != NULL)
{
if (pRasterFileDescriptor != NULL)
{
// Set the rows and columns to match the rows and columns in the file descriptor before creating the subset
const vector<DimensionDescriptor>& rows = pRasterFileDescriptor->getRows();
pRasterDescriptor->setRows(rows);
const vector<DimensionDescriptor>& columns = pRasterFileDescriptor->getColumns();
pRasterDescriptor->setColumns(columns);
const vector<DimensionDescriptor>& bands = pRasterFileDescriptor->getBands();
pRasterDescriptor->setBands(bands);
}
// Data type
if (mpDataType != NULL)
{
pRasterDescriptor->setDataType(*mpDataType);
}
// InterleaveFormat
if (mpInterleave != NULL)
{
pRasterDescriptor->setInterleaveFormat(*mpInterleave);
}
// Bad values
if (mpBadValues != NULL)
{
pRasterDescriptor->setBadValues(*mpBadValues);
}
// Rows
if ((mpStartRow != NULL) || (mpEndRow != NULL) || (mpRowSkipFactor != NULL))
{
// We need to obtain this origRows from the FileDescriptor if present since an importer
// may generate a subset by default in which case the DataDescriptor will not contain all
// the rows and subsetting will not work correctly. We
// can't just set mpFileDescriptor = pRasterDescriptor->getFileDescriptor() since we only
// want to replace the DataDescriptor's row list if one of the subset options is specified
const RasterFileDescriptor* pFileDesc(pRasterFileDescriptor);
if (pFileDesc == NULL)
{
pFileDesc = dynamic_cast<const RasterFileDescriptor*>(pRasterDescriptor->getFileDescriptor());
}
const vector<DimensionDescriptor>& origRows = (pFileDesc != NULL) ?
pFileDesc->getRows() : pRasterDescriptor->getRows();
unsigned int startRow = 0;
if (mpStartRow != NULL)
{
startRow = *mpStartRow;
}
else if (origRows.empty() == false)
{
startRow = origRows.front().getOriginalNumber() + 1;
}
unsigned int endRow = 0;
if (mpEndRow != NULL)
{
endRow = *mpEndRow;
}
else if (origRows.empty() == false)
{
endRow = origRows.back().getOriginalNumber() + 1;
}
unsigned int rowSkip = 0;
//.........这里部分代码省略.........