void function(const Eigen::Ref<const Eigen::VectorXd> &x, Eigen::Ref<Eigen::VectorXd> out) const override
    {
        if (chains_ == 2)
        {
            out[0] = (getTip(x, 0) - getTip(x, 1)).norm() - radius_ * 2;
            return;
        }

        unsigned int idx = 0;

        Eigen::Vector3d centroid = Eigen::Vector3d::Zero();
        for (unsigned int i = 0; i < chains_; ++i)
            centroid += getTip(x, i);
        centroid /= chains_;

        for (unsigned int i = 0; i < chains_; ++i)
            out[idx++] = (centroid - getTip(x, i)).norm() - radius_;

        for (unsigned int i = 0; i < chains_ - 3; ++i)
        {
            const Eigen::Vector3d ab = getTip(x, i + 1) - getTip(x, i);
            const Eigen::Vector3d ac = getTip(x, i + 2) - getTip(x, i);
            const Eigen::Vector3d ad = getTip(x, i + 3) - getTip(x, i);

            out[idx++] = ad.dot(ab.cross(ac));
        }
    }
Example #2
0
void DatasetsListWidget::sl_newDataset() {
    GCOUNTER(cvar, tvar, "WD::Dataset::New Dataset");
    QString error;
    QString text = getTip();
    do {
        bool ok = false;
        text = QInputDialog::getText(this,
            tr("Enter Dataset Name"),
            tr("New dataset name:"),
            QLineEdit::Normal,
            text, &ok);
        if (!ok) {
            return;
        }
        U2OpStatusImpl os;
        ctrl->addDataset(text, os);
        error = os.getError();
        if (!error.isEmpty()) {
            QMessageBox::critical(this, tr("Error"), error);
        }
    } while (!error.isEmpty());

    // activate the tab after adding
    tabs->setCurrentIndex(tabs->count() - 1);
}
bool ModelContact::salvare(CString fisier)
{
	char fis[200];
	strcpy(fis,fisier.GetBuffer());
	std::ofstream fo(fis,std::ios::app);
	fo.flush();

	if(!fo.is_open())
		return false;

	CString linie;
	linie.Empty();
	switch(getTip())
	{
		case Friend:
			linie=_T("f"); break;
		case Colleague:
			linie=_T("c"); break;
		case Acquaintance:
			linie=_T("a"); break;
	}
	linie.Append("|");
	linie.Append(nume);
	linie.Append("|");
	linie.Append(prenume);
	linie.Append("|");
	linie.Append(nr_tel);
	linie.Append("|");
	linie.Append(atribut);

	char lin[300];
	strcpy(lin,linie.GetBuffer());
	fo<<lin<<"\n";
	return true;
}
Example #4
0
	Node StrokeStreamer::toNode(const BitmapGraphics::HStroke stroke)
	{
		Node node("Stroke");
		node.setOpening(true);
		BitmapGraphics::Color strokeColor = stroke->getColor();
		std::string sColor = strokeColor.toHexString();
		node.addAtribute("color", sColor);
		node.addAtribute("size", std::to_string(stroke->getSize()));
		node.addAtribute("tip", getTip(stroke));
		node.setClosing(true);
		return node;
	}
