Пример #1
0
        public override IGraphCloneable Clone(CloneContext cloneContext)
        {
            DxfAttribute dxfAttribute = (DxfAttribute)cloneContext.GetExistingClone((IGraphCloneable)this);

            if (dxfAttribute == null)
            {
                dxfAttribute = new DxfAttribute();
                cloneContext.RegisterClone((IGraphCloneable)this, (IGraphCloneable)dxfAttribute);
                dxfAttribute.CopyFrom((DxfHandledObject)this, cloneContext);
            }
            return((IGraphCloneable)dxfAttribute);
        }
Пример #2
0
 public void Draw(DxfAttribute attribute)
 {
     if (!this.bool_1)
     {
         return;
     }
     if (this.graphicElementInsert_0.AttributeBlock == null)
     {
         this.graphicElementInsert_0.AttributeBlock = new GraphicElementBlock1(this.surface_1.Layer.Color, this.surface_1.ByBlockColor)
         {
             Transform = Matrix4D.Identity
         }
     }
     ;
     attribute.Draw(this.surface_1, this.graphics_0, (IGraphicElementBlock)this.graphicElementInsert_0.AttributeBlock);
 }
Пример #3
0
        public void ApplyInsertionPointOffsetToAttributes()
        {
            Vector3D insertionPoint = (Vector3D)this.insertionPoint;

            foreach (DxfAttribute dxfAttribute1 in (DxfHandledObjectCollection <DxfAttribute>) this.activeDxfHandledObjectCollection_0)
            {
                DxfAttribute dxfAttribute2 = dxfAttribute1;
                dxfAttribute2.AlignmentPoint1 = dxfAttribute2.AlignmentPoint1 + insertionPoint;
                if (dxfAttribute1.AlignmentPoint2.HasValue)
                {
                    DxfAttribute    dxfAttribute3   = dxfAttribute1;
                    WW.Math.Point3D?alignmentPoint2 = dxfAttribute3.AlignmentPoint2;
                    Vector3D        vector3D        = insertionPoint;
                    dxfAttribute3.AlignmentPoint2 = alignmentPoint2.HasValue ? new WW.Math.Point3D?(alignmentPoint2.GetValueOrDefault() + vector3D) : new WW.Math.Point3D?();
                }
            }
        }
Пример #4
0
        internal void method_0(
            DxfTableContent tableContent,
            double width,
            double height,
            double rotation,
            double horizontalMargin,
            double verticalMargin)
        {
            DxfBlock valueObject = this.ValueObject as DxfBlock;

            if (valueObject == null)
            {
                this.dxfContentFormat_0.method_6(1.0);
            }
            else
            {
                DxfInsert dxfInsert = new DxfInsert(valueObject);
                foreach (DxfTableAttribute dxfTableAttribute in (List <DxfTableAttribute>) this.dxfTableAttributeCollection_0)
                {
                    if (dxfTableAttribute.AttributeDefinition != null)
                    {
                        DxfAttribute dxfAttribute1 = new DxfAttribute(dxfTableAttribute.AttributeDefinition);
                        dxfAttribute1.Text = dxfTableAttribute.Value;
                        DxfAttribute dxfAttribute2 = dxfAttribute1;
                        dxfAttribute2.AlignmentPoint1 = dxfAttribute2.AlignmentPoint1 - valueObject.BasePoint;
                        if (dxfAttribute1.AlignmentPoint2.HasValue)
                        {
                            DxfAttribute     dxfAttribute3   = dxfAttribute1;
                            WW.Math.Point3D? alignmentPoint2 = dxfAttribute3.AlignmentPoint2;
                            WW.Math.Vector3D basePoint       = valueObject.BasePoint;
                            dxfAttribute3.AlignmentPoint2 = alignmentPoint2.HasValue ? new WW.Math.Point3D?(alignmentPoint2.GetValueOrDefault() - basePoint) : new WW.Math.Point3D?();
                        }
                    }
                }
                BoundsCalculator boundsCalculator = new BoundsCalculator();
                boundsCalculator.GetBounds(tableContent.Model, (DxfEntity)dxfInsert);
                Bounds3D bounds    = boundsCalculator.Bounds;
                Matrix4D transform = Transformation4D.Translation(valueObject.BasePoint) * Transformation4D.RotateZ(rotation) * Transformation4D.Translation(-valueObject.BasePoint);
                bounds.Transform(transform);
                Vector2D vector2D = new Vector2D((width - 2.0 * horizontalMargin) / bounds.Delta.X, (height - 2.0 * verticalMargin) / bounds.Delta.Y);
                this.dxfContentFormat_0.BlockScale = System.Math.Min(vector2D.X, vector2D.Y);
            }
        }
