9#include "CnetEditorWidget.h" 
   12#include <QActionGroup> 
   13#include <QApplication> 
   21#include <QItemSelection> 
   38#include "AbstractMeasureItem.h" 
   39#include "AbstractPointItem.h" 
   40#include "AbstractTreeItem.h" 
   41#include "CnetDisplayProperties.h" 
   42#include "CnetEditorSortConfigDialog.h" 
   44#include "ControlMeasure.h" 
   45#include "ControlNet.h" 
   46#include "ControlPoint.h" 
   48#include "FilterWidget.h" 
   49#include "IException.h" 
   50#include "ImageImageTreeModel.h" 
   51#include "ImagePointTreeModel.h" 
   52#include "MeasureTableModel.h" 
   53#include "PointMeasureTreeModel.h" 
   54#include "PointTableModel.h" 
   57#include "TableViewHeader.h" 
   74  CnetEditorWidget::CnetEditorWidget(Control *control, QString pathForSettings) {
 
   86    connect(CnetDisplayProperties::getInstance(), SIGNAL(compositionFinished()),
 
   93    setLayout(mainLayout);
 
  101    installEventFilter(
this);
 
  218    bool ignoreAll = 
false;
 
  221        item->deleteSource();
 
  224        QString message = e.what();
 
  227          if (item == itemsToDelete.last()) {
 
  228            QMessageBox::warning(
 
  229              this, 
"Failed to delete row", message, QMessageBox::Ok);
 
  232            message += 
"\n\nOkay to continue?";
 
  234            QMessageBox::StandardButton status = QMessageBox::warning(
 
  235                this, 
"Failed to delete row", message, QMessageBox::Yes |
 
  236                QMessageBox::YesToAll | QMessageBox::No);
 
  238            if (status == QMessageBox::YesToAll)
 
  240            else if (status == QMessageBox::No)
 
 
  280    QHBoxLayout *pointTableLayout = 
new QHBoxLayout;
 
  286    QHBoxLayout *measureTableLayout = 
new QHBoxLayout;
 
  294    QBoxLayout *mainLayout = 
new QHBoxLayout;
 
 
  307        FileName(
"$ISISROOT/appdata/images/icons/ice.png").expanded()),
 
  308        tr(
"&Freeze Tables"), 
this);
 
  309    freezeTablesAct->setCheckable(
true);
 
  310    freezeTablesAct->setToolTip(tr(
"Freeze tables (filters will not take " 
  311        "effect until unfrozen)"));
 
  312    freezeTablesAct->setStatusTip(tr(
"Freeze tables (filters will not take " 
  313        "effect until unfrozen)"));
 
  314    freezeTablesAct->setWhatsThis(tr(
"<html>When frozen, the contents of the " 
  315        "tables will be locked.  Current filters will not be applied to the " 
  316        "tables until they are unfrozen.</html>"));
 
  317    connect(freezeTablesAct, SIGNAL(toggled(
bool)),
 
  320    freezeTablesLocation.append(tr(
"&Tables"));
 
  321    m_menuActions->insert(freezeTablesAct, freezeTablesLocation);
 
  324        FileName(
"$ISISROOT/appdata/images/icons/sort.png").expanded()),
 
  325        tr(
"&Sorting Options..."), 
this);
 
  326    QString configureSortToolTipText = tr(
"Configure table sorting options");
 
  327    configureSortAct->setToolTip(configureSortToolTipText);
 
  328    configureSortAct->setStatusTip(configureSortToolTipText);
 
  329    configureSortAct->setWhatsThis(tr(
"<html>Click here to configure options " 
  330        "related to the sorting of table columns.</html>"));
 
  331    connect(configureSortAct, SIGNAL(triggered()),
 
  334    configureSortLocation.append(tr(
"&Tables"));
 
  335    m_menuActions->insert(configureSortAct, configureSortLocation);
 
  337    QAction *xyzDisplayAct = 
new QAction(QIcon(
FileName(
"$ISISROOT/appdata/images/icons/xyz.png").expanded()),
 
  339    xyzDisplayAct->setCheckable(
true);
 
  340    xyzDisplayAct->setChecked(
false);    
 
  341    QString configureXYZDisplayToolTipText = tr(
"X,Y,Z Coordinate Display");
 
  342    xyzDisplayAct->setToolTip(configureXYZDisplayToolTipText);
 
  343    xyzDisplayAct->setStatusTip(configureXYZDisplayToolTipText);
 
  344    xyzDisplayAct->setWhatsThis(tr(
"<html>Click here to select coordinate display in : " 
  346    connect(xyzDisplayAct, SIGNAL(triggered()),
 
  349    xyzDisplayLocation.append(tr(
"&Coordinate Display"));
 
  350    QActionGroup *coordDisplayGroup = 
new QActionGroup(
this);
 
  351    coordDisplayGroup->addAction(xyzDisplayAct);
 
  354    QAction *latLonRadiusDisplayAct
 
  355        = 
new QAction(QIcon(
FileName(
"$ISISROOT/appdata/images/icons/latlonrad.png").expanded()),
 
  356          tr(
"&Lat,Lon,Radius"), 
this);
 
  357    latLonRadiusDisplayAct->setCheckable(
true);
 
  358    latLonRadiusDisplayAct->setChecked(
true);
 
  359    QString configureLatLonRadiusDisplayToolTipText = tr(
"Lat,Lon,Radius Coordinate Display");
 
  360    latLonRadiusDisplayAct->setToolTip(configureLatLonRadiusDisplayToolTipText);
 
  361    latLonRadiusDisplayAct->setStatusTip(configureLatLonRadiusDisplayToolTipText);
 
  362    latLonRadiusDisplayAct->setWhatsThis(tr(
"<html>Click here to select coordinate display in : " 
  363        "latitude, longitude, radius</html>"));
 
  364    connect(latLonRadiusDisplayAct, SIGNAL(triggered()),
 
  367    latLonRadiusDisplayLocation.append(tr(
"&Coordinate Display"));
 
  368    coordDisplayGroup->addAction(latLonRadiusDisplayAct);
 
  369    m_menuActions->insert(latLonRadiusDisplayAct, latLonRadiusDisplayLocation);
 
  371    QAction *whatsThisAct = QWhatsThis::createAction(
this);
 
  373    whatsThisLocation.append(tr(
"&Help"));
 
  377    tbActionList.append(freezeTablesAct);
 
  378    tbActionList.append(configureSortAct);
 
  379    tbActionList.append(latLonRadiusDisplayAct);
 
  380    tbActionList.append(xyzDisplayAct);
 
 
  428    QHBoxLayout *pointFilterLayout = 
new QHBoxLayout;
 
  429    pointFilterLayout->addWidget(pointFilter);
 
  431    pointArea->setLayout(pointFilterLayout);
 
  432    QScrollArea *pointFilterScrollArea = 
new QScrollArea;
 
  433    pointFilterScrollArea->setWidget(pointArea);
 
  434    pointFilterScrollArea->setWidgetResizable(
true);
 
  442    QHBoxLayout *serialFilterLayout = 
new QHBoxLayout;
 
  443    serialFilterLayout->addWidget(serialFilter);
 
  445    serialArea->setLayout(serialFilterLayout);
 
  446    QScrollArea *serialFilterScrollArea = 
new QScrollArea;
 
  447    serialFilterScrollArea->setWidget(serialArea);
 
  448    serialFilterScrollArea->setWidgetResizable(
true);
 
  456    QHBoxLayout *connectionFilterLayout = 
new QHBoxLayout;
 
  457    connectionFilterLayout->addWidget(connectionFilter);
 
  459    connectionArea->setLayout(connectionFilterLayout);
 
  460    QScrollArea *connectionFilterScrollArea = 
new QScrollArea;
 
  461    connectionFilterScrollArea->setWidget(connectionArea);
 
  462    connectionFilterScrollArea->setWidgetResizable(
true);
 
 
  473    connect(
this, SIGNAL(coordinateDisplayTypeChanged()),
 
  479        "point.  Each column in the table is an attribute of a control " 
  480        "point.<br/><br/>Cells that are gray are not editable.</html>");
 
  482        this, SIGNAL(cnetModified()));
 
  498            this, SIGNAL(editControlPoint(
ControlPoint *, QString)));
 
  500    for (
int i = 0; i < AbstractPointItem::COLS; i++) {
 
  502        AbstractPointItem::getColumnName((AbstractPointItem::Column) i), 
this);
 
  503      act->setCheckable(
true);
 
  509      Qt::ActionsContextMenu);
 
 
  519        "m_measureTableView");
 
  521        "measure.  Each column in the table is an attribute of a control " 
  522        "measure.<br/><br/>Rows with bold text are reference measures.  " 
  523        "Cells that are gray are not editable.</html>");
 
  525        SIGNAL(tableSelectionChanged(QList< AbstractTreeItem * >)),
 
  527        SLOT(handleTreeSelectionChanged(QList<AbstractTreeItem *>)));
 
  530        SIGNAL(tableSelectionChanged(QList< AbstractTreeItem * >)),
 
  532        SLOT(handleTreeSelectionChanged(QList< AbstractTreeItem * >)));
 
  536        this, SIGNAL(cnetModified()));
 
  550            this, SIGNAL(editControlPoint(
ControlPoint *, QString)));
 
  552    for (
int i = 0; i < AbstractMeasureItem::COLS; i++) {
 
  554          (AbstractMeasureItem::Column) i), 
