<commit_before>/*=========================================================================

  Program: Visomics

  Copyright (c) Kitware, Inc.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

=========================================================================*/

// Qt includes
#include <QDebug>

// QtPropertyBrowser includes
#include <QtVariantProperty>
#include <QtVariantPropertyManager>

// Visomics includes
#include "voCustomAnalysis.h"
#include "voCustomAnalysisInformation.h"
#include "voDataObject.h"
#include "voInputFileDataObject.h"
#include "voTableDataObject.h"
#include "voUtils.h"
#include "vtkExtendedTable.h"

// VTK includes
#include <vtkArrayData.h>
#include <vtkCompositeDataIterator.h>
#include <vtkDoubleArray.h>
#include <vtkGraph.h>
#include <vtkMultiPieceDataSet.h>
#include <vtkNew.h>
#include <vtkSmartPointer.h>
#include <vtkStringArray.h>
#include <vtkTable.h>
#include <vtkTableToGraph.h>
#include <vtkTree.h>

// --------------------------------------------------------------------------
// voCustomAnalysisPrivate methods

// --------------------------------------------------------------------------
class voCustomAnalysisPrivate
{
public:
  voCustomAnalysisInformation *Information;
};

// --------------------------------------------------------------------------
// voCustomAnalysis methods

// --------------------------------------------------------------------------
voCustomAnalysis::voCustomAnalysis(QObject* newParent):
    Superclass(), d_ptr(new voCustomAnalysisPrivate)
{
  if (newParent)
    {
    this->setParent(newParent);
    }
  Q_D(voCustomAnalysis);
  d->Information = NULL;
}

// --------------------------------------------------------------------------
voCustomAnalysis::~voCustomAnalysis()
{
}

// --------------------------------------------------------------------------
void voCustomAnalysis::loadInformation(voCustomAnalysisInformation *info)
{
  Q_D(voCustomAnalysis);
  d->Information = info;
}

// --------------------------------------------------------------------------
void voCustomAnalysis::setOutputInformation()
{
  Q_D(voCustomAnalysis);
  if (d->Information == NULL)
    {
    return;
    }
  foreach(voCustomAnalysisData *output, d->Information->outputs())
    {
    QString name = output->name();
    QString type = output->type();
    if (type == "Table")
      {
      this->addOutputType(name, "vtkTable",
                          "", "",
                          "voTableView", name);
      }
    else if (type == "Tree")
      {
      this->addOutputType(name, "vtkTree",
                          "", "",
                          "voTreeHeatmapView", name);
      }
    else
      {
      qCritical() << "Unsupported output type in voCustomAnalysis:" << type;
      }
    }
}

// --------------------------------------------------------------------------
void voCustomAnalysis::setParameterInformation()
{
  Q_D(voCustomAnalysis);
  if (d->Information == NULL)
    {
    return;
    }<commit_msg>Add viewType for custom analyses<commit_after>/*=========================================================================

  Program: Visomics

  Copyright (c) Kitware, Inc.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

=========================================================================*/

// Qt includes
#include <QDebug>

// QtPropertyBrowser includes
#include <QtVariantProperty>
#include <QtVariantPropertyManager>

// Visomics includes
#include "voCustomAnalysis.h"
#include "voCustomAnalysisInformation.h"
#include "voDataObject.h"
#include "voInputFileDataObject.h"
#include "voTableDataObject.h"
#include "voUtils.h"
#include "vtkExtendedTable.h"

// VTK includes
#include <vtkArrayData.h>
#include <vtkCompositeDataIterator.h>
#include <vtkDoubleArray.h>
#include <vtkGraph.h>
#include <vtkMultiPieceDataSet.h>
#include <vtkNew.h>
#include <vtkSmartPointer.h>
#include <vtkStringArray.h>
#include <vtkTable.h>
#include <vtkTableToGraph.h>
#include <vtkTree.h>

// --------------------------------------------------------------------------
// voCustomAnalysisPrivate methods

// --------------------------------------------------------------------------
class voCustomAnalysisPrivate
{
public:
  voCustomAnalysisInformation *Information;
};

// --------------------------------------------------------------------------
// voCustomAnalysis methods

// --------------------------------------------------------------------------
voCustomAnalysis::voCustomAnalysis(QObject* newParent):
    Superclass(), d_ptr(new voCustomAnalysisPrivate)
{
  if (newParent)
    {
    this->setParent(newParent);
    }
  Q_D(voCustomAnalysis);
  d->Information = NULL;
}

// --------------------------------------------------------------------------
voCustomAnalysis::~voCustomAnalysis()
{
}

// --------------------------------------------------------------------------
void voCustomAnalysis::loadInformation(voCustomAnalysisInformation *info)
{
  Q_D(voCustomAnalysis);
  d->Information = info;
}

// --------------------------------------------------------------------------
void voCustomAnalysis::setOutputInformation()
{
  Q_D(voCustomAnalysis);
  if (d->Information == NULL)
    {
    return;
    }
  foreach(voCustomAnalysisData *output, d->Information->outputs())
    {
    QString name = output->name();
    QString type = output->type();
    QString viewType = output->viewType();

    if (type == "Table")
      {
      this->addOutputType(name, "vtkTable",
                          viewType, "",
                          "voTableView", name);
      }
    else if (type == "Tree")
      {
      this->addOutputType(name, "vtkTree",
                          viewType, "",
                          "voTreeHeatmapView", name);
      }
    else
      {
      qCritical() << "Unsupported output type in voCustomAnalysis:" << type;
      }
    }
}

// --------------------------------------------------------------------------
void voCustomAnalysis::setParameterInformation()
{
  Q_D(voCustomAnalysis);
  if (d->Information == NULL)
    {
    return;
    }
{'fraction_non_alphanumeric': 0.30194574634284904, 'fraction_numerical': 0.001136202243999432, 'mean_word_length': 1.8567951318458418, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7038609', 'n_tokens_mistral': 1747, 'n_tokens_neox': 1722, 'n_words': 425}