本文整理汇总了C++中FactoryResource::setFullPathAndName方法的典型用法代码示例。如果您正苦于以下问题:C++ FactoryResource::setFullPathAndName方法的具体用法?C++ FactoryResource::setFullPathAndName怎么用?C++ FactoryResource::setFullPathAndName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactoryResource
的用法示例。
在下文中一共展示了FactoryResource::setFullPathAndName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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;
}
示例4: 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;
}
}
示例5: 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;
}
示例6: 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;
}
示例7: readHeader
bool LandsatEtmPlusImporter::readHeader(const string& strInFstHeaderFileName)
{
if (strInFstHeaderFileName.empty())
{
return false;
}
//The HTM header file contains information for Band 6 Channel 1 and 2.
//This set extracts the info needed to process HTM(band 6) header
mFieldHTM.clear();
string baseFileName = strInFstHeaderFileName.substr(0, strInFstHeaderFileName.length() - 7);
FactoryResource<Filename> filename;
filename->setFullPathAndName(baseFileName);
FactoryResource<FileFinder> fileFinder;
string htmFileName = filename->getFileName() + "HTM.FST";
if (fileFinder->findFile(filename->getPath(), htmFileName))
{
fileFinder->findNextFile();
fileFinder->getFullPath(htmFileName);
}
LargeFileResource htmFile;
if (htmFile.open(htmFileName, O_RDONLY, S_IREAD))
{
//process HTM header
vector<char> buf(5120);
size_t count = static_cast<size_t>(htmFile.read(&buf.front(), 5120));
VERIFY(htmFile.eof());
string htmHeaderFull(&buf.front(), count);
vector<string> htmHeaderLines = StringUtilities::split(htmHeaderFull, '\n');
if (!parseHeader(htmHeaderLines, mFieldHTM)) //parse band 6 header
{
mFieldHTM.clear();
}
}
htmFile.close();
// The HRF Header file contains the parameters for Bands 1-5 and 7.
mFieldHRF.clear();
string hrfFileName = filename->getFileName() + "HRF.FST";
if (fileFinder->findFile(filename->getPath(), hrfFileName))
{
fileFinder->findNextFile();
fileFinder->getFullPath(hrfFileName);
}
LargeFileResource hrfFile;
if (hrfFile.open(hrfFileName, O_RDONLY, S_IREAD))
{
//process HRF header
vector<char> buf(5120);
size_t count = static_cast<size_t>(hrfFile.read(&buf.front(), 5120));
VERIFY(hrfFile.eof());
string hrfHeaderFull(&buf.front(), count);
vector<string> hrfHeaderLines = StringUtilities::split(hrfHeaderFull, '\n');
if (!parseHeader(hrfHeaderLines, mFieldHRF)) //parse bands 1-5 and 7 header
{
mFieldHRF.clear();
}
}
hrfFile.close();
// The HPN Header file contains the parameters for Band 8.
mFieldHPN.clear();
string hpnFileName = filename->getFileName() + "HPN.FST";
if (fileFinder->findFile(filename->getPath(), hpnFileName))
{
fileFinder->findNextFile();
fileFinder->getFullPath(hpnFileName);
}
LargeFileResource hpnFile;
if (hpnFile.open(hpnFileName, O_RDONLY, S_IREAD))
{
//process HPN header
vector<char> buf(5120);
size_t count = static_cast<size_t>(hpnFile.read(&buf.front(), 5120));
VERIFY(hpnFile.eof());
string hpnHeaderFull(&buf.front(), count);
vector<string> hpnHeaderLines = StringUtilities::split(hpnHeaderFull, '\n');
if (!parseHeader(hpnHeaderLines, mFieldHPN)) //parse band 8 header
{
mFieldHPN.clear();
}
}
hpnFile.close();
return (!mFieldHRF.empty() || !mFieldHTM.empty() || !mFieldHPN.empty());
}
示例8: 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;
}
示例9: VERIFY
bool Nitf::NitfImporterShell::createRasterPager(RasterElement* pRaster) const
{
if (pRaster == NULL)
{
return false;
}
// Get the filename
string filename = pRaster->getFilename();
FactoryResource<Filename> pFilename;
pFilename->setFullPathAndName(filename);
// Get the image segment corresponding to this raster element
DataDescriptor* pDescriptor = pRaster->getDataDescriptor();
VERIFY(pDescriptor != NULL);
FileDescriptor* pFileDescriptor = pDescriptor->getFileDescriptor();
VERIFY(pFileDescriptor != NULL);
const string& datasetLocation = pFileDescriptor->getDatasetLocation();
if (datasetLocation.empty() == true)
{
return false;
}
string imageSegmentText = datasetLocation.substr(1);
unsigned int imageSegment = StringUtilities::fromDisplayString<unsigned int>(imageSegmentText) - 1;
// Create the resource to execute the pager
ExecutableResource pPlugIn;
// Check for J2K compression in the metadata of the raster element being imported and not the given raster
// element, because the given raster element may be a temporary raster element used by RasterElementImporterShell
// when the processing location is IN_MEMORY, which does not contain the metadata or the parent information
// (see RasterUtilities::generateUnchippedRasterDataDescriptor())
string imageCompression;
const RasterElement* pElement = getRasterElement();
if (pElement != NULL)
{
const DynamicObject* pMetadata = pElement->getMetadata();
VERIFYRV(pMetadata, NULL);
const string attributePath[] =
{
Nitf::NITF_METADATA,
Nitf::IMAGE_SUBHEADER,
Nitf::ImageSubheaderFieldNames::COMPRESSION,
END_METADATA_NAME
};
imageCompression = pMetadata->getAttributeByPath(attributePath).toDisplayString();
}
if ((imageCompression == Nitf::ImageSubheaderFieldValues::IC_C8) ||
(imageCompression == Nitf::ImageSubheaderFieldValues::IC_M8))
{
// Get the offset and size of the image segment in the file
uint64_t offset = getImageOffset(filename, imageSegment);
uint64_t size = getImageSize(filename, imageSegment);
// Use the JPEG2000 pager
pPlugIn->setPlugIn("JPEG2000 Pager");
pPlugIn->getInArgList().setPlugInArgValue(CachedPager::PagedElementArg(), pRaster);
pPlugIn->getInArgList().setPlugInArgValue(CachedPager::PagedFilenameArg(), pFilename.get());
pPlugIn->getInArgList().setPlugInArgValue("Offset", &offset);
pPlugIn->getInArgList().setPlugInArgValue("Size", &size);
}
else
{
// Use the NITF Pager
pPlugIn->setPlugIn("NitfPager");
pPlugIn->getInArgList().setPlugInArgValue(CachedPager::PagedElementArg(), pRaster);
pPlugIn->getInArgList().setPlugInArgValue(CachedPager::PagedFilenameArg(), pFilename.get());
pPlugIn->getInArgList().setPlugInArgValue("Segment Number", &imageSegment);
}
if (pPlugIn->execute() == true)
{
RasterPager* pPager = dynamic_cast<RasterPager*>(pPlugIn->getPlugIn());
if (pPager != NULL)
{
pRaster->setPager(pPager);
pPlugIn->releasePlugIn();
return true;
}
}
return false;
}
示例10: execute
bool NefImporter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
if (pInArgList == NULL || pOutArgList == NULL)
{
return false;
}
//setting up mpRasterElement
parseInputArgList(pInArgList);
RasterElement* pRaster = getRasterElement();
VERIFY(pRaster != NULL);
RasterDataDescriptor *pDescriptor = dynamic_cast<RasterDataDescriptor*>(pRaster->getDataDescriptor());
VERIFY(pDescriptor != NULL);
FileDescriptor *pFileDescriptor = pDescriptor->getFileDescriptor();
VERIFY(pFileDescriptor != NULL);
//data accessor
//RED
DimensionDescriptor firstBand = pDescriptor->getActiveBand(0);
FactoryResource<DataRequest> pRequest;
pRequest->setInterleaveFormat(BSQ);
pRequest->setBands(firstBand, firstBand);
pRequest->setWritable(true);
DataAccessor firstBandDa = pRaster->getDataAccessor(pRequest.release());
//GREEN
DimensionDescriptor secondBand = pDescriptor->getActiveBand(1);
FactoryResource<DataRequest> qRequest;
qRequest->setInterleaveFormat(BSQ);
qRequest->setBands(secondBand, secondBand);
qRequest->setWritable(true);
DataAccessor secondBandDa = pRaster->getDataAccessor(qRequest.release());
//BLUE
DimensionDescriptor thirdBand = pDescriptor->getActiveBand(2);
FactoryResource<DataRequest> rRequest;
rRequest->setInterleaveFormat(BSQ);
rRequest->setBands(thirdBand, thirdBand);
rRequest->setWritable(true);
DataAccessor thirdBandDa = pRaster->getDataAccessor(rRequest.release());
std::string filename = pRaster->getFilename();
Progress *pProgress = getProgress();
FactoryResource<Filename> pFilename;
pFilename->setFullPathAndName(filename);
LibRaw RawProcessor;
putenv ((char*)"TZ=UTC");
#define P1 RawProcessor.imgdata.idata
#define S RawProcessor.imgdata.sizes
#define C RawProcessor.imgdata.color
#define T RawProcessor.imgdata.thumbnail
#define P2 RawProcessor.imgdata.other
#define OUT RawProcessor.imgdata.params
const char *fname=filename.c_str();
RawProcessor.open_file(fname);
// Let us unpack the image
if (RawProcessor.unpack() != LIBRAW_SUCCESS)
{
return false;
}
/*
unsigned int *r=NULL;
unsigned int *g=NULL;
unsigned int *b=NULL;
unsigned int *h=NULL;
*/
unsigned int *zero=0;
int row=0,col=0,r=0,c=0;
/*
r=(unsigned int*)(&RawProcessor.imgdata.image[i][0]);
g=(unsigned int*)(&RawProcessor.imgdata.image[i][1]);
b=(unsigned int*)(&RawProcessor.imgdata.image[i][2]);
h=(unsigned int*)(&RawProcessor.imgdata.image[i][3]);
*/
//secondBandDa->toPixel(row,col);
//thirdBandDa->toPixel(row,col);
unsigned short *pData=reinterpret_cast<unsigned short*>(pRaster->getRawData());
if (pData == NULL)
{
return NULL;
}
memcpy(pData, RawProcessor.imgdata.rawdata.raw_image, sizeof(unsigned short) * RawProcessor.imgdata.sizes.raw_height * RawProcessor.imgdata.sizes.raw_width);
//.........这里部分代码省略.........