本文整理汇总了C++中SpatialDataView::getLayerList方法的典型用法代码示例。如果您正苦于以下问题:C++ SpatialDataView::getLayerList方法的具体用法?C++ SpatialDataView::getLayerList怎么用?C++ SpatialDataView::getLayerList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpatialDataView
的用法示例。
在下文中一共展示了SpatialDataView::getLayerList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deriveLayer
Layer* deriveLayer(Layer* pLayer, const char* pName, const char* pType)
{
if (pLayer == NULL)
{
setLastError(SIMPLE_BAD_PARAMS);
return NULL;
}
SpatialDataView* pView = dynamic_cast<SpatialDataView*>(pLayer->getView());
if (pView == NULL)
{
setLastError(SIMPLE_WRONG_VIEW_TYPE);
return NULL;
}
pLayer = pView->deriveLayer(pLayer, StringUtilities::fromXmlString<LayerType>(std::string(pType)));
if (pLayer == NULL)
{
setLastError(SIMPLE_WRONG_TYPE);
return NULL;
}
if (pName != NULL)
{
pView->getLayerList()->renameLayer(pLayer, std::string(pName));
}
setLastError(SIMPLE_NO_ERROR);
return pLayer;
}
示例2: updateGeoreferenceAttachment
void MeasurementObjectImp::updateGeoreferenceAttachment()
{
if (mpGeoreference.get() != NULL)
{
return;
}
RasterElement* pGeoreference = NULL;
// Must find Georeference through the view, since the GraphicElement is a root element.
GraphicLayer* pLayer = getLayer();
if (pLayer != NULL)
{
SpatialDataView* pView = dynamic_cast<SpatialDataView*>(pLayer->getView());
if (pView != NULL)
{
LayerList* pLayerList = pView->getLayerList();
VERIFYNRV(pLayerList != NULL);
pGeoreference = pLayerList->getPrimaryRasterElement();
}
}
if (pGeoreference != NULL && pGeoreference->isGeoreferenced())
{
mpGeoreference.reset(pGeoreference);
enableGeo();
generateGeoStrings();
}
}
示例3: createReturnGuiElement
bool BandMath::createReturnGuiElement()
{
bool bSuccess = false;
if (mbInteractive || (mbDisplayResults && Service<ApplicationServices>()->isBatch() == false))
{
SpatialDataWindow* pWindow = NULL;
if (mbAsLayerOnExistingView)
{
pWindow = static_cast<SpatialDataWindow*>(mpDesktop->getWindow(mpCube->getName(), SPATIAL_DATA_WINDOW));
}
else
{
pWindow = static_cast<SpatialDataWindow*>(mpDesktop->createWindow(mResultsName.c_str(), SPATIAL_DATA_WINDOW));
}
if (pWindow == NULL)
{
return false;
}
SpatialDataView* pView = pWindow->getSpatialDataView();
VERIFYRV(pView != NULL, NULL);
UndoLock lock(pView);
if (!mbAsLayerOnExistingView)
{
pView->setPrimaryRasterElement(mpResultData);
}
LayerList* pLayerList = pView->getLayerList();
if (pLayerList != NULL)
{
Layer* pLayer = pLayerList->getLayer(RASTER, mpResultData);
if (pLayer == NULL)
{
if (pView->createLayer(RASTER, mpResultData) != NULL)
{
bSuccess = true;
}
if (!mbAsLayerOnExistingView)
{
Service<ModelServices> pModel;
vector<DataElement*> elements = pModel->getElements(mpResultData, "GcpList");
for_each(elements.begin(), elements.end(),
boost::bind(&SpatialDataView::createLayer, pView, GCP_LAYER, _1));
}
}
}
}
else // no GUI required, method has successfully noop'd
{
bSuccess = true;
}
return bSuccess;
}
示例4: Image
Image(SpatialDataView* iPView) : pView(iPView) {
LayerList* pLayerList = pView->getLayerList(); VERIFYNRV(pLayerList != NULL);
pRaster = dynamic_cast<RasterElement*>(pLayerList->getPrimaryRasterElement()); VERIFYNRV(pRaster != NULL);
pDataDescriptor = dynamic_cast<const RasterDataDescriptor*>(pRaster->getDataDescriptor()); VERIFYNR(pDataDescriptor != NULL);
/* Service<DesktopServices> pDesktop;
VERIFYNRV(pDesktop.get() != NULL);
SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(pDesktop->getWindow(pRaster->getName(), SPATIAL_DATA_WINDOW));
VERIFYNRV(pWindow != NULL);
VERIFYNRV(pDesktop->setCurrentWorkspaceWindow(pWindow));*/
}
示例5: getViewLayer
Layer* getViewLayer(View* pView, uint32_t index)
{
if (pView == NULL)
{
setLastError(SIMPLE_BAD_PARAMS);
return NULL;
}
SpatialDataView* pSdv = dynamic_cast<SpatialDataView*>(pView);
if (pSdv == NULL)
{
setLastError(SIMPLE_WRONG_VIEW_TYPE);
return NULL;
}
if (index >= pSdv->getLayerList()->getNumLayers())
{
setLastError(SIMPLE_NOT_FOUND);
return NULL;
}
std::vector<Layer*> layers;
pSdv->getLayerList()->getLayers(layers);
setLastError(SIMPLE_NO_ERROR);
return layers[index];
}
示例6: getViewPrimaryRasterElement
DataElement* getViewPrimaryRasterElement(View* pView)
{
if (pView == NULL)
{
setLastError(SIMPLE_BAD_PARAMS);
return NULL;
}
SpatialDataView* pSdv = dynamic_cast<SpatialDataView*>(pView);
if (pSdv == NULL)
{
setLastError(SIMPLE_WRONG_VIEW_TYPE);
return NULL;
}
setLastError(SIMPLE_NO_ERROR);
return pSdv->getLayerList()->getPrimaryRasterElement();
}
示例7: getViewLayerCount
uint32_t getViewLayerCount(View* pView)
{
if (pView == NULL)
{
setLastError(SIMPLE_BAD_PARAMS);
return 0;
}
SpatialDataView* pSdv = dynamic_cast<SpatialDataView*>(pView);
if (pSdv == NULL)
{
setLastError(SIMPLE_WRONG_VIEW_TYPE);
return 0;
}
setLastError(SIMPLE_NO_ERROR);
return pSdv->getLayerList()->getNumLayers();
}
示例8: setAnimations
void FrameLabelObjectImp::setAnimations(View* pView)
{
if (getLocked() == false)
{
reset();
vector<Animation*> pAnimations;
if (pView != NULL)
{
SpatialDataView* pSpatialDataView = dynamic_cast<SpatialDataView*>(pView);
if (pSpatialDataView == NULL)
{
mpView.reset(pView);
mpAnimationController.reset(mpView->getAnimationController());
if (mpAnimationController.get() != NULL)
{
pAnimations = mpAnimationController->getAnimations();
}
}
else
{
mpLayerList.reset(pSpatialDataView->getLayerList());
VERIFYNRV(mpLayerList.get() != NULL);
vector<Layer*> pLayers;
mpLayerList->getLayers(RASTER, pLayers);
for (vector<Layer*>::iterator iter = pLayers.begin(); iter != pLayers.end(); ++iter)
{
RasterLayer* pRasterLayer = dynamic_cast<RasterLayer*>(*iter);
VERIFYNRV(pRasterLayer != NULL);
pRasterLayer->attach(SIGNAL_NAME(RasterLayer, AnimationChanged),
Slot(this, &FrameLabelObjectImp::updateAnimations));
pRasterLayer->attach(SIGNAL_NAME(Subject, Deleted),
Slot(this, &FrameLabelObjectImp::layerDeleted));
mLayers.push_back(pRasterLayer);
if (pRasterLayer->getAnimation() != NULL)
{
pAnimations.push_back(pRasterLayer->getAnimation());
}
}
}
}
insertAnimations(pAnimations);
}
}
示例9: createChipView
SpatialDataView* ChippingWindow::createChipView() const
{
if (mpView == NULL)
{
return NULL;
}
SpatialDataView* pChipView = dynamic_cast<SpatialDataView*>(mpView->copy());
if (pChipView != NULL)
{
vector<std::pair<View*, LinkType> > linkedViews;
pChipView->getLinkedViews(linkedViews);
for (unsigned int i = 0; i < linkedViews.size(); ++i)
{
if (linkedViews[i].second == NO_LINK)
{
continue;
}
pChipView->unlinkView(linkedViews[i].first);
}
LayerList* pLayerList = pChipView->getLayerList();
if (pLayerList != NULL)
{
vector<Layer*> layers;
pLayerList->getLayers(layers);
for (unsigned int i = 0; i < layers.size(); i++)
{
Layer* pLayer = layers.at(i);
if (dynamic_cast<RasterLayer*>(pLayer) == NULL)
{
pChipView->deleteLayer(pLayer);
}
}
}
}
return pChipView;
}
示例10: 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);
}
示例11: saveAnimationTimes
bool TimelineWidget::saveAnimationTimes(Animation *pAnim)
{
if(pAnim == NULL)
{
return false;
}
bool success = false;
const std::vector<AnimationFrame> frames = pAnim->getFrames();
std::vector<double> times(frames.size(), 0.0);
for(unsigned int idx = 0; idx < frames.size(); idx++)
{
times[idx] = frames[idx].mTime;
}
std::vector<Window*> windows;
Service<DesktopServices>()->getWindows(SPATIAL_DATA_WINDOW, windows);
for(std::vector<Window*>::iterator window = windows.begin(); window != windows.end(); ++window)
{
SpatialDataView *pView = static_cast<SpatialDataWindow*>(*window)->getSpatialDataView();
std::vector<Layer*> layers;
pView->getLayerList()->getLayers(RASTER, layers);
for(std::vector<Layer*>::iterator layer = layers.begin(); layer != layers.end(); ++layer)
{
RasterLayer *pLayer = static_cast<RasterLayer*>(*layer);
if(pLayer->getAnimation() == pAnim)
{
RasterElement *pElement = static_cast<RasterElement*>(pLayer->getDataElement());
DynamicObject *pMetadata = static_cast<RasterDataDescriptor*>(pElement->getDataDescriptor())->getMetadata();
if(pMetadata != NULL)
{
success = success || pMetadata->setAttributeByPath(FRAME_TIMES_METADATA_PATH, times);
}
}
}
}
return success;
}
示例12: init
Correlator<RasterElement>::Correlator()
{
vector<DataElement*> allElements = Service<ModelServices>()->getElements("RasterElement");
RasterElement* pPrimary = NULL;
SpatialDataView* pView = dynamic_cast<SpatialDataView*>(Service<DesktopServices>()->getCurrentWorkspaceWindowView());
if (pView != NULL)
{
pPrimary = RM_NULLCHK(pView->getLayerList())->getPrimaryRasterElement();
}
int index = 1;
for (vector<DataElement*>::iterator ppElement=allElements.begin(); ppElement!=allElements.end(); ++ppElement)
{
RasterElement* pElement = dynamic_cast<RasterElement*>(*ppElement);
if (pElement == pPrimary)
{
mElements[index++] = pPrimary;
break;
}
}
init(allElements, index, pPrimary);
}
示例13: execute
bool CgmImporter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
Progress* pProgress = NULL;
DataElement* pElement = NULL;
StepResource pStep("Import cgm element", "app", "8D5522FE-4A89-44cb-9735-6920A3BFC903");
// get input arguments and log some useful info about them
{ // scope the MessageResource
MessageResource pMsg("Input arguments", "app", "A1735AC7-C182-45e6-826F-690DBA15D84A");
pProgress = pInArgList->getPlugInArgValue<Progress>(Executable::ProgressArg());
pMsg->addBooleanProperty("Progress Present", (pProgress != NULL));
pElement = pInArgList->getPlugInArgValue<DataElement>(Importer::ImportElementArg());
if (pElement == NULL)
{
if (pProgress != NULL)
{
pProgress->updateProgress("No data element", 0, ERRORS);
}
pStep->finalize(Message::Failure, "No data element");
return false;
}
pMsg->addProperty("Element name", pElement->getName());
}
if (pProgress != NULL)
{
pProgress->updateProgress((string("Read and parse file ") + pElement->getFilename()), 20, NORMAL);
}
// Create a new annotation layer for a spatial data view or get the layout layer for a product view
if (pProgress != NULL)
{
pProgress->updateProgress("Create a new layer", 30, NORMAL);
}
View* pView = mpDesktop->getCurrentWorkspaceWindowView();
if (pView == NULL)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Could not access the current view.", 0, ERRORS);
}
pStep->finalize(Message::Failure, "Could not access the current view.");
return false;
}
UndoGroup undoGroup(pView, "Import CGM");
AnnotationLayer* pLayer = NULL;
SpatialDataView* pSpatialDataView = dynamic_cast<SpatialDataView*>(pView);
if (pSpatialDataView != NULL)
{
// Set the parent element of the annotation element to the primary raster element
LayerList* pLayerList = pSpatialDataView->getLayerList();
if (pLayerList != NULL)
{
RasterElement* pNewParentElement = pLayerList->getPrimaryRasterElement();
if (pNewParentElement != NULL)
{
Service<ModelServices> pModel;
pModel->setElementParent(pElement, pNewParentElement);
}
}
pLayer = dynamic_cast<AnnotationLayer*>(pSpatialDataView->createLayer(ANNOTATION, pElement));
}
else
{
ProductView* pProductView = dynamic_cast<ProductView*>(mpDesktop->getCurrentWorkspaceWindowView());
if (pProductView != NULL)
{
pLayer = pProductView->getLayoutLayer();
}
}
if (pLayer == NULL)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Unable to get the annotation layer", 0, ERRORS);
}
pStep->finalize(Message::Failure, "Unable to get the annotation layer");
return false;
}
// add the CGM object
if (pProgress != NULL)
{
pProgress->updateProgress("Create the CGM object", 60, NORMAL);
}
CgmObject* pCgmObject = dynamic_cast<CgmObject*>(pLayer->addObject(CGM_OBJECT));
if (pCgmObject == NULL)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Unable to create the CGM object", 0, ERRORS);
}
//.........这里部分代码省略.........
示例14: execute
//.........这里部分代码省略.........
FactoryResource<Wavelengths> pWavelengths;
if (pElement != NULL) // try loading wavelengths from user specified data element
{
if (getWavelengthsFromElement(pElement, pWavelengths.get(), errorMsg) == false)
{
progress.report(errorMsg, 0, ERRORS, true);
return false;
}
resampledTo = pElement->getName();
}
else if (waveFilename.empty() == false) // if no user provided raster, look for a wavelengths file
{
if (QFile::exists(QString::fromStdString(waveFilename)))
{
if (getWavelengthsFromFile(waveFilename, pWavelengths.get(), errorMsg) == false)
{
progress.report(errorMsg, 0, ERRORS, true);
return false;
}
}
else
{
errorMsg = "The wavelengths file \"" + waveFilename + "\" could not be found.";
progress.report(errorMsg, 0, ERRORS, true);
return false;
}
resampledTo = waveFilename;
}
else // if no wavelength source provided, look for raster in current active spatial data view
{
SpatialDataView* pView = dynamic_cast<SpatialDataView*>(pDesktop->getCurrentWorkspaceWindowView());
if (pView != NULL)
{
LayerList* pLayerList = pView->getLayerList();
if (pLayerList != NULL)
{
pElement = pLayerList->getPrimaryRasterElement();
pWavelengths->initializeFromDynamicObject(pElement->getMetadata(), false);
if (pWavelengths->isEmpty())
{
progress.report("No target wavelengths are available for resampling the signatures.", 0, ERRORS, true);
return false;
}
resampledTo = pElement->getName();
}
}
}
PlugInResource pPlugIn("Resampler");
Resampler* pResampler = dynamic_cast<Resampler*>(pPlugIn.get());
if (pResampler == NULL)
{
progress.report("The \"Resampler\" plug-in is not available so the signatures can not be resampled.",
0, ERRORS, true);
return false;
}
std::string dataName("Reflectance");
std::string wavelengthName("Wavelength");
// save user config settings - Resampler doesn't have interface to set them separately from user config
std::string configMethod = ResamplerOptions::getSettingResamplerMethod();
ResamplerOptions::setSettingResamplerMethod(resampleMethod);
double configDropout = ResamplerOptions::getSettingDropOutWindow();
ResamplerOptions::setSettingDropOutWindow(dropOutWindow);
double configFwhm = ResamplerOptions::getSettingFullWidthHalfMax();
ResamplerOptions::setSettingFullWidthHalfMax(fwhm);
示例15: get_data_element_names
/**
* Get the names of all the data elements which are children of the primary raster element.
*
* @param[in] WINDOW @opt
* The name of the window. Defaults to the active window.
* @return An array of data element names or the string "failure" if an error occurred.
* @usage names = get_data_element_names()
* @endusage
*/
IDL_VPTR get_data_element_names(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;
std::string name;
bool bSuccess = false;
IDL_VPTR idlPtr;
unsigned int total = 0;
IDL_STRING* pStrarr = NULL;
if (kw->windowExists)
{
windowName = IDL_STRING_STR(&kw->windowName);
}
SpatialDataWindow* pWindow = NULL;
if (windowName.empty())
{
pWindow = dynamic_cast<SpatialDataWindow*>(Service<DesktopServices>()->getCurrentWorkspaceWindow());
}
else
{
pWindow = dynamic_cast<SpatialDataWindow*>(
Service<DesktopServices>()->getWindow(windowName, SPATIAL_DATA_WINDOW));
}
if (pWindow != NULL)
{
SpatialDataView* pView = pWindow->getSpatialDataView();
if (pView != NULL)
{
LayerList* pList = pView->getLayerList();
if (pList != NULL)
{
RasterElement* pElement = pList->getPrimaryRasterElement();
if (pElement != NULL)
{
std::vector<std::string> names = Service<ModelServices>()->getElementNames(pElement, "");
total = names.size();
if (total > 0)
{
pStrarr = reinterpret_cast<IDL_STRING*>(malloc(total * sizeof(IDL_STRING)));
for (unsigned int i=0; i < total; ++i)
{
IDL_StrStore(&(pStrarr[i]), const_cast<char*>(names[i].c_str()));
}
bSuccess = true;
}
}
}
}
}
else if (windowName == "all")
{
std::vector<std::string> names = Service<ModelServices>()->getElementNames("RasterElement");
total = names.size();
if (total > 0)
{
pStrarr = reinterpret_cast<IDL_STRING*>(malloc(total* sizeof(IDL_STRING)));
for (unsigned int i=0; i < total; ++i)
{
IDL_StrStore(&(pStrarr[i]), const_cast<char*>(names[i].c_str()));
}
bSuccess = true;
}
}
if (!bSuccess)
{
IDL_Message(IDL_M_GENERIC, IDL_MSG_RET, "No elements matched.");
return IDL_StrToSTRING("failure");
}
IDL_MEMINT dims[] = {total};
idlPtr = IDL_ImportArray(1, dims, IDL_TYP_STRING, reinterpret_cast<UCHAR*>(pStrarr),
reinterpret_cast<IDL_ARRAY_FREE_CB>(free), NULL);
return idlPtr;
//.........这里部分代码省略.........