예제 #1
0
        public DPGeometryModel3D GetSimplifiedGeometryModel3D(double unitSize)
        {
            var meshGeometry3D = MeshRefactor.GetSimplifiedMeshGeometry3D(MeshGeometry, unitSize);

            if (meshGeometry3D == null || meshGeometry3D.TriangleIndices == null || !meshGeometry3D.TriangleIndices.Any())
            {
                return(null);
            }

            var ret = new DPGeometryModel3D();

            ret.MeshGeometry      = meshGeometry3D;
            ret.MaterialColor     = MaterialColor;
            ret.BackMaterialColor = BackMaterialColor;
            return(ret);
        }
예제 #2
0
        private DPGeometryModel3D LoadGeometryModel3D(XmlTextReader reader)
        {
            try
            {
                if (!MoveToNextNode(reader, XmlNodeType.Element, "GeometryModel3D"))
                {
                    return(null);
                }

                var ret = new DPGeometryModel3D();

                if (!reader.IsEmptyElement)
                {
                    while (MoveToNextElement(reader))
                    {
                        if (reader.NodeType == XmlNodeType.EndElement)
                        {
                            break;
                        }

                        if (!reader.IsEmptyElement)
                        {
                            if (reader.Name == "GeometryModel3D.Geometry")
                            {
                                ret.MeshGeometry = LoadMeshGeometry3D(reader);
                            }
                            else if (reader.Name == "GeometryModel3D.Material")
                            {
                                ret.MaterialColor = LoadMaterialColor(reader);
                            }
                            else if (reader.Name == "GeometryModel3D.BackMaterial")
                            {
                                ret.BackMaterialColor = LoadMaterialColor(reader);
                            }

                            MoveToNextNode(reader, XmlNodeType.EndElement);
                        }
                    }
                }
                return(ret);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }