A kind of method of pattern arrangement combination of jumping based on coordinate
Technical field
The present invention relates in appointed area, the rectangle of all size be carried out the method for permutation and combination, by to the great-jump-forward of rectangular coordinates point to Analogue Storage when, leave in fixing region minimized the required irregular rectangle representing, thereby dwindle the space of demonstration, reduce redundancy, make to represent more rationally directly perceived.
Background technology
As the management system of large enterprise, conventional chart carrys out some demands such as progress displaying, income and distribution.If just simply each figure is cumulative, ceaselessly represents each figure with row layout, data volume is larger, likely can exceed and represent region, increasing along with data volume, and the transfer of partial service, figure also can be along with renewal, if now continuously cumulative, will cause the redundancy stack of figure, and viewing area can be long especially, the interface special in disorder complexity that also seems, have a strong impact on actual use, can not meet the aesthetic property and the intuitive requirement that represent.
Summary of the invention
The object of this invention is to provide a kind of method of pattern arrangement combination of jumping based on coordinate, the method by the great-jump-forward of rectangular coordinates point to Analogue Storage when, leave in fixing region minimized the required irregular rectangle representing, thereby dwindle the space of demonstration, reduce redundancy, make to represent more rationally directly perceived.
Object of the present invention is achieved through the following technical solutions:
A method for the pattern arrangement combination of jumping based on coordinate, is characterized in that the method comprises the following steps:
1) prepare background painting canvas, whole rectangle attribute
The background painting canvas of a fixed size of initialization, is 0 by the starting point Y-axis coordinate assignment of each rectangle, and starting point X-axis coordinate represents the start time of content that rectangle represents, and is fixed value; Be ready to again the each rectangle attribute that will draw, mouse in the height of the width of the X-axis coordinate of this rectangle upper left corner starting point, Y-axis coordinate, rectangle, rectangle, displaying interface is rested on to the business information showing on this rectangle to be encapsulated, then by each rectangle with the descending sort of height value size, join one by one in the list of a rectangular object;
2) attempt drawing rectangle, in painting canvas, find out the starting point coordinate satisfying condition
In the rectangular object list of step 1), take out a rectangle, obtain X-axis coordinate, the Y-axis coordinate of its starting point, find again the Y-axis coordinate of the initial point from right to left of the coboundary line of this rectangle and the lower limb line intersecting lens of previous rectangle, due to comparison intersecting lens time, X-axis coordinate is fixed, so only require the starting point Y-axis coordinate making new advances; Then judge new X, the Y-axis coordinate of rectangle, wide and high, whether exceed the border of initial painting canvas, and judge in this rectangle, whether all coordinate points all do not have occupied;
If above-mentioned condition all meets, the X of this rectangular object starting point, Y-axis coordinate figure are added in the set that the attribute of this rectangular object " meets a little ";
If do not met, find the next starting point coordinate satisfying condition, X-axis value is fixed, Y-axis value adds 1 circulation, then judge new X, the Y-axis coordinate of rectangle, wide and high, whether exceed the border of initial painting canvas, and it is occupied to judge whether the interior all coordinate points of this rectangle all do not have, until find qualified starting point Y-axis coordinate in painting canvas;
3) coordinate jumps and detects, and checks all available coordinate points, the set of putting into coordinate points
In background painting canvas, carry out coordinate points jump and detect, because rectangle starting point coordinate has joined in the set of coordinate points, so as long as other available coordinate points are all added in this set, recall step by step and detect use for the rectangle of step 4), the Y-axis coordinate of initialization current rectangle adds that this rectangle height value is as new Y-axis coordinate, then judge with former X-axis, new Y-axis, rectangle width, it is highly the border whether 1 little rectangle exceeds initial painting canvas, and judge in this little rectangle, whether all coordinate points all do not have occupied, if satisfied condition, former Y-axis coordinate is added to 1 as the new Y-axis starting point coordinate of rectangle, the new Y-axis end point coordinate of rectangle becomes former Y-axis coordinate and adds 1 height of adding rectangle, then by starting point, former X-axis, former Y-axis coordinate adds in the set that 1 attribute that joins this rectangular object " meets a little ", if do not met, starting point Y-axis coordinate changes to the Y-axis coordinate of the end point of former rectangle, find again the next coordinate points satisfying condition, X-axis value is fixed, Y-axis value adds 1 circulation, then judge the new X of rectangle, Y-axis coordinate, wide and high, whether exceed the border of initial painting canvas, and judge in this rectangle, whether all coordinate points all do not have occupied, then repeat aforesaid operations, the coordinate points that other are satisfied condition is all added in the set of " meeting a little ",
4) recall step by step and detect drafting rectangle, carry out permutation and combination
Judge and in the set that the attribute of this rectangular object " meets a little ", whether have value:
If one has, the starting point of rectangle is made as in rectangular object first point in set a little.Then start to draw rectangle, in canvas area by the scope of this rectangle being all made as and drawing a little, and according to the situation of filling revise rectangle starting point between width starting point Y-axis coordinate a little.If filling and starting point Y-axis coordinate are the situation of rectangle height, the Y-axis coordinate that starting point Y-axis coordinate is modified as rectangle adds the height of rectangle, otherwise, do not fill and starting point Y-axis coordinate is the Y-axis coordinate of rectangle while adding the height of rectangle, new starting point Y-axis coordinate is modified as the Y-axis coordinate of rectangle;
If two do not have, use and recall step by step, survey and whether have target, first the drafting of its previous rectangle is made into not draw, whether the drafting of then testing previous rectangle puts to success: whether the quantity that first judges its target complete point is empty, if only have a point, be that last coordinate points is the coordinate points in use, this rectangle is removed, then remove the coordinate points of all desired values, then whether return, then make comparisons with previous rectangle again, recalling step by step detection has target; Otherwise, in the set " meeting a little " at the attribute of this rectangle, remove this coordinate points, more next coordinate points is set to the starting point coordinate of this rectangle, then whole this rectangle coordinate points are shown with the form of filling;
Three, remaining rectangle is attempted drawing according to the method described above, is repeated step 2), step 3), the operation of step 4), finally obtains the set after whole rectangular arranged combinations;
5) displaying interface
The rectangular set that above-mentioned permutation and combination is obtained, take X-axis coordinate, Y-axis coordinate, width, highly as basis, is presented in interface.
The present invention jumps to detect by coordinate whole rectangles is judged whether to meet the qualification being arranged, operation by interspersed and recursive backtracking compares whole rectangles, preediting arrangement is carried out in blank region, if can not deposit, can attempt having deposited in automatic editing area the general layout of rectangle, thereby that carries out robotization carries out the permutation and combination of minimization principle to whole rectangles, reasonably utilize limited spacial flex, avoid the appearance of large area white space.Adopt rational filling mode, minimized being arranged in appointed area of chart that needs are shown, thus reduce redundancy, make to represent content more rationally directly perceived, easy to use.
Accompanying drawing explanation
Fig. 1 is process flow diagram of the present invention.
Embodiment
A kind of method of pattern arrangement combination of jumping based on coordinate, the method by the great-jump-forward of rectangular coordinates point to Analogue Storage when, leave in fixing region minimized the required irregular rectangle representing, thereby dwindle the space of demonstration, reduce redundancy, make to represent more rationally directly perceived.Concrete steps are as follows:
1) prepare background painting canvas, whole rectangle attribute
The background painting canvas of a fixed size of initialization for 0(starting point X-axis coordinate represents start time of content that rectangle represents, is fixed value by the starting point Y-axis coordinate assignment of each rectangle).Be ready to again the each rectangle attribute that will draw, by the height of the width of the X-axis coordinate of this rectangle upper left corner starting point, Y-axis coordinate, rectangle, rectangle, show that mouse in interface rests on the association attributeses such as the business information that shows on this rectangle and is encapsulated, then by each rectangle with the descending sort of height value size, join one by one in the list of a rectangular object.
2) attempt drawing rectangle, in painting canvas, find out the starting point coordinate satisfying condition
In the rectangular object list of step 1, take out a rectangle, obtain X-axis coordinate, the Y-axis coordinate of its starting point, find again the Y-axis coordinate of the initial point from right to left of the coboundary line of this rectangle and the lower limb line intersecting lens of previous rectangle (because relatively when intersecting lens, X-axis coordinate is fixed, so only require the starting point Y-axis coordinate making new advances).Then judge new X, the Y-axis coordinate of rectangle, wide and high, whether exceed the border of initial painting canvas, and judge in this rectangle, whether all coordinate points all do not have occupied.If above-mentioned condition all meets, the X of this rectangular object starting point, Y-axis coordinate figure are added in the set that the attribute of this rectangular object " meets a little ".If do not met, (X-axis value is fixed to find the next starting point coordinate satisfying condition, Y-axis value adds 1 circulation, then judge new X, the Y-axis coordinate of rectangle, wide and high, whether exceed the border of initial painting canvas, and it is occupied to judge whether the interior all coordinate points of this rectangle all do not have, until find qualified starting point Y-axis coordinate in painting canvas).
3) coordinate jumps and detects, and checks all available coordinate points, the set of putting into coordinate points
In background painting canvas, carry out coordinate points jump and detect, because rectangle starting point coordinate has joined in the set of coordinate points, so as long as other available coordinate points are all added in this set, recall step by step and detect use for the rectangle of step 4.The Y-axis coordinate of initialization current rectangle adds that this rectangle height value is as new Y-axis coordinate, then judge with former X-axis, new Y-axis, rectangle width, it is highly the border whether 1 little rectangle exceeds initial painting canvas, and judge in this little rectangle, whether all coordinate points all do not have occupied, if satisfied condition, former Y-axis coordinate is added to 1 as the new Y-axis starting point coordinate of rectangle, the new Y-axis end point coordinate of rectangle becomes former Y-axis coordinate and adds 1 height of adding rectangle, then by starting point (former X-axis, former Y-axis coordinate adds 1) join in the set that the attribute of this rectangular object " meets a little ", if do not met, starting point Y-axis coordinate changes to the Y-axis coordinate of the end point of former rectangle, (X-axis value is fixed to find the next coordinate points satisfying condition again, Y-axis value adds 1 circulation, then judge the new X of rectangle, Y-axis coordinate, wide and high, whether exceed the border of initial painting canvas, and judge in this rectangle, whether all coordinate points all do not have occupied, then repeat aforesaid operations, the coordinate points that other are satisfied condition is all added in the set of " meeting a little ").
4) recall step by step and detect drafting rectangle, carry out permutation and combination
Judge and in the set that the attribute of this rectangular object " meets a little ", whether have value:
If one has, the starting point of rectangle is made as in rectangular object first point in set a little.Then start to draw rectangle, in canvas area by the scope of this rectangle being all made as and drawing a little, and according to the situation of filling revise rectangle starting point between width starting point Y-axis coordinate a little.If filling and starting point Y-axis coordinate are the situation of rectangle height, the Y-axis coordinate that starting point Y-axis coordinate is modified as rectangle adds the height of rectangle, otherwise, do not fill and starting point Y-axis coordinate is the Y-axis coordinate of rectangle while adding the height of rectangle, new starting point Y-axis coordinate is modified as the Y-axis coordinate of rectangle.
If two do not have, use and recall step by step, survey and whether have target, first the drafting of its previous rectangle is made into not draw, whether the drafting of then testing previous rectangle puts to success: whether the quantity that first judges its target complete point is empty, if only have a point, be that last coordinate points is the coordinate points in use, this rectangle is removed, then remove the coordinate points of all desired values, then whether return, then make comparisons with previous rectangle again, recalling step by step detection has target.Otherwise, in the set " meeting a little " at the attribute of this rectangle, remove this coordinate points, more next coordinate points is set to the starting point coordinate of this rectangle, then whole this rectangle coordinate points are shown with the form of filling.
Three, remaining rectangle is attempted drawing according to the method described above, repeated step 2, step 3, the operation of step 4.Finally obtain the set after whole rectangular arranged combinations.
5) displaying interface
The rectangular set that above-mentioned permutation and combination is obtained, take X-axis coordinate, Y-axis coordinate, width, highly as basis, is presented in interface.