CN116863052A - Map drawing method and device based on distributed operating system - Google Patents

Map drawing method and device based on distributed operating system Download PDF

Info

Publication number
CN116863052A
CN116863052A CN202310850195.8A CN202310850195A CN116863052A CN 116863052 A CN116863052 A CN 116863052A CN 202310850195 A CN202310850195 A CN 202310850195A CN 116863052 A CN116863052 A CN 116863052A
Authority
CN
China
Prior art keywords
operating system
programming interface
distributed operating
application programming
map
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310850195.8A
Other languages
Chinese (zh)
Inventor
刘爽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Cennavi Technologies Co Ltd
Original Assignee
Beijing Cennavi Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Cennavi Technologies Co Ltd filed Critical Beijing Cennavi Technologies Co Ltd
Priority to CN202310850195.8A priority Critical patent/CN116863052A/en
Publication of CN116863052A publication Critical patent/CN116863052A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/05Geographic models
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/20Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2219/00Indexing scheme for manipulating 3D models or images for computer graphics
    • G06T2219/024Multi-user, collaborative environment
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Graphics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Geometry (AREA)
  • Remote Sensing (AREA)
  • Architecture (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Generation (AREA)

Abstract

The application provides a method and a device for drawing a map based on a distributed operating system, relates to the technical field of electronic maps, and is used for drawing the electronic map in the distributed operating system. The method comprises the following steps: acquiring storage path information of map data in a distributed operating system through an application programming interface of an application development language eTS of the distributed operating system, and sending the storage path information to a NAPI component; reading the storage path information in the NAPI component according to an application programming interface of the general programming language to obtain map data; an electronic map is drawn in the distributed operating system based on the map data and the graphics rendering application programming interface.

Description

Map drawing method and device based on distributed operating system
Technical Field
The present application relates to the field of electronic map technologies, and in particular, to a method and apparatus for drawing a map based on a distributed operating system.
Background
The distributed operating system is a new-generation domestic intelligent terminal operating system and has wide development prospect in the future. With the popularization and promotion of distributed operating systems, the development of applications related to the distributed operating systems will realize explosive growth.
The prior art lacks of development and application of a distributed operating system, and cannot draw an electronic map in the distributed operating system.
Disclosure of Invention
The application provides a method and a device for drawing a map based on a distributed operating system, which are used for drawing an electronic map in the distributed operating system.
In order to achieve the above purpose, the application adopts the following technical scheme:
in a first aspect, a method for mapping based on a distributed operating system is provided, the method comprising: acquiring storage path information of map data in a distributed operating system through an application programming interface of an application development language eTS of the distributed operating system, and sending the storage path information to a NAPI component; reading the storage path information in the NAPI component according to an application programming interface of the general programming language to obtain map data; an electronic map is drawn in the distributed operating system based on the map data and the graphics rendering application programming interface.
Optionally, after reading the storage path information in the NAPI component according to the application programming interface of the general programming language to obtain the map data, the method further includes: transmitting a refresh signal to the eTS through a general programming language; the refresh signal is used for indicating the map data in the application programming interface of the general programming language to change; after the eTS receives the refresh signal, a graphics rendering application programming interface is invoked by the eTS.
Optionally, drawing the electronic map in the distributed operating system based on the map data and the graphics rendering application programming interface includes: converting the original coordinate data of the map data into target coordinate data which can be identified by the graphic rendering application programming interface based on the graphic rendering application programming interface; and constructing an object to be rendered according to the target coordinate data, and rendering the object to be rendered according to the pixel information of the map data.
Optionally, the graphics rendering application programming interface includes a vertex shader and a fragment shader; constructing an object to be rendered according to the target coordinate data, and rendering the object to be rendered according to pixel information of map data, including: transmitting the target coordinate data to a vertex shader, so that the vertex shader obtains corresponding primitives according to the target coordinate data, and taking the primitives as objects to be rendered; rasterizing the primitive to obtain a plurality of fragments to be rendered; and transmitting the pixel information into a fragment shader, so that the fragment shader renders each fragment to be rendered fragment by fragment.
Optionally, after drawing the electronic map in the distributed operating system, the method further includes: and calling an XCOMPONET component in the distributed operating system, and displaying the drawn electronic map.
In a second aspect, an apparatus for mapping based on a distributed operating system is provided, the apparatus including an acquisition unit and a processing unit; the acquisition unit is used for acquiring the storage path information of the map data in the distributed operating system through an application programming interface of an application development language eTS of the distributed operating system and sending the storage path information to the NAPI component; the acquisition unit is also used for reading the storage path information in the NAPI component according to an application programming interface of the general programming language so as to obtain map data; and the processing unit is used for drawing the electronic map in the distributed operating system based on the map data and the graphic rendering application programming interface.
Optionally, after the obtaining unit reads the storage path information in the NAPI component according to the application programming interface of the general programming language to obtain the map data, the processing unit is further configured to: transmitting a refresh signal to the eTS through a general programming language; the refresh signal is used for indicating the map data in the application programming interface of the general programming language to change; after the eTS receives the refresh signal, a graphics rendering application programming interface is invoked by the eTS.
Optionally, the processing unit is specifically configured to: converting the original coordinate data of the map data into target coordinate data which can be identified by the graphic rendering application programming interface based on the graphic rendering application programming interface; and constructing an object to be rendered according to the target coordinate data, and rendering the object to be rendered according to the pixel information of the map data.
Optionally, the graphics rendering application programming interface includes a vertex shader and a fragment shader; the processing unit is specifically used for: transmitting the target coordinate data to a vertex shader, so that the vertex shader obtains corresponding primitives according to the target coordinate data, and taking the primitives as objects to be rendered; rasterizing the primitive to obtain a plurality of fragments to be rendered; and transmitting the pixel information into a fragment shader, so that the fragment shader renders each fragment to be rendered fragment by fragment.
Optionally, after the processing unit draws the electronic map in the distributed operating system, the processing unit is further configured to: and calling an XCOMPONET component in the distributed operating system, and displaying the drawn electronic map.
In a third aspect, there is provided an electronic device comprising: a processor, a memory for storing instructions executable by the processor; wherein the processor is configured to execute instructions to implement the method of the first aspect described above for mapping based on a distributed operating system.
In a fourth aspect, there is provided a computer readable storage medium having instructions stored thereon which, when executed by a processor of an electronic device, enable the electronic device to perform the method of mapping based on a distributed operating system as described in the first aspect above.
The technical scheme provided by the application has at least the following beneficial effects: the map drawing device obtains the storage path information of map data in the distributed operating system through an application programming interface of an application development language eTS of the distributed operating system, and sends the storage path information to the NAPI component. Since the NAPI component provides interactive capability for the interaction of the calls between the eTS and the generic programming language, the mapping device can read the storage path information from the NAPI component according to the application programming interface of the generic programming language to obtain the map data. Further, the map drawing device draws the electronic map in the distributed operating system based on the obtained map data and the graphic rendering application programming interface. Therefore, the map drawing method designed by the application is suitable for the distributed operating system, the application programming interface of the eTS of the distributed operating system can learn the storage path of the map data in the distributed operating system, and the application programming interface of the general programming language can successfully take the map data by further utilizing the characteristics of the NAPI component provided by the distributed operating system. Therefore, the map drawing can be realized in the distributed operating system, and the application functions of the distributed operating system are enriched.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic structural diagram of a mapping system according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a method for mapping based on a distributed operating system according to an embodiment of the present application;
FIG. 3 is a second flow chart of a method for mapping based on a distributed operating system according to an embodiment of the present application;
FIG. 4 is a schematic diagram of drawing vertex coordinates according to an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating the assembly of primitives according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a rasterization process according to an embodiment of the present application;
FIG. 7 is a schematic diagram of fragment-by-fragment rendering according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a map drawing device according to an embodiment of the present application;
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be noted that, in the embodiments of the present application, words such as "exemplary" or "such as" are used to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g." in an embodiment should not be taken as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
It should be noted that, in the embodiment of the present application, "english: of", "corresponding" and "corresponding" may sometimes be used in combination, and it should be noted that the meaning to be expressed is consistent when the distinction is not emphasized.
In order to clearly describe the technical solution of the embodiments of the present application, in the embodiments of the present application, the terms "first", "second", etc. are used to distinguish the same item or similar items having substantially the same function and effect, and those skilled in the art will understand that the terms "first", "second", etc. are not limited in number and execution order.
Before explaining the embodiments of the present application in detail, some related technical terms and related technologies related to the embodiments of the present application are described.
Geographic information system (Geographic Information System or Geo-Information system, GIS): sometimes also referred to as a "geoscience information system". Which is a specific spatial information system. The system is a technical system for collecting, storing, managing, operating, analyzing, displaying and describing the related geographic distribution data in the whole or partial earth surface (including atmosphere) space under the support of a computer hard and software system.
An Operating System (OS) is a set of interrelated System software programs that hosts and controls the operation, deployment, and execution of computer hardware, software resources, and provides common services to organize user interactions.
The OpenHarmony operating system: the open source distributed operating system has the characteristics of full scene oriented, distributed and the like, and is a full-field, new-generation, open source and open operating system.
Application programming interface (Application Program Interface, API): is defined as a standard set that an application program can use to exchange information and commands with a computer operating system. A standard application program interface provides a generic programming environment for users or software developers to write applications that can interoperate with computers of different vendors.
eTS (extended TypeScript) it is an application development language for hong Meng ecological. On the basis of TypeScript (TS for short), the corresponding capabilities of a declaration User Interface (UI), state management and the like are expanded, so that an developer can develop high-performance applications in a simpler and more natural mode. TS is a superset of JavaScript (JS for short), and eTS is a superset of TS. The eTS will continue to evolve in conjunction with the needs of application development and execution, including but not limited to language features that introduce aspects of distributed development paradigms, parallelism and concurrency enhancement, type system enhancement, and the like.
NAPI (Native API): the method is a set of native module expansion development framework in an OpenHarmony operating system, is developed based on the node.js N-API specification, and provides interaction capability of mutual calling between JavaScript or eTS and a C/C++ module for a developer.
C language: is a general program design language facing to the process and abstract, and is widely applied to the bottom development. The C language can be compiled and processed in a simple manner into low-level memory. The C language is a high efficiency programming language that produces only a small amount of machine language to run without any running environment support. Although the C language provides many low-level processing functions, the cross-platform feature is maintained and C language programs written in a standard specification may be compiled on many computer platforms, including operating platforms such as embedded processors and supercomputers.
C++: is a high-level programming language of a computer, and is generated by expanding and upgrading a C language.
Open graphics library (pen Graphics Library, openGL): is a cross-language, cross-platform application programming interface (Application Programming Interface, API) for rendering 2D, 3D vector graphics.
OpenGL ES (OpenGL for Embedded Systems) is a subset of OpenGL three-dimensional graphics APIs designed for embedded devices such as cell phones, palm top computers (Personal Digital Assistant, PDA), and game hosts.
The prior art lacks of development and application of a distributed operating system, and cannot draw an electronic map in the distributed operating system.
In view of this, the embodiment of the application provides a method for drawing a map based on a distributed operating system, which aims at realizing the drawing of an electronic map in the distributed operating system.
The method provided by the embodiment of the application is described in detail below with reference to the accompanying drawings.
Fig. 1 illustrates an exemplary application scenario diagram provided by an embodiment of the present application. As shown in fig. 1, the method for mapping based on the distributed operating system according to the embodiment of the present application may be applied to the mapping system 10. The mapping system 10 includes a mapping apparatus 11 and an electronic device 12. Wherein the mapping apparatus 11 is connected to an electronic device 12. The mapping device 11 and the electronic device 12 may be connected in a wired manner or may be connected in a wireless manner, which is not limited in the embodiment of the present application.
The electronic device 12 is installed with a distributed operating system. The distributed operating system may be an OpenHarmony operating system (such as OpenHarmony 3.1) or other operating systems, and the present application is not limited to a specific distributed operating system. The electronic device 12 may be an OpenHarmony development board.
The map drawing device 11 is configured to obtain storage path information of map data in the distributed operating system through an application programming interface of an application development language etis of the distributed operating system, and send the storage path information to the NAPI component. The map drawing device 11 is also used for reading the storage path information from the NAPI component according to an application programming interface of a general programming language to obtain map data, and drawing an electronic map in a distributed operating system based on the map data and the graphic rendering application programming interface.
Optionally, the electronic device 12 further comprises a display for displaying the electronic map.
In different application scenarios, the mapping apparatus 11 and the electronic device 12 may be independent devices, or may be integrated in the same device, which is not specifically limited in the embodiments of the present disclosure.
When the map drawing device 11 and the electronic device 12 are integrated in the same device, the data transmission between the map drawing device 11 and the electronic device 12 is performed by data transmission between internal modules of the device. In this case, the data transfer flow therebetween is the same as "in the case where the map drawing apparatus 11 and the electronic device 12 are independent of each other".
In the following embodiments provided in the embodiments of the present disclosure, description will be given taking an example in which the map drawing apparatus 11 and the electronic device 12 are provided independently of each other.
FIG. 2 is a flow diagram illustrating a method of mapping based on a distributed operating system, according to some example embodiments. In some embodiments, the method for mapping based on the distributed operating system may be applied to the mapping apparatus, the electronic device, and other similar devices as shown in fig. 1.
As shown in fig. 2, a method for mapping based on a distributed operating system according to an embodiment of the present disclosure includes the following S201 to S203.
S201, the map drawing device obtains storage path information of map data in the distributed operating system through an application programming interface of an application development language eTS of the distributed operating system, and sends the storage path information to the NAPI component.
As one possible implementation, the mapping device invokes an API of the eTS to obtain the storage path information of the map data in the distributed operating system. Further, the mapping apparatus transmits the storage path information to a NAPI layer in the distributed operating system to give the storage path information at the NAPI component.
The map data is used for recording map resource information, and the basic configuration of a map data map, map style, icons, fonts, geographical data, and the like. For example, the map data may be data in a GIS.
For example, the operator may store map data in advance in a unique readable-writable directory of the OpenHarmony operating system: data/accounts/accounts_0/appdata/os. The readable and writable directory is the storage path information of the map data. When the map drawing device draws a map in the OpenHarmony operating system (namely, when a map engine is initialized), a readable and writable path can be obtained through an eTS API, and the readable and writable path is transferred to the NAPI layer.
S202, the map drawing device reads the storage path information in the NAPI component according to an application programming interface of the general programming language to obtain map data.
As one possible implementation, the mapping apparatus calls an API of the general programming language, reads map data under the storage path information in the NAPI component, and obtains the map data.
It should be noted that the formal language of the computer program is defined. It is a standardized communication technique used to instruct computers. For example, the general programming language in the present application may be C, C ++, JAVA, etc.
For example, when the map drawing device draws a map in the OpenHarmony operating system (i.e. when a map engine is initialized), the map drawing device obtains a readable and writable path through an eTS API, transfers the readable and writable path to the NAPI layer, and calls the C/c++ interface to read map data under the readable and writable path.
And S203, the map drawing device draws the electronic map in the distributed operating system based on the map data and the graphic rendering application programming interface.
As one possible implementation, the mapping device converts the original coordinate data of the map data into target coordinate data recognizable by the graphics rendering application programming interface based on the graphics rendering application programming interface. Further, the map drawing device constructs an object to be rendered according to the target coordinate data, and renders the object to be rendered according to pixel information of the map data.
Alternatively, the graphics rendering application programming interface may be an API designed based on OpenGL ES, for example an API packaged based on OpenGL ES 3.0 technology.
When the map drawing device adopts the OpenGL ES to perform the map, the original coordinate data of the map data needs to be converted into the OpenGL coordinates so that the OpenGL ES can draw the map.
Optionally, the mapping device converts the read map data into OpenGL coordinates by using ink card support Projection through three transformation matrices (including Model matrix, view matrix, projection matrix).
Illustratively, the mapping apparatus converts the object coordinates into world coordinates through OpenGL ES by model conversion. The map drawing device further converts world coordinates into observer coordinates through visual transformation, converts world coordinates into clipping coordinates through projective transformation, and then converts the clipping coordinates into standard standardized device coordinates (Normal Device Coordinate, NDC) through perspective division, namely the coordinates which can be identified by OpenGL ES. In addition, the mapping device can convert the NDC into screen coordinates through viewport transformation so as to be displayed on a screen.
For ease of understanding, the description is given below of an object coordinate system, a world coordinate system, an observer coordinate system, a clipping coordinate system, NDC, and a screen coordinate system.
Object coordinate system: also called the object coordinate system, the model coordinate system. The object coordinate system is a relative coordinate system that is specific to the object itself. When the object rotates, moves and the like, the object coordinate system also rotates and moves in the same way.
World coordinate system-this is the absolute coordinate system of the system, any point on the system's picture can find its coordinates in the world coordinate system before the user's own coordinate system is not established, and the position of the point is determined from the coordinates. The world coordinate system is constant throughout.
Observer coordinate system: each of the observer coordinates is viewed from the camera or observer's angle.
Clipping coordinate system: after the coordinates reach the viewing space, they need to be projected onto the clipping coordinates. The clipping coordinates are processed to a range of-1.0 to 1.0 and a determination is made as to which vertices will appear on the screen.
Normalized Device Coordinates (NDC): the interval range of the coordinate system is [ -1,1], that is, the coordinates of all points are converted into a coordinate range of-1 to 1. Vertices exceeding this range will not be visible.
Ink-card-holder projection: is a positive axis equiangular cylindrical projection, also known as an equiangular cylindrical projection, one of which was created by the netherlands atlas staff mercator (g.mercator) in 1569. Is the most influencing map projection method. It is assumed that a cylinder with the same direction as the earth axis is cut or cut on the earth, the longitude and latitude net is projected onto the cylinder surface according to the equiangular condition, and the plane theodolite net is obtained after the cylinder surface is spread into the plane. The warp lines after projection are a group of vertical equidistant parallel straight lines, and the weft lines are a group of parallel straight lines perpendicular to the warp lines. The spacing between adjacent wefts increases from the equator to the poles. The length ratio in any direction at one point is equal, i.e. there is no angular deformation, whereas the area deformation is significant, increasing with distance from the base weft.
Screen coordinate system: clipping coordinates are changed to screen coordinates using a process called viewport transformation (Viewport Transform). The viewport transformation transforms coordinates lying in the range-1.0 to 1.0 into a coordinate range defined by glViewport (). The final transformed coordinates are sent to a rasterizer, which converts them into fragments. Wherein glViewport () is a function in OpenGL.
The mapping device needs to convert the read four-dimensional data (i.e. object coordinates) into screen coordinates in the OpenGL rendering pipeline, before which the object coordinate system needs to be transformed into a plurality of transition coordinate systems. The coordinate transformation needs to be performed by means of transformation matrices, such as the three transformation matrices described above: model matrix, view matrix, projection matrix.
In one possible implementation, the coordinate transformation procedure is as follows: the map drawing device converts the object coordinates into world coordinates through a model. The mapping device converts world coordinates into observer coordinates by visual transformation. The mapping device may also convert world coordinates into clipping coordinates by projective transformation. Furthermore, the map drawing device converts the clipping coordinates into normalized equipment coordinates by utilizing perspective division, so that the processing is convenient. Finally, the map drawing device converts the standardized equipment coordinates into screen coordinates through viewport transformation. In addition, the screen coordinates subjected to the coordinate transformation may be transferred to the vertex shader for rendering, and a specific rendering process refers to S2031 described below.
In some embodiments, after obtaining the map data, the mapping apparatus sends a refresh signal to the eTS through the generic programming language. The refresh signal is used for indicating the map data in the application programming interface of the general programming language to change. Further, after the eTS receives the refresh signal, the mapping device invokes the graphics rendering application programming interface through the eTS.
For example, the operator may create a drawing timer in the OpenHarmony operating system through the eTS, and when the map data is changed (e.g., the map drawing device may put the map data in a cache of the OpenHarmony operating system after acquiring the map data), the map drawing device transmits an eTS refresh signal through the c++, and the eTS receives the signal and invokes the OpenGL ES drawing method written in the c++ to draw the map.
The technical scheme provided by the embodiment of the application at least has the following beneficial effects: the map drawing device obtains the storage path information of map data in the distributed operating system through an application programming interface of an application development language eTS of the distributed operating system, and sends the storage path information to the NAPI component. Since the NAPI component provides interactive capability for the interaction of the calls between the eTS and the generic programming language, the mapping device can read the storage path information from the NAPI component according to the application programming interface of the generic programming language to obtain the map data. Further, the map drawing device draws the electronic map in the distributed operating system based on the obtained map data and the graphic rendering application programming interface. Therefore, the map drawing method designed by the application is suitable for the distributed operating system, the application programming interface of the eTS of the distributed operating system can learn the storage path of the map data in the distributed operating system, and the application programming interface of the general programming language can successfully take the map data by further utilizing the characteristics of the NAPI component provided by the distributed operating system. Therefore, the map drawing can be realized in the distributed operating system, and the application functions of the distributed operating system are enriched.
In one design, a graphics rendering application programming interface includes a vertex shader and a fragment shader. As shown in fig. 3, the step S203 provided in the embodiment of the present application specifically includes:
s2031, the mapping apparatus transmits the target coordinate data to the vertex shader, so that the vertex shader obtains a corresponding primitive according to the target coordinate data, and takes the primitive as an object to be rendered.
It should be noted that, the vertex shader is pre-written by the operation staff and stored in the distributed operating system. The vertex shader may perform vertex transforms, lighting, application of materials, and the like. Through the vertex shader, the graphics card can know where the vertex should be drawn.
Illustratively, as shown in FIG. 4, the mapping device may transmit the target coordinate data to the vertex shader, where the graphics card may then map the vertex coordinates at the locations shown in FIG. 4. Furthermore, the mapping device can also determine the primitive composed of the vertex coordinates through the vertex coordinates determined by the vertex shader.
It should be noted that the mapping device converts the four-dimensional data, i.e., the object coordinates, read out into screen coordinates by the coordinates, and transmits the screen coordinates to the vertex shader as vertex coordinates.
Optionally, the mapping device may also assemble the constructed primitives.
It should be noted that the primitive may be a geometric object such as a triangle, a line, or a point. Each vertex of the primitive is sent to the vertex shader for assembly. The primitive assembly is to receive the output data of the vertex shader and assemble the vertex data transmitted by the vertex shader into primitives. Wherein, the graphics primitive refers to geometric figures such as points, lines, triangles and the like.
During primitive assembly, these vertices are combined into primitives. As shown in fig. 5, for each primitive, the mapping device discards the portion of the primitive that is not within the view cone (the region where the screen is visible), and after clipping the portion of the region within the view cone, converts the vertex position to screen coordinates. Wherein, the cone is located in the visible range of the screen.
The primitive assembly phase will clip the vertex coordinates that go beyond the screen. When in clipping, if the graphic primitive is completely positioned in the viewing cone and the custom clipping plane, the graphic primitive is transmitted to the following step for processing; discarding the primitive if the primitive is entirely outside of the view volume or custom clipping plane; if a primitive has one part inside and another part outside, then the primitive needs to be clipped.
And S2032, the map drawing device performs rasterization processing on the primitives to obtain a plurality of fragments to be rendered.
It should be noted that rasterization is a process of converting a primitive into a two-dimensional fragment.
As shown in fig. 6, the mapping apparatus performs rasterization processing on the primitive to divide the primitive into a plurality of rasters to be rendered.
S2033, the mapping device transmits the pixel information to the fragment shader, so that the fragment shader renders each fragment to be rendered fragment by fragment.
Wherein the pixel information includes texture, color, etc. attribute information, which may be from four-dimensional data, passed to the fragment shader.
It should be noted that the fragment shader is pre-written by the operation and maintenance personnel and stored in the distributed operating system. The fragment shader is used for processing fragment values and related data, and can perform sampling of textures, summarization of colors, calculation of fog colors and the like.
As a possible implementation, the mapping apparatus passes pixel information into a fragment shader, and renders each fragment to be rendered with the fragment shader in a fragment-by-fragment operation.
In practical application, the workflow of the fragment shader is as follows: fragment data- > pixel attribution test- > clipping test- > stencil test- > depth test- > mix- > dither- > go to the frame buffer. The fragment of screen coordinates (Xw, yw) generated by the rasterization stage can only modify the pixels in the frame buffer at positions (Xw, yw). For example, as shown in FIG. 7, at the end of the fragment-by-fragment phase of operation, fragments are rejected or fragment color, depth, or template values are written at the frame buffer (Xw, yw) locations.
The pixel attribution test stage is used for testing whether a pixel at a certain position in the frame buffer belongs to a current window. For example, if the current window is obscured by another window, the obscured pixel does not belong to the current window and therefore is not displayed.
The clipping test is used to limit the frame buffer writable area. For example, pixels within the region are set to be writable; pixels outside the area are set to be non-writable.
The frame buffer has a screen size template buffer, and each element has an 8-bit unsigned integer value stored therein, which is the template value for the pixel. And (3) template test, namely comparing the value in the template buffer area with a reference value, and updating the frame buffer according to the comparison result.
And the depth test is to compare the depth value of the patch with the depth value in the depth buffer area so as to determine whether to perform writing operation on the pixel point corresponding to the patch.
The mixing is to mix the color of the tile with the existing color values in the frame buffer color buffer and write the new value obtained by mixing into the color buffer.
Dithering is a display that uses limited colors to allow you to see more colors than the actual image.
The forward frame buffer is the color buffer which performs AND or NOR and other logic operation on the color value transmitted in the previous step and then writes the color value into the frame buffer.
In some embodiments, after the map drawing device finishes drawing the electronic map in the distributed operating system, the XComponent component in the distributed operating system may be further called to display the drawn electronic map.
For example, openharmonyl 3.1 provides an XComponent component for displaying OpenGL ES drawing results on a screen.
In practical application, the mapping device may create an oh_native xcomment instance (including creating an oh_native xcomment_callback and registering by an oh_native xcomment_registercallback method), initialize OpenGL ES in an onsurface ecreatedcb Callback method, change view size in onsurface ecchange dcb, and destroy OpenGL ES in onsurface destredoyedcb. And the eTS binds XCOMPONET in the distributed operating system, and the map drawing device initializes a drawing timer in a callback after XComponent onLoad loading is completed, and performs map drawing after receiving a refresh signal and binds with OpenGL Surface.
In some embodiments, the mapping apparatus also requires compiling the source code in order for the distributed operating system to successfully run the source code written by the operator. The C/C++ part in the source code depends on an OpenHarmony3.1 system library, the OpenHarmony3.1 source code is required to be carried, and the map drawing device compiles each module of the map engine into a static library respectively, compiles the static library and the NAPI layer into a dynamic library and calls eTS.
Illustratively, the mapping device downloads and builds an OpenHarmony 3.1 source code compiling environment, further copies the map engine source code to an OpenHarmony 3.1 source code appointed directory, and compiles a gn compiling file. In response to a compiling instruction of an operation and maintenance person, the mapping device calls a gn OpenHarmony source code compiling command to compile. Where gn is a small build system tool used to quickly generate the metafile needed to build the ninja compiler.
In some embodiments, the mapping apparatus may also install a DevEco Studio to package the dynamic library and the etis source code into haps, for example, the DevEco Studio downloads the haps. Wherein the static libraries are linked into the object code at program compilation time. The program no longer needs to be static libraries at run time. The compiled volume is therefore relatively large, beginning with lib and ending with a. Dynamic libraries, also called shared libraries, are not linked into object code at program compilation time, but are loaded at program execution time. The program needs to be dynamically pooled at run time. The compiled volume is therefore relatively small, starting with lib and ending with so.
Illustratively, the mapping device creates a corresponding directory "libs/arminabi-v 7a" under the entry according to the architecture of a central processing unit (Central Processing Unit, CPU) of the mapping device, and further copies a dynamic library so compiled based on OpenHarmony 3.1 source code to the corresponding directory. The operation and maintenance personnel clicks on 'Build- > Build APP (s)/Hap(s) - > Build Hap(s)', corresponding 'so' library files and eTS source codes are packaged into Hap, green triangles are clicked, and the Hap is operated and installed on the map drawing device.
The foregoing embodiments mainly describe the solutions provided by the embodiments of the present application from the perspective of the apparatus (device). It will be appreciated that, in order to implement the above-mentioned method, the apparatus or device includes hardware structures and/or software modules corresponding to each of the method flows, and these hardware structures and/or software modules corresponding to each of the method flows may constitute a material information determining apparatus. Those of skill in the art will readily appreciate that the various illustrative algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The embodiment of the application can divide the functional modules of the device or the equipment according to the method example, for example, the device or the equipment can divide each functional module corresponding to each function, or two or more functions can be integrated in one processing module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation.
Fig. 8 is a schematic structural view of a mapping apparatus according to an exemplary embodiment. Referring to fig. 8, a map drawing apparatus 30 provided in an embodiment of the present application includes an acquisition unit 301 and a processing unit 302.
An obtaining unit 301, configured to obtain, through an application programming interface of an application development language etis of the distributed operating system, storage path information of map data in the distributed operating system, and send the storage path information to the NAPI component; the obtaining unit 301 is further configured to read the storage path information in the NAPI component according to an application programming interface of the general programming language, so as to obtain map data; the processing unit 302 is configured to draw an electronic map in the distributed operating system based on the map data and the graphics rendering application programming interface.
Optionally, after the obtaining unit 301 reads the storage path information in the NAPI component according to the application programming interface of the general programming language to obtain the map data, the processing unit 302 is further configured to: transmitting a refresh signal to the eTS through a general programming language; the refresh signal is used for indicating the map data in the application programming interface of the general programming language to change; after the eTS receives the refresh signal, a graphics rendering application programming interface is invoked by the eTS.
Optionally, the processing unit 302 is specifically configured to: converting the original coordinate data of the map data into target coordinate data which can be identified by the graphic rendering application programming interface based on the graphic rendering application programming interface; and constructing an object to be rendered according to the target coordinate data, and rendering the object to be rendered according to the pixel information of the map data.
Optionally, the graphics rendering application programming interface includes a vertex shader and a fragment shader; the processing unit 302 is specifically configured to: transmitting the target coordinate data to a vertex shader, so that the vertex shader obtains corresponding primitives according to the target coordinate data, and taking the primitives as objects to be rendered; rasterizing the primitive to obtain a plurality of fragments to be rendered; and transmitting the pixel information into a fragment shader, so that the fragment shader renders each fragment to be rendered fragment by fragment.
Optionally, after the processing unit 302 draws the electronic map in the distributed operating system, the processing unit is further configured to: and calling an XCOMPONET component in the distributed operating system, and displaying the drawn electronic map.
Fig. 9 is a schematic structural diagram of an electronic device provided by the present application. As shown in fig. 9, the electronic device 40 may include at least one processor 401 and a memory 402 for storing processor executable instructions, wherein the processor 401 is configured to execute the instructions in the memory 402 to implement the method of mapping based on a distributed operating system in the above-described embodiments.
In addition, the electronic device 40 may also include a communication bus 403 and at least one communication interface 404.
The processor 401 may be a processor (central processing units, CPU), a microprocessor unit, ASIC, or one or more integrated circuits for controlling the execution of the programs of the present application.
Communication bus 403 may include a pathway to transfer information between the aforementioned components.
The communication interface 404 uses any transceiver-like device for communicating with other devices or communication networks, such as ethernet, radio access network (radio access network, RAN), wireless local area network (wireless local area networks, WLAN), etc.
The memory 402 may be, but is not limited to, read-only memory (ROM) or other type of static storage device that can store static information and instructions, random access memory (random access memory, RAM) or other type of dynamic storage device that can store information and instructions, but may also be electrically erasable programmable read-only memory (EEPROM), compact disc-read only memory (compact disc read-only memory) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory may be implemented separately and coupled to the processor 401 via a bus. The memory may also be integrated with the processor 401.
The memory 402 is used for storing instructions for executing the scheme of the present application, and the processor 401 controls the execution. The processor 401 is arranged to execute instructions stored in the memory 402 in order to carry out the functions of the method of the application.
As an example, in connection with fig. 8, the acquisition unit 301 and the processing unit 302 in the mapping apparatus 30 realize the same functions as those of the processor 401 in fig. 9.
In a particular implementation, as one embodiment, processor 401 may include one or more CPUs, such as CPU0 and CPU1 in FIG. 9.
In a particular implementation, electronic device 40 may include multiple processors, such as processor 401 and processor 407 in FIG. 9, as one embodiment. Each of these processors may be a single-core (single-CPU) processor or may be a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
In a particular implementation, electronic device 40 may also include an output device 405 and an input device 406, as one embodiment. The output device 405 communicates with the processor 401 and may display information in a variety of ways. For example, the output device 405 may be a liquid crystal display (liquid crystal display, LCD), a light emitting diode (light emitting diode, LED) display device, a Cathode Ray Tube (CRT) display device, or a projector (projector), or the like. The input device 406 is in communication with the processor 401 and may accept input of a user object in a variety of ways. For example, the input device 406 may be a mouse, keyboard, touch screen device, or sensing device, among others.
Those skilled in the art will appreciate that the structure shown in fig. 9 is not limiting of the electronic device 40 and may include more or fewer components than shown, or may combine certain components, or may employ a different arrangement of components.
In addition, the present application also provides a computer readable storage medium, which when executed by a processor of an electronic device, enables the electronic device to perform the method for mapping based on the distributed operating system as provided in the above embodiment.
In addition, the application also provides a computer program product comprising computer instructions which, when run on an electronic device, cause the electronic device to perform the method of mapping based on a distributed operating system as provided in the above embodiments.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.

Claims (10)

1. A method of mapping based on a distributed operating system, the method comprising:
acquiring storage path information of map data in the distributed operating system through an application programming interface of an application development language eTS of the distributed operating system, and sending the storage path information to a NAPI component;
reading the storage path information in the NAPI component according to an application programming interface of a general programming language to obtain the map data;
and drawing an electronic map in the distributed operating system based on the map data and a graphics rendering application programming interface.
2. The method of claim 1, wherein the drawing an electronic map in the distributed operating system based on the map data and a graphics rendering application programming interface comprises:
converting the original coordinate data of the map data into target coordinate data identifiable by the graphic rendering application programming interface based on the graphic rendering application programming interface;
and constructing an object to be rendered according to the target coordinate data, and rendering the object to be rendered according to the pixel information of the map data.
3. The method of claim 2, wherein the graphics rendering application programming interface comprises a vertex shader and a fragment shader; the constructing an object to be rendered according to the target coordinate data, and rendering the object to be rendered according to the pixel information of the map data, includes:
transmitting the target coordinate data to the vertex shader, so that the vertex shader obtains corresponding primitives according to the target coordinate data, and taking the primitives as the objects to be rendered;
rasterizing the primitive to obtain a plurality of fragments to be rendered;
and transmitting the pixel information into the fragment shader so that the fragment shader can render each fragment to be rendered fragment by fragment.
4. The method of claim 1, wherein after reading the storage path information in the NAPI component according to an application programming interface of a general programming language to obtain the map data, the method further comprises:
sending a refresh signal to the eTS through the generic programming language; the refresh signal is used for indicating the map data in the application programming interface of the general programming language to change;
And after the eTS receives the refresh signal, calling the graphic rendering application programming interface through the eTS.
5. The method of any of claims 1-4, wherein after the drawing of the electronic map in the distributed operating system, the method further comprises:
and calling an XCOMPONET component in the distributed operating system, and displaying the drawn electronic map.
6. A device for drawing a map based on a distributed operating system, which is characterized by comprising an acquisition unit and a processing unit;
the acquiring unit is used for acquiring the storage path information of the map data in the distributed operating system through an application programming interface of an application development language eTS of the distributed operating system and sending the storage path information to the NAPI component;
the obtaining unit is further configured to read the storage path information in the NAPI component according to an application programming interface of a general programming language, so as to obtain the map data;
the processing unit is used for drawing an electronic map in the distributed operating system based on the map data and a graphic rendering application programming interface.
7. The apparatus according to claim 6, wherein after the acquisition unit reads the storage path information in the NAPI component according to an application programming interface of a general programming language to obtain the map data, the processing unit is further configured to:
sending a refresh signal to the eTS through the generic programming language; the refresh signal is used for indicating the map data in the application programming interface of the general programming language to change;
and after the eTS receives the refresh signal, calling the graphic rendering application programming interface through the eTS.
8. The apparatus according to claim 6, wherein the processing unit is specifically configured to:
converting the original coordinate data of the map data into target coordinate data identifiable by the graphic rendering application programming interface based on the graphic rendering application programming interface;
and constructing an object to be rendered according to the target coordinate data, and rendering the object to be rendered according to the pixel information of the map data.
9. An electronic device, comprising: a processor, a memory for storing instructions executable by the processor; wherein the processor is configured to execute instructions to implement the method of mapping based on a distributed operating system of any one of claims 1-5.
10. A non-transitory computer readable storage medium having stored thereon program instructions or a computer program; and/or a computer program, characterized in that the program instructions or the computer program, when being executed by a processor, is capable of performing the method of mapping based on a distributed operating system according to any of claims 1-5.
CN202310850195.8A 2023-07-11 2023-07-11 Map drawing method and device based on distributed operating system Pending CN116863052A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310850195.8A CN116863052A (en) 2023-07-11 2023-07-11 Map drawing method and device based on distributed operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310850195.8A CN116863052A (en) 2023-07-11 2023-07-11 Map drawing method and device based on distributed operating system

Publications (1)

Publication Number Publication Date
CN116863052A true CN116863052A (en) 2023-10-10

Family

ID=88223083

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310850195.8A Pending CN116863052A (en) 2023-07-11 2023-07-11 Map drawing method and device based on distributed operating system

Country Status (1)

Country Link
CN (1) CN116863052A (en)

Similar Documents

Publication Publication Date Title
WO2022116759A1 (en) Image rendering method and apparatus, and computer device and storage medium
CN106997610B (en) Image rendering method and device and electronic equipment
KR102003655B1 (en) Determining the Start Node for Tree Traversal for Shadow Lays in Graphics Processing
KR101732288B1 (en) Sprite graphics rendering system
EP3489907B1 (en) Shader program execution techniques for use in graphics processing
CN110262907B (en) System and method for unifying application programming interfaces and models
RU2459260C2 (en) Texture sampling
US20100289804A1 (en) System, mechanism, and apparatus for a customizable and extensible distributed rendering api
US9495722B2 (en) Developer controlled layout
CN101059760B (en) OPENGL to OPENGLIES translator and OPENGLIES emulator
CN110544290A (en) data rendering method and device
JP2005322224A (en) System and method for providing enhanced graphics pipeline
EP3012737A1 (en) Devices and methods for generating elementary geometries
US10319068B2 (en) Texture not backed by real mapping
CN113593027B (en) Three-dimensional avionics display control interface device
Angel et al. An interactive introduction to WEBGL and three. JS
CN114862999A (en) Dotting rendering method, dotting rendering device, dotting rendering equipment and storage medium
CN109634611B (en) Mobile terminal three-dimensional model ply file analysis and display method based on OpenGL
CN116863052A (en) Map drawing method and device based on distributed operating system
Ioannidis et al. Multithreaded rendering for cross-platform 3D visualization based on Vulkan Api
CN113593028A (en) Three-dimensional digital earth construction method for avionic display control
CN110136235B (en) Three-dimensional BIM model shell extraction method and device and computer equipment
Angel et al. Introduction to modern OpenGL programming
Joshi et al. Graphics programming for the web
Marek et al. Possibilities for development and use of 3D applications on the android platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination