void dmz::MBRAPluginArchiveSupport::_init (Config &local) { RuntimeContext *context = get_plugin_runtime_context (); init_archive (local); _defaultAttrHandle = activate_default_object_attribute (ObjectCreateMask); _ecAttrHandle = activate_object_attribute ( config_to_string ("elimination-cost.name", local, "NA_Node_Elimination_Cost"), ObjectScalarMask); _typeSet = config_to_object_type_set ("object-type-list", local, context); if (_typeSet.get_count () == 0) { _typeSet.add_object_type ("na_node", context); } _toggleMapMessage = config_create_message ( "message.toggle-map.name", local, "ToggleMapMessage", context, &_log); _threatAttrHandle = config_to_named_handle ( "threat.name", local, "NA_Node_Threat", context); _vulAttrHandle = config_to_named_handle ( "vulnerability.name", local, "NA_Node_Vulnerability", context); _pcAttrHandle = config_to_named_handle ( "prevention-cost.name", local, "NA_Node_Prevention_Cost", context); _toggleHandle = config_to_named_handle ("toggle.name", local, "toggle", context); _toggleTargetHandle = config_to_named_handle ( "toggle-target.name", local, "dmzQtPluginMapProperties", context); }
void dmz::WeaponPluginGravityBullet::_init (Config &local) { RuntimeContext *context (get_plugin_runtime_context ()); _defaultHandle = activate_default_object_attribute ( ObjectCreateMask | ObjectDestroyMask); _typeSet = config_to_object_type_set ("munitions", local, context); _defaultSpeed = config_to_float64 ("speed.value", local, _defaultSpeed); }
void dmz::QtPluginGraph::_init (Config &local) { RuntimeContext *context (get_plugin_runtime_context ()); Definitions defs (context); _scene = new QGraphicsScene; _view = new QGraphicsView (_scene); _view->setAlignment (Qt::AlignLeft); // | Qt::AlignBottom); _typeSet = config_to_object_type_set ("set", local, context); if (_typeSet.get_count () == 0) { _log.info << "No object types specified. Using root type." << endl; _typeSet.add_object_type (defs.get_root_object_type ()); } activate_default_object_attribute (ObjectCreateMask | ObjectDestroyMask); Config attrList; if (local.lookup_all_config ("attribute", attrList)) { ConfigIterator it; Config attr; while (attrList.get_next_config (it, attr)) { const String Type = config_to_string ("type", attr).get_lower (); const String AttrName = config_to_string ("name", attr); if (AttrName) { if (Type == "link") { activate_object_attribute (AttrName, ObjectLinkMask | ObjectUnlinkMask); } else if (Type == "counter") { activate_object_attribute (AttrName, ObjectCounterMask); } else { _log.error << "Unknown attribute type: " << Type << endl; } } else { _log.error << "Attribute missing name." << endl; } } } _ascendingOrder = config_to_boolean ("ascending.value", local, _ascendingOrder); _maxCount = config_to_int32 ("start.value", local, _maxCount); _showPowerLaw = config_to_boolean ("power-law.show", local, _showPowerLaw); _powerStroke = config_to_qpen ("power-law.stroke", local, _powerStroke); _barStroke = config_to_qpen ("bar.stroke", local, _barStroke); _barFill = config_to_qbrush ("bar.fill", local, _barFill); _barWidth = config_to_int32 ("bar.width", local, _barWidth); _barHeight = config_to_int32 ("bar.height", local, _barHeight); _spaceWidth = config_to_int32 ("bar.space", local, _spaceWidth); _steps = config_to_int32 ("bar.steps", local, _steps); _yDivisions = config_to_int32 ("bar.divisions", local, _yDivisions); _yLabels = new QGraphicsTextItem*[_yDivisions]; for (Int32 ix = 0; ix < _yDivisions; ix++) { const Float32 Offset (-_barHeight * ((Float32)(ix + 1)) / (Float32)_yDivisions); _yLabels[ix] = new QGraphicsTextItem; _yLabels[ix]->setPlainText ( QString::number (100 * (ix +1) / _yDivisions) + QString ("%")); _yLabels[ix]->setZValue (1.0f); QRectF rect = _yLabels[ix]->boundingRect (); _yLabels[ix]->setPos (-5.0 - rect.width (), Offset - (rect.height () * 0.5f)); _scene->addItem (_yLabels[ix]); QGraphicsLineItem *line = new QGraphicsLineItem (-4.0, Offset, 0.0f, Offset); line->setZValue (1.0f); _scene->addItem (line); } }