本文整理汇总了C++中DynamicObject::setAttributeByPath方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicObject::setAttributeByPath方法的具体用法?C++ DynamicObject::setAttributeByPath怎么用?C++ DynamicObject::setAttributeByPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicObject
的用法示例。
在下文中一共展示了DynamicObject::setAttributeByPath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: polishDataDescriptor
void LayerImporter::polishDataDescriptor(DataDescriptor *pDescriptor)
{
// if no metadata has been pushed into the options widget, then the user hasn't called the widget
// so don't update the metadata with bad values
// call base class method.
ImporterShell::polishDataDescriptor(pDescriptor);
DynamicObject* pMetadata = pDescriptor->getMetadata();
VERIFYNRV(NULL != pDescriptor);
// ensure we are reentrant by locking the sets or we'll get in an infinite loop
bool echk = false; // check value...must be stack local for reentrance check to work
if (mPolishEntered.compare_exchange_strong(echk, true, boost::memory_order_seq_cst))
{
bool usePixelCoords = false;
if (NULL != mpCheckBox)
{
usePixelCoords = mpCheckBox->isChecked();
}
pMetadata->setAttributeByPath( "Layer/Import Options/Use Pixel Coordinates",
usePixelCoords );
mPolishEntered.store(false);
}
}
示例2: xml
vector<ImportDescriptor*> LayerImporter::getImportDescriptors(const string& filename, bool reportErrors)
{
vector<ImportDescriptor*> descriptors;
if (!filename.empty())
{
MessageLog* pLog = NULL;
if (reportErrors == true)
{
Service<MessageLogMgr> pLogMgr;
pLog = pLogMgr->getLog();
}
XmlReader xml(pLog);
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* pDoc = xml.parse(filename, "metadata");
DOMElement* pRootElement = NULL;
if (pDoc != NULL)
{
pRootElement = pDoc->getDocumentElement();
}
if (pRootElement != NULL)
{
for (DOMNode* pChild = pRootElement->getFirstChild();
pChild != NULL;
pChild = pChild->getNextSibling())
{
if (pChild->getNodeType() == DOMNode::ELEMENT_NODE)
{
DOMElement* pChildElement = static_cast<DOMElement*>(pChild);
string cNodeName = A(pChildElement->getNodeName());
ImportDescriptor* pImportDescriptor = ModelImporter::populateImportDescriptor(pChildElement, filename);
if (pImportDescriptor != NULL)
{
DataDescriptor* pDataDescriptor = pImportDescriptor->getDataDescriptor();
if (NULL != pDataDescriptor)
{
DynamicObject* pMetadataZ = pDataDescriptor->getMetadata();
VERIFYRV(pMetadataZ, descriptors);
if (!pMetadataZ->getAttributeByPath("Layer/Import Options/Use Pixel Coordinates").isValid())
{
pMetadataZ->setAttributeByPath("Layer/Import Options/Use Pixel Coordinates", false);
}
}
descriptors.push_back(pImportDescriptor);
}
}
}
}
}
return descriptors;
}
示例3: VERIFY
bool Nitf::DesSubheader::importMetadata(const ossimPropertyInterface *pHeader, RasterDataDescriptor *pDescriptor)
{
VERIFY(pHeader != NULL && pDescriptor != NULL);
FactoryResource<DynamicObject> pDesSubheaderMetadata;
VERIFY(pDesSubheaderMetadata.get() != NULL);
VERIFY(Header::importMetadata(pHeader, pDescriptor, pDesSubheaderMetadata.get()));
VERIFY(pDescriptor != NULL);
DynamicObject* pMetadata = pDescriptor->getMetadata();
VERIFY(pMetadata != NULL);
pMetadata->setAttributeByPath(getMetadataPath(), *pDesSubheaderMetadata.get());
return true;
}
示例4: saveAnimationTimes
bool TimelineWidget::saveAnimationTimes(Animation *pAnim)
{
if(pAnim == NULL)
{
return false;
}
bool success = false;
const std::vector<AnimationFrame> frames = pAnim->getFrames();
std::vector<double> times(frames.size(), 0.0);
for(unsigned int idx = 0; idx < frames.size(); idx++)
{
times[idx] = frames[idx].mTime;
}
std::vector<Window*> windows;
Service<DesktopServices>()->getWindows(SPATIAL_DATA_WINDOW, windows);
for(std::vector<Window*>::iterator window = windows.begin(); window != windows.end(); ++window)
{
SpatialDataView *pView = static_cast<SpatialDataWindow*>(*window)->getSpatialDataView();
std::vector<Layer*> layers;
pView->getLayerList()->getLayers(RASTER, layers);
for(std::vector<Layer*>::iterator layer = layers.begin(); layer != layers.end(); ++layer)
{
RasterLayer *pLayer = static_cast<RasterLayer*>(*layer);
if(pLayer->getAnimation() == pAnim)
{
RasterElement *pElement = static_cast<RasterElement*>(pLayer->getDataElement());
DynamicObject *pMetadata = static_cast<RasterDataDescriptor*>(pElement->getDataDescriptor())->getMetadata();
if(pMetadata != NULL)
{
success = success || pMetadata->setAttributeByPath(FRAME_TIMES_METADATA_PATH, times);
}
}
}
}
return success;
}
示例5: pFile
std::vector<ImportDescriptor*> FitsImporter::getImportDescriptors(const std::string& fname)
{
std::string filename = fname;
std::vector<std::vector<std::string> >& errors = mErrors[fname];
std::vector<std::vector<std::string> >& warnings = mWarnings[fname];
errors.clear();
warnings.clear();
int status=0;
std::vector<ImportDescriptor*> descriptors;
FitsFileResource pFile(filename);
if (!pFile.isValid())
{
errors.resize(1);
errors[0].push_back(pFile.getStatus());
RETURN_DESCRIPTORS;
}
int hduCnt = 0;
int specificHdu = 0;
int hdu = 1;
if (!splitFilename(filename, hduCnt, specificHdu, hdu, pFile, errors, warnings))
{
RETURN_DESCRIPTORS;
}
errors.resize(hduCnt+1);
warnings.resize(hduCnt+1);
for(; hdu <= hduCnt; ++hdu)
{
std::string datasetName = filename + "[" + StringUtilities::toDisplayString(hdu) + "]";
int hduType;
CHECK_FITS(fits_movabs_hdu(pFile, hdu, &hduType, &status), hdu, false, continue);
ImportDescriptorResource pImportDescriptor(static_cast<ImportDescriptor*>(NULL));
FactoryResource<DynamicObject> pMetadata;
VERIFYRV(pMetadata.get() != NULL, descriptors);
{ // scope
std::vector<std::string> comments;
char pCard[81];
char pValue[81];
char pComment[81];
int nkeys = 0;
CHECK_FITS(fits_get_hdrspace(pFile, &nkeys, NULL, &status), hdu, true, ;);
for(int keyidx = 1; keyidx <= nkeys; ++keyidx)
{
CHECK_FITS(fits_read_keyn(pFile, keyidx, pCard, pValue, pComment, &status), hdu, true, continue);
std::string name = StringUtilities::stripWhitespace(std::string(pCard));
std::string val = StringUtilities::stripWhitespace(std::string(pValue));
std::string comment = StringUtilities::stripWhitespace(std::string(pComment));
if (!val.empty())
{
pMetadata->setAttributeByPath("FITS/" + name, val);
}
else if (!comment.empty())
{
comments.push_back(comment);
}
}
if (!comments.empty())
{
// ideally, this would add a multi-line string but Opticks doesn't display this properly
// pMetadata->setAttributeByPath("FITS/COMMENT", StringUtilities::join(comments, "\n"));
for(unsigned int idx = 0; idx < comments.size(); ++idx)
{
pMetadata->setAttributeByPath("FITS/COMMENT/" + StringUtilities::toDisplayString(idx), comments[idx]);
}
}
}
switch(hduType)
{
case IMAGE_HDU:
{
pImportDescriptor = ImportDescriptorResource(datasetName, TypeConverter::toString<RasterElement>());
VERIFYRV(pImportDescriptor.get() != NULL, descriptors);
EncodingType fileEncoding;
InterleaveFormatType interleave(BSQ);
unsigned int rows=0;
unsigned int cols=0;
unsigned int bands=1;
int bitpix;
int naxis;
long axes[3];
CHECK_FITS(fits_get_img_param(pFile, 3, &bitpix, &naxis, axes, &status), hdu, false, continue);
switch(bitpix)
{
case BYTE_IMG:
fileEncoding = INT1UBYTE;
break;
case SHORT_IMG:
fileEncoding = INT2SBYTES;
break;
case LONG_IMG:
fileEncoding = INT4SBYTES;
break;
case FLOAT_IMG:
fileEncoding = FLT4BYTES;
break;
case DOUBLE_IMG:
//.........这里部分代码省略.........
示例6: if
//.........这里部分代码省略.........
pDescriptor->setDisplayBand(RED, redBand);
pDescriptor->setDisplayBand(GREEN, greenBand);
pDescriptor->setDisplayBand(BLUE, blueBand);
pDescriptor->setDisplayMode(RGB_MODE);
}
}
// Bad bands
pField = mFields.find("bbl");
if (pField != NULL)
{
vector<unsigned int> validBands;
parseBbl(pField, validBands);
vector<DimensionDescriptor> bandsToLoad;
for (vector<unsigned int>::const_iterator iter = validBands.begin();
iter != validBands.end();
++iter)
{
const unsigned int onDiskNumber = *iter;
const DimensionDescriptor dim = pFileDescriptor->getOnDiskBand(onDiskNumber);
if (dim.isValid())
{
bandsToLoad.push_back(dim);
}
}
pDescriptor->setBands(bandsToLoad);
}
DynamicObject* pMetadata = pDescriptor->getMetadata();
// Band names
pField = mFields.find("band names");
if (pField != NULL)
{
vector<string> bandNames;
bandNames.reserve(bands.size());
vector<string> strNames;
for (vector<EnviField*>::size_type i = 0; i < pField->mChildren.size(); ++i)
{
strNames = StringUtilities::split(pField->mChildren[i]->mValue, ',');
copy(strNames.begin(), strNames.end(), back_inserter(bandNames));
}
vector<string>::iterator it;
for (it = bandNames.begin(); it != bandNames.end(); ++it)
{
*it = StringUtilities::stripWhitespace(*it);
}
if (pMetadata != NULL)
{
string pNamesPath[] = { SPECIAL_METADATA_NAME, BAND_METADATA_NAME,
NAMES_METADATA_NAME, END_METADATA_NAME };
pMetadata->setAttributeByPath(pNamesPath, bandNames);
}
}
// wavelength units
pField = mFields.find("wavelength units");
if (pField != NULL)
{
mWavelengthUnits = strToType(pField->mValue);
}
// Wavelengths
vector<double> centerWavelengths;
pField = mFields.find("wavelength");
if (pField != NULL)
{
if ((parseWavelengths(pField, ¢erWavelengths) == true) && (pMetadata != NULL))
{
string pCenterPath[] = { SPECIAL_METADATA_NAME, BAND_METADATA_NAME,
CENTER_WAVELENGTHS_METADATA_NAME, END_METADATA_NAME };
pMetadata->setAttributeByPath(pCenterPath, centerWavelengths);
}
}
// FWHM
pField = mFields.find("fwhm");
if (pField != NULL)
{
vector<double> startWavelengths;
vector<double> endWavelengths;
if ((parseFwhm(pField, &startWavelengths, ¢erWavelengths, &endWavelengths) == true) &&
(pMetadata != NULL))
{
string pStartPath[] = { SPECIAL_METADATA_NAME, BAND_METADATA_NAME,
START_WAVELENGTHS_METADATA_NAME, END_METADATA_NAME };
pMetadata->setAttributeByPath(pStartPath, startWavelengths);
string pEndPath[] = { SPECIAL_METADATA_NAME, BAND_METADATA_NAME,
END_WAVELENGTHS_METADATA_NAME, END_METADATA_NAME };
pMetadata->setAttributeByPath(pEndPath, endWavelengths);
}
}
// File descriptor
pDescriptor->setFileDescriptor(pFileDescriptor.get());
}
示例7: pFile
//.........这里部分代码省略.........
}
else if ((sioFile.mVersion == 7) || (sioFile.mVersion == 8))
{
gcpLowerRight.mCoordinate.mX = sioFile.mParameters[i].uParameter_Value.dData;
}
bValidGcps = true;
break;
case LOWER_RIGHT_CORNER_LONG:
if ((sioFile.mVersion == 5) || (sioFile.mVersion == 6))
{
gcpLowerRight.mCoordinate.mX = sioFile.mParameters[i].uParameter_Value.dData;
}
else if ((sioFile.mVersion == 7) || (sioFile.mVersion == 8))
{
gcpLowerRight.mCoordinate.mY = sioFile.mParameters[i].uParameter_Value.dData;
}
bValidGcps = true;
break;
case CENTER_LAT:
if ((sioFile.mVersion == 5) || (sioFile.mVersion == 6))
{
gcpCenter.mCoordinate.mY = sioFile.mParameters[i].uParameter_Value.dData;
}
else if ((sioFile.mVersion == 7) || (sioFile.mVersion == 8))
{
gcpCenter.mCoordinate.mX = sioFile.mParameters[i].uParameter_Value.dData;
}
bValidGcps = true;
break;
case CENTER_LONG:
if ((sioFile.mVersion == 5) || (sioFile.mVersion == 6))
{
gcpCenter.mCoordinate.mX = sioFile.mParameters[i].uParameter_Value.dData;
}
else if ((sioFile.mVersion == 7) || (sioFile.mVersion == 8))
{
gcpCenter.mCoordinate.mY = sioFile.mParameters[i].uParameter_Value.dData;
}
bValidGcps = true;
break;
default:
break;
}
}
}
if (bValidGcps == true)
{
list<GcpPoint> gcps;
gcps.push_back(gcpLowerLeft);
gcps.push_back(gcpLowerRight);
gcps.push_back(gcpUpperLeft);
gcps.push_back(gcpUpperRight);
gcps.push_back(gcpCenter);
pFileDescriptor->setGcps(gcps);
}
// Classification
pDescriptor->setClassification(sioFile.mpClassification.get());
// Metadata
pDescriptor->setMetadata(sioFile.mpMetadata.get());
DynamicObject* pMetadata = pDescriptor->getMetadata();
if (pMetadata != NULL)
{
vector<double> startWavelengths(sioFile.mStartWavelengths.size());
copy(sioFile.mStartWavelengths.begin(), sioFile.mStartWavelengths.end(), startWavelengths.begin());
vector<double> endWavelengths(sioFile.mEndWavelengths.size());
copy(sioFile.mEndWavelengths.begin(), sioFile.mEndWavelengths.end(), endWavelengths.begin());
vector<double> centerWavelengths(sioFile.mCenterWavelengths.size());
copy(sioFile.mCenterWavelengths.begin(), sioFile.mCenterWavelengths.end(), centerWavelengths.begin());
string pStartPath[] = { SPECIAL_METADATA_NAME, BAND_METADATA_NAME,
START_WAVELENGTHS_METADATA_NAME, END_METADATA_NAME };
pMetadata->setAttributeByPath(pStartPath, startWavelengths);
string pEndPath[] = { SPECIAL_METADATA_NAME, BAND_METADATA_NAME,
END_WAVELENGTHS_METADATA_NAME, END_METADATA_NAME };
pMetadata->setAttributeByPath(pEndPath, endWavelengths);
string pCenterPath[] = { SPECIAL_METADATA_NAME, BAND_METADATA_NAME,
CENTER_WAVELENGTHS_METADATA_NAME, END_METADATA_NAME };
pMetadata->setAttributeByPath(pCenterPath, centerWavelengths);
}
// File descriptor
pDescriptor->setFileDescriptor(pFileDescriptor.get());
}
}
descriptors.push_back(pImportDescriptor);
}
}
return descriptors;
}
示例8: importMetadata
bool Nitf::importMetadata(const unsigned int& currentImage, const Nitf::OssimFileResource& pFile,
const ossimNitfFileHeaderV2_X* pFileHeader, const ossimNitfImageHeaderV2_X* pImageSubheader,
RasterDataDescriptor* pDescriptor, map<string, TrePlugInResource>& parsers, string& errorMessage)
{
//#pragma message(__FILE__ "(" STRING(__LINE__) ") : warning : Separate the file header parsing " \
// "from the subheader parsing (dadkins)")
VERIFY(pFileHeader != NULL && pImageSubheader != NULL && pDescriptor != NULL);
// Add metadata for the NITF File Header and the supported subheaders
const string fileVersion = pFileHeader->getVersion();
Nitf::FileHeader fileHeader(fileVersion);
if (fileHeader.importMetadata(pFileHeader, pDescriptor) == false)
{
errorMessage += "Unable to import metadata from the file header.\n";
return false;
}
unsigned int numDes = pFileHeader->getNumberOfDataExtSegments();
for (unsigned int i = 0; i < numDes; ++i)
{
auto_ptr<ossimNitfDataExtensionSegment> pDes(pFile->getNewDataExtensionSegment(i));
if (pDes.get() != NULL)
{
Nitf::DesSubheader desSubheader(fileVersion, i);
if (desSubheader.importMetadata(pDes.get(), pDescriptor) == false)
{
stringstream errorStream;
errorStream << "Unable to retrieve DES subheader #" << i << "." << endl;
errorMessage += errorStream.str();
}
}
}
Nitf::ImageSubheader imageSubheader(fileVersion);
if (imageSubheader.importMetadata(pImageSubheader, pDescriptor) == false)
{
errorMessage += "Unable to import metadata from the image subheader.\n";
return false;
}
// Now do the TREs
FactoryResource<DynamicObject> pTres;
FactoryResource<DynamicObject> pTreInfo;
const unsigned int numImageTags = pImageSubheader->getNumberOfTags();
for (unsigned int imageTag = 0; imageTag < numImageTags; ++imageTag)
{
ossimNitfTagInformation tagInfo;
if (pImageSubheader->getTagInformation(tagInfo, imageTag) == false)
{
stringstream errorStream;
errorStream << "Unable to retrieve tag #" << imageTag << " from the image subheader." << endl;
errorMessage += errorStream.str();
}
else
{
addTagToMetadata(currentImage, tagInfo, pDescriptor, pTres.get(), pTreInfo.get(), parsers, errorMessage);
}
}
const unsigned int numFileTags = pFileHeader->getNumberOfTags();
for (unsigned int fileTag = 0; fileTag < numFileTags; ++fileTag)
{
ossimNitfTagInformation tagInfo;
if (pFileHeader->getTagInformation(tagInfo, fileTag) == false)
{
stringstream errorStream;
errorStream << "Unable to retrieve tag #" << fileTag << " from the file header." << endl;
errorMessage += errorStream.str();
}
else
{
// For file headers, currentImage is always 0.
addTagToMetadata(0, tagInfo, pDescriptor, pTres.get(), pTreInfo.get(), parsers, errorMessage);
}
}
// FTITLE parsing requires the metadata object to be populated first
DynamicObject* pMetadata = pDescriptor->getMetadata();
VERIFY(pMetadata != NULL);
pMetadata->setAttributeByPath(Nitf::NITF_METADATA + "/" + Nitf::TRE_METADATA, *pTres.get());
pMetadata->setAttributeByPath(Nitf::NITF_METADATA + "/" + Nitf::TRE_INFO_METADATA, *pTreInfo.get());
//#pragma message(__FILE__ "(" STRING(__LINE__) ") : warning : Consider moving this into ChipConverter (leckels)")
// We have two equations of the form:
// FI_x = a*OP_x + b*OP_y + c and
// FI_y = d*OP_x + e*OP_y + f
//
// The coefficients a-f are as follows (from Todd's implementation of FTITLE -> ICHIPB Coefficients
// a = 1.0;
// b = 0.0
// c = (row-1)*x_pixel_block_size, where row comes from FTITLE
// d = 0.0
// e = 1.0
// f = (column-1)*y_pixel_block_size, where column comes from FTITLE
//
// Solving for OP_x, OP_y, and substituting for a-f, we get:
// FI_x - c = OP_x
// FI_y - f = OP_y
//.........这里部分代码省略.........