• 使用ArcEngine创建Multipatch图形


    C#

    3D multipatch examples

    PurposeThis sample shows how various multipatch geometries can be programmatically constructed—alone, from a single patch (TriangleStrip, TriangleFan, Triangles, and Ring examples), from a series of Rings (RingGroup examples), through the assistance of the Vector3D class (Vector3D examples), via extrusion of base 2D geometries (Extrusion examples), and from multiple patches of varying types (Composite examples). A few examples have also been provided illustrating how these geometries can be rotated, scaled, and repositioned via the ITransform3D interface.该示例展示了multipatch是可以通过编程的方式创建的,从单个patch[面片](TriangleStrip三角形条带,TriangleFan三角形扇形、Triangles三角形、和Ring环状),从一系列的Rings环(RingGroup环组例子),通过Vector3D类的帮助,通过基本2D几何体的拉伸(拉伸示例),以及来自不同类型的多个面片组合。此外,还提供了几个例子,展示这些几何图形是可以通过ITransform3d接口进行旋转、缩放和重定位的。
     
    By studying these examples, a user can gain insight into the types of shapes the multipatch geometry type can encompass and identify cases where it is appropriate to use, to model 3D entities in a geographic information system (GIS).通过研究这些示例,用户可以深入了解multipatch几何图形类型可以包含的形状类型,并确定适合用于在地理信息系统(GIS)中建模三维实体的情况。

    Development licensingDeployment licensing
    Engine Developer Kit ArcView: 3D Analyst
      ArcEditor: 3D Analyst
      ArcInfo: 3D Analyst
      Engine Runtime: 3D

    How to use

    See Using the samples for help on compiling, setting up the debugger, and running the sample (either an exe or dll).

    Running the sample
      1. Open Visual Studio's integrated development environment (IDE).
      2. Click Debug and click Start Debugging, or compile the sample and run the created .exe.

    Using the sample
      1. When the sample starts, you will see x,y,z axes rendered in an embedded SceneControl and buttons on the right side of the form.当示例开始时,您将看到嵌入SceneControl中呈现的x、y、z轴以及窗体右侧的按钮。
      2. Click a button on the right side of the Windows form's user interface (UI) to render the selected example in the embedded SceneControl with the x,y,z axes (left in place to clarify where the multipatch is positioned in 3D space). The geometry is rendered with a solid fill color and the outline that makes up the multipatch geometry is rendered for illustrative purposes.单击Windows窗体用户界面(UI)右侧的按钮,以在嵌入的SceneControl中使用x、y、z轴呈现所选示例(左对齐以明确多批次在三维空间中的位置)。几何体使用实心填充颜色渲染,构成多批次几何体的轮廓渲染用于说明目的。
      3. The header for the sections of buttons indicates the type of geometry that is rendered, and each of the numbered buttons corresponds to a different example of that type of geometry. For example, clicking the 1 button on the Composite section displays two cylinders and two pyramids. Clicking the 3 button on the Composite section results in the house shown in the following illustration. Each click clears the screen allowing the just clicked item to appear.按钮部分的标题指示渲染的几何体类型,每个编号的按钮对应于该类型几何体的不同示例。例如,单击“组合”部分上的1按钮将显示两个圆柱体和两个棱锥体。单击组合截面上的3按钮将生成下图所示的房子。每次单击都会清除屏幕,使刚刚单击的项目显示出来。
      4. To rotate the displayed multipatch, click and drag on the SceneControl. Move left and right to move around in the same horizontal plane, and move the mouse up and down to rotate vertically.要旋转显示的多批次,请单击并拖动SceneControl。左右移动可在同一水平面内移动,上下移动鼠标可垂直旋转。
      5. To zoom out, right-click and hold down the mouse button while moving the mouse away from you.要缩小,请右键单击并按住鼠标键,同时将鼠标移离您。
      6. To zoom in, righ-click and hold down the mouse button while moving the mouse towards you.要放大,右键单击并按住鼠标键,同时向您移动鼠标。

    Illustration showing multipatch example UI after adding geometries.

    Additional information

    If you are working in a 2D environment, the code to create the multipatch items are the same. Write your class to draw them, as the one used in this example draws in 3D. If you are working in 2D with these multipoint items, no extension (neither 3D Analyst for ArcView, ArcEditor, and ArcGIS Desktop, nor 3D for ArcGIS Engine) is required. 

    VB

        Public Function CreateSimpleBoreHoleSurface(pTopCentre As IPoint, pBottomCentre As IPoint, pRadius As Double) As IMultiPatch
            'pTopCentre 为顶面中心点 ,pBottomCentre 为底面中心点 ,pRadius 为钻孔半径
            Dim pPatchs As IMultiPatch
            Dim pGCol As IGeometryCollection
            Dim pZAware As IZAware
            Dim pStrip As IPointCollection
            Dim pPnt As IPoint
            Dim pX As Double, pY As Double
            Dim i As Long
            'Dim pPnts As ITriangleStrip
            pPatchs = New MultiPatch
            pZAware = pPatchs
            pZAware.ZAware = True
            pGCol = pPatchs
            'pPnts = New TriangleStrip
            pStrip = New TriangleStrip
            For i = 0 To 12
            '计算顶面点坐标
                pPnt = New Point
                pX = pTopCentre.X + pRadius * Cos(i * 30 * PI / 180)
                pY = pTopCentre.Y + pRadius * Sin(i * 30 * PI / 180)
                '建立顶面点
                pPnt = New Point
                pPnt.PutCoords(pX, pY)
                pPnt.Z = pTopCentre.Z
                '把顶面点加入三角形带中
                pStrip.AddPoint(pPnt)
    
                '计算底面点坐标
                pPnt = New Point
                pX = pBottomCentre.X + pRadius * Cos(i * 30 * PI / 180)
                pY = pBottomCentre.Y + pRadius * Sin(i * 30 * PI / 180)
    
                '建立底面点
                pPnt = New Point
                pPnt.PutCoords(pX, pY)
                pPnt.Z = pBottomCentre.Z
                '把底面点加入三角形带中
                pStrip.AddPoint(pPnt)
            Next i
    
            '把三角形带加入到元素集合中
            pGCol.AddGeometry(pStrip)
            CreateSimpleBoreHoleSurface = pPatchs
        End Function

    >>二维geodatabase数据存储,三维显示

    >>可不可以把创建的Multipatch图元保存到multipatch图层呢?https://www.doc88.com/p-5814402346230.html

    >>Multipatch类与geometry类的关系

  • 相关阅读:
    SDOI2016游戏
    李超线段树
    SDOI2016数字配对
    SDOI2016储能表
    ! JOISC2020DAY3星座3
    JOISC2020DAY2有趣的 Joitter 交友
    第十天学习内容 函数
    第九天学习内容 结构体
    第八天学习内容 集合
    第七天学习内容 数组
  • 原文地址:https://www.cnblogs.com/2008nmj/p/14322237.html
Copyright © 2020-2023  润新知