/// Draw the Slider
void Slider::draw() const
{
    if(showing)
    {
        if( type == HORIZONTAL )
        {
            gl::color( ColorA( 0.2,0.3,0.4, alpha) );
            gl::drawSolidRoundedRect( *this, 5.0, 32 );
          
            Rectf pctg_rect = Rectf( Vec2f( getX1(), getY1() ), Vec2f( getX1() + pctg*getWidth(), getY2() ) ) ;
            gl::color( color );
            gl::drawSolidRoundedRect( pctg_rect, 5.0, 32);
        }
        else if( type == VERTICAL )
        {
            gl::color( ColorA( 0.2,0.3,0.4, alpha) );
            gl::drawSolidRoundedRect( *this, 5.0, 32 );
           
            Rectf pctg_rect = Rectf( Vec2f( getX1(), getY2() - pctg*getHeight() ), Vec2f( getX2(), getY2() ) ) ;
            gl::color( color );
            gl::drawSolidRoundedRect( pctg_rect, 5.0, 32);
        }
        else if( type == CIRCULAR )
        {
            gl::color( ColorA( 0.2,0.3,0.4, alpha) );
            _drawArc( getCenter(), getWidth(), getHeight(), 0.0, 2*3.14159     , 10 );
            gl::color( color );
            _drawArc( getCenter(), getWidth(), getHeight(), 0.0, 2*3.14159*pctg, 7 );
        }
    }
}
Пример #2
0
//----------------------------------------------------------
bool Rect::operator == (const Rect & rect) const {
    bool bSame = true;
    bSame = bSame && (getX1() == rect.getX1());
    bSame = bSame && (getX2() == rect.getX2());
    bSame = bSame && (getY1() == rect.getY1());
    bSame = bSame && (getY2() == rect.getY2());
    return bSame;
}
Пример #3
0
std::vector<Line> HourGlass::getLines() const {
  std::vector<Line> lines;
  float x1 = getX1()+2;
  float x2 = getX2()-2;
  float y1 = getY1()+2;
  float y2 = getY2()-2;
  lines.push_back(Line(x1,y1,x2,y2));
  lines.push_back(Line(x2,y1,x1,y2));
  lines.push_back(Line(x1,y1,x2,y1));
  lines.push_back(Line(x1,y2,x2,y2));
  return lines;
}
Пример #4
0
void QFCropPixelsEdit::spinValueChanged()
{
    connectWidgets(false);
    if (spinX2->value()<=spinX1->value()) {
        spinX1->setValue(spinX2->value()+1);
    }
    if (spinY2->value()<=spinY1->value()) {
        spinY1->setValue(spinY2->value()+1);
    }
    connectWidgets(true);
    emit valueChanged(getX1(), getX2(), getY1(), getY2());
}
Пример #5
0
//----------------------------------------------------------
void Rect::lerp(const Rect & rect, float p) {

    float _x1 = coc::lerp(getX1(), rect.getX1(), p);
    float _x2 = coc::lerp(getX2(), rect.getX2(), p);
    float _y1 = coc::lerp(getY1(), rect.getY1(), p);
    float _y2 = coc::lerp(getY2(), rect.getY2(), p);

    setX1(_x1);
    setX2(_x2);
    setY1(_y1);
    setY2(_y2);
}
Пример #6
0
    arma::mat TogersonMetricLearner::generateB(int iIdx) {

        vec iVec = getX1(iIdx);

        expandConstraints();
        generateD();

        int i = iIdx;

        mat B(D.n_rows - 1, D.n_cols - 1);
        for(int j = 1; j < D.n_rows; ++j) {
            for(int k = 1; k < D.n_cols; ++k) {

                double costheta = ( pow(D(i, j), 2) + pow(D(i, k), 2) - pow(D(j, k), 2) ) / (2 * D(i, j) * D(i, k));
                B(j - 1, k - 1) = D(i, j) * D(i, k) * costheta;

            }
        }

        return B;

    }
Пример #7
0
    void InfTheoMetricLearner::computeConstraints() {

        simConstraints.flush();
        disSimConstraints.flush();

        int sampleCount = getSampleCount();

        for(int i = 0; i < sampleCount; ++i) {

            vec x1 = getX1(i);
            vec x2 = getX2(i);

            double dist = getSampleDistance(i);
            if(dist <= simBorder) {
                simConstraints.addConstraint(x1, x2, simBorder);
            } else if(dist >= disSimBorder) {
                disSimConstraints.addConstraint(x1, x2, disSimBorder);
            } else {
                // no additional constraint
            }

        }

    }
Пример #8
0
void UMLInheritanceLink::draw(Gtk::DrawingArea* drawingArea)
{
	Cairo::RefPtr<Cairo::Context> cr = drawingArea->get_window()->create_cairo_context();

	Arrows::draw_arrow(cr, getX1(), getY1(), getX2(), getY2(), Line::FULL, Arrow::NORMAL, Arrow::NONE, isSelected());
}
Пример #9
0
int QFCropPixelsEdit::getWIDTH() const
{
    return getX2()-getX1()+1;
}