| 136 | |
| 137 | |
| 138 | QPointF |
| 139 | NodeGeometry:: |
| 140 | portScenePosition(PortIndex index, |
| 141 | PortType portType, |
| 142 | QTransform const & t) const |
| 143 | { |
| 144 | auto const connectionDiameter = StyleCollection::nodeStyle().ConnectionPointDiameter; |
| 145 | |
| 146 | if( _ports_layout == PortLayout::Horizontal) |
| 147 | { |
| 148 | unsigned int step = _entryHeight + _spacing; |
| 149 | double totalHeight = step * index; |
| 150 | totalHeight += step / 2.0; |
| 151 | |
| 152 | double x = (portType == PortType::Out) ? _width + connectionDiameter : |
| 153 | - connectionDiameter; |
| 154 | return t.map( QPointF(x, totalHeight) ); |
| 155 | } |
| 156 | else |
| 157 | { |
| 158 | unsigned int nPorts = _dataModel->nPorts(portType); |
| 159 | unsigned int step = _width / (nPorts + 1); |
| 160 | double x = step * (index+1); |
| 161 | |
| 162 | double y = (portType == PortType::Out) ? _height + connectionDiameter : |
| 163 | - connectionDiameter; |
| 164 | return t.map( QPointF( x, y) ); |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | |
| 169 | PortIndex |