void Selection3DDisplayCustom::queryContext( int x, int y )
{
    float win_width = render_panel_->width();
    float win_height = render_panel_->height();

    //then send a raycast straight out from the camera at the mouse's position
    Ogre::Ray mouseRay = this->render_panel_->getCamera()->getCameraToViewportRay((float)x/win_width, (float)y/win_height);

    Ogre::Vector3 position;

    Ogre::Vector3 pt(0,0,0);
    Ogre::Quaternion ot(1,0,0,0);
    transform(pt,ot,"/world",fixed_frame_.toUtf8().constData());
    int type = -1;
    std::string name;
    if(raycast_utils_->RayCastFromPoint(mouseRay,pt,ot,position,type,name))
    {
        //ROS_ERROR("COLLIDED WITH %s %d",name.c_str(), type);
        // type 0 -> UNKNOWN ENTITY
        // type 1 -> POINT CLOUD
        // type 2 -> WAYPOINT
        // type 3 -> TEMPLATE
        Q_EMIT setContext(type,name);
    }
    else
    {
        Q_EMIT setContext(-1,""); // NO_HIT
    }
}
Exemple #2
0
/* call seq:init,setContext,create(start),reset,
   chooseContext,glcx->makeCurrent(); */
void QGLWidget::init( QGLContext *context, const QGLWidget* shareWidget )
{
    qDebug( "qgl_win.cpp; QGLWidget::init( QGLContext *context, const QGLWidget* shareWidget )" );
    glcx = 0;
    autoSwap = TRUE;
    if ( shareWidget )
        setContext( context, shareWidget->context() );
    else
        setContext( context );
    setBackgroundMode( NoBackground ); //the widget is not cleared before paintEvent().

    /*
      if (isValid() && context->format().hasOverlay() ) {
      QCString olcxName (name() );
      olcxName+="-OGL_internal_overlay_widget";
      olcx = new QGLWidget( QGLFormat::defaultOverlayFormat(),
      this, olwName, shareWidget );
      if ( olcx->isValid() ) {
      olcx->setAutoBufferSwap( FALSE );
      }
      else {
      delete olcx;
      olcx = 0;
      glcx->glFormat.setOverlay( FALSE );
      }
      }*/


}
Exemple #3
0
QPixmap QGLWidget::renderPixmap( int w, int h, bool useContext )
{
    QPixmap nullPm;
    QSize sz = size();
    if ( (w > 0) && (h > 0) )
	sz = QSize( w, h );
    QPixmap pm( sz );
    glcx->doneCurrent();
    bool success = TRUE;

    if ( useContext && isValid() && renderCxPm( &pm ) )
	return pm;

    QGLFormat fmt = format();
    fmt.setDirectRendering( FALSE );		// No direct rendering
    fmt.setDoubleBuffer( FALSE );		// We don't need dbl buf
    QGLContext* pcx = new QGLContext( fmt, &pm );
    QGLContext* ocx = (QGLContext*)context();
    setContext( pcx, 0, FALSE );
    if ( pcx->isValid() )
	updateGL();
    else
	success = FALSE;
    setContext( ocx );				// Will delete pcx

    if ( success )
	return pm;
    else
	return nullPm;
}
void DUpdateVisitor::visitMObject(const MObject *object)
{
    auto dobject = dynamic_cast<DObject *>(m_target);
    QMT_CHECK(dobject);
    if (isUpdating(object->stereotypes() != dobject->stereotypes()))
        dobject->setStereotypes(object->stereotypes());
    const MObject *objectOwner = object->owner();
    const MObject *diagramOwner = m_diagram->owner();
    if (objectOwner && diagramOwner && objectOwner->uid() != diagramOwner->uid()) {
        if (isUpdating(objectOwner->name() != dobject->context()))
            dobject->setContext(objectOwner->name());
    } else {
        if (isUpdating(!dobject->context().isEmpty()))
            dobject->setContext(QString());
    }
    if (isUpdating(object->name() != dobject->name()))
        dobject->setName(object->name());
    // TODO unlikely that this is called for all objects if hierarchy is modified
    // PERFORM remove loop
    int depth = 1;
    const MObject *owner = object->owner();
    while (owner) {
        owner = owner->owner();
        depth += 1;
    }
    if (isUpdating(depth != dobject->depth()))
        dobject->setDepth(depth);
    visitMElement(object);
}
NavigationWidget::NavigationWidget(KDevelop::DeclarationPointer declaration, KDevelop::TopDUContextPointer topContext, const QString& /* htmlPrefix */, const QString& /* htmlSuffix */)
{
    kDebug() << "Navigation widget for Declaration requested";
    m_topContext = topContext;
    
    initBrowser(400);
    
    DeclarationNavigationContext* context = new DeclarationNavigationContext(declaration, m_topContext);
    m_startContext = context;
    setContext(m_startContext);
    
    m_fullyQualifiedModuleIdentifier = context->m_fullyQualifiedModuleIdentifier;
    kDebug() << "Identifier: " << m_fullyQualifiedModuleIdentifier;
    if ( m_fullyQualifiedModuleIdentifier.length() ) {
        kDebug() << "Checking wether doc server is running";
        QTcpSocket* sock = new QTcpSocket();
        sock->connectToHost(QHostAddress::LocalHost, 1050, QTcpSocket::ReadOnly);
        bool running = sock->waitForConnected(300);
        if ( ! running ) {
            kDebug() << "Not running, starting pydoc server";
            QProcess::startDetached("/usr/bin/env", QStringList() << "python" << QString(INSTALL_PATH) + "/pydoc.py" << "-p" << "1050");
            usleep(100000); // give pydoc server 100ms to start up
        }
        else {
            sock->disconnectFromHost();
        }
        delete sock;
        
        m_documentationWebView = new QWebView(this);
        m_documentationWebView->load(QUrl("http://localhost:1050/" + m_fullyQualifiedModuleIdentifier + ".html"));
        connect( m_documentationWebView, SIGNAL(loadFinished(bool)), SLOT(addDocumentationData(bool)) );
    }
}
Exemple #6
0
VariableDeclaration::VariableDeclaration(const KDevelop::RangeInRevision& range, KDevelop::DUContext* context)
        : KDevelop::Declaration(*new VariableDeclarationData, range)
{
    d_func_dynamic()->setClassId(this);
    if (context)
        setContext(context);
}
PythonEditor::PythonEditor(EditorWidget *editorWidget)
    :BaseTextEditor(editorWidget)
{
    setContext(Core::Context(Constants::C_PYTHONEDITOR_ID,
                             TextEditor::Constants::C_TEXTEDITOR));
    setDuplicateSupported(true);
}
Exemple #8
0
void X11Wnd::fillRects(Context* context, RECT* rects, int numRects)
{
  setContext(context);
  for (int i = 0; i < numRects; i++)
    solidRect(rects[i],::GetTextColor(m_dc));
  ::InvalidateRect(m_hWnd,NULL,FALSE);
}
Exemple #9
0
void X11Wnd::drawLine(Context* context, int x1, int y1, int x2, int y2)
{
  setContext(context);
  ::MoveToEx(m_dc,x1,y1,NULL);
  ::LineTo(m_dc,x2,y2);
  ::InvalidateRect(m_hWnd,NULL,FALSE);
}
Exemple #10
0
	void ShortcutManager::SetShortcut (const QString& id, const QKeySequences_t& seqs)
	{
		for (auto act : Actions_ [id])
			act->setShortcuts (seqs);

		for (auto sc : Shortcuts_ [id])
		{
			sc->setKey (seqs.value (0));
			qDeleteAll (Shortcut2Subs_.take (sc));

			const int seqsSize = seqs.size ();
			for (int i = 1; i < seqsSize; ++i)
			{
				auto subsc = new QShortcut { sc->parentWidget () };
				subsc->setContext (sc->context ());
				subsc->setKey (seqs.value (i));
				connect (subsc,
						SIGNAL (activated ()),
						sc,
						SIGNAL (activated ()));
				Shortcut2Subs_ [sc] << subsc;
			}
		}

		if (Globals_.contains (id))
		{
			auto& e = Globals_ [id];
			e.Additional_ ["Shortcut"] = QVariant::fromValue (seqs.value (0));
			e.Additional_ ["AltShortcuts"] = Util::Map (seqs.mid (1),
					&QVariant::fromValue<QKeySequence>);
			CoreProxy_->GetEntityManager ()->HandleEntity (e);
		}
	}
