Isis 3 Programmer Reference
Isis::Shape Class Reference

This represents a shape in a project-based GUI interface. More...

#include <Shape.h>

Inheritance diagram for Isis::Shape:
Inheritance graph
Collaboration diagram for Isis::Shape:
Collaboration graph

Classes

class  XmlHandler
 

Public Types

enum  ShapeType { Dem , Basemap , Unprojected , Unknown }
 

Public Slots

void updateFileName (Project *)
 Change the on-disk file name for this cube to be where the shape ought to be in the given project.
 

Public Member Functions

 Shape (QString shapeFileName, QObject *parent=0)
 Create an Shape from a cube file on disk.
 
 Shape (Cube *shapeCube, QObject *parent=0)
 Create an shape from a cube file on disk.
 
 Shape (FileName shapeFolder, XmlStackedHandlerReader *xmlReader, QObject *parent=0)
 Construct this shape from XML.
 
 ~Shape ()
 Clean up this shape.
 
void fromPvl (const PvlObject &pvl)
 Read the shape settings from a Pvl.
 
PvlObject toPvl () const
 Convert this Shape to PVL.
 
bool isFootprintable () const
 Test to see if it's possible to create a footprint from this shape.
 
Cubecube ()
 Get the Cube * associated with this display property.
 
void closeCube ()
 Cleans up the Cube *.
 
ControlPoint::SurfacePointSource::Source surfacePointSource ()
 
ControlPoint::RadiusSource::Source radiusSource ()
 
ShapeDisplayPropertiesdisplayProperties ()
 Get the display (GUI) properties (information) associated with this shape.
 
ShapeType shapeType ()
 
const ShapeDisplayPropertiesdisplayProperties () const
 Get a non-mutable (const) the display (GUI) properties (information) associated with this shape.
 
QString fileName () const
 Get the file name of the cube that this shape represents.
 
QString serialNumber ()
 Get the serial number.
 
geos::geom::MultiPolygon * footprint ()
 Get the footprint of this shape (if available).
 
const geos::geom::MultiPolygon * footprint () const
 Get the non-mutable (const) footprint of this shape (if available).
 
void setId (QString id)
 Override the automatically generated ID with the given ID.
 
bool initFootprint (QMutex *cameraMutex)
 Calculate a footprint for this shape.
 
double aspectRatio () const
 Get the aspect ratio of this shape, as calculated and attached by camstats.
 
QString id () const
 Get a unique, identifying string associated with this shape.
 
double resolution () const
 Get the resolution of this shape, as calculated and attached by camstats.
 
Angle emissionAngle () const
 Get the emission angle of this shape, as calculated and attached by camstats.
 
Angle incidenceAngle () const
 Get the incidence angle of this shape, as calculated and attached by camstats.
 
double lineResolution () const
 Get the line resolution of this shape, as calculated and attached by camstats.
 
Distance localRadius () const
 Get the local radius of this shape, as calculated and attached by camstats.
 
Angle northAzimuth () const
 Get the north azimuth of this shape, as calculated and attached by camstats.
 
Angle phaseAngle () const
 Get the phase angle of this shape, as calculated and attached by camstats.
 
double sampleResolution () const
 Get the sample resolution of this shape, as calculated and attached by camstats.
 
void copyToNewProjectRoot (const Project *project, FileName newProjectRoot)
 Copy the cub/ecub files associated with this shape into the new project.
 
void deleteFromDisk ()
 Delete the shape data from disk.
 
