コード例 #1
0
ファイル: capacitor.cpp プロジェクト: jdpillon/simulide
Capacitor::Capacitor( QObject* parent, QString type, QString id )
    : Component( parent, type, id ), eCapacitor()
{
    m_ePin.resize(2);

    QString nodid = m_id;
    nodid.append(QString("lnod"));
    QPoint nodpos = QPoint(-16-8,0);
    Pin* pin = new Pin( 180, nodpos, nodid, 0, this);
    pin->setLength(12);
    pin->setPos(-16, 0 );
    m_ePin[0] = pin;

    nodid = m_id;
    nodid.append(QString("rnod"));
    nodpos = QPoint(16+8,0);
    pin = new Pin( 0, nodpos, nodid, 1, this);
    pin->setLength(12);
    pin->setPos( 16, 0 );
    m_ePin[1] = pin;

    label->setText( QString("") );
    label->setPos(-16,-24);

    /*const QFont sansFont("Helvetica [Cronyx]", 7);
    m_labelcurr = Circuit::self()->addSimpleText( id.toLatin1().data(), sansFont );
    m_labelcurr->setParentItem( this );
    m_labelcurr->setPos(-13, -5.5 );
    //m_labelcurr->rotate( 180-dir );
    m_labelcurr->setText( QString("%1").arg(m_resist) );*/
}
コード例 #2
0
ファイル: circuit.cpp プロジェクト: UIKit0/astran
void Circuit::calculateCellsPins(){
	int halfPinSize=currentRules->getRule(E1M1VI)+currentRules->getRule(W2VI)/2;
	int hGrid=currentRules->getIntValue(getHPitch()), vGrid=currentRules->getIntValue(getVPitch());
	for(map<string, CellNetlst>::iterator cellNetlsts_it=cellNetlsts.begin(); cellNetlsts_it!=cellNetlsts.end(); ++cellNetlsts_it){
		map<string, CLayout>::iterator layouts_it=layouts.find(cellNetlsts_it->first);
		if(layouts_it!=layouts.end()){
			layouts_it->second.getPins().clear();
			for(int x=hGrid/2; x<=layouts_it->second.getWidth(); x+=hGrid){
				for(int y=vGrid; y<=layouts_it->second.getHeight()-vGrid; y+=vGrid){
					string connectedNet="none";
					string aroundNet="none";
					bool fail=false;
					int finalX, finalY;
					for(map <layer_name , list<Box> >::iterator layers_it = layouts_it->second.layers.begin(); layers_it != layouts_it->second.layers.end(); layers_it++){
						if(layers_it->first==MET1){
							for(list <Box>::iterator layer_it = layers_it->second.begin(); layer_it != layers_it->second.end(); layer_it++){
								int dx=max(layer_it->getX1(),x-halfPinSize) - min(layer_it->getX2(),x+halfPinSize);
								int dy=max(layer_it->getY1(),y-halfPinSize) - min(layer_it->getY2(),y+halfPinSize);
								if(dx<=-(2*halfPinSize-1) && dy<=-(2*halfPinSize-1)){
									if(connectedNet=="none"){
										connectedNet=layer_it->getNet();
										finalX=x;
										finalY=y;
									}
									if(connectedNet!=layer_it->getNet() || (aroundNet!="none" && aroundNet!=connectedNet)) fail=true;									
								}else if((dx<0 && dy<0) || 
										 (dx<=0 && dy>=0 && dy<currentRules->getRule(S1M1M1)-1) ||
										 (dx>=0 && dy<=0 && dx<currentRules->getRule(S1M1M1)-1) ||
										 (dx>=0 && dy>=0 && sqrt(float(dx*dx+dy*dy))<currentRules->getRule(S1M1M1)-1)){
									if(aroundNet=="none") aroundNet=layer_it->getNet();
									if(aroundNet!=layer_it->getNet() || (connectedNet!="none" && aroundNet!=connectedNet)) fail=true;
								}								
							}
						}
					}
					Pin p;
					p.setPos(x,y);
					p.setLayer(MET1);
					if(!fail && connectedNet!="none" && connectedNet!=""){
						layouts_it->second.getPins().insert(make_pair(connectedNet,p));
						layouts_it->second.addLabel(connectedNet, Point(x, y));
					} else if(!(connectedNet=="none" && aroundNet=="none")){
						layouts_it->second.getPins().insert(make_pair("bl",p));
                        //						layouts_it->second.addLabel("bl", Point(x, y));
					}
				} 
			}
		}
	}		
}