Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 47 additions & 9 deletions igramarea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2129,14 +2129,27 @@ void IgramArea::loadOutlineFile(const QString &fileName){
// an oln file at all (or some portions of the oln data get lost). Because of this I decided not to report any json parsing errors.
QJsonDocument loadDoc(QJsonDocument::fromJson(saveData));

// Reset region model + UI so loading is self-contained and never leaks old regions.
m_polygons.clear();
m_regionEdit->clear();

// outer
QJsonObject outside = loadDoc["outside_outline"].toObject();
CircleOutline out(outside);
m_outside = out;
m_outside.translate(QPointF(-cropTotalDx, -cropTotalDy));
m_OutterP1 = m_outside.m_p1;
m_OutterP2 = m_outside.m_p2;
outterPcount = 2;
if (m_outside.m_radius > 0) {
m_OutterP1 = m_outside.m_p1;
m_OutterP2 = m_outside.m_p2;
outterPcount = 2;
}
else {
qWarning() << "OLN load warning:" << fileName
<< "has no valid outside outline; clearing outside outline state.";
m_OutterP1 = QPointF(0,0);
m_OutterP2 = QPointF(0,0);
outterPcount = 0;
}

// center/inner
QJsonObject inside = loadDoc["inside_outline"].toObject();
Expand All @@ -2148,14 +2161,18 @@ void IgramArea::loadOutlineFile(const QString &fileName){
m_innerP2 = m_center.m_p2;
innerPcount = 2;
}
else {
m_innerP1 = QPointF(0,0);
m_innerP2 = QPointF(0,0);
innerPcount = 0;
}

const double filter = loadDoc["dft_filter_radius"].toDouble();
emit dftCenterFilter(filter);



// mask polygons regions
m_polygons.clear();
QJsonArray jregions = loadDoc["regions"].toArray();
for (int i=0; i < jregions.size(); ++i) {
QJsonArray jpoly = jregions[i].toArray();
Expand Down Expand Up @@ -2192,11 +2209,24 @@ void IgramArea::loadOutlineFileOldV6(const QString &fileName){
return;
}

// Reset region model + UI so loading is self-contained and never leaks old regions.
m_polygons.clear();
m_regionEdit->clear();


m_outside = readCircle(file, -cropTotalDx, -cropTotalDy);
m_OutterP1 = m_outside.m_p1;
m_OutterP2 = m_outside.m_p2;
outterPcount = 2;
if (m_outside.m_radius > 0) {
m_OutterP1 = m_outside.m_p1;
m_OutterP2 = m_outside.m_p2;
outterPcount = 2;
}
else {
qWarning() << "OLN load warning:" << fileName
<< "has no valid outside outline; clearing outside outline state.";
m_OutterP1 = QPointF(0,0);
m_OutterP2 = QPointF(0,0);
outterPcount = 0;
}
CircleOutline sideLobe = readCircle(file);
emit dftCenterFilter(sideLobe.m_radius);
char b = file.peek();
Expand All @@ -2209,13 +2239,21 @@ void IgramArea::loadOutlineFileOldV6(const QString &fileName){
m_innerP2 = m_center.m_p2;
innerPcount = 2;
}
else {
m_center = CircleOutline(QPointF(0,0),0);
m_innerP1 = QPointF(0,0);
m_innerP2 = QPointF(0,0);
innerPcount = 0;
}
}
else {
m_center.m_radius = 0;
m_center = CircleOutline(QPointF(0,0),0);
m_innerP1 = QPointF(0,0);
m_innerP2 = QPointF(0,0);
innerPcount = 0;
}

std::string line;
m_polygons.clear();
while(std::getline(file, line)){

if (line == "Poly"){
Expand Down
2 changes: 1 addition & 1 deletion surfacemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3209,7 +3209,7 @@ void SurfaceManager::report(){
doc->addResource(QTextDocument::ImageResource, QUrl(pixStat),
QVariant(pixStats.scaledToWidth(dlg.histoWidth * finalWidth,
Qt::SmoothTransformation)));
imagesHtml.append("<table style=\"page-break-before:always\" border = \"1\"><tr><th>Pixel Histogram and SLope error</th></tr> <tr><td> <img src = '" +
imagesHtml.append("<table style=\"page-break-before:always\" border = \"1\"><tr><th>Pixel Histogram and Slope error</th></tr> <tr><td> <img src = '" +
pixStat + "'></td></tr></table>");
}
editor->setHtml(title + html +zerns + imagesHtml + tail);
Expand Down
Loading