CN111880776A - Hierarchical relationship obtaining method and device and electronic equipment - Google Patents

Hierarchical relationship obtaining method and device and electronic equipment Download PDF

Info

Publication number
CN111880776A
CN111880776A CN202010761393.3A CN202010761393A CN111880776A CN 111880776 A CN111880776 A CN 111880776A CN 202010761393 A CN202010761393 A CN 202010761393A CN 111880776 A CN111880776 A CN 111880776A
Authority
CN
China
Prior art keywords
layer
level
coverage area
hierarchical relationship
determined
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010761393.3A
Other languages
Chinese (zh)
Inventor
蔡宇
吴瑞卿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing IQIYI Science and Technology Co Ltd
Original Assignee
Beijing IQIYI Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing IQIYI Science and Technology Co Ltd filed Critical Beijing IQIYI Science and Technology Co Ltd
Priority to CN202010761393.3A priority Critical patent/CN111880776A/en
Publication of CN111880776A publication Critical patent/CN111880776A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the invention provides a hierarchical relationship obtaining method, a hierarchical relationship obtaining device and electronic equipment, and relates to the technical field of computers, wherein the hierarchical relationship obtaining method comprises the following steps: according to a design file of a user interface, obtaining the size and the position of each layer in the user interface; obtaining a starting layer based on each layer, and determining the level of the starting layer; based on the level of the initial layer, obtaining the hierarchical relationship of each layer according to the inclusion relationship between the coverage area of the layer of each undetermined level and the coverage area of the layer of the determined level in a mode of traversing each layer, wherein the coverage area of the upper layer includes the coverage area of the lower layer of the layer between the layers of the upper and lower level relationships in the hierarchical relationship, and the coverage area of each layer is as follows: the size and position of the layer characterize the area. By applying the hierarchical relationship obtaining scheme provided by the embodiment of the invention, the hierarchical relationship obtaining efficiency can be improved.

Description

