当前位置: 首页>>代码示例>>C++>>正文


C++ DataElement::getDataDescriptor方法代码示例

本文整理汇总了C++中DataElement::getDataDescriptor方法的典型用法代码示例。如果您正苦于以下问题:C++ DataElement::getDataDescriptor方法的具体用法?C++ DataElement::getDataDescriptor怎么用?C++ DataElement::getDataDescriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataElement的用法示例。


在下文中一共展示了DataElement::getDataDescriptor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initialize

bool PropertiesWavelengths::initialize(SessionItem* pSessionItem)
{
   WavelengthsWidget* pWavelengthsPage = dynamic_cast<WavelengthsWidget*>(getWidget());
   if (pWavelengthsPage == NULL)
   {
      return false;
   }

   DataElement* pElement = dynamic_cast<DataElement*>(pSessionItem);
   if (pElement != NULL)
   {
      RasterDataDescriptor* pDescriptor = dynamic_cast<RasterDataDescriptor*>(pElement->getDataDescriptor());
      if (pDescriptor != NULL)
      {
         const DynamicObject* pMetadata = pElement->getMetadata();
         if (pMetadata != NULL)
         {
            mWavelengths.initializeFromDynamicObject(pMetadata, true);
            pWavelengthsPage->setWavelengths(pDescriptor->getBands(), &mWavelengths);
            return PropertiesShell::initialize(pSessionItem);
         }
      }
   }

   return false;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:26,代码来源:PropertiesWavelengths.cpp

示例2: initialize

bool EngrdaWidget::initialize(SessionItem* pSessionItem)
{
   DataElement* pElement = dynamic_cast<DataElement*>(pSessionItem);
   DataDescriptor* pDesc = (pElement == NULL) ? NULL : pElement->getDataDescriptor();
   const DynamicObject* pMeta = (pDesc == NULL) ? NULL : pDesc->getMetadata();
   return initialize(pMeta);
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:7,代码来源:EngrdaWidget.cpp

示例3: initialize

bool PropertiesFileDescriptor::initialize(SessionItem* pSessionItem)
{
   FileDescriptorWidget* pDescriptorPage = dynamic_cast<FileDescriptorWidget*>(getWidget());
   if (pDescriptorPage == NULL)
   {
      return false;
   }

   DataElement* pElement = dynamic_cast<DataElement*>(pSessionItem);
   if (pElement != NULL)
   {
      DataDescriptor* pDescriptor = pElement->getDataDescriptor();
      if (pDescriptor != NULL)
      {
         const FileDescriptor* pFileDescriptor = pDescriptor->getFileDescriptor();
         if (pFileDescriptor != NULL)
         {
            pDescriptorPage->setFileDescriptor(pFileDescriptor);
            return true;
         }
      }
   }

   return false;
}
开发者ID:wzssyqa,项目名称:opticks-cmake,代码行数:25,代码来源:PropertiesFileDescriptor.cpp

示例4: createOverview

SpatialDataViewImp* OverviewWindow::createOverview()
{
   SpatialDataViewImp* pOverview = NULL;
   if (mpView != NULL)
   {
      pOverview = dynamic_cast<SpatialDataViewImp*>(mpView->copy());
      VERIFYRV(pOverview != NULL, NULL);
      pOverview->installEventFilter(this);

      LayerList* pLayerList = NULL;
      pLayerList = pOverview->getLayerList();
      if (pLayerList != NULL)
      {
         // get primary raster layer from data view
         LayerList* pSDVlist = mpView->getLayerList();
         VERIFYRV(pSDVlist != NULL, NULL);
         DataElement* pPrimElem = pSDVlist->getPrimaryRasterElement();
         VERIFYRV(pPrimElem != NULL, NULL);
         Layer* pPrimLayer = pSDVlist->getLayer(RASTER, pPrimElem);
         VERIFYRV(pPrimLayer != NULL, NULL);
         string primName(pPrimLayer->getName());

         vector<Layer*> layers;
         pLayerList->getLayers(layers);
         for (unsigned int i = 0; i < layers.size(); i++)
         {
            Layer* pLayer = NULL;
            pLayer = layers.at(i);
            string layerName(pLayer->getName());
            if (pLayer->getLayerType()==RASTER && layerName==primName)
            {
               pPrimLayer->linkLayer(pLayer);

               // reset the scale to what is in the model
               DataElement* pElement = pLayer->getDataElement();
               VERIFYRV(pElement != NULL, NULL);

               const RasterDataDescriptor* pDescriptor =
                  dynamic_cast<const RasterDataDescriptor*>(pElement->getDataDescriptor());
               VERIFYRV(pDescriptor != NULL, NULL);

               pLayer->setYScaleFactor(pDescriptor->getYPixelSize());
               pLayer->setXScaleFactor(pDescriptor->getXPixelSize());
            }
            else
            {
               pOverview->deleteLayer(pLayer);
            }
         }
         pOverview->resetOrientation();
      }
   }

   return pOverview;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:55,代码来源:OverviewWindow.cpp

示例5: applyChanges

bool PropertiesWavelengths::applyChanges()
{
   DataElement* pElement = dynamic_cast<DataElement*>(getSessionItem());
   if (pElement != NULL)
   {
      if (dynamic_cast<RasterDataDescriptor*>(pElement->getDataDescriptor()) != NULL)
      {
         DynamicObject* pMetadata = pElement->getMetadata();
         if (pMetadata != NULL)
         {
            return mWavelengths.applyToDynamicObject(pMetadata);
         }
      }
   }

   return false;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:17,代码来源:PropertiesWavelengths.cpp

示例6: applyChanges

bool PropertiesDataDescriptor::applyChanges()
{
   if (mpDescriptor.get() == NULL)
   {
      return false;
   }

   DataElement* pElement = dynamic_cast<DataElement*>(getSessionItem());
   if (pElement != NULL)
   {
      DataDescriptor* pDescriptor = pElement->getDataDescriptor();
      if (pDescriptor != NULL)
      {
         return pDescriptor->clone(mpDescriptor.get());
      }
   }

   return false;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:19,代码来源:PropertiesDataDescriptor.cpp

示例7: initialize

bool PropertiesDataDescriptor::initialize(SessionItem* pSessionItem)
{
   DataDescriptorWidget* pDescriptorPage = dynamic_cast<DataDescriptorWidget*>(getWidget());
   if (pDescriptorPage == NULL)
   {
      return false;
   }

   DataElement* pElement = dynamic_cast<DataElement*>(pSessionItem);
   if (pElement != NULL)
   {
      DataDescriptor* pDescriptor = pElement->getDataDescriptor();
      if (pDescriptor != NULL)
      {
         // turn off full editing of fields
         pDescriptorPage->setDataDescriptor(pDescriptor, false);
         return true;
      }
   }

   return false;
}
开发者ID:wzssyqa,项目名称:opticks-cmake,代码行数:22,代码来源:PropertiesDataDescriptor.cpp

示例8: execute


//.........这里部分代码省略.........
      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);
      }
      pStep->finalize(Message::Failure, "Unable to create the CGM object");
      return false;
   }

   // load the CGM file
   if (pProgress != NULL)
   {
      pProgress->updateProgress("Load the CGM file", 90, NORMAL);
   }
   string fname = pElement->getDataDescriptor()->getFileDescriptor()->getFilename().getFullPathAndName();
   if (!pCgmObject->deserializeCgm(fname))
   {
      if (pProgress != NULL)
      {
         pProgress->updateProgress("Error loading the CGM element", 0, ERRORS);
      }
      pStep->finalize(Message::Failure, "Unable to parse the CGM file.");
      return false;
   }

   if (pProgress != NULL)
   {
      pProgress->updateProgress("Successfully loaded the CGM file", 100, NORMAL);
   }
   pStep->finalize(Message::Success);
   return true;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:101,代码来源:CgmImporter.cpp

示例9: 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);
      }
