Quick layer display method and device, storage medium and computer equipment
By building a layer index library and performing entity analysis, the full display data is generated and stored in the GPU, the problem of drawing display time and large GPU resource utilization is solved, and the rapid display of layers and efficient GPU resource management is achieved.
Patent Information
- Application Number
- CN202411674225.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-02-07
AI Technical Summary
In the prior art, the drawing display process takes a long time and occupies a lot of GPU resources, resulting in unstable display and lag.
By obtaining and parsing the layer table of drawing data, building a layer index library, performing entity and element analysis, extracting attribute and geometric drawing data, generating full display data, and storing it in the GPU, setting the layer switch status and Load into preset memory and activate the drawing texture for quick layer display.
It realizes rapid layer display, reduces GPU resource consumption, improves the stability and efficiency of layer display, and achieves delay-free response.
Smart Images

Figure CN119397041A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of drawing display technology, and more particularly to a method, device, storage medium and computer equipment for rapid layer display. Background Art
[0002] In the traditional DWG drawing display process, the system needs to query whether the layer is visible based on the unique identifier of the layer where the entity is located. For layers with a switch status of off, the entities on them will be skipped and will not participate in the generation of graphics, so they will not be displayed in the user interface. In this context, after the user switches the drawing or adjusts the switch status of the layer, the system needs to rescan the entities in the entire drawing and redraw and display the graphics.
[0003] However, in the current market environment, especially in the browser environment, the graphics update operation caused by this layer switching faces many challenges. Due to the slow code execution speed and GPU utilization efficiency of the browser environment, the drawing redisplay process takes a long time and occupies a large amount of GPU resources, resulting in unstable display and freezes. Summary of the invention
[0004] The purpose of this application is to solve at least one of the above-mentioned technical defects, especially the technical defects in the prior art that the drawing display process takes a long time and occupies a large amount of GPU resources, resulting in unstable display and freeze phenomenon.
[0005] The present application provides a method for quickly displaying a layer, the method comprising:
[0006] Acquire drawing data including a plurality of layers, and parse to obtain a layer table of the drawing data, extract an identifier and a switch state of each layer from the layer table, and construct a layer index library of the drawing data based on the identifier and the switch state of each layer;
[0007] Perform entity parsing on the layer table to obtain entity nodes corresponding to each layer, and perform graphic element parsing on each entity node to obtain attribute drawing data and geometric drawing data corresponding to each entity node;
[0008] Extracting the identifier in each attribute drawing data, and determining the layer index information corresponding to each identifier based on the layer index library, so as to generate the full display data of the drawing data according to the layer index information and geometric drawing information of each layer;
[0009] The full display data is stored in the GPU, and the switch state corresponding to each layer is set in the preset memory based on the layer index library, and the preset memory after setting is loaded into the drawing texture pre-built in the GPU;
[0010] The loaded drawing texture is activated so that when a layer preview instruction from a user is received, the GPU is used to quickly draw and display the layer to be previewed in the drawing data according to the activated drawing texture.
[0011] Optionally, constructing a layer index library of the drawing data based on the identifier and switch status of each layer includes:
[0012] Set the index value corresponding to each identifier;
[0013] An identification index table is constructed based on the identifier and index value of each layer, and a state index table is constructed based on the index value and switch state of each layer;
[0014] A layer index library of the drawing data is generated according to the identification index table and the status index table.
[0015] Optionally, each entity node includes an attribute primitive and a geometric primitive corresponding to the attribute primitive;
[0016] The step of performing primitive analysis on each entity node to obtain attribute drawing data and geometric drawing data corresponding to each entity node includes:
[0017] For each entity node, attribute parsing is performed on the attribute primitives of the entity node to obtain attribute drawing data corresponding to the entity node, and geometric parsing is performed on the geometric primitives of the entity node to obtain geometric drawing data of the entity node;
[0018] The geometric drawing data includes point data and color data.
[0019] Optionally, the layer index library includes an identification index table, and the identification index table is constructed with an index relationship between an identifier of each layer and an index value;
[0020] The determining the layer index information corresponding to each identifier based on the layer index library includes:
[0021] For each identifier, an index value corresponding to the identifier is obtained by indexing in the identifier index table, and layer index information is generated according to the identifier and the index value.
[0022] Optionally, the layer index library further includes a state index table, wherein the state index table constructs an index relationship between the index value of each layer and the switch state;
[0023] The step of setting the switch state corresponding to each layer in the preset memory based on the layer index library includes:
[0024] Constructing a preset memory, wherein the memory length of the preset memory is consistent with the number of layers of the drawing data;
[0025] The memory position of each layer is set in the preset memory based on the index value of the state index table, and the display value of each memory position is set according to the switch state corresponding to each index value.
[0026] Optionally, the full display data is composed of entity drawing data of each layer in the drawing data;
[0027] The method of using the GPU to quickly draw and display the layer to be previewed in the drawing data according to the activated drawing texture includes:
[0028] Determine the layer to be previewed in the drawing data as the display layer according to the preset memory loaded in the activated drawing texture;
[0029] The GPU extracts entity drawing data of each display layer from the full display data, and quickly draws and displays each display layer based on each entity drawing data.
[0030] Optionally, the method further comprises:
[0031] After detecting that the user has changed the switch status of each layer in the drawing data, the switch status of the corresponding layer in the preset memory is adjusted according to the change result, and the drawing texture is reactivated.
[0032] The present application also provides a layer rapid display device, comprising:
[0033] A data acquisition module is used to acquire drawing data containing multiple layers, and parse to obtain a layer table of the drawing data, so as to extract an identifier and a switch state of each layer from the layer table, and construct a layer index library of the drawing data based on the identifier and the switch state of each layer;
[0034] A data parsing module is used to perform entity parsing on the layer table to obtain entity nodes corresponding to each layer, and perform graphic element parsing on each entity node to obtain attribute drawing data and geometric drawing data corresponding to each entity node;
[0035] A data aggregation module, used for extracting the identifier in each attribute drawing data, and determining the layer index information corresponding to each identifier based on the layer index library, so as to generate the full display data of the drawing data according to the layer index information and geometric drawing information of each layer;
[0036] A data loading module, used to store the full display data in the GPU, and to set the switch state corresponding to each layer in the preset memory based on the layer index library, and to load the set preset memory into the pre-built drawing texture in the GPU;
[0037] The layer drawing module is used to activate the loaded drawing texture so that when receiving the user's layer preview instruction, the GPU is used to quickly draw and display the layer to be previewed in the drawing data according to the activated drawing texture.
[0038] The present application also provides a storage medium, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the layer rapid display method as described in any of the above embodiments.
[0039] The present application also provides a computer device, comprising: one or more processors, and a memory;
[0040] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the layer rapid display method described in any one of the above embodiments are performed.
[0041] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0042] The layer rapid display method, device, storage medium and computer equipment provided by the present application first parse the layer table of the drawing data when opening a drawing, so that the identifier and switch status of each layer can be extracted from the layer table, and a layer index library of the drawing data can be constructed based on the identifiers and switch status of each layer, which serves as the data index basis for subsequent drawing display; at the same time, the layer table can be entity parsed to obtain the entity node corresponding to each layer, and each entity node can be respectively parsed to obtain the attribute drawing data and geometric drawing data corresponding to each entity node, so that lightweight drawing information can be retained and the response efficiency of subsequent drawing display can be improved; then the identifier in each attribute drawing data can be extracted, and based on the identifier and switch status of each layer, a layer index library of the drawing data can be constructed to obtain the attribute drawing data and geometric drawing data corresponding to each entity node. The layer index library determines the layer index information corresponding to each identifier to generate the full display data of the drawing data according to the layer index information and geometric drawing information of each layer, thereby realizing the full loading and reuse of the drawing data and reducing GPU resource consumption; finally, the full display data can be stored in the GPU, and the switch state corresponding to each layer can be set in the preset memory based on the layer index library, and then the preset memory after setting is loaded into the pre-built drawing texture in the GPU, and the loaded drawing texture is activated. Therefore, when the user's layer preview instruction is received, the GPU can be used to quickly draw and display the layer to be previewed in the drawing data according to the activated drawing texture to achieve a delay-free response. Based on this, the present application can first load the drawing data in full when opening the drawing and retain it in the GPU so that it can be reused when the drawing is redisplayed, thereby reducing the GPU's resource consumption and improving the stability and efficiency of layer display. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0044] Figure 1 A schematic diagram of a process flow of a layer rapid display method provided in an embodiment of the present application;
[0045] Figure 2 A schematic diagram of a process of constructing a layer index library provided in an embodiment of the present application;
[0046] Figure 3 A schematic diagram of the flow of a layer rapid display logic provided in an embodiment of the present application;
[0047] Figure 4A schematic diagram of the structure of a layer rapid display device provided in an embodiment of the present application;
[0048] Figure 5 A schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0050] In the current market environment, especially in the browser environment, the graphics update operation caused by this layer switching faces many challenges. Due to the slow code execution speed and GPU utilization efficiency of the browser environment, the drawing redisplay process takes a long time and occupies a large amount of GPU resources, resulting in unstable display and freezes.
[0051] Based on this, this application proposes the following technical solutions, see below for details:
[0052] In one embodiment, Figure 1 As shown, Figure 1 A schematic diagram of a process flow of a layer rapid display method provided in an embodiment of the present application; the present application provides a layer rapid display method, which specifically includes the following:
[0053] S110: Acquire drawing data including multiple layers, and parse to obtain a layer table of the drawing data, extract an identifier and a switch state of each layer from the layer table, and construct a layer index library of the drawing data based on the identifiers and switch states of each layer.
[0054] In this step, when the user opens the drawing for the first time, the computer device can first obtain the drawing data containing multiple layers corresponding to the target graphic object, and then parse to obtain the layer table of the drawing data, so that the identifier and switch status of each layer can be extracted from the layer table, and a layer index library of the drawing data can be constructed based on the identifiers and switch status of each layer, which serves as the data index basis for subsequent drawing display.
[0055] Among them, drawing data refers to the complete drawing information corresponding to the target graphic object, which usually exists in the form of a file, such as a CAD file or other vector file, which contains all the contents in the drawing, including geometric shapes, annotations, text, colors, line types, hierarchical relationships, etc. The layer table refers to the specific information table about the layer parsed from the drawing data. Each layer in the drawing is equivalent to a logical grouping for organizing drawing elements. Through the layer table, this application can quickly extract and manage the layer information in the drawing data, which is convenient for dynamically adjusting the display status of the drawing.
[0056] It is understandable that drawing data is usually composed of multiple layers, each of which is used to organize and store specific types of drawing elements, such as geometric shapes, annotation information, text labels, line styles, etc. Based on this, the computer device can perform layer parsing on the drawing data to be loaded to extract relevant information of each layer and generate a layer table. In the layer table, each layer will be assigned a unique identifier to distinguish and locate the specific layer, and the current switch status of each layer will also be recorded to indicate the visible status of the layer when the drawing data is loaded and drawn.
[0057] In addition, after the computer device extracts the identifier and switch status of each layer from the layer table, it can build a layer index library based on these data. The layer index library here is actually an efficient way to organize drawing data. It manages the basic information of the layer in a systematic and structured manner, so that it can quickly respond to subsequent drawing display requests. Through the layer index library, the computer device can quickly realize operations such as fast acquisition, dynamic display, hiding or adjustment of the layer, thereby providing users with a smoother interactive experience.
[0058] S120: performing entity parsing on the layer table to obtain entity nodes corresponding to each layer, and performing graphic element parsing on each entity node to obtain attribute drawing data and geometric drawing data corresponding to each entity node.
[0059] In this step, after obtaining the layer table of the drawing data through step S110, the computer device can also perform entity parsing on the layer table to obtain the entity nodes corresponding to each layer, and then perform primitive parsing on each entity node to obtain the attribute drawing data and geometric drawing data corresponding to each entity node. This can retain lightweight drawing information and improve the response efficiency of subsequent drawing displays.
[0060] Among them, the entity node refers to the logical representation of a specific drawing object or geometric element in a layer. It is the smallest unit in the drawing data that can be processed independently, including various types of elements such as points, line segments, arcs, polygons, text annotations, blocks, etc.; for example, in a CAD drawing, an entity node can be a line, a piece of text, or an inserted block, etc. In addition, an entity node can be composed of attribute drawing data and geometric drawing data; the attribute drawing data here refers to the non-geometric information of the entity node, which is used to describe the style, expression form and additional information of the entity node, while the geometric drawing data refers to the spatial description information of the entity node, which defines the specific shape, size and position of the entity node.
[0061] Specifically, the computer device can perform entity parsing on the layer table to obtain the specific drawing objects or elements contained in each layer. These drawing objects or elements are entity nodes, which are the basic components of the layer structure and represent the specific geometric shapes on the drawing; therefore, through entity parsing, the computer device can refine and classify the geometric shapes of each layer. After obtaining the entity nodes of each layer, the computer device can also parse and extract the core information of each entity node, including attribute drawing data and geometric drawing data, so as to describe the appearance characteristics of the entity node through the attribute drawing data, and describe the spatial shape and position of the entity node through the geometric drawing data.
[0062] Therefore, through entity parsing of layer tables and primitive parsing of entity nodes, computer equipment can refine complex data into streamlined lightweight information and remove redundant or unnecessary data, which can not only significantly reduce the occupation of memory and computing resources, but also greatly improve the response speed of drawing display. In addition, lightweight drawing information still retains key attributes and geometric features, ensuring that the display effect is consistent with the original drawing, providing efficient data support for subsequent fast rendering and dynamic interaction.
[0063] S130: extracting the identifier in each attribute drawing data, and determining the layer index information corresponding to each identifier based on the layer index library, so as to generate full display data of the drawing data according to the layer index information and geometric drawing information of each layer.
[0064] In this step, after extracting the attribute drawing data and geometric drawing data of each layer through step S120, the computer device can extract the identifier of each attribute drawing data, and then determine the layer index information corresponding to each identifier based on the layer index library, and then generate the full display data of the drawing data according to the layer index information and geometric drawing information of each layer, thereby realizing the full loading and reuse of the drawing data and reducing GPU resource consumption.
[0065] It is understandable that the computer device can represent the layer where the corresponding entity node is located through the identifier in the attribute drawing data. Specifically, the computer device can quickly match the extracted identifier with the pre-built layer index library to obtain the corresponding layer index information; the layer index information contains the basic data structure and relationship mapping of the corresponding layer, such as the identifier, switch status and other data that can be used for management and display.
[0066] Furthermore, the computer device can integrate the layer index information of each layer and the geometric drawing information of the corresponding entity node, and form the full display data of the complete drawing data by associating the two. The full display data obtained in this way is a comprehensive reconstruction of the drawing data. It contains the geometric elements of all layers and their visual and attribute information, and can completely and efficiently restore the visual effect of the entire drawing data after drawing. In addition, this full display data can be cached or reused to avoid repeated calculations when the user views or switches views multiple times, thereby significantly reducing the consumption of GPU resources.
[0067] S140: storing all display data in the GPU, and setting the switch state corresponding to each layer in the preset memory based on the layer index library, and loading the set preset memory into the pre-built drawing texture in the GPU.
[0068] In this step, after obtaining the full display data of the drawing data through step S130, the computer device can store the full display data in the GPU. At the same time, the computer device can also set the switch state corresponding to each layer in the preset memory based on the layer index library, and load the set preset memory into the drawing texture pre-built in the GPU.
[0069] It is understandable that GPUs often process large-scale graphics and geometric data. This application stores all display data in the GPU to fully utilize its powerful parallel computing capabilities and improve the rendering efficiency and response speed of the drawing display. In addition, the computer device can also set the corresponding switch state for each layer in the preset memory area based on the information of the layer index library, such as display state or hidden state; therefore, the computer device can adjust the switch state of each layer in the memory area in real time according to user needs or operations.
[0070] For example, when the switch state of a layer is displayed, the computer device can set the value of the corresponding position in the memory area to 1; when the switch state of a layer is hidden, the computer device can set the value of the corresponding position in the memory area to 0. If the user still needs to hide some of the layers later, the computer device only needs to update the switch state of the corresponding position in the memory area according to the user's needs, without parsing or re-rendering the entire drawing data.
[0071] It should be noted that the drawing texture of this application is a key data structure used by the GPU to manage and process graphics rendering. It can associate the switch state of the layer with the corresponding full display data, so as to dynamically adjust the display effect of each layer during actual rendering. Through this mechanism, the computer device can efficiently realize the display and hiding switching of the layer without recalculating all the geometric data in the drawing data.
[0072] S150: Activate the loaded drawing texture so that when receiving a layer preview instruction from the user, use the GPU to quickly draw and display the layer to be previewed in the drawing data according to the activated drawing texture.
[0073] In this step, after the preset memory is loaded into the drawing texture through step S140, the computer device can activate the loaded drawing texture. In this way, when receiving the user's layer preview instruction, the computer device can use the GPU to quickly draw and display the layer to be previewed in the drawing data according to the activated drawing texture, thereby achieving a delay-free response.
[0074] It can be understood that the process of activating the drawing texture is actually to configure it as the current rendering target of the GPU, so that it can quickly respond to user instructions in the subsequent drawing process. In this way, the computer device can use the GPU to call the layer switch status and the corresponding full display data stored in the activated drawing texture at any time, so that without affecting other layers, only the layers that need to be previewed in the user interface are rendered and displayed. Operations, thereby effectively shortening the response time, and giving full play to the parallel processing capabilities of the GPU, ensure that smooth rendering operations can still be provided when processing large-scale drawing data.
[0075] In the above embodiment, when opening a drawing, the layer table of the drawing data is first parsed to obtain the identifier and switch status of each layer from the layer table, and a layer index library of the drawing data is constructed based on the identifiers and switch status of each layer, which serves as the data index basis for subsequent drawing display; at the same time, the layer table can also be entity parsed to obtain the entity node corresponding to each layer, and the entity nodes are respectively parsed to obtain the attribute drawing data and geometric drawing data corresponding to each entity node, so that lightweight drawing information can be retained and the response efficiency of subsequent drawing display can be improved; then the identifier in each attribute drawing data can be extracted, and each identifier can be determined based on the layer index library. The layer index information corresponding to the symbol is used to generate the full display data of the drawing data according to the layer index information and geometric drawing information of each layer, thereby realizing the full loading and reuse of the drawing data and reducing the GPU resource consumption; finally, the full display data can be stored in the GPU, and the switch state corresponding to each layer can be set in the preset memory based on the layer index library, and then the preset memory after the setting is loaded into the pre-built drawing texture in the GPU, and the loaded drawing texture is activated. Therefore, when the user's layer preview instruction is received, the GPU can be used to quickly draw and display the layer to be previewed in the drawing data according to the activated drawing texture to achieve a delay-free response. Based on this, the present application can first load the drawing data in full when opening the drawing and retain it in the GPU so that it can be reused when the drawing is redisplayed, thereby reducing the GPU's resource consumption and improving the stability and efficiency of layer display.
[0076] In one embodiment, Figure 2 As shown, Figure 2 A schematic diagram of a process of constructing a layer index library provided in an embodiment of the present application; Figure 2 In step S110, the process of constructing a layer index library of drawing data based on the identifiers and switch states of each layer may include:
[0077] S111: Setting the index value corresponding to each identifier.
[0078] S112: constructing an identification index table based on the identifiers and index values of each layer, and constructing a status index table based on the index values and switch states of each layer.
[0079] S113: Generate a layer index library of drawing data according to the identification index table and the status index table.
[0080] In this embodiment, when establishing a layer index library, the computer device can set the index value corresponding to each identifier, and then construct an identification index table based on the identifiers and index values of each layer, and construct a status index table based on the index values and switch states of each layer, and then generate a layer index library for the drawing data based on the identification index table and the status index table.
[0081] It is understandable that the index value here can be used as a unique identifier for each layer to improve search efficiency in the management process of drawing data; through the index value, the computer device can directly access the data of the corresponding layer without traversing all layers. When assigning index values to each layer, the computer device can increase them in sequence according to the order in which the layers were created, that is, number them in sequence according to the generation time or order of appearance of the layers in the drawing data to ensure the uniqueness of the index value; for example, the index value of the first created layer is assigned 1, the second is assigned 2, and so on. In addition, the method of assigning index values can also be adjusted according to specific needs, such as custom sorting by layer type, priority or other attributes, which is not limited here.
[0082] Specifically, after the index values of each layer are assigned, the computer device can further construct a layer index library according to the identifiers, index values and switch states of each layer, including an identification index table and a status index table. Among them, the identification index table can associate the identifier of each layer with its corresponding index value. Therefore, through the identification index table, the computer device can quickly find the index value corresponding to the identifier, thereby providing an efficient positioning mechanism for subsequent data parsing and layer operations; the status index table is constructed based on the index values and switch states of each layer. Through the status index table, the computer device can quickly determine and index the display state of the corresponding layer without re-parsing the complete drawing data. In short, the layer index library of the present application, as the core management structure of the drawing data, can efficiently organize the identifiers, index values, switch states and other attributes of the layers, and provide strong support for the rapid loading, accurate query, dynamic rendering and real-time interaction of the drawing data.
[0083] In one embodiment, each entity node in step S120 includes an attribute primitive and a geometric primitive corresponding to the attribute primitive; wherein the process of performing primitive parsing on each entity node to obtain attribute drawing data and geometric drawing data corresponding to each entity node may include:
[0084] S121: For each entity node, perform attribute parsing on the attribute primitives of the entity node to obtain attribute drawing data corresponding to the entity node, and perform geometric parsing on the geometric primitives of the entity node to obtain geometric drawing data of the entity node.
[0085] In this embodiment, since the entity node contains attribute primitives and geometric primitives corresponding to the attribute primitives, when parsing the entity node, the attribute primitives of the entity node can be firstly subjected to attribute parsing to obtain the attribute drawing data corresponding to the entity node; at the same time, the computer device can also perform geometric parsing on the geometric primitives of the entity node to obtain the geometric drawing data of the entity node.
[0086] Among them, attribute primitives refer to the part of entity nodes used to describe and define non-geometric information, which is usually related to the visual or logical characteristics of the entity. These primitives carry the attribute data of the layer object, rather than its specific spatial form or geometric structure; while geometric primitives refer to the part of entity nodes used to describe spatial form and structural characteristics, mainly defining the specific position, shape and size of the object in the drawing. These primitives are graphic elements directly presented on the drawing, which determine the geometric appearance of the entity and are the core components of the drawing data visualization.
[0087] It is understandable that attribute primitives may include information such as visual attributes, logical attributes, descriptive information and interactive attributes, while geometric primitives may include information such as points, lines, surfaces, bodies and coordinate information. Therefore, the computer device can parse and extract key information from the attribute primitives, such as color, transparency, and line type in visual attributes, layers and identifiers in logical attributes, annotations and naming in descriptive information, and response time or dynamic behavior in interactive attributes, and then generate attribute drawing data, which is mainly used as the basis for subsequent geometric primitive rendering and determines the appearance and behavior of the geometric primitives; in addition, the computer device can also parse and extract key information from geometric primitives, such as points, lines, surfaces and complex geometric bodies, and then generate geometric drawing information, which is the core information for the visual display of entity nodes in drawings and directly determines their position, shape and size in drawings.
[0088] It should be noted that by parsing the attribute primitives and geometric primitives in steps, the computer device can extract complete and independent attribute drawing data and geometric drawing data from the entity node, thereby providing sufficient data support for subsequent drawing rendering. This parsing method can not only ensure the clear separation of attribute information and geometric information, but also achieve efficient collaborative processing during rendering. For example, when drawing, the computer device can apply the style to the geometric drawing data according to the configuration of the attribute drawing data, thereby achieving accurate restoration and dynamic adjustment of the entity nodes in the layer.
[0089] In one embodiment, in step S130, the layer index library includes an identification index table, and the identification index table constructs an index relationship between the identifiers and index values of each layer; wherein the process of determining the layer index information corresponding to each identifier based on the layer index library may include:
[0090] S131: For each identifier, obtain an index value corresponding to the identifier by searching in the identifier index table, and generate layer index information according to the identifier and the index value.
[0091] In this embodiment, when the computer device determines the layer index information corresponding to the identifier, it can index the index value corresponding to the identifier in the identification index table in the layer index library, and generate the layer index information based on the identifier and the index value. Therefore, the correspondence between the identifier and the index value can be obtained through the layer index information.
[0092] It is understandable that the identification index table pre-constructs the index relationship between each identifier and index value in the drawing data, which associates the unique identifier of each layer with the corresponding index value for fast positioning and management of layer data. Therefore, after the computer device obtains the identifier of the layer, it can enter the identifier in the identification index table for data query, so as to obtain the index value corresponding to the identifier; then, the computer device can extract the queried index value and combine it with the identifier to generate layer index information, so that the layer can be directly located through the layer index information later.
[0093] In one embodiment, in step S140, the layer index library further includes a state index table, and the state index table constructs an index relationship between the index value of each layer and the switch state; wherein, the process of setting the switch state corresponding to each layer in the preset memory based on the layer index library may include:
[0094] S141: construct a preset memory, the memory length of the preset memory is consistent with the number of layers of the drawing data.
[0095] S142: setting a memory position of each layer in a preset memory based on the index value of the state index table, and setting a display value of each memory position according to a switch state corresponding to each index value.
[0096] In this embodiment, the computer device can construct a preset memory with a memory length consistent with the number of layers of the drawing data, and then set the memory position of each layer in the preset memory based on the index value of the state index table, and set the display value of each memory position according to the switch state corresponding to each index value, so that the switch state of each layer can be directly determined through the preset memory, avoiding the need to repeatedly analyze the drawing data each time the drawing data is switched.
[0097] It is understandable that in order to improve the efficiency of layer management and the response speed of layer drawing, the computer device can build a preset memory that is consistent with the number of layers of the drawing data. By mapping the switch status of each layer to this preset memory, the switch status of each layer can be stored and managed in an efficient manner, so that subsequent drawing display, rendering and user interaction operations can respond quickly, thereby greatly improving the performance of drawing data management. Therefore, each time the drawing data is switched, the computer device only needs to reload the preset memory of the corresponding drawing data without repeatedly parsing or reconstructing the layer switch status.
[0098] Specifically, the computer and the device can first allocate a preset memory area of fixed length according to the number of layers of the drawing data; for example, if the drawing data includes 100 layers, the length of the preset memory will be set to 100 storage units, each storage unit corresponds to a layer, and an efficient mapping table is provided for the rapid access of the layer switch status. Then, the computer device can determine the position of each layer in the preset memory based on the index value recorded in the state index table; in detail, the index value can be used as an offset value of the preset memory. For example, if the index value of one of the layers is 5, the display value of its corresponding switch status will be stored in the 5th storage unit of the preset memory, so as to ensure that the switch status of each layer can be quickly located by the index value.
[0099] In one embodiment, the full display data in step S150 is composed of entity drawing data of each layer in the drawing data. The process of using the GPU to quickly draw and display the layers to be previewed in the drawing data according to the activated drawing texture may include:
[0100] S151: Determine a layer to be previewed in the drawing data according to the preset memory loaded in the activated drawing texture as a display layer.
[0101] S152: extracting entity drawing data of each display layer from the full display data through the GPU, and quickly drawing and displaying each display layer based on each entity drawing data.
[0102] In this embodiment, when the computer device draws the drawing data, it can determine the layer to be previewed in the drawing data according to the preset memory loaded in the activated drawing texture as the display layer, and then extract the entity drawing data of each display layer from the full display data through the GPU, and quickly draw and display each display layer based on each entity drawing data, thereby realizing the rapid display of the drawing data.
[0103] It should be noted that the full display data is the complete drawing information of all layers in the drawing data, including the entity drawing data of each layer. The entity drawing data is composed of the attribute drawing data and geometric drawing data of the corresponding layer, which fully describes the appearance characteristics and spatial form of the entity in the layer.
[0104] Specifically, the computer device can quickly identify the layer that needs to be previewed and displayed in the drawing data through a state management mechanism of a preset memory, and use it as the display layer, avoiding the overhead of re-parsing the layer switch state during the drawing and display process; then the parallel processing capability of the GPU can be fully utilized to quickly locate the entity drawing data of each display layer from the full display data according to the identifier and index value of the display layer, thereby being able to complete the filtering and extraction of a large amount of drawing data in a shorter time, and the extracted entity drawing data will be loaded into the drawing pipeline as the core input for rendering.
[0105] Furthermore, the computer device can use the GPU to quickly draw these layers one by one based on the entity drawing data of each display layer. During the drawing process, the GPU can render each entity in the display layer to the user interface in a high-quality form according to the attributes defined in the entity drawing data, such as color, line type, transparency, etc., as well as geometric information such as shape, size, coordinates, etc. At the same time, other auxiliary information in the drawing texture, such as layer priority, overlay mode, etc., will also be applied in this process to ensure that the final displayed graphic objects can accurately reflect their hierarchical relationships and visual effects.
[0106] In one embodiment, the method may further include:
[0107] S160: After detecting that the user has changed the switch status of each layer in the drawing data, the switch status of the corresponding layer in the preset memory is adjusted according to the change result, and the drawing texture is reactivated.
[0108] In this embodiment, the computer device can also efficiently respond to the user's changes to the switch state of the layer to achieve dynamic updates of the layer display. Specifically, when the computer device detects that the user has changed the switch state of the layer in the drawing data, it can immediately respond to the user operation and parse the user operation to determine the specific layer that has been changed and its switch state after the change according to the analysis result. Then, the computer device can locate the storage location of the corresponding layer in the preset memory according to the user's change result, and write the switch state value in the change result to the corresponding location in the preset memory. Because the drawing texture is the direct basis for the GPU to control the layer display, the computer device also needs to reactivate the drawing texture after the state is changed, so that the new switch state of the layer can be reflected in the rendering result.
[0109] In order to better explain the layer quick display method of this application, the following will be Figure 3 To further illustrate, schematically, Figure 3 As shown, Figure 3 A flow diagram of a layer quick display logic provided in an embodiment of the present application.
[0110] Figure 3 In the process, the computer device can translate the layer information of the original DWG data (drawing data) through LayerTable (chart layer), generate LayerMap (state index table) through the target data in the translation result, and parse the entity layer in the translation result to obtain the corresponding Index (identifier), and set the corresponding target (index value) for it, until all layers are parsed, generate full display data according to the parsing results, and load the full display data into the GPU for storage; at the same time, generate a texture, and load the layer information into the texture according to LayerMap to set the drawing environment, and then perform entity drawing in the user interface according to the full display data and texture stored in the GPU. During the drawing process, for each layer, if the texture query finds that the layer does not need to be displayed, the GPU will not draw it, otherwise it will draw it and display it in the user interface. In addition, when the user inputs information to modify the switch state of the layer, the computer device can synchronously update the switch state in LayerMap according to the corresponding layer information modified by the user.
[0111] The layer rapid display device provided in the embodiment of the present application is described below. The layer rapid display device described below and the layer rapid display method described above can be referenced to each other.
[0112] In one embodiment, Figure 4 As shown, Figure 4 The present application also provides a layer rapid display device, including a data acquisition module 210, a data analysis module 220, a data aggregation module 230, a data loading module 240 and a layer drawing module 250, which specifically include the following:
[0113] The data acquisition module 210 is used to acquire drawing data containing multiple layers, and parse to obtain a layer table of the drawing data, so as to extract the identifier and switch status of each layer from the layer table, and construct a layer index library of the drawing data based on the identifier and switch status of each layer.
[0114] The data analysis module 220 is used to perform entity analysis on the layer table to obtain entity nodes corresponding to each layer, and perform primitive analysis on each entity node to obtain attribute drawing data and geometric drawing data corresponding to each entity node.
[0115] The data aggregation module 230 is used to extract the identifiers in each attribute drawing data, and determine the layer index information corresponding to each identifier based on the layer index library, so as to generate full display data of the drawing data according to the layer index information and geometric drawing information of each layer.
[0116] The data loading module 240 is used to store all display data in the GPU, and to set the switch state corresponding to each layer in the preset memory based on the layer index library, and load the set preset memory into the pre-built drawing texture in the GPU.
[0117] The layer drawing module 250 is used to activate the loaded drawing texture so that when receiving the user's layer preview instruction, the GPU is used to quickly draw and display the layer to be previewed in the drawing data according to the activated drawing texture.
[0118] In the above embodiment, when opening a drawing, the layer table of the drawing data is first parsed to obtain the identifier and switch status of each layer from the layer table, and a layer index library of the drawing data is constructed based on the identifiers and switch status of each layer, which serves as the data index basis for subsequent drawing display; at the same time, the layer table can also be entity parsed to obtain the entity node corresponding to each layer, and the entity nodes are respectively parsed to obtain the attribute drawing data and geometric drawing data corresponding to each entity node, so that lightweight drawing information can be retained and the response efficiency of subsequent drawing display can be improved; then the identifier in each attribute drawing data can be extracted, and each identifier can be determined based on the layer index library. The layer index information corresponding to the symbol is used to generate the full display data of the drawing data according to the layer index information and geometric drawing information of each layer, thereby realizing the full loading and reuse of the drawing data and reducing the GPU resource consumption; finally, the full display data can be stored in the GPU, and the switch state corresponding to each layer can be set in the preset memory based on the layer index library, and then the preset memory after the setting is loaded into the pre-built drawing texture in the GPU, and the loaded drawing texture is activated. Therefore, when the user's layer preview instruction is received, the GPU can be used to quickly draw and display the layer to be previewed in the drawing data according to the activated drawing texture to achieve a delay-free response. Based on this, the present application can first load the drawing data in full when opening the drawing and retain it in the GPU so that it can be reused when the drawing is redisplayed, thereby reducing the GPU's resource consumption and improving the stability and efficiency of layer display.
[0119] In one embodiment, the data acquisition module 210 may include:
[0120] The index value setting submodule is used to set the index value corresponding to each identifier.
[0121] The index table construction submodule is used to construct an identification index table based on the identifier and index value of each layer, and to construct a status index table based on the index value and switch status of each layer.
[0122] The index library generation submodule is used to generate a layer index library of drawing data based on the identification index table and the status index table.
[0123] In one embodiment, each entity node in the data analysis module 220 includes an attribute primitive and a geometric primitive corresponding to the attribute primitive; wherein the data analysis module 220 may further include:
[0124] The graphic element parsing submodule is used to perform attribute parsing on the attribute graphic element of each entity node to obtain the attribute drawing data corresponding to the entity node, and to perform geometric parsing on the geometric graphic element of the entity node to obtain the geometric drawing data of the entity node.
[0125] The geometric drawing data includes point data and color data.
[0126] In one embodiment, the layer index library in the data aggregation module 230 includes an identification index table, and the identification index table constructs an index relationship between the identifier and the index value of each layer; wherein the data aggregation module 230 may further include:
[0127] The index information generation submodule is used to index each identifier in the identifier index table to obtain the index value corresponding to the identifier, and generate layer index information according to the identifier and the index value.
[0128] In one embodiment, the layer index library in the data loading module 240 further includes a state index table, and the state index table constructs an index relationship between the index value of each layer and the switch state; wherein the data loading module 240 may further include:
[0129] The memory construction submodule is used to construct a preset memory. The memory length of the preset memory is consistent with the number of layers of the drawing data.
[0130] The state setting submodule is used to set the memory position of each layer in the preset memory based on the index value of the state index table, and to set the display value of each memory position according to the switch state corresponding to each index value.
[0131] In one embodiment, the full display data in the layer drawing module 250 is composed of entity drawing data of each layer in the drawing data. The layer drawing module 250 may also include:
[0132] The Tucao determination submodule is used to determine the layer to be previewed in the drawing data as the display layer according to the preset memory loaded in the activated drawing texture.
[0133] The layer display submodule is used to extract the entity drawing data of each display layer from the full display data through the GPU, and quickly draw and display each display layer based on each entity drawing data.
[0134] In one embodiment, the apparatus may further include:
[0135] The state adjustment module is used to adjust the switch state of the corresponding layer in the preset memory according to the change result after detecting that the user has changed the switch state of each layer in the drawing data, and reactivate the drawing texture.
[0136] In one embodiment, the present application also provides a storage medium, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the layer rapid display method as described in any of the above embodiments.
[0137] In one embodiment, the present application also provides a computer device having computer-readable instructions stored therein. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the layer rapid display method as described in any of the above embodiments.
[0138] Indicatively, Figure 5 As shown, Figure 5 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 300 may be provided as a server. Figure 5 , the computer device 300 includes a processing component 302, which further includes one or more processors, and a memory resource represented by a memory 301, for storing instructions executable by the processing component 302, such as an application. The application stored in the memory 301 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 302 is configured to execute instructions to perform the layer fast display method of any of the above embodiments.
[0139] The computer device 300 may further include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate based on an operating system stored in the memory 301, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.
[0140] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0141] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also 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 a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0142] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.
[0143] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for quickly displaying a layer, characterized in that: The method comprises: Acquire drawing data including a plurality of layers, and parse to obtain a layer table of the drawing data, extract an identifier and a switch state of each layer from the layer table, and construct a layer index library of the drawing data based on the identifier and the switch state of each layer; Perform entity parsing on the layer table to obtain entity nodes corresponding to each layer, and perform graphic element parsing on each entity node to obtain attribute drawing data and geometric drawing data corresponding to each entity node; Extracting the identifier in each attribute drawing data, and determining the layer index information corresponding to each identifier based on the layer index library, so as to generate the full display data of the drawing data according to the layer index information and geometric drawing information of each layer; The full display data is stored in the GPU, and the switch state corresponding to each layer is set in the preset memory based on the layer index library, and the preset memory after setting is loaded into the drawing texture pre-built in the GPU; The loaded drawing texture is activated so that when a layer preview instruction from a user is received, the GPU is used to quickly draw and display the layer to be previewed in the drawing data according to the activated drawing texture.
2. The layer rapid display method according to claim 1, characterized in that: The layer index library of the drawing data is constructed based on the identifiers and switch states of each layer, including: Set the index value corresponding to each identifier; An identification index table is constructed based on the identifier and index value of each layer, and a state index table is constructed based on the index value and switch state of each layer; A layer index library of the drawing data is generated according to the identification index table and the status index table.
3. The layer rapid display method according to claim 1, characterized in that: Each entity node includes an attribute primitive and a geometric primitive corresponding to the attribute primitive; The step of performing primitive analysis on each entity node to obtain attribute drawing data and geometric drawing data corresponding to each entity node includes: For each entity node, attribute parsing is performed on the attribute primitives of the entity node to obtain attribute drawing data corresponding to the entity node, and geometric parsing is performed on the geometric primitives of the entity node to obtain geometric drawing data of the entity node; The geometric drawing data includes point data and color data.
4. The layer rapid display method according to claim 1, characterized in that: The layer index library includes an identification index table, and the identification index table constructs an index relationship between the identifier of each layer and the index value; The determining the layer index information corresponding to each identifier based on the layer index library includes: For each identifier, an index value corresponding to the identifier is obtained by indexing in the identifier index table, and layer index information is generated according to the identifier and the index value.
5. The layer rapid display method according to claim 1, characterized in that: The layer index library also includes a state index table, which constructs an index relationship between the index value of each layer and the switch state; The step of setting the switch state corresponding to each layer in the preset memory based on the layer index library includes: Constructing a preset memory, wherein the memory length of the preset memory is consistent with the number of layers of the drawing data; The memory position of each layer is set in the preset memory based on the index value of the state index table, and the display value of each memory position is set according to the switch state corresponding to each index value.
6. The layer rapid display method according to claim 1, characterized in that: The full display data is composed of entity drawing data of each layer in the drawing data; The method of using the GPU to quickly draw and display the layer to be previewed in the drawing data according to the activated drawing texture includes: Determine the layer to be previewed in the drawing data as the display layer according to the preset memory loaded in the activated drawing texture; The GPU extracts entity drawing data of each display layer from the full display data, and quickly draws and displays each display layer based on each entity drawing data.
7. The layer rapid display method according to claim 1, characterized in that: The method further comprises: After detecting that the user has changed the switch status of each layer in the drawing data, the switch status of the corresponding layer in the preset memory is adjusted according to the change result, and the drawing texture is reactivated.
8. A layer rapid display device, characterized in that: include: A data acquisition module is used to acquire drawing data containing multiple layers, and parse to obtain a layer table of the drawing data, so as to extract an identifier and a switch state of each layer from the layer table, and construct a layer index library of the drawing data based on the identifier and the switch state of each layer; A data parsing module is used to perform entity parsing on the layer table to obtain entity nodes corresponding to each layer, and perform graphic element parsing on each entity node to obtain attribute drawing data and geometric drawing data corresponding to each entity node; A data aggregation module, used for extracting the identifier in each attribute drawing data, and determining the layer index information corresponding to each identifier based on the layer index library, so as to generate the full display data of the drawing data according to the layer index information and geometric drawing information of each layer; A data loading module, used to store the full display data in the GPU, and to set the switch state corresponding to each layer in the preset memory based on the layer index library, and to load the set preset memory into the pre-built drawing texture in the GPU; The layer drawing module is used to activate the loaded drawing texture so that when receiving the user's layer preview instruction, the GPU is used to quickly draw and display the layer to be previewed in the drawing data according to the activated drawing texture.
9. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the layer rapid display method as described in any one of claims 1 to 7.
10. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the layer rapid display method as described in any one of claims 1 to 7 are performed.