Exemple #11
0
ClassMethodDeclaration::ClassMethodDeclaration(const KDevelop::RangeInRevision& range, KDevelop::DUContext* context)
        : KDevelop::ClassFunctionDeclaration(*new ClassMethodDeclarationData, range, context)
{
    d_func_dynamic()->setClassId(this);
    if (context)
        setContext(context);
}
WebCLUserEvent::WebCLUserEvent(cl_event event, PassRefPtr<WebCLContext> context)
    : WebCLEvent(event)
    , m_eventStatusSituation(StatusUnset)
    , m_executionStatus(0)
{
    setContext(context);
}
Exemple #13
0
void Console::setScriptEvaluator(const ScriptEvaluator &evaluator)
{
    m_scriptEvaluator = evaluator;
    m_consoleItemModel->setCanFetchMore(bool(m_scriptEvaluator));
    if (!m_scriptEvaluator)
        setContext(QString());
}
Exemple #14
0
/* OGLCanvas::onPaint
 * Called when the gfx canvas has to be redrawn
 *******************************************************************/
void OGLCanvas::onPaint(wxPaintEvent& e) {
	wxPaintDC(this);

	if (IsShown()) {
		// Set context to this window
#ifdef USE_SFML_RENDERWINDOW
#if SFML_VERSION_MAJOR < 2
		sf::RenderWindow::SetActive();
		Drawing::setRenderTarget(this);
		SetView(sf::View(sf::FloatRect(0.0f, 0.0f, GetSize().x, GetSize().y)));
#else
		sf::RenderWindow::setActive();
		Drawing::setRenderTarget(this);
		setView(sf::View(sf::FloatRect(0.0f, 0.0f, GetSize().x, GetSize().y)));
#endif//SFML_VERSION_MAJOR
#else
		setContext();
#endif//USE_SFML_RENDERWINDOW

		// Init if needed
		if (!init_done)
			init();

		// Draw content
		draw();
	}
}
Exemple #15
0
DesignerContext::DesignerContext(const Core::Context &context,
                                 QWidget *widget, QObject *parent)
  : Core::IContext(parent)
{
    setContext(context);
    setWidget(widget);
}
Exemple #16
0
QGLTextureGlyphCache::QGLTextureGlyphCache(const QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix)
    : QImageTextureGlyphCache(type, matrix), QGLContextGroupResourceBase()
    , ctx(0)
    , pex(0)
    , m_blitProgram(0)
    , m_filterMode(Nearest)
    , m_serialNumber(qgltextureglyphcache_serial_number.fetchAndAddRelaxed(1))
{
#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG
    qDebug(" -> QGLTextureGlyphCache() %p for context %p.", this, ctx);
#endif
    setContext(context);

    m_vertexCoordinateArray[0] = -1.0f;
    m_vertexCoordinateArray[1] = -1.0f;
    m_vertexCoordinateArray[2] =  1.0f;
    m_vertexCoordinateArray[3] = -1.0f;
    m_vertexCoordinateArray[4] =  1.0f;
    m_vertexCoordinateArray[5] =  1.0f;
    m_vertexCoordinateArray[6] = -1.0f;
    m_vertexCoordinateArray[7] =  1.0f;

    m_textureCoordinateArray[0] = 0.0f;
    m_textureCoordinateArray[1] = 0.0f;
    m_textureCoordinateArray[2] = 1.0f;
    m_textureCoordinateArray[3] = 0.0f;
    m_textureCoordinateArray[4] = 1.0f;
    m_textureCoordinateArray[5] = 1.0f;
    m_textureCoordinateArray[6] = 0.0f;
    m_textureCoordinateArray[7] = 1.0f;
}
 AgentCallbackLoginAction::AgentCallbackLoginAction(const std::string& agent, const std::string& exten, const std::string& context, bool ackCall, long wrapupTime) {
     setAgent(agent);
     setExten(exten);
     setContext(context);
     setAckCall(ackCall);
     setWrapupTime(wrapupTime);
 }
