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 WINAPI
        wndProcProxy(HWND hwnd,
            UINT message,
            WPARAM wparam,
            LPARAM lparam);
​
    LRESULT CALLBACK
        wndProc(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); // Shaded
        selDrawer->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 once
    static 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 positions
        Rect.right - Rect.left, Rect.bottom - Rect.top, // Adjusted width and height
        NULL, 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); // faces
        m_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 creation
    m_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 parameters
    Graphic3d_RenderingParams& RenderParams = m_view->ChangeRenderingParams();
    RenderParams.IsAntialiasingEnabled = true;
    RenderParams.NbMsaaSamples = 8; // Anti-aliasing by multi-sampling
    RenderParams.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 pair
            m_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 position
        CURSORINFO 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 state
                pos.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 windows
            break;
        }
​
        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 RTTI
    DEFINE_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 Event
    virtual 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、编译运行

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

各省快递量数据, shp+excel,2001-2021年,已实现数据可视化

基本信息. 数据名称: 各省快递量数据 数据格式: shpexcel 数据时间&#xff1a;2001-2021年 数据几何类型: 面 数据坐标系: WGS84 数据来源&#xff1a;网络公开数据 数据字段&#xff1a; 序号字段名称字段说明1a_2001快递量/万件_2001年2a_2002快递量/万件_2002年3…

热压机PLC数据采集远程监控物联网解决方案

热压机PLC数据采集远程监控物联网解决方案 随着工业4.0时代的到来&#xff0c;智能制造已经成为制造业发展的重要方向。在热压机领域&#xff0c;PLC数据采集远程监控物联网解决方案为提高生产效率、降低维护成本、优化生产工艺提供了有效的手段。 一、热压机PLC数据采集远程…

一文带你揭秘淘宝终端技术

作者&#xff1a;周杰&#xff08;寻弦&#xff09; 在这个数字化迅速发展的时代&#xff0c;技术的每一次飞跃都不仅仅意味着一个产品的升级&#xff0c;更是对未来世界的一次大胆想象。从 PC 到 iPhone&#xff0c;从 Model 3 到 ChatGPT&#xff0c;都引领了全新的一个行业。…

Linux miniGUI移植分析

框架介绍 常用GUI程序对比 https://www.cnblogs.com/zyly/p/17378659.html MiniGUI分为底层的GAL&#xff08;图形抽象层&#xff09;和IAL&#xff08;输入抽象层&#xff09;&#xff0c;向上为基于标准POSIX接口中pthread库的Mini-Thread架构和基于Server/Client的Mini-L…

护眼灯有没有护眼的效果啊?有效果的护眼灯推荐

近几年&#xff0c;青少年近视人数呈现猛增的势头&#xff0c;且低龄化趋势也越来越明显&#xff0c;社会各界开始重视对青少年视力问题的关注。伤害视力的原因有很多种&#xff0c;其中没有良好的光线条件是问题之一&#xff0c;当使用的台灯不合格&#xff0c;频闪与蓝光问题…

渗透测试(12)- WireShark 网络数据包分析

目录 1、WireShack 简介 2、WireShark 基本使用方法 3、 WireShack 抓包分析 3.1 Hypertext Transfer Protocol (应用层) 3.2 Transmission Control Protocol (传输层) 3.3 Internet Protocol Version 4(网络层) 3.4 Ethernet Il (链路层): 数据链路层以太网头部信息 …

ZooKeeper 实战(五) Curator实现分布式锁

文章目录 ZooKeeper 实战(五) Curator实现分布式锁1.简介1.1.分布式锁概念1.2.Curator 分布式锁的实现方式1.3.分布式锁接口 2.准备工作3.分布式可重入锁3.1.锁对象3.2.非重入式抢占锁测试代码输出日志 3.3.重入式抢占锁测试代码输出日志 4.分布式非可重入锁4.1.锁对象4.2.重入…

数据结构之串|数组|广义表

串 数组 广义表 总结&#xff1a;

【JS逆向学习】1号店

逆向目标 接口&#xff1a;https://passport.yhd.com/publicPassport/login.do加密参数&#xff1a; credentials.usernamecredentials.password 逆向过程 老规矩&#xff0c;输入用户名和密码&#xff0c;点击登录&#xff0c;然后过滤 XHR 请求 进入 Initiator 随便找个…

计算机毕业设计------SSH新闻资讯网站管理系统

