Serializer Plugin

Ruben de Laat edited this page Jul 10, 2013 · 5 revisions
Clone this wiki locally

A serializer serializes an object model to a stream of data. Among the default serializers are: IFC2x3, IfcXml, CityGML and others. Most serializers will output a textbased format but that is not required.

Serializer plugins must implement SerializerPlugin interface

public interface SerializerPlugin extends Plugin {
    /**
     * @return A serializer
     */
    Serializer createSerializer(PluginConfiguration plugin);

    /**
     * @return Whether this plugin will be needing geometry
     */
    boolean needsGeometry();
}
public interface Serializer {
    void init(IfcModelInterface model, ProjectInfo projectInfo, PluginManager pluginManager, RenderEnginePlugin renderEnginePlugin, boolean normalizeOids) throws SerializerException;
    void writeToFile(File file) throws SerializerException;
    byte[] getBytes();
    IfcModelInterface getModel();
    InputStream getInputStream() throws IOException;
    void writeToOutputStream(OutputStream outputStream) throws SerializerException;
    void reset();
}

You can subclass EmfSerializer so you don't have to implement all methods.

You can subclass AbstractGeometrySerializer if your serializer is going to need triangulated geometry.