void save (QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
 Output format:
 

Private Member Functions

 Shape (const Shape &other)
 
Shapeoperator= (const Shape &rhs)
 
void initMemberData ()
 
void initShape ()
 
void initCamStats ()
 TODO.
 
void initMapStats ()
 
void initDemStats ()
 
geos::geom::MultiPolygon * createFootprint (QMutex *cameraMutex)
 Calculate a footprint for an Shape using the camera or projection information.
 
void initQuickFootprint ()
 

Private Attributes

SpiceInt * m_bodyCode
 The NaifBodyCode value, if it exists in the labels.
 
Cubem_cube
 The cube associated with this Shape.
 
ControlPoint::SurfacePointSource::Source m_surfacePointSource
 
ControlPoint::RadiusSource::Source m_radiusSource
 
ShapeType m_shapeType
 
ShapeDisplayPropertiesm_displayProperties
 The GUI information for how this Shape ought to be displayed.
 
QString m_fileName
 The on-disk file name of the cube associated with this Shape.
 
QString m_serialNumber
 This will always be simply the filename and is created on construction.
 
QString m_instrumentId
 Instrument id associated with this Shape.
 
QString m_spacecraftName
 Spacecraft name associated with this Shape.
 
geos::geom::MultiPolygon * m_footprint
 A 0-360 ocentric lon,lat degrees footprint of this Shape.
 
QUuid * m_id
 A unique ID for this Shape (useful for others to reference this Shape when saving to disk).
 
double m_aspectRatio
 
double m_resolution
 
Angle m_emissionAngle
 
Angle m_incidenceAngle
 
double m_lineResolution
 
Distance m_localRadius
 
Angle m_northAzimuth
 
Angle m_phaseAngle
 
double m_sampleResolution
 
QString m_targetName
 
QString m_projectionName
 
Longitude m_centerLongitude
 
Latitude m_centerLatitude
 
Latitude m_minimumLatitude
 
Latitude m_maximumLatitude
 
Longitude m_minimumLongitude
 
Longitude m_maximumLongitude
 
double m_pixelResolution
 
double m_scale
 
Distance m_minimumRadius
 
Distance m_maximumRadius
 

Detailed Description

This represents a shape in a project-based GUI interface.

The actual cube doesn't have to be open. This encapsulates ideas about an shape such as it's footprint, it's cube, how it should be viewed, where it is on disk, etc. This class is designed to be semi-light weight - we should be able to have tens of thousands of these in memory without any issues (provided the Cube files aren't open - see closeCube()).

Author
2016-07-25 Tracie Sucharski
History

2016-10-21 Tracie Sucharski - Add Image to the Shape class. This was done because the qmos class expect Images, and we want to display a footprint of a Shape.

2018-09-10 Tracie Sucharski - Added surface point source and radius source along with access methods.

2018-09-21 Tracie Sucharski - Serial number is composed on construction and is always the filename.

2018-10-03 Tracie Sucharski - Fixed problem in constructor with cube being set before member data was initialized. Fixed the computation for surfacePointSource and radiusSource. References #5504.

Definition at line 68 of file Shape.h.

Member Enumeration Documentation

◆ ShapeType

enum Isis::Shape::ShapeType

Definition at line 71 of file Shape.h.

Constructor & Destructor Documentation

◆ Shape() [1/3]

Isis::Shape::Shape ( QString imageFileName,
QObject * parent = 0 )
explicit

Create an Shape from a cube file on disk.

Parameters
ShapeFileNameThe name of a cube on disk - /work/users/.../blah.cub
parentThe Qt-relationship parent

Definition at line 45 of file Shape.cpp.

References cube(), and m_fileName.

◆ Shape() [2/3]

Isis::Shape::Shape ( Cube * shapeCube,
QObject * parent = 0 )
explicit

Create an shape from a cube file on disk.

Parameters
shapeFileNameThe name of a cube on disk - /work/users/.../blah.cub
parentThe Qt-relationship parent

Definition at line 61 of file Shape.cpp.

References m_cube, and m_fileName.

◆ Shape() [3/3]

Isis::Shape::Shape ( FileName shapeFolder,
XmlStackedHandlerReader * xmlReader,
QObject * parent = 0 )

Construct this shape from XML.

Parameters
shapeFolderWhere this shape XML resides - /work/.../projectRoot/shapes/import1
xmlReaderAn XML reader that's up to an <shape> tag.
parentThe Qt-relationship parent

Definition at line 78 of file Shape.cpp.

◆ ~Shape()

Isis::Shape::~Shape ( )

Clean up this shape.

If you haven't saved this shape, all of its settings will be lost.

Definition at line 89 of file Shape.cpp.