Hierarchical relationship obtaining method and device and electronic equipment
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a hierarchical relationship obtaining method and apparatus, and an electronic device.
Background
In a UI (User Interface) development scenario, a designer usually designs a UI to obtain a design file, and then a developer develops the UI according to the design file.
The UI designed by the designer usually includes multiple layers, and there is a hierarchical relationship between the multiple layers. When a developer develops the UI according to the design file, the developer needs to obtain the hierarchical relationship between different layers, and develop the UI according to the hierarchical relationship.
In the prior art, when obtaining the hierarchical relationship, a developer is usually required to manually analyze a design file to obtain information of each layer in a UI designed by the developer, and manually determine the hierarchical relationship between each layer according to the obtained information. When the hierarchical relationship is obtained manually, a large amount of human resources are needed, and the efficiency of obtaining the hierarchical relationship is low.
Disclosure of Invention
The embodiment of the invention aims to provide a hierarchical relationship obtaining method, a hierarchical relationship obtaining device and electronic equipment so as to improve the efficiency of obtaining the hierarchical relationship. The specific technical scheme is as follows:
in a first aspect of the present invention, there is provided a hierarchical relationship obtaining method, including:
according to a design file of a user interface, obtaining the size and the position of each layer in the user interface;
obtaining a starting layer based on each layer, and determining the level of the starting layer;
based on the level of the initial layer, obtaining the hierarchical relationship of each layer according to the inclusion relationship between the coverage area of the layer of each undetermined level and the coverage area of the layer of the determined level in a mode of traversing each layer, wherein the coverage area of the upper layer includes the coverage area of the lower layer of the layer between the layers of the upper and lower level relationships in the hierarchical relationship, and the coverage area of each layer is as follows: the size and position of the layer characterize the area.
In an embodiment of the present invention, the determining the hierarchy of the starting layer includes:
determining the level of the starting layer as the uppermost level;
the obtaining the hierarchical relationship of each layer according to the inclusion relationship between the coverage area of the layer of each undetermined hierarchy and the coverage area of the layer of the determined hierarchy in a mode of traversing each layer based on the hierarchy of the starting layer includes:
selecting a layer with an undetermined hierarchy as a layer to be determined;
judging whether a target layer with a covering area containing the covering area of the layer to be determined exists in the layer of the current level, wherein the initial value of the current level is the uppermost level;
if the target layer does not exist in the layer of the current level, determining the level of the layer to be determined as the current level, searching the layer of which the coverage area belongs to the coverage area of the layer to be determined in the layer of the current level, and updating the level of the searched layer to the level of the lower layer of the layer to be determined;
if the target layer exists in the layer of the current level, updating the current level as: returning to the step of judging whether a target layer with a coverage area including the coverage area of the layer to be determined exists in the layer of the current level until the level of the layer to be determined is determined;
and returning to the step of selecting one layer of the undetermined layers as the layer to be determined until the layers of all the layers are determined to obtain the hierarchical relationship of each layer.
In an embodiment of the present invention, the obtaining a starting layer based on each layer includes:
creating a layer with a coverage area containing a total area as a starting layer, wherein the total area contains: the coverage area of all layers.
In one embodiment of the invention, the method further comprises:
obtaining the type of each layer in the user interface according to the design file of the user interface;
and adjusting the hierarchical relation according to the type of each layer.
In an embodiment of the present invention, the adjusting the hierarchical relationship according to the type of each layer includes:
sequentially traversing each level in the hierarchical relationship according to the sequence of the levels from bottom to top, removing the transparent type in the level and removing the first layer without a lower layer, and removing the upper-lower relationship comprising the first layer from the hierarchical relationship; and/or
And traversing each level in the hierarchical relationship in sequence according to the order of the levels from bottom to top, removing a second layer which is of a transparent type in the level and has the same size and position as the lower layer, removing the upper-lower relation including the second layer from the hierarchical relationship, and establishing the upper-lower relation between a third layer and a fourth layer, wherein the third layer is the upper layer of the second layer, and the fourth layer is the lower layer of the second layer.
In an embodiment of the present invention, the adjusting the hierarchical relationship according to the type of each layer includes:
and traversing each level in the hierarchical relationship in sequence according to the order of the levels from bottom to top, selecting a layer with an overlapping area in a coverage area from layers with the type in the level being a preset type and without lower layers, combining the selected layers into one layer, removing the upper-lower relationship comprising the selected layer from the hierarchical relationship, and establishing the upper-lower relationship between a fifth layer and the combined layer, wherein the fifth layer is the upper layer of the selected layer.
In an embodiment of the present invention, for an image layer with a mask, a coverage area of the image layer is: and the area which is overlapped with the area where the mask is positioned in the area represented by the size and the position of the image layer.
In an embodiment of the present invention, the obtaining, according to a design file of a user interface, a size and a position of each layer in the user interface includes:
aiming at a combined layer consisting of a plurality of layers, obtaining the size and the position of each layer in the combined layer according to a design file of a user interface;
and aiming at the non-combined layer, obtaining the size and the position of the non-combined layer according to a design file of a user interface.
In a second aspect of the present invention, there is provided a hierarchical relationship obtaining apparatus, the apparatus including:
the layer information obtaining module is used for obtaining the size and the position of each layer in the user interface according to a design file of the user interface;
the starting layer determining module is used for obtaining a starting layer based on each layer and determining the level of the starting layer;
a hierarchical relationship obtaining module, configured to obtain a hierarchical relationship of each layer according to an inclusion relationship between a coverage area of a layer with an undetermined hierarchy and a coverage area of a layer with a determined hierarchy in a manner of traversing each layer based on a hierarchy of the initial layer, where, between layers with upper and lower relationships in the hierarchical relationship, a coverage area of a higher layer includes a coverage area of a lower layer of the layer, and a coverage area of each layer is: the size and position of the layer characterize the area.
In an embodiment of the present invention, the starting layer determining module is specifically configured to:
obtaining an initial layer based on each layer, and determining the level of the initial layer as the highest level;
the hierarchical relationship obtaining module is specifically configured to:
selecting a layer with an undetermined hierarchy as a layer to be determined;
judging whether a target layer with a covering area containing the covering area of the layer to be determined exists in the layer of the current level, wherein the initial value of the current level is the uppermost level;
if the target layer does not exist in the layer of the current level, determining the level of the layer to be determined as the current level, searching the layer of which the coverage area belongs to the coverage area of the layer to be determined in the layer of the current level, and updating the level of the searched layer to the level of the lower layer of the layer to be determined;
if the target layer exists in the layer of the current level, updating the current level as: returning to the step of judging whether a target layer with a coverage area including the coverage area of the layer to be determined exists in the layer of the current level until the level of the layer to be determined is determined;
and returning to the step of selecting one layer of the undetermined layers as the layer to be determined until the layers of all the layers are determined to obtain the hierarchical relationship of each layer.
In an embodiment of the present invention, the starting layer determining module is specifically configured to:
creating a layer with a coverage area containing a total area as a starting layer, and determining the level of the starting layer, wherein the total area contains: the coverage area of all layers.
In one embodiment of the present invention, the apparatus further comprises:
the type obtaining module is used for obtaining the type of each layer in the user interface according to the design file of the user interface;
and the layer adjusting module is used for adjusting the hierarchical relationship according to the type of each layer.
In an embodiment of the present invention, the layer adjusting module is specifically configured to:
sequentially traversing each level in the hierarchical relationship according to the sequence of the levels from bottom to top, removing a first layer which is transparent in the level and does not have a lower layer, and removing the upper-lower relationship comprising the first layer from the hierarchical relationship; and/or
And traversing each level in the hierarchical relationship in sequence according to the order of the levels from bottom to top, removing a second layer which is transparent in the level and has the same size and position as the lower layer, removing the upper-lower relation including the second layer from the hierarchical relationship, and establishing the upper-lower relation between a third layer and a fourth layer, wherein the third layer is the upper layer of the second layer, and the fourth layer is the lower layer of the second layer.
In an embodiment of the present invention, the layer adjusting module is specifically configured to:
and traversing each level in the hierarchical relationship in sequence according to the order of the levels from bottom to top, selecting a layer with an overlapping area in a coverage area from layers with the type in the level being a preset type and without lower layers, combining the selected layers into one layer, removing the upper-lower relationship comprising the selected layer from the hierarchical relationship, and establishing the upper-lower relationship between a fifth layer and the combined layer, wherein the fifth layer is the upper layer of the selected layer.
In an embodiment of the present invention, for an image layer with a mask, a coverage area of the image layer is: and the area which is overlapped with the area where the mask is positioned in the area represented by the size and the position of the image layer.
In an embodiment of the present invention, the layer information obtaining module is specifically configured to:
aiming at a combined layer consisting of a plurality of layers, obtaining the size and the position of each layer in the combined layer according to a design file of a user interface;
and aiming at the non-combined layer, obtaining the size and the position of the non-combined layer according to a design file of a user interface.
In a third aspect of the present invention, there is also provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of the first aspect when executing a program stored in the memory.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium, having stored therein instructions, which, when run on a computer, cause the computer to perform any of the above-mentioned hierarchical relationship obtaining method steps.
In yet another aspect of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the above-described hierarchical relationship obtaining method steps.
When the scheme provided by the embodiment of the invention is applied to obtain the hierarchical relationship, the size and the position of each layer in the user interface can be obtained according to the design file of the user interface; obtaining an initial layer based on each layer, and determining the level of the initial layer; based on the level of the initial layer, obtaining the hierarchical relationship of each layer according to the inclusion relationship between the coverage area of the layer of each undetermined level and the coverage area of the layer of the determined level in a mode of traversing each layer, wherein the coverage area of the upper layer includes the coverage area of the lower layer of the layer between the layers of the upper and lower level relationships in the hierarchical relationship, and the coverage area of each layer is as follows: the size and position of the layer characterize the area. The size and position of each layer may characterize the coverage area of the layer. For the layers with the inclusion relationship in the coverage area, the layer with the larger coverage area is usually the upper layer, and the layer with the smaller coverage area is usually the lower layer, so that the upper-lower relationship of each layer can be obtained according to the inclusion relationship of the coverage area of each layer, and further the hierarchical relationship of each layer can be obtained. Therefore, by applying the hierarchical relationship obtaining scheme provided by the embodiment of the invention, the design file does not need to be analyzed manually when the hierarchical relationship is obtained, so that the consumption of human resources is reduced, and the efficiency of obtaining the hierarchical relationship can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a schematic flowchart of a hierarchical relationship obtaining method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a layer according to an embodiment of the present invention;
fig. 3 is a schematic flow chart of another hierarchical relationship obtaining method according to an embodiment of the present invention;
fig. 4 is a schematic diagram of layers included in a user interface according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a hierarchical relationship according to an embodiment of the present invention;
fig. 6 is a schematic flowchart of another hierarchical relationship obtaining method according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a hierarchical relationship obtaining apparatus according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
Because the hierarchical relationship obtaining efficiency is low in the prior art, in order to solve the technical problem, embodiments of the present invention provide a hierarchical relationship obtaining method, an apparatus, and an electronic device.
In an embodiment of the present invention, a hierarchical relationship obtaining method is provided, and the method may be applied to electronic devices such as a mobile phone, a desktop computer, a notebook computer, and a tablet computer, and may also be applied to software such as PS (Photo Shop), Sketch (drawing application program). The method comprises the following steps:
according to the design file of the user interface, the size and the position of each layer in the user interface are obtained;
obtaining an initial layer based on each layer, and determining the level of the initial layer;
based on the level of the initial layer, obtaining the hierarchical relationship of each layer according to the inclusion relationship between the coverage area of the layer of each undetermined level and the coverage area of the layer of the determined level in a mode of traversing each layer, wherein the coverage area of the upper layer includes the coverage area of the lower layer of the layer between the layers of the upper and lower level relationships in the hierarchical relationship, and the coverage area of each layer is as follows: the size and position of the layer characterize the area.
When the scheme provided by the above embodiment is applied to obtain the hierarchical relationship, the size and position of each layer can represent the coverage area of the layer. For the layers with the inclusion relationship in the coverage area, the layer with the larger coverage area is usually the upper layer, and the layer with the smaller coverage area is usually the lower layer, so that the upper-lower relationship of each layer can be obtained according to the inclusion relationship of the coverage area of each layer, and further the hierarchical relationship of each layer can be obtained. Therefore, by applying the hierarchical relationship obtaining scheme provided by the embodiment of the invention, the design file does not need to be analyzed manually when the hierarchical relationship is obtained, so that the consumption of human resources is reduced, and the efficiency of obtaining the hierarchical relationship can be improved.
The method, the apparatus, and the electronic device for obtaining a hierarchical relationship according to the embodiments of the present invention are described in detail below with reference to specific embodiments.
Referring to fig. 1, fig. 1 is a schematic flow chart of a hierarchical relationship obtaining method according to an embodiment of the present invention, where the method includes the following steps 101 to 103.
Step 101, obtaining the size and position of each layer in the user interface according to the design file of the user interface.
The design file of the user interface is as follows: the designer designs the files obtained by the user interface, and the design files can be pictures, documents and the like. For example, in the case where a designer designs a design file by drawing software such as PS, Sketch, etc., the design file may be a picture; in the case where a designer designs a design file by document editing software such as Office Word, txt (text file), or the like, the design file may be a document.
The size of each layer can be represented by the length, width, radius and the like of the layer, and the unit of the size of the layer can be the number of pixels, centimeters, millimeters and the like. The position of a layer may be represented by the coordinates of the vertices, the coordinates of the center point, etc. of that layer.
In an embodiment of the present invention, when the design file is a picture, the design file may be obtained first, and then the image detection algorithm is used to detect the design file, so as to obtain the size and the position of each layer in the design file.
In an embodiment of the present invention, when the design file is a document, the document generally includes parameters such as a size, a position, a color, and a type of each layer, and in this case, the parameters such as the size and the position of each layer in the design file may be directly read, so as to obtain the size and the position of each layer.
Step 102, obtaining a starting layer based on each layer, and determining the level of the starting layer.
Specifically, the hierarchical relationship exists between layers, and a starting layer may be determined first, and then the hierarchical relationship of other layers with respect to the starting layer is determined with the starting layer as a reference, so as to obtain the hierarchical relationship of each layer.
In an embodiment of the present invention, a layer with the largest size may be selected as an initial layer, and in this case, it may be determined that the level of the initial layer is the top level; the layer with the smallest size can also be selected as the starting layer, and in this case, the hierarchy of the starting layer can be determined to be the lowest hierarchy; a new layer may also be created as an initial layer and a hierarchy determined for the newly created layer. And the created coverage area of the initial layer comprises the coverage area of each layer in the user interface.
And 103, based on the level of the initial layer, obtaining the hierarchical relationship of each layer in a mode of traversing each layer according to the inclusion relationship between the coverage area of each layer with an undetermined level and the coverage area of the layer with a determined level.
Wherein, the coverage area of each layer is: the size and position of the layer characterize the area. Specifically, according to the size and the position of the layer, the area occupied by the layer in the user interface, that is, the coverage area of the layer, may be determined.
And among the layers in the upper and lower levels of the hierarchical relationship, the coverage area of the upper layer comprises the coverage area of the lower layer of the layer.
Specifically, in the user interface, in consideration of the shielding of the upper layer from the lower layer, the layer with a larger coverage area is usually located at the lower layer, and the layer with a smaller coverage area is usually located at the upper layer, while in the hierarchical relationship, the layer located at the lower layer has a higher hierarchy and the layer located at the upper layer has a lower hierarchy, that is, the layer with a larger coverage area is usually located at the upper level of the layer with a smaller coverage area, and further, the coverage area exists between the layers with a containing relationship, and if the coverage area of one layer contains the coverage area of another layer, the hierarchy of the above-mentioned one layer is located at the upper level of the hierarchy of the other layer.
Referring to fig. 2, fig. 2 is a schematic diagram of a layer according to an embodiment of the present invention. As can be seen, if the coverage area of the layer B includes the coverage area of the layer a, the layer a may be considered to be located on the upper layer of the layer B, and then the hierarchy of the layer B may be considered to be located on the upper level of the hierarchy of the layer a.
Each layer can be traversed, for the currently traversed layer, the inclusion relationship between the coverage area of the layer and the coverage area of the layer with the determined hierarchy can be judged one by one, and the layer with the smallest size and the coverage area including the coverage area of the layer is determined to serve as the upper layer of the layer, that is, the hierarchy of the layer is determined as follows: the hierarchy of the lower layer of the upper layer. And traversing the layers of each undetermined layer in sequence until the layers of all the layers are determined, so as to obtain the hierarchical relation of each layer.
In an embodiment of the present invention, the layers may be traversed sequentially according to the order of the sizes of the layers from large to small. In this case, when determining a layer whose coverage area includes a coverage area of the layer, the layers having the determined hierarchy may be determined one by one in order from top to bottom of the hierarchy.
For example, assuming that there are layer 1, layer 2, and layer 3 with undetermined hierarchy, where the size relationship of the above layers is layer 1 > layer 2 > layer 3, the hierarchy of layer 1 is determined first. When the hierarchy of the layer 1 is determined, sequentially comparing the hierarchy with each layer of the determined hierarchy according to the sequence of the hierarchy from top to bottom, determining the layer with the smallest size and the coverage area including the coverage area of the layer, and determining the hierarchy of the layer 1 as the hierarchy of the lower layer of the layer. Since the coverage area of the layer with the higher hierarchy is larger, the hierarchy of each layer is sequentially determined according to the sequence, and the efficiency of determining the hierarchy can be improved.
In an embodiment of the present invention, the layers may also be sequentially traversed according to the order of the sizes of the layers from small to large. In this case, when determining a layer whose coverage area includes the coverage area of the layer, the layers of the determined hierarchy may be determined one by one in order from bottom to top of the hierarchy.
When the scheme provided by the embodiment is applied to obtain the hierarchical relationship, the size and the position of each layer in the user interface can be obtained according to the design file of the user interface; obtaining an initial layer based on each layer, and determining the level of the initial layer; based on the level of the initial layer, obtaining the hierarchical relationship of each layer according to the inclusion relationship between the coverage area of the layer of each undetermined level and the coverage area of the layer of the determined level in a mode of traversing each layer, wherein the coverage area of the upper layer includes the coverage area of the lower layer of the layer between the layers of the upper and lower level relationships in the hierarchical relationship, and the coverage area of each layer is as follows: the size and position of the layer characterize the area. The size and position of each layer may characterize the coverage area of the layer. For the layers with the inclusion relationship in the coverage area, the layer with the larger coverage area is usually the upper layer, and the layer with the smaller coverage area is usually the lower layer, so that the upper-lower relationship of each layer can be obtained according to the inclusion relationship of the coverage area of each layer, and further the hierarchical relationship of each layer can be obtained. Therefore, by applying the hierarchical relationship obtaining scheme provided by the embodiment, the design file does not need to be analyzed manually when the hierarchical relationship is obtained, so that the human resource consumption is reduced, and the efficiency of obtaining the hierarchical relationship can be improved.
The manner in which the hierarchical relationship is obtained in step 103 is described in detail below.
In an embodiment of the present invention, when determining the hierarchy of the starting layer, the hierarchy of the starting layer may be determined as the uppermost hierarchy.
In an embodiment of the present invention, for the step 102, when obtaining the starting layer, a layer whose coverage area includes the total area may be created as the starting layer. Wherein the total area comprises: the coverage area of all layers. The shape of the created starting layer may be a rectangle, a circle, an ellipse, etc., and the created starting layer may be a layer whose coverage area includes the total area and has the smallest size. That is, the coverage area of the created layer may be a circumscribed rectangular area, a circumscribed circular area, or the like of the total area.
Because the created coverage area of the start layer includes the coverage area of each layer in the user interface, that is, the start layer is located at the lowest layer of each layer in the user interface, the level of the start layer can be further determined as the highest level.
Referring to fig. 3, fig. 3 is a schematic flow chart of another hierarchical relationship obtaining method according to an embodiment of the present invention. When obtaining the hierarchical relationship of each layer, the following steps 301 to 305 may be included.
Step 301, selecting a layer of an undetermined hierarchy as a layer to be determined.
Specifically, one layer may be optionally selected from layers of undetermined levels as a layer to be determined. The layer with the largest size can also be selected as the layer to be determined.
Step 302, judging whether a target layer with a coverage area containing the coverage area of the layer to be determined exists in the layer of the current level, if so, executing step 304, and if not, executing step 303.
Wherein, the initial value of the current hierarchy is the uppermost hierarchy.
Specifically, the uppermost hierarchy may be used as the current hierarchy, each layer in the current hierarchy is traversed one by one, the coverage area of the layer to be determined is compared with the coverage area of each layer in the current hierarchy, and the layer whose coverage area includes the coverage area of the layer to be determined is used as the target layer. It may be determined whether a target layer exists in the current level, if so, step 304 is performed, and if not, step 303 is performed.
Step 303, determining the layer level of the layer to be determined as the current layer level, searching the layer of which the coverage area belongs to the coverage area of the layer to be determined in the layer of the current layer level, and updating the searched layer level to the layer level of the lower layer of the layer to be determined.
If the target layer does not exist in the layer of the current level, it is indicated that no layer whose coverage area includes the coverage area of the layer to be determined exists in the layer of the current level, that is, the layer to be determined does not belong to the lower layers of all layers in the current level, and thus the level of the layer to be determined can be regarded as the current level.
After the hierarchy of the layer to be determined is determined, whether the lower layer of the layer to be determined exists in the current hierarchy is required to be judged, whether the coverage area of the layer belongs to the coverage area of the layer to be determined can be sequentially judged for each layer except the layer to be determined in the current hierarchy, if the coverage area of the layer belongs to the coverage area of the layer to be determined, the layer is the lower layer of the layer to be determined, and therefore the hierarchy of the layer can be updated to the hierarchy of the lower layer of the layer to be determined; if not, it is indicated that the layer and the layer to be determined do not have a top-bottom relationship, and the layer level of the layer does not need to be updated.
Step 304, update the current hierarchy as: and returning to the step 302 until the hierarchy of the layer to be determined is determined according to the hierarchy of the lower layer of the target layer.
If a target layer exists in the current level, it is indicated that a layer whose coverage area includes a coverage area of a layer to be determined exists in the layer of the current level, that is, the layer to be determined belongs to a lower layer of the target layer. Therefore, the current level may be updated to the level where the lower layer of the target layer is located, and then the process returns to step 302 to determine whether there is a layer whose coverage area includes the coverage area of the layer to be determined in the lower layer until the level of the layer to be determined is determined.
And 305, returning to the step 301 until the hierarchy of all the layers is determined, and obtaining the hierarchical relationship of each layer.
Specifically, step 301 may be returned to, select a layer from the layers with undetermined hierarchy again as the layer to be determined, and determine the hierarchy for the new layer to be determined until the hierarchies of all the layers are determined, so as to obtain the hierarchical relationship of each layer.
In an embodiment of the present invention, when determining the hierarchical relationship of each layer, the hierarchical relationship of each layer may be further obtained by using a structure tree, where each node in the structure tree corresponds to one layer, and a layer where each node is located corresponds to each level in the hierarchical relationship. The created coverage area includes a starting layer of the coverage area of each layer, and since the starting layer is located at the uppermost level in the hierarchical relationship, the starting layer can be used as the root node of the structure tree. For the layers in the upper and lower level relations in the hierarchical relation, the upper layer is a father node in the structure tree, and the lower layer is a child node in the structure tree.
The scheme shown in FIG. 3 is described below by way of specific examples.
Referring to fig. 4, fig. 4 is a schematic diagram of layers included in a user interface according to an embodiment of the present invention. The method comprises the following steps of supposing that a layer A, a layer B and a layer C exist, wherein the coverage area of the layer C comprises the coverage area of the layer B.
Firstly, a layer can be created as a starting layer, the coverage area of the starting layer includes the coverage areas of layer a, layer B and layer C, and the starting layer is used as a root node in the structure tree.
For the layer a, the level corresponding to the root node is used as an initial current level, wherein the coverage area of the initial layer includes the coverage area of the layer a, so that the initial layer can be used as a target layer, at this time, the current level is updated to the level where the lower layer of the initial layer is located, no layer exists in the updated current level, and further, no target layer exists, so that the level of the layer a is directly determined as a new current level, that is, the layer a is used as a child node of the initial layer.
For the layer B, a hierarchy corresponding to the root node is used as an initial current hierarchy, where a coverage area of the initial layer includes a coverage area of the layer B, so that the initial layer may be used as a target layer, at this time, the current hierarchy is updated to a hierarchy where a lower layer of the initial layer is located, the updated current hierarchy has the layer a, and the coverage area of the layer a does not include the coverage area of the layer B, so that the hierarchy of the layer B may be determined as a new current hierarchy, that is, the layer B is used as a child node of the initial layer. In addition, the coverage area of layer a is determined not to belong to the coverage area of layer B, so the hierarchy of layer a is kept unchanged.
For the layer C, a level corresponding to the root node is used as an initial current level, wherein a coverage area of the initial layer includes a coverage area of the layer C, so that the initial layer can be used as a target layer, the current level is updated to a level where a lower layer of the initial layer is located, the updated current level includes a layer a and a layer B, the coverage area of the layer a does not include the coverage area of the layer C, and the coverage area of the layer B does not include the coverage area of the layer C, so that the level of the layer C can be determined as a new current level, that is, the layer C is used as a child node of the initial layer. In addition, the coverage area of the layer A is judged not to belong to the coverage area of the layer C, but the coverage area of the layer B belongs to the coverage area of the layer C, so that the hierarchy of the layer A is kept unchanged, and the hierarchy of the layer B is updated to the hierarchy of the lower layer of the layer C.
Thus, the hierarchical relationship of layer a, layer B, and layer C shown in fig. 5 is finally obtained.
In addition, when the hierarchical relationship is determined, the hierarchy of each layer can be determined according to the order of the hierarchical relationship from bottom to top.
The layer with the smallest size can be selected as the starting layer, and the hierarchy of the starting layer is determined to be the lowest hierarchy. A layer of the undetermined hierarchy may be selected as a layer to be determined, and it is determined whether a target layer whose coverage area belongs to the coverage area of the layer to be determined exists in the layer of the current hierarchy, where an initial value of the current hierarchy is a lowest hierarchy.
If the target layer does not exist in the layer of the current level, determining the level of the layer to be determined as the current level, searching the layer of which the coverage area contains the coverage area of the layer to be determined in the layer of the current level, and updating the level of the searched layer to the level of the upper layer of the layer to be determined.
If the layer of the current level has the target layer, updating the current level as follows: returning to the step of judging whether the target layer with the covering area belonging to the covering area of the layer to be determined exists in the layer of the current level until the level of the layer to be determined is determined
And returning to the step of selecting a layer with undetermined hierarchy as the layer to be determined until the hierarchy of all layers is determined to obtain the hierarchical relationship of each layer.
After the hierarchical relationship of each layer in the user interface is obtained in step 103, each layer and the hierarchical relationship may be adjusted, which will be described in detail below.
Referring to fig. 6, fig. 6 is a schematic flowchart of another hierarchical relationship obtaining method according to an embodiment of the present invention, where the method further includes step 104.
And 104, obtaining the type of each layer in the user interface according to the design file of the user interface, and adjusting the hierarchical relation according to the type of each layer.
The type of the layer may also be a picture, a graphic, a text, and the like.
Adjusting the hierarchical relationship includes: and combining a plurality of layers of each hierarchy into one layer, removing the layers and the like, and updating the hierarchy relation according to the combined/removed layers.
In an embodiment of the present invention, when the design file is a document, the design file may include parameters related to types of each layer, and the parameters of the type of each layer in the design file may be read, so as to obtain the type of each layer. When the design file is a picture, feature extraction can be performed on each layer in the picture, and the type of each layer is determined according to the extracted features.
In an embodiment of the present invention, the type of each layer manually input by the user may also be obtained. Specifically, the types of the layers may be analyzed manually, and then the analyzed types are input into the electronic device through the input device, so that the electronic device obtains the types of the layers.
In an embodiment of the present invention, when adjusting layers, each layer in the hierarchical relationship may be sequentially traversed according to a sequence from bottom to top of the layer, a transparent type in the layer is removed, a first layer of a lower layer does not exist, and a top-bottom relationship including the first layer is removed from the hierarchical relationship.
Specifically, if an image layer is of a transparent type and a lower image layer does not exist in the image layer, it is indicated that the image layer has no practical meaning in the user interface, and therefore the image layer can be removed. After the first layer is removed, the hierarchical relationship including the first layer may be removed from the hierarchical relationship, so as to update the hierarchical relationship.
For example, assume that there are layer 1 and layer 2, where layer 1 is an upper layer of layer 2, layer 2 is a transparent type, and there is no lower layer, so that layer 2 may be removed, and the upper-lower relationship between layer 2 and layer 1 in the hierarchical relationship is deleted, and in the updated hierarchical relationship, layer 1 does not have a lower layer containing layer 2.
In an embodiment of the present invention, each level in the hierarchical relationship may also be sequentially traversed according to a sequence from bottom to top of the level, the second layer of the transparent type in the level and having the same size and position as the lower layer is removed, the upper-lower relationship including the second layer is removed from the hierarchical relationship, and the upper-lower relationship between the third layer and the fourth layer is established.
The third layer is a higher layer of the second layer, and the fourth layer is a lower layer of the second layer.
Specifically, if a layer is of a transparent type and the size and position of a lower layer of the layer are the same as those of the layer, it is determined that the layer is overlapped with the lower layer thereof, and therefore, it may be considered that the layer of the transparent type is redundant, and the layer may be removed. After the second layer is removed, the hierarchical relationship including the upper-lower level relationship of the second layer may be removed, and the upper-lower level relationship between the upper layer and the lower layer of the second layer is established, so that the hierarchical relationship is updated.
For example, assume that there are layer 1, layer 2, and layer 3, where layer 1 is a higher layer of layer 2, layer 2 is a higher layer of layer 3, and layer 2 is a transparent type, and the size and position of layer 2 are completely the same as those of layer 3, so that layer 2 may be removed, the upper-lower level relationship between layer 2 and layer 1 and the upper-lower level relationship between layer 2 and layer 3 in the hierarchical relationship are deleted, and the upper-lower level relationship between layer 1 and layer 3 is established. In the updated hierarchical relationship, the lower layer of the layer 1 includes a layer 3.
If an image layer is of a transparent type and the size and position of a lower image layer of the image layer are not exactly the same as those of the image layer, it is indicated that the image layer may have a practical meaning, for example, a coverage area of the image layer may be an operation identification area in a user interface, and therefore the image layer is not deleted.
In an embodiment of the present invention, each hierarchy in the hierarchical relationship may be sequentially traversed according to a sequence of the hierarchy from bottom to top, layers having overlapping regions in coverage regions are selected from layers having a preset type and no lower-level layers in the hierarchy, the selected layers are merged into one layer, a top-bottom relationship including the selected layer is removed from the hierarchical relationship, and a top-bottom relationship between a fifth layer and the layer obtained by merging is established.
And the fifth layer is a higher layer of the selected layer.
Specifically, for layers of the same level, if there is a layer whose coverage area is an overlapping area in the above layers, the layers with the overlapping area may be merged into one layer. And removing the upper-lower level relation including the selected layer from the hierarchical relation, and establishing the upper-lower level relation between the fifth layer and the combined layer.
For example, if the layer W, the layer X, the layer Y, and the layer Z are at the same level and are lower layers of the layer V, where the layer X and the layer Y have an overlapping region and the layer Y and the layer Z have an overlapping region, the layer X, the layer Y, and the layer Z may be merged into the same layer P. Therefore, when the user interface is developed, the development workload can be reduced, and the development efficiency can be improved. And in the hierarchical relationship, removing the hierarchical relationship between the layer V and the layer X, the hierarchical relationship between the layer V and the layer Y, and the hierarchical relationship between the layer V and the layer Z, and establishing the upper-lower level relationship between the layer V and the layer P.
In an embodiment of the present invention, for an image layer with a mask, a coverage area of the image layer is: and the area which is overlapped with the area where the mask is positioned in the area represented by the size and the position of the layer. Therefore, for the layer with the mask, the area where the mask is located in the layer can be identified, and an area overlapping with the area where the mask is located, that is, the area which can be effectively displayed in the layer, is selected from the coverage area of the layer as the coverage area of the layer.
In an embodiment of the present invention, for the step 101, when obtaining the size and the position of each layer in the user interface, for a combined layer composed of a plurality of layers, the size and the position of each layer in the combined layer may be obtained according to a design file of the user interface; and aiming at the non-combined layer, obtaining the size and the position of the non-combined layer according to the design file of the user interface.
In a designed user interface, a combined layer obtained by combining a plurality of layers is usually included, so that when the size and the position of each layer are obtained, the combined layer can be deeply analyzed, and the size and the position of each layer in the combined layer are obtained; for non-combined layers, usually a single layer composition is used, in which case the size and position of the non-combined layers can be directly obtained.
Specifically, when the size and the position of each layer are obtained according to the design file, for each layer, it may be first determined whether the layer is a combined layer, and if not, the size and the position of the layer may be directly obtained; if so, the size and position of each layer in the combined layer may be obtained.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a hierarchical relationship obtaining apparatus according to an embodiment of the present invention, where the apparatus includes:
the layer information obtaining module 701 is configured to obtain a size and a position of each layer in a user interface according to a design file of the user interface;
an initial layer determining module 702, configured to obtain an initial layer based on each layer, and determine a level of the initial layer;
a hierarchical relationship obtaining module 703, configured to obtain, based on the level of the starting layer, a hierarchical relationship of each layer according to an inclusion relationship between a coverage area of a layer of each undetermined level and a coverage area of a layer of a determined level in a manner of traversing each layer, where, between layers of upper and lower levels in the hierarchical relationship, a coverage area of a higher layer includes a coverage area of a lower layer of the layer, and a coverage area of each layer is: the size and position of the layer characterize the area.
In an embodiment of the present invention, the starting layer determining module 702 is specifically configured to:
obtaining an initial layer based on each layer, and determining the level of the initial layer as the highest level;
the hierarchical relationship obtaining module 703 is specifically configured to:
selecting a layer with an undetermined hierarchy as a layer to be determined;
judging whether a target layer with a covering area containing the covering area of the layer to be determined exists in the layer of the current level, wherein the initial value of the current level is the uppermost level;
if the target layer does not exist in the layer of the current level, determining the level of the layer to be determined as the current level, searching the layer of which the coverage area belongs to the coverage area of the layer to be determined in the layer of the current level, and updating the level of the searched layer to the level of the lower layer of the layer to be determined;
if the target layer exists in the layer of the current level, updating the current level as: returning to the step of judging whether a target layer with a coverage area including the coverage area of the layer to be determined exists in the layer of the current level until the level of the layer to be determined is determined;
and returning to the step of selecting one layer of the undetermined layers as the layer to be determined until the layers of all the layers are determined to obtain the hierarchical relationship of each layer.
In an embodiment of the present invention, the starting layer determining module 702 is specifically configured to:
creating a layer with a coverage area containing a total area as a starting layer, and determining the level of the starting layer, wherein the total area contains: the coverage area of all layers.
In one embodiment of the present invention, the apparatus further comprises:
the type obtaining module is used for obtaining the type of each layer in the user interface according to the design file of the user interface;
and the layer adjusting module is used for adjusting the hierarchical relationship according to the type of each layer.
In an embodiment of the present invention, the layer adjusting module is specifically configured to:
sequentially traversing each level in the hierarchical relationship according to the sequence of the levels from bottom to top, removing a first layer which is transparent in the level and does not have a lower layer, and removing the upper-lower relationship comprising the first layer from the hierarchical relationship; and/or
And traversing each level in the hierarchical relationship in sequence according to the order of the levels from bottom to top, removing a second layer which is transparent in the level and has the same size and position as the lower layer, removing the upper-lower relation including the second layer from the hierarchical relationship, and establishing the upper-lower relation between a third layer and a fourth layer, wherein the third layer is the upper layer of the second layer, and the fourth layer is the lower layer of the second layer.
In an embodiment of the present invention, the layer adjusting module is specifically configured to:
and traversing each level in the hierarchical relationship in sequence according to the order of the levels from bottom to top, selecting a layer with an overlapping area in a coverage area from layers with the type in the level being a preset type and without lower layers, combining the selected layers into one layer, removing the upper-lower relationship comprising the selected layer from the hierarchical relationship, and establishing the upper-lower relationship between a fifth layer and the combined layer, wherein the fifth layer is the upper layer of the selected layer.
In an embodiment of the present invention, for an image layer with a mask, a coverage area of the image layer is: and the area which is overlapped with the area where the mask is positioned in the area represented by the size and the position of the image layer.
In an embodiment of the present invention, the layer information obtaining module 701 is specifically configured to:
aiming at a combined layer consisting of a plurality of layers, obtaining the size and the position of each layer in the combined layer according to a design file of a user interface;
and aiming at the non-combined layer, obtaining the size and the position of the non-combined layer according to a design file of a user interface.
When the scheme provided by the embodiment is applied to obtain the hierarchical relationship, the size and the position of each layer in the user interface can be obtained according to the design file of the user interface; obtaining an initial layer based on each layer, and determining the level of the initial layer; based on the level of the initial layer, obtaining the hierarchical relationship of each layer according to the inclusion relationship between the coverage area of the layer of each undetermined level and the coverage area of the layer of the determined level in a mode of traversing each layer, wherein the coverage area of the upper layer includes the coverage area of the lower layer of the layer between the layers of the upper and lower level relationships in the hierarchical relationship, and the coverage area of each layer is as follows: the size and position of the layer characterize the area. The size and position of each layer may characterize the coverage area of the layer. For the layers with the inclusion relationship in the coverage area, the layer with the larger coverage area is usually the upper layer, and the layer with the smaller coverage area is usually the lower layer, so that the upper-lower relationship of each layer can be obtained according to the inclusion relationship of the coverage area of each layer, and further the hierarchical relationship of each layer can be obtained. Therefore, by applying the hierarchical relationship obtaining scheme provided by the embodiment, the design file does not need to be analyzed manually when the hierarchical relationship is obtained, so that the human resource consumption is reduced, and the efficiency of obtaining the hierarchical relationship can be improved.
An embodiment of the present invention further provides an electronic device, as shown in fig. 8, which includes a processor 801, a communication interface 802, a memory 803, and a communication bus 804, where the processor 801, the communication interface 802, and the memory 803 complete mutual communication through the communication bus 804,
a memory 803 for storing a computer program;
the processor 801 is configured to implement the steps of the hierarchical relationship obtaining method when executing the program stored in the memory 803.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In another embodiment of the present invention, a computer-readable storage medium is further provided, in which instructions are stored, and when the instructions are executed on a computer, the computer is caused to execute the hierarchical relationship obtaining method described in any one of the above embodiments.
In another embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the hierarchical relationship obtaining method described in any one of the above embodiments.
When the scheme provided by the embodiment is applied to obtain the hierarchical relationship, the size and the position of each layer in the user interface can be obtained according to the design file of the user interface; obtaining an initial layer based on each layer, and determining the level of the initial layer; based on the level of the initial layer, obtaining the hierarchical relationship of each layer according to the inclusion relationship between the coverage area of the layer of each undetermined level and the coverage area of the layer of the determined level in a mode of traversing each layer, wherein the coverage area of the upper layer includes the coverage area of the lower layer of the layer between the layers of the upper and lower level relationships in the hierarchical relationship, and the coverage area of each layer is as follows: the size and position of the layer characterize the area. The size and position of each layer may characterize the coverage area of the layer. For the layers with the inclusion relationship in the coverage area, the layer with the larger coverage area is usually the upper layer, and the layer with the smaller coverage area is usually the lower layer, so that the upper-lower relationship of each layer can be obtained according to the inclusion relationship of the coverage area of each layer, and further the hierarchical relationship of each layer can be obtained. Therefore, by applying the hierarchical relationship obtaining scheme provided by the embodiment, the design file does not need to be analyzed manually when the hierarchical relationship is obtained, so that the human resource consumption is reduced, and the efficiency of obtaining the hierarchical relationship can be improved.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, apparatus embodiments, electronic device embodiments, computer-readable storage medium embodiments, and computer program product embodiments are substantially similar to method embodiments and therefore are described with relative ease, as appropriate, with reference to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (11)

