Ejemplo n.º 1
0
void IcicleTreeCanvas::compressLevelChanged(int value) {
  auto& na = node_tree.getNA();
  int leafIndex;
  compressLevel = value;
  compressInit(*na[0], 0, 0);
  VisualNode* lftLeaf = findLeftLeaf();
  leafIndex = lftLeaf->getIndex(na);
  int xoff = statistic[lftLeaf->getIndex(na)].absX * icicle_image_.pixel_height();
  sa_.horizontalScrollBar()->setValue(xoff);
  redrawAll();
  leafIndex = findLeftLeaf()->getIndex(na);
  sa_.horizontalScrollBar()->setValue(xoff);
  qDebug() << "compressionChanged to: " << compressLevel;
}
Ejemplo n.º 2
0
QRgb IcicleTreeCanvas::getColorByType(const VisualNode& node) {

  if (selectedNode == &node) { return QColor::fromHsv(0, 150, 150).rgba();}

  QRgb color;
  auto& na = node_tree.getNA();
  auto& data = tc_.getExecution()->getData();
  auto gid = node.getIndex(na);
  auto* entry = data.getEntry(gid);
  auto domain_red = entry == nullptr ? 0 : entry->domain;
  domain_red_sum += domain_red;
  switch (IcicleTreeCanvas::color_mapping_type) {
    case ColorMappingType::DEFAULT: {
      NodeStatus ns = statistic[gid].ns;
      color = getColor(ns);
    } break;
    case ColorMappingType::DOMAIN_REDUCTION: {
      /// the smaller the value, the darker the color
      int color_value = 255 * static_cast<float>(domain_red);
      if (color_value < 0) color_value = 0;
      color = QColor::fromHsv(0, 0, color_value).rgba();
    } break;
    case ColorMappingType::NODE_TIME: {
      auto node_time = entry == nullptr ? 0 : entry->node_time;
      /// TODO(maxim): need to normalize the node time
      int color_value = static_cast<float>(node_time);
      color = QColor::fromHsv(0, 0, color_value).rgba();
    }
  }

  return color;
}