项目介绍 该系统分成两个项目&#xff0c;前台项目与后台项目&#xff0c;需要分别运行&#xff1b; 后台管理员角色包含以下功能&#xff1a; 管理员登录,新闻专题类别管理,友情链接管理,广告管理,新闻列表管理,管理员管理,信息修改等功能。 前台用户角色包含以下功能&#…

逸学Docker【java工程师基础】1.认识docker并且安装

场景问题 在实际开发过程中我们有这样的场景问题 在开发阶段的环境配置到了其他人项目人员那里就不能运行了&#xff0c;尽管配置规格相同&#xff0c;但是在较多的不同的环境情况下还是可能会有错误。 开发&#xff1a;程序员&#xff1a;你那边可以运行了吗 测试&#xf…

JUC的常见类

目录 Callable ReentrantLock Semaphore CountDownLatch JUC即 java.util.concurrent&#xff0c;其中存放了一些进行多线程编程时有用的类 Callable Callable是一个接口&#xff0c;在我们实现Runnable创建线程时&#xff0c;Runnable关注的是其过程&#xff0c;而不关注…

【1】SM4 CBC-MAC 机制

0x01 题目 MSG1: e55e3e24a3ae7797808fdca05a16ac15eb5fa2e6185c23a814a35ba32b4637c2 MAC1: 0712c867aa6ec7c1bb2b66312367b2c8 ----------------------------------------------------- MSG2: d8d94f33797e1f41cab9217793b2d0f02b93d46c2ead104dce4bfec453767719 MAC2: 4366…

【CF闯关练习】—— 1400分(C. Make Good、B. Applejack and Storages)

&#x1f30f;博客主页&#xff1a;PH_modest的博客主页 &#x1f6a9;当前专栏&#xff1a;cf闯关练习 &#x1f48c;其他专栏&#xff1a; &#x1f534;每日一题 &#x1f7e1; C跬步积累 &#x1f7e2; C语言跬步积累 &#x1f308;座右铭&#xff1a;广积粮&#xff0c;缓…

016-Vue-黑马2023:前后端分离开发(在线接口文档),前端工程化、Element、nginx

第三节 前后端分离开发 1、介绍 开发模式 前后端混合开发&#xff1a;传统开发模式 前后端分离开发&#xff1a;当前最为主流的开发模式 页面原型需求案例&#xff1a;分析出接口文档 离线开发文档示例&#xff1a; 2、YAPI&#xff08;官网已停用&#xff09; 202…

【工作记录】基于springboot3+springsecurity6实现多种登录方式(一)

前言 springboot3已经推出有一段时间了&#xff0c;近期公司里面的小项目使用的都是springboot3版本的&#xff0c;安全框架还是以springsecurity为主&#xff0c;毕竟亲生的。 本文针对基于springboot3和springsecurity实现用户登录认证访问以及异常处理做个记录总结&#x…

NVMe-oF RDMA vs. TCP延时测试对比:端到端SPDK的意义

前不久看到一篇《NVIDIA BlueField 再创 DPU 性能世界纪录》的新闻&#xff0c;该测试环境是2台服务器&#xff0c;每台各安装2块NVIDIA Bluefield-2 DPU&#xff0c;形成4条100GbE以太网直连&#xff0c;两端分别跑NVMe-oF Target&#xff08;存储目标&#xff09;和Initiator…

Spring IoC 和 DI

文章目录 1. 什么是 Spring2. 什么是 IoC3. 什么是 DI4. IoC & DI 使用5. 获取 Bean 的方式5.1 根据类型获取 bean5.2 根据名称获取 bean5.3 获取bean对象的其他方式5.4 五大注解的关联 6. 方法注解7. 扫描路径8. Bean 的名称9. DI 详解9.1 属性注入9.2 构造方法注入9.3 Se…

残差网络 ResNet

目录 1.1 ResNet 2.代码实现 1.1 ResNet 如上图函数的大小代表函数的复杂程度&#xff0c;星星代表最优解&#xff0c;可见加了更多层之后的预测比小模型的预测离真实最优解更远了&#xff0c; ResNet做的事情就是使得模型加深一定会使效果变好而不是变差。 2.代码实现 impo…

【OpenAI】自定义GPTs应用(GPT助手应用)及外部API接口请求

11月10日&#xff0c;OpenAI正式宣布向所有ChatGPT Plus用户开放GPTs功能 简而言之&#xff1a;GPT应用市场(简称GPTs, 全称GPT Store) Ps&#xff1a; 上图为首次进入时的页面&#xff0c;第一部分是自己创建的GPTs应用&#xff0c;下面是公开可以使用的GPTs应用 一、创建GPTs…