/// <summary> /// Adds a regular multi-edged polygon on board /// </summary> /// <param name="region">region of the polygon</param> /// <param name="penColor">Color of the pen</param> /// <param name="fillColor">Fill color</param> /// <param name="penWidth">Width of the pen</param> /// <param name="isFilled">Is pentagon filled</param> /// <param name="points">Points of the polygon</param> public void AddRegularPolygon(Region region, Color penColor, Color fillColor, float penWidth, bool isFilled, List <PointF> points) { region.FixSize(MinimumSize); this.DeSelect(); Polygon regularPolygon = new Polygon(); regularPolygon.Region = region; regularPolygon.PenColor = penColor; regularPolygon.PenWidth = penWidth; regularPolygon.FillColor = fillColor; regularPolygon.FillEnabled = isFilled; regularPolygon.Curved = false; regularPolygon.Closed = true; regularPolygon.FixedCorners = true; List <PointElement> pointElementList = new List <PointElement>(); foreach (PointF point in points) { pointElementList.Add(new PointElement(point)); } regularPolygon.points = pointElementList; this.shapes.Add(regularPolygon); StoreInBuffer(BufferOperation.Insert, regularPolygon); handlerCol = new ShapeHandlerCollection(regularPolygon); this.selectedElement = regularPolygon; this.selectedElement.Select(); }
/// <summary> /// DeSerializes single shape element /// </summary> /// <param name="xmlContent">XML content to be deserialized</param> public void DeSerializeXMLSelected(string xmlContent) { YAXSerializer serializer = new YAXSerializer(typeof(ShapeElement)); this.selectedElement = serializer.Deserialize(xmlContent) as ShapeElement; this.shapes.Add(this.selectedElement); }
/// <summary> /// Stores element in the undo/redo buffer /// </summary> /// <param name="operation">Operation that will be save for the element</param> /// <param name="element">Element to be buffered</param> public void StoreInBuffer(BufferOperation operation, ShapeElement element) { UndoElement UndoElement = new UndoElement(element, operation); this.undoManager.AddItem(UndoElement); element.UndoShape = element.Copy(); }
/// <summary> /// Selects last shape containing point(x,y) /// </summary> /// <param name="x">X region on coordinate system</param> /// <param name="y">Y region on coordinate system</param> public void Click(int x, int y) { handlerCol = null; selectedElement = null; foreach (ShapeElement element in this.shapes) { element.Selected = false; element.DeSelect(); if (element.Contains(x, y)) { selectedElement = element; } } if (selectedElement != null) { selectedElement.Selected = true; selectedElement.Select(); if (selectedElement is Polygon) { handlerCol = new PolygonHandlerCollection(selectedElement); } else { handlerCol = new ShapeHandlerCollection(selectedElement); } } }
/// <summary> /// Updates the selection during FixUpDiagram. Default behavior is to select /// the newChildShape on the active diagram view if there is one, or on all /// views if there is no active view. /// </summary> /// <param name="newChildShape">The new child shape that is added by FixUpDiagram</param> /// <returns> /// A non-null list of DiagramClientViews that had their selection modified. /// </returns> public override IList FixUpDiagramSelection(ShapeElement newChildShape) { if (this.Diagram.Store.TransactionManager.CurrentTransaction.IsSerializing) { return base.FixUpDiagramSelection(newChildShape); } Guard.NotNull(() => newChildShape, newChildShape); if (!newChildShape.CanSelect || newChildShape is LinkShape) { return new ArrayList(0); } var list = new ArrayList(); var activeDiagramView = this.ActiveDiagramView; var clientView = (activeDiagramView != null) ? activeDiagramView.DiagramClientView : null; if (clientView != null) { clientView.Selection.DeferredClearBeforeAdditions(); clientView.Selection.DeferredAdd(new DiagramItem(newChildShape)); list.Add(clientView); } return list; }
public override RectangleD GetCompliantBounds(ShapeElement shape, RectangleD proposedBounds) { if (shape.Store.InSerializationTransaction) return proposedBounds; double width = 0.83675; double height = 0.83675; if (shape is StartableShape || shape is BatchWaitShape || shape is DatabaseBatchWaitShape) { width = 1.243; height = 0.84025; } else if (shape is WorkflowRuleShape) { width = 1.2395; height = 0.84025; } var activityShape = shape as BaseActivityShape; if (activityShape == null) return proposedBounds; var approvedBounds = new RectangleD(); approvedBounds.Location = proposedBounds.Location; // But the height and width are constrained: approvedBounds.Height = height; approvedBounds.Width = width; return approvedBounds; }
/// <summary> /// Create a connection between an ExternalConstraintShape and a FactType. Roles /// used in the connection are stored with the currently active connect action. /// </summary> /// <param name="sourceShapeElement">The source of the requested connection</param> /// <param name="targetShapeElement">The target of the requested connection</param> /// <param name="paintFeedbackArgs">PaintFeedbackArgs</param> public override void CreateConnection(ShapeElement sourceShapeElement, ShapeElement targetShapeElement, PaintFeedbackArgs paintFeedbackArgs) { ORMDiagram diagram = (ORMDiagram)sourceShapeElement.Diagram; RoleConnectAction action = diagram.RoleConnectAction; ObjectType objectType; RoleBase sourceRole = action.mySourceRole; RoleBase roleBase; RoleBase targetRole; FactTypeShape factTypeShape; if (sourceRole != null && sourceShapeElement == targetShapeElement && null != (targetRole = action.myLastMouseMoveRole) && targetRole != sourceRole && null != (factTypeShape = sourceShapeElement as FactTypeShape)) { LinkedElementCollection <RoleBase> displayedRoles = factTypeShape.GetEditableDisplayRoleOrder(); displayedRoles.Move(displayedRoles.IndexOf(sourceRole), displayedRoles.IndexOf(targetRole)); } else if ((null != (roleBase = sourceRole) && null != (objectType = ObjectTypeFromShape(targetShapeElement))) || (null != (objectType = action.mySourceObjectType) && null != (roleBase = action.myLastMouseMoveRole))) { // Don't trigger a change if none is indicated. Turn this into a noop Role role = roleBase.Role; if (role.RolePlayer != objectType) { role.RolePlayer = objectType; } } else if (targetShapeElement == diagram && action.mySourceRoleMissingConnector) { diagram.PlaceORMElementOnDiagram(null, roleBase.Role.RolePlayer, paintFeedbackArgs.TargetFeedbackBounds.Location, ORMPlacementOption.AllowMultipleShapes, null, null); } }
/// <summary> /// Arranges the shapes. /// </summary> public void ArrangeShapes() { List <ShapeElement> externalComponents = new List <ShapeElement>(); List <ShapeElement> component = new List <ShapeElement>(); foreach (PresentationElement elem in this.NestedChildShapes) { ShapeElement shape = elem as ShapeElement; if (shape == null) { continue; } if (shape.ModelElement is SoftwareComponent) { component.Add(shape); } else { externalComponents.Add(shape); } } PointD startPoint = new PointD(0.1, 0.1); if (component.Count > 0) { ShapeHelper.ArrangeChildShapes(this, component, 0, 1, startPoint, 0.2, 0); startPoint = new PointD(component[0].AbsoluteBoundingBox.Right + 0.4, component[0].AbsoluteBoundingBox.Location.Y); } ShapeHelper.ArrangeChildShapes(this, externalComponents, 0, 1, startPoint, 0, 0.4); }
// set clip to make sure child shapes will not overlap parent shape public override void OnPaintShape(DiagramPaintEventArgs e) { ShapeElement parentShape = this.ParentShape; if (parentShape == null || (parentShape is Diagram)) { base.OnPaintShape(e); return; } RectangleD thisRect = this.AbsoluteBoundingBox; thisRect.Inflate(new SizeD(this.OutlinePenWidth, this.OutlinePenWidth)); while (parentShape != null && !(parentShape is Diagram)) { RectangleD clipRect = parentShape.AbsoluteBoundingBox; clipRect.Inflate(new SizeD(-parentShape.OutlinePenWidth, -parentShape.OutlinePenWidth)); thisRect.Intersect(clipRect); parentShape = parentShape.ParentShape; } Region clip = e.Graphics.Clip; e.Graphics.SetClip(RectangleD.ToRectangleF(thisRect), CombineMode.Intersect); base.OnPaintShape(e); e.Graphics.Clip = clip; }
/// <summary> /// If a new child shape was not placed, then defer to /// PlaceAsChildOf on the child. Note that AutoResize /// has not been called on the child prior to this call. /// </summary> /// <param name="child">A new child shape element</param> /// <param name="childWasPlaced">false if the child element was not previously placed.</param> /// <param name="createdDuringViewFixup">Whether this shape was created as part of a view fixup</param> protected override void OnChildConfigured(ShapeElement child, bool childWasPlaced, bool createdDuringViewFixup) { // Don't check childWasPlaced here during drag-drop. In this case, // childWasPlace will be true if the parent shape was placed, so is // only relevant for our code base for the top-level shapes, in which // case the OnChildConfigured for the dropped shape is called on the // diagram, not a base shape. Any derived shape that allows placed // drag from the toolbox (etc) onto child shapes (which none of // the shapes in ORMShapeDomainModel allow), then childWasPlaced should // be tested. if (childWasPlaced) { Transaction transaction = Store.TransactionManager.CurrentTransaction.TopLevelTransaction; if (transaction != null && (DropTargetContext.HasDropTargetContext(transaction) || transaction.Context.ContextInfo.ContainsKey(ORMBaseShape.PlaceAllChildShapes))) { childWasPlaced = false; } } if (!childWasPlaced) { ORMBaseShape baseShape; if (null != (baseShape = child as ORMBaseShape)) { baseShape.PlaceAsChildOf(this, createdDuringViewFixup); } } }
static partial void onBindShapeFields(object sender, EventArgs e) { ShapeElement shape = (ShapeElement)sender; // header associateProperty(shape, VDHTMLTagShape.FieldName_OpenTag, VDHTMLTag._OpenTagStrDomainPropertyId, Guid.Empty); associateProperty(shape, VDHTMLTagShape.FieldName_Text, VDHTMLTag.TagTextDomainPropertyId, VDHTMLTag._HasTagTextDomainPropertyId, true); associateProperty(shape, VDHTMLTagShape.FieldName_HeaderCloseTag, VDHTMLTag._CloseTagStrDomainPropertyId, VDHTMLTag._IsCloseTagVisibleInHeaderDomainPropertyId, true); // footer associateProperty(shape, VDHTMLTagShape.FieldName_Foot, Guid.Empty, VDHTMLTag._IsCloseTagVisibleInFooterDomainPropertyId, true); associateProperty(shape, VDHTMLTagShape.FieldName_FooterCloseTag, VDHTMLTag._CloseTagStrDomainPropertyId, VDHTMLTag._IsCloseTagVisibleInFooterDomainPropertyId, true); }
/// <summary> /// Gets the selected elements. /// </summary> /// <param name="provider">The provider.</param> /// <returns></returns> public static IList <object> GetSelectedElements(IServiceProvider provider) { ModelingDocView docView = DesignerHelper.GetModelingDocView(provider); if (docView != null) { if (docView.SelectionCount > 0) { IList <object> elements = new List <object>(docView.SelectionCount); foreach (object component in docView.GetSelectedComponents()) { ShapeElement selectedShape = component as ShapeElement; ModelElement selectedElement = component as ModelElement; if (selectedShape != null) { elements.Add(selectedShape.ModelElement); } else if (selectedElement != null) { elements.Add(selectedElement); } } return(elements); } } return(null); }
public static void ShapeAndComplexShape(string unparsed) { Application app = Utilities.ComApp; Point3d[] pntArray = new Point3d[6]; pntArray[0] = app.Point3dFromXY(0, -6); pntArray[1] = app.Point3dFromXY(0, -2); pntArray[2] = app.Point3dFromXY(2, -2); pntArray[3] = app.Point3dFromXY(2, -4); pntArray[4] = app.Point3dFromXY(4, -4); pntArray[5] = app.Point3dFromXY(4, -6); ShapeElement oShape = app.CreateShapeElement1(null, ref pntArray); oShape.Color = 0; oShape.LineWeight = 2; app.ActiveModelReference.AddElement(oShape); ChainableElement[] elmArray = new ChainableElement[2]; for (int i = 0; i < 6; i++) { pntArray[i].X += 5; } elmArray[0] = app.CreateLineElement1(null, ref pntArray); pntArray[2].Y = -8; elmArray[1] = app.CreateArcElement3(null, ref pntArray[5], ref pntArray[2], ref pntArray[0]); ComplexShapeElement oComplexShape = app.CreateComplexShapeElement1(ref elmArray); oComplexShape.Color = 1; oComplexShape.LineWeight = 2; app.ActiveModelReference.AddElement(oComplexShape); }
/// <summary> /// Gets a value indicating whether this <see cref="ICommand"/> is visible. /// </summary> /// <returns></returns> /// <value><c>true</c> if visible; otherwise, <c>false</c>.</value> public bool Visible() { if (_store == null) { return(false); } foreach (object o in _elements) { // Pick out shapes representing Component model elements. ShapeElement element = o as ShapeElement; if (element != null && element.ModelElement != null || o is ModelElement) { ModelElement mel = element != null ? element.ModelElement : o as ModelElement; if (mel is Entity || mel is Operation || mel is Enumeration || mel is ClassImplementation || mel is ServiceContract || mel is Property) { return(true); } } } return(false); }
public override RectangleD GetCompliantBounds(ShapeElement shape, RectangleD proposedBounds) { // base rule proposedBounds = VDDefaultBoundsRules.Instance.GetCompliantBounds(shape, proposedBounds); VDWidgetShape parentShape = shape.ParentShape as VDWidgetShape; VDContainer thisMEL = shape.ModelElement as VDContainer; VDContainerShape thisPEL = shape as VDContainerShape; // if (parentShape != null && thisMEL != null && thisPEL != null) { if (parentShape is VDHoriContainerShape) { // setup left anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasLeftAnchor && !thisPEL.Anchoring.HasLeftAnchor, thisMEL.LeftSibling, AnchoringBehavior.Edge.Left); // setup right anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasRightAnchor && !thisPEL.Anchoring.HasRightAnchor, thisMEL.RightSibling, AnchoringBehavior.Edge.Right); } else if (parentShape is VDVertContainerShape) { // setup top anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasTopAnchor && !thisPEL.Anchoring.HasTopAnchor, thisMEL.TopSibling, AnchoringBehavior.Edge.Top); // setup bottom anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasBottomAnchor && !thisPEL.Anchoring.HasBottomAnchor, thisMEL.BottomSibling, AnchoringBehavior.Edge.Bottom); } else if (!(parentShape is VDFullFilledContainerShape)) { // setup left anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasLeftAnchor && !thisPEL.Anchoring.HasLeftAnchor, thisMEL.LeftSibling, AnchoringBehavior.Edge.Left); // setup right anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasRightAnchor && !thisPEL.Anchoring.HasRightAnchor, thisMEL.RightSibling, AnchoringBehavior.Edge.Right); // setup top anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasTopAnchor && !thisPEL.Anchoring.HasTopAnchor, thisMEL.TopSibling, AnchoringBehavior.Edge.Top); // setup bottom anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasBottomAnchor && !thisPEL.Anchoring.HasBottomAnchor, thisMEL.BottomSibling, AnchoringBehavior.Edge.Bottom); } if (thisMEL is VDHoriContainer && ((VDHoriContainer)thisMEL).FixedHeight > VDConstants.DOUBLE_DIFF) { proposedBounds = new RectangleD(proposedBounds.Location, new SizeD(proposedBounds.Width, ((VDHoriContainer)thisMEL).FixedHeight)); } else if (thisMEL is VDVertContainer && ((VDVertContainer)thisMEL).FixedWidth > VDConstants.DOUBLE_DIFF) { proposedBounds = new RectangleD(proposedBounds.Location, new SizeD(((VDVertContainer)thisMEL).FixedWidth, proposedBounds.Height)); } } return(proposedBounds); }
/// <summary> /// Clean up. /// </summary> protected override void OnDispose() { this.shapeElement = null; this.sufaceDiagram = null; base.OnDispose(); }
/// <summary> /// Replacement helper function for DiagramDocView.CountShapes /// that respects the ISelectionContainerFilter interface /// </summary> /// <param name="parentShapeElement">The parent shape element. /// This is called recursively.</param> /// <returns>The number of selectable shapes</returns> private static uint CountAllShapes(ShapeElement parentShapeElement) { uint total = 0; if (parentShapeElement != null) { if (parentShapeElement.CanSelect) { ISelectionContainerFilter filter; if (null == (filter = parentShapeElement as ISelectionContainerFilter) || filter.IncludeInSelectionContainer) { ++total; } } foreach (ShapeElement nestedShape in parentShapeElement.NestedChildShapes) { total += CountAllShapes(nestedShape); } foreach (ShapeElement relativeShape in parentShapeElement.RelativeChildShapes) { total += CountAllShapes(relativeShape); } } return(total); }
internal static void SelectDiagramItems( this EntityDesignerView.EntityDesignerDiagram entityDesignerDiagram, ShapeElement[] shapeElements) { var diagramItemCollection = new DiagramItemCollection(); foreach (var shapeElement in shapeElements) { diagramItemCollection.Add(new DiagramItem(shapeElement)); } if (entityDesignerDiagram.ActiveDiagramView != null) { entityDesignerDiagram.ActiveDiagramView.Focus(); entityDesignerDiagram.ActiveDiagramView.Selection.Set(diagramItemCollection); entityDesignerDiagram.EnsureSelectionVisible(); } else { // if no active diagram view is available, set the selection in any client view. if (entityDesignerDiagram.ClientViews != null && entityDesignerDiagram.ClientViews.Count > 0) { foreach (DiagramClientView clientView in entityDesignerDiagram.ClientViews) { clientView.Selection.Set(diagramItemCollection); clientView.Selection.EnsureVisible(DiagramClientView.EnsureVisiblePreferences.ScrollIntoViewCenter); break; } } else { throw new InvalidOperationException("There is no active client views in the diagram."); } } }
// The class is double-derived so that we can override this method. // Called once for each class. protected override void InitializeDecorators(IList <ShapeField> shapeFields, IList <Decorator> decorators) { // TODO: Allow user to change text align. // Set up the decorators defined in the DSL Definition: base.InitializeDecorators(shapeFields, decorators); //this.HasShadow = false; // Look up the text decorator, which is called "Comment". TextField commentField = (TextField)ShapeElement.FindShapeField(shapeFields, "Comment"); // This sets the wrapping behavior, but we need a couple of other things too: commentField.DefaultMultipleLine = true; // Autosize is incompatible with multiple line: commentField.DefaultAutoSize = false; //commentField.AllowInPlaceEditorAutoSize(this); // Need to anchor the field sides to the parent box to get sensible size: commentField.AnchoringBehavior.Clear(); commentField.AnchoringBehavior.SetLeftAnchor(AnchoringBehavior.Edge.Left, 0.01); commentField.AnchoringBehavior.SetRightAnchor(AnchoringBehavior.Edge.Right, 0.01); commentField.AnchoringBehavior.SetTopAnchor(AnchoringBehavior.Edge.Top, 0.01); commentField.AnchoringBehavior.SetBottomAnchor(AnchoringBehavior.Edge.Bottom, 0.01); // Note that this method is called just once per class. // commentField is a field definition, attached to the class, not instances. }
/*---------------------------------------------------------------------------------**//** * Create Grouped hole element. * @bsimethod Bentley Systems * /*--------------+---------------+---------------+---------------+---------------+------*/ public static Element CreateElement(DPoint3d start, DPoint3d opposite) { DgnModel model = Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnModel(); //Create Solid shape element from actual start and opposite points. ShapeElement solidShape = CreateShapeElement(model, start, opposite); //Get holes for grouped hole element. ElementAgenda holes; PopulateHolesAgenda(out holes, start, opposite, model); //Create actual grouped hole element with given solid and holes. GroupedHoleElement groupedHoleElement = new GroupedHoleElement(model, solidShape, holes); //Set line color. ElementPropertiesSetter pSetter = new ElementPropertiesSetter(); pSetter.SetColor((uint)Bentley.MstnPlatformNET.Settings.GetActiveColor().Index); pSetter.Apply(groupedHoleElement); //Add fill color. if (PlaceGroupedHoleForm.GetAddFillColor()) { groupedHoleElement.AddSolidFill((uint)Bentley.MstnPlatformNET.Settings.GetActiveFillColor().Index, false); } return(groupedHoleElement); }
public ShapeElement CreateCircle() { float radius = Random.Range(1f, 4f); Vector2 startPoint = new Vector2(0f, radius); var circle = this.lf.Create(startPoint); for (float theta = 0f; theta < 2f * Mathf.PI; theta += 2f * Mathf.PI / 100f) { var x = radius * Mathf.Sin(theta); var y = radius * Mathf.Cos(theta); circle.AddVertex(new Vector2(x, y)); } circle.AddVertex(new Vector2(0f, radius)); circle.SetColor(this.color); circle.SetSize(this.size); var startLine = this.lf.Create(startPoint); if (drawStartPoint) { startLine.SetColor(Color.white); startLine.SetSize(this.size); } ShapeElement shape = new ShapeElement(circle, startLine, Shape.Circle); return(shape); }
/// <summary> /// Gets the selected element. /// </summary> /// <param name="provider">The provider.</param> /// <returns></returns> public static ModelElement GetSelectedElement(IServiceProvider provider) { ModelingDocView docView = DesignerHelper.GetModelingDocView(provider); if (docView != null) { if (docView.SelectionCount == 1) { foreach (object component in docView.GetSelectedComponents()) { ShapeElement selectionShape = component as ShapeElement; ModelElement selectionElement = component as ModelElement; if (selectionShape != null) { return(selectionShape.ModelElement); } else if (selectionElement != null) { return(selectionElement); } } } } return(null); }
/// <summary>Associate shape field's content and visibility with IMS properties</summary> /// <param name="shape">The shape containing the shape field</param> /// <param name="fieldname">Field name</param> /// <param name="valuePropertyId">property to associate with the content of shape field</param> /// <param name="isValuePropertyOfShape">does 'valuePropertyId' belong to a shape object (PEL, not MEL)</param> /// <param name="visibilityPropertyId">property to associate with the visibility of shape field</param> /// <param name="isVisibilityPropOfShape">does 'visibilityPropertyId' belong to a shape object, instead of a MEL</param> /// <param name="visibilityFiltervalues">values to filter the visibility</param> static protected void associateProperty(ShapeElement shape, string fieldname, Guid valuePropertyId, bool isValuePropertyOfShape, /* associate value */ Guid visibilityPropertyId, bool isVisibilityPropOfShape, params object[] visibilityFiltervalues) /* associate visibility*/ { if (valuePropertyId != Guid.Empty) { AssociatedPropertyInfo propertyInfo = new AssociatedPropertyInfo(valuePropertyId); propertyInfo.IsShapeProperty = isValuePropertyOfShape; ShapeElement.FindShapeField(shape.ShapeFields, fieldname).AssociateValueWith(shape.Store, propertyInfo); } if (visibilityPropertyId != Guid.Empty) { AssociatedPropertyInfo propertyInfo = new AssociatedPropertyInfo(visibilityPropertyId); propertyInfo.IsShapeProperty = isVisibilityPropOfShape; if (visibilityFiltervalues != null) { for (int i = 0; i < visibilityFiltervalues.Length; i++) { propertyInfo.FilteringValues.Add(visibilityFiltervalues[i]); } } ShapeElement.FindShapeField(shape.ShapeFields, fieldname).AssociateVisibilityWith(shape.Store, propertyInfo); } }
/// <summary> /// Code that handles retrieval of the text to display in ValueConstraintShape. /// </summary> public sealed override string GetDisplayText(ShapeElement parentShape) { string retval = null; ValueConstraintShape parentValueConstraintShape = parentShape as ValueConstraintShape; if (parentShape is ObjectTypeShape) { LinkedElementCollection <PresentationElement> pelList = PresentationViewsSubject.GetPresentation(parentShape); foreach (ShapeElement pel in pelList) { ValueConstraintShape valueConstraintShape = pel as ValueConstraintShape; if (valueConstraintShape != null) { parentValueConstraintShape = valueConstraintShape; break; } } } if (parentValueConstraintShape == null) { retval = base.GetDisplayText(parentShape); } else { retval = parentValueConstraintShape.DisplayText; } return(retval); }
/// <summary> /// This method will return a DSL ShapeElement for the given efobject. If the given efobject doesn't map to a designer shape, /// then this will look for a designer shape for the object's parent. /// If no designer shape can be found, this will return null. /// </summary> /// <param name="efobject"></param> /// <returns></returns> private static ShapeElement GetDesignerShapeElementForEFObject(EntityDesignerDiagram diagram, EFObject efobject) { ShapeElement shapeElement = null; while (shapeElement == null && efobject != null && ((efobject is ConceptualEntityModel) == false)) { var dslElement = diagram.ModelElement.ModelXRef.GetExisting(efobject); shapeElement = dslElement as ShapeElement; if (shapeElement == null && dslElement != null) { var shapes = PresentationViewsSubject.GetPresentation(dslElement); // just select the first shape for this item if (shapes != null && shapes.Count > 0) { shapeElement = shapes[0] as ShapeElement; } } // walk up the EFObject tree until we find a node that has a ShapeElement. if (shapeElement == null) { efobject = efobject.Parent; } } return(shapeElement); }
public ShapeElement CreateRectangle() { Vector2 A; do { A = GetRandomPointFromActiveArea(); }while ((A.x < 1 && A.x > -1) || (A.y < 1 && A.y > -1) || A.x > 6 || A.x < -6 || (Mathf.Abs(A.x) < Mathf.Abs(A.y) * 1.2f && Mathf.Abs(A.x) > Mathf.Abs(A.y) * 0.8f)); var rectangle = this.lf.Create(A); rectangle.AddVertex(new Vector2(-A.x, A.y)); rectangle.AddVertex(new Vector2(-A.x, -A.y)); rectangle.AddVertex(new Vector2(A.x, -A.y)); rectangle.AddVertex(A); rectangle.SetColor(this.color); rectangle.SetSize(this.size);; var startLine = this.lf.Create(A); if (drawStartPoint) { startLine.SetColor(Color.white); startLine.SetSize(this.size); } ShapeElement shape = new ShapeElement(rectangle, startLine, Shape.Rectangle); return(shape); }
public ShapeElement CreateCurvedLine() { List <Vector2> bezierCurve = this.BezierCurves[Random.Range(0, this.BezierCurves.Count)]; Vector2 q0 = CalculateBezierPoint(0, bezierCurve[0], bezierCurve[1], bezierCurve[2], bezierCurve[3]); // starting point Vector2 q1; // point of current incrementation float t; // time point of current incrementation [0, 1] int increments = 30; // amount of segments needed to draw curved line var curvedLine = this.lf.Create(q0); for (int i = 1; i <= increments; i++) { t = i / (float)increments; q1 = CalculateBezierPoint(t, bezierCurve[0], bezierCurve[1], bezierCurve[2], bezierCurve[3]); curvedLine.AddVertex(q1); } // set color and size of triangle's lines curvedLine.SetColor(this.color); curvedLine.SetSize(this.size); var startLine = this.lf.Create(q0); if (drawStartPoint) { startLine.SetColor(Color.white); startLine.SetSize(this.size); } ShapeElement shape = new ShapeElement(curvedLine, startLine, Shape.CurvedLine); return(shape); }
private string GetPerentSummrytxt(ShapeElement parentShape) { ClrClass class2 = GetClass(parentShape); if (class2 == null) { return(""); } if (class2.Inherits == null) { return(""); } if (class2.Inherits == "Object") { return(""); } if (class2.Parent is ClrNamespace) { foreach (ClrType type in ((ClrNamespace)class2.Parent).ClrClasses) { if (type.AccessibleName == class2.Inherits) { if (string.IsNullOrEmpty(type.DocSummary)) { return(string.Format("¼Ì³Ð:{0}", class2.Inherits)); } return(string.Format("¼Ì³Ð:{0}", type.DocSummary)); } } } return(string.Format("¼Ì³Ð:{0}", class2.Inherits)); }
/// <summary> /// Gets the value. /// </summary> /// <param name="parentShape">The parent shape.</param> /// <returns></returns> public override object GetValue(ShapeElement parentShape) { object obj = base.GetValue(parentShape); if (obj is Multiplicity) { switch ((Multiplicity)obj) { case Multiplicity.One: return("1,1"); case Multiplicity.OneMany: return("1,N"); case Multiplicity.ZeroMany: return("0,N"); case Multiplicity.ZeroOne: return("0,1"); case Multiplicity.NotApplicable: return(String.Empty); } } return(obj); }
// Methods public override void DoPaint(DiagramPaintEventArgs e, ShapeElement parentShape) { base.DoPaint(e, parentShape); Font font = this.GetFont(e.View); string summrytxt = this.GetSummrytxt(parentShape); string perentSummrytxt = this.GetPerentSummrytxt(parentShape); summrytxt = HttpUtility.HtmlDecode(summrytxt); perentSummrytxt = HttpUtility.HtmlDecode(summrytxt); bool flag = false; this.Overrideheight = 0.15f; RectangleF rect = new RectangleF(this.summeryx, this.summeryy, ((float)parentShape.BoundingBox.Width) - (this.summeryx * 2f), this.Overrideheight); //RectangleF rect =RectangleD.ToRectangleF(parentShape.BoundingBox); rect.X = 0.03f; if (!string.IsNullOrEmpty(perentSummrytxt)) { flag = true; this.Overrideheight += this.Overrideheight; rect = new RectangleF(this.summeryx, this.summeryy, ((float)parentShape.BoundingBox.Width) - (this.summeryx * 2f), this.Overrideheight); } LinearGradientBrush brush = new LinearGradientBrush(rect, Color.FromArgb(0xd4, 0xdd, 0xef), Color.White, 0f); e.Graphics.FillRectangle(brush, rect); e.Graphics.DrawString("Àà:" + summrytxt, font, this.SumerBrush, this.summeryx + 0.05f, this.summeryy + 0.03f); if (flag) { Font font2 = this.GetFont(e.View); e.Graphics.DrawString(perentSummrytxt, font2, this.PerentBrush, this.perentx + 0.05f, this.perenty + 0.03f); } }
/// <summary> /// Replacement for <see cref="ShapeField.GetBackgroundBrush"/> that recognizes /// <see cref="IDynamicColorGeometryHost"/> /// </summary> public override Pen GetPen(DiagramClientView view, ShapeElement parentShape, ref Color oldColor) { StyleSet styleSet = (parentShape != null) ? parentShape.StyleSet : null; Color restoreColor = Color.Empty; Pen pen = null; if (styleSet != null) { StyleSetResourceId penId = GetPenId(parentShape); pen = styleSet.GetPen(penId); IDynamicColorGeometryHost dynamicColors = parentShape as IDynamicColorGeometryHost; if (dynamicColors == null || (restoreColor = dynamicColors.UpdateDynamicColor(penId, pen)).IsEmpty) { if (view != null) { restoreColor = parentShape.UpdateGeometryLuminosity(view, pen); } } else if (view != null) { parentShape.UpdateGeometryLuminosity(view, pen); } } if (pen != null && !restoreColor.IsEmpty) { restoreColor = pen.Color; } return(pen); }
public ShapeElement CreateSquare() { Vector2 A; float pointTranslation; // distance of the point from the center of the screen do { A = GetRandomPointFromActiveArea(); pointTranslation = Vector2.Distance(A, new Vector2(0f, 0f)); }while (A.y < 1f || pointTranslation < 1f || pointTranslation > this.gameUnitsVerticalInActiveArea); var square = this.lf.Create(A); square.AddVertex(new Vector2(A.y, -A.x)); square.AddVertex(new Vector2(-A.x, -A.y)); square.AddVertex(new Vector2(-A.y, A.x)); square.AddVertex(A); square.SetColor(this.color); square.SetSize(this.size); var startLine = this.lf.Create(A); if (drawStartPoint) { startLine.SetColor(Color.white); startLine.SetSize(this.size); } ShapeElement shape = new ShapeElement(square, startLine, Shape.Square); return(shape); }
private void _finishedLevel(bool skipping = false) { Debug.Log("Level " + CurrentLevel + " finished."); _previousShapeVertices = null; _currentLevel++; float time = 4f; if (skipping) { time = 0f; } if (CurrentLevel <= _config.NrOfLevels) { fader.LoadSceneFadingAfterTime(sceneName, new WaitForSeconds(time)); } else { fader.LoadSceneFadingAfterTime(finishSceneName, new WaitForSeconds(time)); fader.LoadSceneFadingAfterTime(resultSceneName, new WaitForSeconds(time + 3f)); } }
/// <summary> /// Provides the image for the current state of the button /// </summary> /// <param name="parentShape"></param> /// <returns></returns> protected override Image GetButtonImage(ShapeElement parentShape) { if (!(parentShape is VDWidgetTitlePort)) return null; Image image = _unpinImage; object isPined = this.GetValue(parentShape); if (isPined != null) { image = ((bool)isPined) ? _pinImage : _unpinImage; } return image; }
/// <summary> /// Gets the minimum <see cref="SizeD"/> of this <see cref="AutoSizeTextField"/> for the current text. /// </summary> /// <param name="parentShape"> /// The <see cref="ShapeElement"/> that this <see cref="AutoSizeTextField"/> is associated with. /// </param> /// <returns>The minimum <see cref="SizeD"/> of this <see cref="AutoSizeTextField"/>.</returns> public override SizeD GetMinimumSize(ShapeElement parentShape) { string text = GetDisplayText(parentShape); if (!string.IsNullOrEmpty(text)) { using (Font font = GetFont(parentShape)) { return base.MeasureDisplayText(text, font, GetStringFormat(parentShape), parentShape.MaximumSize); } } return SizeD.Empty; }
public override bool CanCreateConnection( ShapeElement sourceShapeElement, ShapeElement targetShapeElement, ref string connectionWarning) { if ((sourceShapeElement != null) && (targetShapeElement != null)) { if (RemovePassThroughShapes(sourceShapeElement) == RemovePassThroughShapes(targetShapeElement)) { return false; } } return base.CanCreateConnection(sourceShapeElement, targetShapeElement, ref connectionWarning); }
/// <summary> /// Called as the pointer is moved over potential targets after a source is selected /// So should be pretty quick /// </summary> /// <remarks> /// The cursor can change dependant on CanCreateConnection when this returns true /// </remarks> /// <param name="sourceShapeElement">ShapeElement</param> /// <param name="targetShapeElement">ShapeElement</param> /// <returns></returns> public override bool IsValidSourceAndTarget(ShapeElement sourceShapeElement, ShapeElement targetShapeElement) { SubtypeConnectAction action = (sourceShapeElement.Diagram as ORMDiagram).SubtypeConnectAction; ObjectType sourceObjectType; ObjectType targetObjectType; if ((null != (sourceObjectType = action.mySourceObjectType)) && (null != (targetObjectType = ObjectTypeFromShape(targetShapeElement)))) { // UNDONE: Be smarter here, or display message later on return sourceObjectType != targetObjectType && ((sourceObjectType.DataType == null) == (targetObjectType.DataType == null)); } return false; }
private static ShapeElement RemovePassThroughShapes(ShapeElement shape) { if (shape is Compartment) { return shape.ParentShape; } var swimlane = shape as SwimlaneShape; if (swimlane != null && swimlane.ForwardDragDropToParent) { return shape.ParentShape; } return shape; }
/// <summary> /// Called as the pointer is moved over potential targets after a source is selected /// So should be pretty quick /// </summary> /// <remarks> /// The cursor can change dependant on CanCreateConnection when this returns true /// When this returns false, the control falls back to /// ExternalConstraintConectAction. /// </remarks> /// <param name="sourceShapeElement">ShapeElement</param> /// <param name="targetShapeElement">ShapeElement</param> /// <returns></returns> public override bool IsValidSourceAndTarget(ShapeElement sourceShapeElement, ShapeElement targetShapeElement) { // We support attaching from an external constraint shape to a fact type shape. However, to // get warning text on the drag action we need to get through to CanCreateConnection, so we // are more lenient here. bool retVal = false; if (sourceShapeElement is ExternalConstraintShape) { // The source and target shapes are allowed here so we can display instructions in CanCreateConnection retVal = targetShapeElement is FactTypeShape || targetShapeElement is SubtypeLink || sourceShapeElement == targetShapeElement; } return retVal; }
/// <summary> /// Used for more in-depth checking before ConnectionType.CreateConnection is called, and /// to display warning messages on the design surface. /// </summary> /// <param name="sourceShapeElement">The source of the requested connection</param> /// <param name="targetShapeElement">The target of the requested connection</param> /// <param name="connectionWarning">A location to write the warning string</param> /// <returns>true if the connection can proceed</returns> public override bool CanCreateConnection(ShapeElement sourceShapeElement, ShapeElement targetShapeElement, ref string connectionWarning) { bool retVal = false; if (sourceShapeElement is FactTypeShape) { if (sourceShapeElement == targetShapeElement) { // UNDONE: Constrain this, this is overly generous retVal = true; } else { Debug.Assert(IsValidSourceAndTarget(sourceShapeElement, targetShapeElement)); // The condition that got us here if (targetShapeElement == sourceShapeElement.Diagram) { connectionWarning = ResourceStrings.InternalUniquenessConstraintConnectActionInstructions; } } } return retVal; }
/// <summary> /// Adds the <paramref name="shape"/> with the specified <paramref name="pinned"/> value. /// </summary> /// <param name="shape">The shape to lay out on the diagram.</param> /// <param name="pinned">Indicates whether the shape is pinned in place or not. True means the shape is pinned to its current location.</param> public void AddShape(ShapeElement shape, bool pinned) { NodeShape ns = shape as NodeShape; if (ns == null || shape.ParentShape as ORMDiagram == null) { return; } LayoutShapeList list = myLayoutShapes; LayoutShape layshape; // If the shape doesn't exist, add it, otherwise simply modify the pinned value. if (!list.TryGetValue(ns, out layshape)) { layshape = new LayoutShape(ns, pinned); list.Add(layshape); } else { layshape.Pinned = pinned; } }
/// <summary> /// Provide the transaction name. The name is displayed in the undo and redo lists. /// </summary> public override string GetConnectTransactionName(ShapeElement sourceShape, ShapeElement targetShape) { return (targetShape is ORMDiagram) ? ResourceStrings.DropShapeTransactionName : ResourceStrings.RoleConnectActionTransactionName; }
/// <summary> /// Retrieve all connect types associated with this connect action. /// Returns an empty array unless the sourceShapeElement is an ExternalConstraintShape /// </summary> /// <param name="sourceShapeElement">The source element</param> /// <param name="targetShapeElement">The target element. Currently ignored.</param> /// <returns></returns> protected override ConnectionType[] GetConnectionTypes(ShapeElement sourceShapeElement, ShapeElement targetShapeElement) { return RoleConnectionType.InstanceArray; }
/// <summary> /// Get the underlying object type for a ShapeElement /// </summary> /// <param name="shape">A shape element.</param> /// <returns>An ObjectType, or null</returns> protected static ObjectType ObjectTypeFromShape(ShapeElement shape) { ObjectType objectType; if (shape == null) { // Protect against breaking into the debugger, should // not be hit without a debugger active. return null; } ModelElement backingElement = shape.ModelElement; FactType factType; if (null == (objectType = backingElement as ObjectType)) { if (null != (factType = backingElement as FactType)) { objectType = factType.NestingType; } } return objectType; }
public override RectangleD GetCompliantBounds(ShapeElement portShape, RectangleD proposedBounds) { if (portShape == null) { throw new ArgumentNullException("portShape"); } VDWidgetShape parentShape = portShape.ParentShape as VDWidgetShape; if (parentShape == null || portShape.Store.InUndoRedoOrRollback) { return proposedBounds; } PointD location = new PointD(0, -portShape.DefaultSize.Height - portShape.OutlinePenWidth * 2); SizeD size = portShape.DefaultSize; TextField titleTextField = portShape.FindShapeField("WidgetTitleText") as TextField; if (titleTextField != null) { size.Width = titleTextField.GetMinimumSize(portShape).Width; size.Width += size.Height + 0.03; } if (parentShape.HasWidgetTitleIcon) { size.Width += size.Height + 0.02; // add more space for icon } for (int i = 0; i < ADDITIONAL_TITLE_ICON_COUNT; i++) { // add more space for additional title icon if (parentShape.HasAdditionalWidgetTitleIcon(i)) { size.Width += size.Height + 0.02; } } // should be smaller than parent shape if (size.Width > parentShape.Size.Width) size.Width = parentShape.Size.Width; return new RectangleD(location, size); }
/// <summary> /// Correctly connect a <see cref="ForeignKeyConnector"/> /// </summary> protected override void OnChildConfiguring(ShapeElement child, bool createdDuringViewFixup) { ForeignKeyConnector foreignKeyConnector; if (null != (foreignKeyConnector = child as ForeignKeyConnector)) { ReferenceConstraintTargetsTable link = (ReferenceConstraintTargetsTable)child.ModelElement; TableShape sourceShape = null; Table sourceTable; if (null != (sourceTable = link.ReferenceConstraint.SourceTable)) { foreach (PresentationElement pel in PresentationViewsSubject.GetPresentation(sourceTable)) { TableShape testShape = pel as TableShape; if (testShape != null && testShape.Diagram == this) { sourceShape = testShape; break; } } } if (null != sourceShape) { foreach (PresentationElement pel in PresentationViewsSubject.GetPresentation(link.TargetTable)) { TableShape targetShape = pel as TableShape; if (targetShape != null && targetShape.Diagram == this) { foreignKeyConnector.Connect(sourceShape, targetShape); return; } } } } base.OnChildConfiguring(child, createdDuringViewFixup); }
/// <summary> /// Implements <see cref="IReconfigureableLink.Reconfigure"/> /// </summary> protected void Reconfigure(ShapeElement discludedShape) { ModelNoteReferencesModelElement link = ModelElement as ModelNoteReferencesModelElement; MultiShapeUtility.ReconfigureLink(this, link.Note, link.Element, discludedShape); }
public override RectangleD GetCompliantBounds(ShapeElement shape, RectangleD proposedBounds) { if (shape.Diagram != null) { proposedBounds.Location = PointD.Empty; proposedBounds.Size = shape.Diagram.Bounds.Size; } return proposedBounds; }
public override RectangleD GetCompliantBounds(ShapeElement shape, RectangleD proposedBounds) { // base rule proposedBounds = VDDefaultBoundsRules.Instance.GetCompliantBounds(shape, proposedBounds); VDWidgetShape parentShape = shape.ParentShape as VDWidgetShape; VDContainer thisMEL = shape.ModelElement as VDContainer; VDContainerShape thisPEL = shape as VDContainerShape; // if (parentShape != null && thisMEL != null && thisPEL != null) { if (parentShape is VDHoriContainerShape) { // setup left anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasLeftAnchor && !thisPEL.Anchoring.HasLeftAnchor, thisMEL.LeftSibling, AnchoringBehavior.Edge.Left); // setup right anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasRightAnchor && !thisPEL.Anchoring.HasRightAnchor, thisMEL.RightSibling, AnchoringBehavior.Edge.Right); } else if (parentShape is VDVertContainerShape) { // setup top anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasTopAnchor && !thisPEL.Anchoring.HasTopAnchor, thisMEL.TopSibling, AnchoringBehavior.Edge.Top); // setup bottom anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasBottomAnchor && !thisPEL.Anchoring.HasBottomAnchor, thisMEL.BottomSibling, AnchoringBehavior.Edge.Bottom); } else if (!(parentShape is VDFullFilledContainerShape)) { // setup left anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasLeftAnchor && !thisPEL.Anchoring.HasLeftAnchor, thisMEL.LeftSibling, AnchoringBehavior.Edge.Left); // setup right anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasRightAnchor && !thisPEL.Anchoring.HasRightAnchor, thisMEL.RightSibling, AnchoringBehavior.Edge.Right); // setup top anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasTopAnchor && !thisPEL.Anchoring.HasTopAnchor, thisMEL.TopSibling, AnchoringBehavior.Edge.Top); // setup bottom anchor setAnchor(parentShape, thisMEL, thisPEL, thisMEL.HasBottomAnchor && !thisPEL.Anchoring.HasBottomAnchor, thisMEL.BottomSibling, AnchoringBehavior.Edge.Bottom); } if (thisMEL is VDHoriContainer && ((VDHoriContainer)thisMEL).FixedHeight > VDConstants.DOUBLE_DIFF) { proposedBounds = new RectangleD(proposedBounds.Location, new SizeD(proposedBounds.Width, ((VDHoriContainer)thisMEL).FixedHeight)); } else if (thisMEL is VDVertContainer && ((VDVertContainer)thisMEL).FixedWidth > VDConstants.DOUBLE_DIFF) { proposedBounds = new RectangleD(proposedBounds.Location, new SizeD(((VDVertContainer)thisMEL).FixedWidth, proposedBounds.Height)); } } return proposedBounds; }
/// <summary> /// Correctly connect a <see cref="AssociationConnector"/> /// </summary> protected override void OnChildConfiguring(ShapeElement child, bool createdDuringViewFixup) { AssociationConnector connector; if (null != (connector = child as AssociationConnector)) { BarkerErModelContainsBinaryAssociation link = (BarkerErModelContainsBinaryAssociation)child.ModelElement; BarkerEntityShape sourceShape = null; EntityType sourceEntity; if (null != (sourceEntity = link.BinaryAssociation.RoleCollection[0].EntityType)) { foreach (PresentationElement pel in PresentationViewsSubject.GetPresentation(sourceEntity)) { BarkerEntityShape testShape = pel as BarkerEntityShape; if (testShape != null && testShape.Diagram == this) { sourceShape = testShape; break; } } } if (null != sourceShape) { foreach (PresentationElement pel in PresentationViewsSubject.GetPresentation(link.BinaryAssociation.RoleCollection[1].EntityType)) { BarkerEntityShape targetShape = pel as BarkerEntityShape; if (targetShape != null && targetShape.Diagram == this) { connector.Connect(sourceShape, targetShape); return; } } } } base.OnChildConfiguring(child, createdDuringViewFixup); }
/// <summary> /// Get an accurate bounding box for a shape, which we'll define as /// the bounding box for the top-most non-diagram shape in the parent hierarchy. /// </summary> private RectangleD GetShapeBoundingBox(ShapeElement shape) { ShapeElement parentShape = shape.ParentShape; while (parentShape != null && !(parentShape is Diagram)) { shape = parentShape; parentShape = shape.ParentShape; } return shape.BoundingBox; }
/// <summary> /// Select the specified <paramref name="shape"/> in the spy window /// </summary> /// <param name="shape">The <see cref="ShapeElement"/> to activate and show</param> /// <returns>true if activation was successful</returns> public bool ActivateShape(ShapeElement shape) { Diagram diagram = shape as Diagram; if (ActivateDiagram(diagram ?? shape.Diagram)) { if (diagram == null) { // Do not select the rectangle for a diagram, the view zooms out to fit it in the window myDiagramView.DiagramClientView.EnsureVisible(GetShapeBoundingBox(shape), DiagramClientView.EnsureVisiblePreferences.ScrollIntoViewCenter); // We could select a diagram, but this leaves it with the old selection state instead // if this is the currently selected spy diagram. If the user really wants the diagram, // they are only one click away after this point. myDiagramView.Selection.Set(new DiagramItem(shape)); } return true; } return false; }
public override System.Collections.IList FixUpDiagramSelection(ShapeElement newChildShape) { return base.FixUpDiagramSelection(newChildShape); }
/// <summary> /// Create a connection between an ExternalConstraintShape and a FactType. Roles /// used in the connection are stored with the currently active connect action. /// </summary> /// <param name="sourceShapeElement">The source of the requested connection</param> /// <param name="targetShapeElement">The target of the requested connection</param> /// <param name="paintFeedbackArgs">PaintFeedbackArgs</param> public override void CreateConnection(ShapeElement sourceShapeElement, ShapeElement targetShapeElement, PaintFeedbackArgs paintFeedbackArgs) { ORMDiagram diagram = (ORMDiagram)sourceShapeElement.Diagram; RoleConnectAction action = diagram.RoleConnectAction; ObjectType objectType; RoleBase sourceRole = action.mySourceRole; RoleBase roleBase; RoleBase targetRole; FactTypeShape factTypeShape; if (sourceRole != null && sourceShapeElement == targetShapeElement && null != (targetRole = action.myLastMouseMoveRole) && targetRole != sourceRole && null != (factTypeShape = sourceShapeElement as FactTypeShape)) { LinkedElementCollection<RoleBase> displayedRoles = factTypeShape.GetEditableDisplayRoleOrder(); displayedRoles.Move(displayedRoles.IndexOf(sourceRole), displayedRoles.IndexOf(targetRole)); } else if ((null != (roleBase = sourceRole) && null != (objectType = ObjectTypeFromShape(targetShapeElement))) || (null != (objectType = action.mySourceObjectType) && null != (roleBase = action.myLastMouseMoveRole))) { // Don't trigger a change if none is indicated. Turn this into a noop Role role = roleBase.Role; if (role.RolePlayer != objectType) { role.RolePlayer = objectType; } } else if (targetShapeElement == diagram && action.mySourceRoleMissingConnector) { diagram.PlaceORMElementOnDiagram(null, roleBase.Role.RolePlayer, paintFeedbackArgs.TargetFeedbackBounds.Location, ORMPlacementOption.AllowMultipleShapes, null, null); } }
/// <summary> /// Stop all auto shape selection on transaction commit except when /// the item is being dropped. /// </summary> public override IList FixUpDiagramSelection(ShapeElement newChildShape) { if (DropTargetContext.HasDropTargetContext(Store.TransactionManager.CurrentTransaction)) { return base.FixUpDiagramSelection(newChildShape); } return null; }
/// <summary> /// Stop the DSLTools framework from placing a shape that has a non-empty location /// </summary> protected override void OnChildConfigured(ShapeElement child, bool childWasPlaced, bool createdDuringViewFixup) { if (!childWasPlaced) { TableShape shape = child as TableShape; if (shape != null && shape.Location != BoundsRules.GetCompliantBounds(child, RectangleD.Empty).Location) { IDictionary unplacedShapes = UnplacedShapesContext.GetUnplacedShapesMap(Store.TransactionManager.CurrentTransaction.TopLevelTransaction, this.Id); if (unplacedShapes.Contains(child)) { unplacedShapes.Remove(child); } } } base.OnChildConfigured(child, childWasPlaced, createdDuringViewFixup); }
protected override bool CalculateDerivedVisible(ShapeElement source) { return base.CalculateDerivedVisible(source); }
void IReconfigureableLink.Reconfigure(ShapeElement discludedShape) { Reconfigure(discludedShape); }
public override bool CanShapeContainConnectors(ShapeElement parentCandidate) { return base.CanShapeContainConnectors(parentCandidate); }
protected override ShapeElement DetermineHighlightShape(ShapeElement shape) { return base.DetermineHighlightShape(shape); }