Esempio n. 1
0
        public static DisplayModel Convert(gbXML model)
        {
            if (model is null)
            {
                return(null);
            }

            var campus   = ModelQuery.GetCampusFromModel(model);
            var building = ModelQuery.GetBuildingFromCampus(campus);
            var spaces   = ModelQuery.GetSpacesFromBuilding(building);

            var displayModel = new DisplayModel();

            displayModel.Spaces.AddRange(spaces.Select(ConvertSpace));
            displayModel.Floors.AddRange(DisplayModelQuery.CreateFloors(displayModel));

            return(displayModel);
        }
Esempio n. 2
0
        private static ViewModel.Space ConvertSpace(Model.Space space)
        {
            Debug.Assert(space != null);

            var result = new ViewModel.Space
            {
                Name = ModelQuery.GetSpaceName(space)
            };

            var shellGeometry = ModelQuery.GetShellGeometryFromSpace(space);
            var closedShell   = ModelQuery.GetClosedShellFromShellGeometry(shellGeometry);
            var polyloops     = closedShell?.Items;
            var polygons      = polyloops.Select(ConvertPolygon);

            // only need to display the floor
            result.Polygons.AddRange(DisplayModelQuery.GetFloorPolygons(polygons));

            return(result);
        }