public override void ElementAttributeChanged(ElementAttributeChangedEventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } SimpleDecoratorMapping.UpdateDecoratorsFromObjectModel(e.ModelElement, e.MetaAttribute.Id); //if (e.MetaAttribute.Id == ISpySoft.SFSchemaLanguage.DomainModel.Artifact.TypeMetaAttributeGuid) //{ // foreach (ISpySoft.SFSchemaLanguage.Designer.ArtifactShape afs in e.ModelElement.AssociatedPresentationElements) // { // foreach (System.ComponentModel.PropertyDescriptor property in e.ModelElement.GetProperties()) // { // if (property.Name == "Type" && (ISpySoft.SFSchemaLanguage.DomainModel.ArtifactType)property.GetValue(property) == ISpySoft.SFSchemaLanguage.DomainModel.ArtifactType.Asset) // { // afs.FillColor = System.Drawing.Color.Lime; // } // if (property.Name == "Type" && (ISpySoft.SFSchemaLanguage.DomainModel.ArtifactType)property.GetValue(property) == ISpySoft.SFSchemaLanguage.DomainModel.ArtifactType.Tool) // { // afs.FillColor = System.Drawing.Color.Red; // } // if (property.Name == "Type" && (ISpySoft.SFSchemaLanguage.DomainModel.ArtifactType)property.GetValue(property) == ISpySoft.SFSchemaLanguage.DomainModel.ArtifactType.WorkProduct) // { // afs.FillColor = System.Drawing.Color.Green; // } // // } // } //} }
public override void ElementAttributeChanged(ElementAttributeChangedEventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } SimpleDecoratorMapping.UpdateDecoratorsFromObjectModel(e.ModelElement, e.MetaAttribute.Id); }
public override void ElementAttributeChanged(ElementAttributeChangedEventArgs e) { // only respond to bounds changes if (e.MetaAttribute.Id == NodeShape.AbsoluteBoundsMetaAttributeGuid) { // get the NodeShape reference to work with. NodeShape thisShape = e.ModelElement as NodeShape; if (thisShape != null && thisShape.Diagram != null && thisShape != thisShape.Diagram) { SelectedShapesCollection selection = thisShape.Diagram.ActiveDiagramView.Selection; // make sure the specified shape is in the selection because we only want // the selected shapes to move their connected shapes (not continously // ripple this effect). if (selection != null && selection.Contains(new DiagramItem(thisShape)) == true) { // calculate the change in bounds position. RectangleD oldBounds = (RectangleD)e.OldValue; RectangleD newBounds = (RectangleD)e.NewValue; double deltaX = newBounds.X - oldBounds.X; double deltaY = newBounds.Y - oldBounds.Y; // find all of the connected shapes. List <Shape> connectedShapes = GetConnectedShapes(thisShape); foreach (Shape shape in connectedShapes) { // make sure the shape isn't in the selection, // because those will be on their own as part of drag-drop. if (selection.Contains(new DiagramItem(shape)) == false) { PointD currentLocation = shape.Location; shape.Location = new PointD(currentLocation.X + deltaX, currentLocation.Y + deltaY); } } } } } }