-
Notifications
You must be signed in to change notification settings - Fork 263
Graph Data Model
ATF's graph interfaces are not dependent on the ATF DOM. However, virtually all concrete types in the graph namespace use the ATF DOM for their data model and undo/redo support, so practically speaking, you need to use the ATF DOM to fully utilize ATF's default DOM-based graph implementation. Nevertheless, all interfaces and generic types (such as renderers) in the ATF graph are not DOM-aware, so you can probably go a long way just by using these generic types and interfaces, if it is too much work to support the required graph interfaces in your custom graph data model. This may be the case if your main goal is to visualize your data model using ATF's graph rendering engine, without a need for complicated and interactive graph editing. However, in almost all cases, it is far easier and productive to adopt the ATF DOM directly.
If you use an XML Schema to define the data model, you can use the DomGen utility to generate a Schema
class containing metadata classes for the types.
The next step is to define your own DOM adapters to bind DOM data to the graph model at runtime. Typically this is an easy step, because you can derive from ATF's abstract DOM adapter classes and override the adapter's properties and methods as needed. In particular, override the properties that provide application-specific type metadata, typically using the metadata classes in the Schema
class. For details on how the ATF Circuit Editor Sample derives from existing DOM adapters, see DOM Adapters. There is an extensive set of DOM adapters for circuit graphs; for a list, see Circuit DOM Adapters.
For every complex type defined in the schema, there is a corresponding DomNodeType
that is created by the schema type loader class, which is usually named SchemaLoader
and derives from XmlSchemaTypeLoader
. You need to define your DOM adapters as extensions to each DOM type after the schema is loaded, but before attempting to load any application document. DOM adapters are usually defined on the data types in SchemaLoader
.
For example, for a circuit graph, you could create DOM adapters for schema types of pin, element (an item with pins such as an OR gate), and wire. You can also define adapters for composite types, such as circuit and group.
After setting up these visual elements that form the building blocks of a graph, the next step is to attach higher level DOM adapters that coordinate the editing, interaction, rendering, and validating of these elements. For example, some adapters provide an editing context for editing circuit items. For a description, see Circuit Context Classes. For an example of implementing contexts in ATF Circuit Editor Sample, see Context Classes. Other adapters can validate the graph as changes are made. For an example of circuit validation, see CircuitValidator Class.
In the ATF DOM, each graph element is represented by a DomNode
, and the graph is represented as a tree of DomNode
s. The tree can be stored as a part of the application's DomDocument
. The tree can be saved as XML using the DomXmlWriter
class and read back with DomXmlReader
for easy data serialization.
For more information on the ATF DOM, see the ATF Programmer's Guide: Document Object Model (DOM), downloadable from ATF Documentation.
- What is a Graph in ATF: General description of graphs.
- Graph Data Model: Data model for graphs using the ATF DOM.
- Types of Graphs: Types of graphs supported in ATF.
-
ATF Graph Interfaces: The main interface
IGraph
and other interfaces used in graphs. - General Graph Support: Description of general graph support.
- Circuit Graph Support: How to use circuit graphs, which ATF provides the most support for.
- Statechart Graph Support: Support for statechart type graphs.
- Home
- Getting Started
- Features & Benefits
- Requirements & Dependencies
- Gallery
- Technology & Samples
- Adoption
- News
- Release Notes
- ATF Community
- Searching Documentation
- Using Documentation
- Videos
- Tutorials
- How To
- Programmer's Guide
- Reference
- Code Samples
- Documentation Files
© 2014-2015, Sony Computer Entertainment America LLC