本文整理汇总了C++中FactoryResource::setLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ FactoryResource::setLevel方法的具体用法?C++ FactoryResource::setLevel怎么用?C++ FactoryResource::setLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactoryResource
的用法示例。
在下文中一共展示了FactoryResource::setLevel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pHandler
//.........这里部分代码省略.........
{
if (*iter == Nitf::ImageSubheaderFieldValues::BAND_REPRESENTATIONS_LUT)
{
hasLut = true;
break;
}
}
}
}
if (hasLut == false)
{
vector<unsigned int> numLuts;
const string numLutsPathName[] = { Nitf::NITF_METADATA, Nitf::IMAGE_SUBHEADER,
Nitf::ImageSubheaderFieldNames::NUMBER_OF_LUTS, END_METADATA_NAME };
const DataVariant& dvNumLuts = pMetadata->getAttributeByPath(numLutsPathName);
if (dvNumLuts.getValue(numLuts) == true)
{
for (vector<unsigned int>::iterator iter = numLuts.begin(); iter != numLuts.end(); iter++)
{
if (*iter > 0)
{
hasLut = true;
break;
}
}
}
}
if (hasLut == true)
{
if (errorMessage.empty() == false)
{
errorMessage += "\n";
}
errorMessage += "The lookup table will not be applied.";
}
// Check for valid Classification markings. If any level is higher than the file header, display a warning.
FactoryResource<Classification> pClassification;
const Classification* pOverallClassification = pDescriptor->getClassification();
VERIFY(pOverallClassification != NULL);
// Look in the image subheader.
string imageClassLevel;
const string imageClassLevelPathName[] = { Nitf::NITF_METADATA, Nitf::IMAGE_SUBHEADER,
Nitf::ImageSubheaderFieldNames::SECURITY_LEVEL, END_METADATA_NAME };
const DataVariant& dvImageClassLevel = pMetadata->getAttributeByPath(imageClassLevelPathName);
if (dvImageClassLevel.getValue(imageClassLevel) == true)
{
pClassification->setLevel(imageClassLevel);
if (pClassification->hasGreaterLevel(pOverallClassification) == true)
{
if (errorMessage.empty() == false)
{
errorMessage += "\n";
}
errorMessage += "THIS FILE CONTAINS INVALID CLASSIFICATION INFORMATION! The image has a higher "
"classification level than the file. Update the Classification information before proceeding.";
}
}
// Look in each DES subheader.
int numDes;
const string numDesPathName[] = { Nitf::NITF_METADATA, Nitf::FILE_HEADER,
Nitf::FileHeaderFieldNames::NUM_DES, END_METADATA_NAME };
const DataVariant& dvNumDes = pMetadata->getAttributeByPath(numDesPathName);
if (dvNumDes.getValue(numDes) == true)
{
for (int i = 0; i < numDes; ++i)
{
stringstream desStr;
desStr << "DES_" << setw(3) << setfill('0') << i;
string desClassLevel;
const string desClassLevelPathName[] = { Nitf::NITF_METADATA, Nitf::DES_METADATA,
desStr.str(), Nitf::DesSubheaderFieldNames::SECURITY_LEVEL, END_METADATA_NAME };
const DataVariant& dvDesClassLevel = pMetadata->getAttributeByPath(desClassLevelPathName);
if (dvDesClassLevel.getValue(desClassLevel) == true)
{
pClassification->setLevel(desClassLevel);
if (pClassification->hasGreaterLevel(pOverallClassification) == true)
{
if (errorMessage.empty() == false)
{
errorMessage += "\n";
}
errorMessage += "THIS FILE CONTAINS INVALID CLASSIFICATION INFORMATION! " + desStr.str() +
" has a higher classification level than the file. Update the Classification information "
"before proceeding.";
}
}
}
}
return true;
}
示例2: setClassification
bool ClassificationImp::setClassification(const string& classificationText)
{
if (classificationText.empty() == true)
{
return false;
}
Service<UtilityServices> pUtilities;
FactoryResource<Classification> pClassification;
const string delimiter = "//";
// Level
QString field = QString::fromStdString(classificationText);
string::size_type pos = classificationText.find(delimiter);
if (pos != string::npos)
{
field = QString::fromStdString(classificationText.substr(0, pos));
}
pClassification->setLevel(field.toStdString());
// All other fields
while (pos != string::npos)
{
// Get the next field
pos += delimiter.length();
string::size_type nextPos = classificationText.find(delimiter, pos);
if (nextPos != string::npos)
{
field = QString::fromStdString(classificationText.substr(pos, nextPos - pos));
}
else
{
field = QString::fromStdString(classificationText.substr(pos));
}
pos = nextPos;
if (field.isEmpty() == true)
{
continue;
}
QStringList fieldList = field.split("/", QString::SkipEmptyParts);
// Codewords
bool codewordsField = true;
const vector<string>& codewords = pUtilities->getCodewords();
for (int i = 0; i < fieldList.count(); ++i)
{
if (std::find(codewords.begin(), codewords.end(), fieldList[i].toStdString()) == codewords.end())
{
codewordsField = false;
break;
}
}
if (codewordsField == true)
{
field.replace("/", " ");
pClassification->setCodewords(field.toStdString());
continue;
}
// System
bool systemField = true;
const vector<string>& systems = pUtilities->getSystems();
for (int i = 0; i < fieldList.count(); ++i)
{
if (std::find(systems.begin(), systems.end(), fieldList[i].toStdString()) == systems.end())
{
systemField = false;
break;
}
}
if (systemField == true)
{
field.replace("/", " ");
pClassification->setSystem(field.toStdString());
continue;
}
// File releasing
bool fileReleasingField = true;
const QString relTo = "REL TO";
const vector<string>& fileReleasings = pUtilities->getFileReleasing();
for (int i = 0; i < fieldList.count(); ++i)
{
QString fileReleasing = fieldList[i];
if (fileReleasing.indexOf(relTo) == 0)
{
fileReleasing = relTo;
}
//.........这里部分代码省略.........
示例3: if
//.........这里部分代码省略.........
vector<DimensionDescriptor> bands;
pField = mFields.find(bandsStr);
if (pField != NULL)
{
int numBands = atoi(pField->mValue.c_str());
bands = RasterUtilities::generateDimensionVector(numBands, true, false, true);
pDescriptor->setBands(bands);
pFileDescriptor->setBands(bands);
}
// Description
list<GcpPoint> gcps;
pField = mFields.find("description");
if (pField != NULL)
{
// Metadata
if (pField->mChildren.empty() == false)
{
FactoryResource<DynamicObject> pMetadata;
for (unsigned int i = 0; i < pField->mChildren.size(); ++i)
{
EnviField* pChild = pField->mChildren[i];
if (pChild != NULL)
{
if (pChild->mTag == "classification")
{
// Classification
FactoryResource<Classification> pClassification;
if (pClassification.get() != NULL)
{
string classLevel;
classLevel.append(1, *(pChild->mValue.data()));
pClassification->setLevel(classLevel);
pDescriptor->setClassification(pClassification.get());
}
}
else if ((pChild->mTag == "ll") || (pChild->mTag == "lr") || (pChild->mTag == "ul") ||
(pChild->mTag == "ur") || (pChild->mTag == "center"))
{
GcpPoint gcp;
bool dmsFormat = false;
char ns;
char ew;
sscanf(pChild->mValue.c_str(), "%lg%c %lg%c", &gcp.mCoordinate.mY, &ew,
&gcp.mCoordinate.mX, &ns);
if (fabs(gcp.mCoordinate.mY) > 180.0 || fabs(gcp.mCoordinate.mX) > 90.0)
{
dmsFormat = true;
}
double deg;
double min;
double sec;
if (dmsFormat == true)
{
deg = static_cast<int>(gcp.mCoordinate.mY / 10000.0);
min = static_cast<int>((gcp.mCoordinate.mY - 10000.0 * deg) / 100.0);
sec = gcp.mCoordinate.mY - 10000.0 * deg - 100.0 * min;
gcp.mCoordinate.mY = deg + (min / 60.0) + (sec / 3600.0);
}
if (ew == 'W' || ew == 'w')
{
示例4: validate
bool ImporterShell::validate(const DataDescriptor* pDescriptor, string& errorMessage) const
{
mValidationError = ValidationTest();
// Check for no validation
int validationTest = getValidationTest(pDescriptor);
if (validationTest == NO_VALIDATION)
{
return true;
}
// Always validate the data descriptor and file descriptor
if (pDescriptor == NULL)
{
errorMessage = "The data set information is invalid.";
return false;
}
const FileDescriptor* pFileDescriptor = pDescriptor->getFileDescriptor();
if (pFileDescriptor == NULL)
{
errorMessage = "The data set does not contain valid file information.";
return false;
}
// Existing file
const string& filename = pFileDescriptor->getFilename();
if (validationTest & EXISTING_FILE)
{
// Valid filename
if (filename.empty() == true)
{
errorMessage = "The filename is invalid.";
mValidationError = EXISTING_FILE;
return false;
}
// Existing file
LargeFileResource file(true);
if (!file.open(filename.c_str(), O_RDONLY | O_BINARY, S_IREAD))
{
errorMessage = "The file: " + filename + " does not exist.";
mValidationError = EXISTING_FILE;
return false;
}
}
// Existing data element
if (validationTest & NO_EXISTING_DATA_ELEMENT)
{
const string& name = pDescriptor->getName();
const string& type = pDescriptor->getType();
DataElement* pParent = pDescriptor->getParent();
Service<ModelServices> pModel;
if (pModel->getElement(name, type, pParent) != NULL)
{
errorMessage = "The data set currently exists. It may have already been imported.";
mValidationError = NO_EXISTING_DATA_ELEMENT;
return false;
}
}
// Valid classification
Service<UtilityServices> pUtilities;
if (validationTest & VALID_CLASSIFICATION)
{
// Existing Classification object
const Classification* pClassification = pDescriptor->getClassification();
if (pClassification == NULL)
{
errorMessage = "The required classification does not exist.";
mValidationError = VALID_CLASSIFICATION;
return false;
}
// Unauthorized classification level on the system - warn the user, but continue to load the file
FactoryResource<Classification> pSystemClassification;
pSystemClassification->setLevel(pUtilities->getDefaultClassification());
if (pClassification->hasGreaterLevel(pSystemClassification.get()) == true)
{
errorMessage = "THIS FILE CONTAINS CLASSIFIED INFORMATION WHICH SHOULD NOT BE PROCESSED ON THIS SYSTEM!\n"
"THIS MAY CONSTITUTE A SECURITY VIOLATION WHICH SHOULD BE REPORTED TO YOUR SECURITY OFFICER!\n";
StepResource pStep("Validate", "app", "1A881267-6A96-4eb2-A9D3-7D30334B0A0B", errorMessage);
}
}
// Valid metadata
if (validationTest & VALID_METADATA)
{
if (pDescriptor->getMetadata() == NULL)
{
errorMessage = "The required metadata does not exist.";
mValidationError = VALID_METADATA;
return false;
}
}
// Processing location
if (validationTest & VALID_PROCESSING_LOCATION)
//.........这里部分代码省略.........