Isis 3 Programmer Reference
Isis::MosaicSceneItem Class Reference

A single cube in the mosaic scene. More...

#include <MosaicSceneItem.h>

Inheritance diagram for Isis::MosaicSceneItem:
Inheritance graph
Collaboration diagram for Isis::MosaicSceneItem:
Collaboration graph

Public Slots

void cubeDisplayChanged ()
 Someone changed something in the cube display properties, re-read the whole thing.
 

Signals

void colorChanged ()
 
void changed (const QList< QRectF > &)
 
void mosaicCubeClosed (Image *)
 

Public Member Functions

 MosaicSceneItem (Image *image, MosaicSceneWidget *parent)
 MosaicSceneItem constructor.
 
 ~MosaicSceneItem ()
 Mosaic Item destructor.
 
virtual QRectF boundingRect () const
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
 Re-paints the item.
 
QColor color () const
 
Imageimage ()
 
QGraphicsSimpleTextItem * getLabel () const
 
void reproject ()
 Called anytime the user reprojects the cube.
 
bool contains (const QPointF &) const
 Test if we contain the point.
 
void updateSelection (bool)
 Update the selected state.
 
void scenePropertiesChanged ()
 

Protected Member Functions

virtual bool sceneEvent (QEvent *event)
 This filters out events that happen within our polygons.
 
virtual void contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
 The user right clicked on us (or otherwise requested a context menu).
 

Private Slots

void lostCubeDisplay ()
 
void onCloseCube ()
 Emits a signal when Close Cube is selected from the context menu.
 

Private Member Functions

 MosaicSceneItem (const MosaicSceneItem &)
 cannot copy
 
MosaicSceneItemoperator= (const MosaicSceneItem &)
 cannot assign
 
void updateChildren ()
 This applies the displayProperties and selectability.
 
StretchgetStretch ()
 This gets a Stretch object that will work for the cubeDisplay converting from DN to screen pixel.
 
void setupFootprint ()
 
void drawImage (QPainter *painter, const QStyleOptionGraphicsItem *option)
 This method reads in and draws the image associated with this item.
 
double getPixelValue (int sample, int line)
 Returns the pixel value at the given sample/line.
 
void setupStretch ()
 

Private Attributes

MosaicSceneWidgetm_scene
 
geos::geom::MultiPolygon * m_mp
 This item's multipolygon in the 0/360 longitude domain.
 
geos::geom::MultiPolygon * m_180mp
 This item's multipolygon in the -180/180 longitude domain.
 
QList< QGraphicsPolygonItem * > * m_polygons
 
UniversalGroundMapgroundMap
 
Imagem_image
 
Stretchm_cubeDnStretch
 
bool m_showingLabel
 
bool m_ignoreCubeDisplayChanged
 
QGraphicsSimpleTextItem * m_label
 

Detailed Description

A single cube in the mosaic scene.

Author
????-??-?? Stacy Alley
History

2010-10-26 Tracie Sucharski - Added missing includes to cpp after removing includes from ControlNet.h.

2011-05-07 Steven Lambright - Refactored from MosaicItem to have far fewer responsibilities.

2011-05-10 Steven Lambright - Reduced the amount of useless code

2011-05-11 Steven Lambright - Reduced the amount of useless code, footprint is now gathered from the CubeDisplayProperties so duplicate work is not done.

2011-05-17 Steven Lambright - Labels auto-rotate by 90 degrees once again

2015-05-27 Kristin Berry - Updated to work with longitude domain = 180 correctly. Fixes #2208.

2016-05-18 Ian Humphrey - Explicitly made outlines cosmetic so that they always appear as 1 pixel wide on screen (Qt4 to Qt5).

2017-07-27 Makayla Shepherd - Fixed a segfault that occurred when closing a cube footprint. Fixes #5050.

Definition at line 47 of file MosaicSceneItem.h.

Constructor & Destructor Documentation

◆ MosaicSceneItem() [1/2]

◆ ~MosaicSceneItem()

Isis::MosaicSceneItem::~MosaicSceneItem ( )

Mosaic Item destructor.

