Enhance API of mesh selection
This commit is contained in:
parent
b51fcb4470
commit
8f9a9b71a2
|
@ -1794,6 +1794,16 @@ MeshRefPointToFacets::operator[] (unsigned long pos) const
|
|||
return _map[pos];
|
||||
}
|
||||
|
||||
void MeshRefPointToFacets::AddNeighbour(unsigned long pos, unsigned long facet)
|
||||
{
|
||||
_map[pos].insert(facet);
|
||||
}
|
||||
|
||||
void MeshRefPointToFacets::RemoveNeighbour(unsigned long pos, unsigned long facet)
|
||||
{
|
||||
_map[pos].erase(facet);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void MeshRefFacetToFacets::Rebuild (void)
|
||||
|
@ -1881,6 +1891,16 @@ MeshRefPointToPoints::operator[] (unsigned long pos) const
|
|||
return _map[pos];
|
||||
}
|
||||
|
||||
void MeshRefPointToPoints::AddNeighbour(unsigned long pos, unsigned long facet)
|
||||
{
|
||||
_map[pos].insert(facet);
|
||||
}
|
||||
|
||||
void MeshRefPointToPoints::RemoveNeighbour(unsigned long pos, unsigned long facet)
|
||||
{
|
||||
_map[pos].erase(facet);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void MeshRefEdgeToFacets::Rebuild (void)
|
||||
|
|
|
@ -374,6 +374,8 @@ public:
|
|||
std::set<unsigned long> NeighbourPoints(const std::vector<unsigned long>& , int level) const;
|
||||
void Neighbours (unsigned long ulFacetInd, float fMaxDist, MeshCollector& collect) const;
|
||||
Base::Vector3f GetNormal(unsigned long) const;
|
||||
void AddNeighbour(unsigned long, unsigned long);
|
||||
void RemoveNeighbour(unsigned long, unsigned long);
|
||||
|
||||
protected:
|
||||
void SearchNeighbours(const MeshFacetArray& rFacets, unsigned long index, const Base::Vector3f &rclCenter,
|
||||
|
@ -432,6 +434,8 @@ public:
|
|||
const std::set<unsigned long>& operator[] (unsigned long) const;
|
||||
Base::Vector3f GetNormal(unsigned long) const;
|
||||
float GetAverageEdgeLength(unsigned long) const;
|
||||
void AddNeighbour(unsigned long, unsigned long);
|
||||
void RemoveNeighbour(unsigned long, unsigned long);
|
||||
|
||||
protected:
|
||||
const MeshKernel &_rclMesh; /**< The mesh kernel. */
|
||||
|
|
|
@ -162,13 +162,13 @@ void MeshSelection::stopInteractiveCallback(Gui::View3DInventorViewer* viewer)
|
|||
}
|
||||
}
|
||||
|
||||
void MeshSelection::prepareBrushSelection(bool add)
|
||||
void MeshSelection::prepareBrushSelection(bool add,SoEventCallbackCB *cb)
|
||||
{
|
||||
// a rubberband to select a rectangle area of the meshes
|
||||
Gui::View3DInventorViewer* viewer = this->getViewer();
|
||||
if (viewer) {
|
||||
stopInteractiveCallback(viewer);
|
||||
startInteractiveCallback(viewer, selectGLCallback);
|
||||
startInteractiveCallback(viewer, cb);
|
||||
// set cross cursor
|
||||
Gui::BrushSelection* brush = new Gui::BrushSelection();
|
||||
brush->setColor(1.0f,0.0f,0.0f);
|
||||
|
@ -186,12 +186,19 @@ void MeshSelection::prepareBrushSelection(bool add)
|
|||
|
||||
void MeshSelection::startSelection()
|
||||
{
|
||||
prepareBrushSelection(true);
|
||||
prepareBrushSelection(true, selectGLCallback);
|
||||
}
|
||||
|
||||
void MeshSelection::startDeselection()
|
||||
{
|
||||
prepareBrushSelection(false);
|
||||
prepareBrushSelection(false, selectGLCallback);
|
||||
}
|
||||
|
||||
void MeshSelection::stopSelection()
|
||||
{
|
||||
Gui::View3DInventorViewer* viewer = getViewer();
|
||||
if (viewer)
|
||||
stopInteractiveCallback(viewer);
|
||||
}
|
||||
|
||||
void MeshSelection::fullSelection()
|
||||
|
@ -332,11 +339,21 @@ void MeshSelection::setCheckOnlyPointToUserTriangles(bool on)
|
|||
onlyPointToUserTriangles = on;
|
||||
}
|
||||
|
||||
bool MeshSelection::isCheckedOnlyPointToUserTriangles() const
|
||||
{
|
||||
return onlyPointToUserTriangles;
|
||||
}
|
||||
|
||||
void MeshSelection::setCheckOnlyVisibleTriangles(bool on)
|
||||
{
|
||||
onlyVisibleTriangles = on;
|
||||
}
|
||||
|
||||
bool MeshSelection::isCheckedOnlyVisibleTriangles() const
|
||||
{
|
||||
return onlyVisibleTriangles;
|
||||
}
|
||||
|
||||
void MeshSelection::setAddComponentOnClick(bool on)
|
||||
{
|
||||
addComponent = on;
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
|
||||
void startSelection();
|
||||
void startDeselection();
|
||||
void stopSelection();
|
||||
bool deleteSelection();
|
||||
void fullSelection();
|
||||
void clearSelection();
|
||||
|
@ -58,18 +59,22 @@ public:
|
|||
void deselectTriangle();
|
||||
|
||||
void setCheckOnlyPointToUserTriangles(bool);
|
||||
bool isCheckedOnlyPointToUserTriangles() const;
|
||||
void setCheckOnlyVisibleTriangles(bool);
|
||||
bool isCheckedOnlyVisibleTriangles() const;
|
||||
void setAddComponentOnClick(bool);
|
||||
void setRemoveComponentOnClick(bool);
|
||||
void setObjects(const std::vector<Gui::SelectionObject>&);
|
||||
std::vector<App::DocumentObject*> getObjects() const;
|
||||
|
||||
private:
|
||||
protected:
|
||||
std::list<ViewProviderMesh*> getViewProviders() const;
|
||||
Gui::View3DInventorViewer* getViewer() const;
|
||||
void prepareBrushSelection(bool,SoEventCallbackCB *cb);
|
||||
void startInteractiveCallback(Gui::View3DInventorViewer* viewer,SoEventCallbackCB *cb);
|
||||
void stopInteractiveCallback(Gui::View3DInventorViewer* viewer);
|
||||
void prepareBrushSelection(bool);
|
||||
|
||||
private:
|
||||
|
||||
static void selectGLCallback(void * ud, SoEventCallback * n);
|
||||
static void pickFaceCallback(void * ud, SoEventCallback * n);
|
||||
|
|
|
@ -1596,11 +1596,7 @@ void ViewProviderMesh::deleteSelection()
|
|||
if (!indices.empty()) {
|
||||
rMesh.clearFacetSelection();
|
||||
unhighlightSelection();
|
||||
|
||||
Mesh::MeshObject* pMesh = meshProp.startEditing();
|
||||
pMesh->deleteFacets(indices);
|
||||
meshProp.finishEditing();
|
||||
pcObject->purgeTouched();
|
||||
removeFacets(indices);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user