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
65 changes: 64 additions & 1 deletion depthmapX/GraphDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ void QGraphDoc::UpdateMainframestatus()
else if ((state & MetaGraph::DATAMAPS) && m_meta_graph->getViewClass() & MetaGraph::VIEWDATA) {
n = (int) m_meta_graph->getDisplayedDataMap().getShapeCount();
}
else if ((state & MetaGraph::TRACEMAPS) && m_meta_graph->getViewClass() & MetaGraph::VIEWTRACES) {
n = (int) m_meta_graph->getDisplayedTraceMap().getShapeCount();
}
// either showing or constructing the VGA graph
else if ((state & MetaGraph::POINTMAPS) && m_meta_graph->getViewClass() & MetaGraph::VIEWVGA) {
n = (int) m_meta_graph->getDisplayedPointMap().getFilledPointCount();
Expand Down Expand Up @@ -885,6 +888,53 @@ void QGraphDoc::OnFileExportLinks()
stream.close();
}

void QGraphDoc::OnFileExportTraces()
{
if (m_communicator) {
QMessageBox::warning(this, tr("Notice"), tr("Sorry, cannot export as another process is running"), QMessageBox::Ok, QMessageBox::Ok);
return; // Locked
}
if (!m_meta_graph->viewingProcessedTraces()) {
QMessageBox::warning(this, tr("Notice"), tr("Sorry, can only export traces maps"), QMessageBox::Ok, QMessageBox::Ok);
return; // No graph to export
}

QFilePath path(m_opened_name);
QString defaultname = path.m_path + (path.m_name.isEmpty() ? windowTitle() : path.m_name);

QString template_string = tr("Traceset XML file (*.xml)\n");

QFileDialog::Options options = 0;
QString selectedFilter;
QString outfile = QFileDialog::getSaveFileName(
0, tr("Save Output As"),
defaultname,
template_string,
&selectedFilter,
options);
if(outfile.isEmpty())
{
return;
}

FILE* fp = fopen(outfile.toLatin1(), "wb");
fclose(fp);

QFilePath filepath(outfile);
QString ext = filepath.m_ext;

std::ofstream stream(outfile.toLatin1());
if (stream.fail() || stream.bad()) {
QMessageBox::warning(this, tr("Notice"), tr("Sorry, unable to open file for export"), QMessageBox::Ok, QMessageBox::Ok);
stream.close();
return;
}

m_meta_graph->getDisplayedTraceMap().writeTracesToXMLFile(stream);

stream.close();
}

