Virtual ruler generation method and device based on touch, equipment and storage medium
By detecting touch data on the touch screen, identifying measurement events and analyzing trajectories, and generating virtual rulers, the problem of cumbersome polygon measurement operations in the prior art is solved, and the continuity of user experience and explanation is improved.
Patent Information
- Application Number
- CN202411027450.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-15
AI Technical Summary
When users measure objects such as polygons, existing touch screen technology requires measuring edge by side or selecting them to view information. The operation is cumbersome, especially in explanation scenarios, it is easy to interrupt the lecture progress.
By detecting touch data, identifying touch events, entering the measurement state, analyzing the trajectory to determine the linear segment, generating a virtual ruler and displaying measurement information, simplifying the operation process.
It realizes automatic analysis of trajectory to determine straight line segments, generates virtual rulers and displays measurement information, which is simple and fast, reducing user interruptions during explanations and improving user experience.
Smart Images

Figure CN118963636A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of touch technology, and in particular to a touch-based virtual ruler generation method, device, equipment and storage medium. Background Art
[0002] With the development of touch screen technology, touch screens have been widely used in various electronic devices, such as smart phones, tablet computers and electronic large screens, etc. Existing touch screens mainly include resistive touch screens, capacitive touch screens and optical touch screens, which can detect the user's touch position and perform operations such as writing or drawing.
[0003] Currently, applications based on touch screen technology have certain limitations. For example, when a user is in touch mode and is writing or drawing to generate an object, assuming that the generated object is a polygon, if the user wants to measure the length of each side of the polygon and other related information, the user needs to call the measurement tool to measure each side one by one, or needs to select the sides of the polygon one by one and then check the attribute information, check the length and other related information, which is very cumbersome and can easily interrupt the teaching progress in a math class or other teaching scenario. Summary of the invention
[0004] The embodiments of the present application provide a touch-based virtual ruler generation method, device, equipment and storage medium to solve at least one problem existing in the related art. The technical solution is as follows:
[0005] In a first aspect, an embodiment of the present application provides a method for generating a virtual ruler based on touch, comprising:
[0006] detecting touch data, and identifying a touch event according to the touch data;
[0007] When the touch event is a measurement event, entering a measurement state;
[0008] In the measurement state, performing trajectory analysis on the touch data to determine at least one straight line segment;
[0009] A virtual ruler is generated according to the straight line segment, and measurement information of the virtual ruler is displayed.
[0010] In one implementation, the detecting touch data and identifying a touch event according to the touch data includes:
[0011] Detecting the coordinate values of each touch point and the touch time value corresponding to the touch action to obtain touch data;
[0012] Perform movement feature recognition on the touch data to determine a touch event.
[0013] In one implementation, performing movement feature recognition on the touch data to determine a touch event includes:
[0014] Determining whether the touch points are connected according to the coordinate values of the touch points;
[0015] When the touch points are connected, determining the elapsed time according to the touch time value of the first touch point and the touch time value of the last touch point;
[0016] The moving speed is determined based on the elapsed time and the total number of touch points. When the moving speed is less than a speed threshold, the touch event is determined to be a measurement event. Alternatively, when the elapsed time is greater than a time threshold, the touch event is determined to be a measurement event or a determination option for the measurement event is displayed. In response to a click operation on the determination option, the touch event is determined to be a measurement event.
[0017] In one implementation, the touch data includes a plurality of touch points; and in the measurement state, performing trajectory analysis on the touch data to determine at least one straight line segment includes:
[0018] Analyze the coordinate values of each of the touch points to determine the analysis results of the segmentation points;
[0019] When the analysis result indicates that there is no segmentation point, the touch track formed by each of the touch points is determined as a straight line segment;
[0020] When the analysis result indicates that there is a segmentation point, at least one straight line segment is determined according to the segmentation point and the touch track formed by each of the touch points.
[0021] In one implementation, analyzing the coordinate values of each of the touch points to determine the analysis results of the segmentation points includes:
[0022] Determining the curvature of each of the touch points according to the coordinate values of each of the touch points;
[0023] comparing each of the curvatures with a curvature threshold, respectively;
[0024] When the curvature is greater than or equal to the curvature threshold, the touch point corresponding to the curvature is used as a segmentation point to obtain an analysis result indicating the existence of the segmentation point;
[0025] When the curvature is less than the curvature threshold, an analysis result indicating that no segmentation point exists is obtained.
[0026] In one implementation, generating a virtual ruler according to the straight line segment and displaying measurement information of the virtual ruler includes:
[0027] determining the length and angle of the straight line segment according to the coordinate value of the first touch point and the coordinate value of the last touch point on the straight line segment, and using the length and the angle as measurement information of the virtual ruler;
[0028] Determine the actual position of the straight line segment, and generate a virtual ruler according to the actual position;
[0029] The measurement information of the virtual ruler is displayed.
[0030] In one implementation, generating a virtual ruler according to the actual position includes:
[0031] Get the icon of the virtual ruler from the database;
[0032] According to the measurement information, adjust the length and angle of the icon of the virtual ruler;
[0033] An icon of an adjusted virtual ruler is generated according to the actual position.
[0034] In a second aspect, an embodiment of the present application provides a touch-based virtual ruler generation device, comprising:
[0035] A detection module, used to detect touch data and identify touch events according to the touch data;
[0036] A measuring module, configured to enter a measuring state when the touch event is a measuring event;
[0037] An analysis module, configured to perform trajectory analysis on the touch data in the measurement state to determine at least one straight line segment;
[0038] The display module is used to generate a virtual ruler according to the straight line segment and display measurement information of the virtual ruler.
[0039] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory, wherein the memory stores instructions, and the instructions are loaded and executed by the processor to implement a method in any one of the above-mentioned embodiments.
[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed, the method in any one of the above-mentioned embodiments is implemented.
[0041] The beneficial effects of the above technical solution include at least:
[0042] By detecting touch data, a touch event is identified according to the touch data. When the touch event is a measurement event, the measurement state is entered. In other cases, the measurement state is not entered to prevent interference with other operations performed by the user. In the measurement state, a trajectory analysis is performed on the touch data to determine at least one straight line segment, a virtual ruler is generated according to the straight line segment, and measurement information of the virtual ruler is displayed. The trajectory is automatically analyzed to determine the straight line segment, thereby generating a virtual ruler and displaying the measurement information. The operation is simple and fast, and the occurrence of interruptions to the explanation accuracy is reduced, which is conducive to improving the user experience.
[0043] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present application will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in the present application and should not be regarded as limiting the scope of the present application.
[0045] Figure 1 This is a schematic diagram of the steps of a method for generating a virtual ruler based on touch according to an embodiment of the present application;
[0046] Figure 2 A schematic diagram of a graph and a straight line segment of an embodiment of the present application;
[0047] Figure 3 A schematic diagram of a graphic and a virtual ruler according to an embodiment of the present application;
[0048] Figure 4 This is a structural block diagram of a touch-based virtual ruler generating device according to an embodiment of the present application;
[0049] Figure 5 This is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0050] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the spirit or scope of the present application. Therefore, the drawings and descriptions are considered to be exemplary and non-restrictive in nature.
[0051] Reference Figure 1, a flowchart of a touch-based virtual ruler generation method according to an embodiment of the present application is shown. The touch-based virtual ruler generation method may at least include steps S100-S400:
[0052] S100: Detect touch data, and identify a touch event according to the touch data.
[0053] S200: When the touch event is a measurement event, enter a measurement state.
[0054] S300 : In the measurement state, performing trajectory analysis on touch data to determine at least one straight line segment.
[0055] S400: Generate a virtual ruler according to the straight line segment, and display measurement information of the virtual ruler.
[0056] The touch-based virtual ruler generation method of the embodiment of the present application can be executed by a computer, a mobile phone, a tablet, an electronic large screen, etc., or by a cloud server. In the embodiment of the present application, an electronic large screen with a touch screen is used as an example for description.
[0057] The technical solution of the embodiment of the present application detects touch data, identifies touch events based on the touch data, enters a measuring state when the touch event is a measuring event, and does not enter a measuring state in other cases to prevent interference with other operations performed by the user; in the measuring state, performs trajectory analysis on the touch data to determine at least one straight line segment, generates a virtual ruler based on the straight line segment, and displays measurement information of the virtual ruler, automatically analyzes the trajectory to determine the straight line segment, thereby generating a virtual ruler and displaying measurement information, the operation is simple and quick, reduces the occurrence of interruptions to the explanation accuracy, and is conducive to improving user experience.
[0058] In one embodiment, step S100 includes steps S110-S120:
[0059] S110 , detecting coordinate values and touch time values of each touch point corresponding to the touch action to obtain touch data.
[0060] Optionally, the user can use a finger or a stylus to perform a touch action on the touch screen of the electronic large screen. The sensor of the electronic large screen can detect several touch points corresponding to the touch action. The processor determines the coordinate value of each touch point, the touch time value corresponding to each coordinate value, the pressure value and other data based on the detection of the sensor, thereby obtaining the touch data. The set of coordinate values of each touch point is the touch trajectory.
[0061] It should be noted that the processor can pre-process the touch data, such as filtering the collected touch data for noise and removing environmental interference; using a filtering algorithm to smooth the touch data to ensure the stability and accuracy of the data; using the IQR method to remove outliers in the coordinate values; data interpolation: using linear interpolation to fill in missing coordinate values; applying a filtering algorithm: applying a low-pass filter to further remove high-frequency noise; and data normalization: normalizing the filtered data.
[0062] S120: Perform movement feature recognition on the touch data to determine a touch event.
[0063] Optionally, the method specifically includes steps S1201-S1203:
[0064] S1201. Determine whether the touch points are connected according to the coordinate values of the touch points.
[0065] Optionally, based on the coordinate value of each touch point, determine whether the coordinate values between two touch points have the same horizontal coordinate or vertical coordinate. If so, it means that the two touch points are connected, otherwise they are disconnected, thereby determining whether the touch points are connected. For example, the coordinate value of touch point A is (X1, Y1), and the coordinate value of touch point B is (X1, Y2) or (X2, Y1). At this time, if the horizontal coordinate or the vertical coordinate is the same, it is considered that touch point A and touch point B are connected. By determining whether the touch points are connected in the same way, it is possible to determine whether the touch track is connected.
[0066] S1202: When the touch points are connected, determine the elapsed time according to the touch time value of the first touch point and the touch time value of the last touch point.
[0067] Optionally, when the touch points are connected, that is, the touch trajectory is connected, based on the touch time value of the first touch point and the touch time value of the last touch point in the touch trajectory, the difference between the touch time value of the last touch point and the touch time value of the first touch point is calculated to determine the elapsed time.
[0068] S1203. Determine the moving speed according to the elapsed time and the total number of touch points. When the moving speed is less than the speed threshold, determine the touch event as a measurement event. Alternatively, when the elapsed time is greater than the time threshold, determine the touch event as a measurement event or display a determination option for the measurement event. In response to a click operation on the determination option, determine the touch event as a measurement event.
[0069] Optionally, the moving speed is determined according to the ratio of the elapsed time to the total number of touch points. Then, because in general, when the user needs to measure, the speed will be slowed down in order to maintain a straight line as much as possible, the speed factor can be used as the basis for analysis; specifically, a speed threshold is set based on experience or actual conditions, and when the moving speed is less than the speed threshold, the touch event is determined to be a measurement event. In another embodiment, since the speed varies from person to person, a time threshold can be set. Usually, when writing or drawing, the touch points will be disconnected, that is, incoherent. If they are coherent and maintained for a period of time, the probability of a measurement event is very high. Therefore, when the elapsed time is greater than the time threshold, the touch event is directly determined to be a measurement event; and in order to be more secure, a determination option for the measurement event can also be displayed at this time. If the user is determined, click the determination option, and in response to the click operation of the determination option, the touch event is determined to be a measurement event.
[0070] In one embodiment, a preset touch action corresponding to a measurement event may be set in advance. For example, if the touch data is analyzed to satisfy one of single-point touch, double-click, long press, slide, drag, zoom, and rotation, it is considered to be a preset touch action, and is then determined as a measurement event. For example, if the touch time value is less than a preset threshold (e.g., 500 milliseconds) in the touch data, and the total moving distance of each touch point is less than a distance threshold (e.g., 10 pixels), it is determined to be a single-point touch action.
[0071] In one implementation, when the touch event is determined to be a measurement event, the electronic large screen enters a measurement state.
[0072] In one implementation, step S300 includes steps S310-S330:
[0073] S310: Analyze the coordinate values of each touch point to determine the analysis results of the segmentation points.
[0074] Optionally, steps S3101-S3103 are included:
[0075] S3101. Determine the curvature of each touch point according to the coordinate values of each touch point.
[0076] S3102. Compare each curvature with the curvature threshold respectively.
[0077] Optionally, the processor of the electronic large screen calculates the curvature of each touch point according to the coordinate values of each touch point using an existing curvature calculation formula, and then compares the curvature of each touch point with a curvature threshold value, the value of which is set based on experience or actual conditions.
[0078] S3103: When the curvature is greater than or equal to the curvature threshold, the touch point corresponding to the curvature is used as a segmentation point to obtain an analysis result indicating that a segmentation point exists; when the curvature is less than the curvature threshold, an analysis result indicating that no segmentation point exists is obtained.
[0079] Optionally, when the curvature is greater than or equal to the curvature threshold, or the touch point deviates to a certain extent from the previous touch point, the touch point corresponding to the curvature greater than or equal to the curvature threshold is used as a segmentation point, and finally one or more touch points as segmentation points can be determined to obtain an analysis result indicating the existence of segmentation points. When the curvature is less than the curvature threshold, an analysis result indicating the absence of segmentation points is obtained.
[0080] For example, Figure 2 As shown, assuming that a graphic 21 is displayed on the touch screen of the electronic large screen, and assuming that the user's touch tracks are 22, 23, and 24, the touch points at the two ends of the line 23 can be determined as segmentation points.
[0081] S320: When the analysis result indicates that there is no segmentation point, the touch track formed by each touch point is determined as a straight line segment.
[0082] Optionally, if the analysis result indicates that there is no segmentation point, the touch track formed by each touch point is directly determined as a straight line segment. Figure 2 As shown, if the touch track is only line 22, no segmentation point can be found, and line 22 is directly determined as a straight line segment.
[0083] S330: When the analysis result indicates that there is a segmentation point, determine at least one straight line segment according to the segmentation point and the touch track formed by each touch point.
[0084] Optionally, when the analysis result indicates that there are segmentation points, the touch track formed by each touch point is segmented according to the segmentation points, thereby determining at least one straight line segment. Figure 2 As shown, the touch points at the two ends of line 23 are segmentation points, so three straight line segments can be determined eventually, namely line 22, line 23 and line 24.
[0085] It should be noted that after segmentation based on touch points, a straight line equation can be constructed based on any two touch points of each line segment. When the number of other touch points of the line segment located on the straight line equation is greater than a preset number, the line segment is determined to be a straight line segment, and other touch points not on the straight line equation can be corrected based on the straight line equation to update the touch points. Alternatively, the similarity between each line segment and a preset straight line can be determined, and when the similarity is greater than a similarity threshold, the line segment is determined to be a straight line segment.
[0086] In one implementation, step S400 includes steps S410-S430:
[0087] S410: Determine the length and angle of the straight line segment according to the coordinate value of the first touch point and the coordinate value of the last touch point on the straight line segment, and use the length and angle as measurement information of the virtual ruler.
[0088] Optionally, the length and angle of the straight line segment are determined according to the coordinate value of the first touch point and the coordinate value of the last touch point on the straight line segment, and the length and angle are used as measurement information of the virtual ruler to be generated.
[0089] S420: Determine the actual position of the straight line segment, and generate a virtual ruler according to the actual position.
[0090] Optionally, the actual position of the straight line segment is determined, and then a virtual ruler parallel to the straight line segment can be generated at a preset distance from the actual position to enhance the realism of the measurement.
[0091] Optionally, when generating a virtual ruler, the processor may obtain a virtual ruler icon from a database in advance. Since the size of the icon is fixed and may not be adapted to the current straight line segment, in order to improve the display effect, the length and angle of the virtual ruler icon are adjusted according to measurement information such as length and angle, and then the adjusted virtual ruler icon parallel to the straight line segment is generated at a preset distance from the actual position. For example, Figure 2 and Figure 3 As shown, taking lines 22 and 24 as examples, icons 25 and 26 of virtual rulers are generated correspondingly to restore the real experience of measuring with a ruler.
[0092] S430: Display measurement information of the virtual ruler.
[0093] Then, if Figure 3 As shown, the measurement information such as the length and angle of each virtual ruler (icon 25, 26) can be displayed in a marked manner, so as to obtain the length and angle of the two sides of the graphic 21, and complete the automatic measurement based on the virtual ruler.
[0094] Optionally, the generated virtual ruler can be calibrated based on user feedback or automatically. For example, a reference standard of known length and angle is automatically selected for calibration; the reference standard is measured using the virtual ruler, the measurement result is recorded, and then the error between the measurement result and the actual value of the reference standard is calculated as the error. The processor analyzes the source of the error to determine whether it is a systematic error or a random error. If it is a systematic error, the error is adjusted by correcting system parameters (such as calibration coefficients, sensor sensitivity, etc.). For example, if the measurement results are generally low, the calibration coefficient can be increased to compensate for the error.
[0095] Reference Figure 4, shows a structural block diagram of a touch-based virtual ruler generation device according to an embodiment of the present application, and the device may include:
[0096] A detection module, used to detect touch data and identify touch events according to the touch data;
[0097] A measuring module, used for entering a measuring state when a touch event is a measuring event;
[0098] An analysis module, used for performing trajectory analysis on the touch data in a measurement state to determine at least one straight line segment;
[0099] The display module is used to generate a virtual ruler according to the straight line segment and display the measurement information of the virtual ruler.
[0100] The functions of each module in each device in the embodiments of the present application can be found in the corresponding description in the above method, and will not be repeated here.
[0101] Reference Figure 5 , shows a structural block diagram of an electronic device according to an embodiment of the present application, the electronic device includes: a memory 310 and a processor 320, the memory 310 stores instructions that can be run on the processor 320, and the processor 320 loads and executes the instructions to implement the touch-based virtual ruler generation method in the above embodiment. The number of the memory 310 and the processor 320 can be one or more.
[0102] In one embodiment, the electronic device also includes a communication interface 330 for communicating with external devices and performing data exchange transmission. If the memory 310, the processor 320 and the communication interface 330 are implemented independently, the memory 310, the processor 320 and the communication interface 330 can be interconnected through a bus and complete mutual communication. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0103] Optionally, in a specific implementation, if the memory 310, the processor 320 and the communication interface 330 are integrated on a chip, the memory 310, the processor 320 and the communication interface 330 can communicate with each other through an internal interface.
[0104] An embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the touch-based virtual ruler generation method provided in the above embodiment.
[0105] An embodiment of the present application also provides a chip, which includes a processor for calling and executing instructions stored in the memory from the memory, so that a communication device equipped with the chip executes the method provided by the embodiment of the present application.
[0106] An embodiment of the present application also provides a chip, including: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method provided in the embodiment of the application.
[0107] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting the advanced RISC machines (ARM) architecture.
[0108] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory, and may also include a non-volatile random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available. For example, static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct rambus RAM (DR RAM).
[0109] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
[0110] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example" or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the described specific features, structures, materials or characteristics may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.
[0111] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0112] Any process or method description in the flow chart or otherwise described herein can be understood to represent a module, fragment or portion of a code including one or more executable instructions for implementing the steps of a specific logical function or process. And the scope of the preferred embodiment of the present application includes other implementations, in which the functions may not be performed in the order shown or discussed, including in a substantially simultaneous manner or in a reverse order according to the functions involved.
[0113] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be embodied in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, apparatus or device and execute instructions), or used in combination with these instruction execution systems, apparatuses or devices.
[0114] It should be understood that the various parts of the present application can be implemented with hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented with software or firmware stored in a memory and executed by a suitable instruction execution system. All or part of the steps of the above embodiment method can be completed by instructing the relevant hardware through a program, which can be stored in a computer-readable storage medium, and when the program is executed, it includes one of the steps of the method embodiment or a combination thereof.
[0115] In addition, each functional unit in each embodiment of the present application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the above-mentioned integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. The storage medium can be a read-only memory, a disk or an optical disk, etc.
[0116] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A touch-based virtual ruler generation method, characterized in that: include: detecting touch data, and identifying a touch event according to the touch data; When the touch event is a measurement event, entering a measurement state; In the measurement state, performing trajectory analysis on the touch data to determine at least one straight line segment; A virtual ruler is generated according to the straight line segment, and measurement information of the virtual ruler is displayed.
2. The touch-based virtual ruler generation method according to claim 1, characterized in that: The detecting touch data and identifying a touch event according to the touch data comprises: Detecting the coordinate values of each touch point and the touch time value corresponding to the touch action to obtain touch data; Perform movement feature recognition on the touch data to determine a touch event.
3. The touch-based virtual ruler generation method according to claim 2, characterized in that: The performing movement feature recognition on the touch data to determine the touch event comprises: Determining whether the touch points are connected according to the coordinate values of the touch points; When the touch points are connected, determining the elapsed time according to the touch time value of the first touch point and the touch time value of the last touch point; The moving speed is determined based on the elapsed time and the total number of touch points. When the moving speed is less than a speed threshold, the touch event is determined to be a measurement event. Alternatively, when the elapsed time is greater than a time threshold, the touch event is determined to be a measurement event or a determination option for the measurement event is displayed. In response to a click operation on the determination option, the touch event is determined to be a measurement event.
4. The touch-based virtual ruler generation method according to claim 1, characterized in that: The touch data includes a plurality of touch points; in the case of the measuring state, performing trajectory analysis on the touch data to determine at least one straight line segment includes: Analyze the coordinate values of each of the touch points to determine the analysis results of the segmentation points; When the analysis result indicates that there is no segmentation point, the touch track formed by each of the touch points is determined as a straight line segment; When the analysis result indicates that there is a segmentation point, at least one straight line segment is determined according to the segmentation point and the touch track formed by each of the touch points.
5. The touch-based virtual ruler generation method according to claim 4, characterized in that: The analyzing the coordinate values of each of the touch points to determine the analysis results of the segmentation points includes: Determining the curvature of each of the touch points according to the coordinate values of each of the touch points; comparing each of the curvatures with a curvature threshold, respectively; When the curvature is greater than or equal to the curvature threshold, the touch point corresponding to the curvature is used as a segmentation point to obtain an analysis result indicating the existence of the segmentation point; When the curvature is less than the curvature threshold, an analysis result indicating that no segmentation point exists is obtained.
6. The touch-based virtual ruler generation method according to any one of claims 1 to 5, characterized in that: The generating a virtual ruler according to the straight line segment and displaying the measurement information of the virtual ruler comprises: determining the length and angle of the straight line segment according to the coordinate value of the first touch point and the coordinate value of the last touch point on the straight line segment, and using the length and the angle as measurement information of the virtual ruler; Determine the actual position of the straight line segment, and generate a virtual ruler according to the actual position; The measurement information of the virtual ruler is displayed.
7. The touch-based virtual ruler generation method according to claim 6, characterized in that: Generating a virtual ruler according to the actual position comprises: Get the icon of the virtual ruler from the database; According to the measurement information, adjust the length and angle of the icon of the virtual ruler; An icon of an adjusted virtual ruler is generated according to the actual position.
8. A touch-based virtual ruler generation device, characterized in that: include: A detection module, used to detect touch data and identify touch events according to the touch data; A measuring module, configured to enter a measuring state when the touch event is a measuring event; An analysis module, configured to perform trajectory analysis on the touch data in the measurement state to determine at least one straight line segment; The display module is used to generate a virtual ruler according to the straight line segment and display measurement information of the virtual ruler.
9. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores instructions, and the instructions are loaded and executed by the processor to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed, the method according to any one of claims 1 to 7 is implemented.
