Open CASCADE学习|显示模型

目录

1、编写代码

Viewer.h

Viewer.cpp

ViewerInteractor.h

ViewerInteractor.cpp

helloworld.cpp

2、配置

3、编译运行


1、编写代码

Viewer.h

#pragma once
​
#ifdef _WIN32
#include <Windows.h>
#endif
​
// Local includes
#include "ViewerInteractor.h"
​
// OpenCascade includes
#include <TopoDS_Shape.hxx>
#include <WNT_Window.hxx>
​
// Standard includes
#include <vector>
​
class V3d_Viewer;
class V3d_View;
class AIS_InteractiveContext;
class AIS_ViewController;
​
//-----------------------------------------------------------------------------
​
//! Simple 3D viewer.
class Viewer
{
public:
​Viewer(const int left,const int top,const int width,const int height);
​
public:
​Viewer& operator<<(const TopoDS_Shape& shape){this->AddShape(shape);return *this;}
​void AddShape(const TopoDS_Shape& shape);
​void StartMessageLoop();
​
private:
​static LRESULT WINAPIwndProcProxy(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam);
​LRESULT CALLBACKwndProc(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam);
​void init(const HANDLE& windowHandle);
​/* API-related things */
private:
​std::vector<TopoDS_Shape> m_shapes; //!< Shapes to visualize.
​/* OpenCascade's things */
private:
​Handle(V3d_Viewer)             m_viewer;Handle(V3d_View)               m_view;Handle(AIS_InteractiveContext) m_context;Handle(WNT_Window)             m_wntWindow;Handle(ViewerInteractor)       m_evtMgr;
​/* Lower-level things */
private:
​HINSTANCE m_hInstance; //!< Handle to the instance of the module.HWND      m_hWnd;      //!< Handle to the instance of the window.bool      m_bQuit;     //!< Indicates whether user want to quit from window.
​
};

Viewer.cpp

