本文整理汇总了C++中SpatialDataView::showLayer方法的典型用法代码示例。如果您正苦于以下问题:C++ SpatialDataView::showLayer方法的具体用法?C++ SpatialDataView::showLayer怎么用?C++ SpatialDataView::showLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpatialDataView
的用法示例。
在下文中一共展示了SpatialDataView::showLayer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: show_layer
/**
* Show a hidden layer.
*
* @param[in] [1]
* The name of the layer to show.
* @param[in] WINDOW @opt
* The name of the window. Defaults to the active window.
* @rsof
* @usage print,show_layer("raster.tif")
* @endusage
*/
IDL_VPTR show_layer(int argc, IDL_VPTR pArgv[], char* pArgk)
{
IDL_VPTR idlPtr;
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;
std::string layerName;
if (kw->windowExists)
{
windowName = IDL_STRING_STR(&kw->windowName);
}
bool bSuccess = false;
if (argc < 1)
{
IDL_Message(IDL_M_GENERIC, IDL_MSG_RET, "function takes a layer name as a parameter with "
"'window' as an optional keyword.");
return IDL_StrToSTRING("failure");
}
//the layer name as a parameter
layerName = IDL_VarGetString(pArgv[0]);
SpatialDataView* pView = dynamic_cast<SpatialDataView*>(IdlFunctions::getViewByWindowName(windowName));
if (pView != NULL)
{
Layer* pLayer = IdlFunctions::getLayerByName(windowName, layerName, false);
if (pLayer != NULL)
{
pView->showLayer(pLayer);
bSuccess = true;
}
}
if (bSuccess)
{
idlPtr = IDL_StrToSTRING("success");
}
else
{
idlPtr = IDL_StrToSTRING("failure");
}
return idlPtr;
}
示例2: setLayerDisplayed
int setLayerDisplayed(Layer* pLayer, int displayed)
{
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;
}
bool success = true;
if (displayed != 0)
{
if (!pView->isLayerDisplayed(pLayer))
{
success = pView->showLayer(pLayer);
}
}
else
{
if (pView->isLayerDisplayed(pLayer))
{
success = pView->hideLayer(pLayer);
}
}
if (!success)
{
setLastError(SIMPLE_OTHER_FAILURE);
return 1;
}
setLastError(SIMPLE_NO_ERROR);
return 0;
}