void
dmz::RenderModuleCoreOSGBasic::_init (Config &local, Config &global) {

   const String UpStr = config_to_string ("osg-up.value", local, "y").to_lower ();
   if (UpStr == "y") { set_osg_y_up (); _log.info << "OSG render Y is up." << endl; }
   else if (UpStr == "z") { set_osg_z_up (); _log.info << "OSG render Z is up" << endl; }
   else {

      _log.warn << "Unknown osg up type: " << UpStr << ". Defaulting to Y up." << endl;
   }

   Config pluginList;

   if (local.lookup_all_config ("plugin-list.plugin", pluginList)) {

      RuntimeContext *context (get_plugin_runtime_context ());

      if (dmz::load_plugins (context, pluginList, local, global, _extensions, &_log)) {

         _extensions.discover_plugins ();
         _extensions.discover_external_plugin (this);
      }
   }

   osgDB::Registry *reg = osgDB::Registry::instance ();
   Config pathList;

   if (reg && local.lookup_all_config ("loader.path", pathList)) {

      osgDB::FilePathList &fpl = reg->getLibraryFilePathList ();

      ConfigIterator it;
      Config path;

      while (pathList.get_next_config (it, path)) {

         String pathStr = config_to_string ("value", path);

         if (get_absolute_path (pathStr, pathStr)) {

            fpl.push_back (pathStr.get_buffer ());
         }
      }

   }

   if(reg) {

      reg->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES);
   }

   _defaultHandle = activate_default_object_attribute (
      ObjectDestroyMask | ObjectPositionMask | ObjectScaleMask | ObjectOrientationMask);

   _bvrHandle = config_to_named_handle (
      "bounding-volume-radius-attribute.name",
      local,
      ObjectAttributeBoundingVolumeRaidusName,
      get_plugin_runtime_context ());
}
// ObjectPluginHighlight Interface
void
dmz::ObjectPluginHighlight::_init (Config &local) {

   _highlightAttr = activate_object_attribute (
      ObjectAttributeHighlightName,
      ObjectFlagMask);

   _convert.set_handle (
      config_to_string ("data-convert-handle.name", local, "handle"),
      get_plugin_runtime_context ());

   _mouseMoveMsg = config_create_message (
      "mouse-move-message.name",
      local,
      "Mouse_Move_Message",
      get_plugin_runtime_context ());

   _deactivateMsg = config_create_message (
      "deactivate-message.name",
      local,
      "Object_Highlight_Deactivate_Message",
      get_plugin_runtime_context ());

   subscribe_to_message (_mouseMoveMsg);
   subscribe_to_message (_deactivateMsg);
}
void
dmz::RenderModuleCoreOgreBasic::_init (Config &local, Config &global) {

   Definitions defs (get_plugin_runtime_context (), &_log);

   _defaultAttributeHandle = defs.create_named_handle (ObjectAttributeDefaultName);

   Config pluginList;

   if (local.lookup_all_config ("plugins.plugin", pluginList)) {

      RuntimeContext *context (get_plugin_runtime_context ());
      dmz::load_plugins (context, pluginList, local, global, _extensions, &_log);
   }
   else {

   }

   Config ogreLocal;

   if (local.lookup_config ("ogre", ogreLocal)) {

      try {

         _init_root (ogreLocal);
         _init_resources (ogreLocal);
         _init_render_system (ogreLocal);
         _init_render_windows ();

         Ogre::ResourceGroupManager::getSingleton ().initialiseAllResourceGroups ();

         _init_scene_manager (ogreLocal);
      }
      catch (Ogre::Exception e) {

         if (_root) {

            if (_sceneManager) {

               _root->destroySceneManager (_sceneManager);
               _sceneManager = 0;
            }

            delete _root;
            _root = 0;
         }

         _log.error << e.getFullDescription ().c_str () << endl;
      }
   }
   else {

   }

   _extensions.discover_plugins ();
}
Esempio n. 4
0
dmz::QtPluginAppUpdater::QtPluginAppUpdater (
    const PluginInfo &Info,
    Config &local,
    Config &global) :
    QObject (0),
    Plugin (Info),
    _log (Info),
    _exit (get_plugin_runtime_context ()),
    _version (global),
    _updateVersion (),
    _mainWindowModule (0),
    _mainWindowModuleName (),
    _netManager (0),
    _updateDialog (0),
    _releaseChannel ("stable"),
    _updateUrl (),
    _downloadUrl (),
    _downloadFile (),
    _downloadReply (0),
    _downloadToTemp (True),
    _forceUpdate (False),
    _updateFlag (True),
    _autoFinishCount (15),
    _updateMessageName ("AppUpdaterUpdateMessage"),
    _channelMessageName ("AppUpdaterChannelMessage") {

    _init (local);
}
Esempio n. 5
0
void
dmz::NetExtPacketCodecObjectNative::_init (Config &local) {

   RuntimeContext *context (get_plugin_runtime_context ());
   Definitions defs (context, &_log);

   _defaultHandle = defs.create_named_handle (ObjectAttributeDefaultName);
   _lnvHandle = defs.create_named_handle (ObjectAttributeLastNetworkValueName);

   Config adapters;
   ObjectAttributeAdapter *current (0);

   if (local.lookup_all_config ("adapter", adapters)) {

      ConfigIterator it;
      Config data;

      while (adapters.get_next_config (it, data)) {

         ObjectAttributeAdapter *next (create_object_adapter (data, context, _log));

         if (next) {

            if (current) { current->next = next; current = next; }
            else { _adapterList = current = next; }
         }
      }
   }
}
Esempio n. 6
0
void
dmz::QtPluginIconPalletTool::_init (Config &local) {

   RuntimeContext *context (get_plugin_runtime_context ());

   _showMsg = config_create_message (
      "show.name",
      local,
      "DMZ_Show_Icon_Pallet_Tool",
      context);

   subscribe_to_message (_showMsg);

   _useSession = config_to_boolean ("use-session.value", local, _useSession);

   if (_useSession && context) {

      Config session (get_session_config (get_plugin_name (), context));

      QByteArray geometry (config_to_qbytearray ("geometry", session, saveGeometry ()));
      restoreGeometry (geometry);

      if (config_to_boolean ("window.visible", session, False)) { show (); }
   }

   _ui.iconView->setModel (&_model);

   _add_type (Definitions (context).get_root_object_type ());
}
Esempio n. 7
0
dmz::RenderExtViewerOSG::RenderExtViewerOSG (
      const PluginInfo &Info,
      Config &local) :
      Plugin (Info),
      TimeSlice (Info),
      _log (Info),
      _title ("DMZ Application"),
      _core (0),
      _channels (0),
      _viewerName (RenderMainPortalName),
      _eventHandler (0),
      _viewer (0) {

   _viewer = new osgViewer::Viewer;
   _viewer->setThreadingModel (osgViewer::Viewer::SingleThreaded);
   _eventHandler = new RenderEventHandlerOSG (get_plugin_runtime_context (), local);

   osg::ref_ptr<osgViewer::StatsHandler> stats = new osgViewer::StatsHandler;
   stats->setKeyEventTogglesOnScreenStats (osgGA::GUIEventAdapter::KEY_F1);
   stats->setKeyEventPrintsOutStats (osgGA::GUIEventAdapter::KEY_F2);
   _viewer->addEventHandler (stats.get ());
   _viewer->addEventHandler (_eventHandler.get ());
   _viewer->setKeyEventSetsDone (0);
   _viewer->setQuitEventSetsDone (true);

   _init (local);
}
Esempio n. 8
0
dmz::AudioModuleFMOD::InstanceStruct *
dmz::AudioModuleFMOD::_get_new_instance (SoundStruct *soundData) {

   InstanceStruct *result (0);

   if (soundData) {

   // Check for existing list of stored instances
      if (_instanceRecycle) {

         result = _instanceRecycle;

         _instanceRecycle = _instanceRecycle->next;

         result->next = 0;

         result->data = soundData;

         soundData->ref ();
      }
      else { //Create new instance

         result = new InstanceStruct (
            soundData->FileName,
            (*this),
            soundData,
            get_plugin_runtime_context ());
      }
   }

   return result;
}
Esempio n. 9
0
// Plugin Interface
void
dmz::QtPluginIconPalletTool::update_plugin_state (
      const PluginStateEnum State,
      const UInt32 Level) {

   if (State == PluginStateInit) {

   }
   else if (State == PluginStateStart) {

   }
   else if (State == PluginStateStop) {

   }
   else if (State == PluginStateShutdown) {

      RuntimeContext *context (get_plugin_runtime_context ());

      if (context && _useSession) {

         Config session (get_plugin_name ());

         session.add_config (qbytearray_to_config ("geometry", saveGeometry ()));

         session.add_config (
            boolean_to_config ("window", "visible", isVisible () ? True : False));

         set_session_config (context, session);
      }
   }
}
Esempio n. 10
0
void
dmz::RenderPluginEventOSG::_init (Config &local) {

   RuntimeContext *context = get_plugin_runtime_context ();

   _defaultHandle = _defs.create_named_handle (EventAttributeDefaultName);

   EventTypeSet set = config_to_event_type_set ("event-list", local, context);

   if (set.get_count () == 0) {

      EventType root = _defs.get_root_event_type ();
      activate_event_callback (root, EventCloseMask);
   }
   else {

      RuntimeIterator it;
      EventType type;

      while (set.get_next (it, type)) {

         activate_event_callback (type, EventCloseMask);
      }
   }
}
Esempio n. 11
0
dmz::QtPluginViewerOSG::QtPluginViewerOSG (
    const PluginInfo &Info,
    Config &local) :
    Plugin (Info),
    TimeSlice (Info),
    QtWidget (Info),
    _log (Info),
    _core (0),
    _channels (0),
    _portalName (DefaultPortalNameOSG),
    _camera (0),
    _cameraManipulator (0),
    _eventHandler (0),
    _viewer (0) {

    _viewer = new ViewerQOSG;
    _viewer->setThreadingModel (osgViewer::Viewer::SingleThreaded);
    _cameraManipulator = new RenderCameraManipulatorOSG;
    _eventHandler = new RenderEventHandlerOSG (get_plugin_runtime_context ());

    osgViewer::StatsHandler *stats = new osgViewer::StatsHandler;
    stats->setKeyEventTogglesOnScreenStats (osgGA::GUIEventAdapter::KEY_F1);
    stats->setKeyEventPrintsOutStats (osgGA::GUIEventAdapter::KEY_F2);
    _viewer->addEventHandler (stats);
    _viewer->setCameraManipulator (_cameraManipulator.get ());
    _viewer->addEventHandler (_eventHandler.get ());
    _viewer->setKeyEventSetsDone (0);

    _init (local);

    _camera = _viewer->getCamera ();
}
Esempio n. 12
0
void
dmz::EntityPluginFreeFly::_init (Config &local) {

   Definitions defs (get_plugin_runtime_context (), &_log);

   _defaultHandle = defs.create_named_handle (ObjectAttributeDefaultName);

   _hilHandle = activate_object_attribute (
      ObjectAttributeHumanInTheLoopName,
      ObjectFlagMask);

   _move.moveSpeed = config_to_float64 ("movement.speed", local, _move.moveSpeed);
   _move.turnRate = config_to_float64 ("movement.turn-rate", local, _move.turnRate);

   init_input_channels (
      local,
      InputEventButtonMask | InputEventAxisMask | InputEventChannelStateMask,
      &_log);

   _isectParameters.set_test_result_type (IsectClosestPoint);
   _isectParameters.set_calculate_normal (False);
   _isectParameters.set_calculate_object_handle (False);
   _isectParameters.set_calculate_distance (True);
   _isectParameters.set_calculate_cull_mode (False);
}
void
dmz::EntityPluginPortalFollow3D::_init (Config &local) {

   Definitions defs (get_plugin_runtime_context (), &_log);

   _defaultHandle = defs.create_named_handle (ObjectAttributeDefaultName);

   _hilAttrHandle = activate_object_attribute (
      ObjectAttributeHumanInTheLoopName,
      ObjectFlagMask);

   Boolean foundOffset (False);

   Config cameraParams;

   if (local.lookup_config ("offset", cameraParams)) {

      foundOffset = True;

      _offset = config_to_vector (cameraParams, _offset);
   }

   init_input_channels (local, InputEventChannelStateMask, &_log);

   _log.info << "Using " << (foundOffset ? "" : "default ") << "camera offset: "
      << _offset << endl;
}
Esempio n. 14
0
// AudioModule Interface
dmz::Handle
dmz::AudioModuleFMOD::create_sound (const String &FileName) {

   Handle result (0);
   String absPath;

   if (_system) {

      // Convert to absolute file path
      Boolean validPath = get_absolute_path (FileName, absPath);

      if (validPath) {

         SoundStruct *soundData = _soundNameTable.lookup (absPath);

         if (soundData) {

            result = soundData->get_handle ();
         }
         else {

            FMOD::Sound *newSound (0);

            FMOD_RESULT fmodResult = _system->createSound (
               absPath.get_buffer (),
               FMOD_3D,
               0,
               &newSound);

            String loadingErrorHeader ("Loading Sound '");
            loadingErrorHeader << absPath << "'";

            if (_error_check (loadingErrorHeader, fmodResult)) {

               SoundStruct *newSoundData = new SoundStruct (
                  absPath,
                  newSound,
                  _soundHandleTable,
                  _soundNameTable,
                  get_plugin_runtime_context ());

               if (newSoundData && _soundNameTable.store (absPath, newSoundData)) {

                  Handle newHandle = newSoundData->get_handle ();

                  if (newHandle && _soundHandleTable.store (newHandle, newSoundData)) {

                     _log.info << "Sound file '" << absPath << "' Loaded" << endl;
                     result = newHandle;
                  }
               }
               else if (newSoundData) { newSoundData->unref (); }
            }
         }
      }
   }

   return result;
}
void
dmz::BorderWebInterface::_init (Config &local) {

   RuntimeContext *context = get_plugin_runtime_context ();

   _uiV8Name = config_to_string ("module.js.name", local, "dmzJsModuleUiV8QtBasic");
   _jsWindowObjectName = config_to_string ("module.js.windowObject.name", local, "dmz");
   _mainWindowName = config_to_string ("module.main-window.name", local, "dmzQtModuleMainWindowBasic");
   _frameName = config_to_string ("webframe.name", local, "DystopiaWebFrame");

   _pinIDHandle = config_to_string ("pin-handles.id.name", local);
   _pinPositionHandle = config_to_string ("pin-handles.position.name", local);
   _pinTitleHandle = config_to_string ("pin-handles.title.name", local);
   _pinDescHandle = config_to_string ("pin-handles.description.name", local);

   _addPinMessage = config_create_message (
      "message-names.add",
      local,
      "AddPinMessage",
      context,
      &_log);

   _pinAddedMessage = config_create_message (
      "message-names.add-confirm",
      local,
      "PinAddedMessage",
      context,
      &_log);

   _removePinMessage = config_create_message (
      "message-names.remove",
      local,
      "RemovePinMessage",
      context,
      &_log);

   _pinRemovedMessage = config_create_message (
      "message-names.remove-confirm",
      local,
      "PinRemovedMessage",
      context,
      &_log);

   _pinMovedMessage = config_create_message (
      "message-names.moved",
      local,
      "PinMovedMessage",
      context,
      &_log);

   _setFrameMessage = config_create_message (
      "message-names.set-interface",
      local,
      "SetInterfaceWebFrameMessage",
      context,
      &_log);
}
Esempio n. 16
0
// ObjectPluginSelect Interface
void
dmz::ObjectPluginSelect::_init (Config &local) {

   _selectMsg = config_create_message (
      "select-message.name",
      local,
      "Object_Select_Message",
      get_plugin_runtime_context ());

   subscribe_to_message (_selectMsg);

   _convert.set_handle (
      config_to_string ("data-convert-handle.name", local, "handle"),
      get_plugin_runtime_context ());

   _key = config_to_key_value ("add-to-selection-key.name", local, KeyShift, &_log);

   init_input_channels (local, InputEventKeyMask, &_log);
}
Esempio n. 17
0
dmz::Handle
dmz::AudioModuleFMOD::create_listener (const String &Name) {

   Handle result (0);

   Int32 numListeners = _listenerNameTable.get_count ();

   if (_system && (numListeners <= 4)) {

      ListenerStruct *newListener = new ListenerStruct (
         Name,
         numListeners,
         get_plugin_runtime_context ());

      if (newListener) {

         Boolean storeResults = True;

         storeResults = storeResults && _listenerNameTable.store (Name, newListener);
         storeResults =  storeResults &&
            _listenerHandleTable.store (newListener->get_handle (), newListener);
         storeResults = storeResults &&
            _listenerIndexTable.store (numListeners, newListener);

         if (storeResults) {

            FMOD_RESULT fmodResult = _system->set3DNumListeners (numListeners + 1);

            if (_error_check ("Creating a Listener", fmodResult)) {

               if (numListeners == 0)  {

                  // First listener being added - unmute all sounds
                  Boolean muteSuccess = set_mute_all_state (False);

                  if (muteSuccess) {

                     result = newListener->get_handle ();
                  }
               }
            }
         }
         else {

            _listenerNameTable.remove (Name);
            _listenerHandleTable.remove (newListener->get_handle ());
            _listenerIndexTable.remove (numListeners);
         }
      }

      if (!result) { delete newListener; newListener = 0; }
   }

   return result;
}
Esempio n. 18
0
void
dmz::QtPluginCanvasObject::_init (Config &local, Config &global) {

   _canvasModuleName = config_to_string ("module.canvas.name", local);

   Config pluginList;

   if (local.lookup_all_config ("plugins.plugin", pluginList)) {

      RuntimeContext *context (get_plugin_runtime_context ());

      if (dmz::load_plugins (context, pluginList, local, global, _extensions, &_log)) {

         _extensions.discover_plugins ();
      }
   }

   _defaultAttributeHandle = activate_default_object_attribute (
      ObjectCreateMask |
      ObjectDestroyMask |
      ObjectPositionMask |
      ObjectOrientationMask);

   _linkAttributeHandle = activate_object_attribute (
      ObjectAttributeLayerLinkName,
      ObjectLinkMask | ObjectUnlinkMask);

#if 0
   Config preLoadList;

   if (local.lookup_all_config ("preload", preLoadList)) {

      Config data;
      ConfigIterator it;

      Boolean done (!preLoadList.get_first_config (it, data));

      while (!done) {

         ObjectType objType;
         Mask objState;

         if (_defs.lookup_object_type (config_to_string ("type", data), objType)) {

            _defs.lookup_state (config_to_string ("state", data), objState);

            _log.info << "Pre-Loading object of type: " << objType.get_name () << endl;
            _get_model_struct (objType, objState);
         }

         done = !preLoadList.get_next_config (it, data);
      }
   }
#endif
}
Esempio n. 19
0
void
dmz::QtPluginPreferences::_init (Config &local) {
   
   RuntimeContext *context (get_plugin_runtime_context ());
      
   setObjectName (get_plugin_name ().get_buffer ());
   
   qframe_config_read ("frame", local, this);
   
   _mainWindowModuleName = config_to_string (
      "module.mainWindow.name",
      local,
      "dmzQtModuleMainWindowBasic");
      
   _preferencesAction = new QAction (this),

   _preferencesAction->setMenuRole (QAction::PreferencesRole);

   _preferencesAction->setText (
      config_to_string ("preferences-menu.text", local, "&Preferences...").get_buffer ());

   connect (
      _preferencesAction, SIGNAL (triggered ()),
      this, SLOT (show ()));

   _menuName = config_to_string ("edit-menu.text", local, _menuName);
   
   _ui.tabWidget->removeTab (0);
   
   Config widgetList;

   if (local.lookup_all_config ("widget", widgetList)) {

      ConfigIterator it;
      Config widget;

      while (widgetList.get_next_config (it, widget)) {

         const String WidgetName (config_to_string ("name", widget));
         
         if (WidgetName && !_widgetTable.lookup (WidgetName)) {

            WidgetStruct *ws (new WidgetStruct);
            
            if (ws) {
               
               ws->title = config_to_string ("title", widget);
            }

            if (!_widgetTable.store (WidgetName, ws)) { delete ws; ws = 0; }
         }
      }
   }
}
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);
}
Esempio n. 21
0
void
dmz::ExPluginMessageSend::_init (Config &local) {

   _type =
      config_to_message_type (
         "message.name",
         local,
         get_plugin_runtime_context (),
         &_log);

   _value = config_to_string ("message.value", local, _value);
}
Esempio n. 22
0
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);
}
Esempio n. 23
0
void
dmz::QtPluginAppUpdater::_init (Config &local) {

    setObjectName (get_plugin_name ().get_buffer ());
    RuntimeContext *context (get_plugin_runtime_context ());

    _mainWindowModuleName = config_to_string ("module.mainWindow.name", local);
    _forceUpdate = config_to_boolean ("force-update.value", local, _forceUpdate);
    _downloadToTemp = config_to_boolean ("download-to-temp.value", local, _downloadToTemp);
    _releaseChannel = config_to_string ("release.channel", local, _releaseChannel);

    // _updateUrl = "latest/{system_name}-{release_channel}/{app_name}.xml";
    // _downloadUrl = "downloads/{app_name}-{major}-{minor}-{bug}-{build_number}";

    String host = config_to_string ("update.host", local);
    String path = config_to_string ("update.path", local);

    if (host && path) {

        _updateUrl = host + path;

        host = config_to_string ("download.host", local, host);
        path = config_to_string ("download.path", local);

        if (host && path) {
            _downloadUrl = host + path;
        }
    }

    if (_updateUrl) {
        _log.debug << "Update URL: " << _updateUrl << endl;
    }
    else {
        _log.debug << "Update URL not specified." << endl;
    }

    if (_downloadUrl) {
        _log.debug << "Download URL: " << _downloadUrl << endl;
    }
    else {
        _log.debug << "Download URL not specified." << endl;
    }

    _valueAttrHandle = config_to_named_handle (
                           "attribute.value.name",
                           local,
                           "value",
                           context);

    _updateMessageName = config_to_string ("update.message", local, _updateMessageName);
    _channelMessageName = config_to_string ("channel.message", local, _channelMessageName);
}
Esempio n. 24
0
void
dmz::EntityPluginDetach::_init (Config &local) {

   _attachMsg = config_create_message (
      "attach-message.name",
      local,
      EntityMessageAttachName,
      get_plugin_runtime_context ());

   subscribe_to_message (_attachMsg);

   activate_default_object_attribute (ObjectDestroyMask);
}
void
dmz::EntityPluginRestoreHealth::_init (Config &local) {

   Definitions defs (get_plugin_runtime_context ());

   defs.lookup_state (DefaultStateNameDead, _dead);

   _healthAttrHandle = defs.create_named_handle (EntityAttributeHealthName);

   _defaultAttrHandle = activate_default_object_attribute (ObjectStateMask);

   _health = config_to_float64 ("health.value", local, _health);
}
void
dmz::StarfighterPluginSpaceBoxOSG::_init (Config &local) {

   Definitions defs (get_plugin_runtime_context ());

   _defaultHandle = defs.create_named_handle (ObjectAttributeDefaultName);

   _imgRc = config_to_string ("image.resource", local, _imgRc);
   _offset = config_to_float64 ("box.offset", local, _offset);

   activate_object_attribute (ObjectAttributeHumanInTheLoopName, ObjectFlagMask);

   _create_box ();
}
Esempio n. 27
0
void
dmz::RenderExtViewerOSG::update_time_slice (const Float64 TimeDelta) {

   if (_viewer.valid ()) {

      if (_viewer->done ()) {

         Exit (get_plugin_runtime_context ()).request_exit (
            ExitStatusNormal,
            "Application Quit.");
      }
      else { _viewer->frame (); } // Render a complete new frame
   }
}
void
dmz::MBRAPluginFaultTreeAutoLayout::_init (Config &local) {

   const Mask EmptyMask;
   RuntimeContext *context = get_plugin_runtime_context ();

   _canvasModuleName = config_to_string ("module.canvas.name", local);

   _defaultAttrHandle = activate_default_object_attribute (EmptyMask);

   _activeAttrHandle = activate_object_attribute (
      config_to_string ("attribute.activate.name", local, "FT_Active_Fault_Tree"),
      ObjectFlagMask);

   _linkAttrHandle = activate_object_attribute (
      config_to_string ("attribute.link.name", local, "FT_Link"),
      ObjectLinkMask | ObjectUnlinkMask);

   _logicAttrHandle = config_to_named_handle (
      "attribute.logic.name", local, "FT_Logic_Link", context);

   _nameAttrHandle = config_to_named_handle (
      "attribute.threat.name", local, "FT_Name", context);

   _hideAttrHandle = config_to_named_handle (
      "attribute.hide.name", local, ObjectAttributeHideName, context);

   Definitions defs (get_plugin_runtime_context (), &_log);

   defs.lookup_object_type (
      config_to_string ("root.type", local, "ft_component_root"), _rootType);

   _rootText = config_to_string ("root.text", local, _rootText);

   _hOffset = config_to_float64 ("offset.horizontal", local, _hOffset);
   _vOffset = config_to_float64 ("offset.vertical", local, _vOffset);
}
Esempio n. 29
0
void
dmz::RenderExtViewerOSG::discover_plugin (
      const PluginDiscoverEnum Mode,
      const Plugin *PluginPtr) {

   if (Mode == PluginDiscoverAdd) {

      if (!_core) {

         _core = RenderModuleCoreOSG::cast (PluginPtr);
         if (_core) {

            osg::ref_ptr<osg::Group> scene = _core->get_scene ();

            if (scene.valid ()) { _viewer->setSceneData (scene.get ()); }

            _core->add_viewer (_viewerName, _viewer.get ());
         }
      }

      if (!_channels) {

         _channels = InputModule::cast (PluginPtr);
         if (_channels) {

            Definitions defs (get_plugin_runtime_context (), &_log);
            const Handle SourceHandle = defs.create_named_handle (_viewerName);
            _eventHandler->set_input_module_channels (_channels, SourceHandle);
         }
      }
   }
   else if (Mode == PluginDiscoverRemove) {

      if (_core && (_core == RenderModuleCoreOSG::cast (PluginPtr))) {

         _core->remove_viewer (_viewerName);
         osg::ref_ptr<osg::Group> scene = new osg::Group;
         if (scene.valid ()) { _viewer->setSceneData (scene.get ()); }
         _core = 0;
      }

      if (_channels && (_channels == InputModule::cast (PluginPtr))) {

         _eventHandler->set_input_module_channels (0, 0);
         _channels = 0;
      }
   }
}
Esempio n. 30
0
void
dmz::EventModuleCommonBasic::_init (Config &local) {

   RuntimeContext *context (get_plugin_runtime_context ());
   Definitions defs (context, &_log);

   _defaultObjectHandle = defs.create_named_handle (ObjectAttributeDefaultName);
   _defaultEventHandle = defs.create_named_handle (EventAttributeDefaultName);

   _sourceHandle = defs.create_named_handle (EventAttributeSourceName);
   _targetHandle = defs.create_named_handle (EventAttributeTargetName);
   _munitionsHandle = defs.create_named_handle (EventAttributeMunitionsName);

   defs.lookup_event_type (EventLaunchName, _launchType);
   defs.lookup_event_type (EventDetonationName, _detonationType);
   defs.lookup_event_type (EventCollisionName, _collisionType);
}