Ejemplo n.º 1
0
// Get the current particle data from main form, register
// it using a local copy,  and prepare a list of particle
// types; this function is called each time the board is launched
void PolymerBoard::setData()
{
    // Get a list of particles that are currently rendered
    AggregateData *ad = mainForm->getAggregateData();

    propertyBox->setPropertyInformation(ad->propertiesInformation);

    // Get the current settings and register
    // it using a local particle data structure
    thisPd = mainForm->getParticleData();

    // Make entries in the combo box -- use only particle
    // types that are really needed; otherwise the list
    // gets too long
    if (atomCob) {
        atomCob->clear();
        for (int i=0;i<(*thisPd).numberOfParticleTypes;i++) {
            // Check: is this particle type really needed?
            for (int j=0;j<(*ad).numberOfParticles;j++) {
                if (typeCmp( (char *)&(*ad).particles[j].type, (char *)&(*thisPd).type[i])) {
                    // Add the item to the list
                    atomCob->addItem( QString( (char *)&(*thisPd).type[i]));
                    break;
                }
            }
        }
        atomCob->setMinimumSize( atomCob->sizeHint() );
    }


    // Sort the entries alphabetically, at least approximately
    for (int i=0;i<(*thisPd).numberOfParticleTypes;i++) {
        for (int j=0;j<atomCob->count()-1;j++) {
            if (QString::compare(atomCob->itemText(j), atomCob->itemText(j+1)) > 0) {
                tag tmp;
                typeCopy( qPrintable(atomCob->itemText(j+1)), (char *)&tmp );
                atomCob->insertItem(j, QString( (char *)&tmp));
                atomCob->removeItem(j+2);
            }
        }
    }

    // Set the first particle type as the current type
    if ((*ad).numberOfParticles > 0) {
        thisPolymerAtomIndex = 0;
        this->setPolymerAtom();
    }
    else {
        thisPolymerAtomIndex = -1;
    }
}
Ejemplo n.º 2
0
// Set the pore under consideration: adjust the toggle switch
void PoreBoard::setPore( void )
{
        tag thisPore;
        thisPoreIndex = -1;

        // Find out what combination of particles is set
        typeCopy( (const char *)poreCob->currentText(), (char *)&thisPore );

        for (int i=0;i<(*thisPd).numberOfParticleTypes;i++) {
                if (typeCmp( (char *)&(*thisPd).type[i], (char *)&thisPore ) == TRUE) {
                        // Found the correct entry
                        thisPoreIndex = i;

        		// Adjust the color board
			this->setColors();

			// Adjust the toggles
			bool thisShowParticle = (*thisPd).showParticle[thisPoreIndex];
			showPoreCb->setChecked( thisShowParticle);

			switch( thisShowParticle) {
                                case TRUE:
                                        if (thisPoreIndex >= 0) {
                                                modeL->setDisabled( FALSE );
                                                colorMode->setDisabled( FALSE );
                                        }
                                        else {
                                                modeL->setDisabled( TRUE );
                                                colorMode->setDisabled( TRUE );
                                        }
                                break;
                                case FALSE:
                                        sizeBox->setDisabled( TRUE );
                                        modeL->setDisabled( TRUE );
                                        colorMode->setDisabled( TRUE );
                                break;
                        }

			// Adjust the toggles
                        if (poreRenderStyle != PDOT && poreRenderStyle != PLINE && thisShowParticle) {
                                sizeBox->setDisabled( FALSE );
                        }
                        else {
                                sizeBox->setDisabled( TRUE );
                        }

			// Adjust size settings
			sizeBox->setParticle( thisPd, thisPoreIndex );

			colorCriterion colorCrit = (*thisPd).colorCrit[thisPoreIndex];
			switch (colorCrit) {
				case TYPE:
					this->buildLayout( TYPE );
					colorMode0->setChecked( TRUE );
					colorButton->setDisabled( FALSE );
				break;
				case POSITION:
					this->buildLayout( POSITION );
					colorMode1->setChecked( TRUE );
					colorButton->setDisabled( FALSE );
				break;
				case PROPERTY:
					this->buildLayout( PROPERTY );
					colorMode2->setChecked( TRUE );
					colorButton->setDisabled( FALSE );
				break;
				case COLORCODE:
					this->buildLayout( COLORCODE );
					colorMode3->setChecked( TRUE );
					colorButton->setDisabled( TRUE );
					colorLabel0->switchOff();
					colorLabel1->switchOff();
					colorLabel2->switchOff();
					colorLabel3->switchOff();
					colorLabel4->switchOff();
					colorLabel5->switchOff();
				break;
			}
	
			positionBox->setParticle( thisPd, thisPoreIndex );
			propertyBox->setParticle( thisPd, thisPoreIndex );
			codeBox->setParticle( thisPd, thisPoreIndex );
			typeColorNumberBox->setParticle( thisPd, thisPoreIndex );
			lineTypeBox->setParticle( thisPd, thisPoreIndex );
		}
	}
}
Ejemplo n.º 3
0
// Get the current particle data from main form, register
// it using a local copy,  and prepare a list of particle
// types; this function is called each time the board is launched
void PoreBoard::setData( void )
{
        aggregateData * ad = NULL;
	tag tmp;

        if (mainForm) {
                // Get the current switch settings and register
                // it using a local particle data structure
                thisPd = mainForm->getParticleData();

                // Get a list of particles that are currently rendered
                ad = mainForm->getAggregateData();

	        // Make entries in the combo box -- use only particle
	        // types that are really needed; otherwise the list
	        // gets too long
                int item = 0;
                if (poreCob) {
                        poreCob->clear();
                        for (int i=0;i<(*thisPd).numberOfParticleTypes;i++) {
                                // Check: is this particle type really needed?
                                bool needed = FALSE;
                                for (int j=0;j<(*ad).numberOfParticles;j++) {
                                        if (typeCmp( (char *)&(*ad).particles[j].type, (char *)&(*thisPd).type[i]) == TRUE) {
                                                // Yes it is needed: set a flag
                                                needed = TRUE;
                                                break;
                                        }
                                }

                                // Add the item to the list
                                if (needed) {
                                        poreCob->insertItem( QString( (char *)&(*thisPd).type[i]), item );
                                        item++;

                                }
                        }
                        poreCob->setMinimumSize( poreCob->sizeHint() );
                }
	}

        // Sort the entries alphabetically, at least approximately
        for (int i=0;i<(*thisPd).numberOfParticleTypes;i++) {
                for (int j=0;j<poreCob->count()-1;j++) {
                        if (QString::compare(poreCob->text(j), poreCob->text(j+1)) > 0) {
                                typeCopy( (const char *)poreCob->text(j+1), (char *)&tmp );
                                poreCob->insertItem( QString( (char *)&tmp), j);
                                poreCob->removeItem(j+2);
                        }
                }
        }

        // Set the first pore as the current pore
        if ((*ad).numberOfParticles > 0) {
                thisPoreIndex = 0;
                this->setPore();
        }
        else {
                thisPoreIndex = -1;
        }
}
Ejemplo n.º 4
0
// Set the spin under consideration: adjust the toggle switch
void SpinBoard::setSpin()
{
    tag thisSpin;
    thisSpinIndex = -1;

    // Find out what combination of particles is set
    typeCopy( qPrintable(spinCob->currentText()), (char *)&thisSpin );

    for (int i=0;i<(*thisPd).numberOfParticleTypes;i++) {
        if (typeCmp( (char *)&(*thisPd).type[i], (char *)&thisSpin )) {
            // Found the correct entry
            thisSpinIndex = i;

            // Adjust the color board
            this->setColors();

            // Adjust the toggles
            bool thisShowParticle = (*thisPd).showParticle[thisSpinIndex];
            showSpinCb->setChecked( thisShowParticle);

            if(thisShowParticle){
                modeL->setDisabled(thisSpinIndex >= 0 ? false : true );
                colorMode->setDisabled(thisSpinIndex >= 0 ? false : true );
            } else {
                sizeBox->setDisabled(true);
                modeL->setDisabled(true);
                colorMode->setDisabled(true);
            }

            // Adjust the toggles
            if (spinRenderStyle != SDOT && spinRenderStyle != SLINE && thisShowParticle) {
                sizeBox->setDisabled(false);
            } else {
                sizeBox->setDisabled(true);
            }

            // Adjust size settings
            sizeBox->setParticle( thisPd, thisSpinIndex );

            colorCriterion colorCrit = (*thisPd).colorCrit[thisSpinIndex];
            switch (colorCrit) {
            case TYPE:
                this->buildLayout( TYPE );
                colorMode0->setChecked(true);
                colorButton->setDisabled(false);
                break;
            case POSITION:
                this->buildLayout( POSITION );
                colorMode1->setChecked(true);
                colorButton->setDisabled(false);
                break;
            case PROPERTY:
                this->buildLayout( PROPERTY );
                colorMode2->setChecked(true);
                colorButton->setDisabled(false);
                break;
            case COLORCODE:
                this->buildLayout( COLORCODE );
                colorMode3->setChecked(true);
                colorButton->setDisabled(true);
                colorLabel0->switchOff();
                colorLabel1->switchOff();
                colorLabel2->switchOff();
                colorLabel3->switchOff();
                colorLabel4->switchOff();
                colorLabel5->switchOff();
                break;
            }

            positionBox->setParticle( thisPd, thisSpinIndex );
            propertyBox->setParticle( thisPd, thisSpinIndex );
            codeBox->setParticle( thisPd, thisSpinIndex );
            lineTypeBox->setParticle( thisPd, thisSpinIndex );
        }
    }
}