// Own include
#include "Viewer.h"
​
// OpenCascade includes
#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
#include <Aspect_DisplayConnection.hxx>
#include <Aspect_Handle.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <V3d_AmbientLight.hxx>
#include <V3d_DirectionalLight.hxx>
#include <V3d_View.hxx>
#include <V3d_Viewer.hxx>
​
namespace {//! Adjust the style of local selection.//! \param[in] context the AIS context.void AdjustSelectionStyle(const Handle(AIS_InteractiveContext)& context)
{// Initialize style for sub-shape selection.Handle(Prs3d_Drawer) selDrawer = new Prs3d_Drawer;//selDrawer->SetLink(context->DefaultDrawer());selDrawer->SetFaceBoundaryDraw(true);selDrawer->SetDisplayMode(1); // ShadedselDrawer->SetTransparency(0.5f);selDrawer->SetZLayer(Graphic3d_ZLayerId_Topmost);selDrawer->SetColor(Quantity_NOC_GOLD);selDrawer->SetBasicFillAreaAspect(new Graphic3d_AspectFillArea3d());
​// Adjust fill area aspect.const Handle(Graphic3d_AspectFillArea3d)&fillArea = selDrawer->BasicFillAreaAspect();//fillArea->SetInteriorColor(Quantity_NOC_GOLD);fillArea->SetBackInteriorColor(Quantity_NOC_GOLD);//fillArea->ChangeFrontMaterial().SetMaterialName(Graphic3d_NOM_NEON_GNC);fillArea->ChangeFrontMaterial().SetTransparency(0.4f);fillArea->ChangeBackMaterial().SetMaterialName(Graphic3d_NOM_NEON_GNC);fillArea->ChangeBackMaterial().SetTransparency(0.4f);
​selDrawer->UnFreeBoundaryAspect()->SetWidth(1.0);
​// Update AIS context.context->SetHighlightStyle(Prs3d_TypeOfHighlight_LocalSelected, selDrawer);}
}
​
//-----------------------------------------------------------------------------
​
Viewer::Viewer(const int left,const int top,const int width,const int height): m_hWnd(NULL),m_bQuit(false)
{// Register the window class oncestatic HINSTANCE APP_INSTANCE = NULL;if (APP_INSTANCE == NULL){APP_INSTANCE = GetModuleHandleW(NULL);m_hInstance = APP_INSTANCE;
​WNDCLASSW WC;WC.cbClsExtra = 0;WC.cbWndExtra = 0;WC.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);WC.hCursor = LoadCursor(NULL, IDC_ARROW);WC.hIcon = LoadIcon(NULL, IDI_APPLICATION);WC.hInstance = APP_INSTANCE;WC.lpfnWndProc = (WNDPROC)wndProcProxy;WC.lpszClassName = L"OpenGLClass";WC.lpszMenuName = 0;WC.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
​if (!RegisterClassW(&WC)){return;}}
​// Set coordinates for window's area rectangle.RECT Rect;SetRect(&Rect,left, top,left + width, top + height);
​// Adjust window rectangle.AdjustWindowRect(&Rect, WS_OVERLAPPEDWINDOW, false);
​// Create window.m_hWnd = CreateWindow(L"OpenGLClass",L"Quaoar >>> 3D",WS_OVERLAPPEDWINDOW,Rect.left, Rect.top, // Adjusted x, y positionsRect.right - Rect.left, Rect.bottom - Rect.top, // Adjusted width and heightNULL, NULL,m_hInstance,this);
​// Check if window has been created successfully.if (m_hWnd == NULL){return;}
​// Show window finally.ShowWindow(m_hWnd, TRUE);
​HANDLE windowHandle = (HANDLE)m_hWnd;
​this->init(windowHandle);
}
​
//-----------------------------------------------------------------------------
​
void Viewer::AddShape(const TopoDS_Shape& shape)
{m_shapes.push_back(shape);
}
​
//-----------------------------------------------------------------------------
​
//! Starts message loop.
void Viewer::StartMessageLoop()
{for (auto sh : m_shapes){Handle(AIS_Shape) shape = new AIS_Shape(sh);m_context->Display(shape, true);m_context->SetDisplayMode(shape, AIS_Shaded, true);
​// Adjust selection style.::AdjustSelectionStyle(m_context);
​// Activate selection modes.m_context->Activate(4, true); // facesm_context->Activate(2, true); // edges}
​MSG Msg;while (!m_bQuit){switch (::MsgWaitForMultipleObjectsEx(0, NULL, 12, QS_ALLINPUT, 0)){case WAIT_OBJECT_0:{while (::PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)){if (Msg.message == WM_QUIT)m_bQuit = true;// return;
​::TranslateMessage(&Msg);::DispatchMessage(&Msg);}}}}
}
​
//-----------------------------------------------------------------------------
​
void Viewer::init(const HANDLE& windowHandle)
{static Handle(Aspect_DisplayConnection) displayConnection;//if (displayConnection.IsNull())displayConnection = new Aspect_DisplayConnection();
​HWND winHandle = (HWND)windowHandle;//if (winHandle == NULL)return;
​// Create OCCT viewer.Handle(OpenGl_GraphicDriver)graphicDriver = new OpenGl_GraphicDriver(displayConnection, false);
​m_viewer = new V3d_Viewer(graphicDriver);
​// Lightning.Handle(V3d_DirectionalLight) LightDir = new V3d_DirectionalLight(V3d_Zneg, Quantity_Color(Quantity_NOC_GRAY97), 1);Handle(V3d_AmbientLight)     LightAmb = new V3d_AmbientLight();//LightDir->SetDirection(1.0, -2.0, -10.0);//m_viewer->AddLight(LightDir);m_viewer->AddLight(LightAmb);m_viewer->SetLightOn(LightDir);m_viewer->SetLightOn(LightAmb);
​// AIS context.m_context = new AIS_InteractiveContext(m_viewer);
​// Configure some global props.const Handle(Prs3d_Drawer)& contextDrawer = m_context->DefaultDrawer();//if (!contextDrawer.IsNull()){const Handle(Prs3d_ShadingAspect)& SA = contextDrawer->ShadingAspect();const Handle(Graphic3d_AspectFillArea3d)& FA = SA->Aspect();contextDrawer->SetFaceBoundaryDraw(true); // Draw edges.FA->SetEdgeOff();
​// Fix for inifinite lines has been reduced to 1000 from its default value 500000.contextDrawer->SetMaximalParameterValue(1000);}
​// Main view creation.m_view = m_viewer->CreateView();m_view->SetImmediateUpdate(false);
​// Event manager is constructed when both contex and view become available.m_evtMgr = new ViewerInteractor(m_view, m_context);
​// Aspect window creationm_wntWindow = new WNT_Window(winHandle);m_view->SetWindow(m_wntWindow, nullptr);//if (!m_wntWindow->IsMapped()){m_wntWindow->Map();}m_view->MustBeResized();
​// View settings.m_view->SetShadingModel(V3d_PHONG);
​// Configure rendering parametersGraphic3d_RenderingParams& RenderParams = m_view->ChangeRenderingParams();RenderParams.IsAntialiasingEnabled = true;RenderParams.NbMsaaSamples = 8; // Anti-aliasing by multi-samplingRenderParams.IsShadowEnabled = false;RenderParams.CollectedStats = Graphic3d_RenderingParams::PerfCounters_NONE;
}
​
//-----------------------------------------------------------------------------
​
LRESULT WINAPI Viewer::wndProcProxy(HWND   hwnd,UINT   message,WPARAM wparam,LPARAM lparam)
{if (message == WM_CREATE){// Save pointer to our class instance (sent on window create) to window storage.CREATESTRUCTW* pCreateStruct = (CREATESTRUCTW*)lparam;SetWindowLongPtr(hwnd, int(GWLP_USERDATA), (LONG_PTR)pCreateStruct->lpCreateParams);}
​// Get pointer to our class instance.Viewer* pThis = (Viewer*)GetWindowLongPtr(hwnd, int(GWLP_USERDATA));return (pThis != NULL) ? pThis->wndProc(hwnd, message, wparam, lparam): DefWindowProcW(hwnd, message, wparam, lparam);
}
​
//-----------------------------------------------------------------------------
​
//! Window procedure.
LRESULT Viewer::wndProc(HWND   hwnd,UINT   message,WPARAM wparam,LPARAM lparam)
{if (m_view.IsNull())return DefWindowProc(hwnd, message, wparam, lparam);
​switch (message){case WM_PAINT:{PAINTSTRUCT aPaint;BeginPaint(m_hWnd, &aPaint);EndPaint(m_hWnd, &aPaint);m_evtMgr->ProcessExpose();break;}case WM_SIZE:{m_evtMgr->ProcessConfigure();break;}case WM_MOVE:case WM_MOVING:case WM_SIZING:{switch (m_view->RenderingParams().StereoMode){case Graphic3d_StereoMode_RowInterlaced:case Graphic3d_StereoMode_ColumnInterlaced:case Graphic3d_StereoMode_ChessBoard:{// track window moves to reverse stereo pairm_view->MustBeResized();m_view->Update();break;}default:break;}break;}case WM_KEYUP:case WM_KEYDOWN:{const Aspect_VKey vkey = WNT_Window::VirtualKeyFromNative((int)wparam);//if (vkey != Aspect_VKey_UNKNOWN){const double timeStamp = m_evtMgr->EventTime();if (message == WM_KEYDOWN){m_evtMgr->KeyDown(vkey, timeStamp);}else{m_evtMgr->KeyUp(vkey, timeStamp);}}break;}case WM_LBUTTONUP:case WM_MBUTTONUP:case WM_RBUTTONUP:case WM_LBUTTONDOWN:case WM_MBUTTONDOWN:case WM_RBUTTONDOWN:{const Graphic3d_Vec2i pos(LOWORD(lparam), HIWORD(lparam));const Aspect_VKeyFlags flags = WNT_Window::MouseKeyFlagsFromEvent(wparam);Aspect_VKeyMouse button = Aspect_VKeyMouse_NONE;//switch (message){case WM_LBUTTONUP:case WM_LBUTTONDOWN:button = Aspect_VKeyMouse_LeftButton;break;case WM_MBUTTONUP:case WM_MBUTTONDOWN:button = Aspect_VKeyMouse_MiddleButton;break;case WM_RBUTTONUP:case WM_RBUTTONDOWN:button = Aspect_VKeyMouse_RightButton;break;}if (message == WM_LBUTTONDOWN|| message == WM_MBUTTONDOWN|| message == WM_RBUTTONDOWN){SetFocus(hwnd);SetCapture(hwnd);
​if (!m_evtMgr.IsNull())m_evtMgr->PressMouseButton(pos, button, flags, false);}else{ReleaseCapture();
​if (!m_evtMgr.IsNull())m_evtMgr->ReleaseMouseButton(pos, button, flags, false);}
​m_evtMgr->FlushViewEvents(m_context, m_view, true);break;}case WM_MOUSEWHEEL:{const int    delta = GET_WHEEL_DELTA_WPARAM(wparam);const double deltaF = double(delta) / double(WHEEL_DELTA);//const Aspect_VKeyFlags flags = WNT_Window::MouseKeyFlagsFromEvent(wparam);//Graphic3d_Vec2i pos(int(short(LOWORD(lparam))), int(short(HIWORD(lparam))));POINT cursorPnt = { pos.x(), pos.y() };if (ScreenToClient(hwnd, &cursorPnt)){pos.SetValues(cursorPnt.x, cursorPnt.y);}
​if (!m_evtMgr.IsNull()){m_evtMgr->UpdateMouseScroll(Aspect_ScrollDelta(pos, deltaF, flags));m_evtMgr->FlushViewEvents(m_context, m_view, true);}break;}case WM_MOUSEMOVE:{Graphic3d_Vec2i pos(LOWORD(lparam), HIWORD(lparam));Aspect_VKeyMouse buttons = WNT_Window::MouseButtonsFromEvent(wparam);Aspect_VKeyFlags flags = WNT_Window::MouseKeyFlagsFromEvent(wparam);
​// don't make a slide-show from input events - fetch the actual mouse cursor positionCURSORINFO cursor;cursor.cbSize = sizeof(cursor);if (::GetCursorInfo(&cursor) != FALSE){POINT cursorPnt = { cursor.ptScreenPos.x, cursor.ptScreenPos.y };if (ScreenToClient(hwnd, &cursorPnt)){// as we override mouse position, we need overriding also mouse statepos.SetValues(cursorPnt.x, cursorPnt.y);buttons = WNT_Window::MouseButtonsAsync();flags = WNT_Window::MouseKeyFlagsAsync();}}
​if (m_wntWindow.IsNull() || (HWND)m_wntWindow->HWindow() != hwnd){// mouse move events come also for inactive windowsbreak;}
​if (!m_evtMgr.IsNull()){m_evtMgr->UpdateMousePosition(pos, buttons, flags, false);m_evtMgr->FlushViewEvents(m_context, m_view, true);}break;}default:{break;}
​case WM_DESTROY:m_bQuit = true;}return DefWindowProc(hwnd, message, wparam, lparam);
}

ViewerInteractor.h

#pragma once
​
// OpenCascade includes
#include <AIS_ViewController.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <TCollection_AsciiString.hxx>
​
class AIS_InteractiveContext;
class V3d_View;
​
//! Manages input events.
class ViewerInteractor : public Standard_Transient, public AIS_ViewController
{
public:
​// OCCT RTTIDEFINE_STANDARD_RTTI_INLINE(ViewerInteractor, Standard_Transient)
​
public:
​//! Ctor.//! \param[in] view the V3d view instance.//! \param[in] ctx  the interactive context.ViewerInteractor(const Handle(V3d_View)& view,const Handle(AIS_InteractiveContext)& ctx);
​//! Dtor.virtual ~ViewerInteractor();
​
public:
​//! Return interactive context.const Handle(AIS_InteractiveContext)&GetContext() const { return m_ctx; }
​//! Handle mouse button press/release event.virtual bool UpdateMouseButtons(const Graphic3d_Vec2i& thePoint,Aspect_VKeyMouse       theButtons,Aspect_VKeyFlags       theModifiers,bool                   theIsEmulated) Standard_OVERRIDE;
​//! Release key.virtual void KeyDown(Aspect_VKey theKey,double theTime,double thePressure = 1.0) Standard_OVERRIDE;
​//! Release key.virtual void KeyUp(Aspect_VKey theKey,double theTime) Standard_OVERRIDE;
​//! Redraw the View on an Expose Eventvirtual void ProcessExpose();
​//! Handle redraw.virtual void handleViewRedraw(const Handle(AIS_InteractiveContext)& theCtx,const Handle(V3d_View)& theView) Standard_OVERRIDE;
​//! Resize View.virtual void ProcessConfigure();
​//! Handle KeyPress event.void ProcessKeyPress(Aspect_VKey theKey);
​
private:
​Handle(V3d_View)               m_view; //!< 3D view.Handle(AIS_InteractiveContext) m_ctx;  //!< Interactive context.
​
};

ViewerInteractor.cpp

// Own include
#include "ViewerInteractor.h"
​
// OpenCascade includes
#include <Aspect_Grid.hxx>
#include <AIS_AnimationCamera.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
#include <V3d_View.hxx>
​
//-----------------------------------------------------------------------------
​
ViewerInteractor::ViewerInteractor(const Handle(V3d_View)& view,const Handle(AIS_InteractiveContext)& ctx): m_view(view),m_ctx(ctx)
{}
​
//-----------------------------------------------------------------------------
​
ViewerInteractor::~ViewerInteractor()
{}
​
//-----------------------------------------------------------------------------
​
bool ViewerInteractor::UpdateMouseButtons(const Graphic3d_Vec2i& point,Aspect_VKeyMouse       buttons,Aspect_VKeyFlags       modifiers,bool                   isEmulated)
{return AIS_ViewController::UpdateMouseButtons(point, buttons, modifiers, isEmulated);
}
​
//-----------------------------------------------------------------------------
​
void ViewerInteractor::ProcessExpose()
{if (!m_view.IsNull()){m_view->Invalidate();FlushViewEvents(m_ctx, m_view, true);}
}
​
//-----------------------------------------------------------------------------
​
void ViewerInteractor::handleViewRedraw(const Handle(AIS_InteractiveContext)& ctx,const Handle(V3d_View)& view)
{AIS_ViewController::handleViewRedraw(ctx, view);
}
​
//-----------------------------------------------------------------------------
​
void ViewerInteractor::ProcessConfigure()
{if (!m_view.IsNull()){m_view->MustBeResized();FlushViewEvents(m_ctx, m_view, true);}
}
​
//-----------------------------------------------------------------------------
​
void ViewerInteractor::KeyDown(Aspect_VKey key,double      time,double      pressure)
{AIS_ViewController::KeyDown(key, time, pressure);
}
​
//-----------------------------------------------------------------------------
​
void ViewerInteractor::KeyUp(Aspect_VKey key,double      time)
{const unsigned int modifOld = myKeys.Modifiers();//AIS_ViewController::KeyUp(key, time);//const unsigned int modifNew = myKeys.Modifiers();
​ProcessKeyPress(key | modifNew);
}
​
//-----------------------------------------------------------------------------
​
void ViewerInteractor::ProcessKeyPress(Aspect_VKey key)
{if (m_ctx.IsNull() || m_view.IsNull()){return;}
​switch (key){case Aspect_VKey_F:{if (m_ctx->NbSelected() > 0){m_ctx->FitSelected(m_view);}else{m_view->FitAll();}break;}case Aspect_VKey_S:case Aspect_VKey_W:{const int dm = (key == Aspect_VKey_S) ? AIS_Shaded : AIS_WireFrame;
​if (m_ctx->NbSelected() == 0){m_ctx->SetDisplayMode(dm, false);m_ctx->UpdateCurrentViewer();}else{for (m_ctx->InitSelected(); m_ctx->MoreSelected(); m_ctx->NextSelected()){m_ctx->SetDisplayMode(m_ctx->SelectedInteractive(), dm, false);}m_ctx->UpdateCurrentViewer();}break;}case Aspect_VKey_Backspace: // Axonometry.{m_view->SetProj(V3d_XposYnegZpos);m_view->Redraw();break;}case Aspect_VKey_T:{m_view->SetProj(V3d_TypeOfOrientation_Zup_Top);m_view->Redraw();break;}case Aspect_VKey_B:{m_view->SetProj(V3d_TypeOfOrientation_Zup_Bottom);m_view->Redraw();break;}case Aspect_VKey_L:{m_view->SetProj(V3d_TypeOfOrientation_Zup_Left);m_view->Redraw();break;}case Aspect_VKey_R:{m_view->SetProj(V3d_TypeOfOrientation_Zup_Right);m_view->Redraw();break;}default: break;}
}
​

helloworld.cpp

#include "Viewer.h"
​
#include <BRepTools.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
​
int main(int argc, char** argv)
{Viewer vout(50, 50, 500, 500);
​vout << BRepPrimAPI_MakeBox(10, 10, 20)<< BRepPrimAPI_MakeBox(20, 30, 10);
​if (argc > 1){BRep_Builder bb;TopoDS_Shape fromFile;//if (!BRepTools::Read(fromFile, argv[1], bb)){std::cout << "Failed to read BREP shape from file " << argv[1] << std::endl;return 1;}
​vout << fromFile;}
​vout.StartMessageLoop();
​return 0;
}
​

2、配置

库文件和头文件同以前

附加依赖项添加以下:

TKernel.lib

TKMath.lib

TKTopAlgo.lib

TKBRep.lib

TKPrim.lib

TKOpenGl.lib

TKService.lib

TKV3d.lib

kernel32.lib

user32.lib

gdi32.lib

winspool.lib

把freetype.lib和freetype.dll拷贝到源码编译后的库文件目录

D:\vs pj\opencascade\3rdparty\freetype-2.5.5-vc14-64

D:\vs pj\opencascade\install\win64\vc14

3、编译运行

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/630226.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Redis 服务器 命令

目录 1.Redis Client Pause 命令 - 在指定时间内终止运行来自客户端的命令简介语法可用版本: > 2.9.50返回值: 返回 OK。如果 timeout 参数是非法的返回错误。 示例 2.Redis Debug Object 命令 - 获取 key 的调试信息简介语法可用版本: > 1.0.0返回值: 当 key 存在时&…

MySQL下对[库]的操作

目录 创建数据库 创建一个数据库案例&#xff1a; 字符集和校验规则&#xff1a; 默认字符集&#xff1a; 默认校验规则&#xff1a; 查看数据库支持的字符集&#xff1a; 查看数据库支持的字符集校验规则&#xff1a; 校验规则对数据库的影响&#xff1a; 操作数据…

FFmpeg之SwrRessample

文章目录 一、概述二、重采样流程三、重要结构体3.1、SwrContext3.2、ResamplerContext 四、重要函数4.1、swr_alloc4.2、swr_alloc_set_opts4.3、av_opt_set_*4.4、swr_init4.5、av_samples_alloc_array_and_samples4.6、av_samples_alloc4.7、swr_convert4.8、swr_get_delay4…

树莓派4B+ubuntu20.04+ros1桌面配置(一)

烧录系统至树莓派 下载系统&#xff1a; 方案一 https://ubuntu.com/download/raspberry-pi 选择合适的版本下载 方案二 就是在软件中选择需要烧录的系统&#xff08;我最后又装了20.04的ubuntu server系统&#xff0c;因为22的系统不能装ros1&#xff09; 方案三(采用…

子类的构造函数和析构函数调用顺序

看代码&#xff1a; class A { public:A() { cout << __FUNCTION__ << endl; }~A() { cout << __FUNCTION__ << endl; } };class B { public:B() { cout << __FUNCTION__ << endl; }~B() { cout << __FUNCTION__ << endl; …

学习JavaEE的日子 day11 初识面相对象

day11 1.初识面相对象 1.1 类和对象的理解 类 * 类是对象的数据类型&#xff0c;类是具有相同属性和行为的一组对象的集合 * 简单理解&#xff1a;类就是对现实事物的一种描述 类的组成 * 属性&#xff1a;指事物的特征&#xff0c;例如&#xff1a;手机事物&#xff08;品牌…

c语言 编译与链接

编译与链接 翻译环境和执行环境翻译环境1.1预编译1.2编译1.3汇编&#xff08;ASM&#xff09;2.链接 执行环境最后给大家附上一张关于本节知识内容的图供大家更好理解~ ![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/522d488885ba44d99aa504d6b21c88d5.png) &…

【FastAPI】路径参数(二)

预设值 如果你有一个接收路径参数的路径操作&#xff0c;但你希望预先设定可能的有效参数值&#xff0c;则可以使用标准的 Python Enum 类型。 导入 Enum 并创建一个继承自 str 和 Enum 的子类。通过从 str 继承&#xff0c;API 文档将能够知道这些值必须为 string 类型并且能…

交友系统程序开发,前后端源码交付,允许二开,UI配色新颖,APP小程序H5随心搭配!

在开发设计与测试阶段&#xff0c;主要包括了程序开发、测试和上线运营等环节。根据产品经理确定的功能需求&#xff0c;开发团队开始进行具体的编程和开发工作。这个过程中需要考虑到不同设备、不同系统和不同版本的需求&#xff0c;确保软件可以在不同平台上稳定运行。 测试是…

WiNGPT2突破:国产140亿参数医疗AI模型

模型介绍 WiNGPT2是基于GPT架构开发的医疗垂直领域大模型&#xff0c;其主要目标是将医学知识、医疗信息和数据进行深度融合&#xff0c;以提供智能化的医疗服务。该模型拥有70亿和140亿两种参数规模的版本&#xff0c;使其能够处理更复杂的医疗场景和需求。 Huggingface模型下…

【Docker】Docker基础教程

&#x1f996;我是Sam9029&#xff0c;一个前端 &#x1f431;‍&#x1f409;&#x1f431;‍&#x1f409;恭喜你&#xff0c;若此文你认为写的不错&#xff0c;不要吝啬你的赞扬&#xff0c;求收藏&#xff0c;求评论&#xff0c;求一个大大的赞&#xff01;&#x1f44d; 基…

嵌入式学习-网络编程-Day4

思维导图 广播通信模型 #include <myhead.h> int main(int argc, char const *argv[]) {int rfd socket(AF_INET,SOCK_DGRAM,0);if(rfd-1){perror("socket error");return -1;}//填充地址信息结构体struct sockaddr_in rin;rin.sin_familyAF_INET;rin.sin_por…

2024年甘肃省职业院校技能大赛信息安全管理与评估 样题一 模块二

竞赛需要完成三个阶段的任务&#xff0c;分别完成三个模块&#xff0c;总分共计 1000分。三个模块内容和分值分别是&#xff1a; 1.第一阶段&#xff1a;模块一 网络平台搭建与设备安全防护&#xff08;180 分钟&#xff0c;300 分&#xff09;。 2.第二阶段&#xff1a;模块二…

安泰功率信号源设计方法有哪些

在电子系统中&#xff0c;功率信号源是一个关键的组成部分&#xff0c;用于提供稳定、可靠的电能。这篇文章将详细介绍功率信号源的设计方法&#xff0c;包括选择功率源类型、设计电源拓扑结构、提高效率和管理电磁干扰等方面。 1.功率源类型的选择 选择适当的功率源类型是功率…

MSSQL-识别扩展extended event(扩展事件)中的时间单位

经常使用sqlserver extended event(扩展事件)&#xff0c;但是总是忘记扩展事件使用的时间单位&#xff0c;不确定它们是 秒、毫秒、还是微秒&#xff1f; 以下下代码能够从 相关DMV中提取description字段内容来识别时间单位&#xff1a; SELECT [p].[name] [package_name],[o…

07. 面向对象编程(一)

目录 1、前言 2、类和对象 2.1、定义类 2.2、定义方法 2.3、创建对象 2.4、访问控制 2.4.1、公共变量 2.4.2、私有变量 2.4.3、保护成员 2.4.4、总结 3、封装 4、继承 5、多态 6、小结 1、前言 在Python中&#xff0c;面向对象编程&#xff08;Object-Oriented …

vuex的初步使用-1

1. 介绍 Vuex 是一个 Vue 的 状态管理工具&#xff0c;状态就是数据。 简单讲&#xff1a;Vuex 就是一个插件&#xff0c;可以帮我们管理 Vue 通用的数据 (多组件共享的数据)。相对于一个仓库&#xff1a;存放组件共享的数据。 2. 安装 vuex 安装vuex与vue-router类似&…

基于Mapbox的Mvt矢量瓦片集成实践

目录 前言 一、数据说明 1、基本数据 2、属性数据 二、Mapbox集成Mvt矢量瓦片 1、关于访问令牌 2、定义html 3、初始地图 4、加载矢量瓦片 5、效果展示 总结 前言 熟悉矢量瓦片的朋友一定知道&#xff0c;在Webgis当中&#xff0c;矢量瓦片的格式除了pbf的格式&#x…

docker:环境安装

系列文章目录 docker&#xff1a;环境安装 文章目录 系列文章目录前言一、Debian安装1.镜像下载2.VM安装3.Debian安装 二、docker安装1.Debian12换源2.docker安装3.docker测试4.docker换源 总结 前言 因为CentOS7确定停服时间为6月30日&#xff0c;虽然对我这种小虾米没啥影响…

dubbox框架

1、dubbox介绍 Dubbo(读音[ˈdʌbəʊ])是阿里巴巴公司开源的一个基于Java的高性能RPC&#xff08;Remote Procedure Call&#xff09;框架&#xff0c;使得应用可通过高性能的 RPC 实现服务的输出和输入功能&#xff0c;可以和 Spring框架无缝集成。后期阿里巴巴停止了该项目…