Program Listing for File PostscriptWriter.hpp

Return to documentation for file (include/networkit/viz/PostscriptWriter.hpp)

/*
 * PostscriptWriter.hpp
 *
 *  Created on: Apr 10, 2013
 *      Author: Henning
 */

#ifndef NETWORKIT_VIZ_POSTSCRIPT_WRITER_HPP_
#define NETWORKIT_VIZ_POSTSCRIPT_WRITER_HPP_

#include <fstream>
#include <string>
#include <vector>

#include <networkit/graph/Graph.hpp>
#include <networkit/structures/Partition.hpp>
#include <networkit/viz/Point.hpp>

namespace NetworKit {

class PostscriptWriter final {
public:
    PostscriptWriter(bool isTorus = false);

    void write(const Graph &g, const std::vector<Point2D> &coordinates, const Partition &clustering,
               std::string_view filename);

    void write(const Graph &g, const std::vector<Point2D> &coordinates, std::string_view filename);

private:
    bool wrapAround;

    Point2D ps_size;
    Point2D ps_border;

    Point2D ps_min;
    Point2D ps_max;
    Point2D ps_scale;

    void init(std::ofstream &file) const;

    void computeBoundaryBox(const std::vector<Point2D> &coordinates);

    void writeHeader(std::ofstream &file) const;
    void writeMacros(std::ofstream &file) const;
    void writeClustering(const Graph &g, const std::vector<Point2D> &coordinates,
                         const Partition &clustering, std::ofstream &file);
};

} /* namespace NetworKit */
#endif // NETWORKIT_VIZ_POSTSCRIPT_WRITER_HPP_