Definition at line 103 of file MosaicSceneItem.cpp.

◆ MosaicSceneItem() [2/2]

Isis::MosaicSceneItem::MosaicSceneItem ( const MosaicSceneItem & )
private

cannot copy

Member Function Documentation

◆ boundingRect()

QRectF Isis::MosaicSceneItem::boundingRect ( ) const
virtual

Definition at line 113 of file MosaicSceneItem.cpp.

◆ color()

QColor Isis::MosaicSceneItem::color ( ) const

Definition at line 413 of file MosaicSceneItem.cpp.

◆ contains()

bool Isis::MosaicSceneItem::contains ( const QPointF & p) const

Test if we contain the point.

Even though our rect is empty, return true if a child polygon contains it for toolTips and other events.

Definition at line 494 of file MosaicSceneItem.cpp.

Referenced by sceneEvent().

◆ contextMenuEvent()

void Isis::MosaicSceneItem::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event)
protectedvirtual

◆ cubeDisplayChanged

void Isis::MosaicSceneItem::cubeDisplayChanged ( )
slot

Someone changed something in the cube display properties, re-read the whole thing.

Definition at line 423 of file MosaicSceneItem.cpp.

References Isis::Image::displayProperties(), Isis::DisplayProperties::getValue(), reproject(), Isis::ImageDisplayProperties::ShowLabel, updateChildren(), and updateSelection().

Referenced by MosaicSceneItem().

◆ drawImage()

void Isis::MosaicSceneItem::drawImage ( QPainter * painter,
const QStyleOptionGraphicsItem * option )
private

◆ getLabel()

QGraphicsSimpleTextItem * Isis::MosaicSceneItem::getLabel ( ) const
inline

Definition at line 60 of file MosaicSceneItem.h.

◆ getPixelValue()

double Isis::MosaicSceneItem::getPixelValue ( int sample,
int line )
private

Returns the pixel value at the given sample/line.

Parameters
sample
line
Returns
int

Definition at line 298 of file MosaicSceneItem.cpp.

References Isis::Image::cube(), Isis::Null, Isis::Cube::pixelType(), and Isis::Cube::read().

Referenced by drawImage().

◆ getStretch()

Stretch * Isis::MosaicSceneItem::getStretch ( )
private

This gets a Stretch object that will work for the cubeDisplay converting from DN to screen pixel.

The first time this is called the stretch is calculated, later calls re-use the original object. Ownership remains at the class scope.

Definition at line 691 of file MosaicSceneItem.cpp.

References Isis::Stretch::AddPair(), Isis::Image::cube(), Isis::Cube::read(), Isis::Stretch::SetHis(), Isis::Stretch::SetHrs(), Isis::Stretch::SetLis(), Isis::Stretch::SetLrs(), and Isis::Stretch::SetNull().

Referenced by drawImage().

◆ image()

Image * Isis::MosaicSceneItem::image ( )
inline

Definition at line 59 of file MosaicSceneItem.h.

◆ lostCubeDisplay

void Isis::MosaicSceneItem::lostCubeDisplay ( )
privateslot

Definition at line 606 of file MosaicSceneItem.cpp.

◆ onCloseCube

void Isis::MosaicSceneItem::onCloseCube ( )
privateslot

Emits a signal when Close Cube is selected from the context menu.

Definition at line 614 of file MosaicSceneItem.cpp.

Referenced by contextMenuEvent().

◆ operator=()

MosaicSceneItem & Isis::MosaicSceneItem::operator= ( const MosaicSceneItem & )
private

cannot assign

◆ paint()

void Isis::MosaicSceneItem::paint ( QPainter * painter,
const QStyleOptionGraphicsItem * option,
QWidget * widget = 0 )
virtual

Re-paints the item.

Parameters
painter
option
widget

Definition at line 140 of file MosaicSceneItem.cpp.

References Isis::Image::displayProperties(), drawImage(), Isis::DisplayProperties::getValue(), and Isis::ImageDisplayProperties::ShowDNs.

◆ reproject()

void Isis::MosaicSceneItem::reproject ( )

Called anytime the user reprojects the cube.

