Example #1
0
bool UniPAX::SBase::setAttribute(std::string& attribute, std::string& value, PersistenceManager& manager) {

	if (UniPAX::UIBase::setAttribute(attribute, value, manager))
		return true;

	if (boost::iequals(attribute,"sboTerm"))
	{
		setSboTerm(value);
		return true;
	}
	if (boost::iequals(attribute,"metaId"))
	{
		setMetaId(value);
		return true;
	}
	if (boost::iequals(attribute,"notes"))
	{
		setNotes(value);
		return true;
	}
	if (boost::iequals(attribute,"annotation"))
	{
		setAnnotation(value);
		return true;
	}
	return false;

}
Example #2
0
void Server_Card::resetState()
{
    counters.clear();
    setTapped(false);
    setAttacking(false);
    power = -1;
    toughness = -1;
    setAnnotation(QString());
    setDoesntUntap(false);
}
Example #3
0
AIDA::Dev::IDevCloud1D * iAIDA::AIDA_XMLStore::Cloud1DTranslator::createFromXML(AIDA::Dev::IDevHistogramFactory& factory)
{ 
  // read header 
  std::string title,options = emptyString;
  getObjectHeader(m_element,m_name,title,m_path,options); 
  int nMax = -1; 
  toValue(m_element.getAttributeValue("maxEntries"), nMax);


  // read annotation
  AnnotationData annoData; 
  getAnnotation(m_element,annoData); 

  // Now I can create the cloud 

  AIDA::Dev::IDevCloud1D * cloud  = 
    factory.createCloud1D( title, nMax,options );

  if (!cloud) { 
    std::cerr << " AIDA_XMLStore::Cloud1DTranslator - Cannot create Cloud1D " << std::endl; 
    return 0; 
  }

  //no need to  get statistics since for AIDA 

  // set annotation
  AIDA::IAnnotation & anno = cloud->annotation(); 
  setAnnotation(&anno,annoData); 

  // get the data 
 
  const DataXML::DataObject * dataElement = m_element.getChild("entries1d");
  if (!dataElement) return cloud; 
  //int i = 0; 
  //cout << " Number of elements " << dataElement->children().size() << endl; 
  for (std::vector<DataXML::DataObject>::const_iterator entryElement = dataElement->children().begin(); entryElement != dataElement->children().end(); ++entryElement) {  
    // need to check on the name to eliminate white spaces
    if (entryElement->name() == "entry1d") { 
      double xval,yval,zval = 0;    
      double weight = 1; 
      getCloudEntryData(*entryElement,1,xval,yval,zval,weight);
      // fill the cloud with the contents 
      //cout << " entry " << entryElement->name() << " " << i << " x " << xval << " w " << weight << endl; 
      cloud->fill(xval,weight); 
      //i++;
    }
  }

  //  std::cout << " cloud entries = " << cloud->entries() << endl; 

  return cloud; 
}
Example #4
0
QString Server_Card::setAttribute(CardAttribute attribute, const QString &avalue, bool allCards)
{
    switch (attribute) {
        case AttrTapped: {
            bool value = avalue == "1";
            if (!(!value && allCards && doesntUntap))
                setTapped(value);
            break;
        }
        case AttrAttacking: setAttacking(avalue == "1"); break;
        case AttrFaceDown: setFaceDown(avalue == "1"); break;
        case AttrColor: setColor(avalue); break;
        case AttrPT: setPT(avalue); return getPT();
        case AttrAnnotation: setAnnotation(avalue); break;
        case AttrDoesntUntap: setDoesntUntap(avalue == "1"); break;
    }
    return avalue;
}
Example #5
0
void CardItem::processCardInfo(const ServerInfo_Card &info)
{
    counters.clear();
    const int counterListSize = info.counter_list_size();
    for (int i = 0; i < counterListSize; ++i) {
        const ServerInfo_CardCounter &counterInfo = info.counter_list(i);
        counters.insert(counterInfo.id(), counterInfo.value());
    }
    
    setId(info.id());
    setName(QString::fromStdString(info.name()));
    setAttacking(info.attacking());
    setFaceDown(info.face_down());
    setPT(QString::fromStdString(info.pt()));
    setAnnotation(QString::fromStdString(info.annotation()));
    setColor(QString::fromStdString(info.color()));
    setTapped(info.tapped());
    setDestroyOnZoneChange(info.destroy_on_zone_change());
    setDoesntUntap(info.doesnt_untap());
}
Example #6
0
NodeConnectorView::NodeConnectorView(bool isOutput, QGraphicsItem* parent)
    : QGraphicsWidget(parent, 0)
    , mRect(NodeStyle::SocketSize)
    , mPen(NodeStyle::SocketPen)
    , mAnimation(this, "penWidth")
    , mTemporaryLink(nullptr)
    , mHoveredConnector(nullptr)
    , mAnnotation(new QGraphicsSimpleTextItem(this))
    , mIsOutput(isOutput)
{
    setBrushGradient(Qt::white, Qt::black);
    setPenWidth(NodeStyle::NodeSocketPenWidth);
    setAnnotation(QString());
    setCursor(Qt::PointingHandCursor);

    setAcceptHoverEvents(true);

    mAnimation.setDuration(250);
    mAnimation.setEasingCurve(QEasingCurve::InOutQuad);
    mAnimation.setStartValue(penWidth());

    connect(this, SIGNAL(draggingLinkDropped(QGraphicsWidget*, QGraphicsWidget*)),
        Controller::instancePtr(), SLOT(draggingLinkDropped(QGraphicsWidget*, QGraphicsWidget*)));
}
Example #7
0
AIDA::Dev::IDevHistogram1D * iAIDA::AIDA_XMLStore::Histo1DTranslator::createFromXML(AIDA::Dev::IDevHistogramFactory& factory)
{ 
  // read header 
  std::string title, options;
  getObjectHeader(m_element,m_name,title,m_path,options); 

  // read annotation
  AnnotationData annoData; 
  getAnnotation(m_element,annoData); 

  // read axis
  int numberOfBins = 0;
  double lowerEdge = 0;
  double upperEdge = 0;
  std::vector<double> edges; 
  getAxis(m_element,"x",numberOfBins,lowerEdge,upperEdge,edges); 


  // Now I can create the histogram 

  AIDA::Dev::IDevHistogram1D * h = 0; 
  if (edges.empty()) 
    // equal bins histograms
    h = factory.createHistogram1D( title, numberOfBins, lowerEdge, upperEdge );
  else   
    // variable bins histograms 
    h = factory.createHistogram1D( title, edges, emptyString );

  //read statistics (rms is needed since no binRMs is stored) 
  double mean,rms,skew = 0; 
  const DataXML::DataObject * statElement = m_element.getChild("statistics");
  if (statElement)
    getStatistics(*statElement,"x",mean,rms,skew); 
  

  // set annotation
  AIDA::IAnnotation & anno = h->annotation(); 
  setAnnotation(&anno,annoData); 

  // get the data 
 
  const DataXML::DataObject * dataElement = m_element.getChild("data1d");
  if (dataElement) { 
    for (std::vector<DataXML::DataObject>::const_iterator binElement = dataElement->children().begin(); binElement != dataElement->children().end(); ++binElement) {  
      if (binElement->name() == "bin1d") { 
	int xbin = -999;    // just a number which is not used 
	int entries = 0;
	// get info (not all is used..) 
	double height, error, wRms, wMean, error2, rms = 0; 
	getHisto1DBinData(*binElement,xbin,entries,height,error,wMean,wRms,error2, rms); 
	// fill the histogram with the bin contents 
	// (if binMean(centre) is not defined calculate from binWidth 
	if (wMean == 0 && xbin >=0 ) { 
	  wMean = h->binMean(xbin);  // if histo is empty should return 1/2 value
	}
	h->setBinContents(xbin,entries, height, error, wMean); 
      }
    }
  }

  h->setRms(rms); 

  return h; 
}