本文整理汇总了C++中SpatialDataWindow类的典型用法代码示例。如果您正苦于以下问题:C++ SpatialDataWindow类的具体用法?C++ SpatialDataWindow怎么用?C++ SpatialDataWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SpatialDataWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QToolBox
AnnotationImagePaletteWidget::AnnotationImagePaletteWidget(QWidget* pParent) : QToolBox(pParent)
{
mDesktopAttachments.addSignal(SIGNAL_NAME(DesktopServices, WindowAdded),
Slot(this, &AnnotationImagePaletteWidget::windowAdded));
mDesktopAttachments.addSignal(SIGNAL_NAME(DesktopServices, WindowRemoved),
Slot(this, &AnnotationImagePaletteWidget::windowRemoved));
mDesktopAttachments.reset(Service<DesktopServices>().get());
std::vector<Window*> windows;
Service<DesktopServices>()->getWindows(SPATIAL_DATA_WINDOW, windows);
for (std::vector<Window*>::iterator window = windows.begin(); window != windows.end(); ++window)
{
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(*window);
if (pWindow != NULL)
{
pWindow->getWidget()->installEventFilter(this);
pWindow->getWidget()->setAcceptDrops(true);
mWindows.insert(pWindow);
}
}
setContextMenuPolicy(Qt::ActionsContextMenu);
QAction* pRefreshAction = new QAction("Refresh", this);
pRefreshAction->setAutoRepeat(false);
addAction(pRefreshAction);
VERIFYNR(connect(pRefreshAction, SIGNAL(triggered()), this, SLOT(refresh())));
setMinimumHeight(50);
}
示例2: VERIFY
SpatialDataView* ConvolutionFilterShell::displayResult()
{
VERIFY(mInput.mpResult != NULL);
if (Service<ApplicationServices>()->isBatch())
{
return NULL;
}
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(
Service<DesktopServices>()->createWindow(mInput.mpResult->getName(), SPATIAL_DATA_WINDOW));
SpatialDataView* pView = (pWindow == NULL) ? NULL : pWindow->getSpatialDataView();
if (pView == NULL)
{
Service<DesktopServices>()->deleteWindow(pWindow);
mProgress.report("Unable to create view.", 0, ERRORS, true);
return NULL;
}
pView->setPrimaryRasterElement(mInput.mpResult);
RasterLayer* pLayer = NULL;
{ // scope
UndoLock lock(pView);
pLayer = static_cast<RasterLayer*>(pView->createLayer(RASTER, mInput.mpResult));
}
if (pLayer == NULL)
{
//#pragma message(__FILE__ "(" STRING(__LINE__) ") : warning : This would be cleaner with a WindowResource. If one " \
// "becomes available, use it instead. (tclarke)")
Service<DesktopServices>()->deleteWindow(pWindow);
mProgress.report("Unable to create layer.", 0, ERRORS, true);
return NULL;
}
return pView;
}
示例3: fromXml
bool HistogramWindowImp::fromXml(DOMNode* pDocument, unsigned int version)
{
if ((pDocument == NULL) || (DockWindowImp::fromXml(pDocument, version) == false))
{
return false;
}
if (mpPlotSetGroup->fromXml(pDocument, version) == false)
{
return false;
}
vector<Window*> windows;
mpDesktop->getWindows(SPATIAL_DATA_WINDOW, windows);
for (vector<Window*>::const_iterator iter = windows.begin(); iter != windows.end(); ++iter)
{
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(*iter);
if (pWindow != NULL)
{
SpatialDataViewImp* pView = dynamic_cast<SpatialDataViewImp*>(pWindow->getSpatialDataView());
if (pView != NULL)
{
VERIFYNR(connect(pView, SIGNAL(layerAdded(Layer*)), this, SLOT(createPlot(Layer*))));
VERIFYNR(connect(pView, SIGNAL(layerActivated(Layer*)), this, SLOT(setCurrentPlot(Layer*))));
VERIFYNR(pView->attach(SIGNAL_NAME(SpatialDataView, LayerShown),
Slot(this, &HistogramWindowImp::layerShown)));
}
}
示例4: displayResult
bool NormalizeData::displayResult()
{
if (isBatch())
{
return true;
}
if (mInput.mpResult == NULL)
{
return false;
}
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(
Service<DesktopServices>()->createWindow(mInput.mpResult->getName(), SPATIAL_DATA_WINDOW));
SpatialDataView* pView = (pWindow == NULL) ? NULL : pWindow->getSpatialDataView();
if (pView == NULL)
{
mProgress.report("Unable to create view.", 0, ERRORS, true);
return false;
}
pView->setPrimaryRasterElement(mInput.mpResult);
UndoLock lock(pView);
RasterLayer* pLayer = static_cast<RasterLayer*>(pView->createLayer(RASTER, mInput.mpResult));
if (pLayer == NULL)
{
mProgress.report("Unable to create view.", 0, ERRORS, true);
return false;
}
return true;
}
示例5:
AnnotationImagePaletteWidget::~AnnotationImagePaletteWidget()
{
for (std::set<Window*>::iterator window = mWindows.begin(); window != mWindows.end(); ++window)
{
SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(*window);
pWindow->getWidget()->removeEventFilter(this);
// Don't disable drops in case another plug-in is expecting drops enabled
}
}
示例6: 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;
}
示例7: pStep
bool PrintView::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
StepResource pStep("Execute Wizard Item", "app", "4EA89098-57C8-4b93-B04F-3197C59B0D58");
pStep->addProperty("Item", getName());
mpStep = pStep.get();
if (!extractInputArgs(pInArgList))
{
reportError("Unable to extract input arguments.", "9FC540AC-4BCF-4041-9E8E-484A494AF6AD");
return false;
}
// Get the window
SpatialDataWindow* pWindow = NULL;
vector<Window*> windows;
Service<DesktopServices> pDesktop;
if (pDesktop.get() != NULL)
{
pDesktop->getWindows(SPATIAL_DATA_WINDOW, windows);
}
for (vector<Window*>::iterator iter = windows.begin(); iter != windows.end(); ++iter)
{
SpatialDataWindow* pCurrentWindow = static_cast<SpatialDataWindow*>(*iter);
if (pCurrentWindow != NULL)
{
SpatialDataView* pView = pCurrentWindow->getSpatialDataView();
if (pView != NULL)
{
LayerList* pLayerList = pView->getLayerList();
if (pLayerList != NULL)
{
RasterElement* pRasterElement = pLayerList->getPrimaryRasterElement();
if (pRasterElement != NULL && pRasterElement == mpRasterElement)
{
pWindow = pCurrentWindow;
break;
}
}
}
}
}
if (pWindow == NULL)
{
reportError("Could not get the window for the data set!", "28355746-8AE3-44a4-9253-58684E1964C1");
return false;
}
// Print the view
pWindow->print(mbPrintDialog);
reportComplete();
return true;
}
示例8: windowAdded
void AnnotationImagePaletteWidget::windowAdded(Subject& subject, const std::string& signal, const boost::any& val)
{
SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(boost::any_cast<Window*>(val));
if (pWindow != NULL)
{
pWindow->getWidget()->installEventFilter(this);
pWindow->getWidget()->setAcceptDrops(true);
mWindows.insert(pWindow);
}
}
示例9: windowRemoved
void AnnotationImagePaletteWidget::windowRemoved(Subject& subject, const std::string& signal, const boost::any& val)
{
SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(boost::any_cast<Window*>(val));
if (pWindow != NULL)
{
pWindow->getWidget()->removeEventFilter(this);
// Don't disable drops in case another plug-in is expecting drops enabled
}
mWindows.erase(boost::any_cast<Window*>(val));
}
示例10: createView
SpatialDataView* VideoImporter::createView() const
{
if ((isBatch()) || (mpRasterElement == NULL))
{
return NULL;
}
mProgress.report("Creating view...", 85, NORMAL);
// Get the data set name
std::string name = mpRasterElement->getName();
if (name.empty())
{
mProgress.report("The data set name is invalid! A view cannot be created.", 0, ERRORS, true);
return NULL;
}
// Create the spatial data window
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(Service<DesktopServices>()->createWindow(name, SPATIAL_DATA_WINDOW));
SpatialDataView* pView = (pWindow == NULL) ? NULL : pWindow->getSpatialDataView();
if (pView == NULL)
{
mProgress.report("Could not create the view window!", 0, ERRORS, true);
return NULL;
}
// Set the spatial data in the view
pView->setPrimaryRasterElement(mpRasterElement);
// Block undo actions when creating the layers
UndoLock lock(pView);
// Add the cube layer
RasterLayer* pLayer = static_cast<RasterLayer*>(pView->createLayer(RASTER, mpRasterElement));
if (pLayer == NULL)
{
mProgress.report("Could not create the cube layer!", 0, ERRORS, true);
return NULL;
}
pLayer->setStretchUnits(RED, RAW_VALUE);
pLayer->setStretchUnits(GREEN, RAW_VALUE);
pLayer->setStretchUnits(BLUE, RAW_VALUE);
pLayer->setStretchValues(RED, 0, 255);
pLayer->setStretchValues(GREEN, 0, 255);
pLayer->setStretchValues(BLUE, 0, 255);
if (pLayer->isGpuImageSupported())
{
pLayer->enableGpuImage(true);
}
return pView;
}
示例11: VERIFY
QWidget* ResultsExporter::getExportOptionsWidget(const PlugInArgList *pInArgList)
{
const DataDescriptor* pDescriptor = NULL;
if (pInArgList != NULL)
{
RasterElement* pElement = pInArgList->getPlugInArgValue<RasterElement>(Exporter::ExportItemArg());
if (pElement != NULL)
{
pDescriptor = pElement->getDataDescriptor();
}
}
if (mpOptionsWidget == NULL)
{
Service<DesktopServices> pDesktop;
VERIFY(pDesktop.get() != NULL);
mpOptionsWidget = new ResultsOptionsWidget(pDesktop->getMainWidget());
}
if (mpOptionsWidget != NULL)
{
const string& name = pDescriptor->getName();
const string& type = pDescriptor->getType();
DataElement* pParent = pDescriptor->getParent();
RasterElement* pResults = dynamic_cast<RasterElement*>(mpModel->getElement(name, type, pParent));
if (pResults != NULL)
{
PassArea passArea = MIDDLE;
double dFirstThreshold = 0.0;
double dSecondThreshold = 0.0;
SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(mpDesktop->getCurrentWorkspaceWindow());
if (pWindow != NULL)
{
SpatialDataView* pView = pWindow->getSpatialDataView();
if (pView != NULL)
{
LayerList* pLayerList = pView->getLayerList();
if (pLayerList != NULL)
{
ThresholdLayer* pThresholdLayer =
static_cast<ThresholdLayer*>(pLayerList->getLayer(THRESHOLD, pResults));
if (pThresholdLayer != NULL)
{
passArea = pThresholdLayer->getPassArea();
dFirstThreshold = pThresholdLayer->getFirstThreshold();
dSecondThreshold = pThresholdLayer->getSecondThreshold();
}
else
{
Statistics* pStatistics = pResults->getStatistics();
if (pStatistics != NULL)
{
dFirstThreshold = pStatistics->getMin();
dSecondThreshold = pStatistics->getMax();
}
}
}
LatLonLayer* pLatLonLayer = static_cast<LatLonLayer*>(pView->getTopMostLayer(LAT_LONG));
if (pLatLonLayer != NULL)
{
GeocoordType geocoordType = pLatLonLayer->getGeocoordType();
mpOptionsWidget->setGeocoordType(geocoordType);
}
}
}
mpOptionsWidget->setPassArea(passArea);
mpOptionsWidget->setFirstThreshold(dFirstThreshold);
mpOptionsWidget->setSecondThreshold(dSecondThreshold);
}
}
return mpOptionsWidget;
}
示例12: 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;
//.........这里部分代码省略.........
示例13: pStep
bool LayerImporter::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
Layer* pLayer = NULL;
Progress* pProgress = NULL;
DataElement* pElement = NULL;
SpatialDataView* pView = NULL;
StepResource pStep("Import layer", "app", "DF24688A-6B34-4244-98FF-5FFE2063AC05");
// get input arguments and log some useful info about them
{ // scope the MessageResource
MessageResource pMsg("Input arguments", "app", "C0A532DE-0E19-44D3-837C-16ABD267B2C1");
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", 100, ERRORS);
}
pStep->finalize(Message::Failure, "No data element");
return false;
}
pMsg->addProperty("Element name", pElement->getName());
pView = pInArgList->getPlugInArgValue<SpatialDataView>(Executable::ViewArg());
if (pView != NULL)
{
pMsg->addProperty("View name", pView->getName());
}
}
if (pProgress != NULL)
{
pProgress->updateProgress((string("Read and parse file ") + pElement->getFilename()),
20, NORMAL);
}
// parse the xml
XmlReader xml(Service<MessageLogMgr>()->getLog());
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* pDomDocument = xml.parse(pElement->getFilename());
if (pDomDocument == NULL)
{
if (pProgress != NULL)
{
pProgress->updateProgress("Unable to parse the file", 100, ERRORS);
}
pStep->finalize(Message::Failure, "Unable to parse the file");
return false;
}
DOMElement* pRootElement = pDomDocument->getDocumentElement();
VERIFY(pRootElement != NULL);
if (pProgress != NULL)
{
pProgress->updateProgress("Create the layer", 40, NORMAL);
}
string name(A(pRootElement->getAttribute(X("name"))));
string type(A(pRootElement->getAttribute(X("type"))));
unsigned int formatVersion = atoi(A(pRootElement->getAttribute(X("version"))));
{ // scope the MessageResource
MessageResource pMsg("Layer information", "app", "AA358F7A-107E-456E-8D11-36DDBE5B1645");
pMsg->addProperty("name", name);
pMsg->addProperty("type", type);
pMsg->addProperty("format version", formatVersion);
}
// If user requested pixel coordinates be used.
bool usePixelCoords = false;
DataDescriptor* pDesc = pElement->getDataDescriptor();
VERIFY( pDesc );
pDesc->getMetadata()->getAttributeByPath( "Layer/Import Options/Use Pixel Coordinates" ).getValue( usePixelCoords );
if (usePixelCoords)
{
// Remove geoVertices and geoBox elements.
removeGeoNodes(pRootElement);
}
if (pView == NULL)
{
//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);
}
//.........这里部分代码省略.........
示例14: getRasterElement
void ChippingWindow::createView()
{
if (mpChippingWidget == NULL)
{
return;
}
RasterElement* pRaster = getRasterElement();
if (pRaster == NULL)
{
return;
}
// Create the new raster element from the primary element of the source.
// Note that this does not chip displayed elements if they differ from the primary element.
// This causes a special case below where the stretch values are being applied to the chipped layer.
RasterElement* pRasterChip = pRaster->createChip(pRaster->getParent(), "_chip",
mpChippingWidget->getChipRows(), mpChippingWidget->getChipColumns(), mpChippingWidget->getChipBands());
if (pRasterChip == NULL)
{
QMessageBox::critical(this, windowTitle(), "Unable to create a new cube!");
return;
}
const RasterDataDescriptor* pDescriptor =
dynamic_cast<const RasterDataDescriptor*>(pRasterChip->getDataDescriptor());
VERIFYNRV(pDescriptor != NULL);
// Create a view for the new chip
SpatialDataWindow* pWindow = dynamic_cast<SpatialDataWindow*>(
Service<DesktopServices>()->createWindow(pRasterChip->getName(), SPATIAL_DATA_WINDOW));
if (pWindow == NULL)
{
return;
}
SpatialDataView* pView = pWindow->getSpatialDataView();
if (pView == NULL)
{
Service<DesktopServices>()->deleteWindow(pWindow);
return;
}
UndoLock lock(pView);
if (pView->setPrimaryRasterElement(pRasterChip) == false)
{
Service<DesktopServices>()->deleteWindow(pWindow);
return;
}
// RasterLayerImp is needed for the call to setCurrentStretchAsOriginalStretch().
RasterLayerImp* pLayer = dynamic_cast<RasterLayerImp*>(pView->createLayer(RASTER, pRasterChip));
if (pLayer == NULL)
{
Service<DesktopServices>()->deleteWindow(pWindow);
return;
}
string origName = pRaster->getName();
SpatialDataWindow* pOrigWindow = dynamic_cast<SpatialDataWindow*>(
Service<DesktopServices>()->getWindow(origName, SPATIAL_DATA_WINDOW));
if (pOrigWindow != NULL)
{
SpatialDataView* pOrigView = pOrigWindow->getSpatialDataView();
if (pOrigView != NULL)
{
LayerList* pLayerList = pOrigView->getLayerList();
if (pLayerList != NULL)
{
RasterLayer* pOrigLayer = static_cast<RasterLayer*>(pLayerList->getLayer(RASTER, pRaster));
if (pOrigLayer != NULL)
{
// Set the stretch type first so that stretch values are interpreted correctly.
pLayer->setStretchType(GRAYSCALE_MODE, pOrigLayer->getStretchType(GRAYSCALE_MODE));
pLayer->setStretchType(RGB_MODE, pOrigLayer->getStretchType(RGB_MODE));
pLayer->setDisplayMode(pOrigLayer->getDisplayMode());
// Set the properties of the cube layer in the new view.
// For each channel, display the first band if the previously displayed band was chipped.
vector<RasterChannelType> channels = StringUtilities::getAllEnumValues<RasterChannelType>();
for (vector<RasterChannelType>::const_iterator iter = channels.begin(); iter != channels.end(); ++iter)
{
bool bandCopied = true;
DimensionDescriptor newBand;
DimensionDescriptor oldBand = pOrigLayer->getDisplayedBand(*iter);
if (oldBand.isOriginalNumberValid() == true)
{
newBand = pDescriptor->getOriginalBand(oldBand.getOriginalNumber());
}
if (newBand.isValid() == false)
{
bandCopied = false;
newBand = pDescriptor->getBands().front();
}
// No need to explicitly set the RasterElement here since the new view only has one RasterElement.
pLayer->setDisplayedBand(*iter, newBand);
//.........这里部分代码省略.........
示例15: pStep
//.........这里部分代码省略.........
for (unsigned int col = 0; col < N_Col; ++col)
{
NodeLat = OrthoGrid.Lat_Min+row*OrthoGrid.Lat_Step;
NodeLon = OrthoGrid.Lon_Min+col*OrthoGrid.Lon_Step;
// RETRIEVE HEIGHT VALUE FROM DSM
if (DSM_resampling == 0)
{
int DSM_I = int((NodeLon - DSMGrid.Lon_Min)/DSMGrid.Lon_Step);
int DSM_J = pDescDSM->getRowCount() - int((NodeLat - DSMGrid.Lat_Min)/DSMGrid.Lat_Step);
pDSMAcc->toPixel(DSM_J,DSM_I);
VERIFY(pDSMAcc.isValid());
H_IJ = (pDSMAcc->getColumnAsDouble());
}
else
{
double DSM_I = ((NodeLon - DSMGrid.Lon_Min)/DSMGrid.Lon_Step);
double DSM_J = pDescDSM->getRowCount() - ((NodeLat - DSMGrid.Lat_Min)/DSMGrid.Lat_Step);
H_IJ = bilinear_height(pDSMAcc,DSM_I,DSM_J);
}
P_COORD NodeImage = Model->SAR_GroundToImage(NodeLon,NodeLat,H_IJ+Geoid_Offset);
if ((NodeImage.I>1 && NodeImage.I< Model->Metadata.Width-1) && (NodeImage.J>1 && NodeImage.J< Model->Metadata.Height-1))
{
switchOnEncoding(pResultDesc->getDataType(), copypixel3, pDestAcc->getColumn(), pSrcAcc, int(NodeImage.I), int(NodeImage.J),boxsize, H_IJ);
}
pDestAcc->nextColumn();
}
pDestAcc->nextRow();
}
Service<DesktopServices> pDesktop;
Service<ModelServices> pMod;
GcpList* GcpL = static_cast<GcpList*>(pMod->createElement("corner coordinate","GcpList",pResultCube.get()));
// Update GCPs Information: to account for Opticks reading gcp lat&lon values the opposite way around,
// here it is necessary to switch the value to assign lat to gcp.mCoordinate.mX and lon to gcp.mCoordinate.mY
GcpPoint Punto;
Punto.mCoordinate.mX = OrthoGrid.Lat_Min;
Punto.mCoordinate.mY = OrthoGrid.Lon_Min;
Punto.mCoordinate.mZ = 0.0;
Punto.mPixel.mX = 0.0;
Punto.mPixel.mY = 0.0;
GcpL->addPoint(Punto);
Punto.mCoordinate.mX = OrthoGrid.Lat_Max;
Punto.mCoordinate.mY = OrthoGrid.Lon_Min;
Punto.mCoordinate.mZ = 0.0;
Punto.mPixel.mX = 0.0;
Punto.mPixel.mY = OrthoGrid.Y_Dim;
GcpL->addPoint(Punto);
Punto.mCoordinate.mX = OrthoGrid.Lat_Min;
Punto.mCoordinate.mY = OrthoGrid.Lon_Max;
Punto.mCoordinate.mZ = 0.0;
Punto.mPixel.mX = OrthoGrid.X_Dim;
Punto.mPixel.mY = 0.0;
GcpL->addPoint(Punto);
Punto.mCoordinate.mX = OrthoGrid.Lat_Max;
Punto.mCoordinate.mY = OrthoGrid.Lon_Max;
Punto.mCoordinate.mZ = 0.0;
Punto.mPixel.mX = OrthoGrid.X_Dim;
Punto.mPixel.mY = OrthoGrid.Y_Dim;
GcpL->addPoint(Punto);
SpatialDataWindow* pWindow = static_cast<SpatialDataWindow*>(pDesktop->createWindow(pResultCube->getName(),
SPATIAL_DATA_WINDOW));
SpatialDataView* pView = (pWindow == NULL) ? NULL : pWindow->getSpatialDataView();
pView->setPrimaryRasterElement(pResultCube.get());
pView->createLayer(RASTER, pResultCube.get());
pView->createLayer(GCP_LAYER,GcpL,"GCP");
pView->setDataOrigin(LOWER_LEFT);
pResultCube.release();
pProgress->updateProgress("Orthorectification is complete.", 100, NORMAL);
pStep->addStep("End","app", "B4D426EC-E06D-11E1-83C8-42E56088709B");
pStep->finalize();
return true;
}