(Selects a new map file.) And everytime a mosaic item is created.

Definition at line 189 of file MosaicSceneItem.cpp.

References Isis::DisplayProperties::displayName(), Isis::Image::displayProperties(), Isis::DisplayProperties::getValue(), m_180mp, m_mp, Isis::ImageDisplayProperties::ShowLabel, Isis::PolygonTools::To180(), and updateChildren().

Referenced by cubeDisplayChanged(), and Isis::MosaicSceneWidget::reprojectItems().

◆ sceneEvent()

bool Isis::MosaicSceneItem::sceneEvent ( QEvent * event)
protectedvirtual

This filters out events that happen within our polygons.

This is necessary because usually events are filtered based on the bounding box alone.

Parameters
watched
event
Returns
bool

Definition at line 451 of file MosaicSceneItem.cpp.

References contains().

◆ scenePropertiesChanged()

void Isis::MosaicSceneItem::scenePropertiesChanged ( )
inline

Definition at line 66 of file MosaicSceneItem.h.

◆ setupFootprint()

void Isis::MosaicSceneItem::setupFootprint ( )
private

Definition at line 160 of file MosaicSceneItem.cpp.

◆ updateChildren()

void Isis::MosaicSceneItem::updateChildren ( )
private

This applies the displayProperties and selectability.

It's called updateChildren because the child items are the visually displayed items on the scene.

Definition at line 624 of file MosaicSceneItem.cpp.

References Isis::Image::displayProperties(), Isis::DisplayProperties::getValue(), Isis::ImageDisplayProperties::ShowFill, Isis::ImageDisplayProperties::ShowLabel, and Isis::ImageDisplayProperties::ShowOutline.

Referenced by cubeDisplayChanged(), and reproject().

◆ updateSelection()

void Isis::MosaicSceneItem::updateSelection ( bool save)

Update the selected state.

Parameters
saveTrue if we need to write to the DisplayProperties, false if we need to read from them.

Definition at line 516 of file MosaicSceneItem.cpp.

References Isis::Image::displayProperties(), Isis::DisplayProperties::getValue(), Isis::ImageDisplayProperties::Selected, and Isis::ImageDisplayProperties::setSelected().

Referenced by cubeDisplayChanged().

Member Data Documentation

◆ groundMap

UniversalGroundMap* Isis::MosaicSceneItem::groundMap
private

Definition at line 100 of file MosaicSceneItem.h.

◆ m_180mp

geos::geom::MultiPolygon* Isis::MosaicSceneItem::m_180mp
private

This item's multipolygon in the -180/180 longitude domain.

Definition at line 98 of file MosaicSceneItem.h.

Referenced by reproject().

◆ m_cubeDnStretch

Stretch* Isis::MosaicSceneItem::m_cubeDnStretch
private

Definition at line 109 of file MosaicSceneItem.h.

◆ m_ignoreCubeDisplayChanged

bool Isis::MosaicSceneItem::m_ignoreCubeDisplayChanged
private

Definition at line 112 of file MosaicSceneItem.h.

◆ m_image

Image* Isis::MosaicSceneItem::m_image
private

Definition at line 108 of file MosaicSceneItem.h.

◆ m_label

QGraphicsSimpleTextItem* Isis::MosaicSceneItem::m_label
private

Definition at line 114 of file MosaicSceneItem.h.

◆ m_mp

geos::geom::MultiPolygon* Isis::MosaicSceneItem::m_mp
private

This item's multipolygon in the 0/360 longitude domain.

Definition at line 97 of file MosaicSceneItem.h.

Referenced by MosaicSceneItem(), and reproject().

◆ m_polygons

QList< QGraphicsPolygonItem * >* Isis::MosaicSceneItem::m_polygons
private

Definition at line 99 of file MosaicSceneItem.h.

◆ m_scene

MosaicSceneWidget* Isis::MosaicSceneItem::m_scene
private

Definition at line 95 of file MosaicSceneItem.h.

◆ m_showingLabel

bool Isis::MosaicSceneItem::m_showingLabel
private

Definition at line 111 of file MosaicSceneItem.h.


The documentation for this class was generated from the following files: