CN111857703B - Method and device for matching layers in interface and electronic equipment - Google Patents

Method and device for matching layers in interface and electronic equipment Download PDF

Info

Publication number
CN111857703B
CN111857703B CN202010761354.3A CN202010761354A CN111857703B CN 111857703 B CN111857703 B CN 111857703B CN 202010761354 A CN202010761354 A CN 202010761354A CN 111857703 B CN111857703 B CN 111857703B
Authority
CN
China
Prior art keywords
layer
checked
standard
layers
type
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.)
Active
Application number
CN202010761354.3A
Other languages
Chinese (zh)
Other versions
CN111857703A (en
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 CN202010761354.3A priority Critical patent/CN111857703B/en
Publication of CN111857703A publication Critical patent/CN111857703A/en
Application granted granted Critical
Publication of CN111857703B publication Critical patent/CN111857703B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the invention provides a method and a device for matching layers in an interface and electronic equipment, wherein the method comprises the following steps: acquiring attribute information of each layer to be checked in the interface to be checked, and acquiring attribute information of each standard layer in the standard interface; ordering each layer to be checked according to the position of each layer to be checked and a preset ordering rule; traversing each layer to be checked according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of each layer to be checked and each standard layer when traversing one layer to be checked; determining a standard layer matched with the currently traversed layer to be checked; and continuing to traverse the next layer to be checked until the traversal of all the layers to be checked is finished. Because the corresponding relation of the layers in the application program interface and the corresponding interface of the design draft does not need to be identified manually, the determining efficiency of the corresponding relation of the layers to be checked and the standard layers can be greatly improved.

Description

Method and device for matching layers in interface and electronic equipment
Technical Field
The present invention relates to the field of application program development technologies, and in particular, to a method and an apparatus for matching layers in an interface, and an electronic device.
Background
In the development process of the application program interface, the interface development is carried out according to the requirement of the design manuscript which is finished in advance, and after the development is finished, the application program interface needs to be checked and accepted in order to detect whether the application program interface meets the requirement of the design manuscript.
The current way of accepting an application program interface relies on manual work. Specifically, after the corresponding interfaces of the application program interface and the design draft are obtained, the corresponding relation of the layers in the corresponding interfaces of the application program interface and the design draft is manually identified by an acceptance person, and then according to the corresponding relation, the patterns of the layers of the application program interface and the intervals between the layers are compared with the patterns of the corresponding layers in the design draft and the intervals between the layers, and the layers with wrong patterns and/or intervals are marked, so that an acceptance result is obtained.
Therefore, in the current acceptance method, the correspondence relationship between the application program interface and the layer in the interface corresponding to the design draft needs to be manually identified, so that the determination efficiency of the correspondence relationship is very low.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for matching layers in an interface and electronic equipment, so as to improve the determination efficiency of the corresponding relation of the layers in the interface. The specific technical scheme is as follows:
In a first aspect, an embodiment of the present invention provides a method for matching layers in an interface, where the method includes:
Acquiring attribute information of each layer to be checked in an interface to be checked, and acquiring attribute information of each standard layer in a standard interface, wherein the standard interface is defined by a design draft corresponding to the interface to be checked, and the attribute information comprises size, position and type;
sequencing each layer to be checked according to the position of each layer to be checked and a preset sequencing rule to obtain a sequencing result;
traversing each layer to be checked according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of each layer to be checked and each standard layer when traversing one layer to be checked;
Determining a standard layer matched with the currently traversed layer to be checked based on the matching degree, recording the corresponding relation between the currently traversed layer to be checked and the standard layer, and determining that the standard layer is matched;
And continuing to traverse the next layer to be checked, returning to the step of calculating the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and the positions of the layers to be checked and the standard layers until the traversal of all the layers to be checked is finished, and obtaining the corresponding relation between the layers to be checked and the standard layers.
Optionally, before the step of traversing each layer to be checked according to the sorting result, the method further includes:
Determining adjacent layers of each standard layer according to the positions of the standard layers;
The step of calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of the layers to be checked and the standard layers comprises the following steps:
Determining adjacent layers of the currently traversed layers to be checked according to the positions of the layers to be checked;
and respectively calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer based on the type of the currently traversed layer to be checked and the adjacent layers and the type of each currently unmatched standard layer and the adjacent layers.
Optionally, the step of calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer based on the type of the currently traversed layer to be checked and the adjacent layer and the type of each currently unmatched standard layer and the adjacent layer respectively includes:
determining whether the type of the currently traversed layer to be checked is the same as the type of each currently unmatched standard layer;
If the matching degree is different, determining the matching degree between the currently traversed layer to be checked and the unmatched standard layers with different types as a first matching degree;
if so, determining whether the type of the adjacent layers of the currently traversed layer to be checked is the same as the type of the adjacent layers of each unmatched target standard layer, wherein the target standard layer is a standard layer with the same type as the type of the currently traversed layer to be checked;
if the type of the adjacent layers of the currently traversed layer to be checked is the same as the type of the adjacent layers of the target standard layer, determining that the matching degree between the currently traversed layer to be checked and the target standard layer is a second matching degree;
if the type of the adjacent layers of the currently traversed layer to be checked is different from the type of the adjacent layers of the target standard layer, determining that the matching degree between the currently traversed layer to be checked and the target standard layer is a third matching degree;
And if the type of the adjacent layers of the currently traversed layer to be checked is not identical to the type of the adjacent layers of the target standard layer, determining the matching degree between the currently traversed layer to be checked and the target standard layer based on the number of the layers with the identical type.
Optionally, the attribute information further includes transparency;
Before the step of sorting the layers to be inspected according to the positions of the layers to be inspected and a preset sorting rule to obtain a sorting result, the method further includes:
and removing the layers with the transparency of 100% from the layers to be checked and accepted and the standard layers.
Optionally, the attribute information further includes color;
Before the step of sorting the layers to be inspected according to the positions of the layers to be inspected and a preset sorting rule to obtain a sorting result, the method further includes:
Selecting a layer only comprising background color from the layers to be checked and the standard layers as a target layer;
For each target layer, determining whether the target layer is included according to the size and the position of each layer to be checked or each standard layer;
If any, the target layer is removed in the case where the background color of the layer having the smallest area among the layers including the target layer is the same as the background color of the target layer.
Optionally, the step of obtaining attribute information of each layer to be checked in the interface to be checked and obtaining attribute information of each standard layer in the standard interface includes:
calling a preset view interface, and extracting attribute information of each layer to be checked in the interface to be checked;
Analyzing each standard layer in the standard interface to obtain attribute information of each standard layer in the standard interface.
Optionally, the step of analyzing each standard layer in the standard interface to obtain attribute information of each standard layer in the standard interface includes:
Analyzing a standard interface, and determining whether each layer in the standard interface is provided with a mask or not and whether each layer is a composite layer or not;
Cutting a layer with a mask according to the size of the mask to obtain a corresponding standard layer, and determining attribute information of the standard layer;
And decomposing the composite layer aiming at the composite layer to obtain each standard layer forming the composite layer, and determining attribute information of each standard layer.
In a second aspect, an embodiment of the present invention provides a device for matching layers in an interface, where the device includes:
the system comprises an attribute information acquisition module, a storage module and a storage module, wherein the attribute information acquisition module is used for acquiring attribute information of each layer to be checked in an interface to be checked and acquiring attribute information of each standard layer in a standard interface, wherein the standard interface is an interface defined by a design draft corresponding to the interface to be checked and comprises a size, a position and a type;
The layer ordering module is used for ordering the layers to be checked according to the positions of the layers to be checked and a preset ordering rule to obtain an ordering result;
the matching degree calculation module is used for traversing each layer to be checked according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of each layer to be checked and each standard layer when one layer to be checked is traversed;
The corresponding relation determining module is used for determining a standard layer matched with the currently traversed layer to be checked based on the matching degree, recording the corresponding relation between the currently traversed layer to be checked and the standard layer, and determining that the standard layer is matched; and continuing to traverse the next layer to be checked, returning to calculate the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and the positions of the layers to be checked and the standard layers until the traversal of all the layers to be checked is finished, and obtaining the corresponding relation between the layers to be checked and the standard layers.
Optionally, the apparatus further includes:
The adjacent layer determining module is used for determining the adjacent layer of each standard layer according to the position of each standard layer before the step of traversing each layer to be checked according to the sequencing result;
the matching degree calculating module comprises:
The adjacent layer determining unit is used for determining the adjacent layers of the currently traversed layers to be checked according to the positions of the layers to be checked;
And the matching degree determining unit is used for respectively calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer based on the type of the currently traversed layer to be checked and the adjacent layer and the type of each currently unmatched standard layer and the adjacent layer.
Optionally, the matching degree determining unit includes:
a first type determining subunit, configured to determine whether the type of the currently traversed layer to be checked is the same as the type of each currently unmatched standard layer;
The first matching degree determining subunit is used for determining that the matching degree between the currently traversed layer to be checked and the unmatched standard layers with different types is the first matching degree if the currently traversed layer to be checked and the unmatched standard layers with different types are different;
A second type determining subunit, configured to determine, if the type of the adjacent layer of the currently traversed layer to be checked is the same as the type of the adjacent layer of each unmatched target standard layer, where the target standard layer is a standard layer having the same type as the type of the currently traversed layer to be checked;
The second matching degree determining subunit is configured to determine that the matching degree between the currently traversed layer to be checked and the target standard layer is the second matching degree if the type of the adjacent layer of the currently traversed layer to be checked is the same as the type of the adjacent layer of the target standard layer;
a third matching degree determining subunit, configured to determine that, if the type of the adjacent layer of the currently traversed layer to be checked is different from the type of the adjacent layer of the target standard layer, the matching degree between the currently traversed layer to be checked and the target standard layer is the third matching degree;
And the fourth matching degree determining subunit is configured to determine, if the type of the adjacent layer of the currently traversed layer to be checked is not identical to the type of the adjacent layer of the target standard layer, the matching degree between the currently traversed layer to be checked and the target standard layer based on the number of layers with the identical type.
In a third aspect, an embodiment of the present invention provides 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;
and the processor is used for realizing the steps of the matching method of the image layer in the interface in any one of the first aspect when executing the program stored in the memory.
In a fourth aspect, an embodiment of the present invention provides a computer readable buffer medium, where a computer program is buffered in the computer readable buffer medium, where the computer program when executed by a processor implements the steps of the matching method of the image layer in the interface in any one of the first aspects.
In a fifth aspect, embodiments of the present invention provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method steps of matching layers in an interface as described in any of the first aspects above.
In the scheme provided by the embodiment of the invention, the electronic equipment can acquire the attribute information of each layer to be checked in the interface to be checked and acquire the attribute information of each standard layer in the standard interface, wherein the standard interface is an interface defined by a design draft corresponding to the interface to be checked, and the attribute information comprises size, position and type; sequencing each layer to be checked according to the position of each layer to be checked and a preset sequencing rule to obtain a sequencing result; traversing each layer to be checked according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of each layer to be checked and each standard layer when traversing one layer to be checked; determining a standard layer matched with the currently traversed layer to be checked based on the matching degree, recording the corresponding relation between the currently traversed layer to be checked and the standard layer, and determining that the standard layer is matched; and continuing to traverse the next layer to be checked, and returning to the step of calculating the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and positions of the layers to be checked and each standard layer until the traversal of all the layers to be checked is finished, so as to obtain the corresponding relation between each layer to be checked and each standard layer. Because the corresponding relation of the layers in the application program interface and the corresponding interface of the design draft does not need to be identified manually, the determining efficiency of the corresponding relation of the layers to be checked and the standard layers can be greatly 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 flowchart of a method for matching layers in an interface according to an embodiment of the present invention;
FIG. 2 (a) is a schematic diagram of an interface to be checked provided by an embodiment of the present invention;
FIG. 2 (b) is a schematic diagram of a standard interface provided by an embodiment of the present invention;
FIG. 3 is a flow chart of a manner of determining the degree of matching based on the embodiment shown in FIG. 1;
FIG. 4 is a flow chart of a layer cleaning scheme based on the embodiment shown in FIG. 1;
FIG. 5 is a flow chart of a parsing scheme of a standard interface based on the embodiment shown in FIG. 1;
fig. 6 is a schematic structural diagram of a matching device for layers in an interface according to an embodiment of the present invention;
FIG. 7 is a schematic diagram showing a specific structure of the matching degree calculating module 630 in the embodiment shown in FIG. 6;
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 accompanying drawings in the embodiments of the present invention.
In order to improve the efficiency of determining the correspondence between the layer to be checked and the standard layer during the application program interface checking, the embodiment of the invention provides a method, a device, electronic equipment, a computer readable storage medium and a computer program product for matching the layers in the interface. The following describes a method for matching layers in an interface provided by an embodiment of the present invention.
The matching method of the layers in the interface provided by the embodiment of the invention can be used for arbitrarily determining the corresponding relation between the layers to be checked and the standard layers. The electronic device may be an electronic device such as a mobile phone, a computer, a tablet computer, etc., which is not particularly limited herein. For clarity of description, hereinafter, referred to as an electronic device.
As shown in fig. 1, a method for matching layers in an interface, the method includes:
S101, acquiring attribute information of each layer to be checked in the interface to be checked, and acquiring attribute information of each standard layer in the standard interface;
The standard interface is defined by a design draft corresponding to the interface to be checked, and the attribute information comprises size, position and type.
S102, sorting the layers to be inspected according to the positions of the layers to be inspected and a preset sorting rule to obtain a sorting result;
s103, traversing each layer to be checked according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and the positions of each layer to be checked and each standard layer when traversing one layer to be checked;
S104, determining a standard layer matched with the currently traversed layer to be checked based on the matching degree, recording the corresponding relation between the currently traversed layer to be checked and the standard layer, and determining that the standard layer is matched;
And S105, continuously traversing the next layer to be checked and returning to the step of calculating the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and the positions of the layers to be checked and the standard layers until the traversal of all the layers to be checked is finished, and obtaining the corresponding relation between the layers to be checked and the standard layers.
In the solution provided by the embodiment of the present invention, the electronic device may obtain attribute information of each layer to be inspected in the interface to be inspected, and obtain attribute information of each layer to be inspected in the standard interface, where the standard interface is an interface defined by a design draft corresponding to the interface to be inspected, and the attribute information includes a size, a position, and a type; sequencing each layer to be checked according to the position of each layer to be checked and a preset sequencing rule to obtain a sequencing result; traversing each layer to be checked according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of each layer to be checked and each standard layer when traversing one layer to be checked; determining a standard layer matched with the currently traversed layer to be checked based on the matching degree, recording the corresponding relation between the currently traversed layer to be checked and the standard layer, and determining that the standard layer is matched; and continuing to traverse the next layer to be checked, and returning to the step of calculating the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and positions of the layers to be checked and each standard layer until the traversal of all the layers to be checked is finished, so as to obtain the corresponding relation between each layer to be checked and each standard layer. Because the corresponding relation of the layers in the application program interface and the corresponding interface of the design draft does not need to be identified manually, the determining efficiency of the corresponding relation of the layers to be checked and the standard layers can be greatly improved.
When the correspondence between the layers to be checked and the standard layers needs to be determined, the electronic device may execute the step S101, that is, obtain attribute information of each layer to be checked in the interface to be checked, and obtain attribute information of each standard layer in the standard interface, where the standard interface is an interface defined by a design draft corresponding to the interface to be checked. The attribute information of the layer may include the size, position, type, style, etc. of the layer, and the style may include information of font, font size, frame shape, color, etc. The types of layers may include text types and picture types.
The layer to be checked is a layer in the interface to be checked, and the standard layer is a layer in the standard interface defined by the design draft, which is only for conveniently distinguishing the layers in the two interfaces, and has no other limiting meaning.
After the attribute information is obtained, the electronic device may determine the corresponding relationship between each layer to be checked and each standard layer based on the size, the position and the type of each layer to be checked and each standard layer, specifically, the electronic device may sort each layer to be checked according to the position of each layer to be checked and a preset sorting rule, so as to obtain a sorting result, that is, execute the step S102.
In order to facilitate subsequent traversal, the electronic device may sort the layers to be inspected according to a preset sorting rule and the positions of the layers to be inspected, so as to obtain a sorting result. The preset ordering rule may be to order the positions in the interface from top to bottom, from left to right, and the like, which is all reasonable.
After the sorting result is obtained, the electronic device can traverse each layer to be checked according to the sorting result, namely the sorting result traverses from the first layer to be checked to the last layer to be checked. When traversing one layer to be checked, the electronic equipment can calculate the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of each layer to be checked and each standard layer.
For the first traversal to-be-checked layer, the current unmatched standard layers are all standard layers, that is, for the first traversal to-be-checked layer, the matching degree between the to-be-checked layer and all standard layers needs to be calculated. For the non-first traversal layers to be checked, the standard layers which are not matched at present are the standard layers which are not determined corresponding relation at present in all the standard layers. That is, for the layer to be checked that is not the first traversal, the matching degree between the layer to be checked and each standard layer that is currently remaining and has not yet determined the correspondence needs to be calculated.
In one embodiment, the electronic device may determine the layers to be checked around the currently traversed layers to be checked according to the positions of the layers to be checked, and similarly, may determine the standard layers around each standard layer according to the positions of the standard layers. Furthermore, whether the type of the currently traversed layer to be checked is the same as the type of each currently unmatched standard layer can be compared, whether the type of the standard layer around the currently traversed layer to be checked is the same as the type of the standard layer around each unmatched standard layer can be also compared, and the matching degree is determined according to the two comparison results.
Next, in step S104, the electronic device may determine, based on the matching degree, a standard layer matching with the currently traversed layer to be checked, record a correspondence between the currently traversed layer to be checked and the standard layer, and determine that the standard layer is matched. After the matching degree is determined, the electronic device can determine the standard layer matched with the currently-traversed layer to be checked, and record a matching result, namely the corresponding relation between the currently-traversed layer to be checked and the standard layer.
As one implementation, the electronic device may determine the standard layer with the highest matching degree as the standard layer corresponding to the currently traversed layer to be checked. Then the standard layer, i.e. the matched standard layer, can not calculate the matching degree between the standard layer and the standard layer when traversing the next layer to be checked, so as to reduce the calculation amount and improve the matching efficiency.
And then, the electronic equipment can continue to traverse the next layer to be checked and return to the step of calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and the positions of the layers to be checked and the standard layers until the traversal of all the layers to be checked is finished, so that the corresponding relation between the layers to be checked and the standard layers can be obtained.
As an implementation manner of the embodiment of the present invention, before the step of traversing each layer to be checked according to the sorting result, the method may further include:
And determining adjacent layers of each standard layer according to the positions of the standard layers.
Because the matching degree between the adjacent layers needs to be calculated when the matching degree between the layers is calculated, in order to improve the traversing efficiency, the electronic device can determine the adjacent layers of each standard layer according to the positions of the standard layers before traversing each layer to be checked according to the sequencing result. The adjacent layers can be layers adjacent to the standard layers in the 4 directions of up, down, left and right in the interface, or 2 or 3 layers adjacent to the standard layers in the four directions can be selected as the adjacent layers, which is reasonable.
Correspondingly, the step of calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of the layers to be checked and the standard layers may include:
Determining adjacent layers of the current layer to be checked according to the positions of the layers to be checked; and respectively calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer based on the type of the currently traversed layer to be checked and the adjacent layers and the type of each currently unmatched standard layer and the adjacent layers.
The electronic device may determine, according to the positions of the layers to be checked, adjacent layers of the currently traversed layer to be checked, where the adjacent layers may be layers that are adjacent to the currently traversed layer to be checked in the up-down, left-right, 4 directions in the interface, or may select 2 or 3 layers that are adjacent in the four directions as the adjacent layers. In order to facilitate the determination of the degree of matching, the number of adjacent layers of the currently traversed layers to be accepted and the standard layers and the corresponding directions in the interface may remain consistent.
After determining the adjacent layers of the currently traversed to-be-inspected layer, the electronic device can calculate the matching degree between the currently traversed to-be-inspected layer and each currently unmatched standard layer based on the types of the currently traversed to-be-inspected layer and the adjacent layers and the types of each currently unmatched standard layer and the adjacent layers.
For example, in the acceptance interface 200 shown in fig. 2 (a), adjacent layers of the currently traversed acceptance layer 210 include an adjacent layer 211, an adjacent layer 212, and an adjacent layer 213. As shown in fig. 2 (b), in the standard interface 201, the unmatched standard layers include a standard layer 220, a standard layer 221, a standard layer 222, and a standard layer 223. The electronic device may determine the degree of matching between the currently traversed layer under inspection 210 and standard layer 220, standard layer 221, standard layer 222, and standard layer 223, respectively.
In calculating the matching degree between the currently traversed layer to be checked 210 and the standard layer 220, it may be determined whether the type of the currently traversed layer to be checked 210 is the same as the type of the standard layer 220, and whether the types of the adjacent layer 211, the adjacent layer 212 and the adjacent layer 213 are the same as the types of the standard layer 221, the standard layer 222 and the standard layer 223 respectively, so as to obtain the matching degree.
It can be seen that, in this embodiment, the electronic device may determine, according to the positions of the to-be-inspected layers, the adjacent layers of the currently traversed to-be-inspected layer, and calculate, based on the type of the currently traversed to-be-inspected layer and its adjacent layers, and the type of each currently unmatched standard layer and its adjacent layers, the matching degree between the currently traversed to-be-inspected layer and each currently unmatched standard layer, so that the types of the currently traversed to-be-inspected layer and its adjacent layers may be considered simultaneously, and accuracy of the matching degree calculation may be ensured.
As shown in fig. 3, the step of calculating, based on the type of the currently traversed layer to be checked and the adjacent layers thereof, and the type of each currently unmatched standard layer and the adjacent layers thereof, the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer may include:
s301, determining whether the type of the currently traversed layer to be checked is the same as the type of each currently unmatched standard layer, and if so, executing step S302; if so, step S303 is performed;
since whether the type of the currently traversed layer to be checked is the same as the type of each currently unmatched standard layer directly determines whether the two layers can be matched, for example, the type of the currently traversed layer to be checked is a text layer, and the type of one unmatched standard layer is a picture layer, the two layers are obviously unmatched.
The electronic device may first determine whether the type of the currently traversed layer to be accepted is the same as the type of each currently unmatched standard layer, and if not, execute step S302. If so, step S303 is continued to determine if the types of adjacent pre-layers are the same.
S302, determining the matching degree between the currently traversed layer to be checked and the unmatched standard layers with different types as a first matching degree;
If the type of the currently traversed layer to be checked is different from the type of the standard layer, the matching degree between the currently traversed layer to be checked and the standard layer is the lowest, and the matching degree may be determined to be the first matching degree, for example, the first matching degree may be 0.
S303, determining whether the type of the adjacent layer of the currently traversed layer to be checked is the same as the type of the adjacent layer of each unmatched target standard layer, and if the type of the adjacent layer of the currently traversed layer to be checked is the same as the type of the adjacent layer of the target standard layer, executing step S304; if the types of the adjacent layers of the currently traversed layer to be checked are different from the types of the adjacent layers of the target standard layer, executing step S305; if the type of the adjacent layer of the currently traversed layer to be checked is not identical to the type of the adjacent layer of the target standard layer, executing step S306;
If the type of the currently traversed layer to be checked is the same as the type of a certain unmatched standard layer, the standard layer will be referred to as a target standard layer for convenience of description, that is, the target standard layer is a standard layer with the same type as the type of the currently traversed layer to be checked.
At this time, the electronic device may continue to determine whether the type of the adjacent layer of the currently traversed layer to be checked is the same as the type of the adjacent layer of each unmatched target standard layer. For example, the number of target standard layers is 3, which are respectively a target standard layer 1, a target standard layer 2 and a target standard layer 3. The electronic device can respectively judge whether the type of the adjacent layer of the currently traversed layer to be checked is the same as the type of the adjacent layer of the target standard layer 1; judging whether the type of the adjacent layer of the currently traversed layer to be checked is the same as the type of the adjacent layer of the target standard layer 2; and judging whether the type of the adjacent layer of the currently traversed layer to be checked is the same as the type of the adjacent layer of the target standard layer 3.
When judging the types of the adjacent layers, in order to ensure the accuracy of the result, the positions of the adjacent layers of the currently traversed layer to be checked and the positions of the adjacent layers of the target standard layer can be consistent. For example, the adjacent layers of the currently traversed layer to be accepted include a layer above the currently traversed layer to be accepted and a layer to the right, and then the electronic device may compare the type of the layer above the currently traversed layer to be accepted with the type of the layer above the target standard layer, and likewise compare the type of the layer to the right of the currently traversed layer to be accepted with the type of the layer to the right of the target standard layer.
S304, determining the matching degree between the currently traversed layer to be checked and the target standard layer as a second matching degree;
If the type of the currently traversed layer to be checked is the same as the type of the target standard layer, and the type of the adjacent layer of the currently traversed layer to be checked is also the same as the type of the adjacent layer of the target standard layer, which means that the types of the currently traversed layer to be checked and the surrounding layers are the same as the type of the target standard layer and the surrounding layers, then it may be determined that the matching degree between the currently traversed layer to be checked and the standard layer is the highest, and the electronic device may execute step S304, i.e. determine that the matching degree between the currently traversed layer to be checked and the target standard layer is the second matching degree. Wherein the second degree of matching may be 1.
S305, determining the matching degree between the currently traversed layer to be checked and the target standard layer as a third matching degree;
If the type of the adjacent layers of the currently traversed layer to be checked is different from the type of the adjacent layers of the target standard layer, the type of the currently traversed layer to be checked is the same as the type of the target standard layer, but the types of surrounding layers are different, and then the currently traversed layer to be checked and the target standard layer are not matched.
At this time, the electronic device may determine that the matching degree between the currently traversed layer to be checked and the target standard layer is a third matching degree, where the third matching degree may be the same as the first matching degree. Of course, the third matching degree may be a smaller value, so long as it may indicate that the matching degree is lower, for example, 0.1, 0.15, 0.2, etc.
S306, determining the matching degree between the currently traversed layer to be checked and the target standard layer based on the number of layers with the same type.
If the type of the currently traversed layer to be checked is the same as the type of the target standard layer and the type of the adjacent layer of the currently traversed layer to be checked is the same as the type of the adjacent layer of the target standard layer and different from the type of the adjacent layer, the matching degree between the currently traversed layer to be checked and the target standard layer can be determined according to the number of the adjacent layers with the same type, for example, the matching degree can be a numerical value between 0 and 1.
In one embodiment, the greater the number of adjacent layers of the same type, the higher the degree of matching between the currently traversed layer to be accepted and the target standard layer may be.
It can be seen that, in this embodiment, the electronic device may accurately determine, according to the type of the currently traversed layer to be checked and the type of the adjacent layer, the type of the target standard layer and the type of the adjacent layer, the matching degree between the currently traversed layer to be checked and each unmatched standard layer, so as to improve the accuracy of the corresponding relationship.
The attribute information may further include transparency as an implementation of the embodiment of the present invention. In this case, before the step of sorting the layers to be inspected according to the positions of the layers to be inspected and the preset sorting rule to obtain the sorting result, the method may further include:
and removing the layers with the transparency of 100% from the layers to be checked and accepted and the standard layers.
Since the layer with the transparency of 100% is visually invisible, the layer with the transparency of 100% has no effect on the display effect of the application program interface for the user, so that the layer with the transparency of 100% in each layer to be checked and each standard layer can be removed in order to increase the processing speed and reduce the calculation amount.
Therefore, in this embodiment, before ordering the layers to be checked according to the positions of the layers to be checked and the preset ordering rule, and obtaining the ordering result, the electronic device may remove the layers with transparency of 100% from the layers to be checked and the standard layers, so that the processing speed may be increased, and the calculation amount may be reduced.
The attribute information may further include a color as one implementation of the embodiment of the present invention. In this case, as shown in fig. 4, before the step of sorting the layers to be inspected according to the positions of the layers to be inspected and the preset sorting rule to obtain the sorting result, the method may further include:
s401, selecting a layer only comprising background color from the layers to be checked and the standard layers as a target layer;
Since the layer including only the background color is not visually visible if it is covered by other layers having the same background color as the other layers, the layer including only the background color has no influence on the display effect of the application program interface for the user, so that the electronic device can screen out of the layers to be checked and the standard layers, the layer including only the background color as the target layer.
S402, for each target layer, determining whether a layer comprising the target layer exists according to the size and the position of each layer to be checked or each standard layer, and if so, executing step S403; and if not, executing the step of sequencing the layers to be checked according to the positions of the layers to be checked and a preset sequencing rule to obtain a sequencing result.
For each target layer, the electronic device may determine whether to have a layer including the target layer according to the size and position of each layer to be accepted or each standard layer. If the target layer is one of the layers to be checked, the electronic device may determine whether there is a layer to be checked including the target layer according to the size and the position of each layer to be checked; if the target layer is one of the standard layers, the electronic device may determine whether to have a standard layer including the target layer according to the size and location of each standard layer.
If the layer including the target layer is not included, the target layer is only a layer which needs to be displayed in the application program interface although the target layer has a background color, so the electronic device can continue to execute the step of sorting the layers to be inspected according to the positions of the layers to be inspected and the preset sorting rule to obtain a sorting result.
S403, removing the target layer if the background color of the layer with the smallest area among the layers including the target layer is the same as the background color of the target layer.
If there is a layer that includes the target layer, the electronic device may further determine whether a background color of a layer that includes the target layer and has a smallest area among the layers that includes the target layer is the same as the background color of the target layer, and if so, the target layer may be removed because it is indicated as being visually invisible. If not, the target layer is said to have an influence on the display effect of the application program interface visually, so that the removal operation may not be performed. And executing the step of sequencing each layer to be checked according to the positions of the layers to be checked and a preset sequencing rule to obtain a sequencing result.
It can be seen that, in this embodiment, the electronic device may screen out the layers including only the background color from the layers to be checked and the standard layers, as the target layers, determine, for each target layer, whether to have a layer including the target layer according to the size and the position of each layer to be checked or each standard layer, and if so, remove the target layer if the background color of the layer having the smallest area among the layers including the target layer is the same as the background color of the target layer, so that the processing speed may be improved and the calculation amount may be reduced.
As an implementation manner of the embodiment of the present invention, the step of obtaining attribute information of each layer to be inspected in the interface to be inspected and obtaining attribute information of each standard layer in the standard interface may include:
Calling a preset view interface, and extracting attribute information of each layer to be checked in the interface to be checked; analyzing each standard layer in the standard interface to obtain attribute information of each standard layer in the standard interface.
Because the interface to be checked is a developed executable application program interface, the electronic equipment can call the preset view interface to extract the attribute information of each layer to be checked in the interface to be checked. The preset view interface may be any interface capable of providing a function of analyzing attribute information of a layer in the interface, which is not specifically limited herein.
The standard interface is an interface in a design draft, which is a draft drawn by a design institute and used for guiding development, and is generally a file in the formats of psd, sketch and the like, so that attribute information of a standard layer in the standard interface cannot be extracted through a preset view interface. In order to obtain the attribute information of the standard layers, the electronic device may analyze each standard layer in the standard interface through image processing software or the like, so as to obtain the attribute information of each standard layer in the standard interface. The image processing software may be PhotoShop, sketch, figma or the like, and is not particularly limited herein.
It can be seen that, in this embodiment, the electronic device may call the preset view interface, extract attribute information of each layer to be checked in the interface to be checked, and parse each standard layer in the standard interface to obtain attribute information of each standard layer in the standard interface. Thus, the attribute information of the image layer can be accurately obtained for the interface to be checked or the standard interface.
As shown in fig. 5, the step of analyzing each standard layer in the standard interface to obtain attribute information of each standard layer in the standard interface may include:
s501, analyzing a standard interface, and determining whether each layer in the standard interface is provided with a mask and is a composite layer;
The actual display effect of the layers due to the masking is affected. The composite layer is composed of a plurality of layers which are composited together. For both cases, therefore, in order to ensure the accuracy of the determination result of the above-mentioned correspondence relationship, the electronic device may perform corresponding processing for both cases.
Specifically, the electronic device may parse the standard interface to determine whether each layer in the standard interface has a mask and is a composite layer.
S502, cutting a layer with a mask according to the size of the mask to obtain a corresponding standard layer, and determining attribute information of the standard layer;
Because the image layer with the mask can only be seen by a user when the image layer is actually displayed in the application program interface, and the area covered by the mask is not seen, the electronic device can cut the image layer according to the size of the mask to obtain a corresponding standard image layer, and determine the attribute information of the standard image layer.
S503, decomposing the composite layer according to the composite layer to obtain each standard layer forming the composite layer, and determining attribute information of each standard layer.
For the conforming layer, development is required to be performed on each standard layer forming the conforming layer to obtain a corresponding layer to be checked, so that the composite layer can be decomposed to obtain each standard layer forming the composite layer, and then attribute information of each standard layer is determined.
It can be seen that, in this embodiment, the electronic device may process the layer with the mask and the composite layer respectively, so as to ensure accuracy of the obtained attribute information of each standard layer.
Corresponding to the method for matching the layers in the interface, the embodiment of the invention also provides a device for matching the layers in the interface. The following describes a device for matching layers in an interface provided by an embodiment of the present invention.
As shown in fig. 6, a device for matching layers in an interface, the device includes:
the attribute information obtaining module 610 is configured to obtain attribute information of each layer to be checked in the interface to be checked, and obtain attribute information of each standard layer in the standard interface;
The standard interface is defined by a design draft corresponding to the interface to be checked, and the attribute information comprises size, position and type.
The layer ordering module 620 is configured to order the layers to be checked according to the positions of the layers to be checked and a preset ordering rule, so as to obtain an ordering result;
The matching degree calculating module 630 is configured to traverse each layer to be checked according to the sorting result, and calculate, when traversing one layer to be checked, a matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to types and positions of each layer to be checked and each standard layer;
The correspondence determining module 640 is configured to determine, based on the matching degree, a standard layer that matches the currently traversed layer to be checked, record a correspondence between the currently traversed layer to be checked and the standard layer, and determine that the standard layer is matched; and continuing to traverse the next layer to be checked, returning to calculate the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and the positions of the layers to be checked and the standard layers until the traversal of all the layers to be checked is finished, and obtaining the corresponding relation between the layers to be checked and the standard layers.
In the solution provided by the embodiment of the present invention, the electronic device may obtain attribute information of each layer to be inspected in the interface to be inspected, and obtain attribute information of each layer to be inspected in the standard interface, where the standard interface is an interface defined by a design draft corresponding to the interface to be inspected, and the attribute information includes a size, a position, and a type; sequencing each layer to be checked according to the position of each layer to be checked and a preset sequencing rule to obtain a sequencing result; traversing each layer to be checked according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of each layer to be checked and each standard layer when traversing one layer to be checked; determining a standard layer matched with the currently traversed layer to be checked based on the matching degree, recording the corresponding relation between the currently traversed layer to be checked and the standard layer, and determining that the standard layer is matched; and continuing to traverse the next layer to be checked, and returning to the step of calculating the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and positions of the layers to be checked and each standard layer until the traversal of all the layers to be checked is finished, so as to obtain the corresponding relation between each layer to be checked and each standard layer. Because the corresponding relation of the layers in the application program interface and the corresponding interface of the design draft does not need to be identified manually, the determining efficiency of the corresponding relation of the layers to be checked and the standard layers can be greatly improved.
As an implementation manner of the embodiment of the present invention, the foregoing apparatus may further include:
The adjacent layer determining module is used for determining the adjacent layer of each standard layer according to the position of each standard layer before the step of traversing each layer to be checked according to the sequencing result;
As shown in fig. 7, the matching degree calculating module 630 may include:
the adjacent layer determining unit 631 is configured to determine, according to the positions of the layers to be checked, an adjacent layer of the currently traversed layer to be checked;
The matching degree determining unit 632 is configured to calculate, based on the type of the currently traversed layer to be checked and the adjacent layers thereof, and the type of each currently unmatched standard layer and the adjacent layers thereof, a matching degree between the currently traversed layer to be checked and each currently unmatched standard layer.
As an implementation manner of the embodiment of the present invention, the matching degree determining unit 632 may include:
a first type determining subunit, configured to determine whether the type of the currently traversed layer to be checked is the same as the type of each currently unmatched standard layer;
The first matching degree determining subunit is used for determining that the matching degree between the currently traversed layer to be checked and the unmatched standard layers with different types is the first matching degree if the currently traversed layer to be checked and the unmatched standard layers with different types are different;
A second type determining subunit, configured to determine, if the type of the adjacent layer of the currently traversed layer to be checked is the same as the type of the adjacent layer of each unmatched target standard layer, where the target standard layer is a standard layer having the same type as the type of the currently traversed layer to be checked;
The second matching degree determining subunit is configured to determine that the matching degree between the currently traversed layer to be checked and the target standard layer is the second matching degree if the type of the adjacent layer of the currently traversed layer to be checked is the same as the type of the adjacent layer of the target standard layer;
a third matching degree determining subunit, configured to determine that, if the type of the adjacent layer of the currently traversed layer to be checked is different from the type of the adjacent layer of the target standard layer, the matching degree between the currently traversed layer to be checked and the target standard layer is the third matching degree;
And the fourth matching degree determining subunit is configured to determine, if the type of the adjacent layer of the currently traversed layer to be checked is not identical to the type of the adjacent layer of the target standard layer, the matching degree between the currently traversed layer to be checked and the target standard layer based on the number of layers with the identical type.
As an implementation of the embodiment of the present invention, the attribute information may further include transparency;
The apparatus may further include:
And the first layer cleaning module is used for removing the layers with the transparency of 100% from the layers to be checked and the standard layers before sequencing the layers to be checked according to the positions of the layers to be checked and a preset sequencing rule to obtain a sequencing result.
As one implementation of the embodiment of the present invention, the attribute information may further include a color;
The apparatus may further include:
the layer screening module is used for screening out layers only comprising background colors from the layers to be checked and the standard layers before the layers to be checked are ordered according to the positions of the layers to be checked and a preset ordering rule to obtain an ordering result, and the layers to be checked are used as target layers;
the layer selection module is used for determining whether each target layer is provided with a layer comprising the target layer according to the size and the position of each layer to be checked or each standard layer;
And the second layer cleaning module is used for removing the target layer if any, if the background color of the layer with the smallest area in the layers comprising the target layer is the same as the background color of the target layer.
As an implementation manner of the embodiment of the present invention, the attribute information obtaining module 610 may include:
the first attribute information acquisition unit is used for calling a preset view interface and extracting attribute information of each layer to be checked in the interface to be checked;
the second attribute information acquisition unit is used for analyzing each standard layer in the standard interface to acquire attribute information of each standard layer in the standard interface.
As one implementation of the embodiment of the present invention, the second attribute information acquiring unit may include:
The interface analysis subunit is used for analyzing the standard interface and determining whether each layer in the standard interface is provided with a mask or not and whether each layer is a composite layer or not;
The first information acquisition subunit is used for cutting a layer with a mask according to the size of the mask to obtain a corresponding standard layer and determining attribute information of the standard layer;
and the second information acquisition subunit is used for decomposing the composite layer aiming at the composite layer to obtain each standard layer forming the composite layer and determining attribute information of each standard layer.
The embodiment of the present invention further provides an electronic device, as shown in fig. 8, including 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 communication with each other through the communication bus 804,
A memory 803 for storing a computer program;
the processor 801 is configured to implement the steps of the matching method of the layers in the interface according to any of the embodiments described above when executing the program stored in the memory 803.
In the solution provided by the embodiment of the present invention, the electronic device may obtain attribute information of each layer to be inspected in the interface to be inspected, and obtain attribute information of each layer to be inspected in the standard interface, where the standard interface is an interface defined by a design draft corresponding to the interface to be inspected, and the attribute information includes a size, a position, and a type; sequencing each layer to be checked according to the position of each layer to be checked and a preset sequencing rule to obtain a sequencing result; traversing each layer to be checked according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of each layer to be checked and each standard layer when traversing one layer to be checked; determining a standard layer matched with the currently traversed layer to be checked based on the matching degree, recording the corresponding relation between the currently traversed layer to be checked and the standard layer, and determining that the standard layer is matched; and continuing to traverse the next layer to be checked, and returning to the step of calculating the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and positions of the layers to be checked and each standard layer until the traversal of all the layers to be checked is finished, so as to obtain the corresponding relation between each layer to be checked and each standard layer. Because the corresponding relation of the layers in the application program interface and the corresponding interface of the design draft does not need to be identified manually, the determining efficiency of the corresponding relation of the layers to be checked and the standard layers can be greatly improved.
The communication bus mentioned by the above electronic device may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, abbreviated as PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated as EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The memory may include random access memory (Random Access Memory, RAM) or may include non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one cache device located remotely from the processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, abbreviated as CPU), a network processor (Network Processor, abbreviated as NP), etc.; but may also be a digital signal processor (DIGITAL SIGNAL Processing, DSP), application Specific Integrated Circuit (ASIC), field-Programmable gate array (FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components.
In yet another embodiment of the present invention, a computer readable storage medium is provided, where instructions are cached, which when executed on a computer, cause the computer to perform the steps of a method for matching layers in an interface according to any one of the embodiments described above.
In the solution provided by the embodiment of the present invention, when the instruction cached in the computer readable storage medium runs on the computer, attribute information of each layer to be checked in the interface to be checked can be obtained, and attribute information of each layer to be checked in the standard interface is obtained, where the standard interface is an interface defined by a design draft corresponding to the interface to be checked, and the attribute information includes a size, a position and a type; sequencing each layer to be checked according to the position of each layer to be checked and a preset sequencing rule to obtain a sequencing result; traversing each layer to be checked according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of each layer to be checked and each standard layer when traversing one layer to be checked; determining a standard layer matched with the currently traversed layer to be checked based on the matching degree, recording the corresponding relation between the currently traversed layer to be checked and the standard layer, and determining that the standard layer is matched; and continuing to traverse the next layer to be checked, and returning to the step of calculating the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and positions of the layers to be checked and each standard layer until the traversal of all the layers to be checked is finished, so as to obtain the corresponding relation between each layer to be checked and each standard layer. Because the corresponding relation of the layers in the application program interface and the corresponding interface of the design draft does not need to be identified manually, the determining efficiency of the corresponding relation of the layers to be checked and the standard layers can be greatly improved.
In yet another embodiment of the present invention, a computer program product comprising instructions, which when executed on a computer, causes the computer to perform the method steps of matching layers in an interface as described in any of the embodiments above is also provided.
In the solution provided by the embodiment of the present invention, when the computer program product runs on a computer, attribute information of each layer to be inspected in an interface to be inspected is obtained, and attribute information of each standard layer in a standard interface is obtained, where the standard interface is an interface defined by a design draft corresponding to the interface to be inspected, and the attribute information includes a size, a position and a type; sequencing each layer to be checked according to the position of each layer to be checked and a preset sequencing rule to obtain a sequencing result; traversing each layer to be checked according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of each layer to be checked and each standard layer when traversing one layer to be checked; determining a standard layer matched with the currently traversed layer to be checked based on the matching degree, recording the corresponding relation between the currently traversed layer to be checked and the standard layer, and determining that the standard layer is matched; and continuing to traverse the next layer to be checked, and returning to the step of calculating the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and positions of the layers to be checked and each standard layer until the traversal of all the layers to be checked is finished, so as to obtain the corresponding relation between each layer to be checked and each standard layer. Because the corresponding relation of the layers in the application program interface and the corresponding interface of the design draft does not need to be identified manually, the determining efficiency of the corresponding relation of the layers to be checked and the standard layers can be greatly improved.
In the above embodiments, it may be implemented in whole or in part 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, produces a flow or function in accordance with embodiments of the present invention, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be cached in or transmitted from one computer-readable cache medium to another, for example, by wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means from one website, computer, server, or data center. The computer readable cache medium may be any available medium that can be accessed by a computer or a data caching device such as a server, data center, etc. that contains one or more integration of the available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk Solid STATE DISK (SSD)), etc.
It is noted that relational terms such as first and second, and the like are 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the apparatus, electronic device, computer readable storage medium, and computer program product embodiments, the description is relatively simple, as relevant to the method embodiments being referred to in the section of the description of the method embodiments.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (7)

