Method and system for linkage drawing and editing of horizontal section based on OpenGL
By building a platform using the OpenGL graphics library and employing unique identifiers to associate planar and cross-sectional feature functions, the complex problem of associating planar and cross-sectional features in existing technologies is solved, enabling efficient linked drawing and editing and improving the efficiency of planar and cross-sectional map generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NORTHWEST ELECTRIC POWER DESIGN INST OF CHINA POWER ENG CONSULTING GRP
- Filing Date
- 2023-02-03
- Publication Date
- 2026-04-10
AI Technical Summary
Existing plan and section drawing software requires a lot of text operations when linking plan and section views, has complex attribute editing, and the section views cannot be linked in real time, which affects the efficiency of drawing.
A drawing platform is built using the OpenGL graphics library. Functions that associate planar and cross-sectional features with unique identifiers are used to achieve linked drawing and editing using OpenGL functions, including mouse response events, highlighting, and attribute acquisition modules.
It enables the simultaneous drawing and editing of planar and cross-sectional features, reducing text operations, improving mapping efficiency, and lowering the probability of errors.
Smart Images

Figure CN115984425B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of overhead transmission line plan section drawing processing, and particularly relates to a plan section drawing linkage drawing and editing method and system based on OpenGL. BACKGROUND
[0002] In the design stage of overhead transmission line engineering construction drawing, the measurement data obtained through final survey positioning needs to be drawn into line plan section drawing and provided to line design personnel; in the design work, the line plan section drawing, as main measurement data, is the basis for line optimization positioning design, and therefore, accurate and rapid plan section drawing is crucial to the entire transmission line project.
[0003] Now, the relatively mature plan section drawing software includes the domestic Daoheng SLW2D overhead transmission line plan section drawing processing and positioning SLCAD software and the foreign PLS-CADD software, etc., however, these software is not satisfactory in the association between plane and section, needs a large amount of text operation, is not fully object-oriented, and the attribute editing is very complex, and after the plane ground object attribute is moved and edited, the associated section drawing cannot be drawn in linkage in real time, which greatly affects the drawing efficiency of plan section drawing. SUMMARY
[0004] The present application aims at the problems in the prior art, and provides a plan section drawing linkage drawing and editing method and system based on OpenGL, which effectively improves the drawing efficiency of plan section drawing and reduces the workload of internal personnel.
[0005] In order to achieve the above-mentioned purpose, the present application has the following technical scheme:
[0006] A plan section drawing linkage drawing and editing method based on OpenGL, comprising the following steps:
[0007] An OpenGL graphics library is cited to build a drawing platform, functions of plane ground objects and section ground objects are constructed, and the functions of plane ground objects and section ground objects are associated by using unique identification ID;
[0008] A mouse single-click response event OglControl_LeftMouseButtonDown is added to draw plane ground objects, the plane ground objects are drawn by using an OpenGL drawing function OnDraw, the positions of section ground objects are calculated and the section ground objects are drawn at the same time of drawing the plane ground objects, the plane ground objects and the section ground objects are associated in the background by using ID, and are stored in an array;
[0009] Adding response event in OpenGL mouse event OglControl_MouseMove, when mouse moves to a certain plane feature or a certain section feature, using SetHoverFlag function to highlight the associated plane feature and section feature at the same time;
[0010] When selecting a certain plane feature or section feature, using SetSelectedFlag function in OpenGL to select the associated plane feature and section feature at the same time, and giving the attributes of plane and section in the attribute table at the same time;
[0011] When editing the attribute value of a certain plane feature or section feature, the associated plane feature and section feature are edited at the same time, and the result is displayed in real time by using OnDraw function.
[0012] As a preferred scheme, in the step of associating the functions of plane feature and section feature by using unique identification ID, one plane feature can be associated with multiple sections, but one section feature can only be associated with one plane feature.
[0013] As a preferred scheme, in the step of associating the functions of plane feature and section feature by using unique identification ID, an ID generator is constructed to generate unique ID; when a certain plane feature is deleted, its corresponding section feature is also deleted, and the ID number is deleted in the ID array.
[0014] As a preferred scheme, when drawing plane feature or section feature by using OpenGL drawing function OnDraw, rubber band drawing method of OpenGL is used to draw linear feature, and when drawing planar feature, the first point and the last point are closed.
[0015] As a preferred scheme, in the step of adding response event in OpenGL mouse event OglControl_MouseMove, when mouse moves to a certain plane feature or a certain section feature, using SetHoverFlag function to highlight the associated plane feature and section feature at the same time, when mouse moves on the screen, the coordinate position of mouse is picked up in real time, whether the mouse is on plane or section is judged according to the coordinate position of mouse, then the corresponding feature is queried in the feature, then the corresponding associated feature is found according to ID, and the associated plane feature and section feature are highlighted at the same time.
[0016] As a preferred scheme, when mouse moves to a certain plane feature, the threshold value of object selection is set to control precision, and the threshold value is controlled in centimeter precision.
[0017] As a preferred scheme, when the linkage drawing and editing are performed, the block operation is performed according to the mileage of the planar feature, and the associated features are selected according to the threshold value.
[0018] An OpenGL-based planar profile map linkage drawing and editing system comprises:
[0019] A function association module is configured to reference an OpenGL graphics library to build a drawing platform, construct functions of planar features and profile features, and associate the functions of the planar features and the profile features by using a unique identification ID.
[0020] A drawing module is configured to add a mouse single-click response event OglControl_LeftMouseButtonDown to draw the planar features, draw the planar features by using an OpenGL drawing function OnDraw, calculate the positions of the profile features and draw the profile features at the same time of drawing the planar features, associate the planar features and the profile features in the background by using the ID, and store the planar features and the profile features in an array.
[0021] A highlight display module is configured to add a response event in an OpenGL mouse event OglControl_MouseMove, highlight the associated planar features and profile features at the same time when the mouse moves to a planar feature or a profile feature by using a SetHoverFlag function.
[0022] An attribute acquisition module is configured to select the associated planar features and profile features at the same time by using a SetSelectedFlag function in the OpenGL when a planar feature or a profile feature is selected, and simultaneously give the attributes of the planar features and the profile features in an attribute table.
[0023] An editing module is configured to simultaneously edit the associated planar features and profile features when the attribute values of the planar features or the profile features are edited, and display the results in real time by using an OnDraw function.
[0024] An electronic device comprises:
[0025] A memory is configured to store at least one instruction; and
[0026] A processor is configured to execute the instruction stored in the memory to implement the OpenGL-based planar profile map linkage drawing and editing method.
[0027] A computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the OpenGL-based planar profile map linkage drawing and editing method.
[0028] Compared with the prior art, the present application has at least the following beneficial effects:
[0029] The drawing platform is built by referring to the OpenGL graphics library, the functions of the planar feature and the cross-section feature are constructed, the functions of the planar feature and the cross-section feature are associated by using the unique identification ID, the linkage drawing and editing of the planar feature and the cross-section feature can be completely realized by using the cooperation of the OpenGL functions, the text editing operation of the mapping personnel is no longer needed, the storage content of the background is no longer considered, only the graphic file needed by the mapping personnel is drawn, and the drawn is the obtained. Meanwhile, the attribute values of the planar feature and the cross-section feature can be conveniently edited after the drawing, the mapping efficiency is greatly improved, and the error probability is reduced. BRIEF DESCRIPTION OF DRAWINGS
[0030] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments will be simply introduced below, and it should be understood that the following drawings only show some embodiments of the present application, and other related drawings can also be obtained by those skilled in the art without creative labor on the premise of the drawings.
[0031] Figure 1 The drawing platform is built by referring to the OpenGL graphics library, the functions of the planar feature and the cross-section feature are constructed, the functions of the planar feature and the cross-section feature are associated by using the unique identification ID, the linkage drawing and editing of the planar feature and the cross-section feature can be completely realized by using the cooperation of the OpenGL functions, the text editing operation of the mapping personnel is no longer needed, the storage content of the background is no longer considered, only the graphic file needed by the mapping personnel is drawn, and the drawn is the obtained. Meanwhile, the attribute values of the planar feature and the cross-section feature can be conveniently edited after the drawing, the mapping efficiency is greatly improved, and the error probability is reduced.
[0032] Figure 2 The functions of the planar feature and the cross-section feature are constructed, and the planar cross-section drawing is linkage drawn.
[0033] Figure 3 The planar and cross-section linkage highlight display is shown.
[0034] Figure 4 The planar and cross-section attribute information is simultaneously displayed. DETAILED DESCRIPTION
[0035] The technical solutions in the embodiments of the present application will be clearly and completely described below by combining the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, other embodiments can also be obtained by those skilled in the art without creative labor.
[0036] The existing planar cross-section drawing software needs a large amount of text operation when the planar feature and the cross-section are associated, is not completely object-oriented, and the attribute editing is very complex. After the planar feature attribute is moved and edited, the associated cross-section drawing cannot be linkage drawn in real time, which influences the mapping efficiency of the planar cross-section drawing. Therefore, the present application provides a planar cross-section drawing linkage drawing and editing method based on the OpenGL, which specifically includes the following steps:
[0037] 1、Refer to Figure 1 , reference OpenGL graphics library to build drawing platform, construct functions of planar features and cross-section features, and associate the functions of planar features and cross-section features by using unique identifier ID;
[0038] 2、Refer to Figure 2 , add mouse single-click response event OglControl_LeftMouseButtonDown to draw planar features, draw the planar features by using OpenGL drawing function OnDraw, calculate the position of cross-section features and draw the cross-section features while drawing the planar features, associate the planar features and cross-section features in the background by using ID, and store in an array;
[0039] 3、add response event in OpenGL mouse event OglControl_MouseMove, when the mouse moves to a planar feature or a cross-section feature, highlight the associated planar feature and cross-section feature at the same time by using SetHoverFlag function, as shown in Figure 3 ;
[0040] 4、when a planar feature or a cross-section feature is selected, the associated planar feature and cross-section feature are selected at the same time by using SetSelectedFlag function in OpenGL, and the attributes of the planar and cross-section features are given in the attribute table at the same time, as shown in Figure 4 ;
[0041] 5、when editing the attribute value of a planar feature or a cross-section feature, the associated planar feature and cross-section feature are edited at the same time, and the result is displayed in real time by using OnDraw function.
[0042] In a possible implementation, in step 1 of associating the functions of planar features and cross-section features by using unique identifier ID, one planar feature can also be associated with multiple cross-sections, but one cross-section feature can only be associated with one planar feature. For example, one power line can intersect with multiple cross-sections, and there are multiple cross-section projection lines, so an array needs to be set in the attributes of planar and cross-section features to store ID. At the same time, ID, as the unique identifier of planar and cross-section features in the whole map, cannot be repeated, so an ID generator needs to be constructed to generate a unique ID. When a planar feature is deleted, the corresponding cross-section feature is also deleted, and the ID number is deleted in the ID array.
[0043] In a possible implementation, in step 2, when drawing linear features, the rubber band drawing method of OpenGL needs to be used, and when drawing planar features, the start and end points need to be closed.
[0044] In a possible implementation, step 3 picks up the coordinate position of the mouse in real time when the mouse moves on the screen, judges whether the mouse is on a plane or a section according to the coordinate position of the mouse, then queries the corresponding ground object in the ground object, and finds the corresponding associated ground object according to the ID, and simultaneously highlights the associated plane ground object and section ground object.
[0045] In a possible implementation, when there are more plane ground objects, the adjacent ground objects are also selected when the mouse moves to a certain plane ground object, so the precision control is needed when setting the threshold value, and the control is generally in the centimeter precision, so the wrong selection is not possible.
[0046] Meanwhile, when the linkage drawing and editing are performed, the associated ground object is selected according to the threshold value, and a large amount of loop operation is needed, so when there are more ground objects, the block operation can be performed according to the mileage of the plane ground object to improve the efficiency.
[0047] The linkage drawing and editing of the plane ground object and the section ground object can be completely realized by using the OpenGL function in the linkage drawing and editing method of the plane and section drawing based on the OpenGL according to the above embodiments of the application.
[0048] Another embodiment of the application further provides a linkage drawing and editing system of plane and section drawing based on OpenGL, comprising:
[0049] The function association module is used to reference the OpenGL graphics library to build a drawing platform, construct the functions of the plane ground object and the section ground object, and associate the functions of the plane ground object and the section ground object by using the unique ID.
[0050] The drawing module is used to add the mouse single-click response event OglControl_LeftMouseButtonDown to draw the plane ground object, draw the plane ground object by using the OpenGL drawing function OnDraw, calculate the position of the section ground object and draw the section ground object at the same time of drawing the plane ground object, associate the plane ground object and the section ground object in the background by using the ID, and store in the array.
[0051] The highlight display module is used to add the response event in the OpenGL mouse event OglControl_MouseMove, highlight the associated plane ground object and section ground object at the same time by using the SetHoverFlag function when the mouse moves to a certain plane ground object or a certain section ground object.
[0052] The attribute acquisition module is configured to, when a certain planar feature or cross-section feature is selected, use a SetSelectedFlag function in OpenGL to simultaneously select the associated planar feature and cross-section feature, and simultaneously display the attributes of the planar feature and cross-section feature in an attribute table.
[0053] The editing module is configured to, when editing the attribute value of a certain planar feature or cross-section feature, simultaneously edit the associated planar feature and cross-section feature, and use an OnDraw function to display the result in real time.
[0054] An electronic device includes a memory storing at least one instruction, and a processor executing the instruction stored in the memory to implement the OpenGL-based planar cross-section feature linkage drawing and editing method.
[0055] A computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the OpenGL-based planar cross-section feature linkage drawing and editing method.
[0056] For example, the instruction stored in the memory can be divided into one or more modules / units, which are stored in a computer readable storage medium and executed by the processor to complete the OpenGL-based planar cross-section feature linkage drawing and editing method. The one or more modules / units can be a series of computer readable instruction segments capable of completing a specific function, which are used to describe the execution process of the computer program in the server.
[0057] The electronic device can be a smart phone, a notebook, a palm computer, a cloud server, and other computing devices. The electronic device can include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the electronic device can further include more or less components, or combine certain components, or different components, for example, the electronic device can further include an input / output device, a network access device, a bus, etc.
[0058] The processor can be a central processing unit (CPU), and can also be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.
[0059] The memory can be an internal storage unit of the server, such as a hard disk or a memory of the server. The memory can also be an external storage device of the server, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory can also include both the internal storage unit and the external storage device of the server. The memory is used to store the computer readable instructions and other programs and data required by the server. The memory can also be used to temporarily store data that has been output or will be output.
[0060] It should be noted that the information interaction and execution process between the above module units are based on the same concept as the method embodiments, and the specific functions and technical effects brought by them can be referred to the method embodiment part, which will not be repeated here.
[0061] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is taken as an example for illustration, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit or module in the embodiment can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software functional unit. In addition, the specific names of each functional unit or module are only for easy distinction, and do not limit the protection scope of the present application. The specific working process of the unit or module in the system can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
[0062] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware, and the computer program can be stored in a computer readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned various method embodiments can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms. The computer readable medium at least includes any entity or device capable of carrying the computer program code to the photographing device / terminal equipment, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium. For example, U disk, mobile hard disk, magnetic disk or optical disk, etc.
[0063] In the above embodiments, the description of each embodiment has its own focus, and the parts not described or recorded in a certain embodiment can be referred to the relevant description of other embodiments.
[0064] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A method for OpenGL-based flat section diagram linkage drawing and editing, characterized in that, It comprises the following steps: The OpenGL graphics library is cited to build a drawing platform, functions of planar and cross-section features are constructed, and the functions of planar and cross-section features are associated by using unique identification ID; The planar feature is drawn by adding a mouse single-click response event OglControl_LeftMouseButtonDown, the planar feature is drawn by using the OpenGL drawing function OnDraw, the position of the cross-section feature is calculated and the cross-section feature is drawn at the same time, the planar feature and the cross-section feature are associated in the background by using ID, and the planar feature and the cross-section feature are kept in an array; The response event is added in the OpenGL mouse event OglControl_MouseMove, when the mouse moves to a planar feature or a cross-section feature, the associated planar feature and cross-section feature are highlighted at the same time by using the SetHoverFlag function; When a planar feature or a cross-section feature is selected, the associated planar feature and cross-section feature are selected at the same time by using the SetSelectedFlag function in the OpenGL, and the attributes of the planar and cross-section features are simultaneously given in the attribute table; When the attribute value of a planar feature or a cross-section feature is edited, the associated planar feature and cross-section feature are edited at the same time, and the result is displayed in real time by using the OnDraw function.
2. The OpenGL-based profile linkage drawing and editing method according to claim 1, wherein, In the step of associating the functions of planar and cross-section features by using unique identification ID, one planar feature can be associated with multiple cross-sections, but one cross-section feature can only be associated with one planar feature.
3. The OpenGL-based profile linkage drawing and editing method according to claim 1, wherein, In the step of associating the functions of planar and cross-section features by using unique identification ID, an ID generator is constructed to generate unique ID, when a planar feature is deleted, the corresponding cross-section feature is deleted, and the ID number is deleted in the ID array.
4. The OpenGL-based profile linkage drawing and editing method according to claim 1, wherein, When the planar feature or the cross-section feature is drawn by using the OpenGL drawing function OnDraw, the rubber band line method of the OpenGL is used to draw linear features, and the head and tail points are closed when drawing surface features.
5. The OpenGL-based profile linkage drawing and editing method according to claim 1, wherein, In the step of adding the response event in the OpenGL mouse event OglControl_MouseMove, when the mouse moves to a planar feature or a cross-section feature, the associated planar feature and cross-section feature are highlighted at the same time by using the SetHoverFlag function, when the mouse moves on the screen, the coordinate position of the mouse is picked up in real time, whether the mouse is on the planar or the cross-section is judged according to the coordinate position of the mouse, the corresponding feature is queried in the feature, the associated feature is found according to the ID, and the associated planar feature and cross-section feature are highlighted at the same time.
6. The OpenGL-based profile linkage drawing and editing method according to claim 1, wherein, When the mouse moves to a planar feature, the threshold value of object selection is set for accuracy control, and the threshold value is controlled within the centimeter accuracy.
7. The OpenGL-based profile linkage drawing and editing method according to claim 6, wherein, When the linkage drawing and editing are performed, the block operation is performed according to the mileage of the planar feature, and the associated feature is selected according to the threshold value.
8. An OpenGL-based cross-section linkage drawing and editing system, characterized in that, It comprises: A function association module is configured to cite an OpenGL graphics library to build a drawing platform, construct functions of planar and cross-section features, and associate the functions of the planar and cross-section features by using a unique identification ID; A drawing module is configured to add a mouse single-click response event OglControl_LeftMouseButtonDown to draw the planar features, draw the planar features by using an OpenGL drawing function OnDraw, calculate the positions of the cross-section features and draw the cross-section features while drawing the planar features, and associate the planar features and the cross-section features in the background by using the ID and store the planar features and the cross-section features in an array; A highlight display module is configured to add a response event in an OpenGL mouse event OglControl_MouseMove, highlight the associated planar features and cross-section features at the same time by using a SetHoverFlag function when the mouse moves to a certain planar feature or a certain cross-section feature; An attribute acquisition module is configured to select a certain planar feature or cross-section feature, select the associated planar features and cross-section features at the same time by using a SetSelectedFlag function in the OpenGL, and simultaneously give the attributes of the planar and cross-section features in an attribute table; An editing module is configured to edit the attribute values of a certain planar feature or cross-section feature, edit the associated planar features and cross-section features at the same time, and display the results in real time by using an OnDraw function.
9. An electronic device, comprising: It comprises: a memory storing at least one instruction; and a processor executing the instruction stored in the memory to realize the method for drawing and editing planar and cross-section features based on OpenGL as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to realize the method for drawing and editing planar and cross-section features based on OpenGL as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Railway line horizontal and vertical real-time linkage design method
CN109918803A
Three-dimensional component modeling and construction drawing mutual linkage editing method
CN110929311A