本文整理汇总了C++中FactoryResource::setEndian方法的典型用法代码示例。如果您正苦于以下问题:C++ FactoryResource::setEndian方法的具体用法?C++ FactoryResource::setEndian怎么用?C++ FactoryResource::setEndian使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactoryResource
的用法示例。
在下文中一共展示了FactoryResource::setEndian方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: if
//.........这里部分代码省略.........
validDataTypes.push_back(dataType);
pDescriptor->setValidDataTypes(validDataTypes);
}
// Interleave format
pField = mFields.find("interleave");
if (pField != NULL)
{
string interleave = StringUtilities::toLower(pField->mValue);
if (interleave == "bip")
{
pDescriptor->setInterleaveFormat(BIP);
pFileDescriptor->setInterleaveFormat(BIP);
}
else if (interleave == "bil")
{
pDescriptor->setInterleaveFormat(BIL);
pFileDescriptor->setInterleaveFormat(BIL);
}
else if (interleave == "bsq")
{
pDescriptor->setInterleaveFormat(BSQ);
pFileDescriptor->setInterleaveFormat(BSQ);
}
}
// Endian
pField = mFields.find("byte order");
if (pField != NULL)
{
int byteOrder = atoi(pField->mValue.c_str());
if (byteOrder == 0)
{
pFileDescriptor->setEndian(LITTLE_ENDIAN_ORDER);
}
else if (byteOrder == 1)
{
pFileDescriptor->setEndian(BIG_ENDIAN_ORDER);
}
}
// check for scaling factor
pField = mFields.find("reflectance scale factor");
if (pField != NULL)
{
double scalingFactor = 0.0;
stringstream scaleStream(pField->mValue);
scaleStream >> scalingFactor;
if (!scaleStream.fail() && scalingFactor != 0.0)
{
Units* pUnits = pDescriptor->getUnits();
if (pUnits != NULL)
{
pUnits->setScaleFromStandard(1.0 / scalingFactor);
pUnits->setUnitName("Reflectance");
pUnits->setUnitType(REFLECTANCE);
}
}
}
// Pixel size
pField = mFields.find("pixel size");
if (pField != NULL)
{
if (pField->mChildren.size() == 2)
{
示例3: pFile
vector<ImportDescriptor*> SioImporter::getImportDescriptors(const string& filename)
{
vector<ImportDescriptor*> descriptors;
if (filename.empty() == false)
{
// Read the header values
FileResource pFile(filename.c_str(), "rb");
SioFile sioFile;
bool bSuccess = sioFile.deserialize(pFile.get());
if (bSuccess == false)
{
return descriptors;
}
if (sioFile.mOriginalVersion == 9)
{
mVersion9Sio = true;
}
// Create the import descriptor
ImportDescriptor* pImportDescriptor = mpModel->createImportDescriptor(filename, "RasterElement", NULL);
if (pImportDescriptor != NULL)
{
RasterDataDescriptor* pDescriptor =
dynamic_cast<RasterDataDescriptor*>(pImportDescriptor->getDataDescriptor());
if (pDescriptor != NULL)
{
FactoryResource<RasterFileDescriptor> pFileDescriptor;
if (pFileDescriptor.get() != NULL)
{
// Filename
pFileDescriptor->setFilename(filename);
// Endian
pFileDescriptor->setEndian(sioFile.mEndian);
// Rows
vector<DimensionDescriptor> rows;
for (int i = 0; i < sioFile.mRows; ++i)
{
DimensionDescriptor rowDim;
// Do not set an active number since the user has not selected the rows to load
if (static_cast<unsigned int>(i) < sioFile.mOrigRowNumbers.size())
{
rowDim.setOriginalNumber(sioFile.mOrigRowNumbers[i]);
}
else
{
rowDim.setOriginalNumber(i);
}
rowDim.setOnDiskNumber(i);
rows.push_back(rowDim);
}
pDescriptor->setRows(rows);
pFileDescriptor->setRows(rows);
// Columns
vector<DimensionDescriptor> columns;
for (int i = 0; i < sioFile.mColumns; ++i)
{
DimensionDescriptor columnDim;
// Do not set an active number since the user has not selected the rows to load
if (static_cast<unsigned int>(i) < sioFile.mOrigColumnNumbers.size())
{
columnDim.setOriginalNumber(sioFile.mOrigColumnNumbers[i]);
}
else
{
columnDim.setOriginalNumber(i);
}
columnDim.setOnDiskNumber(i);
columns.push_back(columnDim);
}
pDescriptor->setColumns(columns);
pFileDescriptor->setColumns(columns);
// Bands
vector<DimensionDescriptor> bands;
for (int i = 0; i < (sioFile.mBands - sioFile.mBadBands); ++i)
{
DimensionDescriptor bandDim;
// Do not set an active number since the user has not selected the rows to load
if (static_cast<unsigned int>(i) < sioFile.mOrigBandNumbers.size())
{
bandDim.setOriginalNumber(sioFile.mOrigBandNumbers[i]);
}
else
{
bandDim.setOriginalNumber(i);
}
bandDim.setOnDiskNumber(i);
//.........这里部分代码省略.........