示例#1
0
        private static InsertTransform <T> Flatten <T>(Insert insert, InsertTransform <T> inner, netDxf.Units.DrawingUnits baseUnits) where T : netDxf.DxfObject
        {
            var blockRecordUnits = insert.Block.Record.Units;
            var unitFactorScale  = (float)netDxf.Units.UnitHelper.ConversionFactor(blockRecordUnits, baseUnits);
            var scale            = insert.Scale.ToGeometryVector();
            var pos = insert.Position.ToGeometryVector();

            return(new InsertTransform <T>()
            {
                Value = inner.Value,
                Transform = v => (inner.Transform(v) * scale * unitFactorScale) + pos,
                Debug_TransformStr = string.Format("(({0}) * s{1} * {3}) + p{2}", inner.Debug_TransformStr, scale, pos, unitFactorScale),
                InsertLevels = new Insert[] { insert }.Concat(inner.InsertLevels).ToList(),
                Inner = inner,
            });
        }
示例#2
0
        private static Geometry.Bounds GetBounds <T>(InsertTransform <T> x) where T : DxfObject
        {
            var b = GetBounds(x.Value);

            return(new Geometry.Bounds(x.Transform(b.Min), x.Transform(b.Max)));
        }
示例#3
0
 private static float GetFontHeight <T>(InsertTransform <T> x, float fontHeight) where T : DxfObject => Math.Abs((x.Transform(new System.Numerics.Vector2(0, 1)).Y - x.Transform(new System.Numerics.Vector2(0, 0)).Y) * fontHeight);