/*---------------------------------- private: ----------------------------{{{-*/
void
RvizTfTransformGraphicsWidget::extendLayout()
{
  m_markerLabel = new QLabel("Marker");
  m_markerEdit = new QLineEdit();
  connect(m_markerEdit, SIGNAL(editingFinished()), this, SLOT(updateMarker()));
  m_markerFileButton = new QPushButton(QApplication::style()->standardIcon(QStyle::SP_FileIcon), tr("&Mesh"));
  connect(m_markerFileButton, SIGNAL(pressed()), this, SLOT(markerDialog()));

  m_markerScaleLabel = new QLabel("Scale");
  m_markerScaleXEdit = new QLineEdit("1.0");
  m_markerScaleXEdit->setFixedWidth(40);
  connect(m_markerScaleXEdit, SIGNAL(editingFinished()), this, SLOT(updateMarker()));
  m_markerScaleYEdit = new QLineEdit("1.0");
  m_markerScaleYEdit->setFixedWidth(40);
  connect(m_markerScaleYEdit, SIGNAL(editingFinished()), this, SLOT(updateMarker()));
  m_markerScaleZEdit = new QLineEdit("1.0");
  m_markerScaleZEdit->setFixedWidth(40);
  connect(m_markerScaleZEdit, SIGNAL(editingFinished()), this, SLOT(updateMarker()));

  m_markerLayout = new QHBoxLayout();
  m_markerLayout->addWidget(m_markerLabel);
  m_markerLayout->addWidget(m_markerFileButton);
  m_markerLayout->addWidget(m_markerEdit);
  m_markerLayout->addWidget(m_markerScaleLabel);
  m_markerLayout->addWidget(m_markerScaleXEdit);
  m_markerLayout->addWidget(m_markerScaleYEdit);
  m_markerLayout->addWidget(m_markerScaleZEdit);

  m_topLayout->addLayout(m_markerLayout, m_topLayout->rowCount() + 1, 1);
  updateParentLabel();
}
Beispiel #2
0
bool CSVRender::Object::referenceDataChanged (const QModelIndex& topLeft,
    const QModelIndex& bottomRight)
{
    if (mReferenceId.empty())
        return false;

    const CSMWorld::RefCollection& references = mData.getReferences();

    int index = references.searchId (mReferenceId);

    if (index!=-1 && index>=topLeft.row() && index<=bottomRight.row())
    {
        int columnIndex =
            references.findColumnIndex (CSMWorld::Columns::ColumnId_ReferenceableId);

        adjustTransform();

        if (columnIndex>=topLeft.column() && columnIndex<=bottomRight.row())
        {
            mReferenceableId =
                references.getData (index, columnIndex).toString().toUtf8().constData();

            update();
            updateMarker();
        }

        return true;
    }

    return false;
}
void QgsMarkerLineSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
{
  if ( layer->layerType() != "MarkerLine" )
    return;

  // layer type is correct, we can do the cast
  mLayer = static_cast<QgsMarkerLineSymbolLayerV2*>( layer );

  // set values
  spinInterval->setValue( mLayer->interval() );
  chkRotateMarker->setChecked( mLayer->rotateMarker() );
  spinOffset->setValue( mLayer->offset() );
  if ( mLayer->placement() == QgsMarkerLineSymbolLayerV2::Interval )
    radInterval->setChecked( true );
  else if ( mLayer->placement() == QgsMarkerLineSymbolLayerV2::Vertex )
    radVertex->setChecked( true );
  else if ( mLayer->placement() == QgsMarkerLineSymbolLayerV2::LastVertex )
    radVertexLast->setChecked( true );
  else if ( mLayer->placement() == QgsMarkerLineSymbolLayerV2::CentralPoint )
    radCentralPoint->setChecked( true );
  else
    radVertexFirst->setChecked( true );
  updateMarker();
  setPlacement(); // update gui
}
Beispiel #4
0
void prepareForNextHHBC(IRGS& env,
                        const NormalizedInstruction* ni,
                        SrcKey newSk,
                        bool lastBcInst) {
  FTRACE(1, "------------------- prepareForNextHHBC ------------------\n");
  env.currentNormalizedInstruction = ni;

  always_assert_flog(
    IMPLIES(isInlining(env), !env.lastBcInst),
    "Tried to end trace while inlining."
  );

  always_assert_flog(
    IMPLIES(isInlining(env), !env.firstBcInst),
    "Inlining while still at the first region instruction."
  );

  always_assert(env.bcStateStack.size() >= env.inlineLevel + 1);
  auto pops = env.bcStateStack.size() - 1 - env.inlineLevel;
  while (pops--) env.bcStateStack.pop_back();

  always_assert_flog(env.bcStateStack.back().func() == newSk.func(),
                     "Tried to update current SrcKey with a different func");

  env.bcStateStack.back().setOffset(newSk.offset());
  updateMarker(env);
  env.lastBcInst = lastBcInst;
  env.catchCreator = nullptr;
  env.irb->prepareForNextHHBC();
}
Beispiel #5
0
void endInlinedCommon(IRGS& env) {
  assertx(!curFunc(env)->isPseudoMain());

  assertx(!resumed(env));

  decRefLocalsInline(env);
  decRefThis(env);

  gen(env, InlineReturn, fp(env));

  // Return to the caller function.  Careful between here and the
  // updateMarker() below, where the caller state isn't entirely set up.
  env.inlineLevel--;
  env.bcStateStack.pop_back();
  always_assert(env.bcStateStack.size() > 0);

  updateMarker(env);

  /*
   * After the end of inlining, we are restoring to a previously defined stack
   * that we know is entirely materialized (i.e. in memory), so stackDeficit
   * needs to be slammed to zero.
   *
   * The push of the return value in the caller of this function is not yet
   * materialized.
   */
  assertx(env.irb->evalStack().empty());
  env.irb->clearStackDeficit();

  FTRACE(1, "]]] end inlining: {}\n", curFunc(env)->fullName()->data());
}
Beispiel #6
0
DataWidget* WidgetArea::loadOneWidget(DataFileParser *file, bool skip)
{
    // type
    if(!file->seekToNextBlock("widgetType", BLOCK_WIDGET))
        return NULL;

    quint8 type = 0;
    file->read((char*)&type, sizeof(quint8));

    // pos and size
    if(!file->seekToNextBlock("widgetPosSize", BLOCK_WIDGET))
        return NULL;

    int val[4];
    file->read((char*)&val, sizeof(val));

    DataWidget *w = addWidget(QPoint(val[0], val[1]), type, !skip);
    if(!w)
        return NULL;

    w->resize(val[2], val[3]);
    w->loadWidgetInfo(file);

    if(skip)
        removeWidget(w->getId());
    else
        updateMarker(w);
    return w;
}
Beispiel #7
0
CSVRender::Object::Object (CSMWorld::Data& data, osg::Group* parentNode,
    const std::string& id, bool referenceable, bool forceBaseToZero)
