00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 #ifndef SPATIALDATAVIEW_H 00011 #define SPATIALDATAVIEW_H 00012 00013 #include "PerspectiveView.h" 00014 #include "ConfigurationSettings.h" 00015 #include "DataVariantValidator.h" 00016 #include "EnumWrapper.h" 00017 #include "TypesFile.h" 00018 00019 #include <vector> 00020 00021 class Animation; 00022 class DataElement; 00023 class Layer; 00024 class LayerList; 00025 class QImage; 00026 class RasterElement; 00027 00028 /** 00029 * Specifies the panning range limit for the spatial data view 00030 */ 00031 enum PanLimitTypeEnum 00032 { 00033 NO_LIMIT=0, /**< The panning range is not limited */ 00034 CUBE_EXTENTS, /**< The panning range is limited to the extents of the primary raster layer */ 00035 MAX_EXTENTS /**< The panning range is limited to the extents of all displayed layers*/ 00036 }; 00037 00038 /** 00039 * @EnumWrapper ::PanLimitTypeEnum. 00040 */ 00041 typedef EnumWrapper<PanLimitTypeEnum> PanLimitType; 00042 00043 /** 00044 * A view to display layers. 00045 * 00046 * The spatial data view provides a means by which one or more layers are displayed. 00047 * Layers that are available for display are contained in the view's layer list, which 00048 * has an associated data set. Layers for other data sets can be added to this view, 00049 * which adds the layer to the layer list. It is also possible to add all layers in 00050 * another layer list to the view. When displaying layers the view maintains a display 00051 * index, which specifies the order in which the layers are drawn in the view. For 00052 * raster layers, a texture mode is available that specifies how the pixels are drawn 00053 * at their boundaries. 00054 * 00055 * The spatial data view defines the following mouse modes, where the name given is the 00056 * name populated by MouseMode::getName(): 00057 * - LayerMode 00058 * - MeasurementMode 00059 * - PanMode 00060 * - RotateMode 00061 * - ZoomInMode 00062 * - ZoomOutMode 00063 * - ZoomBoxMode 00064 * 00065 * This subclass of Subject will notify upon the following conditions: 00066 * - The following methods are called: setLayerDisplayIndex(), setTextureMode(), 00067 * showLayer(), hideLayer(), setActiveLayer(), setFrontLayer(), setBackLayer(), 00068 * bringLayerForward(), sendLayerBackward(). 00069 * - The display index of any layer changes. 00070 * - Everything else documented in PerspectiveView. 00071 * 00072 * @see Layer, LayerList 00073 */ 00074 class SpatialDataView : public PerspectiveView 00075 { 00076 public: 00077 SETTING(ClassificationMarkingPositions, SpatialDataView, PositionType, CENTER) 00078 SETTING(DisplayOrigin, SpatialDataView, bool, true) 00079 SETTING(DisplayAxis, SpatialDataView, bool, true) 00080 SETTING(GeoCoordTooltip, SpatialDataView, bool, false) 00081 SETTING(ConfirmLayerDelete, SpatialDataView, bool, true) 00082 SETTING(FastPanSpeed, SpatialDataView, int, 20) 00083 SETTING(MaximumZoomRatio, SpatialDataView, double, 1.5) 00084 SETTING(MinimumZoomPixels, SpatialDataView, double, 1.0) 00085 SETTING(PanLimit, SpatialDataView, PanLimitType, CUBE_EXTENTS) 00086 SETTING(SlowPanSpeed, SpatialDataView, int, 10) 00087 00088 /** 00089 * Emitted with boost::any<TextureMode> when the texture mode is changed. 00090 */ 00091 SIGNAL_METHOD(SpatialDataView, TextureModeChanged) 00092 00093 /** 00094 * Emitted with boost::any<Layer*> when a layer is shown. 00095 */ 00096 SIGNAL_METHOD(SpatialDataView, LayerShown) 00097 00098 /** 00099 * Emitted with boost::any<Layer*> when a layer is hidden. 00100 */ 00101 SIGNAL_METHOD(SpatialDataView, LayerHidden) 00102 00103 /** 00104 * Emitted when the display index of any layer changes. 00105 */ 00106 SIGNAL_METHOD(SpatialDataView, LayerDisplayIndexesChanged) 00107 00108 /** 00109 * Emitted with boost::any<Layer*> when the layer that is edited with the 00110 * LayerMode mouse mode changes. 00111 * 00112 * This signal may be emitted if the layer is not displayed. 00113 * 00114 * @see setActiveLayer() 00115 */ 00116 SIGNAL_METHOD(SpatialDataView, LayerActivated) 00117 00118 /** 00119 * @copydoc SessionItem::getContextMenuActions() 00120 * 00121 * @default The default implementation returns the context menu actions 00122 * listed \ref spatialdataview "here". The default actions can be 00123 * removed or additional actions can be added by attaching to the 00124 * signalAboutToShowContextMenu() signal. 00125 */ 00126 virtual std::list<ContextMenuAction> getContextMenuActions() const = 0; 00127 00128 /** 00129 * Associates a RasterElement with the view. 00130 * 00131 * This method associates a RasterElement with the view. Once the 00132 * RasterElement is associated with the view, it cannot be changed. 00133 * 00134 * @return TRUE if the element was successfully associated with the view. 00135 * FALSE is returned if another RasterElement was previously 00136 * associated with the view. 00137 * 00138 * @see RasterElement 00139 * @see LayerList::getPrimaryRasterElement() 00140 */ 00141 virtual bool setPrimaryRasterElement(RasterElement* pRasterElement) = 0; 00142 00143 /** 00144 * Sets the view texture mode. 00145 * 00146 * When zoomed in such that a scene pixel maps to more than one screen pixel, the 00147 * window can either replicate the scene pixel or interpolate between scene pixels. 00148 * 00149 * This method does not call refresh() so that multiple calls to modify 00150 * view settings can be made without refreshing the view after each modification. 00151 * 00152 * @param textureMode 00153 * The new texture mode. 00154 * 00155 * @notify This method will notify signalTextureModeChanged() with 00156 * boost::any<TextureMode>. 00157 * 00158 * @see TextureMode 00159 */ 00160 virtual void setTextureMode(const TextureMode& textureMode) = 0; 00161 00162 /** 00163 * Returns the view texture mode. 00164 * 00165 * @return The current texture mode. 00166 * 00167 * @see TextureMode 00168 */ 00169 virtual TextureMode getTextureMode() const = 0; 00170 00171 /** 00172 * Returns the list of available display layers. 00173 * 00174 * @return The layer list used for displaying layers in the view. 00175 */ 00176 virtual LayerList* getLayerList() const = 0; 00177 00178 /** 00179 * Adds a new layer to the view. 00180 * 00181 * This method creates a new layer of a given type based on a given element 00182 * and adds it to this view. The layer is created with a name based on the 00183 * name of the data element. If a layer already exists with the same name 00184 * as the element, then the layer is created with a unique name based on the 00185 * given layer type. In this case, the element name will not necessarily 00186 * match the layer name. 00187 * 00188 * @param layerType 00189 * The layer type. 00190 * @param pElement 00191 * The data element used as the basis for drawing the layer. If 00192 * \c NULL is passed in, an element is created with a unique 00193 * default name based on the element type associated with the given 00194 * layer type. 00195 * 00196 * @return A pointer to the created layer, which can be safely cast to a 00197 * derived layer class according to the layer type. \c NULL is 00198 * returned if the layer or data element could not be created. 00199 * 00200 * @see createLayer(const LayerType&, DataElement*, const std::string&) 00201 */ 00202 virtual Layer* createLayer(const LayerType& layerType, DataElement* pElement) = 0; 00203 00204 /** 00205 * Adds a new layer to the view. 00206 * 00207 * This method creates a new layer of a given type with a given name based 00208 * on a given element and adds it to this view. The layer is created with 00209 * a name based on the name of the data element. If a layer already exists 00210 * with the same name as the element, then the layer is created with a 00211 * unique name based on the given layer type. In this case, the element 00212 * name will not necessarily match the layer name. 00213 * 00214 * @param layerType 00215 * The layer type. 00216 * @param pElement 00217 * The data element used as the basis for drawing the layer. If 00218 * \c NULL is passed in, an element is created with a unique 00219 * default name based on the element type associated with the given 00220 * layer type. 00221 * @param layerName 00222 * The name to assign to the created layer. If the given name is 00223 * empty, the name of the data element is used. 00224 * 00225 * @return A pointer to the created layer, which can be safely cast to a 00226 * derived layer class according to the layer type. \c NULL is 00227 * returned if the layer or data element could not be created. 00228 * 00229 * @see createLayer(const LayerType&, DataElement*) 00230 */ 00231 virtual Layer* createLayer(const LayerType& layerType, DataElement* pElement, const std::string& layerName) = 0; 00232 00233 /** 00234 * Adds an existing layer to the view. 00235 * 00236 * @param pLayer 00237 * The layer to add to the view. Cannot be NULL. 00238 * 00239 * @return TRUE if the layer was successfully added to the view. FALSE 00240 * is returned if the layer already exists in the view. 00241 * 00242 * @see createLayer(), addLayerList() 00243 */ 00244 virtual bool addLayer(Layer* pLayer) = 0; 00245 00246 /** 00247 * Adds the layers from a layer list to the view. 00248 * 00249 * The method adds the layers from a layer list into the view. If the 00250 * given layer list contains a layer that already exists in this list, the 00251 * layer is not added again. 00252 * 00253 * @param pLayerList 00254 * The layer list from which to add its layers to the view. 00255 * Cannot be NULL. 00256 * 00257 * @return TRUE if the layers from the layer list were successfully 00258 * added to the view. This includes the cases where layers are 00259 * not added to this list if they already exist in this list. 00260 * FALSE is returned if an error occurs. 00261 * 00262 * @see addLayer() 00263 */ 00264 virtual bool addLayerList(const LayerList* pLayerList) = 0; 00265 00266 /** 00267 * Returns layer types from which a given layer can be derived. 00268 * 00269 * This is a convenience method that calls Layer::getLayerType() and then 00270 * calls getDerivedLayerTypes(LayerType) const. 00271 * 00272 * @param pLayer 00273 * The layer to query for layer types which can be derived. 00274 * 00275 * @return All layer types that can be derived from the given layer. 00276 * 00277 * @see getDerivedLayerTypes(LayerType) const, deriveLayer() 00278 */ 00279 virtual std::vector<LayerType> getDerivedLayerTypes(const Layer* pLayer) const = 0; 00280 00281 /** 00282 * Returns layer types that can be derived from a given layer type. 00283 * 00284 * @param layerType 00285 * The layer type to query for layer types which can be derived. 00286 * 00287 * @return All layer types that can be derived from the given layer type. 00288 * 00289 * @see getDerivedLayerTypes(const Layer*) const, deriveLayer() 00290 */ 00291 virtual std::vector<LayerType> getDerivedLayerTypes(LayerType layerType) const = 0; 00292 00293 /** 00294 * Creates a new layer based on an existing layer of another type. 00295 * 00296 * This method creates a new layer with a different type, but the same data 00297 * element and name as an existing layer. If a new annotation or AOI layer 00298 * is created, the data element is copied. 00299 * 00300 * @param pLayer 00301 * The existing layer from which to derive the new layer. This layer 00302 * can, but does not need to be contained in this view. 00303 * @param newLayerType 00304 * The layer type for the new layer. If \em newLayerType is the 00305 * same as the type for \em pLayer a copy of the layer is made. 00306 * 00307 * @return A pointer to the created layer, which can be safely cast to a 00308 * derived layer class according to the new layer type. \b NULL 00309 * is returned if the given layer does not support creating a new 00310 * layer of the given type. 00311 * 00312 * @see getDerivedLayerTypes() 00313 */ 00314 virtual Layer* deriveLayer(const Layer* pLayer, const LayerType& newLayerType) = 0; 00315 00316 /** 00317 * Converts an existing layer from one type to another. 00318 * 00319 * This method is a convenience method that calls deriveLayer() followed by 00320 * deleteLayer() with both calls wrapped in a single undo action group. 00321 * 00322 * @param pLayer 00323 * The existing layer to convert to the new type. The existing layer 00324 * does not need to be contained in the view, but the new converted 00325 * layer is only added to this view. 00326 * @param newLayerType 00327 * The new layer type. 00328 * 00329 * @return A pointer to the created layer, which can be safely cast to a 00330 * derived layer class according to the new layer type. \b NULL is 00331 * returned if the given layer cannot be converted to the new layer 00332 * type. 00333 */ 00334 virtual Layer* convertLayer(Layer* pLayer, const LayerType& newLayerType) = 0; 00335 00336 /** 00337 * Displays a layer in the layer list. 00338 * 00339 * This method displays the given layer in the view. The layer is displayed on 00340 * top of the other displayed layers and has a display index of 0. 00341 * 00342 * @param pLayer 00343 * The layer to display. The layer must be included in the layer 00344 * list. Cannot be NULL. 00345 * 00346 * @return TRUE is the layer was successfully displayed. FALSE if the layer 00347 * does not exist in the layer list or if an error occurred. 00348 * 00349 * @notify This method will notify signalLayerShown() with 00350 * boost::any<Layer*>. 00351 */ 00352 virtual bool showLayer(Layer* pLayer) = 0; 00353 00354 /** 00355 * Hides a displayed layer in the layer list. 00356 * 00357 * This method hides a displayed layer, but does not remove or delete the layer 00358 * from the layer list. 00359 * 00360 * @param pLayer 00361 * The layer to remove from the display. The layer must be included 00362 * in the layer list. Cannot be NULL. 00363 * 00364 * @return TRUE is the layer was successfully hidden. FALSE if the layer does 00365 * not exist in the layer list or if an error occurred. 00366 * 00367 * @notify This method will notify signalLayerHidden() with 00368 * boost::any<Layer*>. 00369 */ 00370 virtual bool hideLayer(Layer* pLayer) = 0; 00371 00372 /** 00373 * Retrieves the displayed layers in the layer list. 00374 * 00375 * @param displayedLayers 00376 * A reference to a vector to contain pointers for each displayed layer. 00377 * 00378 * @see isLayerDisplayed() 00379 */ 00380 virtual void getDisplayedLayers(std::vector<Layer*>& displayedLayers) const = 0; 00381 00382 /** 00383 * Queries whether a layer is currently displayed. 00384 * 00385 * @param pLayer 00386 * The layer to query for its display. Cannot be NULL. 00387 * 00388 * @return TRUE if the layer is displayed. FALSE if the layer is not displayed, 00389 * or the layer does not exist. 00390 */ 00391 virtual bool isLayerDisplayed(Layer* pLayer) const = 0; 00392 00393 /** 00394 * Returns the top-most layer. 00395 * 00396 * @return A pointer to the top-most visible layer, regardless of the layer 00397 * type. \c NULL is returned if no layers are currently visible in 00398 * the view. 00399 * 00400 * @see getTopMostLayer(LayerType) const, 00401 * getTopMostLayer(const LocationType&) const, 00402 * getTopMostLayer(LayerType, const LocationType&) const, 00403 * getTopMostElement() const 00404 */ 00405 virtual Layer* getTopMostLayer() const = 0; 00406 00407 /** 00408 * Returns the top-most layer of a given type. 00409 * 00410 * @param layerType 00411 * The type of layer for which to get the top-most layer. 00412 * 00413 * @return A pointer to the top-most visible layer of the given type. 00414 * \c NULL is returned if no layers of the given type are 00415 * currently visible in the view. 00416 * 00417 * @see getTopMostLayer() const, 00418 * getTopMostLayer(const LocationType&) const, 00419 * getTopMostLayer(LayerType, const LocationType&) const 00420 */ 00421 virtual Layer* getTopMostLayer(LayerType layerType) const = 0; 00422 00423 /** 00424 * Returns the top-most layer at a given pixel coordinate regardless of 00425 * layer type. 00426 * 00427 * @param worldCoord 00428 * The pixel coordinate in world coordinates. 00429 * 00430 * @return A pointer to the top-most displayed layer in the view whose 00431 * extents include the given pixel coordinate. \c NULL is returned 00432 * if no layers are currently visible in the view whose extents 00433 * include the given pixel coordinate. 00434 * 00435 * @see getTopMostLayer() const, 00436 * getTopMostLayer(LayerType) const, 00437 * getTopMostLayer(LayerType, const LocationType&) const 00438 */ 00439 virtual Layer* getTopMostLayer(const LocationType& worldCoord) const = 0; 00440 00441 /** 00442 * Returns the top-most layer of a given type at a given pixel coordinate. 00443 * 00444 * @param layerType 00445 * The layer type. 00446 * @param worldCoord 00447 * The pixel coordinate in world coordinates. 00448 * 00449 * @return A pointer to the top-most displayed layer of the given type in 00450 * the view whose extents include the given pixel coordinate. 00451 * \c NULL is returned if no layers of the given type are currently 00452 * visible in the view whose extents include the given pixel 00453 * coordinate. 00454 * 00455 * @see getTopMostLayer() const, 00456 * getTopMostLayer(LayerType) const, 00457 * getTopMostLayer(const LocationType&) const 00458 */ 00459 virtual Layer* getTopMostLayer(LayerType layerType, const LocationType& worldCoord) const = 0; 00460 00461 /** 00462 * Returns the data element of the top-most layer. 00463 * 00464 * @return A pointer to the data element being displayed by the top-most 00465 * visible layer in the view, regardless of layer type. \c NULL is 00466 * returned if no layers are currently visible in the view. 00467 * 00468 * @see getTopMostElement(LayerType) const, 00469 * getTopMostElement(const LocationType&) const, 00470 * getTopMostElement(LayerType, const LocationType&) const, 00471 * getTopMostElement(const std::string&) const, 00472 * getTopMostLayer() const 00473 */ 00474 virtual DataElement* getTopMostElement() const = 0; 00475 00476 /** 00477 * Returns the data element of the top-most layer of a given type. 00478 * 00479 * @param layerType 00480 * The type of layer for which to get the element. 00481 * 00482 * @return A pointer to the data element being displayed by the top-most 00483 * visible layer of the given type. \c NULL is returned if no 00484 * layers of the given type are currently visible in the view. 00485 * 00486 * @see getTopMostElement() const, 00487 * getTopMostElement(const LocationType&) const, 00488 * getTopMostElement(LayerType, const LocationType&) const, 00489 * getTopMostElement(const std::string&) const 00490 */ 00491 virtual DataElement* getTopMostElement(LayerType layerType) const = 0; 00492 00493 /** 00494 * Returns the data element of the top-most layer at a given pixel 00495 * coordinate regardless of layer type. 00496 * 00497 * @param worldCoord 00498 * The pixel coordinate in world coordinates. 00499 * 00500 * @return A pointer to the data element being displayed by the top-most 00501 * displayed layer in the view whose extents include the given 00502 * pixel coordinate. \c NULL is returned if no layers are 00503 * currently visible in the view whose extents include the given 00504 * pixel coordinate. 00505 * 00506 * @see getTopMostElement() const, 00507 * getTopMostElement(LayerType) const, 00508 * getTopMostElement(LayerType, const LocationType&) const, 00509 * getTopMostElement(const std::string&) const 00510 */ 00511 virtual DataElement* getTopMostElement(const LocationType& worldCoord) const = 0; 00512 00513 /** 00514 * Returns the data element of the top-most layer of a given type at a given 00515 * pixel coordinate. 00516 * 00517 * @param layerType 00518 * The type of layer for which to get the element. 00519 * @param worldCoord 00520 * The pixel coordinate in world coordinates. 00521 * 00522 * @return A pointer to the data element being displayed by the top-most 00523 * displayed layer of the given type in the view whose extents 00524 * include the given pixel coordinate. \c NULL is returned if no 00525 * layers of the given type are currently visible in the view whose 00526 * extents include the given pixel coordinate. 00527 * 00528 * @see getTopMostElement() const, 00529 * getTopMostElement(LayerType) const, 00530 * getTopMostElement(const LocationType&) const, 00531 * getTopMostElement(const std::string&) const 00532 */ 00533 virtual DataElement* getTopMostElement(LayerType layerType, const LocationType& worldCoord) const = 0; 00534 00535 /** 00536 * Returns the data element the top-most layer displaying an element of the 00537 * given type. 00538 * 00539 * @param elementType 00540 * The element type corresponding the to class name of element for 00541 * which to get the data element being displayed by the top-most 00542 * layer. Subclass element types are also checked. 00543 * 00544 * @return A pointer to the data element being displayed by the top-most 00545 * layer that displays an element of the given type. \c NULL is 00546 * returned if no layers displaying an element of the given type 00547 * are currently visible in the view. 00548 * 00549 * @see getTopMostElement() const, 00550 * getTopMostElement(LayerType) const, 00551 * getTopMostElement(const LocationType&) const, 00552 * getTopMostElement(LayerType, const LocationType&) const, 00553 * TypeConverter::toString() 00554 */ 00555 virtual DataElement* getTopMostElement(const std::string& elementType) const = 0; 00556 00557 /** 00558 * Enables an existing layer to be edited with the mouse. 00559 * 00560 * This method sets the layer that will be edited with the mouse if the 00561 * "LayerMode" mouse mode is active. The active layer is maintained when 00562 * the "LayerMode" mouse mode is not active. 00563 * 00564 * @param pLayer 00565 * The layer to activate, which must be able to accept mouse 00566 * events or \b NULL to set no layer as active. If the given 00567 * layer is not present in this view, this method does nothing. 00568 * 00569 * @notify This method will notify signalLayerActivated() if the active 00570 * layer is successfully set. 00571 * 00572 * @see getTopMostLayer(), setMouseMode() 00573 */ 00574 virtual void setActiveLayer(Layer* pLayer) = 0; 00575 00576 /** 00577 * Returns the layer that is edited with the mouse. 00578 * 00579 * @return The active layer that receives mouse events when the 00580 * "LayerMode" mouse mode is active. \b NULL is returned if an 00581 * active layer has not yet been set on the view. 00582 * 00583 * @see setActiveLayer() 00584 */ 00585 virtual Layer* getActiveLayer() const = 0; 00586 00587 /** 00588 * Moves an existing layer to the top position of the display order. 00589 * 00590 * This method moves the given layer to the top of the display order. If the 00591 * given layer is already the top layer in the display, its position does 00592 * not change. Layers in the top position may obscur other layers on the display. 00593 * 00594 * @param pLayer 00595 * The layer to set as the top layer. The layer must be included in the 00596 * layer list. Cannot be NULL. 00597 * 00598 * @return TRUE is the layer was successfully repositioned to the top of the 00599 * display order. FALSE if the layer does not exist in the layer list 00600 * or an error occurred. 00601 * 00602 * @see bringLayerForward() 00603 * 00604 * @notify This method will notify signalLayerDisplayIndexesChanged(). 00605 */ 00606 virtual bool setFrontLayer(Layer* pLayer) = 0; 00607 00608 /** 00609 * Moves an existing layer to the bottom position of the display order. 00610 * 00611 * This method moves the given layer to the bottom of the display order. If the 00612 * given layer is already the bottom layer in the display, its position does 00613 * not change. Layers in the bottom position may be obscurred by other layers 00614 * on the display. 00615 * 00616 * @param pLayer 00617 * The layer to set as the bottom layer. The layer must be included in 00618 * the layer list. Cannot be NULL. 00619 * 00620 * @return TRUE is the layer was successfully repositioned to the bottom of the 00621 * display order. FALSE if the layer does not exist in the layer list 00622 * or an error occurred. 00623 * 00624 * @see sendLayerBackward() 00625 * 00626 * @notify This method will notify signalLayerDisplayIndexesChanged(). 00627 */ 00628 virtual bool setBackLayer(Layer* pLayer) = 0; 00629 00630 /** 00631 * Moves an existing layer up one position in the display order. 00632 * 00633 * This method increases the display order of an existing layer by one position. 00634 * If the given layer is already the top layer in the display, its position does 00635 * not change. 00636 * 00637 * @param pLayer 00638 * The layer to reposition. The layer must be included in the layer 00639 * list. Cannot be NULL. 00640 * 00641 * @return TRUE is the layer was successfully repositioned in the display order. 00642 * FALSE if the layer does not exist in the layer list or an error 00643 * occurred. 00644 * 00645 * @see setFrontLayer() 00646 * 00647 * @notify This method will notify signalLayerDisplayIndexesChanged(). 00648 */ 00649 virtual bool bringLayerForward(Layer* pLayer) = 0; 00650 00651 /** 00652 * Moves an existing layer down one position in the display order. 00653 * 00654 * This method decreases the display order of an existing layer by one position. 00655 * If the given layer is already the bottom layer in the display, its position does 00656 * not change. 00657 * 00658 * @param pLayer 00659 * The layer to reposition. The layer must be included in the layer 00660 * list. Cannot be NULL. 00661 * 00662 * @return TRUE is the layer was successfully repositioned in the display order. 00663 * FALSE if the layer does not exist in the layer list or an error 00664 * occurred. 00665 * 00666 * @see setBackLayer() 00667 * 00668 * @notify This method will notify signalLayerDisplayIndexesChanged(). 00669 */ 00670 virtual bool sendLayerBackward(Layer* pLayer) = 0; 00671 00672 /** 00673 * Sets the display order for the given layer. 00674 * 00675 * This method sets the layer z-order of a currently displayed layer. If the given 00676 * layer is hidden, it is automatically shown. 00677 * 00678 * @param pLayer 00679 * The layer for which to set the display index. The layer must be included 00680 * in the layer list. Cannot be NULL. 00681 * @param iIndex 00682 * The new zero-based display index for the layer. A display index of 0 is 00683 * the topmost layer. 00684 * 00685 * @return TRUE if the layer order was successfully set. FALSE if the layer does not 00686 * exist in the layer list or an error occurred. 00687 * 00688 * @notify This method will notify signalLayerDisplayIndexesChanged(). 00689 */ 00690 virtual bool setLayerDisplayIndex(Layer* pLayer, int iIndex) = 0; 00691 00692 /** 00693 * Returns the display index for the given layer. 00694 * 00695 * This method returns an index value representing the layer z-order in the displayed 00696 * layers. The topmost layer has a display order of 0, and pixels drawn in this may 00697 * obscure those in lower layers. 00698 * 00699 * @param pLayer 00700 * The layer for which to get its current display index. 00701 * 00702 * @return The zero-based layer index representing the z-order value. A value of -1 00703 * is returned if the layer is not displayed or if the layer does not exist 00704 * in the layer list. 00705 */ 00706 virtual int getLayerDisplayIndex(Layer* pLayer) const = 0; 00707 00708 /** 00709 * Deletes a layer in the view. 00710 * 00711 * This method removes the given layer from the view and deletes it. It 00712 * also deletes its corresponding data element only if no other layers 00713 * are currently displaying the same element. 00714 * 00715 * @param pLayer 00716 * The layer in the view to delete. Cannot be NULL. 00717 * 00718 * @return TRUE is the layer was successfully removed and deleted from 00719 * the view, otherwise FALSE. 00720 * 00721 * @see clear() 00722 */ 00723 virtual bool deleteLayer(Layer* pLayer) = 0; 00724 00725 /** 00726 * Deletes all layers in the view. 00727 */ 00728 virtual void clear() = 0; 00729 00730 /** 00731 * Clears all analyst markings on the view. The resulting view is as if 00732 * the RasterElement had just been loaded. This action cannot be undone. 00733 */ 00734 virtual void clearMarkings() = 0; 00735 00736 /** 00737 * Toggles the display of the origin location marker in the view. 00738 * 00739 * @param display 00740 * Set this value to \c true to display the origin location marker 00741 * in the view or to \c false to hide the origin marker. 00742 * 00743 * @see isOriginDisplayed() 00744 */ 00745 virtual void displayOrigin(bool display) = 0; 00746 00747 /** 00748 * Queries whether the origin location marker is displayed in the view. 00749 * 00750 * @return Returns \c true if the origin location marker is currently 00751 * displayed in the view. Returns \c false if the origin is 00752 * currently hidden. 00753 * 00754 * @see displayOrigin() 00755 */ 00756 virtual bool isOriginDisplayed() const = 0; 00757 00758 /** 00759 * Toggles the display of the orientation axis in the upper left corner of 00760 * the view. 00761 * 00762 * @param display 00763 * Set this value to \c true to display the orientation axis in the 00764 * view or to \c false to hide the axis. 00765 * 00766 * @see isAxisDisplayed() 00767 */ 00768 virtual void displayAxis(bool display) = 0; 00769 00770 /** 00771 * Queries whether the orientation axis is displayed in the view. 00772 * 00773 * @return Returns \c true if the orientation axis is currently displayed 00774 * in the view. Returns \c false if the axis is currently hidden. 00775 * 00776 * @see displayAxis() 00777 */ 00778 virtual bool isAxisDisplayed() const = 0; 00779 00780 /** 00781 * Retrieves 2D image data for a displayed layer. 00782 * 00783 * @param pLayer 00784 * The layer for which to get an image. 00785 * @param pImage 00786 * A pointer to the layer image pixel data. 00787 * @param iWidth 00788 * The number of pixel columns in the layer image. 00789 * @param iHeight 00790 * The number of pixel rows in the layer image. 00791 * @param iDepth 00792 * The number of bits per pixel in the layer image. 00793 * @param iNumColors 00794 * The number of colors present in the layer image. This is not the 00795 * total number of available colors specified by the depth. 00796 * @param transparent 00797 * A reference to a color that is populated with the color value that 00798 * is used to represent transparent pixels in the image. Transparent 00799 * pixels are those pixels within the layer extents that do not contain 00800 * valid layer data. If a valid color is passed in, this will be used as 00801 * the transparency color. 00802 * @param bbox 00803 * An integer array that is populated with the extents of the layer in 00804 * screen pixels. 00805 * 00806 * @return TRUE if the layer image was successfully retrieved, otherwise FALSE. 00807 */ 00808 virtual bool getLayerImage(Layer* pLayer, unsigned char*& pImage, int& iWidth, int& iHeight, 00809 int& iDepth, int& iNumColors, ColorType& transparent, int bbox[4]) = 0; 00810 00811 /** 00812 * Retrieves 2D image data for a displayed layer. 00813 * 00814 * @param pLayer 00815 * The layer for which to get an image. 00816 * @param image 00817 * The QImage which will contain the layer image. The state of this object will be reset. 00818 * @param transparent 00819 * A reference to a color that is populated with the color value that 00820 * is used to represent transparent pixels in the image. Transparent 00821 * pixels are those pixels within the layer extents that do not contain 00822 * valid layer data. If a valid color is passed in, this will be used as 00823 * the transparency color. 00824 * @param bbox 00825 * Contains layer extents for drawing. 00826 * - This parameter is used as input if the layer is not currently displayed. 00827 * When used as input, the values are interpreted as follows: 00828 * - bbox[0] The width of the image 00829 * - bbox[1] The height of the image 00830 * - bbox[2] Ignored 00831 * - bbox[3] Ignored 00832 * - When the method returns this parameter is populated with the bounding box of the drawn portion of the layer. 00833 * - bbox[0] Minimum X 00834 * - bbox[1] Minimum Y 00835 * - bbox[2] Maximum X 00836 * - bbox[3] Maximum Y 00837 * 00838 * @return \c True if the layer image was successfully retrieved, otherwise \c false. 00839 */ 00840 virtual bool getLayerImage(Layer* pLayer, QImage &image, ColorType& transparent, int bbox[4]) = 0; 00841 00842 /** 00843 * Sets the type of limit on panning the view. 00844 * 00845 * This method sets how panning will be limited within the view. 00846 * 00847 * @param eType 00848 * The type of panning limit for the view. 00849 * 00850 * @see PanLimitType, getPanLimit() 00851 */ 00852 virtual void setPanLimit(PanLimitType eType) = 0; 00853 00854 /** 00855 * Returns the current type of limit on panning in the view. 00856 * 00857 * This method returns how panning is currently limited within the view. 00858 * 00859 * @return The type of panning limit for the view. 00860 * 00861 * @see PanLimitType, setPanLimit() 00862 */ 00863 virtual PanLimitType getPanLimit() const = 0; 00864 00865 /** 00866 * Sets the limits for the minimum zoom. 00867 * 00868 * This method sets the minimum zoom which is the ratio of the 00869 * scene extents to the current view size, e.g., a value of 0.5 00870 * would limit zooming out such that the scene would fill no less 00871 * than one half of the view's shortest dimension. 00872 * 00873 * A value of 0 will disable the minimum zoom limit. 00874 * 00875 * @param dMinZoom 00876 * The ratio of the scene extents to the current view size. 00877 * 00878 * @see getMinimumZoom() 00879 */ 00880 virtual void setMinimumZoom(double dMinZoom) = 0; 00881 00882 /** 00883 * Returns the current minimum zoom 00884 * 00885 * This method returns the current minimum zoom. 00886 * 00887 * @return The current minimum zoom. 00888 * 00889 * @see setMinimumZoom() 00890 */ 00891 virtual double getMinimumZoom() const = 0; 00892 00893 /** 00894 * Sets the limits for the maximum zoom. 00895 * 00896 * This method sets the maximum zoom which is defined as the minimum number 00897 * of scene pixels that are visible in the view in the shortest view dimension, 00898 * e.g., a value of 1.5 would limit zooming in such that one and a half scene 00899 * pixels would fill the view in the shortest dimension. 00900 * 00901 * A value of 0 will disable the maximum zoom limit. 00902 * 00903 * @param dMaxZoom 00904 * The maximum zoom. 00905 * 00906 * @see getMaximumZoom() 00907 */ 00908 virtual void setMaximumZoom(double dMaxZoom) = 0; 00909 00910 /** 00911 * Returns the current maximum zoom 00912 * 00913 * This method returns the current maximum zoom. 00914 * 00915 * @return The current maximum zoom. 00916 * 00917 * @see setMaximumZoom() 00918 */ 00919 virtual double getMaximumZoom() const = 0; 00920 00921 /** 00922 * Creates a new animation attached to the primary raster layer. 00923 * 00924 * This method creates a frame-based animation in the view's animation 00925 * controller that is attached to the primary raster layer so that the 00926 * displayed bands are automatically updated when the animation is played. 00927 * 00928 * The animation name is set to the primary raster layer name. If the 00929 * primary raster layer already contains an animation, a new animation is 00930 * not created. 00931 * 00932 * An animation controller is created if the view does not already have an 00933 * associated animation controller. If the view already has an animation 00934 * controller that is time-based and it is empty, the controller will be 00935 * deleted and a new frame-based controller will be created with the same 00936 * name as the view. If the existing time-based controller is not empty, a 00937 * new animation is not created. 00938 * 00939 * If the animation is successfully created, the animation controller is 00940 * activated on the animation toolbar, and the toolbar is displayed if 00941 * necessary. 00942 * 00943 * @return A pointer to the created Animation for the primary raster 00944 * layer. \b NULL is returned if there is no primary raster 00945 * layer, or if the animation could not be created. 00946 * 00947 * @notify This method may notify 00948 * AnimationServices::signalControllerCreated() with 00949 * boost::any<AnimationController*> if the animation controller 00950 * for the view needs to be created and may also notify 00951 * AnimationToolBar::signalControllerChanged() with 00952 * boost::any<AnimationController*> if the controller is 00953 * successfully activated on the animation toolbar. 00954 * 00955 * @see getAnimationController(), RasterLayer::getAnimation() 00956 */ 00957 virtual Animation* createDefaultAnimation() = 0; 00958 00959 /** 00960 * Resets the stretch type, units, values, and displayed band(s) 00961 * for all channels in all visible raster layers back to those used when the layer was created. 00962 * 00963 * @notify This method may notify the same signals as RasterLayer::resetStretch() for each visible RasterLayer. 00964 * 00965 * @see RasterLayer::resetStretch() 00966 */ 00967 virtual void resetStretch() = 0; 00968 00969 protected: 00970 /** 00971 * This should be destroyed by calling DesktopServices::deleteView. 00972 */ 00973 virtual ~SpatialDataView() {} 00974 }; 00975 00976 /** 00977 * \cond INTERNAL 00978 * This template specialization is required to allow this type to be put into a DataVariant. 00979 */ 00980 template <> class VariantTypeValidator<PanLimitType> {}; 00981 /// \endcond 00982 00983 #endif