#ifndef __PMIViewerApplication_HeaderFile
#define __PMIViewerApplication_HeaderFile
#include "../baseviewer/BaseViewerApplication.hxx"
class PMIViewerApplication : public BaseViewerApplication
{
Q_OBJECT
public:
PMIViewerApplication();
void CreateSceneNodes() override;
};
#endif
#define __CADEX_PREVIEW_PMI 1
#include "PMIViewerApplication.hxx"
#include <cadex/ModelData_Appearance.hxx>
#include <cadex/ModelData_Color.hxx>
#include <cadex/ModelData_Instance.hxx>
#include <cadex/ModelData_PMIData.hxx>
#include <cadex/ModelData_PMIGraphicalElement.hxx>
#include <cadex/ModelData_PMITable.hxx>
#include <cadex/ModelPrs_SceneNodeFactory.hxx>
#include <deque>
#include <iostream>
namespace {
{
public:
myFactory (theFactory)
{
myNodes.push_back (theRoot);
}
{
myNodes.pop_back();
}
{
auto anSGENode = myFactory.CreateNode (theSGE);
myNodes.back().AddChildNode (anSGENode);
myNodes.push_back (anSGENode);
AddPMINodes (theSGE);
return true;
}
{
auto aPartNode = myFactory.CreateNode (thePart);
myNodes.back().AddChildNode (aPartNode);
AddPMINodes (thePart);
auto aRepNode = myFactory.CreateNode (aRep);
aPartNode.AddChildNode (aRepNode);
}
{
auto anElement = anIt.Next();
if (anElement) {
auto aPMINode = myFactory.CreateNode (anElement.GraphicalElement());
}
}
myNodes.back().AddChildNode (aPMIRootNode);
}
private:
std::deque<ModelPrs_SceneNode> myNodes;
};
}
PMIViewerApplication::PMIViewerApplication()
{
myReaderParameters.ReadPMI() = true;
}
void PMIViewerApplication::CreateSceneNodes()
{
ModelVisitor aVisitor (myRoot, aFactory);
myModel.Accept (aVisitor);
}
Provides an interface to appearance which is a collection of visual styles.
Definition: ModelData_Appearance.hxx:39
Defines an RGBA color (with alpha channel).
Definition: ModelData_Color.hxx:34
Provides combined methods VisitEnter() and VisitLeave() to visit all elements.
Definition: ModelData_Model.hxx:123
Iterator over added PMIData items, which contains graphical and semantical elements.
Definition: ModelData_PMITable.hxx:81
Defines a leaf node in the scene graph hiearchy.
Definition: ModelData_Part.hxx:35
ModelData_BRepRepresentation BRepRepresentation() const
Definition: ModelData_Part.cxx:360
Base class for part, instance and assembly.
Definition: ModelData_SceneGraphElement.hxx:39
ModelData_PMITable PMI() const
Returns a PMI table.
Definition: ModelData_SceneGraphElement.cxx:255
Creates a scene nodes and its children from input data model objects.
Definition: ModelPrs_SceneNodeFactory.hxx:53
Represents a node in the visual scene graph.
Definition: ModelPrs_SceneNode.hxx:44
bool AddChildNode(ModelPrs_SceneNode &theNode)
Adds theNode to children. Returns false if the node already has a parent, otherwise returns true.
Definition: ModelPrs_SceneNode.cxx:787
void SetAppearance(const ModelData_Appearance &theAppearance)
Definition: ModelPrs_SceneNode.cxx:894
Defines classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22
#include "PMIViewerApplication.hxx"
#include <cadex/LicenseManager_Activate.h>
#include <QtCore/QUrl>
#include <QtWidgets/QApplication>
#include "../../../cadex_license.cxx"
int main (int argc, char *argv[])
{
auto aKey = LicenseKey::Value();
if (!CADExLicense_Activate (aKey)) {
qCritical ("Failed to activate CAD Exchanger license.");
return 1;
}
QCoreApplication::setAttribute (Qt::AA_EnableHighDpiScaling);
QApplication app (argc, argv);
PMIViewerApplication anApp;
if (anApp.Initialize (QUrl ("qrc:/qml/BaseViewerWindow.qml"), "viewPort")) {
return app.exec();
}
return 0;
}