Esempio n. 1
0
Demultiplexer::Demultiplexer( ICNDocument *icnDocument, bool newItem, const char *id )
	: Component( icnDocument, newItem, id ? id : "demultiplexer" )
{
	m_name = i18n("Demultiplexer");
	
	m_input = 0l;
	
	createProperty( "addressSize", Variant::Type::Int );
	property("addressSize")->setCaption( i18n("Address Size") );
	property("addressSize")->setMinValue(1);
	property("addressSize")->setMaxValue(8);
	property("addressSize")->setValue(1);
	
	// For backwards compatibility
	createProperty( "numInput", Variant::Type::Int );
	property("numInput")->setMinValue(-1);
	property("numInput")->setValue(-1);
	property("numInput")->setHidden(true);
}
LambertMaterial::LambertMaterial(const MString& name, const MString& type)
    : SurfaceMaterial(name, type)
{
    createProperty("color",             MaterialProperty::kRGB,   Color);
    createProperty("transparency",      MaterialProperty::kRGB,   Transparency);
    createProperty("ambientColor",      MaterialProperty::kRGB,   AmbientColor);
    createProperty("incandescence",     MaterialProperty::kRGB,   Incandescence);
    createProperty("diffuse",           MaterialProperty::kFloat, Diffuse);
    createProperty("translucence",      MaterialProperty::kFloat, Translucence);
    createProperty("translucenceDepth", MaterialProperty::kFloat, TranslucenceDepth);
    createProperty("translucenceFocus", MaterialProperty::kFloat, TranslucenceFocus);
    createProperty("hideSource",        MaterialProperty::kBool,  HideSource);
    createProperty("glowIntensity",     MaterialProperty::kFloat, GlowIntensity);

    Color->setDefault(MColor(0.5f, 0.5f, 0.5f));
    Diffuse->setDefault(0.8f);
    TranslucenceDepth->setDefault(0.5f);
    TranslucenceFocus->setDefault(0.5f);
}
Experimental3DVolume::Experimental3DVolume(Volume *volume)
    : m_alternativeImage(0), m_finiteDifferenceGradientEstimator(0), m_4DLinearRegressionGradientEstimator(0)
{
    createImage(volume->getVtkData());
    createVolumeRayCastFunctions();
    createVoxelShaders();
    createMappers();
    createProperty();
    createVolume();
}
Esempio n. 4
0
/// @todo remove the pro->text != NULL restriction?
/// @todo warn that you need to free() anything from a Property
void setTextProperty(TextProperty* pro, const char* text) {
	if (!pro)
		return;
	else if (!text) {
		deleteProperty(pro->text);
		pro->text = createProperty();
	} else {
		setLetters(pro->text, text);
	}
}
Esempio n. 5
0
VoltageRegulator::VoltageRegulator( ICNDocument* icnDocument, bool newItem, const QString& id )
    : Component( icnDocument, newItem, (!id.isEmpty()) ? id : "voltageregulator" )
{

    createProperty( "voltageout",  Variant::Type::Double );
    property("voltageout")->setCaption( i18n( "Voltage Out" ) );
    property("voltageout")->setMinValue( 2 );
    property("voltageout")->setMaxValue( maxVoltageOut );
    property("voltageout")->setValue( 5 );

}
Esempio n. 6
0
//BEGIN class ClockedFlipFlop
ClockedFlipFlop::ClockedFlipFlop( ICNDocument *icnDocument, bool newItem, const char * id )
	: Component( icnDocument, newItem, id )
{
	createProperty( "trig", Variant::Type::Select );
	property("trig")->setCaption( i18n("Trigger Edge") );
	QStringMap allowed;
	allowed["Rising"] = i18n("Rising");
	allowed["Falling"] = i18n("Falling");
	property("trig")->setAllowed( allowed );
	property("trig")->setValue("Rising");
	m_edgeTrigger = Rising;
}
Esempio n. 7
0
ResistorDIP::ResistorDIP( ICNDocument *icnDocument, bool newItem, const char *id )
	: Component( icnDocument, newItem, id ? id : "multiplexer" )
{
	m_name = i18n("Resistor DIP");
	
	m_resistorCount = 0;
	for ( int i=0; i<maxCount; ++i )
		m_resistance[i] = 0l;
	
	createProperty( "resistance", Variant::Type::Double );
	property("resistance")->setCaption( i18n("Resistance") );
	property("resistance")->setUnit( QChar(0x3a9) );
	property("resistance")->setValue(1e4);
	property("resistance")->setMinValue(1e-6);
	
	createProperty( "count", Variant::Type::Int );
	property("count")->setCaption( i18n("Count") );
	property("count")->setMinValue(2);
	property("count")->setMaxValue(maxCount);
	property("count")->setValue(8);
}
Esempio n. 8
0
Delay::Delay( ICNDocument *icnDocument, bool newItem, const char *id )
	: FlowPart( icnDocument, newItem, id ? id : "delay" )
{
	m_name = i18n("Delay");
	initProcessSymbol();
	createStdInput();
	createStdOutput();
	
	createProperty( "delay_length", Variant::Type::Double );
	property("delay_length")->setCaption( i18n("Pause Length") );
	property("delay_length")->setUnit("sec");
	property("delay_length")->setValue(1.0);
}
Esempio n. 9
0
RAM::RAM(ICNDocument *icnDocument, bool newItem, const char *id)
        : DIPComponent(icnDocument, newItem, id ? id : "ram") {
    m_name = i18n("RAM");

    createProperty("wordSize", Variant::Type::Int);
    property("wordSize")->setCaption(i18n("Word Size"));
    property("wordSize")->setMinValue(1);
    property("wordSize")->setMaxValue(64);
    property("wordSize")->setValue(2);

    createProperty("addressSize", Variant::Type::Int);
    property("addressSize")->setCaption(i18n("Address Size"));
    property("addressSize")->setMinValue(1);
    property("addressSize")->setMaxValue(24);
    property("addressSize")->setValue(4);

    m_data = createProperty("data", Variant::Type::Raw)->value().asBitArray();    

    m_pWE.setCallback(this, (CallbackPtr)(&RAM::inStateChanged));
    m_pOE.setCallback(this, (CallbackPtr)(&RAM::inStateChanged));
    m_pCS.setCallback(this, (CallbackPtr)(&RAM::inStateChanged));
}
moveit_rviz_plugin::PropertyHolder::PropertyHolder(
      rviz::Property *parent_property,
      const PropertyHolder* clone)
  : name_(clone->name_)
  , type_(clone->type_)
  , flags_(clone->flags_)
  , property_(NULL)
{
logInform(" construct PropertyHolder %s at %d (clone)",name_.c_str(), __LINE__);
  createProperty(parent_property,
                 clone->property_->getDescription().toStdString(),
                 clone->property_->getValue());
}
Esempio n. 11
0
LED::LED( ICNDocument *icnDocument, bool newItem, const char *id )
	: ECDiode( icnDocument, newItem, id ? id : "led" )
{
	m_bDynamicContent = true;
	m_name = i18n("LED");
	setSize( -8, -16, 24, 24, true );
	avg_brightness = 255;
	lastUpdatePeriod = 0.;
	r=g=b=0;
	last_brightness = 255;
	
	createProperty( "0-color", Variant::Type::Color );
	property("0-color")->setCaption( i18n("Color") );
	property("0-color")->setColorScheme( ColorCombo::LED );
}
moveit_rviz_plugin::PropertyHolder::PropertyHolder(
      rviz::Property *parent_property,
      const std::string& name,
      const std::string& descr,
      PropertyType type,
      QVariant value,
      unsigned int flags)
  : name_(name)
  , type_(type)
  , flags_(flags)
  , property_(NULL)
{
logInform(" construct PropertyHolder %s at %d (full)",name_.c_str(), __LINE__);
  createProperty(parent_property, descr, value);
}
Esempio n. 13
0
DPText::DPText( ItemDocument *itemDocument, bool newItem, const char *id )
	: DrawPart( itemDocument, newItem, id ? id : "canvas_text" )
{
	m_rectangularOverlay = new RectangularOverlay(this);
	m_name = i18n("Text");
	
	createProperty( "text", Variant::Type::RichText );
	property("text")->setValue( i18n("Text") );
	
	createProperty( "background", Variant::Type::Bool );
	property("background")->setValue(false);
	property("background")->setCaption( i18n("Display Background") );
	property("background")->setAdvanced(true);
	
	createProperty( "background-color", Variant::Type::Color );
	property("background-color")->setValue(Qt::white);
	property("background-color")->setCaption( i18n("Background Color") );
	property("background-color")->setAdvanced(true);
	
	createProperty( "frame-color", Variant::Type::Color );
	property("frame-color")->setValue(Qt::black);
	property("frame-color")->setCaption( i18n("Frame Color") );
	property("frame-color")->setAdvanced(true);
}
Esempio n. 14
0
BusSplitter::BusSplitter( ICNDocument *icnDocument, bool newItem, const char *id )
	: Component( icnDocument, newItem, id ? id : "Bus" )
{
	m_name = i18n("Bus Splitter");

	m_busSize = 0;	
	init1PinLeft();
	m_pInNode = m_pNNode[0];
	
	createProperty( "size", Variant::Type::Int );
	property("size")->setCaption( i18n("Size") );
	property("size")->setMinValue(1);
	property("size")->setMaxValue(MAX_BUS_SIZE);
	property("size")->setValue(8);
}
Esempio n. 15
0
TestPin::TestPin( ICNDocument *icnDocument, bool newItem, const char *id )
	: FlowPart( icnDocument, newItem, id ? id : "testpin" )
{
	m_name = i18n("Test Pin State");
	initDecisionSymbol();
	createStdInput();
	createStdOutput();
	createAltOutput();
	
	createProperty( "pin", Variant::Type::Pin );
	property("pin")->setCaption( i18n("Pin") );
	property("pin")->setValue("RA0");
	
	addDisplayText( "output_false", QRect( offsetX()+width(), 2, 40, 20 ), "Low" );
	addDisplayText( "output_true", QRect( 0, offsetY()+height(), 50, 20 ), "High" );
}
Esempio n. 16
0
//BEGIN class DependentSource
DependentSource::DependentSource(ICNDocument *icnDocument, bool newItem, const char *id)
		: SimpleComponent(icnDocument, newItem, id) {
	setSize(-16, -16, 32, 32);

	init2PinLeft();
	init2PinRight();

	m_pNNode[1]->setLength(13);
	m_pPNode[1]->setLength(13);

	createProperty("gain", Variant::Type::Double);
	property("gain")->setCaption(i18n("Gain"));
	property("gain")->setValue(1.0);

	addDisplayText("gain", QRect(-16, -32, 32, 16), "");
}
Esempio n. 17
0
Interrupt::Interrupt( ICNDocument *icnDocument, bool newItem, const char *id )
	: FlowContainer( icnDocument, newItem, id ? id : "interrupt" )
{
	m_name = i18n("Interrupt");
	
	QStringList interruptTypes;
	interruptTypes.append("changed");
	interruptTypes.append("external");
	interruptTypes.append("timer");
	interruptTypes.append("trigger");

	createProperty( "interrupt", Variant::Type::Select );
	property("interrupt")->setAllowed(interruptTypes);
	property("interrupt")->setCaption( i18n("Interrupt") );
	property("interrupt")->setValue("trigger");
}
Esempio n. 18
0
ECLogicInput::ECLogicInput( ICNDocument *icnDocument, bool newItem, const char *id )
	: Component( icnDocument, newItem, (id) ? id : "logic_input" )
{
	m_name = i18n("Logic Input");
	setSize( -8, -8, 16, 16 );
	
	b_state = false;
	addButton( "button", QRect( -24, -8, 16, 16 ), "", true );
	
	createProperty( "useToggle", Variant::Type::Bool );
	property("useToggle")->setCaption( i18n("Use Toggle") );
	property("useToggle")->setValue(true);

	init1PinRight();
	
	m_pOut = createLogicOut( m_pPNode[0], false );
}
Esempio n. 19
0
AttributeDialog::AttributeDialog(QWidget* parent, FPackage* fPackage) :
	QDialog(parent)
{
	setupUi(this);
	
	Q_ASSERT(fPackage);
	m_fPackage = fPackage;
	
	m_managerFolder = new QtGroupPropertyManager(this);
	m_managerAttribute = new QtStringPropertyManager(this);
	m_lineEditFactory = new QtLineEditFactory(this);
	
	propertyEditor->setFactoryForManager(m_managerAttribute, m_lineEditFactory);
	
    createProperty(fPackage->getAttributeStorage()->getModel()->invisibleRootItem());
	
	load();
}
Esempio n. 20
0
void PropertyBrowser::updateCustomProperties()
{
    mUpdating = true;

    qDeleteAll(mNameToProperty);
    mNameToProperty.clear();

    QMapIterator<QString,QString> it(mObject->properties());
    while (it.hasNext()) {
        it.next();
        QtVariantProperty *property = createProperty(CustomProperty,
                                                     QVariant::String,
                                                     it.key(),
                                                     mCustomPropertiesGroup);
        property->setValue(it.value());
    }

    mUpdating = false;
}
Esempio n. 21
0
DPArrow::DPArrow( ItemDocument *itemDocument, bool newItem, const char *id )
	: DPLine( itemDocument, newItem, id ? id : "arrow" )
{
	m_name = i18n("Arrow");
	
	// We don't want to use the square cap style as it screws up drawing our arrow head
	QStringList allowed = property("cap-style")->allowed();
	allowed.remove( DrawPart::penCapStyleToName( Qt::SquareCap ) );
	property("cap-style")->setAllowed(allowed);
	
	m_headAngle = 20.0;
	Variant * v = createProperty( "HeadAngle", Variant::Type::Double );
	v->setAdvanced( true );
	v->setCaption( i18n("Head angle") );
	v->setMinValue( 10.0 );
	v->setMaxValue( 60.0 );
	v->setUnit( QChar(0xb0) );
	v->setValue( m_headAngle );
}
Esempio n. 22
0
DPImage::DPImage( ItemDocument *itemDocument, bool newItem, const char *id )
	: DrawPart( itemDocument, newItem, id ? id : "image" )
{
	m_bSettingsChanged = false;
	m_bResizeToImage = newItem;
	m_imageScaling = ImageScaleThread::Unscaled;
	
	m_pRectangularOverlay = new RectangularOverlay( this );
	
	m_pCheckImageScalingTimer = new QTimer( this );
	connect( m_pCheckImageScalingTimer, SIGNAL(timeout()), SLOT(checkImageScaling()) );
	m_pCheckImageScalingTimer->start( 100 );
	
	m_name = i18n("Image");
	
	Variant * v = createProperty( "image", Variant::Type::FileName );
	v->setCaption( i18n("Image File") );
	dataChanged();
}
Esempio n. 23
0
Capacitor::Capacitor( ICNDocument *icnDocument, bool newItem, const char *id )
	: Component( icnDocument, newItem, id ? id : "capacitor" )
{
	m_name = i18n("Capacitor");
	setSize( -8, -8, 16, 16 );
	
	init1PinLeft();
	init1PinRight();
	
	m_capacitance = createCapacitance( m_pNNode[0], m_pPNode[0], 0.001 );
	
	createProperty( "Capacitance", Variant::Type::Double );
	property("Capacitance")->setCaption( i18n("Capacitance") );
	property("Capacitance")->setUnit("F");
	property("Capacitance")->setMinValue(1e-12);
	property("Capacitance")->setMaxValue(1e12);
	property("Capacitance")->setValue(1e-3);
	
	addDisplayText( "capacitance", QRect( -8, -24, 16, 16 ), "", false );
}
void QDeclarative1OpenMetaObject::setValue(const QByteArray &name, const QVariant &val)
{
    QHash<QByteArray, int>::ConstIterator iter = d->type->d->names.find(name);

    int id = -1;
    if (iter == d->type->d->names.end()) {
        id = createProperty(name.constData(), "") - d->type->d->propertyOffset;
    } else {
        id = *iter;
    }

    if (id >= 0) {
        QVariant &dataVal = d->getData(id);
        if (dataVal == val)
            return;

        dataVal = val;
        activate(d->object, id + d->type->d->signalOffset, 0);
    }
}
Esempio n. 25
0
ECJKFlipFlop::ECJKFlipFlop( ICNDocument *icnDocument, bool newItem, const char *id )
	: ClockedFlipFlop( icnDocument, newItem, id ? id : "jk_flipflop" )
{
	m_name = i18n("JK-Type Flip-Flop");
	
	setSize( -32, -32, 64, 64 );
	init3PinLeft( -16, 0, 16 );
	init2PinRight( -16, 16 );
	initSymbolFromTrigger();
	
	m_bPrevClock = false;
	
	createProperty( "trig", Variant::Type::Select );
	property("trig")->setCaption( i18n("Trigger Edge") );
	QStringMap allowed;
	allowed["Rising"] = i18n("Rising");
	allowed["Falling"] = i18n("Falling");
	property("trig")->setAllowed( allowed );
	property("trig")->setValue("Rising");
	m_edgeTrigger = Rising;
	initSymbolFromTrigger();
	
	m_pJ = createLogicIn( m_pNNode[0] );
	m_pClock = createLogicIn( m_pNNode[1] );
	m_pK = createLogicIn( m_pNNode[2] );
	
	m_pQ = createLogicOut( m_pPNode[0], false );
	m_pQBar = createLogicOut( m_pPNode[1], false );

	setp = createLogicIn( createPin( 0, -40, 90, "set" ) );
	rstp = createLogicIn( createPin( 0, 40, 270, "rst" ) );
	
	addDisplayText( "Q",	QRect( 12,	-24,	20, 16 ), "Q" );
	addDisplayText( "Q'",	QRect( 12,	8,		20, 16 ), "Q'" );
		
	m_pClock->setCallback( this, static_cast<CallbackPtr>(&ECJKFlipFlop::clockChanged) );
	setp->setCallback( this, static_cast<CallbackPtr>(&ECJKFlipFlop::asyncChanged) );
	rstp->setCallback( this, static_cast<CallbackPtr>(&ECJKFlipFlop::asyncChanged) );
	
	inStateChanged(false);
}
Esempio n. 26
0
Capacitor::Capacitor(ICNDocument *icnDocument, bool newItem, const char *id)
		: SimpleComponent(icnDocument, newItem, id ? id : "capacitor"),
		m_capacitance(0.001, LINEAR_UPDATE_PERIOD) {
	m_name = i18n("Capacitor");
	setSize(-8, -8, 16, 16);

	init1PinLeft();
	init1PinRight();

;
	setup2pinElement(m_capacitance, m_pNNode[0]->pin(), m_pPNode[0]->pin());

	createProperty("Capacitance", Variant::Type::Double);
	property("Capacitance")->setCaption(i18n("Capacitance"));
	property("Capacitance")->setUnit("F");
	property("Capacitance")->setMinValue(1e-12);
	property("Capacitance")->setMaxValue(1e12);
	property("Capacitance")->setValue(1e-3);

	addDisplayText("capacitance", QRect(-8, -24, 16, 16), "", false);
}
Esempio n. 27
0
ECCell::ECCell(ICNDocument *icnDocument, bool newItem, const char *id)
        : SimpleComponent(icnDocument, newItem, id ? id : "cell") {
    m_name = i18n("Battery");
    setSize(-8, -8, 16, 16);

    init1PinLeft();
    init1PinRight();

    m_pNNode[0]->pin().setGroundType(Pin::gt_medium);

    setup2pinElement(m_voltageSource, m_pNNode[0]->pin(), m_pPNode[0]->pin());

    createProperty("voltage", Variant::Type::Double);
    property("voltage")->setUnit("V");
    property("voltage")->setCaption(i18n("Voltage"));
    property("voltage")->setMinValue(-1e12);
    property("voltage")->setMaxValue(1e12);
    property("voltage")->setValue(5.0);

    addDisplayText("voltage", QRect(-16, -24, 32, 16), "");
}
Esempio n. 28
0
void ObjectTypesEditor::updateProperties()
{
    const auto selectionModel = mUi->objectTypesTable->selectionModel();
    const auto selectedRows = selectionModel->selectedRows();

    AggregatedProperties aggregatedProperties;

    for (const QModelIndex &index : selectedRows) {
        ObjectType objectType = mObjectTypesModel->objectTypeAt(index);
        aggregatedProperties.aggregate(objectType.defaultProperties);
    }

    mAddPropertyAction->setEnabled(!selectedRows.isEmpty());

    mProperties = aggregatedProperties;

    mUpdating = true;
    mVariantManager->clear();
    mNameToProperty.clear();

    QMapIterator<QString, AggregatedPropertyData> it(aggregatedProperties);
    while (it.hasNext()) {
        it.next();

        const QString &name = it.key();
        const AggregatedPropertyData &data = it.value();

        QtVariantProperty *property = createProperty(data.value().userType(), name);
        property->setValue(data.value());

        bool everywhere = data.presenceCount() == selectedRows.size();
        bool consistent = everywhere && data.valueConsistent();
        if (!everywhere)
            property->setNameColor(Qt::gray);
        if (!consistent)
            property->setValueColor(Qt::gray);
    }

    mUpdating = false;
}
Esempio n. 29
0
void AttributeDialog::createProperty(const QStandardItem* root, QtProperty* propertyParent)
{
	int n = root->rowCount();
	for (int i = 0; i < n; i++)
	{
		QStandardItem* item = root->child(i);
		
        switch (item->type())
		{
        case TYPE_FOLDER:
			{
				QtProperty* propertyFolder = m_managerFolder->addProperty(item->text());
				
				if (propertyParent)
					propertyParent->addSubProperty(propertyFolder);
				else
					propertyEditor->addProperty(propertyFolder);
				
				createProperty(item, propertyFolder);
			}
			break;
        case TYPE_ATTRIBUTE:
			{
                SeAttribute* attribute = (SeAttribute*)item;
				if (attribute)
				{
					QtProperty* propertyAttribute = m_managerAttribute->addProperty(item->text());
					
					if (propertyParent)
						propertyParent->addSubProperty(propertyAttribute);
					else
						propertyEditor->addProperty(propertyAttribute);
					
                    m_attributes[attribute->getId()] = propertyAttribute;
				}
			}
			break;		
		}
	}	
}
Esempio n. 30
0
MatrixDisplayDriver::MatrixDisplayDriver(ICNDocument *icnDocument, bool newItem, const char *id)
        : DIPComponent(icnDocument, newItem, id ? id : "Matrix Display Driver") {
    m_name = i18n("Matrix Display Driver");

    m_Col = 4;

// FIXME: functionality not implemented! =(
    createProperty("diode-configuration", Variant::Type::Select);
    property("diode-configuration")->setCaption(i18n("Configuration"));
    QStringMap allowed;
    allowed["Row Cathode"] = i18n("Row Cathode");
    allowed["Column Cathode"] = i18n("Column Cathode");
    property("diode-configuration")->setAllowed(allowed);
    property("diode-configuration")->setValue("Row Cathode");
    property("diode-configuration")->setAdvanced(true);

    QStringList pins = QStringList::split(',', "D0,D1,D2,D3,D4,D5,D6,D7,,,,,,C4,C3,C2,C1,C0,,R0,R1,R2,R3,R4,R5,R6", true);
    initDIPSymbol(pins, 64);
    initDIP(pins);

    m_pValueLogic.resize(8);
    for(unsigned i = 0; i < 8; ++i)
        setup1pinElement(m_pValueLogic[i], ecNodeWithID("D" + QString::number(i))->pin());

    m_pRowLogic.resize(7);
    for(unsigned i = 0; i < 7; ++i) {
        setup1pinElement(m_pRowLogic[i], ecNodeWithID("R" + QString::number(i))->pin());
        m_pRowLogic[i].setOutputLowConductance(1.0);
        m_pRowLogic[i].setOutputHighVoltage(5.0);
    }

    m_pColLogic.resize(5);
    for(unsigned i = 0; i < 5; ++i) {
        setup1pinElement(m_pColLogic[i], ecNodeWithID("C" + QString::number(i))->pin());
        m_pColLogic[i].setOutputHighVoltage(5.0);
    }
}