CN116245052A - Drawing migration method, device, equipment and storage medium - Google Patents

Drawing migration method, device, equipment and storage medium Download PDF

Info

Publication number
CN116245052A
CN116245052A CN202310308055.8A CN202310308055A CN116245052A CN 116245052 A CN116245052 A CN 116245052A CN 202310308055 A CN202310308055 A CN 202310308055A CN 116245052 A CN116245052 A CN 116245052A
Authority
CN
China
Prior art keywords
graphic
target
primitive
canvas
graphic file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310308055.8A
Other languages
Chinese (zh)
Inventor
杨慕葵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jingdong Technology Information Technology Co Ltd
Original Assignee
Jingdong Technology Information Technology 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 Jingdong Technology Information Technology Co Ltd filed Critical Jingdong Technology Information Technology Co Ltd
Priority to CN202310308055.8A priority Critical patent/CN116245052A/en
Publication of CN116245052A publication Critical patent/CN116245052A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/30Circuit design
    • G06F30/31Design entry, e.g. editors specifically adapted for circuit design
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Evolutionary Computation (AREA)
  • Geometry (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The embodiment of the invention discloses a drawing migration method, a device, equipment and a storage medium, wherein the method comprises the following steps: acquiring a first graphic file in a first graphic file format corresponding to a drawing to be migrated; based on the second graphic file format, converting the format of the vector graphic elements in the first graphic file to obtain a second graphic file in the second graphic file format; analyzing the second graphic file, and rendering the analyzed target vector graphic to the first canvas; determining target primitives corresponding to the target vector graphics based on user selection operation and/or primitive template matching modes triggered on the first canvas, and rendering the target primitives to the second canvas; and carrying out connection processing on each target graphic element on the second canvas to obtain a logic drawing migrated to the graphic configuration software. By the technical scheme of the embodiment of the invention, the operation of migrating the drawing to the graphic configuration software can be simplified, and the drawing migration efficiency is improved.

Description

Drawing migration method, device, equipment and storage medium
Technical Field
Embodiments of the present invention relate to computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for migrating drawings.
Background
The graphic configuration software is a data visualization integration tool, interaction of components is realized through dragging layout and configuration, a visual controllable page is completed in a graphic mode, and then real equipment is monitored and controlled.
At present, when a drawing which is only used for displaying but cannot be edited is migrated to graphic configuration software, a logic drawing which is corresponding to a vector graphic in the drawing and has a primitive connection relationship is usually required to be manually drawn in the graphic configuration software.
However, in the process of implementing the present invention, the inventors found that at least the following problems exist in the prior art:
the existing drawing migration mode needs to be manually redrawn, time and labor are wasted, and drawing migration efficiency is reduced.
Disclosure of Invention
The embodiment of the invention provides a drawing migration method, a device, equipment and a storage medium, which are used for simplifying drawing migration operation and improving drawing migration efficiency.
In a first aspect, an embodiment of the present invention provides a drawing migration method, including:
acquiring a first graphic file in a first graphic file format corresponding to a drawing to be migrated;
based on a second graphic file format, carrying out format conversion on vector graphic elements in the first graphic file to obtain a second graphic file in the second graphic file format;
Analyzing the second graphic file, and rendering the analyzed target vector graphic to a first canvas;
determining a target primitive corresponding to the target vector graphic based on user selection operation and/or primitive template matching mode triggered on the first canvas, and rendering the target primitive onto a second canvas;
and carrying out connection processing on each target graphic primitive on the second canvas to obtain a logic drawing migrated to graphic configuration software.
In a second aspect, an embodiment of the present invention further provides a drawing migration apparatus, including:
the first graphic file acquisition module is used for acquiring a first graphic file in a first graphic file format corresponding to a drawing to be migrated;
the first graphic file conversion module is used for carrying out format conversion on vector graphic elements in the first graphic file based on a second graphic file format to obtain a second graphic file in the second graphic file format;
the target vector graphic rendering module is used for analyzing the second graphic file and rendering the analyzed target vector graphic to the first canvas;
the target graphic primitive rendering module is used for determining target graphic primitives corresponding to the target vector graphics based on user selection operation and/or graphic primitive template matching modes triggered on the first canvas and rendering the target graphic primitives onto a second canvas;
And the target graphic element connecting module is used for carrying out connecting processing on each target graphic element on the second canvas to obtain a logic drawing migrated to graphic configuration software.
In a third aspect, an embodiment of the present invention further provides an electronic device, including:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the drawing migration method as provided by any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer readable storage medium having stored thereon a computer program, which when executed by a processor, implements a drawing migration method as provided in any embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits:
the method comprises the steps of obtaining a first graphic file in a first graphic file format corresponding to a drawing to be migrated, converting the format of vector graphic elements in the first graphic file based on a second graphic file format, obtaining a second graphic file in the second graphic file format, analyzing the second graphic file, and rendering an analyzed target vector graphic on a first canvas; and determining target graphic primitives corresponding to the target vector graphics based on user selection operation and/or graphic primitive template matching modes triggered on the first canvas, rendering the target graphic primitives to the second canvas, and carrying out connection processing on all the target graphic primitives on the second canvas to obtain a logic drawing migrated to graphic configuration software, so that the vector graphics in the drawing to be migrated can be subjected to graphic primitive splitting without manual redrawing through the user selection operation and/or graphic primitive template matching modes, thereby simplifying drawing migration operation and improving drawing migration efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief description will be given below of the drawings required for the embodiments or the prior art descriptions, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for migrating drawings according to one embodiment of the present invention;
FIG. 2 is an example of a process for drawing migration in accordance with one embodiment of the present invention;
FIG. 3 is a flow chart of another method for migrating a drawing provided by one embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a drawing migration apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Fig. 1 is a flowchart of a drawing migration method according to an embodiment of the present invention, where the embodiment is applicable to a case of migrating a drawing which is only used for presentation but cannot be edited into graphic configuration software, and in particular, to a case of migrating a CAD drawing into the graphic configuration software. The method can be executed by a drawing migration device, and the device can be realized by software and/or hardware and is integrated in electronic equipment. As shown in fig. 1, the method specifically includes the following steps:
s110, acquiring a first graphic file in a first graphic file format corresponding to a drawing to be migrated.
The drawing to be migrated refers to a drawing which needs to be migrated to graphic configuration software and is only used for displaying but cannot be edited. For example, the drawing to be migrated may refer to a CAD drawing created based on CAD drawing software. The drawing to be migrated contains the generated vector graphics. The first graphic file format may refer to a file storage format of vector graphics in a drawing to be migrated. Vector graphics in the first graphics file format cannot be identified in the graphics configuration software. For example, the first graphic file format may refer to a drawing exchange file DXF (Drawing Exchange Format) format corresponding to a CAD drawing, and the corresponding first graphic file may refer to a DXF file corresponding to the CAD drawing. The DXF format is stored in ASCII code format and can be read and edited by a notepad. Correspondingly, the DXF file is a markup file representing graphics stored in ASCII code format and editable by notepad reading.
Specifically, drawing a drawing to be migrated including a vector graphic, such as a CAD drawing, by using drawing software, and importing a first graphic file under a first graphic file format, such as a DXF file corresponding to the CAD drawing, into graphic configuration software so as to perform drawing conversion in the graphic configuration software based on the DXF file, thereby obtaining a logic drawing with a logic connection relationship.
S120, converting the format of the vector graphic elements in the first graphic file based on the second graphic file format to obtain a second graphic file in the second graphic file format.
The second graphic file format may refer to a file storage format in which vector graphics can be identified in graphic configuration software. For example, the second graphics file format may refer to the scalable vector graphics SVG (Scalable Vector Graphics) format. The vector graphic element may be an element object for composing a vector graphic. For example, vector graphics elements may include, but are not limited to: straight lines, line segments, circles, ellipses, circular arcs and spline curves. In different graphic file formats, the representation modes corresponding to the same vector graphic element are different. For example, the same vector graphic element is characterized by different element names, for example, the element name corresponding to the vector graphic element "straight line" in DXF format is: the element names corresponding to the vector graphic element 'straight LINE' in the LINE and SVG formats are as follows: line. The coordinate systems corresponding to the different graphic file formats are also different, so that the element coordinate values of each vector graphic element also need to be converted. For example, the origin of the coordinate system in the DXF format is in the lower left corner of the screen, the X-axis is forward to the right, and the Y-axis is forward to the top. The origin of the coordinate system in the SVG format is in the upper left corner of the screen, the positive direction of the X-axis is to the right, and the positive direction of the Y-axis is to the bottom.
Specifically, the first graphic file in the first graphic file format may be converted into the second graphic file in the second graphic file format based on the original format conversion tool. The vector graphic elements in the first graphic file can also be subjected to name conversion and coordinate conversion based on the element conversion relation between the second graphic file format and the first graphic file format, so as to obtain a second graphic file in the second graphic file format.
Illustratively, S120 may include: converting the element names of the vector graphic elements in the first graphic file based on the corresponding relation between the vector graphic element names in the first graphic file format and the vector graphic element names in the second graphic file format; converting element coordinate values of vector graphic elements in the first graphic file based on a first graphic coordinate system corresponding to the first graphic file format and a second graphic coordinate system corresponding to the second graphic file format; and determining the graphic file obtained after the conversion of the element name and the element coordinate value as a second graphic file in a second graphic file format.
Specifically, based on the correspondence between the vector graphic element names in the first graphic file format and the vector graphic element names in the second graphic format, the element name of each vector graphic element in the first graphic file is converted into the vector graphic element name in the corresponding second graphic format, so that conversion and translation of the element names are realized. Based on a first graphic coordinate system corresponding to the first graphic file format and a second graphic coordinate system corresponding to the second graphic file format, a coordinate transformation matrix can be determined, and based on the coordinate transformation matrix, conversion of element coordinate values is performed on each vector graphic element in the first graphic file, element coordinate values under the second graphic coordinate system are obtained, so that conversion of the coordinate system of the element coordinate values is realized. After the conversion of the element names and the element coordinate values is completed, the obtained graphic file can be determined to be a second graphic file in a second graphic file format, so that the vector graphic is converted and translated from the drawing in the first graphic file format to the drawing in the second graphic file format, for example, the vector graphic is converted and translated from the CAD drawing to the SVG drawing.
It should be noted that the second graphic file obtained after conversion is only a collection of a pile of elements, and the element combinations are not yet mapped to specific device primitives. For example, the SVG file obtained after conversion is as follows:
<svg viewBox="0 0 800 600"version="1.1"stroke-linecap="round"stroke-linejoin="round"fill-rule="evenodd"xml:space="preserve">
<defs>
<clipPath id="clipId0">
<path d="M0,600 800,600 800,0 0,0z"/>
</clipPath>
</defs>
<gclip-path="url(#clipId0)"fill="none"stroke="rgb(0,0,0)"stroke-width="0.1"/>
<path d="M26.1687,572.645 26.8215,571.992 787.167,571.992 787.82,572.645z"/>
s130, analyzing the second graphic file, and rendering the analyzed target vector graphic to the first canvas.
The target vector graphic may refer to a vector graphic that needs to be migrated. The canvas may be a drawing for showing graphics. For example, the Canvas may be, but is not limited to, a Canvas. The first canvas may be a drawing for exposing a target vector graphic of the primitive to be sliced in order to allow subsequent edit extraction operations.
In particular, since the second graphics file format (such as SVG format) does not provide pixel-level processing, picture pixel data of a specific location cannot be acquired. In order to segment the primitives in the second graphic file, the second graphic file may be parsed into Javascript drawing codes corresponding to the target vector graphic through a Canvas plugin, such as a fabric. Js tool, and the target vector graphic may be rendered onto a first Canvas, such as a first Canvas, by executing the Javascript drawing codes. For example, fig. 2 shows an example of a drawing migration process, and as shown in fig. 2, a target vector graphic in a drawing to be migrated is rendered on a first canvas, so that a user can perform a primitive selection operation on the first canvas.
And S140, determining a target primitive corresponding to the target vector graphic based on user selection operation and/or primitive template matching mode triggered on the first canvas, and rendering the target primitive onto the second canvas.
Wherein, the graphic element may refer to a configuration element for characterizing the device graphic. It should be noted that the primitive may be closed or non-closed, such as a pin line with two ends. For example, the resistor graphic element may construct a graph of resistors in a "straight line + rectangle + straight line" manner. The target primitive may refer to a primitive contained in the target vector graphic. The target vector graphic includes a plurality of target primitives. The second canvas may be a drawing for showing the cut target primitives.
Specifically, all target primitives in the target vector graphics can be obtained through user selection operation triggered by a user on the first canvas and/or through splitting in a primitive template matching mode. For example, if the primitive template library does not have primitives in the drawing field to be migrated, the user may perform a primitive selection operation on the target vector graphic displayed by the first canvas based on the service requirement, for example, the user may perform a click operation or a circle selection operation on the graphic portion belonging to the same primitive, so that the target element set selected by the user each time may be combined into a corresponding target primitive. For example, as shown in fig. 2, the user performs circle selection on the diode part in the circuit on the first canvas, such as the dashed box in fig. 2, so that the user's circle selected part can determine a target primitive, namely the diode primitive, so that the user can directly trigger and select each primitive on the first canvas, split all the target primitives in the target vector graphic, and further allow drawing migration to be performed quickly on the premise that no domain primitive exists in the graphic configuration software.
For another example, if the primitive template library has primitives in the drawing field to be migrated, template matching can be performed on the primitive templates in the primitive template library and the target vector graphics on the first canvas, so that the target primitives in the target vector graphics can be automatically matched without manually drawing the target primitives.
Furthermore, all target primitives in the target vector graphics can be split by combining user selection operation and primitive template matching mode. For example, after a user selects a target primitive on the first canvas, the target primitive selected by the user can be used as a primitive template to be matched with the target vector graphic, and other target primitives in the target vector graphic can be automatically matched, so that the number of times of selecting the primitive by the user can be reduced, and the primitive splitting efficiency is improved. For example, as shown in fig. 2, a diode primitive selected by a user is used as a primitive template to perform template matching, so as to obtain a matched resistor primitive and capacitor primitive.
The present embodiment may create a new second Canvas, such as a second Canvas, within the DOM (Document Object Model ) tree to accept the split target primitives. The splitting condition of the user can be prompted by rendering the split target primitives to the second canvas for display. According to the embodiment, corresponding target graphic elements can be rendered according to the original graphic positions in the imported drawing, and the target graphic elements are displayed at the same positions, so that subsequent connection operation is simplified, and drawing migration efficiency is further improved.
And S150, carrying out connection processing on each target graphic primitive on the second canvas to obtain a logic drawing migrated to the graphic configuration software.
The graphic configuration software may be, but is not limited to, visual graphic rendering software based on web pages. The logic drawing may refer to a drawing with a graphic element logic connection relationship, that is, a visual drawing drawn in graphic configuration software.
Specifically, after all target primitives in the target vector graphics are split, on the second canvas, all the target primitives which are successfully split can be subjected to connection line filling according to the connection relation between the original graphics positions, so that a drawing to be migrated, which is imported into the graphic configuration software, is updated into a logic drawing with the primitive logic connection relation, and drawing migration operation is completed. Through format conversion and user selection operation on the primitives, the drawings in the original working field can be quickly migrated to the graphic configuration software with changed technology, the dependence on the starting of the primitives in the field is reduced, the work consumption of construction from the beginning is reduced, and the drawing migration efficiency is improved.
According to the technical scheme, a first graphic file in a first graphic file format corresponding to a drawing to be migrated is obtained, format conversion is conducted on vector graphic elements in the first graphic file based on a second graphic file format, a second graphic file in the second graphic file format is obtained, the second graphic file is analyzed, and the analyzed target vector graphic is rendered on a first canvas; and determining target graphic primitives corresponding to the target vector graphics based on user selection operation and/or graphic primitive template matching modes triggered on the first canvas, rendering the target graphic primitives to the second canvas, and carrying out connection processing on all the target graphic primitives on the second canvas to obtain a logic drawing migrated to graphic configuration software, so that the vector graphics in the drawing to be migrated can be subjected to graphic primitive splitting without manual redrawing through the user selection operation and/or graphic primitive template matching modes, thereby simplifying drawing migration operation and improving drawing migration efficiency.
Based on the above technical solution, after S140, the method may further include: displaying the primitive confirmation information corresponding to the target primitive after each rendering; and deleting the target primitive which is confirmed to be wrong by the user in response to a primitive error instruction triggered by the user based on the primitive confirmation information.
The primitive confirmation information may be information for prompting the user whether the target primitive rendered at the present time is the primitive to be split. The primitive error instruction may be an instruction to characterize that the current rendered target primitive is not the primitive that needs to be split.
Specifically, after each rendering of the target primitive on the second canvas, corresponding primitive confirmation information may be displayed to prompt the user to perform primitive confirmation. The user can trigger the primitive error instruction by clicking the error button aiming at the displayed primitive confirmation information, and if the primitive error instruction is detected, the target primitive confirmed to be in error by the user can be deleted from the second canvas so as to re-split the primitive. The user may also trigger primitive correct instructions by clicking on the correct button to continue to present the user confirmation of the correct target primitive on the second canvas. When all target primitives in the target vector graphics are split and split is confirmed to be correct, connection processing can be carried out on all the confirmed correct target primitives on the second canvas, so that accuracy of drawing migration can be guaranteed.
Fig. 3 is a flowchart of another drawing migration method according to an embodiment of the present invention, where a process of determining a target primitive through a user selection operation is described based on the above embodiments, and a process of determining a target primitive through a primitive template matching manner is also described based on the above embodiments. Wherein the explanation of the same or corresponding terms as those of the above embodiments is not repeated herein.
Referring to fig. 3, another drawing migration method provided in this embodiment specifically includes the following steps:
s310, acquiring a first graphic file in a first graphic file format corresponding to a drawing to be migrated.
S320, converting the format of the vector graphic elements in the first graphic file based on the second graphic file format to obtain a second graphic file in the second graphic file format.
S330, analyzing the second graphic file, and rendering the analyzed target vector graphic to the first canvas.
S340, determining a target element set selected by the current user in the target vector graph based on the current triggered user selection operation on the first canvas.
Specifically, the user may perform a primitive selection operation on the target vector graphic displayed on the first canvas based on the service requirement, for example, the user may perform a click operation or a circle selection operation on the graphic portion belonging to the same primitive. And monitoring a mouse event, such as a mouse click start event mouseup, a mouse click end event mousedown and a mouse click movement event mousemove, on the first canvas, so that a graphic area clicked or circled by the current user can be determined through the monitored mouse event, and all elements in the graphic area are determined to be a target element set selected by the current user.
And S350, combining the target element sets to determine the target element sets as the target elements selected at the present time, and rendering the target elements selected at the present time onto the second canvas.
Specifically, the target element set selected by the current user is combined into the current selected target element, and a new second canvas is established in the DOM tree to accept the current selected target element. The user directly triggers the primitive selection operation on the first canvas, and the target primitive related in the target vector graph can be generated, so that drawing migration is allowed to be rapidly carried out on the premise that the field primitive does not exist in the graph configuration software.
S360, adding the currently selected target primitive as a primitive template into a primitive template library for storage.
Specifically, the target primitive selected by the user at present can be used as a new primitive template to be added into a primitive template library of the graphic configuration software for storage, so as to update the primitive style in the primitive template library in real time.
S370, acquiring a target graphic area which is not rendered currently in the target vector graphic.
The target graphic region may refer to a graphics region which is not rendered and remains after the target vector graphic in the first canvas removes the primitive region which is currently rendered in the second canvas.
Specifically, the target graphics area which is not rendered at present dynamically changes along with each splitting rendering of the graphics primitive, so that the target graphics area which is not rendered at present in the target vector graphics needs to be acquired in real time, so as to continue splitting the graphics primitive of the target graphics area.
And S380, performing template matching on the primitive templates in the primitive template library in a target primitive region, determining target primitives matched with the primitive templates, and rendering the matched target primitives on a second canvas.
The target primitive matched with the primitive template can comprise the primitive identical to the primitive template, and can also comprise similar primitives belonging to the same class with the primitive template. For example, as shown in FIG. 2, if the primitive templates are diode primitives, the matching target primitives may include resistor primitives and capacitor primitives.
Specifically, because similar primitives in the target graphic region have different displacements and different scaling, when the templates of the first round are matched, the position and size data of the target graphic region and the primitive templates can be preprocessed. For example, the points tag of the polyline is used to represent the points involved in the polyline element, so that polyline elements with the same points can be matched and screened out. If the primitive template contains a plurality of polyline elements or other element combinations, each element is matched and then is regarded as preliminary matching. In the first round of template matching, a partial region which is possibly similar in the target image region can be cut out, and the second round of template matching is continued on the partial region. For example, taking polyline as an example, it is determined whether the slope of the same number of points is the same from point to point, whether the distance between points is the same or a uniform multiple, and the multiple may continue in other graph traversal matches. Target primitives matched with each primitive template in the primitive template library can be rapidly determined through two rounds of template matching, and all matched target primitives are rendered on the second canvas.
It should be noted that, if the target graphics area still exists in the target vector graphics after the template matching, that is, there is still a target graphics area still not yet split, the user may continue to trigger the selection operation, that is, return to the mode of step S340 to continue to split the graphics primitive, store the latest split target graphics primitive as the graphics primitive template, and perform the graphics primitive template matching based on the latest stored graphics primitive template until all the target graphics primitives in the target vector graphics have been split, thereby performing the graphics primitive splitting by combining the user selection operation and the graphics primitive template matching mode, and further improving the graphics primitive splitting efficiency.
It should be noted that, after step S330, the primitive template matching operation may be performed first, i.e. steps S370-S380, if the target graphics area still exists in the target vector graphics after the template matching, then the operations of manually selecting the primitive by the user of S340-S350 are performed again, and the newly selected target primitive is used as the new primitive template to perform the primitive template matching again until all the target primitives in the target vector graphics have been split. The embodiment does not limit the sequence of the user selection operation and the primitive template matching mode.
S390, carrying out connection processing on each target graphic primitive on the second canvas to obtain a logic drawing migrated to the graphic configuration software.
According to the technical scheme, the target graphic elements selected by the user at present are used as graphic element templates and added into the graphic element template library for storage, so that graphic element patterns in the graphic element template library can be updated in real time, template matching can be performed on the basis of the target graphic areas which are not rendered currently by the stored graphic element templates, other target graphic elements matched with the graphic element templates are automatically split, the user does not need to select the target graphic elements one by one, the selection times of the user are reduced, and further drawing migration efficiency is further improved on the premise that the field graphic elements are not allowed.
Based on the above technical solution, S380 may include: performing document traversal matching on a template tag document corresponding to a primitive template in a primitive template library and a target graphic document corresponding to a target graphic region in a tag attribute matching mode; and rendering the target primitive onto a second canvas based on the target primitive document matched with the template tag document.
Wherein each primitive template added to the primitive template library is essentially an XML (Extensible Markup Language ) template tag document without hierarchy. For example, the XML tag document portion corresponding to the target element set in the SVG file may be determined as the template tag document of the corresponding primitive template. The target graphic document corresponding to the target graphic region may refer to a remaining document of the second graphic file from which the document portion corresponding to the rendered target graphic element is removed. For example, table 1 gives an example of a template tag document and a matched target primitive document. Table 2 gives an example of tag attributes that different graphic elements in an SVG file need to match.
Table 1 examples of template tag documents and matched target primitive documents
Figure BDA0004149578090000141
Table 2 example of tag attributes in SVG files that different graphic elements need to match
Figure BDA0004149578090000151
Specifically, through a label attribute matching mode, traversing and inquiring similar parts of a template label document corresponding to the primitive template in a target graphic document corresponding to the target graphic region, carrying out accurate matching on the similar parts to determine target primitive documents which belong to the same kind as the primitive template, analyzing the target primitive documents into corresponding target primitives, and rendering the corresponding target primitives onto a second canvas, so that the same kind of primitives can be automatically matched, rendered and displayed.
The following is an embodiment of a drawing migration apparatus provided in the embodiment of the present invention, where the apparatus and the drawing migration method of each embodiment belong to the same inventive concept, and details of the embodiment of the drawing migration apparatus are not described in detail, and reference may be made to the embodiment of the drawing migration method.
Fig. 4 is a schematic structural diagram of a drawing migration device according to an embodiment of the present invention, where the embodiment is applicable to a situation of migrating drawings which are only used for presentation and cannot be edited into graphic configuration software, and in particular, to a situation of migrating CAD drawings into graphic configuration software. As shown in fig. 4, the apparatus specifically includes: a first graphics file acquisition module 410, a first graphics file conversion module 420, a target vector graphics rendering module 430, a target primitive rendering module 440, and a target primitive wiring module 450.
The first graphic file obtaining module 410 is configured to obtain a first graphic file in a first graphic file format corresponding to a drawing to be migrated; a first graphic file conversion module 420, configured to perform format conversion on vector graphic elements in the first graphic file based on a second graphic file format, to obtain a second graphic file in the second graphic file format; the target vector graphic rendering module 430 is configured to parse the second graphic file and render the parsed target vector graphic onto the first canvas; the target primitive rendering module 440 is configured to determine a target primitive corresponding to the target vector graphic based on a user selection operation and/or a primitive template matching manner triggered on the first canvas, and render the target primitive onto a second canvas; and the target graphic primitive connecting module 450 is used for connecting each target graphic primitive on the second canvas to obtain a logic drawing migrated to graphic configuration software.
According to the technical scheme, a first graphic file in a first graphic file format corresponding to a drawing to be migrated is obtained, format conversion is conducted on vector graphic elements in the first graphic file based on a second graphic file format, a second graphic file in the second graphic file format is obtained, the second graphic file is analyzed, and the analyzed target vector graphic is rendered on a first canvas; and determining target graphic primitives corresponding to the target vector graphics based on user selection operation and/or graphic primitive template matching modes triggered on the first canvas, rendering the target graphic primitives to the second canvas, and carrying out connection processing on all the target graphic primitives on the second canvas to obtain a logic drawing migrated to graphic configuration software, so that the vector graphics in the drawing to be migrated can be subjected to graphic primitive splitting without manual redrawing through the user selection operation and/or graphic primitive template matching modes, thereby simplifying drawing migration operation and improving drawing migration efficiency.
Optionally, the drawing to be migrated is a CAD drawing made based on CAD drawing software, the first graphic file format is a drawing exchange file DXF format, and the second graphic file format is a scalable vector graphics SVG format.
Optionally, the first graphic file conversion module 420 is specifically configured to:
converting the element names of the vector graphic elements in the first graphic file based on the corresponding relation between the vector graphic element names in the first graphic file format and the vector graphic element names in the second graphic file format; converting element coordinate values of vector graphic elements in a first graphic file based on a first graphic coordinate system corresponding to a first graphic file format and a second graphic coordinate system corresponding to a second graphic file format; and determining the graphic file obtained after the conversion of the element name and the element coordinate value as a second graphic file in the second graphic file format.
Optionally, the target primitive rendering module 440 includes:
the first primitive rendering unit is used for determining a target element set selected by a current user in the target vector graph based on the current triggered user selection operation on the first canvas; and combining the target element sets to determine the target element set to be the currently selected target element, and rendering the currently selected target element set to the second canvas.
Optionally, the target primitive rendering module 440 further includes:
and the target primitive storage unit is used for adding the currently selected target primitive serving as a primitive template into the primitive template library for storage after rendering the currently selected target primitive onto the second canvas.
Optionally, the target primitive rendering module 440 further includes:
the second primitive rendering unit is used for acquiring a target graphic area which is not rendered currently in the target vector graphic; and carrying out template matching on the primitive templates in the primitive template library in the target graphic area, determining target primitives matched with the primitive templates, and rendering the matched target primitives onto a second canvas.
Optionally, the second primitive rendering unit is specifically configured to:
performing document traversal matching on a template tag document corresponding to a primitive template in a primitive template library and a target graphic document corresponding to the target graphic region in a tag attribute matching mode; and rendering the target primitive onto a second canvas based on the target primitive document matched with the template tag document.
Optionally, the apparatus further comprises:
the target primitive deleting module is used for displaying primitive confirmation information corresponding to the target primitive after each rendering after rendering the target primitive on the second canvas; and deleting the target primitive which is confirmed to be wrong by the user in response to a primitive error instruction triggered by the user based on the primitive confirmation information.
The drawing migration device provided by the embodiment of the invention can execute the drawing migration method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the drawing migration method.
It should be noted that, in the embodiment of the drawing migration apparatus, each unit and module included are only divided according to the functional logic, but not limited to the above division, so long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the present invention.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. Fig. 5 illustrates a block diagram of an exemplary electronic device 12 suitable for use in implementing embodiments of the present invention. The electronic device 12 shown in fig. 5 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in fig. 5, the electronic device 12 is in the form of a general purpose computing device. Components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, a bus 18 that connects the various system components, including the system memory 28 and the processing units 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, commonly referred to as a "hard disk drive"). Although not shown in fig. 5, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of the embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored in, for example, system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the electronic device 12, and/or any devices (e.g., network card, modem, etc.) that enable the electronic device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Also, the electronic device 12 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 over the bus 18. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 12, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, for example, implementing a drawing migration method step provided in the present embodiment, the method includes:
acquiring a first graphic file in a first graphic file format corresponding to a drawing to be migrated;
based on a second graphic file format, carrying out format conversion on vector graphic elements in the first graphic file to obtain a second graphic file in the second graphic file format;
analyzing the second graphic file, and rendering the analyzed target vector graphic to a first canvas;
determining a target primitive corresponding to the target vector graphic based on user selection operation and/or primitive template matching mode triggered on the first canvas, and rendering the target primitive onto a second canvas;
and carrying out connection processing on each target graphic primitive on the second canvas to obtain a logic drawing migrated to graphic configuration software.
Of course, those skilled in the art will understand that the processor may also implement the technical solution of the drawing migration method provided by any embodiment of the present invention.
The present embodiment provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the drawing migration method steps as provided by any embodiment of the present invention, the method comprising:
acquiring a first graphic file in a first graphic file format corresponding to a drawing to be migrated;
based on a second graphic file format, carrying out format conversion on vector graphic elements in the first graphic file to obtain a second graphic file in the second graphic file format;
analyzing the second graphic file, and rendering the analyzed target vector graphic to a first canvas;
determining a target primitive corresponding to the target vector graphic based on user selection operation and/or primitive template matching mode triggered on the first canvas, and rendering the target primitive onto a second canvas;
and carrying out connection processing on each target graphic primitive on the second canvas to obtain a logic drawing migrated to graphic configuration software.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium may be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
It will be appreciated by those of ordinary skill in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be centralized on a single computing device, or distributed over a network of computing devices, or they may alternatively be implemented in program code executable by a computer device, such that they are stored in a memory device and executed by the computing device, or they may be separately fabricated as individual integrated circuit modules, or multiple modules or steps within them may be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (11)