: mData (data), mBaseNode(0), mSelected(false), mParentNode(parentNode), mResourceSystem(data.getResourceSystem().get()), mForceBaseToZero (forceBaseToZero),
  mScaleOverride (1), mOverrideFlags (0), mSubMode (-1), mMarkerTransparency(0.5f)
{
    mRootNode = new osg::PositionAttitudeTransform;

    mBaseNode = new osg::PositionAttitudeTransform;
    mBaseNode->addCullCallback(new SceneUtil::LightListCallback);

    mOutline = new osgFX::Scribe;

    mBaseNode->setUserData(new ObjectTag(this));

    mRootNode->addChild (mBaseNode);

    parentNode->addChild (mRootNode);

    mRootNode->setNodeMask(Mask_Reference);

    if (referenceable)
    {
        mReferenceableId = id;
    }
    else
    {
        mReferenceId = id;
        mReferenceableId = getReference().mRefID;
    }

    adjustTransform();
    update();
    updateMarker();
}
Beispiel #8
0
void CompactIndex2::copySegmentsToWriteCache() {
	if (currentTermSegmentCount <= 0)
		return;

	writeCache[cacheBytesUsed++] = 0;

	if (currentTermMarker < 0)
		return;

	updateMarker();
	currentTermMarker = -1;

	if (cacheBytesUsed + 16 > WRITE_CACHE_SIZE)
		flushPartialWriteCache();
	cacheBytesUsed +=
		encodeVByte32(currentTermSegmentCount, &writeCache[cacheBytesUsed]);
	cacheBytesUsed +=
		encodeVByte32(usedByPLSH, &writeCache[cacheBytesUsed]);

	int pos = 0;
	while (pos < usedByPLSH) {
		int chunkSize = MIN(65536, usedByPLSH - pos);
		if (cacheBytesUsed + chunkSize > WRITE_CACHE_SIZE)
			flushPartialWriteCache();
		memcpy(&writeCache[cacheBytesUsed], &temporaryPLSH[pos], chunkSize);
		pos += chunkSize;
		cacheBytesUsed += chunkSize;
	}

	// reset status variables for current term's segment headers
	currentTermSegmentCount = 0;
	usedByPLSH = 0;
} // end of copySegmentsToWriteCache()
void
RvizTfTransformGraphicsWidget::setMarkerScale(double p_x, double p_y, double p_z)
{
  m_markerScaleXEdit->setText(QString::number(p_x));
  m_markerScaleYEdit->setText(QString::number(p_y));
  m_markerScaleZEdit->setText(QString::number(p_z));
  updateMarker();
}
Beispiel #10
0
void CSVRender::Object::setSubMode (int subMode)
{
    if (subMode!=mSubMode)
    {
        mSubMode = subMode;
        updateMarker();
    }
}
void QgsMarkerLineSymbolLayerV2Widget::setMarker()
{
  QgsSymbolV2PropertiesDialog dlg( mLayer->subSymbol(), mVectorLayer, this );
  if ( dlg.exec() == 0 )
    return;
  updateMarker();

  emit changed();
}
Beispiel #12
0
void QCustomPlotExt::setMarkerValue(double value)
{
    if (marker)
    {
        markerValue = value;
        updateMarker();
        replot();
    }
}
    void updateIfNeeded()
    {
        if (lastHue != h)
        {
            lastHue = h;
            colours = Image::null;
            repaint();
        }

        updateMarker();
    }
void QgsCentroidFillSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
{
  if ( layer->layerType() != "CentroidFill" )
    return;

  // layer type is correct, we can do the cast
  mLayer = static_cast<QgsCentroidFillSymbolLayerV2*>( layer );

  // set values
  updateMarker();
}
/*------------------------------- public Q_SLOTS: --------------------------{{{-*/
void
RvizTfTransformGraphicsWidget::broadcastTransform()
{
  TfTransformGraphicsWidget::broadcastTransform();

  if (!(m_lastTf == *tf())) {
    updateMarker();
  }

  m_lastTf = *tf();
}
Beispiel #16
0
IRGS::IRGS(IRUnit& unit)
  : context(unit.context())
  , transFlags(unit.context().flags)
  , unit(unit)
  , irb(new IRBuilder(unit, initial_marker(context)))
  , bcStateStack { context.srcKey() }
{
  updateMarker(*this);
  auto const frame = gen(*this, DefFP);
  gen(*this, DefSP, FPInvOffsetData { context.initSpOffset }, frame);
}
void FlightVisualization::updateCoordinates(double latitude, double longitude,
        double bearing, int planeID)
{
    if (firstMessage) {
        setMapCenter(latitude, longitude);

        firstMessage = false;
    }

    updateMarker(latitude, longitude, bearing, planeID);
    updateFlightPath(latitude, longitude, planeID);
}
/*------------------------------- private Q_SLOTS: -------------------------{{{-*/
void
RvizTfTransformGraphicsWidget::markerDialog()
{
  QString packagePath = QDir::homePath() + tr("/catkin_ws/src");
  QString markerFileName = QFileDialog::getOpenFileName(this,
                                                        tr("Open Mesh as Marker"),
                                                        packagePath,
                                                        tr("Meshes (*.dae *.stl *.mesh)"));
  if (!markerFileName.isEmpty()) {
    markerFileName.replace(packagePath, "package:/");
    m_markerEdit->setText(markerFileName);
    updateMarker();
  }
}
Beispiel #19
0
void videoProcessor::update(){
    bool bNewFrame = false;
    videoInput->update();
    bNewFrame = videoInput->isFrameNew();
    if (bNewFrame){ aruco.detectBoards(videoInput->getPixelsRef() );}

    if(aruco.getNumMarkers() == 4){
        std::vector<aruco::Marker> m = aruco.getMarkers();
        convertedMarker.clear();
        for (std::vector<aruco::Marker>::iterator it = m.begin(); it != m.end();++it){
            convertedMarker.push_back(ofVec2f((*it).getCenter().x,(*it).getCenter().y ));
        }
        updateMarker(convertedMarker);
    }
    
    unsigned char * pixels = videoInput->getPixels();
}
Beispiel #20
0
bool CSVRender::Object::referenceableDataChanged (const QModelIndex& topLeft,
    const QModelIndex& bottomRight)
{
    const CSMWorld::RefIdCollection& referenceables = mData.getReferenceables();

    int index = referenceables.searchId (mReferenceableId);

    if (index!=-1 && index>=topLeft.row() && index<=bottomRight.row())
    {
        adjustTransform();
        update();
        updateMarker();
        return true;
    }

    return false;
}
Beispiel #21
0
void CSVRender::Object::setSelected(bool selected)
{
    mSelected = selected;

    mOutline->removeChild(mBaseNode);
    mRootNode->removeChild(mOutline);
    mRootNode->removeChild(mBaseNode);
    if (selected)
    {
        mOutline->addChild(mBaseNode);
        mRootNode->addChild(mOutline);
    }
    else
        mRootNode->addChild(mBaseNode);

    mMarkerTransparency = CSMPrefs::get()["Rendering"]["object-marker-alpha"].toDouble();
    updateMarker();
}
Beispiel #22
0
void QCustomPlotExt::xAxisRangeChanged(const QCPRange& range)
{
    double delta = range.upper - range.lower;
    if (range.lower < xAxisRangeOrg.lower)
    {
        if (xAxisRangeOrg.lower + delta < xAxisRangeOrg.upper)
            xAxis->setRange(QCPRange(xAxisRangeOrg.lower, xAxisRangeOrg.lower + delta));
        else
            xAxis->setRange(xAxisRangeOrg);
    }
    else if (range.upper > xAxisRangeOrg.upper)
    {
        if (xAxisRangeOrg.upper - delta > xAxisRangeOrg.lower)
            xAxis->setRange(QCPRange(xAxisRangeOrg.upper - delta, xAxisRangeOrg.upper));
        else
            xAxis->setRange(xAxisRangeOrg);
    }
    updateMarker();
}
Beispiel #23
0
void WidgetArea::moveWidgets(QPoint diff)
{
    m_grid_offset += diff;
    m_grid_offset %= m_grid;

    for(w_map::iterator itr = m_widgets.begin(); itr != m_widgets.end(); ++itr)
    {
        QPoint pos = (*itr)->pos() + diff;
        (*itr)->move(pos);

        updateMarker(*itr);
    }

    for(size_t i = 0; i < m_bookmarks.size(); ++i)
        m_bookmarks[i].main += diff;

    m_undoStack.areaMoved(diff);

    update();
}
Beispiel #24
0
void prepareForNextHHBC(HTS& env,
                        const NormalizedInstruction* ni,
                        Offset newOff,
                        bool lastBcOff) {
  FTRACE(1, "------------------- prepareForNextHHBC ------------------\n");
  env.currentNormalizedInstruction = ni;

  always_assert_log(
    IMPLIES(isInlining(env), !env.lastBcOff),
    [&] {
      return folly::format("Tried to end trace while inlining:\n{}",
                           env.unit).str();
    }
  );

  env.bcStateStack.back().setOffset(newOff);
  updateMarker(env);
  env.lastBcOff = lastBcOff;
  env.irb->prepareForNextHHBC();
}
Beispiel #25
0
void QgsComposerRuler::mouseMoveEvent( QMouseEvent* event )
{
    //qWarning( "QgsComposerRuler::mouseMoveEvent" );
    updateMarker( event->posF() );
    setSnapLinePosition( event->posF() );

    //update cursor position in status bar
    QPointF displayPos = mTransform.inverted().map( event->posF() );
    if ( mDirection == Horizontal )
    {
        //mouse is over a horizontal ruler, so don't show a y coordinate
        displayPos.setY( 0 );
    }
    else
    {
        //mouse is over a vertical ruler, so don't show an x coordinate
        displayPos.setX( 0 );
    }
    emit cursorPosChanged( displayPos );
}
Beispiel #26
0
void endInlinedCommon(HTS& env) {
  assert(!env.fpiActiveStack.empty());
  assert(!curFunc(env)->isPseudoMain());

  assert(!resumed(env));

  decRefLocalsInline(env);
  if (curFunc(env)->mayHaveThis()) {
    gen(env, DecRefThis, fp(env));
  }

  /*
   * Pop the ActRec and restore the stack and frame pointers.  It's
   * important that this does endInlining before pushing the return
   * value so stack offsets are properly tracked.
   */
  gen(env, InlineReturn, fp(env));

  // Return to the caller function.  Careful between here and the
  // updateMarker() below, where the caller state isn't entirely set up.
  env.bcStateStack.pop_back();
  env.fpiActiveStack.pop();

  updateMarker(env);
  gen(env, ResetSP, StackOffset{env.irb->spOffset()}, fp(env));

  /*
   * After the end of inlining, we are restoring to a previously defined stack
   * that we know is entirely materialized (i.e. in memory), so stackDeficit
   * needs to be slammed to zero.
   *
   * The push of the return value in the caller of this function is not yet
   * materialized.
   */
  assert(env.irb->evalStack().empty());
  env.irb->clearStackDeficit();

  FTRACE(1, "]]] end inlining: {}\n", curFunc(env)->fullName()->data());
}
Beispiel #27
0
/*
 * Attempts to begin inlining, and returns whether or not it successed.
 *
 * When doing gen-time inlining, we set up a series of IR instructions
 * that looks like this:
 *
 *   fp0  = DefFP
 *   sp   = DefSP<offset>
 *
 *   // ... normal stuff happens ...
 *
 *   // FPI region:
 *     SpillFrame sp, ...
 *     // ... probably some StStks due to argument expressions
 *     fp2   = DefInlineFP<func,retBC,retSP,off> sp
 *
 *         // ... callee body ...
 *
 *     InlineReturn fp2
 *
 * In DCE we attempt to remove the InlineReturn and DefInlineFP instructions if
 * they aren't needed.
 */
