/**
* Set the offset in u-coordinate of a 2d (unwrapped) surface
*/
void InstrumentWidgetRenderTab::setUCorrection() {
  auto surface = getSurface();
  auto rotSurface = boost::dynamic_pointer_cast<RotationSurface>(surface);
  if (rotSurface) {
    QPointF oldUCorr = rotSurface->getUCorrection();
    // ask the user to enter a number for the u-correction
    UCorrectionDialog dlg(this, oldUCorr, rotSurface->isManualUCorrection());
    if (dlg.exec() != QDialog::Accepted)
      return;

    QSettings settings;
    settings.beginGroup(m_instrWidget->getInstrumentSettingsGroupName());

    if (dlg.applyCorrection()) {
      QPointF ucorr = dlg.getValue();
      // update the surface only if the correction changes
      if (ucorr != oldUCorr) {
        rotSurface->setUCorrection(ucorr.x(),
                                   ucorr.y()); // manually set the correction
        rotSurface->requestRedraw();           // redraw the view
        settings.setValue(EntryManualUCorrection, true);
        settings.setValue(EntryUCorrectionMin, ucorr.x());
        settings.setValue(EntryUCorrectionMax, ucorr.y());
      }
    } else {
      rotSurface->setAutomaticUCorrection(); // switch to automatic correction
      rotSurface->requestRedraw();           // redraw the view
      settings.remove(EntryManualUCorrection);
      settings.remove(EntryUCorrectionMin);
      settings.remove(EntryUCorrectionMax);
    }
  }
}
Example #2
0
void FalagardActionButton::setPercentageImage(const String& animateName, int cur, int total)
{
    const Animate* pAnimate = 0;
    d_percentageImg = 0;

    //0.check para.
    if(abs(cur) > abs(total))
    {
        requestRedraw();
        return;
    }

    //1.get animate.
    if(animateName.empty())
    {
        pAnimate = AnimateManager::getSingleton().getAnimate((utf8*)"Percentage");
    }
    else
    {
        pAnimate = AnimateManager::getSingleton().getAnimate(animateName);
    }

    //2.get img used to draw percentage.
    if(pAnimate)
    {
        d_percentageImg = pAnimate->getFrame(abs(cur), abs(total));
    }

    requestRedraw();
}
Example #3
0
/*************************************************************************
	Sets the colours to be applied when rendering the image.
*************************************************************************/
void StaticImage::setImageColours(const ColourRect& colours)
{
	d_imageCols = colours;
	updateRenderableImageColours();

	requestRedraw();
}
Example #4
0
	/*************************************************************************
		Handler called when size is changed
	*************************************************************************/
	void FalagardRewardItem::onSized(WindowEventArgs& e)
	{
		FalagardButton::onSized(e);

		performWindowLayout();
		requestRedraw();
	}