1. A method for migrating a drawing, comprising:
acquiring a first graphic file in a first graphic file format corresponding to a drawing to be migrated;
based on a second graphic file format, carrying out format conversion on vector graphic elements in the first graphic file to obtain a second graphic file in the second graphic file format;
analyzing the second graphic file, and rendering the analyzed target vector graphic to a first canvas;
determining a target primitive corresponding to the target vector graphic based on user selection operation and/or primitive template matching mode triggered on the first canvas, and rendering the target primitive onto a second canvas;
and carrying out connection processing on each target graphic primitive on the second canvas to obtain a logic drawing migrated to graphic configuration software.
2. The method of claim 1, wherein the drawing to be migrated is a CAD drawing created based on CAD drawing software, the first graphic file format is a drawing exchange file DXF format, and the second graphic file format is a scalable vector graphics SVG format.
3. The method of claim 1, wherein the converting the vector graphic elements in the first graphic file into a format based on a second graphic file format to obtain a second graphic file in the second graphic file format comprises:
Converting the element names of the vector graphic elements in the first graphic file based on the corresponding relation between the vector graphic element names in the first graphic file format and the vector graphic element names in the second graphic file format;
converting element coordinate values of vector graphic elements in a first graphic file based on a first graphic coordinate system corresponding to a first graphic file format and a second graphic coordinate system corresponding to a second graphic file format;
and determining the graphic file obtained after the conversion of the element name and the element coordinate value as a second graphic file in the second graphic file format.
4. The method of claim 1, wherein determining the target primitive corresponding to the target vector graphic based on the user selection operation triggered on the first canvas and rendering the target primitive onto a second canvas comprises:
determining a target element set selected by a current user in the target vector graph based on the current triggered user selection operation on the first canvas;
and combining the target element sets to determine the target element set to be the currently selected target element, and rendering the currently selected target element set to the second canvas.
5. The method of claim 4, further comprising, after rendering the currently selected target primitive onto the second canvas:
and adding the target primitive selected at present as a primitive template into a primitive template library for storage.
6. The method of claim 1 or 5, wherein determining the target primitive corresponding to the target vector graphic based on the primitive template matching manner and rendering the target primitive onto the second canvas comprises:
acquiring a target graph area which is not rendered currently in the target vector graph;
and carrying out template matching on the primitive templates in the primitive template library in the target graphic area, determining target primitives matched with the primitive templates, and rendering the matched target primitives onto a second canvas.
7. The method of claim 6, wherein template matching primitive templates in a primitive template library in the target graphics region, determining target primitives that match the primitive templates, and rendering the matched target primitives onto a second canvas, comprises:
performing document traversal matching on a template tag document corresponding to a primitive template in a primitive template library and a target graphic document corresponding to the target graphic region in a tag attribute matching mode;
And rendering the target primitive onto a second canvas based on the target primitive document matched with the template tag document.
8. The method of claim 1, further comprising, after rendering the target primitive onto the second canvas:
displaying the primitive confirmation information corresponding to the target primitive after each rendering;
and deleting the target primitive which is confirmed to be wrong by the user in response to a primitive error instruction triggered by the user based on the primitive confirmation information.
9. A drawing migration apparatus, comprising:
the first graphic file acquisition module is used for acquiring a first graphic file in a first graphic file format corresponding to a drawing to be migrated;
the first graphic file conversion module is used for carrying out format conversion on vector graphic elements in the first graphic file based on a second graphic file format to obtain a second graphic file in the second graphic file format;
the target vector graphic rendering module is used for analyzing the second graphic file and rendering the analyzed target vector graphic to the first canvas;
the target graphic primitive rendering module is used for determining target graphic primitives corresponding to the target vector graphics based on user selection operation and/or graphic primitive template matching modes triggered on the first canvas and rendering the target graphic primitives onto a second canvas;
And the target graphic element connecting module is used for carrying out connecting processing on each target graphic element on the second canvas to obtain a logic drawing migrated to graphic configuration software.
10. An electronic device, the electronic device comprising:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, causes the one or more processors to implement the drawing migration method of any one of claims 1-8.
11. A computer readable storage medium having stored thereon a computer program, which when executed by a processor implements a drawing migration method according to any one of claims 1-8.
CN202310308055.8A 2023-03-27 2023-03-27 Drawing migration method, device, equipment and storage medium Pending CN116245052A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310308055.8A CN116245052A (en) 2023-03-27 2023-03-27 Drawing migration method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310308055.8A CN116245052A (en) 2023-03-27 2023-03-27 Drawing migration method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116245052A true CN116245052A (en) 2023-06-09

