--- a/src/documentmanager.h Tue Nov 02 15:43:57 2021 +0200 +++ b/src/documentmanager.h Thu Mar 03 11:42:52 2022 +0200 @@ -19,6 +19,7 @@ #pragma once #include "libraries.h" #include "model.h" +#include "polygoncache.h" class DocumentManager : public QObject { @@ -55,10 +56,12 @@ QTextStream &errorStream); bool saveModel(const ModelId modelId, QTextStream& errors); std::optional<ModelId> findIdForModel(const Model* model) const; + PolygonCache* getPolygonCacheForModel(ModelId modelId); private: struct ModelInfo { std::unique_ptr<Model> model; + ModelId id; QString path; OpenType opentype; std::map<QString, ModelId> dependencies = {}; @@ -67,11 +70,13 @@ int modelIdCounter = 0; int untitledNameCounter = 0; std::map<ModelId, ModelInfo> openModels; + std::map<ModelId, PolygonCache> polygonCaches; void loadDependenciesForModel(const ModelId modelId, const QString& path, LoadDepedenciesBag& bag); void collectReferences(QSet<QString> &referenced, const QString& name, const Model* model); void updateDependencies(ModelInfo* model); void prune(); bool isReferencedByAnything(const ModelId modelId) const; + void makePolygonCacheForModel(const ModelId modelId); }; QString pathToName(const QFileInfo& path);