# VTK specific targets:
IF(SALOME_USE_VTKVIEWER)
LIST(APPEND _${PROJECT_NAME}_exposed_targets
- VTKViewer vtkTools vtkEDFOverloads)
+ VTKViewer )
IF(SALOME_USE_SALOMEOBJECT)
LIST(APPEND _${PROJECT_NAME}_exposed_targets
SVTK)
SET(GUI_VTKViewer VTKViewer)
SET(GUI_PVViewer PVViewer)
SET(GUI_PVServerService PVServerService)
-SET(GUI_vtkEDFOverloads vtkEDFOverloads)
SET(GUI_vtkTools vtkTools)
SET(GUI_SalomeGuiHelpers SalomeGuiHelpers)
SET(GUI_SalomeTreeData SalomeTreeData)
#include <pqDataTimeStepBehavior.h>
#include <pqDefaultViewBehavior.h>
#include <pqObjectPickingBehavior.h>
-#include <pqPersistentMainWindowStateBehavior.h>
#include <pqPipelineContextMenuBehavior.h>
#include <pqPluginActionGroupBehavior.h>
#include <pqPluginDockWidgetsBehavior.h>
new pqAutoLoadPluginXMLBehavior(this); // auto load plugins GUI stuff
new pqPluginDockWidgetsBehavior(desk);
new pqPluginActionGroupBehavior(desk);
- new pqPersistentMainWindowStateBehavior(desk);
+ // rnv: Disable ParaView main window persistance mechanism,
+ // because SALOME has own functionality for store/restore windows state.
+ // new pqPersistentMainWindowStateBehavior(desk);
new pqObjectPickingBehavior(desk);
new pqCollaborationBehavior(this);
new pqViewStreamingBehavior(this);
if ( d )
aWorkspace = d->workstack();
}
-#if SIP_VERSION < 0x040800
- PyObjWrapper pyws( sipBuildResult( 0, "M", aWorkspace, sipClass_QWidget) );
-#else
- #if SIP_VERSION >= 0x041303
+#if SIP_VERSION >= 0x041300
static const sipTypeDef *sipType_QWidget = 0;
if (!sipType_QWidget)
sipType_QWidget = sipFindType("QWidget");
- #endif
- PyObjWrapper pyws( sipBuildResult( 0, "D", aWorkspace, sipType_QWidget , NULL) );
#endif
+ PyObjWrapper pyws( sipBuildResult( 0, "D", aWorkspace, sipType_QWidget , NULL) );
// ... and finally call Python module's setWorkSpace() method (obsolete)
if ( PyObject_HasAttrString( myPyModule, (char*)"setWorkSpace" ) ) {
PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"setWorkSpace", (char*)"O", pyws.get() ) );
QStringList* theList = new QStringList(entries);
-#if SIP_VERSION < 0x040800
- PyObjWrapper sipList(sipBuildResult(0, "M", theList, sipClass_QStringList));
-#else
- #if SIP_VERSION >= 0x041303
+#if SIP_VERSION >= 0x041300
static const sipTypeDef *sipType_QStringList = 0;
if (!sipType_QStringList)
sipType_QStringList = sipFindType("QStringList");
- #endif
- PyObjWrapper sipList( sipBuildResult( 0, "D", theList, sipType_QStringList, NULL ) );
#endif
+ PyObjWrapper sipList( sipBuildResult( 0, "D", theList, sipType_QStringList, NULL ) );
if (PyObject_HasAttrString(myPyModule, (char*) "onSelectionUpdated"))
{
MESSAGE("call onSelectionUpdated");
if ( myXmlHandler )
myXmlHandler->createPopup( menu, aContext, aParent, aObject );
-#if SIP_VERSION < 0x040800
- PyObjWrapper sipPopup( sipBuildResult( 0, "M", menu, sipClass_QMenu ) );
-#else
- #if SIP_VERSION >= 0x041303
+#if SIP_VERSION >= 0x041300
static const sipTypeDef *sipType_QMenu = 0;
if (!sipType_QMenu)
sipType_QMenu = sipFindType("QMenu");
- #endif
- PyObjWrapper sipPopup( sipBuildResult( 0, "D", menu, sipType_QMenu, NULL ) );
#endif
+ PyObjWrapper sipPopup( sipBuildResult( 0, "D", menu, sipType_QMenu, NULL ) );
// then call Python module's createPopupMenu() method (for new modules)
if ( PyObject_HasAttrString( myPyModule, (char*)"createPopupMenu" ) ) {
QStringList* theList = new QStringList( files );
-#if SIP_VERSION < 0x040800
- PyObjWrapper sipList( sipBuildResult( 0, "M", theList, sipClass_QStringList ) );
-#else
- #if SIP_VERSION >= 0x041303
+#if SIP_VERSION >= 0x041300
static const sipTypeDef *sipType_QStringList = 0;
if (!sipType_QStringList)
sipType_QStringList = sipFindType("QStringList");
- #endif
- PyObjWrapper sipList( sipBuildResult( 0, "D", theList, sipType_QStringList, NULL ) );
#endif
+ PyObjWrapper sipList( sipBuildResult( 0, "D", theList, sipType_QStringList, NULL ) );
if ( PyObject_HasAttrString(myPyModule , (char*)"openFiles") ) {
// try with two parameters (new syntax)
if ( dataObject ) theList->append( dataObject->entry() );
}
-#if SIP_VERSION < 0x040800
- PyObjWrapper sipList( sipBuildResult( 0, "M", theList, sipClass_QStringList) );
-#else
- #if SIP_VERSION >= 0x041303
+#if SIP_VERSION >= 0x041300
static const sipTypeDef *sipType_QStringList = 0;
if (!sipType_QStringList)
sipType_QStringList = sipFindType("QStringList");
- #endif
- PyObjWrapper sipList( sipBuildResult( 0, "D", theList, sipType_QStringList, NULL) );
#endif
+ PyObjWrapper sipList( sipBuildResult( 0, "D", theList, sipType_QStringList, NULL) );
if ( PyObject_HasAttrString(myPyModule, (char*)"dropObjects") ) {
PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"dropObjects", (char*)"Osii",
sipList.get(),
myRepresentation = VTKViewer::Representation::Surface;
myIsResolveCoincidentTopology = true;
- vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
- myPolygonOffsetUnits);
+ VTKViewer_Actor::GetDefaultPolygonOffsetParameters(myPolygonOffsetFactor,
+ myPolygonOffsetUnits);
myMapper = VTKViewer_DataSetMapper::New();
aStyle->SetInteractor(NULL);
myInteractorStyles.pop();
}
-
- SetRenderer(NULL);
-
- GetDevice()->SetRenderWindow(NULL);
}
/*!
}
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
- // initialization of the X11 visual on Linux
- QSurfaceFormat format;
- format.setDepthBufferSize(16);
- format.setStencilBufferSize(1);
- format.setProfile(QSurfaceFormat::CompatibilityProfile);
- QSurfaceFormat::setDefaultFormat(format);
+
+ // RNV: setup the default format:
+ // QSurfaceFormat should be set before creation of QApplication,
+ // so to avoid conflicts beetween SALOME and ParaView QSurfaceFormats we should merge theirs formats
+ // (see comments below) and set the resultant format here.
+
+ // Settings from Paraview:
+ // This piece of code was taken from QVTKOpenGLWidget::defaultFormat() method in
+ // order to avoid dependency of the SALOME_Session_Server on vtk libraries
+ QSurfaceFormat fmt;
+ fmt.setRenderableType(QSurfaceFormat::OpenGL);
+ fmt.setVersion(3, 2);
+ fmt.setProfile(QSurfaceFormat::CoreProfile);
+ fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
+ fmt.setRedBufferSize(1);
+ fmt.setGreenBufferSize(1);
+ fmt.setBlueBufferSize(1);
+ fmt.setDepthBufferSize(1);
+ fmt.setStencilBufferSize(0);
+ fmt.setAlphaBufferSize(1);
+ fmt.setStereo(false);
+ fmt.setSamples(0);
+
+ // Settings for OCCT viewer window:
+ fmt.setDepthBufferSize(16);
+ fmt.setStencilBufferSize(1);
+ // fmt.setProfile(QSurfaceFormat::CompatibilityProfile);
+
+ QSurfaceFormat::setDefaultFormat(fmt);
+
#endif
// Create Qt application instance;
myIsPreselected(false),
myIsHighlighted(false)
{
- vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor,
- myPolygonOffsetUnits);
+ VTKViewer_Actor::GetDefaultPolygonOffsetParameters(myPolygonOffsetFactor,
+ myPolygonOffsetUnits);
for(int i = 0; i < 6; i++)
myPassFilter.push_back(vtkPassThroughFilter::New());
units = myPolygonOffsetUnits;
}
+/*!
+ Get polygon offset parameters
+ \param factor, units - Opengl polygon offset parameters
+*/
+void
+VTKViewer_Actor
+::GetDefaultPolygonOffsetParameters(double& factor,
+ double& units)
+{
+ factor = 2.0;
+ units = 2.0;
+}
+
/*!
\return shrink factor
*/
void
GetPolygonOffsetParameters(double& factor,
double& units);
+
+ //! Get default ResolveCoincidentTopology parameters
+ static
+ void
+ GetDefaultPolygonOffsetParameters(double& factor,
+ double& units);
virtual
void
ADD_SUBDIRECTORY(dlgfactory)
-IF(SALOME_USE_VTKVIEWER)
- ADD_SUBDIRECTORY(vtkEDFOverloads)
-ENDIF()
-
##
# Python-based packages, part 1 (generic)
##
+++ /dev/null
-# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# 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(${VTK_USE_FILE})
-
-ADD_LIBRARY(vtkTools vtkEDFCutter.cxx)
-TARGET_LINK_LIBRARIES(vtkTools ${VTK_LIBRARIES})
-INSTALL(TARGETS vtkTools EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
-
-ADD_LIBRARY(vtkEDFOverloads vtkEDFFactory.cxx)
-TARGET_LINK_LIBRARIES(vtkEDFOverloads ${VTK_LIBRARIES} vtkTools)
-INSTALL(TARGETS vtkEDFOverloads EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_GUI_INSTALL_PARAVIEW_LIBS})
-
-FILE(GLOB COMMON_HEADERS_H "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
-INSTALL(FILES ${COMMON_HEADERS_H} DESTINATION ${SALOME_INSTALL_HEADERS})
+++ /dev/null
-// Copyright (C) 2010-2016 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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 "vtkEDFCutter.h"
-
-#include "vtkInformationVector.h"
-#include "vtkInformation.h"
-#include "vtkSmartPointer.h"
-#include "vtkGenericCell.h"
-#include "vtkPolyData.h"
-#include "vtkObjectFactory.h"
-#include "vtkIdTypeArray.h"
-#include "vtkCellData.h"
-#include "vtkCellArray.h"
-#include "vtkIdList.h"
-
-#include <list>
-#include <set>
-#include <map>
-#include <deque>
-
-class vtkEDFEdge
-{
-public :
- vtkIdType v0;
- vtkIdType v1;
-
- vtkEDFEdge(vtkIdType a, vtkIdType b) : v0(a), v1(b){}
- vtkEDFEdge(){}
-};
-
-bool operator == (const vtkEDFEdge& e0, const vtkEDFEdge& e1)
-{
- return (e0.v0 == e1.v0 && e0.v1 == e1.v1) ||
- (e0.v1 == e1.v0 && e0.v0 == e1.v1);
-}
-
-bool operator != (const vtkEDFEdge& e0, const vtkEDFEdge& e1)
-{
- return !(e0==e1);
-}
-
-bool operator < (const vtkEDFEdge& e0, const vtkEDFEdge& e1)
-{
- vtkEDFEdge the_e0;
- vtkEDFEdge the_e1;
- if(e0.v0 < e0.v1)
- {
- the_e0.v0 = e0.v0;
- the_e0.v1 = e0.v1;
- }
- else
- {
- the_e0.v0 = e0.v1;
- the_e0.v1 = e0.v0;
- }
- if(e1.v0 < e1.v1)
- {
- the_e1.v0 = e1.v0;
- the_e1.v1 = e1.v1;
- }
- else
- {
- the_e1.v0 = e1.v1;
- the_e1.v1 = e1.v0;
- }
-
- if(the_e0.v0 == the_e1.v0)
- return (the_e0.v1 < the_e1.v1);
-
- return the_e0.v0 < the_e1.v0;
-}
-
-vtkStandardNewMacro(vtkEDFCutter);
-
-vtkEDFCutter::vtkEDFCutter()
-{
- this->OriginalCellIdsName = NULL;
-}
-
-vtkEDFCutter::~vtkEDFCutter()
-{
- this->SetOriginalCellIdsName(NULL);
-}
-
-int vtkEDFCutter::RequestData(vtkInformation * request,
- vtkInformationVector ** inVector,
- vtkInformationVector * outVector)
-{
- // get the info objects
- vtkInformation *inInfo = inVector[0]->GetInformationObject(0);
- vtkInformation *outInfo = outVector->GetInformationObject(0);
-
- // get the input and output
- vtkDataSet *input = vtkDataSet::SafeDownCast(
- inInfo->Get(vtkDataObject::DATA_OBJECT()));
-
- vtkSmartPointer<vtkIdTypeArray> cellIdArray =
- vtkSmartPointer<vtkIdTypeArray>::New();
- cellIdArray->SetName(this->GetOriginalCellIdsName());
- cellIdArray->SetNumberOfComponents(1);
- cellIdArray->SetNumberOfTuples(input->GetNumberOfCells());
- for(vtkIdType id=0; id < cellIdArray->GetNumberOfTuples(); id++)
- {
- cellIdArray->SetTuple1(id, id);
- }
- input->GetCellData()->AddArray(cellIdArray);
-
- int ret = this->Superclass::RequestData(request, inVector, outVector);
-
- if(ret == 0)
- return 0;
-
- vtkPolyData *output = vtkPolyData::SafeDownCast(
- outInfo->Get(vtkDataObject::DATA_OBJECT()));
-
- vtkSmartPointer<vtkPolyData> tmpOutput;
- tmpOutput.TakeReference(output->NewInstance());
-
- this->AssembleOutputTriangles(output, tmpOutput);
-
- output->ShallowCopy(tmpOutput);
-
- return ret;
-}
-
-
-void vtkEDFCutter::AssembleOutputTriangles(vtkPolyData* inpd,
- vtkPolyData* outpd)
-{
- outpd->ShallowCopy(inpd);
-
- vtkIdTypeArray* originalCellIds = vtkIdTypeArray::SafeDownCast(
- inpd->GetCellData()->GetArray(this->GetOriginalCellIdsName()));
-
- if(originalCellIds == NULL)
- {
- return;
- }
-
- outpd->GetCellData()->Initialize();
- outpd->GetCellData()->CopyAllocate(inpd->GetCellData());
-
- vtkSmartPointer<vtkCellArray> verts = vtkSmartPointer<vtkCellArray>::New();
- vtkSmartPointer<vtkCellArray> lines = vtkSmartPointer<vtkCellArray>::New();
- vtkSmartPointer<vtkCellArray> polys = vtkSmartPointer<vtkCellArray>::New();
- vtkSmartPointer<vtkCellArray> strips = vtkSmartPointer<vtkCellArray>::New();
- outpd->SetVerts(verts);
- outpd->SetLines(lines);
- outpd->SetPolys(polys);
- outpd->SetStrips(strips);
-
- for(vtkIdType cellId=0; cellId<inpd->GetNumberOfCells(); cellId++)
- {
- unsigned char type = inpd->GetCellType(cellId);
- if(type != VTK_TRIANGLE)
- {
- vtkIdType npts;
- vtkIdType* pts = NULL;
- inpd->GetCellPoints(cellId, npts, pts);
- vtkIdType newCellId =
- outpd->InsertNextCell(type, npts, pts);
- outpd->GetCellData()->CopyData(inpd->GetCellData(), cellId, newCellId);
- }
- else
- {
- vtkIdType cellIdEnd = cellId+1;
- vtkIdType originalCellId = originalCellIds->GetValue(cellId);
- while(cellIdEnd < inpd->GetNumberOfCells() &&
- inpd->GetCellType(cellIdEnd) == VTK_TRIANGLE &&
- originalCellIds->GetValue(cellIdEnd) == originalCellId)
- {
- cellIdEnd++;
- }
-
- // all triangles from cellId to cellIdEnd come from the same
- // original cell.
-
- // A batch is composed of triangles which are connected by the edges.
- std::map<vtkIdType, std::set<vtkIdType> > connectedTriangles;
- for(vtkIdType firstCell = cellId; firstCell < cellIdEnd-1; firstCell++)
- {
- vtkIdType npts;
- vtkIdType* pts = NULL;
- inpd->GetCellPoints(firstCell, npts, pts);
- vtkEDFEdge fe0 = vtkEDFEdge(pts[0], pts[1]);
- vtkEDFEdge fe1 = vtkEDFEdge(pts[1], pts[2]);
- vtkEDFEdge fe2 = vtkEDFEdge(pts[2], pts[0]);
- for(vtkIdType secondCell = firstCell+1; secondCell < cellIdEnd; secondCell++)
- {
- vtkIdType snpts;
- vtkIdType* spts = NULL;
- inpd->GetCellPoints(secondCell, snpts, spts);
- vtkEDFEdge se0 = vtkEDFEdge(spts[0], spts[1]);
- vtkEDFEdge se1 = vtkEDFEdge(spts[1], spts[2]);
- vtkEDFEdge se2 = vtkEDFEdge(spts[2], spts[0]);
-
- if(fe0 == se0 || fe0 == se1 || fe0 == se2 ||
- fe1 == se0 || fe1 == se1 || fe1 == se2 ||
- fe2 == se0 || fe2 == se1 || fe2 == se2)
- {
- connectedTriangles[firstCell].insert(secondCell);
- connectedTriangles[secondCell].insert(firstCell);
- }
- }
- }
-
- std::set<vtkIdType> visitedCell;
- for(vtkIdType id=cellId; id<cellIdEnd; id++)
- {
- if(visitedCell.find(id) != visitedCell.end())
- continue;
-
- // if this cell has not yet been visited, I create a batch of all
- // cells connected to this one
-
- visitedCell.insert(id);
- std::set<vtkIdType> batch;
- std::list<vtkIdType> cellList;
- cellList.push_back(id);
- while(cellList.size() > 0)
- {
- vtkIdType currentId = *(cellList.begin());
- batch.insert(currentId);
- cellList.pop_front();
- if(connectedTriangles.find(currentId) != connectedTriangles.end())
- {
- const std::set<vtkIdType>& adj = connectedTriangles[currentId];
- std::set<vtkIdType>::const_iterator it = adj.begin();
- while(it != adj.end())
- {
- vtkIdType other = *it;
- if(visitedCell.find(other) == visitedCell.end())
- {
- cellList.push_back(other);
- visitedCell.insert(other);
- }
- it++;
- }
- }
- }
-
-
-
- // then I add this batch to the output,
- // creating a unique cell for the whole batch.
-
- if(batch.size() == 1)
- {
- vtkIdType tid = *(batch.begin());
- vtkIdType npts;
- vtkIdType* pts = NULL;
- inpd->GetCellPoints(tid, npts, pts);
- vtkIdType newCellId =
- outpd->InsertNextCell(VTK_TRIANGLE, npts, pts);
- outpd->GetCellData()->CopyData(inpd->GetCellData(), cellId, newCellId);
- }
- else if(batch.size() == 2)
- { // two triangles connected together --> create a VTK_QUAD
- vtkIdType fid = *(batch.begin());
- vtkIdType sid = *(batch.rbegin());
- vtkIdType fnpts;
- vtkIdType* fpts = NULL;
- inpd->GetCellPoints(fid, fnpts, fpts);
- vtkIdType snpts;
- vtkIdType* spts = NULL;
- inpd->GetCellPoints(sid, snpts, spts);
-
- int findex = 0;
- vtkIdType fv = fpts[findex];
- while(((fv == spts[0]) ||
- (fv == spts[1]) ||
- (fv == spts[2])) && findex < 3)
- {
- findex++;
- fv = fpts[findex];
- }
- if(findex == 3)
- {// this is a degenerate case : one of the triangles use
- // only 2 vertices
- findex = 0;
- }
- int sindex = 0;
- vtkIdType sv = spts[sindex];
- while(((sv == fpts[0]) ||
- (sv == fpts[1]) ||
- (sv == fpts[2])) && sindex < 3)
- {
- sindex++;
- sv = spts[sindex];
- }
- if(sindex == 3)
- {// this is a degenerate case : one of the triangles use
- // only 2 vertices
- sindex = 0;
- }
-
- vtkIdType pts[4];
- pts[0] = fpts[findex];
- pts[1] = fpts[(findex+1)%3];
- pts[2] = spts[sindex];
- pts[3] = fpts[(findex+2)%3];
-
- vtkIdType newCellId = outpd->InsertNextCell(VTK_QUAD, 4, pts);
- outpd->GetCellData()->CopyData(inpd->GetCellData(), cellId, newCellId);
- }
- else
- {
- std::deque<vtkEDFEdge> contour;
-
- std::list<vtkIdType> toVisit;
- std::set<vtkIdType> visited;
-
- toVisit.push_back(*(batch.begin()));
-
- std::set<vtkIdType> triedAgain;
-
- while(toVisit.size() > 0)
- {
- vtkIdType currentId = *(toVisit.begin());
- toVisit.pop_front();
- if(visited.find(currentId) != visited.end())
- continue;
-
- visited.insert(currentId);
- const std::set<vtkIdType>& adj = connectedTriangles[currentId];
- std::set<vtkIdType>::const_iterator it = adj.begin();
- while(it != adj.end())
- {
- vtkIdType adjid = *it;
- it++;
- if(visited.find(adjid) != visited.end())
- continue;
-
- toVisit.push_back(adjid);
- }
-
- vtkIdType npts;
- vtkIdType* pts = NULL;
- inpd->GetCellPoints(currentId, npts, pts);
- vtkEDFEdge edge[3] = {vtkEDFEdge(pts[0], pts[1]),
- vtkEDFEdge(pts[1], pts[2]),
- vtkEDFEdge(pts[2], pts[0])};
-
- // special case : initialization of the contour
- if(contour.size() == 0)
- {
- contour.push_back(edge[0]);
- contour.push_back(edge[1]);
- contour.push_back(edge[2]);
- continue;
- }
-
- // Find which edge of the contour
- // is connected to the current triangle
- int orient = 0;
- std::deque<vtkEDFEdge>::iterator contourit = contour.begin();
- bool found = false;
- while(contourit != contour.end())
- {
- vtkEDFEdge& e = *contourit;
- for(orient = 0; orient<3; orient++)
- {
- if(e == edge[orient])
- {
- found = true;
- break;
- }
- }
- if(found)
- break;
-
- contourit++;
- }
- if(contourit == contour.end())
- {// this triangle is not connected to the current contour.
- // put it back in the queue for later processing
- if(triedAgain.find(currentId) == triedAgain.end())
- {
- triedAgain.insert(currentId);
- toVisit.push_back(currentId);
- visited.erase(currentId);
- continue;
- }
- else
- {
- vtkDebugMacro( << "triangle " << currentId
- << "could not be added to the contour of the current batch");
- continue;
- }
- }
- // if I reach this point, I will add the triangle to the contour
- // --> the contour will be modified and I can try again
- // to add the previously rejected triangles
- triedAgain.clear();
-
- // Now, merge the edges of the current triangle with
- // the contour
- vtkEDFEdge& tbeforeedge = edge[(orient+1)%3];
- vtkEDFEdge& tafteredge = edge[(orient+2)%3];
-
- std::deque<vtkEDFEdge>::iterator beforeit;
- if(contourit == contour.begin())
- beforeit = contour.end()-1;
- else
- beforeit = contourit - 1;
- vtkEDFEdge& beforeedge = *beforeit;
-
- std::deque<vtkEDFEdge>::iterator afterit;
- if(contourit == contour.end()-1)
- afterit = contour.begin();
- else
- afterit = contourit + 1;
- vtkEDFEdge& afteredge = *afterit;
-
- if(beforeedge == tbeforeedge)
- {
- if(afteredge == tafteredge)
- {// in this case, I am adding a triangle that is fully inside
- // the contour. I need to remove the three edges from the
- // contour.
- if(contour.size() == 3)
- {
- contour.clear();
- }
- else
- {
- std::deque<vtkEDFEdge>::iterator lastit;
- if(afterit == contour.end()-1)
- lastit = contour.begin();
- else
- lastit = afterit + 1;
-
- if(lastit < beforeit)
- {
- contour.erase(beforeit, contour.end());
- contour.erase(contour.begin(), lastit);
- }
- else
- {
- contour.erase(beforeit, lastit);
- }
- }
- }
- else
- {// the edge before is the glued, remove the two adjacent edges
- // and add the edge after
- if(beforeit == contour.end()-1)
- {
- contour.erase(beforeit, contour.end());
- contour.erase(contour.begin(), contour.begin()+1);
- contour.push_back(tafteredge);
- }
- else
- {
- int index = beforeit - contour.begin();
- contour.erase(beforeit, contourit+1);
- contour.insert(contour.begin()+index, tafteredge);
- }
- }
- }
- else if(afteredge == tafteredge)
- {// the edge after is glued, removed the two glued edges and add
- // the edge new edge
- if(contourit == contour.end() -1)
- {
- contour.erase(contour.end() - 1);
- contour.erase(contour.begin());
- contour.push_back(tbeforeedge);
- }
- else
- {
- int index = contourit - contour.begin();
- contour.erase(contourit, afterit+1);
- contour.insert(contour.begin()+index, tbeforeedge);
- }
- }
- else
- {
- int index = contourit - contour.begin();
- contour.erase(contourit);
- contour.insert(contour.begin()+index, tbeforeedge);
- contour.insert(contour.begin()+index+1, tafteredge);
- }
- }
- vtkSmartPointer<vtkIdList> ids = vtkSmartPointer<vtkIdList>::New();
- std::deque<vtkEDFEdge>::iterator cit = contour.begin();
- while(cit != contour.end())
- {
- vtkEDFEdge& e = *cit;
- cit++;
- ids->InsertNextId(e.v0);
- }
-
- vtkIdType newCellId = outpd->InsertNextCell(VTK_POLYGON, ids);
- outpd->GetCellData()->CopyData(inpd->GetCellData(), cellId, newCellId);
- }
- }
- cellId = cellIdEnd - 1;
- }
- }
-}
-
-void vtkEDFCutter::PrintSelf(ostream& os, vtkIndent indent)
-{
- this->Superclass::PrintSelf(os, indent);
-}
-
-
+++ /dev/null
-// Copyright (C) 2010-2016 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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
-//
-
-#ifndef __vtkEDFCutter_h__
-#define __vtkEDFCutter_h__
-
-#include "vtkEDFOverloadsDefines.h"
-#include "vtkCutter.h"
-
-class VTKTOOLS_EXPORT vtkEDFCutter : public vtkCutter
-{
-public :
- static vtkEDFCutter* New();
- vtkTypeMacro(vtkEDFCutter, vtkCutter);
- void PrintSelf(ostream& os, vtkIndent indent);
-
- // Description:
- // these ivars
- // control the name given to the field in which the ids are written into. If
- // set to NULL, then vtkOriginalCellIds or vtkOriginalPointIds (the default)
- // is used, respectively.
- vtkSetStringMacro(OriginalCellIdsName);
- virtual const char *GetOriginalCellIdsName() {
- return ( this->OriginalCellIdsName
- ? this->OriginalCellIdsName : "vtkOriginalCellIds");
- }
-
-protected :
- virtual int RequestData(vtkInformation *,
- vtkInformationVector **,
- vtkInformationVector *);
-
- virtual void AssembleOutputTriangles(vtkPolyData* inpd,
- vtkPolyData* outpd);
-
- char* OriginalCellIdsName;
-
- vtkEDFCutter();
- ~vtkEDFCutter();
-
-private:
- vtkEDFCutter(const vtkEDFCutter&); // Not implemented.
- void operator=(const vtkEDFCutter&); // Not implemented.
-};
-
-#endif //__vtkEDFCutter_h__
+++ /dev/null
-// Copyright (C) 2010-2016 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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 "vtkEDFFactory.h"
-#include "vtkVersion.h"
-#include "vtkEDFCutter.h"
-
-vtkStandardNewMacro(vtkEDFFactory);
-
-VTK_CREATE_CREATE_FUNCTION(vtkEDFCutter);
-
-vtkEDFFactory::vtkEDFFactory()
-{
- this->RegisterOverride("vtkCutter",
- "vtkEDFCutter",
- "MergeTriangles",
- 1,
- vtkObjectFactoryCreatevtkEDFCutter);
-}
-
-const char* vtkEDFFactory::GetVTKSourceVersion()
-{
- return VTK_SOURCE_VERSION;
-}
-
-const char* vtkEDFFactory::GetDescription()
-{
- return "VTK EDF Factory";
-}
-
-#ifdef WIN32
- //RNV: workaround to avoid definition __declspec( dllimport )
- //for the vtkGetFactoryCompilerUsed(), vtkGetFactoryVersion()
- //and vtkLoad(). This happens because of a bug in the
- //vtkObjectFactory.h file.
- //This workaround will be removed in the future as soon as
- //mentioned bug is fixed.
- #ifdef VTK_FACTORY_INTERFACE_IMPLEMENT
- #undef VTK_FACTORY_INTERFACE_IMPLEMENT
-
- #define VTK_FACTORY_INTERFACE_IMPLEMENT(factoryName) \
- extern "C" \
- VTKEDF_OVERLOADS_EXPORT \
- const char* vtkGetFactoryCompilerUsed() \
- { \
- return VTK_CXX_COMPILER; \
- } \
- extern "C" \
- VTKEDF_OVERLOADS_EXPORT \
- const char* vtkGetFactoryVersion() \
- { \
- return VTK_SOURCE_VERSION; \
- } \
- extern "C" \
- VTKEDF_OVERLOADS_EXPORT \
- vtkObjectFactory* vtkLoad() \
- { \
- return factoryName ::New(); \
- }
- #endif
-#endif
-
-
-VTK_FACTORY_INTERFACE_IMPLEMENT(vtkEDFFactory);
+++ /dev/null
-// Copyright (C) 2010-2016 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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
-//
-
-#ifndef __vtkEDFFactory_h
-#define __vtkEDFFactory_h
-
-#include "vtkEDFOverloadsDefines.h"
-#include "vtkObjectFactory.h"
-
-class VTKEDF_OVERLOADS_EXPORT vtkEDFFactory : public vtkObjectFactory
-{
-public:
-// Methods from vtkObject
- vtkTypeMacro(vtkEDFFactory,vtkObjectFactory);
- static vtkEDFFactory *New();
-
- virtual const char* GetVTKSourceVersion();
- virtual const char* GetDescription();
-protected:
- vtkEDFFactory();
-private:
- vtkEDFFactory(const vtkEDFFactory&); // Not implemented.
- void operator=(const vtkEDFFactory&); // Not implemented.
-};
-
-extern "C" VTK_EXPORT vtkObjectFactory* vtkLoad();
-#endif
+++ /dev/null
-// Copyright (C) 2010-2016 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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
-//
-
-#ifndef VTKEDF_OVERLOADS_DEFINES_H
-#define VTKEDF_OVERLOADS_DEFINES_H
-
-#if defined WIN32
-# if defined VTKEDF_OVERLOADS_EXPORTS || defined vtkEDFOverloads_EXPORTS
-# define VTKEDF_OVERLOADS_EXPORT __declspec( dllexport )
-# else
-# define VTKEDF_OVERLOADS_EXPORT __declspec( dllimport )
-# endif
-
-# if defined VTKTOOLS_EXPORTS || defined vtkTools_EXPORTS
-# define VTKTOOLS_EXPORT __declspec( dllexport )
-# else
-# define VTKTOOLS_EXPORT __declspec( dllimport )
-# endif
-
-#else
-# define VTKEDF_OVERLOADS_EXPORT
-# define VTKTOOLS_EXPORT
-#endif //WIN32
-
-#endif //VTKEDF_OVERLOADS_DEFINES_H