Ejemplo n.º 1
0
void QueryUpdate::process()
{
    auto data = QueryClient::Get().Query();
    if (QueryClient::Get().Status() != ID_MASTER_QUERY)
    {
        emit finished();
        return;
    }

    for (const auto &server : data)
        emit updateModel(server.first.ToString(false), server.first.GetPort(), server.second);
    emit finished();
}
Ejemplo n.º 2
0
void CommentWindow::comment()
{
	if (g_umUserManager.Comment(m_mvModel.m_sVideoID, m_qteComment->toPlainText().toStdString()) == SUCCESS)
	{
		g_umUserManager.GetLastVideo(m_mvModel);
		emit updateModel(m_mvModel);

		m_qteComment->clear();
		m_qmbMsg->setText("Comment Successfully");
		m_qmbMsg->setWindowModality(Qt::WindowModal);
		m_qmbMsg->show();
		connect(m_qmbMsg, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(toComment()));
	}
Ejemplo n.º 3
0
/*!
 Sets parent
 \param parentId
 */
void CaItemModelPrivate::setParentId(int parentId)
{
    CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::setParentId");
    mQuery.setParentId(parentId);
    if (mNotifier) {
        delete mNotifier;
        mNotifier = mService->createNotifier(CaNotifierFilter(mQuery));
        reconnectSlots();
    }
    updateModel();
    CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::setParentId");

}
Ejemplo n.º 4
0
void ToolKillZoneFrustum::setCenter(const Point& newCenter)
	{
	/* Transform the new center to screen coordinates: */
	ONTransform screenT=screen->getScreenTransformation();
	Point newBoxCenter=screenT.inverseTransform(newCenter);
	newBoxCenter[2]=Scalar(0);
	
	/* Move the box to the new center position: */
	box.setOrigin(newBoxCenter-Vector(box.getSize())*Scalar(0.5));
	
	/* Update the model: */
	updateModel();
	}
Ejemplo n.º 5
0
void EventViewer::prevEvent()
{
    if (!matrixDataIsAvailable()) return;
    _EVENT evt;
    evt.Reset();

    if (m_data->GetPrevEvent(evt))
    {
        //treeView model update
        updateModel(evt);
        //update spectrogram data
        updatePlot(evt);
    }
}
Ejemplo n.º 6
0
int XC::HHTHybridSimulation::update(const XC::Vector &deltaU)
{
    AnalysisModel *theModel = this->getAnalysisModelPtr();
    if (theModel == 0)  {
        std::cerr << "WARNING XC::HHTHybridSimulation::update() - no XC::AnalysisModel set\n";
        return -1;
    }	
    
    // check domainChanged() has been called, i.e. Ut will not be zero
    if (Ut.get().Size() == 0)  {
        std::cerr << "WARNING XC::HHTHybridSimulation::update() - domainChange() failed or not called\n";
        return -2;
    }	
    
    // check deltaU is of correct size
    if (deltaU.Size() != U.get().Size())  {
        std::cerr << "WARNING XC::HHTHybridSimulation::update() - Vectors of incompatible size ";
        std::cerr << " expecting " << U.get().Size() << " obtained " << deltaU.Size() << std::endl;
        return -3;
    }
    
    // determine the displacement increment reduction factor
    rFact = 1.0/(theTest->getMaxNumTests() - theTest->getNumTests() + 1.0);

    //  determine the response at t+deltaT
    (U.get()) += rFact*deltaU;

    U.getDot().addVector(1.0, deltaU, rFact*c2);
    
    U.getDotDot().addVector(1.0, deltaU, rFact*c3);

    // determine displacement and velocity at t+alpha*deltaT
    (Ualpha.get()) = Ut.get();
    Ualpha.get().addVector((1.0-alphaF), U.get(), alphaF);

    (Ualpha.getDot()) = Ut.getDot();
    Ualpha.get().addVector((1.0-alphaF), U.getDot(), alphaF);
    
    (Ualpha.getDotDot()) = Ut.getDotDot();
    Ualpha.getDotDot().addVector((1.0-alphaI()), U.getDotDot(), alphaI());

    // update the response at the DOFs
    theModel->setResponse(Ualpha.get(),Ualpha.getDot(),Ualpha.getDotDot());
    if(updateModel() < 0)
      {
        std::cerr << "XC::HHTHybridSimulation::update() - failed to update the domain\n";
        return -4;
      }
    return 0;
  }
Ejemplo n.º 7
0
/*!
 Removes item from model
 \param id of item to remove
 */
void CaItemModelPrivate::removeItem(int id)
{
    CACLIENTTEST_FUNC_ENTRY("CaItemModelPrivate::removeItem");
    int row = mEntries.indexOf(id);
    if (row >= 0 && rowCount() > 1) {
        m_q->beginRemoveRows(QModelIndex(), mEntries.indexOf(id),
        mEntries.indexOf(id));
        mEntries.remove(id);
        m_q->endRemoveRows();
    } else {
        updateModel();
    }
    CACLIENTTEST_FUNC_EXIT("CaItemModelPrivate::removeItem");
}
Ejemplo n.º 8
0
EarthquakePlugin::EarthquakePlugin( const MarbleModel *marbleModel )
    : AbstractDataPlugin( marbleModel ),
      m_ui( 0 ),
      m_configDialog( 0 ),
      m_minMagnitude( 0.0 ),
      m_startDate( QDateTime::fromString( "2006-02-04", "yyyy-MM-dd" ) ),
      m_endDate( marbleModel->clockDateTime() ),
      m_maximumNumberOfItems( 100 )
{
    setEnabled( true ); // Plugin is enabled by default
    setVisible( false ); // Plugin is invisible by default
    connect( this, SIGNAL(settingsChanged(QString)),
             this, SLOT(updateModel()) );
}
Ejemplo n.º 9
0
/***********************************************************************
     * Character
     * updateEquip

***********************************************************************/
void fired::Character::updateEquip() {
	emptyStats(&equipStats);

	if (helm) helm = NULL;
	if (arms) arms = NULL;
	if (legs) legs = NULL;
	if (body) body = NULL;
	if (shoe) shoe = NULL;
	if (fist) fist = NULL;


	if (inventory->helm.base) {
		helm = container->armors[inventory->helm.base->UID];
		equipStats.armor += helm->armor;
	}

	if (inventory->body.base) {
		body = container->armors[inventory->body.base->UID];
		equipStats.armor += body->armor;
	}

	if (inventory->arms.base) {
		arms = container->armors[inventory->arms.base->UID];
		equipStats.armor += arms->armor;
	}

	if (inventory->fist.base) {
		fist = container->armors[inventory->fist.base->UID];
		equipStats.armor += fist->armor;
	}

	if (inventory->legs.base) {
		legs = container->armors[inventory->legs.base->UID];
		equipStats.armor += legs->armor;
	}

	if (inventory->shoe.base) {
		shoe = container->armors[inventory->shoe.base->UID];
		equipStats.armor += shoe->armor;
	}

	if (inventory->primaryWeapon.base) setWeapon(container->weapons[inventory->primaryWeapon.base->UID]);
	else                               setWeapon(base->weapon);

	if (inventory->primaryAmmo.base) ammo = container->ammos[inventory->primaryAmmo.base->UID];
	else                             ammo = base->ammo;

	updateModel();
}
Ejemplo n.º 10
0
static void
cubemodelModelOptionChange (CompScreen             *s,
			    CompOption             *opt,
			    CubemodelScreenOptions num)
{
    CUBEMODEL_SCREEN (s);

    if (!cms->models || cms->numModels <= 0)
    {
	updateCubemodel (s);
	return;
    }

    updateModel (s, 0, cms->numModels);
}
Ejemplo n.º 11
0
void VariableModelManager::setServerAvailable(bool available)
{
    m_serverAvailable = available;
    emit serverAvailableChanged(available);

    if (available){

        m_timer.start();
        updateModel();
    }
    else{

        m_timer.stop();
    }
}
Ejemplo n.º 12
0
void Graph::optimizeCommus(){
	bool haschanged = true;
	while(haschanged){
		haschanged = false;
		for(int v=0; v<numVertices; v++){
			intset neighborcommus;
			for(edgemap::iterator e = vertices[v].edges.begin(); e != vertices[v].edges.end(); e++){
				for(int i=0; i<commupervertex[e->first].size(); i++){
					neighborcommus.insert(commupervertex[e->first][i]);
				}
			}
			for(int i=0; i<commupervertex[v].size(); i++){
				neighborcommus.erase(commupervertex[v][i]);
			}
			for(int i=0; i<commupervertex[v].size(); i++){
				if(testwithout(v,commupervertex[v][i])){
					removeVertexCommunity(v,commupervertex[v][i]);
					if(testsig(commupervertex[v][i]) > sigthresh){
						deleteCommunity(commupervertex[v][i]);
					}
					updateModel();
				}
			}
			for(intset::iterator c = neighborcommus.begin(); c != neighborcommus.end(); c++){
				if(testwith(v,*c)){
					addVertexCommunity(v,*c);
					if(testsig(*c) > sigthresh){
						removeVertexCommunity(v,*c);
					}else{
						updateModel();
					}
				}
			}
		}
	}
}
Ejemplo n.º 13
0
LegendGroup::LegendGroup(const QPointF& Clicked, MarkerModel* model, QGraphicsItem* parent):
	QGraphicsItemGroup(parent), origin(Clicked), model(model)
{
	mySize = 20;
	frame = new RectItem(QRectF());
	frame->setBrush(QColor(255, 255, 255, 192));
	setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemSendsGeometryChanges);
	addToGroup(frame);
	auto s = Settings("LegendL");
	myPenWidth = s.penWidth();
	mySize = s.size();
	myFont = s.font();
	myFontSize = s.fontSize();
	updateModel();
}
Ejemplo n.º 14
0
LayerTableView::LayerTableView(QWidget *parent)
: QTableView(parent)
{
	delegate = new LayerItemDelegate();
	model = new LayerTableModel();
	
	this->setContentsMargins(0, 0, 0, 0);
	this->setModel(model);
	this->setItemDelegate(delegate);
	this->setEditTriggers(QAbstractItemView::DoubleClicked);

	this->horizontalHeader()->setStretchLastSection(true);
	this->horizontalHeader()->setHighlightSections(false);
	this->setFrameShape(QFrame::NoFrame);

#if defined(Q_OS_WIN)
this->setColumnWidth(0, 20);
#elif defined(Q_OS_MAC)
this->setColumnWidth(0, 30);
#endif

    this->setColumnWidth(1, 170);
	this->verticalHeader()->setVisible(false);
	this->horizontalHeader()->setVisible(false);

	this->setSelectionMode(QAbstractItemView::ExtendedSelection);
	this->setDefaultDropAction(Qt::MoveAction);
	this->setDragEnabled(true);
	this->setDragDropOverwriteMode(false);
	this->viewport()->setAcceptDrops(true);
	this->setDragDropMode(QAbstractItemView::InternalMove);
	this->setAcceptDrops(true);
	this->setDropIndicatorShown(true);


	this->setMouseTracking(true);//important

	connect(this->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), \
		this, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection&)));

	//When click on the checkbox it will emit signal twice.Click on the cell emit only once.
	connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(itemClicked(const QModelIndex&)));
	LayerManager* pManager = LayerManager::getInstance();
	connect(pManager, SIGNAL(updateModel()), this, SLOT(updateView()));

	contextMenu = new QMenu(this);
	this->createActions();
}
Ejemplo n.º 15
0
void ContentBlockingDialog::editProfile()
{
	const QModelIndex index(m_ui->profilesViewWidget->currentIndex().sibling(m_ui->profilesViewWidget->currentIndex().row(), 0));
	ContentBlockingProfile *profile(ContentBlockingManager::getProfile(index.data(Qt::UserRole).toString()));

	if (profile)
	{
		const ContentBlockingProfile::ProfileCategory category(profile->getCategory());
		ContentBlockingProfileDialog dialog(this, profile);

		if (dialog.exec() == QDialog::Accepted)
		{
			updateModel(profile, (category != profile->getCategory()));
		}
	}
}
Ejemplo n.º 16
0
fmi2Status FMU2Wrapper::getString(const fmi2ValueReference vr[], size_t nvr,
                                  fmi2String value[])
{
  if (nvr > _string_buffer.size()) {
    FMU2_LOG(this, fmi2Error, logStatusError,
             "Attempt to get %d fmi2String; FMU only has %d",
             nvr, _string_buffer.size());
    return fmi2Error;
  }
  if (_need_update)
    updateModel();
  _model->getString(vr, nvr, &_string_buffer[0]);
  for (size_t i = 0; i < nvr; i++)
    value[i] = _string_buffer[i].c_str(); // convert to fmi2String
  return fmi2OK;
}
Ejemplo n.º 17
0
InstrumentTree::InstrumentTree(QWidget* parent, MidiInstrument* i, bool popup) : QTreeView(parent)
{
    m_instrument = i;
    m_popup = popup;
    _patchModel = new QStandardItemModel(0, 2, this);
    _patchSelModel = new QItemSelectionModel(_patchModel);
    setExpandsOnDoubleClick(true);
    setModel(_patchModel);
    connect(this, SIGNAL( doubleClicked(const QModelIndex&) ), this, SLOT(patchDoubleClicked(const QModelIndex&) ) );
    connect(this, SIGNAL( clicked(const QModelIndex&) ), this, SLOT(patchClicked(const QModelIndex&) ) );
    if(popup)
    {
        setWindowFlags(Qt::SplashScreen | Qt::WindowStaysOnTopHint);
    }
    updateModel();
}
Ejemplo n.º 18
0
QObject *CSVFactory::create(const QString &mimeType, const QUrl &url,
                            const QStringList &argumentNames,
                            const QStringList &argumentValues) const
{
    if (mimeType != "text/csv")
        return 0;

    CSVView *view = new CSVView(argumentValues[argumentNames.indexOf("type")]);

    QNetworkRequest request(url);
    QNetworkReply *reply = manager->get(request);
    connect(reply, SIGNAL(finished()), view, SLOT(updateModel()));
    connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater()));

    return view;
}
Ejemplo n.º 19
0
QModelIndex CObjectInspectorTreeModel::index(int row, int column, const QModelIndex &parent) const
{
    if(!frootNode || row<0 || column<0 || column>=maxColumn || (parent.isValid() && parent.column()!=0))
        return  QModelIndex();

    TreeNode    *   parentNode = nodeForIndex(parent);
    Q_ASSERT(parentNode);
    if(TreeNode * item = dynamic_cast<TreeNode*>(parentNode->childAt(row)))
    {
        QModelIndex createdIndex = createIndex(row,column,item);
        item->setModelIndex(createdIndex);
        connect(item,SIGNAL(updateModel(QModelIndex,QModelIndex)),this,SIGNAL(dataChanged(QModelIndex,QModelIndex)));
        return  createdIndex;
    }
    return  QModelIndex();
}
Ejemplo n.º 20
0
/*
 *	Function called from main block of code
 *  Returns true (1) if sucessful, 0, if unsucessful
 */ 
