本文整理汇总了C++中FactoryResource::getNumAttributes方法的典型用法代码示例。如果您正苦于以下问题:C++ FactoryResource::getNumAttributes方法的具体用法?C++ FactoryResource::getNumAttributes怎么用?C++ FactoryResource::getNumAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactoryResource
的用法示例。
在下文中一共展示了FactoryResource::getNumAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
char* pPtr = strtok(pBuffer, ",");
while (pPtr != NULL)
{
double dWavelength = 0.0;
if (sscanf(pPtr, "%lf", &dWavelength) == 1)
{
if (dWavelength > 50.0) // Assumed to be in nanometers
{
uiNanometerValues++;
}
// Restrict the number of wavelengths to the number of samples in the header file
if (numWavelengthsRead < numWavelengths)
{
// Only write the wavelength if the value is valid
// Since the bands are in descending order,
// goodBands.back() always holds the next good band.
if (pBblField == NULL ||
(goodBands.empty() == false && goodBands.back() == numWavelengthsRead))
{
if (goodBands.empty() == false)
{
goodBands.pop_back();
}
wavelengths.push_back(dWavelength);
}
}
++numWavelengthsRead;
}
pPtr = strtok(NULL, ",");
}
}
}
VERIFYNR(goodBands.empty() == true);
}
// Wavelength units
bool bConvertWavelengths = false;
bool bDetermineUnits = true;
EnviField* pUnitsField = mFields.find("wavelength units");
if (pUnitsField != NULL)
{
if (pUnitsField->mValue == "Micrometers")
{
bDetermineUnits = false;
}
else if (pUnitsField->mValue == "Nanometers")
{
bDetermineUnits = false;
bConvertWavelengths = true;
}
}
if (bDetermineUnits)
{
if ((uiNanometerValues * 100) / wavelengths.size() > 50)
{
bConvertWavelengths = true;
}
}
if (bConvertWavelengths == true)
{
for (vector<double>::size_type i = 0; i < wavelengths.size(); i++)
{
wavelengths[i] *= 0.001;
}
}
string pCenterPath[] = { SPECIAL_METADATA_NAME, BAND_METADATA_NAME,
CENTER_WAVELENGTHS_METADATA_NAME, END_METADATA_NAME };
pMetadata->setAttributeByPath(pCenterPath, wavelengths);
}
if (pMetadata->getNumAttributes() > 0)
{
pDescriptor->setMetadata(pMetadata.get());
}
// Create the file descriptor
FactoryResource<SignatureFileDescriptor> pFileDescriptor;
if (pFileDescriptor.get() != NULL)
{
pFileDescriptor->setFilename(dataFile);
pDescriptor->setFileDescriptor(pFileDescriptor.get());
}
}
descriptors.push_back(pImportDescriptor);
}
}
}
}
return descriptors;
}
示例2: if
//.........这里部分代码省略.........
gcp.mPixel.mX = 0.0;
gcp.mPixel.mY = 0.0;
}
else if (pChild->mTag == "lr")
{
gcp.mPixel.mX = columns.size() - 1.0;
gcp.mPixel.mY = 0.0;
}
else if (pChild->mTag == "ul")
{
gcp.mPixel.mX = 0.0;
gcp.mPixel.mY = rows.size() - 1.0;
}
else if (pChild->mTag == "ur")
{
gcp.mPixel.mX = columns.size() - 1.0;
gcp.mPixel.mY = rows.size() - 1.0;
}
else if (pChild->mTag == "center")
{
gcp.mPixel.mX = floor((columns.size() - 1.0) / 2.0);
gcp.mPixel.mY = floor((rows.size() - 1.0) / 2.0);
}
gcps.push_back(gcp);
}
else if (pChild->mTag.empty() == false)
{
pMetadata->setAttribute(pChild->mTag, pChild->mValue);
}
}
}
if (pMetadata->getNumAttributes() > 0)
{
pDescriptor->setMetadata(pMetadata.get());
}
}
}
if (gcps.empty()) // not in description, check for geo points keyword
{
pField = mFields.find("geo points");
if (pField != NULL)
{
vector<double> geoValues;
const int expectedNumValues = 16; // 4 values for each of the 4 corners
geoValues.reserve(expectedNumValues);
for (unsigned int i = 0; i < pField->mChildren.size(); i++)
{
vectorFromField(pField->mChildren.at(i), geoValues, "%lf");
}
if (geoValues.size() == expectedNumValues)
{
vector<double>::iterator iter = geoValues.begin();
GcpPoint gcp;
while (iter != geoValues.end())
{
gcp.mPixel.mX = *iter++ - 1.0; // adjust ref point for ENVI's use of
gcp.mPixel.mY = *iter++ - 1.0; // upper left corner and one-based first pixel
gcp.mCoordinate.mX = *iter++; // GcpPoint has lat as mX and Lon as mY
gcp.mCoordinate.mY = *iter++; // geo point field has lat then lon value
gcps.push_back(gcp);
}
}