Two-dimensional and three-dimensional linkage drawing method and two-dimensional and three-dimensional linkage drawing system
By establishing the coordinate mapping relationship between two-dimensional and three-dimensional viewports in the surveying and mapping diagram, synchronous drawing of two-dimensional drawing is achieved, solving the problems of insufficient spatial perception and visual error of three-dimensional measurements in the traditional surveying and mapping diagram, and improving the accuracy of surveying and mapping diagrams.
Patent Information
- Application Number
- CN202411944293.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-11
AI Technical Summary
Traditional surveying and mapping mainly relies on two-dimensional plan views, lacking three-dimensional spatial perception, resulting in inadvertent drawings and easy visual errors when directly measured in three-dimensional model views.
By obtaining geographic data, loading it into the geographic information graphing software, creating two-dimensional and three-dimensional viewports, and establishing a coordinate mapping relationship between two-dimensional and three-dimensional viewports. Then, after picking up point coordinates in the three-dimensional viewport, the two-dimensional object entity is drawn in the two-dimensional viewport based on the coordinate mapping relationship, and the three-dimensional object entity is drawn in the three-dimensional viewport synchronously.
The synchronous drawing of two- and three-dimensional dimensions is realized, which improves the accuracy of surveying and mapping, makes the drawn land objects more in line with the characteristics of the landform, and avoids insufficient spatial perception of two-dimensional drawing and visual errors of three-dimensional measurements.
Smart Images