References m_bodyCode, m_cube, m_displayProperties, m_footprint, and m_id.

Member Function Documentation

◆ aspectRatio()

double Isis::Shape::aspectRatio ( ) const

Get the aspect ratio of this shape, as calculated and attached by camstats.

Returns
The aspect ratio if available, otherwise Null

Definition at line 449 of file Shape.cpp.

◆ closeCube()

void Isis::Shape::closeCube ( )

Cleans up the Cube *.

You want to call this once you're sure you are done with the Cube because the OS will limit how many of these we have open.

Definition at line 342 of file Shape.cpp.

References m_cube.

Referenced by deleteFromDisk(), and updateFileName().

◆ copyToNewProjectRoot()

void Isis::Shape::copyToNewProjectRoot ( const Project * project,
FileName newProjectRoot )

Copy the cub/ecub files associated with this shape into the new project.

Definition at line 555 of file Shape.cpp.

References m_fileName, Isis::FileName::name(), Isis::Project::projectRoot(), Isis::FileName::setExtension(), Isis::Project::shapeDataRoot(), and Isis::FileName::toString().

◆ createFootprint()

geos::geom::MultiPolygon * Isis::Shape::createFootprint ( QMutex * cameraMutex)
private

Calculate a footprint for an Shape using the camera or projection information.

Parameters
cameraMutexA mutex that guarantees us serial access to the camera/projection classes
Returns
The resulting footprint

Definition at line 638 of file Shape.cpp.

References cube(), displayProperties(), Isis::Cube::lineCount(), Isis::PolygonTools::MakeMultiPolygon(), Isis::Cube::sampleCount(), and Isis::IException::User.

Referenced by initFootprint().

◆ cube()

◆ deleteFromDisk()

void Isis::Shape::deleteFromDisk ( )

Delete the shape data from disk.

The cube() will no longer be accessible until you call updateFileName().

Definition at line 591 of file Shape.cpp.

References closeCube(), cube(), Isis::Cube::externalCubeFileName(), Isis::IException::Io, m_fileName, Isis::FileName::path(), and Isis::FileName::setExtension().

Referenced by Isis::ShapeList::deleteFromDisk().

◆ displayProperties() [1/2]

ShapeDisplayProperties * Isis::Shape::displayProperties ( )

Get the display (GUI) properties (information) associated with this shape.

Returns
An ShapeDisplayProperties that describes how to view this shape.

Definition at line 355 of file Shape.cpp.

References m_displayProperties.

Referenced by createFootprint(), fromPvl(), initFootprint(), and toPvl().

◆ displayProperties() [2/2]

const ShapeDisplayProperties * Isis::Shape::displayProperties ( ) const

Get a non-mutable (const) the display (GUI) properties (information) associated with this shape.

Returns
A non-mutable ShapeDisplayProperties that describes how to view this shape.

Definition at line 366 of file Shape.cpp.

References m_displayProperties.

◆ emissionAngle()

Angle Isis::Shape::emissionAngle ( ) const

Get the emission angle of this shape, as calculated and attached by camstats.

This is the shape-wide average.

Returns
The emission angle if available, otherwise an invalid angle

Definition at line 481 of file Shape.cpp.

◆ fileName()

QString Isis::Shape::fileName ( ) const

Get the file name of the cube that this shape represents.

Returns
A string containing the path to the cube data associated with this shape.

Definition at line 376 of file Shape.cpp.

References m_fileName.

Referenced by Isis::ControlPointEditWidget::createControlPoint(), Isis::ControlPointEditWidget::loadPoint(), Isis::ControlPointEditWidget::setGroundSourceInfo(), Isis::ProjectItem::setShape(), Isis::ControlPointEditWidget::setShapesForPoint(), and Isis::Shape::XmlHandler::startElement().

◆ footprint() [1/2]

geos::geom::MultiPolygon * Isis::Shape::footprint ( )

Get the footprint of this shape (if available).

Returns
A lat/lon footprint of this shape, or NULL if unavailable.

Definition at line 394 of file Shape.cpp.

References m_footprint.

Referenced by Isis::Footprint2DView::onItemAdded(), and Isis::ImageFileListWidget::XmlHandler::startElement().

◆ footprint() [2/2]

const geos::geom::MultiPolygon * Isis::Shape::footprint ( ) const

Get the non-mutable (const) footprint of this shape (if available).

Returns
A non-mutable (const) lat/lon footprint of this shape, or NULL if unavailable.

Definition at line 412 of file Shape.cpp.

References m_footprint.

◆ fromPvl()

void Isis::Shape::fromPvl ( const PvlObject & pvl)

Read the shape settings from a Pvl.

  Object = Shape
    FileName = ...
    ID = ...
  EndObject
Parameters
pvlThe PvlObject that contains shape information.

Definition at line 236 of file Shape.cpp.

References displayProperties(), m_fileName, m_id, and Isis::IException::Unknown.

Referenced by Isis::ShapeReader::VariantToShapeFunctor::operator()().

◆ id()

QString Isis::Shape::id ( ) const

Get a unique, identifying string associated with this shape.

Returns
A unique ID for this shape

Definition at line 459 of file Shape.cpp.

References m_id.

Referenced by Isis::WorkOrder::listenForShapeDestruction(), and Isis::Footprint2DView::onItemAdded().

◆ incidenceAngle()

Angle Isis::Shape::incidenceAngle ( ) const

Get the incidence angle of this shape, as calculated and attached by camstats.

This is the shape-wide average.

Returns
The incidence angle if available, otherwise an invalid angle

Definition at line 492 of file Shape.cpp.

◆ initCamStats()

◆ initDemStats()

void Isis::Shape::initDemStats ( )
private

Definition at line 809 of file Shape.cpp.

◆ initFootprint()

bool Isis::Shape::initFootprint ( QMutex * cameraMutex)

Calculate a footprint for this shape.

If the footprint is already stored inside the cube, that will be used instead. If no footprint can be found, this throws an exception.

Definition at line 421 of file Shape.cpp.

References createFootprint(), Isis::DisplayProperties::displayName(), displayProperties(), Isis::IException::Io, and m_footprint.

Referenced by Isis::ShapeReader::VariantToShapeFunctor::operator()().

◆ initMapStats()

void Isis::Shape::initMapStats ( )
private

Definition at line 746 of file Shape.cpp.

◆ initMemberData()

void Isis::Shape::initMemberData ( )
private

Definition at line 109 of file Shape.cpp.

◆ initQuickFootprint()

void Isis::Shape::initQuickFootprint ( )
private

Definition at line 815 of file Shape.cpp.

◆ initShape()

void Isis::Shape::initShape ( )
private

Definition at line 129 of file Shape.cpp.

◆ isFootprintable()

bool Isis::Shape::isFootprintable ( ) const

Test to see if it's possible to create a footprint from this shape.

This may not give an accurate answer if the cube isn't open.

Definition at line 294 of file Shape.cpp.

References Isis::Cube::label(), m_cube, m_footprint, Isis::PvlObject::object(), Isis::ImagePolygon::toBlob(), and Isis::Blob::Type().

Referenced by Isis::Footprint2DViewWorkOrder::isExecutable().

◆ lineResolution()

double Isis::Shape::lineResolution ( ) const

Get the line resolution of this shape, as calculated and attached by camstats.

This is the shape-wide average.

Returns
The line resolution if available, otherwise Null

Definition at line 503 of file Shape.cpp.

◆ localRadius()

Distance Isis::Shape::localRadius ( ) const

Get the local radius of this shape, as calculated and attached by camstats.

This is the shape-wide average.

Returns
The local radius if available, otherwise an invalid Distance

Definition at line 514 of file Shape.cpp.

◆ northAzimuth()

Angle Isis::Shape::northAzimuth ( ) const

Get the north azimuth of this shape, as calculated and attached by camstats.

This is the shape-wide average.

Returns
The north azimuth if available, otherwise an invalid angle

Definition at line 525 of file Shape.cpp.

◆ phaseAngle()

Angle Isis::Shape::phaseAngle ( ) const