Family

ID=86627840

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310308055.8A Pending CN116245052A (en) 2023-03-27 2023-03-27 Drawing migration method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116245052A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116991531A (en) * 2023-09-27 2023-11-03 中汽数据(天津)有限公司 Cloud rendering method, device, equipment and medium
CN117408209A (en) * 2023-12-13 2024-01-16 北京芯愿景软件技术股份有限公司 Device extraction method, device, equipment and medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116991531A (en) * 2023-09-27 2023-11-03 中汽数据(天津)有限公司 Cloud rendering method, device, equipment and medium
CN117408209A (en) * 2023-12-13 2024-01-16 北京芯愿景软件技术股份有限公司 Device extraction method, device, equipment and medium
CN117408209B (en) * 2023-12-13 2024-03-19 北京芯愿景软件技术股份有限公司 Device extraction method, device, equipment and medium

Similar Documents

Publication Publication Date Title
CN109801347B (en) Method, device, equipment and medium for generating editable image template
US8665274B2 (en) Method and system for generating and displaying an interactive dynamic view of bi-directional impact analysis results for multiply connected objects
US8194075B2 (en) Method and system for generating and displaying an interactive dynamic list view of multiply connected objects
US8711148B2 (en) Method and system for generating and displaying an interactive dynamic selective view of multiply connected objects
US8711147B2 (en) Method and system for generating and displaying an interactive dynamic graph view of multiply connected objects
CN116245052A (en) Drawing migration method, device, equipment and storage medium
CN110705237B (en) Automatic document generation method, data processing device and storage medium
CN112100550A (en) Page construction method and device
US20140215306A1 (en) In-Context Editing of Output Presentations via Automatic Pattern Detection
US20240160410A1 (en) Application Development Platform, Micro-program Generation Method, and Device and Storage Medium
CN113158101A (en) Visual page rendering method, device, equipment and storage medium
CN111651966A (en) Data report file generation method and device and electronic equipment
US8230319B2 (en) Web-based visualization, refresh, and consumption of data-linked diagrams
CN114647409A (en) Large-screen visualization application creation platform, method, computing device and storage medium
JPWO2005098660A1 (en) Document processing apparatus and document processing method
JPWO2005098658A1 (en) Document processing apparatus and document processing method
CN113345048B (en) Geographic information image editing method and device and computer equipment
CN110309239B (en) Visual map editing method and device
US11367231B2 (en) System for generating snapping guides for a multi-path glyph
CN113656533A (en) Tree control processing method and device and electronic equipment
CN113850884A (en) Method and device for generating mulberry basic diagram, electronic equipment and storage medium
CN111061478B (en) Page form modification method, device and equipment and readable storage medium
CN113419711A (en) Page guiding method and device, electronic equipment and storage medium
CN110162301B (en) Form rendering method, form rendering device and storage medium
CN115904152A (en) HTML 5-based flow chart drawing method, device, equipment and storage medium

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