Files
create/src/Mod/Part/Gui/SoBrepEdgeSet.h
2023-08-23 00:55:03 +02:00

83 lines
3.2 KiB
C++

/***************************************************************************
* Copyright (c) 2011 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef PARTGUI_SOBREPEDGESET_H
#define PARTGUI_SOBREPEDGESET_H
#include <Inventor/nodes/SoIndexedLineSet.h>
#include <memory>
#include <vector>
#include <Gui/SoFCSelectionContext.h>
#include <Mod/Part/PartGlobal.h>
class SoCoordinateElement;
class SoGLCoordinateElement;
class SoTextureCoordinateBundle;
namespace PartGui {
class PartGuiExport SoBrepEdgeSet : public SoIndexedLineSet {
using inherited = SoIndexedLineSet;
SO_NODE_HEADER(SoBrepEdgeSet);
public:
static void initClass();
SoBrepEdgeSet();
protected:
~SoBrepEdgeSet() override = default;
void GLRender(SoGLRenderAction *action) override;
void GLRenderBelowPath(SoGLRenderAction * action) override;
void doAction(SoAction* action) override;
SoDetail * createLineSegmentDetail(
SoRayPickAction *action,
const SoPrimitiveVertex *v1,
const SoPrimitiveVertex *v2,
SoPickedPoint *pp) override;
void getBoundingBox(SoGetBoundingBoxAction * action) override;
private:
struct SelContext;
using SelContextPtr = std::shared_ptr<SelContext>;
void renderShape(const SoGLCoordinateElement * const vertexlist,
const int32_t *vertexindices, int num_vertexindices);
void renderHighlight(SoGLRenderAction *action, SelContextPtr);
void renderSelection(SoGLRenderAction *action, SelContextPtr, bool push=true);
bool validIndexes(const SoCoordinateElement*, const std::vector<int32_t>&) const;
private:
SelContextPtr selContext;
SelContextPtr selContext2;
Gui::SoFCSelectionCounter selCounter;
uint32_t packedColor{0};
};
} // namespace PartGui
#endif // PARTGUI_SOBREPEDGESET_H