ShapeGenerator.cpp [plain text]
#include "common/Dynagraph.h"
#include "common/reorient.h"
#include <sstream>
using namespace std;
void ShapeGenerator::Process(ChangeQueue &Q) {
Layout *subs[2] = {&Q.insN,&Q.modN};
for(int i=0; i<2; ++i)
for(Layout::node_iter ni = subs[i]->nodes().begin(); ni !=subs[i]->nodes().end(); ++ni) {
Layout::Node *n = *ni;
if((i==0 || igd<Update>(n).flags&DG_UPD_POLYDEF) && gd<IfPolyDef>(n).whether) {
gd<Drawn>(n).clear();
try {
genpoly(gd<PolyDef>(n),gd<Drawn>(n));
}
catch(BadPolyDef) {
gd<Drawn>(n).clear();
}
NodeGeom &ng = gd<NodeGeom>(n);
ng.region.shape.Clear();
if(gd<Drawn>(n).size()) {
Line &biggest = gd<Drawn>(n).front(); ng.region.shape.resize(biggest.size());
for(size_t i = 0; i<biggest.size(); ++i)
ng.region.shape[i] = reorient(biggest[i],true,gd<Translation>(Q.current).orientation);
ng.region.shape.degree = biggest.degree;
}
ng.region.updateBounds();
Q.ModNode(n,DG_UPD_REGION|DG_UPD_DRAWN);
}
}
}