CN111538411B - Editing and controlling method, system and terminal of irregular closed polygon - Google Patents

Editing and controlling method, system and terminal of irregular closed polygon Download PDF

Info

Publication number
CN111538411B
CN111538411B CN202010304212.4A CN202010304212A CN111538411B CN 111538411 B CN111538411 B CN 111538411B CN 202010304212 A CN202010304212 A CN 202010304212A CN 111538411 B CN111538411 B CN 111538411B
Authority
CN
China
Prior art keywords
graph
user
class
drawn
view
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.)
Active
Application number
CN202010304212.4A
Other languages
Chinese (zh)
Other versions
CN111538411A (en
Inventor
夏业圣
丁腾飞
鹿中梁
李宗正
刘云
刘丰
闫春强
章飞
王忠山
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Mnai Energy Co ltd
Original Assignee
Shanghai Mnai Energy Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Mnai Energy Co ltd filed Critical Shanghai Mnai Energy Co ltd
Priority to CN202010304212.4A priority Critical patent/CN111538411B/en
Publication of CN111538411A publication Critical patent/CN111538411A/en
Application granted granted Critical
Publication of CN111538411B publication Critical patent/CN111538411B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/0486Drag-and-drop
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/017Gesture based interaction, e.g. based on a set of recognized hand gestures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04842Selection of displayed objects or displayed text elements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04845Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range for image manipulation, e.g. dragging, rotation, expansion or change of colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/206Drawing of charts or graphs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Processing Or Creating Images (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention provides an editing and controlling method of an irregular closed polygon, wherein two View views are arranged in a layout container, one View is used for placing a base map, and the other View is arranged on the base map and used for drawing a graph. Calculating whether the point clicked by the user is in the range of the drawn graph, and if so, selecting the drawn graph in a graph selection class; and carrying out dragging, zooming and rotation control on the selected graph. The invention also provides an editing and controlling system and a terminal of the irregular closed polygon. According to the invention, by selecting the frame for drawing the graph, integrating various operations such as view operation, graph selection, gesture operation and the like, and drawing and redrawing the graph, the selected frame can bring more convenience; after the graphics are well drawn, the redrawn graphics can be kept the same as the graphics drawn by a user during refreshing and redrawing, the requirements of the user can be met, and more functions can be realized.

Description

Editing and controlling method, system and terminal of irregular closed polygon
Technical Field
The invention relates to the technical field of graphic editing, in particular to an editing and control method, system and terminal for an irregular closed polygon.
Background
At present, in each touch mobile device, functions related to random doodling on a picture, such as drawing a line segment, a rectangle or an irregular and curved graph on the picture, are almost supported, but there is no related technology capable of supporting drawing an irregular closed polygon.
The method can support drawing of an irregular closed polygon, has important significance for picture editing, and can really meet the requirements of customers after drawing of the irregular closed polygon.
At present, no explanation or report of the similar technology of the invention is found, and similar data at home and abroad are not collected.
Disclosure of Invention
In view of the above-mentioned shortcomings in the prior art, an object of the present invention is to provide an editing and controlling method, system and terminal for irregular closed polygons, which are directed to provide an editing and controlling technique for irregular closed polygons, so as to implement editing of irregular closed polygons and control of rotation, dragging, enlargement and reduction of the edited graphics.
The invention is realized by the following technical scheme.
According to an aspect of the present invention, there is provided an editing and controlling method for an irregular closed polygon, including:
setting two View views in a layout container;
placing a bottom graph on one View, placing another View on the bottom graph, and overlapping the two View;
creating a basic class, and adding common attributes of graphics to be drawn in the basic class;
creating a view operation class, a graph selection class, a gesture operation class and other classes of the drawn graph; wherein:
the view operation class realizes drawing of graphs;
the graph selection class realizes the selection of the graph;
the gesture operation class monitors gesture operations of a user, and an onDraw method in the View operation class is called, so that a graph can be drawn on a View of the View operation class;
the other classes comprise a tool class and an interface class, the tool class is used for placing a tool method, and the tool method is used for acquiring the coordinate position of a point clicked by a user; the interface method is arranged in the interface class, and the interface method is used for setting a graph color, a graph brush and a graph shape;
after the graph is drawn, calculating whether a point clicked by a user is within the range of the drawn graph or not according to the click of the user, and if so, selecting the drawn graph in a graph selection class;
and carrying out dragging, zooming and rotation control on the selected graph.
Preferably, the layout container is sized by a figure size of the base map, which defines a drawing range in which the figure is drawn.
Preferably, the common attributes include: drawing a graphical brush, the color of the brush, the size of the brush, and the shape of the brush.
Preferably, the method for calculating whether the point clicked by the user is within the range of the drawn graph comprises the following steps:
calculating the position coordinates of the point clicked by the user by utilizing the getX and getY methods of the MotionEvent in the API, combining the coordinates with a graph range after obtaining the coordinates, calculating the numerical values of the vertex coordinates of the graph drawn by the user and the point coordinates clicked by the user on the x and y coordinate axes by utilizing the continain method in the API, comparing, and if the return value of the continain is true, indicating that the point clicked by the user is in the graph range drawn by the user.
Preferably, the method for controlling dragging, zooming out and rotating of the selected graphic comprises:
calculating the positions of each vertex and the central point of the graph, calculating the rotation angle through a trigonometric function, ensuring the shape of the graph to be unchanged, and rotating around the central point of the graph to realize the rotation control of the graph;
calculating the position of a central point of the graphic area, calculating the coordinate of a point where the user finger starts sliding on the screen and the distance change between the coordinate of the point and the coordinate of the point after the user finger finishes sliding according to the gesture operation MotionEvent in the API; according to the distance change, the position of the central point of the graphic area is changed by means of a Canvas transform method in the API, and then the drawing control of the graphic is realized;
calculating the telescopic operation between two fingers of a user, calculating the telescopic operation between the fingers of the user by means of a gesture detection GesturreDetector in the API to obtain the telescopic proportion of the two fingers of the user, and realizing the control of enlarging and reducing the graph by using a scale method of Canvas in the API.
According to another aspect of the present invention, there is provided an editing and control system for irregular closed polygons, comprising:
the layout module of layout is provided with two View views, wherein one View is used for placing a base map, and the other View is used for drawing a graph;
the system comprises a class creating module, a display module and a display module, wherein the class creating module is used for creating a basic class, a view operation class, a graph selection class, a gesture operation class and other classes required by drawing a graph; wherein: the basic class is used for placing common attributes of the graphs to be drawn; the view operation class is used for realizing drawing of graphics; the graph selection class is used for realizing the selection of the graph; the gesture operation class is used for monitoring gesture operation of a user, and drawing a graph on a View of the View operation class by calling an onDraw method in the View operation class; the other classes comprise a tool class and an interface class, wherein the tool class is used for placing tool methods, the tool methods are used for acquiring the coordinate positions of points clicked by a user, the interface class is used for placing interface methods, and the interface methods are used for setting graphic colors, graphic brushes and graphic shapes;
the selection module calculates whether the point clicked by the user is in the range of the drawn graph or not according to the click of the user, and if so, the drawn graph is selected in the graph selection class;
and the control module is used for realizing the control of dragging, amplifying, shrinking and rotating the selected graph.
Preferably, the method for the selection module to calculate whether the point clicked by the user is within the range of the drawn graph is as follows:
calculating coordinates clicked by a user by utilizing getX and getY methods of MotionEvent in the API, combining a graph range after the coordinates are obtained, calculating the values of coordinates of a graph vertex drawn by the user and coordinates of a point clicked by the user on x and y coordinate axes by utilizing a continain method in the API, comparing, and if a continain return value is true, indicating that the point clicked by the user is in the graph range drawn by the user.
Preferably, the method for controlling the control module to drag, enlarge, reduce and rotate the selected graph includes:
calculating the positions of each vertex and the central point of the graph, calculating the rotation angle through a trigonometric function, ensuring the shape of the graph to be unchanged, and rotating around the central point of the graph to realize the rotation control of the graph;
calculating the position of a central point of the graphic area, calculating the coordinate of a point where the user finger starts sliding on the screen and the distance change between the coordinate of the point and the coordinate of the point after the user finger finishes sliding according to the gesture operation MotionEvent in the API; according to the distance change, the position of the central point of the graphic area is changed by means of a Canvas transform method in the API, and then the drawing control of the graphic is realized;
calculating the telescopic operation between two fingers of a user, calculating the telescopic operation between the fingers of the user by means of a gesture detection GesturreDetector in the API to obtain the telescopic proportion of the two fingers of the user, and realizing the control of enlarging and reducing the graph by using a scale method of Canvas in the API.
According to a third aspect of the present invention, there is provided a terminal comprising a memory, a processor and a computer program stored on the memory and operable on the processor, the processor being operable when executing the computer program to perform any of the methods described above.
According to a fourth aspect of the present invention, there is provided another terminal comprising a memory, a processor, and a system according to any one of the preceding claims stored on the memory and executable by the processor.
Compared with the prior art, the invention has the following beneficial effects:
1. according to the editing and controlling method, system and terminal for the irregular closed polygon, provided by the invention, by creating a frame (containing a basic class, a view operation class, a graph selection class and the like) for drawing a graph, various operations such as view operation, graph selection, gesture operation and the like are integrated, and the graph is drawn and redrawn (in the technical aspect, in the gesture operation, the graph is not changed but is a continuous redrawing process, so that the graph cannot be distinguished by naked eyes, and the shape of the graph is not changed), so that more convenience can be brought to the selected frame; the invention can ensure that the redrawn graph and the graph drawn by the user are kept completely the same when refreshing and redrawing after ensuring that the graph is drawn well.
2. Compared with the prior art, the method, the system and the terminal for editing and controlling the irregular closed polygon can better meet the requirements of users and realize more functions.
3. The method, the system and the terminal for editing and controlling the irregular closed polygon can realize the control of dragging, amplifying, shrinking and rotating operations of the graph. The addition and deletion of the graphs can be completed through a view operation class, wherein the addition is that the user can continuously draw the graphs, and the deletion is that the user can delete the selected graphs when selecting the graphs.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments with reference to the following drawings:
FIG. 1 is a flowchart illustrating a method for editing and controlling irregular closed polygons according to an embodiment of the present invention;
FIG. 2 is a block diagram of an editing and control system for irregular closed polygons provided in an embodiment of the present invention;
fig. 3 is a schematic diagram of an editing and controlling process of an irregular closed polygon according to an embodiment of the present invention.
Detailed Description
The following examples illustrate the invention in detail: the embodiment is implemented on the premise of the technical scheme of the invention, and a detailed implementation mode and a specific operation process are given. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention.
The embodiment of the invention provides an editing and controlling method of an irregular closed polygon, which comprises the following steps:
setting two View views in a layout container;
placing a base on one of the View views, and placing another View on the base as if the two View views were overlaid; wherein, the drawn graph is stored on the placed base map to realize the drawing of the graph;
creating a basic class (the class is a java file in the field), and adding some common attributes of the graphics to be drawn in the basic class, such as the width of the graphics edge, the color of the graphics edge, the shape of the graphics, the vertex coordinates Point of the graphics, and the like. The basic class has the functions of putting the common attributes of the graphs together, avoiding the repeated use on codes and improving the high efficiency of the codes; only when the attributes are set (initialized) well, the user can have the graph appear when drawing the graph;
creating a view operation class, a graph selection class, a gesture operation class and other classes of the drawn graph;
in a view operation class, drawing of a graph is realized; that is, the user mainly realizes in the class when drawing by hand; in a view operation class, drawing of a graph is realized;
in the graph selection class, the selection of the graph is realized;
in the gesture operation class, monitoring the gesture operation of a user, calling an onDraw (a method in an API, which is mainly used for drawing a graph) method in the View operation class, and drawing the graph on the View View of the View operation class by the user;
the other classes comprise a tool class and an interface class, wherein the tool class is used for placing a tool method, and the tool method is used for acquiring the coordinate position of a point clicked on the screen by a finger of a user; the interface class is used for placing an interface method, and the interface method is used for setting a graph color, a graph brush and a graph shape;
after the graph is drawn, calculating whether a point clicked by a user is in a graph drawing range or not according to the click of the user and a related algorithm in the API, and if so, selecting the drawn graph in a graph selection class; if not, then there is no reaction, only the user clicks the next View View;
and combining the selected graph with related algorithms in the API to realize the control of dragging, zooming in, zooming out and rotating the graph.
The drawing figures in the embodiment of the invention are irregular closed polygons.
As a preferred embodiment, according to the click of the user, and by combining with the related algorithm and API, calculating whether the point clicked by the user is within the range of the drawing graph, the specific process is as follows: the user clicks the screen, the coordinate clicked by the user is calculated by using a method in the API, the coordinate is combined with a graphic area, the calculation is carried out by using a contact method in the API (the contact method comprises return values of true and false), and if the contact return value is true, the point clicked by the user is in the graphic range drawn by the user; the method for holding specifically comprises the following steps: the coordinates of the vertices of the graph drawn by the user and the coordinates of the points clicked by the user are calculated, and the magnitudes of the values on the x and y coordinate axes are compared.
As a preferred embodiment, the selected graph is combined with a related algorithm in the API to realize the control of dragging, zooming out, and rotating the graph, which specifically comprises the following steps: dragging, namely pressing and holding the drawn graph selected by the user, and sliding the graph on the screen at will, wherein the graph can be followed when the user slides to the place; zooming in and zooming out, namely, selecting a drawn graph by a user, and simultaneously pressing two fingers to zoom in and zoom out; rotating, namely after the user selects the graph, pressing a rotating vertex of the graph (which is already set when the user selects the graph) and rotating the graph for 360 degrees around the central point of the graph; the related algorithm is to obtain the positions of each vertex and center point of the graph during rotation, calculate the rotation angle by using a trigonometric function, and rotate around the center point of the graph while keeping the shape of the graph unchanged.
As a preferred embodiment, the positions of each vertex and a central point of the graph are calculated, the rotating angle is calculated through a trigonometric function, the shape of the graph is ensured to be unchanged, and the graph rotates around the central point of the graph, so that the rotating control of the graph is realized;
calculating the position of a central point of the graphic area, calculating the coordinate of a point where the user finger starts sliding on the screen and the distance change between the coordinate of the point and the coordinate of the point after the user finger finishes sliding according to the gesture operation MotionEvent in the API; according to the distance change, the position of the central point of the graphic area is changed by means of a Canvas transform method in the API, and then the drawing control of the graphic is realized;
calculating the telescopic operation between two fingers of a user, calculating the telescopic operation between the fingers of the user by means of a gesture detection GesturreDetector in the API to obtain the telescopic proportion of the two fingers of the user, and realizing the control of enlarging and reducing the graph by using a scale method of Canvas in the API.
Based on the method for editing and controlling the irregular closed polygon provided by the embodiment of the invention, the embodiment of the invention also provides a system for editing and controlling the irregular closed polygon, which comprises the following steps:
the layout module of layout is provided with two views, wherein one View is used for placing a base map, and the other View is used for drawing a graph;
the system comprises a class creating module, a display module and a display module, wherein the class creating module is used for creating a base class, a view operation class, a graph selection class, a gesture operation class and other classes which are required by drawing a graph; wherein: the base class is used for placing common attributes of the drawing graph; the view operation class is used for drawing the graph; the graph selection class is used for realizing the selection of the graph; the gesture operation class is used for monitoring gesture operation of a user, and drawing a graph on a View of the View operation class by calling a draw method in the View operation class; the other classes comprise a tool class and an interface class, wherein the tool class is used for placing a tool method, and the tool method is used for acquiring the coordinate position of the click of the finger of the user on the screen; the interface class is used for placing an interface method, and the interface method is used for setting a graph color, a graph brush and a graph shape;
the selection module calculates whether the point clicked by the user is in the range of the drawing graph or not by combining a related algorithm in the API according to the click of the user, if so, the drawing graph is selected in the graph selection class, and if not, no reaction is caused, and only the user clicks the lower View;
and the control module combines the selected graph with related algorithms in the API to realize the control of dragging, amplifying, reducing and rotating the graph.
The technical solutions provided by the embodiments of the present invention are further described in detail below with reference to the accompanying drawings.
Fig. 1 is a flow chart of an editing and controlling method of an irregular closed polygon. When the user drags or rotates the graph, the program calls the related method, and the method is executed step by step, so that the effect of user operation is achieved.
FIG. 2 is a diagram of an editing and control system framework for irregular closed polygons, which depicts the interaction between View and user actions. The DoodleView represents the user gesture operation represented by the View and the DoodleOnTouchGestutureListener, and the DoodleView and the DoodleTouchDestector in the IDoodle interface carry out transmission interaction; the IDoodleItem interface contains some attributes of the graphics, such as color, shape, etc. When the user gesture is drawn, a DoodeLEItemBase class and a DoodeLEPath class are called to draw a graph.
Fig. 3 is a schematic diagram illustrating the editing and controlling process of the irregular closed polygon. When a user draws on View, a program calls a gesture to operate DoodeleOnTouchGesturreLi stener to respond to the sliding of the user, obtains a path along which the finger of the user slides through a DrawItem class and a DoodeleItemBase class, and finishes the graph which the user wants to draw by using a DrawPath method of Canvas in an API. After the drawing of the graph is finished, the user can click the selected graph to perform operations such as dragging and rotating.
Based on the method for editing and controlling the irregular closed polygon provided by the embodiment of the present invention, the embodiment of the present invention also provides a terminal, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor, when executing the computer program, can be configured to perform any one of the methods provided by the embodiment of the present invention.
Optionally, a memory for storing a program; a Memory, which may include a volatile Memory (RAM), such as a Random Access Memory (SRAM), a Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM), and the like; the memory may also comprise a non-volatile memory, such as a flash memory. The memory 62 is used to store computer programs (e.g., applications, functional modules, etc. that implement the above-described methods), computer instructions, etc., which may be stored in one or more memories in a partitioned manner. And the computer programs, computer instructions, data, etc. described above may be invoked by a processor.
The computer programs, computer instructions, etc. described above may be stored in one or more memories in a partitioned manner. And the computer programs, computer instructions, data, etc. described above may be invoked by a processor.
A processor for executing the computer program stored in the memory to implement the steps of the method according to the above embodiments. Reference may be made in particular to the description relating to the preceding method embodiment.
The processor and the memory may be separate structures or may be an integrated structure integrated together. When the processor and the memory are separate structures, the memory, the processor may be coupled by a bus.
Based on the system for editing and controlling irregular closed polygons provided by the embodiment of the invention, the embodiment of the invention also provides another terminal, which comprises a memory, a processor and the system provided by the embodiment of the invention, wherein the system is stored on the memory and can be operated by the processor. Further, the system may be used to perform the above-described method.
Here, the options of the memory and the processor are similar to those of the first terminal described above, and are not described here again.
According to the editing and controlling method, the editing and controlling system and the terminal of the irregular closed polygon, provided by the embodiment of the invention, two views are added in a layout container, and the sizes of the views are controlled; and one View View is used for placing the base map, one View View is used for drawing the graph, and after the graph is drawn, the drawn graph is stored in the base map, so that the graph can be drawn. The drawing of the drawing is realized by using two views, one View is used for placing the bottom drawing, one View is used for drawing and redrawing the drawing, and the two views are placed in a container of layout. The size of the container is controlled by the size of the graph dimension, and the size of the View is further controlled. The code is simplified by using characteristics of Java inheritance (one A class can be inherited by another B class, and some methods and attributes in the A class can be used in the B class after inheritance) and the like, so that the code is more efficient and clear, and low-coupling high cohesion is realized.
Creating a class in the code, setting the class as a base class, and encapsulating some common attributes in the base class, such as drawing a graph and a painting brush, the color of the painting brush, the size of the painting brush, the shape of the painting brush and the like; a view operations class, a graphics selection class, a user gesture class, and some other classes such as a tools class, an interface class, etc. are created.
The process of creating the class is as follows:
a basic class is created by using the development tool android studio, such as:
Figure BDA0002455141430000091
Figure BDA0002455141430000101
Figure BDA0002455141430000111
Figure BDA0002455141430000121
Figure BDA0002455141430000131
Figure BDA0002455141430000141
Figure BDA0002455141430000151
and realizing the drawing of the graph and the selection of the graph in the view operation class and the graph selection class.
And monitoring the gesture operation of the user in a gesture operation class, calling an onDraw method in a View operation class, and drawing a graph (irregular closed polygon) on the View. After the graph is drawn, after a user clicks a screen, whether a point clicked by the user is in a graph drawing range or not is calculated by combining a related algorithm and an Application Program Interface (API), if the clicked point is in the graph drawing range or not, the drawn graph is selected, and the selected graph can be dragged, enlarged, reduced and rotated freely by combining the related algorithm and the API.
In the tool class and the interface class, some tool methods and interface methods are placed. Wherein the tool method comprises: the rotatePoint method and the ComputeAngel method are respectively used for calculating whether the rotation is clockwise or not and calculating the rotation angle; the interface method comprises the following steps: the IDoodleColor, IDoodlePon and IDoodleShape are respectively used for setting graphic colors, setting graphic brushes and setting graphic shapes.
According to the editing and controlling method, the editing and controlling system and the terminal for the irregular closed polygon provided by the embodiment of the invention, by creating a frame for drawing a graph (comprising a basic class, a view operation class, a graph selection class and the like), integrating various operations such as view operation, graph selection, gesture operation and the like, and drawing and redrawing the graph (in a technical aspect, in the gesture operation, the graph is not changed in a process of continuously redrawing actually, and can not be distinguished by naked eyes, and the shape of the graph looks the same as that of the graph), the selected frame can bring more convenience; after the graph is well drawn, the redrawn graph can be ensured to be completely the same as the graph drawn by a user when the redrawn is refreshed; compared with the prior art, the method can better meet the user requirements and realize more functions; the control of the dragging, the zooming-in, the zooming-out and the rotating operation of the graph can be realized. The addition and deletion of the graphs can be completed through the view operation class, the addition is that the user can continuously draw the graphs, and the deletion is that the user can delete the selected graphs when selecting the graphs (the deletion function is set when the graphs are selected).
It should be noted that, the steps in the method provided by the present invention can be implemented by using corresponding modules, devices, units, and the like in the system, and those skilled in the art can implement the step flow of the method by referring to the technical scheme of the system, that is, the embodiment in the system can be understood as a preferred example of the implementation method, and details are not described herein.
Those skilled in the art will appreciate that, in addition to implementing the system and its various devices provided by the present invention in purely computer readable program code means, the method steps can be fully programmed to implement the same functions by implementing the system and its various devices in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Therefore, the system and various devices thereof provided by the present invention can be regarded as a hardware component, and the devices included in the system and various devices thereof for realizing various functions can also be regarded as structures in the hardware component; means for performing the functions may also be regarded as structures within both software modules and hardware components for performing the methods.
The foregoing description of specific embodiments of the present invention has been presented. It is to be understood that the present invention is not limited to the specific embodiments described above, and that various changes and modifications may be made by one skilled in the art within the scope of the appended claims without departing from the spirit of the invention.

Claims (10)

1. An editing and control method for irregular closed polygons is characterized by comprising the following steps:
setting two View views in a layout container;
placing a bottom graph on one View, placing another View on the bottom graph, and overlapping the two View;
creating a basic class, and adding common attributes of graphics to be drawn in the basic class;
creating a view operation class, a graph selection class, a gesture operation class and other classes of the drawn graph; wherein:
the view operation class realizes drawing of graphs;
the graph selection class realizes the selection of the graph;
the gesture operation class monitors gesture operations of a user, and an onDraw method in the View operation class is called, so that a graph can be drawn on a View of the View operation class;
the other classes comprise a tool class and an interface class, the tool class is used for placing a tool method, and the tool method is used for acquiring the coordinate position of a point clicked by a user; the interface method is arranged in the interface class, and the interface method is used for setting a graph color, a graph brush and a graph shape;
after the graph is drawn, calculating whether a point clicked by a user is within the range of the drawn graph or not according to the click of the user, and if so, selecting the drawn graph in a graph selection class;
and carrying out dragging, zooming and rotation control on the selected graph.
2. The method for editing and controlling an irregular closed polygon according to claim 1, wherein the layout container is sized by a figure size of a base map, the figure size of the base map defining a drawing range for drawing a figure.
3. The method for editing and controlling an irregular closed polygon according to claim 1, wherein the common attributes comprise: drawing a graphical brush, the color of the brush, the size of the brush, and the shape of the brush.
4. The method for editing and controlling an irregular closed polygon according to claim 1, wherein the method for calculating whether the point clicked by the user is within the range of the drawn graph is as follows:
calculating the position coordinates of the point clicked by the user by utilizing the getX and getY methods of the MotionEvent in the API, combining the coordinates with a graph range after obtaining the coordinates, calculating the numerical values of the vertex coordinates of the graph drawn by the user and the point coordinates clicked by the user on the x and y coordinate axes by utilizing the continain method in the API, comparing, and if the return value of the continain is true, indicating that the point clicked by the user is in the graph range drawn by the user.
5. The method for editing and controlling an irregular closed polygon according to claim 1, wherein the method for controlling dragging, zooming out and rotating of the selected graph comprises:
calculating the positions of each vertex and the central point of the graph, calculating the rotation angle through a trigonometric function, ensuring the shape of the graph to be unchanged, and rotating around the central point of the graph to realize the rotation control of the graph;
calculating the position of a central point of the graphic area, calculating the coordinate of a point where the user finger starts sliding on the screen and the distance change between the coordinate of the point and the coordinate of the point after the user finger finishes sliding according to the gesture operation MotionEvent in the API; according to the distance change, the position of the central point of the graphic area is changed by means of a Canvas transform method in the API, and then the drawing control of the graphic is realized;
calculating the telescopic operation between two fingers of a user, calculating the telescopic operation between the fingers of the user by means of a gesture detection GesturreDetector in the API to obtain the telescopic proportion of the two fingers of the user, and realizing the control of enlarging and reducing the graph by using a scale method of Canvas in the API.
6. An editing and control system for irregular closed polygons, comprising:
the layout module of layout is provided with two View views, wherein one View is used for placing a base map, and the other View is used for drawing a graph;
the system comprises a class creating module, a display module and a display module, wherein the class creating module is used for creating a basic class, a view operation class, a graph selection class, a gesture operation class and other classes required by drawing a graph; wherein: the basic class is used for placing common attributes of the graphs to be drawn; the view operation class is used for realizing drawing of graphics; the graph selection class is used for realizing the selection of the graph; the gesture operation class is used for monitoring gesture operation of a user, and drawing a graph on a View of the View operation class by calling an onDraw method in the View operation class; the other classes comprise a tool class and an interface class, wherein the tool class is used for placing tool methods, the tool methods are used for acquiring the coordinate positions of points clicked by a user, the interface class is used for placing interface methods, and the interface methods are used for setting graphic colors, graphic brushes and graphic shapes;
the selection module calculates whether the point clicked by the user is in the range of the drawn graph or not according to the click of the user, and if so, the drawn graph is selected in the graph selection class;
and the control module is used for realizing the control of dragging, amplifying, shrinking and rotating the selected graph.
7. The system for editing and controlling an irregular closed polygon according to claim 6, wherein the method for the selection module to calculate whether the point clicked by the user is within the range of the drawn graph is as follows:
calculating coordinates clicked by a user by utilizing getX and getY methods of MotionEvent in the API, combining a graph range after the coordinates are obtained, calculating numerical values of a vertex coordinate of a graph drawn by the user and a point coordinate clicked by the user on x and y coordinate axes by utilizing a continain method in the API, comparing, and if the point coordinate clicked by the user is in the drawn graph range, returning true to the continain; it indicates that the point clicked by the user is within the graphic drawn by the user.
8. The system for editing and controlling irregular closed polygons according to claim 6, wherein the method for controlling the control module to drag, enlarge, reduce and rotate the selected graphics is as follows:
calculating the positions of each vertex and the central point of the graph, calculating the rotation angle through a trigonometric function, ensuring the shape of the graph to be unchanged, and rotating around the central point of the graph to realize the rotation control of the graph;
calculating the position of a central point of the graphic area, calculating the coordinate of a point where the user finger starts sliding on the screen and the distance change between the coordinate of the point and the coordinate of the point after the user finger finishes sliding according to the gesture operation MotionEvent in the API; according to the distance change, the position of the central point of the graphic area is changed by means of a Canvas transform method in the API, and then the drawing control of the graphic is realized;
calculating the telescopic operation between two fingers of a user, calculating the telescopic operation between the fingers of the user by means of a gesture detection GesturreDetector in the API to obtain the telescopic proportion of the two fingers of the user, and realizing the control of enlarging and reducing the graph by using a scale method of Canvas in the API.
9. A terminal comprising a memory, a processor and a computer program stored on the memory and operable on the processor, wherein the computer program, when executed by the processor, is operable to perform the method of any of claims 1 to 5.
10. Another terminal comprising a memory, a processor, and the system of any one of claims 6 to 8 stored on the memory and executable by the processor.
CN202010304212.4A 2020-04-17 2020-04-17 Editing and controlling method, system and terminal of irregular closed polygon Active CN111538411B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010304212.4A CN111538411B (en) 2020-04-17 2020-04-17 Editing and controlling method, system and terminal of irregular closed polygon

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010304212.4A CN111538411B (en) 2020-04-17 2020-04-17 Editing and controlling method, system and terminal of irregular closed polygon

Publications (2)

Publication Number Publication Date
CN111538411A CN111538411A (en) 2020-08-14
CN111538411B true CN111538411B (en) 2022-03-08

Family

ID=71952270

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010304212.4A Active CN111538411B (en) 2020-04-17 2020-04-17 Editing and controlling method, system and terminal of irregular closed polygon

Country Status (1)

Country Link
CN (1) CN111538411B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114115631A (en) * 2021-11-30 2022-03-01 中国平安人寿保险股份有限公司 Graphic processing method, apparatus, device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102955688A (en) * 2011-08-23 2013-03-06 上海无戒空间信息技术有限公司 Processing method for user image controls
WO2017028436A1 (en) * 2015-08-18 2017-02-23 百度在线网络技术(北京)有限公司 Drawing tool implementation method, apparatus, device, and computer storage medium
CN108648109A (en) * 2018-04-11 2018-10-12 泛东教育科技(大连)有限公司 A kind of instructional technology mathematical tool System and method for for realizing multiple functions
CN109064529A (en) * 2018-07-30 2018-12-21 北京酷我科技有限公司 A kind of animation algorithms of button dynamic flashing

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10726036B2 (en) * 2016-05-16 2020-07-28 Sap Se Source service mapping for collaborative platforms

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102955688A (en) * 2011-08-23 2013-03-06 上海无戒空间信息技术有限公司 Processing method for user image controls
WO2017028436A1 (en) * 2015-08-18 2017-02-23 百度在线网络技术(北京)有限公司 Drawing tool implementation method, apparatus, device, and computer storage medium
CN108648109A (en) * 2018-04-11 2018-10-12 泛东教育科技(大连)有限公司 A kind of instructional technology mathematical tool System and method for for realizing multiple functions
CN109064529A (en) * 2018-07-30 2018-12-21 北京酷我科技有限公司 A kind of animation algorithms of button dynamic flashing

Also Published As

Publication number Publication date
CN111538411A (en) 2020-08-14

Similar Documents

Publication Publication Date Title
US10546366B2 (en) Multifunctional environment for image cropping
EP2990924B1 (en) Gesture-based on-chart data filtering
US20210349615A1 (en) Resizing graphical user interfaces
US10162498B2 (en) Providing selection areas for selectable objects in graphical interface
US8610714B2 (en) Systems, methods, and computer-readable media for manipulating graphical objects
EP2748738B1 (en) Method of creating a snap point in a computer-aided design system
US20140098142A1 (en) System and method for generation and manipulation of a curve in a dynamic graph based on user input
CN107943365B (en) Line handwriting presenting method and device, electronic equipment and storage medium
TWI550519B (en) Chart drawing method
CN109032898A (en) A kind of display methods of icon, device, equipment and storage medium
CN107704157A (en) A kind of multi-screen interface operation method, device and storage medium
CN111583379A (en) Rendering method and device of virtual model, storage medium and electronic equipment
CN111538411B (en) Editing and controlling method, system and terminal of irregular closed polygon
CN113934350B (en) Virtual object selection method, device, electronic equipment and storage medium
CN113926190A (en) Method and device for controlling three-dimensional model in game editor and storage medium
CN104978135A (en) Icon display method and device, and mobile terminal
CN111984151B (en) Whiteboard canvas size and position roaming control method for improving processing efficiency
CN115658194A (en) WEB interface adaptive different resolution screen method, device, equipment and medium
CN114217725A (en) Drawing method, device, equipment and medium based on Qt graphic view frame
CN113268301A (en) Animation generation method, device, equipment and storage medium
JP2014130504A (en) Display control device, display control method and program of the same
CN106528130B (en) A kind of Edit button adaptation method and device
CN102074030A (en) Method for acquiring and editing custom graphics and system for making subtitle graphics
US11182955B1 (en) Utilizing dynamic filtering to adaptively generate control points of a vector object for display in a graphical user interface
CN113721911B (en) Control method, medium and equipment for display proportion of virtual scene

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
GR01 Patent grant
GR01 Patent grant