世界坐标系和view的Graphic3d_AspectText3d和Prs3d_TextAspect不是同一个
This commit is contained in:
parent
adbd81bf1a
commit
23cf94de71
@ -5,6 +5,7 @@
|
|||||||
// please include "napi/native_api.h".
|
// please include "napi/native_api.h".
|
||||||
|
|
||||||
#include "Axis.h"
|
#include "Axis.h"
|
||||||
|
#include "Graphic3d_NameOfMaterial.hxx"
|
||||||
#include "Prs3d_DatumMode.hxx"
|
#include "Prs3d_DatumMode.hxx"
|
||||||
#include "Quantity_NameOfColor.hxx"
|
#include "Quantity_NameOfColor.hxx"
|
||||||
|
|
||||||
@ -16,9 +17,6 @@ namespace NativeOpenCAX {
|
|||||||
Axis::Axis() : axiPlacement(nullptr), axiTrihedron(nullptr), axiViewCube(nullptr) {}
|
Axis::Axis() : axiPlacement(nullptr), axiTrihedron(nullptr), axiViewCube(nullptr) {}
|
||||||
Axis::~Axis() {}
|
Axis::~Axis() {}
|
||||||
|
|
||||||
void Axis::SetAxisTextStyle(Handle(Prs3d_TextAspect) _textStyle){
|
|
||||||
textStyle=_textStyle;
|
|
||||||
}
|
|
||||||
bool Axis::InitAxis(Handle(AIS_InteractiveContext) & context) {
|
bool Axis::InitAxis(Handle(AIS_InteractiveContext) & context) {
|
||||||
try {
|
try {
|
||||||
//坐标显示文本
|
//坐标显示文本
|
||||||
@ -27,7 +25,7 @@ bool Axis::InitAxis(Handle(AIS_InteractiveContext) & context) {
|
|||||||
const char16_t z_Axis[] = u"Z";
|
const char16_t z_Axis[] = u"Z";
|
||||||
// 创建场景中心参考坐标系
|
// 创建场景中心参考坐标系
|
||||||
gp_Ax2 theAxis;
|
gp_Ax2 theAxis;
|
||||||
double theSize =200; // 大小
|
double theSize =250; // 大小
|
||||||
// 设置原点
|
// 设置原点
|
||||||
theAxis.SetLocation(gp_Pnt(0, 0, 0));
|
theAxis.SetLocation(gp_Pnt(0, 0, 0));
|
||||||
// 以世界坐标轴为准,设置Z,X轴方向
|
// 以世界坐标轴为准,设置Z,X轴方向
|
||||||
@ -55,9 +53,6 @@ bool Axis::InitAxis(Handle(AIS_InteractiveContext) & context) {
|
|||||||
axiTrihedron->SetLabel(Prs3d_DP_YAxis, y_Axis);
|
axiTrihedron->SetLabel(Prs3d_DP_YAxis, y_Axis);
|
||||||
axiTrihedron->SetLabel(Prs3d_DP_ZAxis, z_Axis);
|
axiTrihedron->SetLabel(Prs3d_DP_ZAxis, z_Axis);
|
||||||
axiTrihedron->SetSize(theSize);
|
axiTrihedron->SetSize(theSize);
|
||||||
if(!textStyle.IsNull()){
|
|
||||||
axiTrihedron->Attributes()->DatumAspect()->SetTextAspect(textStyle);
|
|
||||||
}
|
|
||||||
axiTrihedron->SetTransformPersistence(new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers, anOrg));
|
axiTrihedron->SetTransformPersistence(new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers, anOrg));
|
||||||
axiTrihedron->Attributes()->SetZLayer(Graphic3d_ZLayerId_Topmost);
|
axiTrihedron->Attributes()->SetZLayer(Graphic3d_ZLayerId_Topmost);
|
||||||
context->Display(axiTrihedron, true);
|
context->Display(axiTrihedron, true);
|
||||||
@ -68,7 +63,7 @@ bool Axis::InitAxis(Handle(AIS_InteractiveContext) & context) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool Axis::InitAxisCube(Handle(AIS_InteractiveContext) & context) {
|
bool Axis::InitAxisCube(Handle(AIS_InteractiveContext) & context,Handle(Prs3d_TextAspect) _textStyle) {
|
||||||
try {
|
try {
|
||||||
//立方体面显示文本
|
//立方体面显示文本
|
||||||
const char16_t rightCube[] = u"右视图";
|
const char16_t rightCube[] = u"右视图";
|
||||||
@ -90,8 +85,7 @@ bool Axis::InitAxisCube(Handle(AIS_InteractiveContext) & context) {
|
|||||||
axiViewCube->SetTransparency(0.0);
|
axiViewCube->SetTransparency(0.0);
|
||||||
axiViewCube->SetFixedAnimationLoop(true);
|
axiViewCube->SetFixedAnimationLoop(true);
|
||||||
axiViewCube->SetTextColor(Quantity_Color(Quantity_NOC_YELLOW2));
|
axiViewCube->SetTextColor(Quantity_Color(Quantity_NOC_YELLOW2));
|
||||||
axiViewCube->SetFontHeight(2000);
|
axiViewCube->SetFontHeight(35);
|
||||||
axiViewCube->SetFont("HarmonyOS Sans");
|
|
||||||
axiViewCube->SetMaterial(Graphic3d_MaterialAspect(Graphic3d_NOM_ALUMINIUM));
|
axiViewCube->SetMaterial(Graphic3d_MaterialAspect(Graphic3d_NOM_ALUMINIUM));
|
||||||
axiViewCube->SetTransformPersistence(
|
axiViewCube->SetTransformPersistence(
|
||||||
new Graphic3d_TransformPers(Graphic3d_TMF_TriedronPers, Aspect_TOTP_RIGHT_UPPER, NCollection_Vec2<int>(125, 125)));
|
new Graphic3d_TransformPers(Graphic3d_TMF_TriedronPers, Aspect_TOTP_RIGHT_UPPER, NCollection_Vec2<int>(125, 125)));
|
||||||
@ -102,6 +96,7 @@ bool Axis::InitAxisCube(Handle(AIS_InteractiveContext) & context) {
|
|||||||
HILOG_INFO(NATIVE_TAG, "Init Axi View Cube Fail:%{public}d", e.what());
|
HILOG_INFO(NATIVE_TAG, "Init Axi View Cube Fail:%{public}d", e.what());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Axis::SetRotationX(float rx) { rotationX = rx; }
|
void Axis::SetRotationX(float rx) { rotationX = rx; }
|
||||||
|
|||||||
@ -20,8 +20,7 @@ public:
|
|||||||
Axis();
|
Axis();
|
||||||
~Axis();
|
~Axis();
|
||||||
bool InitAxis(Handle(AIS_InteractiveContext)& context);
|
bool InitAxis(Handle(AIS_InteractiveContext)& context);
|
||||||
bool InitAxisCube(Handle(AIS_InteractiveContext) & context);
|
bool InitAxisCube(Handle(AIS_InteractiveContext) & context,Handle(Prs3d_TextAspect) _textStyle);
|
||||||
void SetAxisTextStyle(Handle(Prs3d_TextAspect) textStyle);
|
|
||||||
void SetRotationX(float x);
|
void SetRotationX(float x);
|
||||||
void SetRotationY(float y);
|
void SetRotationY(float y);
|
||||||
void SetRotationZ(float z);
|
void SetRotationZ(float z);
|
||||||
@ -34,7 +33,6 @@ private:
|
|||||||
Handle(AIS_Trihedron) axiTrihedron;
|
Handle(AIS_Trihedron) axiTrihedron;
|
||||||
//定义三面体
|
//定义三面体
|
||||||
Handle(AIS_ViewCube) axiViewCube;
|
Handle(AIS_ViewCube) axiViewCube;
|
||||||
Handle(Prs3d_TextAspect) textStyle;
|
|
||||||
private:
|
private:
|
||||||
//旋转X轴
|
//旋转X轴
|
||||||
float rotationX=0.0f;
|
float rotationX=0.0f;
|
||||||
|
|||||||
@ -14,10 +14,12 @@ namespace NativeOpenCAX {
|
|||||||
|
|
||||||
Context::Context() : context(nullptr) {}
|
Context::Context() : context(nullptr) {}
|
||||||
Context::~Context() {}
|
Context::~Context() {}
|
||||||
bool Context::InitContext(Handle(V3d_Viewer)& viewer) {
|
bool Context::InitContext(Handle(V3d_Viewer)& viewer,Handle(Prs3d_TextAspect) _textAspect) {
|
||||||
try {
|
try {
|
||||||
context = new AIS_InteractiveContext(viewer);
|
context = new AIS_InteractiveContext(viewer);
|
||||||
context->SetDisplayMode(AIS_Shaded, true); // 默认使用着色模式
|
context->SetDisplayMode(AIS_Shaded, true); // 默认使用着色模式
|
||||||
|
Handle(Prs3d_Drawer) theDrawer=context->DefaultDrawer();
|
||||||
|
theDrawer->SetTextAspect(_textAspect);
|
||||||
HILOG_INFO(NATIVE_TAG, "InitCtx Done");
|
HILOG_INFO(NATIVE_TAG, "InitCtx Done");
|
||||||
return true;
|
return true;
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class Context{
|
|||||||
public:
|
public:
|
||||||
Context();
|
Context();
|
||||||
~Context();
|
~Context();
|
||||||
bool InitContext(Handle(V3d_Viewer)& viewer);
|
bool InitContext(Handle(V3d_Viewer)& viewer,Handle(Prs3d_TextAspect) _textAspect);
|
||||||
public:
|
public:
|
||||||
Handle(AIS_InteractiveContext) context;
|
Handle(AIS_InteractiveContext) context;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -26,9 +26,7 @@ bool NativeRender::init(EGLCore &_eglCore) {
|
|||||||
HILOG_ERROR(NATIVE_TAG, "Init GraphicDriver Fail!");
|
HILOG_ERROR(NATIVE_TAG, "Init GraphicDriver Fail!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ts->InitTextStyle()) {
|
if (!ts->InitTextStyle()) {
|
||||||
mAxis->SetAxisTextStyle(ts->text);
|
|
||||||
}else{
|
|
||||||
HILOG_ERROR(NATIVE_TAG, "Init TextSyle Fail!");
|
HILOG_ERROR(NATIVE_TAG, "Init TextSyle Fail!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -36,7 +34,7 @@ bool NativeRender::init(EGLCore &_eglCore) {
|
|||||||
HILOG_ERROR(NATIVE_TAG, "Init Viewer Fail!");
|
HILOG_ERROR(NATIVE_TAG, "Init Viewer Fail!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ctx->InitContext(vr->viewer)) {
|
if (!ctx->InitContext(vr->viewer,ts->GetFontStyle(STYLE_AXIS))) {
|
||||||
HILOG_ERROR(NATIVE_TAG, "Init Ctx Fail!");
|
HILOG_ERROR(NATIVE_TAG, "Init Ctx Fail!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -48,8 +46,8 @@ bool NativeRender::init(EGLCore &_eglCore) {
|
|||||||
HILOG_ERROR(NATIVE_TAG, "Init View Fail!");
|
HILOG_ERROR(NATIVE_TAG, "Init View Fail!");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
vw->SetViewOption();
|
vw->SetViewOption(ts->GetFontStyle(STYLE_AXIS));
|
||||||
vw->SetText(ts->text);
|
vw->SetText(ts->GetFontStyle(STYLE_AXIS));
|
||||||
vw->SetWin(win->window);
|
vw->SetWin(win->window);
|
||||||
}
|
}
|
||||||
if (!cr->InitCamera(vw->view)) {
|
if (!cr->InitCamera(vw->view)) {
|
||||||
@ -62,7 +60,7 @@ bool NativeRender::init(EGLCore &_eglCore) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mAxis->InitAxisCube(ctx->context)) {
|
if (!mAxis->InitAxisCube(ctx->context,ts->GetFontStyle(STYLE_FACE))) {
|
||||||
HILOG_ERROR(NATIVE_TAG, "Init AXIS Cuba Fail!");
|
HILOG_ERROR(NATIVE_TAG, "Init AXIS Cuba Fail!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,6 +56,7 @@ void NativeRenderThread::renderLoop() {
|
|||||||
if (!eglCore_->init(nativeWindow_)) {
|
if (!eglCore_->init(nativeWindow_)) {
|
||||||
OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "EGLCoreInit","Failed to initialize EGL");
|
OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "EGLCoreInit","Failed to initialize EGL");
|
||||||
}
|
}
|
||||||
|
ftMgr=Font_FontMgr::GetInstance();
|
||||||
// 初始化OCCT渲染器
|
// 初始化OCCT渲染器
|
||||||
if (!renderer_->init(*eglCore_)) {
|
if (!renderer_->init(*eglCore_)) {
|
||||||
OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NativeRenderInit","Failed to initialize OCCT renderer");
|
OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NativeRenderInit","Failed to initialize OCCT renderer");
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
// please include "napi/native_api.h".
|
// please include "napi/native_api.h".
|
||||||
|
|
||||||
#include "TextStyle.h"
|
#include "TextStyle.h"
|
||||||
|
#include "Font_FontAspect.hxx"
|
||||||
|
|
||||||
#ifndef NATIVE_TAG
|
#ifndef NATIVE_TAG
|
||||||
#define NATIVE_TAG "TEXTSTYLE"
|
#define NATIVE_TAG "TEXTSTYLE"
|
||||||
@ -14,22 +15,18 @@
|
|||||||
|
|
||||||
namespace NativeOpenCAX {
|
namespace NativeOpenCAX {
|
||||||
|
|
||||||
TextStyle::TextStyle() : text(nullptr) {}
|
TextStyle::TextStyle() :
|
||||||
|
currentFontType(FONT_STYLE_TYPE::STYLE_AXIS),
|
||||||
|
fontStyle(std::map<FONT_STYLE_TYPE, Handle(Prs3d_TextAspect)>())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
TextStyle::~TextStyle() {}
|
TextStyle::~TextStyle() {}
|
||||||
|
|
||||||
bool TextStyle::InitTextStyle() {
|
bool TextStyle::InitTextStyle() {
|
||||||
try {
|
try {
|
||||||
text = new Prs3d_TextAspect();
|
InitAxisText();
|
||||||
text->SetFont("HarmonyOS Sans");
|
InitCubeText();
|
||||||
//缩放比例计算.根据XComp的对角线大小.按照Camera的缩放
|
|
||||||
text->SetHeight(2000);
|
|
||||||
text->Aspect()->SetColor(Quantity_NOC_GRAY95);
|
|
||||||
text->Aspect()->SetColorSubTitle(Quantity_NOC_BLACK);
|
|
||||||
text->Aspect()->SetDisplayType(Aspect_TODT_SHADOW);
|
|
||||||
text->Aspect()->SetTextFontAspect(Font_FA_Bold);
|
|
||||||
text->Aspect()->SetTextZoomable(false);
|
|
||||||
text->SetHorizontalJustification(Graphic3d_HTA_LEFT);
|
|
||||||
text->SetVerticalJustification(Graphic3d_VTA_BOTTOM);
|
|
||||||
HILOG_INFO(NATIVE_TAG, "InitTextSyle Done");
|
HILOG_INFO(NATIVE_TAG, "InitTextSyle Done");
|
||||||
return true;
|
return true;
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
@ -37,4 +34,72 @@ bool TextStyle::InitTextStyle() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void TextStyle::InitAxisText(){
|
||||||
|
FONT_STYLE_TYPE styleType=FONT_STYLE_TYPE::STYLE_AXIS;
|
||||||
|
Handle(Prs3d_TextAspect) axisText= new Prs3d_TextAspect();
|
||||||
|
axisText = new Prs3d_TextAspect();
|
||||||
|
axisText->SetHeight(70);
|
||||||
|
axisText->SetFont("HarmonyOS Sans");
|
||||||
|
axisText->Aspect()->SetFont("HarmonyOS Sans");
|
||||||
|
axisText->Aspect()->SetColor(Quantity_NOC_GRAY95);
|
||||||
|
axisText->Aspect()->SetColorSubTitle(Quantity_NOC_BLACK);
|
||||||
|
axisText->Aspect()->SetDisplayType(Aspect_TODT_SHADOW);
|
||||||
|
axisText->Aspect()->SetTextFontAspect(Font_FA_Regular);
|
||||||
|
axisText->Aspect()->SetTextZoomable(false);
|
||||||
|
axisText->SetHorizontalJustification(Graphic3d_HTA_LEFT);
|
||||||
|
axisText->SetVerticalJustification(Graphic3d_VTA_BOTTOM);
|
||||||
|
fontStyle[styleType]=axisText;
|
||||||
|
}
|
||||||
|
void TextStyle::InitCubeText(){
|
||||||
|
FONT_STYLE_TYPE styleType=FONT_STYLE_TYPE::STYLE_FACE;
|
||||||
|
Handle(Prs3d_TextAspect) cubeText= new Prs3d_TextAspect();
|
||||||
|
cubeText = new Prs3d_TextAspect();
|
||||||
|
cubeText->SetHeight(2000);
|
||||||
|
cubeText->SetFont("HarmonyOS Sans");
|
||||||
|
cubeText->Aspect()->SetFont("HarmonyOS Sans");
|
||||||
|
cubeText->Aspect()->SetColor(Quantity_NOC_GRAY95);
|
||||||
|
cubeText->Aspect()->SetColorSubTitle(Quantity_NOC_BLACK);
|
||||||
|
cubeText->Aspect()->SetDisplayType(Aspect_TODT_SHADOW);
|
||||||
|
cubeText->Aspect()->SetTextFontAspect(Font_FA_Bold);
|
||||||
|
cubeText->Aspect()->SetTextZoomable(true);
|
||||||
|
cubeText->SetHorizontalJustification(Graphic3d_HTA_LEFT);
|
||||||
|
cubeText->SetVerticalJustification(Graphic3d_VTA_BOTTOM);
|
||||||
|
fontStyle[styleType]=cubeText;
|
||||||
|
}
|
||||||
|
Handle(Prs3d_TextAspect) TextStyle::GetFontStyle(FONT_STYLE_TYPE type){
|
||||||
|
return fontStyle[type];
|
||||||
|
}
|
||||||
|
void TextStyle::SetPrs3dFont(const char* theFont){
|
||||||
|
fontStyle[currentFontType]->SetFont(theFont);
|
||||||
|
}
|
||||||
|
void TextStyle::SetPrs3dHeight(int textSize){
|
||||||
|
fontStyle[currentFontType]->SetHeight(textSize);
|
||||||
|
}
|
||||||
|
void TextStyle::SetPrs3dColor(Quantity_Color &theColor){
|
||||||
|
fontStyle[currentFontType]->SetColor(theColor);
|
||||||
|
}
|
||||||
|
void TextStyle::SetPrs3dHTA(Graphic3d_HorizontalTextAlignment theJustification){
|
||||||
|
fontStyle[currentFontType]->SetHorizontalJustification(theJustification);
|
||||||
|
}
|
||||||
|
void TextStyle::SetPrs3dVTA(Graphic3d_VerticalTextAlignment theJustification){
|
||||||
|
fontStyle[currentFontType]->SetVerticalJustification(theJustification);
|
||||||
|
}
|
||||||
|
void TextStyle::SetPrs3dAspectText3d(Handle(Graphic3d_AspectText3d) theAspect){
|
||||||
|
fontStyle[currentFontType]->SetAspect(theAspect);
|
||||||
|
}
|
||||||
|
void TextStyle::SetGrs3dSetColor(const Quantity_Color &theColor){
|
||||||
|
fontStyle[currentFontType]->Aspect()->SetColor(theColor);
|
||||||
|
}
|
||||||
|
void TextStyle::SetGrs3dSetColorRGBA(const Quantity_ColorRGBA &theColor){
|
||||||
|
fontStyle[currentFontType]->Aspect()->SetColor(theColor);
|
||||||
|
}
|
||||||
|
void TextStyle::SetGrs3dSetTextFont(Handle(TCollection_HAsciiString) theFont){
|
||||||
|
fontStyle[currentFontType]->Aspect()->SetTextFont(theFont);
|
||||||
|
}
|
||||||
|
void TextStyle::SetGrs3dSetZoomable(bool theFlag){
|
||||||
|
fontStyle[currentFontType]->Aspect()->SetTextZoomable(theFlag);
|
||||||
|
}
|
||||||
|
void TextStyle::SetGrs3dDisplayType(Font_FontAspect theFontAspect){
|
||||||
|
fontStyle[currentFontType]->Aspect()->SetTextFontAspect(theFontAspect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -9,13 +9,15 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "NativeEGLOCCT/common.h"
|
#include "NativeEGLOCCT/common.h"
|
||||||
#include "Font_NameOfFont.hxx"
|
|
||||||
#include <Prs3d_TextAspect.hxx>
|
#include <Prs3d_TextAspect.hxx>
|
||||||
|
#include <Graphic3d_AspectText3d.hxx>
|
||||||
//字体样式类型.主要用于区别该样式用于何处
|
//字体样式类型.主要用于区别该样式用于何处
|
||||||
enum FONT_STYLE_TYPE{
|
enum FONT_STYLE_TYPE{
|
||||||
STYLE_AXIS,
|
STYLE_AXIS,
|
||||||
STYLE_FACE,
|
STYLE_FACE,
|
||||||
|
};
|
||||||
|
struct TextStyleOpts{
|
||||||
|
|
||||||
};
|
};
|
||||||
namespace NativeOpenCAX{
|
namespace NativeOpenCAX{
|
||||||
class TextStyle{
|
class TextStyle{
|
||||||
@ -23,9 +25,26 @@ public:
|
|||||||
TextStyle();
|
TextStyle();
|
||||||
~TextStyle();
|
~TextStyle();
|
||||||
bool InitTextStyle();
|
bool InitTextStyle();
|
||||||
|
Handle(Prs3d_TextAspect) GetFontStyle(FONT_STYLE_TYPE);
|
||||||
|
//Prs3d
|
||||||
|
void SetPrs3dFont(const char* theFont);
|
||||||
|
void SetPrs3dHeight(int textSize);
|
||||||
|
void SetPrs3dColor(Quantity_Color &theColor);
|
||||||
|
void SetPrs3dHTA(Graphic3d_HorizontalTextAlignment theJustification);
|
||||||
|
void SetPrs3dVTA(Graphic3d_VerticalTextAlignment theJustification);
|
||||||
|
void SetPrs3dAspectText3d(Handle(Graphic3d_AspectText3d) theAspect);
|
||||||
|
//Grs3d
|
||||||
|
void SetGrs3dSetColor(const Quantity_Color &theColor);
|
||||||
|
void SetGrs3dSetColorRGBA(const Quantity_ColorRGBA &theColor);
|
||||||
|
void SetGrs3dSetTextFont(Handle(TCollection_HAsciiString) theFont);
|
||||||
|
void SetGrs3dSetZoomable(bool theFlag);
|
||||||
|
void SetGrs3dDisplayType(Font_FontAspect theFontAspect);
|
||||||
|
private:
|
||||||
|
void InitAxisText();
|
||||||
|
void InitCubeText();
|
||||||
public:
|
public:
|
||||||
Handle(Prs3d_TextAspect) text;
|
|
||||||
//一个字体管理样式对象管理.主要负责对字体样式的归一化集中管理
|
//一个字体管理样式对象管理.主要负责对字体样式的归一化集中管理
|
||||||
|
FONT_STYLE_TYPE currentFontType;
|
||||||
std::map<FONT_STYLE_TYPE, Handle(Prs3d_TextAspect)> fontStyle;
|
std::map<FONT_STYLE_TYPE, Handle(Prs3d_TextAspect)> fontStyle;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
#include "View.h"
|
#include "View.h"
|
||||||
#include "Quantity_NameOfColor.hxx"
|
#include "Quantity_NameOfColor.hxx"
|
||||||
#include "V3d_TypeOfAxe.hxx"
|
#include "V3d_TypeOfAxe.hxx"
|
||||||
|
#include "V3d_TypeOfVisualization.hxx"
|
||||||
|
|
||||||
#ifndef NATIVE_TAG
|
#ifndef NATIVE_TAG
|
||||||
#define NATIVE_TAG "VIEW"
|
#define NATIVE_TAG "VIEW"
|
||||||
@ -27,40 +28,29 @@ bool View::InitView(Handle(V3d_Viewer) & viewer) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void View::SetViewOption() {
|
void View::SetViewOption(Handle(Prs3d_TextAspect) _textStyle) {
|
||||||
// 设置渲染参数
|
// 设置渲染参数
|
||||||
view->SetImmediateUpdate(false);
|
view->SetImmediateUpdate(false);
|
||||||
view->ChangeRenderingParams().Method = Graphic3d_RM_RASTERIZATION;
|
view->ChangeRenderingParams().Method = Graphic3d_RM_RASTERIZATION;
|
||||||
view->ChangeRenderingParams().IsShadowEnabled = Standard_False;
|
view->ChangeRenderingParams().IsShadowEnabled = Standard_False;
|
||||||
view->ChangeRenderingParams().IsReflectionEnabled = Standard_False;
|
view->ChangeRenderingParams().IsReflectionEnabled = Standard_False;
|
||||||
view->ChangeRenderingParams().IsAntialiasingEnabled = Standard_True;
|
// view->ChangeRenderingParams().IsAntialiasingEnabled = Standard_True;
|
||||||
view->ChangeRenderingParams().Resolution = 1;
|
// view->ChangeRenderingParams().Resolution = 2;
|
||||||
// 设置背景渐变
|
// 设置背景渐变
|
||||||
view->SetBgGradientColors(Quantity_Color(Quantity_NOC_GRAY), Quantity_Color(Quantity_NOC_BLACK),
|
view->SetBgGradientColors(Quantity_Color(Quantity_NOC_GRAY), Quantity_Color(Quantity_NOC_BLACK),
|
||||||
Aspect_GFM_VER, // 垂直渐变
|
Aspect_GFM_VER, // 垂直渐变
|
||||||
false);
|
false);
|
||||||
// 设置默认相机位置
|
|
||||||
view->SetSize(0.1);
|
|
||||||
view->SetProj(V3d_XposYnegZpos);
|
view->SetProj(V3d_XposYnegZpos);
|
||||||
view->FitAll(0.02, false);
|
|
||||||
// 可选:显示坐标轴
|
|
||||||
view->ZBufferTriedronSetup();
|
|
||||||
// 调整相机视角
|
|
||||||
view->Camera()->SetProjectionType(Graphic3d_Camera::Projection_Orthographic);
|
view->Camera()->SetProjectionType(Graphic3d_Camera::Projection_Orthographic);
|
||||||
view->SetBackgroundColor(Quantity_NOC_GRAY90);
|
view->SetBackgroundColor(Quantity_NOC_GRAY90);
|
||||||
//左下角默认坐标系
|
|
||||||
view->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_ANTIQUEWHITE, 0.3, V3d_ZBUFFER);
|
view->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_ANTIQUEWHITE, 0.3, V3d_ZBUFFER);
|
||||||
Handle(V3d_Trihedron) tri;
|
view->Trihedron(false)->LabelAspect(V3d_Y)->SetAspect(_textStyle->Aspect());
|
||||||
tri=view->Trihedron(false);
|
view->Trihedron(false)->LabelAspect(V3d_X)->SetAspect(_textStyle->Aspect());
|
||||||
if(!tri.IsNull()){
|
view->Trihedron(false)->LabelAspect(V3d_Z)->SetAspect(_textStyle->Aspect());
|
||||||
HILOG_INFO(NATIVE_TAG, "V3d_Trihedron X");
|
view->SetBackgroundColor(Quantity_NOC_GRAY90);
|
||||||
tri->LabelAspect(V3d_X)->SetFont("HarmonyOS Sans");
|
|
||||||
tri->LabelAspect(V3d_X)->SetHeight(1500.0);
|
|
||||||
tri->LabelAspect(V3d_X)->SetColor(Quantity_Color(Quantity_NOC_YELLOW));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::SetText(Handle(Prs3d_TextAspect) & text) {
|
void View::SetText(Handle(Prs3d_TextAspect) text) {
|
||||||
view->ChangeRenderingParams().StatsTextAspect = text->Aspect();
|
view->ChangeRenderingParams().StatsTextAspect = text->Aspect();
|
||||||
view->ChangeRenderingParams().StatsTextHeight = text->Height();
|
view->ChangeRenderingParams().StatsTextHeight = text->Height();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,9 +21,9 @@ public:
|
|||||||
View();
|
View();
|
||||||
~View();
|
~View();
|
||||||
bool InitView(Handle(V3d_Viewer)& viewer);
|
bool InitView(Handle(V3d_Viewer)& viewer);
|
||||||
void SetViewOption();
|
void SetViewOption(Handle(Prs3d_TextAspect) _textStyle);
|
||||||
void SetWin(Handle(Aspect_NeutralWindow)& win);
|
void SetWin(Handle(Aspect_NeutralWindow)& win);
|
||||||
void SetText(Handle(Prs3d_TextAspect)& text);
|
void SetText(Handle(Prs3d_TextAspect) text);
|
||||||
void SetClearColor(float r, float g, float b, float a);
|
void SetClearColor(float r, float g, float b, float a);
|
||||||
void MustBeResized();
|
void MustBeResized();
|
||||||
void Redraw();
|
void Redraw();
|
||||||
|
|||||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user