1. A hierarchical relationship obtaining method, the method comprising:
according to a design file of a user interface, obtaining the size and the position of each layer in the user interface;
obtaining a starting layer based on each layer, and determining the level of the starting layer;
based on the level of the initial layer, obtaining the hierarchical relationship of each layer according to the inclusion relationship between the coverage area of the layer of each undetermined level and the coverage area of the layer of the determined level in a mode of traversing each layer, wherein the coverage area of the upper layer includes the coverage area of the lower layer of the layer between the layers of the upper and lower level relationships in the hierarchical relationship, and the coverage area of each layer is as follows: the size and position of the layer characterize the area.
2. The method according to claim 1, wherein the determining the hierarchy of the starting layer comprises:
determining the level of the starting layer as the uppermost level;
the obtaining the hierarchical relationship of each layer according to the inclusion relationship between the coverage area of the layer of each undetermined hierarchy and the coverage area of the layer of the determined hierarchy in a mode of traversing each layer based on the hierarchy of the starting layer includes:
selecting a layer with an undetermined hierarchy as a layer to be determined;
judging whether a target layer with a covering area containing the covering area of the layer to be determined exists in the layer of the current level, wherein the initial value of the current level is the uppermost level;
if the target layer does not exist in the layer of the current level, determining the level of the layer to be determined as the current level, searching the layer of which the coverage area belongs to the coverage area of the layer to be determined in the layer of the current level, and updating the level of the searched layer to the level of the lower layer of the layer to be determined;
if the target layer exists in the layer of the current level, updating the current level as: returning to the step of judging whether a target layer with a coverage area including the coverage area of the layer to be determined exists in the layer of the current level until the level of the layer to be determined is determined;
and returning to the step of selecting one layer of the undetermined layers as the layer to be determined until the layers of all the layers are determined to obtain the hierarchical relationship of each layer.
3. The method according to claim 2, wherein obtaining the starting layer based on each layer comprises:
creating a layer with a coverage area containing a total area as a starting layer, wherein the total area contains: the coverage area of all layers.
4. The method of claim 1, further comprising:
obtaining the type of each layer in the user interface according to the design file of the user interface;
and adjusting the hierarchical relation according to the type of each layer.
5. The method according to claim 4, wherein the adjusting the hierarchical relationship according to the type of each layer includes:
sequentially traversing each level in the hierarchical relationship according to the sequence of the levels from bottom to top, removing the transparent type in the level and removing the first layer without a lower layer, and removing the upper-lower relationship comprising the first layer from the hierarchical relationship; and/or
And traversing each level in the hierarchical relationship in sequence according to the order of the levels from bottom to top, removing a second layer which is of a transparent type in the level and has the same size and position as the lower layer, removing the upper-lower relation including the second layer from the hierarchical relationship, and establishing the upper-lower relation between a third layer and a fourth layer, wherein the third layer is the upper layer of the second layer, and the fourth layer is the lower layer of the second layer.
6. The method according to claim 4, wherein the adjusting the hierarchical relationship according to the type of each layer includes:
and traversing each level in the hierarchical relationship in sequence according to the order of the levels from bottom to top, selecting a layer with an overlapping area in a coverage area from layers with the type in the level being a preset type and without lower layers, combining the selected layers into one layer, removing the upper-lower relationship comprising the selected layer from the hierarchical relationship, and establishing the upper-lower relationship between a fifth layer and the combined layer, wherein the fifth layer is the upper layer of the selected layer.
7. The method according to any one of claims 1 to 6,
for a layer with a mask, the coverage area of the layer is as follows: and the area which is overlapped with the area where the mask is positioned in the area represented by the size and the position of the image layer.
8. The method according to any one of claims 1 to 6, wherein the obtaining the size and the position of each layer in the user interface according to the design file of the user interface comprises:
aiming at a combined layer consisting of a plurality of layers, obtaining the size and the position of each layer in the combined layer according to a design file of a user interface;
and aiming at the non-combined layer, obtaining the size and the position of the non-combined layer according to a design file of a user interface.
9. A hierarchical relationship obtaining apparatus, the apparatus comprising:
the layer information obtaining module is used for obtaining the size and the position of each layer in the user interface according to a design file of the user interface;
the starting layer determining module is used for obtaining a starting layer based on each layer and determining the level of the starting layer;
a hierarchical relationship obtaining module, configured to obtain a hierarchical relationship of each layer according to an inclusion relationship between a coverage area of a layer with an undetermined hierarchy and a coverage area of a layer with a determined hierarchy in a manner of traversing each layer based on a hierarchy of the initial layer, where, between layers with upper and lower relationships in the hierarchical relationship, a coverage area of a higher layer includes a coverage area of a lower layer of the layer, and a coverage area of each layer is: the size and position of the layer characterize the area.
10. The apparatus according to claim 9, wherein the start layer determining module is specifically configured to:
obtaining an initial layer based on each layer, and determining the level of the initial layer as the highest level;
the hierarchical relationship obtaining module is specifically configured to:
selecting a layer with an undetermined hierarchy as a layer to be determined;
judging whether a target layer with a covering area containing the covering area of the layer to be determined exists in the layer of the current level, wherein the initial value of the current level is the uppermost level;
if the target layer does not exist in the layer of the current level, determining the level of the layer to be determined as the current level, searching the layer of which the coverage area belongs to the coverage area of the layer to be determined in the layer of the current level, and updating the level of the searched layer to the level of the lower layer of the layer to be determined;
if the target layer exists in the layer of the current level, updating the current level as: returning to the step of judging whether a target layer with a coverage area including the coverage area of the layer to be determined exists in the layer of the current level until the level of the layer to be determined is determined;
and returning to the step of selecting one layer of the undetermined layers as the layer to be determined until the layers of all the layers are determined to obtain the hierarchical relationship of each layer.
11. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 8 when executing a program stored in the memory.
CN202010761393.3A 2020-07-31 2020-07-31 Hierarchical relationship obtaining method and device and electronic equipment Pending CN111880776A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010761393.3A CN111880776A (en) 2020-07-31 2020-07-31 Hierarchical relationship obtaining method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010761393.3A CN111880776A (en) 2020-07-31 2020-07-31 Hierarchical relationship obtaining method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN111880776A true CN111880776A (en) 2020-11-03

