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. More...
 

Signals

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

Public Member Functions

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

Protected Member Functions

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

Private Slots

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

Private Member Functions

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

Private Attributes

MosaicSceneWidgetm_scene
 
geos::geom::MultiPolygon * m_mp
 This item's multipolygon in the 0/360 longitude domain. More...
 
geos::geom::MultiPolygon * m_180mp
 This item's multipolygon in the -180/180 longitude domain. More...
 
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

◆ 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

◆ 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(), Isis::Cube::read(), and Isis::Brick::SetBasePosition().

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::Statistics::AddData(), Isis::Stretch::AddPair(), Isis::BufferManager::begin(), Isis::Statistics::BestMaximum(), Isis::Statistics::BestMinimum(), 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().

◆ 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()

◆ 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().

◆ 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

◆ 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_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().


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