本文整理汇总了C++中DataElement::getFilename方法的典型用法代码示例。如果您正苦于以下问题:C++ DataElement::getFilename方法的具体用法?C++ DataElement::getFilename怎么用?C++ DataElement::getFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataElement
的用法示例。
在下文中一共展示了DataElement::getFilename方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
vector<string> ModelServicesImp::getElementNames(const string& filename, const string& type) const
{
vector<string> elementNames;
multimap<Key, DataElement*>::const_iterator iter;
for (iter = mElements.begin(); iter != mElements.end(); ++iter)
{
DataElement* pElement = iter->second;
if (pElement != NULL)
{
string currentFilename = pElement->getFilename();
string lowerCurrentFilename = StringUtilities::toLower(currentFilename);
string lowerElementFilename = StringUtilities::toLower(filename);
if (lowerCurrentFilename == lowerElementFilename)
{
if ((type.empty() == true) || (pElement->isKindOf(type) == true))
{
elementNames.push_back(pElement->getName());
}
}
}
}
return elementNames;
}
示例2: execute
bool CgmImporter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
Progress* pProgress = NULL;
DataElement* pElement = NULL;
StepResource pStep("Import cgm element", "app", "8D5522FE-4A89-44cb-9735-6920A3BFC903");
// get input arguments and log some useful info about them
{ // scope the MessageResource
MessageResource pMsg("Input arguments", "app", "A1735AC7-C182-45e6-826F-690DBA15D84A");
pProgress = pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg());
pMsg->addBooleanProperty("Progress Present", (pProgress != NULL));
pElement = pInArgList->getPlugInArgValue<DataElement>(Importer::ImportElementArg());
if (pElement == NULL)
{
if (pProgress != NULL)
{
pProgress->updateProgress("No data element", 0, ERRORS);
}
pStep->finalize(Message::Failure, "No data element");
return false;
}
pMsg->addProperty("Element name", pElement->getName());
}
if (pProgress != NULL)
{
pProgress->updateProgress((string("Read and parse file ") + pElement->getFilename()), 20, NORMAL);
}
// Create a new annotation layer for a spatial data view or get the layout layer for a product view
if (pProgress != NULL)
{
pProgress->updateProgress("Create a new layer", 30, NORMAL);
}
View* pView = mpDesktop->getCurrentWorkspaceWindowView();
if (pView == NULL)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Could not access the current view.", 0, ERRORS);
}
pStep->finalize(Message::Failure, "Could not access the current view.");
return false;
}
UndoGroup undoGroup(pView, "Import CGM");
AnnotationLayer* pLayer = NULL;
SpatialDataView* pSpatialDataView = dynamic_cast<SpatialDataView*>(pView);
if (pSpatialDataView != NULL)
{
// Set the parent element of the annotation element to the primary raster element
LayerList* pLayerList = pSpatialDataView->getLayerList();
if (pLayerList != NULL)
{
RasterElement* pNewParentElement = pLayerList->getPrimaryRasterElement();
if (pNewParentElement != NULL)
{
Service<ModelServices> pModel;
pModel->setElementParent(pElement, pNewParentElement);
}
}
pLayer = dynamic_cast<AnnotationLayer*>(pSpatialDataView->createLayer(ANNOTATION, pElement));
}
else
{
ProductView* pProductView = dynamic_cast<ProductView*>(mpDesktop->getCurrentWorkspaceWindowView());
if (pProductView != NULL)
{
pLayer = pProductView->getLayoutLayer();
}
}
if (pLayer == NULL)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Unable to get the annotation layer", 0, ERRORS);
}
pStep->finalize(Message::Failure, "Unable to get the annotation layer");
return false;
}
// add the CGM object
if (pProgress != NULL)
{
pProgress->updateProgress("Create the CGM object", 60, NORMAL);
}
CgmObject* pCgmObject = dynamic_cast<CgmObject*>(pLayer->addObject(CGM_OBJECT));
if (pCgmObject == NULL)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Unable to create the CGM object", 0, ERRORS);
}
//.........这里部分代码省略.........
示例3: execute
bool LayerImporter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
Layer* pLayer = NULL;
Progress* pProgress = NULL;
DataElement* pElement = NULL;
SpatialDataView* pView = NULL;
StepResource pStep("Import layer", "app", "DF24688A-6B34-4244-98FF-5FFE2063AC05");
// get input arguments and log some useful info about them
{ // scope the MessageResource
MessageResource pMsg("Input arguments", "app", "C0A532DE-0E19-44D3-837C-16ABD267B2C1");
pProgress = pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg());
pMsg->addBooleanProperty("Progress Present", (pProgress != NULL));
pElement = pInArgList->getPlugInArgValue<DataElement>(Importer::ImportElementArg());
if (pElement == NULL)
{
if (pProgress != NULL)
{
pProgress->updateProgress("No data element", 100, ERRORS);
}
pStep->finalize(Message::Failure, "No data element");
return false;
}
pMsg->addProperty("Element name", pElement->getName());
pView = pInArgList->getPlugInArgValue<SpatialDataView>(Executable::ViewArg());
if (pView != NULL)
{
pMsg->addProperty("View name", pView->getName());
}
}
if (pProgress != NULL)
{
pProgress->updateProgress((string("Read and parse file ") + pElement->getFilename()),
20, NORMAL);
}
// parse the xml
XmlReader xml(Service<MessageLogMgr>()->getLog());
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* pDomDocument = xml.parse(pElement->getFilename());
if (pDomDocument == NULL)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Unable to parse the file", 100, ERRORS);
}
pStep->finalize(Message::Failure, "Unable to parse the file");
return false;
}
DOMElement* pRootElement = pDomDocument->getDocumentElement();
VERIFY(pRootElement != NULL);
if (pProgress != NULL)
{
pProgress->updateProgress("Create the layer", 40, NORMAL);
}
string name(A(pRootElement->getAttribute(X("name"))));
string type(A(pRootElement->getAttribute(X("type"))));
unsigned int formatVersion = atoi(A(pRootElement->getAttribute(X("version"))));
{ // scope the MessageResource
MessageResource pMsg("Layer information", "app", "AA358F7A-107E-456E-8D11-36DDBE5B1645");
pMsg->addProperty("name", name);
pMsg->addProperty("type", type);
pMsg->addProperty("format version", formatVersion);
}
// If user requested pixel coordinates be used.
bool usePixelCoords = false;
DataDescriptor* pDesc = pElement->getDataDescriptor();
VERIFY( pDesc );
pDesc->getMetadata()->getAttributeByPath( "Layer/Import Options/Use Pixel Coordinates" ).getValue( usePixelCoords );
if (usePixelCoords)
{
// Remove geoVertices and geoBox elements.
removeGeoNodes(pRootElement);
}
if (pView == NULL)
{
//no view provided, so find current view
SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(mpDesktop->getCurrentWorkspaceWindow());
if (pWindow != NULL)
{
pView = pWindow->getSpatialDataView();
}
}
if (pView == NULL)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Could not access the view to create the layer.", 100, ERRORS);
}
//.........这里部分代码省略.........
示例4: FilePlugInDlg
ExportDlg::ExportDlg(ExporterResource& pExporter,
const vector<PlugInDescriptor*>& availablePlugins,
QWidget* pParent) :
FilePlugInDlg(availablePlugins, ConfigurationSettings::getSettingPluginWorkingDirectoryKey("Exporter"), pParent),
mpExporter(pExporter),
mValidated(false)
{
// Initializtion
setWindowTitle("Export");
setFileMode(QFileDialog::AnyFile);
setAcceptMode(QFileDialog::AcceptSave);
setConfirmOverwrite(true);
setLabelText(QFileDialog::LookIn, "Save in:");
setPlugInLabel("Exporter");
enableOptions(true);
// Set the initial directory
Service<ConfigurationSettings> pSettings;
const Filename* pWorkingDir = pSettings->getSetting(
ConfigurationSettings::getSettingPluginWorkingDirectoryKey("Exporter")).getPointerToValue<Filename>();
if (pWorkingDir == NULL)
{
pWorkingDir = ConfigurationSettings::getSettingExportPath();
}
string directory;
if (pWorkingDir != NULL)
{
directory = pWorkingDir->getFullPathAndName();
}
if (!directory.empty())
{
setDirectory(QString::fromStdString(directory));
}
if (isDefaultPlugIn())
{
setSelectedPlugIn("Ice Exporter");
}
updateFromExporter(getSelectedPlugIn());
// Set the initially selected file
QString strFilename;
SessionItem* pSessionItem = mpExporter->getItem();
if (pSessionItem != NULL)
{
DataElement* pDataElement = dynamic_cast<DataElement*>(pSessionItem);
if (pDataElement != NULL)
{
strFilename = QString::fromStdString(pDataElement->getFilename());
}
if (strFilename.isEmpty() == true)
{
strFilename = QString::fromStdString(pSessionItem->getName());
}
strFilename = updateExtension(strFilename);
selectFile(strFilename);
}
updateFromFile(strFilename);
// Connections
VERIFYNR(connect(this, SIGNAL(plugInSelected(const QString&)), this, SLOT(updateFromExporter(const QString&))));
VERIFYNR(connect(this, SIGNAL(optionsClicked()), this, SLOT(invokeOptionsDialog())));
}