Multiple Objects on Connector PositioningMultiple Objects on Connector PositioningRE Multiple Objects on Connector PositioningWilfrid Utzhttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=179312013-03-19T12:27:07Z2013-03-19T12:22:38ZBy determining the position of the end point objects start object and end object a flexible variable alignment of the objects at the MIDDLE is possible As an example implementation see the 2 figures below the position of the element is dynamically determined and the GraphRep implementation takes it into account when re arranging the model content br br strong IMPLEMENTATION PROPOSAL strong br Expression attributes as hidden attributes of the relation class are setup to dynamically determine the actual position of start and end point Calculation of a quotient to adjust the position of MIDDLE elments accordingly is performed The same quotient is also used to identify whether a horizontal or vertical alignment should be done br br endX endY startX startY Retrieve start and end object and parse X and Y coordinates br LengthA LengthB LengthC Calculation of lengths of triangle Pytagoras used for quotient calculation in GraphRep br NumberOfObjects simulate the objects on the relation class br br endX br div class code span class code lines 1 span EXPR type string expr fixed replall replall token replall aval ctobj 034 Position 034 034 NODE 034 034 034 0 034 034 034 x 034 034 034 034 cm 034 034 034 div br endY br div class code span class code lines 1 span EXPR type string expr fixed replall replall token replall aval ctobj 034 Position 034 034 NODE 034 034 034 1 034 034 034 y 034 034 034 034 cm 034 034 034 div br startX br div class code span class code lines 1 span EXPR type string expr fixed replall replall token replall aval cfobj 034 Position 034 034 NODE 034 034 034 0 034 034 034 x 034 034 034 034 cm 034 034 034 div br startY br div class code span class code lines 1 span EXPR type string expr fixed replall replall token replall aval cfobj 034 Position 034 034 NODE 034 034 034 1 034 034 034 y 034 034 034 034 cm 034 034 034 div br LengthA as the X Axis br div class code span class code lines 1 span EXPR type double expr fixed VAL aval 034 startX 034 VAL aval 034 endX 034 div br LengthB as the Y Axis br div class code span class code lines 1 span EXPR type double expr fixed VAL aval 034 startY 034 VAL aval 034 endY 034 div br LengthC not used just to show Expression Functionality br div class code span class code lines 1 span EXPR type double expr fixed sqrt pow aval 034 LengthA 034 2 pow aval 034 LengthB 034 2 div br br GRAPHREP IMPLEMENTATION br div class code span class code lines nbsp 1 span no shadow graphrep since the shadow disturbs to a certain extend the alignment visually br span class code lines nbsp 2 span GRAPHREP SHADOW off br span class code lines nbsp 3 span ready in values from the object all elements are calculating information from the object positioning br span class code lines nbsp 4 span AVAL set default 034 3 034 numberOfObjects 034 NumberOfObjects 034 br span class code lines nbsp 5 span AVAL startX 034 startX 034 br span class code lines nbsp 6 span AVAL startY 034 startY 034 br span class code lines nbsp 7 span AVAL endX 034 endX 034 br span class code lines nbsp 8 span AVAL endY 034 endY 034 br span class code lines nbsp 9 span AVAL lengthA 034 LengthA 034 x axis br span class code lines 10 span AVAL lengthB 034 LengthB 034 y axis br span class code lines 11 span IMPORTANT to adjust the position of the connector marks br span class code lines 12 span SET quotient VAL lengthB VAL lengthA br span class code lines 13 span SET quotientInverse VAL lengthA VAL lengthB br span class code lines 14 span draw the edge br span class code lines 15 span EDGE br span class code lines 16 span draw on the middle position br span class code lines 17 span MIDDLE br span class code lines 18 span SET t 0 br span class code lines 19 span highly recommended to use a while loop for loop crashes under certain circumstances the environment br span class code lines 20 span WHILE t lt VAL numberOfObjects br span class code lines 21 span nbsp calculate the position of the 034 on connector 034 elements based on start and end position br span class code lines 22 span nbsp IF quotient gt 1 AND quotient lt 1 br span class code lines 23 span nbsp nbsp case vertically aligned br span class code lines 24 span nbsp nbsp SET x 0 br span class code lines 25 span nbsp nbsp SET y VAL numberOfObjects 1 2 t br span class code lines 26 span nbsp br span class code lines 27 span nbsp ELSE br span class code lines 28 span nbsp nbsp case hoirzontal aligned br span class code lines 29 span nbsp nbsp SET x VAL numberOfObjects 1 2 t br span class code lines 30 span nbsp nbsp SET y 0 br span class code lines 31 span nbsp nbsp nbsp br span class code lines 32 span nbsp if more than 1 object draw the connecting lines to the connector marks br span class code lines 33 span nbsp IF VAL numberOfObjects gt 1 br span class code lines 34 span nbsp nbsp IF quotient gt 1 AND quotient lt 1 br span class code lines 35 span nbsp nbsp nbsp nbsp POLYLINE 3 x1 0 5cm y1 0cm x2 0 5cm y2 CM y x3 CM x y3 CM y br span class code lines 36 span nbsp nbsp nbsp nbsp POLYLINE 3 x1 0 5cm y1 0cm x2 0 5cm y2 CM y x3 CM x y3 CM y br span class code lines 37 span nbsp nbsp br span class code lines 38 span nbsp nbsp ELSE br span class code lines 39 span nbsp nbsp nbsp nbsp POLYLINE 3 x1 0cm y1 0 5cm x2 CM x y2 0 5cm x3 CM x y3 CM y br span class code lines 40 span nbsp nbsp nbsp nbsp POLYLINE 3 x1 0cm y1 0 5cm x2 CM x y2 0 5cm x3 CM x y3 CM y nbsp nbsp br span class code lines 41 span nbsp nbsp br span class code lines 42 span nbsp br span class code lines 43 span nbsp draw the elements on the connector br span class code lines 44 span nbsp FILL color red br span class code lines 45 span nbsp ELLIPSE x CM x y CM y rx 0 2cm ry 0 2cm br span class code lines 46 span nbsp write numbering in object br span class code lines 47 span nbsp FONT h 8pt br span class code lines 48 span nbsp TEXT t x CM x y CM y w c h c br span class code lines 49 span nbsp update while counter br span class code lines 50 span nbsp SET t t 1 br span class code lines 51 span br span class code lines 52 span draw the connector marks br span class code lines 53 span FILL color white br span class code lines 54 span br span class code lines 55 span IF quotient gt 1 AND quotient lt 1 br span class code lines 56 span nbsp SET yMarkPos quotient 0 5 br span class code lines 57 span nbsp SET yMarkNeg 1 quotient 0 5 br span class code lines 58 span nbsp ELLIPSE rx 0 1cm ry 0 1cm x 0 5cm y CM yMarkPos br span class code lines 59 span nbsp ELLIPSE rx 0 1cm ry 0 1cm x 0 5cm y CM yMarkNeg br span class code lines 60 span br span class code lines 61 span ELSE br span class code lines 62 span nbsp SET xMarkPos quotientInverse 0 5 br span class code lines 63 span nbsp SET xMarkNeg 1 quotientInverse 0 5 br span class code lines 64 span nbsp ELLIPSE rx 0 1cm ry 0 1cm y 0 5cm x CM xMarkPos br span class code lines 65 span nbsp ELLIPSE rx 0 1cm ry 0 1cm y 0 5cm x CM xMarkNeg br span class code lines 66 span br span class code lines 67 span br span class code lines 68 span DEBUG to display the quotient calculated br span class code lines 69 span TEXT STR quotient br div br br br strong LIMITATIONS strong br Currently bendpoints are not considered in the implementation in case bendpoints are created by the user a strategy to eighter read out the position of the bend point and compare to the MIDDEL position has to be added br Merging Parallel markers the repositioning is not smooth but happens when the user releases the move action and the panel is drawnWilfrid Utz2013-03-19T12:22:38ZMultiple Objects on Connector Positioninghttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=178852014-03-27T12:32:38Z2013-03-19T12:05:18ZBased on the recommendation in a previous thread a connector has been implemented which draws an object on top of it All seems to be working for a single object but if multiple objects are to be added on top of the connector it becomes problematic There are two possibilities to add multiple objects on top of the connector in series and in parallel Adding second concept is accomplished by using GraphRep 039 s MIDDLE but offsetting y or x axis accordingly Usually if connector is drawn on the drawing area in a horizontal direction this implementation seems to work but changing connector 039 s direction to for example vertical the other objects than first one appear on the connector 039 s side This is probably because of the hard coded y and x offsets Is it possible to make offsets flexibel and variable to the connector position2013-03-19T12:05:18Z