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


C++ SpatialDataView::setLayerDisplayIndex方法代码示例

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


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

示例1: setLayerDisplayIndex

 int setLayerDisplayIndex(Layer* pLayer, uint32_t newIndex)
 {
    if (pLayer == NULL)
    {
       setLastError(SIMPLE_BAD_PARAMS);
       return 1;
    }
    SpatialDataView* pView = dynamic_cast<SpatialDataView*>(pLayer->getView());
    if (pView == NULL)
    {
       setLastError(SIMPLE_WRONG_VIEW_TYPE);
       return 1;
    }
    if (!pView->setLayerDisplayIndex(pLayer, newIndex))
    {
       setLastError(SIMPLE_OTHER_FAILURE);
       return 1;
    }
    setLastError(SIMPLE_NO_ERROR);
    return 0;
 }
开发者ID:Siddharthk,项目名称:opticks,代码行数:21,代码来源:SimpleViews.cpp

示例2: set_layer_position

/**
 * Move a layer to a new position in the layer list.
 *
 * @param[in] [1]
 *            The name of the layer to move.
 * @param[in] INDEX
 *            The new 0 based index for the layer.
 * @param[in] WINDOW @opt
 *            The name of the window. Defaults to the active window.
 * @rsof
 * @usage print,set_layer_position("data.tif", INDEX=0)
 * @endusage
 */
IDL_VPTR set_layer_position(int argc, IDL_VPTR pArgv[], char* pArgk)
{
   IDL_VPTR idlPtr;
   typedef struct
   {
      IDL_KW_RESULT_FIRST_FIELD;
      int windowExists;
      IDL_STRING windowName;
      int indexExists;
      IDL_LONG index;
   } 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,
      {"INDEX", IDL_TYP_LONG, 1, 0, reinterpret_cast<int*>(IDL_KW_OFFSETOF(indexExists)),
         reinterpret_cast<char*>(IDL_KW_OFFSETOF(index))},
      {"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 index = -1;
   std::string name;

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

   if (argc < 2)
   {
      IDL_Message(IDL_M_GENERIC, IDL_MSG_RET, "set_layer_position takes a layer name as a parameter with a "
         "window as an optional keyword.  A keyword 'index' is needed to specify the position.");
      return IDL_StrToSTRING("failure");
   }
   //the name of the layer to set the posisiton of
   name = IDL_VarGetString(pArgv[0]);
   bool bSuccess = false;
   SpatialDataView* pView = dynamic_cast<SpatialDataView*>(IdlFunctions::getViewByWindowName(windowName));
   if (pView != NULL)
   {
      Layer* pLayer = IdlFunctions::getLayerByName(windowName, name, false);
      if (pLayer != NULL)
      {
         pView->setLayerDisplayIndex(pLayer, index);
         bSuccess = true;
      }
   }
   if (bSuccess)
   {
      idlPtr = IDL_StrToSTRING("success");
   }
   else
   {
      idlPtr = IDL_StrToSTRING("failure");
   }
   return idlPtr;
}
开发者ID:tclarke,项目名称:opticks-extras-IDL,代码行数:81,代码来源:LayerCommands.cpp


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