Modern software applications, including word processors and dedicated drawing application programs, enable users to create both simple and complex graphics. These drawing programs allow users to create graphics using a variety of shapes which may be annotated with text. The graphics created by these applications may be stand-alone documents or incorporated into text documents. Despite the advantages offered by modern drawing programs, however, these programs suffer from several drawbacks which hinder the creation and layout of graphics by the typical user.
One drawback of modern drawing programs is that although they may offer tools for creating graphics, many users are not aware of these existing tools, or of how to use them effectively. As a result, users either create their own graphics or use the graphics tools incorrectly, resulting in graphics with shapes that are misaligned and text that should be the same font size, but is not. Another drawback of modern drawing programs is that shapes containing text do not automatically resize fonts or expand their dimensions for added or enlarged text such that the text remains fully enclosed in the shape. Yet another drawback of modern drawing programs is that they offer either rigid layouts or no layout at all. Programs with no layout require users to manually size and position every shape; programs with rigid layout do not allow users to make any changes or customizations to the size or position of the shape.
It is with respect to these considerations and others that the various embodiments of the present invention have been made.
In accordance with the present invention, the above and other problems are solved by a method, apparatus, and computer-readable medium for creating and laying out a graphic within a drawing application program based on a set of constraints that transform data and relationships into a specific graphic layout. The method includes receiving a data model defining the data and relationships between that data that will be represented in the graphic, receiving a graphic definition defining the graphic to be created, generating a layout tree by mapping data from the data model to the information in the graphic definition, determining the size and position for the graphic shapes according to the constraint values and constraint rules specified in the graphic definition, and creating a shape list for the graphic using the information from the layout tree. These shapes can then be rendered by any rendering application to achieve a final graphic.
To map the data from the data model to the information in the graphic definition, the method iterates through the data model and applies criteria specified in the graphic definition to determine the algorithms, constraints, constraint rules, and shape properties for each shape needed to construct the graphic. These sets of data are then added to the layout tree, which is a hierarchical representation of the graphic structure.
To determine the size and position of graphic shapes, the method accesses the algorithms, constraints, and constraint rules in the graphic definition. The algorithms come from an unbounded set of potential algorithms that know how to size and position shapes to achieve a specific graphic layout, such as laying out shapes in a circular path or laying out shapes in a linear path. The algorithms use the constraints, or starting values, along with the constraint rules, or instructions for altering those starting values within a range, to determine the size and position of the shapes, based on the number of shapes, amount of text within each shape, and the dimensions of the area in which the shapes are to be laid out.
The invention may be implemented as a computer process, a computing system, or as an article of manufacture such as a computer program product or computer readable media. The computer program product may be a computer storage media readable by a computer system and encoding a computer program of instructions for executing a computer process. The computer program product may also be a propagated signal on a carrier readable by a computing system and encoding a computer program of instructions for executing a computer process.
These and various other features, as well as advantages, which characterize the present invention, will be apparent from a reading of the following detailed description and a review of the associated drawings.
Referring now to the drawings, in which like numerals represent like elements, various aspects of the present invention will be described. In particular,
Generally, program modules include routines, programs, components, data structures, and other types of structures that perform particular tasks or implement particular abstract data types. Moreover, those skilled in the art will appreciate that the invention may be practiced with other computer system configurations, including hand-held devices, multiprocessor systems, microprocessor-based or programmable consumer electronics, minicomputers, mainframe computers, and the like. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote memory storage devices.
Referring now to
The mass storage device 14 is connected to the CPU 5 through a mass storage controller (not shown) connected to the bus 12. The mass storage device 14 and its associated computer-readable media provide non-volatile storage for the computer 2. Although the description of computer-readable media contained herein refers to a mass storage device, such as a hard disk or CD-ROM drive, it should be appreciated by those skilled in the art that computer-readable media can be any available media that can be accessed by the computer 2.
By way of example, and not limitation, computer-readable media may comprise computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EPROM, EEPROM, flash memory or other solid state memory technology, CD-ROM, digital versatile disks (“DVD”), or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by the computer 2.
According to various embodiments of the invention, the computer 2 may operate in a networked environment using logical connections to remote computers through a network 18, such as the Internet. The computer 2 may connect to the network 18 through a network interface unit 20 connected to the bus 12. It should be appreciated that the network interface unit 20 may also be utilized to connect to other types of networks and remote computer systems. The computer 2 may also include an input/output controller 22 for receiving and processing input from a number of other devices, including a keyboard, mouse, or electronic stylus (not shown in
As mentioned briefly above, a number of program modules and data files may be stored in the mass storage device 14 and RAM 9 of the computer 2, including an operating system 16 suitable for controlling the operation of a networked personal computer, such as the WINDOWS XP operating system from MICROSOFT CORPORATION of Redmond, Wash. The mass storage device 14 and RAM 9 may also store one or more program modules. In particular, the mass storage device 14 and the RAM 9 may store a drawing application program 10. The drawing application program 10 is operative to provide functionality for the creation and layout of graphics, such as graphic 24. According to one embodiment of the invention, the drawing application program 10 comprises the OFFICE suite of application programs from MICROSOFT CORPORATION including the WORD, EXCEL, and POWERPOINT application programs. Referring now to
The data model 30 includes a collection of nodes, relationships, text, and properties that contains the content for constructing the graphic 24. The graphic definition 40 is a collection of data which describes how to create a specific graphic layout. In various embodiments of the invention, the graphic definition 40 may be formatted according to extensible markup language (“XML”). As is understood by those skilled in the art, XML is a standard format for communicating data. In the XML data format, a schema is used to provide XML data with a set of grammatical and data type rules governing the types and structure of data that may be communicated. The XML data format is well-known to those skilled in the art, and therefore not discussed in further detail herein. The aspects of a graphic described by the graphic definition 40 include the name of a layout algorithm to use for each layout node, algorithm parameters, constraints, and constraint rules for constructing the layout tree, defaults for shape geometry and style properties, graphic classification data, and a sample data model.
Constraints are conditions used by a layout algorithm for creating a graphic. An example of a constraint is the value to be used for a shape's width. It will be appreciated that constraints may include numeric values or Boolean values. Numeric constraints can specify a specific numeric value (e.g., width=1 inch). Numeric constraints may also calculate their value by referring to other constraint values using references (e.g., height=width*0.75). Boolean constraints may include equality constraints which force all nodes in a set to have the same value for another constraint, and may include inequality constraints, where one constraint value is limited based on another constraint value (e.g. shape's width needs to be less-than or greater-than another shape's height). Constraints may be propagated between layout nodes to enforce equality between drawing elements (e.g., all normal nodes have the same font size) or inequality (e.g., width of transition nodes should be <=normal node width). Constraints may be propagated by attaching a shared propagator to a constraint which propagates its states to other layout nodes. It will be appreciated that both constraints and constraint rules may be updated on the other nodes from the propagating constraint. Constraint rules are a description of how to modify a set of constraints if they are unable to be met by a layout algorithm. For instance, a constraint may specify that a font size must be 14 points, but a constraint rule may specify that a font size can decrease to a minimum of 8 points. The graphic definition 40 will be discussed in greater detail with respect to
The layout tree 34 is a collection of presentation elements, or layout nodes. A layout node is a node in the layout tree representing one shape or group of shapes that forms an element of the graphic 24. A layout node may be optionally linked to the nodes of the data model 30. The layout tree 34 stores data about the shapes that will compose a graphic, including the respective geometries, properties, text fitting, and placement of shapes.
The drawing application program 10 constructs the layout tree by mapping the data from the data model to the graphic layout information in the graphic definition to construct layout nodes, and associating algorithms, constraints and constraint rules with these layout nodes. It then utilizes the algorithm, constraints, and constraint rules to determine shape dimensions, text fitting, and shape placement prior to constructing the shape list 50 which is used to render the graphic 24 on the drawing canvas. Layout nodes will be discussed in greater detail, below. The layout tree 34 will be discussed in greater detail with respect to
Referring now to
Referring now to
Referring now to
Referring now to
The routine 500 continues from operation 510 to operation 520, where the drawing application program 10 receives a graphic definition describing one possibility for the mapping of the data from the data model to layout nodes specifying algorithms, parameters, constraints, constraint rules, and shape properties. It will be appreciated that the graphic definition 40 may be retrieved as a separate file, such as an XML file, stored in the computer system 2. In this manner, support is provided for the development of new graphic definitions which may be added by a user so that they may be read by the drawing application program 10. New graphic definitions can be created and retrieved without changes to the layout framework, allowing for an expanding set of graphics that the drawing application can lay out.
The graphic definition provides patterns for applying the algorithms, parameters, constraints, and constraint rules. As defined herein, algorithms are layout routines for positioning and sizing shapes and text. For instance, one algorithm might lay out shapes on a linear path while another algorithm might lay shapes out in a circular path. It will be appreciated that algorithms may take parameters to determine various placement options. For instance, a linear algorithm has parameters for direction and orientation which may be controlled through various drawing tool commands in the drawing application program 10. For instance, a tool may be provided in the drawing application 10 for altering one of the parameters of the layout algorithm to change the orientation of the graphic (e.g., left-to-right vs. right-to-left) or rotate the graphic. The algorithms also are external to the layout framework and can be added to expand the range of graphics that can be created without changes to the layout framework.
The routine 500 continues from operation 520 to operation 530, where the drawing application program 10 generates a layout tree from the received data model and the received graphic definition. In particular, the drawing application program 10 “walks through” the nodes in the data model 30 and maps the nodes and relationships from the data model to specific shapes and default style properties (e.g., formatting and text properties) according to the graphic definition (which may also be defined by an XML schema). As discussed above with respect to
The routine 500 continues from operation 530 to operation 540, where the drawing application program 10 determines the shape size and position for the layout nodes in the layout tree, utilizing the algorithms, parameters, constraints, and constraint rules from the graphic definition. The routine 500 continues from operation 540 to operation 550, where the drawing application program 10 determines if the graphic to be rendered fits a layout space on the drawing canvas based on the constraint values.
If, at operation 550, the graphic to be rendered does not fit the layout space on the drawing canvas, the routine 500 continues to operation 560, where the drawing application program 10 modifies the constraint values using the constraint rules to fit the graphic into the layout space. In particular, the layout nodes in the layout tree 34 may include an ordered set of constraint rules which the drawing application program 10 may utilize to change the constraint values in an attempt to layout the graphic successfully within the layout space. According to various embodiments of the invention, the drawing application program 10 tries each rule in succession, moving on to the next rule only if the current rule does not allow the graphic to fit within the layout space. It will be appreciated that once the application program 10 has finished running through the rules list, it will automatically access a fallback rule list which forces the drawing elements to fit within the layout space on the drawing canvas by shrinking shapes and font size to a very small size, truncating text, or not placing shapes in the layout space.
It should be understood that the aforementioned graphic elements include shapes as well as text which fits inside shapes. Thus, the drawing application program 10 may also determine at operation 550 whether any of the text does not fit within the shapes in the layout space on the drawing canvas. It will be appreciated that text constraint rules as well as other rules may also be included in a layout node's constraint rule list to determine the order in which various techniques are applied to fit the text. These techniques may include growing the size of the shape or altering the text fit constraints (e.g., adjusting margins and font size). Text algorithms are associated with layout nodes of a layout tree where data exists in the data model. Other rules may include algorithms for determining the amount of space between two graphic elements. It will further be appreciated that other rules may utilize algorithms for determining the amount of space between two graphic elements, the relative position of graphic elements, etc.
If, at operation 550, the graphic to be rendered does fit the layout space on the drawing canvas, the routine 500 branches to operation 570, where the drawing application program 10 creates a shape list for the graphic to be created based on the layout tree data determined in operation 540. Once the nodes from the data model 30 and the relationships to specific shapes or shape properties are mapped, the shape list may be rendered on a drawing canvas. The routine 500 then ends.
Based on the foregoing, it should be appreciated that the various embodiments of the invention include a method and apparatus and computer-readable medium for managing specific types of content in an electronic document. The above specification, examples and data provide a complete description of the manufacture and use of the composition of the invention. Since many embodiments of the invention can be made without departing from the spirit and scope of the invention, the invention resides in the claims hereinafter appended.
This patent application is a continuation of U.S. patent application Ser. No. 10/955,271, entitled “Method, System and Computer-Readable Medium for Creating and Laying Out a Graphic within an Application program,” filed on Sep. 30, 2004 and assigned to the same assignee as this application. The aforementioned patent application is expressly incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
Parent | 10955271 | Sep 2004 | US |
Child | 12035878 | US |