コード例 #1
0
ファイル: ofxUIWidget.cpp プロジェクト: BentleyBlanks/ksApp
void ofxUIWidget::drawPaddedOutline() {
	if(draw_padded_rect_outline && !embedded) {
		ofxUINoFill();
		ofxUISetColor(color_padded_rect_outline);
		drawComponent(skin_padded_outline,paddedRect);
	}
}
コード例 #2
0
ファイル: ofxUIWidget.cpp プロジェクト: BentleyBlanks/ksApp
void ofxUIWidget::drawFillHighlight() {
	if(draw_fill_highlight) {
		ofxUIFill();
		ofxUISetColor(color_fill_highlight);
		drawComponent(skin_fill_highlight,rect);
	}
}
コード例 #3
0
ファイル: ofxUIWidget.cpp プロジェクト: BentleyBlanks/ksApp
void ofxUIWidget::drawPadded() {
	if(draw_padded_rect && !embedded) {
		ofxUIFill();
		ofxUISetColor(color_padded_rect);
		drawComponent(skin_padded,paddedRect);
	}
}
コード例 #4
0
ファイル: ofxUIWidget.cpp プロジェクト: BentleyBlanks/ksApp
void ofxUIWidget::drawFill() {
	if(draw_fill) {
		ofxUIFill();
		ofxUISetColor(color_fill);
		drawComponent(skin_fill,rect);
	}
}
コード例 #5
0
ファイル: ofxUIWidget.cpp プロジェクト: BentleyBlanks/ksApp
void ofxUIWidget::drawOutlineHighlight() {
	if(draw_outline_highlight) {
		ofxUINoFill();
		ofxUISetColor(color_outline_highlight);
		drawComponent(skin_outline_highlight,rect);
	}
}
コード例 #6
0
ファイル: ofxUIWidget.cpp プロジェクト: BentleyBlanks/ksApp
void ofxUIWidget::drawOutline() {
	if(draw_outline) {
		ofxUINoFill();
		ofxUISetColor(color_outline);
		drawComponent(skin_outline,rect);		
	}
}
コード例 #7
0
ファイル: ofxUIWidget.cpp プロジェクト: BentleyBlanks/ksApp
void ofxUIWidget::drawBack() {
	if(draw_back) {
		ofxUIFill();
		ofxUISetColor(color_back);		
		drawComponent(skin_back, rect);
	}
}
コード例 #8
0
void HistogramGenerator::drawComponentFull(QPainter *davinci, const int *y, const float &scaling, const QRect &rect,
                                        const QColor &color, const int &textSpace, const bool &unscaled, const uint &max) const
{
    QImage component = drawComponent(y, rect.size() - QSize(0, textSpace), scaling, color, unscaled, max);
    davinci->drawImage(rect.topLeft(), component);

    int min = 0;
    for (uint x = 0; x < max; x++) {
        min = x;
        if (y[x] > 0) {
            break;
        }
    }
    int maxVal = max-1;
    for (int x = max-1; x >= 0; x--) {
        maxVal = x;
        if (y[x] > 0) {
            break;
        }
    }

    const int textY = rect.bottom()-textSpace+15;
    const int dist = 40;
    const int cw = component.width();

    davinci->drawText(0,            textY, "min");
    davinci->drawText(dist,         textY, QString::number(min, 'f', 0));

    davinci->drawText(cw-dist-30,   textY, "max");
    davinci->drawText(cw-30,        textY, QString::number(maxVal, 'f', 0));
}
コード例 #9
0
ファイル: MyRobot.cpp プロジェクト: JoseCardoso/CGRA
void myRobot :: draw()
{
	glPushMatrix();
	glTranslated(x, y ,z);
	glRotated(teta, 0 ,1,0);
	

		glPushMatrix();
		glRotated(90,0,1,0);
		drawComponent(2);
		glPopMatrix();


		glPushMatrix();	
		glRotated(180,0,1,0);
		drawComponent(3);		
		glPopMatrix();
	
		glPushMatrix();
		glRotated(-90,0,1,0);
		drawComponent(4);
		glPopMatrix();


		drawComponent(1);
	

		glPushMatrix();
		glRotated(180, 1,0,0);
		glBegin(GL_QUADS);
		glNormal3d(0, 1,0);
		glVertex3d(0.5,0,0.5);
		glVertex3d(0.5,0,-0.5);
		glVertex3d(-0.5,0,-0.5);
		glVertex3d(-0.5,0,0.5);
		glEnd();
		glPopMatrix();

	glPopMatrix();

}
コード例 #10
0
/* Draw function of a container (window/panel) control */
int drawContainer(control* self, control* window, SDL_Rect parent) {
    coordinates calculated_rects;
    int err = OK;
    if (self != NULL && window != NULL) {
        if (self->ctrl_type == ctrl_window || self->ctrl_type == ctrl_panel) {
            err = drawComponent(self,window,parent);
            if (err == OK) {
                calculated_rects = calculateRectangles(parent,self->rect);
                drawChildren(self,window,calculated_rects.to);
            }
        }
    }
    return err;
}
コード例 #11
0
void CircuitsWidget::deserialize(QString fileName) {
    std::string fn = fileName.toUtf8().constData();
    // n.b. Use this to convert QString in std::string on Windows!
	//std::string fn = qs.toLocal8Bit().constData();
	string line;
    ifstream file;
	file.open(fn.c_str());
    // test
    while(getline(file,line)){
        if(line.compare("#") == 0){
            getline(file,line); // reading type
            int t = atoi(line.c_str());
            getline(file,line); // reading id
            int id = atoi(line.c_str());
            getline(file,line); // reading x position
            int x = atoi(line.c_str());
            getline(file,line); // reading y position
            int y = atoi(line.c_str());
            getline(file,line); // reading width
            int w = atoi(line.c_str());
            getline(file,line); // reading height
            int h = atoi(line.c_str());
            getline(file,line); // reading value
            string sval = line;
            int val = atoi(line.c_str());
            switch(t) {
                case(8):{
                    //muler
                    Muler *m = new Muler(this);
                    drawComponent(m);
                    m->setId(id);
                    m->move(x,y);
                    m->resize(w,h);
                    m->setValue(val);
                    break;
                }
                case(7):{
                    //diver
                    Diver *d = new Diver(this);
                    drawComponent(d);
                    d->setId(id);
                    d->move(x,y);
                    d->resize(w,h);
                    d->setValue(val);
                    // NOTE: this is a particular case, please see under in "restoring connections" 
                    break;
                }
                case(6):{
                    //noter
                    Noter *n = new Noter(this);
                    drawComponent(n);
                    n->setId(id);
                    n->move(x,y);
                    n->resize(w,h);
                    n->setValue(val);
                    break;
                }
                case(5):{
                    //orer
                    Orer *o = new Orer(this);
                    drawComponent(o);
                    o->setId(id);
                    o->move(x,y);
                    o->resize(w,h);
                    o->setValue(val);
                    break;
                }
                case(4):{
                    // ander
                    Ander *a = new Ander(this);
                    drawComponent(a);
                    a->setId(id);
                    a->move(x,y);
                    a->resize(w,h);
                    a->setValue(val);
                    break;
                }
                case(3):{
                    // variable
                    Variable *v = new Variable(this);
	                drawComponent(v);
                    v->setId(id);
                    v->move(x,y);
                    v->resize(w,h);
                    v->setValue(val);
                    v->var->setPlaceholderText(sval.c_str());
                    break;
                }
                case(2):{
                    // collector
                    Collector *c = new Collector(this);
                    drawComponent(c);
                    c->setId(id);
                    c->move(x,y);
                    c->resize(w,h);
                    c->setValue(val);
                    break;
                }
                case(1):{
                    // adder
                    Adder *a = new Adder(this);
                    drawComponent(a);
                    a->setId(id);
                    a->move(x,y);
                    a->resize(w,h);
                    a->setValue(val);
                    break;
                }
                default:{
                    printf("FATAL ERROR: bad format\n");
				    exit(1);
                }
            }
        }
        if(line.compare("@") == 0){
            getline(file,line); // reading id
            int id = atoi(line.c_str());
            getline(file,line); // reading incoming components number
            int nin = atoi(line.c_str());
            getline(file,line); // reading outcoming components number
            int nou = atoi(line.c_str());
            // restoring connections
            int i = 0;
            while(componentList[i]->getId() != id)
                i++;
            for(int j = 0; j < nin; j++){
                getline(file,line);
                int z = atoi(line.c_str());
                int q = 0;
                while(componentList[q]->getId() != z)
                    q++;
                componentList[i]->inComponentList.append(componentList[q]);
                if(componentList[i]->getComponentType()==7){
                    // restoring correct divider if the component is a diver
                    Diver* d = (Diver*) componentList[i].data(); // pay attenction
                    d->setDivider(componentList[q]->getValue() / componentList[i]->getValue());
                }
                Wire *w = new Wire(componentList[i], componentList[q]);
				wireList.append(w);
            }
            for(int j = 0; j < nou; j++){
                getline(file,line);
                int z = atoi(line.c_str());
                int q = 0;
                while(componentList[q]->getId() != z)
                    q++;
                componentList[i]->outComponentList.append(componentList[q]);
                Wire *w = new Wire(componentList[i], componentList[q]);
				wireList.append(w);
            }
        }
    }
    file.close();
    repaint();
    setFocus();
}