Пример #1
0
void NOR_component::PaintComp(QPainter &p){
    if(!ref.isNull())
    {
        QPoint lStart(ref.x()+20,ref.y());
        QPoint lEnd(ref.x()+20,ref.y()+80);
        QPoint centar(ref.x()+75,ref.y()+40);
        //unutrasnji luk
        p.drawArc(lStart.x()-20,lStart.y(),40,80,-90*16, 180*16);

        //produzeci zbog estetike
        p.drawLine(lStart.x(),lStart.y(),lStart.x()+20,lStart.y());
        p.drawLine(lStart.x(),lStart.y()+80,lStart.x()+20,lStart.y()+80);

        //spoljasnji krug
        p.drawArc(lStart.x()-10,lStart.y(),60,80,-90*16, 180*16);

        //pinovi
        p.drawLine(ref.x(),ref.y()+30,ref.x()+38,ref.y()+30);
        p.drawLine(ref.x(),ref.y()+50,ref.x()+38,ref.y()+50);
        p.drawLine(ref.x()+80,ref.y()+40,ref.x()+90,ref.y()+40);

        //kruzic za not
        p.drawEllipse(centar,5,5);
    }
}
void NAND_component::PaintComp(QPainter &p)
{
    if(!ref.isNull())
    {
        if(selektovan==true){
              p.setPen(Qt::red);
        }
        else
        {
           p.setPen(Qt::black);
        }
        QPoint lStart(ref.x()+20,ref.y());
        QPoint lEnd(ref.x()+20,ref.y()+80);
        QPoint centar(ref.x()+65,ref.y()+40);

        //komponenta
        p.drawLine(lStart.x(),lStart.y(),lEnd.x(),lEnd.y());
        p.drawArc(lStart.x()-40,lStart.y(),80,80,-90*16, 180*16);
        p.drawEllipse(centar,5,5);

        //pinovi
        p.drawLine(ref.x(),ref.y()+30,ref.x()+20,ref.y()+30);
        p.drawLine(ref.x(),ref.y()+50,ref.x()+20,ref.y()+50);
        p.drawLine(ref.x()+70,ref.y()+40,ref.x()+90,ref.y()+40);
    }
}
Пример #3
0
std::vector<std::string> 
IdSliceParser::parseList(const std::string& aStringSlice)
{
  namespace qi = boost::spirit::qi;
  namespace ascii = boost::spirit::ascii;
  
  std::string::const_iterator lBegin(aStringSlice.begin()), lEnd(aStringSlice.end());

  IdSliceListGrammar lGrammar;
  
  std::vector<std::string> lIds;
  bool success = qi::phrase_parse ( lBegin , lEnd , lGrammar , ascii::space , lIds );
  if ( success ) {

      // Throw if slice not fully parsed
      if ( lBegin != lEnd ) {
        std::ostringstream msg;
        msg << "SliceList parsing stopped at position " << std::distance(aStringSlice.begin(), lBegin) << " of string '" << aStringSlice << "'"; 

        throw SliceListParsingFailed(msg.str());
      }

  } else {
    // TODO: Should throw here
    return std::vector<std::string>();
  }
  
  // Special case for empty strings. They are parsed into a 1-element vector with a single empty string.
  // If so return an empty vector
  if (lIds.size() == 1 && lIds.front().empty())
    lIds.clear();
      
  return lIds;
}
Пример #4
0
// --------------------------------------------------------
std::vector<std::string>
IdSliceParser::parse(const std::string& aStringSlice) {
  
  namespace qi = boost::spirit::qi;
  namespace ascii = boost::spirit::ascii;
  
  std::string::const_iterator lBegin(aStringSlice.begin()), lEnd(aStringSlice.end());

  IdSliceGrammar lGrammar;
  
  std::vector<std::string> lIds;
  bool success = qi::phrase_parse ( lBegin , lEnd , lGrammar , ascii::space , lIds );
  if ( success ) {

      // Throw if slice not fully parsed
      if ( lBegin != lEnd ) {
        std::ostringstream msg;
        std::ostream_iterator<char> out_it (msg,"");
        msg << "Slice parsing stopped at position " << std::distance(aStringSlice.begin(), lBegin) << " of string '" << aStringSlice << "'";

        throw SliceParsingFailed(msg.str());
      }

  } else {
    // TODO: Should throw here
    return std::vector<std::string>();
  }
      
  return lIds;
}
Пример #5
0
void
TVisitor::booleanizeTos()
{
    castTos(VT_INT);
    Label lSetFalse(bc()), lEnd(bc());
    bc()->addInsn(BC_ILOAD0);
    bc()->addBranch(BC_IFICMPE, lSetFalse);
    bc()->addInsn(BC_ILOAD1);
    bc()->addBranch(BC_JA, lEnd);
    bc()->bind(lSetFalse);
    bc()->addInsn(BC_ILOAD0);
    bc()->bind(lEnd);
}
Пример #6
0
    Level & pickLevelByCriteria( LevelMetric levelMetric )
    {
        std::vector<Level>::iterator lIter( levels_.begin() );
        std::vector<Level>::iterator lEnd( levels_.end() );
        Level & result( *lIter );
        lIter++;
        if( lIter == lEnd ) return result;

        for( ; lIter != lEnd ; ++lIter )
        {
            if( levelMetric.isBetterLevel( result, *lIter ) )
            {
                result = *lIter;
            }
        }

        return result;
    }
Пример #7
0
void NAND_component::PaintComp(QPainter &p)
{
    if(!ref.isNull())
    {
        QPoint lStart(ref.x()+20,ref.y());
        QPoint lEnd(ref.x()+20,ref.y()+80);
        QPoint centar(ref.x()+65,ref.y()+40);

        //komponenta
        p.drawLine(lStart.x(),lStart.y(),lEnd.x(),lEnd.y());
        p.drawArc(lStart.x()-40,lStart.y(),80,80,-90*16, 180*16);
        p.drawEllipse(centar,5,5);

        //pinovi
        p.drawLine(ref.x(),ref.y()+30,ref.x()+20,ref.y()+30);
        p.drawLine(ref.x(),ref.y()+50,ref.x()+20,ref.y()+50);
        p.drawLine(ref.x()+70,ref.y()+40,ref.x()+90,ref.y()+40);
    }
}