Ejemplo n.º 1
0
AbstractObjectPtr
ObjectFactory::createObject(
    const QString &aName,
    const Position aPosition,
    const qreal aWidth,
    const qreal anHeight)
{
    const ObjectFactory *myFactoryPtr = theFactoryListPtr->getFactoryPtr(aName);
    DEBUG5("ObjectFactory::createObject(\"%s\") Factory=%p", ASCII(aName), myFactoryPtr);
    if (myFactoryPtr == nullptr) {
        DEBUG1("There is no factory for Object type '%s'", ASCII(aName));
        return nullptr;
    }
    AbstractObject *myObjectPtr = myFactoryPtr->createObject();
    assert (myObjectPtr != nullptr);
    AbstractObjectPtr mySharedOPtr = AbstractObjectPtr(myObjectPtr);
    myObjectPtr->theThisPtr = mySharedOPtr;
    DEBUG5("  object created = %p, i18n name = '%s'", myObjectPtr, ASCII(myObjectPtr->getName()));
    assert (aName.contains(" ") == false);
    myObjectPtr->theInternalName = aName;
    myObjectPtr->theCenter = aPosition;
    if (aWidth != 1.0)
        myObjectPtr->theWidth = aWidth;
    if (anHeight != 1.0)
        myObjectPtr->theHeight = anHeight;
    // finally, get rid of the actual pointer and return the shared_ptr
    assert (nullptr != mySharedOPtr);
    return mySharedOPtr;
}
Ejemplo n.º 2
0
void DDEngine::SceneTransformator::setObjects(const std::vector<AbstractObject*> objects)
{
	SceneTransformatorStatic::objects = objects;

	for (size_t i = 0; i < objects.size(); i++) {
		AbstractObject* o = objects[i];
		Picker item;
		item.index = i;
		item.name = o->getName();
		selections.push_back(item);
	}

}