int Controller()	{
	
	// Robot will turn this angle in this timestep
	// DEFAULT = no change in current heading
	double angleOfTurn = 0;	


	// INITIALIZE VALUES
	initialize();	
				

	// Checks for that remode control option is disabled
	if (rcDisabled) {		  	
		return false;
	}

	// Set ERROR flag when updating values
	int ERROR = updateVar();			

	// Runs linear controller w/Control Law (calculates next step)
	linearAngle = linearController();
	
	// Checks/updates computer model to see if robot is on 
	// desired trajectory
	modelAngle = modelController();	
	
	
	//CURRENTLY SET FOR ALL SENSOR INPUT
	int c1 = 1;
	int c2 = 0;
	if (ERROR == true)
	{
		//STEER WITHOUT SENSORY INPUT
		c1 = 0; c2 = 1;
	}  	

	// CONTROL LAW - MODEL VS. SENSOR DATA
	angleOfTurn = c1 * linearAngle + c2 * modelAngle;
							 
	// Send commands to steering board (set values of enums)							
	steer(angleOfTurn);
	
	// Update robot model of location
	updateModel(angleOfTurn);	
		
	return ERROR;
}
Ejemplo n.º 21
0
/*------------------------------------------------------*/
unsigned getSymbol(struct Model *m)
{
	unsigned symbol;
	unsigned const *f;
	u_int32_t smallL, smallH, smallT, smallR, smallR_x_smallL, target;

	smallT = m->totFreq;

	/* Get target value */
	smallR = bigR / smallT;
	target = bigD / smallR;
	if (target >= smallT)
		target = smallT - 1;

	smallH = 0;
	for (f = m->freq; ; f++)
	{
		assert(f < &m->freq[m->numSymbols]);

		smallH += *f;
		if (smallH > target)
			break;
	}
	smallL = smallH - *f;

	smallR_x_smallL = smallR * smallL;
	bigD -= smallR_x_smallL;

	if (smallH < smallT)
		bigR = smallR * *f;
	else
		bigR -= smallR_x_smallL;

	while (bigR <= TWO_TO_THE(smallB - 2))
	{
		bigR <<= 1;
		bigD <<= 1;
		bigD |= bs_get_bit();
	}

	symbol = f - m->freq;
	assert(INRANGE(symbol, 0, m->numSymbols - 1));
	updateModel(m, symbol);

	return symbol;
} /* getSymbol */
Ejemplo n.º 22
0
void MeanShiftTracker::trackObject(const cv::Mat &image) {
  double temp = 0;
  double pu_actual[colorBins][colorBins][colorBins];
  double pu_nuevo[colorBins][colorBins][colorBins];
  cv::Point newCenter = cv::Point(-1, -1);
  cv::Point currentCenter = cv::Point(-1, -1);

  currentCenter = trackingWindowCenter;
  iteration = 1;

  do
  {
    getPu(image, pu_actual, currentCenter);
    newCenter = MeanShift(image, pu_actual, currentCenter);
    getPu(image, pu_nuevo, newCenter);

    temp = getBhattaCoefficient(qu, pu_nuevo) - getBhattaCoefficient(qu, pu_actual) ;
    if (temp < bhattaEpsilon || (iteration == maxIterations))
    {
      if (temp < 0)
        newCenter = currentCenter;

      bhattaCoefficient = getBhattaCoefficient(qu, pu_nuevo);
      break;
    }
    else
    {
      currentCenter = newCenter;
      iteration += 1;
    }
  }
  while (true);

  getPu(image, pu_nuevo, newCenter);
  double newPu = getBhattaCoefficient(qu, pu_nuevo);

  lastError = newPu;

  trackingWindowCenter = newCenter;

  if (enableModelUpdate)
    //if (getBhattaCoefficient(qu, pu_nuevo) < modelUpdateEpsilon)
    updateModel(image, newCenter);

  trackingWindow = calculateTrackingWindow(trackingWindowCenter);
}
Ejemplo n.º 23
0
//*****************************************************************************
//  METHOD: ossimTileMapModel::loadState()
//
//  Restores the model's state from the KWL. This KWL also serves as a
//  geometry file.
//
//*****************************************************************************
   bool ossimTileMapModel::loadState(const ossimKeywordlist& kwl,
                                     const char* prefix)
   {
      if (traceExec())  ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimTileMapModel::loadState: entering..." << std::endl;

      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimTileMapModel::loadState:"
                                             << "\nInput kwl:  " << kwl
                                             << std::endl;
      }

      const char* value = NULL;
      //const char* keyword =NULL;
      bool success;

      //***
      // Assure this keywordlist contains correct type info:
      //***
      value = kwl.find(prefix, ossimKeywordNames::TYPE_KW);
      if (!value || (strcmp(value, TYPE_NAME(this))))
      {
         theErrorStatus = 1;
         return false;
      }

      value = kwl.find(prefix, "depth");
      qDepth = atoi(value);

      //***
      // Pass on to the base-class for parsing first:
      //***
      success = ossimSensorModel::loadState(kwl, prefix);
      if (!success)
      {
         theErrorStatus++;
         return false;
      }


      updateModel();

      if (traceExec())  ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimTileMapModel::loadState: returning..." << std::endl;
      return true;
   }
ossimSpectraboticsRedEdgeModel::ossimSpectraboticsRedEdgeModel(const ossimDrect& imageRect,
                                               const ossimGpt& platformPosition,
                                               double roll,
                                               double pitch,
                                               double heading,
                                               const ossimDpt& /* principalPoint */, // in millimeters
                                               double focalLength, // in millimeters
                                               const ossimDpt& pixelSize) // in millimeters
{
   theImageClipRect = imageRect;
   theRefImgPt      = theImageClipRect.midPoint();
   m_compositeMatrix          = ossimMatrix4x4::createIdentity();
   m_compositeMatrixInverse   = ossimMatrix4x4::createIdentity();
   m_roll                     = roll;
   m_pitch                    = pitch;
   m_heading                  = heading;
   m_focalLength              = focalLength;
   m_pixelSize                = pixelSize;
   m_ecefPlatformPosition     = platformPosition;
   m_adjEcefPlatformPosition  = platformPosition;
   m_lensDistortion           = new ossimTangentialRadialLensDistortion();
   initAdjustableParameters();
   updateModel();

   try
   {
      // Method throws ossimException.
     // computeGsd();
   }
   catch (const ossimException& e)
   {
      ossimNotify(ossimNotifyLevel_WARN)
         << "ossimSpectrabotics Constructor caught Exception:\n"
         << e.what() << std::endl;
   }
   
   if (traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
      << "ossimSpectraboticsRedEdgeModel::ossimSpectrabotics DEBUG:" << endl;
#ifdef OSSIM_ID_ENABLED
      ossimNotify(ossimNotifyLevel_DEBUG)<< "OSSIM_ID:  " << OSSIM_ID << endl;
#endif
   }
}
Ejemplo n.º 25
0
rspfApplanixEcefModel::rspfApplanixEcefModel(const rspfDrect& imageRect,
                                               const rspfGpt& platformPosition,
                                               double roll,
                                               double pitch,
                                               double heading,
                                               const rspfDpt& /* principalPoint */, // in millimeters
                                               double focalLength, // in millimeters
                                               const rspfDpt& pixelSize) // in millimeters
{
   theImageClipRect = imageRect;
   theRefImgPt      = theImageClipRect.midPoint();
   theCompositeMatrix          = rspfMatrix4x4::createIdentity();
   theCompositeMatrixInverse   = rspfMatrix4x4::createIdentity();
   theRoll                     = roll;
   thePitch                    = pitch;
   theHeading                  = heading;
   theFocalLength              = focalLength;
   thePixelSize                = pixelSize;
   theEcefPlatformPosition     = platformPosition;
   theAdjEcefPlatformPosition  = platformPosition;
   theLensDistortion           = new rspfMeanRadialLensDistortion;
   initAdjustableParameters();
   updateModel();

   try
   {
      // Method throws rspfException.
      computeGsd();
   }
   catch (const rspfException& e)
   {
      rspfNotify(rspfNotifyLevel_WARN)
         << "rspfApplanixEcefModel Constructor caught Exception:\n"
         << e.what() << std::endl;
   }
   
   if (traceDebug())
   {
      rspfNotify(rspfNotifyLevel_DEBUG)
      << "rspfApplanixEcefModel::rspfApplanixEcefModel DEBUG:" << endl;
#ifdef RSPF_ID_ENABLED
      rspfNotify(rspfNotifyLevel_DEBUG)<< "RSPF_ID:  " << RSPF_ID << endl;
#endif
   }
}
Ejemplo n.º 26
0
void QgsFieldModel::setLayer( QgsVectorLayer *layer )
{
  if ( mLayer )
  {
    disconnect( mLayer, &QgsVectorLayer::updatedFields, this, &QgsFieldModel::updateModel );
    disconnect( mLayer, &QObject::destroyed, this, &QgsFieldModel::layerDeleted );
  }

  mLayer = layer;

  if ( mLayer )
  {
    connect( mLayer, &QgsVectorLayer::updatedFields, this, &QgsFieldModel::updateModel );
    connect( mLayer, &QObject::destroyed, this, &QgsFieldModel::layerDeleted );
  }

  updateModel();
}
Ejemplo n.º 27
0
//*************************************************************************************************
//! Collects common code among all parsers
//*************************************************************************************************
void rspfQuickbirdRpcModel::finishConstruction()
{
   theImageSize.line = theImageClipRect.height();
   theImageSize.samp = theImageClipRect.width();
   theRefImgPt.line = theImageClipRect.midPoint().y;
   theRefImgPt.samp = theImageClipRect.midPoint().x;
   theRefGndPt.lat = theLatOffset;
   theRefGndPt.lon = theLonOffset;
   theRefGndPt.hgt = theHgtOffset;

   //---
   // NOTE:  We must call "updateModel()" to set parameter used by base
   // rspfRpcModel prior to calling lineSampleHeightToWorld or all
   // the world points will be same.
   //---
   updateModel();

   rspfGpt v0, v1, v2, v3;
   lineSampleHeightToWorld(theImageClipRect.ul(), theHgtOffset, v0);
   lineSampleHeightToWorld(theImageClipRect.ur(), theHgtOffset, v1);
   lineSampleHeightToWorld(theImageClipRect.lr(), theHgtOffset, v2);
   lineSampleHeightToWorld(theImageClipRect.ll(), theHgtOffset, v3);

   theBoundGndPolygon = rspfPolygon (rspfDpt(v0), rspfDpt(v1), rspfDpt(v2), rspfDpt(v3));

   // Set the ground reference point using the model.
   lineSampleHeightToWorld(theRefImgPt, theHgtOffset, theRefGndPt);

   if( theGSD.hasNans() )
   {
      try
      {
         // This will set theGSD and theMeanGSD. Method throws rspfException.
         computeGsd();
      }
      catch (const rspfException& e)
      {
         rspfNotify(rspfNotifyLevel_WARN)
            << "rspfQuickbirdRpcModel::finishConstruction -- caught exception:\n"
            << e.what() << std::endl;
      }
   }
}
Ejemplo n.º 28
0
    void process() {
        updateModel(model_);

        if (model_->validate()) {
            // Do something with the data in the model: show it.
            bindString("submit-info",
                       Wt::WString::fromUTF8("Saved user data for ")
		       + model_->userData(), Wt::PlainText);
            // Udate the view: Delete any validation message in the view, etc.
            updateView(model_);
            // Set the focus on the first field in the form.
            Wt::WLineEdit *viewField =
                    resolve<Wt::WLineEdit*>(UserFormModel::FirstNameField);
            viewField->setFocus();
        } else {
            bindEmpty("submit-info"); // Delete the previous user data.
            updateView(model_);
        }
    }
Ejemplo n.º 29
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{    
    HomeWidget* homeWidget = new HomeWidget;
    SettingsWidget* settingsWidget = new SettingsWidget;
    LogsWidget* logsWidget = new LogsWidget;
    ScreenshotWidget* screenshotWidget = new ScreenshotWidget;
    BrowseTimeWidget* browseTimeWidget = new BrowseTimeWidget;
    WebsiteLockerWidget* websiteLockerWidget = new WebsiteLockerWidget;
    ProgramLockerWidget* programLockerWidget = new ProgramLockerWidget;

    currentPageLabel = new QLabel;
    versionLabel = new QLabel;
    versionLabel->setObjectName("versionLabel");

    connect(homeWidget,SIGNAL(updateModel()),settingsWidget,SLOT(updateUsersModel()));
    connect(homeWidget,SIGNAL(updateModel()),logsWidget,SLOT(updateUsersModel()));
    connect(homeWidget,SIGNAL(updateModel()),screenshotWidget,SLOT(updateUsersModel()));
    connect(homeWidget,SIGNAL(updateModel()),browseTimeWidget,SLOT(updateUsersModel()));
    connect(homeWidget,SIGNAL(updateModel()),websiteLockerWidget,SLOT(updateUsersModel()));
    connect(homeWidget,SIGNAL(updateModel()),programLockerWidget,SLOT(updateUsersModel()));

    connect(homeWidget,SIGNAL(registerd()),this,SLOT(readAvailableDays()));

    connect(this,SIGNAL(updateLogs()),logsWidget,SLOT(updateLog()));
    connect(this,SIGNAL(updateScreenshots()),screenshotWidget,SLOT(updateScreenshot()));
    connect(this,SIGNAL(updateStatistics()),settingsWidget,SLOT(updateStatistics()));

    stackedWidget = new SlidingStackedWidget(this);
    stackedWidget->addWidget(homeWidget);
    stackedWidget->addWidget(settingsWidget);
    stackedWidget->addWidget(logsWidget);
    stackedWidget->addWidget(screenshotWidget);
    stackedWidget->addWidget(browseTimeWidget);
    stackedWidget->addWidget(websiteLockerWidget);
    stackedWidget->addWidget(programLockerWidget);
    stackedWidget->setSpeed(500);

    this->setCentralWidget(stackedWidget);
    createDockWidget();
    readAvailableDays();
    createStatusBar();

    this->setWindowTitle("نظام حاجب");
    this->setWindowIcon((QIcon(":/images/hajibIcon.ico")));
    this->setFixedWidth(800);
    this->setFixedHeight(600);

    this->setCurrentWindow(0);
}
Ejemplo n.º 30
0
int Application::main(int argc,char *argv[])
  {
    // Process command line
    BOOM::CommandLine cmd(argc,argv,"");
    if(cmd.numArgs()!=7)
      throw string("\n\
refine-polya <seed-model> <genes.gff> <contigs.fasta>\n\
             <outfile> <margin> <iterations> <percentile>\n\
");
    BOOM::String seedModelFile=cmd.arg(0);
    BOOM::String genesFile=cmd.arg(1);
    BOOM::String contigsFile=cmd.arg(2);
    BOOM::String outFile=cmd.arg(3);
    margin=cmd.arg(4).asInt();
    int iterations=cmd.arg(5).asInt();
    float keepFraction=cmd.arg(6).asFloat();

    alphabet=DnaAlphabet::global;

    // Load GFF
    BOOM::GffReader gffReader(genesFile);
    BOOM::Map<BOOM::String,TranscriptList*> &transcripts=
      *gffReader.loadByContig();

    // Load poly-A model
    currentModel=SignalSensor::load(seedModelFile,gc);
    modelLength=currentModel->getContextWindowLength();

    // Process each contig to extract regions following genes
    processContigs(contigsFile,transcripts);

    // Iteratively process the margins to search for best hits to 
    // current model
    for(int i=0 ; i<iterations ; ++i)
      updateModel(i==iterations-1,keepFraction);

    // Output refined model
    currentModel->save(outFile);

    delete &transcripts;
    return 0;
  }