bool QQmlAndroidContextual::initContext(QQmlAndroidContext *context)
{
    if (!context)
        context = findContext(this);
    setContext(context);
    return context;
}
Exemple #19
0
AliasDeclaration::AliasDeclaration(const RangeInRevision& range, DUContext* context)
  : ClassMemberDeclaration(*new AliasDeclarationData, range)
{
  d_func_dynamic()->setClassId(this);
  setKind(Alias);
  if( context )
    setContext( context );
}
void QQmlAndroidContextual::resolveContext()
{
    if (!m_context) {
        setContext(findContext(this));
        if (!m_context)
            qWarning() << "QQmlAndroidContextual: could not resolve context for" << this;
    }
}
VcsBaseEditor::VcsBaseEditor(VcsBaseEditorWidget *widget,
                             const VcsBaseEditorParameters *type)  :
    BaseTextEditor(widget),
    m_id(type->id),
    m_temporary(false)
{
    setContext(Core::Context(type->context, TextEditor::Constants::C_TEXTEDITOR));
}
// context: String containing the parent context's name
bool ZeroMQHandler::setSlotContext(ZeroMQContext* const msg)
{
   // Save the name and find the context for use in the initialization
   // of the socket
   bool ok = false;
   if (msg != nullptr) ok = setContext(msg);
   return ok;
}
Exemple #23
0
void X11Wnd::drawPoints(Context* context, POINT* points, int numPoints)
{
  setContext(context);
  COLORREF col = ::GetTextColor(m_dc);
  for (int i = 0; i < numPoints; i++)
    ::SetPixel(m_dc,points[i].x,points[i].y,col);
  ::InvalidateRect(m_hWnd,NULL,FALSE);
}
PaintPlugin::~PaintPlugin() {
    gPathI.deletePath(m_touchPath);
    gPaintI.deletePaint(m_paintSurface);
    gPaintI.deletePaint(m_paintButton);

    setContext(NULL);
    destroySurface();
}
Exemple #25
0
/**
 * Sets the context for the script and if name points to a file then
 * sets the __file__ variable
 * @param name A string identifier for the script
 * @param context A QObject defining the context
 */