Пример #5
0
        public DxfAttribute AddAttribute(DxfAttributeDefinition attdef, string text)
        {
            DxfAttribute dxfAttribute = new DxfAttribute(attdef, text);

            this.Attributes.Add(dxfAttribute);
            if (dxfAttribute.Model == null)
            {
                try
                {
                    dxfAttribute.Style = attdef.Style;
                }
                catch (NullReferenceException ex)
                {
                    throw new DxfException("Cannot create attribute from attribute definition which is not attached to a model!\nDid you already add the attribute definition to a block and the block to the model's Blocks?");
                }
            }
            WW.Math.Vector3D vector3D = this.Block != null ? this.Block.BasePoint : WW.Math.Vector3D.Zero;
            dxfAttribute.FixAlignmentPoints();
            dxfAttribute.TransformMe((TransformConfig)GraphicsConfig.WhiteBackground, this.BasicBlockInsertionTransformation * Transformation4D.Translation(-vector3D));
            return(dxfAttribute);
        }
Пример #6
0
        internal Bounds3D method_1(DxfTable table)
        {
            DxfBlock valueObject = this.ValueObject as DxfBlock;

            if (valueObject == null)
            {
                return((Bounds3D)null);
            }
            DxfInsert dxfInsert = new DxfInsert(valueObject);

            foreach (DxfTableAttribute dxfTableAttribute in (List <DxfTableAttribute>) this.dxfTableAttributeCollection_0)
            {
                if (dxfTableAttribute.AttributeDefinition != null)
                {
                    DxfAttribute dxfAttribute1 = new DxfAttribute(dxfTableAttribute.AttributeDefinition);
                    dxfAttribute1.Text = dxfTableAttribute.Value;
                    DxfAttribute dxfAttribute2 = dxfAttribute1;
                    dxfAttribute2.AlignmentPoint1 = dxfAttribute2.AlignmentPoint1 - valueObject.BasePoint;
                    if (dxfAttribute1.AlignmentPoint2.HasValue)
                    {
                        DxfAttribute     dxfAttribute3   = dxfAttribute1;
                        WW.Math.Point3D? alignmentPoint2 = dxfAttribute3.AlignmentPoint2;
                        WW.Math.Vector3D basePoint       = valueObject.BasePoint;
                        dxfAttribute3.AlignmentPoint2 = alignmentPoint2.HasValue ? new WW.Math.Point3D?(alignmentPoint2.GetValueOrDefault() - basePoint) : new WW.Math.Point3D?();
                    }
                }
            }
            BoundsCalculator boundsCalculator = new BoundsCalculator();

            boundsCalculator.GetBounds(table.Content.Model, (DxfEntity)dxfInsert);
            Bounds3D bounds    = boundsCalculator.Bounds;
            Matrix4D transform = Transformation4D.Translation(valueObject.BasePoint) * Transformation4D.RotateZ(this.dxfContentFormat_0.Rotation) * Transformation4D.Translation(-valueObject.BasePoint);

            bounds.Transform(transform);
            return(bounds);
        }
Пример #7
0
 public virtual void Visit(DxfAttribute attribute)
 {
 }
Пример #8
0
 private void method_15(object sender, int index, DxfAttribute item)
 {
     item.vmethod_2((IDxfHandledObject)this);
 }
Пример #9
0
 private void method_14(object sender, int index, DxfAttribute oldItem, DxfAttribute newItem)
 {
     oldItem.vmethod_2((IDxfHandledObject)null);
     newItem.vmethod_2((IDxfHandledObject)this);
 }
Пример #10
0
 public void Draw(DxfAttribute attribute)
 {
     attribute.Draw(this.surface_1, this.isurfaceGraphicsFactory_0);
 }
Пример #11
0
 public void Draw(DxfAttribute attribute)
 {
     attribute.Draw(this.wireframe_1, this.iwireframeGraphicsFactory2_0);
 }
Пример #12
0
 public virtual void Visit(DxfAttribute attribute)
 {
     this.VisitEntity((DxfEntity)attribute);
 }