本文整理汇总了C++中SpatialDataView::getWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ SpatialDataView::getWidget方法的具体用法?C++ SpatialDataView::getWidget怎么用?C++ SpatialDataView::getWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpatialDataView
的用法示例。
在下文中一共展示了SpatialDataView::getWidget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
bool RasterTimingTest::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
if (isBatch())
{
VERIFY(pOutArgList != NULL);
}
Service<DesktopServices> pDesktop;
SpatialDataView* pView = dynamic_cast<SpatialDataView*>(pDesktop->getCurrentWorkspaceWindowView());
if (pView)
{
UndoLock lock(pView);
RasterElement* pElement = pView->getLayerList()->getPrimaryRasterElement();
RasterDataDescriptor* pDesc = dynamic_cast<RasterDataDescriptor*>(pElement->getDataDescriptor());
int bands = pDesc->getBandCount();
int frameNumber = 0;
RasterLayer* pLayer = NULL;
vector<Layer*> layers;
pView->getLayerList()->getLayers(RASTER, layers);
for (vector<Layer*>::iterator iter = layers.begin(); iter != layers.end(); ++iter)
{
RasterLayer* pRasterLayer = static_cast<RasterLayer*>(*iter);
if (pRasterLayer != NULL)
{
RasterElement* pCurrentRasterElement = dynamic_cast<RasterElement*>(pRasterLayer->getDataElement());
if (pCurrentRasterElement == pElement)
{
pLayer = pRasterLayer;
break;
}
}
}
for (int i = 0; i < bands; ++i)
{
pElement->getStatistics(pDesc->getActiveBand(i))->getMin();
}
// set grayscale display mode
DisplayMode initialDisplayMode = pLayer->getDisplayMode();
pLayer->setDisplayMode(GRAYSCALE_MODE);
const int frameiterations = 10000;
clock_t startTime = clock();
QWidget* pWidget = pView->getWidget();
int i = 0;
for (i = 0; i < frameiterations; ++i, ++frameNumber)
{
if (frameNumber >= bands)
{
frameNumber = 0;
}
pLayer->setDisplayedBand(GRAY, pDesc->getActiveBand(frameNumber));
if (pWidget)
{
pWidget->repaint();
}
if ((i + 1) % (frameiterations / 100) == 0)
{
QString message = QString("Frame ") + QString::number(i+1) + QString(" of ") +
QString::number(frameiterations);
pDesktop->setStatusBarMessage(message.toStdString());
}
if ((i + 1) % 20 == 0)
{
clock_t stopTime = clock();
double elapsedTime = static_cast<double>(stopTime - startTime) / CLOCKS_PER_SEC;
if (elapsedTime > 30)
{
++i;
break;
}
}
}
clock_t stopTime = clock();
double framesPerSec = i / (static_cast<double>(stopTime - startTime) / CLOCKS_PER_SEC);
// restore display mode
pLayer->setDisplayMode(initialDisplayMode);
if (isBatch())
{
pOutArgList->setPlugInArgValue<double>("Framerate", &framesPerSec);
}
else
{
QMessageBox::information(pDesktop->getMainWidget(), "Frame Rate",
QString("The number of frames per second was: %1\nGPU Acceleration was%2 enabled\n").arg(framesPerSec)
.arg(pLayer->isGpuImageEnabled() ? "" : " not"));
}
return true;
}
return false;
}
示例2: fileInfo
ChippingWindow::ChippingWindow(SpatialDataView* pView, QWidget* parent) :
QDialog(parent),
mpView(pView),
mpChippingWidget(NULL),
mpWindowRadio(NULL),
mpFileRadio(NULL)
{
// View widget
SpatialDataView* pChipView = createChipView();
pChipView->getWidget()->installEventFilter(this);
mpChippingWidget = new ChippingWidget(pChipView, NULL, this);
mpChippingWidget->setExportMode(true);
// Chip mode
QGroupBox* pModeGroup = new QGroupBox("Chipping Mode", this);
mpWindowRadio = new QRadioButton("Create new window", pModeGroup);
mpFileRadio = new QRadioButton("Export to file", pModeGroup);
// Horizontal line
QFrame* pHLine = new QFrame(this);
pHLine->setFrameStyle(QFrame::HLine | QFrame::Sunken);
// Buttons
QPushButton* pOkButton = new QPushButton("&OK", this);
QPushButton* pCancelButton = new QPushButton("&Cancel", this);
// Layout
QVBoxLayout* pModeLayout = new QVBoxLayout(pModeGroup);
pModeLayout->setMargin(10);
pModeLayout->setSpacing(5);
pModeLayout->addWidget(mpWindowRadio);
pModeLayout->addWidget(mpFileRadio);
QHBoxLayout* pButtonLayout = new QHBoxLayout();
pButtonLayout->setMargin(0);
pButtonLayout->setSpacing(5);
pButtonLayout->addStretch(10);
pButtonLayout->addWidget(pOkButton);
pButtonLayout->addWidget(pCancelButton);
QVBoxLayout* pLayout = new QVBoxLayout(this);
pLayout->setMargin(10);
pLayout->setSpacing(10);
pLayout->addWidget(mpChippingWidget, 10);
pLayout->addWidget(pModeGroup, 0, Qt::AlignLeft);
pLayout->addWidget(pHLine);
pLayout->addLayout(pButtonLayout);
// Initialization
setModal(true);
resize(400, 200);
mpWindowRadio->setChecked(true);
// Set the window icon
setWindowIcon(QIcon(":/icon/ChipImage"));
// Set the caption of the dialog
QString strCaption = "Create Image Chip";
if (mpView != NULL)
{
string viewName = mpView->getName();
if (viewName.empty() == false)
{
QFileInfo fileInfo(QString::fromStdString(viewName));
QString strFilename = fileInfo.fileName();
if (strFilename.isEmpty() == false)
{
strCaption += ": " + strFilename;
}
}
}
setWindowTitle(strCaption);
// Connections
connect(pOkButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(pCancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}
示例3: getPreview
//.........这里部分代码省略.........
// Do not georeference
GeoreferenceDescriptor* pLoadGeorefDescriptor = pLoadDescriptor->getGeoreferenceDescriptor();
if (pLoadGeorefDescriptor != NULL)
{
pLoadGeorefDescriptor->setGeoreferenceOnImport(false);
}
// Validate the preview
string errorMessage;
bool bValidPreview = validate(pLoadDescriptor, vector<const DataDescriptor*>(), errorMessage);
if (bValidPreview == false)
{
// Try an in-memory preview
pLoadDescriptor->setProcessingLocation(IN_MEMORY);
bValidPreview = validate(pLoadDescriptor, vector<const DataDescriptor*>(), errorMessage);
}
QWidget* pPreviewWidget = NULL;
if (bValidPreview == true)
{
// Create the model element
RasterElement* pRasterElement = static_cast<RasterElement*>(mpModel->createElement(pLoadDescriptor));
if (pRasterElement != NULL)
{
// Add the progress and raster element to an input arg list
PlugInArgList* pInArgList = NULL;
bool bSuccess = getInputSpecification(pInArgList);
if ((bSuccess == true) && (pInArgList != NULL))
{
bSuccess = pInArgList->setPlugInArgValue(Executable::ProgressArg(), pProgress);
if (bSuccess)
{
bSuccess = pInArgList->setPlugInArgValue(Importer::ImportElementArg(), pRasterElement);
}
}
// Load the data in batch mode
bool bBatch = isBatch();
setBatch();
bSuccess = execute(pInArgList, NULL);
// Restore to interactive mode if necessary
if (bBatch == false)
{
setInteractive();
}
// Create the spatial data view
if (bSuccess == true)
{
string name = pRasterElement->getName();
SpatialDataView* pView = static_cast<SpatialDataView*>(mpDesktop->createView(name, SPATIAL_DATA_VIEW));
if (pView != NULL)
{
// Set the spatial data in the view
pView->setPrimaryRasterElement(pRasterElement);
// Add the cube layer
RasterLayer* pLayer = static_cast<RasterLayer*>(pView->createLayer(RASTER, pRasterElement));
if (pLayer != NULL)
{
// Get the widget from the view
pPreviewWidget = pView->getWidget();
}
else
{
string message = "Could not create the cube layer!";
if (pProgress != NULL)
{
pProgress->updateProgress(message, 0, ERRORS);
}
mpModel->destroyElement(pRasterElement);
}
}
else
{
string message = "Could not create the view!";
if (pProgress != NULL)
{
pProgress->updateProgress(message, 0, ERRORS);
}
mpModel->destroyElement(pRasterElement);
}
}
else
{
mpModel->destroyElement(pRasterElement);
}
}
}
// Delete the data descriptor copy
mpModel->destroyDataDescriptor(pLoadDescriptor);
return pPreviewWidget;
}