void QGraphDoc::OnAxialConnectionsExportAsDot()
{
if (m_communicator) {
Expand Down Expand Up @@ -925,6 +975,7 @@ void QGraphDoc::OnAxialConnectionsExportAsDot()

if (stream.fail() || stream.bad()) {
QMessageBox::warning(this, tr("Notice"), tr("Sorry, unable to open file for export"), QMessageBox::Ok, QMessageBox::Ok);
stream.close();
return;
}
shapeGraph.writeAxialConnectionsAsDotGraph(stream);
Expand Down Expand Up @@ -972,6 +1023,7 @@ void QGraphDoc::OnAxialConnectionsExportAsPairCSV()

if (stream.fail() || stream.bad()) {
QMessageBox::warning(this, tr("Notice"), tr("Sorry, unable to open file for export"), QMessageBox::Ok, QMessageBox::Ok);
stream.close();
return;
}
shapeGraph.writeAxialConnectionsAsPairsCSV(stream);
Expand Down Expand Up @@ -1019,6 +1071,7 @@ void QGraphDoc::OnSegmentConnectionsExportAsPairCSV()

if (stream.fail() || stream.bad()) {
QMessageBox::warning(this, tr("Notice"), tr("Sorry, unable to open file for export"), QMessageBox::Ok, QMessageBox::Ok);
stream.close();
return;
}
shapeGraph.writeSegmentConnectionsAsPairsCSV(stream);
Expand Down Expand Up @@ -1076,6 +1129,7 @@ void QGraphDoc::OnPointmapExportConnectionsAsCSV()

if (stream.fail() || stream.bad()) {
QMessageBox::warning(this, tr("Notice"), tr("Sorry, unable to open file for export"), QMessageBox::Ok, QMessageBox::Ok);
stream.close();
return;
}
pointMap.outputConnectionsAsCSV(stream, ",");
Expand Down Expand Up @@ -1613,6 +1667,9 @@ void QGraphDoc::OnEditClear()
else if (m_meta_graph->viewingProcessedShapes()) {
modified = m_meta_graph->getDisplayedDataMap().removeSelected();
}
else if (m_meta_graph->viewingProcessedShapes()) {
modified = m_meta_graph->getDisplayedTraceMap().removeSelected();
}

if(modified) {
modifiedFlag = true;
Expand Down Expand Up @@ -2185,6 +2242,9 @@ void QGraphDoc::OnUpdateColumn()
else if (vc & MetaGraph::VIEWDATA) {
shapemap = &(m_meta_graph->getDisplayedDataMap());
}
else if (vc & MetaGraph::VIEWTRACES) {
shapemap = &(m_meta_graph->getDisplayedTraceMap());
}

if (ReplaceColumnContents(pointmap,shapemap,col)) {
m_meta_graph->setDisplayedAttribute(col);
Expand Down Expand Up @@ -2275,6 +2335,9 @@ void QGraphDoc::OnEditQuery()
else if (vc & MetaGraph::VIEWDATA) {
shapemap = &(m_meta_graph->getDisplayedDataMap());
}
else if (vc & MetaGraph::VIEWTRACES) {
shapemap = &(m_meta_graph->getDisplayedTraceMap());
}

if (SelectByQuery(pointmap,shapemap)) {
SetRedrawFlag(VIEW_ALL, QGraphDoc::REDRAW_GRAPH, QGraphDoc::NEW_DATA );
Expand Down Expand Up @@ -2354,7 +2417,7 @@ bool QGraphDoc::SelectByQuery(PointMap *pointmap, ShapeMap *shapemap)

void QGraphDoc::OnEditSelectToLayer()
{
if ((m_meta_graph->getViewClass() & (MetaGraph::VIEWAXIAL|MetaGraph::VIEWDATA))
if ((m_meta_graph->getViewClass() & (MetaGraph::VIEWAXIAL|MetaGraph::VIEWDATA|MetaGraph::VIEWTRACES))
&& m_meta_graph->isSelected()) {

CRenameObjectDlg dlg("Layer"); // note, without specifying existing layer name, this defaults to "New layer" behaviour
Expand Down
1 change: 1 addition & 0 deletions depthmapX/GraphDoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public slots:
void OnFileExport();
void OnFileExportMapGeometry();
void OnFileExportLinks();
void OnFileExportTraces();
void OnAxialConnectionsExportAsDot();
void OnAxialConnectionsExportAsPairCSV();
void OnSegmentConnectionsExportAsPairCSV();
Expand Down
26 changes: 18 additions & 8 deletions depthmapX/dialogs/ColourScaleDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,8 @@ void CColourScaleDlg::MyUpdateData(bool dir, bool apply_to_all) {
m_color = m_displayparams.colorscale;
} else if (graph->getViewClass() & MetaGraph::VIEWAXIAL) {
ShapeGraph &map = graph->getDisplayedShapeGraph();
if (map.getShapeCount() > 0) {
m_display_min = map.getDisplayMinValue();
m_display_max = map.getDisplayMaxValue();
}
m_display_min = map.getDisplayMinValue();
m_display_max = map.getDisplayMaxValue();
m_displayparams = map.getDisplayParams();
m_color = m_displayparams.colorscale;
bool show_lines = m_show_lines, show_fill = m_show_fill, show_centroids = m_show_centroids;
Expand All @@ -291,10 +289,19 @@ void CColourScaleDlg::MyUpdateData(bool dir, bool apply_to_all) {
m_show_centroids = show_centroids;
} else if (graph->getViewClass() & MetaGraph::VIEWDATA) {
ShapeMap &map = graph->getDisplayedDataMap();
if (map.getShapeCount() > 0) {
m_display_min = map.getDisplayMinValue();
m_display_max = map.getDisplayMaxValue();
}
m_display_min = map.getDisplayMinValue();
m_display_max = map.getDisplayMaxValue();
m_displayparams = map.getDisplayParams();
m_color = m_displayparams.colorscale;
bool show_lines = m_show_lines, show_fill = m_show_fill, show_centroids = m_show_centroids;
map.getPolygonDisplay(show_lines, show_fill, show_centroids);
m_show_lines = show_lines;
m_show_fill = show_fill;
m_show_centroids = show_centroids;
} else if (graph->getViewClass() & MetaGraph::VIEWTRACES) {
TraceMap &map = graph->getDisplayedTraceMap();
m_display_min = map.getDisplayMinValue();
m_display_max = map.getDisplayMaxValue();
m_displayparams = map.getDisplayParams();
m_color = m_displayparams.colorscale;
bool show_lines = m_show_lines, show_fill = m_show_fill, show_centroids = m_show_centroids;
Expand Down Expand Up @@ -330,6 +337,9 @@ void CColourScaleDlg::MyUpdateData(bool dir, bool apply_to_all) {
} else if (graph->getViewClass() & MetaGraph::VIEWDATA) {
graph->getDisplayedDataMap().setDisplayParams(m_displayparams, apply_to_all);
graph->getDisplayedDataMap().setPolygonDisplay(m_show_lines, m_show_fill, m_show_centroids);
} else if (graph->getViewClass() & MetaGraph::VIEWTRACES) {
graph->getDisplayedTraceMap().setDisplayParams(m_displayparams, apply_to_all);
graph->getDisplayedTraceMap().setPolygonDisplay(m_show_lines, m_show_fill, m_show_centroids);
}
}
m_viewDoc->SetRedrawFlag(QGraphDoc::VIEW_ALL, QGraphDoc::REDRAW_GRAPH, QGraphDoc::NEW_DEPTHMAPVIEW_SETUP);
Expand Down
Loading