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


C++ LayerList::getNumLayers方法代码示例

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


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

示例1: get_num_layers

/**
 * Get the number of layers in a window.
 *
 * @param[in] WINDOW @opt
 *            The name of the window. Defaults to the active window.
 * @return The number of layers in the window.
 * @usage num_layers = get_num_layers()
 * @endusage
 */
IDL_VPTR get_num_layers(int argc, IDL_VPTR pArgv[], char* pArgk)
{
   typedef struct
   {
      IDL_KW_RESULT_FIRST_FIELD;
      int windowExists;
      IDL_STRING windowName;
   } KW_RESULT;

   //IDL_KW_FAST_SCAN is the type of scan we are using, following it is the
   //name of the keyword, followed by the type, the mask(which should be 1),
   //flags, a boolean whether the value was populated and finally the value itself
   static IDL_KW_PAR kw_pars[] = {
      IDL_KW_FAST_SCAN,
      {"WINDOW", IDL_TYP_STRING, 1, 0, reinterpret_cast<int*>(IDL_KW_OFFSETOF(windowExists)),
         reinterpret_cast<char*>(IDL_KW_OFFSETOF(windowName))},
      {NULL}
   };

   IdlFunctions::IdlKwResource<KW_RESULT> kw(argc, pArgv, pArgk, kw_pars, 0, 1);

   std::string windowName;
   int layers = 0;

   if (kw->windowExists)
   {
      windowName = IDL_STRING_STR(&kw->windowName);
   }

   SpatialDataView* pView = dynamic_cast<SpatialDataView*>(IdlFunctions::getViewByWindowName(windowName));
   if (pView != NULL)
   {
      LayerList* pList = pView->getLayerList();
      if (pList != NULL)
      {
         layers = pList->getNumLayers();
      }
   }
   return IDL_GettmpInt(layers);
}
开发者ID:tclarke,项目名称:opticks-extras-IDL,代码行数:49,代码来源:LayerCommands.cpp

示例2: createView

SpatialDataView* RasterElementImporterShell::createView() const
{
   if (mpRasterElement == NULL)
   {
      return NULL;
   }

   StepResource pStep("Create view", "app", "F41DCDE3-A5C9-4CE7-B9D4-7DF5A9063840");
   if (mpProgress != NULL)
   {
      mpProgress->updateProgress("Creating view...", 99, NORMAL);
   }

   // Get the data set name
   const string& name = mpRasterElement->getName();
   if (name.empty() == true)
   {
      string message = "The data set name is invalid!  A view cannot be created.";
      if (mpProgress != NULL)
      {
         mpProgress->updateProgress(message, 0, ERRORS);
      }

      pStep->finalize(Message::Failure, message);
      return NULL;
   }

   // Create the spatial data window
   SpatialDataView* pView = NULL;

   SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(mpDesktop->createWindow(name, SPATIAL_DATA_WINDOW));
   if (pWindow != NULL)
   {
      pView = pWindow->getSpatialDataView();
   }

   if (pView == NULL)
   {
      string message = "Could not create the view window!";
      if (mpProgress != NULL)
      {
         mpProgress->updateProgress(message, 0, ERRORS);
      }

      pStep->finalize(Message::Failure, message);
      return NULL;
   }

   // Set the spatial data in the view
   pView->setPrimaryRasterElement(mpRasterElement);

   // Create the layers
   {
      UndoLock lock(pView);
      createRasterLayer(pView, pStep.get());
      createGcpLayer(pView, pStep.get());

      const RasterDataDescriptor* pRasterDescriptor =
         dynamic_cast<const RasterDataDescriptor*>(mpRasterElement->getDataDescriptor());
      if (pRasterDescriptor != NULL)
      {
         const GeoreferenceDescriptor* pGeorefDescriptor = pRasterDescriptor->getGeoreferenceDescriptor();
         if ((pGeorefDescriptor != NULL) && (pGeorefDescriptor->getCreateLayer() == true))
         {
            createLatLonLayer(pView, pStep.get());
         }
      }
   }

   // Check for at least one layer in the view
   LayerList* pLayerList = pView->getLayerList();
   VERIFYRV(pLayerList != NULL, NULL);

   if (pLayerList->getNumLayers() == 0)
   {
      mpDesktop->deleteWindow(pWindow);

      string message = "The view contains no layers, so it will not be created.";
      if (mpProgress != NULL)
      {
         mpProgress->updateProgress(message, 0, ERRORS);
      }

      pStep->finalize(Message::Failure, message);
      return NULL;
   }

   pStep->finalize(Message::Success);
   return pView;
}
开发者ID:Tom-VdE,项目名称:opticks,代码行数:90,代码来源:RasterElementImporterShell.cpp


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