Esempio n. 1
0
void PythonPlugin::restoreProperties(const Archive& archive)
{
    Listing& pathListing = *archive.findListing("moduleSearchPath");
    if(pathListing.isValid()){
        MessageView* mv = MessageView::instance();
        PyGILock lock;
        python::list syspath = python::extract<python::list>(sysModule.attr("path"));
        string newPath;
        for(int i=0; i < pathListing.size(); ++i){
            newPath = archive.resolveRelocatablePath(pathListing[i].toString());
            if(!newPath.empty()){
                bool isExisting = false;
                list<string>::iterator p;
                for(p = additionalSearchPathList.begin(); p != additionalSearchPathList.end(); ++p){
                    if(newPath == (*p)){
                        isExisting = true;
                        break;
                    }
                }
                if(!isExisting){
                    syspath.insert(0, getNativePathString(filesystem::path(newPath)));
                    additionalSearchPathList.push_back(newPath);
                    mv->putln(format(_("PythonPlugin: \"%1%\" has been added to the python module search path list."))
                              % newPath);
                }
            }
        }
    }
}
Esempio n. 2
0
void SimulationBar::forEachSimulator(boost::function<void(SimulatorItem* simulator)> callback, bool doSelect)
{
    MessageView* mv = MessageView::instance();
    /*
      ItemList<SimulatorItem> simulators =
      ItemTreeView::mainInstance()->selectedItems<SimulatorItem>();
    */
    ItemList<SimulatorItem> simulators =
        ItemTreeView::mainInstance()->selectedItems<SimulatorItem>();

    if(simulators.empty()){
        simulators.extractChildItems(RootItem::instance());
        if(simulators.empty()){
            mv->notify(_("There is no simulator item."));
        } else  if(simulators.size() > 1){
            simulators.clear();
            mv->notify(_("Please select a simulator item to simulate."));
        } else {
            if(doSelect){
                ItemTreeView::instance()->selectItem(simulators.front());
            }
        }
    }

    typedef map<WorldItem*, SimulatorItem*> WorldToSimulatorMap;
    WorldToSimulatorMap worldToSimulator;

    for(int i=0; i < simulators.size(); ++i){
        SimulatorItem* simulator = simulators.get(i);
        WorldItem* world = simulator->findOwnerItem<WorldItem>();
        if(world){
            WorldToSimulatorMap::iterator p = worldToSimulator.find(world);
            if(p == worldToSimulator.end()){
                worldToSimulator[world] = simulator;
            } else {
                p->second = 0; // skip if multiple simulators are selected
            }
        }
    }

    for(int i=0; i < simulators.size(); ++i){
        SimulatorItem* simulator = simulators.get(i);
        WorldItem* world = simulator->findOwnerItem<WorldItem>();
        if(!world){
            mv->notify(format(_("%1% cannot be processed because it is not related with a world."))
                       % simulator->name());
        } else {
            WorldToSimulatorMap::iterator p = worldToSimulator.find(world);
            if(p != worldToSimulator.end()){
                if(!p->second){
                    mv->notify(format(_("%1% cannot be processed because another simulator"
                                        "in the same world is also selected."))
                               % simulator->name());
                } else {
                    callback(simulator);
                }
            }
        }
    }
}
Esempio n. 3
0
void ChatView::dispatchMessage(const MessageView &mv)
{
	if ((mv.type() == MessageView::Message || mv.type() == MessageView::Subject)
			&& ChatViewCommon::updateLastMsgTime(mv.dateTime()))
	{
		QString color = ColorOpt::instance()->color(infomrationalColorOpt).name();
		appendText(QString(useMessageIcons_?"<img src=\"icon:log_icon_time\" />":"") +
				   QString("<font color=\"%1\">*** %2</font>").arg(color).arg(mv.dateTime().date().toString(Qt::ISODate)));
	}
	switch (mv.type()) {
		case MessageView::Message:
			if (isMuc_) {
				renderMucMessage(mv);
			} else {
				renderMessage(mv);
			}
			break;
		case MessageView::Subject:
			if (isMuc_) {
				renderMucSubject(mv);
			} else {
				renderSubject(mv);
			}
			break;
		case MessageView::Urls:
			renderUrls(mv);
			break;
		default: // System/Status
			renderSysMessage(mv);
	}
}
bool EditableModelItemImpl::loadModelFile(const std::string& filename)
{
    BodyPtr newBody;

    MessageView* mv = MessageView::instance();
    mv->beginStdioRedirect();

    bodyLoader.setMessageSink(mv->cout(true));
    newBody = bodyLoader.load(filename);

    mv->endStdioRedirect();
    
    if(newBody){
        newBody->initializeState();
        newBody->calcForwardKinematics();
        Link* link = newBody->rootLink();
        
        AbstractBodyLoaderPtr loader = bodyLoader.lastActualBodyLoader();
        VRMLBodyLoader* vloader = dynamic_cast<VRMLBodyLoader*>(loader.get());
        if (vloader) {
            // VRMLBodyLoader supports retriveOriginalNode function
            setLinkTree(link, vloader);
        } else {
            // Other loaders dont, so we wrap with inline node
            VRMLProtoInstance* proto = new VRMLProtoInstance(new VRMLProto(""));
            MFNode* children = new MFNode();
            VRMLInlinePtr inl = new VRMLInline();
            inl->urls.push_back(filename);
            children->push_back(inl);
            proto->fields["children"] = *children;
            // first, create joint item
            JointItemPtr item = new JointItem(link);
            item->originalNode = proto;
            self->addChildItem(item);
            ItemTreeView::instance()->checkItem(item, true);
            // next, create link item under the joint item
            LinkItemPtr litem = new LinkItem(link);
            litem->originalNode = proto;
            litem->setName("link");
            item->addChildItem(litem);
            ItemTreeView::instance()->checkItem(litem, true);
        }
        for (int i = 0; i < newBody->numDevices(); i++) {
            Device* dev = newBody->device(i);
            SensorItemPtr sitem = new SensorItem(dev);
            Item* parent = self->findItem<Item>(dev->link()->name());
            if (parent) {
                parent->addChildItem(sitem);
                ItemTreeView::instance()->checkItem(sitem, true);
            }
        }
    }

    return (newBody);
}
Esempio n. 5
0
void ChatView::renderMessage(const MessageView &mv)
{
	QString timestr = formatTimeStamp(mv.dateTime());
	QString color = colorString(mv.isLocal(), mv.isSpooled());
	if (useMessageIcons_ && mv.isAwaitingReceipt()) {
		document()->addResource(QTextDocument::ImageResource, QUrl(QString("icon:delivery") + mv.messageId()), logIconSend);
	}
	QString icon = useMessageIcons_?
		(QString("<img src=\"%1\" />").arg(mv.isLocal()?
		(mv.isAwaitingReceipt()?QString("icon:delivery") + mv.messageId():"icon:log_icon_send"):"icon:log_icon_receive")):"";
	if (mv.isEmote()) {
		appendText(icon + QString("<span style=\"color: %1\">").arg(color) + QString("[%1]").arg(timestr) + QString(" *%1 ").arg(TextUtil::escape(mv.nick())) + mv.formattedText() + "</span>");
	} else {
		if (PsiOptions::instance()->getOption("options.ui.chat.use-chat-says-style").toBool()) {
			appendText(icon + QString("<span style=\"color: %1\">").arg(color) + QString("[%1] ").arg(timestr) + tr("%1 says:").arg(TextUtil::escape(mv.nick())) + "</span><br>" + mv.formattedText());
		}
		else {
			appendText(icon + QString("<span style=\"color: %1\">").arg(color) + QString("[%1] &lt;").arg(timestr) + TextUtil::escape(mv.nick()) + QString("&gt;</span> ") + mv.formattedText());
		}
	}

	if (mv.isLocal()) {
		deferredScroll();
	}
}
Esempio n. 6
0
void ChatView::renderMucSubject(const MessageView &mv)
{
	QString timestr = formatTimeStamp(mv.dateTime());
	QString ut = mv.formattedUserText();
	QString color = ColorOpt::instance()->color(infomrationalColorOpt).name();
	QString userTextColor = ColorOpt::instance()->color("options.ui.look.colors.messages.usertext").name();
	appendText(QString(useMessageIcons_?"<img src=\"icon:log_icon_info\" />":"") +
			   QString("<font color=\"%1\">[%2] *** ").arg(color, timestr) + mv.formattedText() +
						(ut.isEmpty()?"":":<br>") + "</font>" +
						(ut.isEmpty()?"":QString(" <span style=\"color:%1;font-weight:bold\">%2</span>").arg(userTextColor, ut)));
}
Esempio n. 7
0
MessageView MessageView::statusMessage(const QString &nick, int status,
									   const QString &statusText, int priority)
{
	MessageView mv = MessageView::fromPlainText(QObject::tr("%1 is now %2")
												.arg(nick, status2txt(status)),
												Status);
	mv.setNick(nick);
	mv.setStatus(status);
	mv.setStatusPriority(priority);
	mv.setUserText(statusText);
	return mv;
}
Esempio n. 8
0
void MessageDialog::setupDialog(std::string& message, std::string& buttonText1, std::string& buttonText2)
{
//	int resId = 0;	
//	int resSubId = 0;

	MessageView* messageView = new MessageView(this, getDialogRect(), message);
    addView(messageView, VIEW_ID_MESSAGE_VIEW);

	Rect messageViewArea = messageView->getViewArea();
	int middleX = messageViewArea.width() / 2;
	int middleY = messageViewArea.height() - BUTTON_V_OFFSET - BUTTON_SIZE_Y;
	Point middlePoint(middleX, middleY);

	if(!buttonText1.empty())
	{
		Point button1Point = middlePoint;
		if(!buttonText2.empty())
		{
			// setup for 2 buttons
			button1Point.x -= BUTTON_SIZE_X + BUTTON_SPACE/2;
		}
		else
		{
			// setup for 1 button
			button1Point.x -= BUTTON_SIZE_X/2;
		}
		// create button1
		Button* button1 = new Button(this, messageView->localToGlobal(button1Point), VIEW_ID_BUTTON_1);
		button1->setText(buttonText1.c_str());
		addView(button1, VIEW_ID_BUTTON_1);

		if(!buttonText2.empty())
		{
			Point button2Point = middlePoint;
			button2Point.x += BUTTON_SPACE/2;

			// create button2
			Button* button2 = new Button(this, messageView->localToGlobal(button2Point), VIEW_ID_BUTTON_2);
			button2->setText(buttonText2.c_str());
			addView(button2, VIEW_ID_BUTTON_2);
		}
	}

// TODO: remove these catan specific things
#if (defined(CATAN_CLIENT) || defined(CATAN_STANDALONE))
	// Draw Catan Scroll Border around dialog
	CatanDialogBorder* borderView = new CatanDialogBorder(this, getDialogRect());
	addView(borderView, VIEW_ID_BORDER);
#endif

	redraw();
}
Esempio n. 9
0
void ChatView::renderMucMessage(const MessageView &mv)
{
	const QString timestr = formatTimeStamp(mv.dateTime());
	QString alerttagso, alerttagsc, nickcolor;
	QString textcolor = palette().color(QPalette::Active, QPalette::Text).name();
	QString icon = useMessageIcons_?
					(QString("<img src=\"%1\" />").arg(mv.isLocal()?"icon:log_icon_delivered":"icon:log_icon_receive")):"";
	if(mv.isAlert()) {
		textcolor = "#FF0000";
		alerttagso = "<b>";
		alerttagsc = "</b>";
	}

	if(mv.isSpooled()) {
		nickcolor = ColorOpt::instance()->color(infomrationalColorOpt).name();
	} else {
		nickcolor = getMucNickColor(mv.nick(), mv.isLocal());
	}

	if(mv.isEmote()) {
		appendText(icon + QString("<font color=\"%1\">").arg(nickcolor) + QString("[%1]").arg(timestr) + QString(" *%1 ").arg(TextUtil::escape(mv.nick())) + alerttagso + mv.formattedText() + alerttagsc + "</font>");
	}
	else {
		if(PsiOptions::instance()->getOption("options.ui.chat.use-chat-says-style").toBool()) {
			appendText(icon + QString("<font color=\"%1\">").arg(nickcolor) + QString("[%1] ").arg(timestr) + QString("%1 says:").arg(TextUtil::escape(mv.nick())) + "</font><br>" + QString("<font color=\"%1\">").arg(textcolor) + alerttagso + mv.formattedText() + alerttagsc + "</font>");
		}
		else {
			appendText(icon + QString("<font color=\"%1\">").arg(nickcolor) + QString("[%1] &lt;").arg(timestr) + TextUtil::escape(mv.nick()) + QString("&gt;</font> ") + QString("<font color=\"%1\">").arg(textcolor) + alerttagso + mv.formattedText() + alerttagsc +"</font>");
		}
	}

	if(mv.isLocal()) {
		scrollToBottom();
	}
}
Esempio n. 10
0
MessageView* SessionTabWidget::openView(const QString& receiver)
{
    MessageView* view = d.views.value(receiver.toLower());
    if (!view)
    {
        view = new MessageView(d.handler.session(), this);
        view->setReceiver(receiver);
        connect(view, SIGNAL(alert(MessageView*, bool)), this, SLOT(alertTab(MessageView*, bool)));
        connect(view, SIGNAL(highlight(MessageView*, bool)), this, SLOT(highlightTab(MessageView*, bool)));
        connect(view, SIGNAL(query(QString)), this, SLOT(openView(QString)));
        connect(view, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit()));

        d.handler.addReceiver(receiver, view);
        d.views.insert(receiver.toLower(), view);
        addTab(view, receiver);
    }
