CN114637939A - Online rendering method and device of model - Google Patents
Online rendering method and device of model Download PDFInfo
- Publication number
- CN114637939A CN114637939A CN202210282126.7A CN202210282126A CN114637939A CN 114637939 A CN114637939 A CN 114637939A CN 202210282126 A CN202210282126 A CN 202210282126A CN 114637939 A CN114637939 A CN 114637939A
- Authority
- CN
- China
- Prior art keywords
- model
- information
- modelica
- rendering
- component
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 64
- 238000009877 rendering Methods 0.000 title claims abstract description 54
- 230000005540 biological transmission Effects 0.000 claims description 21
- 230000015654 memory Effects 0.000 claims description 18
- 239000010410 layer Substances 0.000 claims description 15
- 239000002356 single layer Substances 0.000 claims description 13
- 230000000712 assembly Effects 0.000 claims description 6
- 238000000429 assembly Methods 0.000 claims description 6
- 238000004590 computer program Methods 0.000 claims description 5
- 238000005516 engineering process Methods 0.000 abstract description 3
- 238000010586 diagram Methods 0.000 description 5
- 238000004891 communication Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 239000002283 diesel fuel Substances 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000004088 simulation Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9574—Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The embodiment of the disclosure discloses a method and a device for online rendering of a model, wherein the method comprises the following steps: after a server side receives a modelica model acquisition request sent by a browser side, determining elements forming the modelica model; generating a json data structure corresponding to each element aiming at each element and a preset protocol; and drawing each element on the interface of the browser end by using a preset rule based on json data corresponding to each element so as to present the modelica model. By using json data description for the modelica model, the rendering of the modelica model is realized, the rendering efficiency is improved, and the technical problem of low rendering speed in the related technology is solved.
Description
Technical Field
The disclosure relates to the technical field of data processing, in particular to a method and a device for online rendering of a model.
Background
The model is usually displayed by an xml document in a browser, and the online rendering is slow in this way.
Disclosure of Invention
The main purpose of the present disclosure is to provide a method and an apparatus for online rendering of a model.
In order to achieve the above object, according to a first aspect of the present disclosure, there is provided a model online rendering method, including: after receiving a modelica model acquisition request sent by a browser end, a server end determines elements forming the modelica model; generating a json data structure corresponding to each element aiming at each element and a preset protocol; and drawing each element on the interface of the browser end by using a preset rule based on json data corresponding to each element so as to present the modelica model.
Optionally, the method further comprises: in the modeling process, after the server receives data of the modelica model sent by the browser, the server determines elements forming the modelica model.
Optionally, the method further comprises: determining the preset protocol based on json, wherein the preset protocol can be operated in the same process of at least one message transmission environment to realize the transmission of the modelica model, and the structure of the preset protocol determined based on json comprises the following steps: information for representing graphic drawing data; information representing attributes of the component; the device comprises a connecting line graph information used for representing port connection generated between components, wherein the connecting line graph information comprises information of two ports and graph information of a line; and/or, the graphic information used for representing the model, wherein the model comprises an icon of the model, a graphic contained by the model, all components under the model and a connecting line.
Optionally, determining the elements that make up the modelica model comprises: and analyzing the physical structure of the modelica model to obtain components, connecting lines among the components and/or graphs forming the modelica model.
Optionally, based on json data corresponding to each element, drawing each element on an interface of a browser end by using a preset rule to present the modelica model includes: generating json data conforming to the transmission protocol aiming at the graphs contained in the modelica model; traversing the json data to read a field representing a graphic shape in the information of the graphic drawing data when the json data is analyzed; drawing the graph shape based on the value corresponding to the field; in the traversing process, when a value representing a graphic position in the information of the graphic drawing data is read, setting the geometric information of the graphic position; in the traversing process, when a value of a graphic style in the information of the graphic drawing data is read, setting the style of the graphic; and/or during the traversal, when the text information for describing the graph in the information of the graph drawing data is read, drawing the text information.
Optionally, based on json data corresponding to each element, drawing each element on an interface of a browser end by using a preset rule to present the modelica model includes: determining the type of a component for the components forming the modelica model; if the type of the component is a single-level component, drawing each element on an interface of a browser end by using a preset rule based on a corresponding json data structure;
if the type of the assembly is a multi-layer assembly formed by nesting and combining single-layer assemblies, analyzing the multi-layer assembly to obtain a plurality of single-layer assemblies forming the multi-layer assembly;
and drawing each single-layer model on an interface of a browser end by using a preset rule based on json data corresponding to a plurality of single-layer components forming the multi-layer component so as to obtain the multi-layer component.
Optionally, based on json data corresponding to each element, drawing each element on an interface of a browser end by using a preset rule to present the modelica model includes: generating json data which accords with the transmission protocol aiming at the single-layer assembly; traversing the json data to read the simple name of the component and first information in the information of the component attribute when analyzing the json data; drawing the component based on the content indicated by the information; after second information of the component attribute data is read, drawing a graph of the component based on the content indicated by the second information; and after the third information of the component attribute data is read, drawing the port of the component based on the content indicated by the third information.
According to a second aspect of the present disclosure, there is provided an online model rendering apparatus, comprising: the determining unit is configured to determine elements forming the modelica model after the server receives a modelica model acquisition request sent by a browser; the data generating unit is configured to generate json data structures corresponding to the elements aiming at the elements and a preset protocol; and the rendering unit is configured to draw each element on the interface of the browser end by using a preset rule based on json data corresponding to each element so as to present the modelica model.
According to a third aspect of the present disclosure, there is provided a computer-readable storage medium storing computer instructions for causing a computer to perform the method for online rendering of a model according to any one of the implementations of the first aspect.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to cause the at least one processor to perform the method of online rendering of a model according to any one of the implementations of the first aspect.
In the method and the device for online rendering of the model in the embodiment of the disclosure, the method comprises the following steps: after a server side receives a modelica model acquisition request sent by a browser side, determining elements forming the modelica model; generating a json data structure corresponding to each element aiming at each element and a preset protocol; and drawing each element on the interface of the browser end by using a preset rule based on json data corresponding to each element so as to present the modelica model. The json data description is used for the modelica model, so that the rendering of the modelica model is realized, the rendering efficiency is improved, and the technical problem of low rendering speed in the related technology is solved.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart of a method for online rendering of a model according to an embodiment of the disclosure;
FIG. 2 is a diagram of an application scenario of a model online rendering method according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those skilled in the art, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only some embodiments of the present disclosure, not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the present disclosure may be described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In the present disclosure, the terms "upper", "lower", "left", "right", "front", "rear", "top", "bottom", "inner", "outer", "middle", "vertical", "horizontal", "lateral", "longitudinal", and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings. These terms are used primarily to better describe the present disclosure and its embodiments, and are not used to limit the indicated devices, elements or components to a particular orientation or to be constructed and operated in a particular orientation.
Moreover, some of the above terms may be used to indicate other meanings besides the orientation or positional relationship, for example, the term "on" may also be used to indicate some kind of attachment or connection relationship in some cases. The specific meaning of these terms in this disclosure can be understood by one of ordinary skill in the art as a matter of context.
Furthermore, the terms "mounted," "disposed," "provided," "connected," and "sleeved" are to be construed broadly. For example, it may be a fixed connection, a removable connection, or a unitary construction; can be a mechanical connection, or an electrical connection; may be directly connected, or indirectly connected through intervening media, or may be in internal communication between two devices, elements or components. The specific meaning of the above terms in the present disclosure can be understood by those of ordinary skill in the art as appropriate.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
According to an embodiment of the present disclosure, there is provided an online model rendering method, as shown in fig. 1, the method includes the following steps 101 to 103:
step 101: after a server side receives a modelica model acquisition request sent by a browser side, determining elements forming the modelica model;
in this embodiment, the browser side and the server side may implement data transmission through a plurality of data transmission protocols, including but not limited to socket, http, and other different message transmission protocols.
The browser side can send a browsing request, namely a modelica model acquisition request, to the server side, where the modelica model can be data stored after last drawing (completed or not completed). The Modelica model of the present embodiment may be a model with a specific physical structure, and the elements constituting the Modelica model may include, but are not limited to, a component model (a single-level component model, a multi-level component model composed of a single-level component model nesting, such as a motor component model, a motor torque control model composed of motor component models), a connection line between components (the connection line may be used to establish a communication relationship between two components), and/or a graphic.
Upon receiving the fetch request, the elements contained in the modelica model of the request can be determined, and then based on the elements, the rendering of modelica can be completed to achieve the display of the interface at the browser end.
As an optional implementation manner of this embodiment, the method further includes: in the modeling process, after the server receives the data of the modelica model sent by the browser, the server determines elements forming the modelica model.
In this optional implementation manner, in the modeling process, the browser end may send data of the currently completed modelica model to the server end in real time, for example, after the modelica model server end of the current diesel fuel module receives the model, the browser end may determine elements constituting the current modelica model.
As an optional implementation manner of this embodiment, determining the elements constituting the modelica model includes: and analyzing the physical structure of the modelica model to obtain components, connecting lines among the components and/or graphs forming the modelica model.
Step 102: and generating a json data structure corresponding to each element according to each element and a preset protocol.
In the embodiment, the Modelica model online rendering solution in the related art is generally implemented by xml text, but there are several outstanding problems, namely, large data transmission is slow, reading is inconvenient, expansion is not easy, and model rendering is slow. In the embodiment, a preset protocol is established based on Json, the protocol can be suitable for a lightweight protocol which is remotely transmitted and can describe Modelica graphic information, Modelica language is used as a standard, contents are described by Json, some data structures and relevant processing rules are defined, and the protocol is allowed to run in the same process based on socket, http and other different message transmission environments. In this embodiment, the server may generate a json data structure for each element based on a preset protocol.
Step 103: and drawing each element on the interface of the browser end by using a preset rule based on json data corresponding to each element so as to present the modelica model.
In this embodiment, after the browser receives the json data sent by the server, the structure of the json data may be traversed, and each element may be drawn in the traversing process.
As an optional implementation manner of this embodiment, the preset protocol is determined based on json, where the preset protocol may be run in the same process of at least one message transmission environment to implement transmission of a modelica model, where a structure of the preset protocol determined based on json includes: information for representing graphic drawing data; information representing attributes of the component; the device comprises a connecting line graph information used for representing port connection generated between components, wherein the connecting line graph information comprises information of two ports and graph information of a line; and/or, the graphic information used for representing the model, wherein the model comprises an icon of the model, a graphic contained by the model, all components under the model and a connecting line.
The implementation can fundamentally solve the problems of slow data transmission, inconvenient reading, difficult expansion and slow model rendering of the Modelica model in a browser environment through the JSON (Java Server object notation) light-weight data exchange format. A preset protocol (hereinafter, JSON-MO protocol) formulated based on JSON is used as a data format for transmitting the client and the server, and the rapid rendering of the Modelica model in the web environment is realized.
In this optional implementation, the information used for representing the graphic drawing data may be Graph (graphics), and the drawing information used for describing an Icon layer and a Diagram layer includes 7 pattern types. The description is performed by information such as an origin, an end point, a fillet radius, and a color.
Further, the information for representing the attributes of the components includes Component, Icon graphical information for describing the relative position and size of a Component in the model where the Component is located, and the Component itself. As in the following table:
further, a connection graph information Connect (connection) generated by port connection between components is described, and the connection graph information generated by port connection of two components includes two end points of a line and graph information of the line, as shown in the following table:
further, the graphic information Model (Model) for representing the Model, the graphic information describing the entire Model, including the Model icon, the graphic contained in the Model, all the components under the Model, and the connection information, is as follows:
the Ident (simple name) is a String type and is used for expressing the simple name of the model or the component, the simple name is a unique key value, and the client can be positioned to the specific model or the component after receiving the Ident.
As an optional implementation manner of this embodiment, based on json data corresponding to each element, drawing each element on an interface of a browser end by using a preset rule to present the modelica model includes: generating json data conforming to the transmission protocol aiming at the graphs contained in the modelica model; traversing the json data to read a field representing a graphic shape in the information of the graphic drawing data when the json data is analyzed; drawing the graph shape based on the value corresponding to the field; in the traversing process, when a value representing a graphic position in the information of the graphic drawing data is read, setting the geometric information of the graphic position; in the traversing process, when a value of a graphic style in the information of the graphic drawing data is read, setting the style of the graphic; and/or during the traversal, when the text information for describing the graph in the information of the graph drawing data is read, drawing the text information.
In this optional implementation, the graph may include a rectangle, an ellipse, a polygon, and a line segment basic graph, and is composed of a graph shape, a graph coordinate, a graph attribute, and a graph description part of information, and when rendering is performed, a preset protocol (hereinafter, referred to as JSON-MO protocol) may be based on, a JSON data structure of the graph may be generated, and then, analysis is performed by using an AST syntax principle, a data structure is traversed, first, a graph shape type field is read, drawing is performed using shape tag elements (including but limited to rect, ellise, path, polygon, polyline, line, and the like) in svg, then, graph coordinate information is read, and when graph position related fields key such as origin, points, and extend are read, graph position geometric information starts to be set based on a value corresponding to the field; reading the attribute information of the graphic style, and setting the style by using a setAttribute method of JavaScript when reading the related fields key of the graphic style such as rotation, lineColor, fillColor, linePattern, fillPattern, lineThickness, borderPattern, radius and the like; and finally, reading the graphic description information, and when the key related to the description is read, drawing the text information by using the text label in the svg, thereby finishing the rendering of the graphic.
In this optional implementation manner, based on json data corresponding to each element, drawing each element on an interface of a browser end by using a preset rule to present the modelica model includes: determining the type of a component for the components forming the modelica model; if the type of the component is a single-level component, drawing each element on an interface of a browser end by using a preset rule based on a corresponding json data structure; if the type of the assembly is a multi-layer assembly formed by nesting and combining single-layer assemblies, analyzing the multi-layer assembly to obtain a plurality of single-layer assemblies forming the multi-layer assembly; and drawing each hierarchical model on the interface of the browser end by using a preset rule based on json data corresponding to a plurality of single-level components forming the multi-level component so as to obtain the multi-level component.
In the optional implementation manner, the single-level component is composed of description information, a graph and a port, the multi-level component is formed by nesting and combining the single-level components, and when the multi-level model is rendered, the nested single-level models can be rendered according to a preset sequence. It is understood that the structure of each model at multiple levels is fixed, the structure of each model at multiple levels is different, and the rendering order of each model at multiple levels is different, which can be determined by the physical structure.
As an optional implementation manner of this embodiment, based on json data corresponding to each element, drawing each element on an interface of a browser end by using a preset rule to present the modelica model includes: generating json data which accords with the transmission protocol aiming at the single-layer assembly; traversing the json data to read the simple name of the component and first information in the information of the component attribute when analyzing the json data; drawing the component based on the content indicated by the information; after second information of the component attribute data is read, drawing a graph of the component based on the content indicated by the second information; and after the third information of the component attribute data is read, drawing the port of the component based on the content indicated by the third information.
In this optional implementation manner, the single-level component rendering method may include the following steps: based on a JSON-MO protocol, a Modelica component can be regarded as a specific JSON structure, the JSON comprises model description information, model graphic information and model input and output port information, a JSON data structure is traversed sequentially, when ident, description and editable related keys are read, traversal is stopped, text label elements in svg are used for drawing, and text content is filled in, so that rendering of the model description information can be completed; continuously traversing the data structure, stopping traversing when the keys related to icon, diagram and component are read, and then drawing the graph by referring to a graph rendering method to finish the rendering of the model graph; and continuously traversing the data structure, stopping traversing when relevant keys such as a port, a visual and the like are read, drawing by referring to a graph rendering method, finishing the rendering of the model port, finishing the traversing and finishing the rendering of the component.
Furthermore, the components all comprise ports, the ports comprise port checking information, port graphic information and port description information, the information is very important in the modeling process, so that the ports need to be correctly identified and rendered, based on a JSON-MO protocol, the port identification is set for the ports to clarify the part of the ports in the model, the ports are very flexible and easy to identify, and the ports also belong to one part of the components, so that after the ports are identified, the ports are rendered based on the rendering method of the components. Referring to fig. 2, an effect diagram of a port at rendering.
The JSON-MO data expression protocol for describing the Modelica model is realized by using a lightweight JSON data transmission format, remote transmission can be performed on http and websocket network protocols based on the JSON-MO data expression protocol as a data exchange format of the Modelica model, so that the purpose of on-line rendering of the Modelica model is realized, and a basis is laid for on-line modeling and simulation of the Modelica by safely and efficiently browsing the Modelica model on a browser and conveniently modeling in real time.
The embodiment overcomes the problems of slow data transmission, inconvenient reading, difficult expansion and slow model rendering caused by realizing the model rendering through the xml text in the related technology
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
According to an embodiment of the present disclosure, there is also provided an apparatus for implementing the online rendering method, the apparatus including: the determining unit is configured to determine elements forming the modelica model after the server receives a modelica model acquisition request sent by a browser; the data generating unit is configured to generate json data structures corresponding to the elements aiming at the elements and a preset protocol; and the rendering unit is configured to draw each element on the interface of the browser end by using a preset rule based on json data corresponding to each element so as to present the modelica model.
The embodiment of the present disclosure provides an electronic device, as shown in fig. 3, the electronic device includes one or more processors 31 and a memory 32, where one processor 31 is taken as an example in fig. 3.
The controller may further include: an input device 33 and an output device 34.
The processor 31, the memory 32, the input device 33 and the output device 34 may be connected by a bus or other means, and fig. 3 illustrates the connection by a bus as an example.
The processor 31 may be a Central Processing Unit (CPU). The processor 31 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or any combination thereof. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 32, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the control methods in the embodiments of the present disclosure. The processor 31 executes various functional applications of the server and data processing by running non-transitory software programs, instructions and modules stored in the memory 32, i.e. implements the method of the above-described method embodiment.
The memory 32 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of a processing apparatus operated by the server, and the like. Further, the memory 32 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 32 may optionally include memory located remotely from the processor 31, which may be connected to a network connection device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 33 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the processing device of the server. The output device 34 may include a display device such as a display screen.
One or more modules are stored in the memory 32, which when executed by the one or more processors 31 perform the method as shown in fig. 1.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program to instruct related hardware, and the program can be stored in a computer readable storage medium, and when executed, the program can include the processes of the embodiments of the motor control methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-only memory (ROM), a Random Access Memory (RAM), a flash memory (flash memory), a hard disk (hard disk drive, abbreviated as HDD) or a Solid State Drive (SSD), etc.; the storage medium may also comprise a combination of memories of the kind described above.
Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations fall within the scope defined by the appended claims.
Claims (10)
1. A method for online rendering of a model, the method comprising:
after receiving a modelica model acquisition request sent by a browser end, a server end determines elements forming the modelica model;
generating a json data structure corresponding to each element aiming at each element and a preset protocol;
and drawing each element on the interface of the browser end by using a preset rule based on json data corresponding to each element so as to present the modelica model.
2. The method of model online rendering of claim 1, the method further comprising:
in the modeling process, after the server receives the data of the modelica model sent by the browser, the server determines elements forming the modelica model.
3. The method of model online rendering of claim 1, the method further comprising: determining the preset protocol based on json, wherein the preset protocol can be operated in the same process of at least one message transmission environment to realize the transmission of the modelica model, and the structure of the preset protocol determined based on json comprises the following steps:
information for representing graphic drawing data;
information representing attributes of the component;
the device comprises a connecting line graph information used for representing port connection generated between components, wherein the connecting line graph information comprises information of two ports and graph information of a line;
and/or, the graphic information used for representing the model, wherein the model comprises an icon of the model, a graphic contained by the model, all components under the model and a connecting line.
4. The method for model online rendering of claim 1, wherein determining the elements that make up the modelica model comprises:
and analyzing the physical structure of the modelica model to obtain components, connecting lines among the components and/or graphs forming the modelica model.
5. The online model rendering method according to claim 3, wherein drawing each element on a browser-side interface by using a preset rule to present the modelica model based on json data corresponding to each element comprises:
generating json data conforming to the transmission protocol aiming at the graphs contained in the modelica model;
traversing the json data when analyzing the json data so as to read a field representing a graphic shape in the information of the graphic drawing data;
drawing the graph shape based on the value corresponding to the field;
in the traversing process, when a value representing a graphic position in the information of the graphic drawing data is read, setting the geometric information of the graphic position;
in the traversing process, when a value representing a graphic style in the information of the graphic drawing data is read, setting the style of the graphic;
and/or during the traversal, when the text information for describing the graph in the information of the graph drawing data is read, drawing the text information.
6. The online model rendering method according to claim 3, wherein the drawing, by using a preset rule, each element on a browser-side interface to present the modelica model based on json data corresponding to each element comprises:
determining the type of a component for the components forming the modelica model;
if the type of the component is a single-level component, drawing each element on an interface of a browser end by using a preset rule based on a corresponding json data structure;
if the type of the assembly is a multi-layer assembly formed by nesting and combining single-layer assemblies, analyzing the multi-layer assembly to obtain a plurality of single-layer assemblies forming the multi-layer assembly;
and drawing each single-layer model on an interface of a browser end by using a preset rule based on json data corresponding to a plurality of single-layer components forming the multi-layer component so as to obtain the multi-layer component.
7. The online model rendering method according to claim 6, wherein the drawing, by using a preset rule, each element on a browser-side interface to present the modelica model based on json data corresponding to each element comprises:
generating json data which accords with the transmission protocol aiming at the single-layer assembly;
traversing the json data to read the simple name of the component and first information in the information of the component attribute when analyzing the json data; drawing the component based on the content indicated by the information;
after second information of the component attribute data is read, drawing a graph of the component based on the content indicated by the second information;
and after the third information of the component attribute data is read, drawing the port of the component based on the content indicated by the third information.
8. An apparatus for rendering a model on-line, comprising:
the determining unit is configured to determine elements forming the modelica model after the server receives a modelica model acquisition request sent by a browser;
the data generating unit is configured to generate json data structures corresponding to the elements according to the elements and a preset protocol;
and the rendering unit is configured to draw each element on the interface of the browser end by using a preset rule based on json data corresponding to each element so as to present the modelica model.
9. A computer-readable storage medium storing computer instructions for causing a computer to perform the method for online rendering of a model according to any one of claims 1-7.
10. An electronic device, comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to cause the at least one processor to perform the model online rendering method of any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210282126.7A CN114637939A (en) | 2022-03-21 | 2022-03-21 | Online rendering method and device of model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210282126.7A CN114637939A (en) | 2022-03-21 | 2022-03-21 | Online rendering method and device of model |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114637939A true CN114637939A (en) | 2022-06-17 |
Family
ID=81949027
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210282126.7A Pending CN114637939A (en) | 2022-03-21 | 2022-03-21 | Online rendering method and device of model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114637939A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115130042A (en) * | 2022-08-31 | 2022-09-30 | 南京远思智能科技有限公司 | Graphical modeling method using Modelica web |
CN116991531A (en) * | 2023-09-27 | 2023-11-03 | 中汽数据(天津)有限公司 | Cloud rendering method, device, equipment and medium |
-
2022
- 2022-03-21 CN CN202210282126.7A patent/CN114637939A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115130042A (en) * | 2022-08-31 | 2022-09-30 | 南京远思智能科技有限公司 | Graphical modeling method using Modelica web |
CN115130042B (en) * | 2022-08-31 | 2022-11-08 | 南京远思智能科技有限公司 | Graphical modeling method using Modelica web |
CN116991531A (en) * | 2023-09-27 | 2023-11-03 | 中汽数据(天津)有限公司 | Cloud rendering method, device, equipment and medium |
CN116991531B (en) * | 2023-09-27 | 2024-06-25 | 中汽数据(天津)有限公司 | Cloud rendering method, device, equipment and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102915375B (en) | A kind of webpage loading method based on layout subregion | |
CN114637939A (en) | Online rendering method and device of model | |
CN106484408A (en) | A kind of node relationships figure display methods based on HTML5 and system | |
US8381094B1 (en) | Incremental visual comparison of web browser screens | |
US9152619B2 (en) | System and method for constructing markup language templates and input data structure specifications | |
CN111459501B (en) | SVG-based Web configuration picture storage and display system, method and medium | |
CN111240669B (en) | Interface generation method and device, electronic equipment and computer storage medium | |
CN104063407A (en) | Browser architecture based on cloud computing and analysis method | |
CN112100123B (en) | Method for layering and displaying large-data-volume CAD (computer aided design) files at front end of Web | |
JP2022166215A (en) | Method for training text positioning model and method for text positioning | |
CN116257715A (en) | Attribute rendering method of Modelica model in web environment | |
CN116245052A (en) | Drawing migration method, device, equipment and storage medium | |
US20130191809A1 (en) | Graphical representation of an order of operations | |
CN113345048B (en) | Geographic information image editing method and device and computer equipment | |
US10614158B2 (en) | Methods and systems for state-based web framework architecture | |
CN111666735A (en) | Image text label display method and device and storage medium | |
CN114627226A (en) | Online modeling method and device | |
CN110866056B (en) | Method, device and equipment for processing lightweight STEP file | |
CN102110166B (en) | Browser-based body 3D (3-demensional) visualizing and editing system and method | |
CN111209359A (en) | EMS transformer graph model access GIS platform icon self-adaption system and method | |
Milovanovic et al. | Python Data Visualization Cookbook | |
US10546559B2 (en) | Multi-layer rendering for visualizations | |
CN111125587B (en) | Webpage structure optimization method, device, equipment and storage medium | |
CN111061971B (en) | Method and device for extracting information | |
Rossi et al. | 3D Digital Models/Accessibility and Inclusive Fruition |
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 |