本文整理汇总了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);
}
示例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;
}