this);
 
  555      act->setCheckable(
true);
 
  561      Qt::ActionsContextMenu);
 
 
  580    for (
int i = 0; i < actions.size(); i++) {
 
  582          actions[i]->isChecked());
 
 
  593    for (
int i = 0; i < actions.size(); i++)
 
  595          actions[i]->isChecked());
 
 
  609    int visibleRows, 
int totalRows) {
 
  611        "Control Point Table");
 
 
  625    int visibleRows, 
int totalRows) {
 
  627        "Control Measure Table");
 
 
  640    int visibleRows, 
int totalRows, QGroupBox *box, QString initialText) {
 
  642      QString newTitle = initialText + 
" (";
 
  643      if (visibleRows > -1)
 
  644        newTitle += QString::number(visibleRows);
 
  648      newTitle += 
" / " + QString::number(totalRows) + 
")";
 
  650      box->setTitle(newTitle);
 
 
  676    m_mainSplitter->restoreState(settings.value(
"mainSplitter").toByteArray());
 
  682    for (
int i = 0; i < actions.size(); i++) {
 
  684          AbstractMeasureItem::getColumnName((AbstractMeasureItem::Column) i);
 
  685      key.replace(
" ", 
"_");
 
  686      actions[i]->setChecked(settings.value(key, 
true).toBool());
 
  690    for (
int i = 0; i < actions.size(); i++) {
 
  692          AbstractPointItem::getColumnName((AbstractPointItem::Column) i);
 
  693      key.replace(
" ", 
"_");
 
  694      actions[i]->setChecked(settings.value(key, 
true).toBool());
 
  699      settings.value(
"measureTableSortingEnabled", 
true).toBool());
 
  701      settings.value(
"measureTableSortLimit", 500000).toInt());
 
  703      settings.value(
"pointTableSortingEnabled", 
true).toBool());
 
  705      settings.value(
"pointTableSortLimit", 100000).toInt());
 
 
  715    settings.setValue(
"version", 
VERSION);
 
  722    for (
int i = 0; i < actions.size(); i++) {
 
  724          AbstractMeasureItem::getColumnName((AbstractMeasureItem::Column) i);
 
  725      key.replace(
" ", 
"_");
 
  726      settings.setValue(key, actions[i]->isChecked());
 
  730    for (
int i = 0; i < actions.size(); i++) {
 
  732          AbstractPointItem::getColumnName((AbstractPointItem::Column) i);
 
  733      key.replace(
" ", 
"_");
 
  734      settings.setValue(key, actions[i]->isChecked());
 
  738    settings.setValue(
"measureTableSortingEnabled",
 
  740    settings.setValue(
"measureTableSortLimit",
 
  742    settings.setValue(
"pointTableSortingEnabled",
 
  744    settings.setValue(
"pointTableSortLimit",
 
 
  887    QList<AbstractTreeItem *> networkItems = 
m_pointModel->getItems(0, -1,
 
  888        AbstractTreeModel::MeasureItems | AbstractTreeModel::PointItems, 
true);
 
  892    for (
int pointIndex = filteredCnet->GetNumPoints() - 1;
 
  895      if (networkItems.isEmpty()) {
 
  899        for (
int measureIndex = 0;
 
  900            measureIndex < cp->GetNumMeasures();
 
  902          cp->GetMeasure(measureIndex)->SetEditLock(
false);
 
  905        filteredCnet->DeletePoint(cp);
 
  907      else if (networkItems.last()->getPointerType() ==
 
  908          AbstractTreeItem::Point) {
 
  912        if (cp->GetId() != networkItemsCp->GetId()) {
 
  915          for (
int measureIndex = 0;
 
  916              measureIndex < cp->GetNumMeasures();
 
  918            cp->GetMeasure(measureIndex)->SetEditLock(
false);
 
  921          filteredCnet->DeletePoint(cp);
 
  924          networkItems.removeLast();
 
  927      else if (networkItems.last()->getPointerType() ==
 
  928          AbstractTreeItem::Measure) {
 
  933        if (cp->GetId() != networkItemsCm->Parent()->GetId()) {
 
  934          cp->SetEditLock(
false);
 
  936          for (
int measureIndex = 0;
 
  937              measureIndex < cp->GetNumMeasures();
 
  939            cp->GetMeasure(measureIndex)->SetEditLock(
false);
 
  942          filteredCnet->DeletePoint(cp);
 
  946          for (
int measureIndex = cp->GetNumMeasures() - 1;
 
  947              networkItemsCm && measureIndex >= 0;
 
  950            if (cm->GetCubeSerialNumber() !=
 
  951                networkItemsCm->GetCubeSerialNumber()) {
 
  952              cm->SetEditLock(
false);
 
  956              networkItems.removeLast();
 
  957              networkItemsCm = NULL;
 
  959              if (networkItems.last()->getPointerType() ==
 
  960                  AbstractTreeItem::Measure) {
 
 
 1084    emit(coordinateDisplayTypeChanged());
 
 
 1102    emit(coordinateDisplayTypeChanged());
 
 
Translates the tree model into a table model.
Base class for an item in the tree.
Handles how control networks should be displayed to the user.
void setCoordinateDisplayType(enum coordinateDisplayType coordDisplay)
Sets the coordinate display type (0 = LatLonRadius, 1 = XYZ).
coordinateDisplayType
Returns coordinate display type (0 = LatLonRadius, 1 = XYZ).
Configure user's sorting settings for the cneteditor widget.
ControlNet * controlNet()
Open and return a pointer to the ControlNet for this Control.
void setModified(bool modified=true)
@description Sets the modification state of this control.
Status SetEditLock(bool editLock)
Set the EditLock state.
File name manipulation and expansion.
Tree model for images and images.
Tree model for images and control points.
Table model for control measures.
Tree model for control points and control measures.
Table model for control points.
TableViewHeader * getHorizontalHeader()
Returns the horizontal header.
void setColumnVisible(QString, bool)
Sets the specified column visible or invisible.
This is free and unencumbered software released into the public domain.