#include "Mainwindow.h"
Mainwindow::Mainwindow(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
mRender = mRenderComponent->CreateBasicRender();
ui.gridLayout->addWidget(mRender->widget);
{0.0, 0.0, 0.0}, {10.0, 0.0, 0.0}, {10.0, 10.0, 0.0}, {0.0, 10.0, 0.0},
{0.0, 0.0, 10.0}, {10.0, 0.0, 10.0}, {10.0, 10.0, 10.0}, {0.0, 10.0, 10.0},
{0.0, 0.0, 0.0}, {10.0, 0.0, 0.0}, {10.0, 0.0, 10.0}, {0.0, 0.0, 10.0},
{10.0, 10.0, 0.0}, {0.0, 10.0, 0.0}, {0.0, 10.0, 10.0}, {10.0, 10.0, 10.0},
{0.0, 0.0, 0.0}, {0.0, 10.0, 0.0}, {0.0, 10.0, 10.0}, {0.0, 0.0, 10.0},
{10.0, 0.0, 0.0}, {10.0, 10.0, 0.0}, {10.0, 10.0, 10.0}, {10.0, 0.0, 10.0}
};
{0.0, 0.0, -1.0}, {0.0, 0.0, -1.0}, {0.0, 0.0, -1.0}, {0.0, 0.0, -1.0},
{0.0, 0.0, 1.0}, {0.0, 0.0, 1.0}, {0.0, 0.0, 1.0}, {0.0, 0.0, 1.0},
{0.0, -1.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, -1.0, 0.0},
{0.0, 1.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 1.0, 0.0},
{-1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0},
{1.0, 0.0, 0.0}, {1.0, 0.0, 0.0}, {1.0, 0.0, 0.0}, {1.0, 0.0, 0.0}
};
{{{0, 2, 1}, {0, 3, 2}}, {0, 1, 2, 3}, 4, {{0.0, 0.0, -1.0}}, {}},
{{{4, 5, 6}, {4, 6, 7}}, {4, 5, 6, 7}, 4, {{0.0, 0.0, 1.0}}, {}},
{{{8, 9, 10}, {8, 10, 11}}, {8, 9, 10, 11}, 4, {{0.0, -1.0, 0.0}}, {}},
{{{12, 13, 14}, {12, 14, 15}}, {12, 13, 14, 15}, 4, {{0.0, 1.0, 0.0}}, {}},
{{{16, 18, 17}, {16, 19, 18}}, {16, 17, 18, 19}, 4, {{-1.0, 0.0, 0.0}}, {}},
{{{20, 21, 22}, {20, 22, 23}}, {20, 21, 22, 23}, 4, {{1.0, 0.0, 0.0}}, {}}
};
auto entity = mRender->entityFactory->FromCAXMeshInfo(cube);
std::vector<double> scalars;
std::map<double, std::vector<double>> colorMap;
colorMap.emplace(0, std::vector<double>{ 0, 0, 0 });
colorMap.emplace(1, std::vector<double>{ 1, 0, 0 });
colorMap.emplace(2, std::vector<double>{ 1, 1, 0 });
colorMap.emplace(3, std::vector<double>{ 1, 1, 1 });
colorMap.emplace(4, std::vector<double>{ 0, 1, 1 });
colorMap.emplace(5, std::vector<double>{ 0, 0, 1 });
for (auto i = 0; i < 6; i++) {
scalars.push_back(i);
}
double matrix[4][4] = {
1,0,0,-25,
0,1,0,0,
0,0,1,0,
0,0,0,1,
};
auto pId = mRender->pluginManage->AddPluginFromMeshEntity(entity);
att->
SetColorMap(colorMap, scalars, AMCAXRender::ColorMapType::rampToStep);
att->SetOpacity(1);
att->SetLineWidth(2);
att->SetMatrix(*matrix);
mRender->pluginManage->SetProperty(pId, att);
double c[3] = { 1,0,1 };
mRender->pluginManage->SetHightLightColor(c);
mRender->pluginManage->ClearHightLight(entityId);
mRender->pluginManage->AddHightLight(entityId, type, subIndex);
}
);
double pos[] = { 0.9,0.1,0.1,0.8 };
std::vector<std::vector<double>> colorList;
colorList.push_back(std::vector<double>{ 0, 0, 0 });
colorList.push_back(std::vector<double>{ 1, 0, 0 });
colorList.push_back(std::vector<double>{ 1, 1, 0 });
colorList.push_back(std::vector<double>{ 1, 1, 1 });
colorList.push_back(std::vector<double>{ 0, 1, 1 });
colorList.push_back(std::vector<double>{ 0, 0, 1 });
std::vector<std::string> labels;
labels.push_back("");
labels.push_back("0");
labels.push_back("1");
labels.push_back("2");
labels.push_back("3");
labels.push_back("4");
labels.push_back("5");
mRender->styleManage->SetColorBarPosition(pos);
mRender->styleManage->SetColorBarColorMap(colorList, labels);
mRender->styleManage->SetColorBarVisible(1);
mRender->cameraManage->ResetCamera();
mRender->entityManage->DoRepaint();
}
Mainwindow::~Mainwindow()
{
}
AMCAX_RENDER_API std::shared_ptr< IRenderComponent > CreateRenderComponent(QWidget *parent)
Create Render Component
PickType
Pick Type
定义 Constants.h:99
@ mouse_click
Left Click
定义 Constants.h:84
Entity Plugin
定义 PluginProperty.h:80
virtual void SetColorMap(std::map< double, std::vector< double > > colorMap, std::vector< double > scalars, ColorMapType type)=0
Set color map
Custom Mesh Data Structure
定义 CAXMeshInfo.h:39
std::vector< Face > faces
Face data collection
定义 CAXMeshInfo.h:46
std::vector< std::vector< double > > points
Point collection
定义 CAXMeshInfo.h:42
std::string id
Unique data ID
定义 CAXMeshInfo.h:41
std::vector< std::vector< double > > normals
Normal vector collection
定义 CAXMeshInfo.h:43
std::string category
Data type, e.g., "SHAPE", "POINT"
定义 CAXMeshInfo.h:40