//.........这里部分代码省略.........
开发者ID:Tom-VdE,项目名称:opticks,代码行数:101,代码来源:LayerImporter.cpp

示例10: getSubstitutedText

string TextObjectImp::getSubstitutedText()
{
   string txt = getText();

   DataElement* pParent = getElement();
   pParent = (pParent == NULL) ? NULL : pParent->getParent();
   DataDescriptor* pParentDesc = (pParent == NULL) ? NULL : pParent->getDataDescriptor();
   DynamicObject* pParentMetadata = (pParentDesc == NULL) ? NULL : pParentDesc->getMetadata();
   for (int i = 0; i < 50; ++i)
   {
      //each pass does replacement of $M(a) currently in the string.
      //do 50 passes to perform sub-expansion at most fifty times, ie. prevent infinite loop
      //for non-terminating recursive expansion
      string::size_type pos = txt.find("$");
      while (pos != string::npos)
      {
         if (pos + 1 >= txt.size())
         {
            break;
         }
         string type = txt.substr(pos+1, 1);
         if (type != "$") //ie. not $$, the escape sequence so continue
         {
            bool replaced = false;
            if (pos+4 < txt.size()) //ie. $M(a)
            {
               if (txt[pos+2] == '(')
               {
                  string::size_type closeParen = txt.find(')', pos+2);
                  if (closeParen == string::npos)
                  {
                     closeParen = txt.size();
                  }
                  string variableName = txt.substr(pos+3, closeParen-(pos+2)-1);
                  string replacementString;
                  if (type == "M" || type == "S")
                  {
                     DataElement* pElmnt = pParent;
                     DynamicObject* pMetadata = pParentMetadata;
                     if (variableName.substr(0, 2) == "//")
                     {
                        string::size_type endNamePos = variableName.find("//", 2);
                        if (endNamePos != string::npos)
                        {
                           string elementName = variableName.substr(2, endNamePos - 2);
                           variableName = variableName.substr(endNamePos + 2);
                           if (!variableName.empty())
                           {
                              if (elementName[0] == '[' && elementName[elementName.size() - 1] == ']')
                              {
                                 elementName = elementName.substr(1, elementName.size() - 2);
                                 std::list<GraphicObject*> objects;
                                 getLayer()->getObjects(VIEW_OBJECT, objects);
                                 for (std::list<GraphicObject*>::iterator object = objects.begin();
                                    object != objects.end(); ++object)
                                 {
                                    GraphicObject* pObj = *object;
                                    if (pObj->getName() == elementName)
                                    {
                                       SpatialDataView* pSdv = dynamic_cast<SpatialDataView*>(pObj->getObjectView());
                                       if (pSdv != NULL)
                                       {
                                          pElmnt = pSdv->getLayerList()->getPrimaryRasterElement();
                                          DataDescriptor* pDesc =
                                             (pElmnt == NULL) ? NULL : pElmnt->getDataDescriptor();
                                          pMetadata = (pDesc == NULL) ? NULL : pDesc->getMetadata();
                                       }
                                       break;
                                    }
                                 }
                              }
                              else
                              {
                                 pElmnt = Service<ModelServices>()->getElement(elementName,
                                    TypeConverter::toString<RasterElement>(), NULL);
                                 DataDescriptor* pDesc = (pElmnt == NULL) ? NULL : pElmnt->getDataDescriptor();
                                 pMetadata = (pDesc == NULL) ? NULL : pDesc->getMetadata();
                              }
                           }
                           else
                           {
                              pElmnt = NULL;
                              pMetadata = NULL;
                           }
                        }
                     }
                     bool success = false;
                     if (type == "M" && pMetadata != NULL)
                     {
                        DataVariant var = pMetadata->getAttributeByPath(variableName);
                        if (var.isValid())
                        {
                           DataVariant::Status status;
                           replacementString = var.toDisplayString(&status);
                           success = (status == DataVariant::SUCCESS);
                           if (mMetadataObjects.find(pMetadata) == mMetadataObjects.end())
                           {
                              mMetadataObjects.insert(make_pair(pMetadata, new AttachmentPtr<DynamicObject>(
                                 pMetadata, SIGNAL_NAME(Subject, Modified),
                                 Slot(this, &TextObjectImp::invalidateTexture))));
//.........这里部分代码省略.........
开发者ID:Siddharthk,项目名称:opticks,代码行数:101,代码来源:TextObjectImp.cpp

示例11: execute

bool ModelExporter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
   Progress* pProgress = NULL;
   FileDescriptor* pFileDescriptor = NULL;
   DataElement* pElement = NULL;

   StepResource pStep("Export model element", "app", "2BF48AAB-4832-4694-8583-882A8D584E97");

   // get input arguments and log some useful info about them
   { // scope the MessageResource
      MessageResource pMsg("Input arguments", "app", "1B02F950-2E04-4BEF-8561-BB8D993340F7");

      pProgress = pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg());
      pMsg->addBooleanProperty("Progress Present", (pProgress != NULL));

      pFileDescriptor = pInArgList->getPlugInArgValue<FileDescriptor>(Exporter::ExportDescriptorArg());
      if (pFileDescriptor == NULL)
      {
         if (pProgress != NULL)
         {
            pProgress->updateProgress("No file specified", 100, ERRORS);
         }
         pStep->finalize(Message::Failure, "No file specified");
         return false;
      }
      pMsg->addProperty("Destination", pFileDescriptor->getFilename());

      pElement = pInArgList->getPlugInArgValueUnsafe<DataElement>(Exporter::ExportItemArg());
      if (pElement == NULL)
      {
         if (pProgress != NULL)
         {
            pProgress->updateProgress("No model element specified", 100, ERRORS);
         }
         pStep->finalize(Message::Failure, "No model element specified");
         return false;
      }
      pMsg->addProperty("Name", pElement->getName());
   }

   if (pProgress != NULL)
   {
      pProgress->updateProgress("Open output file", 10, NORMAL);
   }
   FILE* pFile = fopen(pFileDescriptor->getFilename().getFullPathAndName().c_str(), "w");
   if (pFile == NULL)
   {
      if (pProgress != NULL)
      {
         pProgress->updateProgress("File can not be created", 100, ERRORS);
      }
      pStep->finalize(Message::Failure, "File can not be created");
      return false;
   }

   DataDescriptor* pElementDescriptor = pElement->getDataDescriptor();
   VERIFY(pElementDescriptor != NULL);

   if (pProgress != NULL)
   {
      pProgress->updateProgress("Save element", 20, NORMAL);
   }
   string elementName = pElementDescriptor->getType();
   XMLWriter xml(elementName.c_str(), Service<MessageLogMgr>()->getLog());
   if (!pElement->toXml(&xml))
   {
      if (pProgress != NULL)
      {
         pProgress->updateProgress("Error saving model element", 100, ERRORS);
      }
      pStep->finalize(Message::Failure, "Error saving model element");
      return false;
   }
   else
   {
      xml.writeToFile(pFile);
   }
   fclose(pFile);

   if (pProgress != NULL)
   {
      pProgress->updateProgress("Finished saving the model element", 100, NORMAL);
   }
   pStep->finalize(Message::Success);
   return true;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:86,代码来源:ModelExporter.cpp


注:本文中的DataElement::getDataDescriptor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。