Park three-dimensional map drawing method, computer equipment and computer program product
The method addresses high cost and complexity in park 3D map creation by transforming CAD data into accurate 3D maps using classification rules and coordinate transformation, ensuring comprehensive park coverage and visualization.
Patent Information
- Application Number
- CN202510438523.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2025-07-15
AI Technical Summary
The existing three-dimensional map drawing method of the park has problems such as difficulty in getting started and the large volume of the modeling result affects performance. It is difficult to fully cover the geographical location of the park within the two-dimensional map data, and the terrain structure is incomplete, making it difficult to meet the visualization needs.
By determining the preset rules, extracting the original coordinate information of the park object from the CAD file, establishing a two-dimensional plane coordinate system, obtaining transformation relationships, processing the original coordinate information, determining the target center point, creating a three-dimensional object and adjusting the material object, generating drawing results one by one, and forming a three-dimensional map.
The technical threshold for three-dimensional map drawing is lowered, and the rapid and accurate three-dimensional map drawing of the park is realized, covering the internal geographical location fully, ensuring the integrity of the terrain structure, and meeting the visualization needs.
Smart Images

Figure CN120318445A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer technology, and particularly relates to a method for drawing a three-dimensional map of a park, a computer device, and a computer program product. Background Art
[0002] A three-dimensional map of a park is a map in three-dimensional form that shows industrial parks, industrial complexes, etc. within a small area, and contains information such as buildings, terrain, roads, green belts, etc. This kind of map is usually made through professional three-dimensional modeling software or by combining two-dimensional map data and three-dimensional features of objects. However, the existing methods for drawing three-dimensional maps of parks have the following defects:
[0003] First, using the existing method of making three-dimensional modeling software to draw a three-dimensional map of a park can display the park in detail, but it is difficult to get started, and the volume of the modeling result is large, which affects the product performance;
[0004] Second, the two-dimensional map data combination technology: the production cost is low and the performance is good, but it is difficult to comprehensively cover the geographical locations inside the park, the terrain structure is incomplete, and it is difficult to meet the visualization requirements. Summary of the Invention
[0005] Embodiments of this application provide a method for drawing a three-dimensional map of a park, a computer device, and a computer program product, which can solve the technical problems of high production cost and great difficulty in making three-dimensional maps of parks at present.
[0006] In a first aspect, embodiments of this application provide a method for drawing a three-dimensional map of a park, and the method includes:
[0007] Determine a preset rule, where the preset rule represents a classification rule for n types of park objects, and n is a positive integer;
[0008] Extract the original coordinate information of each type of park object from the CAD file according to the preset rule, and store the extracted original coordinate information in the original object dataset corresponding to the type. The original object dataset is constructed based on the preset rule;
[0009] Establish a two-dimensional plane coordinate system, determine the drawing information and actual map information of the CAD file, and obtain a conversion relationship based on the drawing information of the CAD file, the two-dimensional plane coordinate system, and the actual map information;
[0010] Process the original coordinate information in the original object dataset based on the conversion relationship to obtain a target object dataset containing target coordinate information. The target coordinate information represents that each type of park object in the CAD file is applicable to the two-dimensional plane coordinate system;
[0011] Determine the target center point from the target object dataset according to a preset method;
[0012] Create an empty 3D object in the constructed 3D scene as the root node of the map model, and adjust the 3D object according to the target center point so that the 3D object M corresponds to the actual geographical location;
[0013] Create a corresponding material object for each type of target object dataset;
[0014] Traverse the target object dataset of the type corresponding to the material object based on the material object, and generate rendering results for each type of park object respectively;
[0015] Add the rendering results of each type to the 3D object respectively to obtain the target 3D object, and output the target 3D object to form the target park 3D map.
[0016] In some embodiments, the types of the park objects at least include building object types, road object types, background object types, and specific location object types;
[0017] The target dataset of the original coordinate information at least includes a building dataset, a road dataset, a background dataset, and a specific location dataset.
[0018] In some embodiments, the drawing information of the CAD file includes the scale dimension information of the CAD drawing and the direction information of the CAD drawing;
[0019] The obtaining of the conversion relationship based on the drawing information of the CAD file, the two-dimensional plane coordinate system, and the actual map information includes:
[0020] Compare whether the direction information of the CAD drawing is consistent with the direction information of the two-dimensional plane coordinate system;
[0021] In the case where the direction information of the CAD drawing is inconsistent with the direction information of the two-dimensional plane coordinate system, calculate the rotation angle to be rotated of the CAD drawing, and the rotation angle to be rotated represents the rotation angle that makes the direction information of the CAD drawing consistent with the two-dimensional plane coordinate system;
[0022] Determine the conversion relationship based on the rotation angle to be rotated, the scale dimension information of the CAD drawing, and the actual map information.
[0023] In some embodiments, the processing of the original coordinate information in the original object dataset based on the conversion relationship to obtain a target object dataset including target coordinate information includes:
[0024] Scale the original coordinate information according to the scale dimension information of the CAD drawing to obtain the scaled coordinates;
[0025] In the case where the direction information of the CAD drawing is inconsistent with the direction information of the two-dimensional plane coordinate system, rotate the scaled coordinates according to the rotation angle to be obtained, and obtain the rotated coordinates;
[0026] Select a reference point coordinate from the rotated coordinates, and combine the actual map information to determine the actual position reference coordinate corresponding to the reference point coordinate to obtain the coordinate offset requirement;
[0027] Perform an offset process on the rotated coordinates according to the coordinate offset requirement, so that the rotated coordinates are converted into target coordinate information, and a target object data set including the target coordinate information is obtained.
[0028] In some embodiments, the determining the target center point from the target object data set according to a preset method includes:
[0029] Determine the maximum two-dimensional coordinate and the minimum two-dimensional coordinate from the target object data set, and calculate the target center point based on the maximum two-dimensional coordinate and the minimum two-dimensional coordinate.
[0030] In some embodiments, before the step of creating an empty three-dimensional object in the constructed three-dimensional scene as the root node of the map model and adjusting the three-dimensional object according to the target center point so that the three-dimensional object corresponds to the actual geographical location, the method further includes:
[0031] Construct a three-dimensional scene, where the three-dimensional scene includes scene objects and a virtual camera; wherein, the scene objects are used to organize and render three-dimensional objects; the virtual camera is used to present the three-dimensional objects in the scene objects, and the virtual camera is set within a preset position range of the target center point.
[0032] In some embodiments, in the case where the direction information of the CAD drawing is consistent with the direction information of the two-dimensional plane coordinate system, calculate the rotation angle to be obtained by the following method:
[0033] Select a CAD reference point coordinate from the drawing information of the CAD file;
[0034] Combine the projection coordinate system to obtain the actual position coordinate mapped by the reference point coordinate;
[0035] Calculate a first reference angle composed of the CAD reference point coordinates, and calculate a second reference angle composed of the actual position coordinates;
[0036] Calculate the side vector of the first reference angle and calculate the side vector of the second reference angle;
[0037] Calculate the dot product between the side vector of the first reference angle and the side vector of the second reference angle;
[0038] Calculate the first modulus length of the side vector of the first reference angle and calculate the second modulus length of the side vector of the second reference angle;
[0039] Based on the dot product, the first modulus length, and the second modulus length, calculate the included angle between the side vector of the first reference angle and the side vector of the second reference angle, and use the included angle as the angle to be rotated.
[0040] In some embodiments, the traversing the target object dataset corresponding to the material object based on the material object and generating a rendering result for each type of park object respectively includes:
[0041] Traverse the target object dataset corresponding to the material object based on the material object, and read the two-dimensional coordinate set, height attribute, and elevation attribute of each record.
[0042] Create a three-dimensional object corresponding to the material object according to the two-dimensional coordinate set, the height attribute, and the elevation attribute;
[0043] Render the three-dimensional object according to the material object to generate a rendering result corresponding to the material object type.
[0044] In a second aspect, the present application also provides a computer device. The device includes: a memory, a processor, and a drawing program of the park three-dimensional map stored on the memory and executable on the processor. The drawing program of the park three-dimensional map is configured to implement the steps of the method for drawing the park three-dimensional map as described in the first aspect.
[0045] In a third aspect, the present application also provides a computer program product. The computer program product stores a drawing program of the park three-dimensional map. When the drawing program of the park three-dimensional map is executed by a processor, it implements the steps of the method for drawing the park three-dimensional map as described in the first aspect.
[0046] The beneficial effects of the present application are as follows: The method for drawing the park three-dimensional map provided by the present invention reduces the technical threshold for drawing the three-dimensional map. Without the need to use complex three-dimensional modeling software and GIS software, it can also quickly and accurately draw the corresponding park three-dimensional map content, achieving full coverage of the internal geographical locations of the park, ensuring the integrity of the terrain structure presentation, and further meeting the visualization requirements of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for description in the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0048] Figure 1 It is a schematic flowchart of the method for drawing the three-dimensional map of the park provided by the embodiment of the present invention;
[0049] Figure 2 It is a schematic flowchart of another embodiment of the method for drawing the three-dimensional map of the park provided by the present invention;
[0050] Figure 3 It is a schematic flowchart of yet another embodiment of the method for drawing the three-dimensional map of the park provided by the present invention;
[0051] Figure 4 It is a schematic flowchart of still another embodiment of the method for drawing the three-dimensional map of the park provided by the present invention;
[0052] Figure 5 It is a schematic diagram of the structure of the computer device provided by the embodiment of the present application. Detailed implementation manners
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above drawings are intended to cover non-exclusive inclusion.
[0054] It should be understood that when used in the specification and claims of this application, the term "including" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0055] It should also be understood that the term "and / or" used in the specification and claims of this application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0056] In the description of the embodiments of this application, the term "plurality" means two or more (including two), unless otherwise specifically defined.
[0057] In addition, in the description of the specification and the appended claims of the present application, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be construed as indicating or implying relative importance.
[0058] The reference to "one embodiment" or "some embodiments" etc. described in the specification of the present application means that a specific feature, structure or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, the statements "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "comprising", "including", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0059] The inventors of the present application have noticed that with the advancement of smart cities and the improvement of the national informatization construction level in recent years, regional management has become more and more refined. In some management platforms such as industrial parks, university campuses, communities, factories, etc., the visualization application of the three-dimensional map of the park has also emerged one after another.
[0060] The three-dimensional map of the park usually refers to the map in three-dimensional form within a specific small range such as an industrial park or an industrial park, and the displayed content will include buildings, surface terrain, roads, green belts, annotation information, etc. The three-dimensional map of the park can usually be made through professional three-dimensional modeling software, or drawn by combining two-dimensional map data with the three-dimensional stereo characteristics of some objects in the park.
[0061] However, the three-dimensional modeling software has a high entry threshold and the volume of the modeling result is large, which has a great impact on the product performance in actual applications. For the three-dimensional map of the park through two-dimensional map data, the production cost is lower and the performance is also quite good.
[0062] At present, map manufacturers using existing technologies have also successively launched products of three-dimensional maps produced based on two-dimensional map data. However, the geographical locations inside the park are relatively hidden, and it is difficult for the maps of existing technology map merchants to cover comprehensively, and the internal terrain structure of the park is not presented completely enough to meet the visualization requirements; in addition, the map presentation styles of traditional map merchants are relatively fixed and difficult to customize. During the construction or design process of the park, corresponding CAD design drawings will be generated, which contain very detailed location information of buildings, roads, landscape belts, supporting facilities, etc. However, these drawings are generally two-dimensional line drawings without three-dimensional effects and require specific software to view, and it is difficult to integrate them into the management system of the park as a visualization map.
[0063] To solve the above technical problems, the present application proposes a technical solution for a method, device, computer device, and computer product for drawing a three-dimensional map of a park; in order to illustrate the technical solution proposed in the embodiments of the present application, the following will be described through specific embodiments.
[0064] Please refer to Figure 1 , which is a schematic flowchart of a method for drawing a three-dimensional map of a park provided in the first embodiment of the present application. The drawing method mainly includes steps S1 to S9:
[0065] Step S1: Determine a preset rule, where the preset rule represents a classification rule for n types of park objects;
[0066] In a specific implementation, in this embodiment, an original object data set of each type of park object will be constructed in advance based on the preset rule. The types of park objects at least include building object types, road object types, background object types, and POI (Point of Interest, representing a specific location or position on the map) specific location object types; among them, each type of park object type at least has a height attribute and an elevation attribute;
[0067] It should be noted that the height attribute represents the height of the object itself, and its height is based on the ground as the reference datum; while the elevation attribute represents the altitude, and its height is based on the sea level as the reference datum. In addition, the specific location object type may also include description information (such as a name attribute).
[0068] Step S2: Extract the original coordinate information of each type of park object from the CAD file according to the preset rule, and store the extracted original coordinate information in the original object data set corresponding to the type to obtain a target data set containing the original coordinate information;
[0069] Specifically, the target data set containing the original coordinate information obtained in this embodiment at least includes a building data set, a road data set, a background data set, and a POI specific location data set;
[0070] The classification and data structure of the two-dimensional map data in this embodiment are subdivided, which helps to give corresponding processing solutions for each type of data in the subsequent steps, and can quickly and accurately draw the corresponding map content.
[0071] Step S3: Establish a two-dimensional plane coordinate system, determine the drawing information of the CAD file, and obtain a conversion relationship based on the drawing information of the CAD file and the two-dimensional plane coordinate system;
[0072] Specifically, in this embodiment, a two-dimensional plane coordinate system XOY is established. Among them, the positive direction of the X-axis is horizontally to the right, the positive direction of the Y-axis is horizontally upward, and the unit is meter. The positive direction of the Y-axis represents the true north direction;
[0073] It should be noted that the drawing information of the CAD file in this embodiment includes the scale dimension information S of the CAD drawing and the direction information of the CAD drawing;
[0074] Among them, the step of obtaining the conversion relationship based on the drawing information of the CAD file and the two-dimensional plane coordinate system in this embodiment further includes:
[0075] Compare whether the direction information of the CAD drawing is consistent with the direction information of the two-dimensional plane coordinate system XOY (in this embodiment, the north direction of looking at the drawing). If not, calculate the rotation angle θ to be rotated of the CAD drawing. The rotation angle θ to be rotated represents the rotation angle that makes the direction information of the CAD drawing consistent with the two-dimensional plane coordinate system XOY;
[0076] Finally, determine the conversion relationship based on the rotation angle θ to be rotated and the scale dimension information S of the CAD drawing.
[0077] Step S4: Process the original coordinate information in the original object dataset based on the conversion relationship to obtain a target object dataset containing target coordinate information. The target coordinate information represents that each type of park object in the CAD file is applicable to the two-dimensional plane coordinate system;
[0078] It can be understood that for the technical solution of converting the original coordinate information into the target coordinate information according to the conversion relationship in this embodiment, please refer to Figure 2 , first execute sub-step S41 to scale the original coordinate information according to the scale dimension information S of the CAD drawing to obtain the scaled coordinates;
[0079] In a specific implementation, scale the original coordinate information in the original object dataset according to the scale dimension information S to obtain a new dataset containing the scaled coordinates. The specific algorithm can include the following solutions:
[0080] Traverse the coordinates of all the original object datasets and calculate the scaled coordinates of each coordinate point; assume that the coordinate of each coordinate point is P(x, y), and the scaled P1(x, y), then: P1(x, y) = P(x / S, y / S).
[0081] Further, if the direction information of the CAD drawing is inconsistent with the two-dimensional plane coordinate system XOY (i.e., the θ value is not 0), then perform sub-step S42 to rotate each original coordinate information in the target object dataset by the rotation angle θ to obtain the rotated coordinates. The specific algorithm can include the following scheme:
[0082] Traverse all the coordinates in the new dataset containing the scaled coordinates, and rotate the line connecting the coordinate origin (0, 0) and the point P(x, y) with the coordinate origin as the center point to obtain the rotated target coordinate information P1(x, y). Then: P1(x, y) = P(x·cos(θ) - y·sin(θ), x·sin(θ) + y·cos(θ)).
[0083] In addition, if the direction information of the CAD drawing is consistent with the two-dimensional plane coordinate system XOY, then there is no need to calculate the rotation angle θ.
[0084] Further, after obtaining the dataset containing the rotated coordinates, perform sub-step S431 to select a reference point coordinate S1(x1, y1) from the rotated coordinates, and determine the corresponding actual position reference coordinate S2(x2, y2) of the reference point coordinate S1(x1, y1) based on the actual map information (and in combination with the projection coordinate system) to obtain the coordinate offset requirement. The specific algorithm can include the following scheme: ox = x2 - x1; oy = y2 - y1;
[0085] Where, ox is the offset of the coordinate point on the X-axis, and oy is the offset of the coordinate point on the Y-axis.
[0086] Perform sub-step S432 to perform an offset process on the rotated coordinates according to the coordinate offset requirement, so that the rotated coordinates are converted into target coordinate information, and a target object dataset containing the target coordinate information is obtained. The specific algorithm can include the following scheme:
[0087] Offset all the coordinates in the dataset containing the rotated coordinates to obtain the offset target object dataset. The specific algorithm is as follows:
[0088] Traverse all the coordinates of the target dataset. Assume that the coordinate of each point is P(x, y), and the offset coordinate is P1. Then: P1(x, y) = P(x + ox, y + oy);
[0089] In this embodiment, by calculating the coordinate offset and performing the offset process, it is to ensure that the coordinates in the CAD drawing can be accurately mapped to the actual map coordinates, so as to generate an accurate three-dimensional map. And the target coordinate information (three-dimensional map coordinates) generated in this embodiment is a general coordinate and can be used in combination with positioning systems such as GPS and Beidou.
[0090] Step S5: Determine a target center point from the target object dataset in a preset manner;
[0091] In a specific implementation, the preset manner in this embodiment may be to determine the maximum two-dimensional coordinates and the minimum two-dimensional coordinates from the target object dataset, and calculate the target center point (center.x, center.y) based on the maximum two-dimensional coordinates and the minimum two-dimensional coordinates. center.x represents the x-axis coordinate of the target center point, and center.y represents the y-axis coordinate of the target center point.
[0092] Step S6: Create an empty three-dimensional object M in the constructed three-dimensional scene as the root node of the map model, and adjust the three-dimensional object M according to the target center point so that the three-dimensional object M corresponds to the actual geographical location;
[0093] In a specific implementation, this embodiment may pre-use the ThreeJS three-dimensional development framework to create a three-dimensional scene; ThreeJS is an open-source JavaScript library for creating and displaying 3D graphics in a browser; the three-dimensional scene created using the ThreeJS three-dimensional development framework needs to include a scene object Scene and a virtual camera Camera object. The position of the virtual camera is set within a preset position range of the target center point (center.x, center.y), that is, the position of the virtual camera is set near the target center point;
[0094] It can be understood that the scene object Scene in the embodiment of this application is a container in three-dimensional space for storing all 3D objects, light sources, and cameras that need to be rendered. It is the basis for constructing a three-dimensional scene, and the three-dimensional objects are organized and rendered through the scene object Scene;
[0095] The virtual camera Camera defines the viewing angle of the observer and determines which parts of the scene object Scene will be rendered onto the display screen of the computer device. The three-dimensional objects in the scene object Scene are presented through the virtual camera Camera so that the user can observe the three-dimensional objects; setting the position of the camera near the target center point can ensure that the central area of the scene object Scene is clearly presented to the user. Such a design helps the user better understand and perceive the layout and structure of the entire park. And placing the virtual camera Camera near the target center point can also optimize the visual effect, enabling all parts of the scene to be properly displayed and avoiding problems such as unclear display or distortion of some areas caused by an overly biased viewing angle.
[0096] Furthermore, in this embodiment, the three-dimensional object M can be adjusted in the following ways:
[0097] 1) Rotate the three-dimensional object M counterclockwise by 90° around the X-axis;
[0098] 2) Translate the three-dimensional object M along the X-axis by a distance of -center.x;
[0099] 3) Translate the three-dimensional object M along the Y-axis by a distance of -center.y.
[0100] Step S7: Create a corresponding material object for each type of target object dataset;
[0101] In a specific implementation, for the building object type in this embodiment, a building material object is created, and the gloss, color, etc. of the material are configured;
[0102] For the road object type, a road material object is created, and the gloss, color, etc. of the material are configured;
[0103] For the background object type, according to the value of the category type attribute in the data, a separate material is created for each type value;
[0104] For the data of the POI specific location type, according to the value of the type attribute in the data, a separate material is created for each type value.
[0105] Step S8: Traverse the target object dataset of the type corresponding to the material object based on the material object, and generate rendering results for each type of park object traversed respectively;
[0106] Specifically, referring to Figure 3 , this embodiment performs the following sub-steps S81 to S83 to perform map rendering on each type of park object:
[0107] Sub-step S81, traverse the target object dataset of the type corresponding to the material object based on the material object, and read the two-dimensional coordinate set, height attribute, and elevation attribute of each record.
[0108] Sub-step S82, create a three-dimensional object of the type corresponding to the material object according to the two-dimensional coordinate set, the height attribute, and the elevation attribute;
[0109] Sub-step S83, render the three-dimensional object according to the material object to generate a rendering result of the type corresponding to the material object.
[0110] Through the above sub-steps S81 to S83, this embodiment can accurately read and process two-dimensional data sets, select appropriate materials for rendering, and finely adjust and optimize the position and appearance of three-dimensional objects, and can successfully draw elements such as the ground background, roads, and buildings in the park into a realistic three-dimensional map effect.
[0111] In a specific implementation, this embodiment uses the interface functions of the encapsulated three-dimensional development framework (this embodiment takes the use of the ThreeJS API as the interface function of the three-dimensional development framework as an example). Based on the material objects created in step S7, it traverses the background data set, road data set, building data set, and POI data set respectively, and creates and renders three-dimensional solid objects or text / icons according to the two-dimensional coordinate set, height attribute, type, and material of the data, draws the ground, roads, buildings, and POIs, and adds the drawing results to the empty three-dimensional object M:
[0112] For example, 1) for drawing the background data set, this embodiment first uses the Javascript language to traverse the background data set and read the two-dimensional coordinate set, type (type attribute), height (high attribute), and elevation (elevation attribute) of each record;
[0113] Then, according to the two-dimensional coordinate set of the data and the height data, a three-dimensional solid object is created. The corresponding material is obtained according to the type of the data, and the three-dimensional solid object is rendered to draw the ground and other ground backgrounds.
[0114] Furthermore, the three-dimensional solid object is moved in the vertical direction according to the elevation value. If the type value is background, the elevation is 0 and no movement is required; finally, the drawing results of each record are added to the empty three-dimensional object M.
[0115] 2) For drawing the road data set, this embodiment first uses the Javascript language to traverse the background data set and read the two-dimensional coordinate set, type (type attribute), and height (high attribute) of each record. Then, according to the two-dimensional coordinates of the data and the height data, a three-dimensional solid object is created. The three-dimensional solid object is rendered according to the road material to draw the road. The drawing results of each record are added to the empty three-dimensional object M.
[0116] 3) For drawing the building data set, this embodiment can use the Javascript language to traverse the building data set and read the two-dimensional coordinate set, type (type attribute), and height (high attribute) of each record. Then, according to the two-dimensional coordinate set of the data and the height data, a three-dimensional solid object is created. The three-dimensional solid object is rendered according to the building material to draw the building; finally, the drawing results of each record are added to the empty three-dimensional object M.
[0117] 4) Corresponding to draw the POI specific location dataset. In this embodiment, the Javascript language is used to traverse the building dataset, read the two-dimensional coordinates, type (type attribute), height (high attribute), and elevation (elevation attribute) of each record. Then, judge the type attribute. When the value is label, combine the name attribute value and draw the two-dimensional coordinates as text; when the type is icon, draw the two-dimensional coordinates as an icon; then, according to the elevation attribute, move the text or icon in the vertical direction; finally, add the shape generated by each record to the empty three-dimensional object M.
[0118] Step S9: Add the drawing results of each type to the three-dimensional object M respectively to obtain the target three-dimensional object, and output the target three-dimensional object to form the target campus three-dimensional map.
[0119] The beneficial effect of this embodiment is that: through the technical solutions of the above steps S1 to S9, on the basis of reducing the technical threshold for drawing a three-dimensional map and not requiring the use of complex three-dimensional modeling software and GIS software, it is also possible to quickly and accurately draw the corresponding campus three-dimensional map content, realizing the full coverage of the internal geographical location of the campus, ensuring the integrity of the terrain structure presentation, and further meeting the visualization needs of users.
[0120] In some embodiments, refer to Figure 4 In the case of whether the direction information of the CAD drawing is consistent with the direction information of the two-dimensional plane coordinate system XOY, the following method can be used to calculate the rotation angle θ to be rotated:
[0121] Sub-step S31: Select the CAD reference point coordinates from the drawing information of the CAD file;
[0122] In a specific implementation, three CAD reference point coordinates are selected from the CAD drawing, denoted as G1, G2, and G3. The coordinates are G1(x1, y1), G2(x2, y2), and G3(x3, y3) respectively.
[0123] Sub-step S32: Combine the projection-based coordinate system to obtain the actual position coordinates mapped by the reference point coordinates;
[0124] In a specific implementation, determine the actual position coordinates mapped by the three reference point coordinates, denoted as T1, T2, and T3. The coordinates are T1(x′1, y′1), T2(x′2, y′2), and T3(x′3, y′3) respectively. Among them, T1 corresponds to G1, T2 corresponds to G2, and T3 corresponds to G3. And the on-site position coordinates of the embodiments of the present application are preferably the coordinates obtained under the projection-based coordinate system.
[0125] Sub-step S33: Calculate the first reference angle formed by the CAD reference point coordinates, and calculate the second reference angle formed by the actual position coordinates;
[0126] The first reference angle formed by the connection lines of three points G1, G2, and G3 is A(G1, G2, G3). The second reference angle formed by the connection lines of three points T1, T2, and T3 is A1(T1, T2, T3);
[0127] Sub-step S34: Calculate the side vector of the first reference angle, and calculate the side vector of the second reference angle;
[0128] Calculate the vector of one side of the first reference angle A(G1, G2, G3) (referred to as the side vector of the first reference angle), and the vector of the corresponding side of the second reference angle A1(T1, T2, T3) (referred to as the side vector of the second reference angle). Taking the G1G2 side of the first reference angle A(G1, G2, G3) as an example:
[0129] For the G1G2 side, the side vector VG1 of the first reference angle is VG1 = (x1 - x2, y1 - y2);
[0130] For T1T2, the side vector VT1 of the second reference angle is VT1 = (x′1 - x′2, y′1 - y′2).
[0131] Sub-step S34 in the embodiment of the present application is for calculating the included angle between two vectors through the dot product and modulus length of the vectors subsequently, so as to determine the rotation angle θ to be rotated of the CAD drawing.
[0132] Sub-step S35: Calculate the dot product between the side vector of the first reference angle and the side vector of the second reference angle. The specific calculation method can be:
[0133] Calculate the dot product of two vectors VG1·VT1 = (x1 - x2)(x′1 - x′2) + (y2 - y1)(y′1 - y′2).
[0134] Sub-step S36: Calculate the first modulus length |VG1| of the side vector of the first reference angle, and calculate the second modulus length |VT1| of the side vector of the second reference angle. The specific calculation method can be:
[0135]
[0136] Sub-step S37: Based on the dot product, the first modulus length, and the second modulus length, calculate the included angle θ between the side vector VG1 of the first reference angle and the side vector VT1 of the second reference angle. (When the included angle θ is not 0), take the included angle θ as the rotation angle θ to be rotated. The specific calculation method can be:
[0137] θ = arccos(VG1·VT1 / |VG1|·|VT1|);
[0138] Wherein, when the included angle θ is zero, it means that the north direction of the CAD drawing is consistent with the north direction of the XOY coordinate system.
[0139] Through the above sub-steps S31 to S37 in the embodiments of the present application, the rotation angle θ to be rotated of the CAD drawing can be accurately calculated, providing a basis for subsequently converting the coordinate data in the CAD drawing to the correct direction and drawing an accurate three-dimensional map model.
[0140] Furthermore, the embodiments of the present invention provide a computer device, such as Figure 5 As shown, the computer device in the embodiments of the present application can be, but is not limited to, various computers, laptops, smartphones, and tablets. In specific applications, a drafting person can operate the computer device to execute the method for drawing a three-dimensional map of a park provided in the embodiments of the present application. The electronic device may include: a processor 01, a memory 02, and a program for drawing a three-dimensional map of a park stored in the memory and executable on the processor. When the processor executes the program for drawing a three-dimensional map of a park, it implements the steps in the embodiments of the method for drawing a three-dimensional map of a park in the present application.
[0141] Those skilled in the art can understand that Figure 5 merely examples of computer devices are given, which do not constitute a limitation on computer devices and may include more or fewer components than shown, or combine certain components, or different components.
[0142] The processor may be a central processing unit (CPU), and this processor 01 may also be other general-purpose processors, graphics processing units (GPUs), digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0143] The memory may be the internal storage unit described above in some embodiments, such as the hard disk or memory of a computer device. The memory may also be an external storage device of the computer device in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the computer device.
[0144] In addition, an embodiment of the present application further provides a storage medium. The storage medium is a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0145] In addition, an embodiment of the present application further provides a computer program product. The computer program product stores a program for drawing a three-dimensional map of a park. When the program for drawing the three-dimensional map of the park is executed by a processor, all steps of the above-mentioned method for drawing a three-dimensional map of the park can be implemented.
[0146] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For parts not detailed or recorded in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
[0147] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the 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 various embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for drawing a three-dimensional map of a park, characterized in that, The method includes: Determine a preset rule, where the preset rule represents a classification rule for n types of park objects, and n is a positive integer; Extract the original coordinate information of each type of park object from the CAD file according to the preset rule, and store the extracted original coordinate information in the original object dataset corresponding to the type. The original object dataset is constructed based on the preset rule; Establish a two-dimensional plane coordinate system, determine the drawing information and actual map information of the CAD file, and obtain a conversion relationship based on the drawing information of the CAD file, the two-dimensional plane coordinate system, and the actual map information; Process the original coordinate information in the original object dataset based on the conversion relationship to obtain a target object dataset containing target coordinate information, where the target coordinate information represents making each type of park object in the CAD file applicable to the two-dimensional plane coordinate system; Determine a target center point from the target object dataset according to a preset method; Create an empty three-dimensional object in the constructed three-dimensional scene as the root node of the map model, and adjust the three-dimensional object according to the target center point so that the three-dimensional object M corresponds to the actual geographical location; Create a corresponding material object for each target object dataset; Traverse the target object dataset corresponding to the material object based on the material object, and generate rendering results for each type of park object respectively; Add the rendering results of each type to the three-dimensional object respectively to obtain the target three-dimensional object, and output the target three-dimensional object to form a target park three-dimensional map.
2. The method according to claim 1, characterized in that, The types of the park objects at least include building object types, road object types, background object types, and specific location object types; The target dataset of the original coordinate information at least includes a building dataset, a road dataset, a background dataset, and a specific location dataset.
3. The method according to claim 1, characterized in that, The drawing information of the CAD file includes the scale size information of the CAD drawing and the direction information of the CAD drawing; The obtaining of the conversion relationship based on the drawing information of the CAD file, the two-dimensional plane coordinate system, and the actual map information includes: Compare whether the direction information of the CAD drawing is consistent with the direction information of the two-dimensional plane coordinate system; In the case where the direction information of the CAD drawing is inconsistent with the direction information of the two-dimensional plane coordinate system, calculate the rotation angle to be rotated of the CAD drawing, where the rotation angle to be rotated represents the rotation angle that makes the direction information of the CAD drawing consistent with the two-dimensional plane coordinate system; Determine the conversion relationship based on the rotation angle to be rotated, the scale size information of the CAD drawing, and the actual map information.
4. The method according to claim 3, wherein The processing of the original coordinate information in the original object dataset based on the conversion relationship to obtain a target object dataset containing target coordinate information includes: Perform scaling processing on the original coordinate information according to the scale size information of the CAD drawing to obtain the scaled coordinates; In the case where the direction information of the CAD drawing is inconsistent with the direction information of the two-dimensional plane coordinate system, rotate the scaled coordinates according to the rotation angle to be determined, so as to obtain rotated coordinates; Select a reference point coordinate from the rotated coordinates, and combine the actual map information to determine the actual position reference coordinate corresponding to the reference point coordinate, so as to obtain the coordinate offset requirement; Perform an offset process on the rotated coordinates according to the coordinate offset requirement, so that the rotated coordinates are converted into target coordinate information, and a target object data set including the target coordinate information is obtained.
5. The method according to any one of claims 1 to 4, characterized in that, The determining the target center point from the target object data set according to a preset method includes: Determine the maximum two-dimensional coordinate and the minimum two-dimensional coordinate from the target object data set, and calculate the target center point based on the maximum two-dimensional coordinate and the minimum two-dimensional coordinate.
6. The method according to claim 5, wherein Before the step of creating an empty three-dimensional object as the root node of the map model in the constructed three-dimensional scene and adjusting the three-dimensional object according to the target center point so that the three-dimensional object corresponds to the actual geographical location, the method further includes: Construct a three-dimensional scene, where the three-dimensional scene includes scene objects and a virtual camera; wherein, the scene objects are used to organize and render three-dimensional objects; the virtual camera is used to present the three-dimensional objects in the scene objects, and the virtual camera is set within a preset position range of the target center point.
7. The method according to claim 3 or 4, characterized in that, In the case where the direction information of the CAD drawing is consistent with the direction information of the two-dimensional plane coordinate system, calculate the rotation angle to be determined through the following method: Select CAD reference point coordinates from the drawing information of the CAD file; Combine the projection coordinate system to obtain the actual position coordinates mapped by the reference point coordinates; Calculate a first reference angle formed by the CAD reference point coordinates, and calculate a second reference angle formed by the actual position coordinates; Calculate the side vector of the first reference angle, and calculate the side vector of the second reference angle; Calculate the dot product between the side vector of the first reference angle and the side vector of the second reference angle; Calculate the first modulus length of the side vector of the first reference angle, and calculate the second modulus length of the side vector of the second reference angle; Based on the dot product, the first modulus length and the second modulus length, calculate the included angle between the side vector of the first reference angle and the side vector of the second reference angle, and use the included angle as the rotation angle to be determined.
8. The method according to any one of claims 1 to 4, characterized in that, The traversing the target object data set corresponding to the material object based on the material object and respectively generating a rendering result for each type of park object includes: Traverse the target object data set corresponding to the material object based on the material object, and read the two-dimensional coordinate set, height attribute, and elevation attribute of each record; Create a three-dimensional object corresponding to the type of the material object according to the two-dimensional coordinate set, the height attribute, and the elevation attribute; Render the three-dimensional object according to the material object to generate a rendering result corresponding to the type of the material object.
9. A computer device, characterized in that, The device includes: a memory, a processor, and a program for drawing a three-dimensional map of the park stored on the memory and executable on the processor, the program for drawing the three-dimensional map of the park being configured to implement the steps of the method for drawing a three-dimensional map of the park according to any one of claims 1 to 8.
10. A computer program product, characterized in that, The computer program product stores a program for drawing a three-dimensional map of the park, and when the program for drawing the three-dimensional map of the park is executed by a processor, it implements the steps of the method for drawing a three-dimensional map of the park according to any one of claims 1 to 8.