Get the phase angle of this shape, as calculated and attached by camstats.

This is the shape-wide average.

Returns
The phase angle if available, otherwise an invalid angle

Definition at line 536 of file Shape.cpp.

◆ radiusSource()

ControlPoint::RadiusSource::Source Isis::Shape::radiusSource ( )

Definition at line 214 of file Shape.cpp.

◆ resolution()

double Isis::Shape::resolution ( ) const

Get the resolution of this shape, as calculated and attached by camstats.

This is the shape-wide average.

Returns
The resolution if available, otherwise Null

Definition at line 470 of file Shape.cpp.

◆ sampleResolution()

double Isis::Shape::sampleResolution ( ) const

Get the sample resolution of this shape, as calculated and attached by camstats.

This is the shape-wide average.

Returns
The sample resolution if available, otherwise Null

Definition at line 547 of file Shape.cpp.

◆ save()

void Isis::Shape::save ( QXmlStreamWriter & stream,
const Project * project,
FileName newProjectRoot ) const

◆ serialNumber()

QString Isis::Shape::serialNumber ( )

Get the serial number.

Returns
SerialNumber The cube's serial number.

Definition at line 385 of file Shape.cpp.

References m_serialNumber.

Referenced by Isis::ControlNetTool::drawAllMeasurements().

◆ setId()

void Isis::Shape::setId ( QString id)

Override the automatically generated ID with the given ID.

Definition at line 402 of file Shape.cpp.

References m_id.

◆ shapeType()

Shape::ShapeType Isis::Shape::shapeType ( )

Definition at line 219 of file Shape.cpp.

◆ surfacePointSource()

ControlPoint::SurfacePointSource::Source Isis::Shape::surfacePointSource ( )

Definition at line 209 of file Shape.cpp.

◆ toPvl()

PvlObject Isis::Shape::toPvl ( ) const

Convert this Shape to PVL.

The output looks like this:

  Object = Shape
    FileName = ...
    ID = ...
  EndObject
Returns
A PvlObject that contains shape information.

Definition at line 268 of file Shape.cpp.

References displayProperties(), m_fileName, m_id, and Isis::DisplayProperties::toPvl().

◆ updateFileName

void Isis::Shape::updateFileName ( Project * project)
slot

Change the on-disk file name for this cube to be where the shape ought to be in the given project.

Parameters
projectThe project that this shape is stored in

Definition at line 622 of file Shape.cpp.

References closeCube(), Isis::FileName::dir(), m_fileName, Isis::FileName::name(), and Isis::Project::shapeDataRoot().

Member Data Documentation

◆ m_aspectRatio

double Isis::Shape::m_aspectRatio
private

Definition at line 203 of file Shape.h.

◆ m_bodyCode

SpiceInt* Isis::Shape::m_bodyCode
private

The NaifBodyCode value, if it exists in the labels.

Otherwise, if the target is sky, it's the SPK code and if not sky then it's calculated by the NaifBodyCode() method.

Definition at line 157 of file Shape.h.

Referenced by ~Shape().

◆ m_centerLatitude

Latitude Isis::Shape::m_centerLatitude
private

Definition at line 217 of file Shape.h.

◆ m_centerLongitude

Longitude Isis::Shape::m_centerLongitude
private

Definition at line 216 of file Shape.h.

◆ m_cube

Cube* Isis::Shape::m_cube
private

The cube associated with this Shape.

This is usually NULL once the shape is done initializing because no more than a thousand of these should ever be open at once.

Definition at line 168 of file Shape.h.

Referenced by closeCube(), cube(), isFootprintable(), Shape(), and ~Shape().

◆ m_displayProperties

ShapeDisplayProperties* Isis::Shape::m_displayProperties
private

The GUI information for how this Shape ought to be displayed.

Definition at line 176 of file Shape.h.

Referenced by displayProperties(), displayProperties(), save(), and ~Shape().

◆ m_emissionAngle

Angle Isis::Shape::m_emissionAngle
private

Definition at line 205 of file Shape.h.

◆ m_fileName

QString Isis::Shape::m_fileName
private

