本文整理汇总了C++中SpatialDataView::setActiveLayer方法的典型用法代码示例。如果您正苦于以下问题:C++ SpatialDataView::setActiveLayer方法的具体用法?C++ SpatialDataView::setActiveLayer怎么用?C++ SpatialDataView::setActiveLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpatialDataView
的用法示例。
在下文中一共展示了SpatialDataView::setActiveLayer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activateLayer
int activateLayer(Layer* pLayer)
{
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;
}
pView->setActiveLayer(pLayer);
setLastError(SIMPLE_NO_ERROR);
return 0;
}
示例2: execute
//.........这里部分代码省略.........
//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);
}
pStep->finalize(Message::Failure, "Could not access the view to create the layer.");
return false;
}
bool error = false;
LayerType layerType = StringUtilities::fromXmlString<LayerType>(type, &error);
if (error == true)
{
if (pProgress != NULL)
{
pProgress->updateProgress("The layer type is invalid.", 100, ERRORS);
}
pStep->finalize(Message::Failure, "The layer type is invalid.");
return false;
}
LayerList* pLayerList = pView->getLayerList();
if (pLayerList != NULL)
{
RasterElement* pNewParentElement = pLayerList->getPrimaryRasterElement();
if (pNewParentElement != NULL)
{
Service<ModelServices> pModel;
if (pModel->setElementParent(pElement, pNewParentElement) == false)
{
pProgress->updateProgress("The layer already exists.", 100, ERRORS);
pStep->finalize(Message::Failure, "The layer already exists.");
return false;
}
}
}
UndoGroup group(pView, "Import " + StringUtilities::toDisplayString(layerType) + " Layer");
pLayer = pView->createLayer(layerType, pElement);
if (pLayer == NULL)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Unable to create the layer", 100, ERRORS);
}
pStep->finalize(Message::Failure, "Unable to create the layer");
return false;
}
if (pProgress != NULL)
{
pProgress->updateProgress("Build the layer", 60, NORMAL);
}
// deserialize the layer
try
{
if (pLayer->fromXml(pRootElement, formatVersion) == false)
{
pProgress->updateProgress("Problem with layer file.", 100, ERRORS);
pStep->finalize(Message::Failure, "Problem with layer file.");
return false;
}
}
catch (XmlReader::DomParseException&)
{
return false;
}
pStep->finalize(Message::Success);
if (pProgress != NULL)
{
pProgress->updateProgress("Finished loading the layer", 100, NORMAL);
}
// Add the layer to the view
pView->addLayer(pLayer);
pView->setActiveLayer(pLayer);
pView->setMouseMode("LayerMode");
if (pOutArgList != NULL)
{
// set the output arguments
pOutArgList->setPlugInArgValue("Layer", pLayer);
}
return true;
}