Multi-layer rendering method and device, equipment and medium
By sorting and rendering the area information of layers, the problem of small-area layers in the leaflet library being blocked by large-area layers is solved, and the user experience of the map is achieved is achieved.
Patent Information
- Application Number
- CN202411486515.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-03-11
AI Technical Summary
When using the leaflet library for layer overlay rendering, layers with smaller areas are easily blocked by layers with larger areas, resulting in users being unable to interact with these obstructed layers, affecting the user experience of the map.
By obtaining the instance objects, boundary information and area information of the layer to be rendered, sorting the area information from large to small, and rendering it to avoid small-area layers being covered by large-area layers.
It effectively avoids the problem that small-area layers are blocked by large-area layers, ensures that users can interact with all layers, and optimizes the user experience of the map.
Smart Images

Figure CN119600166A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of layer rendering technology, and specifically relates to a multi-layer rendering method, device, equipment and medium. Background Art
[0002] When using the Leaflet library to render layer overlays, you often encounter a problem: smaller layers are completely blocked by larger layers, making them unselectable or uninterpretable by users. This phenomenon directly affects the user experience of the map, especially when users try to interact with smaller or specific areas on the map.
[0003] In order to ensure that each layer on the map can correctly respond to user interactions, developers need to manually adjust the stacking order of the layers, or programmatically prevent interaction events from being captured by the upper layers. However, as data is updated or user behavior changes, the number and position of layers may change. Manually adjusting the stacking order of each layer is not only time-consuming and laborious, but also prone to errors; preventing interaction events from being captured by the upper layers may have an adverse effect on the interaction logic of the entire map.
[0004] Therefore, how to solve the problem of complete occlusion of multiple layers in a more concise and efficient way is an urgent problem to be solved by people in this field. Summary of the invention
[0005] The embodiments of the present application provide a multi-layer rendering method, device, equipment and medium, the purpose of which is to avoid a small area layer being covered by a large area layer, thereby preventing the user from interacting with the small area layer, and to optimize the user experience.
[0006] In a first aspect, an embodiment of the present application provides a multi-layer rendering method, the method comprising:
[0007] Get instance objects of at least two layers to be rendered that have overlapping areas;
[0008] Obtaining boundary information of the instance objects in each layer to be rendered;
[0009] Determine the area information of the instance object in each layer to be rendered according to the boundary information;
[0010] Each layer to be rendered is rendered according to the area information.
[0011] Further, rendering each to-be-rendered layer according to the area information includes:
[0012] Sorting the instance objects in each layer to be rendered in descending order of the area information to obtain a sorting result;
[0013] Render the instance objects of each layer to be rendered according to the sorting result.
[0014] Furthermore, the instance objects of each layer to be rendered are sorted in descending order of the area information to obtain a sorting result, including:
[0015] Sort the instance objects of each layer to be rendered in descending order of the area information;
[0016] When there are at least two instance objects with the same area information, acquiring historical user interaction data of the instance objects with the same area information;
[0017] Determining the interaction frequency information of the instance object with consistent area information according to the historical user interaction data;
[0018] The instance objects with consistent area information are sorted in descending order of the interaction frequency information to obtain a sorting result.
[0019] Furthermore, the instance objects of each layer to be rendered are sorted in descending order of the area information to obtain a sorting result, including:
[0020] Sort the instance objects of each layer to be rendered in descending order of the area information;
[0021] In the case of recognizing that the user inputs search information, determining the target instance object according to the search information;
[0022] The target instance object is adjusted to the end of the sorting to obtain a sorting result.
[0023] Furthermore, after determining the target instance object according to the search information, the method further includes:
[0024] In the case where there are at least two instance objects with consistent area information, determining the correlation between the instance objects with consistent area information and the target instance object;
[0025] The instance objects with consistent area information are sorted in the order of the relevance from low to high to obtain a sorting result.
[0026] Further, obtaining instance objects of at least two layers to be rendered having overlapping areas includes:
[0027] Create an instance object of the layer to be rendered based on the leaflet library;
[0028] Among the instance objects of the layers to be rendered, it is determined that at least two instance objects of the layers to be rendered have overlapping areas.
[0029] Furthermore, the boundary information of the instance object in each layer to be rendered is obtained, including:
[0030] Get the boundary information of the instance object in each layer to be rendered by using the getBounds method;
[0031] Accordingly, according to the boundary information, the area information of the instance object in each layer to be rendered is determined, including:
[0032] The size information of the boundary information is obtained through the getSize method, and the area information of the instance object in each layer to be rendered is determined according to the size information.
[0033] In a second aspect, an embodiment of the present application provides a multi-layer rendering device, the device comprising:
[0034] An instance object acquisition module, used to acquire instance objects of at least two layers to be rendered that have overlapping areas;
[0035] A boundary information acquisition module, used to obtain boundary information of the instance objects in each layer to be rendered;
[0036] An area information determination module, used to determine the area information of the instance object in each layer to be rendered according to the boundary information;
[0037] The layer rendering module is used to render each layer to be rendered according to the area information.
[0038] Furthermore, the layer rendering module includes:
[0039] An instance object sorting unit, used to sort the instance objects in each to-be-rendered layer in descending order of the area information, to obtain a sorting result;
[0040] The instance object rendering unit is used to render the instance objects of each layer to be rendered according to the sorting result.
[0041] Furthermore, the instance object sorting unit is specifically used to:
[0042] Sort the instance objects of each layer to be rendered in descending order of the area information;
[0043] When there are at least two instance objects with the same area information, acquiring historical user interaction data of the instance objects with the same area information;
[0044] Determining the interaction frequency information of the instance object with consistent area information according to the historical user interaction data;
[0045] The instance objects with consistent area information are sorted in descending order of the interaction frequency information to obtain a sorting result.
[0046] Furthermore, the instance object sorting unit is specifically used to:
[0047] Sort the instance objects of each layer to be rendered in descending order of the area information;
[0048] In the case of recognizing that the user inputs search information, determining the target instance object according to the search information;
[0049] The target instance object is adjusted to the end of the sorting to obtain a sorting result.
[0050] Furthermore, the instance object sorting unit is further used to:
[0051] In the case where there are at least two instance objects with consistent area information, determining the correlation between the instance objects with consistent area information and the target instance object;
[0052] The instance objects with consistent area information are sorted in the order of the relevance from low to high to obtain a sorting result.
[0053] Furthermore, the instance object acquisition module is specifically used to:
[0054] Create an instance object of the layer to be rendered based on the leaflet library;
[0055] Among the instance objects of the layers to be rendered, it is determined that at least two instance objects of the layers to be rendered have overlapping areas.
[0056] Furthermore, the boundary information acquisition module is specifically used to:
[0057] Get the boundary information of the instance object in each layer to be rendered by using the getBounds method;
[0058] Accordingly, according to the boundary information, the area information of the instance object in each layer to be rendered is determined, including:
[0059] The size information of the boundary information is obtained through the getSize method, and the area information of the instance object in each layer to be rendered is determined according to the size information.
[0060] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0061] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0062] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the steps of the method described in the first aspect.
[0063] In an embodiment of the present application, at least two instance objects of the layers to be rendered with overlapping areas are obtained; boundary information of the instance objects in each layer to be rendered is obtained; area information of the instance objects in each layer to be rendered is determined based on the boundary information; and each layer to be rendered is rendered based on the area information. The above-mentioned multi-layer rendering method can avoid the situation where a small area layer is covered by a large area layer, thereby preventing the user from interacting with the small area layer, by rendering each layer to be rendered based on the area information of the instance objects in each layer to be rendered, thereby optimizing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 It is a flowchart of a multi-layer rendering method provided in Embodiment 1 of the present application;
[0065] Figure 2 It is a flowchart of a multi-layer rendering method provided in Embodiment 2 of the present application;
[0066] Figure 3 It is a flowchart of a multi-layer rendering method provided in Embodiment 3 of the present application;
[0067] Figure 4 It is a flowchart of a multi-layer rendering method provided in Embodiment 4 of the present application;
[0068] Figure 5 It is a structural schematic diagram of a multi-layer rendering device provided in Embodiment 5 of the present application;
[0069] Figure 6 It is a structural diagram of an electronic device provided in Example 6 of the present application. DETAILED DESCRIPTION
[0070] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
[0071] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0072] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0073] In conjunction with the accompanying drawings, the multi-layer rendering method, device, equipment and medium provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.
[0074] Embodiment 1
[0075] Figure 1 FIG. 1 is a flow chart of a multi-layer rendering method provided in Embodiment 1 of the present application. Figure 1 As shown, the specific steps include:
[0076] S101, obtaining instance objects of at least two layers to be rendered having overlapping areas;
[0077] First of all, this application is applicable to scenarios where there are layers that need to be rendered. Based on the above usage scenarios, it can be understood that the execution subject of this application can be a platform that needs to render layers to achieve functions, such as a map platform. Specifically, the acquisition of instance objects of the layers to be rendered, the determination of the area information of the instance objects, and the rendering of the layers to be rendered can be performed by the platform, and the platform implements functions based on the rendered layers to meet user needs.
[0078] The layer to be rendered refers to a layer that has not yet been rendered but is ready to be drawn and displayed in the platform. Among them, a layer is an independent part of the image and can contain various graphic elements, such as shapes, texts, and image fragments. Each layer is like a transparent film, which is superimposed together to form the final image. For example, for a map platform, different geographic elements can be stored in different layers to be rendered. For example, a road layer contains various road shapes and lines, and a place name layer contains different text annotations. After being rendered, these layers to be rendered will be superimposed in a specific order to present a clear, accurate and rich map image to the user.
[0079] An instance object is a specific object entity created by a class constructor. Each instance object has the properties and methods defined by the class. The instance object of the layer to be rendered can store the property information of the layer to be rendered, such as position, size, and color, and can be operated by specific methods, such as rendering, moving, and hiding.
[0080] The overlapping area may refer to an area where the portions occupied by the instance objects mapped on the plane are crossed or overlapped. Instance objects of each layer to be rendered may be created according to the predefined layer class to be rendered, and then at least two instance objects of the layer to be rendered having overlapping areas are further determined among the created instance objects.
[0081] S102, obtaining boundary information of the instance objects in each layer to be rendered;
[0082] Boundary information may be information used to describe the outer contour or range of instance objects in each layer to be rendered. By using the method bound to the instance object for obtaining its boundary information, the boundary information of the instance object in each layer to be rendered may be obtained. For example, if the instance object of each layer to be rendered is created based on the leaflet library, the method bound to the instance object for obtaining its boundary information may be the getBounds method.
[0083] S103, determining area information of the instance objects in each layer to be rendered according to the boundary information;
[0084] The area information may refer to a quantitative value of the size of the two-dimensional space occupied by the instance object in each layer to be rendered. The area information of the instance object in each layer to be rendered may be determined by determining the length and width of the instance object according to the boundary information of the instance object, and multiplying the determined length and width to obtain the area information of the instance object.
[0085] S104: Render each to-be-rendered layer according to the area information.
[0086] The method of rendering each layer to be rendered according to the area information can be to sort the instance objects in each layer to be rendered in order of area information from large to small, obtain the sorting result, and render the instance objects in each layer to be rendered according to the sorting result. The instance object can be rendered by using the rendering method bound to the instance object.
[0087] In this technical solution, optionally, rendering each to-be-rendered layer according to the area information includes:
[0088] Sorting the instance objects of each layer to be rendered in descending order of the area information to obtain a sorting result;
[0089] Render the instance objects of each layer to be rendered according to the sorting result.
[0090] In order of the area information from large to small, the instance objects in each layer to be rendered can be sorted by using a sorting algorithm based on the area information of the instance objects, and the output of the sorting algorithm is the sorting result. Among them, the sorting algorithm can select a common quick sort and merge sort and other efficient comparison sorting algorithms.
[0091] The instance objects in each layer to be rendered are rendered according to the sorting result, that is, the instance objects with larger area information are rendered first, and the instance objects with smaller area information are rendered later.
[0092] It can be understood that the rendering order of the instance objects without overlapping areas is not specifically limited.
[0093] The advantage of this setting of the present solution is that, by rendering the instance objects with larger area information first and then rendering the instance objects with smaller area information, the instance objects with smaller area information can be covered on top of the instance objects with larger area information, thereby avoiding the situation where the instance objects with smaller area information are covered by the instance objects with larger area information, and the user cannot interact with the instance objects with smaller area information.
[0094] In an embodiment of the present application, at least two instance objects of the layers to be rendered with overlapping areas are obtained; boundary information of the instance objects in each layer to be rendered is obtained; area information of the instance objects in each layer to be rendered is determined based on the boundary information; and each layer to be rendered is rendered based on the area information. The above-mentioned multi-layer rendering method can avoid the situation where a small area layer is covered by a large area layer, thereby preventing the user from interacting with the small area layer, by rendering each layer to be rendered based on the area information of the instance objects in each layer to be rendered, thereby optimizing the user experience.
[0095] Embodiment 2
[0096] Figure 2 It is a flowchart of the multi-layer rendering method provided in the second embodiment of the present application. This solution makes a better improvement on the above embodiment, and the specific improvement is: sorting the instance objects of each layer to be rendered in the order of the area information from large to small to obtain the sorting result, including: sorting the instance objects of each layer to be rendered in the order of the area information from large to small; in the case where there are at least two instance objects with consistent area information, obtaining the historical user interaction data of the instance objects with consistent area information; determining the interaction frequency information of the instance objects with consistent area information based on the historical user interaction data; sorting the instance objects with consistent area information in the order of the interaction frequency information from low to high to obtain the sorting result.
[0097] like Figure 2 As shown, the specific steps include:
[0098] S201, obtaining instance objects of at least two layers to be rendered having overlapping areas;
[0099] S202, obtaining boundary information of the instance objects in each layer to be rendered;
[0100] S203, determining area information of the instance objects in each layer to be rendered according to the boundary information;
[0101] S204, sorting the instance objects of each layer to be rendered in descending order of the area information;
[0102] S205, when there are at least two instance objects with the same area information, obtaining historical user interaction data of the instance objects with the same area information;
[0103] The historical user interaction data may refer to the relevant record information of the user's interaction with the instance object with the same area information before the current time point, and may include specific information such as the interaction time, interaction type, and interaction result.
[0104] When a user interacts with an instance object, an interaction event of the instance object is triggered, and the platform records the interaction event. The recorded and stored data is the historical user interaction data. Therefore, the historical user interaction data of the instance object with consistent area information can be obtained by querying the recorded and stored data with the instance object with consistent area information as the query condition.
[0105] S206, determining the interaction frequency information of the instance object with consistent area information according to the historical user interaction data;
[0106] The interaction frequency information may refer to a quantitative representation of the frequency of interaction between a user and an instance object. The interaction frequency information of an instance object with consistent area information may be determined by counting the number of interactions between a user and an instance object with consistent area information within a preset time period, and dividing the number of interactions by the preset time period to obtain the interaction frequency information.
[0107] S207, sorting the instance objects with consistent area information in descending order of the interaction frequency information to obtain a sorting result;
[0108] The instance objects with consistent area information are sorted in descending order of interaction frequency information. A sorting algorithm can be used based on the interaction frequency information of the instance objects with consistent area information. The output result of the sorting algorithm is the sorting result.
[0109] For example, currently there is a sorting result for instance objects in each layer to be rendered in order of area information from large to small: a1, a2, a3, a4, a5, a6, among which a3, a4, a5 have the same area information, and the sorting result for them in order of their interaction frequency information from low to high is: a4, a5, a3, and the final sorting result is a1, a2, a4, a5, a3, a6.
[0110] S208: Rendering the instance objects of each layer to be rendered according to the sorting result.
[0111] The advantage of this setting of the present scheme is that by sorting instance objects with consistent area information in order of interaction frequency information from low to high, instance objects with higher interaction frequency information can be overlaid on instance objects with lower interaction frequency information, so that users can interact with instance objects with higher interaction frequency information first, thereby optimizing the user experience.
[0112] Embodiment 3
[0113] Figure 3It is a flowchart of the multi-layer rendering method provided in the third embodiment of the present application. This solution makes a better improvement on the first embodiment, and the specific improvement is: sorting the instance objects of each layer to be rendered in the order of the area information from large to small to obtain the sorting result, including: sorting the instance objects of each layer to be rendered in the order of the area information from large to small; in the case of identifying the user input search information, determining the target instance object according to the search information; adjusting the target instance object to the end of the sorting to obtain the sorting result.
[0114] like Figure 3 As shown, the specific steps include:
[0115] S301, obtaining instance objects of at least two layers to be rendered having overlapping areas;
[0116] S302, obtaining boundary information of the instance objects in each layer to be rendered;
[0117] S303, determining area information of the instance object in each layer to be rendered according to the boundary information;
[0118] S304, sorting the instance objects of each layer to be rendered in descending order of the area information;
[0119] S305, when it is recognized that the user inputs search information, determining a target instance object according to the search information;
[0120] The user search information may refer to the text content input by the user to find the target instance object. The method of identifying the user input search information may be to identify the user input search information when text content is detected in the search box and the user clicks the search button.
[0121] The target instance object may be an instance object that the user wants to interact with. The target instance object may be determined according to the search information by adopting the method of determining the target instance object with the instance object whose name matches the search information the most as the target instance object.
[0122] S306, adjusting the target instance object to the end of the sorting to obtain a sorting result;
[0123] For example, currently there is a sorting result for instance objects in each layer to be rendered in order of area information from large to small: a1, a2, a3, a4, a5, a6, where a2 is the target instance object, and the final sorting result is a1, a3, a4, a5, a6, a2.
[0124] S307: Render the instance objects of each layer to be rendered according to the sorting result.
[0125] The advantage of this setting of the scheme is that by determining the target instance object based on the user's search information and adjusting the target instance object to the end of the sorting, the target instance object can be placed at the top of all instance objects, allowing the user to interact with the instance object that is most relevant to the search information first, thereby optimizing the user experience.
[0126] In this technical solution, optionally, after determining the target instance object according to the search information, the method further includes:
[0127] In the case where there are at least two instance objects with consistent area information, determining the correlation between the instance objects with consistent area information and the target instance object;
[0128] The instance objects with consistent area information are sorted in the order of the relevance from low to high to obtain a sorting result.
[0129] The correlation may refer to the degree of association between two instance objects. The correlation between the instance object with consistent area information and the target instance object may be determined by calculating the matching degree between the name of the instance object with consistent area information and the name of the target instance object as the correlation.
[0130] The instance objects with consistent area information are sorted in order of relevance from low to high. A sorting algorithm can be used based on the relevance of the instance objects with consistent area information. The output result of the sorting algorithm is the sorting result.
[0131] For example, there is currently a sorting result for sorting instance objects in each layer to be rendered in order of area information from large to small: a1, a2, a3, a4, a5, a6, among which a2 is the target instance object, and the area information of a3, a4, and a5 is consistent. According to their relevance to a2 from low to high, the sorting result is: a4, a5, a3, and the final sorting result is a1, a4, a5, a3, a6, and a2.
[0132] The advantage of this setting of the present scheme is that by sorting instance objects with consistent area information in order of relevance to the target instance object from low to high, instance objects with higher relevance can be overlaid on instance objects with lower relevance, so that users can preferentially interact with instance objects that are more relevant to the search information, thereby optimizing the user experience.
[0133] Embodiment 4
[0134] Figure 4This is a flowchart of a multi-layer rendering method provided in Embodiment 4 of the present application. This solution makes better improvements to the above embodiments, specifically: obtaining instance objects of at least two layers to be rendered with overlapping areas, including: creating instance objects of the layers to be rendered based on the leaflet library; determining instance objects of at least two layers to be rendered with overlapping areas in the instance objects of the layers to be rendered.
[0135] like Figure 4 As shown, the specific steps include:
[0136] S401, creating an instance object of the layer to be rendered based on the leaflet library;
[0137] The Leaflet library is an open source JavaScript library that is mainly used to create mobile-friendly interactive maps. The Leaflet library can load various map tile services, such as OpenStreetMap, Google Maps, and Bing Maps, and developers can choose the appropriate map source according to their needs. The Leaflet library allows the creation of multiple layers, and the visibility and transparency of each layer can be controlled separately, which allows developers to easily combine different map data and elements.
[0138] To create an instance object of the layer to be rendered based on the leaflet library, you can download the CSS and JavaScript files of the leaflet library, use the L.map() method of the leaflet library to create a map instance, use the L.tileLayer() method to create a map tile layer, and then use the L.marker() method to create a marker instance object, the L.polygon() method to create a polygon instance object, and the L.polyline() method to create a line instance object.
[0139] S402, determining, among the instance objects of the layers to be rendered, at least two instance objects of the layers to be rendered having overlapping areas;
[0140] A method for determining instance objects of at least two layers to be rendered having overlapping areas may be to obtain boundary information of instance objects in each layer to be rendered; if boundary information of two instance objects belonging to different layers to be rendered overlaps, the two instance objects are determined as instance objects having overlapping areas.
[0141] S403, obtaining boundary information of the instance objects in each layer to be rendered;
[0142] S404, determining area information of the instance objects in each layer to be rendered according to the boundary information;
[0143] In this technical solution, optionally, obtaining the boundary information of the instance object in each layer to be rendered includes:
[0144] Get the boundary information of the instance object in each layer to be rendered by using the getBounds method;
[0145] Accordingly, according to the boundary information, the area information of the instance object in each layer to be rendered is determined, including:
[0146] The size information of the boundary information is obtained through the getSize method, and the area information of the instance object in each layer to be rendered is determined according to the size information.
[0147] The getBounds method is a method used to obtain the boundary range of a map object or layer object. For an instance object in the layer to be rendered, the getBounds method returns the geographic range covered by the instance object, that is, the boundary information of the instance object. The returned boundary information is also an object.
[0148] The getSize method is used to obtain the size information of the boundary information, and can return an x value and a y value. The x value represents the length value of the boundary information, and the y value represents the width value of the boundary information. Therefore, the method of determining the area information of the instance object in each layer to be rendered according to the size information is to multiply the x value and the y value returned by the getSize method to obtain the area information of the instance object.
[0149] The benefit of this setting of the present solution is that by using the getSize method to obtain the size information of the boundary information, and determining the area information of the instance objects in each layer to be rendered based on the size information, it can help obtain accurate area information of the instance objects in each layer to be rendered, thereby helping to avoid the situation where the instance objects are completely covered.
[0150] S405: Render each to-be-rendered layer according to the area information.
[0151] The advantage of this setting is that the Leaflet library is very small, loads quickly, and occupies few system resources. By creating instance objects of the layer to be rendered based on the Leaflet library, a smoother map experience can be provided to users.
[0152] Embodiment 5
[0153] Figure 5 Schematic diagram of the structure of a multi-layer rendering device provided in Embodiment 5 of the present application. Figure 5 As shown, the device comprises:
[0154] An instance object acquisition module 510 is used to acquire instance objects of at least two layers to be rendered that have overlapping areas;
[0155] The boundary information acquisition module 520 is used to acquire the boundary information of the instance object in each layer to be rendered;
[0156] An area information determination module 530, used to determine the area information of the instance object in each layer to be rendered according to the boundary information;
[0157] The layer rendering module 540 is used to render each layer to be rendered according to the area information.
[0158] Furthermore, the layer rendering module 540 includes:
[0159] The instance object sorting unit 5401 is used to sort the instance objects in each to-be-rendered layer in descending order of the area information to obtain a sorting result;
[0160] The instance object rendering unit 5402 is used to render the instance objects of each layer to be rendered according to the sorting result.
[0161] Furthermore, the instance object sorting unit 5401 is specifically used to:
[0162] Sort the instance objects of each layer to be rendered in descending order of the area information;
[0163] When there are at least two instance objects with the same area information, acquiring historical user interaction data of the instance objects with the same area information;
[0164] Determining the interaction frequency information of the instance object with consistent area information according to the historical user interaction data;
[0165] The instance objects with consistent area information are sorted in descending order of the interaction frequency information to obtain a sorting result.
[0166] Furthermore, the instance object sorting unit 5401 is specifically used to:
[0167] Sort the instance objects of each layer to be rendered in descending order of the area information;
[0168] In the case of recognizing that the user inputs search information, determining the target instance object according to the search information;
[0169] The target instance object is adjusted to the end of the sorting to obtain a sorting result.
[0170] Furthermore, the instance object sorting unit 5401 is further configured to:
[0171] In the case where there are at least two instance objects with consistent area information, determining the correlation between the instance objects with consistent area information and the target instance object;
[0172] The instance objects with consistent area information are sorted in the order of the relevance from low to high to obtain a sorting result.
[0173] Furthermore, the instance object acquisition module 510 is specifically used to:
[0174] Create an instance object of the layer to be rendered based on the leaflet library;
[0175] Among the instance objects of the layers to be rendered, it is determined that at least two instance objects of the layers to be rendered have overlapping areas.
[0176] Furthermore, the boundary information acquisition module 520 is specifically used to:
[0177] Get the boundary information of the instance object in each layer to be rendered by using the getBounds method;
[0178] Accordingly, according to the boundary information, the area information of the instance object in each layer to be rendered is determined, including:
[0179] The size information of the boundary information is obtained through the getSize method, and the area information of the instance object in each layer to be rendered is determined according to the size information.
[0180] In an embodiment of the present application, an instance object acquisition module is used to acquire instance objects of at least two layers to be rendered that have overlapping areas; a boundary information acquisition module is used to acquire boundary information of the instance objects in each layer to be rendered; an area information determination module is used to determine the area information of the instance objects in each layer to be rendered based on the boundary information; and a layer rendering module is used to render each layer to be rendered based on the area information. The above-mentioned multi-layer rendering device can avoid the situation where a small area layer is covered by a large area layer, thereby preventing the user from interacting with the small area layer, by rendering each layer to be rendered based on the area information of the instance objects in each layer to be rendered, thereby optimizing the user experience.
[0181] The multi-layer rendering device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0182] The multi-layer rendering device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0183] The multi-layer rendering device provided in the embodiment of the present application can implement each process implemented in the above-mentioned embodiments one to four, and will not be described again here to avoid repetition.
[0184] Embodiment 6
[0185] like Figure 6 As shown, an embodiment of the present application also provides an electronic device 600, including a processor 601, a memory 602, and a program or instruction stored in the memory 602 and executable on the processor 601. When the program or instruction is executed by the processor 601, each process of the above-mentioned multi-layer rendering method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0186] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0187] Embodiment 7
[0188] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned multi-layer rendering method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0189] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0190] Embodiment 8
[0191] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned multi-layer rendering method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0192] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0193] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0194] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0195] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0196] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.
Claims
1. A multi-layer rendering method, characterized in that: The method comprises: Get instance objects of at least two layers to be rendered that have overlapping areas; Obtaining boundary information of the instance objects in each layer to be rendered; Determine the area information of the instance object in each layer to be rendered according to the boundary information; Each layer to be rendered is rendered according to the area information.
2. The multi-layer rendering method according to claim 1, characterized in that: Rendering each to-be-rendered layer according to the area information includes: Sorting the instance objects in each layer to be rendered in descending order of the area information to obtain a sorting result; Render the instance objects of each layer to be rendered according to the sorting result.
3. The multi-layer rendering method according to claim 2, characterized in that: According to the order of the area information from large to small, the instance objects of each layer to be rendered are sorted to obtain a sorting result, including: Sort the instance objects of each layer to be rendered in descending order of the area information; When there are at least two instance objects with the same area information, acquiring historical user interaction data of the instance objects with the same area information; Determining the interaction frequency information of the instance object with consistent area information according to the historical user interaction data; The instance objects with consistent area information are sorted in descending order of the interaction frequency information to obtain a sorting result.
4. The multi-layer rendering method according to claim 2, characterized in that: According to the order of the area information from large to small, the instance objects of each layer to be rendered are sorted to obtain a sorting result, including: Sort the instance objects of each layer to be rendered in descending order of the area information; In the case of recognizing that the user inputs search information, determining the target instance object according to the search information; The target instance object is adjusted to the end of the sorting to obtain a sorting result.
5. The multi-layer rendering method according to claim 4, characterized in that: After determining the target instance object according to the search information, the method further includes: In the case where there are at least two instance objects with consistent area information, determining the correlation between the instance objects with consistent area information and the target instance object; The instance objects with consistent area information are sorted in the order of the relevance from low to high to obtain a sorting result.
6. The multi-layer rendering method according to claim 1, characterized in that: Get the instance objects of at least two layers to be rendered with overlapping areas, including: Create an instance object of the layer to be rendered based on the leaflet library; Among the instance objects of the layers to be rendered, it is determined that at least two instance objects of the layers to be rendered have overlapping areas.
7. The multi-layer rendering method according to claim 6, characterized in that: Obtain boundary information of the instance objects in each layer to be rendered, including: Get the boundary information of the instance object in each layer to be rendered by using the getBounds method; Accordingly, according to the boundary information, the area information of the instance object in each layer to be rendered is determined, including: The size information of the boundary information is obtained through the getSize method, and the area information of the instance object in each layer to be rendered is determined according to the size information.
8. A multi-layer rendering device, characterized in that: The device comprises: An instance object acquisition module, used to acquire instance objects of at least two layers to be rendered that have overlapping areas; A boundary information acquisition module, used to obtain boundary information of the instance objects in each layer to be rendered; An area information determination module, used to determine the area information of the instance object in each layer to be rendered according to the boundary information; The layer rendering module is used to render each layer to be rendered according to the area information.
9. An electronic device, characterized in that: It includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the multi-layer rendering method as described in any one of claims 1 to 7.
10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the multi-layer rendering method as described in any one of claims 1-7 are implemented.