Example #5
0
bool ZClickableLabel::event(QEvent *event)
{
  if(event->type() == QEvent::ToolTip)
  {
    QHelpEvent *helpEvent = (QHelpEvent *) (event);
    QRect tipRect;
    QString tipText;
    if(getTip(helpEvent->pos(), &tipRect, &tipText))
      QToolTip::showText(
            helpEvent->globalPos(), tipText, this, tipRect);
    else
      QToolTip::hideText();
  }
  return QWidget::event(event);
}
Example #6
0
QString WeatherPlugin::getTipText()
{
    QString str = getTip();
    if (str.isEmpty())
        str = i18n("%l<br><br>\n"
                   "<img src=\"icon:weather\"> %c<br>\n"
                   "Temperature: <b>%f &deg;F</b> (<b>%s &deg;C</b>)<br>\n"
                   "Humidity: <b>%h%</b><br>\n"
                   "Pressure: <b>%i</b> in (<b>%a</a> hPa)<br>\n"
                   "Wind: <b>%r</b> <b>%w</b> mph (<b>%x</b> km/h)<br>\n"
                   "Sunrise: %p<br>\n"
                   "Sunset: %q<br>\n"
                   "<br>\n"
                   "Updated: %u");
    return str;
}
Example #7
0
QString WeatherPlugin::getTipText()
{
    QString str = getTip();
    if (str.isEmpty())
        str = i18n("%l<br><br>\n"
                   "<img src=\"icon:weather\"> %c<br>\n"
                   "Temperature: <b>%t</b><br>\n"
                   "Humidity: <b>%h</b><br>\n"
                   "Pressure: <b>%i</b><br>\n"
                   "Wind: <b>%r</b> <b>%w</b><br>\n"
                   "Sunrise: %p<br>\n"
                   "Sunset: %q<br>\n"
                   "<br>\n"
                   "Updated: %u<br>\n"
				   "Weather data provided by weather.com") + QChar((unsigned short)176);
    return str;
}
Example #8
0
QString WeatherPlugin::getTipText()
{
    QString str = getTip();
    if (str.isEmpty())
        str = i18n("%l<br><br>\n"
                   "<img src=\"icon:weather\"> %c<br>\n"
                   "Temperature: <b>%t</b> (feels like: <b>%f</b>)<br>\n"
                   "Humidity: <b>%h</b><br>\n"
                   "Pressure: <b>%p</b><br>\n"
                   "Wind: <b>%b</b> <b>%w %g</b><br>\n"
				   "Visibility: <b>%v</b><br>\n"
				   "Dew Point: <b>%d</b><br>\n"
                   "Sunrise: %r<br>\n"
                   "Sunset: %s<br>\n"
                   "<br>\n"
                   "Updated: %u<br>\n");
    return str;
}
Example #9
0
QString WeatherPlugin::getTipText()
{
    QString str = getTip();
    if (str.isEmpty())
        str = i18n("%l<br><br>\n"
                   "<img src=\"icon:weather%i\"> %c<br>\n"
                   "Temperature: <b>%t</b> (feels like: <b>%f</b>)<br>\n"
                   "Humidity: <b>%h</b><br>\n"
                   "Precipitance: <b>%pp %</b><br>\n"
                   "Pressure: <b>%p</b> (%q)<br>\n"
                   "Wind: <b>%b</b> <b>%w %g</b><br>\n"
                   "Visibility: <b>%v</b><br>\n"
                   "Dew Point: <b>%d</b><br>\n"
                   "Sunrise: %r<br>\n"
                   "Sunset: %s<br>\n"
                   "<img src=\"icon:moon%mi\"> %mp<br>\n"
				   "UV-Intensity is <b>%ut</b> with value <b>%ui</b> (of 11)<br>\n"
                   "<br>\n"
                   "Updated: %u<br>\n");
    return str;
}
Example #10
0
bool SearchList::event(QEvent *e)
{
	if (e->type() == QEvent::ToolTip) {
		QHelpEvent *hEvent = static_cast<QHelpEvent *>(e);
		QPoint pt = m_pList->mapFromParent(hEvent->pos());

		pt.setY(pt.y() -  m_pList->header()->height());

		QTreeWidgetItem* pItem = m_pList->itemAt(pt);

		if (pItem) {
			QString sTip;
			getTip(pItem, sTip);
			QToolTip::showText(hEvent->globalPos(), sTip);
		} else {
			QToolTip::hideText();
			e->ignore();
		}
		return true;
	}
	return QWidget::event(e);
}
Example #11
0
/*
 * addToolBarItem - add an item to the tool bar
 */
static void addToolBarItem( tool_item *item )
{
    TOOLITEMINFO        info;
    int                 id;

    if( item->is_blank ) {
        info.u.blank_space = 8;
        info.flags = ITEM_BLANK;
    } else {
        info.id = item->id;
        info.u.bmp = item->bmp;
        info.flags = 0;
    }
    id = getTip( item->name );
    if( id >= 0 ) {
        LoadString( InstanceHandle, id, info.tip, MAX_TIP );
    } else {
        info.tip[0] = '\0';
    }
    info.depressed = false;
    ToolBarAddItem( toolBar, &info );
    InvalidateRect( ToolBarWindow( toolBar ), NULL, FALSE );

} /* addToolBarItem */