Embedding in an Application

The GCE geometric solver is designed to be a general-purpose parametric drawing component. It means that it can be embedded into any application that deals with planar geometry, drawings or sketches. We assume that such application already has its data structures that represent the sketch geometry. In fact, the developer who embeds GCE component in his application should provide to the solver control over his geometric objects and a due system of constraints. Solver API has its own abstract data type system that provides the minimal functionality required to define constraint satisfaction problem. Therefore, it is required to implement a special wrapper to provide sketch control to the geometric solver. The wrapper would be a bridge between the C3D Solver and the application, it would pass geometry and constraints data into the solver and also apply solver computation results to the sketch geometry. Fig. 1 shows a sample flow chart that describes the interaction of the constraint solver with a sketch. GCE wrapper serves sketch parametric model and performs the following functions:

  • Loads sketch geometric model expressed as C3D Solver data types into the solver;

  • Processes editor requests, e.g., adds or deletes constraint system data, calculates the sketch and drags geometric objects;

  • Controls the state of sketch geometry with applied constraints;

  • Vice versa, updates solver data based on the actual state of sketch geometry;

  • Hides (adapts) solver API using its mathematic data types and provides more convenient API with application data types.

../../../../_images/S.1.2.1.png

Fig. 1

The flow chart on Fig. 1 does not show the only solver embedding option, it just shows an example of a possible way to integrate it in an application with adaptation of GCE mathematic data structures to application data types.

The GCE component does not permit to save user data in a document file, so application developer should implement read/write sketch constraint system in the application document. Furthermore, one should take into account that the set of geometric solver types is not able to cover all diversity of application geometric types. For example, the solver does not have a rectangle type, but it may be represented as four points and lines with some constraints. A possible software implementation is based on creating its method for any drawing object that describes it in the solver.