void repozytorium::addLetter(int letter, int tryb, string user, int xMax) { int position = getPosition(user); lastChange.pozycja = position; lastChange.tryb = tryb; lastChange.znak = letter; if(lastChange.znak == 127) { int i = 1; vector<int>::iterator it = document.begin(); while( i < position) { it++; i++; } document.erase(it); changePosition(position, -1); lastChange.rozmiar = getDocumentSize(); sendChangeToAll(user); } else if(lastChange.znak == 10) { int i = 0; vector<int>::iterator it = document.begin(); cout<<position<<endl; while( i < position) { it++; i++; } int ile = i = (position % xMax); for(; i < xMax; i++) { cout<<i<<endl; if(position < getDocumentSize()) { it = document.insert(it, 10); } else document.push_back(10); changePosition(position, 1); position ++; } cout<<position<<endl; dopelnijEnter(position, xMax, ile); lastChange.rozmiar = getDocumentSize(); cout<<"wyslany rozmiar "<< lastChange.rozmiar<<endl; sendChangeToAll(user); } else if(tryb == CHANGE) { if(position < getDocumentSize()) { document.at(position) = letter; changeCursorPosition(user, 1); } else { document.push_back(letter); changePosition(position, 1); } lastChange.rozmiar = getDocumentSize(); sendChangeToAll(user); } else if(tryb == INSERT) { int i = 0; vector<int>::iterator it = document.begin(); while( i < position) { it++; i++; } if(position < getDocumentSize()) { document.insert(it, letter); changePosition(position, 1); } else { document.push_back(letter); changePosition(position, 1); } lastChange.rozmiar = getDocumentSize(); sendChangeToAll(user); } }
void SlugsPadCameraControl::getDeltaPositionPad(int x2, int y2) { QString dir = "nd"; QPointF localMeasures = ObtenerMarcacionDistanciaPixel(y1,x1,y2,x2); double bearing = localMeasures.x(); double dist = getDistPixel(y1,x1,y2,x2); if(((bearing > 330)&&(bearing < 360)) || ((bearing >= 0)&&(bearing <= 30))) { emit dirCursorText("up"); //bearing = 315; dir = "up"; } else { if((bearing > 30)&&(bearing <= 60) ) { emit dirCursorText("right up"); //bearing = 315; dir = "right up"; } else { if((bearing > 60)&&(bearing <= 105) ) { emit dirCursorText("right"); //bearing = 315; dir = "right"; } else { if((bearing > 105)&&(bearing <= 150) ) { emit dirCursorText("right down"); //bearing = 315; dir = "right down"; } else { if((bearing > 150)&&(bearing <= 195) ) { emit dirCursorText("down"); //bearing = 315; dir = "down"; } else { if((bearing > 195)&&(bearing <= 240) ) { emit dirCursorText("left down"); //bearing = 315; dir = "left down"; } else { if((bearing > 240)&&(bearing <= 300) ) { emit dirCursorText("left"); //bearing = 315; dir = "left"; } else { if((bearing > 300)&&(bearing <= 330) ) { emit dirCursorText("left up"); //bearing = 315; dir = "left up"; } } } } } } } } bearingPad = bearing; distancePad = dist; directionPad = dir; emit changeCursorPosition(bearing, dist, dir); update(); }