当前位置: 首页>>代码示例>>C#>>正文


C# Common.DebugFormat方法代码示例

本文整理汇总了C#中Common.DebugFormat方法的典型用法代码示例。如果您正苦于以下问题:C# Common.DebugFormat方法的具体用法?C# Common.DebugFormat怎么用?C# Common.DebugFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Common的用法示例。


在下文中一共展示了Common.DebugFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildGlobalScene

        /// <summary>
        /// This function builds a scene of all IfcProducts in the model, excluding the geometry of Openings
        /// It will create a scene database, overwriting any of the same name
        /// </summary>
        /// <param name="model">Model containing the model entities</param>
        /// <param name="sceneDbName">Name of scene DB file</param>
        /// <param name="Logger">Logging engine for detailed feedback</param>
        public void BuildGlobalScene(XbimModel model, string sceneDbName, Common.Logging.ILogger Logger = null)
        {
            if (File.Exists(sceneDbName)) 
                File.Delete(sceneDbName);


            //get a connection
            using (var db = new XbimSqliteDB(sceneDbName))
            {
                try
                {
                    short spaceId = IfcMetaData.IfcTypeId(typeof(IfcSpace));
                    XbimGeometryHandleCollection handles = new XbimGeometryHandleCollection(model.GetGeometryHandles()
                                                               .Exclude(IfcEntityNameEnum.IFCFEATUREELEMENT));
                    XbimRect3D modelBounds = XbimRect3D.Empty;
                    XbimColourMap cmap = new XbimColourMap();
                    int layerid = 1;
                    IfcProject project = model.IfcProject;
                    int projectId = 0;
                    if (project != null) projectId = Math.Abs(project.EntityLabel);
                    
                    float mScalingReference = (float)model.ModelFactors.OneMetre;

                    if (Logger != null)
                        Logger.DebugFormat("XbimScene: Scaling reference {0}\r\n", mScalingReference);

                    XbimMatrix3D translate = XbimMatrix3D.Identity;
                    XbimMatrix3D scale = XbimMatrix3D.CreateScale(1 / mScalingReference);
                    XbimMatrix3D composed = translate * scale;
                    XbimGeometryData regionData = model.GetGeometryData(projectId, XbimGeometryType.Region).FirstOrDefault(); //get the region data should only be one
                    if (regionData != null)
                    {
                        // this results in centering the most populated area of the model
                        //
                        XbimRegionCollection regions = XbimRegionCollection.FromArray(regionData.ShapeData);
                        XbimRegion largest = regions.MostPopulated();
                        if (largest != null)
                        {
                            translate = XbimMatrix3D.CreateTranslation(
                                -largest.Centre.X,
                                -largest.Centre.Y,
                                -largest.Centre.Z
                                );
                        }
                        composed = translate * scale;

                        // store region information in Scene
                        if ((Options & GenerateSceneOption.IncludeRegions) == GenerateSceneOption.IncludeRegions)
                        {
                            if (Logger != null)
                                Logger.DebugFormat("XbimScene: Exporting regions.\r\n", mScalingReference);
                            foreach (var item in regions)
                            {
                                // the bounding box needs to be moved/scaled by the transform.
                                //
                                XbimRect3D transformed = item.ToXbimRect3D().Transform(composed);
                                db.AddMetaData(
                                        "Region",
                                        -1,
                                        string.Format("Name:{0};Box:{1};", item.Name, transformed.ToString()), // verbose, but only a few items are expected in the model
                                        item.Name
                                        );
                    }
                        }
                    }

                    if ((Options & GenerateSceneOption.IncludeTransform) == GenerateSceneOption.IncludeTransform)
                    {
                        if (Logger != null)
                            Logger.DebugFormat("XbimScene: Exporting transform.\r\n", mScalingReference);
                        db.AddMetaData(
                                "Transform",
                                -1,
                                composed.ToArray(false),
                                "World"
                                );
                        db.Flush();
                    }

                    if (Logger != null)
                        Logger.DebugFormat("XbimScene: Exporting layers.\r\n", mScalingReference);
                    foreach (var layerContent in handles.GroupByBuildingElementTypes())
                    {
                        string elementTypeName = layerContent.Key;
                        XbimGeometryHandleCollection layerHandles = layerContent.Value;
                        IEnumerable<XbimGeometryData> geomColl = model.GetGeometryData(layerHandles);
                        XbimColour colour = cmap[elementTypeName];
                        XbimMeshLayer<XbimMeshGeometry3D, XbimRenderMaterial> layer = new XbimMeshLayer<XbimMeshGeometry3D, XbimRenderMaterial>(model, colour) { Name = elementTypeName };
                        //add all content initially into the hidden field
                        foreach (var geomData in geomColl)
                        {
                            geomData.TransformBy(composed);
                            if (geomData.IfcTypeId == spaceId)
//.........这里部分代码省略.........
开发者ID:bnaand,项目名称:xBim-Toolkit,代码行数:101,代码来源:XbimSceneBuilder.cs


注:本文中的Common.DebugFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。