void PythonScript::initialize(const QString & name, QObject *context)
{
    clearLocals(); // holds and releases GIL

    GlobalInterpreterLock pythonlock;
    PythonScript::setIdentifier(name);
    setContext(context);
}
Exemple #26
0
void
exitProcess(int code)
{
   sExitCode = code;
   sRunning = false;
   cpu::halt();
   setContext(nullptr);
}
NamespaceAliasDeclaration::NamespaceAliasDeclaration(const SimpleRange& range, DUContext* context)
  : Declaration(*new NamespaceAliasDeclarationData, range)
{
  d_func_dynamic()->setClassId(this);
  setKind(NamespaceAlias);
  if( context )
    setContext( context );
}
Exemple #28
0
JNIEXPORT void JNICALL
Java_go_Seq_setContext(JNIEnv* env, jclass clazz, jobject ctx) {
	JavaVM* vm;
        if ((*env)->GetJavaVM(env, &vm) != 0) {
		LOG_FATAL("failed to get JavaVM");
	}
	setContext(vm, (*env)->NewGlobalRef(env, ctx));
}
FboCubeSurface::FboCubeSurface(int awidth, int aheight, QOpenGLContext* context)
    : QGLAbstractSurface(QGLAbstractSurface::User),
      QOpenGLFunctions(context==0 ? QOpenGLContext::currentContext() : context),
      width(awidth),
      height(aheight) {
    if (context != 0)
        setContext(context);
    init();
}
bool WebCLEvent::setAssociatedCommandQueue(WebCLCommandQueue* commandQueue)
{
    if (m_commandQueue)
        return false;

    m_commandQueue = commandQueue;
    setContext(m_commandQueue->context());
    return true;
}