Example #5
0
/*************************************************************************
	Update the internal state of the Widget
*************************************************************************/
void ButtonBase::updateInternalState(const Point& mouse_pos)
{
	bool oldstate = d_hovering;

	// assume not hovering 
	d_hovering = false;

	// if input is captured, but not by 'this', then we never hover highlight
	const Window* capture_wnd = getCaptureWindow();

	if ((capture_wnd == NULL) || (capture_wnd == this))
	{
		Window* sheet = System::getSingleton().getGUISheet();

		if (sheet != NULL)
		{
			// check if hovering highlight is required, which is basically ("mouse over widget" XOR "widget pushed").
			if ((this == sheet->getChildAtPosition(mouse_pos)) != d_pushed)
			{
				d_hovering = true;
			}

		}

	}

	// if state has changed, trigger a re-draw
	if (oldstate != d_hovering)
	{
		requestRedraw();
	}

}
Example #6
0
void FalagardActionButton::setCornerChar(int nPos, const String32& strChar)
{
    String32 strCharSafe="  ";
    if(strChar.size() > 3)
    {
        strCharSafe += strChar.substr(0, 3);
    }
    else strCharSafe += strChar;
    strCharSafe[0] = 0XFBFFFFFF;
    strCharSafe[1] = 0XFC010101;

    switch(nPos)
    {
    case 0:
        d_CornerChar_TopLeft.d_Char		= strCharSafe;
        break;
    case 1:
        d_CornerChar_TopRight.d_Char	= strCharSafe;
        break;
    case 2:
        d_CornerChar_BotLeft.d_Char		= strCharSafe;
        break;
    case 3:
        d_CornerChar_BotRight.d_Char	= strCharSafe;
        break;
    default:
        break;
    }

    requestRedraw();
}
Example #7
0
void ButtonBase::updateInternalState(const Point& mouse_pos)
{
    // This code is rewritten and has a slightly different behaviour
    // it is no longer fully "correct", as overlapping windows will not be
    // considered if the widget is currently captured.
    // On the other hand it's alot faster, so I believe it's a worthy
    // tradeoff

    bool oldstate = d_hovering;

    // assume not hovering
    d_hovering = false;

    // if input is captured, but not by 'this', then we never hover highlight
    const Window* capture_wnd = getCaptureWindow();
    if (capture_wnd == 0)
    {
        System* sys = System::getSingletonPtr();
        if (sys->getWindowContainingMouse() == this && isHit(mouse_pos))
        {
            d_hovering = true;
        }
    }
    else if (capture_wnd == this && isHit(mouse_pos))
    {
        d_hovering = true;
    }

    // if state has changed, trigger a re-draw
    if (oldstate != d_hovering)
    {
        requestRedraw();
    }
}
void ossimPlanetViewer::updateTraversal()
{
   ossimPlanetTerrain* terrain = dynamic_cast<ossimPlanetTerrain*>(terrainLayer());
   if(terrain&&!terrain->getDatabasePager()) terrain->setDatabasePager(getDatabasePager());

   if(!mkUtils::almostEqual(theCurrentViewMatrix,
                            getCamera()->getViewMatrix()))
   {
      theCurrentViewMatrix        = getCamera()->getViewMatrix();
      theCurrentViewMatrixInverse = theCurrentViewMatrix.inverse(theCurrentViewMatrix);
      computeCurrentCameraInfo();
      const ossimPlanetGeoRefModel* landModel = model();

      // let's do a crude normalize distance to do an estimate NearFarRatio
      //
      if(getCamera()&&landModel&&theCurrentLookAt.valid()&&theCurrentCamera.valid()&&theCalculateNearFarRatioFlag)
      {
         double dist = ossim::min(theCurrentLookAt->range(),
                                  theCurrentCamera->altitude())/osg::WGS_84_RADIUS_EQUATOR;
         double t = log(1+dist);
         t = ossim::clamp(t, 0.0, 1.0);
         double ratio = .1*(t) + (.0000001)*(1.0-t);
         getCamera()->setNearFarRatio(ossim::min(.001, ratio));
      }
      notifyViewChanged();
   }
   osgViewer::Viewer::updateTraversal();
   if(theEphemerisCamera.valid())
   {
      if(theEphemerisCamera.valid())
      {
         theEphemerisCamera->setGraphicsContext(getCamera()->getGraphicsContext());
         theEphemerisCamera->setRenderTargetImplementation( getCamera()->getRenderTargetImplementation() );
      }
      osg::Viewport* viewport    = getCamera()->getViewport();
      osg::Viewport* ephViewport = theEphemerisCamera->getViewport();
      if(viewport&&ephViewport)
      {
         if(!ossim::almostEqual(viewport->x(), ephViewport->x())||
            !ossim::almostEqual(viewport->y(), ephViewport->y())||
            !ossim::almostEqual(viewport->width(), ephViewport->width())||
            !ossim::almostEqual(viewport->height(), ephViewport->height()))
         {            
            ephViewport->setViewport(viewport->x(), 
                                     viewport->y(), 
                                     viewport->width(), 
                                     viewport->height());
         }
      }
      theEphemerisCamera->setProjectionMatrix(getCamera()->getProjectionMatrix());
      theEphemerisCamera->setViewMatrix(getCamera()->getViewMatrix());
   }
   bool databasePagerHasRequests = getDatabasePager()?getDatabasePager()->requiresUpdateSceneGraph():false;//||
                                                       //getDatabasePager()->requiresCompileGLObjects()):false;
   if(databasePagerHasRequests)
   {
      requestRedraw();
   }
   
}
Example #9
0
/*************************************************************************
Remove a tab by ID
*************************************************************************/
void TabControl::removeTab(uint ID)
{
    // do nothing if given window is not attached as a tab.
    if (!d_tabContentPane->isChild(ID))
        return;

    Window* wnd = d_tabContentPane->getChild(ID);
    // Was this selected?
    bool reselect = wnd->isVisible();
    // Tab buttons are the 2nd onward children
    d_tabContentPane->removeChildWindow(ID);

    // remove button too
    removeButtonForTabContent(wnd);

    if (reselect)
    {
        // Select another tab
        if (getTabCount() > 0)
        {
            setSelectedTab(d_tabContentPane->getChildAtIdx(0)->getName());
        }
    }

    performChildWindowLayout();

    requestRedraw();

}
Example #10
0
/*************************************************************************
	Event generated internally whenever the roll-up / shade state of the
	window changes.
*************************************************************************/
void FrameWindow::onRollupToggled(WindowEventArgs& e)
{
    requestRedraw();
    notifyClippingChanged();

	fireEvent(EventRollupToggled, e, EventNamespace);
}
Example #11
0
	void FalagardChatHistory::onSized(WindowEventArgs& e)
	{
		Window::onSized(e);

		performWindowLayout();
		requestRedraw();
	}
