示例#1
0
 public void DecomposeAll()
 {
     for (int i = list.Count - 1; i >= 0; --i)
     {
         if (this[i] is Block)
         {
             Block blk = this[i] as Block;
             Remove(i);
             for (int j = 0; j < blk.Count; ++j)
             {
                 blk.Child(j).PropagateAttributes(blk.Layer, blk.ColorDef);
                 AddDecomposed(blk.Child(j), true, true, true);
             }
         }
         if (this[i] is BlockRef)
         {
             BlockRef blk = this[i] as BlockRef;
             Remove(i);
             AddDecomposed(blk.Flattened, true, true, true);
         }
         if (this[i] is Path || this[i] is Polyline)
         {
             IGeoObject go = this[i];
             Remove(i);
             AddDecomposed(go, true, true, true);
         }
     }
 }
示例#2
0
 public void DecomposeBlocks(bool decomposeHatch)
 {
     for (int i = list.Count - 1; i >= 0; --i)
     {
         if (this[i] is Block && !(!decomposeHatch && this[i] is Hatch))
         {
             if (this[i] is Hatch)
             {
                 Hatch hatch = (this[i] as Hatch);
                 hatch.ConditionalRecalc();
             }
             Block blk = this[i] as Block;
             Remove(i);
             for (int j = 0; j < blk.Count; ++j)
             {
                 AddDecomposed(blk.Child(j), decomposeHatch, false, false);
             }
         }
         if (this[i] is BlockRef)
         {
             BlockRef blk = this[i] as BlockRef;
             Remove(i);
             AddDecomposed(blk.Flattened, decomposeHatch, false, false);
         }
     }
 }
示例#3
0
 public ShowPropertyBlockRef(BlockRef theBlockRef, IFrame theFrame)
 {
     blockRef            = theBlockRef;
     frame               = theFrame;
     resourceId          = "BlockRef.Object";
     attributeProperties = blockRef.GetAttributeProperties(frame);
 }
示例#4
0
        /// <summary>
        /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.Clone ()"/>
        /// </summary>
        /// <returns></returns>
        public override IGeoObject Clone()
        {
            BlockRef result = Construct(idea);

            result.Insertion = insertion;
            result.CopyAttributes(this);
            return(result);
        }
示例#5
0
 /// <summary>
 /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.CopyGeometry (IGeoObject)"/>
 /// </summary>
 /// <param name="ToCopyFrom"></param>
 public override void CopyGeometry(IGeoObject ToCopyFrom)
 {
     using (new Changing(this))
     {
         BlockRef CopyFromBlockRef = (BlockRef)ToCopyFrom;
         idea      = CopyFromBlockRef.idea;
         insertion = CopyFromBlockRef.Insertion;
         if (flattened != null)
         {
             flattened.Target = null;
         }
         extent = null;
     }
 }
示例#6
0
 private void AddPrimitiveToBlock(Block addTo, Layer layer, ColorDef colorDef, ModOp mod, IGeoObject toAdd)
 {
     if (toAdd is BlockRef)
     {
         BlockRef br = (toAdd as BlockRef);
         AddPrimitiveToBlock(addTo, br.Layer, br.ColorDef, mod * br.insertion, br.idea);
     }
     else if (toAdd is Hatch && toAdd.NumChildren == 0)
     {                                     // sonst kann man in ERSACAD nicht per drag and drop verschieben
         IGeoObject clone = toAdd.Clone(); // das ist ja jetzt ein Primitives
         if (clone is ILayer)
         {
             if (clone.Layer == null)
             {
                 clone.Layer = layer;
             }
         }
         if (clone is IColorDef)
         {
             if ((clone as IColorDef).ColorDef == null)
             {
                 (clone as IColorDef).ColorDef = colorDef;
             }
         }
         clone.Modify(mod);
         addTo.Add(clone);
     }
     else if (toAdd is Block)
     {
         Block    blk = (toAdd as Block);
         Layer    l   = blk.Layer;
         ColorDef c   = blk.ColorDef;
         if (l == null)
         {
             l = layer;
         }
         if (c == null)
         {
             c = colorDef;
         }
         for (int i = 0; i < blk.Children.Count; i++)
         {
             AddPrimitiveToBlock(addTo, l, c, mod, blk.Child(i));
         }
     }
     else
     {
         IGeoObject clone = toAdd.Clone(); // das ist ja jetzt ein Primitives
         if (clone is ILayer)
         {
             if (clone.Layer == null)
             {
                 clone.Layer = layer;
             }
         }
         if (clone is IColorDef)
         {
             if ((clone as IColorDef).ColorDef == null)
             {
                 (clone as IColorDef).ColorDef = colorDef;
             }
         }
         clone.Modify(mod);
         addTo.Add(clone);
     }
 }