void ofApp::draw() { ofBackground(255); float w = ofGetWidth(); float h = ofGetHeight(); float orig_width = background.getWidth(); float orig_height = background.getHeight(); float factor = (w/2.1) / orig_width; ofApp::img_x = w/2 - (orig_width * factor)/2; ofApp::img_y = h/3 - (orig_height * factor)/2; ofApp::img_w = orig_width * factor; ofApp::img_h = orig_height * factor; if(!hideMovement && !hideBackgroundWhileDrawing){ the_stream->draw(img_x, img_y, img_w, img_h); }else if(!hideBackgroundWhileDrawing){ background.draw(img_x, img_y, img_w, img_h); } if(drawing){ movement.draw(img_x, img_y, img_w, img_h); } ofPushStyle(); ofSetColor(0, 0, 0); string str = "STREAMING LIVE FROM: " + stream_name; ofDrawBitmapString(str, img_x, img_y + img_h + 20); ofDrawBitmapString(threshold, img_x, img_y + img_h + 35); if (!hideMovement && drawing){ ofSetColor(250); ofDrawRectangle(img_x, img_y + img_h + 75, img_w, 80); ofSetColor(240); drawMinus(img_x + (img_w/2), img_y + img_h + 75 + 40); }else if (!hideMovement){ ofSetColor(240); ofDrawRectangle(img_x, img_y + img_h + 75, img_w, 80); ofSetColor(180); drawMinus(img_x + (img_w/2), img_y + img_h + 75 + 40); }else{ ofSetColor(230); ofDrawRectangle(img_x, img_y + img_h + 75, img_w, 80); ofSetColor(200); drawMinus(img_x + (img_w/2), img_y + img_h + 75 + 40); } if (!drawing){ ofSetColor(240); ofDrawRectangle(img_x, img_y + img_h + 185, img_w, 80); ofSetColor(180); drawPlus(img_x + (img_w/2),img_y + img_h + 185 + 40); }else{ ofSetColor(210); ofDrawRectangle(img_x, img_y + img_h + 185, img_w, 80); ofSetColor(180); drawPlus(img_x + (img_w/2),img_y + img_h + 185 + 40); } // -------- //hidebackgroundWhile Drawing ofSetColor(252); if (drawing){ ofDrawRectangle(img_x, img_y + img_h + 295, img_w, 80); } //next stream ofDrawRectangle(img_x + img_w + 30, img_y, 80, img_h); //reset current stream: ofDrawRectangle(img_x - 30 - 80, img_y, 80, img_h); //treshold - ofDrawRectangle(20, 20, 80, 80); //treshold + ofDrawRectangle(120, 20, 80, 80); ofPopStyle(); }
void CalloutNote::drawNoteNodeConnector(QPainter *painter, bool visible) { float width; float height; QRectF itemPos; if(_scene->_pathBubbles[_pid]==NULL) //does not work return; PathBubble1* path=_scene->_pathBubbles[_pid]; if(!path || path==NULL || !path->isVisible()) return; QPointF dis1=this->sceneBoundingRect().center(); QPointF dis2=path->sceneBoundingRect().center(); if(fixedSize) { width=graphReferenceSize/2*path->_scale; height=graphReferenceSize/2*path->_scale; } else { width=this->realRect().width()/2*path->_scale; height=this->realRect().height()/2*path->_scale; } if(_type == 'L' && _id>=path->ANodeRect.size()) return; switch(_type) { case 'C': itemPos = path->complexRect[_id]; break; case 'E': itemPos = path->physicalEntityRect[_id]; break; case 'P': itemPos = path->proteinRect[_id]; break; case 'S': itemPos = path->smallMoleculeRect[_id]; break; case 'D': itemPos = path->DnaRect[_id]; break; case 'R': itemPos = path->reactionRect[_id]; break; case 'L': itemPos = path->ANodeRect[_id]; break; case 'M': itemPos = path->compartmentRect[_id]; break; } QPointF start,end; start=QPointF(0,0); end=itemPos.center(); start=start+dis1; end=end+dis2; QRectF noteRect=this->sceneBoundingRect(); QRectF pathRect=path->sceneBoundingRect(); float w,h; w=realRect().width(), h=realRect().height(); noteRect=QRectF(noteRect.center().x()-w/2, noteRect.center().y()-h/2, w, h ); QPointF markPos(end.x()+itemPos.width()*0.5, end.y()-itemPos.height()*0.1); _deleteMark = QRectF(noteRect.x()+noteRect.width()*0.90, noteRect.y()+noteRect.height()*0.03, noteRect.width()*0.08, noteRect.width()*0.08); _minimizeMark = QRectF(noteRect.x()+noteRect.width()*0.80, noteRect.y()+noteRect.height()*0.03, noteRect.width()*0.08, noteRect.width()*0.08); //clip QColor c=QColor(_colorBoarder.a, _colorBoarder.b, _colorBoarder.c, 255); if(visible) { if(!noteRect.contains(end)) { drawArrow_5(painter, start, markPos-QPointF(itemPos.width()*0.04,0), QRect(noteRect.center().x()-w/2,noteRect.center().y()-h/2, w, h ), width, height, c ); } drawCross(painter,_deleteMark, c); drawMinus(painter,_minimizeMark, c); } else { //if within the path bubble if(pathRect.contains(start)|| pathRect.contains(end)) drawNoteMark(painter, start, end, QRect(noteRect.center().x()-w/2,noteRect.center().y()-h/2, w, h ), markPos, markRect, width, height, c ); } }