1. A method for matching layers in an interface, the method comprising:
Acquiring attribute information of each layer to be checked in an interface to be checked, and acquiring attribute information of each standard layer in a standard interface, wherein the standard interface is defined by a design draft corresponding to the interface to be checked, and the attribute information comprises size, position and type;
sequencing each layer to be checked according to the position of each layer to be checked and a preset sequencing rule to obtain a sequencing result;
traversing each layer to be checked according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of each layer to be checked and each standard layer when traversing one layer to be checked;
Determining a standard layer matched with the currently traversed layer to be checked based on the matching degree, recording the corresponding relation between the currently traversed layer to be checked and the standard layer, and determining that the standard layer is matched;
Continuing traversing the next layer to be checked, returning to the step of calculating the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and the positions of the layers to be checked and the standard layers until the traversal of all the layers to be checked is finished, and obtaining the corresponding relation between the layers to be checked and the standard layers;
before the step of traversing the layers to be accepted according to the sorting result, the method further comprises:
Determining adjacent layers of each standard layer according to the positions of the standard layers;
The step of calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of the layers to be checked and the standard layers comprises the following steps:
Determining adjacent layers of the currently traversed layers to be checked according to the positions of the layers to be checked;
based on the type of the currently traversed layer to be checked and the type of the adjacent layer, and the type of each currently unmatched standard layer and the type of the adjacent layer, respectively calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer;
the step of calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer based on the type of the currently traversed layer to be checked and the adjacent layers thereof and the type of each currently unmatched standard layer and the adjacent layers thereof respectively comprises the following steps:
determining whether the type of the currently traversed layer to be checked is the same as the type of each currently unmatched standard layer;
If the matching degree is different, determining the matching degree between the currently traversed layer to be checked and the unmatched standard layers with different types as a first matching degree;
if so, determining whether the type of the adjacent layers of the currently traversed layer to be checked is the same as the type of the adjacent layers of each unmatched target standard layer, wherein the target standard layer is a standard layer with the same type as the type of the currently traversed layer to be checked;
if the type of the adjacent layers of the currently traversed layer to be checked is the same as the type of the adjacent layers of the target standard layer, determining that the matching degree between the currently traversed layer to be checked and the target standard layer is a second matching degree;
if the type of the adjacent layers of the currently traversed layer to be checked is different from the type of the adjacent layers of the target standard layer, determining that the matching degree between the currently traversed layer to be checked and the target standard layer is a third matching degree;
And if the type of the adjacent layers of the currently traversed layer to be checked is not identical to the type of the adjacent layers of the target standard layer, determining the matching degree between the currently traversed layer to be checked and the target standard layer based on the number of the layers with the identical type.
2. The method of claim 1, wherein the attribute information further comprises transparency;
Before the step of sorting the layers to be inspected according to the positions of the layers to be inspected and a preset sorting rule to obtain a sorting result, the method further includes:
and removing the layers with the transparency of 100% from the layers to be checked and accepted and the standard layers.
3. The method of claim 1, wherein the attribute information further comprises color;
Before the step of sorting the layers to be inspected according to the positions of the layers to be inspected and a preset sorting rule to obtain a sorting result, the method further includes:
Selecting a layer only comprising background color from the layers to be checked and the standard layers as a target layer;
For each target layer, determining whether the target layer is included according to the size and the position of each layer to be checked or each standard layer;
If any, the target layer is removed in the case where the background color of the layer having the smallest area among the layers including the target layer is the same as the background color of the target layer.
4. The method of claim 1, wherein the step of obtaining attribute information of each layer to be accepted in the interface to be accepted and obtaining attribute information of each layer to be accepted in the standard interface comprises:
calling a preset view interface, and extracting attribute information of each layer to be checked in the interface to be checked;
Analyzing each standard layer in the standard interface to obtain attribute information of each standard layer in the standard interface.
5. The method of claim 4, wherein the step of parsing each standard layer in the standard interface to obtain attribute information of each standard layer in the standard interface comprises:
Analyzing a standard interface, and determining whether each layer in the standard interface is provided with a mask or not and whether each layer is a composite layer or not;
Cutting a layer with a mask according to the size of the mask to obtain a corresponding standard layer, and determining attribute information of the standard layer;
And decomposing the composite layer aiming at the composite layer to obtain each standard layer forming the composite layer, and determining attribute information of each standard layer.
6. A device for matching layers in an interface, the device comprising:
the system comprises an attribute information acquisition module, a storage module and a storage module, wherein the attribute information acquisition module is used for acquiring attribute information of each layer to be checked in an interface to be checked and acquiring attribute information of each standard layer in a standard interface, wherein the standard interface is an interface defined by a design draft corresponding to the interface to be checked and comprises a size, a position and a type;
The layer ordering module is used for ordering the layers to be checked according to the positions of the layers to be checked and a preset ordering rule to obtain an ordering result;
the matching degree calculation module is used for traversing each layer to be checked according to the sequencing result, and calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer according to the types and positions of each layer to be checked and each standard layer when one layer to be checked is traversed;
The corresponding relation determining module is used for determining a standard layer matched with the currently traversed layer to be checked based on the matching degree, recording the corresponding relation between the currently traversed layer to be checked and the standard layer, and determining that the standard layer is matched; continuing traversing the next layer to be checked, returning to calculate the matching degree between the currently traversed layer to be checked and each unmatched standard layer according to the types and positions of the layers to be checked and the standard layers until the traversal of all the layers to be checked is finished, and obtaining the corresponding relation between the layers to be checked and the standard layers;
the apparatus further comprises:
The adjacent layer determining module is used for determining the adjacent layer of each standard layer according to the position of each standard layer before the step of traversing each layer to be checked according to the sequencing result;
the matching degree calculating module comprises:
The adjacent layer determining unit is used for determining the adjacent layers of the currently traversed layers to be checked according to the positions of the layers to be checked;
The matching degree determining unit is used for respectively calculating the matching degree between the currently traversed layer to be checked and each currently unmatched standard layer based on the type of the currently traversed layer to be checked and the adjacent layer and the type of each currently unmatched standard layer and the adjacent layer;
The matching degree determination unit includes:
a first type determining subunit, configured to determine whether the type of the currently traversed layer to be checked is the same as the type of each currently unmatched standard layer;
The first matching degree determining subunit is used for determining that the matching degree between the currently traversed layer to be checked and the unmatched standard layers with different types is the first matching degree if the currently traversed layer to be checked and the unmatched standard layers with different types are different;
A second type determining subunit, configured to determine, if the type of the adjacent layer of the currently traversed layer to be checked is the same as the type of the adjacent layer of each unmatched target standard layer, where the target standard layer is a standard layer having the same type as the type of the currently traversed layer to be checked;
The second matching degree determining subunit is configured to determine that the matching degree between the currently traversed layer to be checked and the target standard layer is the second matching degree if the type of the adjacent layer of the currently traversed layer to be checked is the same as the type of the adjacent layer of the target standard layer;
a third matching degree determining subunit, configured to determine that, if the type of the adjacent layer of the currently traversed layer to be checked is different from the type of the adjacent layer of the target standard layer, the matching degree between the currently traversed layer to be checked and the target standard layer is the third matching degree;
And the fourth matching degree determining subunit is configured to determine, if the type of the adjacent layer of the currently traversed layer to be checked is not identical to the type of the adjacent layer of the target standard layer, the matching degree between the currently traversed layer to be checked and the target standard layer based on the number of layers with the identical type.
7. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
A memory for storing a computer program;
A processor for carrying out the method steps of any one of claims 1-5 when executing a program stored on a memory.
CN202010761354.3A 2020-07-31 2020-07-31 Method and device for matching layers in interface and electronic equipment Active CN111857703B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010761354.3A CN111857703B (en) 2020-07-31 2020-07-31 Method and device for matching layers in interface and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010761354.3A CN111857703B (en) 2020-07-31 2020-07-31 Method and device for matching layers in interface and electronic equipment