Esempio n. 11
0
/**
* 静态方法,创建一个场景,并将自定义的MessageView布景层加入到该场景中
* return  返回创建好的场景对象
*/
CCScene* MessageView::CreateScene() {

    CCScene* scene = CCScene::create() ;

    MessageView* msgView = new MessageView() ; // MessageView::create() ;

    if (msgView && msgView->init())
    {
        msgView->init() ;
    }

    msgView->autorelease() ;

    scene->addChild(msgView) ;

    return scene ;
}
Esempio n. 12
0
void ChatView::renderUrls(const MessageView &mv)
{
	QMap<QString, QString> urls = mv.urls();
	foreach (const QString &key, urls.keys()) {
		appendText(QString("<b>") + tr("URL:") + "</b> " + QString("%1").arg(TextUtil::linkify(TextUtil::escape(key))));
		if (!urls.value(key).isEmpty()) {
			appendText(QString("<b>") + tr("Desc:") + "</b> " + QString("%1").arg(urls.value(key)));
		}
	}
}
Esempio n. 13
0
bool BodyItemImpl::loadModelFile(const std::string& filename)
{
    MessageView* mv = MessageView::instance();
    mv->beginStdioRedirect();
    bodyLoader.setMessageSink(mv->cout(true));

    BodyPtr newBody = bodyLoader.load(filename);

    mv->endStdioRedirect();
    
    if(newBody){
        body = newBody;
        body->setName(self->name());
        body->initializeState();
    }

    initBody(false);

    return (newBody);
}
Esempio n. 14
0
bool ExtCommandItem::execute()
{
    bool result = false;
    
    MessageView* mv = MessageView::instance();
    
    if(!command_.empty()){
        terminate();
        string actualCommand(command_);
#ifdef _WIN32
        if(filesystem::path(actualCommand).extension() != ".exe"){
            actualCommand += ".exe";
        }
        // quote the command string to support a path including spaces
        process.start(QString("\"") + actualCommand.c_str() + "\"");
#else
        process.start(actualCommand.c_str());
#endif

        if(process.waitForStarted()){
            mv->putln(fmt(_("External command \"%1%\" has been executed by item \"%2%\"."))
                      % actualCommand % name());

            if(waitingTimeAfterStarted_ > 0.0){
                msleep(waitingTimeAfterStarted_ * 1000.0);
            }
            
            result = true;

        } else {
            mv->put(fmt(_("External command \"%1%\" cannot be executed.")) % actualCommand);
            if(!boost::filesystem::exists(actualCommand)){
                mv->putln(_(" The command does not exist."));
            } else {
                mv->putln("");
            }
        }
    }
    return result;
}
    void onItemAdded(Item* item)
        {
            MessageView* mv = MessageView::instance();

            if(BodyItem* bodyItem = dynamic_cast<BodyItem*>(item)){
                Body* body = bodyItem->body();
                for(size_t i=0; i < body->numDevices(); ++i){
                    Device* device = body->device(i);
                    if(!camera){
                        camera = dynamic_pointer_cast<Camera>(device);
                        if(camera){
                            mv->putln(format("RTCVisionSensorSamplePlugin: Detected Camera \"%1%\" of %2%.")
                                      % camera->name() % body->name());
                            visionSensorSampleRTC->setCameraLocalT(camera->T_local());
                        }
                    }
                    if(!rangeSensor){
                        rangeSensor = dynamic_pointer_cast<RangeSensor>(device);
                        if(rangeSensor){
                            mv->putln(format("RTCVisionSensorSamplePlugin: Detected RangeSensor \"%1%\" of %2%.")
                                      % rangeSensor->name() % body->name());
                            visionSensorSampleRTC->setRangeSensorLocalT(rangeSensor->T_local());
                        }
                    }
                }
            }else if(PointSetItem* pointSetItem = dynamic_cast<PointSetItem*>(item)){
                if(pointSetItem->name() == "RangeCameraPoints"){
                    pointSetFromRangeCamera = pointSetItem->pointSet();
                    mv->putln("RTCVisionSensorSamplePlugin: Detected PointSetItem \"RangeCameraPoints\"");
                    visionSensorSampleRTC->setPointSetFromRangeCamera(pointSetFromRangeCamera);
                } else if(pointSetItem->name() == "RangeSensorPoints"){
                    pointSetFromRangeSensor = pointSetItem->pointSet();
                    mv->putln("RTCVisionSensorSamplePlugin: Detected PointSetItem \"RangeSensorPoints\"");
                    visionSensorSampleRTC->setPointSetFromRangeSensor(pointSetFromRangeSensor);
                }
            }
        }
