本文整理汇总了C++中FactoryResource::get方法的典型用法代码示例。如果您正苦于以下问题:C++ FactoryResource::get方法的具体用法?C++ FactoryResource::get怎么用?C++ FactoryResource::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactoryResource
的用法示例。
在下文中一共展示了FactoryResource::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
vector<ImportDescriptor*> CgmImporter::getImportDescriptors(const string& filename)
{
vector<ImportDescriptor*> descriptors;
if (!filename.empty())
{
FactoryResource<Filename> pFullFilename;
pFullFilename->setFullPathAndName(filename);
ImportDescriptor* pImportDescriptor = mpModel->createImportDescriptor(filename, "AnnotationElement", NULL);
if (pImportDescriptor != NULL)
{
DataDescriptor* pDescriptor = pImportDescriptor->getDataDescriptor();
if (pDescriptor != NULL)
{
FactoryResource<FileDescriptor> pFileDescriptor;
if (pFileDescriptor.get() != NULL)
{
pFileDescriptor->setFilename(filename);
pDescriptor->setFileDescriptor(pFileDescriptor.get());
}
}
descriptors.push_back(pImportDescriptor);
}
}
return descriptors;
}
示例2: populateDataDescriptor
vector<ImportDescriptor*> Jpeg2000Importer::getImportDescriptors(const string& filename)
{
vector<ImportDescriptor*> descriptors;
if (filename.empty() == true)
{
return descriptors;
}
vector<string>& warnings = msWarnings[filename];
warnings.clear();
vector<string>& errors = msErrors[filename];
errors.clear();
ImportDescriptor* pImportDescriptor = mpModel->createImportDescriptor(filename, "RasterElement", NULL);
if (pImportDescriptor != NULL)
{
RasterDataDescriptor* pDescriptor = dynamic_cast<RasterDataDescriptor*>(pImportDescriptor->getDataDescriptor());
if (pDescriptor != NULL)
{
vector<EncodingType> validDataTypes;
validDataTypes.push_back(INT1UBYTE);
validDataTypes.push_back(INT1SBYTE);
validDataTypes.push_back(INT2UBYTES);
validDataTypes.push_back(INT2SBYTES);
validDataTypes.push_back(INT4UBYTES);
validDataTypes.push_back(INT4SBYTES);
validDataTypes.push_back(FLT4BYTES);
pDescriptor->setValidDataTypes(validDataTypes);
pDescriptor->setProcessingLocation(IN_MEMORY);
// Create and set a file descriptor in the data descriptor
FactoryResource<RasterFileDescriptor> pFileDescriptor;
pFileDescriptor->setEndian(BIG_ENDIAN_ORDER);
if (pFileDescriptor.get() != NULL)
{
pFileDescriptor->setFilename(filename);
pDescriptor->setFileDescriptor(pFileDescriptor.get());
}
// Populate the data descriptor from the file
bool bSuccess = populateDataDescriptor(pDescriptor);
if (bSuccess == true)
{
descriptors.push_back(pImportDescriptor);
}
else
{
// Delete the import descriptor
mpModel->destroyImportDescriptor(pImportDescriptor);
}
}
}
return descriptors;
}
示例3: createRasterPager
bool LandsatEtmPlusImporter::createRasterPager(RasterElement* pRaster) const
{
string srcFile = pRaster->getFilename();
if (srcFile.empty())
{
return false;
}
{
//scoping to ensure the file is closed before creating the pager
LargeFileResource srcFileRes;
if (!srcFileRes.open(srcFile, O_RDONLY | O_BINARY, S_IREAD))
{
return false;
}
}
// create the pager
ExecutableResource pPager("BandResamplePager");
VERIFY(pPager->getPlugIn() != NULL);
bool isWritable = false;
bool useDataDescriptor = false;
FactoryResource<Filename> pFilename;
VERIFY(pFilename.get() != NULL);
pFilename->setFullPathAndName(pRaster->getFilename());
pPager->getInArgList().setPlugInArgValue("Raster Element", pRaster);
pPager->getInArgList().setPlugInArgValue("Filename", pFilename.get());
pPager->getInArgList().setPlugInArgValue("isWritable", &isWritable);
pPager->getInArgList().setPlugInArgValue("Use Data Descriptor", &useDataDescriptor);
RasterDataDescriptor* pDescriptor = static_cast<RasterDataDescriptor*>(pRaster->getDataDescriptor());
VERIFY(pDescriptor != NULL);
RasterFileDescriptor* pFileDescriptor = static_cast<RasterFileDescriptor*>(pDescriptor->getFileDescriptor());
VERIFY(pFileDescriptor != NULL);
unsigned int band = 5, rows = mB6Rows, cols = mB6Cols;
pPager->getInArgList().setPlugInArgValue("Band", &band);
pPager->getInArgList().setPlugInArgValue("Rows", &rows);
pPager->getInArgList().setPlugInArgValue("Columns", &cols);
if (!pPager->execute())
{
return false;
}
RasterPager* pRasterPager = dynamic_cast<RasterPager*>(pPager->getPlugIn());
if (pRasterPager != NULL)
{
pPager->releasePlugIn();
}
else
{
return false;
}
pRaster->setPager(pRasterPager);
return true;
}
示例4: execute
bool AoiLogical::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
if (pInArgList == NULL || pOutArgList == NULL)
{
return false;
}
if (!extractInputArgs(pInArgList))
{
return false;
}
mProgress.report("Begin AOI set operation.", 1, NORMAL);
if (isBatch())
{
mProgress.report("Batch mode is not supported.", 0, ERRORS, true);
return false;
}
FactoryResource<BitMask> pResultMask;
if (pResultMask.get() == NULL)
{
mProgress.report("Unable to create result AOI.", 0, ERRORS, true);
return false;
}
mpResult = pResultMask.get();
if (mOperation == "Union")
{
mpResult->merge(*mpSet1);
mpResult->merge(*mpSet2);
}
else if (mOperation == "Intersection")
{
mpResult->merge(*mpSet1);
mpResult->intersect(*mpSet2);
}
else
{
mProgress.report("Invalid operation: " + mOperation, 0, ERRORS, true);
return false;
}
if (!displayResult())
{
return false;
}
mProgress.upALevel();
return true;
}
示例5: loadDoc
vector<ImportDescriptor*> SignatureSetImporter::getImportDescriptors(const string &filename)
{
vector<ImportDescriptor*> descriptors;
if (filename.empty())
{
return descriptors;
}
mFilename = filename;
try
{
loadDoc(filename);
if (mDoc[filename] == NULL)
{
return descriptors;
}
FactoryResource<DynamicObject> pMetadata;
VERIFYRV(pMetadata.get() != NULL, descriptors);
mDatasetNumber = 0;
ImportDescriptorFilter filter;
DOMTreeWalker* pTree = mDoc[filename]->createTreeWalker(mDoc[filename]->getDocumentElement(), DOMNodeFilter::SHOW_ELEMENT, &filter, false);
std::vector<std::string> dummy;
descriptors = createImportDescriptors(pTree, dummy);
}
catch(const DOMException &) {}
catch(const XMLException &) {}
return descriptors;
}
示例6: createRasterPager
bool DiHdfImporter::createRasterPager(RasterElement *pRaster) const
{
VERIFY(pRaster != NULL);
DataDescriptor *pDescriptor = pRaster->getDataDescriptor();
VERIFY(pDescriptor != NULL);
FileDescriptor *pFileDescriptor = pDescriptor->getFileDescriptor();
VERIFY(pFileDescriptor != NULL);
std::string filename = pRaster->getFilename();
Progress *pProgress = getProgress();
FactoryResource<Filename> pFilename;
pFilename->setFullPathAndName(filename);
ExecutableResource pagerPlugIn("DiHdfRasterPager", std::string(), pProgress);
pagerPlugIn->getInArgList().setPlugInArgValue(CachedPager::PagedElementArg(), pRaster);
pagerPlugIn->getInArgList().setPlugInArgValue(CachedPager::PagedFilenameArg(), pFilename.get());
bool success = pagerPlugIn->execute();
RasterPager *pPager = dynamic_cast<RasterPager*>(pagerPlugIn->getPlugIn());
if(!success || pPager == NULL)
{
std::string message = "Execution of DiHdfRasterPager failed!";
if (pProgress != NULL) pProgress->updateProgress(message, 0, ERRORS);
return false;
}
pRaster->setPager(pPager);
pagerPlugIn->releasePlugIn();
return true;
}
示例7: VERIFY
bool Nitf::DesSubheader::importMetadata(const ossimPropertyInterface *pHeader, RasterDataDescriptor *pDescriptor)
{
VERIFY(pHeader != NULL && pDescriptor != NULL);
FactoryResource<DynamicObject> pDesSubheaderMetadata;
VERIFY(pDesSubheaderMetadata.get() != NULL);
VERIFY(Header::importMetadata(pHeader, pDescriptor, pDesSubheaderMetadata.get()));
VERIFY(pDescriptor != NULL);
DynamicObject* pMetadata = pDescriptor->getMetadata();
VERIFY(pMetadata != NULL);
pMetadata->setAttributeByPath(getMetadataPath(), *pDesSubheaderMetadata.get());
return true;
}
示例8: if
vector<ImportDescriptor*> SignatureSetImporter::createImportDescriptors(DOMTreeWalker* pTree, vector<string> &datasetPath)
{
vector<ImportDescriptor*> descriptors;
FactoryResource<DynamicObject> pMetadata;
VERIFYRV(pMetadata.get() != NULL, descriptors);
string datasetName = StringUtilities::toDisplayString(mDatasetNumber++);
for (DOMNode* pChld = pTree->firstChild(); pChld != NULL; pChld = pTree->nextSibling())
{
if (XMLString::equals(pChld->getNodeName(), X("metadata")))
{
DOMElement* pElmnt = static_cast<DOMElement*>(pChld);
string name = A(pElmnt->getAttribute(X("name")));
string val = A(pElmnt->getAttribute(X("value")));
pMetadata->setAttribute(name, val);
if (name == "Name")
{
datasetName = val;
}
}
else if (XMLString::equals(pChld->getNodeName(), X("signature_set")))
{
datasetPath.push_back(datasetName);
vector<ImportDescriptor*> sub = createImportDescriptors(pTree, datasetPath);
datasetPath.pop_back();
descriptors.insert(descriptors.end(), sub.begin(), sub.end());
pTree->parentNode();
}
}
ImportDescriptorResource pImportDescriptor(datasetName, "SignatureSet", datasetPath);
VERIFYRV(pImportDescriptor.get() != NULL, descriptors);
DataDescriptor* pDataDescriptor = pImportDescriptor->getDataDescriptor();
VERIFYRV(pDataDescriptor != NULL, descriptors);
FactoryResource<SignatureFileDescriptor> pFileDescriptor;
VERIFYRV(pFileDescriptor.get() != NULL, descriptors);
pFileDescriptor->setFilename(mFilename);
datasetPath.push_back(datasetName);
string loc = "/" + StringUtilities::join(datasetPath, "/");
datasetPath.pop_back();
pFileDescriptor->setDatasetLocation(loc);
pDataDescriptor->setFileDescriptor(pFileDescriptor.get());
pDataDescriptor->setMetadata(pMetadata.get());
descriptors.push_back(pImportDescriptor.release());
return descriptors;
}
示例9: getWavelengthsFromFile
bool ResamplerPlugIn::getWavelengthsFromFile(const std::string& filename,
Wavelengths* pWavelengths, std::string& errorMsg)
{
errorMsg.clear();
if (filename.empty() || pWavelengths == NULL)
{
errorMsg = "Invalid input parameters.";
return false;
}
pWavelengths->clear();
FactoryResource<Filename> pFilename;
pFilename->setFullPathAndName(filename);
std::string importerName;
std::string extension;
std::vector<std::string> extensionStrs =
StringUtilities::split(StringUtilities::toLower(pFilename->getExtension()), '.');
if (extensionStrs.empty() == false)
{
extension = extensionStrs.back();
}
if (extension == "wmd")
{
importerName = "Wavelength Metadata Importer";
}
else
{
importerName = "Wavelength Text Importer";
}
ExecutableResource pImporter(importerName, std::string());
if (pImporter->getInArgList().setPlugInArgValue(Wavelengths::WavelengthFileArg(), pFilename.get()) == false)
{
errorMsg = "Unable to set filename into plug-in \"" + importerName + "\".";
return false;
}
if (pImporter->execute() == false)
{
errorMsg = "Unable to load file \"" + filename + "\".";
return false;
}
Wavelengths* pWave = pImporter->getOutArgList().getPlugInArgValue<Wavelengths>(Wavelengths::WavelengthsArg());
if (pWave == NULL)
{
errorMsg = "Unable to extract wavelengths from plug-in \"" + importerName + "\".";
return false;
}
if (pWavelengths->initializeFromWavelengths(pWave) == false)
{
errorMsg = "Unable to retrieve the wavelengths.";
return false;
}
return true;
}
示例10: applyChanges
void OptionsFileLocations::applyChanges(CustomTreeWidget* pTree)
{
VERIFYNR(pTree != NULL);
Service<ConfigurationSettings> pSettings;
QTreeWidgetItemIterator iter(pTree);
while (*iter != NULL)
{
QTreeWidgetItem* pItem = *iter;
if (pItem != NULL)
{
string type = pItem->text(0).toStdString();
string confSettingsKey;
string confSettingsArgumentKey;
for (vector<FileLocationDescriptor>::iterator iter2 = mFileLocations.begin();
iter2 != mFileLocations.end();
++iter2)
{
if (iter2->getText() == type)
{
confSettingsKey = iter2->getKey();
confSettingsArgumentKey = iter2->getArgumentKey();
break;
}
}
if (!confSettingsKey.empty())
{
QString strLocation = pItem->text(1);
strLocation.replace(QRegExp("\\\\"), "/");
FactoryResource<Filename> pFilename;
string location = strLocation.toStdString();
pFilename->setFullPathAndName(location);
pSettings->setSetting(confSettingsKey, *(pFilename.get()));
if (type == "Message Log Path")
{
MessageLogMgrImp::instance()->setPath(location);
}
else if (type == "Wizard Path")
{
Service<DesktopServices> pDesktop;
ApplicationWindow* pAppWindow = static_cast<ApplicationWindow*>(pDesktop->getMainWidget());
if ((location != mWizardPath) && (pAppWindow != NULL))
{
pAppWindow->updateWizardCommands();
}
}
}
if (!confSettingsArgumentKey.empty())
{
pSettings->setSetting(confSettingsArgumentKey, pItem->text(2).toStdString());
}
}
++iter;
}
}
示例11: setAttributeByPath
bool DynamicObjectImp::setAttributeByPath(QStringList pathComponents, DataVariant& value, bool swap)
{
if (!value.isValid())
{
return false;
}
QString finalName = pathComponents.back();
pathComponents.pop_back();
string loopType = "DynamicObject";
DynamicObject* pLoopObj = dynamic_cast<DynamicObject*>(this);
DynamicObject* pCurObj = pLoopObj;
for (QStringList::const_iterator iter = pathComponents.begin();
iter != pathComponents.end(); ++iter)
{
if (pLoopObj == NULL || loopType != "DynamicObject")
{
return false;
}
pCurObj = pLoopObj;
DataVariant& attrValue = pCurObj->getAttribute(iter->toStdString());
loopType = attrValue.getTypeName();
pLoopObj = attrValue.getPointerToValue<DynamicObject>();
if ((pLoopObj != NULL) && (loopType != "DynamicObject"))
{
return false;
}
if (pLoopObj == NULL)
{
FactoryResource<DynamicObject> pNewObj;
if (pCurObj != NULL)
{
pCurObj->setAttribute(iter->toStdString(), *pNewObj.get());
DataVariant& currentValue = pCurObj->getAttribute(iter->toStdString());
loopType = currentValue.getTypeName();
pLoopObj = currentValue.getPointerToValue<DynamicObject>();
}
}
}
if (pLoopObj == NULL || loopType != "DynamicObject")
{
return false;
}
pCurObj = pLoopObj;
DynamicObjectImp* const pCurObjImp = dynamic_cast<DynamicObjectImp*>(pCurObj);
VERIFY(pCurObjImp != NULL);
return pCurObjImp->setAttribute(finalName.toStdString(), value, swap);
}
示例12: VERIFY
bool Nitf::TrePlugInResource::exportMetadata(const RasterDataDescriptor& descriptor,
const RasterFileDescriptor& exportDescriptor, ossimNitfWriter& writer, string& errorMessage) const
{
const TreParser* pParser = dynamic_cast<const TreParser*>(get());
VERIFY(pParser != NULL);
string treErrorMessage;
FactoryResource<DynamicObject> pTre;
VERIFY(pTre.get() != NULL);
unsigned int ownerIndex = 1;
string tagType = "IXSHD";
TreExportStatus status = pParser->exportMetadata(descriptor, exportDescriptor,
*pTre.get(), ownerIndex, tagType, treErrorMessage);
if (treErrorMessage.empty() == false)
{
errorMessage = getArgs().mPlugInName + ": " + treErrorMessage;
}
string writeErrorMessage;
switch (status)
{
case REPLACE:
writeTag(*pTre.get(), ownerIndex, ossimString(tagType), writer, writeErrorMessage);
if (!writeErrorMessage.empty())
{
errorMessage += "," + writeErrorMessage;
}
return true;
case REMOVE:
return true;
default:
break;
}
return false;
}
示例13: VERIFYRV
vector<string> LandsatEtmPlusImporter::getBandFilenames(std::string strInHeaderFileName, LandsatEtmPlusImporter::BandSetType bandSet) const
{
vector<string> bandFilenames;
if (strInHeaderFileName.empty())
{
return bandFilenames;
}
FactoryResource<Filename> headerFileName;
VERIFYRV(headerFileName.get() != NULL, bandFilenames);
headerFileName->setFullPathAndName(strInHeaderFileName);
string bandFilePath = headerFileName->getPath();
// get the requested band filenames
FactoryResource<FileFinder> fileFinder;
if (bandSet == PANCHROMATIC)
{
if (!fileFinder->findFile(bandFilePath, mFieldHPN[FILENAME_1]))
{
return vector<string>();
}
fileFinder->findNextFile();
string path;
fileFinder->getFullPath(path);
bandFilenames += path;
}
else
{
vector<string> fileNames;
fileNames += mFieldHRF[FILENAME_1],
mFieldHRF[FILENAME_2],
mFieldHRF[FILENAME_3],
mFieldHRF[FILENAME_4],
mFieldHRF[FILENAME_5],
((bandSet == LOW_GAIN) ? mFieldHTM[FILENAME_1] : mFieldHTM[FILENAME_2]),
mFieldHRF[FILENAME_6];
for (vector<string>::const_iterator fileName = fileNames.begin(); fileName != fileNames.end(); ++fileName)
{
if (!fileFinder->findFile(bandFilePath, *fileName))
{
return vector<string>();
}
fileFinder->findNextFile();
string path;
fileFinder->getFullPath(path);
bandFilenames += path;
}
}
return bandFilenames;
}
示例14: createResults
RasterElement* AceAlgorithm::createResults(int numRows, int numColumns, const string& sigName)
{
RasterElement* pElement = getRasterElement();
if (pElement == NULL)
{
return NULL;
}
// Delete an existing element to ensure that the new results element is the correct size
Service<ModelServices> pModel;
RasterElement* pExistingResults = static_cast<RasterElement*>(pModel->getElement(sigName,
TypeConverter::toString<RasterElement>(), pElement));
if (pExistingResults != NULL)
{
pModel->destroyElement(pExistingResults);
}
// Create the new results element
ModelResource<RasterElement> pResults(RasterUtilities::createRasterElement(sigName, numRows, numColumns,
FLT4BYTES, true, pElement));
if (pResults.get() == NULL)
{
pResults = ModelResource<RasterElement>(RasterUtilities::createRasterElement(sigName, numRows, numColumns,
FLT4BYTES, false, pElement));
if (pResults.get() == NULL)
{
reportProgress(ERRORS, 0, ACEERR009);
MessageResource(ACEERR009, "spectral", "C89D361B-DB12-43ED-B276-6D98CA3539EE");
return NULL;
}
}
FactoryResource<Units> pUnits;
pUnits->setUnitName("degrees");
vector<int> badValues(1, 181);
RasterDataDescriptor* pResultsDescriptor = static_cast<RasterDataDescriptor*>(pResults->getDataDescriptor());
VERIFYRV(pResultsDescriptor != NULL, NULL);
pResultsDescriptor->setUnits(pUnits.get());
pResultsDescriptor->setBadValues(badValues);
Statistics* pStatistics = pResults->getStatistics();
VERIFYRV(pStatistics != NULL, NULL);
pStatistics->setBadValues(badValues);
return pResults.release();
}
示例15: getCurrentFrameAccessor
DataAccessor BackgroundSuppressionShell::getCurrentFrameAccessor() const
{
if(mpRaster == NULL)
{
return DataAccessor(NULL, NULL);
}
RasterDataDescriptor *pDesc = static_cast<RasterDataDescriptor*>(mpRaster->getDataDescriptor());
VERIFYRV(pDesc != NULL, DataAccessor(NULL, NULL));
FactoryResource<DataRequest> request;
VERIFYRV(request.get() != NULL, DataAccessor(NULL, NULL));
request->setInterleaveFormat(BSQ);
DimensionDescriptor band = pDesc->getBands()[mCurrentFrame];
request->setBands(band, band, 1);
return mpRaster->getDataAccessor(request.release());
}