本文整理汇总了C++中FactoryResource::setDatasetLocation方法的典型用法代码示例。如果您正苦于以下问题:C++ FactoryResource::setDatasetLocation方法的具体用法?C++ FactoryResource::setDatasetLocation怎么用?C++ FactoryResource::setDatasetLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactoryResource
的用法示例。
在下文中一共展示了FactoryResource::setDatasetLocation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: parsedFile
vector<ImportDescriptor*> SampleHdf4Importer::getImportDescriptors(const string& filename)
{
vector<ImportDescriptor*> descriptors;
Hdf4File parsedFile(filename);
bool bSuccess = getFileData(parsedFile);
if (bSuccess == true)
{
const Hdf4Dataset* pDataset =
dynamic_cast<const Hdf4Dataset*>(parsedFile.getRootGroup()->getElement("EV_500_RefSB"));
if ((pDataset != NULL) && (mpModel.get() != NULL))
{
Hdf4FileResource pFile(filename.c_str());
if (pFile.get() != NULL)
{
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)
{
int32 numDims = 0;
int32 dataType = 0;
int32 numAttr = 0;
pFileDescriptor->setFilename(filename);
Hdf4DatasetResource pDataHandle(*pFile, pDataset->getName().c_str());
int32 dimSizes[MAX_VAR_DIMS] = {0};
if (pDataHandle != NULL && *pDataHandle != FAIL)
{
pFileDescriptor->setDatasetLocation(pDataset->getName());
int32 success = SDgetinfo(*pDataHandle, const_cast<char*>(pDataset->getName().c_str()),
&numDims, dimSizes, &dataType, &numAttr);
// find out what type this Dataset is
string strDataType = hdf4TypeToString(dataType, 1);
if (success == SUCCEED && numDims == 3 && strDataType == "unsigned short")
{
// Bands
vector<DimensionDescriptor> bands =
RasterUtilities::generateDimensionVector(dimSizes[0], true, false, true);
pDescriptor->setBands(bands);
pFileDescriptor->setBands(bands);
// Rows
vector<DimensionDescriptor> rows =
RasterUtilities::generateDimensionVector(dimSizes[1], true, false, true);
pDescriptor->setRows(rows);
pFileDescriptor->setRows(rows);
// Columns
vector<DimensionDescriptor> columns =
RasterUtilities::generateDimensionVector(dimSizes[2], true, false, true);
pDescriptor->setColumns(columns);
pFileDescriptor->setColumns(columns);
}
}
// Data type
EncodingType e;
pDataset->getDataEncoding(e);
pDescriptor->setDataType(e);
pFileDescriptor->setBitsPerElement(pDescriptor->getBytesPerElement() * 8);
// Interleave format
pDescriptor->setInterleaveFormat(BSQ);
pFileDescriptor->setInterleaveFormat(BSQ);
// Metadata
FactoryResource<DynamicObject> pMetadata;
if (pMetadata.get() != NULL)
{
const Hdf4Dataset::AttributeContainer& attributes = pDataset->getAttributes();
for (Hdf4Dataset::AttributeContainer::const_iterator it = attributes.begin();
it != attributes.end(); ++it)
{
Hdf4Attribute* pAttribute = it->second;
if (pAttribute != NULL)
{
const string& name = pAttribute->getName();
const DataVariant& var = pAttribute->getVariant();
const unsigned short* pValue = var.getPointerToValue<unsigned short>();
if (name == "_FillValue" && pValue != NULL)
{
// Bad values
vector<int> badValues;
badValues.push_back(*pValue);
pDescriptor->setBadValues(badValues);
}
else
{
//.........这里部分代码省略.........