Esempio n. 16
0
void ChatView::renderSubject(const MessageView &mv)
{
	appendText(QString(useMessageIcons_?"<img src=\"icon:log_icon_info\" />":"") + "<b>" + tr("Subject:") + "</b> " + QString("%1").arg(mv.formattedUserText()));
}
Esempio n. 17
0
void ViewManager::restoreViews(ArchivePtr archive, const std::string& key, ViewManager::ViewStateInfo& out_viewStateInfo)
{
    MessageView* mv = MessageView::instance();

    typedef map<ViewInfo*, vector<View*> > ViewsMap;
    ViewsMap remainingViewsMap;
        
    Listing* viewList = archive->findListing(key);
    
    if(viewList->isValid() && !viewList->empty()){

        vector<ViewState>* viewsToRestoreState = new vector<ViewState>();        
        out_viewStateInfo.data = viewsToRestoreState;
        int id;
        string moduleName;
        string className;
        string instanceName;
        
        for(int i=0; i < viewList->size(); ++i){
            Archive* viewArchive = dynamic_cast<Archive*>(viewList->at(i)->toMapping());
            if(viewArchive){
                bool isHeaderValid =
                    viewArchive->read("id", id) &&
                    viewArchive->read("plugin", moduleName) &&
                    viewArchive->read("class", className);
            
                if(isHeaderValid){
                    View* view = 0;
                    if(!viewArchive->read("name", instanceName)){
                        view = getOrCreateView(moduleName, className);
                    } else {
                        // get one of the view instances having the instance name, or create a new instance.
                        // Different instances are assigned even if there are instances with the same name in the archive
                        ViewInfo* info = findViewInfo(moduleName, className);
                        if(info){
                            vector<View*>* remainingViews;
                            ViewsMap::iterator p = remainingViewsMap.find(info);
                            if(p != remainingViewsMap.end()){
                                remainingViews = &p->second;
                            } else {
                                remainingViews = &remainingViewsMap[info];
                                InstanceInfoList& instances = info->instances;
                                remainingViews->reserve(instances.size());
                                InstanceInfoList::iterator q = instances.begin();
                                if(info->hasDefaultInstance() && q != instances.end()){
                                    ++q;
                                }
                                while(q != instances.end()){
                                    remainingViews->push_back((*q++)->view);
                                }
                            }
                            for(vector<View*>::iterator q = remainingViews->begin(); q != remainingViews->end(); ++q){
                                if((*q)->name() == instanceName){
                                    view = *q;
                                    remainingViews->erase(q);
                                    break;
                                }
                            }
                            if(!view){
                                if(!info->isSingleton() || info->instances.empty()){
                                    view = info->createView(instanceName, true);
                                } else {
                                    mv->putln(MessageView::ERROR,
                                              boost::format(_("A singleton view \"%1%\" of the %2% type cannot be created because its singleton instance has already been created."))
                                              % instanceName % info->className());
                                }
                            }
                        }
                    }
                    if(view){
                        archive->registerViewId(view, id);
                        
                        ArchivePtr state = viewArchive->findSubArchive("state");
                        if(state->isValid()){
                            state->inheritSharedInfoFrom(*archive);
                            viewsToRestoreState->push_back(ViewState(view, state));
                        }

                        if(viewArchive->get("mounted", false)){
                            mainWindow->viewArea()->addView(view);
                        }
                    }
                }
            }
        }
    }
}
Esempio n. 18
0
static BodyCustomizerHandle create(BodyHandle bodyHandle, const char* modelName)
{
    HoseCustomizer* customizer = 0;

    int jointIndices[53];
    jointIndices[ 0] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_hose0");
	jointIndices[ 1] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_1st2L11WD");
	jointIndices[ 2] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L11WD2L11ND");
    jointIndices[ 3] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L11ND2L12WD");
	jointIndices[ 4] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L12WD2L12ND");
	jointIndices[ 5] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L12ND2L13WD");
    jointIndices[ 6] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L13WD2L13ND");
	jointIndices[ 7] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L13ND2S1WD");
	jointIndices[ 8] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_S1WD2S1ND");
    jointIndices[ 9] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_S1ND2L21WD");
	jointIndices[10] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L21WD2L21ND");
	jointIndices[11] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L21ND2L22WD");
    jointIndices[12] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L22WD2L22ND");
	jointIndices[13] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L22ND2L23WD");
	jointIndices[14] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L23WD2L23ND");
    jointIndices[15] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L23ND2S2WD");
	jointIndices[16] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_S2WD2S2ND");
	jointIndices[17] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_S2ND2L31WD");
    jointIndices[18] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L31WD2L31ND");
	jointIndices[19] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L31ND2L32WD");
	jointIndices[20] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L32WD2L32ND");
    jointIndices[21] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L32ND2L33WD");
	jointIndices[22] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L33WD2L33ND");
	jointIndices[23] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L33ND2S3WD");
    jointIndices[24] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_S3WD2S3ND");
	jointIndices[25] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_S3ND2L41WD");
	jointIndices[26] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L41WD2L41ND");
    jointIndices[27] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L41ND2L42WD");
	jointIndices[28] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L42WD2L42ND");
	jointIndices[29] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L42ND2L43WD");
    jointIndices[30] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L43WD2L43ND");
	jointIndices[31] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L43ND2S4WD");
	jointIndices[32] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_S4WD2S4ND");
    jointIndices[33] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_S4ND2L51WD");
	jointIndices[34] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L51WD2L51ND");
	jointIndices[35] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L51ND2L52WD");
    jointIndices[36] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L52WD2L52ND");
	jointIndices[37] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L52ND2L53WD");
	jointIndices[38] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L53WD2L53ND");
	jointIndices[39] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L53ND2S5WD");
	jointIndices[40] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_S5WD2S5ND");
	jointIndices[41] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_S5ND2L61WD");
	jointIndices[42] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L61WD2L61ND");
	jointIndices[43] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L61ND2L62WD");
	jointIndices[44] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L62WD2L62ND");
	jointIndices[45] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L62ND2L63WD");
	jointIndices[46] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L63WD2L63ND");
	jointIndices[47] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L63ND2S6WD");
	jointIndices[48] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_S6WD2S6ND");
	jointIndices[49] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_S6ND2L71WD");
	jointIndices[50] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L71WD2L71ND");
	jointIndices[51] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L71ND2L72WD");
	jointIndices[52] = bodyInterface->getLinkIndexFromName(bodyHandle, "hinge_L72WD2L72ND");

    string name(modelName);

    MessageView* mv;
    mv = MessageView::instance();
    mv->putln("The hose customizer is running");

    if (name == "HOSE") {
        customizer = new HoseCustomizer;
        customizer->bodyHandle = bodyHandle;

		for (int i = 0; i < 53; i++) {
			
			int jointIndex = jointIndices[i];
			JointValSet& jointValSet = customizer->jointValSet[i];

			if (jointIndex >= 0) {
				jointValSet.q_ptr = bodyInterface->getJointValuePtr(bodyHandle, jointIndex);
				jointValSet.dq_ptr = bodyInterface->getJointVelocityPtr(bodyHandle, jointIndex);
				jointValSet.u_ptr = bodyInterface->getJointForcePtr(bodyHandle, jointIndex);
			}
			else {
				jointValSet.q_ptr = NULL;
				jointValSet.dq_ptr = NULL;
				jointValSet.u_ptr = NULL;
			}
		}
    }
    
    return static_cast<BodyCustomizerHandle>(customizer);
}