Isis 3.0 Programmer Reference
Back | Home
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. More...
 

Public Member Functions

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

Private Member Functions

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

Private Attributes

SpiceInt * m_bodyCode
 The NaifBodyCode value, if it exists in the labels. More...
 
Cubem_cube
 The cube associated with this Shape. More...
 
ShapeType m_shapeType
 
ShapeDisplayPropertiesm_displayProperties
 The GUI information for how this Shape ought to be displayed. More...
 
QString m_fileName
 The on-disk file name of the cube associated with this Shape. More...
 
QString m_instrumentId
 Instrument id associated with this Shape. More...
 
QString m_spacecraftName
 Spacecraft name associated with this Shape. More...
 
geos::geom::MultiPolygon * m_footprint
 A 0-360 ocentric lon,lat degrees footprint of this Shape. More...
 
QUuid * m_id
 A unique ID for this Shape (useful for others to reference this Shape when saving to disk). More...
 
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.

Definition at line 70 of file Shape.h.

Constructor & Destructor Documentation

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 43 of file Shape.cpp.

References cube(), and m_fileName.

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 59 of file Shape.cpp.

References Isis::Cube::fileName(), m_cube, and m_fileName.

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 76 of file Shape.cpp.

Isis::Shape::~Shape ( )

Clean up this shape.

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

Definition at line 87 of file Shape.cpp.

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

Member Function Documentation

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 407 of file Shape.cpp.

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 300 of file Shape.cpp.

References m_cube.

Referenced by deleteFromDisk(), Isis::ImportShapesWorkOrder::importConfirmedShapes(), and updateFileName().

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 513 of file Shape.cpp.

References Isis::Cube::externalCubeFileName(), m_fileName, Isis::FileName::path(), Isis::Project::projectRoot(), and Isis::Project::shapeDataRoot().

Referenced by Isis::ShapeList::CopyShapeDataFunctor::operator()().

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 596 of file Shape.cpp.

References _FILEINFO_, Isis::ImagePolygon::Create(), cube(), displayProperties(), Isis::Cube::lineCount(), Isis::PolygonTools::MakeMultiPolygon(), Isis::ImagePolygon::Polys(), Isis::IException::print(), Isis::Cube::sampleCount(), and Isis::IException::User.

Referenced by initFootprint().

Cube * Isis::Shape::cube ( )

Get the Cube * associated with this display property.

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

Definition at line 282 of file Shape.cpp.

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

Referenced by createFootprint(), deleteFromDisk(), initCamStats(), Isis::Footprint2DView::onItemAdded(), Isis::CubeDnView::onItemAdded(), serialNumber(), and Shape().

void Isis::Shape::deleteFromDisk ( )

Delete the shape data from disk.

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

Definition at line 549 of file Shape.cpp.

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

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

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 313 of file Shape.cpp.

References m_displayProperties.

Referenced by createFootprint(), fromPvl(), Isis::ImportShapesWorkOrder::importConfirmedShapes(), initFootprint(), and toPvl().

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 324 of file Shape.cpp.

References m_displayProperties.

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 439 of file Shape.cpp.

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 334 of file Shape.cpp.

References m_fileName.

Referenced by Isis::ProjectItem::setShape(), and Isis::Shape::XmlHandler::startElement().

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 352 of file Shape.cpp.

References m_footprint.

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 370 of file Shape.cpp.

References m_footprint.

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 193 of file Shape.cpp.

References _FILEINFO_, displayProperties(), Isis::PvlObject::findObject(), Isis::PvlObject::hasKeyword(), m_fileName, m_id, and Isis::IException::Unknown.

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

QString Isis::Shape::id ( ) const

Get a unique, identifying string associated with this shape.

Returns
A unique ID for this shape

Definition at line 417 of file Shape.cpp.

References m_id.

Referenced by Isis::ImportShapesWorkOrder::importConfirmedShapes(), and Isis::WorkOrder::listenForShapeDestruction().

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 450 of file Shape.cpp.

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 379 of file Shape.cpp.

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

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

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 251 of file Shape.cpp.

References Isis::PvlObject::hasKeyword(), Isis::PvlContainer::isNamed(), Isis::Cube::label(), m_cube, m_footprint, Isis::Blob::Name(), Isis::PvlObject::object(), Isis::PvlObject::objects(), and Isis::Blob::Type().

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

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 461 of file Shape.cpp.

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 472 of file Shape.cpp.

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 483 of file Shape.cpp.

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 494 of file Shape.cpp.

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 428 of file Shape.cpp.

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 505 of file Shape.cpp.

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

Output format:

<shape id="..." filename="..."> ... </shape>

(fileName attribute is just the base name)

Definition at line 800 of file Shape.cpp.

References Isis::IsSpecial(), Isis::Angle::isValid(), Isis::Distance::isValid(), m_displayProperties, m_fileName, m_footprint, m_id, m_instrumentId, m_spacecraftName, Isis::Distance::meters(), Isis::Angle::radians(), and Isis::ShapeDisplayProperties::save().

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

QString Isis::Shape::serialNumber ( )

Get the serial number.

Returns
SerialNumber The cube's serial number.

Definition at line 343 of file Shape.cpp.

References Isis::SerialNumber::Compose(), and cube().

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

Override the automatically generated ID with the given ID.

Definition at line 360 of file Shape.cpp.

References m_id.

Referenced by Isis::ImportShapesWorkOrder::importConfirmedShapes().

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 225 of file Shape.cpp.

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

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 580 of file Shape.cpp.

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

Member Data Documentation

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 159 of file Shape.h.

Referenced by ~Shape().

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 170 of file Shape.h.

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

ShapeDisplayProperties* Isis::Shape::m_displayProperties
private

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

Definition at line 177 of file Shape.h.

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

QString Isis::Shape::m_fileName
private

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

Definition at line 181 of file Shape.h.

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

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

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

Definition at line 193 of file Shape.h.

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

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 197 of file Shape.h.

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

QString Isis::Shape::m_instrumentId
private

Instrument id associated with this Shape.

Definition at line 185 of file Shape.h.

Referenced by initCamStats(), and save().

QString Isis::Shape::m_spacecraftName
private

Spacecraft name associated with this Shape.

Definition at line 189 of file Shape.h.

Referenced by initCamStats(), and save().


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

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/13/2023 00:15:25