Exemple #1
0
        public static IEnumerable <ProjectedEntity> ProjectTo2D(Drawing drawing, ViewPort viewPort, double width, double height, ProjectionStyle projectionStyle)
        {
            // create transform
            var transform = viewPort.GetProjectionMatrix(width, height, projectionStyle);

            // project all entities
            var entities = new List <ProjectedEntity>();

            foreach (var layer in from l in drawing.GetLayers()
                     where l.EntityCount > 0
                     orderby l.Name
                     select l)
            {
                foreach (var entity in layer.GetEntities().OrderBy(x => x.Id))
                {
                    var projected = Project(entity, layer, transform);
                    if (projected != null)
                    {
                        entities.Add(projected);
                    }
                }
            }

            return(entities);
        }