Publications (2)

Publication Number Publication Date
CN111857703A CN111857703A (en) 2020-10-30
CN111857703B true CN111857703B (en) 2024-06-04

Family

ID=72953945

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010761354.3A Active CN111857703B (en) 2020-07-31 2020-07-31 Method and device for matching layers in interface and electronic equipment

Country Status (1)

Country Link
CN (1) CN111857703B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778905B (en) * 2021-11-10 2022-02-08 腾讯科技(深圳)有限公司 UI design acceptance method, device, equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107015793A (en) * 2016-12-12 2017-08-04 阿里巴巴集团控股有限公司 Design original text adaptation method, apparatus and system
CN109445778A (en) * 2018-09-13 2019-03-08 珠海豆饭科技有限公司 A kind of method and apparatus that the interface auxiliary based on SVG file generates

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10168998B2 (en) * 2017-03-20 2019-01-01 Google Llc Automated interface design

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107015793A (en) * 2016-12-12 2017-08-04 阿里巴巴集团控股有限公司 Design original text adaptation method, apparatus and system
CN109445778A (en) * 2018-09-13 2019-03-08 珠海豆饭科技有限公司 A kind of method and apparatus that the interface auxiliary based on SVG file generates

Also Published As

Publication number Publication date
CN111857703A (en) 2020-10-30

