Two-dimensional Simulation Scenario Animation Visualization Method, Device, Equipment and Medium
Through the bitmap-based two-dimensional simulation scene animation visualization method, the economic and time cost problems of using professional software in small-scale simulation systems are solved, and the simulation scene animation visualization is realized with flexible design and rapid development.
Patent Information
- Application Number
- CN202410019771.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-05
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2044-01-05
AI Technical Summary
The prior art uses professional visualization software for simulation scene animation visualization in small-scale simulation systems, which has problems such as high economic cost, long development time and difficulty in personalized customization.
A two-dimensional simulation scene animation visualization method based on bitmap is adopted. By inputting a bitmap, the pixel size and spatial position of the simulation object are determined, the bitmap spatial data is generated, the bitmap is loaded in the simulation program, the timer is set to achieve regular updates and drawing the simulation scene, and the graphic image is updated according to the state and position changes of the simulation object, so as to realize simulation scene animation visualization.
It realizes the visualization of simulation scene animation of small-scale simulation systems, and has the ability to design flexible and customize on demand, reducing development costs and time.
Smart Images

Figure CN117710545B_ABST
Abstract
Description
Technical Field
[0001] The present invention mainly relates to the technical field of computer simulation visualization, and in particular to a method, device, equipment and medium for visualizing two-dimensional simulation scene animation. Background Art
[0002] Computer simulation technology is widely used in the research and analysis of various fields such as society, economy, military, transportation, architecture, and industrial production. During the process of calculating and solving the simulation model by means of a computer, it is usually necessary to visualize the simulation scene and simulation object instances so as to facilitate people to observe and understand the state and behavior of the simulation system. In order to realize the simulation scene animation, people often use professional visualization software to visually display the simulation scene and simulation object instances. However, people need to connect the simulation scene and data to professional visualization software, and even need to perform data format conversion, or re-develop the simulation model in professional visualization software. Using professional software for visualizing simulation scene animation has problems of economic cost and development time cost, and even has requirements and limitations on the content of visualizing simulation scene animation, which cannot meet personalized customization.
[0003] Therefore, it is not suitable to use professional visualization software to design and develop simulation scene animation for small-scale simulation systems. And a simple and easy-to-use simulation scene animation visualization method that supports flexible design and on-demand customized development is more suitable for visualizing the simulation scene animation of small-scale simulation systems. Summary of the Invention
[0004] In view of the visualization requirements of the simulation scene animation of small-scale simulation systems, the present invention provides a method, device, equipment and medium for visualizing two-dimensional simulation scene animation.
[0005] The technical solution adopted by the present invention is as follows:
[0006] On the one hand, a method for visualizing two-dimensional simulation scene animation is provided, including:
[0007] Input a bitmap, determine the pixel size and spatial position of the bitmap and the simulation object described by the graphic image in the bitmap, and generate bitmap space data;
[0008] Load the bitmap in the simulation program, obtain the current brush of the simulation program view, and initialize the memory brush and memory canvas of the simulation program view according to the bitmap;
[0009] Set a timer to periodically update and draw the current simulation scene in the simulation program view;
[0010] Read the bitmap space data, obtain the bitmap and the pixel size and pixel position of the simulation object described by the graphics and images in the bitmap, initialize the data of the simulation object in the current simulation scene, and generate a simulation object instance;
[0011] Draw the graphics and images of the simulation object instance in the simulation scene with the bitmap as the background map of the simulation scene;
[0012] Update and draw the graphics and images of the simulation object in the simulation scene according to the state and position changes of the simulation object instance, and realize the visualization of the simulation scene animation.
[0013] Furthermore, the method for generating bitmap space data includes:
[0014] Taking the upper left vertex of the bitmap as the origin, the right direction as the positive direction of the abscissa, the lower direction as the positive direction of the ordinate, and using the pixel as the standard unit of spatial distance, establish a spatial coordinate model;
[0015] Determine the pixel size of the bitmap and determine the spatial range of the simulation scene;
[0016] Determine the pixel size and spatial position of the simulation object described by the graphics and images in the bitmap;
[0017] Describe and store the bitmap and the pixel size and spatial position of the simulation object described by the graphics and images in the bitmap in a formatted XML document, which records the basic information of the bitmap and the graphics and images in the bitmap, including: name, position, size, as the bitmap space data.
[0018] Furthermore, initialize the memory brush and memory canvas of the simulation program view according to the bitmap, including: initialize the memory canvas of the simulation program view in bitmap format and load the bitmap using the memory canvas; initialize the memory brush of the simulation program view in the current brush format of the simulation program view and load the memory canvas using the memory brush.
[0019] Furthermore, set a timer to realize the periodic update of the current simulation scene drawn in the simulation program view. The method includes:
[0020] Set a timer and enter the timer timing loop period. At the same time, monitor in real time whether there is a human-computer interaction operation on the simulation program interface;
[0021] Judge whether the current timing period of the timer has ended. If so, paste the memory brush of the simulation program view to the current brush of the simulation program view, update the current simulation scene in the simulation program view, and enter the next new timing period of the timer;
[0022] Determine in real time whether a human-computer interaction operation is detected on the simulation program interface. If so, paste the memory brush of the simulation program view to the current brush of the simulation program view, and update the current simulation scene in the simulation program view.
[0023] Further, when drawing the graphic image of the simulation object instance in the simulation scene with the bitmap as the background image of the simulation scene, draw the graphic image of the simulation object instance at the corresponding position in the simulation scene with the bitmap as the background image of the simulation scene according to the pixel size and spatial position of the simulation object.
[0024] Further, the present invention further includes: temporarily storing the latest simulation scene using the memory brush and the memory canvas, and pasting the latest simulation scene in the memory brush to the current brush of the simulation program view at a set time according to the visualization algorithm to update the simulation scene animation.
[0025] On the other hand, the present invention also provides a two-dimensional simulation scene animation visualization device, including:
[0026] The first module is used to input a bitmap, determine the pixel size and spatial position of the simulation object described by the bitmap and the graphic image in the bitmap, and generate bitmap space data;
[0027] The second module is used to load the bitmap in the simulation program, obtain the current brush of the simulation program view, and initialize the memory brush and the memory canvas of the simulation program view according to the bitmap;
[0028] The third module is used to set a timer to realize periodic update of drawing the current simulation scene in the simulation program view;
[0029] The fourth module is used to read the bitmap space data, obtain the pixel size and pixel position of the simulation object described by the bitmap and the graphic image in the bitmap, initialize the data of the simulation object in the current simulation scene, and generate a simulation object instance;
[0030] The fifth module is used to draw the graphic image of the simulation object instance in the simulation scene with the bitmap as the background image of the simulation scene;
[0031] The sixth module is used to update and draw the graphic image of the simulation object in the simulation scene according to the state and position changes of the simulation object instance to realize the visualization of the simulation scene animation.
[0032] On the other hand, the present invention provides a computer device, including a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the following steps are implemented:
[0033] Input a bitmap, determine the pixel size and spatial position of the simulation object described by the bitmap and the graphic image in the bitmap, and generate bitmap space data;
[0034] Load a bitmap in the simulation program, obtain the current brush of the simulation program view, and initialize the memory brush and memory canvas of the simulation program view according to the bitmap;
[0035] Set a timer to periodically update and draw the current simulation scene in the simulation program view;
[0036] Read the bitmap space data, obtain the pixel size and pixel position of the simulation object described by the bitmap and the graphic images in the bitmap, initialize the data of the simulation object in the current simulation scene, and generate a simulation object instance;
[0037] Draw the graphic image of the simulation object instance in the simulation scene with the bitmap as the background image of the simulation scene;
[0038] Update and draw the graphic image of the simulation object in the simulation scene according to the state and position changes of the simulation object instance, and realize the visualization of the simulation scene animation.
[0039] On the other hand, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0040] Input a bitmap, determine the pixel size and spatial position of the simulation object described by the bitmap and the graphic images in the bitmap, and generate bitmap space data;
[0041] Load a bitmap in the simulation program, obtain the current brush of the simulation program view, and initialize the memory brush and memory canvas of the simulation program view according to the bitmap;
[0042] Set a timer to periodically update and draw the current simulation scene in the simulation program view;
[0043] Read the bitmap space data, obtain the pixel size and pixel position of the simulation object described by the bitmap and the graphic images in the bitmap, initialize the data of the simulation object in the current simulation scene, and generate a simulation object instance;
[0044] Draw the graphic image of the simulation object instance in the simulation scene with the bitmap as the background image of the simulation scene;
[0045] Update and draw the graphic image of the simulation object in the simulation scene according to the state and position changes of the simulation object instance, and realize the visualization of the simulation scene animation.
[0046] In summary, the beneficial technical effects of the present invention are as follows:
[0047] Aiming at the visualization requirement of the simulation scene animation of a small-scale simulation system, the present invention proposes a two-dimensional simulation scene animation visualization method based on a bitmap, so as to simply and quickly realize the flexible design and development of the two-dimensional simulation scene animation visualization. Description of the Drawings
[0048] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on the structures shown in these drawings.
[0049] Figure 1 is the overall framework diagram of the two-dimensional simulation scene animation visualization method provided by an embodiment;
[0050] Figure 2 is the flowchart for periodically updating and drawing the current simulation scene in the simulation program view provided by an embodiment. Detailed Description of the Embodiments
[0051] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0052] In one embodiment, referring to Figure 1 , a two-dimensional simulation scene animation visualization method is provided, including:
[0053] Input a bitmap, determine the pixel size and spatial position of the simulation object described by the bitmap and the graphic images in the bitmap, and generate bitmap space data;
[0054] Load the bitmap in the simulation program, obtain the current brush of the simulation program view, and initialize the memory brush and memory canvas of the simulation program view according to the bitmap;
[0055] Set a timer to periodically update and draw the current simulation scene in the simulation program view;
[0056] Read the bitmap space data, obtain the pixel size and pixel position of the simulation object described by the bitmap and the graphic images in the bitmap, initialize the data of the simulation object in the current simulation scene, and generate a simulation object instance;
[0057] Draw the graphic image of the simulation object instance in the simulation scene with the bitmap as the background map of the simulation scene;
[0058] Update and draw the graphic image of the simulation object in the simulation scene according to the state and position changes of the simulation object instance, and realize the animation visualization of the simulation scene.
[0059] When updating the current simulation scenario in the simulation program view, first use the bitmap mapping method to overwrite and update the previous simulation scenario in the simulation program view, and then draw the graphic image of the simulation object instance in the updated current simulation scenario according to its latest state and position. As the simulation time progresses, the state and position of the simulation object instance change continuously, and at the same time, the simulation scenario is continuously updated and drawn to form the animation visualization effect of the simulation scenario.
[0060] In one embodiment, a method for generating bitmap spatial data is proposed. In essence, it is based on the spatial modeling of bitmap pixels to clarify the spatial size of the two-dimensional simulation scenario and the spatial position and pixel size of simulation objects such as buildings, facilities, and roads described by the graphic images in the bitmap. Specifically, it includes:
[0061] Taking the upper left vertex of the bitmap as the origin, the right direction as the positive direction of the abscissa, the lower direction as the positive direction of the ordinate, and using pixels as the standard unit of spatial distance, establish a spatial coordinate model;
[0062] Determine the pixel size of the bitmap and use it as the spatial range of the simulation scenario;
[0063] Determine the pixel size and spatial position of the simulation objects described by the graphic images in the bitmap;
[0064] Describe and store the bitmap and the pixel size and spatial position of the simulation objects described by the graphic images in the bitmap in a formatted XML document to obtain a bitmap pixel spatial data format file, which is used to format and describe the spatial position information of the simulation scenario and save the spatial data of the simulation scenario objects. The basic information of the bitmap and the graphic images in the bitmap is recorded, including: name, position, size, as the bitmap spatial data.
[0065] Regarding the pixel size and spatial position of the simulation objects described by the graphic images in the bitmap, one embodiment proposes to describe the pixel size and spatial position of the simulation objects described by the graphic images in the bitmap with a rectangle, that is, to determine the spatial position and size of the graphic image through the upper left vertex pixel, pixel width, and pixel height of the graphic image in the bitmap.
[0066] For example, in one embodiment, move the mouse to the upper left vertex of the graphic image in the bitmap in the drawing software to determine the pixel position of the graphic image, and then move the mouse to the lower right vertex of the graphic image to determine the pixel width and height of the graphic image. According to the pixel position of the upper left vertex of the graphic image and the width and height of the graphic image, form a rectangle to determine the spatial position and size of the graphic image in the bitmap. Repeat this step to determine the pixel size and spatial position of all simulation objects such as buildings, infrastructure, places, and roads in the bitmap.
[0067] Record data such as the pixel size of the bitmap and the pixel size and spatial position of the simulated object described by the graphic image in the bitmap into an XML data file. The XML data file records the bitmap number, scene name, bitmap file name, pixel width and height, as well as data such as the building number, name, type, pixel position of the upper left vertex, width and height of the building rectangle, etc.
[0068] In the above embodiment, an XML format file is used to store the pixel spatial position and size data of the bitmap and the graphic image, which supports the initialization of the simulation scene object.
[0069] Establish a simulation scene model according to the bitmap and its bitmap spatial data. The simulation scene model reasonably organizes and manages bitmaps, graphic images, brushes, canvases, scene building objects, and simulation objects, completes the tiled drawing of the bitmap to simulate the scene background, draws simulation objects on the scene background, and copies the drawn simulation scene to the brush of the simulation program view. At the same time, the simulation scene model stores the position information of spatial elements such as buildings and facilities in the scene, can provide scene element information for the simulation model object, and supports the spatial cognition and spatial activities of the simulation object in the scene.
[0070] Initialize the simulation program, including creating brushes and canvases in the simulation program, mainly including the following types: (1) The current brush and canvas of the simulation program view are directly associated with the computer screen resources, that is, the brush and canvas displayed when the simulation program view is explicitly displayed on the screen; (2) The memory brush and memory canvas of the simulation program view exist in the simulation program memory and are used to temporarily store the simulation scene to be explicitly displayed; (3) The background brush and background canvas of the simulation scene model exist in the simulation scene model memory and are used to store the simulation scene background map, and paste the background map tiled to the simulation scene when the simulation scene needs to be updated; (4) The main brush and main canvas of the simulation scene model exist in the memory of the simulation scene model and are used to draw the simulation scene, receive the background map pasted by the background brush, and draw graphic images for the simulation object instance.
[0071] The above several types of brushes and canvases are created during the initialization of the simulation program, and the modes of the brushes and canvases should be compatible with the current brush and canvas of the simulation program view. The background canvas of the simulation scene model is responsible for loading the bitmap file. Under the scheduling of the algorithm, the several types of brushes and canvases draw, update, and transfer the simulation scene to realize the animation visualization of the simulation scene.
[0072] Initialize the memory brush and memory canvas of the simulation program view according to the bitmap, including: initializing the memory canvas of the simulation program view in bitmap format and using the memory canvas to load the bitmap; initializing the memory brush of the simulation program view in the format of the current brush of the simulation program view and using the memory brush to load the memory canvas.
[0073] When the simulation scenario model draws or updates the simulation scenario, it first pastes its background canvas to its main brush, and then loops to draw the graphic images of the simulation object instances. When drawing the graphic images of the simulation object instances in a simulation scenario with a bitmap as the background image of the simulation scenario, according to the pixel size and spatial position of the simulation object, the graphic images of the simulation object instances are drawn at the corresponding positions in the simulation scenario with a bitmap as the background image of the simulation scenario. After the simulation scenario model completes the update drawing of the simulation scenario, it pastes the new simulation scenario to the memory brush of the simulation program view.
[0074] After the memory brush of the simulation program view receives the updated simulation scenario, it should immediately update to the current brush of the simulation program view and be displayed on the computer screen. However, since the calculation speed of the simulation model may be too fast, the simulation scenario is updated too quickly, resulting in the computer screen display resources not being able to keep up with the update speed of the simulation scenario, so that the simulation scenario animation cannot be normally visualized on the computer screen. Therefore, a timer is used in the simulation program to count, and at fixed unit time intervals, the memory brush of the simulation program view is triggered to paste the latest simulation scenario to the current brush of the simulation program view to ensure the normal visualization of the simulation scenario animation. Specifically, referring to Figure 2 , in one embodiment, a timer is set to achieve periodic update and drawing of the current simulation scenario in the simulation program view. The method includes:
[0075] Set a timer and enter the timer timing loop period. At the same time, monitor in real time whether there are human-computer interaction operations on the simulation program interface. The human-computer interaction operations include but are not limited to operations such as moving, covering and restoring on the simulation program interface;
[0076] Judge whether the current timing period of the timer has ended. If so, paste the memory brush of the simulation program view to the current brush of the simulation program view, update the current simulation scenario in the simulation program view, and enter the next new timing period of the timer;
[0077] Judge in real time whether it is detected that there are human-computer interaction operations on the simulation program interface. If so, paste the memory brush of the simulation program view to the current brush of the simulation program view and update the current simulation scenario in the simulation program view;
[0078] Judge whether the simulation program is closed. If so, exit the timer timing and end the process.
[0079] The present invention uses a memory brush and a memory canvas to temporarily store the latest simulation scenario, and according to the visualization algorithm, the latest simulation scenario in the memory brush is pasted to the current brush of the simulation program view at a set moment to update the simulation scenario animation.
[0080] In one embodiment, a simulation program is newly created in Visual Studio software. Select the MFC application and the single-document application type. In the generated class options, select CScrollView as the view base class.
[0081] Initialize the simulation program and create member variables such as the paintbrush and canvas in the simulation program, including the memory paintbrush "CDC_memDC", the memory canvas "CBitmap_memBitMap", and the bitmap "BITMAP_bitMap". The paintbrush and canvas in the simulation program mainly include the following types: (1) The current paintbrush and canvas of the simulation program view, which are directly associated with the computer screen resources, that is, the paintbrush and canvas displayed when the simulation program view is explicitly shown on the screen; (2) The memory paintbrush and memory canvas of the simulation program view, which exist in the simulation program memory and are used to temporarily store the simulation scenarios to be explicitly shown; (3) The background paintbrush and background canvas of the simulation scenario model, which exist in the simulation scenario model memory and are used to store the simulation scenario background map. When the simulation scenario needs to be updated, the background map is tiled and pasted onto the simulation scenario; (4) The main paintbrush and main canvas of the simulation scenario model, which exist in the memory of the simulation scenario model and are used to draw the simulation scenario, receive the background map pasted by the background paintbrush, and draw graphic images for the simulation object instances.
[0082] Load the bitmap in the simulation program and obtain the current paintbrush of the simulation program view. Initialize the memory paintbrush and memory canvas of the simulation program view according to the bitmap: Initialize the memory canvas of the simulation program view in bitmap format and use the memory canvas to load the bitmap; Initialize the memory paintbrush of the simulation program view in the format of the current paintbrush of the simulation program view and use the memory paintbrush to load the memory canvas.
[0083] Set the scaling size of the simulation scenario and set the positions of the vertical and horizontal scroll bars of the simulation program view according to the bitmap size and the scaling size.
[0084] Set a timer to update and draw the simulation scenario in the simulation program view regularly.
[0085] Triggered by the timer or by real-time monitoring of whether there is a human-computer interaction operation on the simulation program interface, update the current simulation scenario in the simulation program view, and paste the memory paintbrush of the simulation program view to the current paintbrush of the simulation program view.
[0086] Next, establish a simulation scenario model, which can include sub-modules such as a simulation scenario painting object class, a simulation scenario building object class, a simulation scenario map object class, a simulation scenario object class, etc., and set according to specific simulation requirements.
[0087] The simulation scenario drawing class sub-module is used to store and manage the background brush, background canvas, main brush, main canvas, bitmap, etc. of the simulation scenario model, and implement the drawing of the simulation scenario and simulation object instances.
[0088] The simulation scenario object class sub-module is used to describe and store the spatial data information of a single simulation scenario object instance.
[0089] The simulation scenario map class sub-module is used to store the spatial data of a series of simulation scenario objects, support simulation model query, and use the spatial object information in the simulation scenario.
[0090] The simulation scenario class sub-module is used to store and manage the simulation scenario drawing class and the simulation scenario map class, and implement the functions of simulation scenario drawing and transmission.
[0091] In one embodiment, the simulation scenario model includes:
[0092] The simulation scenario painting object class sub-module CScenePaint has variables such as the simulation scenario main brush "CDC*_pFrontDC", main canvas "CBitmap*_pFrontBitmap", background brush "CDC*_pBackDC", background canvas "CBitmap*_pBackBitmap", bitmap "BITMAP_bitMap", etc., and implements the drawing of the simulation scenario bitmap background and simulation object instances.
[0093] The simulation scenario building object class sub-module CBuilding has variables such as number "int_nID", name "string_strName", type "int_nType", top-left vertex pixel position "CPoint_pTopLeftPosition", width "int_nWidth", height "int_nHeight", etc., and is used to describe the information of a single graphic image object in the simulation scenario.
[0094] The simulation scenario map object class sub-module CSceneMap has an array variable of buildings "map<int,DMBuilding*>_mapBuildings", which is used to store the spatial position information of graphic image objects such as buildings, infrastructure, roads, etc. in the simulation scenario Figure 1 in this column.
[0095] The simulation scenario object class sub-module CScene describes the simulation scenario-related information, integrates the simulation scenario painting object class and the simulation scenario map class, implements the simulation scenario-related functions, and provides interfaces for simulation scenario drawing, simulation object instance drawing, querying buildings, places, etc. in the scenario for the simulation model framework.
[0096] The simulation object model class sub-module describes information such as the spatial position and state of the simulation object, and completes the designed task activities and interactions.
[0097] The simulation model framework object class sub-module integrally manages simulation object instances and simulation scenario object classes, obtains the memory brush of the program view from the simulation program framework, and passes the memory brush to the simulation scenario object class. When the state of the simulation object instance changes, it investigates the interface of the simulation scenario object class and updates and draws the simulation scenario. After updating and drawing the simulation scenario and the simulation object instance, the simulation scenario object class pastes and draws the latest simulation scenario onto the memory brush of the simulation program view.
[0098] After establishing the simulation program, start the simulation program to run, initialize the simulation scenario and simulation object instances, start the simulation execution, and visualize the simulation scenario animation.
[0099] On the other hand, the present invention also provides a two-dimensional simulation scenario animation visualization device, including:
[0100] The first module is used to input a bitmap, determine the pixel size and spatial position of the simulation object described by the bitmap and the graphic images in the bitmap, and generate bitmap spatial data;
[0101] The second module is used to load the bitmap in the simulation program, obtain the current brush of the simulation program view, and initialize the memory brush and memory canvas of the simulation program view according to the bitmap;
[0102] The third module is used to set a timer to achieve periodic update and drawing of the current simulation scenario in the simulation program view;
[0103] The fourth module is used to read the bitmap spatial data, obtain the pixel size and pixel position of the simulation object described by the bitmap and the graphic images in the bitmap, initialize the data of the simulation object in the current simulation scenario, and generate a simulation object instance;
[0104] The fifth module is used to draw the graphic images of the simulation object instance in the simulation scenario with the bitmap as the background map of the simulation scenario;
[0105] The sixth module is used to update and draw the graphic images of the simulation object in the simulation scenario according to the state and position changes of the simulation object instance, so as to realize the visualization of the simulation scenario animation.
[0106] The implementation methods of the above-mentioned various modules and the construction of the model can all adopt the methods described in any of the foregoing embodiments, and will not be elaborated herein.
[0107] On the other hand, the present invention provides a computer device, which includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps of the two-dimensional simulation scene animation visualization method provided in any of the above embodiments are implemented. The computer device may be a server. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store sample data. The network interface of the computer device is used to communicate with an external terminal through a network connection.
[0108] On the other hand, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the two-dimensional simulation scene animation visualization method provided in any of the above embodiments are implemented.
[0109] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it may include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application may include non-volatile and / or volatile memories. Non-volatile memories may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0110] Matters not described in detail in the present invention are well-known technologies.
[0111] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0112] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the appended claims.
[0113] The above is only the preferred embodiment of the present invention and is not used to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for visualizing two-dimensional simulation scenario animations, characterized in that, including: an input bitmap, determining the pixel size and spatial position of the bitmap and the simulation object described by the graphic image in the bitmap, and generating bitmap spatial data, including: establishing a spatial coordinate model with the top-left vertex of the bitmap as the origin, the right direction as the positive direction of the abscissa, the downward direction as the positive direction of the ordinate, and the pixel as the standard unit of spatial distance; determining the pixel size of the bitmap and determining the spatial range of the simulation scenario; determining the pixel size and spatial position of the simulation object described by the graphic image in the bitmap; describing and storing the pixel size and spatial position of the bitmap and the simulation object described by the graphic image in the bitmap in a formatted XML document, which records the basic information of the bitmap and the graphic image in the bitmap, including: name, position, size, as bitmap spatial data; loading the bitmap in the simulation program, obtaining the current brush of the simulation program view, and initializing the memory brush and memory canvas of the simulation program view according to the bitmap; setting a timer to periodically update and draw the current simulation scenario in the simulation program view; reading the bitmap spatial data, obtaining the pixel size and pixel position of the bitmap and the simulation object described by the graphic image in the bitmap, initializing the data of the simulation object in the current simulation scenario, and generating a simulation object instance; drawing the graphic image of the simulation object instance in the simulation scenario with the bitmap as the background map of the simulation scenario; updating and drawing the graphic image of the simulation object in the simulation scenario according to the state and position changes of the simulation object instance to realize the visualization of the simulation scenario animation.
2. The two-dimensional simulation scene animation visualization method according to claim 1, wherein initializing the memory brush and memory canvas of the simulation program view according to the bitmap, including: initializing the memory canvas of the simulation program view in bitmap format and loading the bitmap using the memory canvas; initializing the memory brush of the simulation program view in the format of the current brush of the simulation program view and loading the memory canvas using the memory brush.
3. The two-dimensional simulation scenario animation visualization method according to claim 1, wherein setting a timer to periodically update and draw the current simulation scenario in the simulation program view, the method including: setting a timer, entering the timing loop period of the timer, and at the same time, real-time monitoring whether there is a human-computer interaction operation on the simulation program interface; judging whether the current timing period of the timer has ended, if so, pasting the memory brush of the simulation program view to the current brush of the simulation program view, updating the current simulation scenario in the simulation program view, and entering the next new timing period of the timer; real-time judging whether it is detected that there is a human-computer interaction operation on the simulation program interface, if so, pasting the memory brush of the simulation program view to the current brush of the simulation program view, and updating the current simulation scenario in the simulation program view.
4. The two-dimensional simulation scene animation visualization method according to claim 1, characterized in that when drawing the graphic image of the simulation object instance in the simulation scenario with the bitmap as the background map of the simulation scenario, according to the pixel size and spatial position of the simulation object, drawing the graphic image of the simulation object instance at the corresponding position in the simulation scenario with the bitmap as the background map of the simulation scenario.
5. The two-dimensional simulation scenario animation visualization method according to claim 1, wherein also including: using the memory brush and memory canvas to temporarily store the latest simulation scenario, and pasting the latest simulation scenario in the memory brush to the current brush of the simulation program view at a set moment according to the visualization algorithm to update the simulation scenario animation.
6. A two-dimensional simulation scene animation visualization device, characterized in that, including: The first module is used to input a bitmap, determine the pixel size and spatial position of the bitmap and the simulation object described by the graphic image in the bitmap, and generate bitmap spatial data, including: Taking the upper left vertex of the bitmap as the origin, the right direction as the positive direction of the abscissa, the lower direction as the positive direction of the ordinate, and using pixels as the standard unit of spatial distance, a spatial coordinate model is established; Determine the pixel size of the bitmap and determine the spatial range of the simulation scene; Determine the pixel size and spatial position of the simulation object described by the graphic image in the bitmap; Describe and store the pixel size and spatial position of the bitmap and the simulation object described by the graphic image in the bitmap in a formatted XML document, which records the basic information of the bitmap and the graphic image in the bitmap, including: name, position, size, as bitmap spatial data; The second module is used to load the bitmap in the simulation program, obtain the current brush of the simulation program view, and initialize the memory brush and memory canvas of the simulation program view according to the bitmap; The third module is used to set a timer to periodically update and draw the current simulation scene in the simulation program view; The fourth module is used to read the bitmap spatial data, obtain the pixel size and pixel position of the bitmap and the simulation object described by the graphic image in the bitmap, initialize the data of the simulation object in the current simulation scene, and generate a simulation object instance; The fifth module is used to draw the graphic image of the simulation object instance in the simulation scene with the bitmap as the background map of the simulation scene; The sixth module is used to update and draw the graphic image of the simulation object in the simulation scene according to the state and position changes of the simulation object instance, and realize the visualization of the simulation scene animation.
7. The two-dimensional simulation scenario animation visualization device according to claim 6, wherein, The third module includes: A monitoring module, used to set a timer, enter the timing loop cycle of the timer, and at the same time monitor in real time whether there is a human-computer interaction operation on the simulation program interface; A judgment and update module, used to judge whether the current timing cycle of the timer has ended. If so, paste the memory brush of the simulation program view to the current brush of the simulation program view, update the current simulation scene in the simulation program view, and enter the next new timing cycle of the timer; at the same time, judge in real time whether it is detected that there is a human-computer interaction operation on the simulation program interface. If so, paste the memory brush of the simulation program view to the current brush of the simulation program view, and update the current simulation scene in the simulation program view.
8. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that: When the processor executes the computer program, the steps of the two-dimensional simulation scene animation visualization method described in claim 1 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, the steps of the two-dimensional simulation scene animation visualization method described in claim 1 are implemented.