mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Function for search conductor at the same potential.
When the search function is searching in a terminal element, they search only for the first terminal found, no matter if the terminal element have more than two terminals. So the list of conductors at the same potential is missing some conductors. This commit fix it, now the search function search for every terminals of a terminal element git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5307 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -765,24 +765,27 @@ Element *Terminal::parentElement() const {
|
||||
* @param t terminal to start search
|
||||
* @param all_diagram :if true return all related terminal,
|
||||
* false return only terminal in the same diagram of @t
|
||||
* @return
|
||||
* @return the list of terminal at the same potential
|
||||
*/
|
||||
Terminal * relatedPotentialTerminal (const Terminal *terminal, const bool all_diagram) {
|
||||
// If terminal parent element is a folio report.
|
||||
if (all_diagram && terminal -> parentElement() -> linkType() & Element::AllReport) {
|
||||
QList<Terminal *> relatedPotentialTerminal (const Terminal *terminal, const bool all_diagram)
|
||||
{
|
||||
// If terminal parent element is a folio report.
|
||||
if (all_diagram && terminal -> parentElement() -> linkType() & Element::AllReport)
|
||||
{
|
||||
QList <Element *> elmt_list = terminal -> parentElement() -> linkedElements();
|
||||
if (!elmt_list.isEmpty()) {
|
||||
return (elmt_list.first() -> terminals().first());
|
||||
if (!elmt_list.isEmpty())
|
||||
{
|
||||
return (elmt_list.first()->terminals());
|
||||
}
|
||||
}
|
||||
// If terminal parent element is a Terminal element.
|
||||
else if (terminal -> parentElement() -> linkType() & Element::Terminale) {
|
||||
QList <Terminal *> terminals = terminal -> parentElement() -> terminals();
|
||||
terminals.removeAll(const_cast<Terminal *> (terminal));
|
||||
if (!terminals.isEmpty())
|
||||
return terminals.first();
|
||||
// If terminal parent element is a Terminal element.
|
||||
else if (terminal -> parentElement() -> linkType() & Element::Terminale)
|
||||
{
|
||||
QList <Terminal *> terminals = terminal->parentElement()->terminals();
|
||||
terminals.removeAll(const_cast<Terminal *>(terminal));
|
||||
return terminals;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return QList<Terminal *>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user