Esempio n. 1
0
        private void addCadObject(CadObject cadObject)
        {
            if (cadObject.Document != null)
            {
                //Avoid exception if the element is assign to this document
                //TODO: AddCadObject: Not very elegant or reilable, check the integrity of this approax
                //if (cadObject.Document == this && this._cadObjects.ContainsKey(cadObject.Handle))
                //	return;

                throw new ArgumentException($"The item with handle {cadObject.Handle} is already assigned to a document");
            }

            cadObject.Document = this;

            if (cadObject.Handle == 0 || this._cadObjects.ContainsKey(cadObject.Handle))
            {
                cadObject.Handle = this._cadObjects.Keys.Max() + 1;
            }

            this._cadObjects.Add(cadObject.Handle, cadObject);
            cadObject.OnReferenceChange += this.onReferenceChanged;

            //TODO: Add the dictionary
            if (cadObject.XDictionary != null)
            {
                this.RegisterCollection(cadObject.XDictionary);
            }

            switch (cadObject)
            {
            case BlockRecord record:
                this.RegisterCollection(record.Entities);
                this.addCadObject(record.BlockEnd);
                this.addCadObject(record.BlockEntity);
                break;
            }
        }
Esempio n. 2
0
 public CadObjectCollection(CadObject owner)
 {
     this.Owner = owner;
 }
Esempio n. 3
0
 public ReferenceChangedEventArgs(CadObject item)
 {
     this.Item = item;
 }