Similar Documents

Publication Publication Date Title
JP5522065B2 (en) Board inspection system
US10296552B1 (en) System and method for automated identification of internet advertising and creating rules for blocking of internet advertising
JP5665125B2 (en) Image processing method and image processing system
JPH07334549A (en) Method and device for automatically entering size in cad system
JP2003100826A (en) Inspecting data analyzing program and inspecting apparatus and inspecting system
CN112307408B (en) Method and device for determining element information in page, electronic equipment and storage medium
JP5075465B2 (en) Incident / accident report analysis apparatus, method, and program
CN111857703B (en) Method and device for matching layers in interface and electronic equipment
CN115546809A (en) Table structure identification method based on cell constraint and application thereof
CN109241485A (en) Relation establishing method and device are jumped between a kind of page
CN112270687A (en) Cloth flaw identification model training method and cloth flaw detection method
CN110908899A (en) Application program debugging method, mobile terminal and computer readable storage medium
JP6907508B2 (en) Inspection system, control method and program of inspection equipment
CN117271625A (en) Risk data display method and system
CN111881049B (en) Acceptance method and device of application program interface and electronic equipment
CN115081389B (en) Printed circuit board wiring inspection method, device, equipment and storage medium
CN110398681B (en) Double-strip-line inspection method and related device
US7634745B2 (en) Method for computing the critical area of compound fault mechanisms
CN105912452A (en) Automated data analysis method and device
CN115544620A (en) Method, device and equipment for analyzing door and window tables in drawing and storage medium
CN114490390A (en) Test data generation method, device, equipment and storage medium
CN112819925A (en) Method and device for processing focus labeling, electronic equipment and medium
US20200167908A1 (en) Determination device and determining method thereof
JP4670482B2 (en) Process flow diagram creation support system and method
CN117371385B (en) Method for confirming adjacent graph, electronic device and storage medium

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
GR01 Patent grant
GR01 Patent grant