Example #12
0
/*************************************************************************
	Set the formatting required for the image.	
*************************************************************************/
void StaticImage::setFormatting(HorzFormatting h_fmt, VertFormatting v_fmt)
{
	d_image.setHorzFormatting((RenderableImage::HorzFormatting)h_fmt);
	d_image.setVertFormatting((RenderableImage::VertFormatting)v_fmt);

	requestRedraw();
}
Example #13
0
void PushButton::setStandardImageryEnabled(bool setting)
{
    if (d_useStandardImagery != setting)
    {
        d_useStandardImagery = setting;
        requestRedraw();
    }
}
Example #14
0
void FalagardActionButton::setBackImage( const Image* pImage )
{
    d_BackImage.setImage(pImage);
    d_BackImage.setHorzFormatting(RenderableImage::HorzStretched);
    d_BackImage.setVertFormatting(RenderableImage::VertStretched);
    d_BackImage.setSize(getUnclippedInnerRect().getSize());
    requestRedraw();
}
Example #15
0
	/*************************************************************************
	Handler called when the scroll bar positions change
	*************************************************************************/
	bool FalagardChatHistory::handleScrollbarChange(const EventArgs& e)
	{
		performWindowLayout();

		requestRedraw();
		d_parentWindow->requestRedraw();
		return true;
	}
Example #16
0
/*************************************************************************
	Causes the list box to update it's internal state after changes have
	been made to one or more attached ListboxItem objects.
*************************************************************************/
void Listbox::handleUpdatedItemData(void)
{
    if (d_sorted)
        resortList();

	configureScrollbars();
	requestRedraw();
}
void RNDFEditGLView::mouseMoveEvent(QMouseEvent *event) {
  double x2, y2;
  pickPoint(event->x(), event->y(), &x2, &y2);
  double utm_x = x2 + gui->rndf_center.x;
  double utm_y = y2 + gui->rndf_center.y;
  std::string utm_zone = gui->rndf_center.zone;
  gui->last_utm_x = utm_x;
  gui->last_utm_y = utm_y;

  switch (event->modifiers()) {
    case Qt::ControlModifier: // selected object is affected
        // update undo buffer
      if(gui->last_rn_) {delete gui->last_rn_;}
      if(gui->last_rn_search_) {delete gui->last_rn_search_;}
      gui->last_rn_ = new rndf::RoadNetwork(*gui->rn_);
      gui->last_rn_search_ = new rndf::RoadNetworkSearch(*gui->rn_search_, gui->last_rn_);
      if (event->buttons().testFlag(Qt::LeftButton)) {
        gui->moveElement(utm_x, utm_y, utm_zone);
      }
      else if (event->buttons() & Qt::RightButton) {
        gui->rotateElement(utm_x, utm_y, utm_zone);
     }

      gui->updateSmoothedLaneStack();
      requestRedraw();
      break;

    case Qt::NoModifier:
      gui->last_mouse_x = event->x();
      gui->last_mouse_y = event->y();
      if (gui->current_element == RNDF_ELEMENT_EXIT) {
        requestRedraw();
      }
      else {
        GLWidget::mouseMoveEvent(event);
      }

    default: // let base class handle other cases
      GLWidget::mouseMoveEvent(event);
      break;
  }

  gui->last_move_utm_x = utm_x;
  gui->last_move_utm_y = utm_y;
}
void ClippedContainer::setClipArea(const CEGUI::Rect& r)
{
    if (d_clipArea != r)
    {
        d_clipArea = r;
        requestRedraw();
        notifyClippingChanged();
    }
}
Example #19
0
/*************************************************************************
	Set the colour to use for the label text when rendering in the
	normal state.	
*************************************************************************/
void ButtonBase::setNormalTextColour(const colour& colour)
{
	if (d_normalColour != colour)
	{
		d_normalColour = colour;
		requestRedraw();
	}

}
Example #20
0
/*************************************************************************
	Set the colour to use for the label text when rendering in the
	hover / highlighted states.	
*************************************************************************/
void ButtonBase::setHoverTextColour(const colour& colour)
{
	if (d_hoverColour != colour)
	{
		d_hoverColour = colour;
		requestRedraw();
	}

}
Example #21
0
/*************************************************************************
	Set the colour to use for the label text when rendering in the
	pushed state.
*************************************************************************/
void ButtonBase::setPushedTextColour(const colour& colour)
{
	if (d_pushedColour != colour)
	{
		d_pushedColour = colour;
		requestRedraw();
	}

}
Example #22
0
void FalagardActionButton::notifyDragingEnd(void)
{
    d_dragging = false;
    d_leftMouseDown = false;
    WindowEventArgs args(this);
    fireEvent(EventDragEnded, args, EventNamespace);

    requestRedraw();
}
void ClippedContainer::setClipperWindow(CEGUI::Window* w)
{
    if (d_clipperWindow != w)
    {
        d_clipperWindow = w;
        requestRedraw();
        notifyClippingChanged();
    }
}
Example #24
0
/*************************************************************************
	Set the colour to use for the label text when rendering in the
	disabled state.	
*************************************************************************/
void ButtonBase::setDisabledTextColour(const colour& colour)
{
	if (d_disabledColour != colour)
	{
		d_disabledColour = colour;
		requestRedraw();
	}

}
Example #25
0
	void	FalagardCheckButton::setSelectImage(const RenderableImage* image)
	{
		if (image)
		{
			d_selectImage = *image;
			d_selectImage.setRect(Rect(0, 0, getAbsoluteWidth(), getAbsoluteHeight()));
		}
		requestRedraw();
	}
Example #26
0
/*************************************************************************
	Enable or disable rendering of the background for this static widget.
*************************************************************************/
void Static::setBackgroundEnabled(bool setting)
{
    if (d_backgroundEnabled != setting)
    {
        d_backgroundEnabled = setting;
        requestRedraw();
    }

}
Example #27
0
int KoReportItemMaps::renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset,
                                       const QVariant &data, KRScriptHandler *script)
{
    Q_UNUSED(script)
    
    myDebug() << this << "data:" << data;
    QString dataKey = data.toString();
    QStringList dataList = dataKey.split(QLatin1Char(';'));
    //myDebug() << "splited:" << dataList;
    Marble::MarbleWidget* marble;
    
    if(m_marbles.count(dataKey)==0){ //no such marble yet
        marble = initMarble();
        m_marbles.insert(dataKey, marble);
        connect(marble->model(), SIGNAL(modelChanged()), this, SLOT(requestRedraw()));
        if(dataList.count()==3){
            marble->setCenterLatitude(dataList[0].toDouble());
            marble->setCenterLongitude(dataList[1].toDouble());
            marble->zoomView(dataList[2].toInt());
        }
    }else{
        marble = m_marbles[dataKey];
    }

    marble->render(m_mapImage);
    
    OROImage * id = new OROImage();
    id->setImage(*m_mapImage);
    id->setScaled(false);

    id->setPosition(m_pos.toScene() + offset);
    id->setSize(m_size.toScene());
    OroIds oroIds;
    if (page) {
        page->addPrimitive(id);
        oroIds.pageId = id;
        myDebug() << "page:id=" <<id;
    }
    
    if (section) {
        OROImage *i2 = dynamic_cast<OROImage*>(id->clone());
        i2->setPosition(m_pos.toPoint());
        section->addPrimitive(i2);
        oroIds.sectionId = i2;
        myDebug() << "section:id=" << i2;
    }
    
    if (!page) {
        delete id;
        oroIds.pageId=0;
    }
    oroIds.marbleWidget = marble;
    m_marbleImgs[marble->model()]=oroIds;
    
    return 0; //Item doesn't stretch the section height
}
void GLWidget::resizeGL(int w, int h) {
  int tx = 0, ty = 0, tw = w, th = h;
  glViewport(tx, ty, tw, th);

  window_width = tw;
  window_height = th;

  init3DMode(tw, th, camera_fov, min_clip_range, max_clip_range);
  requestRedraw();
}
Example #29
0
/*************************************************************************
	Sets the colours to be applied when rendering the background.
*************************************************************************/
void Static::setBackgroundColours(const ColourRect& colours)
{
    d_backgroundCols = colours;

    if (d_backgroundEnabled)
    {
        requestRedraw();
    }

}
Example #30
0
void ButtonBase::onMouseLeaves(MouseEventArgs& e)
{
    // deafult processing
    Window::onMouseLeaves(e);

    d_hovering = false;
    requestRedraw();

    e.handled = true;
}