本文整理汇总了C++中ObjectType::get_name方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectType::get_name方法的具体用法?C++ ObjectType::get_name怎么用?C++ ObjectType::get_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectType
的用法示例。
在下文中一共展示了ObjectType::get_name方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: back
// QtPluginIconPalletTool Interface
void
dmz::QtPluginIconPalletTool::_add_type (const ObjectType &Type) {
const String IconResource = config_to_string (
get_plugin_name () + ".resource",
Type.get_config());
const String IconName = _rc.find_file (IconResource);
if (IconName) {
const String Name = Type.get_name ();
if (Name) {
QImage back (
(int)_iconExtent,
(int)_iconExtent,
QImage::Format_ARGB32_Premultiplied);
QPainter painter (&back);
painter.setCompositionMode (QPainter::CompositionMode_Source);
painter.fillRect (back.rect (), Qt::transparent);
painter.setCompositionMode (QPainter::CompositionMode_SourceOver);
QSvgRenderer qsr (QString (IconName.get_buffer ()));
QRectF size = qsr.viewBoxF ();
qreal width = size.width ();
qreal height = size.height ();
qreal scale = (width > height) ? width : height;
if (scale <= 0.0f) { scale = 1.0f; }
scale = _iconExtent / scale;
width *= scale;
height *= scale;
size.setWidth (width);
size.setHeight (height);
if (height < _iconExtent) { size.moveTop ((_iconExtent - height) * 0.5f); }
if (width < _iconExtent) { size.moveLeft ((_iconExtent - width) * 0.5f); }
qsr.render (&painter, size);
painter.end ();
QIcon icon;
icon.addPixmap (QPixmap::fromImage (back));
QStandardItem *item = new QStandardItem (icon, Name.get_buffer ());
item->setEditable (false);
_model.appendRow (item);
}
}
else if (IconResource) {
_log.error << "Unable to find icon resource: " << IconResource
<< " for object type: " << Type.get_name () << endl;
}
RuntimeIterator it;
ObjectType next;
while (Type.get_next_child (it, next)) { _add_type (next); }
}
示例2: current
void
dmz::CyclesPluginWallOSG::_create_object_wall (
const Handle ObjectHandle,
const ObjectType &Type) {
WallStruct *wall (0);
ObjectType current (Type);
while (current && !wall) {
wall = _wallTable.lookup (Type.get_handle ());
Config wallDef;
if (!wall && current.get_config ().lookup_all_config_merged ("wall", wallDef)) {
const Float32 Red (config_to_float32 ("color.r", wallDef, 1.0));
const Float32 Green (config_to_float32 ("color.g", wallDef, 1.0));
const Float32 Blue (config_to_float32 ("color.b", wallDef, 1.0));
const Float32 Alpha (config_to_float32 ("color.a", wallDef, 1.0));
const Float32 Height (config_to_float32 ("height.value", wallDef, 1.0));
const Float32 Offset (config_to_float32 ("offset.value", wallDef, 1.0));
_log.info << " " << Type.get_name () << " wall information." << endl
<< "\t Red : " << Red << endl
<< "\t Green : " << Green << endl
<< "\t Blue : " << Blue << endl
<< "\t Alpha : " << Alpha << endl
<< "\tHeight : " << Height << endl
<< "\tOffset : " << Offset << endl;
wall = new WallStruct (
True,
osg::Vec4 (Red, Green, Blue, Alpha),
Height,
Offset);
if (wall && !_wallTable.store (Type.get_handle (), wall)) {
delete wall; wall = 0;
}
}
else { current.become_parent (); }
}
if (wall && wall->ColorDefined) {
_create_wall (ObjectHandle, *wall);
}
else if (!wall) {
wall = new WallStruct (False, osg::Vec4 (0.0f, 0.0f, 0.0f, 0.0f), 0.0f, 0.0f);
if (wall && !_wallTable.store (Type.get_handle (), wall)) {
delete wall; wall = 0;
}
}
}
示例3: done
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
}
示例4: result
/*!
\brief Serializes the ObjectType definitions in a RuntimeContext and stores the result
in a Config object.
\ingroup Runtime
\details Format of the returned Config object:
\code
<runtime>
<object-type name="String" parent="String"/>
</runtime>
\endcode
- \b object-type.name String containing the name of the ObjectType.
- \b object-type.parent String containing the name of the parent ObjectType.
- \b object-type.* Config data of the ObjectType.
\param[in] context Pointer to the RuntimeContext to serialize.
\return Returns a Config object containing the serialized ObjectType definitions in the
RuntimeContext.
*/
dmz::Config
dmz::runtime_object_types_to_config (RuntimeContext *context) {
RuntimeContextDefinitions *defs = (context ? context->get_definitions_context () : 0);
Config result (RuntimeName);
if (defs) {
defs->ref ();
const ObjectType RootObjectType = Definitions (context).get_root_object_type ();
HashTableHandleIterator it;
ObjectType *otype (0);
while (defs->objectHandleTable.get_next (it, otype)) {
if (RootObjectType != *otype) {
Config data ("object-type");
data.store_attribute ("name", otype->get_name ());
ObjectType parent = otype->get_parent ();
if (parent != RootObjectType) {
data.store_attribute ("parent", parent.get_name ());
}
data.add_children (otype->get_config ());
result.add_config (data);
}
}
defs->unref ();
}
return result;
}
示例5: current
// Object Observer Interface
void
dmz::RenderPluginDisableObjectIsect::create_object (
const UUID &Identity,
const Handle ObjectHandle,
const ObjectType &Type,
const ObjectLocalityEnum Locality) {
if (_isect) {
Boolean *value (0);
ObjectType current (Type);
while (current && !value) {
value = _isectTable.lookup (current.get_handle ());
if (!value) {
Config data;
if (current.get_config ().lookup_config ("render.isect", data)) {
Boolean disable = config_to_boolean ("disable", data, False);
value = new Boolean (disable);
if (!_isectTable.store (current.get_handle () , value)) {
delete value; value = 0;
}
}
}
current.become_parent ();
}
if (value && *value) {
if (_isect->disable_isect (ObjectHandle) == 0) {
*value = False;
_log.error << "Unable to disable intersection for type: " << Type.get_name ()
<< endl;
}
}
}
}
示例6: type
void
dmz::ArchivePluginObject::update_object_alternate_type (
const UUID &Identity,
const Handle ObjectHandle,
const Handle AttributeHandle,
const ObjectType &Value,
const ObjectType *PreviousValue) {
Config config;
if (_get_attr_config (AttributeHandle, ObjectAltTypeMask, config)) {
Config type ("alttype");
type.store_attribute ("value", Value.get_name ());
config.add_config (type);
}
}
示例7: currentType
// 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); }
}
}
示例8: if
//! Gets root object type.
dmz::ObjectType
dmz::Definitions::get_root_object_type () const {
ObjectType result;
if (_state.context && _state.defs) {
ObjectType *ptr (_state.defs->objectNameTable.lookup (LocalRootObjectTypeName));
if (!ptr) {
TypeContext *rootTypeContext = new TypeContext (
LocalRootObjectTypeName,
_state.context,
0,
0);
if (rootTypeContext) {
ptr = new ObjectType (rootTypeContext);
if (ptr && _state.defs->objectNameTable.store (ptr->get_name (), ptr)) {
_state.defs->objectHandleTable.store (ptr->get_handle (), ptr);
}
else if (ptr) { delete ptr; ptr = 0; }
rootTypeContext->unref ();
}
}
if (ptr) { result = *ptr; }
}
return result;
}
示例9: tmp
dmz::Config
dmz::ArchivePluginObject::_archive_object (const Handle ObjectHandle) {
Config result;
ObjectModule *objMod (get_object_module ());
if (objMod) {
Config tmp ("object");
Boolean archiveObject (True);
const ObjectType Type (objMod->lookup_object_type (ObjectHandle));
if (Type) {
if (_currentFilterList) {
FilterStruct *filter = _currentFilterList->list;
while (filter) {
if (filter->mode & LocalExportMask) {
if (filter->exTypes.get_count () &&
filter->exTypes.contains_type (Type)) {
archiveObject = False;
filter = 0;
}
if (filter && filter->inTypes.get_count () &&
!filter->inTypes.contains_type (Type)) {
archiveObject = False;
filter = 0;
}
}
if (filter) { filter = filter->next; }
}
}
}
else { archiveObject = False; }
if (archiveObject) {
tmp.store_attribute ("type", Type.get_name ());
UUID uuid;
if (objMod->lookup_uuid (ObjectHandle, uuid)) {
tmp.store_attribute ("uuid", uuid.to_string ());
}
_currentConfig = result = tmp;
objMod->dump_all_object_attributes (ObjectHandle, *this);
}
}
_attrTable.empty ();
_currentConfig.set_config_context (0);
return result;
}
示例10: result
QLatin1String
dmz::to_qstring (const ObjectType &Type) {
QLatin1String result (Type.get_name ().get_buffer ());
return result;
}
示例11: test
int
main (int argc, char *argv[]) {
Test test ("dmzRuntimeObjectTypeTest", argc, argv);
// test null contructor
ObjectType testObjectType;
test.validate (
"test default constructor",
!testObjectType.get_type_context () &&
!testObjectType.get_name ().get_length ());
RuntimeContext *context (test.rt.get_context ());
Config config;
if (test.validate (
"Looking up runtime table",
test.config.lookup_config ("dmz.runtime", config))) {
runtime_init (config, test.rt.get_context (), &(test.log));
}
Definitions defs (context, &(test.log));
const String CaracalName ("caracal");
const String CatName ("cat");
ObjectType rootObjectType;
test.validate (
"Looking up ObjectType: Caracal",
defs.lookup_object_type (CaracalName, testObjectType));
test.validate (
"Looking up ObjectType: Cat",
defs.lookup_object_type (CatName, rootObjectType));
// ============================================================================ //
// <validate constructors>
ObjectType copyOfCaracalContext (testObjectType.get_type_context ());
test.validate (
"test (context) constructor",
copyOfCaracalContext == testObjectType);
ObjectType anotherCaracal (CaracalName, context);
ObjectType anotherCat (CatName, context);
test.validate (
"test (Name, RuntimeContext) constructor",
anotherCat == rootObjectType &&
anotherCaracal == testObjectType);
ObjectType yetAnotherCaracal (anotherCaracal.get_handle (), context);
ObjectType yetAnotherCat (anotherCat.get_handle (), context);
test.validate (
"test (Handle, RuntimeContext) constructor",
yetAnotherCat == rootObjectType &&
yetAnotherCaracal == testObjectType);
ObjectType stillAnotherCaracal (anotherCaracal);
ObjectType stillAnotherCat (anotherCat);
test.validate (
"test copy constructor",
stillAnotherCat == rootObjectType &&
stillAnotherCaracal == testObjectType);
// </validate constructors>
// ============================================================================ //
// <validate operators>
ObjectType shouldBeNothing;
ObjectType nothingThatBecomesSomething;
test.validate (
"test = operator - (pre state)",
(nothingThatBecomesSomething == shouldBeNothing) &&
!(nothingThatBecomesSomething == anotherCat));
nothingThatBecomesSomething = anotherCat;
test.validate (
"test = operator - (equal something)",
!(nothingThatBecomesSomething == shouldBeNothing) &&
(nothingThatBecomesSomething == anotherCat));
nothingThatBecomesSomething = shouldBeNothing;
test.validate (
"test = operator - (equal null)",
(nothingThatBecomesSomething == shouldBeNothing) &&
!(nothingThatBecomesSomething == anotherCat));
ObjectType shouldBeACaracal (CaracalName, context);
ObjectType shouldBeACat (CatName, context);
test.validate (
"test == operator",
!(shouldBeNothing == anotherCat) &&
!(shouldBeNothing == anotherCaracal) &&
!(shouldBeACaracal == anotherCat) &&
(shouldBeACaracal == anotherCaracal) &&
(shouldBeACat == anotherCat) &&
//.........这里部分代码省略.........