Mesh: define the typenames FacetIndex and PointIndex to distinguish between facet and point related indexes
This commit is contained in:
@@ -1845,7 +1845,7 @@ void CmdMeshSplitComponents::activated(int)
|
||||
std::vector<App::DocumentObject*> objs = Gui::Selection().getObjectsOfType(Mesh::Feature::getClassTypeId());
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it = objs.begin(); it != objs.end(); ++it) {
|
||||
const MeshObject& mesh = static_cast<Mesh::Feature*>(*it)->Mesh.getValue();
|
||||
std::vector<std::vector<unsigned long> > comps = mesh.getComponents();
|
||||
std::vector<std::vector<Mesh::FacetIndex> > comps = mesh.getComponents();
|
||||
|
||||
for (const auto& comp : comps) {
|
||||
std::unique_ptr<MeshObject> kernel(mesh.meshFromSegment(comp));
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
std::map<std::string, ViewProviderMeshDefects*> vp;
|
||||
Mesh::Feature* meshFeature;
|
||||
QPointer<Gui::View3DInventor> view;
|
||||
std::vector<unsigned long> self_intersections;
|
||||
std::vector<Mesh::FacetIndex> self_intersections;
|
||||
bool enableFoldsCheck;
|
||||
bool checkNonManfoldPoints;
|
||||
bool strictlyDegenerated;
|
||||
@@ -276,7 +276,7 @@ void DlgEvaluateMeshImp::setMesh(Mesh::Feature* m)
|
||||
}
|
||||
}
|
||||
|
||||
void DlgEvaluateMeshImp::addViewProvider(const char* name, const std::vector<unsigned long>& indices)
|
||||
void DlgEvaluateMeshImp::addViewProvider(const char* name, const std::vector<Mesh::ElementIndex>& indices)
|
||||
{
|
||||
removeViewProvider(name);
|
||||
|
||||
@@ -440,7 +440,7 @@ void DlgEvaluateMeshImp::on_analyzeOrientationButton_clicked()
|
||||
|
||||
const MeshKernel& rMesh = d->meshFeature->Mesh.getValue().getKernel();
|
||||
MeshEvalOrientation eval(rMesh);
|
||||
std::vector<unsigned long> inds = eval.GetIndices();
|
||||
std::vector<MeshCore::FacetIndex> inds = eval.GetIndices();
|
||||
#if 0
|
||||
if (inds.empty() && !eval.Evaluate()) {
|
||||
d->ui.checkOrientationButton->setText(tr("Flipped normals found"));
|
||||
@@ -532,7 +532,7 @@ void DlgEvaluateMeshImp::on_analyzeNonmanifoldsButton_clicked()
|
||||
MeshEvalTopology f_eval(rMesh);
|
||||
bool ok1 = f_eval.Evaluate();
|
||||
bool ok2 = true;
|
||||
std::vector<unsigned long> point_indices;
|
||||
std::vector<Mesh::PointIndex> point_indices;
|
||||
|
||||
if (d->checkNonManfoldPoints) {
|
||||
MeshEvalPointManifolds p_eval(rMesh);
|
||||
@@ -555,10 +555,10 @@ void DlgEvaluateMeshImp::on_analyzeNonmanifoldsButton_clicked()
|
||||
d->ui.repairAllTogether->setEnabled(true);
|
||||
|
||||
if (!ok1) {
|
||||
const std::vector<std::pair<unsigned long, unsigned long> >& inds = f_eval.GetIndices();
|
||||
std::vector<unsigned long> indices;
|
||||
const std::vector<std::pair<Mesh::FacetIndex, Mesh::FacetIndex> >& inds = f_eval.GetIndices();
|
||||
std::vector<Mesh::FacetIndex> indices;
|
||||
indices.reserve(2*inds.size());
|
||||
std::vector<std::pair<unsigned long, unsigned long> >::const_iterator it;
|
||||
std::vector<std::pair<Mesh::FacetIndex, Mesh::FacetIndex> >::const_iterator it;
|
||||
for (it = inds.begin(); it != inds.end(); ++it) {
|
||||
indices.push_back(it->first);
|
||||
indices.push_back(it->second);
|
||||
@@ -721,7 +721,7 @@ void DlgEvaluateMeshImp::on_analyzeDegeneratedButton_clicked()
|
||||
|
||||
const MeshKernel& rMesh = d->meshFeature->Mesh.getValue().getKernel();
|
||||
MeshEvalDegeneratedFacets eval(rMesh, d->epsilonDegenerated);
|
||||
std::vector<unsigned long> degen = eval.GetIndices();
|
||||
std::vector<Mesh::FacetIndex> degen = eval.GetIndices();
|
||||
|
||||
if (degen.empty()) {
|
||||
d->ui.checkDegenerationButton->setText(tr("No degenerations"));
|
||||
@@ -787,7 +787,7 @@ void DlgEvaluateMeshImp::on_analyzeDuplicatedFacesButton_clicked()
|
||||
|
||||
const MeshKernel& rMesh = d->meshFeature->Mesh.getValue().getKernel();
|
||||
MeshEvalDuplicateFacets eval(rMesh);
|
||||
std::vector<unsigned long> dupl = eval.GetIndices();
|
||||
std::vector<Mesh::FacetIndex> dupl = eval.GetIndices();
|
||||
|
||||
if (dupl.empty()) {
|
||||
d->ui.checkDuplicatedFacesButton->setText(tr("No duplicated faces"));
|
||||
@@ -919,7 +919,7 @@ void DlgEvaluateMeshImp::on_analyzeSelfIntersectionButton_clicked()
|
||||
|
||||
const MeshKernel& rMesh = d->meshFeature->Mesh.getValue().getKernel();
|
||||
MeshEvalSelfIntersection eval(rMesh);
|
||||
std::vector<std::pair<unsigned long, unsigned long> > intersection;
|
||||
std::vector<std::pair<Mesh::FacetIndex, Mesh::FacetIndex> > intersection;
|
||||
try {
|
||||
eval.GetIntersections(intersection);
|
||||
}
|
||||
@@ -939,9 +939,9 @@ void DlgEvaluateMeshImp::on_analyzeSelfIntersectionButton_clicked()
|
||||
d->ui.repairSelfIntersectionButton->setEnabled(true);
|
||||
d->ui.repairAllTogether->setEnabled(true);
|
||||
|
||||
std::vector<unsigned long> indices;
|
||||
std::vector<Mesh::FacetIndex> indices;
|
||||
indices.reserve(2*intersection.size());
|
||||
std::vector<std::pair<unsigned long, unsigned long> >::iterator it;
|
||||
std::vector<std::pair<Mesh::FacetIndex, Mesh::FacetIndex> >::iterator it;
|
||||
for (it = intersection.begin(); it != intersection.end(); ++it) {
|
||||
indices.push_back(it->first);
|
||||
indices.push_back(it->second);
|
||||
@@ -1022,9 +1022,9 @@ void DlgEvaluateMeshImp::on_analyzeFoldsButton_clicked()
|
||||
removeViewProvider("MeshGui::ViewProviderMeshFolds");
|
||||
}
|
||||
else {
|
||||
std::vector<unsigned long> inds = f_eval.GetIndices();
|
||||
std::vector<unsigned long> inds1 = s_eval.GetIndices();
|
||||
std::vector<unsigned long> inds2 = b_eval.GetIndices();
|
||||
std::vector<Mesh::FacetIndex> inds = f_eval.GetIndices();
|
||||
std::vector<Mesh::FacetIndex> inds1 = s_eval.GetIndices();
|
||||
std::vector<Mesh::FacetIndex> inds2 = b_eval.GetIndices();
|
||||
inds.insert(inds.end(), inds1.begin(), inds1.end());
|
||||
inds.insert(inds.end(), inds2.begin(), inds2.end());
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObserver.h>
|
||||
#include <Mod/Mesh/App/Types.h>
|
||||
|
||||
class QAbstractButton;
|
||||
|
||||
@@ -127,7 +128,7 @@ protected:
|
||||
void refreshList();
|
||||
void showInformation();
|
||||
void cleanInformation();
|
||||
void addViewProvider(const char* vp, const std::vector<unsigned long>& indices);
|
||||
void addViewProvider(const char* vp, const std::vector<Mesh::ElementIndex>& indices);
|
||||
void removeViewProvider(const char* vp);
|
||||
void removeViewProviders();
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
@@ -121,7 +121,7 @@ SmoothingDialog::SmoothingDialog(QWidget* parent, Qt::WindowFlags fl)
|
||||
QVBoxLayout* hboxLayout = new QVBoxLayout(this);
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
|
||||
|
||||
connect(buttonBox, SIGNAL(accepted()),
|
||||
this, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()),
|
||||
@@ -138,7 +138,7 @@ SmoothingDialog::~SmoothingDialog()
|
||||
// ---------------------------------------
|
||||
|
||||
/* TRANSLATOR MeshGui::TaskSmoothing */
|
||||
|
||||
|
||||
TaskSmoothing::TaskSmoothing()
|
||||
{
|
||||
widget = new DlgSmoothing();
|
||||
@@ -180,7 +180,7 @@ bool TaskSmoothing::accept()
|
||||
bool hasSelection = false;
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it = meshes.begin(); it != meshes.end(); ++it) {
|
||||
Mesh::Feature* mesh = static_cast<Mesh::Feature*>(*it);
|
||||
std::vector<unsigned long> selection;
|
||||
std::vector<Mesh::FacetIndex> selection;
|
||||
if (widget->smoothSelection()) {
|
||||
// clear the selection before editing the mesh to avoid
|
||||
// to have coloured triangles when doing an 'undo'
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace bp = boost::placeholders;
|
||||
|
||||
PROPERTY_SOURCE(MeshGui::ViewProviderFace, Gui::ViewProviderDocumentObject)
|
||||
|
||||
ViewProviderFace::ViewProviderFace() : mesh(0), current_index(-1)
|
||||
ViewProviderFace::ViewProviderFace() : mesh(nullptr), current_index(-1)
|
||||
{
|
||||
pcCoords = new SoCoordinate3();
|
||||
pcCoords->ref();
|
||||
@@ -150,7 +150,7 @@ const char* ViewProviderFace::getDefaultDisplayMode() const
|
||||
return "Marker";
|
||||
}
|
||||
|
||||
std::vector<std::string> ViewProviderFace::getDisplayModes(void) const
|
||||
std::vector<std::string> ViewProviderFace::getDisplayModes() const
|
||||
{
|
||||
std::vector<std::string> modes;
|
||||
modes.push_back("Marker");
|
||||
@@ -174,7 +174,7 @@ SoPickedPoint* ViewProviderFace::getPickedPoint(const SbVec2s& pos, const Gui::V
|
||||
// returns a copy of the point
|
||||
SoPickedPoint* pick = rp.getPickedPoint();
|
||||
//return (pick ? pick->copy() : 0); // needs the same instance of CRT under MS Windows
|
||||
return (pick ? new SoPickedPoint(*pick) : 0);
|
||||
return (pick ? new SoPickedPoint(*pick) : nullptr);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -314,8 +314,8 @@ void MeshFaceAddition::showMarker(SoPickedPoint* pp)
|
||||
int index = (int)f._aulPoints[i];
|
||||
if (std::find(faceView->index.begin(), faceView->index.end(), index) != faceView->index.end())
|
||||
continue; // already inside
|
||||
if (f._aulNeighbours[i] == ULONG_MAX ||
|
||||
f._aulNeighbours[(i+2)%3] == ULONG_MAX) {
|
||||
if (f._aulNeighbours[i] == MeshCore::FACET_INDEX_MAX ||
|
||||
f._aulNeighbours[(i+2)%3] == MeshCore::FACET_INDEX_MAX) {
|
||||
pnt = points[index];
|
||||
float len = Base::DistanceP2(pnt, Base::Vector3f(vec[0],vec[1],vec[2]));
|
||||
if (len < distance) {
|
||||
@@ -418,8 +418,8 @@ namespace MeshGui {
|
||||
// for sorting of elements
|
||||
struct NofFacetsCompare
|
||||
{
|
||||
bool operator () (const std::vector<unsigned long> &rclC1,
|
||||
const std::vector<unsigned long> &rclC2)
|
||||
bool operator () (const std::vector<Mesh::PointIndex> &rclC1,
|
||||
const std::vector<Mesh::PointIndex> &rclC2)
|
||||
{
|
||||
return rclC1.size() < rclC2.size();
|
||||
}
|
||||
@@ -430,7 +430,7 @@ namespace MeshGui {
|
||||
|
||||
MeshFillHole::MeshFillHole(MeshHoleFiller& hf, Gui::View3DInventor* parent)
|
||||
: QObject(parent)
|
||||
, myMesh(0)
|
||||
, myMesh(nullptr)
|
||||
, myNumPoints(0)
|
||||
, myVertex1(0)
|
||||
, myVertex2(0)
|
||||
@@ -566,7 +566,7 @@ void MeshFillHole::createPolygons()
|
||||
const MeshCore::MeshKernel & rMesh = this->myMesh->Mesh.getValue().getKernel();
|
||||
|
||||
// get the mesh boundaries as an array of point indices
|
||||
std::list<std::vector<unsigned long> > borders;
|
||||
std::list<std::vector<Mesh::PointIndex> > borders;
|
||||
MeshCore::MeshAlgorithm cAlgo(rMesh);
|
||||
MeshCore::MeshPointIterator p_iter(rMesh);
|
||||
cAlgo.GetMeshBorders(borders);
|
||||
@@ -576,7 +576,7 @@ void MeshFillHole::createPolygons()
|
||||
borders.sort(NofFacetsCompare());
|
||||
|
||||
int32_t count=0;
|
||||
for (std::list<std::vector<unsigned long> >::iterator it =
|
||||
for (std::list<std::vector<Mesh::PointIndex> >::iterator it =
|
||||
borders.begin(); it != borders.end(); ++it) {
|
||||
if (it->front() == it->back())
|
||||
it->pop_back();
|
||||
@@ -589,14 +589,14 @@ void MeshFillHole::createPolygons()
|
||||
|
||||
coords->point.setNum(count);
|
||||
int32_t index = 0;
|
||||
for (std::list<std::vector<unsigned long> >::iterator it =
|
||||
for (std::list<std::vector<Mesh::PointIndex> >::iterator it =
|
||||
borders.begin(); it != borders.end(); ++it) {
|
||||
SoPolygon* polygon = new SoPolygon();
|
||||
polygon->startIndex = index;
|
||||
polygon->numVertices = it->size();
|
||||
myBoundariesGroup->addChild(polygon);
|
||||
myPolygons[polygon] = *it;
|
||||
for (std::vector<unsigned long>::iterator jt = it->begin();
|
||||
for (std::vector<Mesh::PointIndex>::iterator jt = it->begin();
|
||||
jt != it->end(); ++jt) {
|
||||
p_iter.Set(*jt);
|
||||
coords->point.set1Value(index++,p_iter->x,p_iter->y,p_iter->z);
|
||||
@@ -606,7 +606,7 @@ void MeshFillHole::createPolygons()
|
||||
|
||||
SoNode* MeshFillHole::getPickedPolygon(const SoRayPickAction& action/*SoNode* root, const SbVec2s& pos*/) const
|
||||
{
|
||||
SoPolygon* poly = 0;
|
||||
SoPolygon* poly = nullptr;
|
||||
const SoPickedPointList & points = action.getPickedPointList();
|
||||
for (int i=0; i < points.getLength(); i++) {
|
||||
const SoPickedPoint * point = points[i];
|
||||
@@ -627,11 +627,11 @@ SoNode* MeshFillHole::getPickedPolygon(const SoRayPickAction& action/*SoNode* ro
|
||||
}
|
||||
|
||||
float MeshFillHole::findClosestPoint(const SbLine& ray, const TBoundary& polygon,
|
||||
unsigned long& vertex_index, SbVec3f& closestPoint) const
|
||||
Mesh::PointIndex& vertex_index, SbVec3f& closestPoint) const
|
||||
{
|
||||
// now check which vertex of the polygon is closest to the ray
|
||||
float minDist = FLT_MAX;
|
||||
vertex_index = ULONG_MAX;
|
||||
vertex_index = MeshCore::POINT_INDEX_MAX;
|
||||
|
||||
const MeshCore::MeshKernel & rMesh = myMesh->Mesh.getValue().getKernel();
|
||||
const MeshCore::MeshPointArray& pts = rMesh.GetPoints();
|
||||
@@ -671,7 +671,7 @@ void MeshFillHole::fileHoleCallback(void * ud, SoEventCallback * n)
|
||||
std::map<SoNode*, TBoundary>::iterator it = self->myPolygons.find(node);
|
||||
if (it != self->myPolygons.end()) {
|
||||
// now check which vertex of the polygon is closest to the ray
|
||||
unsigned long vertex_index;
|
||||
Mesh::PointIndex vertex_index;
|
||||
SbVec3f closestPoint;
|
||||
float minDist = self->findClosestPoint(rp.getLine(), it->second, vertex_index, closestPoint);
|
||||
if (minDist < 1.0f) {
|
||||
@@ -701,7 +701,7 @@ void MeshFillHole::fileHoleCallback(void * ud, SoEventCallback * n)
|
||||
std::map<SoNode*, TBoundary>::iterator it = self->myPolygons.find(node);
|
||||
if (it != self->myPolygons.end()) {
|
||||
// now check which vertex of the polygon is closest to the ray
|
||||
unsigned long vertex_index;
|
||||
Mesh::PointIndex vertex_index;
|
||||
SbVec3f closestPoint;
|
||||
float minDist = self->findClosestPoint(rp.getLine(), it->second, vertex_index, closestPoint);
|
||||
if (minDist < 1.0f) {
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
void attach(App::DocumentObject* obj);
|
||||
void setDisplayMode(const char* ModeName);
|
||||
const char* getDefaultDisplayMode() const;
|
||||
std::vector<std::string> getDisplayModes(void) const;
|
||||
std::vector<std::string> getDisplayModes() const;
|
||||
SoPickedPoint* getPickedPoint(const SbVec2s& pos, const Gui::View3DInventorViewer* viewer) const;
|
||||
|
||||
ViewProviderMesh* mesh;
|
||||
@@ -110,8 +110,8 @@ public:
|
||||
virtual ~MeshHoleFiller()
|
||||
{
|
||||
}
|
||||
virtual bool fillHoles(Mesh::MeshObject&, const std::list<std::vector<unsigned long> >&,
|
||||
unsigned long, unsigned long)
|
||||
virtual bool fillHoles(Mesh::MeshObject&, const std::list<std::vector<Mesh::PointIndex> >&,
|
||||
Mesh::PointIndex, Mesh::PointIndex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -138,14 +138,14 @@ private Q_SLOTS:
|
||||
void closeBridge();
|
||||
|
||||
private:
|
||||
typedef std::vector<unsigned long> TBoundary;
|
||||
typedef std::vector<Mesh::PointIndex> TBoundary;
|
||||
typedef boost::signals2::connection Connection;
|
||||
|
||||
static void fileHoleCallback(void * ud, SoEventCallback * n);
|
||||
void createPolygons();
|
||||
SoNode* getPickedPolygon(const SoRayPickAction& action) const;
|
||||
float findClosestPoint(const SbLine& ray, const TBoundary& polygon,
|
||||
unsigned long&, SbVec3f&) const;
|
||||
Mesh::PointIndex&, SbVec3f&) const;
|
||||
void slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop);
|
||||
|
||||
private:
|
||||
@@ -157,8 +157,8 @@ private:
|
||||
std::map<SoNode*, TBoundary> myPolygons;
|
||||
Mesh::Feature* myMesh;
|
||||
int myNumPoints;
|
||||
unsigned long myVertex1;
|
||||
unsigned long myVertex2;
|
||||
Mesh::PointIndex myVertex1;
|
||||
Mesh::PointIndex myVertex2;
|
||||
TBoundary myPolygon;
|
||||
MeshHoleFiller& myHoleFiller;
|
||||
Connection myConnection;
|
||||
|
||||
@@ -254,8 +254,8 @@ void MeshSelection::fullSelection()
|
||||
for (std::list<ViewProviderMesh*>::iterator it = views.begin(); it != views.end(); ++it) {
|
||||
Mesh::Feature* mf = static_cast<Mesh::Feature*>((*it)->getObject());
|
||||
const Mesh::MeshObject* mo = mf->Mesh.getValuePtr();
|
||||
std::vector<unsigned long> faces(mo->countFacets());
|
||||
std::generate(faces.begin(), faces.end(), Base::iotaGen<unsigned long>(0));
|
||||
std::vector<Mesh::FacetIndex> faces(mo->countFacets());
|
||||
std::generate(faces.begin(), faces.end(), Base::iotaGen<Mesh::FacetIndex>(0));
|
||||
(*it)->addSelection(faces);
|
||||
}
|
||||
}
|
||||
@@ -301,12 +301,12 @@ bool MeshSelection::deleteSelectionBorder()
|
||||
Mesh::Feature* mf = static_cast<Mesh::Feature*>((*it)->getObject());
|
||||
|
||||
// mark the selected facet as visited
|
||||
std::vector<unsigned long> selection, remove;
|
||||
std::set<unsigned long> borderPoints;
|
||||
std::vector<Mesh::FacetIndex> selection, remove;
|
||||
std::set<Mesh::PointIndex> borderPoints;
|
||||
MeshCore::MeshAlgorithm meshAlg(mf->Mesh.getValue().getKernel());
|
||||
meshAlg.GetFacetsFlag(selection, MeshCore::MeshFacet::SELECTED);
|
||||
meshAlg.GetBorderPoints(selection, borderPoints);
|
||||
std::vector<unsigned long> border;
|
||||
std::vector<Mesh::PointIndex> border;
|
||||
border.insert(border.begin(), borderPoints.begin(), borderPoints.end());
|
||||
|
||||
meshAlg.ResetFacetFlag(MeshCore::MeshFacet::VISIT);
|
||||
@@ -359,13 +359,13 @@ void MeshSelection::selectComponent(int size)
|
||||
Mesh::Feature* mf = static_cast<Mesh::Feature*>((*it)->getObject());
|
||||
const Mesh::MeshObject* mo = mf->Mesh.getValuePtr();
|
||||
|
||||
std::vector<std::vector<unsigned long> > segm;
|
||||
std::vector<std::vector<Mesh::FacetIndex> > segm;
|
||||
MeshCore::MeshComponents comp(mo->getKernel());
|
||||
comp.SearchForComponents(MeshCore::MeshComponents::OverEdge,segm);
|
||||
|
||||
std::vector<unsigned long> faces;
|
||||
for (std::vector<std::vector<unsigned long> >::iterator jt = segm.begin(); jt != segm.end(); ++jt) {
|
||||
if (jt->size() < (unsigned long)size)
|
||||
std::vector<Mesh::FacetIndex> faces;
|
||||
for (std::vector<std::vector<Mesh::FacetIndex> >::iterator jt = segm.begin(); jt != segm.end(); ++jt) {
|
||||
if (jt->size() < (Mesh::FacetIndex)size)
|
||||
faces.insert(faces.end(), jt->begin(), jt->end());
|
||||
}
|
||||
|
||||
@@ -380,13 +380,13 @@ void MeshSelection::deselectComponent(int size)
|
||||
Mesh::Feature* mf = static_cast<Mesh::Feature*>((*it)->getObject());
|
||||
const Mesh::MeshObject* mo = mf->Mesh.getValuePtr();
|
||||
|
||||
std::vector<std::vector<unsigned long> > segm;
|
||||
std::vector<std::vector<Mesh::FacetIndex> > segm;
|
||||
MeshCore::MeshComponents comp(mo->getKernel());
|
||||
comp.SearchForComponents(MeshCore::MeshComponents::OverEdge,segm);
|
||||
|
||||
std::vector<unsigned long> faces;
|
||||
for (std::vector<std::vector<unsigned long> >::iterator jt = segm.begin(); jt != segm.end(); ++jt) {
|
||||
if (jt->size() > (unsigned long)size)
|
||||
std::vector<Mesh::FacetIndex> faces;
|
||||
for (std::vector<std::vector<Mesh::FacetIndex> >::iterator jt = segm.begin(); jt != segm.end(); ++jt) {
|
||||
if (jt->size() > (Mesh::FacetIndex)size)
|
||||
faces.insert(faces.end(), jt->begin(), jt->end());
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ void MeshSelection::selectGLCallback(void * ud, SoEventCallback * n)
|
||||
for (std::list<ViewProviderMesh*>::iterator it = views.begin(); it != views.end(); ++it) {
|
||||
ViewProviderMesh* vp = *it;
|
||||
|
||||
std::vector<unsigned long> faces;
|
||||
std::vector<Mesh::FacetIndex> faces;
|
||||
const Mesh::MeshObject& mesh = static_cast<Mesh::Feature*>((*it)->getObject())->Mesh.getValue();
|
||||
const MeshCore::MeshKernel& kernel = mesh.getKernel();
|
||||
|
||||
@@ -494,23 +494,23 @@ void MeshSelection::selectGLCallback(void * ud, SoEventCallback * n)
|
||||
const SbVec2s& p = *it;
|
||||
rect.extendBy(SbVec2s(p[0],height-p[1]));
|
||||
}
|
||||
std::vector<unsigned long> rf; rf.swap(faces);
|
||||
std::vector<unsigned long> vf = vp->getVisibleFacetsAfterZoom
|
||||
std::vector<Mesh::FacetIndex> rf; rf.swap(faces);
|
||||
std::vector<Mesh::FacetIndex> vf = vp->getVisibleFacetsAfterZoom
|
||||
(rect, view->getSoRenderManager()->getViewportRegion(), view->getSoRenderManager()->getCamera());
|
||||
|
||||
// get common facets of the viewport and the visible one
|
||||
std::sort(vf.begin(), vf.end());
|
||||
std::sort(rf.begin(), rf.end());
|
||||
std::back_insert_iterator<std::vector<unsigned long> > biit(faces);
|
||||
std::back_insert_iterator<std::vector<Mesh::FacetIndex> > biit(faces);
|
||||
std::set_intersection(vf.begin(), vf.end(), rf.begin(), rf.end(), biit);
|
||||
}
|
||||
|
||||
// if set filter out all triangles which do not point into user direction
|
||||
if (self->onlyPointToUserTriangles) {
|
||||
std::vector<unsigned long> screen;
|
||||
std::vector<Mesh::FacetIndex> screen;
|
||||
screen.reserve(faces.size());
|
||||
MeshCore::MeshFacetIterator it_f(kernel);
|
||||
for (std::vector<unsigned long>::iterator it = faces.begin(); it != faces.end(); ++it) {
|
||||
for (std::vector<Mesh::FacetIndex>::iterator it = faces.begin(); it != faces.end(); ++it) {
|
||||
it_f.Set(*it);
|
||||
if (it_f->GetNormal() * normal > 0.0f) {
|
||||
screen.push_back(*it);
|
||||
@@ -560,7 +560,7 @@ void MeshSelection::pickFaceCallback(void * ud, SoEventCallback * n)
|
||||
const SoDetail* detail = point->getDetail(/*mesh->getShapeNode()*/);
|
||||
if (detail && detail->getTypeId() == SoFaceDetail::getClassTypeId()) {
|
||||
// get the boundary to the picked facet
|
||||
unsigned long uFacet = static_cast<const SoFaceDetail*>(detail)->getFaceIndex();
|
||||
Mesh::FacetIndex uFacet = static_cast<const SoFaceDetail*>(detail)->getFaceIndex();
|
||||
if (self->addToSelection) {
|
||||
if (self->addComponent)
|
||||
mesh->selectComponent(uFacet);
|
||||
|
||||
@@ -262,7 +262,7 @@ void ParametersDialog::on_compute_clicked()
|
||||
const Mesh::MeshObject& kernel = myMesh->Mesh.getValue();
|
||||
if (kernel.hasSelectedFacets()) {
|
||||
FitParameter::Points fitpts;
|
||||
std::vector<unsigned long> facets, points;
|
||||
std::vector<Mesh::ElementIndex> facets, points;
|
||||
kernel.getFacetsFromSelection(facets);
|
||||
points = kernel.getPointsFromFacets(facets);
|
||||
MeshCore::MeshPointArray coords = kernel.getKernel().GetPoints(points);
|
||||
|
||||
@@ -388,7 +388,7 @@ void SoFCMeshPickNode::pick(SoPickAction * action)
|
||||
const SbVec3f& dir = line.getDirection();
|
||||
Base::Vector3f pt(pos[0],pos[1],pos[2]);
|
||||
Base::Vector3f dr(dir[0],dir[1],dir[2]);
|
||||
unsigned long index;
|
||||
Mesh::FacetIndex index;
|
||||
if (alg.NearestFacetOnRay(pt, dr, *meshGrid, pt, index)) {
|
||||
SoPickedPoint* pp = raypick->addIntersection(SbVec3f(pt.x,pt.y,pt.z));
|
||||
if (pp) {
|
||||
@@ -1350,7 +1350,7 @@ void SoFCMeshSegmentShape::drawFaces(const Mesh::MeshObject * mesh, SoMaterialBu
|
||||
const MeshCore::MeshFacetArray & rFacets = mesh->getKernel().GetFacets();
|
||||
if (mesh->countSegments() <= this->index.getValue())
|
||||
return;
|
||||
const std::vector<unsigned long> rSegm = mesh->getSegment
|
||||
const std::vector<Mesh::FacetIndex> rSegm = mesh->getSegment
|
||||
(this->index.getValue()).getIndices();
|
||||
bool perVertex = (mb && bind == PER_VERTEX_INDEXED);
|
||||
bool perFace = (mb && bind == PER_FACE_INDEXED);
|
||||
@@ -1360,7 +1360,7 @@ void SoFCMeshSegmentShape::drawFaces(const Mesh::MeshObject * mesh, SoMaterialBu
|
||||
glBegin(GL_TRIANGLES);
|
||||
if (ccw) {
|
||||
// counterclockwise ordering
|
||||
for (std::vector<unsigned long>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it)
|
||||
for (std::vector<Mesh::FacetIndex>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it)
|
||||
{
|
||||
const MeshCore::MeshFacet& f = rFacets[*it];
|
||||
const MeshCore::MeshPoint& v0 = rPoints[f._aulPoints[0]];
|
||||
@@ -1389,7 +1389,7 @@ void SoFCMeshSegmentShape::drawFaces(const Mesh::MeshObject * mesh, SoMaterialBu
|
||||
}
|
||||
else {
|
||||
// clockwise ordering
|
||||
for (std::vector<unsigned long>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it)
|
||||
for (std::vector<Mesh::FacetIndex>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it)
|
||||
{
|
||||
const MeshCore::MeshFacet& f = rFacets[*it];
|
||||
const MeshCore::MeshPoint& v0 = rPoints[f._aulPoints[0]];
|
||||
@@ -1412,7 +1412,7 @@ void SoFCMeshSegmentShape::drawFaces(const Mesh::MeshObject * mesh, SoMaterialBu
|
||||
}
|
||||
else {
|
||||
glBegin(GL_TRIANGLES);
|
||||
for (std::vector<unsigned long>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it)
|
||||
for (std::vector<Mesh::FacetIndex>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it)
|
||||
{
|
||||
const MeshCore::MeshFacet& f = rFacets[*it];
|
||||
glVertex(rPoints[f._aulPoints[0]]);
|
||||
@@ -1432,7 +1432,7 @@ void SoFCMeshSegmentShape::drawPoints(const Mesh::MeshObject * mesh, SbBool need
|
||||
const MeshCore::MeshFacetArray & rFacets = mesh->getKernel().GetFacets();
|
||||
if (mesh->countSegments() <= this->index.getValue())
|
||||
return;
|
||||
const std::vector<unsigned long> rSegm = mesh->getSegment
|
||||
const std::vector<Mesh::FacetIndex> rSegm = mesh->getSegment
|
||||
(this->index.getValue()).getIndices();
|
||||
int mod = rSegm.size()/renderTriangleLimit+1;
|
||||
|
||||
@@ -1444,7 +1444,7 @@ void SoFCMeshSegmentShape::drawPoints(const Mesh::MeshObject * mesh, SbBool need
|
||||
glBegin(GL_POINTS);
|
||||
int ct=0;
|
||||
if (ccw) {
|
||||
for (std::vector<unsigned long>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it, ct++)
|
||||
for (std::vector<Mesh::FacetIndex>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it, ct++)
|
||||
{
|
||||
if (ct%mod==0) {
|
||||
const MeshCore::MeshFacet& f = rFacets[*it];
|
||||
@@ -1469,7 +1469,7 @@ void SoFCMeshSegmentShape::drawPoints(const Mesh::MeshObject * mesh, SbBool need
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (std::vector<unsigned long>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it, ct++)
|
||||
for (std::vector<Mesh::FacetIndex>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it, ct++)
|
||||
{
|
||||
if (ct%mod==0) {
|
||||
const MeshCore::MeshFacet& f = rFacets[*it];
|
||||
@@ -1498,7 +1498,7 @@ void SoFCMeshSegmentShape::drawPoints(const Mesh::MeshObject * mesh, SbBool need
|
||||
else {
|
||||
glBegin(GL_POINTS);
|
||||
int ct=0;
|
||||
for (std::vector<unsigned long>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it, ct++)
|
||||
for (std::vector<Mesh::FacetIndex>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it, ct++)
|
||||
{
|
||||
if (ct%mod==0) {
|
||||
const MeshCore::MeshFacet& f = rFacets[*it];
|
||||
@@ -1536,7 +1536,7 @@ void SoFCMeshSegmentShape::generatePrimitives(SoAction* action)
|
||||
return;
|
||||
if (mesh->countSegments() <= this->index.getValue())
|
||||
return;
|
||||
const std::vector<unsigned long> rSegm = mesh->getSegment
|
||||
const std::vector<Mesh::FacetIndex> rSegm = mesh->getSegment
|
||||
(this->index.getValue()).getIndices();
|
||||
|
||||
// get material binding
|
||||
@@ -1552,7 +1552,7 @@ void SoFCMeshSegmentShape::generatePrimitives(SoAction* action)
|
||||
beginShape(action, TRIANGLES, &faceDetail);
|
||||
try
|
||||
{
|
||||
for (std::vector<unsigned long>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it)
|
||||
for (std::vector<Mesh::FacetIndex>::const_iterator it = rSegm.begin(); it != rSegm.end(); ++it)
|
||||
{
|
||||
const MeshCore::MeshFacet& f = rFacets[*it];
|
||||
const MeshCore::MeshPoint& v0 = rPoints[f._aulPoints[0]];
|
||||
@@ -1618,13 +1618,13 @@ void SoFCMeshSegmentShape::computeBBox(SoAction *action, SbBox3f &box, SbVec3f &
|
||||
const Mesh::MeshObject * mesh = SoFCMeshObjectElement::get(state);
|
||||
if (mesh && mesh->countSegments() > this->index.getValue()) {
|
||||
const Mesh::Segment& segm = mesh->getSegment(this->index.getValue());
|
||||
const std::vector<unsigned long>& indices = segm.getIndices();
|
||||
const std::vector<Mesh::FacetIndex>& indices = segm.getIndices();
|
||||
Base::BoundBox3f cBox;
|
||||
if (!indices.empty()) {
|
||||
const MeshCore::MeshPointArray& rPoint = mesh->getKernel().GetPoints();
|
||||
const MeshCore::MeshFacetArray& rFaces = mesh->getKernel().GetFacets();
|
||||
|
||||
for (std::vector<unsigned long>::const_iterator it = indices.begin();
|
||||
for (std::vector<Mesh::FacetIndex>::const_iterator it = indices.begin();
|
||||
it != indices.end(); ++it) {
|
||||
const MeshCore::MeshFacet& face = rFaces[*it];
|
||||
cBox.Add(rPoint[face._aulPoints[0]]);
|
||||
@@ -1709,7 +1709,7 @@ void SoFCMeshObjectBoundary::drawLines(const Mesh::MeshObject * mesh) const
|
||||
glBegin(GL_LINES);
|
||||
for (MeshCore::MeshFacetArray::_TConstIterator it = rFacets.begin(); it != rFacets.end(); ++it) {
|
||||
for (int i=0; i<3; i++) {
|
||||
if (it->_aulNeighbours[i] == ULONG_MAX) {
|
||||
if (it->_aulNeighbours[i] == MeshCore::FACET_INDEX_MAX) {
|
||||
glVertex(rPoints[it->_aulPoints[i]]);
|
||||
glVertex(rPoints[it->_aulPoints[(i+1)%3]]);
|
||||
}
|
||||
@@ -1741,7 +1741,7 @@ void SoFCMeshObjectBoundary::generatePrimitives(SoAction* action)
|
||||
for (MeshCore::MeshFacetArray::_TConstIterator it = rFacets.begin(); it != rFacets.end(); ++it)
|
||||
{
|
||||
for (int i=0; i<3; i++) {
|
||||
if (it->_aulNeighbours[i] == ULONG_MAX) {
|
||||
if (it->_aulNeighbours[i] == MeshCore::FACET_INDEX_MAX) {
|
||||
const MeshCore::MeshPoint& v0 = rPoints[it->_aulPoints[i]];
|
||||
const MeshCore::MeshPoint& v1 = rPoints[it->_aulPoints[(i+1)%3]];
|
||||
|
||||
@@ -1805,7 +1805,7 @@ void SoFCMeshObjectBoundary::getPrimitiveCount(SoGetPrimitiveCountAction * actio
|
||||
int ctEdges=0;
|
||||
for (MeshCore::MeshFacetArray::_TConstIterator jt = rFaces.begin(); jt != rFaces.end(); ++jt) {
|
||||
for (int i=0; i<3; i++) {
|
||||
if (jt->_aulNeighbours[i] == ULONG_MAX) {
|
||||
if (jt->_aulNeighbours[i] == MeshCore::FACET_INDEX_MAX) {
|
||||
ctEdges++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,14 +147,14 @@ void ViewProviderMeshBuilder::createMesh(const App::Property* prop, SoCoordinate
|
||||
const MeshCore::MeshPointArray& cP = rcMesh.GetPoints();
|
||||
coords->point.setNum(rcMesh.CountPoints());
|
||||
SbVec3f* verts = coords->point.startEditing();
|
||||
unsigned long i=0;
|
||||
int i=0;
|
||||
for (MeshCore::MeshPointArray::_TConstIterator it = cP.begin(); it != cP.end(); ++it, i++) {
|
||||
verts[i].setValue(it->x, it->y, it->z);
|
||||
}
|
||||
coords->point.finishEditing();
|
||||
|
||||
// set the face indices
|
||||
unsigned long j=0;
|
||||
int j=0;
|
||||
const MeshCore::MeshFacetArray& cF = rcMesh.GetFacets();
|
||||
faces->coordIndex.setNum(4*rcMesh.CountFacets());
|
||||
int32_t* indices = faces->coordIndex.startEditing();
|
||||
@@ -1211,7 +1211,7 @@ void ViewProviderMesh::selectGLCallback(void * ud, SoEventCallback * n)
|
||||
void ViewProviderMesh::getFacetsFromPolygon(const std::vector<SbVec2f>& picked,
|
||||
const Base::ViewProjMethod& proj,
|
||||
SbBool inner,
|
||||
std::vector<unsigned long>& indices) const
|
||||
std::vector<Mesh::FacetIndex>& indices) const
|
||||
{
|
||||
const bool ok = true;
|
||||
Base::Polygon2d polygon;
|
||||
@@ -1225,11 +1225,11 @@ void ViewProviderMesh::getFacetsFromPolygon(const std::vector<SbVec2f>& picked,
|
||||
|
||||
if (!inner) {
|
||||
// get the indices that are completely outside
|
||||
std::vector<unsigned long> complete(meshProp.getValue().countFacets());
|
||||
std::generate(complete.begin(), complete.end(), Base::iotaGen<unsigned long>(0));
|
||||
std::vector<Mesh::FacetIndex> complete(meshProp.getValue().countFacets());
|
||||
std::generate(complete.begin(), complete.end(), Base::iotaGen<Mesh::FacetIndex>(0));
|
||||
std::sort(indices.begin(), indices.end());
|
||||
std::vector<unsigned long> complementary;
|
||||
std::back_insert_iterator<std::vector<unsigned long> > biit(complementary);
|
||||
std::vector<Mesh::FacetIndex> complementary;
|
||||
std::back_insert_iterator<std::vector<Mesh::FacetIndex> > biit(complementary);
|
||||
std::set_difference(complete.begin(), complete.end(), indices.begin(), indices.end(), biit);
|
||||
indices = complementary;
|
||||
}
|
||||
@@ -1238,7 +1238,7 @@ void ViewProviderMesh::getFacetsFromPolygon(const std::vector<SbVec2f>& picked,
|
||||
Base::Console().Message("The picked polygon seems to have self-overlappings. This could lead to strange results.");
|
||||
}
|
||||
|
||||
std::vector<unsigned long> ViewProviderMesh::getFacetsOfRegion(const SbViewportRegion& select,
|
||||
std::vector<Mesh::FacetIndex> ViewProviderMesh::getFacetsOfRegion(const SbViewportRegion& select,
|
||||
const SbViewportRegion& region,
|
||||
SoCamera* camera) const
|
||||
{
|
||||
@@ -1251,7 +1251,7 @@ std::vector<unsigned long> ViewProviderMesh::getFacetsOfRegion(const SbViewportR
|
||||
gl.apply(root);
|
||||
root->unref();
|
||||
|
||||
std::vector<unsigned long> faces;
|
||||
std::vector<Mesh::FacetIndex> faces;
|
||||
faces.insert(faces.end(), gl.indices.begin(), gl.indices.end());
|
||||
return faces;
|
||||
}
|
||||
@@ -1315,7 +1315,7 @@ void ViewProviderMesh::boxZoom(const SbBox2s& box, const SbViewportRegion & vp,
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<unsigned long> ViewProviderMesh::getVisibleFacetsAfterZoom(const SbBox2s& rect,
|
||||
std::vector<Mesh::FacetIndex> ViewProviderMesh::getVisibleFacetsAfterZoom(const SbBox2s& rect,
|
||||
const SbViewportRegion& vp,
|
||||
SoCamera* camera) const
|
||||
{
|
||||
@@ -1363,7 +1363,7 @@ private:
|
||||
|
||||
}
|
||||
|
||||
std::vector<unsigned long> ViewProviderMesh::getVisibleFacets(const SbViewportRegion& vp,
|
||||
std::vector<Mesh::FacetIndex> ViewProviderMesh::getVisibleFacets(const SbViewportRegion& vp,
|
||||
SoCamera* camera) const
|
||||
{
|
||||
#if 0
|
||||
@@ -1458,14 +1458,14 @@ std::vector<unsigned long> ViewProviderMesh::getVisibleFacets(const SbViewportRe
|
||||
int width = img.width();
|
||||
int height = img.height();
|
||||
QRgb color=0;
|
||||
std::vector<unsigned long> faces;
|
||||
std::vector<Mesh::FacetIndex> faces;
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
QRgb rgb = img.pixel(x,y);
|
||||
rgb = rgb-(0xff << 24);
|
||||
if (rgb != 0 && rgb != color) {
|
||||
color = rgb;
|
||||
faces.push_back((unsigned long)rgb);
|
||||
faces.push_back((Mesh::FacetIndex)rgb);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1481,7 +1481,7 @@ void ViewProviderMesh::cutMesh(const std::vector<SbVec2f>& picked,
|
||||
const Base::ViewProjMethod& proj, SbBool inner)
|
||||
{
|
||||
// Get the facet indices inside the tool mesh
|
||||
std::vector<unsigned long> indices;
|
||||
std::vector<Mesh::FacetIndex> indices;
|
||||
getFacetsFromPolygon(picked, proj, inner, indices);
|
||||
removeFacets(indices);
|
||||
}
|
||||
@@ -1510,17 +1510,17 @@ void ViewProviderMesh::splitMesh(const MeshCore::MeshKernel& toolMesh, const Bas
|
||||
const MeshCore::MeshKernel& meshPropKernel = meshProp.getValue().getKernel();
|
||||
|
||||
// Get the facet indices inside the tool mesh
|
||||
std::vector<unsigned long> indices;
|
||||
std::vector<Mesh::FacetIndex> indices;
|
||||
MeshCore::MeshFacetGrid cGrid(meshPropKernel);
|
||||
MeshCore::MeshAlgorithm cAlg(meshPropKernel);
|
||||
cAlg.GetFacetsFromToolMesh(toolMesh, normal, cGrid, indices);
|
||||
if (!clip_inner) {
|
||||
// get the indices that are completely outside
|
||||
std::vector<unsigned long> complete(meshPropKernel.CountFacets());
|
||||
std::generate(complete.begin(), complete.end(), Base::iotaGen<unsigned long>(0));
|
||||
std::vector<Mesh::FacetIndex> complete(meshPropKernel.CountFacets());
|
||||
std::generate(complete.begin(), complete.end(), Base::iotaGen<Mesh::FacetIndex>(0));
|
||||
std::sort(indices.begin(), indices.end());
|
||||
std::vector<unsigned long> complementary;
|
||||
std::back_insert_iterator<std::vector<unsigned long> > biit(complementary);
|
||||
std::vector<Mesh::FacetIndex> complementary;
|
||||
std::back_insert_iterator<std::vector<Mesh::FacetIndex> > biit(complementary);
|
||||
std::set_difference(complete.begin(), complete.end(), indices.begin(), indices.end(), biit);
|
||||
indices = complementary;
|
||||
}
|
||||
@@ -1542,17 +1542,17 @@ void ViewProviderMesh::segmentMesh(const MeshCore::MeshKernel& toolMesh, const B
|
||||
const MeshCore::MeshKernel& meshPropKernel = meshProp.getValue().getKernel();
|
||||
|
||||
// Get the facet indices inside the tool mesh
|
||||
std::vector<unsigned long> indices;
|
||||
std::vector<Mesh::FacetIndex> indices;
|
||||
MeshCore::MeshFacetGrid cGrid(meshPropKernel);
|
||||
MeshCore::MeshAlgorithm cAlg(meshPropKernel);
|
||||
cAlg.GetFacetsFromToolMesh(toolMesh, normal, cGrid, indices);
|
||||
if (!clip_inner) {
|
||||
// get the indices that are completely outside
|
||||
std::vector<unsigned long> complete(meshPropKernel.CountFacets());
|
||||
std::generate(complete.begin(), complete.end(), Base::iotaGen<unsigned long>(0));
|
||||
std::vector<Mesh::FacetIndex> complete(meshPropKernel.CountFacets());
|
||||
std::generate(complete.begin(), complete.end(), Base::iotaGen<Mesh::FacetIndex>(0));
|
||||
std::sort(indices.begin(), indices.end());
|
||||
std::vector<unsigned long> complementary;
|
||||
std::back_insert_iterator<std::vector<unsigned long> > biit(complementary);
|
||||
std::vector<Mesh::FacetIndex> complementary;
|
||||
std::back_insert_iterator<std::vector<Mesh::FacetIndex> > biit(complementary);
|
||||
std::set_difference(complete.begin(), complete.end(), indices.begin(), indices.end(), biit);
|
||||
indices = complementary;
|
||||
}
|
||||
@@ -1617,7 +1617,7 @@ void ViewProviderMesh::faceInfoCallback(void * ud, SoEventCallback * n)
|
||||
if (detail && detail->getTypeId() == SoFaceDetail::getClassTypeId()) {
|
||||
// get the boundary to the picked facet
|
||||
const SoFaceDetail* faceDetail = static_cast<const SoFaceDetail*>(detail);
|
||||
unsigned long uFacet = faceDetail->getFaceIndex();
|
||||
Mesh::FacetIndex uFacet = faceDetail->getFaceIndex();
|
||||
that->faceInfo(uFacet);
|
||||
Gui::GLFlagWindow* flags = 0;
|
||||
std::list<Gui::GLGraphicsItem*> glItems = view->getGraphicsItemsOfType(Gui::GLFlagWindow::getClassTypeId());
|
||||
@@ -1683,7 +1683,7 @@ void ViewProviderMesh::fillHoleCallback(void * ud, SoEventCallback * n)
|
||||
const SoDetail* detail = point->getDetail(that->getShapeNode());
|
||||
if ( detail && detail->getTypeId() == SoFaceDetail::getClassTypeId() ) {
|
||||
// get the boundary to the picked facet
|
||||
unsigned long uFacet = ((SoFaceDetail*)detail)->getFaceIndex();
|
||||
Mesh::FacetIndex uFacet = ((SoFaceDetail*)detail)->getFaceIndex();
|
||||
that->fillHole(uFacet);
|
||||
}
|
||||
}
|
||||
@@ -1750,14 +1750,14 @@ void ViewProviderMesh::markPartCallback(void * ud, SoEventCallback * n)
|
||||
const SoDetail* detail = point->getDetail(that->getShapeNode());
|
||||
if ( detail && detail->getTypeId() == SoFaceDetail::getClassTypeId() ) {
|
||||
// get the boundary to the picked facet
|
||||
unsigned long uFacet = static_cast<const SoFaceDetail*>(detail)->getFaceIndex();
|
||||
Mesh::FacetIndex uFacet = static_cast<const SoFaceDetail*>(detail)->getFaceIndex();
|
||||
that->selectComponent(uFacet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderMesh::faceInfo(unsigned long uFacet)
|
||||
void ViewProviderMesh::faceInfo(Mesh::FacetIndex uFacet)
|
||||
{
|
||||
Mesh::Feature* fea = static_cast<Mesh::Feature*>(this->getObject());
|
||||
const MeshCore::MeshKernel& rKernel = fea->Mesh.getValue().getKernel();
|
||||
@@ -1775,28 +1775,28 @@ void ViewProviderMesh::faceInfo(unsigned long uFacet)
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderMesh::fillHole(unsigned long uFacet)
|
||||
void ViewProviderMesh::fillHole(Mesh::FacetIndex uFacet)
|
||||
{
|
||||
// get parameter from user settings
|
||||
Base::Reference<ParameterGrp> hGrp = Gui::WindowParameter::getDefaultParameter()->GetGroup("Mod/Mesh");
|
||||
int level = (int)hGrp->GetInt("FillHoleLevel", 2);
|
||||
|
||||
// get the boundary to the picked facet
|
||||
std::list<unsigned long> aBorder;
|
||||
std::list<Mesh::PointIndex> aBorder;
|
||||
Mesh::Feature* fea = reinterpret_cast<Mesh::Feature*>(this->getObject());
|
||||
const MeshCore::MeshKernel& rKernel = fea->Mesh.getValue().getKernel();
|
||||
MeshCore::MeshRefPointToFacets cPt2Fac(rKernel);
|
||||
MeshCore::MeshAlgorithm meshAlg(rKernel);
|
||||
meshAlg.GetMeshBorder(uFacet, aBorder);
|
||||
std::vector<unsigned long> boundary(aBorder.begin(), aBorder.end());
|
||||
std::list<std::vector<unsigned long> > boundaries;
|
||||
std::vector<Mesh::PointIndex> boundary(aBorder.begin(), aBorder.end());
|
||||
std::list<std::vector<Mesh::PointIndex> > boundaries;
|
||||
boundaries.push_back(boundary);
|
||||
meshAlg.SplitBoundaryLoops(boundaries);
|
||||
|
||||
std::vector<MeshCore::MeshFacet> newFacets;
|
||||
std::vector<Base::Vector3f> newPoints;
|
||||
unsigned long numberOfOldPoints = rKernel.CountPoints();
|
||||
for (std::list<std::vector<unsigned long> >::iterator it = boundaries.begin(); it != boundaries.end(); ++it) {
|
||||
for (std::list<std::vector<Mesh::PointIndex> >::iterator it = boundaries.begin(); it != boundaries.end(); ++it) {
|
||||
if (it->size() < 3/* || it->size() > 200*/)
|
||||
continue;
|
||||
boundary = *it;
|
||||
@@ -1863,7 +1863,12 @@ void ViewProviderMesh::resetFacetTransparency()
|
||||
pcShapeMaterial->transparency.setValue(0);
|
||||
}
|
||||
|
||||
void ViewProviderMesh::removeFacets(const std::vector<unsigned long>& facets)
|
||||
/*! The triangles with the passed indices are already added to the mesh. */
|
||||
void ViewProviderMesh::appendFacets(const std::vector<Mesh::FacetIndex>&)
|
||||
{
|
||||
}
|
||||
|
||||
void ViewProviderMesh::removeFacets(const std::vector<Mesh::FacetIndex>& facets)
|
||||
{
|
||||
// Get the attached mesh property
|
||||
Mesh::PropertyMeshKernel& meshProp = static_cast<Mesh::Feature*>(pcObject)->Mesh;
|
||||
@@ -1874,7 +1879,7 @@ void ViewProviderMesh::removeFacets(const std::vector<unsigned long>& facets)
|
||||
bool ok = Coloring.getValue();
|
||||
|
||||
if (prop && prop->getSize() == static_cast<int>(kernel->countPoints())) {
|
||||
std::vector<unsigned long> pointDegree;
|
||||
std::vector<Mesh::PointIndex> pointDegree;
|
||||
unsigned long invalid = kernel->getPointDegree(facets, pointDegree);
|
||||
if (invalid > 0) {
|
||||
// switch off coloring mode
|
||||
@@ -1921,9 +1926,9 @@ void ViewProviderMesh::removeFacets(const std::vector<unsigned long>& facets)
|
||||
Coloring.setValue(ok);
|
||||
}
|
||||
|
||||
void ViewProviderMesh::selectFacet(unsigned long facet)
|
||||
void ViewProviderMesh::selectFacet(Mesh::FacetIndex facet)
|
||||
{
|
||||
std::vector<unsigned long> selection;
|
||||
std::vector<Mesh::FacetIndex> selection;
|
||||
selection.push_back(facet);
|
||||
|
||||
const Mesh::MeshObject& rMesh = static_cast<Mesh::Feature*>(pcObject)->Mesh.getValue();
|
||||
@@ -1941,9 +1946,9 @@ void ViewProviderMesh::selectFacet(unsigned long facet)
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderMesh::deselectFacet(unsigned long facet)
|
||||
void ViewProviderMesh::deselectFacet(Mesh::FacetIndex facet)
|
||||
{
|
||||
std::vector<unsigned long> selection;
|
||||
std::vector<Mesh::FacetIndex> selection;
|
||||
selection.push_back(facet);
|
||||
|
||||
const Mesh::MeshObject& rMesh = static_cast<Mesh::Feature*>(pcObject)->Mesh.getValue();
|
||||
@@ -1967,16 +1972,16 @@ void ViewProviderMesh::deselectFacet(unsigned long facet)
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderMesh::isFacetSelected(unsigned long facet)
|
||||
bool ViewProviderMesh::isFacetSelected(Mesh::FacetIndex facet)
|
||||
{
|
||||
const Mesh::MeshObject& rMesh = static_cast<Mesh::Feature*>(pcObject)->Mesh.getValue();
|
||||
const MeshCore::MeshFacetArray& faces = rMesh.getKernel().GetFacets();
|
||||
return faces[facet].IsFlag(MeshCore::MeshFacet::SELECTED);
|
||||
}
|
||||
|
||||
void ViewProviderMesh::selectComponent(unsigned long uFacet)
|
||||
void ViewProviderMesh::selectComponent(Mesh::FacetIndex uFacet)
|
||||
{
|
||||
std::vector<unsigned long> selection;
|
||||
std::vector<Mesh::FacetIndex> selection;
|
||||
selection.push_back(uFacet);
|
||||
|
||||
MeshCore::MeshTopFacetVisitor clVisitor(selection);
|
||||
@@ -1990,9 +1995,9 @@ void ViewProviderMesh::selectComponent(unsigned long uFacet)
|
||||
highlightSelection();
|
||||
}
|
||||
|
||||
void ViewProviderMesh::deselectComponent(unsigned long uFacet)
|
||||
void ViewProviderMesh::deselectComponent(Mesh::FacetIndex uFacet)
|
||||
{
|
||||
std::vector<unsigned long> selection;
|
||||
std::vector<Mesh::FacetIndex> selection;
|
||||
selection.push_back(uFacet);
|
||||
|
||||
MeshCore::MeshTopFacetVisitor clVisitor(selection);
|
||||
@@ -2009,7 +2014,7 @@ void ViewProviderMesh::deselectComponent(unsigned long uFacet)
|
||||
unhighlightSelection();
|
||||
}
|
||||
|
||||
void ViewProviderMesh::setSelection(const std::vector<unsigned long>& indices)
|
||||
void ViewProviderMesh::setSelection(const std::vector<Mesh::FacetIndex>& indices)
|
||||
{
|
||||
const Mesh::MeshObject& rMesh = static_cast<Mesh::Feature*>(pcObject)->Mesh.getValue();
|
||||
rMesh.clearFacetSelection();
|
||||
@@ -2022,7 +2027,7 @@ void ViewProviderMesh::setSelection(const std::vector<unsigned long>& indices)
|
||||
highlightSelection();
|
||||
}
|
||||
|
||||
void ViewProviderMesh::addSelection(const std::vector<unsigned long>& indices)
|
||||
void ViewProviderMesh::addSelection(const std::vector<Mesh::FacetIndex>& indices)
|
||||
{
|
||||
const Mesh::MeshObject& rMesh = static_cast<Mesh::Feature*>(pcObject)->Mesh.getValue();
|
||||
rMesh.addFacetsToSelection(indices);
|
||||
@@ -2031,7 +2036,7 @@ void ViewProviderMesh::addSelection(const std::vector<unsigned long>& indices)
|
||||
highlightSelection();
|
||||
}
|
||||
|
||||
void ViewProviderMesh::removeSelection(const std::vector<unsigned long>& indices)
|
||||
void ViewProviderMesh::removeSelection(const std::vector<Mesh::FacetIndex>& indices)
|
||||
{
|
||||
const Mesh::MeshObject& rMesh = static_cast<Mesh::Feature*>(pcObject)->Mesh.getValue();
|
||||
rMesh.removeFacetsFromSelection(indices);
|
||||
@@ -2051,7 +2056,7 @@ void ViewProviderMesh::invertSelection()
|
||||
unsigned long num_notsel = std::count_if(faces.begin(), faces.end(), [flag](const MeshCore::MeshFacet& f) {
|
||||
return flag(f, MeshCore::MeshFacet::SELECTED);
|
||||
});
|
||||
std::vector<unsigned long> notselect;
|
||||
std::vector<Mesh::FacetIndex> notselect;
|
||||
notselect.reserve(num_notsel);
|
||||
MeshCore::MeshFacetArray::_TConstIterator beg = faces.begin();
|
||||
MeshCore::MeshFacetArray::_TConstIterator end = faces.end();
|
||||
@@ -2071,7 +2076,7 @@ void ViewProviderMesh::clearSelection()
|
||||
|
||||
void ViewProviderMesh::deleteSelection()
|
||||
{
|
||||
std::vector<unsigned long> indices;
|
||||
std::vector<Mesh::FacetIndex> indices;
|
||||
Mesh::PropertyMeshKernel& meshProp = static_cast<Mesh::Feature*>(pcObject)->Mesh;
|
||||
const Mesh::MeshObject& rMesh = meshProp.getValue();
|
||||
rMesh.getFacetsFromSelection(indices);
|
||||
@@ -2084,7 +2089,6 @@ void ViewProviderMesh::deleteSelection()
|
||||
|
||||
bool ViewProviderMesh::hasSelection() const
|
||||
{
|
||||
std::vector<unsigned long> indices;
|
||||
Mesh::PropertyMeshKernel& meshProp = static_cast<Mesh::Feature*>(pcObject)->Mesh;
|
||||
const Mesh::MeshObject& rMesh = meshProp.getValue();
|
||||
return rMesh.hasSelectedFacets();
|
||||
@@ -2096,7 +2100,7 @@ void ViewProviderMesh::selectArea(short x, short y, short w, short h,
|
||||
{
|
||||
SbViewportRegion vp;
|
||||
vp.setViewportPixels (x, y, w, h);
|
||||
std::vector<unsigned long> faces = getFacetsOfRegion(vp, region, camera);
|
||||
std::vector<Mesh::FacetIndex> faces = getFacetsOfRegion(vp, region, camera);
|
||||
|
||||
const Mesh::MeshObject& rMesh = static_cast<Mesh::Feature*>(pcObject)->Mesh.getValue();
|
||||
rMesh.addFacetsToSelection(faces);
|
||||
@@ -2107,7 +2111,7 @@ void ViewProviderMesh::selectArea(short x, short y, short w, short h,
|
||||
|
||||
void ViewProviderMesh::highlightSelection()
|
||||
{
|
||||
std::vector<unsigned long> selection;
|
||||
std::vector<Mesh::FacetIndex> selection;
|
||||
const Mesh::MeshObject& rMesh = static_cast<Mesh::Feature*>(pcObject)->Mesh.getValue();
|
||||
rMesh.getFacetsFromSelection(selection);
|
||||
if (selection.empty()) {
|
||||
@@ -2125,7 +2129,7 @@ void ViewProviderMesh::highlightSelection()
|
||||
SbColor* cols = pcShapeMaterial->diffuseColor.startEditing();
|
||||
for (int i=0; i<uCtFacets; i++)
|
||||
cols[i].setValue(c.r,c.g,c.b);
|
||||
for (std::vector<unsigned long>::iterator it = selection.begin(); it != selection.end(); ++it)
|
||||
for (std::vector<Mesh::FacetIndex>::iterator it = selection.begin(); it != selection.end(); ++it)
|
||||
cols[*it].setValue(1.0f,0.0f,0.0f);
|
||||
pcShapeMaterial->diffuseColor.finishEditing();
|
||||
}
|
||||
@@ -2153,7 +2157,7 @@ void ViewProviderMesh::setHighlightedComponents(bool on)
|
||||
void ViewProviderMesh::highlightComponents()
|
||||
{
|
||||
const Mesh::MeshObject& rMesh = static_cast<Mesh::Feature*>(pcObject)->Mesh.getValue();
|
||||
std::vector<std::vector<unsigned long> > comps = rMesh.getComponents();
|
||||
std::vector<std::vector<Mesh::FacetIndex> > comps = rMesh.getComponents();
|
||||
|
||||
// Colorize the components
|
||||
pcMatBinding->value = SoMaterialBinding::PER_FACE;
|
||||
@@ -2161,12 +2165,12 @@ void ViewProviderMesh::highlightComponents()
|
||||
pcShapeMaterial->diffuseColor.setNum(uCtFacets);
|
||||
|
||||
SbColor* cols = pcShapeMaterial->diffuseColor.startEditing();
|
||||
for (std::vector<std::vector<unsigned long> >::iterator it = comps.begin(); it != comps.end(); ++it) {
|
||||
for (std::vector<std::vector<Mesh::FacetIndex> >::iterator it = comps.begin(); it != comps.end(); ++it) {
|
||||
float fMax = (float)RAND_MAX;
|
||||
float fRed = (float)rand()/fMax;
|
||||
float fGrn = (float)rand()/fMax;
|
||||
float fBlu = (float)rand()/fMax;
|
||||
for (std::vector<unsigned long>::iterator jt = it->begin(); jt != it->end(); ++jt) {
|
||||
for (std::vector<Mesh::FacetIndex>::iterator jt = it->begin(); jt != it->end(); ++jt) {
|
||||
cols[*jt].setValue(fRed,fGrn,fBlu);
|
||||
}
|
||||
}
|
||||
@@ -2213,11 +2217,11 @@ void ViewProviderMesh::highlightSegments(const std::vector<App::Color>& colors)
|
||||
pcShapeMaterial->diffuseColor.setNum(uCtFacets);
|
||||
SbColor* cols = pcShapeMaterial->diffuseColor.startEditing();
|
||||
for (unsigned long i=0; i<numSegm; i++) {
|
||||
std::vector<unsigned long> segm = rMesh.getSegment(i).getIndices();
|
||||
std::vector<Mesh::FacetIndex> segm = rMesh.getSegment(i).getIndices();
|
||||
float fRed = colors[i].r;
|
||||
float fGrn = colors[i].g;
|
||||
float fBlu = colors[i].b;
|
||||
for (std::vector<unsigned long>::iterator it = segm.begin(); it != segm.end(); ++it) {
|
||||
for (std::vector<Mesh::FacetIndex>::iterator it = segm.begin(); it != segm.end(); ++it) {
|
||||
cols[*it].setValue(fRed,fGrn,fBlu);
|
||||
}
|
||||
}
|
||||
@@ -2311,7 +2315,7 @@ void ViewProviderIndexedFaceSet::showOpenEdges(bool show)
|
||||
const MeshCore::MeshFacetArray& rFaces = rMesh.GetFacets();
|
||||
for (MeshCore::MeshFacetArray::_TConstIterator it = rFaces.begin(); it != rFaces.end(); ++it) {
|
||||
for (int i=0; i<3; i++) {
|
||||
if (it->_aulNeighbours[i] == ULONG_MAX) {
|
||||
if (it->_aulNeighbours[i] == MeshCore::FACET_INDEX_MAX) {
|
||||
lines->coordIndex.set1Value(index++,it->_aulPoints[i]);
|
||||
lines->coordIndex.set1Value(index++,it->_aulPoints[(i+1)%3]);
|
||||
lines->coordIndex.set1Value(index++,SO_END_LINE_INDEX);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <Inventor/fields/SoSFVec2f.h>
|
||||
|
||||
#include <Mod/Mesh/App/Core/Elements.h>
|
||||
#include <Mod/Mesh/App/Types.h>
|
||||
#include <Gui/ViewProviderGeometryObject.h>
|
||||
#include <Gui/ViewProviderBuilder.h>
|
||||
#include <App/PropertyStandard.h>
|
||||
@@ -142,27 +143,28 @@ public:
|
||||
/** @name Editing */
|
||||
//@{
|
||||
bool doubleClicked(void){ return false; }
|
||||
bool isFacetSelected(unsigned long facet);
|
||||
void selectComponent(unsigned long facet);
|
||||
void deselectComponent(unsigned long facet);
|
||||
void selectFacet(unsigned long facet);
|
||||
void deselectFacet(unsigned long facet);
|
||||
void setSelection(const std::vector<unsigned long>&);
|
||||
void addSelection(const std::vector<unsigned long>&);
|
||||
void removeSelection(const std::vector<unsigned long>&);
|
||||
bool isFacetSelected(Mesh::FacetIndex facet);
|
||||
void selectComponent(Mesh::FacetIndex facet);
|
||||
void deselectComponent(Mesh::FacetIndex facet);
|
||||
void selectFacet(Mesh::FacetIndex facet);
|
||||
void deselectFacet(Mesh::FacetIndex facet);
|
||||
void setSelection(const std::vector<Mesh::FacetIndex>&);
|
||||
void addSelection(const std::vector<Mesh::FacetIndex>&);
|
||||
void removeSelection(const std::vector<Mesh::FacetIndex>&);
|
||||
void invertSelection();
|
||||
void clearSelection();
|
||||
void deleteSelection();
|
||||
bool hasSelection() const;
|
||||
void getFacetsFromPolygon(const std::vector<SbVec2f>& picked,
|
||||
const Base::ViewProjMethod& proj, SbBool inner,
|
||||
std::vector<unsigned long>& indices) const;
|
||||
std::vector<unsigned long> getFacetsOfRegion(const SbViewportRegion&, const SbViewportRegion&, SoCamera*) const;
|
||||
std::vector<unsigned long> getVisibleFacetsAfterZoom(const SbBox2s&, const SbViewportRegion&, SoCamera*) const;
|
||||
std::vector<unsigned long> getVisibleFacets(const SbViewportRegion&, SoCamera*) const;
|
||||
std::vector<Mesh::FacetIndex>& indices) const;
|
||||
std::vector<Mesh::FacetIndex> getFacetsOfRegion(const SbViewportRegion&, const SbViewportRegion&, SoCamera*) const;
|
||||
std::vector<Mesh::FacetIndex> getVisibleFacetsAfterZoom(const SbBox2s&, const SbViewportRegion&, SoCamera*) const;
|
||||
std::vector<Mesh::FacetIndex> getVisibleFacets(const SbViewportRegion&, SoCamera*) const;
|
||||
virtual void cutMesh(const std::vector<SbVec2f>& picked, const Base::ViewProjMethod& proj, SbBool inner);
|
||||
virtual void trimMesh(const std::vector<SbVec2f>& picked, const Base::ViewProjMethod& proj, SbBool inner);
|
||||
virtual void removeFacets(const std::vector<unsigned long>&);
|
||||
virtual void appendFacets(const std::vector<Mesh::FacetIndex>&);
|
||||
virtual void removeFacets(const std::vector<Mesh::FacetIndex>&);
|
||||
/*! The size of the array must be equal to the number of facets. */
|
||||
void setFacetTransparency(const std::vector<float>&);
|
||||
void resetFacetTransparency();
|
||||
@@ -180,8 +182,8 @@ protected:
|
||||
void setOpenEdgeColorFrom(const App::Color& col);
|
||||
virtual void splitMesh(const MeshCore::MeshKernel& toolMesh, const Base::Vector3f& normal, SbBool inner);
|
||||
virtual void segmentMesh(const MeshCore::MeshKernel& toolMesh, const Base::Vector3f& normal, SbBool inner);
|
||||
virtual void faceInfo(unsigned long facet);
|
||||
virtual void fillHole(unsigned long facet);
|
||||
virtual void faceInfo(Mesh::FacetIndex facet);
|
||||
virtual void fillHole(Mesh::FacetIndex facet);
|
||||
virtual void selectArea(short, short, short, short, const SbViewportRegion&, SoCamera*);
|
||||
virtual void highlightSelection();
|
||||
virtual void unhighlightSelection();
|
||||
|
||||
@@ -340,7 +340,7 @@ void ViewProviderMeshCurvature::setVertexCurvatureMode(int mode)
|
||||
|
||||
// curvature values
|
||||
std::vector<float> fValues = pCurvInfo->getCurvature( mode );
|
||||
unsigned long j=0;
|
||||
int j=0;
|
||||
for ( std::vector<float>::const_iterator jt = fValues.begin(); jt != fValues.end(); ++jt, j++ ) {
|
||||
App::Color col = pcColorBar->getColor( *jt );
|
||||
pcColorMat->diffuseColor.set1Value(j, SbColor(col.r, col.g, col.b));
|
||||
|
||||
@@ -149,7 +149,7 @@ void ViewProviderMeshOrientation::attach(App::DocumentObject* pcFeat)
|
||||
addDisplayMaskMode(pcFaceRoot, "Face");
|
||||
}
|
||||
|
||||
void ViewProviderMeshOrientation::showDefects(const std::vector<unsigned long>& inds)
|
||||
void ViewProviderMeshOrientation::showDefects(const std::vector<Mesh::ElementIndex>& inds)
|
||||
{
|
||||
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||
@@ -157,9 +157,9 @@ void ViewProviderMeshOrientation::showDefects(const std::vector<unsigned long>&
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(3*inds.size());
|
||||
MeshCore::MeshFacetIterator cF(rMesh);
|
||||
unsigned long i=0;
|
||||
unsigned long j=0;
|
||||
for (std::vector<unsigned long>::const_iterator it = inds.begin(); it != inds.end(); ++it) {
|
||||
int i=0;
|
||||
int j=0;
|
||||
for (std::vector<Mesh::ElementIndex>::const_iterator it = inds.begin(); it != inds.end(); ++it) {
|
||||
cF.Set(*it);
|
||||
for (int k=0; k<3; k++) {
|
||||
Base::Vector3f cP = cF->_aclPoints[k];
|
||||
@@ -214,7 +214,7 @@ void ViewProviderMeshNonManifolds::attach(App::DocumentObject* pcFeat)
|
||||
addDisplayMaskMode(pcLineRoot, "Line");
|
||||
}
|
||||
|
||||
void ViewProviderMeshNonManifolds::showDefects(const std::vector<unsigned long>& inds)
|
||||
void ViewProviderMeshNonManifolds::showDefects(const std::vector<Mesh::ElementIndex>& inds)
|
||||
{
|
||||
if ((inds.size() % 2) != 0)
|
||||
return;
|
||||
@@ -224,9 +224,9 @@ void ViewProviderMeshNonManifolds::showDefects(const std::vector<unsigned long>&
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(inds.size());
|
||||
MeshCore::MeshPointIterator cP(rMesh);
|
||||
unsigned long i=0;
|
||||
unsigned long j=0;
|
||||
for (std::vector<unsigned long>::const_iterator it = inds.begin(); it != inds.end(); ++it) {
|
||||
int i=0;
|
||||
int j=0;
|
||||
for (std::vector<Mesh::ElementIndex>::const_iterator it = inds.begin(); it != inds.end(); ++it) {
|
||||
cP.Set(*it);
|
||||
pcCoords->point.set1Value(i++,cP->x,cP->y,cP->z);
|
||||
++it; // go to end point
|
||||
@@ -279,15 +279,15 @@ void ViewProviderMeshNonManifoldPoints::attach(App::DocumentObject* pcFeat)
|
||||
addDisplayMaskMode(pcPointRoot, "Point");
|
||||
}
|
||||
|
||||
void ViewProviderMeshNonManifoldPoints::showDefects(const std::vector<unsigned long>& inds)
|
||||
void ViewProviderMeshNonManifoldPoints::showDefects(const std::vector<Mesh::ElementIndex>& inds)
|
||||
{
|
||||
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(inds.size());
|
||||
MeshCore::MeshPointIterator cP(rMesh);
|
||||
unsigned long i = 0;
|
||||
for ( std::vector<unsigned long>::const_iterator it = inds.begin(); it != inds.end(); ++it ) {
|
||||
int i = 0;
|
||||
for ( std::vector<Mesh::ElementIndex>::const_iterator it = inds.begin(); it != inds.end(); ++it ) {
|
||||
cP.Set(*it);
|
||||
pcCoords->point.set1Value(i++,cP->x,cP->y,cP->z);
|
||||
}
|
||||
@@ -343,7 +343,7 @@ void ViewProviderMeshDuplicatedFaces::attach(App::DocumentObject* pcFeat)
|
||||
addDisplayMaskMode(pcFaceRoot, "Face");
|
||||
}
|
||||
|
||||
void ViewProviderMeshDuplicatedFaces::showDefects(const std::vector<unsigned long>& inds)
|
||||
void ViewProviderMeshDuplicatedFaces::showDefects(const std::vector<Mesh::ElementIndex>& inds)
|
||||
{
|
||||
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||
@@ -351,9 +351,9 @@ void ViewProviderMeshDuplicatedFaces::showDefects(const std::vector<unsigned lon
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(3*inds.size());
|
||||
MeshCore::MeshFacetIterator cF(rMesh);
|
||||
unsigned long i=0;
|
||||
unsigned long j=0;
|
||||
for (std::vector<unsigned long>::const_iterator it = inds.begin(); it != inds.end(); ++it) {
|
||||
int i=0;
|
||||
int j=0;
|
||||
for (std::vector<Mesh::ElementIndex>::const_iterator it = inds.begin(); it != inds.end(); ++it) {
|
||||
cF.Set(*it);
|
||||
for (int k=0; k<3; k++) {
|
||||
Base::Vector3f cP = cF->_aclPoints[k];
|
||||
@@ -408,15 +408,15 @@ void ViewProviderMeshDuplicatedPoints::attach(App::DocumentObject* pcFeat)
|
||||
addDisplayMaskMode(pcPointRoot, "Point");
|
||||
}
|
||||
|
||||
void ViewProviderMeshDuplicatedPoints::showDefects(const std::vector<unsigned long>& inds)
|
||||
void ViewProviderMeshDuplicatedPoints::showDefects(const std::vector<Mesh::ElementIndex>& inds)
|
||||
{
|
||||
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(inds.size());
|
||||
MeshCore::MeshPointIterator cP(rMesh);
|
||||
unsigned long i = 0;
|
||||
for ( std::vector<unsigned long>::const_iterator it = inds.begin(); it != inds.end(); ++it ) {
|
||||
int i = 0;
|
||||
for ( std::vector<Mesh::ElementIndex>::const_iterator it = inds.begin(); it != inds.end(); ++it ) {
|
||||
cP.Set(*it);
|
||||
pcCoords->point.set1Value(i++,cP->x,cP->y,cP->z);
|
||||
}
|
||||
@@ -465,7 +465,7 @@ void ViewProviderMeshDegenerations::attach(App::DocumentObject* pcFeat)
|
||||
addDisplayMaskMode(pcLineRoot, "Line");
|
||||
}
|
||||
|
||||
void ViewProviderMeshDegenerations::showDefects(const std::vector<unsigned long>& inds)
|
||||
void ViewProviderMeshDegenerations::showDefects(const std::vector<Mesh::ElementIndex>& inds)
|
||||
{
|
||||
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||
@@ -473,9 +473,9 @@ void ViewProviderMeshDegenerations::showDefects(const std::vector<unsigned long>
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(2*inds.size());
|
||||
MeshCore::MeshFacetIterator cF(rMesh);
|
||||
unsigned long i=0;
|
||||
unsigned long j=0;
|
||||
for (std::vector<unsigned long>::const_iterator it = inds.begin(); it != inds.end(); ++it) {
|
||||
int i=0;
|
||||
int j=0;
|
||||
for (std::vector<Mesh::ElementIndex>::const_iterator it = inds.begin(); it != inds.end(); ++it) {
|
||||
cF.Set(*it);
|
||||
const MeshCore::MeshPoint& rE0 = cF->_aclPoints[0];
|
||||
const MeshCore::MeshPoint& rE1 = cF->_aclPoints[1];
|
||||
@@ -571,7 +571,7 @@ void ViewProviderMeshIndices::attach(App::DocumentObject* pcFeat)
|
||||
addDisplayMaskMode(pcFaceRoot, "Face");
|
||||
}
|
||||
|
||||
void ViewProviderMeshIndices::showDefects(const std::vector<unsigned long>& inds)
|
||||
void ViewProviderMeshIndices::showDefects(const std::vector<Mesh::ElementIndex>& inds)
|
||||
{
|
||||
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||
@@ -580,9 +580,9 @@ void ViewProviderMeshIndices::showDefects(const std::vector<unsigned long>& inds
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(3*inds.size());
|
||||
MeshCore::MeshFacetIterator cF(rMesh);
|
||||
unsigned long i=0;
|
||||
unsigned long j=0;
|
||||
for (std::vector<unsigned long>::const_iterator it = inds.begin(); it != inds.end(); ++it) {
|
||||
int i=0;
|
||||
int j=0;
|
||||
for (std::vector<Mesh::ElementIndex>::const_iterator it = inds.begin(); it != inds.end(); ++it) {
|
||||
cF.Set(*it);
|
||||
for (int k=0; k<3; k++) {
|
||||
Base::Vector3f cP = cF->_aclPoints[k];
|
||||
@@ -638,7 +638,7 @@ void ViewProviderMeshSelfIntersections::attach(App::DocumentObject* pcFeat)
|
||||
addDisplayMaskMode(pcLineRoot, "Line");
|
||||
}
|
||||
|
||||
void ViewProviderMeshSelfIntersections::showDefects(const std::vector<unsigned long>& indices)
|
||||
void ViewProviderMeshSelfIntersections::showDefects(const std::vector<Mesh::ElementIndex>& indices)
|
||||
{
|
||||
if (indices.size() % 2 != 0)
|
||||
return;
|
||||
@@ -646,12 +646,12 @@ void ViewProviderMeshSelfIntersections::showDefects(const std::vector<unsigned l
|
||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||
MeshCore::MeshEvalSelfIntersection eval(rMesh);
|
||||
|
||||
std::vector<std::pair<unsigned long, unsigned long> > intersection;
|
||||
std::vector<unsigned long>::const_iterator it;
|
||||
std::vector<std::pair<Mesh::ElementIndex, Mesh::ElementIndex> > intersection;
|
||||
std::vector<Mesh::ElementIndex>::const_iterator it;
|
||||
for (it = indices.begin(); it != indices.end(); ) {
|
||||
unsigned long id1 = *it; ++it;
|
||||
unsigned long id2 = *it; ++it;
|
||||
intersection.emplace_back(id1,id2);
|
||||
Mesh::ElementIndex id1 = *it; ++it;
|
||||
Mesh::ElementIndex id2 = *it; ++it;
|
||||
intersection.push_back(std::make_pair(id1,id2));
|
||||
}
|
||||
|
||||
std::vector<std::pair<Base::Vector3f, Base::Vector3f> > lines;
|
||||
@@ -659,8 +659,8 @@ void ViewProviderMeshSelfIntersections::showDefects(const std::vector<unsigned l
|
||||
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(2*lines.size());
|
||||
unsigned long i=0;
|
||||
unsigned long j=0;
|
||||
int i=0;
|
||||
int j=0;
|
||||
for (std::vector<std::pair<Base::Vector3f, Base::Vector3f> >::const_iterator it = lines.begin(); it != lines.end(); ++it) {
|
||||
pcCoords->point.set1Value(i++,it->first.x,it->first.y,it->first.z);
|
||||
pcCoords->point.set1Value(i++,it->second.x,it->second.y,it->second.z);
|
||||
@@ -718,7 +718,7 @@ void ViewProviderMeshFolds::attach(App::DocumentObject* pcFeat)
|
||||
addDisplayMaskMode(pcFaceRoot, "Face");
|
||||
}
|
||||
|
||||
void ViewProviderMeshFolds::showDefects(const std::vector<unsigned long>& inds)
|
||||
void ViewProviderMeshFolds::showDefects(const std::vector<Mesh::ElementIndex>& inds)
|
||||
{
|
||||
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||
@@ -726,9 +726,9 @@ void ViewProviderMeshFolds::showDefects(const std::vector<unsigned long>& inds)
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(3*inds.size());
|
||||
MeshCore::MeshFacetIterator cF(rMesh);
|
||||
unsigned long i=0;
|
||||
unsigned long j=0;
|
||||
for (std::vector<unsigned long>::const_iterator it = inds.begin(); it != inds.end(); ++it) {
|
||||
int i=0;
|
||||
int j=0;
|
||||
for (std::vector<Mesh::ElementIndex>::const_iterator it = inds.begin(); it != inds.end(); ++it) {
|
||||
cF.Set(*it);
|
||||
for (int k=0; k<3; k++) {
|
||||
Base::Vector3f cP = cF->_aclPoints[k];
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
// Build up the initial Inventor node
|
||||
virtual void attach(App::DocumentObject* pcFeature) = 0;
|
||||
/// Fill up the Inventor node with data
|
||||
virtual void showDefects(const std::vector<unsigned long>&) = 0;
|
||||
virtual void showDefects(const std::vector<Mesh::ElementIndex>&) = 0;
|
||||
|
||||
protected:
|
||||
/// get called by the container whenever a property has been changed
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
virtual ~ViewProviderMeshOrientation();
|
||||
|
||||
void attach(App::DocumentObject* pcFeature);
|
||||
void showDefects(const std::vector<unsigned long>&);
|
||||
void showDefects(const std::vector<Mesh::ElementIndex>&);
|
||||
|
||||
protected:
|
||||
SoFaceSet* pcFaces;
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
virtual ~ViewProviderMeshNonManifolds();
|
||||
|
||||
void attach(App::DocumentObject* pcFeature);
|
||||
void showDefects(const std::vector<unsigned long>&);
|
||||
void showDefects(const std::vector<Mesh::ElementIndex>&);
|
||||
|
||||
protected:
|
||||
SoLineSet* pcLines;
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
virtual ~ViewProviderMeshNonManifoldPoints();
|
||||
|
||||
void attach(App::DocumentObject* pcFeature);
|
||||
void showDefects(const std::vector<unsigned long>&);
|
||||
void showDefects(const std::vector<Mesh::ElementIndex>&);
|
||||
|
||||
protected:
|
||||
SoPointSet* pcPoints;
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
virtual ~ViewProviderMeshDuplicatedFaces();
|
||||
|
||||
void attach(App::DocumentObject* pcFeature);
|
||||
void showDefects(const std::vector<unsigned long>&);
|
||||
void showDefects(const std::vector<Mesh::ElementIndex>&);
|
||||
|
||||
protected:
|
||||
SoFaceSet* pcFaces;
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
virtual ~ViewProviderMeshDegenerations();
|
||||
|
||||
void attach(App::DocumentObject* pcFeature);
|
||||
void showDefects(const std::vector<unsigned long>&);
|
||||
void showDefects(const std::vector<Mesh::ElementIndex>&);
|
||||
|
||||
protected:
|
||||
SoLineSet* pcLines;
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
virtual ~ViewProviderMeshDuplicatedPoints();
|
||||
|
||||
void attach(App::DocumentObject* pcFeature);
|
||||
void showDefects(const std::vector<unsigned long>&);
|
||||
void showDefects(const std::vector<Mesh::ElementIndex>&);
|
||||
|
||||
protected:
|
||||
SoPointSet* pcPoints;
|
||||
@@ -174,7 +174,7 @@ public:
|
||||
virtual ~ViewProviderMeshIndices();
|
||||
|
||||
void attach(App::DocumentObject* pcFeature);
|
||||
void showDefects(const std::vector<unsigned long>&);
|
||||
void showDefects(const std::vector<Mesh::ElementIndex>&);
|
||||
|
||||
protected:
|
||||
SoFaceSet* pcFaces;
|
||||
@@ -192,7 +192,7 @@ public:
|
||||
virtual ~ViewProviderMeshSelfIntersections();
|
||||
|
||||
void attach(App::DocumentObject* pcFeature);
|
||||
void showDefects(const std::vector<unsigned long>&);
|
||||
void showDefects(const std::vector<Mesh::ElementIndex>&);
|
||||
|
||||
protected:
|
||||
SoLineSet* pcLines;
|
||||
@@ -207,7 +207,7 @@ public:
|
||||
virtual ~ViewProviderMeshFolds();
|
||||
|
||||
void attach(App::DocumentObject* pcFeature);
|
||||
void showDefects(const std::vector<unsigned long>&);
|
||||
void showDefects(const std::vector<Mesh::ElementIndex>&);
|
||||
|
||||
protected:
|
||||
SoFaceSet* pcFaces;
|
||||
|
||||
@@ -167,7 +167,7 @@ void ViewProviderMeshFaceSet::updateData(const App::Property* prop)
|
||||
}
|
||||
|
||||
showOpenEdges(OpenEdges.getValue());
|
||||
std::vector<unsigned long> selection;
|
||||
std::vector<Mesh::FacetIndex> selection;
|
||||
mesh->getFacetsFromSelection(selection);
|
||||
if (selection.empty())
|
||||
unhighlightSelection();
|
||||
@@ -181,7 +181,7 @@ void ViewProviderMeshFaceSet::showOpenEdges(bool show)
|
||||
if (pcOpenEdge) {
|
||||
// remove the node and destroy the data
|
||||
pcRoot->removeChild(pcOpenEdge);
|
||||
pcOpenEdge = 0;
|
||||
pcOpenEdge = nullptr;
|
||||
}
|
||||
|
||||
if (show) {
|
||||
@@ -204,7 +204,7 @@ void ViewProviderMeshFaceSet::showOpenEdges(bool show)
|
||||
const MeshCore::MeshFacetArray& rFaces = rMesh.GetFacets();
|
||||
for (MeshCore::MeshFacetArray::_TConstIterator it = rFaces.begin(); it != rFaces.end(); ++it) {
|
||||
for (int i=0; i<3; i++) {
|
||||
if (it->_aulNeighbours[i] == ULONG_MAX) {
|
||||
if (it->_aulNeighbours[i] == MeshCore::FACET_INDEX_MAX) {
|
||||
lines->coordIndex.set1Value(index++,it->_aulPoints[i]);
|
||||
lines->coordIndex.set1Value(index++,it->_aulPoints[(i+1)%3]);
|
||||
lines->coordIndex.set1Value(index++,SO_END_LINE_INDEX);
|
||||
|
||||
@@ -51,11 +51,11 @@ PyObject* ViewProviderMeshPy::setSelection(PyObject *args)
|
||||
return 0;
|
||||
|
||||
Py::Sequence list(obj);
|
||||
std::vector<unsigned long> selection;
|
||||
std::vector<Mesh::FacetIndex> selection;
|
||||
selection.reserve(list.size());
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
Py::Long index(*it);
|
||||
unsigned long value = static_cast<unsigned long>(index);
|
||||
Mesh::FacetIndex value = static_cast<Mesh::FacetIndex>(index);
|
||||
selection.push_back(value);
|
||||
}
|
||||
|
||||
@@ -71,11 +71,11 @@ PyObject* ViewProviderMeshPy::addSelection(PyObject *args)
|
||||
return 0;
|
||||
|
||||
Py::Sequence list(obj);
|
||||
std::vector<unsigned long> selection;
|
||||
std::vector<Mesh::FacetIndex> selection;
|
||||
selection.reserve(list.size());
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
Py::Long index(*it);
|
||||
unsigned long value = static_cast<unsigned long>(index);
|
||||
Mesh::FacetIndex value = static_cast<Mesh::FacetIndex>(index);
|
||||
selection.push_back(value);
|
||||
}
|
||||
|
||||
@@ -91,11 +91,11 @@ PyObject* ViewProviderMeshPy::removeSelection(PyObject *args)
|
||||
return 0;
|
||||
|
||||
Py::Sequence list(obj);
|
||||
std::vector<unsigned long> selection;
|
||||
std::vector<Mesh::FacetIndex> selection;
|
||||
selection.reserve(list.size());
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
Py::Long index(*it);
|
||||
unsigned long value = static_cast<unsigned long>(index);
|
||||
Mesh::FacetIndex value = static_cast<Mesh::FacetIndex>(index);
|
||||
selection.push_back(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ void ViewProviderMeshTransformDemolding::calcMaterialIndex(const SbRotation &rot
|
||||
// 3.1415926535897932384626433832795
|
||||
SbVec3f Up(0,0,1),result;
|
||||
|
||||
unsigned long i=0;
|
||||
int i=0;
|
||||
for( std::vector<SbVec3f>::const_iterator it=normalVector.begin();it != normalVector.end(); ++it,i++)
|
||||
{
|
||||
rot.multVec(*it,result);
|
||||
|
||||
Reference in New Issue
Block a user