Isis Developer 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

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:
 

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

Member Enumeration Documentation

◆ ShapeType

Enumerator
Dem 
Basemap 
Unprojected 
Unknown 

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

References cube().

◆ 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

◆ 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

◆ ~Shape()

Isis::Shape::~Shape ( )

Clean up this shape.

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

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

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

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.

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

◆ cube()

Cube * Isis::Shape::cube ( )

Get the Cube * associated with this display property.

This will allocate the Cube * if one is not already present.

References _FILEINFO_, and Isis::IException::Programmer.

Referenced by Isis::ControlPointEditWidget::createControlPoint(), deleteFromDisk(), and Shape().

◆ deleteFromDisk()

void Isis::Shape::deleteFromDisk ( )

Delete the shape data from disk.

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

References _FILEINFO_, closeCube(), cube(), Isis::Cube::externalCubeFileName(), Isis::IException::Io, 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.

Referenced by 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.

◆ 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

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

Referenced by Isis::ControlPointEditWidget::createControlPoint(), and Isis::ProjectItem::setShape().

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

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

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

References _FILEINFO_, displayProperties(), Isis::DisplayProperties::fromPvl(), and Isis::IException::Unknown.

◆ id()

QString Isis::Shape::id ( ) const

Get a unique, identifying string associated with this shape.

Returns
A unique ID for this shape

Referenced by Isis::CubeDnView::save().

◆ 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

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

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

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

References Isis::Cube::label(), 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

◆ 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

◆ 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

◆ 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

◆ radiusSource()

◆ 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

◆ 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

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

◆ setId()

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

Override the automatically generated ID with the given ID.

◆ shapeType()

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

◆ surfacePointSource()

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

References displayProperties(), 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

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


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