Family

ID=73205006

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010761393.3A Pending CN111880776A (en) 2020-07-31 2020-07-31 Hierarchical relationship obtaining method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111880776A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113835704A (en) * 2021-09-27 2021-12-24 中电金信软件有限公司 Layout file generation method, device, equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108733371A (en) * 2018-05-16 2018-11-02 北京奇艺世纪科技有限公司 A kind of interface creating method, device and equipment
CN109710362A (en) * 2018-12-26 2019-05-03 掌阅科技股份有限公司 Screenshot processing method calculates equipment and computer storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108733371A (en) * 2018-05-16 2018-11-02 北京奇艺世纪科技有限公司 A kind of interface creating method, device and equipment
CN109710362A (en) * 2018-12-26 2019-05-03 掌阅科技股份有限公司 Screenshot processing method calculates equipment and computer storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113835704A (en) * 2021-09-27 2021-12-24 中电金信软件有限公司 Layout file generation method, device, equipment and storage medium
CN113835704B (en) * 2021-09-27 2024-05-10 中电金信软件有限公司 Layout file generation method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US9697423B1 (en) Identifying the lines of a table
US11023540B2 (en) Web page clustering method and device
US20150134913A1 (en) Method and apparatus for cleaning files in a mobile terminal and associated mobile terminal
US8108360B2 (en) Database object update order determination
CN109697414B (en) Text positioning method and device
CN111444750B (en) PDF document identification method and device and electronic equipment
CN109144392B (en) Method and device for processing gesture conflict and electronic equipment
CN110688353A (en) File management method, device and computer readable medium
CN111858613B (en) Service data retrieval method
CN114116065A (en) Method and device for acquiring topological graph data object and electronic equipment
CN113282799A (en) Node operation method and device, computer equipment and storage medium
CN106484779B (en) File operation method and device
CN111400575A (en) User identification generation method, user identification method and device
CN116682130A (en) Method, device and equipment for extracting icon information and readable storage medium
CN111880776A (en) Hierarchical relationship obtaining method and device and electronic equipment
CN111126029B (en) Electronic document generation method and device, computer equipment and storage medium
CN111913777A (en) Information processing method, information processing device, electronic equipment and storage medium
CN112069236A (en) Associated file display method, device, equipment and storage medium
CN116088721A (en) Page interaction method, device, equipment and storage medium
CN110688995A (en) Map query processing method, computer-readable storage medium and mobile terminal
CN110989893A (en) Click operation response method and device and electronic equipment
CN111553130A (en) Chapter title style conversion method and device, electronic equipment and storage medium
CN110908570B (en) Image processing method, device, terminal and storage medium
CN113961296A (en) Page element layout method and device, readable medium and electronic equipment
CN111881050A (en) Method and device for clipping text layer and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination