many eval things

moved obsolete code
TeX work
This commit is contained in:
2017-04-10 18:20:11 +02:00
parent b2adb16b49
commit 32674e3fbb
21 changed files with 1063 additions and 251 deletions

View File

@@ -31,7 +31,7 @@ class PlotErrFunc {
K::GnuplotPlot gplot;
//std::vector<std::string> colors = {"#000000", "#ff0000", "#00bb00", "#0000ff"};
std::vector<std::string> colors = {"#000000", "#999999", "#0000ff", "#9999ff", "#ff0000"};
std::vector<std::string> colors = {"#000000", "#ff0000", "#00ff00", "#0000ff", "#00aaaa"};
bool markers = false;
@@ -42,10 +42,10 @@ public:
/** ctor with x-axis label */
PlotErrFunc(const std::string& xLabel, const std::string& yLabel) {
gplot.setLabelX(xLabel);
gplot.setLabelY(yLabel);
gplot.setRangeX(K::GnuplotAxisRange(0, K::GnuplotAxisRange::AUTO));
gplot.setRangeY(K::GnuplotAxisRange(0, K::GnuplotAxisRange::AUTO));
gplot.getAxisX().setLabel(xLabel);
gplot.getAxisY().setLabel(yLabel);
gplot.getAxisX().setRange(K::GnuplotAxis::Range(0, K::GnuplotAxis::Range::AUTO));
gplot.getAxisY().setRange(K::GnuplotAxis::Range(0, K::GnuplotAxis::Range::AUTO));
}
/** add one curve. Statistics<T> are allowed to be altered outside afterwards! */
@@ -53,7 +53,7 @@ public:
Entry entry(name, stats);
entry.line = new K::GnuplotPlotElementLines();
entry.line->setTitle(name);
entry.line->setLineWidth(2);
entry.line->getStroke().setWidth(2);
gplot.add(entry.line);
entries.push_back(entry);
}
@@ -89,7 +89,7 @@ public:
const Entry& e = entries[i];
e.line->clear();
e.line->setColorHex(colors[i]);
e.line->getStroke().getColor().setHexStr(colors[i]);
// distancen between min and max
const float minX = e.stats->getQuantile(0);

View File

@@ -25,16 +25,16 @@ public:
/** ctor */
PlotErrTime(const std::string& xLabel, const std::string& yLabel, const std::string& y2Label) {
gpplot.setLabelX(xLabel);
gpplot.setLabelY(yLabel);
gpplot.setLabelY2(y2Label);
gpplot.getAxisX().setLabel(xLabel);
gpplot.getAxisY().setLabel(yLabel);
gpplot.getAxisY2().setLabel(y2Label);
gpplot.add(&lineErr[0]); lineErr[0].setLineWidth(1.5); lineErr[0].setColorHex("#000000");
gpplot.add(&lineErr[1]); lineErr[1].setLineWidth(1.5); lineErr[1].setColorHex("#FF0000");
gpplot.add(&lineErr[2]); lineErr[2].setLineWidth(1.5); lineErr[2].setColorHex("#00FF00");
gpplot.add(&lineErr[3]); lineErr[3].setLineWidth(1.5); lineErr[3].setColorHex("#0000FF");
gpplot.add(&lineErr[0]); lineErr[0].getStroke().setWidth(1.5); lineErr[0].getStroke().getColor().setHexStr("#000000");
gpplot.add(&lineErr[1]); lineErr[1].getStroke().setWidth(1.5); lineErr[1].getStroke().getColor().setHexStr("#FF0000");
gpplot.add(&lineErr[2]); lineErr[2].getStroke().setWidth(1.5); lineErr[2].getStroke().getColor().setHexStr("#00FF00");
gpplot.add(&lineErr[3]); lineErr[3].getStroke().setWidth(1.5); lineErr[3].getStroke().getColor().setHexStr("#0000FF");
gpplot.add(&lineB); lineB.setLineWidth(1); lineB.setColorHex("#0000ff");
gpplot.add(&lineB); lineB.getStroke().setWidth(1); lineB.getStroke().getColor().setHexStr("#0000ff");
gpplot.add(&lineC);
gpplot.setGrid(true);

View File

@@ -107,6 +107,7 @@ public:
bool stairs = true;
bool obstacles = true;
bool outline = true;
K::GnuplotColor outlineColor = K::GnuplotColor::fromRGB(128,128,128);
float minZ = -9999;
float maxZ = +9999;
} settings;
@@ -126,17 +127,17 @@ public:
// how to draw the floorplan
mapOutlineConcrete.setColorHex("#888888"); mapOutlineConcrete.setLineWidth(2);
mapOutlineDrywall.setColorHex("#888888");
mapOutlineGlass.setColorHex("#888888"); mapOutlineGlass.setDashType(2);
mapOutlineConcrete.getStroke().getColor().setHexStr("#888888"); mapOutlineConcrete.getStroke().setWidth(2);
mapOutlineDrywall.getStroke().getColor().setHexStr("#888888");
mapOutlineGlass.getStroke().getColor().setHexStr("#888888"); mapOutlineGlass.getStroke().setType(K::GnuplotDashtype::DASHED);
splot.add(&mapOutlineConcrete);
splot.add(&mapOutlineDrywall);
splot.add(&mapOutlineGlass);
splot.add(&particles); particles.setPointSize(0.20); //particles.setColorHex("#777777");
splot.add(&pathReal); pathReal.setLineWidth(2); pathReal.setColorHex("#000000");
splot.add(&pathEst); pathEst.setLineWidth(2); pathEst.setColorHex("#0000ff");
splot.add(&pathReal); pathReal.getStroke().setWidth(2); pathReal.getStroke().getColor().setHexStr("#000000");
splot.add(&pathEst); pathEst.getStroke().setWidth(2); pathEst.getStroke().getColor().setHexStr("#0000ff");
splot.add(&points);
points.setPointType(7);
@@ -208,16 +209,29 @@ public:
if (p.z > settings.maxZ) {return;}
}
gp << "set object polygon from ";
for (size_t i = 0; i < points.size(); ++i) {
const Point3 p = points[i];
if (i > 0) {gp << " to ";}
gp << p.x << "," << p.y << "," << p.z << " ";
const K::GnuplotFill pfill = (fill) ? (K::GnuplotFill(K::GnuplotFillStyle::SOLID, K::GnuplotColor::fromHexStr(color))) : (K::GnuplotFill::NONE());
const K::GnuplotStroke pstroke = (!fill) ? (K::GnuplotStroke(K::GnuplotDashtype::SOLID, 1.0, K::GnuplotColor::fromHexStr(color))) : (K::GnuplotStroke::NONE());
K::GnuplotObjectPolygon* poly = new K::GnuplotObjectPolygon(pfill, pstroke);
for (const Point3 p : points) {
poly->add(K::GnuplotCoordinate3(p.x, p.y, p.z, K::GnuplotCoordinateSystem::FIRST));
poly->setZIndex(p.z); // manual depth ordering
}
gp << (front ? "front" : "");
if (fill) {gp << " fs solid ";} else {gp << " fs transparent ";}
gp << " fc rgb " << "'" << color << "'";
gp << "\n";
poly->setFront(front);
splot.getObjects().add(poly);
// gp << "set object polygon from ";
// for (size_t i = 0; i < points.size(); ++i) {
// const Point3 p = points[i];
// if (i > 0) {gp << " to ";}
// gp << p.x << "," << p.y << "," << p.z << " ";
// }
// gp << (front ? "front" : "");
// if (fill) {gp << " fs solid ";} else {gp << " fs transparent ";}
// gp << " fc rgb " << "'" << color << "'";
// gp << "\n";
}
@@ -289,6 +303,11 @@ public:
}
void plot() {
this->mapOutlineConcrete.getStroke().setColor(settings.outlineColor);
this->mapOutlineDrywall.getStroke().setColor(settings.outlineColor);
this->mapOutlineGlass.getStroke().setColor(settings.outlineColor);
gp.draw(splot);
gp << "unset multiplot\n"; // scaling
if (codeFile != "") {
@@ -313,10 +332,10 @@ public:
}
}
// process each selected floor
for (Floorplan::Floor* floor : floors) {
// plot obstacles
// plot obstacles?
if (settings.obstacles) {
for (Floorplan::FloorObstacle* obs : floor->obstacles) {
Floorplan::FloorObstacleLine* line = dynamic_cast<Floorplan::FloorObstacleLine*>(obs);
@@ -338,14 +357,15 @@ public:
// plot the floor's outline
if (settings.outline) {
for (Floorplan::FloorOutlinePolygon* poly : floor->outline) {
gp << "set object polygon from ";
for (size_t i = 0; i < poly->poly.points.size() + 1; ++i) {
if (i > 0) {gp << " to ";}
const Point2 pt = poly->poly.points[i % poly->poly.points.size()]; // ensures closing the polygon
gp << pt.x << "," << pt.y << "," << floor->atHeight << " ";
K::GnuplotColor color = (poly->outdoor) ? (K::GnuplotColor::fromRGB(200, 240, 200)) : (K::GnuplotColor::fromRGB(210,210,210));
K::GnuplotFill filler(K::GnuplotFillStyle::SOLID, color);
K::GnuplotObjectPolygon* gpol = new K::GnuplotObjectPolygon(filler, K::GnuplotStroke::NONE());
for (Point2 pt : poly->poly.points) {
K::GnuplotCoordinate3 coord(pt.x, pt.y, floor->atHeight, K::GnuplotCoordinateSystem::FIRST);
gpol->add(coord);
}
gp << " fs solid fc rgb " << ( poly->outdoor ? "'#bbeebb'" : "'#dddddd'");
gp << "\n";
gpol->close();
splot.getObjects().add(gpol);
}
}