Map application development methods, devices, electronic devices, and non-volatile storage media
By parsing the code files of map engine functional modules to generate target files, the map application development process is simplified, solving the problems of complexity and high cost in map software development, improving development efficiency and reducing costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUPCON TECH CO LTD
- Filing Date
- 2022-11-18
- Publication Date
- 2026-04-21
AI Technical Summary
Map software development is technically complex and highly specialized, resulting in low development efficiency and high costs, making it difficult for non-specialized companies to afford.
By obtaining the functional code files of the map engine's functional modules, parsing them into an abstract syntax tree, generating target files in the target format, and encapsulating them into target files for calling, the development process is simplified.
It has improved the efficiency of map application development, reduced development costs, broken down technical barriers, and simplified the development process.
Smart Images

Figure CN116048503B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of geographic information system technology, and more specifically, to a map application development method, apparatus, electronic device, and non-volatile storage medium. Background Technology
[0002] With the continuous development and popularization of GIS (Geographic Information System) technology, electronic maps have become an indispensable part of people's lives. Map applications are increasingly used on web, mobile, and embedded terminal devices. The most common needs in map application development are functions such as using electronic maps for navigation and positioning, and visualizing various data on maps.
[0003] Currently, most related technologies focus on how to build a complete GIS system, while neglecting the complex and specialized map software development technology. Developers face certain technical barriers and high technical thresholds when using it. Upgrading existing projects after deployment often requires significant time and manpower for maintenance, which is unbearable for many companies outside the professional mapping field. The complexity, high specialization, and technical threshold of map software development technology result in problems such as low development efficiency and high development costs.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This application provides a map application development method, apparatus, electronic device, and non-volatile storage medium to at least solve the technical problems of low development efficiency and high development cost of map software caused by the complexity, high professionalism, and technical barriers of current map software development technology.
[0006] According to one aspect of the embodiments of this application, a map application development method is provided, comprising: obtaining functional code files corresponding to each functional module in a map engine, wherein the map engine includes functional modules required for developing a target map application; parsing the functional code files to obtain a first abstract syntax tree, wherein the first abstract syntax tree is used to characterize the code structure in the functional code files; obtaining a target file of a target format based on the first abstract syntax tree, and calling the target file to develop the target map application, wherein the target format is a format supported by the target map application.
[0007] Optionally, each functional module corresponds one-to-one with an abstract syntax tree. Obtaining the target file in the target format based on the abstract syntax tree includes: traversing all first target nodes in the first abstract syntax tree and checking whether each first target node calls other functional modules; if a first target node calls other functional modules, loading the second abstract syntax tree corresponding to the called other functional modules; recursively checking whether a second target node in the second abstract syntax tree calls other functional modules, and if a second target node calls other functional modules, loading the abstract syntax tree corresponding to the called other functional modules, until no target node in the loaded abstract syntax tree calls other functional modules; and generating the target file in the target format based on all loaded abstract syntax trees.
[0008] Optionally, generating a target file in the target format based on all loaded abstract syntax trees includes: determining the target format and target output path based on the configuration file; merging all loaded abstract syntax trees and converting the merged abstract syntax trees into a target file in the target format; and storing the target file in the target output path.
[0009] Optionally, developing a target map application by calling the target file includes: obtaining development instructions from the front-end page; determining the target file corresponding to the development instructions; and calling the target file to develop the target map application.
[0010] Optionally, developing a target map application by calling the target file includes: obtaining target interface parameters based on a reference file, wherein the reference file is used to indicate how to call the target file, and the target interface parameters are the parameters required to call the target file; importing the target file into the development project of the target map application and passing in the target interface parameters for development.
[0011] Optionally, after obtaining the target file in the target format based on the first abstract syntax tree, the process further includes: generating a sample application based on the target file and sending the sample application to the front-end interface for display. The sample application contains all the functional modules corresponding to the target file and is used by the target object for reference when developing the target map application.
[0012] Optionally, developing the target map application by calling the target file further includes: responding to a first editing instruction, importing a first target file, and obtaining the map base map configuration parameters corresponding to the first target file; passing the map base map configuration parameters to the first target file, and calling the first target file to initialize the map base map on the map display interface of the target map application; responding to a second editing instruction, importing a second target file, and obtaining the building model parameters corresponding to the first target file; passing the building model parameters to the second target file, and calling the second target file to create a new building model on the base map; responding to a third editing instruction, importing a third target file, and calling the third target file to register a mouse click event so that the map display interface responds to mouse click operations; responding to a fourth editing instruction, accessing the backend data to the map display interface, and importing a fourth target file; obtaining the map point configuration parameters corresponding to the fourth target file, and, based on the map point configuration parameters and the backend data, calling the fourth target file to render map points for display on the map display interface.
[0013] According to another aspect of the embodiments of this application, a map application development apparatus is also provided, comprising: a code acquisition module, configured to acquire functional code files corresponding to each functional module in a map engine, wherein the map engine includes functional modules required for developing a target map application; a code parsing module, configured to parse the functional code files to obtain a first abstract syntax tree, wherein the first abstract syntax tree is used to characterize the code structure in the functional code files; and a file generation module, configured to obtain a target file of a target format based on the first abstract syntax tree, and call the target file to develop the target map application, wherein the target format is a format supported by the target map application.
[0014] According to another aspect of the embodiments of this application, an electronic device is also provided, the electronic device including a processor, the processor being used to run a program, wherein the program executes a map application development method when running.
[0015] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored computer program, wherein the device where the non-volatile storage medium is located executes a map application development method by running the computer program.
[0016] In this embodiment, the method involves obtaining the functional code files corresponding to each functional module in the map engine, wherein the map engine includes functional modules required for developing the target map application; parsing the functional code files to obtain a first abstract syntax tree, wherein the first abstract syntax tree is used to represent the code structure in the functional code files; obtaining a target file in the target format based on the first abstract syntax tree, and calling the target file to develop the target map application, wherein the target format is a format supported by the target map application. By encapsulating and converting the map software development code, users do not need to pay attention to the internal implementation principles, but only need to pass parameters according to the calling method described in the interface documentation to generate / obtain the desired map elements. This achieves the goal of improving the efficiency of map application development and reducing development costs, thereby solving the technical problems of low development efficiency and high development costs caused by the complexity, high professionalism, and technical barriers of current map software development technology. Attached Figure Description
[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0018] Figure 1 This is a hardware structure block diagram of a computer terminal (or electronic device) for implementing a method for map application development, according to an embodiment of this application.
[0019] Figure 2 This is a schematic diagram of a method flow for developing a map application according to an embodiment of this application;
[0020] Figure 3 This is a schematic diagram of a functional module encapsulation provided according to an embodiment of this application;
[0021] Figure 4a This is a schematic diagram illustrating the effect of initializing a map by calling a target file, according to an embodiment of this application.
[0022] Figure 4b This is a schematic diagram illustrating the effect of calling a target file to initialize a model according to an embodiment of this application;
[0023] Figure 4c This is a schematic diagram illustrating the effect of drawing points by calling a target file according to an embodiment of this application;
[0024] Figure 4d This is a schematic diagram illustrating the effect of drawing lines by calling a target file according to an embodiment of this application;
[0025] Figure 4eThis is a schematic diagram illustrating the effect of drawing a surface by calling a target file according to an embodiment of this application;
[0026] Figure 5 This is a schematic diagram illustrating the effect of generating a base map instance by calling a target file according to an embodiment of this application;
[0027] Figure 6 This is a schematic diagram of the core architecture of a map application development method provided according to an embodiment of this application;
[0028] Figure 7 This is a schematic diagram of a specific scheme of a map application development method provided according to an embodiment of this application;
[0029] Figure 8 This is a schematic diagram of the structure of a map application development device provided according to an embodiment of this application. Detailed Implementation
[0030] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0032] To facilitate a better understanding of the embodiments of this application by those skilled in the art, some technical terms or nouns involved in the embodiments of this application are explained as follows:
[0033] Cesium is an open-source front-end library written in JavaScript and using WebGL to display 3D globes and maps. It can display massive amounts of 3D model data, imagery data, terrain elevation data, vector data, and more. It supports glTF format for 3D models and 3D Tiles format for 3D tile models. Vector data supports GeoJSON and TopoJSON formats. Imagery data supports WMTS, etc. Elevation data supports STK format. It also supports drawing points, lines, and polygons on the map. Functionally, it supports measuring various lengths on the map, flight navigation, and lighting simulation.
[0034] Rollup is a JavaScript module bundler that can compile small pieces of code into large, complex pieces of code. It supports generating code in specified formats through configuration options and currently supports generating IIFE, CommonJS, AMD, UMD, SystemJS, and ESM code formats.
[0035] Most related technologies focus on how to build a complete GIS system, neglecting the complex and specialized map software development technology. Developers face certain technical barriers and high technical thresholds in using map software, resulting in low development efficiency and high development costs. To address this issue, this application provides relevant solutions, which are detailed below.
[0036] According to an embodiment of this application, a method embodiment for developing a map application is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0037] The methods and embodiments provided in this application can be executed on mobile terminals, computer terminals, or similar computing devices. Figure 1 This is a hardware structure block diagram of a computer terminal (or electronic device) for implementing a method for map application development, according to an embodiment of this application. Figure 1As shown, the computer terminal 10 (or electronic device 10) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0038] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or electronic device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0039] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the map application development method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the above-mentioned map application development method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0040] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0041] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10 (or electronic device).
[0042] Under the above operating environment, this application embodiment provides a map application development method. Figure 2 This is a schematic diagram of a method flow for developing a map application according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:
[0043] Step S202: Obtain the function code files corresponding to each function module in the map engine, wherein the map engine includes the function modules required for developing the target map application;
[0044] In some embodiments of this application, the map engine is a software function development library for developing map software functions, which can provide various technologies required for map application development. In this embodiment, the Cesium open-source front-end library is used as an example for illustration.
[0045] In some embodiments of this application, the functional modules in the map engine include at least one of the following: map initialization function, model initialization function, mouse click event, point drawing function, line drawing function, and surface drawing function.
[0046] Figure 3 This is a schematic diagram of a functional module encapsulation provided according to an embodiment of this application, such as... Figure 3As shown, the various functional technologies provided in Cesium (i.e., the aforementioned functional modules) are abstracted and encapsulated to obtain multiple functional code files. These functional code files encapsulate the various functions required for developing map applications provided by the map engine, such as map initialization (including basic configurations such as initializing the sphere, view, and timeline), base map initialization (users only need to pass in specified parameters to generate a map base map), model initialization (supports passing in model files to display on the map), left / right mouse click events (users can obtain all information of the currently clicked object after calling this method), view settings (can set the display of a specified view), view flight (supports flight animation function), camera-related functions (obtaining camera information, view zooming), coordinate-related functions (various coordinate transformation methods, obtaining the coordinates of a specified point), drawing points, drawing lines, drawing surfaces, drawing billboards, creating real-time motion models, and other functions.
[0047] Step S204: Parse the function code file to obtain the first abstract syntax tree, wherein the first abstract syntax tree is used to represent the code structure in the function code file;
[0048] As an optional implementation, parsing the functional code file to obtain the first abstract syntax tree can be achieved using a packaging tool. The packaging tool can compile small pieces of code into large, complex pieces of code and supports generating code in a specified format through configuration options. In this embodiment, the Rollup packaging tool is used as an example for explanation.
[0049] Step S206: Based on the first abstract syntax tree, obtain the target file in the target format, and call the target file to develop the target map application, wherein the target format is the format supported by the target map application.
[0050] In some embodiments of this application, functional modules correspond one-to-one with abstract syntax trees. Obtaining a target file in the target format based on the abstract syntax tree includes the following steps: traversing all first target nodes in the first abstract syntax tree and detecting whether the first target node calls other functional modules; if the first target node calls other functional modules, loading the second abstract syntax tree corresponding to the called other functional modules; recursively detecting whether the second target node in the second abstract syntax tree calls other functional modules, and if the second target node calls other functional modules, loading the abstract syntax tree corresponding to the called other functional modules, until the target node in the loaded abstract syntax tree does not call other functional modules; generating a target file in the target format based on all loaded abstract syntax trees.
[0051] In some embodiments of this application, generating a target file in the target format based on all loaded abstract syntax trees includes the following steps: determining the target format and target output path based on the configuration file; merging all loaded abstract syntax trees and converting the merged abstract syntax trees into a target file in the target format; and storing the target file to the target output path.
[0052] Specifically, by reading the configured entry file (i.e., the aforementioned functional code file), the tool parses and reads the file to generate an abstract syntax tree (i.e., the aforementioned first abstract syntax tree). Based on the specified flags within the abstract syntax tree, it is determined whether the code of other modules needs to be loaded. If so, the code inside the corresponding module is loaded (i.e., the second abstract syntax tree corresponding to the other called functional modules is loaded). This process is repeated until it is no longer necessary to load the code of other modules. The code that needs to be loaded is merged, and unused code is removed. The output file is then sent to the configured file path (i.e., the aforementioned target output path).
[0053] In some embodiments of this application, the target format can be UMD format. UMD format code can be used both on the browser side and on the node.js (server side), which has the advantage of strong compatibility.
[0054] As an optional implementation, after processing each functional module using a packaging tool to obtain the target file, the target file can be deployed to a specified directory on the server. Once deployed, it can be used in multiple system software. The target file can be imported using the script tag in the software development project that needs to use it (equivalent to the target map application mentioned above) to develop map-related functions.
[0055] In some embodiments of this application, calling a target file to develop a target map application includes the following steps: obtaining development instructions from the front-end page; determining the target file corresponding to the development instructions; and calling the target file to develop the target map application.
[0056] To make it easier for developers to call target files for map application development, the following steps are involved: Based on the reference file, obtain the target interface parameters, where the reference file indicates the calling method of the target file, and the target interface parameters are the parameters required to call the target file; import the target file into the development project of the target map application and pass in the target interface parameters for development.
[0057] As an optional implementation, the above reference documents can be generated from the functional code files of each functional module according to the code writing and commenting specifications in the map engine, and are used to explain the calling method of the target file, as well as the classes, attributes and methods in the target file.
[0058] In some embodiments of this application, sample applications are also provided for developers to refer to. After obtaining the target file in the target format based on the first abstract syntax tree, the following steps are also included: generating a sample application based on the target file and sending the sample application to the front-end interface for display. The sample application contains all the functional modules corresponding to the target file. The sample application is used as a reference for the target object when developing the target map application.
[0059] As an optional implementation, the example application described above supports online editing and debugging, which developers can use as a reference when developing target map applications.
[0060] After generating the target files mentioned above, each functional module provides practical functions. Users do not need to concern themselves with the internal implementation details; they only need to follow the parameter passing methods described in the reference documentation to generate / obtain the desired map elements or functions. Below are some commonly used functions as examples. Figure 4a This is a schematic diagram illustrating the effect of initializing a map by calling a target file, according to an embodiment of this application. Figure 4b This is a schematic diagram illustrating the effect of calling a target file to initialize a model according to an embodiment of this application; Figure 4c This is a schematic diagram illustrating the effect of drawing points by calling a target file according to an embodiment of this application; Figure 4d This is a schematic diagram illustrating the effect of drawing lines by calling a target file according to an embodiment of this application; Figure 4e This is a schematic diagram illustrating the effect of drawing a surface by calling a target file according to an embodiment of this application, such as... Figure 4a , 4b As shown in 4c, 4d, and 4e.
[0061] As an optional implementation, developing the target map application by calling the target file further includes the following steps: responding to a first editing instruction, importing a first target file and obtaining the map base map configuration parameters corresponding to the first target file; passing the map base map configuration parameters to the first target file and calling the first target file to initialize the map base map on the map display interface of the target map application; responding to a second editing instruction, importing a second target file and obtaining the building model parameters corresponding to the first target file; passing the building model parameters to the second target file and calling the second target file to create a new building model on the base map; responding to a third editing instruction, importing a third target file and calling the third target file to register a mouse click event so that the map display interface responds to mouse click operations; responding to a fourth editing instruction, accessing the background data to the map display interface and importing a fourth target file; obtaining the map point configuration parameters corresponding to the fourth target file, and based on the map point configuration parameters and the background data, calling the fourth target file to render map points for display on the map display interface.
[0062] The following example illustrates the process of developing a map application by calling a target file.
[0063] Specifically, during system development, source files deployed to the server are introduced. The main program calls the new window.$DK.SupMap(domId) method of the target file to initialize the map. Here, domId is the page rendering container ID, which is used to carry the map display. After initialization, the generated map instance mapInstance is returned.
[0064] Use the map instance to call the initialization basemap method mapInstance.initTdtMap of the target file, pass in the map basemap configuration to be displayed, and complete the basemap initialization in the map display interface of the map application;
[0065] The target file initializes and displays the view by calling the mapInstance.cameraSetView method, which retrieves the view configuration from the configuration file.
[0066] The `mapInstance.createModel` method of the target file is called to initialize the model and display the building model on the map.
[0067] The target file is called to register mouse events using mapInstance.setDefaultMouseEventHandler, so that the map display interface responds to mouse clicks, forming a pattern like... Figure 5 The page shown initially only displays basic map elements, without any business-related functions or data. Subsequently, backend API data is integrated, and map points are added using the pre-defined map method `mapInstance.viewer.entities.add` in the target file. Based on the passed configuration items, the map points are automatically rendered onto the screen. Figure 5 Based on the interface shown, it can respond to mouse clicks and display data corresponding to the clicked location. For example, when the mouse clicks on a building on the map, it can display basic information such as the building's name and function, as well as relevant operational data from the backend, such as the building's current alarm status. When business functions need to manipulate map elements, they can call the map methods of the encapsulated target file. The specific method called depends on the actual needs and business functions.
[0068] The map application development method in steps S202 to S206 of the embodiments of this application will be further described below.
[0069] Figure 6This is a schematic diagram of the core architecture of a map application development method provided according to an embodiment of this application, such as... Figure 6 As shown, Cesium is selected as the 3D map software function development library in this implementation, and map-related functions (i.e., ...) are developed on this basis. Figure 6 The code files for each function in the left-hand box are abstracted and encapsulated. Simultaneously, the code is compiled and compressed using the Rollup packaging tool to generate the final source file lib.js (the target file) that can be deployed to the server. Users can then directly reference the relevant files.
[0070] Figure 7 This is a schematic diagram illustrating a specific scheme of a map application development method provided in an embodiment of this application, such as... Figure 7 As shown, the method includes the following steps:
[0071] Step S702: Configure the environment and encapsulate the functional code in the map engine and place it in the preset input position;
[0072] Specifically, create a new project using the npm command (npm init); install rollup in the project (npm install rollup --save-dev); create a rollup.config.js file (the configuration file mentioned above) to define configuration items, including input files, output files, output file formats, and so on; place the Cesium-based functional code files (the functional code files mentioned above) in any folder, usually in the root directory according to the project directory structure.
[0073] Step S704: The function code file at the preset input location is processed by a packaging tool to generate a target file and stored on the server.
[0074] Specifically, add the Rollup packaging directive to the package.json file to process the functional code files at the preset input locations using a packaging tool; execute npm run build to generate the packaged file, i.e., the target file mentioned above; deploy the packaged file to the specified directory on the server; and use the script tag to import the target file in the software development project (i.e., the target map application mentioned above).
[0075] Through the above steps, a development solution is provided that completely separates map logic from other business logic, ensuring they do not interfere with each other. Various map development technologies are encapsulated in the form of an SDK (Software Development Kit), allowing developers to focus solely on their own business function development without needing to concern themselves with the complex implementation logic within the map functions. This breaks down the technical barriers in GIS system software development, which are characterized by complex development techniques, low development efficiency, and high development costs. It is convenient and easy to use, improving development efficiency while ensuring development quality, and significantly reducing R&D and implementation costs. Furthermore, the target files in this solution can be continuously upgraded with technological advancements, keeping pace with the development of the GIS industry.
[0076] Through the above steps, the map software development code is encapsulated and transformed, so that users do not need to pay attention to the internal implementation principles. They only need to pass parameters according to the calling method described in the interface documentation to generate / obtain the desired map elements. This achieves the goal of improving the efficiency of map application development and reducing development costs. In turn, it solves the technical problems of low development efficiency and high development cost caused by the complexity, high professionalism and technical barriers of current map software development technology.
[0077] According to an embodiment of this application, an embodiment of a map application development apparatus is also provided. Figure 8 This is a schematic diagram of the structure of a map application development device according to an embodiment of this application. Figure 8 As shown, the device includes:
[0078] The code acquisition module 80 is used to acquire the functional code files corresponding to each functional module in the map engine, which includes the functional modules required to develop the target map application.
[0079] The code parsing module 82 is used to parse the functional code file to obtain the first abstract syntax tree, wherein the first abstract syntax tree is used to represent the code structure in the functional code file;
[0080] The file generation module 84 is used to obtain a target file in the target format based on the first abstract syntax tree, and to call the target file to develop a target map application, wherein the target format is a format supported by the target map application.
[0081] It should be noted that the modules in the above-mentioned map application development device can be program modules (such as a set of program instructions to implement a certain function) or hardware modules. For the latter, they can be in the following forms, but are not limited to these: each of the above modules is in the form of a processor, or the functions of each of the above modules are implemented by a processor.
[0082] It should be noted that the map application development device provided in this embodiment can be used to execute... Figure 2 The map application development method shown above is also applicable to the embodiments of this application, and will not be repeated here.
[0083] This application embodiment also provides a non-volatile storage medium, which includes a stored computer program. The device containing the non-volatile storage medium executes the following map application development method by running the computer program: obtaining function code files corresponding to each function module in a map engine, wherein the map engine includes function modules required for developing a target map application; parsing the function code files to obtain a first abstract syntax tree, wherein the first abstract syntax tree is used to characterize the code structure in the function code files; obtaining a target file in a target format based on the first abstract syntax tree, and calling the target file to develop the target map application, wherein the target format is a format supported by the target map application.
[0084] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0085] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0086] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0087] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0088] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0089] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0090] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for developing map applications, characterized in that, include: Obtain the functional code files corresponding to each functional module in the map engine, wherein the map engine includes the functional modules required for developing the target map application; The function code file is parsed to obtain a first abstract syntax tree, wherein the first abstract syntax tree is used to represent the code structure in the function code file; Based on the first abstract syntax tree, a target file in the target format is obtained, and the target file is called to develop the target map application, wherein the target format is a format supported by the target map application; The functional modules correspond one-to-one with the abstract syntax trees (APIs). Obtaining the target file in the target format based on the APIs includes: traversing all first target nodes in the first API and detecting whether each first target node calls other functional modules; if a first target node calls other functional modules, loading the second API corresponding to the called other functional modules; recursively detecting whether a second target node in the second API calls other functional modules, and if so, loading the API corresponding to the called other functional modules, until no target node in the loaded APIs calls other functional modules; and generating the target file in the target format based on all loaded APIs. Developing the target map application by calling the target file further includes: responding to a first editing instruction, importing a first target file, and obtaining map base map configuration parameters corresponding to the first target file; passing the map base map configuration parameters to the first target file, and calling the first target file to initialize the map base map on the map display interface of the target map application; responding to a second editing instruction, importing a second target file, and obtaining building model parameters corresponding to the first target file; passing the building model parameters to the second target file, and calling the second target file to create a new building model on the base map; responding to a third editing instruction, importing a third target file, and calling the third target file to register a mouse click event so that the map display interface responds to mouse click operations; responding to a fourth editing instruction, accessing backend data to the map display interface, and importing a fourth target file; obtaining map point configuration parameters corresponding to the fourth target file, and, based on the map point configuration parameters and the backend data, calling the fourth target file to render map points for display on the map display interface.
2. The map application development method according to claim 1, characterized in that, Based on all the loaded abstract syntax trees, generating the target file in the target format includes: Based on the configuration file, determine the target format and target output path; Merge all the loaded abstract syntax trees and convert the merged abstract syntax trees into the target file of the target format; Store the target file to the target output path.
3. The map application development method according to claim 1, characterized in that, Developing the target map application by calling the target file includes: Obtain development instructions for the front-end page; Identify the target file corresponding to the development instructions, and call the target file to develop the target map application.
4. The map application development method according to claim 3, characterized in that, Developing the target map application by calling the target file includes: According to the reference document, the target interface parameters are obtained, wherein the reference document is used to indicate the calling method of the target file, and the target interface parameters are the parameters required to call the target file; The target file is imported into the development project of the target map application, and the target interface parameters are passed in for development.
5. The map application development method according to claim 1, characterized in that, After obtaining the target file in the target format based on the first abstract syntax tree, the process further includes: Based on the target file, a sample application is generated and sent to the front-end interface for display. The sample application contains all the functional modules corresponding to the target file and is used as a reference for the target object when developing the target map application.
6. A map application development device, characterized in that, include: The code acquisition module is used to acquire the functional code files corresponding to each functional module in the map engine, wherein the map engine includes the functional modules required for developing the target map application; The code parsing module is used to parse the functional code file to obtain a first abstract syntax tree, wherein the first abstract syntax tree is used to represent the code structure in the functional code file; The file generation module is used to obtain a target file in a target format based on the first abstract syntax tree, and to call the target file to develop the target map application, wherein the target format is a format supported by the target map application; The functional modules correspond one-to-one with the abstract syntax trees (APIs). Obtaining the target file in the target format based on the APIs includes: traversing all first target nodes in the first API and detecting whether each first target node calls other functional modules; if a first target node calls other functional modules, loading the second API corresponding to the called other functional modules; recursively detecting whether a second target node in the second API calls other functional modules, and if so, loading the API corresponding to the called other functional modules, until no target node in the loaded APIs calls other functional modules; and generating the target file in the target format based on all loaded APIs. Developing the target map application by calling the target file further includes: responding to a first editing instruction, importing a first target file, and obtaining map base map configuration parameters corresponding to the first target file; passing the map base map configuration parameters to the first target file, and calling the first target file to initialize the map base map on the map display interface of the target map application; responding to a second editing instruction, importing a second target file, and obtaining building model parameters corresponding to the first target file; passing the building model parameters to the second target file, and calling the second target file to create a new building model on the base map; responding to a third editing instruction, importing a third target file, and calling the third target file to register a mouse click event so that the map display interface responds to mouse click operations; responding to a fourth editing instruction, accessing backend data to the map display interface, and importing a fourth target file; obtaining map point configuration parameters corresponding to the fourth target file, and, based on the map point configuration parameters and the backend data, calling the fourth target file to render map points for display on the map display interface.
7. An electronic device, the electronic device comprising a processor, characterized in that, The processor is used to run a program, wherein the program executes the map application development method according to any one of claims 1 to 5 when it runs.
8. A non-volatile storage medium, characterized in that, The non-volatile storage medium includes a stored computer program, wherein the device containing the non-volatile storage medium executes the map application development method according to any one of claims 1 to 5 by running the computer program.
Citation Information
Patent Citations
Map application rapid construction method and construction system based on data driving
CN111176620A
System and method of generating platform-agnostic abstract syntax tree
US20170060910A1