]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Basics for selection in PV3D viewer
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 14 Apr 2023 09:42:45 +0000 (11:42 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 14 Apr 2023 09:42:45 +0000 (11:42 +0200)
31 files changed:
src/LightApp/LightApp_PV3DSelector.cxx
src/LightApp/LightApp_PV3DSelector.h
src/SPV3D/CMakeLists.txt
src/SPV3D/SPV3D_CADSelection.cxx [new file with mode: 0644]
src/SPV3D/SPV3D_CADSelection.h [new file with mode: 0644]
src/SPV3D/SPV3D_Prs.cxx
src/SPV3D/SPV3D_ViewModel.cxx
src/SPV3D/SPV3D_ViewModel.h
src/SPV3D/SPV3D_ViewWindow.cxx
src/SPV3D/SPV3D_ViewWindow.h
src/SPV3D/plugins/CMakeLists.txt [deleted file]
src/SPV3D/plugins/cadRepresentations/CADRepresentations/CADRepresentation.xml [deleted file]
src/SPV3D/plugins/cadRepresentations/CADRepresentations/CMakeLists.txt [deleted file]
src/SPV3D/plugins/cadRepresentations/CADRepresentations/MBDebug.h [deleted file]
src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtk.module [deleted file]
src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtkCADMapper.cxx [deleted file]
src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtkCADMapper.h [deleted file]
src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtkCADRepresentation.cxx [deleted file]
src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtkCADRepresentation.h [deleted file]
src/SPV3D/plugins/cadRepresentations/CMakeLists.txt [deleted file]
src/SPV3D/plugins/cadRepresentations/paraview.plugin [deleted file]
src/SPV3D/plugins/cadSources/CADSources/CADSource.xml [deleted file]
src/SPV3D/plugins/cadSources/CADSources/CMakeLists.txt [deleted file]
src/SPV3D/plugins/cadSources/CADSources/MBDebug.h [deleted file]
src/SPV3D/plugins/cadSources/CADSources/vtk.module [deleted file]
src/SPV3D/plugins/cadSources/CADSources/vtkGeometryGenerator.cxx [deleted file]
src/SPV3D/plugins/cadSources/CADSources/vtkGeometryGenerator.h [deleted file]
src/SPV3D/plugins/cadSources/CADSources/vtkMeshGenerator.cxx [deleted file]
src/SPV3D/plugins/cadSources/CADSources/vtkMeshGenerator.h [deleted file]
src/SPV3D/plugins/cadSources/CMakeLists.txt [deleted file]
src/SPV3D/plugins/cadSources/paraview.plugin [deleted file]

index 961cf8b412243065b6fe4032cc377469f2f9e0cc..ff1ca466e18e2bf56b3ae8df4007d8550b706b67 100644 (file)
@@ -91,7 +91,7 @@ void LightApp_PV3DSelector::onSelectionChanged()
 /*!
   Gets list of selected data owners.(output \a aList).
 */
-void LightApp_PV3DSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
+void LightApp_PV3DSelector::getSelection( SUIT_DataOwnerPtrList& /*aList*/ ) const
 {
   DBG_FUN();
 
@@ -126,8 +126,10 @@ void LightApp_PV3DSelector::setSelection( const SUIT_DataOwnerPtrList& theList )
   DBG_FUN();
 
   if ( myViewer && ( theList.isEmpty() || myViewer->isSelectionEnabled() )) {
-    if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){
-      if(SPV3D_ViewWindow* aView = dynamic_cast<SPV3D_ViewWindow*>(aViewMgr->getActiveView())){
+    //if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager())
+    {
+    //  if(SPV3D_ViewWindow* aView = dynamic_cast<SPV3D_ViewWindow*>(aViewMgr->getActiveView()))
+      {
         // if(PV3DViewer_Selector* aSelector = aView->GetSelector()){
         //   SALOME_ListIO anAppendList;
         //   const SALOME_ListIO& aStoredList = aSelector->StoredIObjects();
index 69f883ea1e002cdbb011e7768878d0a4e965fd12..4586b8520279bafb547c78e1ef0ddf8cf4b73aa4 100644 (file)
@@ -1,7 +1,4 @@
-// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2023  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
index 4dbbd264aa3ea3614d6f2a879c83192aecccb93d..7d476458dee30cf18c8a995746e0a56f6b6e4a92 100644 (file)
@@ -19,8 +19,6 @@
 
 INCLUDE(UseQtExt)
 
-#add_subdirectory(plugins)
-
 # --- options ---
 
 # additional include directories
@@ -60,6 +58,7 @@ SET(_moc_HEADERS
    SPV3D_ViewManager.h
    SPV3D_ViewModel.h
    SPV3D_ViewWindow.h
+   SPV3D_CADSelection.h
 )
 
 # header files / no moc processing
@@ -82,6 +81,7 @@ SET(_other_SOURCES
    SPV3D_ViewManager.cxx
    SPV3D_ViewModel.cxx
    SPV3D_ViewWindow.cxx
+   SPV3D_CADSelection.cxx
 )
 
 # sources / to compile
diff --git a/src/SPV3D/SPV3D_CADSelection.cxx b/src/SPV3D/SPV3D_CADSelection.cxx
new file mode 100644 (file)
index 0000000..3433178
--- /dev/null
@@ -0,0 +1,443 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SPV3D_CADSelection.h"
+
+#include <pqActiveObjects.h>
+#include <pqRenderView.h>
+#include <pqUndoStack.h>
+#include <pqCoreUtilities.h>
+
+#include <vtkDataObject.h>
+#include <vtkCollection.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkPVRenderView.h>
+#include <vtkPVDataInformation.h>
+#include <vtkPVArrayInformation.h>
+#include <vtkPVRenderViewSettings.h>
+#include <vtkSMRenderViewProxy.h>
+#include <vtkSMPropertyHelper.h>
+#include <vtkSMSessionProxyManager.h>
+#include <vtkSMStringVectorProperty.h>
+#include <vtkSMRepresentationProxy.h>
+#include <vtkPVDataSetAttributesInformation.h>
+
+//-----------------------------------------------------------------------------
+SPV3D_CADSelection::SPV3D_CADSelection(QObject *parent,
+  pqRenderView* view, SelectionMode mode):QObject(parent)
+{
+  this->View = view;
+  this->Mode = mode;
+  this->PreviousRenderViewMode = -1;
+  this->MousePosition[0] = 0;
+  this->MousePosition[1] = 0;
+  //this->selectionComboBox = comboBox;
+
+  for (size_t i = 0; i < sizeof(this->ObserverIds) / sizeof(this->ObserverIds[0]); ++i)
+  {
+    this->ObserverIds[i] = 0;
+  }
+
+  //QObject::connect(button, SIGNAL(toggled(bool)), this, SLOT(actionTriggered(bool)));
+
+  // if view == nullptr, we track the active view.
+  if (view == nullptr)
+  {
+    QObject::connect(
+      &pqActiveObjects::instance(), SIGNAL(viewChanged(pqView*)), this, SLOT(setView(pqView*)));
+    // this ensure that the enabled-state is set correctly.
+    this->setView(nullptr);
+  }
+
+  this->setRepresentation(nullptr);
+  QObject::connect(&pqActiveObjects::instance(),
+    SIGNAL(representationChanged(pqDataRepresentation*)), this,
+    SLOT(setRepresentation(pqDataRepresentation*)));
+
+  vtkPVRenderViewSettings::GetInstance()->SetEnableFastPreselection(true);
+
+  this->updateEnableState();
+}
+
+//-----------------------------------------------------------------------------
+SPV3D_CADSelection::~SPV3D_CADSelection()
+{
+  this->cleanupObservers();
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::SetMode(const SPV3D_CADSelection::SelectionMode mode)
+{
+  this->Mode = mode;
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::updateEnableState()
+{
+  this->endSelection();
+
+  //auto paction = this->parentAction();
+  //bool state = false;
+  if (this->Representation)
+  {
+    vtkSMProxy* proxy = this->Representation->getProxy();
+    vtkSMStringVectorProperty* prop =
+      vtkSMStringVectorProperty::SafeDownCast(proxy->GetProperty("ColorArrayName"));
+    if (prop)
+    {
+      int association = std::atoi(prop->GetElement(3));
+      const char* arrayName = prop->GetElement(4);
+
+      vtkPVDataInformation* dataInfo = this->Representation->getInputDataInformation();
+
+      vtkPVDataSetAttributesInformation* info = nullptr;
+      if (association == vtkDataObject::CELL &&
+        this->Mode == SELECT_FACES)
+      {
+        info = dataInfo->GetCellDataInformation();
+      }
+      if (association == vtkDataObject::POINT &&
+        this->Mode == SELECT_VERTICES)
+      {
+        info = dataInfo->GetPointDataInformation();
+      }
+
+      if (info)
+      {
+        /*vtkPVArrayInformation* arrayInfo = */info->GetArrayInformation(arrayName);
+        //state = arrayInfo && arrayInfo->GetDataType() == VTK_ID_TYPE;
+      }
+    }
+  }
+  //paction->setEnabled(state);
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::actionTriggered(bool val)
+{
+  if (val)
+  {
+    this->beginSelection();
+  }
+  else
+  {
+    this->endSelection();
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::setView(pqView* view)
+{
+  if (this->View != view)
+  {
+    // if we were currently in selection, finish that before changing the view.
+    this->endSelection();
+  }
+
+  this->View = qobject_cast<pqRenderView*>(view);
+
+  // update enable state.
+  //this->parentAction()->setEnabled(this->View != nullptr);
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::setRepresentation(pqDataRepresentation* representation)
+{
+  if (this->Representation != representation)
+  {
+    // if we are currently in selection, finish that before changing the representation.
+    this->endSelection();
+
+    if (this->Representation != nullptr)
+    {
+      QObject::disconnect(this->RepresentationConnection);
+    }
+
+    this->Representation = representation;
+
+    if (this->Representation != nullptr)
+    {
+      this->RepresentationConnection = this->connect(
+        this->Representation, SIGNAL(colorArrayNameModified()), SLOT(updateEnableState()));
+    }
+
+    // update enable state.
+    this->updateEnableState();
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::beginSelection()
+{
+  if (!this->View)
+  {
+    return;
+  }
+
+  //QAction* actn = this->parentAction();
+  //if (actn->isCheckable())
+  {
+    //this->selectionComboBox->setEnabled(false);
+
+    vtkSMRenderViewProxy* rmp = this->View->getRenderViewProxy();
+    vtkSMPropertyHelper(rmp, "InteractionMode").Get(&this->PreviousRenderViewMode);
+
+    //QString currentPrimitive = this->selectionComboBox->currentText();
+    pqCoreUtilities::promptUser("SPV3D_CADSelection", QMessageBox::Information,
+      "Interactive Selection Information",
+      "You are entering interactive selection mode to highlight.\n"
+      "Move the mouse point over the dataset to interactively highlight elements.\n\n"
+      "Press Ctrl + click to add the currently highlighted element.\n"
+      "Press Shift + click to remove the element.\n\n"
+      "Click on Select button to exit this mode.",
+      QMessageBox::Ok | QMessageBox::Save);
+    this->View->setCursor(Qt::CrossCursor);
+    vtkSMPropertyHelper(rmp, "InteractionMode").Set(vtkPVRenderView::INTERACTION_MODE_SELECTION);
+
+    rmp->UpdateVTKObjects();
+
+    // Setup observer.
+    assert(this->ObserverIds[0] == 0 && this->ObservedObject == nullptr && this->ObserverIds[1] == 0);
+    this->ObservedObject = rmp->GetInteractor();
+    this->ObserverIds[0] = this->ObservedObject->AddObserver(
+      vtkCommand::MouseMoveEvent, this, &SPV3D_CADSelection::onMouseMove);
+    this->ObserverIds[1] = this->ObservedObject->AddObserver(vtkCommand::LeftButtonReleaseEvent,
+      this, &SPV3D_CADSelection::onLeftButtonRelease);
+    this->ObserverIds[2] = this->ObservedObject->AddObserver(vtkCommand::RightButtonPressEvent,
+      this, &SPV3D_CADSelection::onRightButtonPress);
+    this->ObserverIds[3] = this->ObservedObject->AddObserver(vtkCommand::RightButtonReleaseEvent,
+      this, &SPV3D_CADSelection::onRightButtonRelease);
+
+    //this->parentAction()->setChecked(true);
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::endSelection()
+{
+  if (!this->View)
+  {
+    return;
+  }
+
+  if (this->PreviousRenderViewMode == -1)
+  {
+    return;
+  }
+
+  //QAction* actn = this->parentAction();
+  //if (actn->isCheckable())
+  {
+    vtkSMRenderViewProxy* rmp = this->View->getRenderViewProxy();
+    vtkSMPropertyHelper(rmp, "InteractionMode").Set(this->PreviousRenderViewMode);
+    this->PreviousRenderViewMode = -1;
+    rmp->UpdateVTKObjects();
+    this->View->setCursor(QCursor());
+    this->cleanupObservers();
+    //this->parentAction()->setChecked(false);
+
+    if (this->CurrentRepresentation != nullptr)
+    {
+      vtkSMSessionProxyManager* pxm = rmp->GetSessionProxyManager();
+      vtkSMProxy* emptySel = pxm->NewProxy("sources", "IDSelectionSource");
+
+      this->CurrentRepresentation->UpdateVTKObjects();
+      this->CurrentRepresentation = nullptr;
+      emptySel->Delete();
+
+      rmp->StillRender();
+    }
+
+    //this->selectionComboBox->setEnabled(true);
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::onMouseMove()
+{
+  if (!this->DisablePreSelection && vtkPVRenderViewSettings::GetInstance()->GetEnableFastPreselection())
+  {
+    this->fastSelection(true);
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::onLeftButtonRelease()
+{
+  if (vtkPVRenderViewSettings::GetInstance()->GetEnableFastPreselection())
+  {
+    this->fastSelection();
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::onRightButtonPress()
+{
+  this->DisablePreSelection = true;
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::onRightButtonRelease()
+{
+  this->DisablePreSelection = false;
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::fastSelection(bool presel)
+{
+  vtkSMRenderViewProxy* rmp = this->View->getRenderViewProxy();
+  assert(rmp != nullptr);
+
+  int x = rmp->GetInteractor()->GetEventPosition()[0];
+  int y = rmp->GetInteractor()->GetEventPosition()[1];
+  this->MousePosition[0] = x;
+  this->MousePosition[1] = y;
+
+  int region[4] = { x, y, x, y };
+
+  vtkNew<vtkCollection> selectedRepresentations;
+  vtkNew<vtkCollection> selectionSources;
+  bool status = false;
+  // Do the selection on the current region
+  switch (this->Mode)
+  {
+    case SELECT_SOLIDS:
+      status = rmp->SelectSurfaceCells(region, selectedRepresentations, selectionSources, false, 0, false, "Solid id");
+      break;
+    case SELECT_FACES:
+      status = rmp->SelectSurfaceCells(region, selectedRepresentations, selectionSources, false, 0, false, "Face id");
+      break;
+    case SELECT_EDGES:
+      status = rmp->SelectSurfaceCells(region, selectedRepresentations, selectionSources, false, 0, false, "Edge id");
+      break;
+    case SELECT_VERTICES:
+      status = rmp->SelectSurfaceCells(region, selectedRepresentations, selectionSources, false, 0, false, "Vertex id");
+      break;
+    default:
+      qCritical("Invalid call to SPV3D_CADSelection::fastSelection");
+      return;
+  }
+
+  vtkSMRepresentationProxy* repr =
+    vtkSMRepresentationProxy::SafeDownCast(selectedRepresentations->GetItemAsObject(0));
+
+  if (repr && !presel)
+  {
+    repr->InvokeCommand("BeginSelect");
+  }
+
+  // If something has been preselected or selected
+  if (status)
+  {
+    vtkSMRepresentationProxy* repr =
+      vtkSMRepresentationProxy::SafeDownCast(selectedRepresentations->GetItemAsObject(0));
+
+    // If the selection occurs on a new represention, clean the selection on the
+    // current representation before continuing
+    if (this->CurrentRepresentation != nullptr && repr != this->CurrentRepresentation)
+    {
+      vtkSMSessionProxyManager* pxm = repr->GetSessionProxyManager();
+      vtkSMProxy* emptySel = pxm->NewProxy("sources", "IDSelectionSource");
+
+      vtkSMPropertyHelper(this->CurrentRepresentation, "Selection").Set(emptySel);
+      this->CurrentRepresentation->UpdateVTKObjects();
+      emptySel->Delete();
+    }
+
+    this->CurrentRepresentation = repr;
+
+    // Set the selection (selection source) to the current representation
+    vtkSMSourceProxy* sel = vtkSMSourceProxy::SafeDownCast(selectionSources->GetItemAsObject(0));
+    vtkSMPropertyHelper(repr, "Selection").Set(sel);
+    repr->UpdateVTKObjects();
+  }
+  // If nothing has been selected then clean current representation
+  // with an "empty" selection source
+  else if (this->CurrentRepresentation != nullptr)
+  {
+    vtkSMSessionProxyManager* pxm = rmp->GetSessionProxyManager();
+    vtkSMProxy* emptySel = pxm->NewProxy("sources", "IDSelectionSource");
+
+    vtkSMPropertyHelper(this->CurrentRepresentation, "Selection").Set(emptySel);
+    this->CurrentRepresentation->UpdateVTKObjects();
+    this->CurrentRepresentation = nullptr;
+    emptySel->Delete();
+  }
+
+  this->View->forceRender();
+  this->View->forceRender();
+  // TODO improve this to avoid double render
+
+  if (repr && !presel)
+  {
+    repr->InvokeCommand("EndSelect");
+  }
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::selectionChanged(vtkObject*, unsigned long, void* calldata)
+{
+  BEGIN_UNDO_EXCLUDE();
+
+  int selectionModifier = this->getSelectionModifier();
+  int* region = reinterpret_cast<int*>(calldata);
+// Simple version check to change once 5.10 support is dropped
+  this->View->selectCellsOnSurface(region, selectionModifier);
+  //this->View->selectOnSurface(region, selectionModifier);
+  END_UNDO_EXCLUDE();
+
+  this->endSelection();
+}
+
+//-----------------------------------------------------------------------------
+int SPV3D_CADSelection::getSelectionModifier()
+{
+  int selectionModifier = pqView::PV_SELECTION_DEFAULT;//this->Superclass::getSelectionModifier();
+
+  vtkSMRenderViewProxy* rmp = this->View->getRenderViewProxy();
+  assert(rmp != nullptr);
+
+  bool ctrl = rmp->GetInteractor()->GetControlKey() == 1;
+  bool shift = rmp->GetInteractor()->GetShiftKey() == 1;
+  selectionModifier = pqView::PV_SELECTION_TOGGLE;
+
+  if (ctrl)
+  {
+    selectionModifier = pqView::PV_SELECTION_ADDITION;
+  }
+  else if (shift)
+  {
+    selectionModifier = pqView::PV_SELECTION_SUBTRACTION;
+  }
+  return selectionModifier;
+}
+
+//-----------------------------------------------------------------------------
+void SPV3D_CADSelection::cleanupObservers()
+{
+  for (size_t i = 0; i < sizeof(this->ObserverIds) / sizeof(this->ObserverIds[0]); ++i)
+  {
+    if (this->ObservedObject != nullptr && this->ObserverIds[i] > 0)
+    {
+      this->ObservedObject->RemoveObserver(this->ObserverIds[i]);
+    }
+    this->ObserverIds[i] = 0;
+  }
+  this->ObservedObject = nullptr;
+}
diff --git a/src/SPV3D/SPV3D_CADSelection.h b/src/SPV3D/SPV3D_CADSelection.h
new file mode 100644 (file)
index 0000000..b73fa7d
--- /dev/null
@@ -0,0 +1,160 @@
+// Copyright (C) 2023  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#include <pqSelectionReaction.h>
+
+#include <vtkSmartPointer.h>
+#include <vtkWeakPointer.h>
+
+#include <QCursor>
+#include <QPointer>
+#include <QTimer>
+#include <QPushButton>
+#include <QComboBox>
+
+class vtkObject;
+class pqView;
+class pqRenderView;
+class vtkIntArray;
+class pqDataRepresentation;
+class vtkSMRepresentationProxy;
+class vtkSMSourceProxy;
+
+/**
+ * SPV3D_CADSelection handles various selection modes available on
+ * RenderViews. Simply create multiple instances of
+ * SPV3D_CADSelection to handle selection modes for that RenderView.
+ * SPV3D_CADSelection uses internal static members to ensure that
+ * at most 1 view (and 1 type of selection) is in selection-mode at any given
+ * time.
+ */
+class SPV3D_CADSelection : public QObject
+{
+  Q_OBJECT
+
+public:
+  enum SelectionMode
+  {
+    SELECT_SOLIDS,
+    SELECT_FACES,
+    SELECT_EDGES,
+    SELECT_VERTICES
+  };
+
+  /**
+   * If \c view is nullptr, this reaction will track the active-view maintained by
+   * pqActiveObjects.
+   */
+  SPV3D_CADSelection(QObject *parent, pqRenderView* view, SelectionMode mode);
+  
+  ~SPV3D_CADSelection() override;
+
+  /**
+   * Set the selectionMode
+   */
+  void SetMode(const SPV3D_CADSelection::SelectionMode mode);
+  
+public Q_SLOTS:
+  /**
+   * For checkable actions, this calls this->beginSelection() or
+   * this->endSelection() is val is true or false, respectively. For
+   * non-checkable actions, this call this->beginSelection() and
+   * this->endSelection() in that order.
+   */
+  virtual void actionTriggered(bool val);
+  
+private Q_SLOTS:
+  /**
+   * Called when this object was created with nullptr as the view and the active
+   * view changes.
+   */
+  void setView(pqView* view);
+
+  /**
+   * Called when the active representation changes.
+   */
+  void setRepresentation(pqDataRepresentation* representation);
+
+  /**
+   * starts the selection i.e. setup render view in selection mode.
+   */
+  void beginSelection();
+
+  /**
+   * finishes the selection. Doesn't cause the selection, just returns the
+   * render view to previous interaction mode.
+   */
+  void endSelection();
+
+  void updateEnableState();
+
+  ///@{
+  /**
+   * Disable preselection during rotation using the right button.
+   */
+  void onRightButtonPress();
+  void onRightButtonRelease();
+  ///@}
+
+private:
+
+  /**
+   * callback called when the vtkPVRenderView is done with selection.
+   */
+  void selectionChanged(vtkObject*, unsigned long, void* calldata);
+
+  /**
+   * callback called for mouse move events when in 'interactive selection'
+   * modes.
+   */
+  void onMouseMove();
+
+  /**
+   * callback called for click events when in 'interactive selection' modes.
+   */
+  void onLeftButtonRelease();
+
+  // Get the current state of selection modifier
+  int getSelectionModifier();
+
+  /**
+   * makes fast selection.
+   */
+  void fastSelection(bool presel = false);
+
+  /**
+   * cleans up observers.
+   */
+  void cleanupObservers();
+
+  Q_DISABLE_COPY(SPV3D_CADSelection)
+  QPointer<pqRenderView> View;
+  QPointer<pqDataRepresentation> Representation;
+  QMetaObject::Connection RepresentationConnection;
+  vtkSMRepresentationProxy* CurrentRepresentation = nullptr;
+  SelectionMode Mode;
+  int PreviousRenderViewMode;
+  vtkWeakPointer<vtkObject> ObservedObject;
+  unsigned long ObserverIds[4];
+  int MousePosition[2];
+  QComboBox* selectionComboBox;
+  bool DisablePreSelection = false;
+};
index d10efd876921f5914ab280a88a9d6366017ccdda..f06108fef303cbad402ba246a7dc60887c24ad41 100644 (file)
@@ -1,7 +1,4 @@
-// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2023  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -27,7 +24,8 @@
 #include "SPV3D_ViewWindow.h"
 
 #include "vtkActor.h"
-#include "vtkDataSet.h"
+#include "vtkPolyData.h"
+#include "vtkCellData.h"
 #include "vtkMapper.h"
 #include "pqServer.h"
 #include "pqApplicationCore.h"
@@ -38,6 +36,7 @@
 #include "vtkPVTrivialProducer.h"
 #include <pqDataRepresentation.h>
 
+
 //---------------------------------------------------------
 #define USE_DEBUG
 #define MBCLASSNAME "SPV3D_Prs"
@@ -80,8 +79,21 @@ void SPV3D_Prs::FillUsingActor(vtkActor *actor) const
   if(alreadyExistingSrc && !alreadyExistingSrc->GetSourceProducer())
   {
     actor->GetMapper()->Update();
-    vtkDataObject *ds = actor->GetMapper()->GetInput();//GetOutputDataObject(0);
-    vtkDataSet *ds2 = vtkDataSet::SafeDownCast(ds);
+    vtkDataObject *ds = actor->GetMapper()->GetInput();
+    vtkPolyData *ds3 = vtkPolyData::SafeDownCast(ds);
+    vtkNew<vtkPolyData> ds4;
+    if(ds3)
+    {
+      ds4->ShallowCopy( ds3 );
+      vtkNew<vtkIdTypeArray> solidIdArray;
+      auto nbCells( ds4->GetNumberOfCells() );
+      solidIdArray->SetNumberOfComponents(1);
+      solidIdArray->SetNumberOfTuples( nbCells );
+      solidIdArray->SetName("Solid id");
+      vtkIdType *pt( solidIdArray->GetPointer(0) );
+      std::for_each(pt,pt+nbCells,[](vtkIdType& elt) { elt = 0; });
+      ds4->GetCellData()->AddArray( solidIdArray );
+    }
     //
     pqServer *serv(pqApplicationCore::instance()->getServerManagerModel()->findServer(pqServerResource("builtin:")));
     pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder());
@@ -90,7 +102,7 @@ void SPV3D_Prs::FillUsingActor(vtkActor *actor) const
     vtkSMSourceProxy *producer(vtkSMSourceProxy::SafeDownCast(producerBase));
     vtkObjectBase *clientSideObject(producer->GetClientSideObject());
     vtkPVTrivialProducer *clientSideObjectCast = vtkPVTrivialProducer::SafeDownCast(clientSideObject);
-    clientSideObjectCast->SetOutput(ds2);
+    clientSideObjectCast->SetOutput(ds4);
     mySourceProducer->updatePipeline();
     pqProxy *producerBase2( getPQProxy(producerBase) );
     if(producerBase2 && !_name.empty())
index 1c761d50822c86b881df2f49f515798b31b792f8..2e084f496fcf7a2bfd0083255bfeb357b549e396 100644 (file)
@@ -1,7 +1,4 @@
-// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2023  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -152,7 +149,7 @@ void SPV3D_ViewModel::setViewManager(SUIT_ViewManager* theViewManager)
 /*!
   Builds popup for vtk viewer
 */
-void SPV3D_ViewModel::contextMenuPopup( QMenu* thePopup )
+void SPV3D_ViewModel::contextMenuPopup( QMenu */*thePopup*/ )
 {
   DBG_FUN();
 
@@ -187,7 +184,6 @@ void SPV3D_ViewModel::enableSelection(bool isEnabled)
   ARG(isEnabled);
   mySelectionEnabled = isEnabled;
   //!! To be done for view windows
-   
   if (SUIT_ViewManager* aViewManager = getViewManager()) {
     QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
     for ( int i = 0; i < aViews.count(); i++ )
@@ -200,11 +196,11 @@ void SPV3D_ViewModel::enableSelection(bool isEnabled)
   if(!isEnabled) {
     //clear current selection in the viewer
     bool blocked = blockSignals( true );
-    if ( SUIT_ViewManager* aViewMgr = getViewManager() ) {
+    /*if ( SUIT_ViewManager* aViewMgr = getViewManager() ) {
       if( SPV3D_ViewWindow* aViewWindow = dynamic_cast<SPV3D_ViewWindow*>( aViewMgr->getActiveView() ) ){
         //NYI
       }
-    }
+    }*/
     blockSignals( blocked );  
   }
 
@@ -231,16 +227,19 @@ void SPV3D_ViewModel::Display( const SALOME_PV3DPrs* prs )
       pqActiveObjects::instance().setActiveView(getView());
       pqPipelineSource *mySourceProducer = aPrs->GetSourceProducer();
       aPrs->SetSourceProducer( mySourceProducer );
-      pqDataRepresentation* myRepr(builder->createDataRepresentation(mySourceProducer->getOutputPort(0),getView(),"GeometryRepresentation"));
+      pqDataRepresentation* myRepr(builder->createDataRepresentation(mySourceProducer->getOutputPort(0),getView(),"CADRepresentation"));//"GeometryRepresentation"
       vtkSMViewProxy::RepresentationVisibilityChanged(myRepr->getViewProxy(), myRepr->getProxy(), true);
       aPrs->SetRepresentation(myRepr);
     }
     pqDataRepresentation* myRepr = aPrs->GetRepresentation();
     myRepr->setVisible(1);
     vtkSMPVRepresentationProxy* proxy(dynamic_cast<vtkSMPVRepresentationProxy*>(myRepr->getProxy()));
-    vtkSMPropertyHelper inputHelper(proxy, "Input");
-    vtkSMSourceProxy* input = vtkSMSourceProxy::SafeDownCast(inputHelper.GetAsProxy());
-    input->UpdatePipeline();
+    if(proxy)
+    {
+      vtkSMPropertyHelper inputHelper(proxy, "Input");
+      vtkSMSourceProxy* input = vtkSMSourceProxy::SafeDownCast(inputHelper.GetAsProxy());
+      input->UpdatePipeline();
+    }
     getView()->resetDisplay();
     getView()->render();
   }
@@ -251,7 +250,7 @@ void SPV3D_ViewModel::Display( const SALOME_PV3DPrs* prs )
   \param prs - presentation
   \param forced - removes object from view
 */
-void SPV3D_ViewModel::Erase( const SALOME_PV3DPrs* prs, const bool forced )
+void SPV3D_ViewModel::Erase( const SALOME_PV3DPrs* prs, const bool /*forced*/ )
 {
   DBG_FUN();
 
@@ -311,7 +310,7 @@ bool SPV3D_ViewModel::isVisible( const Handle(SALOME_InteractiveObject)& io )
   \Collect objects visible in viewer
   \param theList - visible objects collection
 */
-void SPV3D_ViewModel::GetVisible( SALOME_ListIO& theList )
+void SPV3D_ViewModel::GetVisible( SALOME_ListIO &/*theList*/ )
 {
   // NYI
 }
@@ -327,7 +326,7 @@ void SPV3D_ViewModel::Repaint()
 }
 
 
-void SPV3D_ViewModel::onViewCreated( SUIT_ViewWindow* view) {
+void SPV3D_ViewModel::onViewCreated( SUIT_ViewWindow */*view*/) {
   DBG_FUN();
 #ifdef VGL_WORKAROUND
   if ( SPV3D_ViewWindow* svw = dynamic_cast<SPV3D_ViewWindow*>( view ) )
@@ -335,8 +334,6 @@ void SPV3D_ViewModel::onViewCreated( SUIT_ViewWindow* view) {
 #endif
 }
 
-
-
 //-----------------------------------------------------------------------------
 void SPV3D_ViewModel::onSourceCreated(pqPipelineSource* source)
 {
index 1c9c9469bc598aa437fa30365ffa75c4fb649a69..b9690501f9c367d5f5fac069808ed891ebc9b3fb 100644 (file)
@@ -1,7 +1,4 @@
-// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2023  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-#ifndef SPV3D_VIEWMODEL_H
-#define SPV3D_VIEWMODEL_H
+#pragma once
 
 #include "SPV3D.h"
 #include "PV3DViewer_ViewModel.h"
 
-#include "Qtx.h"
-
 #include <SALOME_Prs.h>
 #include <SALOME_InteractiveObject.hxx>
 #include <SALOME_ListIO.hxx>
 
-#include <QColor>
-#include <QMap>
-
 class QMouseEvent;
-
-class SPV3D_ViewWindow;
-class PV3DViewer_Actor;
-
 class pqPipelineSource;
-class pqCADSelection;
-class pqCADGroupModel;
 class pqView;
 
-
 //! Extends two interfaces #SPV3D_ViewModelBase and #SALOME_View 
 class SPV3D_EXPORT SPV3D_ViewModel : public PV3DViewer_ViewModel, public SALOME_View 
 {
@@ -117,13 +101,6 @@ protected:
   pqPipelineSource* MeshSource = nullptr;
 
 private:
-  pqCADSelection* selection;
-  pqCADGroupModel* GroupModel;
-  int GroupCounter = 0;
-
-private:
-  bool                 mySelectionEnabled;
+  bool mySelectionEnabled;
   pqView *_view = nullptr;
 };
-
-#endif
index 036b9fc2dde7ae60706e35f688b2f509573cd262..b8f00272a0f17b401d02712d9488b1de626474bb 100644 (file)
@@ -80,6 +80,7 @@ SPV3D_ViewWindow::SPV3D_ViewWindow(SUIT_Desktop* theDesktop, SPV3D_ViewModel* th
 }
 
 #include <pqRenderViewSelectionReaction.h>
+#include <pqPipelineSource.h>
 #include <vtkSMRenderViewProxy.h>
 #include <vtkCollection.h>
 #include <vtkSMRepresentationProxy.h>
@@ -88,6 +89,8 @@ SPV3D_ViewWindow::SPV3D_ViewWindow(SUIT_Desktop* theDesktop, SPV3D_ViewModel* th
 #include <vtkRenderer.h>
 #include <vtkSMSessionProxyManager.h>
 
+#include "SPV3D_CADSelection.h"
+
 void SPV3D_ViewWindow::init()
 {
   pqView *view(myModel->getView());
@@ -96,6 +99,7 @@ void SPV3D_ViewWindow::init()
   wid->setParent( this );
   setCentralWidget( wid );
   //
+  this->
   myToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"),                       // title (language-dependant)
                                         QString( "PV3DViewerViewOperations" ),          // name (language-independant)
                                         false );
@@ -116,6 +120,37 @@ void SPV3D_ViewWindow::init()
   QObject::connect(selectionReaction,
     QOverload<int, int, int, int>::of(&pqRenderViewSelectionReaction::selectedCustomBox), this,
     &SPV3D_ViewWindow::pickCenterOfRotation);
+  //
+  mySelection = new SPV3D_CADSelection(this,renderView,SPV3D_CADSelection::SELECT_SOLIDS);
+  QAction *selectionAction =  toolMgr()->toolBar(myToolBar)->addAction(SUIT_Session::session()->resourceMgr()->loadPixmap( "VTKViewer", tr( "ICON_SVTK_PRESELECTION_STANDARD" ) ), tr( "MNU_SVTK_PRESELECTION_STANDARD" ) );
+  selectionAction->setCheckable(true);
+  QObject::connect(selectionAction, &QAction::toggled, this, &SPV3D_ViewWindow::goSelect);
+}
+
+void SPV3D_ViewWindow::goSelect(bool val)
+{
+  if(val)
+    {
+      pqView* activeView(myModel->getView());
+      if (!activeView)
+      {
+        return;
+      }
+      for(const auto& elt : myPrs)
+      {
+        pqPipelineSource *geometrySource = elt.second->GetSourceProducer();
+        if(geometrySource)
+        {
+          vtkSMProxy* repr = activeView->getViewProxy()->FindRepresentation(
+            geometrySource->getSourceProxy(), 0);
+          repr->InvokeCommand("Reset");
+        }
+      }
+      activeView->forceRender();
+      activeView->render();
+      activeView->resetDisplay();
+    }
+  mySelection->actionTriggered(val);
 }
 
 //-----------------------------------------------------------------------------
@@ -264,12 +299,10 @@ bool SPV3D_ViewWindow::isVisible(const Handle(SALOME_InteractiveObject)& theIObj
   \param theIO - object
   \param theImmediatly - update viewer
 */
-void SPV3D_ViewWindow::Display(const Handle(SALOME_InteractiveObject)& theIO,
-                              bool theImmediatly
+void SPV3D_ViewWindow::Display(const Handle(SALOME_InteractiveObject)& /*theIO*/,
+                              bool /*theImmediatly*/
 {
   DBG_FUN();
-
-  // NYI
 }
 
 /*!
@@ -277,8 +310,8 @@ void SPV3D_ViewWindow::Display(const Handle(SALOME_InteractiveObject)& theIO,
   \param theIO - object
   \param theImmediatly - update viewer
 */
-void SPV3D_ViewWindow::Erase(const Handle(SALOME_InteractiveObject)& theIO,
-                            bool theImmediatly) 
+void SPV3D_ViewWindow::Erase(const Handle(SALOME_InteractiveObject)& /*theIO*/,
+                            bool /*theImmediatly*/)
 {
   DBG_FUN();
 }
@@ -287,10 +320,9 @@ void SPV3D_ViewWindow::Erase(const Handle(SALOME_InteractiveObject)& theIO,
   Display only passed object
   \param theIO - object
 */
-void SPV3D_ViewWindow::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIO) 
+void SPV3D_ViewWindow::DisplayOnly(const Handle(SALOME_InteractiveObject)& /*theIO*/)
 {
   DBG_FUN();
-  // NYI
 }
 
 
@@ -300,7 +332,6 @@ void SPV3D_ViewWindow::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIO
 void SPV3D_ViewWindow::DisplayAll() 
 {
   DBG_FUN();
-  // NYI
 }
 
 /*!
@@ -322,7 +353,6 @@ void SPV3D_ViewWindow::EraseAll()
 */
 void SPV3D_ViewWindow::Repaint(bool )//(bool theUpdateTrihedron)
 {
-  // NYI
   if(myModel)
     myModel->render();
 }
@@ -331,10 +361,9 @@ void SPV3D_ViewWindow::Repaint(bool )//(bool theUpdateTrihedron)
   Enables/disables selection.
   \param theEnable if true - selection will be enabled
 */
-void SPV3D_ViewWindow::SetSelectionEnabled( bool theEnable )
+void SPV3D_ViewWindow::SetSelectionEnabled( bool /*theEnable*/ )
 {
   DBG_FUN();
-  // NYI
 }
 
 /*!
index 505ddb9a4cea7373b15e53c16bb3b15608a64b1a..b3cc7f08cf415691f81b20820f01db364f4719af 100644 (file)
@@ -20,8 +20,7 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-#ifndef SPV3D_VIEWWINDOW_H
-#define SPV3D_VIEWWINDOW_H
+#pragma once
 
 #ifdef WIN32
 #pragma warning( disable:4251 )
 #include "SALOME_InteractiveObject.hxx"
 #include "SALOME_ListIO.hxx"
 
-#include <QImage>
-#include <vtkSmartPointer.h>
-
 #include <list>
 #include <memory>
 
-class SUIT_Desktop;
-class SUIT_ResourceMgr;
-
-class PV3DViewer_Actor;
-class PV3DViewer_Trihedron;
-
 class SPV3D_ViewModel;
-class SPV3D_Selector;
-class SPV3D_View;
-
-class SPV3D_CubeAxesActor2D;
-
-class vtkRenderer;
-class vtkRenderWindow;
-class vtkRenderWindowInteractor;
-class vtkInteractorStyle;
-class vtkCallbackCommand;
-
-class SPV3D_RenderWindowInteractor;
-class SPV3D_Renderer;
-class SPV3D_NonIsometricDlg;
-class SPV3D_UpdateRateDlg;
-class SPV3D_CubeAxesDlg;
-class SPV3D_SetRotationPointDlg;
-class SPV3D_InteractorStyle;
-class SPV3D_KeyFreeInteractorStyle;
-class SPV3D_ViewParameterDlg;
-class SPV3D_Recorder;
-class SPV3D_Prs;
-
-namespace salomevtk
-{
-  class vtkPVAxesWidget;
-}
-
-class vtkObject;
-class QtxAction;
-
+class SPV3D_CADSelection;
 
 //! Define a container for SALOME PV3D view window
-class SPV3D_EXPORT SPV3D_ViewWindow : public PV3DViewer_ViewWindow //SUIT_ViewWindow
+class SPV3D_EXPORT SPV3D_ViewWindow : public PV3DViewer_ViewWindow 
 {
   Q_OBJECT
 
@@ -133,6 +93,7 @@ public slots:
   virtual void hideEvent( QHideEvent * );
   void showCenterAxes(bool);
   void pickCenterOfRotation(int posx, int posy);
+  void goSelect(bool val);
 
 protected slots:
   void onKeyPressed(QKeyEvent* event);
@@ -143,6 +104,7 @@ protected slots:
   void onMouseMoving(QMouseEvent* event);
 
 protected:
+  SPV3D_CADSelection *mySelection = nullptr;
   int myToolBar = -1;
   SPV3D_ViewModel* myModel;
   std::list< std::pair<std::string, std::unique_ptr<SPV3D_EXPORTSPV3DData> > > myPrs;
@@ -151,5 +113,3 @@ protected:
 #ifdef WIN32
 #pragma warning( default:4251 )
 #endif
-
-#endif
diff --git a/src/SPV3D/plugins/CMakeLists.txt b/src/SPV3D/plugins/CMakeLists.txt
deleted file mode 100644 (file)
index 72c3784..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-option(BUILD_SHARED_LIBS "Build shared libraries" ON)
-
-paraview_plugin_scan(
-  PLUGIN_FILES
-    cadSources/paraview.plugin
-    cadRepresentations/paraview.plugin
-  PROVIDES_PLUGINS plugins
-  ENABLE_BY_DEFAULT ON
-  HIDE_PLUGINS_FROM_CACHE ON)
-
-paraview_plugin_build(
-  RUNTIME_DESTINATION "${CMAKE_INSTALL_BINDIR}"
-  LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}"
-  LIBRARY_SUBDIRECTORY "${PARAVIEW_PLUGIN_SUBDIR}"
-  PLUGINS_FILE_NAME "salome.xml"
-  INSTALL_EXPORT SPV3DParaViewPlugins
-  CMAKE_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/SPV3D
-  LIBRARY_SUBDIRECTORY "salome"
-  PLUGINS ${plugins}
-  TARGET salome_paraview_plugins)
diff --git a/src/SPV3D/plugins/cadRepresentations/CADRepresentations/CADRepresentation.xml b/src/SPV3D/plugins/cadRepresentations/CADRepresentations/CADRepresentation.xml
deleted file mode 100644 (file)
index b79338f..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<ServerManagerConfiguration>
-  <ProxyGroup name="representations">
-    <RepresentationProxy class="vtkCADRepresentation"
-                         name="CADRepresentation"
-                         processes="client|renderserver|dataserver">
-      <Documentation>
-        CAD Representation.
-      </Documentation>
-      <InputProperty command="SetInputConnection"
-                     name="Input">
-        <Documentation>
-          Set the input to the representation. Must be a vtkPolyData producer.
-        </Documentation>
-        <DataTypeDomain composite_data_supported="0"
-                        name="input_type">
-          <DataType value="vtkImageData" />
-        </DataTypeDomain>
-      </InputProperty>
-      <InputProperty command="SetSelectionConnection"
-                     name="Selection">
-        <DataTypeDomain name="input_type">
-          <DataType value="vtkSelection" />
-        </DataTypeDomain>
-        <Documentation>Set the selection.</Documentation>
-      </InputProperty>
-      <IntVectorProperty command="SetVisibility"
-                         default_values="1"
-                         name="Visibility"
-                         number_of_elements="1">
-        <BooleanDomain name="bool" />
-        <Documentation>
-          Set the visibility for this representation.
-        </Documentation>
-      </IntVectorProperty>
-      <IntVectorProperty command="SetGroupVisibility"
-                         default_values="-1 0"
-                         name="SetGroupVisibility"
-                         number_of_elements="2">
-        <Documentation>
-         Set the group to show in Group Mode.
-        </Documentation>
-      </IntVectorProperty>
-      <IntVectorProperty command="SetGroupOpacity"
-                         default_values="-1 0"
-                         name="SetGroupOpacity"
-                         number_of_elements="2">
-        <Documentation>
-         Set the opacity of the given group.
-        </Documentation>
-      </IntVectorProperty>
-      <IntVectorProperty command="SetGroupModeEnabled"
-                         default_values="0"
-                         name="GroupMode"
-                         number_of_elements="1">
-        <BooleanDomain name="bool" />
-        <Documentation>
-           Enable or disable the Group Mode.
-        </Documentation>
-      </IntVectorProperty>
-      <Property command="Reset" name="Reset"/>
-      <Property command="BeginSelect" name="BeginSelect"/>
-      <Property command="EndSelect" name="EndSelect"/>
-      <Property command="CreateGroup" name="CreateGroup"/>
-    </RepresentationProxy>
- </ProxyGroup>
-</ServerManagerConfiguration>
diff --git a/src/SPV3D/plugins/cadRepresentations/CADRepresentations/CMakeLists.txt b/src/SPV3D/plugins/cadRepresentations/CADRepresentations/CMakeLists.txt
deleted file mode 100644 (file)
index b896170..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-set(classes
-  vtkCADMapper
-  vtkCADRepresentation)
-
-vtk_module_add_module(CADRepresentations
-  FORCE_STATIC
-  CLASSES ${classes})
-
-paraview_add_server_manager_xmls(
-  XMLS CADRepresentation.xml)
diff --git a/src/SPV3D/plugins/cadRepresentations/CADRepresentations/MBDebug.h b/src/SPV3D/plugins/cadRepresentations/CADRepresentations/MBDebug.h
deleted file mode 100644 (file)
index 53f42ed..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-#ifndef MBDebug_HeaderFile\r
-#define MBDebug_HeaderFile\r
-\r
-//---------------------------------------------------------------\r
-// Usage of the logging facilities:\r
-//\r
-//  (1) At the beginning of each class file to be debugged, there\r
-//      should be a static string variable defined with the name\r
-//      of the class. Then, include the "MBDebug.h" header file.\r
-//\r
-//      //---------------------------------------------------------\r
-//      #define USE_DEBUG\r
-//      static const char *dbg_class = "ClassName";\r
-//      #include "MBDebug.h"\r
-//      //---------------------------------------------------------\r
-//\r
-//  (2) At the beginning of each class method, call the DBG_FUN\r
-//      macro.\r
-//\r
-//      int ClassName::MyMethod(int x)\r
-//      {\r
-//        DBG_FUN();\r
-//        ...\r
-//      }\r
-//\r
-//      NOTE: For static methods, call the DBG_FUNC() macro!!\r
-//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r
-//  This debugging/logging class is a "header-only" solution and\r
-//  does NOT require any additional implementation (.cpp) file!\r
-//---------------------------------------------------------------\r
-\r
-#include <iostream>\r
-#include <string>\r
-#include <locale>\r
-#include <codecvt>\r
-#include <list>\r
-#include <map>\r
-#include <set>\r
-#include <vector>\r
-#ifndef MB_IGNORE_QT\r
-# include <qstring.h>\r
-#endif\r
-\r
-//---------------------------------------------------------------\r
-//     Set the debug flags dependent on the preprocessor definitions\r
-//---------------------------------------------------------------\r
-#ifdef USE_DEBUG\r
-#      define MBS_DEBUG_FLAG           MBDebug::DF_DEBUG\r
-#else\r
-#      define MBS_DEBUG_FLAG           0\r
-#endif /*DEBUG*/ \r
-\r
-#define        MBS_DBG_FLAGS                   (MBS_DEBUG_FLAG)\r
-\r
-\r
-//---------------------------------------------------------------\r
-//     Define the global debug macros\r
-//---------------------------------------------------------------\r
-#define DLOG                                                   MBDebug::LogPrint()\r
-#define RETURN(var)                            { RET(var); return (var); }\r
-\r
-#ifdef USE_DEBUG\r
-\r
-# define DBG_FUN()                             MBDebug _dbg(dbg_class, __FUNCTION__, MBS_DBG_FLAGS, (void*)this)\r
-# define DBG_FUNC()                            MBDebug _dbg(dbg_class, __FUNCTION__, MBS_DBG_FLAGS)\r
-# define DBG_FUNB(blk)         MBDebug _dbg(dbg_class, blk, MBS_DBG_FLAGS)\r
-#      define MSGEL(txt)                               MBDebug::LogPrint() << txt << std::endl\r
-#      define PRINT(txt)                               MBDebug::LogPrint() << txt\r
-#      define SHOW2(var,typ)           DumpVar(#var,(typ)(var))\r
-#      define SHOW(var)                                DumpVar(#var,var)\r
-#      define ARG(var)                                 do { PRINT("in:"); DumpVar(#var,var); } while (0)\r
-#      define ARG2(var,typ)            do { PRINT("in:"); DumpVar(#var,(typ)(var)); } while (0)\r
-#      define RET(var)                                 do { PRINT("out:"); DumpVar(#var,var); } while (0)\r
-#      define MSG(txt)                                 MBDebug::LogPrint() << txt\r
-\r
-#else  /*!USE_DEBUG*/ \r
-\r
-#      define DBG_FUN()\r
-#      define DBG_FUNC()\r
-#      define DBG_FUNB(blk)\r
-#      define MSGEL(txt)\r
-#      define PRINT(txt)\r
-#      define SHOW2(var,typ)\r
-#      define SHOW(var)\r
-#      define ARG(var)\r
-#      define ARG2(var,typ)\r
-#      define RET(var)\r
-#      define MSG(txt)\r
-\r
-#endif /*USE_DEBUG*/ \r
-\r
-\r
-//---------------------------------------------------------------\r
-//     Declare the debugging and profiling class\r
-//---------------------------------------------------------------\r
-class MBDebug\r
-{\r
-public:\r
-       enum {\r
-               DF_NONE                 = 0x00,         // no debug\r
-               DF_DEBUG                = 0x01          // debug a function\r
-       };\r
-\r
-       MBDebug(const char* aClassName, const char* aFuncName, const short aFlag, void* aThis=NULL)\r
-       :mClassName(aClassName),mFuncName(aFuncName),mThis(aThis),mFlags((unsigned char)aFlag)\r
-  {\r
-       if (mFlags & (DF_DEBUG))\r
-       {\r
-               std::cout << "{ENTER: " << mClassName + "::" + mFuncName;\r
-               if (mThis) std::cout << "(this=" << mThis << ")";\r
-               std::cout << std::endl;\r
-       }\r
-  }\r
-       virtual ~MBDebug()\r
-  {\r
-       if (mFlags & (DF_DEBUG))\r
-               std::cout << "}LEAVE: " << mClassName << "::" << mFuncName << std::endl;\r
-  }\r
-\r
-       // Log file output management\r
-       static std::ostream&    LogPrint()      { return std::cout; }\r
-\r
-private:\r
-       std::string                     mClassName;     // Name of class to be debugged\r
-       std::string                     mFuncName;      // Name of function to be debugged\r
-       void*                           mThis;            // The "this" pointer to the class being debugged\r
-       unsigned char           mFlags;                 // Debug mode flags\r
-};\r
-\r
-\r
-\r
-#define YesNo(b)       (b ? "Yes" : "No")\r
-\r
-\r
-\r
-inline std::string w2s(std::wstring ws)\r
-{\r
-       using convert_typeX = std::codecvt_utf8<wchar_t>;\r
-       std::wstring_convert<convert_typeX, wchar_t> converterX;\r
-       return(converterX.to_bytes(ws));\r
-}\r
-\r
-// Primitive types\r
-inline void DumpVar(const char *szName, char value)\r
-{\r
-       DLOG << "[chr]: " << szName << "='" << value << "'" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, bool value)\r
-{\r
-       DLOG << "[bool]: " << szName << "=" << (value ? "true" : "false") << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, short value)\r
-{\r
-       DLOG  << "[shrt]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, int value)\r
-{\r
-       DLOG << "[int]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, long value)\r
-{\r
-       DLOG << "[long]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, double value)\r
-{\r
-       DLOG << "[dbl]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned char value)\r
-{\r
-       DLOG << "[byte]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned short value)\r
-{\r
-       DLOG << "[word]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned int value)\r
-{\r
-       DLOG << "[uint]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned long value)\r
-{\r
-       DLOG << "[dword]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const char* value)\r
-{\r
-       DLOG << "[str]: " << szName << "=\"" << (value ? value : "") << "\"" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::string &value)\r
-{\r
-       DLOG << "[Str]: " << szName << "=\"" << value << "\"" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::wstring &value)\r
-{\r
-       DLOG << "[WStr]: " << szName << "=\"" << w2s(value) << "\"" << std::endl;\r
-}\r
-\r
-#ifndef MB_IGNORE_QT\r
-inline void DumpVar(const char *szName, const QString &value)\r
-{\r
-       DLOG << "[QStr]: " << szName << "=\"" << value.toStdString() << "\"" << std::endl;\r
-}\r
-#endif\r
-\r
-inline void DumpVar(const char *szName, const void* value)\r
-{\r
-       DLOG << "[ptr]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-\r
-// Collection of primitive types\r
-inline void DumpVar(const char *szName, const std::set<int> &values)\r
-{\r
-       DLOG << "[intSet]: " << szName << "={" << values.size() << "}[";\r
-       bool bFirst = true;\r
-       for (auto it=values.cbegin(); it!=values.cend(); ++it)\r
-               DLOG << (bFirst ? "" : ",") << *it;\r
-       DLOG << "]" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::list<bool>& values)\r
-{\r
-       DLOG << "[boolList]: " << szName << "={" << values.size() << "}[";\r
-       bool bFirst = true;\r
-       for (auto it=values.cbegin(); it!=values.cend(); ++it)\r
-               DLOG << (bFirst ? "" : ",") << (*it ? "Y" : "N");\r
-       DLOG << "]" << std::endl;\r
-}\r
-\r
-\r
-#endif // MBDebug_HeaderFile\r
-\r
diff --git a/src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtk.module b/src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtk.module
deleted file mode 100644 (file)
index 515f266..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-NAME
-  CADRepresentations
-DEPENDS
-  ParaView::RemotingViews
-  VTK::RenderingOpenGL2
-  VTK::CommonDataModel
-  VTK::glew
-PRIVATE_DEPENDS
-  VTK::CommonCore
diff --git a/src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtkCADMapper.cxx b/src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtkCADMapper.cxx
deleted file mode 100644 (file)
index df91e28..0000000
+++ /dev/null
@@ -1,495 +0,0 @@
-#include "vtkCADMapper.h"
-
-#include <vtkCellData.h>
-#include <vtkObjectFactory.h>
-#include <vtkOpenGLBufferObject.h>
-#include <vtkOpenGLCellToVTKCellMap.h>
-#include <vtkOpenGLRenderWindow.h>
-#include <vtkPolyData.h>
-#include <vtkProperty.h>
-#include <vtkRenderer.h>
-#include <vtkTextureObject.h>
-#include <vtkSelectionNode.h>
-
-//---------------------------------------------------------
-#define USE_DEBUG
-#define MB_IGNORE_QT
-static const char *dbg_class = "vtkCADMapper";
-#include "MBDebug.h"
-//---------------------------------------------------------
-
-
-vtkStandardNewMacro(vtkCADMapper);
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::SetOpacity(vtkIdType cellId, unsigned char opacity)
-{
-  DBG_FUN();
-  ARG2(cellId, long);
-  ARG2(opacity, int);
-  
-  if(this->PrimColors.empty())
-  {
-    return;
-  }
-
-  for (vtkIdType primId : this->CellToPrimMap[cellId])
-  {
-    this->PrimColors[4 * primId + 3] = opacity;
-  }
-}
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::ToggleResetColor(vtkIdType cellId)
-{
-   DBG_FUN();
-   ARG2(cellId, long);
-
-  if(this->PrimColors.empty())
-  {
-    return;
-  }
-
-  const int opacity = this->GroupModeEnabled ? 0 : 255;
-
-  // Retrieve "default" colors
-  unsigned char color[4];
-  this->Colors->GetTypedTuple(cellId, color);
-
-  for (vtkIdType primId : this->CellToPrimMap[cellId])
-  {
-    this->PrimColors[4 * primId] = color[0];
-    this->PrimColors[4 * primId + 1] = color[1];
-    this->PrimColors[4 * primId + 2] = color[2];
-    this->PrimColors[4 * primId + 3] = opacity;
-  }
-}
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::ToggleSelectColor(vtkIdType cellId)
-{
-  DBG_FUN();
-  ARG2(cellId, long);
-
-  if(this->PrimColors.empty())
-  {
-    return;
-  }
-
-  auto* selectionColors =
-      this->GroupModeEnabled ? this->GroupSelectionColor : this->SelectionColor;
-
-  const int opacity = this->GroupModeEnabled ? this->SavedCellOpacities[cellId] : 255;
-
-  for (vtkIdType primId : this->CellToPrimMap[cellId])
-  {
-    this->PrimColors[4 * primId] = selectionColors[0];
-    this->PrimColors[4 * primId + 1] = selectionColors[1];
-    this->PrimColors[4 * primId + 2] = selectionColors[2];
-    this->PrimColors[4 * primId + 3] = opacity;
-  }
-}
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::TogglePreselectColor(vtkIdType cellId)
-{
-  // DBG_FUN();
-  // ARG2(cellId, long);
-
-  if(this->PrimColors.empty())
-  {
-    return;
-  }
-
-  for (vtkIdType primId : this->CellToPrimMap[cellId])
-  {
-    this->PrimColors[4 * primId] = this->PreselectionColor[0];
-    this->PrimColors[4 * primId + 1] = this->PreselectionColor[1];
-    this->PrimColors[4 * primId + 2] = this->PreselectionColor[2];
-    this->PrimColors[4 * primId + 3] = 255;
-  }
-}
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::ForceUpdate()
-{
-  DBG_FUN();
-
-  this->Modified();
-  this->NeedUpdate = true;
-}
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::BuildCellTextures(vtkRenderer* ren, vtkActor* vtkNotUsed(actor),
-  vtkCellArray* vtkNotUsed(prims)[4], int vtkNotUsed(representation))
-{
-   DBG_FUN();
-
-  if (!this->NeedUpdate)
-  {
-    return;
-  }
-
-  // Add the preselection
-  for (vtkIdType idx :
-    this->SelectionCache[std::make_tuple(0, 0, this->PreselectedCellId)])
-  {
-    this->TogglePreselectColor(idx);
-  }
-
-  // Fill OpenGL related buffers
-  if (!this->CellScalarTexture)
-  {
-    this->CellScalarTexture = vtkTextureObject::New();
-    this->CellScalarBuffer = vtkOpenGLBufferObject::New();
-    this->CellScalarBuffer->SetType(vtkOpenGLBufferObject::TextureBuffer);
-  }
-  this->CellScalarTexture->SetContext(static_cast<vtkOpenGLRenderWindow*>(ren->GetVTKWindow()));
-  this->CellScalarBuffer->Upload(this->PrimColors, vtkOpenGLBufferObject::TextureBuffer);
-  this->CellScalarTexture->CreateTextureBuffer(
-    static_cast<unsigned int>(this->PrimColors.size() / 4), 4, VTK_UNSIGNED_CHAR,
-    this->CellScalarBuffer);
-
-  // Reset preselection
-  for (vtkIdType idx :
-    this->SelectionCache[std::make_tuple(0, 0, this->PreselectedCellId)])
-  {
-    this->ToggleResetColor(idx);
-  }
-
-  this->NeedUpdate = false;
-}
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::BeginSelect()
-{
-  DBG_FUN();
-  MSGEL("...vtkMapper::BeginSelect()");
-
-  this->Selecting = true;
-}
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::EndSelect()
-{
-  DBG_FUN();
-  MSGEL("...vtkMapper::EndSelect()");
-
-  this->Selecting = false;
-}
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::CreateGroup()
-{
-  DBG_FUN();
-
-  this->SavedGroups.emplace_back(std::make_pair(this->SelectedIds, this->CurrentArrayName));
-  this->SavedGroupVisibilities.emplace_back(false);
-  this->ResetSelection();
-}
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::SetGroupVisibility(int groupIdx, bool visibility)
-{
-  DBG_FUN();
-  ARG(groupIdx);
-  ARG(visibility);
-
-  if(!this->GroupModeEnabled)
-  {
-    return;
-  }
-
-  // Reconstruct the cache if needed (if a different array for selection by value is choosen)
-  this->BuildSelectionCache(this->SavedGroups[groupIdx].second.c_str(), 0, this->CurrentInput);
-
-  // Save the group visibility
-  this->SavedGroupVisibilities[groupIdx] = visibility;
-
-  // Show the selected group
-  for (vtkIdType id : this->SavedGroups[groupIdx].first)
-  {
-    for (vtkIdType idx : this->SelectionCache[std::make_tuple(0, 0, id)])
-    {
-      if (visibility)
-      {
-        this->ToggleSelectColor(idx);
-      }
-      else
-      {
-        this->ToggleResetColor(idx);
-      }
-    }
-    this->SelectedIds.emplace(id);
-  }
-  this->ForceUpdate();
-}
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::SetGroupOpacity(int groupIdx, unsigned char opacity)
-{
-  DBG_FUN();
-  ARG(groupIdx);
-  ARG2(opacity, int);
-
-  if(!this->GroupModeEnabled)
-  {
-    return;
-  }
-
-  // Reconstruct the cache if needed (if a different array for selection by value is choosen)
-  this->BuildSelectionCache(this->SavedGroups[groupIdx].second.c_str(), 0, this->CurrentInput);
-
-  // Save the opacity of the selected group and update it directly if currently visible
-  for (vtkIdType id : this->SavedGroups[groupIdx].first)
-  {
-    for (vtkIdType idx : this->SelectionCache[std::make_tuple(0, 0, id)])
-    {
-      this->SavedCellOpacities[idx] = opacity;
-      if(this->SavedGroupVisibilities[groupIdx])
-      {
-        this->SetOpacity(idx, opacity);
-      }
-    }
-  }
-  this->ForceUpdate();
-}
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::SetGroupModeEnabled(bool enabled)
-{
-  DBG_FUN();
-  ARG(enabled);
-
-  this->GroupModeEnabled = enabled;
-
-  // Set the group mode colors and opacity and clear the selections
-  this->InitializePrimColors();
-  this->SelectedIds.clear();
-  this->PreselectedCellId = -1;
-
-  // Show all visible groups
-  for (vtkIdType groupId = 0; groupId < this->SavedGroups.size(); groupId++)
-  {
-    if (this->SavedGroupVisibilities[groupId])
-    {
-      this->SetGroupVisibility(groupId, true);
-    }
-  }
-
-  this->ForceUpdate();
-}
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::ResetSelection()
-{
-  DBG_FUN();
-
-  for (vtkIdType id : this->SelectedIds)
-  {
-    for (vtkIdType idx : this->SelectionCache[std::make_tuple(0, 0, id)])
-    {
-      this->ToggleResetColor(idx);
-    }
-  }
-
-  this->SelectedIds.clear();
-  this->PreselectedCellId = -1;
-  this->ForceUpdate();
-}
-
-//-----------------------------------------------------------------------------
-void vtkCADMapper::Initialize()
-{
-  DBG_FUN();
-
-  vtkPolyData* input = vtkPolyData::SafeDownCast(this->GetInput());
-  if(!input)
-  {
-    vtkErrorMacro("Unable to retrieve input polydata.");
-    return;
-  }
-
-  vtkCellArray* prims[4];
-
-  prims[0] = input->GetVerts();
-  prims[1] = input->GetLines();
-  prims[2] = input->GetPolys();
-  prims[3] = input->GetStrips();
-
-  vtkIdType nbVerts = input->GetNumberOfVerts();
-  vtkIdType nbLines = input->GetNumberOfLines();
-  vtkIdType nbPolys = input->GetNumberOfPolys();
-  SHOW2(nbVerts, long);
-  SHOW2(nbLines, long);
-  SHOW2(nbPolys, long);
-
-  // Store the mapping from OpenGL primitives to VTK cells
-  this->CellCellMap->BuildCellSupportArrays(prims, VTK_SURFACE, input->GetPoints());
-
-  // Create the mapping from VTK cells to OpenGL primitives (inverse of CellCellMap)
-  this->CellToPrimMap.clear();
-  this->CellToPrimMap.resize(nbVerts + nbLines + nbPolys);
-  for (auto& v : this->CellToPrimMap)
-  {
-    // heuristic : for performances, we assume that we will have at most 10 primitives per cell
-    // it's just a reserve, the algorithm will still works if there is more primitives
-    v.reserve(10);
-  }
-
-  for (size_t i = 0; i < this->CellCellMap->GetSize(); i++)
-  {
-    this->CellToPrimMap[this->CellCellMap->GetValue(i)].push_back(i);
-  }
-
-  // Reset the default colors for all VTK cells
-  if (vtkUnsignedCharArray::SafeDownCast(input->GetCellData()->GetArray("RGB")))
-  {
-    input->GetCellData()->RemoveArray("RGB");
-  }
-
-  vtkNew<vtkUnsignedCharArray> colorArray;
-  colorArray->SetNumberOfComponents(3);
-  colorArray->SetNumberOfTuples(nbVerts + nbLines + nbPolys);
-  colorArray->SetName("RGB");
-
-  input->GetCellData()->SetScalars(colorArray);
-
-  for (int i = 0; i < nbVerts; i++)
-  {
-    colorArray->SetTypedTuple(i, this->VertexColor);
-  }
-
-  for (int i = 0; i < nbLines; i++)
-  {
-    colorArray->SetTypedTuple(nbVerts + i, this->EdgeColor);
-  }
-
-  for (int i = 0; i < nbPolys; i++)
-  {
-    colorArray->SetTypedTuple(nbVerts + nbLines + i, this->FaceColor);
-  }
-
-  // Initialize the primitive colors from the created color array
-  this->InitializePrimColors();
-
-  // Clear saved group visibilities
-  this->SavedGroupVisibilities.clear();
-
-  // Initialize saved cell opacities
-  this->SavedCellOpacities.clear();
-  this->SavedCellOpacities.resize(nbVerts + nbLines + nbPolys, 255);
-
-  // Reset texture and selection
-  if (this->CellScalarTexture)
-  {
-    this->CellScalarTexture->Delete();
-    this->CellScalarTexture = nullptr;
-  }
-
-  if (this->CellScalarBuffer)
-  {
-    this->CellScalarBuffer->Delete();
-    this->CellScalarBuffer = nullptr;
-  }
-
-  this->SelectedIds.clear();
-  this->PreselectedCellId = -1;
-  this->ForceUpdate();
-}
-
-//----------------------------------------------------------------------------
-void vtkCADMapper::InitializePrimColors()
-{
-  DBG_FUN();
-
-  vtkPolyData* input = vtkPolyData::SafeDownCast(this->GetInput());
-  if(!input)
-  {
-    vtkErrorMacro("Unable to retrieve input polydata.");
-    return;
-  }
-
-  vtkUnsignedCharArray* colorArray = vtkUnsignedCharArray::SafeDownCast(input->GetCellData()->GetAbstractArray("RGB"));
-  if(!colorArray)
-  {
-    vtkErrorMacro("Unable to retrieve the input color array.");
-    return;
-  }
-
-  // Map the VTK cell color values to the OpenGL primitives color values
-  unsigned char* colorPtr = colorArray->GetPointer(0);
-  const int opacity = this->GroupModeEnabled ? 0 : 255;
-
-  this->PrimColors.clear();
-  this->PrimColors.reserve(4 * this->CellCellMap->GetSize());
-  for (size_t i = 0; i < this->CellCellMap->GetSize(); i++)
-  {
-    for (int j = 0; j < 3; j++)
-    {
-      this->PrimColors.push_back(colorPtr[this->CellCellMap->GetValue(i) * 3 + j]);
-    }
-    this->PrimColors.push_back(opacity);
-  }
-}
-
-//----------------------------------------------------------------------------
-void vtkCADMapper::PrintSelf(ostream& os, vtkIndent indent)
-{
-  DBG_FUN();
-
-  this->Superclass::PrintSelf(os, indent);
-}
-
-//----------------------------------------------------------------------------
-void vtkCADMapper::AddCellIdsToSelectionPrimitives(vtkPolyData* poly, const char* arrayName,
-  unsigned int processId, unsigned int compositeIndex, vtkIdType selectedId)
-{
-  MSGEL("...vtkCADMapper::AddCellIdsToSelectionPrimitives(array=" << (arrayName ? arrayName : "") << ", procId=" << processId << ", compIdx=" << compositeIndex << ", selId=" << (int)selectedId << ")");
-  // DBG_FUN();
-  // ARG(arrayName);
-  // ARG(processId);
-  // ARG(compositeIndex);
-  // ARG2(selectedId, long);
-
-  this->BuildSelectionCache(arrayName, false, poly);
-  this->CurrentArrayName = arrayName;
-
-  // If we are selecting an already selected cell, remove it
-  auto idIterator = this->SelectedIds.find(selectedId);
-  if (idIterator != this->SelectedIds.end())
-  {
-    if (!this->Selecting)
-    {
-      return;
-    }
-    for (vtkIdType idx :
-      this->SelectionCache[std::make_tuple(processId, compositeIndex, selectedId)])
-    {
-      this->ToggleResetColor(idx);
-    }
-    this->SelectedIds.erase(idIterator);
-    return;
-  }
-
-  if (!this->Selecting)
-  {
-    if (this->PreselectedCellId == selectedId)
-    {
-      return;
-    }
-    this->PreselectedCellId = selectedId;
-    this->ForceUpdate();
-  }
-  else
-  {
-    this->PreselectedCellId = -1;
-    for (vtkIdType idx :
-      this->SelectionCache[std::make_tuple(processId, compositeIndex, selectedId)])
-    {
-      this->ToggleSelectColor(idx);
-    }
-    this->SelectedIds.emplace(selectedId);
-    this->ForceUpdate();
-  }
-}
diff --git a/src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtkCADMapper.h b/src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtkCADMapper.h
deleted file mode 100644 (file)
index 2148780..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-#ifndef vtkCADMapper_h
-#define vtkCADMapper_h
-
-#include "CADRepresentationsModule.h" // for export macro
-
-#include <vtkOpenGLPolyDataMapper.h>
-
-#include <set>
-#include <vector>
-
-class CADREPRESENTATIONS_EXPORT vtkCADMapper : public vtkOpenGLPolyDataMapper
-{
-public:
-  static vtkCADMapper* New();
-  vtkTypeMacro(vtkCADMapper, vtkOpenGLPolyDataMapper);
-  void PrintSelf(ostream& os, vtkIndent indent) override;
-
-  /**
-   *  Set the opacity value for the given VTK cell.
-   */
-  void SetOpacity(vtkIdType id, unsigned char opacity);
-
-  /**
-   *  Set the reset color value for the given VTK cell.
-   */
-  void ToggleResetColor(vtkIdType id);
-
-
-  /**
-   *  Set the select color value for the given VTK cell.
-   */
-  void ToggleSelectColor(vtkIdType id);
-
-
-  /**
-   *  Set the preselect color value for the given VTK cell.
-   */
-  void TogglePreselectColor(vtkIdType id);
-
-  /**
-   *  Initialize the map between the VTK cells and OpenGL primitives.
-   *  Initialize also the colors of the primitives using this map
-   *  and the defined colors (Face/Vertex/Edge colors)
-   */
-  void Initialize();
-
-  /**
-   * Force BuildCellTextures to execute for the next rendering step.
-   */
-  void ForceUpdate();
-
-  ///@{
-  /**
-   * Mark the begining and the end of the selection.
-   */
-  void BeginSelect();
-  void EndSelect();
-  ///@}
-
-  /**
-   * Create a new selection group, and reset the selection.
-   */
-  void CreateGroup();
-
-  /**
-   * If in group mode, set the visibility of the given selection group.
-   */
-  void SetGroupVisibility(int groupIdx, bool visibility);
-
-  /**
-   * If in group mode, set the opacity of the given selection group.
-   */
-  void SetGroupOpacity(int groupIdx, unsigned char opacity);
-
-  /**
-   * Enable/disable the Group Mode. In this mode, you visualize
-   * groups you saved (with the CreateGroup function). Only one
-   * group can be displayed at a time.
-   */
-  void SetGroupModeEnabled(bool enabled);
-
-  /**
-   * Reset the current selection.
-   */
-  void ResetSelection();
-
-protected:
-  vtkCADMapper() = default;
-  ~vtkCADMapper() = default;
-
-  /**
-   * Called each time a render pass is done. Pushes the primitive colors (PrimColors)
-   * on the OpenGL side.
-   */
-  void BuildCellTextures(
-    vtkRenderer* ren, vtkActor* actor, vtkCellArray* prims[4], int representation) override;
-
-private:
-  vtkCADMapper(const vtkCADMapper&) = delete;
-  void operator=(const vtkCADMapper&) = delete;
-
-  /**
-   * Called during the render pass if the mapper's selection (vtkSelection) changed.
-   * - Save the preselected id in order to render pre-selection when BuildCellTextures is called
-   * - If a new selected id is furnished, add it to the SelectedId cache and toggle
-   *   the selection color for the corresponding vtkCell ids using the SelectionCache map.
-   *
-   * Selected / preselected ids are values of the data array (arrayName), which allow to
-   * map geometry elements to their vtkCell counterparts. This mapping is stored in the
-   * SelectionCache map.
-   */
-  void AddCellIdsToSelectionPrimitives(vtkPolyData* poly, const char* arrayName,
-    unsigned int processId, unsigned int compositeIndex, vtkIdType selectedId) override;
-
-  /**
-   * Initialise the primitive colors using color array stored in the input polydata.
-   * Also initialize the opacity values (depending on current mode).
-   */
-  void InitializePrimColors();
-
-  // VTK cells to OpenGL primitives map
-  std::vector<std::vector<vtkIdType>> CellToPrimMap;
-  // Store the currenly selected ids (array values)
-  std::set<vtkIdType> SelectedIds;
-  // Store all the saved selection groups and their respective array name
-  // (type of cell to select)
-  std::vector<std::pair<std::set<vtkIdType>, std::string>> SavedGroups;
-  // OpenGL primitives color, used in the BuildCellTextures method.
-  std::vector<unsigned char> PrimColors;
-  // Store the current preselected id (array value)
-  vtkIdType PreselectedCellId = -1;
-  bool NeedUpdate = false;
-  bool Selecting = false;
-  std::string CurrentArrayName;
-  bool GroupModeEnabled = false;
-
-  std::vector<bool> SavedGroupVisibilities;
-  std::vector<unsigned char> SavedCellOpacities;
-
-  const unsigned char FaceColor[3] = { 255, 255, 255 };
-  const unsigned char EdgeColor[3] = { 0, 255, 0 };
-  const unsigned char VertexColor[3] = { 255, 128, 0 };
-  const unsigned char PreselectionColor[3] = { 0, 0, 255 };
-  const unsigned char SelectionColor[3] = { 255, 0, 0 };
-  const unsigned char GroupSelectionColor[3] = { 0, 255, 255 };
-};
-
-#endif
diff --git a/src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtkCADRepresentation.cxx b/src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtkCADRepresentation.cxx
deleted file mode 100644 (file)
index d1e879d..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-#include "vtkCADMapper.h"
-#include "vtkCADRepresentation.h"
-
-#include <vtkActor.h>
-#include <vtkCellData.h>
-#include <vtkDataObject.h>
-#include <vtkInformation.h>
-#include <vtkInformationVector.h>
-#include <vtkObjectFactory.h>
-#include <vtkPolyData.h>
-#include <vtkPVRenderView.h>
-#include <vtkPVView.h>
-#include <vtkRenderer.h>
-#include <vtkSelection.h>
-
-#include <vtkMultiProcessController.h>
-#include <vtkAlgorithmOutput.h>
-#include <vtkSMSession.h>
-#include <vtkProcessModule.h>
-#include <vtkSelectionNode.h>
-
-//---------------------------------------------------------
-#define USE_DEBUG
-#define MB_IGNORE_QT
-static const char *dbg_class = "vtkCADRepresentation";
-#include "MBDebug.h"
-//---------------------------------------------------------
-
-
-vtkStandardNewMacro(vtkCADRepresentation);
-
-//----------------------------------------------------------------------------
-vtkCADRepresentation::vtkCADRepresentation()
-{
-  DBG_FUN();
-
-  this->Actor->SetMapper(this->Mapper);
-
-  vtkNew<vtkSelection> sel;
-  this->Mapper->SetSelection(sel);
-
-  this->SetArrayIdNames(nullptr, nullptr);
-}
-
-//----------------------------------------------------------------------------
-int vtkCADRepresentation::ProcessViewRequest(vtkInformationRequestKey* request_type, vtkInformation* inInfo,
-  vtkInformation* outInfo)
-{
-  DBG_FUN();
-
-  if (!this->Superclass::ProcessViewRequest(request_type, inInfo, outInfo))
-  {
-    return 0;
-  }
-
-  if (request_type == vtkPVView::REQUEST_UPDATE())
-  {
-    MSGEL("....vtkCADRepresentation::ProcessViewRequest(REQUEST_UPDATE)");
-    vtkPVRenderView::SetPiece(inInfo, this, this->PolyData);
-    vtkPVRenderView::SetGeometryBounds(inInfo, this, this->PolyData->GetBounds());
-  }
-  else if (request_type == vtkPVView::REQUEST_RENDER())
-  {
-    MSGEL("....vtkCADRepresentation::ProcessViewRequest(REQUEST_RENDER)");
-    vtkAlgorithmOutput* producerPort = vtkPVRenderView::GetPieceProducer(inInfo, this);
-    this->Mapper->SetInputConnection(producerPort);
-
-    if(!this->IsInitialized)
-    {
-      this->Mapper->Initialize();
-      this->IsInitialized = true;
-    }
-  }
-
-  return 1;
-}
-
-//------------------------------------------------------------------------------
-void vtkCADRepresentation::SetVisibility(bool value)
-{
-  DBG_FUN();
-  ARG(value);
-
-  this->Superclass::SetVisibility(value);
-  this->Actor->SetVisibility(value);
-}
-
-//----------------------------------------------------------------------------
-void vtkCADRepresentation::BeginSelect()
-{
-  DBG_FUN();
-
-  if(this->IsInitialized)
-  {
-    this->Mapper->BeginSelect();
-  }
-}
-
-//----------------------------------------------------------------------------
-void vtkCADRepresentation::EndSelect()
-{
-  DBG_FUN();
-
-  if(this->IsInitialized)
-  {
-    this->Mapper->EndSelect();
-  }
-}
-
-//----------------------------------------------------------------------------
-void vtkCADRepresentation::CreateGroup()
-{
-  DBG_FUN();
-
-  if(this->IsInitialized)
-  {
-    this->Mapper->CreateGroup();
-  }
-}
-
-//----------------------------------------------------------------------------
-void vtkCADRepresentation::SetGroupVisibility(int groupIdx, bool visibility)
-{
-  DBG_FUN();
-  ARG(groupIdx);
-  ARG(visibility);
-
-  if(this->IsInitialized)
-  {
-    this->Mapper->SetGroupVisibility(groupIdx, visibility);
-  }
-}
-
-//----------------------------------------------------------------------------
-void vtkCADRepresentation::SetGroupOpacity(int groupIdx, unsigned char opacity)
-{
-  DBG_FUN();
-  ARG(groupIdx);
-  ARG2(opacity, int);
-
-  if(this->IsInitialized)
-  {
-    this->Mapper->SetGroupOpacity(groupIdx, opacity);
-  }
-}
-
-//----------------------------------------------------------------------------
-void vtkCADRepresentation::SetGroupModeEnabled(bool enabled)
-{
-  DBG_FUN();
-  ARG(enabled);
-
-  if(this->IsInitialized)
-  {
-    this->Mapper->SetGroupModeEnabled(enabled);
-  }
-}
-
-//----------------------------------------------------------------------------
-void vtkCADRepresentation::Reset()
-{
-  DBG_FUN();
-
-  if(this->IsInitialized)
-  {
-    this->Mapper->ResetSelection();
-  }
-}
-
-//------------------------------------------------------------------------------
-int vtkCADRepresentation::FillInputPortInformation(int vtkNotUsed(port), vtkInformation* info)
-{
-  DBG_FUN();
-
-  info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
-
-  // Saying INPUT_IS_OPTIONAL() is essential, since representations don't have
-  // any inputs on client-side (in client-server, client-render-server mode) and
-  // render-server-side (in client-render-server mode).
-  info->Set(vtkAlgorithm::INPUT_IS_OPTIONAL(), 1);
-
-  return 1;
-}
-
-//------------------------------------------------------------------------------
-int vtkCADRepresentation::RequestData(
-  vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
-{
-  DBG_FUN();
-
-  if (inputVector[0]->GetNumberOfInformationObjects() == 1)
-  {
-    MSGEL("....for a SINGLE info object");
-    vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
-    vtkPolyData* polyData = vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
-    this->PolyData->ShallowCopy(polyData);
-  }
-  else
-  {
-    this->PolyData->Initialize();
-  }
-
-  return this->Superclass::RequestData(request, inputVector, outputVector);
-}
-
-//------------------------------------------------------------------------------
-bool vtkCADRepresentation::AddToView(vtkView* view)
-{
-  DBG_FUN();
-
-  vtkPVRenderView* rview = vtkPVRenderView::SafeDownCast(view);
-  if (rview)
-  {
-    MSGEL("....Renderer->AddActor()");
-    rview->GetRenderer()->AddActor(this->Actor);
-
-    // Indicate that this is prop that we are rendering when hardware selection
-    // is enabled.
-    rview->RegisterPropForHardwareSelection(this, this->Actor);
-    return this->Superclass::AddToView(view);
-  }
-  return false;
-}
-
-//------------------------------------------------------------------------------
-bool vtkCADRepresentation::RemoveFromView(vtkView* view)
-{
-  DBG_FUN();
-
-  vtkPVRenderView* rview = vtkPVRenderView::SafeDownCast(view);
-  if (rview)
-  {
-    rview->GetRenderer()->RemoveActor(this->Actor);
-    rview->UnRegisterPropForHardwareSelection(this, this->Actor);
-    return this->Superclass::RemoveFromView(view);
-  }
-  return false;
-}
-
-//----------------------------------------------------------------------------
-void vtkCADRepresentation::PrintSelf(ostream& os, vtkIndent indent)
-{
-  DBG_FUN();
-
-  this->Superclass::PrintSelf(os, indent);
-}
-
-//----------------------------------------------------------------------------
-void vtkCADRepresentation::SetSelectionConnection(vtkAlgorithmOutput* input)
-{
-  DBG_FUN();
-
-  // Copied from vtkCompositeRepresentation
-  if (!input)
-  {
-    return;
-  }
-
-  vtkMultiProcessController* controller = vtkMultiProcessController::GetGlobalController();
-  int numPiece = controller->GetNumberOfProcesses();
-  int piece = controller->GetLocalProcessId();
-  input->GetProducer()->UpdatePiece(piece, numPiece, 0);
-
-  vtkSmartPointer<vtkSelection> sel;
-  int actualNbPieces = numPiece;
-
-  vtkSMSession* session =
-    vtkSMSession::SafeDownCast(vtkProcessModule::GetProcessModule()->GetSession());
-  if (session)
-  {
-    actualNbPieces = session->GetNumberOfProcesses(vtkPVSession::DATA_SERVER);
-  }
-
-  // in order to handle the case where we are connected to a parallel server using
-  // local rendering, we have to compare the number of processes here
-  if (numPiece < actualNbPieces && piece == 0)
-  {
-    vtkSelection* localSel =
-      vtkSelection::SafeDownCast(input->GetProducer()->GetOutputDataObject(0));
-    sel = vtkSmartPointer<vtkSelection>::New();
-    sel->ShallowCopy(localSel);
-
-    for (int i = 1; i < actualNbPieces; i++)
-    {
-      input->GetProducer()->UpdatePiece(i, actualNbPieces, 0);
-      localSel = vtkSelection::SafeDownCast(input->GetProducer()->GetOutputDataObject(0));
-      if (localSel->GetNumberOfNodes() > 1)
-      {
-        vtkWarningMacro("Only the first node of a selection will be considered.");
-      }
-      vtkSelectionNode* node = localSel->GetNode(0);
-      node->GetProperties()->Set(vtkSelectionNode::PROCESS_ID(), i);
-      sel->AddNode(localSel->GetNode(0));
-    }
-  }
-  else
-  {
-    sel = vtkSelection::SafeDownCast(input->GetProducer()->GetOutputDataObject(0));
-    if (sel->GetNumberOfNodes() > 1)
-    {
-      vtkWarningMacro("Only the first node of a selection will be considered.");
-    }
-    sel->GetNode(0)->GetProperties()->Set(vtkSelectionNode::PROCESS_ID(), piece);
-  }
-
-  this->Mapper->GetSelection()->ShallowCopy(sel);
-}
-
-//----------------------------------------------------------------------------
-void vtkCADRepresentation::SetArrayIdNames(const char* pointArray, const char* cellArray)
-{
-  DBG_FUN();
-  ARG(pointArray);
-  ARG(cellArray);
-
-  vtkCADMapper* mapper = vtkCADMapper::SafeDownCast(this->Mapper);
-  mapper->SetPointIdArrayName(pointArray ? pointArray : "vtkOriginalPointIds");
-  mapper->SetCellIdArrayName(cellArray ? cellArray : "vtkOriginalCellIds");
-}
diff --git a/src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtkCADRepresentation.h b/src/SPV3D/plugins/cadRepresentations/CADRepresentations/vtkCADRepresentation.h
deleted file mode 100644 (file)
index e3a277b..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef vtkCADRepresentation_h
-#define vtkCADRepresentation_h
-
-#include "CADRepresentationsModule.h" // for export macro
-
-#include <vtkPVDataRepresentation.h>
-
-#include <array>
-#include <map>
-#include <unordered_set>
-#include <vector>
-
-class vtkActor;
-class vtkCADMapper;
-
-enum SelectionType : unsigned char
-{
-  GeometrySolids = 0,
-  GeometryVertices,
-  GeometryEdges,
-  GeometryFaces,
-  SelectionTypeCount
-};
-class CADREPRESENTATIONS_EXPORT vtkCADRepresentation
-  : public vtkPVDataRepresentation
-{
-public:
-  static vtkCADRepresentation* New();
-  vtkTypeMacro(vtkCADRepresentation, vtkPVDataRepresentation);
-  void PrintSelf(ostream& os, vtkIndent indent) override;
-
-  int ProcessViewRequest(vtkInformationRequestKey* request_type, vtkInformation* inInfo,
-    vtkInformation* outInfo) override;
-
-  /**
-   * Set the pre-configured selection source for making the selection.
-   * The vtkSelection is obtained internally and forwarded to the mapper
-   */
-  void SetSelectionConnection(vtkAlgorithmOutput* input);
-
-  /**
-   * Set the visibility of the rendered actor.
-   */
-  void SetVisibility(bool val) override;
-
-  void Reset();
-  void BeginSelect();
-  void EndSelect();
-
-  /**
-   * Create a new selection group, and reset the selection.
-   * Forwarded to the mapper.
-   */
-  void CreateGroup();
-
-  /**
-   * If in group mode, set the visibility of the given selection group.
-   * Forwarded to the mapper.
-   */
-  void SetGroupVisibility(int groupIdx, bool visibility);
-
-  /**
-   * If in group mode, set the opacity of the given selection group.
-   * Forwarded to the mapper.
-   */
-  void SetGroupOpacity(int groupIdx, unsigned char opacity);
-
-  /**
-   * Enable/disable the Group Mode. In this mode, you visualize
-   * groups you saved (with the CreateGroup function). Only one
-   * group can be displayed at a time.
-   * Forwarded to the mapper.
-   */
-  void SetGroupModeEnabled(bool enabled);
-
-  /**
-   * Add a shape to the list of selected shapes that will
-   * be modified by setOpacity / toggleColor functions
-   * (for debugging purposes).
-   */
-  void AddShape(vtkIdType groupId, vtkIdType cellId);
-
-  void SetArrayIdNames(const char* pointArray, const char* cellArray) override;
-protected:
-  vtkCADRepresentation();
-  ~vtkCADRepresentation() = default;
-
-  int FillInputPortInformation(int port, vtkInformation* info) override;
-  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
-  bool AddToView(vtkView* view) override;
-  bool RemoveFromView(vtkView* view) override;
-
-  bool IsInitialized = false;
-  vtkNew<vtkActor> Actor;
-  vtkNew<vtkCADMapper> Mapper;
-  vtkNew<vtkPolyData> PolyData;
-
-private:
-  vtkCADRepresentation(const vtkCADRepresentation&) = delete;
-  void operator=(const vtkCADRepresentation&) = delete;
-};
-
-#endif // vtkCADRepresentation_h
diff --git a/src/SPV3D/plugins/cadRepresentations/CMakeLists.txt b/src/SPV3D/plugins/cadRepresentations/CMakeLists.txt
deleted file mode 100644 (file)
index 57849ac..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-paraview_add_plugin(CADRepresentation
-  VERSION "1.0"
-  MODULES CADRepresentations
-  MODULE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/CADRepresentations/vtk.module"
-  XML_DOCUMENTATION OFF)
diff --git a/src/SPV3D/plugins/cadRepresentations/paraview.plugin b/src/SPV3D/plugins/cadRepresentations/paraview.plugin
deleted file mode 100644 (file)
index 239ebf1..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-NAME
-  CADRepresentation
-DESCRIPTION
-  CADViewer plugin providing representations.
-REQUIRES_MODULES
-  ParaView::RemotingViews
-  VTK::CommonCore
-  VTK::CommonDataModel
-  VTK::RenderingOpenGL2
diff --git a/src/SPV3D/plugins/cadSources/CADSources/CADSource.xml b/src/SPV3D/plugins/cadSources/CADSources/CADSource.xml
deleted file mode 100644 (file)
index 5911cac..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<ServerManagerConfiguration>
-  <ProxyGroup name="sources">
-   <SourceProxy name="GeometryGenerator" class="vtkGeometryGenerator">
-    <IntVectorProperty
-         name="EdgeSubdivision"
-         command="SetEdgeSubdivision"
-         number_of_elements="1"
-         default_values="5" >
-    </IntVectorProperty>
-    <IntVectorProperty
-         name="NumberOfSolids"
-         command="SetNumberOfSolids"
-         number_of_elements="1"
-         default_values="100" >
-    </IntVectorProperty>
-   </SourceProxy>
-  <!--
-   <SourceProxy name="ShapeSource" class="vtkShapeSource">
-    <IntVectorProperty
-         name="NumberOfSolids"
-         command="SetNumberOfSolids"
-         number_of_elements="1"
-         default_values="10" >
-    </IntVectorProperty>
-   </SourceProxy>
- </ProxyGroup>
- <ProxyGroup name="filters">
-  <SourceProxy name="MeshGenerator" class="vtkMeshGenerator">
-   <InputProperty
-        name="Input"
-        command="SetInputConnection">
-    <DataTypeDomain name="input_type">
-     <DataType value="vtkPolyData"/>
-    </DataTypeDomain>
-   </InputProperty>
-  </SourceProxy>
-  -->
- </ProxyGroup>
-</ServerManagerConfiguration>
diff --git a/src/SPV3D/plugins/cadSources/CADSources/CMakeLists.txt b/src/SPV3D/plugins/cadSources/CADSources/CMakeLists.txt
deleted file mode 100644 (file)
index 224a42b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-set(classes
-  vtkGeometryGenerator
-  vtkMeshGenerator)
-
-vtk_module_add_module(CADSources
-  FORCE_STATIC 
-  CLASSES ${classes})
-
-paraview_add_server_manager_xmls(
-  XMLS  CADSource.xml)
diff --git a/src/SPV3D/plugins/cadSources/CADSources/MBDebug.h b/src/SPV3D/plugins/cadSources/CADSources/MBDebug.h
deleted file mode 100644 (file)
index bb70115..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-#ifndef MBDebug_HeaderFile\r
-#define MBDebug_HeaderFile\r
-\r
-//---------------------------------------------------------------\r
-// Usage of the logging facilities:\r
-//\r
-//  (1) At the beginning of each class file to be debugged, there\r
-//      should be a static string variable defined with the name\r
-//      of the class. Then, include the "MBDebug.h" header file.\r
-//\r
-//      //---------------------------------------------------------\r
-//      #define USE_DEBUG\r
-//      //#define MB_IGNORE_QT\r
-//      #define MB_CLASSNAME "ClassName"\r
-//      #include "MBDebug.h"\r
-//      //---------------------------------------------------------\r
-//\r
-//  (2) At the beginning of each class method, call the DBG_FUN\r
-//      macro.\r
-//\r
-//      int ClassName::MyMethod(int x)\r
-//      {\r
-//        DBG_FUN();\r
-//        ...\r
-//      }\r
-//\r
-//      NOTE: For static methods, call the DBG_FUNC() macro!!\r
-//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r
-//  This debugging/logging class is a "header-only" solution and\r
-//  does NOT require any additional implementation (.cpp) file!\r
-//---------------------------------------------------------------\r
-\r
-#include <iostream>\r
-#include <string>\r
-#include <locale>\r
-#include <codecvt>\r
-#include <list>\r
-#include <map>\r
-#include <set>\r
-#include <vector>\r
-#ifndef MB_IGNORE_QT\r
-# include <qstring.h>\r
-#endif\r
-\r
-//---------------------------------------------------------------\r
-//     Set the debug flags dependent on the preprocessor definitions\r
-//---------------------------------------------------------------\r
-#ifdef USE_DEBUG\r
-#      define MBS_DEBUG_FLAG           MBDebug::DF_DEBUG\r
-#else\r
-#      define MBS_DEBUG_FLAG           0\r
-#endif /*DEBUG*/ \r
-\r
-#define        MBS_DBG_FLAGS                   (MBS_DEBUG_FLAG)\r
-\r
-\r
-//---------------------------------------------------------------\r
-//     Define the global debug macros\r
-//---------------------------------------------------------------\r
-#define DLOG                                                   MBDebug::LogPrint()\r
-#define RETURN(var)                            { RET(var); return (var); }\r
-\r
-#ifdef USE_DEBUG\r
-\r
-# define DBG_FUN()                             MBDebug _dbg(MB_CLASSNAME, __FUNCTION__, MBS_DBG_FLAGS, (void*)this)\r
-# define DBG_FUNC()                            MBDebug _dbg(MB_CLASSNAME, __FUNCTION__, MBS_DBG_FLAGS)\r
-# define DBG_FUNB(blk)         MBDebug _dbg(MB_CLASSNAME, blk, MBS_DBG_FLAGS)\r
-#      define MSGEL(txt)                               MBDebug::LogPrint() << txt << std::endl\r
-#      define PRINT(txt)                               MBDebug::LogPrint() << txt\r
-#      define SHOW2(var,typ)           DumpVar(#var,(typ)(var))\r
-#      define SHOW(var)                                DumpVar(#var,var)\r
-#      define ARG(var)                                 do { PRINT("in:"); DumpVar(#var,var); } while (0)\r
-#      define ARG2(var,typ)            do { PRINT("in:"); DumpVar(#var,(typ)(var)); } while (0)\r
-#      define RET(var)                                 do { PRINT("out:"); DumpVar(#var,var); } while (0)\r
-#      define MSG(txt)                                 MBDebug::LogPrint() << txt\r
-\r
-#else  /*!USE_DEBUG*/ \r
-\r
-#      define DBG_FUN()\r
-#      define DBG_FUNC()\r
-#      define DBG_FUNB(blk)\r
-#      define MSGEL(txt)\r
-#      define PRINT(txt)\r
-#      define SHOW2(var,typ)\r
-#      define SHOW(var)\r
-#      define ARG(var)\r
-#      define ARG2(var,typ)\r
-#      define RET(var)\r
-#      define MSG(txt)\r
-\r
-#endif /*USE_DEBUG*/ \r
-\r
-\r
-//---------------------------------------------------------------\r
-//     Declare the debugging and profiling class\r
-//---------------------------------------------------------------\r
-class MBDebug\r
-{\r
-public:\r
-       enum {\r
-               DF_NONE                 = 0x00,         // no debug\r
-               DF_DEBUG                = 0x01          // debug a function\r
-       };\r
-\r
-       MBDebug(const char* aClassName, const char* aFuncName, const short aFlag, void* aThis=NULL)\r
-       :mClassName(aClassName),mFuncName(aFuncName),mThis(aThis),mFlags((unsigned char)aFlag)\r
-  {\r
-       if (mFlags & (DF_DEBUG))\r
-       {\r
-               std::cout << "{ENTER: " << mClassName + "::" + mFuncName;\r
-               if (mThis) std::cout << "(this=" << mThis << ")";\r
-               std::cout << std::endl;\r
-       }\r
-  }\r
-       virtual ~MBDebug()\r
-  {\r
-       if (mFlags & (DF_DEBUG))\r
-               std::cout << "}LEAVE: " << mClassName << "::" << mFuncName << std::endl;\r
-  }\r
-\r
-       // Log file output management\r
-       static std::ostream&    LogPrint()      { return std::cout; }\r
-\r
-private:\r
-       std::string                     mClassName;     // Name of class to be debugged\r
-       std::string                     mFuncName;      // Name of function to be debugged\r
-       void*                           mThis;            // The "this" pointer to the class being debugged\r
-       unsigned char           mFlags;                 // Debug mode flags\r
-};\r
-\r
-\r
-\r
-#define YesNo(b)       (b ? "Yes" : "No")\r
-\r
-\r
-\r
-inline std::string w2s(std::wstring ws)\r
-{\r
-       using convert_typeX = std::codecvt_utf8<wchar_t>;\r
-       std::wstring_convert<convert_typeX, wchar_t> converterX;\r
-       return(converterX.to_bytes(ws));\r
-}\r
-\r
-// Primitive types\r
-inline void DumpVar(const char *szName, char value)\r
-{\r
-       DLOG << "[chr]: " << szName << "='" << value << "'" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, bool value)\r
-{\r
-       DLOG << "[bool]: " << szName << "=" << (value ? "true" : "false") << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, short value)\r
-{\r
-       DLOG  << "[shrt]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, int value)\r
-{\r
-       DLOG << "[int]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, long value)\r
-{\r
-       DLOG << "[long]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, double value)\r
-{\r
-       DLOG << "[dbl]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned char value)\r
-{\r
-       DLOG << "[byte]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned short value)\r
-{\r
-       DLOG << "[word]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned int value)\r
-{\r
-       DLOG << "[uint]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, unsigned long value)\r
-{\r
-       DLOG << "[dword]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const char* value)\r
-{\r
-       DLOG << "[str]: " << szName << "=\"" << (value ? value : "") << "\"" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::string &value)\r
-{\r
-       DLOG << "[Str]: " << szName << "=\"" << value << "\"" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::wstring &value)\r
-{\r
-       DLOG << "[WStr]: " << szName << "=\"" << w2s(value) << "\"" << std::endl;\r
-}\r
-\r
-#ifndef MB_IGNORE_QT\r
-inline void DumpVar(const char *szName, const QString &value)\r
-{\r
-       DLOG << "[QStr]: " << szName << "=\"" << value.toStdString() << "\"" << std::endl;\r
-}\r
-#endif\r
-\r
-inline void DumpVar(const char *szName, const void* value)\r
-{\r
-       DLOG << "[ptr]: " << szName << "=" << value << std::endl;\r
-}\r
-\r
-\r
-// Collection of primitive types\r
-inline void DumpVar(const char *szName, const std::set<int> &values)\r
-{\r
-       DLOG << "[intSet]: " << szName << "={" << values.size() << "}[";\r
-       bool bFirst = true;\r
-       for (auto it=values.cbegin(); it!=values.cend(); ++it)\r
-               DLOG << (bFirst ? "" : ",") << *it;\r
-       DLOG << "]" << std::endl;\r
-}\r
-\r
-inline void DumpVar(const char *szName, const std::list<bool>& values)\r
-{\r
-       DLOG << "[boolList]: " << szName << "={" << values.size() << "}[";\r
-       bool bFirst = true;\r
-       for (auto it=values.cbegin(); it!=values.cend(); ++it)\r
-               DLOG << (bFirst ? "" : ",") << (*it ? "Y" : "N");\r
-       DLOG << "]" << std::endl;\r
-}\r
-\r
-\r
-#endif // MBDebug_HeaderFile\r
diff --git a/src/SPV3D/plugins/cadSources/CADSources/vtk.module b/src/SPV3D/plugins/cadSources/CADSources/vtk.module
deleted file mode 100644 (file)
index 612a211..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-NAME
-  CADSources
-DEPENDS
-  VTK::FiltersCore
-PRIVATE_DEPENDS
-  VTK::CommonCore
-  VTK::CommonExecutionModel
diff --git a/src/SPV3D/plugins/cadSources/CADSources/vtkGeometryGenerator.cxx b/src/SPV3D/plugins/cadSources/CADSources/vtkGeometryGenerator.cxx
deleted file mode 100644 (file)
index 540d7bf..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-/*=========================================================================
-
-  Program:   Visualization Toolkit
-  Module:    vtkGeometryGenerator.cxx
-
-  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
-  All rights reserved.
-  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
-     This software is distributed WITHOUT ANY WARRANTY; without even
-     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-     PURPOSE.  See the above copyright notice for more information.
-
-=========================================================================*/
-#include "vtkGeometryGenerator.h"
-
-#include <vtkCellArray.h>
-#include <vtkCellData.h>
-#include <vtkIdTypeArray.h>
-#include <vtkInformation.h>
-#include <vtkInformationVector.h>
-#include <vtkObjectFactory.h>
-#include <vtkPointData.h>
-#include <vtkPoints.h>
-#include <vtkPolyData.h>
-
-#include <array>
-#include <cfenv>
-
-//---------------------------------------------------------
-#define USE_DEBUG
-#define MB_IGNORE_QT
-#define MB_CLASSNAME "vtkGeometryGenerator"
-#include "MBDebug.h"
-//---------------------------------------------------------
-
-
-vtkStandardNewMacro(vtkGeometryGenerator);
-
-//----------------------------------------------------------------------------
-vtkGeometryGenerator::vtkGeometryGenerator()
-{
-  DBG_FUN();
-  this->SetNumberOfInputPorts(0);
-}
-
-//----------------------------------------------------------------------------
-void vtkGeometryGenerator::PrintSelf(ostream& os, vtkIndent indent)
-{
-  DBG_FUN();
-  this->Superclass::PrintSelf(os, indent);
-}
-
-//----------------------------------------------------------------------------
-int vtkGeometryGenerator::RequestData(vtkInformation* vtkNotUsed(request),
-  vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector)
-{
-  DBG_FUN();
-  // get the output
-  vtkPolyData* output = vtkPolyData::GetData(outputVector);
-
-  unsigned int nbPoints = 8                                         // cube points
-    + 12 * (this->EdgeSubdivision - 1)                              // additional points on edges
-    + 6 * (this->EdgeSubdivision - 1) * (this->EdgeSubdivision - 1) // additional points on faces
-    ;
-
-  unsigned int nbLines = 12;
-  unsigned int nbPointsPerLine = this->EdgeSubdivision + 1;
-  unsigned int sizeLines = nbLines * (nbPointsPerLine + 1);
-
-  unsigned int nbQuads = 6 * this->EdgeSubdivision * this->EdgeSubdivision;
-  unsigned int sizeQuads = nbQuads * 5;
-  SHOW2(nbPoints, int); SHOW2(nbLines, int); SHOW2(nbQuads, int);
-
-  vtkNew<vtkPoints> points;
-  points->Allocate(this->NumberOfSolids * nbPoints);
-
-  vtkNew<vtkCellArray> vertices;
-  vertices->Allocate(this->NumberOfSolids * 8 * 2);
-
-  vtkNew<vtkCellArray> lines;
-  lines->Allocate(this->NumberOfSolids * sizeLines);
-
-  vtkNew<vtkCellArray> quads;
-  quads->Allocate(this->NumberOfSolids * sizeQuads);
-
-  unsigned int totalCells = this->NumberOfSolids * (8 + 12 + nbQuads);
-
-  vtkNew<vtkIdTypeArray> solidIdArray;
-  solidIdArray->SetName("Solid id");
-  solidIdArray->SetNumberOfComponents(1);
-  solidIdArray->Allocate(totalCells);
-
-  vtkNew<vtkIdTypeArray> faceIdArray;
-  faceIdArray->SetName("Face id");
-  faceIdArray->SetNumberOfComponents(1);
-  faceIdArray->Allocate(totalCells);
-
-  vtkNew<vtkIdTypeArray> edgeIdArray;
-  edgeIdArray->SetName("Edge id");
-  edgeIdArray->SetNumberOfComponents(1);
-  edgeIdArray->Allocate(totalCells);
-
-  vtkNew<vtkIdTypeArray> vertexIdArray;
-  vertexIdArray->SetName("Vertex id");
-  vertexIdArray->SetNumberOfComponents(1);
-  vertexIdArray->Allocate(totalCells);
-
-  int sizeRow;
-  int save_round = std::fegetround();
-  std::fesetround(FE_UPWARD);
-  sizeRow = std::lrint(std::cbrt(this->NumberOfSolids) - 1e-10);
-  std::fesetround(save_round);
-
-  // edge ids
-  std::array<std::vector<vtkIdType>, 12> edgesIds;
-  for (std::vector<vtkIdType>& v : edgesIds)
-  {
-    v.resize(this->EdgeSubdivision + 1);
-  }
-
-  // quads ids
-  std::array<std::vector<vtkIdType>, 6> quadsIds;
-  for (std::vector<vtkIdType>& v : quadsIds)
-  {
-    v.resize((this->EdgeSubdivision + 1) * (this->EdgeSubdivision + 1));
-  }
-
-  // cube creation
-  const double cubeLen = 0.5;
-  const double cubeSpacing = 1.0;
-  const double edgeLen = cubeLen / static_cast<double>(this->EdgeSubdivision);
-  unsigned int currentIndex = 0;
-  for (unsigned int i = 0; i < this->NumberOfSolids; i++)
-  {
-    double x = cubeSpacing * (i % sizeRow);
-    double y = cubeSpacing * ((i / sizeRow) % sizeRow);
-    double z = cubeSpacing * (i / (sizeRow * sizeRow));
-
-    // create vertices
-    std::array<vtkIdType, 8> verticesIds;
-
-    auto addPoint = [&](int id, double px, double py, double pz) {
-      verticesIds[id] = points->InsertNextPoint(px, py, pz);
-      vertices->InsertNextCell(1, &verticesIds[id]);
-    };
-
-    addPoint(0, x, y, z);
-    addPoint(1, x + cubeLen, y, z);
-    addPoint(2, x, y + cubeLen, z);
-    addPoint(3, x + cubeLen, y + cubeLen, z);
-    addPoint(4, x, y, z + cubeLen);
-    addPoint(5, x + cubeLen, y, z + cubeLen);
-    addPoint(6, x, y + cubeLen, z + cubeLen);
-    addPoint(7, x + cubeLen, y + cubeLen, z + cubeLen);
-
-    // create edges
-
-    auto addEdge = [&](int id, unsigned int vId1, unsigned int vId2, int comp) {
-      edgesIds[id][0] = verticesIds[vId1];
-      edgesIds[id][this->EdgeSubdivision] = verticesIds[vId2];
-      double p[3]; // position of starting point
-      points->GetPoint(verticesIds[vId1], p);
-      for (unsigned int j = 1; j < this->EdgeSubdivision; j++)
-      {
-        p[comp] += edgeLen;
-        edgesIds[id][j] = points->InsertNextPoint(p);
-      }
-      lines->InsertNextCell(this->EdgeSubdivision + 1, edgesIds[id].data());
-    };
-
-    addEdge(0, 0, 1, 0);
-    addEdge(1, 1, 3, 1);
-    addEdge(2, 2, 3, 0);
-    addEdge(3, 0, 2, 1);
-    addEdge(4, 4, 5, 0);
-    addEdge(5, 4, 6, 1);
-    addEdge(6, 6, 7, 0);
-    addEdge(7, 5, 7, 1);
-    addEdge(8, 0, 4, 2);
-    addEdge(9, 1, 5, 2);
-    addEdge(10, 3, 7, 2);
-    addEdge(11, 2, 6, 2);
-
-    // create faces
-    auto addFace = [&](int id, unsigned int eId1, unsigned int eId2, unsigned int eId3,
-                     unsigned int eId4, int compU, int compV, bool orientU, bool orientV) {
-      for (unsigned int j = 0; j < this->EdgeSubdivision + 1; j++)
-      {
-        // vertices will be written two times (for each edges) but it should be the same
-        int uid = orientU ? j : this->EdgeSubdivision - j;
-        int vid = orientV ? j : this->EdgeSubdivision - j;
-        quadsIds[id][j] = edgesIds[eId1][uid];
-        quadsIds[id][j + this->EdgeSubdivision * (this->EdgeSubdivision + 1)] = edgesIds[eId2][uid];
-        quadsIds[id][j * (this->EdgeSubdivision + 1)] = edgesIds[eId3][vid];
-        quadsIds[id][(j + 1) * (this->EdgeSubdivision + 1) - 1] = edgesIds[eId4][vid];
-      }
-
-      // create internal points
-      double p[3]; // position of starting corner
-      points->GetPoint(edgesIds[eId1][orientU ? 0 : this->EdgeSubdivision], p);
-
-      double v = p[compV];
-      for (unsigned int j = 1; j < this->EdgeSubdivision; j++)
-      {
-        p[compU] += orientV ? edgeLen : -edgeLen;
-        p[compV] = v;
-        for (unsigned int k = 1; k < this->EdgeSubdivision; k++)
-        {
-          p[compV] += orientU ? edgeLen : -edgeLen;
-          quadsIds[id][j * (this->EdgeSubdivision + 1) + k] = points->InsertNextPoint(p);
-        }
-      }
-
-      // link internal points
-      for (unsigned int j = 0; j < this->EdgeSubdivision; j++)
-      {
-        for (unsigned int k = 0; k < this->EdgeSubdivision; k++)
-        {
-          vtkIdType q[4] = { quadsIds[id][j * (this->EdgeSubdivision + 1) + k],
-            quadsIds[id][(j + 1) * (this->EdgeSubdivision + 1) + k],
-            quadsIds[id][(j + 1) * (this->EdgeSubdivision + 1) + k + 1],
-            quadsIds[id][j * (this->EdgeSubdivision + 1) + k + 1] };
-          quads->InsertNextCell(4, q);
-        }
-      }
-    };
-
-    addFace(0, 0, 2, 3, 1, 1, 0, true, true);
-    addFace(1, 9, 10, 1, 7, 1, 2, true, true);
-    addFace(2, 4, 6, 7, 5, 1, 0, false, true);
-    addFace(3, 8, 11, 5, 3, 1, 2, false, true);
-    addFace(4, 4, 0, 8, 9, 2, 0, true, false);
-    addFace(5, 2, 6, 11, 10, 2, 0, true, true);
-  }
-
-  // noId indicates that no specific ID is assigned.
-  // -2 is used to avoid conflict with existing IDs as well as with preselection
-  vtkIdType noId = -2;
-
-  // add vertex ids
-  for (unsigned int i = 0; i < this->NumberOfSolids; i++)
-  {
-    vtkIdType sId = i + 1;
-    for (unsigned int j = 0; j < 8; j++)
-    {
-      vtkIdType id = 8 * i + j + 1;
-      solidIdArray->InsertNextTypedTuple(&sId);
-      faceIdArray->InsertNextTypedTuple(&noId);
-      edgeIdArray->InsertNextTypedTuple(&noId);
-      vertexIdArray->InsertNextTypedTuple(&id);
-    }
-  }
-
-  // add edges ids
-  for (unsigned int i = 0; i < this->NumberOfSolids; i++)
-  {
-    vtkIdType sId = i + 1;
-    for (unsigned int j = 0; j < 12; j++)
-    {
-      vtkIdType id = 12 * i + j + 1;
-      solidIdArray->InsertNextTypedTuple(&sId);
-      faceIdArray->InsertNextTypedTuple(&noId);
-      edgeIdArray->InsertNextTypedTuple(&id);
-      vertexIdArray->InsertNextTypedTuple(&noId);
-    }
-  }
-
-  // add faces ids
-  for (unsigned int i = 0; i < this->NumberOfSolids; i++)
-  {
-    vtkIdType sId = i + 1;
-    for (unsigned int j = 0; j < 6; j++)
-    {
-      vtkIdType id = 6 * i + j + 1;
-      for (unsigned int k = 0; k < this->EdgeSubdivision * this->EdgeSubdivision; k++)
-      {
-        solidIdArray->InsertNextTypedTuple(&sId);
-        faceIdArray->InsertNextTypedTuple(&id);
-        edgeIdArray->InsertNextTypedTuple(&noId);
-        vertexIdArray->InsertNextTypedTuple(&noId);
-      }
-    }
-  }
-
-  SHOW2(points->GetNumberOfPoints(), long);
-  SHOW2(vertices->GetNumberOfCells(), long);
-  SHOW2(lines->GetNumberOfCells(), long);
-  SHOW2(quads->GetNumberOfCells(), long);
-  output->SetPoints(points);
-  output->SetVerts(vertices);
-  output->SetLines(lines);
-  output->SetPolys(quads);
-
-  output->GetCellData()->AddArray(solidIdArray);
-  output->GetCellData()->AddArray(faceIdArray);
-  output->GetCellData()->AddArray(edgeIdArray);
-  output->GetCellData()->AddArray(vertexIdArray);
-
-  return 1;
-}
diff --git a/src/SPV3D/plugins/cadSources/CADSources/vtkGeometryGenerator.h b/src/SPV3D/plugins/cadSources/CADSources/vtkGeometryGenerator.h
deleted file mode 100644 (file)
index c435271..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*=========================================================================
-
-  Program:   Visualization Toolkit
-  Module:    vtkGeometryGenerator.h
-
-  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
-  All rights reserved.
-  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
-     This software is distributed WITHOUT ANY WARRANTY; without even
-     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-     PURPOSE.  See the above copyright notice for more information.
-
-=========================================================================*/
-/**
- * @class   vtkGeometryGenerator
- * @brief   create a polygonal mesh with BRep mapping
- */
-
-#ifndef vtkGeometryGenerator_h
-#define vtkGeometryGenerator_h
-
-#include "CADSourcesModule.h"
-
-#include <vtkPolyDataAlgorithm.h>
-
-class CADSOURCES_EXPORT vtkGeometryGenerator : public vtkPolyDataAlgorithm
-{
-public:
-  vtkTypeMacro(vtkGeometryGenerator, vtkPolyDataAlgorithm);
-  void PrintSelf(ostream& os, vtkIndent indent) override;
-  static vtkGeometryGenerator* New();
-
-  //@{
-  /**
-   * Set/Get the number of subdivision of each edges of one cube.
-   */
-  vtkSetMacro(EdgeSubdivision, unsigned int);
-  vtkGetMacro(EdgeSubdivision, unsigned int);
-  //@}
-
-  //@{
-  /**
-   * Set/Get the number of solids (cubes) generated.
-   */
-  vtkSetMacro(NumberOfSolids, unsigned int);
-  vtkGetMacro(NumberOfSolids, unsigned int);
-  //@}
-
-protected:
-  vtkGeometryGenerator();
-  ~vtkGeometryGenerator() override = default;
-
-  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
-
-  unsigned int EdgeSubdivision = 10;
-  unsigned int NumberOfSolids = 5000;
-
-private:
-  vtkGeometryGenerator(const vtkGeometryGenerator&) = delete;
-  void operator=(const vtkGeometryGenerator&) = delete;
-};
-
-#endif
diff --git a/src/SPV3D/plugins/cadSources/CADSources/vtkMeshGenerator.cxx b/src/SPV3D/plugins/cadSources/CADSources/vtkMeshGenerator.cxx
deleted file mode 100644 (file)
index 0c81182..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "vtkMeshGenerator.h"
-
-#include <vtkInformation.h>
-#include <vtkInformationVector.h>
-#include <vtkPolyData.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkDelaunay3D.h>
-
-#include <array>
-#include <cfenv>
-
-//---------------------------------------------------------
-#define USE_DEBUG
-#define MB_IGNORE_QT
-#define MB_CLASSNAME "vtkMeshGenerator"
-#include "MBDebug.h"
-//---------------------------------------------------------
-
-
-vtkStandardNewMacro(vtkMeshGenerator);
-
-//----------------------------------------------------------------------------
-void vtkMeshGenerator::PrintSelf(ostream& os, vtkIndent indent)
-{
-  DBG_FUN();
-
-  this->Superclass::PrintSelf(os, indent);
-}
-
-//------------------------------------------------------------------------------
-int vtkMeshGenerator::FillInputPortInformation(int port, vtkInformation* info)
-{
-  DBG_FUN();
-  ARG(port);
-
-  if (port == 0)
-  {
-    info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
-    return 1;
-  }
-  return 0;
-}
-
-//----------------------------------------------------------------------------
-int vtkMeshGenerator::RequestData(vtkInformation* request,
-  vtkInformationVector** inputVector, vtkInformationVector* outputVector)
-{
-  DBG_FUN();
-  
-  vtkPolyData* input = vtkPolyData::GetData(inputVector[0]);
-  vtkUnstructuredGrid* output = vtkUnstructuredGrid::GetData(outputVector);
-  if (!input || !output)
-  {
-    return 0;
-  }
-
-  MSGEL("....applying Delaunay3D filter");
-  vtkNew<vtkDelaunay3D> delaunay;
-  delaunay->SetInputData(input);
-  delaunay->Update();
-
-  output->ShallowCopy(delaunay->GetOutput());
-
-  return 1;
-}
-
diff --git a/src/SPV3D/plugins/cadSources/CADSources/vtkMeshGenerator.h b/src/SPV3D/plugins/cadSources/CADSources/vtkMeshGenerator.h
deleted file mode 100644 (file)
index ef5c1b3..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef vtkMeshGenerator_h
-#define vtkMeshGenerator_h
-
-#include "CADSourcesModule.h"
-
-#include <vtkUnstructuredGridAlgorithm.h>
-
-/**
- * @class   vtkMeshGenerator
- * @brief   create a mesh  using a 3D Delaunay filter on a vtkPolyData
- */
-class CADSOURCES_EXPORT vtkMeshGenerator : public vtkUnstructuredGridAlgorithm
-{
-public:
-
-  vtkTypeMacro(vtkMeshGenerator, vtkUnstructuredGridAlgorithm);
-  void PrintSelf(ostream& os, vtkIndent indent) override;
-  static vtkMeshGenerator* New();
-
-protected:
-  vtkMeshGenerator() = default;
-  ~vtkMeshGenerator() override = default;
-
-  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
-  int FillInputPortInformation(int, vtkInformation*) override;
-
-private:
-  vtkMeshGenerator(const vtkMeshGenerator&) = delete;
-  void operator=(const vtkMeshGenerator&) = delete;
-};
-
-#endif
diff --git a/src/SPV3D/plugins/cadSources/CMakeLists.txt b/src/SPV3D/plugins/cadSources/CMakeLists.txt
deleted file mode 100644 (file)
index be0a7a2..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-paraview_add_plugin(CADSource
-  VERSION "1.0"
-  MODULES CADSources
-  SOURCES ${sources}
-  MODULE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/CADSources/vtk.module")
-
diff --git a/src/SPV3D/plugins/cadSources/paraview.plugin b/src/SPV3D/plugins/cadSources/paraview.plugin
deleted file mode 100644 (file)
index b25a871..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-NAME
-  CADSource
-DESCRIPTION
-  CADViewer plugin providing sources
-REQUIRES_MODULES
-  VTK::CommonCore