The on-disk file name of the cube associated with this Shape.

Definition at line 180 of file Shape.h.

Referenced by copyToNewProjectRoot(), cube(), deleteFromDisk(), fileName(), fromPvl(), initCamStats(), save(), Shape(), Shape(), toPvl(), and updateFileName().

◆ m_footprint

geos::geom::MultiPolygon* Isis::Shape::m_footprint
private

A 0-360 ocentric lon,lat degrees footprint of this Shape.

Definition at line 196 of file Shape.h.

Referenced by footprint(), footprint(), initFootprint(), isFootprintable(), save(), and ~Shape().

◆ m_id

QUuid* Isis::Shape::m_id
private

A unique ID for this Shape (useful for others to reference this Shape when saving to disk).

Definition at line 200 of file Shape.h.

Referenced by fromPvl(), id(), save(), setId(), toPvl(), and ~Shape().

◆ m_incidenceAngle

Angle Isis::Shape::m_incidenceAngle
private

Definition at line 206 of file Shape.h.

◆ m_instrumentId

QString Isis::Shape::m_instrumentId
private

Instrument id associated with this Shape.

Definition at line 188 of file Shape.h.

Referenced by initCamStats(), and save().

◆ m_lineResolution

double Isis::Shape::m_lineResolution
private

Definition at line 207 of file Shape.h.

◆ m_localRadius

Distance Isis::Shape::m_localRadius
private

Definition at line 208 of file Shape.h.

◆ m_maximumLatitude

Latitude Isis::Shape::m_maximumLatitude
private

Definition at line 219 of file Shape.h.

◆ m_maximumLongitude

Longitude Isis::Shape::m_maximumLongitude
private

Definition at line 221 of file Shape.h.

◆ m_maximumRadius

Distance Isis::Shape::m_maximumRadius
private

Definition at line 227 of file Shape.h.

◆ m_minimumLatitude

Latitude Isis::Shape::m_minimumLatitude
private

Definition at line 218 of file Shape.h.

◆ m_minimumLongitude

Longitude Isis::Shape::m_minimumLongitude
private

Definition at line 220 of file Shape.h.

◆ m_minimumRadius

Distance Isis::Shape::m_minimumRadius
private

Definition at line 226 of file Shape.h.

◆ m_northAzimuth

Angle Isis::Shape::m_northAzimuth
private

Definition at line 209 of file Shape.h.

◆ m_phaseAngle

Angle Isis::Shape::m_phaseAngle
private

Definition at line 210 of file Shape.h.

◆ m_pixelResolution

double Isis::Shape::m_pixelResolution
private

Definition at line 222 of file Shape.h.

◆ m_projectionName

QString Isis::Shape::m_projectionName
private

Definition at line 215 of file Shape.h.

◆ m_radiusSource

ControlPoint::RadiusSource::Source Isis::Shape::m_radiusSource
private

Definition at line 170 of file Shape.h.

◆ m_resolution

double Isis::Shape::m_resolution
private

Definition at line 204 of file Shape.h.

◆ m_sampleResolution

double Isis::Shape::m_sampleResolution
private

Definition at line 211 of file Shape.h.

◆ m_scale

double Isis::Shape::m_scale
private

Definition at line 223 of file Shape.h.

◆ m_serialNumber

QString Isis::Shape::m_serialNumber
private

This will always be simply the filename and is created on construction.

Definition at line 184 of file Shape.h.

Referenced by save(), and serialNumber().

◆ m_shapeType

ShapeType Isis::Shape::m_shapeType
private

Definition at line 171 of file Shape.h.

◆ m_spacecraftName

QString Isis::Shape::m_spacecraftName
private

Spacecraft name associated with this Shape.

Definition at line 192 of file Shape.h.

Referenced by initCamStats(), and save().

◆ m_surfacePointSource

ControlPoint::SurfacePointSource::Source Isis::Shape::m_surfacePointSource
private

Definition at line 169 of file Shape.h.

◆ m_targetName

QString Isis::Shape::m_targetName
private

Definition at line 214 of file Shape.h.


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