Summary of the invention
For the defects in the prior art, the present invention provides a kind of page object automatic adjusting method and device, can from
The object of current operation is adjusted by dynamic ground, effectively increases typesetting efficiency.
In a first aspect, the present invention provides a kind of page object automatic adjusting method, which comprises
Obtain the location information of each page object in current operation page object and its preset range;
The location information of the first page object is extracted in the location information of each page object in the preset range, it is described
First page object is with the current operation page object central point apart from the smallest page object;
According to the location information of the location information of first page object and the current operation page object, institute is determined
State the positional shift value of the first page object Yu the current operation page object;
The current operation page object is adjusted according to the positional shift value.
Optionally, the location information includes frame line position and position of center line.
Optionally, the position of the first page object is extracted in the location information of the page object each in the preset range
Confidence breath, specifically includes:
Determine the central point distance of each page object in the current operation page object and its preset range;
Using in the preset range with the central point of the current operation page object apart from the smallest page object as
First page object;
Extract the location information of first page object.
Optionally, the position of the location information according to first page object and the current operation page object
Information determines the positional shift value of first page object Yu the current operation page object, specifically includes:
First space of a whole page is determined according to the location information of first page object and the current operation page object
The reference line of object and the current operation page object;
The distance between the reference line of first page object Yu the current operation page object is calculated, and will be described
The distance between reference line is used as positional shift value.
Optionally, the reference line is top wire, following wire, left side wire, the right wire, horizontal center line or perpendicular
Straight center line.
Optionally, described that the current operation page object is adjusted according to the positional shift value, it specifically includes:
In the space of a whole page in the horizontal direction or the mobile positional shift value of vertical direction by the current operation page object
Distance so that the current operation page object is aligned with first page object.
Optionally, the method also includes:
Obtain the dimension information and pitch information of each page object in current operation page object and its preset range;
The ruler of the second page object is extracted in the dimension information of each page object and pitch information in the preset range
Very little information and pitch information, second page object be the dimension information of dimension information and the current operation page object most
Close page object;
The current operation page object is adjusted according to the dimension information of second page object and pitch information
It is whole;
The dimension information includes: height and width;
The pitch information includes: its spacing between adjacent page object.
Optionally, the dimension information and pitch information according to second page object is to the current operation space of a whole page
Object is adjusted, and is specifically included::
The height of the current operation page object is adjusted to the height of second page object;
And/or
It is the width of second page object by the width adjustment of the current operation page object;
And/or
Spacing between the current operation page object and second page object is adjusted to second space of a whole page
Spacing between object and an adjacent page object.
Second aspect, the present invention provide a kind of page object automatic regulating apparatus, and described device includes:
Location information acquiring unit, for obtaining the position of each page object in current operation page object and its preset range
Confidence breath;
First page object location information extraction unit, the location information for page object each in the preset range
It is middle extract the first page object location information, first page object be with the current operation page object central point away from
From the smallest page object;
Positional shift value determination unit, for according to the location information of first page object and the current operation version
In face of the location information of elephant, the positional shift value of first page object Yu the current operation page object is determined;
The first adjustment unit, for being adjusted according to the positional shift value to the current operation page object.
Optionally, described device further include:
Size and pitch information acquiring unit, for obtaining each space of a whole page pair in current operation page object and its preset range
The dimension information and pitch information of elephant;
Second page object size and pitch information extraction unit, the ruler for page object each in the preset range
The dimension information and pitch information of the second page object are extracted in very little information and pitch information, second page object is size
The immediate page object of dimension information of information and the current operation page object;
Second adjustment unit, for the dimension information and pitch information according to second page object to the current behaviour
It is adjusted as page object.
The dimension information includes: height and width;
The pitch information includes: its spacing between adjacent page object.
As shown from the above technical solution, page object automatic adjusting method of the invention and device, by obtaining the first edition
In face of the location information of elephant, and according to the position of the location information of first page object and the current operation page object
Information determines the positional shift value of first page object Yu the current operation page object, finally according to the position
Deviant is adjusted the current operation page object.Hereby it is achieved that the adjust automatically of page object, the row of effectively increasing
Version efficiency.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, the technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only
It is only a part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiment of the present invention, ordinary skill people
Member's every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
Fig. 1 shows the flow diagram of the page object automatic adjusting method of one embodiment of the invention offer, such as Fig. 1 institute
Show, the page object automatic adjusting method of the present embodiment is as described below.
101, the location information of each page object in current operation page object and its preset range is obtained.
It should be noted that the location information includes frame line position and position of center line.
For example, the length centered on acquisition current operation page object is each space of a whole page within the scope of the rectangle frame of 2mm
The frame line position and position of center line of object.Wherein, frame line may include top wire, following wire, left side wire and or
Frame line;Center line may include horizontal center line and vertical centerline.Above-mentioned level refers to each space of a whole page pair with vertical centerline
As place the space of a whole page in horizontal and vertical direction, above-mentioned length be 2mm rectangle frame be only the present embodiment one kind it is optional
Situation, can change the form of range or preset range according to actual needs, and the present embodiment is not limited thereof.
102, the location information of the first page object is extracted in the location information of each page object in the preset range.
It should be noted that first page object is with the current operation page object central point apart from the smallest
Page object.
In a particular application, above-mentioned step 102 may also include sub-step 1021 not shown in the figure to sub-step 1023.
1021, the central point distance of each page object in the current operation page object and its preset range is determined.
For example, above-mentioned central point can be the geometric center point of page object, then central point distance is each space of a whole page
The distance between object geometric center point.
1022, by the central point in the preset range with the current operation page object apart from the smallest page object
As the first page object.
It will be appreciated that the central point with current operation page object is currently grasped apart from the smallest page object as distance
Make the nearest page object of page object.
1023, the location information of first page object is extracted.
For example, the position of the first page object frame line and center line is extracted, specifically, can extract first space of a whole page
Object top wire, following wire, the position of left side wire or the right wire and horizontal center line and the position for holding up center line
It sets.In implementing operation, in mobile or creation current operation page object, first have to obtain is apart from the current operation space of a whole page
The nearest page object of object, i.e. each frame line of the first page object and the position of each center line.In a kind of enforceable side
In formula, above-mentioned each frame line and each center line can be shown with the close of current operation page object.
103, according to the location information of the location information of first page object and the current operation page object, really
The positional shift value of fixed first page object and the current operation page object.
It will be appreciated that above-mentioned positional shift value refers to current operation page object with the first page object for a certain phase
Same position (for example, upper side frame line position) in the horizontal direction or the distance of the relative position of vertical direction, i.e. the current operation space of a whole page
Object can be moved into the position being aligned with the first page object after the above-mentioned positional shift value of movement.
In a particular application, above-mentioned step 103 may also include sub-step 1031 and sub-step 1032 not shown in the figure.
1031, described first is determined according to the location information of first page object and the current operation page object
The reference line of page object and the current operation page object.
It will be appreciated that be determined first in calculating position deviant or when being moved to current operation page object
Reference line, the operation that page object is moved or is adjusted further according to reference line.
For example, the reference line can be top wire, following wire, left side wire, the right wire, horizontal center line
Or vertical centerline.
1032, the distance between the reference line of first page object and the current operation page object is calculated, and
It regard the distance between described reference line as the positional shift value.
For example, it may be determined that the left side wire of the first page object and current operation page object is benchmark line, and is counted
The distance between the first page object left side wire and current operation page object left side wire are calculated, and the first page object is left
The distance between frame line and current operation page object left side wire are used as positional shift value.
104, the current operation page object is adjusted according to the positional shift value.
In a particular application, can by the current operation page object in the space of a whole page in the horizontal direction or vertical direction is mobile
The distance of the positional shift value, so that the current operation page object is aligned with first page object.It is intelligible
It is, when current operation page object is aligned as benchmark line with the first page object using left side wire or the right wire, to need
The distance of horizontal direction shift position deviant;It and is benchmark line in the above frame line of current operation page object or following wire
When being aligned with the first page object, the distance in the mobile deviant of vertical direction is needed.
In a kind of enforceable mode, programming code can be used, above-mentioned current operation page object is adjusted automatically
It is whole.
For example, using left side wire as benchmark line, alignment adjustment is carried out to current operation page object.
RcOperatorItem refers to current operation page object position data, hereinafter referred to as operation object;
RcSnapItem refers to the position data of the page object captured, hereinafter referred to as capture object;
FAdjustSize refers to positional shift value;
FDeviation refers to allowable error value;
DItemDistance refers to the central point distance between page object.
First, it is determined that whether within a preset range to capture object, judgment method is as follows:
|rcOperatorItem.left-rcSnapItem.left|<fDeviation
If above-mentioned capture object is within a preset range, the positional shift value of calculating operation object and capture object is in
Heart point distance;
FAdjustSize=rcOperatorItem.left-rcSnapItem.left;
DItemDistance=sqrt ((dCenter1.x-dCenter2.x) * (dCenter1.x-dCenter2.x)+
(dCenter1.y-dCenter2.y)*(dCenter1.y-dCenter2.y));
The smallest page object of dItemDistance is found out within a preset range, using this object as the above-mentioned first edition
In face of as and current operation page object rcOperatorItem being deviated fAdjustSize in X-direction, to realize current behaviour
Make page object to be aligned with the first page object left side wire, as shown in Figure 4.
For example, using vertical centerline as benchmark line, alignment adjustment is carried out to current operation page object.
First, it is determined that whether within a preset range to capture object, judgment method is as follows:
DOperatorCenter=(rcOperatorItem.left+rcOperatorItem.right)/2;
DSnapCenter=(rcSnapItem.left+rcSnapItem.right)/2;
|dOperatorCenter-dSnapCenter|<fDeviation。
If above-mentioned capture object is within a preset range, the positional shift value of calculating operation object and capture object is in
Heart point distance;
FAdjustSize=dSnapCenter-dOperatorCenter;
DItemDistance=sqrt ((dCenter1.x-dCenter2.x) * (dCenter1.x-dCenter2.x)+
(dCenter1.y-dCenter2.y)*(dCenter1.y-dCenter2.y));
The smallest page object of dItemDistance is found out within a preset range, using this object as the above-mentioned first edition
In face of as and current operation page object rcOperatorItem being deviated fAdjustSize in X-direction, to realize current behaviour
Make page object to be aligned with the first page object vertical centerline, as shown in Figure 5.
The page object automatic adjusting method of the present embodiment, by the location information and the second edition that obtain the first page object
In face of the dimension information of elephant, and according to the dimension information of the location information of the first page object and the second page object to current behaviour
The position and size for making page object are adjusted.Hereby it is achieved that the adjust automatically of page object, effectively increases typesetting effect
Rate.
In another achievable mode, above-mentioned method may also include step shown in Fig. 2, to above-mentioned current operation
The size and spacing of page object are adjusted.Specifically:
201, the dimension information and pitch information of each page object in current operation page object and its preset range are obtained.
For example, dimension information may include the height and width of page object.Pitch information may include and the adjacent space of a whole page
Spacing between object.
202, the dimension information of the second page object is extracted in the dimension information of each page object in the preset range
And pitch information.
It should be noted that second page object is the size letter of dimension information and the current operation page object
Cease immediate page object.It will be appreciated that closest with the dimension information of current operation page object can include: with it is current
The height and the width for operating page object are closest, closest with the height of current operation page object, and and current operation
The width of page object is closest.
203, according to the dimension information of second page object and pitch information to the current operation page object into
Row adjustment.
Specifically, it may include at least one of following three kinds of modes:
The height of the current operation page object is adjusted to the height of second page object;
It is the width of second page object by the width adjustment of the current operation page object;
Spacing between the current operation page object and second page object is adjusted to second space of a whole page
Spacing between object and an adjacent page object.
It will be appreciated that the page object adjacent with the second page object not only includes the adjacent space of a whole page pair of horizontal direction
As further including the adjacent page object of vertical direction.Therefore, when adjusting the spacing of current operation page object, being will be current
Spacing between operation page object and the second page object be adjusted to the second page object and its a certain adjacent page object it
Between spacing, and choose the second page object which adjacent page object can be selected according to actual needs to be adjusted
It selects.For example, it is desired to the horizontal direction of current operation page object is adjusted, then it can be by current operation page object and second
Spacing between page object is adjusted to the spacing between the second page object page object adjacent with certain level.
In practical applications, programming code can be used to be automatically adjusted above-mentioned current operation page object.
For example, programming code can be used to be automatically adjusted above-mentioned current operation page object.Below to adjust
For the height and spacing of the whole current operation space of a whole page, the current operation space of a whole page is adjusted and is illustrated.
RcOperatorItem refers to current operation page object position data, hereinafter referred to as operation object;
RcSnapItem refers to the position data of the page object captured, hereinafter referred to as capture object;
FAdjustSize adjusted value;
FDeviation refers to allowable error value;
DItemDistance refers to the central point distance between page object.
First, it is determined that whether within a preset range to capture object, judgment method is identical as above-mentioned judgment method.
If above-mentioned capture object is within a preset range, the adjusted value of calculating operation object and the center with capture object
Point distance;
AdjustSize=rcSnapItem.Height ()-rcOperatorItem.Height ();
DItemDistance=sqrt ((dCenter1.x-dCenter2.x) * (dCenter1.x-dCenter2.x)+
(dCenter1.y-dCenter2.y)*(dCenter1.y-dCenter2.y));
The smallest page object of dItemDistance is found out within a preset range, using this object as the above-mentioned second edition
In face of as, and the height of current operation page object rcOperatorItem is increased or reduced into fAdjustSize in the Y direction,
And it is identical as the height of the second page object, to realize adjustment to current operation page object height, the adjustment of width with it is upper
It is similar to state step, details are not described herein again, and operation object adjusted is as shown in Figure 6.
In a kind of enforceable mode, the spacing of current operation page object can be also adjusted, to current behaviour
Make page object spacing be adjusted before, first the page object in preset range should be ranked up, and then to sequence
Page object afterwards adjusts spacing, specifically:
RcOperatorItem refers to current operation page object position data, hereinafter referred to as operation object;
RcSnapItem refers to the position data of the object captured, hereinafter referred to as capture object;
By the page object of rcSnapItem.BottomLeft () .x < rcOperatorItem.BottomLeft () .x
Left side object as operation object;
By rcSnapItem.BottomLeft () .x >=rcOperatorItem.BottomLeft () .x space of a whole page pair
As the right side object as operation object.
As shown in fig. 7, P1 is operation object, Si is object to be captured.Using P1 as rightmost side object, it is right successively to calculate left side
As whether there is equidistant object, existing, not continuing to.For example, the distance dDistance of S4 and P1 is calculated, if left side
Object exists and the distance of S4 is equal to the object Si of dDistance, then collecting (Si, S4, P1) is equidistant object.If S4 is not
Meet condition actually required and then reexamine S3, until capturing suitable Si;Again using P1 as leftmost side object, successively calculate right
Side object whether there is equidistant object;Above-mentioned capture object is compared, and the smallest object of dDistance is made
For best equidistant object, i.e., the second above-mentioned page object;The distance that current operation page object needs to deviate finally is calculated,
Current operation page object is adjusted, as shown in Fig. 8 to Figure 10.
The page object automatic adjusting method of the present embodiment, the size by obtaining the second page object in preset range are believed
Breath and pitch information, and according to the dimension information and pitch information to current operation page object height, width or object it
Between spacing be adjusted.Hereby it is achieved that the adjust automatically of page object, effectively increases typesetting efficiency.
Fig. 3 shows the page object automatic regulating apparatus of one embodiment of the invention offer, as described in Figure 3, the present embodiment
Page object automatic regulating apparatus, comprising: location information acquiring unit 31, the first page object location information extraction unit
32, positional shift value determination unit 33 and the first adjustment unit 34.
The location information acquiring unit 31, for obtaining each space of a whole page pair in current operation page object and its preset range
The location information of elephant;
First page object location information extraction unit 32, the position for page object each in the preset range are believed
The location information of the first page object is extracted in breath, first page object is and the current operation page object central point
Apart from the smallest page object;
Positional shift value determination unit 33, for the location information and the current operation according to first page object
The location information of page object determines the positional shift value of first page object Yu the current operation page object;
The first adjustment unit 34, for being adjusted according to the positional shift value to the current operation page object.
Optionally, described device further includes size and pitch information acquiring unit not shown in the figure, the second page object
Size and pitch information extraction unit and second adjustment unit.
Wherein, size and pitch information acquiring unit, it is each in current operation page object and its preset range for obtaining
The dimension information and pitch information of page object;
Second page object dimension information extraction unit, the dimension information for page object each in the preset range
With the dimension information for extracting the second page object in pitch information, second page object is dimension information and the current behaviour
Make the immediate page object of dimension information of page object;
Second adjustment unit, for the dimension information and pitch information according to second page object to the current behaviour
It is adjusted as page object.
The dimension information includes: height and width;
The pitch information includes: its spacing between adjacent page object.
Optionally, the first page object location information extraction unit 32 is specifically used for determining the current operation version
In face of as the central point distance with each page object in its preset range;By in the preset range with the current operation space of a whole page
The central point of object is apart from the smallest page object as the first page object;Extract the position letter of first page object
Breath.
Optionally, the positional shift value determination unit 33, specifically for according to first page object and described working as
The location information of preceding operation page object determines the reference line of first page object and the current operation page object;Meter
The distance between the reference line of first page object Yu the current operation page object is calculated, and will be between the reference line
Distance as positional shift value.
Optionally, the first adjustment unit 34, be specifically used for by the current operation page object in the space of a whole page along water
Square to or the mobile positional shift value of vertical direction distance so that the current operation page object and the first edition
In face of as alignment.
Optionally, the second adjustment unit, specifically for the height of the current operation page object is adjusted to institute
State the height of the second page object;
And/or
It is the width of second page object by the width adjustment of the current operation page object;
And/or
Spacing between the current operation page object and second page object is adjusted to second space of a whole page
Spacing between object and an adjacent page object.
The page object automatic regulating apparatus of the present embodiment, can be used for executing embodiment of the method shown in above-mentioned Fig. 1 or Fig. 2
Technical solution, it is similar that the realization principle and technical effect are similar, and details are not described herein again.
The page object automatic regulating apparatus of the present embodiment, by the location information of the first page object of acquisition, and according to
The location information of the location information of first page object and the current operation page object determines that the first edition faces
As the positional shift value with the current operation page object, finally according to the positional shift value to the current operation space of a whole page
Object is adjusted.Hereby it is achieved that the adjust automatically of page object, effectively increases typesetting efficiency.
Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent
Pipe present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: its according to
So be possible to modify the technical solutions described in the foregoing embodiments, or to some or all of the technical features into
Row equivalent replacement;And these are modified or replaceed, it does not separate the essence of the corresponding technical solution, and the claims in the present invention are limited
Fixed range.