3DTools/MeshUtils.cs

(开头部分) 13KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

//---------------------------------------------------------------------------
//
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Limited Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/limitedpermissivelicense.mspx
// All other rights reserved.
//
// This file is part of the 3D Tools for Windows Presentation Foundation
// project.  For more information, see:
// 
// http://CodePlex.com/Wiki/View.aspx?ProjectName=3DTools
//
//---------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Media3D;

namespace _3DTools
{
    #region Mesh IValueConverters

    /// <summary>
    ///     Abstract base class for all type converters that have a MeshGeometry3D source
    /// </summary>
    public abstract class MeshConverter<TargetType> : IValueConverter
    {
        public MeshConverter()
        {
        }

        /// <summary>
        ///     IValueConverter.Convert
        /// </summary>
        /// <param name="value">The binding source (should be a MeshGeometry3D)</param>
        /// <param name="targetType">The binding target</param>
        /// <param name="parameter">Optionaly parameter to the converter</param>
        /// <param name="culture">(ignored)</param>
        /// <returns>The converted value</returns>
        object IValueConverter.Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return DependencyProperty.UnsetValue;
            }

            if (targetType != typeof(TargetType))
            {
                throw new ArgumentException(String.Format("MeshConverter must target a {0}", typeof(TargetType).Name));
            }

            MeshGeometry3D mesh = value as MeshGeometry3D;
            if (mesh == null)
            {
                throw new ArgumentException("MeshConverter can only convert from a MeshGeometry3D");
            }
后面还有 310 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。