bool beginInlining(IRGS& env,
                   unsigned numParams,
                   const Func* target,
                   Offset returnBcOffset) {
  auto const& fpiStack = env.irb->fpiStack();

  assertx(!fpiStack.empty() &&
    "Inlining does not support calls with the FPush* in a different Tracelet");
  assertx(returnBcOffset >= 0 && "returnBcOffset before beginning of caller");
  assertx(curFunc(env)->base() + returnBcOffset < curFunc(env)->past() &&
         "returnBcOffset past end of caller");

  FTRACE(1, "[[[ begin inlining: {}\n", target->fullName()->data());

  SSATmp** params = (SSATmp**)alloca(sizeof(SSATmp*) * numParams);
  for (unsigned i = 0; i < numParams; ++i) {
    params[numParams - i - 1] = popF(env);
  }

  auto const prevSP    = fpiStack.front().returnSP;
  auto const prevSPOff = fpiStack.front().returnSPOff;
  spillStack(env);
  auto const calleeSP  = sp(env);

  always_assert_flog(
    prevSP == calleeSP,
    "FPI stack pointer and callee stack pointer didn't match in beginInlining"
  );

  auto const& info = fpiStack.front();
  always_assert(!isFPushCuf(info.fpushOpc) && !info.interp);

  auto ctx = [&] {
    if (info.ctx || isFPushFunc(info.fpushOpc)) {
      return info.ctx;
    }

    constexpr int32_t adjust = offsetof(ActRec, m_r) - offsetof(ActRec, m_this);
    IRSPOffset ctxOff{invSPOff(env) - info.returnSPOff - adjust};
    return gen(env, LdStk, TCtx, IRSPOffsetData{ctxOff}, sp(env));
  }();

  DefInlineFPData data;
  data.target        = target;
  data.retBCOff      = returnBcOffset;
  data.fromFPushCtor = isFPushCtor(info.fpushOpc);
  data.ctx           = ctx;
  data.retSPOff      = prevSPOff;
  data.spOffset      = offsetFromIRSP(env, BCSPOffset{0});

  // Push state and update the marker before emitting any instructions so
  // they're all given markers in the callee.
  auto const key = SrcKey {
    target,
    target->getEntryForNumArgs(numParams),
    false
  };
  env.bcStateStack.emplace_back(key);
  env.inlineLevel++;
  updateMarker(env);

  auto const calleeFP = gen(env, DefInlineFP, data, calleeSP, fp(env));

  for (unsigned i = 0; i < numParams; ++i) {
    stLocRaw(env, i, calleeFP, params[i]);
  }
  const bool hasVariadicArg = target->hasVariadicCaptureParam();
  for (unsigned i = numParams; i < target->numLocals() - hasVariadicArg; ++i) {
    /*
     * Here we need to be generating hopefully-dead stores to initialize
     * non-parameter locals to KindOfUninit in case we have to leave the trace.
     */
    stLocRaw(env, i, calleeFP, cns(env, TUninit));
  }
  if (hasVariadicArg) {
    auto argNum = target->numLocals() - 1;
    always_assert(numParams <= argNum);
    stLocRaw(env, argNum, calleeFP, cns(env, staticEmptyArray()));
  }

  return true;
}
void QgsComposerRuler::mouseMoveEvent( QMouseEvent* event )
{
  //qWarning( "QgsComposerRuler::mouseMoveEvent" );
  updateMarker( event->posF() );
  setSnapLinePosition( event->posF() );
}
Beispiel #29
0
	/**
	 * @brief Called when the entity moves.
	 */
	void entityMoved()
	{
		updateMarker();
	}
Beispiel #30
0
void QCustomPlotExt::yAxisRangeChanged(const QCPRange& range)
{
    yAxis2->setRange((range - plotYOffset) * plotYGain);
    updateMarker();
}