TemporalConstraintView::TemporalConstraintView(
        TemporalConstraintPresenter &presenter,
        QGraphicsObject* parent) :
    ConstraintView {presenter, parent},
    m_bgColor{ScenarioStyle::instance().ConstraintDefaultBackground},
    m_labelItem{new SimpleTextItem{this}},
    m_counterItem{new SimpleTextItem{this}}
{
    this->setParentItem(parent);

    this->setZValue(ZPos::Constraint);
    m_leftBrace = new LeftBraceView{*this, this};
    m_leftBrace->setX(minWidth());

    m_rightBrace = new RightBraceView{*this, this};
    m_rightBrace->setX(maxWidth());

    const int fontSize = 12;
    auto f = Skin::instance().SansFont;
    f.setBold(false);
    f.setPointSize(fontSize);
    f.setStyleStrategy(QFont::NoAntialias);
    m_labelItem->setFont(f);
    m_labelItem->setPos(0, -16);
    m_labelItem->setAcceptedMouseButtons(Qt::MouseButton::NoButton);
    m_labelItem->setAcceptHoverEvents(false);
    f.setPointSize(7);
    f.setStyleStrategy(QFont::NoAntialias);
    m_counterItem->setFont(f);
    m_counterItem->setColor(ColorRef(&Skin::Light));
    m_counterItem->setAcceptedMouseButtons(Qt::MouseButton::NoButton);
    m_counterItem->setAcceptHoverEvents(false);
}
Beispiel #2
0
PointRender<Scalar, Dim>::PointRender(const Vector<Scalar, Dim>* points, unsigned int point_num, const std::vector<Scalar> &point_size)
    :points_(points), point_num_(point_num)
{
    setPointSize(point_size);
    setPointColor(Color<Scalar>::Green());
    render_mode_ = point_mode_;
}
Beispiel #3
0
PointRender<Scalar, Dim>::PointRender(const Vector<Scalar, Dim> *points, unsigned int point_num)
    :points_(points), point_num_(point_num)
{
    setPointSize(default_point_size_);
    setPointColor(Color<Scalar>::Green());
    render_mode_ = point_mode_;
}
SensorBrowseControl::SensorBrowseControl(bool showPoints) :
    mUi(new Ui_SensorBrowseControl()),
    mLogFilesize(0),
    mLogFilepos(0),
    mMinDistance(Converter::mMinDistance),
    mMaxDistance(Converter::mMaxDistance) {
  mUi->setupUi(this);
  mLogMenu = mMenu.addMenu("Log");
  mLogStartAction = mLogMenu->addAction("Seek start", this,
    SLOT(logStartClicked()));
  mLogStartAction->setShortcut(Qt::Key_Home);
  mLogPlayAction = mLogMenu->addAction("Play", this,
    SLOT(logPlayTriggered()));
  mLogPlayAction->setCheckable(true);
  mLogPlayAction->setShortcut(Qt::Key_Space);
  mLogSkipAction = mLogMenu->addAction("Skip scan", this,
    SLOT(logSkipClicked()));
  mLogSkipAction->setShortcut(Qt::Key_PageDown);
  mTimer.setSingleShot(true);
  connect(&mTimer, SIGNAL(timeout()), this, SLOT(timerTimeout()));
  mUi->colorChooser->setPalette(&mPalette);
  connect(&mPalette, SIGNAL(colorChanged(const QString&, const QColor&)),
    this, SLOT(colorChanged(const QString&, const QColor&)));
  connect(&View3d::getInstance().getScene(), SIGNAL(render(View3d&, Scene3d&)),
    this, SLOT(render(View3d&, Scene3d&)));
  setPointColor(Qt::gray);
  setPointSize(1.0);
  setShowPoints(showPoints);
  setSmoothPoints(true);
  setCalibrationFilename(mUi->calibrationEdit->text());
  setLogFilename(QDir::current().path());
  setMinDistance(mMinDistance);
  setMaxDistance(mMaxDistance);
}
Beispiel #5
0
PaintData::PaintData()
	: _type(TYPE::SIGNAL),
	_mins(0),
	_maxs(0),
	_dim(0),
	_colormap(0),
	_pen(0),
	_brush(0),
	_back_brush(0),
	_font(0),
	_font_pen(0),
	_font_brush(0),
	_precision(2),
	_fix_limits(false),
	_fix_min (0),
	_fix_max (0),
	_indx (0),
	_indy (1),
	_reset_limits (true),
	_stream_has_changed (true) {

	_label[0] = '\0';

	_painter = new Painter();
	setColormap(IColormap::COLORMAP::COLOR64);
	setPen(IPainter::ITool::COLORS::GREEN, 1, IPainter::ITool::LINE_STYLES::SOLID);
	setBrush(IPainter::ITool::COLORS::BLACK);
	setBackground(true, IPainter::ITool::COLORS::BLACK);
	setFont("Courier New", IPainter::ITool::COLORS::WHITE, IPainter::ITool::COLORS::BLACK, 15, IPainter::ITool::FONT_STYLES::NORMAL);
	setPointSize(5);

	ssi_stream_init(_stream, 0, 0, sizeof(ssi_real_t), SSI_REAL, 0);
	ssi_stream_init(_resample, 0, 0, sizeof(ssi_real_t), SSI_REAL, 0);
}
Beispiel #6
0
Font::Font(const String& family, int pointSize) :
	desc_(pango_font_description_from_string(family.toUtf8())),
	isStrikeout_(false),
	isUnderline_(false)
{
	setPointSize(std::max(pointSize, 1));
}
Beispiel #7
0
PointRender<Scalar, Dim>::PointRender()
    :points_(NULL), point_num_(0)
{
    setPointSize(default_point_size_);
    setPointColor(Color<Scalar>::Green());
    render_mode_ = point_mode_;
}
Beispiel #8
0
QFont PluginListWidgetItemDelegate::subtitleFont(const QFont &baseFont) const
{
	auto retFont = baseFont;
	retFont.setItalic(true);
	retFont.setPointSize(baseFont.pointSize()-2);

	return retFont;
}
Beispiel #9
0
// Limit an entered point size, call the set function to set up slider, and pass it on
void ContSurfPoint::pointSizeEntered()
{
  float value = pointSizeEdit->text().toFloat();
  if (value < 0.)
    value = 0.;
  if (value > MAX_POINT_SIZE)
    value = MAX_POINT_SIZE;
  setPointSize(value, 0);
  icePointSize(value);
}
Beispiel #10
0
DialogButton::DialogButton(QWidget *parent):
    QToolButton(parent)
{
    auto fnt = this->font();
    fnt.setPointSize(14);
    fnt.setBold(true);
    this->setFont(fnt);

    this->setMinimumSize(140, 50);
    this->setStyleSheet("background:rgb(100, 100, 100); border-style: inset; border-width: 1px; border-color: white; border-radius: 5px; color:white;");
}
Beispiel #11
0
LayerView::LayerView(QGraphicsItem* parent) :
    Process::LayerView {parent}
{
    setZValue(1);
    setFlags(ItemClipsChildrenToShape | ItemIsSelectable | ItemIsFocusable);
    setAcceptDrops(true);
    auto f = Skin::instance().SansFont;
    f.setPointSize(fontSize);

    m_textcache.setFont(f);
    m_textcache.setCacheEnabled(true);
}
void ofxRParticleRenderer::init()
{
    bAllocatedPointSize = true;
    pointSize = new float;
    setPointSize(5.0);
    bAllocatedAdditiveBlending = true;
    bAdditiveBlending = new bool;
    setAdditiveBlending(true);

    bAllocatedDepthTesting = true;
    bDepthTesting = new bool;
    setDepthTesting(false);
}
Beispiel #13
0
JFont::JFont(int face, int style, int size)
  : QFont(), metrics(*this)
{
  int qfont_size;
  QString qfont_family;
  switch (size)
  {
    case SIZE_SMALL:
      qfont_size = QFONT_SIZE_SMALL;
      break;
      
    default:
    case SIZE_MEDIUM:
      qfont_size = QFONT_SIZE_MEDIUM;
      break;
      
    case SIZE_LARGE:
      qfont_size = QFONT_SIZE_LARGE;
      break;
  }
  setPointSize(qfont_size);
  
  switch (face)
  {
    case FACE_SYSTEM:
      qfont_family = QFONT_FAMILY_SYSTEM;
      break;
    
    default:
    case FACE_PROPORTIONAL:
      qfont_family = QFONT_FAMILY_PROPORTIONAL;
      break;
      
    case FACE_MONOSPACE:
      qfont_family = QFONT_FAMILY_MONOSPACE;
      break;
  }
  setFamily(qfont_family);

  if (style & STYLE_BOLD)
    setBold(true);
  if (style & STYLE_ITALIC)
    setItalic(true);
  if (style & STYLE_UNDERLINED)
    setUnderline(true);
  
  metrics = QFontMetrics(*this, JApplication::desktop()->screen());
  
  id = attrs2id(face, style, size);
  cache[id] = this;
}
Beispiel #14
0
void AutomationView::paint_impl(QPainter* painter) const
{
    static const int fontSize = 10;
    QRectF processNameRect{0, this->height() - 2*fontSize, 0.95 * this->width(), fontSize + 2 };

    if(m_showName)
    {
        auto f = ProcessFonts::Sans();
        f.setPointSize(fontSize);
        painter->setFont(f);
        painter->setPen(Qt::lightGray);
        painter->drawText(processNameRect, Qt::AlignRight, m_displayedName);
    }
}
Beispiel #15
0
LEDCube::LEDCube(int l, int w, int d)
{
    length = l;
    width = w;
    depth = d;
    
    model2world.identity();
    
    cubeLength = LED_LEN_INTERVAL * LED_LENGTH;
    cubeWidth = LED_WID_INTERVAL * LED_WIDTH;
    cubeDepth = LED_DEP_INTERVAL * LED_DEPTH;
    
    setPointSize();
    setTestColors();
}
Beispiel #16
0
  Show_points_base::Show_points_base(Color c,
				     int pointsize,
				     PointStyle pointstyle,
				     QObject * parent,
				     const char * name)
    : Qt_widget_styled_layer(0, parent, name)
  {
    color=tr("Color");
    size=tr("Point size");
    style_name=tr("Point style");

    setColor(QColor(c.red(), c.green(), c.blue()));
    setPointSize(pointsize);
    setPointStyle(pointstyle);
  }
