31 cnet = someControlNet;
130 QString msg =
"\n\nGetCubesOnIsland called on connected graph with no "
137 if (island < 0 || island >=
islands->size()) {
138 QString msg =
"\n\nA list of cubes was requested from island " +
139 QString::number(island) +
"\nbut that island does not exist!!!"
140 "\n\nThere are " + QString::number(
islands->size()) +
" islands "
141 "numbered from 0 to " + QString::number(
islands->size() - 1) +
"\n\n";
146 for (
int i = 0; i < (*islands)[island].size(); i++) {
163 cubeList.push_back(i.key());
177 CubeSerialNumber)
const {
238 if (!(*
cnet)[cpIndex]->IsIgnored()) {
241 for (
int cmIndex = 0; cmIndex < curCtrlPoint.GetNumMeasures(); cmIndex++) {
243 QString curCube = curCtrlPoint[cmIndex]->GetCubeSerialNumber();
251 >::iterator graphIterator =
graph->find(curCubeIndex);
254 for (
int cmIndex2 = 0; cmIndex2 < curCtrlPoint.GetNumMeasures(); cmIndex2++) {
255 if (cmIndex2 != cmIndex) {
257 QString adjacentCube = curCtrlPoint[cmIndex2]->GetCubeSerialNumber();
265 if (graphIterator !=
graph->end()) {
266 graphIterator.value().first.AddConnection(adjCubeIndex, cpIndex,
272 graph->insert(curCubeIndex, qMakePair(newCubeList, cmStats));
278 if (graphIterator !=
graph->end()) {
280 GetMeasure(cmIndex)->GetMeasureDataNames());
282 for (
int i = 0; i < dataNames.size(); i++)
283 graphIterator.value().second.AddStatistic(dataNames[i],
285 GetMeasureData(dataNames[i]));
310 for (
int i = 0; i <
graph->size(); i++)
311 searchList.insert(i,
false);
320 int subgraphIndex = -1;
322 while (searchList.size()) {
331 searchList.begin().value() =
true;
332 q.enqueue(searchList.begin().key());
336 int curVertex(q.dequeue());
340 for (
int i = 0; i < adjacentVertices.size(); i++) {
341 const int &curNeighbor = adjacentVertices[i];
343 ASSERT(searchList.find(curNeighbor) != searchList.end());
345 if (!searchList.find(curNeighbor).value()) {
346 searchList.find(curNeighbor).value() =
true;
347 q.enqueue(curNeighbor);
354 while (i != searchList.end()) {
356 (*islands)[subgraphIndex].push_back(i.key());
362 for (
int i = 0; i < (*islands)[subgraphIndex].size(); i++) {
363 searchList.remove((*
islands)[subgraphIndex][i]);
369 if (subgraphIndex == 0) {
386 const int &cpIndex,
const int &cmIndex) {
390 firstEdge.push_back(qMakePair(cpIndex, cmIndex));
426 return adjacentCubes;
429 connections->constBegin();
430 while (i != connections->constEnd()) {
431 adjacentCubes.push_back(i.key());
435 return adjacentCubes;
449 const int &cpIndex,
const int &cmIndex) {
451 connections->find(cubeIndex);
455 if (i != connections->end()) {
456 i.value().push_back(qMakePair(cpIndex, cmIndex));
460 firstEdge.push_back(qMakePair(cpIndex, cmIndex));
461 connections->insert(cubeIndex, firstEdge);
~ControlGraph()
Destruct a ControlGraph.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
const GroupedStatistics & GetMeasureStats(const QString &CubeSerialNumber) const
AdjacentCubeList(const int &cubeIndex, const int &cpIndex, const int &cmIndex)
Construct a new AdjacentCubeList given one initial adjacent connection.
void HashCubesAndPopulateGraph()
int GetNumPoints() const
Return the number of control points in the network.
ControlGraph(ControlNet *someControlNet)
construct a ControlGraph given a ControlNet
This error is for when a programmer made an API call that was illegal.
ControlNet * cnet
ControlNet to make a graph from.
~AdjacentCubeList()
destruct an AdjacentCubeList
bool connected
Stores the state of the graphs connectivity so that connectivity must only be calculated once...
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
QHash< int, QString > * cubeIndexToIdHash
Used to get a cube serial number from an index.
const QVector< QString > GetCubesOnIsland(const int &island) const
#define _FILEINFO_
Macro for the filename and line number.
const QVector< QString > GetCubeList() const
bool IsConnected() const
Returns true if this ControlGraph is connected or false otherwise.
QMap< int, QVector< QPair< int, int > > > * connections
stores all edges or connections for an adjacent cube
int GetIslandCount() const
There can be 0 islands or 2 or more islands.
const QVector< int > GetAdjacentCubes() const
ControlGraph & operator=(const ControlGraph &other)
AdjacentCubeList & operator=(const AdjacentCubeList &other)
QHash< QString, int > * cubeIdToIndexHash
Used to get an index from a cube serial number.
void CalculateIslands()
Determines whether or not islands exist and calculates what they are if present.
QVector< QVector< int > > * islands
Stores a list of islands which are themselves a list of cube indices.
QMap< int, QPair< AdjacentCubeList, GroupedStatistics > > * graph
THE GRAPH!! It is a map of cube indices to a pair.
Control Graph nested class.
Control Network statistics and connectivity.
void AddConnection(const int &cubeIndex, const int &cpIndex, const int &cmIndex)
Adds a connection to an AdjacentCubeList.
const ControlMeasure * GetMeasure(QString serialNumber) const
Get a control measure based on its cube's serial number.