Point3DCollection 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示 Point3D 对象的有序集合。
public ref class Point3DCollection sealed : System::Windows::Freezable, IFormattable, System::Collections::Generic::ICollection<System::Windows::Media::Media3D::Point3D>, System::Collections::Generic::IEnumerable<System::Windows::Media::Media3D::Point3D>, System::Collections::Generic::IList<System::Windows::Media::Media3D::Point3D>, System::Collections::IList
[System.ComponentModel.TypeConverter(typeof(System.Windows.Media.Media3D.Point3DCollectionConverter))]
public sealed class Point3DCollection : System.Windows.Freezable, IFormattable, System.Collections.Generic.ICollection<System.Windows.Media.Media3D.Point3D>, System.Collections.Generic.IEnumerable<System.Windows.Media.Media3D.Point3D>, System.Collections.Generic.IList<System.Windows.Media.Media3D.Point3D>, System.Collections.IList
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Media.Media3D.Point3DCollectionConverter))>]
type Point3DCollection = class
inherit Freezable
interface IFormattable
interface IList
interface ICollection
interface IList<Point3D>
interface ICollection<Point3D>
interface seq<Point3D>
interface IEnumerable
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Media.Media3D.Point3DCollectionConverter))>]
type Point3DCollection = class
inherit Freezable
interface IFormattable
interface IList
interface ICollection
interface IEnumerable
interface IList<Point3D>
interface ICollection<Point3D>
interface seq<Point3D>
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Media.Media3D.Point3DCollectionConverter))>]
type Point3DCollection = class
inherit Freezable
interface ICollection<Point3D>
interface seq<Point3D>
interface IEnumerable
interface IList<Point3D>
interface ICollection
interface IList
interface IFormattable
Public NotInheritable Class Point3DCollection
Inherits Freezable
Implements ICollection(Of Point3D), IEnumerable(Of Point3D), IFormattable, IList, IList(Of Point3D)
- 继承
- 属性
- 实现
示例
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Media3D;
namespace SDKSample
{
public partial class Basic3DShapeExample : Page
{
public Basic3DShapeExample()
{
// Declare scene objects.
Viewport3D myViewport3D = new Viewport3D();
Model3DGroup myModel3DGroup = new Model3DGroup();
GeometryModel3D myGeometryModel = new GeometryModel3D();
ModelVisual3D myModelVisual3D = new ModelVisual3D();
// Defines the camera used to view the 3D object. In order to view the 3D object,
// the camera must be positioned and pointed such that the object is within view
// of the camera.
PerspectiveCamera myPCamera = new PerspectiveCamera();
// Specify where in the 3D scene the camera is.
myPCamera.Position = new Point3D(0, 0, 2);
// Specify the direction that the camera is pointing.
myPCamera.LookDirection = new Vector3D(0, 0, -1);
// Define camera's horizontal field of view in degrees.
myPCamera.FieldOfView = 60;
// Asign the camera to the viewport
myViewport3D.Camera = myPCamera;
// Define the lights cast in the scene. Without light, the 3D object cannot
// be seen. Note: to illuminate an object from additional directions, create
// additional lights.
DirectionalLight myDirectionalLight = new DirectionalLight();
myDirectionalLight.Color = Colors.White;
myDirectionalLight.Direction = new Vector3D(-0.61, -0.5, -0.61);
myModel3DGroup.Children.Add(myDirectionalLight);
// The geometry specifes the shape of the 3D plane. In this sample, a flat sheet
// is created.
MeshGeometry3D myMeshGeometry3D = new MeshGeometry3D();
// Create a collection of normal vectors for the MeshGeometry3D.
Vector3DCollection myNormalCollection = new Vector3DCollection();
myNormalCollection.Add(new Vector3D(0,0,1));
myNormalCollection.Add(new Vector3D(0,0,1));
myNormalCollection.Add(new Vector3D(0,0,1));
myNormalCollection.Add(new Vector3D(0,0,1));
myNormalCollection.Add(new Vector3D(0,0,1));
myNormalCollection.Add(new Vector3D(0,0,1));
myMeshGeometry3D.Normals = myNormalCollection;
// Create a collection of vertex positions for the MeshGeometry3D.
Point3DCollection myPositionCollection = new Point3DCollection();
myPositionCollection.Add(new Point3D(-0.5, -0.5, 0.5));
myPositionCollection.Add(new Point3D(0.5, -0.5, 0.5));
myPositionCollection.Add(new Point3D(0.5, 0.5, 0.5));
myPositionCollection.Add(new Point3D(0.5, 0.5, 0.5));
myPositionCollection.Add(new Point3D(-0.5, 0.5, 0.5));
myPositionCollection.Add(new Point3D(-0.5, -0.5, 0.5));
myMeshGeometry3D.Positions = myPositionCollection;
// Create a collection of texture coordinates for the MeshGeometry3D.
PointCollection myTextureCoordinatesCollection = new PointCollection();
myTextureCoordinatesCollection.Add(new Point(0, 0));
myTextureCoordinatesCollection.Add(new Point(1, 0));
myTextureCoordinatesCollection.Add(new Point(1, 1));
myTextureCoordinatesCollection.Add(new Point(1, 1));
myTextureCoordinatesCollection.Add(new Point(0, 1));
myTextureCoordinatesCollection.Add(new Point(0, 0));
myMeshGeometry3D.TextureCoordinates = myTextureCoordinatesCollection;
// Create a collection of triangle indices for the MeshGeometry3D.
Int32Collection myTriangleIndicesCollection = new Int32Collection();
myTriangleIndicesCollection.Add(0);
myTriangleIndicesCollection.Add(1);
myTriangleIndicesCollection.Add(2);
myTriangleIndicesCollection.Add(3);
myTriangleIndicesCollection.Add(4);
myTriangleIndicesCollection.Add(5);
myMeshGeometry3D.TriangleIndices = myTriangleIndicesCollection;
// Apply the mesh to the geometry model.
myGeometryModel.Geometry = myMeshGeometry3D;
// The material specifies the material applied to the 3D object. In this sample a
// linear gradient covers the surface of the 3D object.
// Create a horizontal linear gradient with four stops.
LinearGradientBrush myHorizontalGradient = new LinearGradientBrush();
myHorizontalGradient.StartPoint = new Point(0, 0.5);
myHorizontalGradient.EndPoint = new Point(1, 0.5);
myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.Yellow, 0.0));
myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.Red, 0.25));
myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.Blue, 0.75));
myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.LimeGreen, 1.0));
// Define material and apply to the mesh geometries.
DiffuseMaterial myMaterial = new DiffuseMaterial(myHorizontalGradient);
myGeometryModel.Material = myMaterial;
// Apply a transform to the object. In this sample, a rotation transform is applied,
// rendering the 3D object rotated.
RotateTransform3D myRotateTransform3D = new RotateTransform3D();
AxisAngleRotation3D myAxisAngleRotation3d = new AxisAngleRotation3D();
myAxisAngleRotation3d.Axis = new Vector3D(0,3,0);
myAxisAngleRotation3d.Angle = 40;
myRotateTransform3D.Rotation = myAxisAngleRotation3d;
myGeometryModel.Transform = myRotateTransform3D;
// Add the geometry model to the model group.
myModel3DGroup.Children.Add(myGeometryModel);
// Add the group of models to the ModelVisual3d.
myModelVisual3D.Content = myModel3DGroup;
//
myViewport3D.Children.Add(myModelVisual3D);
// Apply the viewport to the page so it will be rendered.
this.Content = myViewport3D;
}
}
}
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Media
Imports System.Windows.Media.Media3D
Namespace SDKSample
Partial Public Class Basic3DShapeExample
Inherits Page
Public Sub New()
' Declare scene objects.
Dim myViewport3D As New Viewport3D()
Dim myModel3DGroup As New Model3DGroup()
Dim myGeometryModel As New GeometryModel3D()
Dim myModelVisual3D As New ModelVisual3D()
' Defines the camera used to view the 3D object. In order to view the 3D object,
' the camera must be positioned and pointed such that the object is within view
' of the camera.
Dim myPCamera As New PerspectiveCamera()
' Specify where in the 3D scene the camera is.
myPCamera.Position = New Point3D(0, 0, 2)
' Specify the direction that the camera is pointing.
myPCamera.LookDirection = New Vector3D(0, 0, -1)
' Define camera's horizontal field of view in degrees.
myPCamera.FieldOfView = 60
' Asign the camera to the viewport
myViewport3D.Camera = myPCamera
' Define the lights cast in the scene. Without light, the 3D object cannot
' be seen. Note: to illuminate an object from additional directions, create
' additional lights.
Dim myDirectionalLight As New DirectionalLight()
myDirectionalLight.Color = Colors.White
myDirectionalLight.Direction = New Vector3D(-0.61, -0.5, -0.61)
myModel3DGroup.Children.Add(myDirectionalLight)
' The geometry specifes the shape of the 3D plane. In this sample, a flat sheet
' is created.
Dim myMeshGeometry3D As New MeshGeometry3D()
' Create a collection of normal vectors for the MeshGeometry3D.
Dim myNormalCollection As New Vector3DCollection()
myNormalCollection.Add(New Vector3D(0,0,1))
myNormalCollection.Add(New Vector3D(0,0,1))
myNormalCollection.Add(New Vector3D(0,0,1))
myNormalCollection.Add(New Vector3D(0,0,1))
myNormalCollection.Add(New Vector3D(0,0,1))
myNormalCollection.Add(New Vector3D(0,0,1))
myMeshGeometry3D.Normals = myNormalCollection
' Create a collection of vertex positions for the MeshGeometry3D.
Dim myPositionCollection As New Point3DCollection()
myPositionCollection.Add(New Point3D(-0.5, -0.5, 0.5))
myPositionCollection.Add(New Point3D(0.5, -0.5, 0.5))
myPositionCollection.Add(New Point3D(0.5, 0.5, 0.5))
myPositionCollection.Add(New Point3D(0.5, 0.5, 0.5))
myPositionCollection.Add(New Point3D(-0.5, 0.5, 0.5))
myPositionCollection.Add(New Point3D(-0.5, -0.5, 0.5))
myMeshGeometry3D.Positions = myPositionCollection
' Create a collection of texture coordinates for the MeshGeometry3D.
Dim myTextureCoordinatesCollection As New PointCollection()
myTextureCoordinatesCollection.Add(New Point(0, 0))
myTextureCoordinatesCollection.Add(New Point(1, 0))
myTextureCoordinatesCollection.Add(New Point(1, 1))
myTextureCoordinatesCollection.Add(New Point(1, 1))
myTextureCoordinatesCollection.Add(New Point(0, 1))
myTextureCoordinatesCollection.Add(New Point(0, 0))
myMeshGeometry3D.TextureCoordinates = myTextureCoordinatesCollection
' Create a collection of triangle indices for the MeshGeometry3D.
Dim myTriangleIndicesCollection As New Int32Collection()
myTriangleIndicesCollection.Add(0)
myTriangleIndicesCollection.Add(1)
myTriangleIndicesCollection.Add(2)
myTriangleIndicesCollection.Add(3)
myTriangleIndicesCollection.Add(4)
myTriangleIndicesCollection.Add(5)
myMeshGeometry3D.TriangleIndices = myTriangleIndicesCollection
' Apply the mesh to the geometry model.
myGeometryModel.Geometry = myMeshGeometry3D
' The material specifies the material applied to the 3D object. In this sample a
' linear gradient covers the surface of the 3D object.
' Create a horizontal linear gradient with four stops.
Dim myHorizontalGradient As New LinearGradientBrush()
myHorizontalGradient.StartPoint = New Point(0, 0.5)
myHorizontalGradient.EndPoint = New Point(1, 0.5)
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Yellow, 0.0))
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Red, 0.25))
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Blue, 0.75))
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.LimeGreen, 1.0))
' Define material and apply to the mesh geometries.
Dim myMaterial As New DiffuseMaterial(myHorizontalGradient)
myGeometryModel.Material = myMaterial
' Apply a transform to the object. In this sample, a rotation transform is applied,
' rendering the 3D object rotated.
Dim myRotateTransform3D As New RotateTransform3D()
Dim myAxisAngleRotation3d As New AxisAngleRotation3D()
myAxisAngleRotation3d.Axis = New Vector3D(0,3,0)
myAxisAngleRotation3d.Angle = 40
myRotateTransform3D.Rotation = myAxisAngleRotation3d
myGeometryModel.Transform = myRotateTransform3D
' Add the geometry model to the model group.
myModel3DGroup.Children.Add(myGeometryModel)
' Add the group of models to the ModelVisual3d.
myModelVisual3D.Content = myModel3DGroup
'
myViewport3D.Children.Add(myModelVisual3D)
' Apply the viewport to the page so it will be rendered.
Me.Content = myViewport3D
End Sub
End Class
End Namespace
注解
XAML 属性用法
<object property="oneOrMorePoint3Ds"/>
XAML 隐式集合用法
<object>
<object.property>
oneOrMorePoint3DObjectElements
</object.property>
</object>
XAML 值
oneOrMorePoint3D 一个或多个 Point3D 结构,每个值集用逗号和/或一个或多个空格分隔。
例如,"0,0,5 100,100,125 200,100,30"
和 "0,0,5,100,100,125,200,100,30"
都是有效的。
oneOrMorePointObjectElements 使用对象元素语法声明的一个或多个 Point3D 对象。
构造函数
Point3DCollection() |
初始化 Point3DCollection 类的新实例。 |
Point3DCollection(IEnumerable<Point3D>) |
使用指定的集合初始化 Point3DCollection 类的新实例。 |
Point3DCollection(Int32) |
使用指定的容量初始化 Point3DCollection 类的新实例。 |
属性
CanFreeze |
获取一个值,该值指示是否可以使对象不可修改。 (继承自 Freezable) |
Count |
获取 Point3DCollection中包含的 Point3D 对象数。 |
DependencyObjectType |
获取包装此实例的 CLR 类型的 DependencyObjectType。 (继承自 DependencyObject) |
Dispatcher |
获取与此 DispatcherObject 关联的 Dispatcher。 (继承自 DispatcherObject) |
IsFrozen |
获取一个值,该值指示对象当前是否可修改。 (继承自 Freezable) |
IsSealed |
获取一个值,该值指示此实例当前是否密封(只读)。 (继承自 DependencyObject) |
Item[Int32] |
获取或设置指定从零开始的索引处的 Point3D。 |
方法
事件
Changed |
在修改 Freezable 或其包含的对象时发生。 (继承自 Freezable) |
显式接口实现
ICollection.CopyTo(Array, Int32) |
有关此成员的说明,请参阅 CopyTo(Array, Int32)。 |
ICollection.IsSynchronized |
有关此成员的说明,请参阅 IsSynchronized。 |
ICollection.SyncRoot |
有关此成员的说明,请参阅 SyncRoot。 |
ICollection<Point3D>.IsReadOnly |
有关此成员的说明,请参阅 IsReadOnly。 |
IEnumerable.GetEnumerator() |
有关此成员的说明,请参阅 GetEnumerator()。 |
IEnumerable<Point3D>.GetEnumerator() |
有关此成员的说明,请参阅 GetEnumerator()。 |
IFormattable.ToString(String, IFormatProvider) |
有关此成员的说明,请参阅 ToString(String, IFormatProvider)。 |
IList.Add(Object) |
有关此成员的说明,请参阅 Add(Object)。 |
IList.Contains(Object) |
有关此成员的说明,请参阅 Contains(Object)。 |
IList.IndexOf(Object) |
有关此成员的说明,请参阅 IndexOf(Object)。 |
IList.Insert(Int32, Object) |
有关此成员的说明,请参阅 Insert(Int32, Object)。 |
IList.IsFixedSize |
有关此成员的说明,请参阅 IsFixedSize。 |
IList.IsReadOnly |
有关此成员的说明,请参阅 IsReadOnly。 |
IList.Item[Int32] |
有关此成员的说明,请参阅 Item[Int32]。 |
IList.Remove(Object) |
有关此成员的说明,请参阅 Remove(Object)。 |