Skip to content

Commit

Permalink
Solved missing reference marker issues
Browse files Browse the repository at this point in the history
This commit fixes the issues described by in3otd
(Qucs#407 (comment))

The fix consist on updating the ActiveMarkers map in the paint() event
so as to know if the reference marker has been removed or if its name
has changed. In these cases, the marker pointing to that reference is
set to be a convenitional marker.

In the same line, if the user activates the delta mode for the reference
marker, those markers pointing to that reference are converted into
conventional markers
  • Loading branch information
andresmmera committed Jul 9, 2017
1 parent 4a6b0e5 commit 754b7c7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions qucs/qucs/diagrams/diagram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,21 @@ qDebug() << "----------------------------";
foreach(Graph *pg, Graphs)
foreach(Marker *pm, pg->Markers)
{
IDref = pm->getReferenceMarkerID();
if (!ActiveMarkers.contains(IDref))
{//If the reference marker was removed or its name has changed, the marker pointing to that reference must be a conventional marker
pm->setReferenceMarkerID("");
pm->setMarkerMode(0);
}
else
{//The reference marker exists, then check if delta mode is activated
RefData = ActiveMarkers[IDref];//Reference marker data. The 5th field shows if delta mode is activated
if (RefData[5] == 1)
{//If the reference marker is already a delta marker, the current marker must be a conventional marker
pm->setReferenceMarkerID("");
pm->setMarkerMode(0);
}
}
pm->setMarkersMap(ActiveMarkers);
pm->paint(p, cx, cy);
}
Expand Down
5 changes: 5 additions & 0 deletions qucs/qucs/diagrams/marker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ void Marker::setReferenceMarkerID(QString ref)
ReferenceMarkerID=ref;
}

QString Marker::getReferenceMarkerID()
{
return ReferenceMarkerID;
}


// This function returns the marker values. Its main use is to provide data to the Diagram object so
// as to build a map with the data of all the active markers.
Expand Down
1 change: 1 addition & 0 deletions qucs/qucs/diagrams/marker.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class Marker : public Element {
Graph const *pGraph; // the corresponding graph

void setReferenceMarkerID(QString);
QString getReferenceMarkerID();
void setMarkersMap(QMap<QString, std::vector<double>>);

QMap<QString, std::vector<double>> getMarkersMap();
Expand Down

0 comments on commit 754b7c7

Please sign in to comment.