Figure CN119810238A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of surveying and mapping, and in particular to a two-dimensional and three-dimensional linkage drawing method and a two-dimensional and three-dimensional linkage drawing system. Background Art
[0002] At present, the traditional surveying and mapping industry mainly produces two-dimensional plane maps, which can provide accurate information on landforms and geomorphology. In the actual production process, the map is generally drawn by importing feature point files into Southmap geographic information mapping software, and then the corresponding landform information is drawn by comparing pictures or recording information. However, the two-dimensional plane map lacks the overall three-dimensional spatial perception, and drawing only in two-dimensional images is not intuitive enough. Although the current three-dimensional visualization technology can bring great convenience to drawing, it is easy to produce visual errors when picking positions when implementing direct measurement in the three-dimensional model view.
[0003] Therefore, the complementary combination of two-dimensional and three-dimensional information is particularly important for mapping in the surveying and mapping industry. Currently, there is an urgent need for a linkage drawing solution from two-dimensional to three-dimensional models to improve the accuracy of surveying and mapping. Summary of the invention
[0004] The present invention provides a two-dimensional and three-dimensional linkage drawing method and a two-dimensional and three-dimensional linkage drawing system to solve the above technical problems and effectively improve the accuracy of surveying and mapping.
[0005] In order to solve the above technical problems, the present invention provides a two-dimensional and three-dimensional linkage drawing method, comprising:
[0006] Obtain feature data and load the feature data into a preset geographic information mapping software to create a two-dimensional viewport;
[0007] Loading the three-dimensional data of the object in the preset geographic information mapping software based on the object data to create a three-dimensional viewport;
[0008] Establish the coordinate mapping relationship between the 2D viewport and the 3D viewport;
[0009] After setting the coordinate synchronization of the 2D viewport and the 3D viewport, obtain the coordinates of the point picked in the 3D viewport, draw the 2D object entity in the 2D viewport based on the point coordinates and the coordinate mapping relationship, obtain the point coordinate set of the 2D object entity, and synchronously draw the 3D object entity in the 3D view based on the point coordinate set and the coordinate mapping relationship.
[0010] The beneficial effects of the present invention are:
[0011] Compared with the existing surveying and mapping industry drawings, the two-dimensional plane drawings lack overall three-dimensional spatial perception, and drawing only in two-dimensional images is not intuitive enough. When direct measurement is implemented in the three-dimensional model view, visual errors are easily generated when picking positions. After setting the synchronization of the two-dimensional viewport and the three-dimensional viewport coordinates, the present invention obtains the point coordinates picked up in the three-dimensional viewport, draws the two-dimensional land object entity in the two-dimensional viewport based on the point coordinates and the coordinate mapping relationship, obtains the point coordinate set of the two-dimensional land object entity, and synchronously draws the three-dimensional land object entity in the three-dimensional view based on the point coordinate set and the coordinate mapping relationship. Therefore, the present invention can determine the land object information to be drawn according to the land object entity in the three-dimensional viewport, thereby accurately obtaining the point coordinates corresponding to the land object entity, and realizing the two-dimensional and three-dimensional synchronous drawing of the land object entity based on the accurately obtained point coordinates, which effectively improves the accuracy of surveying and mapping and makes the drawn land object entity more in line with the landform characteristics.
[0012] As a preferred solution, the method of loading the three-dimensional data of the ground object in the preset geographic information mapping software based on the ground object data to create a three-dimensional viewport includes:
[0013] Based on the object data, the object three-dimensional data path is read in the preset geographic information mapping software to load the object three-dimensional data;
[0014] Based on the feature data, obtain all entity IDs;
[0015] Based on all entity IDs, a node 3D coordinate set of each entity is obtained in the 3D data of the ground object;
[0016] Based on the node 3D coordinate set of each entity, the corresponding initial 3D ground object entities are drawn in the 3D viewport to complete the creation of the 3D viewport.
[0017] This preferred solution reads the three-dimensional data path of the ground object based on the ground object data, so that the corresponding three-dimensional data of the ground object can be quickly and accurately located, the loading of the three-dimensional data of the ground object can be completed, and the three-dimensional viewport can be created.
[0018] As a preferred solution, the three-dimensional data of the ground object is three-dimensional point cloud data.
[0019] Compared with the existing three-dimensional data files of objects provided by traditional measurement results such as RTK, this preferred solution uses point cloud data as the three-dimensional data of objects. Compared with the three-dimensional data provided by RTK, the data in the point cloud data is denser, and denser three-dimensional data can reflect more and more comprehensive actual object information. Therefore, using three-dimensional point cloud data as the three-dimensional data of objects enables this solution to subsequently pick up point coordinates that more accurately reflect the object information, thereby improving the accuracy of the two- and three-dimensional linkage drawing of the object entity, and obtaining a topographic map that can better reflect the real landform.
[0020] As a preferred solution, the method of obtaining the coordinates of a point picked up in a three-dimensional viewport, drawing a two-dimensional object entity in a two-dimensional viewport based on the point coordinates and the coordinate mapping relationship, obtaining a point coordinate set of the two-dimensional object entity, and synchronously drawing the three-dimensional object entity in a three-dimensional view based on the point coordinate set and the coordinate mapping relationship includes:
[0021] Get the coordinates of the point picked in the 3D viewport;
[0022] Convert point coordinates into two-dimensional coordinates based on coordinate mapping relationship;
[0023] Pass the two-dimensional coordinates to the preset two-dimensional drawing algorithm to call the preset two-dimensional drawing algorithm to draw the corresponding nodes of the two-dimensional object entity in the two-dimensional viewport based on the two-dimensional coordinates, and store the two-dimensional coordinates in the point coordinate set;
[0024] Based on the reactor mechanism, after determining that the preset two-dimensional drawing algorithm obtains the two-dimensional coordinates, the two-dimensional coordinates corresponding to the nodes corresponding to the two-dimensional object entity are converted into three-dimensional coordinates based on the coordinate mapping relationship, so as to call the preset three-dimensional drawing algorithm to synchronously draw the corresponding nodes of the three-dimensional object entity in the three-dimensional viewport based on the three-dimensional coordinates.
[0025] This preferred solution converts the coordinates of the point picked up in the three-dimensional viewport into two-dimensional coordinates based on the coordinate mapping relationship, calls the preset two-dimensional drawing algorithm to draw the corresponding nodes of the two-dimensional object entity in the two-dimensional viewport based on the two-dimensional coordinates, and then based on the reactor mechanism, after determining that the preset two-dimensional drawing algorithm has obtained the two-dimensional coordinates, obtains the three-dimensional coordinates corresponding to the corresponding nodes of the two-dimensional object entity, so as to call the preset three-dimensional drawing algorithm to synchronously draw the corresponding nodes of the three-dimensional object entity in the three-dimensional viewport based on the three-dimensional coordinates, so that when drawing a point in the two-dimensional viewport, the corresponding point is synchronously drawn in the three-dimensional viewport, thereby achieving a two- and three-dimensional linkage drawing effect.
[0026] As a preferred solution, the step of converting point coordinates into two-dimensional coordinates based on a coordinate mapping relationship includes:
[0027] Based on the coordinate mapping relationship, the point coordinates are converted into world coordinates using a first preset coordinate conversion function;
[0028] The world coordinates are converted into two-dimensional coordinates through a second preset coordinate conversion function.
[0029] This preferred solution converts three-dimensional point coordinates into two-dimensional coordinates through a first preset coordinate conversion function and a second preset coordinate conversion function, and can realize coordinate conversion in different coordinate systems of different dimensions, thereby facilitating the preset two-dimensional drawing algorithm and the preset three-dimensional drawing algorithm to quickly and accurately draw the terrain entities in the corresponding dimension based on the coordinates in the corresponding dimension.
[0030] As a preferred solution, the two-dimensional and three-dimensional linkage drawing method further includes:
[0031] When drawing a two-dimensional object entity, a character message input by the user is obtained, and the preset two-dimensional drawing algorithm and the preset three-dimensional drawing algorithm are called to synchronously process the drawn two-dimensional object entity and three-dimensional object entity in the two-dimensional viewport and the three-dimensional viewport respectively according to the character message.
[0032] This preferred solution can achieve a 2D and 3D synchronous drawing effect of the object entity by calling a preset 2D drawing algorithm and a preset 3D drawing algorithm to synchronously process the drawn 2D object entity and 3D object entity based on the character message input by the user.
[0033] As a preferred solution, the two-dimensional and three-dimensional linkage drawing method further includes:
[0034] When the character message is an end mark character, the three-dimensional object entity is redrawn in the three-dimensional viewport according to the point coordinate set and the coordinate mapping relationship to update the three-dimensional object entity in the three-dimensional viewport;
[0035] After the 3D object entities in the 3D viewport are updated, the drawing ends.
[0036] This preferred solution redraws the three-dimensional object entity in the three-dimensional viewport according to the point coordinate set and the coordinate mapping relationship when the character message is the end mark character, so as to update the three-dimensional object entity in the three-dimensional viewport, thereby synchronizing the three-dimensional object entity with the two-dimensional object entity modified by other methods, and ensuring that the three-dimensional object entity finally drawn is synchronized with the two-dimensional object entity.
[0037] As a preferred solution, the setting of the 2D viewport and 3D viewport coordinate synchronization includes:
[0038] When you double-click or scroll the mouse in the 3D viewport, you can get the 3D data range and center point of the object.
[0039] Zoom the 3D data range and center point of the object into the 3D viewport range;
[0040] The feature data range and center point of the two-dimensional viewport are set according to the scaled three-dimensional feature data range and center point to complete the synchronous setting of the coordinates of the two-dimensional viewport and the three-dimensional viewport.
[0041] This preferred solution achieves synchronization of the coordinates of the two-dimensional viewport and the three-dimensional viewport by scaling the three-dimensional data range and center point of the feature to the range of the three-dimensional viewport when the mouse is double-clicked or the scroll wheel is slid in the three-dimensional viewport, and setting the feature data range and center point of the two-dimensional viewport according to the scaled three-dimensional data range and center point of the feature, thereby providing the prerequisite for the subsequent presentation of the synchronized drawing effect of two- and three-dimensional feature entities.
[0042] As a preferred solution, before acquiring the point coordinates picked up in the 3D viewport, drawing the 2D object entity in the 2D viewport based on the point coordinates and the coordinate mapping relationship, acquiring the point coordinate set of the 2D object entity, and synchronously drawing the 3D object entity in the 3D view based on the point coordinate set and the coordinate mapping relationship, the method further includes:
[0043] Sets the 2D viewport and 3D viewport transformation synchronization.
[0044] This preferred solution also sets up synchronization of transformation of the 2D viewport and the 3D viewport before drawing the 2D object entity and the 3D object entity, so that after the 2D object entity and the 3D object entity are drawn, they can be conveniently compared by synchronously transforming the 2D viewport and the 3D viewport.
[0045] In order to solve the above technical problems, the present invention also provides a 2D and 3D linkage drawing system, including: a 2D viewport creation module, a 3D viewport creation module, a mapping relationship establishment module and a 2D and 3D synchronous drawing module;
[0046] The two-dimensional viewport creation module is used to obtain the object data and load the object data into the preset geographic information mapping software to create a two-dimensional viewport;
[0047] The three-dimensional viewport creation module is used to load the three-dimensional data of the ground object in the preset geographic information mapping software based on the ground object data to create a three-dimensional viewport;
[0048] The mapping relationship establishment module is used to establish a coordinate mapping relationship between a two-dimensional viewport and a three-dimensional viewport;
[0049] The two-dimensional and three-dimensional synchronous drawing module is used to obtain the coordinates of the point picked up in the three-dimensional viewport after setting the coordinate synchronization of the two-dimensional viewport and the three-dimensional viewport, draw the two-dimensional land object entity in the two-dimensional viewport based on the point coordinates and the coordinate mapping relationship, obtain the point coordinate set of the two-dimensional land object entity, and synchronously draw the three-dimensional land object entity in the three-dimensional view based on the point coordinate set and the coordinate mapping relationship. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 : A flow chart of an embodiment of a two- and three-dimensional linkage drawing method provided by the present invention;
[0051] Figure 2 : A structural schematic diagram of an embodiment of a two- and three-dimensional linked drawing system provided by the present invention. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] Embodiment 1
[0054] The present invention provides a two-dimensional and three-dimensional linkage drawing method and a two-dimensional and three-dimensional linkage drawing system to solve the technical problems existing in the above-mentioned background technology and effectively improve the accuracy of surveying and mapping.
[0055] Please refer to the following Figure 1 , which is a flow chart of an embodiment of a two- and three-dimensional linkage drawing method provided in an embodiment of the present invention.
[0056] like Figure 1 As shown, the two-dimensional and three-dimensional linkage drawing method includes steps 101 to 104, specifically:
[0057] Step 101: Acquire feature data, and load the feature data into a preset geographic information mapping software to create a two-dimensional viewport;
[0058] Step 102: Loading the three-dimensional data of the ground object in a preset geographic information mapping software based on the ground object data to create a three-dimensional viewport;
[0059] Step 103: Establishing a coordinate mapping relationship between the two-dimensional viewport and the three-dimensional viewport;
[0060] Step 104: After setting the coordinate synchronization of the 2D viewport and the 3D viewport, obtain the coordinates of the point picked in the 3D viewport, draw the 2D object entity in the 2D viewport based on the point coordinates and the coordinate mapping relationship, obtain the point coordinate set of the 2D object entity, and synchronously draw the 3D object entity in the 3D view based on the point coordinate set and the coordinate mapping relationship.
[0061] In this embodiment, the preset geographic information mapping software can be but is not limited to SouthMap geographic information mapping software, which is a geographic information mapping software based on platforms such as Autocad; further, the preset geographic information mapping software is combined with an osg (Open Scene Graph) open source three-dimensional engine library, and the osg open source three-dimensional engine library contains a variety of osg development library functions, so that the present invention can realize the two- and three-dimensional linkage drawing method by combining the osg open source three-dimensional engine library and the cad secondary development library.
[0062] In this embodiment, the feature data may be, but is not limited to, data in dwg format.
[0063] In this embodiment, after the three-dimensional viewport is created, the three-dimensional viewport and the two-dimensional viewport are equally divided into the view interface of the preset geographic information mapping software, that is, the size of the two-dimensional viewport and the three-dimensional viewport are set to be the same. By setting the three-dimensional viewport and the two-dimensional viewport to equally divide the view interface of the preset geographic information mapping software, it is convenient for users to compare and view the two and three-dimensional viewports, and clearly view the synchronous drawing process of the ground object entities in the two and three-dimensional viewports.
[0064] In this embodiment, the coordinates of the picking point are clicked in the 3D viewport by the mouse.
[0065] Furthermore, in step 102, the three-dimensional data of the ground object is loaded into the preset geographic information mapping software based on the ground object data to create a three-dimensional viewport, including:
[0066] Based on the object data, the object three-dimensional data path is read in the preset geographic information mapping software to load the object three-dimensional data;
[0067] Based on the feature data, obtain all entity IDs;
[0068] Based on all entity IDs, a node 3D coordinate set of each entity is obtained in the 3D data of the ground object;
[0069] Based on the node 3D coordinate set of each entity, the corresponding initial 3D ground object entities are drawn in the 3D viewport to complete the creation of the 3D viewport.
[0070] In one embodiment, the three-dimensional data path of the feature is read in a preset geographic information mapping software based on the feature data to load the three-dimensional data of the feature. Specifically, when the feature data is in dwg format, the three-dimensional data path of the feature corresponding to the external extension attribute (Xrecord) in the dwg feature data is read to load and open the three-dimensional data of the feature.
[0071] In this embodiment, after loading the three-dimensional data of the features, the initial creation of the three-dimensional viewport can be achieved. However, at this time, the feature data is displayed in the two-dimensional viewport, but the three-dimensional data of the features is not yet displayed in the three-dimensional viewport. Then, by executing the synchronization command in the preset geographic information mapping software such as SouthMap geographic information mapping software, all the entity IDs in the two-dimensional viewport dwg feature data can be obtained. Relying on the external expansion attribute of the dwg feature data, the corresponding Z value point set can be obtained according to the unique attribute of the entity ID, and the node three-dimensional coordinate set corresponding to each entity can be obtained according to the point order, wherein the point order is the node order of the entity in the dwg feature data, such as the node order of the polyline, and the subsequent drawing of the initial three-dimensional feature entity is drawn according to the point order; thereafter, the initial three-dimensional feature entity is drawn in the three-dimensional viewport according to the node three-dimensional coordinate set to complete the creation of the three-dimensional viewport. Therefore, by executing the synchronization command, the initial three-dimensional feature entity can be drawn in the three-dimensional viewport based on the feature data in the two-dimensional viewport, and the refresh of the three-dimensional viewport display data is realized, so that the three-dimensional viewport displays the three-dimensional feature data.
[0072] In this embodiment, data is stored through a map structure, in which the entity ID is the key and the initial three-dimensional object entity is the value.
[0073] The present invention reads the path of ground object three-dimensional data based on ground object data, so as to quickly and accurately locate the corresponding ground object three-dimensional data, complete the loading of ground object three-dimensional data, and realize the creation of three-dimensional viewport.
[0074] Furthermore, the three-dimensional data of the ground object is three-dimensional point cloud data.
[0075] In this embodiment, the data type of the three-dimensional point cloud data may be, but is not limited to, a las type, an osgb type, and an xml type.
[0076] In this embodiment, based on the OSG open source 3D engine and the CAD secondary development library, the present invention can quickly import and display 3D point cloud data of existing commonly used data types into the preset geographic information mapping software, and is no longer limited to the 3D point coordinate files provided by traditional measurement results such as RTK.
[0077] Compared with the existing three-dimensional data files of objects provided by traditional measurement results such as RTK, the present invention adopts point cloud data as the three-dimensional data of objects. Compared with the three-dimensional data provided by RTK, the data in the point cloud data is denser, and the denser three-dimensional data can reflect more and more comprehensive actual object information. Therefore, the use of three-dimensional point cloud data as the three-dimensional data of objects enables the present invention to pick up point coordinates that more accurately reflect the object information in the subsequent process, thereby improving the accuracy of the two- and three-dimensional linkage drawing of the object entity, and obtaining a topographic map that can better reflect the real landform.
[0078] Further, in step 104, the step of obtaining the point coordinates picked up in the three-dimensional viewport, drawing the two-dimensional object entity in the two-dimensional viewport based on the point coordinates and the coordinate mapping relationship, obtaining the point coordinate set of the two-dimensional object entity, and synchronously drawing the three-dimensional object entity in the three-dimensional view based on the point coordinate set and the coordinate mapping relationship includes:
[0079] Get the coordinates of the point picked in the 3D viewport;
[0080] Convert point coordinates into two-dimensional coordinates based on coordinate mapping relationship;
[0081] Pass the two-dimensional coordinates to the preset two-dimensional drawing algorithm to call the preset two-dimensional drawing algorithm to draw the corresponding nodes of the two-dimensional object entity in the two-dimensional viewport based on the two-dimensional coordinates, and store the two-dimensional coordinates in the point coordinate set;
[0082] Based on the reactor mechanism, after determining that the preset two-dimensional drawing algorithm obtains the two-dimensional coordinates, the two-dimensional coordinates corresponding to the nodes corresponding to the two-dimensional object entity are converted into three-dimensional coordinates based on the coordinate mapping relationship, so as to call the preset three-dimensional drawing algorithm to synchronously draw the corresponding nodes of the three-dimensional object entity in the three-dimensional viewport based on the three-dimensional coordinates.
[0083] In this embodiment, the preset two-dimensional drawing algorithm and the preset three-dimensional drawing algorithm are user-defined functions of the present invention, which realize functions such as drawing ground object entities and modifying entity information, and can dynamically draw or modify two- and three-dimensional ground object entity information according to character messages input by the user.
[0084] In this embodiment, the reactor mechanism is a cad reactor mechanism, which is an implementation of the observer pattern. Under this mechanism, there are event notifiers and event receivers, and the one responsible for receiving events is called a reactor. Before the reactor can receive messages from the notifier, it must be explicitly added to the notifier's reactor list (the list of notification objects in the observer pattern); among them, common reactor types include document reactors (AcApDocManagerReactor), edit reactors (AcEditorReactor) and database reactors (AcDbDatabaseReactor), which are triggered during document operations, before and after command execution, and database object operations, respectively. In addition, there are context reactors (AcEdInputContextReactor) and mouse reactors.
[0085] In this embodiment, the realization of drawing a two-dimensional object entity in a two-dimensional viewport and synchronously drawing a three-dimensional object entity in a three-dimensional view is based on the response to the object drawing function command (dd command) of a preset geographic information mapping software such as SouthMap geographic information mapping software; specifically, it depends on the editing reactor (AcEditorReactor). After detecting the execution of the object drawing function command, the preset two-dimensional drawing algorithm and the preset three-dimensional drawing algorithm are synchronously started. During the polyline drawing process of the two-dimensional object entity, the preset two-dimensional drawing algorithm waits for the user to click the mouse according to the three-dimensional data of the object in the three-dimensional viewport, picks up the point coordinates of the three-dimensional viewport, and executes the cad command line. The point coordinates are passed to a preset two-dimensional drawing algorithm, wherein the preset two-dimensional drawing algorithm obtains the two-dimensional coordinates obtained by converting the point coordinates based on the coordinate mapping relationship. After obtaining the two-dimensional coordinates, the preset two-dimensional drawing algorithm draws a node of the two-dimensional object entity corresponding to the two-dimensional coordinates in the two-dimensional viewport, and stores the two-dimensional coordinates in a point coordinate set. The preset three-dimensional drawing algorithm learns from a context reactor (AcEdInputContextReactor) that the preset two-dimensional drawing algorithm obtains the two-dimensional coordinates, and then the preset three-dimensional drawing algorithm draws a node corresponding to the three-dimensional object entity in the three-dimensional viewport based on the coordinate mapping relationship and the three-dimensional coordinates obtained by the two-dimensional coordinate conversion.
[0086] In this embodiment, by responding to the function command of drawing objects, the present invention can synchronize the transformation and drawing of the three-dimensional viewport with the two-dimensional viewport, thereby achieving a two-dimensional and three-dimensional linkage drawing effect.
[0087] In one implementation, the preset 3D drawing algorithm is further used to pass the coordinates of the point picked up in the 3D viewport to the preset 2D drawing algorithm.
[0088] The present invention converts the coordinates of a point picked up in a three-dimensional viewport into two-dimensional coordinates based on a coordinate mapping relationship, calls a preset two-dimensional drawing algorithm to draw corresponding nodes of a two-dimensional object entity in the two-dimensional viewport based on the two-dimensional coordinates, and then based on a reactor mechanism, after determining that the preset two-dimensional drawing algorithm obtains the two-dimensional coordinates, obtains the three-dimensional coordinates corresponding to the corresponding nodes of the two-dimensional object entity, so as to call the preset three-dimensional drawing algorithm to synchronously draw the corresponding nodes of the three-dimensional object entity in the three-dimensional viewport based on the three-dimensional coordinates, so that when drawing a point in the two-dimensional viewport, the corresponding point is synchronously drawn in the three-dimensional viewport, thereby achieving a two- and three-dimensional linkage drawing effect with clear drawing ideas.
[0089] Specifically, preset geographic information mapping software, such as SouthMap geographic information mapping software, calls various OSG development library functions in the OSG open source 3D engine library based on the OSG event processing mechanism, wherein the OSG event processing mechanism includes osgGA::GUIEventHandler user interaction events, osgGA::GUIEventAdapter control event types and osgGA::GUIActionAdapter to make requests to the system.
[0090] Furthermore, the step of converting the point coordinates into two-dimensional coordinates based on the coordinate mapping relationship includes:
[0091] Based on the coordinate mapping relationship, the point coordinates are converted into world coordinates using a first preset coordinate conversion function;
[0092] The world coordinates are converted into two-dimensional coordinates through a second preset coordinate conversion function.
[0093] In this embodiment, the OSG open source three-dimensional engine library and the CAD secondary development library have their own corresponding coordinate conversion functions. The OSG coordinate conversion function, such as the first preset coordinate conversion function, can convert three-dimensional screen coordinates into world coordinates. The CAD coordinate conversion function, such as the second preset coordinate conversion function, can convert world coordinates into two-dimensional screen coordinates.
[0094] The present invention realizes the conversion of three-dimensional point coordinates into two-dimensional coordinates through a first preset coordinate conversion function and a second preset coordinate conversion function, and can realize coordinate conversion in different coordinate systems of different dimensions, thereby facilitating the preset two-dimensional drawing algorithm and the preset three-dimensional drawing algorithm to quickly and accurately draw the land object entities in the corresponding dimension based on the coordinates in the corresponding dimension.
[0095] Furthermore, the two-dimensional and three-dimensional linkage drawing method further includes:
[0096] When drawing a two-dimensional object entity, a character message input by the user is obtained, and the preset two-dimensional drawing algorithm and the preset three-dimensional drawing algorithm are called to synchronously process the drawn two-dimensional object entity and three-dimensional object entity in the two-dimensional viewport and the three-dimensional viewport respectively according to the character message.
[0097] In this embodiment, the user can input the required character messages in the cad command line according to the prompt information in the cad command line, such as room edge J / arc Q / change direction H / backward U / close C / close every other point G / capture elevation M / next point, etc. The preset two-dimensional drawing algorithm and the preset three-dimensional drawing algorithm will perform corresponding synchronous processing or drawing on the drawn two-dimensional object entities and three-dimensional object entities in the two-dimensional viewport and three-dimensional viewport respectively according to the character messages.
[0098] The present invention can achieve a two-dimensional and three-dimensional synchronous drawing effect of a land object entity by calling a preset two-dimensional drawing algorithm and a preset three-dimensional drawing algorithm to synchronously process the drawn two-dimensional land object entity and three-dimensional land object entity based on a character message input by a user.
[0099] Furthermore, the two-dimensional and three-dimensional linkage drawing method further includes:
[0100] When the character message is an end mark character, the three-dimensional object entity is redrawn in the three-dimensional viewport according to the point coordinate set and the coordinate mapping relationship to update the three-dimensional object entity in the three-dimensional viewport;
[0101] After the 3D object entities in the 3D viewport are updated, the drawing ends.
[0102] When the character message is an end mark character, the present invention redraws the three-dimensional object entity in the three-dimensional viewport according to the point coordinate set and the coordinate mapping relationship to update the three-dimensional object entity in the three-dimensional viewport, so as to synchronize the three-dimensional object entity with the two-dimensional object entity modified by other methods, wherein the other methods refer to methods that do not modify and update the two-dimensional object entity through character messages and point coordinates, for example, deleting a node in the two-dimensional object entity, so as to ensure that the three-dimensional object entity finally drawn is synchronized with the two-dimensional object entity.
[0103] In this embodiment, the 3D viewport is controlled and operated accordingly through the underlying processing function of the 3D viewport: after the 3D viewport is created, a specific osg development library function (multi-threaded mode) is used to display the 3D data of the objects in the 3D viewport, and a parent class is created in the 3D viewport. The C++ polymorphism mechanism is used, and the parent class inherits the osg event processing mechanism and the cad reactor mechanism at the same time, so that the parent class can simultaneously obtain the 2D and 3D viewport messages and list the various message virtual functions that need to be processed; after the preset geographic information mapping software such as SouthMap geographic information mapping software loads the 3D data of the objects, when no command is executed, a default class inheritance is created Base class, and implement the parent class message function, get mouse messages, and do corresponding processing according to the mouse messages, such as 2D and 3D synchronous rotation; when executing the command, according to the editing reactor (AcEditorReactor), create the corresponding subclass (inheriting the default class) in the 3D viewport, and process the keyboard and mouse messages during the execution of this command. The database reactor (AcDbDatabaseReactor) can monitor the addition, modification, and deletion messages of the entities in this command, and synchronously update the entity information to the 2D and 3D viewports. When the command ends, it jumps back to the default class and continues to wait for new commands to process the terrain data until it ends.
[0104] In one embodiment, after creating the two-dimensional viewport and the three-dimensional viewport, the two-dimensional and three-dimensional linkage drawing method includes:
[0105] S1: Call and execute the command of drawing features;
[0106] S2: Depends on the editing reactor (AcEditorReactor), detects the execution of the function command of drawing features, starts the preset 2D drawing algorithm, and simultaneously starts the preset 3D drawing algorithm;
[0107] S3: The preset 2D drawing algorithm waits for the user to input point coordinates or character messages during the execution of polyline drawing:
[0108] S3.1: When the user picks up point coordinates in the 3D viewport by clicking the mouse according to the 3D data of the ground object, the point coordinates are passed to the preset 2D drawing algorithm through the cad command line, and the point coordinates are transformed into 2D coordinates. After the preset 2D drawing algorithm obtains the 2D coordinates, it draws a point in the 2D viewport based on the 2D coordinates, and stores the 2D coordinates to the point coordinate set; the preset 3D drawing algorithm learns that the preset 2D drawing algorithm obtains the point coordinates according to the context reactor (AcEdInputContextReactor), then the preset 3D drawing algorithm obtains the 3D coordinates obtained based on the 2D coordinate transformation, and synchronously draws the corresponding point in the 3D viewport based on the 3D coordinates; repeat S3;
[0109] S3.2: When the user inputs a character message in the cad command line, the preset 2D drawing algorithm obtains the character message and performs corresponding processing on the drawn 2D object entity, and the preset 3D drawing algorithm obtains the corresponding character message through the preset cad hook function and performs corresponding processing on the 3D object entity drawn in the 3D viewport;
[0110] If the character message is not an end mark character, S3 is repeated; if the character message is an end mark character, the preset two-dimensional drawing algorithm and the preset three-dimensional drawing algorithm each end the polyline drawing process, and the preset three-dimensional drawing algorithm stores the point coordinate set in the extended attribute (Xrecord) of the object data dwg, and draws the corresponding three-dimensional object entity in the three-dimensional viewport based on the point coordinate set;
[0111] S4: The dependent editing reactor (AcEditorReactor) detects that the preset 2D drawing algorithm has ended, and the preset 3D drawing algorithm ends immediately.
[0112] When drawing an entity in a two-dimensional view, the point coordinates transmitted from the three-dimensional viewport will be recorded to obtain a point coordinate set, which will then be presented in real time in the three-dimensional viewport based on the coordinate mapping relationship; and when the position of the two-dimensional object entity changes in the two-dimensional viewport, the corresponding position of the three-dimensional object entity in the three-dimensional viewport will also be updated accordingly. The present invention is based on the synchronous drawing and linkage interaction of the two- and three-dimensional viewports, which greatly enhances the intuitiveness and credibility of surveying and mapping.
[0113] Furthermore, the setting of the coordinate synchronization of the two-dimensional viewport and the three-dimensional viewport includes:
[0114] When you double-click or scroll the mouse in the 3D viewport, you can get the 3D data range and center point of the object.
[0115] Zoom the 3D data range and center point of the object into the 3D viewport range;
[0116] The feature data range and center point of the two-dimensional viewport are set according to the scaled three-dimensional feature data range and center point to complete the synchronous setting of the coordinates of the two-dimensional viewport and the three-dimensional viewport.
[0117] In this embodiment, the 3D data range of the ground object can be obtained through a specific osg function, and the projection mode and viewing angle of the 3D data of the ground object can be set so that the 3D data of the ground object is displayed in the center of the 3D viewport.
[0118] The present invention scales the three-dimensional data range and center point of the object to within the range of the three-dimensional viewport when the mouse is double-clicked or the scroll wheel is slid in the three-dimensional viewport, so that the three-dimensional data of the object is displayed in the center of the three-dimensional viewport, and sets the object data range and center point of the two-dimensional viewport according to the scaled three-dimensional data range and center point of the object, thereby achieving synchronization of the coordinates of the two-dimensional viewport and the three-dimensional viewport, thereby providing a prerequisite for the subsequent presentation of the synchronous drawing effect of two- and three-dimensional object entities.
[0119] In this embodiment, before drawing two-dimensional object entities and three-dimensional object entities, it is necessary to implement linkage message processing of two-dimensional and three-dimensional viewports to obtain the message of the mouse in the three-dimensional viewport. The linkage message processing includes the above-mentioned setting of the coordinate synchronization of the two-dimensional viewport and the three-dimensional viewport, and sending the message when the mouse is clicked in the three-dimensional viewport to the two-dimensional viewport. Among them, the specific implementation process of sending the message when the mouse is clicked in the three-dimensional viewport to the two-dimensional viewport is: when the mouse is clicked (left button) in the three-dimensional viewport, it is determined whether it is currently in the function command of drawing objects. If not, a WM_LBUTTONDOWN message is sent to the two-dimensional viewport. If it is, the point coordinates are sent to the two-dimensional viewport through a special cad function; in addition, it also includes the setting of synchronous movement of the mouse (dual mouse) in the two-dimensional viewport, and its specific implementation process is: when the mouse moves in the three-dimensional viewport, the three-dimensional screen coordinates are converted into world coordinates using the osg coordinate conversion function, and then the world coordinates are converted into two-dimensional screen coordinates through the cad coordinate conversion function, and then the WM_MOUSEMOVE message is sent to the two-dimensional viewport to form the synchronous movement effect of the two-dimensional window mouse (dual mouse).
[0120] The present invention achieves synchronization of coordinates of the two-dimensional viewport and the three-dimensional viewport by scaling the three-dimensional data range and center point of the object to within the three-dimensional viewport range when the mouse is double-clicked or the scroll wheel is slid in the three-dimensional viewport, and setting the object data range and center point of the two-dimensional viewport according to the scaled three-dimensional data range and center point of the object, thereby providing a prerequisite for the subsequent presentation of the synchronous drawing effect of two- and three-dimensional object entities.
[0121] The present invention can provide a prerequisite for the subsequent presentation of the synchronous drawing effect of the two-dimensional and three-dimensional ground object entities by implementing the linkage message processing of the two-dimensional and three-dimensional viewports before drawing the two-dimensional ground object entity and the three-dimensional ground object entity.
[0122] Furthermore, before acquiring the point coordinates picked up in the three-dimensional viewport, drawing the two-dimensional object entity in the two-dimensional viewport based on the point coordinates and the coordinate mapping relationship, acquiring the point coordinate set of the two-dimensional object entity, and synchronously drawing the three-dimensional object entity in the three-dimensional view based on the point coordinate set and the coordinate mapping relationship, it also includes:
[0123] Sets the 2D viewport and 3D viewport transformation synchronization.
[0124] In this embodiment, the transformation synchronization of the 2D viewport and the 3D viewport includes the synchronization of rotation, scaling, etc. of the 2D viewport and the 3D viewport.
[0125] Before drawing the two-dimensional object entity and the three-dimensional object entity, the present invention also sets the synchronization of the transformation of the two-dimensional viewport and the three-dimensional viewport, so that after the two-dimensional object entity and the three-dimensional object entity are drawn, they can be conveniently compared by synchronously transforming the two-dimensional viewport and the three-dimensional viewport.
[0126] Furthermore, the two-dimensional and three-dimensional linkage drawing method further includes: after the two-dimensional object entity and the three-dimensional object entity are drawn, updating the object three-dimensional data path and storing the object three-dimensional data path in the object data.
[0127] In this embodiment, when the feature data is in dwg format, after drawing is completed, the feature three-dimensional data path information can be stored in the current dwg feature data (i.e., in the XRrcord extended attribute) by saving the dwg feature data, so that the corresponding feature three-dimensional data can be quickly located when the dwg feature data is loaded later.
[0128] Correspondingly, the embodiment of the present invention also provides a two-dimensional and three-dimensional linkage drawing system. Figure 2 , which is a structural schematic diagram of an embodiment of a two- and three-dimensional linkage drawing system provided by the present invention.
[0129] like Figure 2As shown, the 2D and 3D linkage drawing system 20 comprises: a 2D viewport creation module 201, a 3D viewport creation module 202, a mapping relationship establishment module 203 and a 2D and 3D synchronous drawing module 204;
[0130] The two-dimensional viewport creation module 201 is used to obtain the object data and load the object data into the preset geographic information mapping software to create a two-dimensional viewport;
[0131] The three-dimensional viewport creation module 202 is used to load the three-dimensional data of the ground object in the preset geographic information mapping software based on the ground object data to create a three-dimensional viewport;
[0132] The mapping relationship establishing module 203 is used to establish a coordinate mapping relationship between a two-dimensional viewport and a three-dimensional viewport;
[0133] The two-dimensional and three-dimensional synchronous drawing module 204 is used to obtain the coordinates of the point picked up in the three-dimensional viewport after setting the coordinate synchronization of the two-dimensional viewport and the three-dimensional viewport, draw the two-dimensional land object entity in the two-dimensional viewport based on the point coordinates and the coordinate mapping relationship, obtain the point coordinate set of the two-dimensional land object entity, and synchronously draw the three-dimensional land object entity in the three-dimensional view based on the point coordinate set and the coordinate mapping relationship.
[0134] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0135] Compared with the existing surveying and mapping industry drawings, the two-dimensional plane drawings lack overall three-dimensional spatial perception, and drawing only in two-dimensional images is not intuitive enough. When direct measurement is implemented in the three-dimensional model view, visual errors are easily generated when picking positions. After setting the synchronization of the two-dimensional viewport and the three-dimensional viewport coordinates, the present invention obtains the point coordinates picked up in the three-dimensional viewport, draws the two-dimensional land object entity in the two-dimensional viewport based on the point coordinates and the coordinate mapping relationship, obtains the point coordinate set of the two-dimensional land object entity, and synchronously draws the three-dimensional land object entity in the three-dimensional view based on the point coordinate set and the coordinate mapping relationship. Therefore, the present invention can determine the land object information to be drawn according to the land object entity in the three-dimensional viewport, thereby accurately obtaining the point coordinates corresponding to the land object entity, and realizing the two-dimensional and three-dimensional synchronous drawing of the land object entity based on the accurately obtained point coordinates, which effectively improves the accuracy of surveying and mapping and makes the drawn land object entity more in line with the landform characteristics.
[0136] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A two-dimensional and three-dimensional linkage drawing method, characterized in that: include: Obtain feature data and load the feature data into a preset geographic information mapping software to create a two-dimensional viewport; Loading the three-dimensional data of the object in the preset geographic information mapping software based on the object data to create a three-dimensional viewport; Establish the coordinate mapping relationship between the 2D viewport and the 3D viewport; After setting the coordinate synchronization of the 2D viewport and the 3D viewport, obtain the coordinates of the point picked in the 3D viewport, draw the 2D object entity in the 2D viewport based on the point coordinates and the coordinate mapping relationship, obtain the point coordinate set of the 2D object entity, and synchronously draw the 3D object entity in the 3D view based on the point coordinate set and the coordinate mapping relationship.
2. A two-dimensional and three-dimensional linkage drawing method as claimed in claim 1, characterized in that: The method of loading the three-dimensional data of the ground object in the preset geographic information mapping software based on the ground object data to create a three-dimensional viewport includes: Based on the object data, the object three-dimensional data path is read in the preset geographic information mapping software to load the object three-dimensional data; Based on the feature data, obtain all entity IDs; Based on all entity IDs, a node 3D coordinate set of each entity is obtained in the 3D data of the ground object; Based on the node 3D coordinate set of each entity, the corresponding initial 3D ground object entities are drawn in the 3D viewport to complete the creation of the 3D viewport.
3. A two-dimensional and three-dimensional linkage drawing method as claimed in claim 1, characterized in that: The three-dimensional data of the ground object is three-dimensional point cloud data.
4. A two-dimensional and three-dimensional linkage drawing method as claimed in claim 1, characterized in that: The method of acquiring the coordinates of a point picked up in a three-dimensional viewport, drawing a two-dimensional object entity in a two-dimensional viewport based on the point coordinates and the coordinate mapping relationship, acquiring a point coordinate set of the two-dimensional object entity, and synchronously drawing the three-dimensional object entity in a three-dimensional view based on the point coordinate set and the coordinate mapping relationship includes: Get the coordinates of the point picked in the 3D viewport; Convert point coordinates into two-dimensional coordinates based on coordinate mapping relationship; Pass the two-dimensional coordinates to the preset two-dimensional drawing algorithm to call the preset two-dimensional drawing algorithm to draw the corresponding nodes of the two-dimensional object entity in the two-dimensional viewport based on the two-dimensional coordinates, and store the two-dimensional coordinates in the point coordinate set; Based on the reactor mechanism, after determining that the preset two-dimensional drawing algorithm obtains the two-dimensional coordinates, the two-dimensional coordinates corresponding to the nodes corresponding to the two-dimensional object entity are converted into three-dimensional coordinates based on the coordinate mapping relationship, so as to call the preset three-dimensional drawing algorithm to synchronously draw the corresponding nodes of the three-dimensional object entity in the three-dimensional viewport based on the three-dimensional coordinates.
5. A two-dimensional and three-dimensional linkage drawing method as claimed in claim 4, characterized in that: The step of converting the point coordinates into two-dimensional coordinates based on the coordinate mapping relationship includes: Based on the coordinate mapping relationship, the point coordinates are converted into world coordinates using a first preset coordinate conversion function; The world coordinates are converted into two-dimensional coordinates through a second preset coordinate conversion function.
6. A two-dimensional and three-dimensional linkage drawing method as claimed in claim 4, characterized in that: Also includes: When drawing a two-dimensional object entity, a character message input by the user is obtained, and the preset two-dimensional drawing algorithm and the preset three-dimensional drawing algorithm are called to synchronously process the drawn two-dimensional object entity and three-dimensional object entity in the two-dimensional viewport and the three-dimensional viewport respectively according to the character message.
7. A two-dimensional and three-dimensional linkage drawing method as claimed in claim 6, characterized in that: Also includes: When the character message is an end mark character, the three-dimensional object entity is redrawn in the three-dimensional viewport according to the point coordinate set and the coordinate mapping relationship to update the three-dimensional object entity in the three-dimensional viewport; After the 3D object entities in the 3D viewport are updated, the drawing ends.
8. The two-dimensional and three-dimensional linkage drawing method according to claim 1, characterized in that: The step of setting the coordinate synchronization of the two-dimensional viewport and the three-dimensional viewport includes: When you double-click or scroll the mouse in the 3D viewport, you can get the 3D data range and center point of the object. Zoom the 3D data range and center point of the object into the 3D viewport range; The feature data range and center point of the two-dimensional viewport are set according to the scaled three-dimensional feature data range and center point to complete the synchronous setting of the coordinates of the two-dimensional viewport and the three-dimensional viewport.
9. A two-dimensional and three-dimensional linkage drawing method as claimed in claim 1, characterized in that: Before acquiring the point coordinates picked up in the 3D viewport, drawing the 2D object entity in the 2D viewport based on the point coordinates and the coordinate mapping relationship, acquiring the point coordinate set of the 2D object entity, and synchronously drawing the 3D object entity in the 3D view based on the point coordinate set and the coordinate mapping relationship, the method further includes: Sets the 2D viewport and 3D viewport transformation synchronization.
10. A two-dimensional and three-dimensional linkage drawing system, characterized in that: include: A 2D viewport creation module, a 3D viewport creation module, a mapping relationship establishment module and a 2D and 3D synchronous drawing module; The two-dimensional viewport creation module is used to obtain the object data and load the object data into the preset geographic information mapping software to create a two-dimensional viewport; The three-dimensional viewport creation module is used to load the three-dimensional data of the ground object in the preset geographic information mapping software based on the ground object data to create a three-dimensional viewport; The mapping relationship establishment module is used to establish a coordinate mapping relationship between a two-dimensional viewport and a three-dimensional viewport; The two-dimensional and three-dimensional synchronous drawing module is used to obtain the coordinates of the point picked up in the three-dimensional viewport after setting the coordinate synchronization of the two-dimensional viewport and the three-dimensional viewport, draw the two-dimensional land object entity in the two-dimensional viewport based on the point coordinates and the coordinate mapping relationship, obtain the point coordinate set of the two-dimensional land object entity, and synchronously draw the three-dimensional land object entity in the three-dimensional view based on the point coordinate set and the coordinate mapping relationship.