int FontDisplay::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QLabel::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setText(*(QString*)_a[1]); break;
        case 1: setBold(*(bool*)_a[1]); break;
        case 2: setItalic(*(bool*)_a[1]); break;
        case 3: setPointSize(*(int*)_a[1]); break;
        }
        _id -= 4;
    }
    return _id;
}
Beispiel #18
0
MainWindow::MainWindow(QMainWindow *parent) : QMainWindow(parent)
{
  setupUi(this);

  connect(btnRadius,SIGNAL(clicked()), this, SLOT(setSelectionMode()));
  connect(btnKNearest,SIGNAL(clicked()), this, SLOT(setSelectionMode()));
  connect(spinKNearest,SIGNAL(editingFinished()), this, SLOT(setKNearest()));
  connect(spinRadius,SIGNAL(editingFinished()), this, SLOT(setRadius()));
  connect(spinPointSize,SIGNAL(editingFinished()), this, SLOT(setPointSize()));
  connect(spinKNearest,SIGNAL(valueChanged(int)), this, SLOT(setKNearest()));
  connect(spinVertexID,SIGNAL(valueChanged(int)), this, SLOT(setVertexId()));
  connect(spinRadius,SIGNAL(valueChanged(double)), this, SLOT(setRadius()));
  connect(spinPointSize,SIGNAL(valueChanged(double)), this, SLOT(setPointSize()));
  connect(btnRenderKDTree,SIGNAL(clicked()), this, SLOT(setDrawKDTree()));

  updateConfig();
}
Beispiel #19
0
void DeviceExplorerView::paintEvent(QPaintEvent* event)
{
  QTreeView::paintEvent(event);
  if (model() && model()->rowCount(rootIndex()) > 0)
    return;

  QPainter p{this->viewport()};
  const auto& skin = score::Skin::instance();
  auto font = skin.Bold12Pt;
  font.setPointSize(24);
  p.setFont(font);
  auto pen = p.pen();
  auto col = pen.color();
  col.setAlphaF(0.5);
  pen.setColor(col);
  p.setPen(pen);
  p.drawText(rect(), Qt::AlignCenter, "Right-click\nto add a device");
}
void ccGenericPointCloud::importParametersFrom(const ccGenericPointCloud* cloud)
{
	if (!cloud)
	{
		assert(false);
		return;
	}

	//original center
	setGlobalShift(cloud->getGlobalShift());
	setGlobalScale(cloud->getGlobalScale());
	//keep the transformation history!
	setGLTransformationHistory(cloud->getGLTransformationHistory());
	//custom point size
	setPointSize(cloud->getPointSize());
	//meta-data
	setMetaData(cloud->metaData());
}
void TemporalConstraintView::paint(
        QPainter* painter,
        const QStyleOptionGraphicsItem*,
        QWidget*)
{
    qreal min_w = minWidth();
    qreal max_w = maxWidth();
    qreal def_w = defaultWidth();
    qreal play_w = playWidth();

    // Draw the stuff present if there is a rack *in the model* ?
    if(presenter().rack())
    {
        // Background
        auto rect = boundingRect();
        rect.adjust(0,15,0,-10);
        rect.setWidth(this->defaultWidth());
        painter->fillRect(rect, m_bgColor);

        // Fake timenode continuation
        auto color = ScenarioStyle::instance().RackSideBorder;
        QPen pen{color, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin};
        painter->setPen(pen);
        painter->drawLine(rect.topLeft(), rect.bottomLeft());
        painter->drawLine(rect.topRight(), rect.bottomRight());
    }


    QPainterPath solidPath, dashedPath, leftBrace, rightBrace;

    // Paths
    if(infinite())
    {
        if(min_w != 0.)
        {
            solidPath.lineTo(min_w, 0);

            leftBrace.moveTo(min_w, -10);
            leftBrace.arcTo(min_w - 10, -10, 20, 20, 90, 180);
        }

        // TODO end state should be hidden
        dashedPath.moveTo(min_w, 0);
        dashedPath.lineTo(def_w, 0);
    }
    else if(min_w == max_w) // TODO rigid()
    {
        solidPath.lineTo(def_w, 0);
    }
    else
    {
        if(min_w != 0.)
            solidPath.lineTo(min_w, 0);

        dashedPath.moveTo(min_w, 0);
        dashedPath.lineTo(max_w, 0);

        leftBrace.moveTo(min_w + 10, -10);
        leftBrace.arcTo(min_w, -10, 20, 20, 90, 180);
        leftBrace.closeSubpath();

        rightBrace.moveTo(max_w, 10);
        rightBrace.arcTo(max_w - 10, -10, 20, 20, 270, 180);
        rightBrace.closeSubpath();
        rightBrace.translate(-10, 0); // TODO bleh.
    }

    QPainterPath playedPath;
    if(play_w != 0.)
    {
        playedPath.lineTo(play_w, 0);
    }

    // Colors
    QColor constraintColor;
    // TODO make a switch instead
    if(isSelected())
    {
        constraintColor = ScenarioStyle::instance().ConstraintSelected;
    }
    else if(warning())
    {
        constraintColor = ScenarioStyle::instance().ConstraintWarning;
    }
    else
    {
        constraintColor = ScenarioStyle::instance().ConstraintBase;
    }
    if(! isValid())
    {
        constraintColor = ScenarioStyle::instance().ConstraintInvalid;
        this->setZValue(this->zValue()+ 1);
    }
    else
    {
        this->setZValue(parentObject()->zValue() + 3);
    }

    m_solidPen.setColor(constraintColor);
    m_dashPen.setColor(constraintColor);

    // Drawing
    painter->setPen(m_solidPen);
    if(!solidPath.isEmpty())
        painter->drawPath(solidPath);
    if(!leftBrace.isEmpty())
        painter->drawPath(leftBrace);
    if(!rightBrace.isEmpty())
        painter->drawPath(rightBrace);

    painter->setPen(m_dashPen);
    if(!dashedPath.isEmpty())
        painter->drawPath(dashedPath);

    leftBrace.closeSubpath();
    rightBrace.closeSubpath();

    QPen anotherPen(Qt::transparent, 4);
    painter->setPen(anotherPen);
    QColor blueish = m_solidPen.color().lighter();
    blueish.setAlphaF(0.3);
    painter->setBrush(blueish);
    painter->drawPath(leftBrace);
    painter->drawPath(rightBrace);

    static const QPen playedPen{
        QBrush{ScenarioStyle::instance().ConstraintPlayFill},
        4,
        Qt::SolidLine,
                Qt::RoundCap,
                Qt::RoundJoin
    };

    painter->setPen(playedPen);
    if(!playedPath.isEmpty())
        painter->drawPath(playedPath);


    static const int fontSize = 12;
    QRectF labelRect{0,0, defaultWidth(), (-fontSize - 2.)};
    auto f = ProcessFonts::Sans();
    f.setPointSize(fontSize);

    painter->setFont(f);
    painter->setPen(m_labelColor);
    painter->drawText(labelRect, Qt::AlignCenter, m_label);

#if defined(ISCORE_SCENARIO_DEBUG_RECTS)
    painter->setPen(Qt::darkRed);
    painter->setBrush(Qt::NoBrush);
    painter->drawRect(boundingRect());
#endif
}
void TemporalConstraintHeader::paint(
        QPainter *painter,
        const QStyleOptionGraphicsItem *option,
        QWidget *widget)
{
    if(m_state == State::RackHidden)
    {
        auto rect = boundingRect();
        painter->fillRect(rect, ScenarioStyle::instance().ConstraintHeaderRackHidden.getBrush());

        // Fake timenode continuation
        auto color = ScenarioStyle::instance().ConstraintHeaderSideBorder.getColor();
        QPen pen{color, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin};
        painter->setPen(pen);
        painter->drawLine(rect.topLeft(), rect.bottomLeft());
        painter->drawLine(rect.topRight(), rect.bottomRight());
        painter->drawLine(rect.bottomLeft(), rect.bottomRight());
    }

    // Header
    auto font = Skin::instance().SansFont;
    font.setPointSize(10);
    font.setBold(true);

    painter->setFont(font);
    painter->setPen(ScenarioStyle::instance().ConstraintHeaderText.getColor());

    QFontMetrics fm(font);
    int textWidth = fm.width(m_text);

    // If the centered text is hidden, we put it at the left so that it's on the view.
    // We have to compute the visible part of the header
    auto view = scene()->views().first();
    int text_left = view->mapFromScene(mapToScene({m_width / 2. - textWidth / 2., 0})).x();
    int text_right = view->mapFromScene(mapToScene({m_width / 2. + textWidth / 2., 0})).x();
    double x = (m_width - textWidth) / 2.;
    double min_x = 10;
    double max_x = view->width() - 30;

    if(text_left <= min_x)
    {
        // Compute the pixels needed to add to have top-left at 0
        x = x - text_left + min_x;
    }
    else if(text_right >= max_x)
    {
        // Compute the pixels needed to add to have top-right at max
        x = x - text_right + max_x;
    }

    x = std::max(x, 10.);
    double y = 2.5;
    double w = m_width - x;
    double h = ConstraintHeader::headerHeight();


    if(std::abs(m_previous_x - x) > 1)
    {
        m_previous_x = x;
    }
    painter->drawText(m_previous_x,y,w,h, Qt::AlignLeft, m_text);

    if(m_width > 20)
    {
        painter->setPen(ScenarioStyle::instance().ConstraintHeaderBottomLine.getColor());
        painter->drawLine(
                    boundingRect().bottomLeft(),
                    boundingRect().bottomRight());
    }
}
Beispiel #23
0
int main(int argc, char *argv[])
{
    QScopedPointer<QGuiApplication> app(new QGuiApplication(argc, argv));

    qDebug() << app->arguments();
    if (app->arguments().size() < 2)
        return EXIT_FAILURE;

    auto defaultFont = app->font();
    defaultFont.setPointSize(10);
    app->setFont(defaultFont);

    Mode mode = Unknown;

    QScopedPointer<QQmlApplicationEngine> engine(new QQmlApplicationEngine);
    engine->rootContext()->setContextProperty("abort_editor", QVariant::fromValue(false));
    QScopedPointer<CommitModel> commitModel(new CommitModel);
    engine->rootContext()->setContextProperty("commits", commitModel.data());

    if (app->arguments()[1].endsWith("COMMIT_EDITMSG")
            || app->arguments()[1].endsWith("addp-hunk-edit.diff")) {
        mode = Edit;
        QFile file(app->arguments()[1]);
        if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
            return EXIT_FAILURE;

        engine->rootContext()->setContextProperty("value", file.readAll());
        engine->load(QUrl(QStringLiteral("qrc:/qml/git_editor/edit.qml")));
    }

    if (app->arguments()[1].endsWith("git-rebase-todo")) {
        mode = Rebase;
        QFile file(app->arguments()[1]);
        if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
            return EXIT_FAILURE;

        QTextStream in(&file);
        QStringList comments;
        while (!in.atEnd()) {
            QString line = in.readLine().trimmed();
            if (line.startsWith('|')) {
                comments += line;
            } else if (!line.isEmpty()) {
                QSharedPointer<DataObject> data(new DataObject);
                data->operation = line.section(' ', 0, 0);
                data->sha = line.section(' ', 1, 1);
                data->description = line.section(' ', 2);
                commitModel->appendRow(data);
            }
        }
        file.close();

        engine->rootContext()->setContextProperty("comments", comments.join("\n"));
        engine->load(QUrl(QStringLiteral("qrc:/qml/git_editor/main.qml")));
    }

    if (mode == Unknown) {
        return EXIT_FAILURE;
    }

    auto result = app->exec();

    if (commitModel->abort()) {
        qDebug() << "Aborting";
        return EXIT_FAILURE;
    }

    if (mode == Rebase) {
        QFile file(app->arguments()[1]);
        if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
            qDebug() << "Unable to open for write" << app->arguments()[1];
            return EXIT_FAILURE;
        }

        QTextStream out(&file);
        for (int row = 0; row < commitModel->rowCount(); ++row) {
            QModelIndex index = commitModel->index(row);
            QString operation = commitModel->data(index, CommitModel::Operation).toString();
            QString sha = commitModel->data(index, CommitModel::Sha).toString();
            QString description = commitModel->data(index, CommitModel::Description).toString();
            qDebug() << operation << sha << description;
            if (operation == "DELETE")
                continue;
            out << operation << ' ' << sha << ' ' << description << '\n';
        }
    } else if (mode == Edit) {
        QFile file(app->arguments()[1]);
        if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
            qDebug() << "Unable to open for write" << app->arguments()[1];
            return EXIT_FAILURE;
        }

        QTextStream out(&file);
        auto rootObject = engine->rootObjects()[0];
        auto textEdit = rootObject->findChild<QObject*>("textEdit");
        out << QQmlProperty::read(textEdit, "text").toString();
    }

    return result;
}
void OpenGLRenderer::resetPointSize()
{
  setPointSize(1.0f);
}
Beispiel #25
0
bool QgsSymbol::readXML( QDomNode &synode, const QgsVectorLayer *vl )
{
  // Legacy project file formats didn't have support for pointsymbol nor
  // pointsize Dom elements.  Therefore we should check whether these
  // actually exist.

  QDomNode lvalnode = synode.namedItem( "lowervalue" );
  if ( ! lvalnode.isNull() )
  {
    QDomElement lvalelement = lvalnode.toElement();
    if ( lvalelement.attribute( "null" ).toInt() == 1 )
    {
      mLowerValue = QString::null;
    }
    else
    {
      mLowerValue = lvalelement.text();
    }
  }

  QDomNode uvalnode = synode.namedItem( "uppervalue" );
  if ( ! uvalnode.isNull() )
  {
    QDomElement uvalelement = uvalnode.toElement();
    mUpperValue = uvalelement.text();
  }

  QDomNode labelnode = synode.namedItem( "label" );
  if ( ! labelnode.isNull() )
  {
    QDomElement labelelement = labelnode.toElement();
    mLabel = labelelement.text();
  }

  QDomNode psymbnode = synode.namedItem( "pointsymbol" );

  if ( ! psymbnode.isNull() )
  {
    QDomElement psymbelement = psymbnode.toElement();
    setNamedPointSymbol( psymbelement.text() );
  }

  QDomNode psizenode = synode.namedItem( "pointsize" );

  if ( ! psizenode.isNull() )
  {
    QDomElement psizeelement = psizenode.toElement();
    setPointSize( psizeelement.text().toFloat() );
  }

  QDomNode psizeunitnodes = synode.namedItem( "pointsizeunits" );
  if ( ! psizeunitnodes.isNull() )
  {
    QDomElement psizeunitelement = psizeunitnodes.toElement();
    QgsDebugMsg( QString( "psizeunitelement:%1" ).arg( psizeunitelement.text() ) );
    setPointSizeUnits( psizeunitelement.text().compare( "mapunits", Qt::CaseInsensitive ) == 0 );
  }

  if ( vl )
  {
    mRotationClassificationField = readFieldName( synode, "rotationclassificationfield", *vl );
    mScaleClassificationField = readFieldName( synode, "scaleclassificationfield", *vl );
    mSymbolField = readFieldName( synode, "symbolfield", *vl );
  }
  else
  {
    mRotationClassificationField = -1;
    mScaleClassificationField = -1;
  }

  QDomNode outlcnode = synode.namedItem( "outlinecolor" );
  QDomElement oulcelement = outlcnode.toElement();
  int red = oulcelement.attribute( "red" ).toInt();
  int green = oulcelement.attribute( "green" ).toInt();
  int blue = oulcelement.attribute( "blue" ).toInt();
  setColor( QColor( red, green, blue ) );

  QDomNode outlstnode = synode.namedItem( "outlinestyle" );
  QDomElement outlstelement = outlstnode.toElement();
  setLineStyle( QgsSymbologyUtils::qString2PenStyle( outlstelement.text() ) );

  QDomNode outlwnode = synode.namedItem( "outlinewidth" );
  QDomElement outlwelement = outlwnode.toElement();
  setLineWidth( outlwelement.text().toDouble() );

  QDomNode fillcnode = synode.namedItem( "fillcolor" );
  QDomElement fillcelement = fillcnode.toElement();
  red = fillcelement.attribute( "red" ).toInt();
  green = fillcelement.attribute( "green" ).toInt();
  blue = fillcelement.attribute( "blue" ).toInt();
  setFillColor( QColor( red, green, blue ) );

  QDomNode texturepathnode = synode.namedItem( "texturepath" );
  QDomElement texturepathelement = texturepathnode.toElement();
  setCustomTexture( QgsProject::instance()->readPath( texturepathelement.text() ) );

  //run this after setting the custom texture path, so we override the brush if it isn't the custom pattern brush.
  QDomNode fillpnode = synode.namedItem( "fillpattern" );
  QDomElement fillpelement = fillpnode.toElement();
  setFillStyle( QgsSymbologyUtils::qString2BrushStyle( fillpelement.text() ) );

  return true;
}
PointMotion::PointMotion(float _pointSize, TTK::Vector3 _pos, std::string _label)
{
    setPointSize(_pointSize);
    pos = _pos;
    label = _label;
}
Beispiel #27
0
Window::Window(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::Window)
    , calc_thread(new QThread(this))
    , calculator(new Calculator())
{
    calculator->moveToThread(calc_thread);
    calc_thread->start();

    ui->setupUi(this);

    {
        auto font = ui->plot->font();
        font.setPointSize(18);
        ui->plot->setFont(font);
        ui->plot->xAxis->setTickLabelFont(font);
        ui->plot->yAxis->setTickLabelFont(font);
        ui->plot->yAxis2->setTickLabelFont(font);
        font.setItalic(true);
        ui->plot->xAxis->setLabelFont(font);
        ui->plot->yAxis->setLabelFont(font);
        ui->plot->yAxis2->setLabelFont(font);
    }
    ui->plot->addGraph();
    ui->plot->addGraph(ui->plot->xAxis, ui->plot->yAxis2);
    ui->plot->yAxis2->setVisible(true);
    ui->plot->xAxis->setLabel("t");
    ui->plot->yAxis->setLabel("U");
    ui->plot->yAxis2->setLabel("I");
    connect(ui->plot->yAxis, static_cast<void(QCPAxis::*)(const QCPRange &, const QCPRange &)>(&QCPAxis::rangeChanged),  [this] (const QCPRange &newRange, const QCPRange &oldRange)
    {
        double scale_coef = ui->plot->yAxis2->range().size() / oldRange.size();

        double d_size = newRange.size() / oldRange.size();
        double d_center = (newRange.center() - oldRange.center()) * scale_coef;

        double new_size = ui->plot->yAxis2->range().size() * d_size;
        double new_center = ui->plot->yAxis2->range().center() + d_center;

        ui->plot->yAxis2->setRange(new_center - new_size/2, new_center + new_size/2);
    });

    for (int i=2; i < 5; i++)
    {
        ui->plot->addGraph();
    }
    ui->plot->addGraph(ui->plot->xAxis, ui->plot->yAxis2);

    ui->plot->graph(1)->setPen(QPen(QColor("blue")));
    ui->plot->graph(1)->setPen(QPen(QColor("red")));
    ui->plot->xAxis->setAutoTickCount(ui->x_axis_density->value());

    ui->plot->graph(2)->setPen(QPen(QColor("green")));
    ui->plot->graph(3)->setPen(QPen(QColor("green")));

    ui->plot->graph(4)->setPen(QPen(QBrush(QColor("lime")), 2));
    ui->plot->graph(5)->setPen(QPen(QBrush(QColor("orange")), 2));

    ui->plot->setInteraction(QCP::iRangeDrag);
    ui->plot->setInteraction(QCP::iRangeZoom);

    connect(this, SIGNAL(beginCalc()), calculator, SLOT(start()));
    connect(calculator, SIGNAL(progress(int,int)), this, SLOT(onProgress(int,int)));
    connect(calculator, SIGNAL(done()), this, SLOT(onDone()));
    connect(ui->btnRescale, SIGNAL(released()), this, SLOT(rescale()));
    connect(ui->allow_save_to_file, &QCheckBox::toggled, ui->output_filename, &QLineEdit::setEnabled);
    connect(ui->allow_save_to_file, &QCheckBox::toggled, calculator, &Calculator::setAllowOutToFile);

    connect(ui->slider_double, &DoubleSlider::valueChanged, this, &Window::onDoubleSliderMoved);
    connect(ui->slider_double, &DoubleSlider::altValueChanged, this, &Window::onDoubleSliderAltMoved);

    connect(ui->chck_dispersion_select, &QCheckBox::toggled, this, [this] (bool checked) {
        ui->chck_range_select->blockSignals(true);
        ui->chck_range_select->setChecked(false);
        ui->chck_range_select->blockSignals(false);

        if (checked)
        {
            select_from = ui->spin_dispersion_from;
            select_to = ui->spin_dispersion_to;
            ui->slider_double->show();
        }
        else
        {
            ui->slider_double->hide();
        }
    });

    connect(ui->chck_range_select, &QCheckBox::toggled, this, [this] (bool checked) {
        ui->chck_dispersion_select->blockSignals(true);
        ui->chck_dispersion_select->setChecked(false);
        ui->chck_dispersion_select->blockSignals(false);

        if (checked)
        {
            select_from = ui->spin_from;
            select_to = ui->spin_to;
            ui->slider_double->show();
        }
        else
        {
            ui->slider_double->hide();
        }
    });

    ui->chck_dispersion_select->setChecked(true);

    ui->allow_save_to_file->setChecked(false);
    ui->btnRescale->setIcon(qApp->style()->standardIcon(QStyle::SP_BrowserReload));
    ui->progressBar->hide();
}
void PointsEventHandler::changePointSize(float delta)
{
    setPointSize(getPointSize() + delta);
}
Beispiel #29
0
 void changePointSize(float delta)
 {
     setPointSize(getPointSize()+delta);
 }