dmz::QtPluginCanvasObjectBasic::ModelStruct * dmz::QtPluginCanvasObjectBasic::_get_model_struct (const ObjectType &ObjType) { ModelStruct *retVal (_masterModelTable.lookup (ObjType.get_handle ())); if (!retVal) { Config local; ObjectType currentType (ObjType); if (_find_config_from_type (local, currentType)) { ModelStruct *ms (_modelTable.lookup (currentType.get_handle ())); if (!ms) { ms = _config_to_model_struct (local, currentType); if (ms) { _modelTable.store (ms->ObjType.get_handle (), ms); } } retVal = ms; } } if (retVal) { _masterModelTable.store (ObjType.get_handle (), retVal); } return retVal; }
// Object Observer Interface void dmz::QtPluginCanvasObject::create_object ( const UUID &Identity, const Handle ObjectHandle, const ObjectType &Type, const ObjectLocalityEnum Locality) { Config data; ObjectType currentType (Type); if (_find_config_from_type (data, currentType)) { String name (currentType.get_name ()); name << "." << ObjectHandle; ObjectStruct *os (new ObjectStruct (ObjectHandle)); os->item->setData (QtCanvasObjectNameIndex, name.get_buffer ()); ObjectModule *objMod (get_object_module ()); if (objMod) { Vector pos; Matrix ori; objMod->lookup_position (ObjectHandle, _defaultAttributeHandle, pos); objMod->lookup_orientation (ObjectHandle, _defaultAttributeHandle, ori); os->posX = pos.get_x (); os->posY = pos.get_z (); os->heading = get_heading (ori); os->update (); } _objectTable.store (os->ObjHandle, os); if (_canvasModule) { _canvasModule->add_item (os->ObjHandle, os->item); } } }