File: UmlBaseSubject.cpp

package info (click to toggle)
bouml 4.21-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 73,336 kB
  • ctags: 55,459
  • sloc: cpp: 290,644; makefile: 228; sh: 13
file content (27 lines) | stat: -rw-r--r-- 660 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

#include "UmlCom.h"
#include "UmlBaseSubject.h"
#include "UmlSubject.h"

void UmlBaseSubject::read_() {
  _name = UmlCom::read_string();
  _x = (int) UmlCom::read_unsigned();
  _y = (int) UmlCom::read_unsigned();
  _w = (int) UmlCom::read_unsigned();
  _h = (int) UmlCom::read_unsigned();
}

UmlSubject * UmlBaseSubject::get_container_(int x, int y, int w, int h, const QVector<UmlSubject> & subjects)
{
  int rank = subjects.count();

  while (rank-- != 0) {
    UmlBaseSubject * s = subjects[rank];

    if ((x > s->_x) && (y > s->_y) &&
        ((x + w) < (s->_x + s->_w)) && ((y + h) < (s->_y + s->_h)))
      return (UmlSubject  *) s;
  }
  return 0;
}