unsigned int ParallelCoordinatesGraphProxy::getDataCount() const {
  if (getDataLocation() == NODE) {
    return numberOfNodes();
  } else {
    return numberOfEdges();
  }
}
Color ParallelCoordinatesGraphProxy::getOriginalDataColor(const unsigned int dataId) {
  if (getDataLocation() == NODE) {
    return originalDataColors->getNodeValue(node(dataId));
  } else {
    return originalDataColors->getEdgeValue(edge(dataId));
  }
}
Iterator<unsigned int> *ParallelCoordinatesGraphProxy::getDataIterator() {
  if (getDataLocation() == NODE) {
    return new ParallelCoordinatesDataIterator<node>(getNodes());
  } else {
    return new ParallelCoordinatesDataIterator<edge>(getEdges());
  }
}
void ParallelCoordinatesGraphProxy::deleteData(const unsigned int dataId) {
  if (getDataLocation() == NODE) {
    delNode(node(dataId));
  } else {
    delEdge(edge(dataId));
  }
}
Iterator<unsigned int> *ParallelCoordinatesGraphProxy::getUnselectedDataIterator() {
  BooleanProperty *viewSelection = static_cast<BooleanProperty *>(getProperty("viewSelection"));

  if (getDataLocation() == NODE) {
    return new ParallelCoordinatesDataIterator<node>(viewSelection->getNodesEqualTo(false));
  } else {
    return new ParallelCoordinatesDataIterator<edge>(viewSelection->getEdgesEqualTo(false));
  }
}
예제 #6
0
void MainWindow::doRefreshBsrnReferenceIDs()
{
    setWaitCursor();
    setStatusBar( tr( "Reading BSRN reference IDs database - please wait" ) );

// **********************************************************************************************

    downloadFile( findCurl(), QLatin1String( "https://www.pangaea.de/ddi?request=bsrn/BSRNReferences&format=textfile&charset=UTF-8" ), getDataLocation() + "/" + "BSRN_Reference_IDs.txt" );

// **********************************************************************************************

    readBsrnReferenceIDs( true );

// **********************************************************************************************

    setNormalCursor();
    setStatusBar( tr( "Ready" ), 2 );

// **********************************************************************************************

    onError( _NOERROR_ );
}
예제 #7
0
void MainWindow::doRefreshBsrnIDs()
{
    setWaitCursor();
    setStatusBar( tr( "Reading BSRN IDs database - please wait" ) );

// **********************************************************************************************

    downloadFile( findCurl(), QLatin1String( "https://store.pangaea.de/config/bsrn/BSRN_IDs.txt" ), getDataLocation() + "/" + "BSRN_IDs.txt" );

// **********************************************************************************************

    setNormalCursor();
    setStatusBar( tr( "Ready" ), 2 );

// **********************************************************************************************

    readBsrnIDs();

// **********************************************************************************************

    onError( _NOERROR_ );
}
void ParallelCoordinatesGraphProxy::colorDataAccordingToHighlightedElts() {

  static bool lastHighlightedElementsSet = false;

  if (originalDataColors == nullptr) {
    return;
  }

  graphColorsChanged = false;

  // If new colors have been set for the graph elements, backup the change to restore the correct
  // ones when unhighlighting
  if (highlightedEltsSet()) {

    for (unsigned int dataId : getDataIterator()) {
      Color currentColor = getPropertyValueForData<ColorProperty, ColorType>("viewColor", dataId);
      Color originalColor;

      if (getDataLocation() == NODE) {
        originalColor = originalDataColors->getNodeValue(node(dataId));
      } else {
        originalColor = originalDataColors->getEdgeValue(edge(dataId));
      }

      if (!isDataHighlighted(dataId) && currentColor.getA() != unhighlightedEltsColorAlphaValue) {
        if (getDataLocation() == NODE) {
          originalDataColors->setNodeValue(node(dataId),
                                           Color(currentColor.getR(), currentColor.getG(),
                                                 currentColor.getB(), originalColor.getA()));
        } else {
          originalDataColors->setEdgeValue(edge(dataId),
                                           Color(currentColor.getR(), currentColor.getG(),
                                                 currentColor.getB(), originalColor.getA()));
        }

        Color newColor = getOriginalDataColor(dataId);
        newColor.setA(unhighlightedEltsColorAlphaValue);
        setPropertyValueForData<ColorProperty, ColorType>("viewColor", dataId, newColor);
      }

      if (highlightedEltsSet() && isDataHighlighted(dataId) && currentColor != originalColor) {
        if (getDataLocation() == NODE) {
          originalDataColors->setNodeValue(node(dataId),
                                           Color(currentColor.getR(), currentColor.getG(),
                                                 currentColor.getB(), originalColor.getA()));
        } else {
          originalDataColors->setEdgeValue(edge(dataId),
                                           Color(currentColor.getR(), currentColor.getG(),
                                                 currentColor.getB(), originalColor.getA()));
        }

        setPropertyValueForData<ColorProperty, ColorType>("viewColor", dataId,
                                                          getOriginalDataColor(dataId));
      }
    }

    lastHighlightedElementsSet = true;
  } else if (lastHighlightedElementsSet) {
    *(graph_component->getProperty<ColorProperty>("viewColor")) = *originalDataColors;
    lastHighlightedElementsSet = false;
  } else {
    *originalDataColors = *dataColors;
  }
}