Esempio n. 1
0
bool PlayerGst::open(QUrl fname, long start, long length)
{
	sync_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
	if(fname.toString().toLower().startsWith("file://")/*fname.toLocalFile().size()*/) {
		//g_object_set (G_OBJECT (l_src), "location", (const char*)fname.toLocalFile().toLocal8Bit(), NULL);
		setLink(1, fname);
	} else if(fname.toString().toLower().startsWith("http://")) {
		//g_object_set (G_OBJECT (http_src), "location", (const char*)fname.toString().toLocal8Bit(), NULL);
		setLink(2, fname);
	} else if(fname.toString().toLower().startsWith("mms://")) {
		QMessageBox::warning(0, "Error", "The mms protocol not supported now");
		return false;
	}

	//g_object_set (player, "uri", (const char*)fname.toString().toLocal8Bit(), NULL);
	sync_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
	//gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
	Gstart = start;
	Gstart *= 1000000000 / 75;
	Glength = length;
	Glength *= 1000000000 / 75;
	gint64 all=0;
	GstFormat fmt = GST_FORMAT_TIME;
	//while(!gst_element_query_duration(pipeline, &fmt, &all)) {}  // don't do that again, bad boy
	if(gst_element_query_duration(pipeline, &fmt, &all)) { 
		if(!Glength)
			Glength = all - Gstart;
	} else {
		Gstart = Glength = 0;
	}
	//QMessageBox::information(0, "", QString("start = %1, length = %2, stream = %3").arg(QString::number((qlonglong)Gstart), QString::number((qlonglong)Glength), QString::number((qlonglong)all)));
    return true;
}
Esempio n. 2
0
Chirp::Chirp(bool hinterested, bool client, Link *link)
{
    m_link = NULL;
    m_errorCorrected = false;
    m_sharedMem = false;
    m_buf = NULL;
    m_bufSave = NULL;

    m_maxNak = CRP_MAX_NAK;
    m_retries = CRP_RETRIES;
    m_headerTimeout = CRP_HEADER_TIMEOUT;
    m_dataTimeout = CRP_DATA_TIMEOUT;
    m_idleTimeout = CRP_IDLE_TIMEOUT;
    m_sendTimeout = CRP_SEND_TIMEOUT;
    m_call = false;
    m_connected = false;
    m_hinformer = false;
    m_hinterested = hinterested;
    m_client = client;

    m_procTableSize = CRP_PROCTABLE_LEN;
    m_procTable = new (std::nothrow) ProcTableEntry[m_procTableSize];
    memset(m_procTable, 0, sizeof(ProcTableEntry)*m_procTableSize);

    if (link)
        setLink(link);
}
Esempio n. 3
0
LinkLabel::LinkLabel(const QString &title, const QString &icon, LinkLook *look, int hAlign, int vAlign,
                     QWidget *parent, Qt::WFlags f)
        : QFrame(parent, f), m_isSelected(false), m_isHovered(false), m_look(0)
{
    initLabel(hAlign, vAlign);
    setLink(title, icon, look);
}
Esempio n. 4
0
/**
 *  @brief Add a link from this object to another with the specified ID
 *  @details Only two links are allowed; if both slots are already filled,
 *  an exception is thrown
 * 
 *  @param id the ID of the object that is linked to this object
 *  @throws Exception if two links are already present
 */
void Linkable::addLink(int id){
	int ix = getLinkIx(INVALID_ID);	// Try to find an empty slot
	if(ix != INVALID_ID){
		setLink(ix, id);	// This function will also check for duplicate ID in the link slots
	}else{
		throw Exception("linkable::addLink: Two links already present, cannot add a new one");
	}
}//===========================================
Esempio n. 5
0
ChirpMon::ChirpMon(Interpreter *interpreter, USBLink *link) : m_mutex(QMutex::Recursive)
{
    m_hinterested = true;
    m_client = true;
    m_interpreter = interpreter;

    if (setLink(link)<0)
        throw std::runtime_error("Unable to connect to device.");
}
Esempio n. 6
0
void *PointSet::read(DOMNode *node) {
	unsigned int i; 				// variable to counter
	DOMNodeList *children;			// variable to hold the node children
	
	DOMNamedNodeMap *attributes;	// variable to hold the node attributes

	attributes = node->getAttributes();
	for (i = 0; i < attributes->getLength(); i++) {
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "DEF")) {
			setLink(XMLString::transcode(attributes->item(i)->getNodeValue()),this);
		}// else
		//if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "USE")) {
		//	return(getLink(XMLString::transcode(attributes->item(i)->getNodeValue())));
		//} 
	}

	children = node->getChildNodes();
	if (children != NULL) {
		for (i = 0; i < children->getLength (); i++) {			
			if (!strcmp (XMLString::transcode(children->item(i)->getNodeName()),"Coordinate")) {
				coordinate = Coordinate::get(children->item(i));
				coordinateNumber = coordinate->getNumberOfElements();
			} else
			if (!strcmp (XMLString::transcode(children->item(i)->getNodeName()),"Color")) {
				color = Color::get(children->item(i));
				colorNumber = color->getNumberOfElements();
			} 
		}
	}
	
	#ifdef DEBUG
		float sizes[2];
		float step;
		glGetFloatv(GL_POINT_SIZE_RANGE,sizes);
		glGetFloatv(GL_POINT_SIZE_GRANULARITY,&step);
		cout << "Max and Min point size " << sizes[0] << " , " << sizes[1] << " Granularity " << step << endl;
	#endif
	
	if(colorNumber) {
		if(colorNumber==3) {
			cout << "Three colors selected" << endl;
		} else
		if(colorNumber!=coordinateNumber) {
			cerr << "Color and coordinate not matching" << endl;
		}
	}

		
	#ifdef DEBUG
		cout << "Coordinate Number " << coordinateNumber << endl;
		cout << "Color Number " << colorNumber << endl;
	#endif

	return(NULL);
	
}
void QFacebookGraphUser::requestDone(bool ok) {
    if(ok)
    {
        QVariantMap map = result();
        QVariantMap::const_iterator i;
        for (i = map.constBegin(); i != map.constEnd(); ++i)
        {
            if(i.key() == "name" )
                setName(i.value().toString());
            if(i.key() == "hometown")
                setHometown(i.value().toMap());
            if(i.key() == "last_name")
                setLastName(i.value().toString());
            if(i.key() == "birthday")
                setBirthday(i.value().toString());
            if(i.key() == "education") {
                QFacebookGraphCommonEducationModel *edu = new QFacebookGraphCommonEducationModel();
                for (int j = 0; j < i.value().toList().size(); ++j) {
                    edu->populate(i.value().toList().at(j).toMap());
                    m_education.append(edu);
                    edu = new QFacebookGraphCommonEducationModel();
                }
            }
            if(i.key() == "work") {
                QFacebookGraphCommonWorkModel *work = new QFacebookGraphCommonWorkModel();
                for (int j = 0; j < i.value().toList().size(); ++j) {
                    work->populate(i.value().toList().at(j).toMap());
                    m_work.append(work);
                    work = new QFacebookGraphCommonWorkModel();
                }
            }
            if(i.key() == "first_name")
                setFirstName(i.value().toString());
            if(i.key() == "gender")
                setGender(i.value().toString());
            if(i.key() == "id")
                setFbid(i.value().toString());
            if(i.key() == "link")
                setLink(i.value().toString());
            if(i.key() == "locale")
                setLocale(i.value().toString());
            if(i.key() == "location")
                setLocation(i.value().toMap());
            if(i.key() == "middle_name")
                setMiddleName(i.value().toString());
            if(i.key() == "timezone")
                setTimezone(i.value().toLongLong());
            if(i.key() == "updated_time")
                setUpdatedtime(i.value().toString());
            if(i.key() == "verified")
                setVerified(i.value().toBool());
        }

        emit modelPopulated();
    }
}
Esempio n. 8
0
 void updateLink()
 {
     ChannelListWidget *tw = static_cast<ChannelListWidget *>(treeWidget());
     if (tw->minimumItemHeight())
         setSizeHint(0, QSize(1, tw->minimumItemHeight()));
     if (tw->linkEnabled()) {
         bool enable = false;
         switch (tw->linkType()) {
         case ChannelListWidget::ChannelLink:
             enable = m_channel->isPlayable();
             break;
         case ChannelListWidget::ContactLink:
             enable = m_channel->hasContactUrl();
             break;
         }
         setLink(ChannelListWidget::Name, enable);
     } else {
         setLink(ChannelListWidget::Name, false);
     }
 }
Esempio n. 9
0
WAnchor::WAnchor(const WLink& link, WContainerWidget *parent)
  : WContainerWidget(parent),
    text_(0),
    image_(0),
    target_(TargetSelf),
    changeInternalPathJS_(0)
{
  setInline(true);

  setLink(link);
}
Esempio n. 10
0
void
FormComboBox::setCfg( const Cfg::ComboBox & c )
{
	setObjectId( c.objectId() );
	setLink( c.link() );
	setObjectPen( Cfg::fromPen( c.pen() ), false );
	d->setRect( QRectF( c.pos().x(), c.pos().y(),
		c.size().width(), c.size().height() ) );

	update();
}
CParticleLinkDialog::CParticleLinkDialog(CSkeletonTreeModel *model, QWidget *parent)
	: QDockWidget(parent)
{
	_ui.setupUi(this);

	qobject_cast<QMainWindow *>(parent)->addDockWidget(Qt::RightDockWidgetArea, this);

	_ui.treeView->setModel(model);

	connect(model, SIGNAL(modelReset()), this, SLOT(resetModel()));
	connect(_ui.linkPushButton, SIGNAL(clicked()), this, SLOT(setLink()));
	connect(_ui.unlinkPushButton, SIGNAL(clicked()), this, SLOT(setUnlink()));
	connect(_ui.treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(clickedItem(QModelIndex)));
}
Esempio n. 12
0
// triIJK should be an extant tri; otherTri doesn't need to be.
void Triangulation::setLink(FIndex triIJK, int edgeIdx, FIndex otherTri) {
	if (!isLinkedTri(otherTri)) {
		return;
	}

	// find the index of i,j,k
	const unique_ptr<LinkedTriangle>& ltriIJK = linkedTriangles_[triIJK - 1];
	int iIdx, jIdx, kIdx;
	ltriIJK->tri_.get(iIdx, jIdx, kIdx);


	if (edgeIdx == 0) {
		// otherTri shares edge IJ
		const unique_ptr<LinkedTriangle>& ltriXJI =
			linkedTriangles_[otherTri - 1];
		int edgeIdxJI, edgeIdxIX, edgeIdxXJ;
		ltriXJI->getEdgeIndices(jIdx, edgeIdxJI, edgeIdxIX, edgeIdxXJ);

		setLink(triIJK, edgeIdx, otherTri, edgeIdxJI);
	} else if (edgeIdx == 1) {
		// otherTri shares edge JK
		const unique_ptr<LinkedTriangle>& ltriXKJ =
			linkedTriangles_[otherTri - 1];
		int edgeIdxKJ, edgeIdxJX, edgeIdxXK;
		ltriXKJ->getEdgeIndices(kIdx, edgeIdxKJ, edgeIdxJX, edgeIdxXK);

		setLink(triIJK, edgeIdx, otherTri, edgeIdxKJ);
	} else if (edgeIdx == 2) {
		// otherTri shares edge KI
		const unique_ptr<LinkedTriangle>& ltriXIK =
			linkedTriangles_[otherTri - 1];
		int edgeIdxIK, edgeIdxKX, edgeIdxXI;
		ltriXIK->getEdgeIndices(iIdx, edgeIdxIK, edgeIdxKX, edgeIdxXI);

		setLink(triIJK, edgeIdx, otherTri, edgeIdxIK);
	}
}
Esempio n. 13
0
Inline *Inline::get(DOMNode *node) {
unsigned int i; 				// variable to counter
	DOMNamedNodeMap *attributes;	// variable to hold the node attributes
	
	char DEF2[256];					// temporary variable to hold the DEF name
	strcpy(DEF2,"");					// reseting the variable
	
	Inline *inline2 = NULL;					// temporary variable
	
	attributes = node->getAttributes();
	for (i = 0; i < attributes->getLength(); i++) {
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "DEF")) {
			strcpy(DEF2,XMLString::transcode (attributes->item(i)->getNodeValue()));
			break;
		} else 
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "USE")) {
			
			inline2 = (Inline *)getLink(XMLString::transcode(attributes->item(i)->getNodeValue()));
			
			if( inline2->ami("Inline") ) {
				cout << "USE of a different DEF type" << endl;
			}
			
			return(inline2);
			
		} 
	}
		
	
	// verificar se o USE ta retornando NULL
	
	inline2 = new Inline();
	if(inline2==NULL) { 
		cerr << "Error on getting Group" << endl;
	}
	
	if(strcmp(DEF2,"")) {
		#ifdef DEBUG3
			cout << "DEF : " << DEF2 << endl;
		#endif
		strcpy(inline2->DEF,DEF2);
		setLink(inline2->DEF,inline2);			
	}
	
	inline2->read(node);
	
	return inline2;

}
/**
 *  This creates a link from this object to 'other' of the given 'linkType'.
 *
 *  @param linkType         The type of the link.
 *  @param other            The node to link to.
 *
 *  @return                 The link between this and other.
 */
ChunkLinkPtr EditorChunkItemLinkable::createLink(
	ChunkLink::Direction linkType, EditorChunkItemLinkable* other)
{
	MF_ASSERT( other );
	MF_ASSERT( other != this );

	MF_ASSERT( chunkItem()->pOwnSect() );
	MF_ASSERT( other->chunkItem()->pOwnSect() );

    ChunkLinkPtr result = NULL;

	switch (linkType)
	{
	case ChunkLink::DIR_NONE:
		if (isLinkedTo( other->guid() ))
			removeLink( other );
		if (other->isLinkedTo( guid() ))
			other->removeLink( this );
		result = NULL;
		break;
	case ChunkLink::DIR_START_END:
		result = setLink( other, true );
		other->setLink( this, false );
		break;
	case ChunkLink::DIR_END_START:
		result = setLink( other, false );
		other->setLink( this, true );
		break;
	case ChunkLink::DIR_BOTH:
		result = setLink( other, true );
		other->setLink( this, true );
		break;
	}

    return result;
}
Esempio n. 15
0
WordAlignment::WordAlignment(uint nsrc, uint ntgt, const std::string &alignment) :
		nsrc_(nsrc), ntgt_(ntgt), matrix_(nsrc * ntgt) {
	std::istringstream is(boost::trim_copy(alignment));
	for(;;) {
		std::string ss, st;
		getline(is, ss, '-');
		getline(is, st, ' ');
		if(!is)
			break;

		uint s = boost::lexical_cast<uint>(ss);
		uint t = boost::lexical_cast<uint>(st);
		setLink(s, t);
	}
}
Esempio n. 16
0
void
FormCheckBox::setCfg( const Cfg::CheckBox & c )
{
	d->m_checked = c.isChecked();

	setObjectId( c.objectId() );
	setLink( c.link() );
	setObjectPen( Cfg::fromPen( c.pen() ), false );

	d->setRect( QRectF( c.pos().x(), c.pos().y(),
		c.width(), c.size().height() ) );

	setText( c.text() );

	update();
}
TerminalConsole::TerminalConsole(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::TerminalConsole),
    m_consoleMode(APM)
{
    ui->setupUi(this);

    // create the cosole and add it to the centralwidget
    m_console = new Console;
    m_console->setEnabled(false);

    m_statusBar = new QStatusBar;

    QLayout* layout = ui->terminalGroupBox->layout();
    layout->addWidget(m_console);
    layout->addWidget(m_statusBar);

    m_serial = new QSerialPort(this);
    m_settingsDialog = new SettingsDialog;

    ui->connectButton->setEnabled(true);
    ui->disconnectButton->setEnabled(false);
    ui->settingsButton->setEnabled(true);


    addBaudComboBoxConfig();
    fillPortsInfo(*ui->linkComboBox);

    loadSettings();

    if (m_settings.name == "") {
        setLink(ui->linkComboBox->currentIndex());
    } else {
        ui->linkComboBox->setCurrentIndex(0);
    }

    addConsoleModesComboBoxConfig();

    initConnections();
}
void ColladaBodyLoaderImpl::buildLinks(DaeNode* extNode, DaeNode* parentNode, Link* parentLink, Body& body, int& jointId)
{
    bool duplicate; Link* link = NULL;


    if (DaeLink* extLink = dynamic_cast<DaeLink*>(extNode)) {
        // It will record the link.
        // The link and joint is one in two. 
        // In addition, link will be child relationship (except root) in the parent joint always.
        setLink(extNode, parentLink, body);
        setMass(extLink, parentLink);
       
        for (DaeLinkChildren::iterator iterl = extLink->children.begin(); iterl != extLink->children.end(); iterl++) {
            DaeNode* extJoint = parser->findJointByLink(*iterl);
            buildLinks(extJoint, extLink, parentLink, body, jointId);
        }

    } else
        if (DaeJoint* extJoint = dynamic_cast<DaeJoint*>(extNode)) {
            if (!parentLink) {
                throwException((format(_("joint node can not be root link"))).str());
            }
            // It will record the link.
            link = createLink(body, static_cast<DaeJoint*>(extNode)->name, &duplicate);
            // The joint and link is one in the link.
            setJoint(extNode, parentNode, link, jointId);
            parentLink->appendChild(link);

            for (DaeJointChildren::iterator iterj = extJoint->children.begin(); iterj != extJoint->children.end(); iterj++) {
                // Joint is same as link. (Comprehension)
                DaeNode* extLink = parser->findLinkByJoint(*iterj);
                buildLinks(extLink, extJoint, link, body, jointId);
            }

        } else {
            return;
        }
}
Esempio n. 19
0
void WPushButton::setResource(WResource *resource)
{
  setLink(WLink(resource));
}
Esempio n. 20
0
void
FormText::setCfg( const Cfg::Text & c )
{
	setPlainText( QString() );

	QFont f = font();
	QTextCharFormat fmt = textCursor().charFormat();
	QTextBlockFormat b = textCursor().blockFormat();

	foreach( const Cfg::TextStyle & s, c.text() )
	{
		if( s.style().contains( Cfg::c_normalStyle ) )
		{
			f.setWeight( QFont::Normal );
			f.setItalic( false );
			f.setUnderline( false );

			fmt.setFontWeight( QFont::Normal );
			fmt.setFontItalic( false );
			fmt.setFontUnderline( false );
		}
		else
		{
			if( s.style().contains( Cfg::c_boldStyle ) )
			{
				f.setWeight( QFont::Bold );
				fmt.setFontWeight( QFont::Bold );
			}
			else
			{
				f.setWeight( QFont::Normal );
				fmt.setFontWeight( QFont::Normal );
			}

			if( s.style().contains( Cfg::c_italicStyle ) )
			{
				f.setItalic( true );
				fmt.setFontItalic( true );
			}
			else
			{
				f.setItalic( false );
				fmt.setFontItalic( false );
			}

			if( s.style().contains( Cfg::c_underlineStyle ) )
			{
				f.setUnderline( true );
				fmt.setFontUnderline( true );
			}
			else
			{
				f.setUnderline( false );
				fmt.setFontUnderline( false );
			}
		}

		Cfg::initBlockFormat( b, s );

		f.setPointSize( s.fontSize() );

		fmt.setFontPointSize( s.fontSize() );

		setFont( f );

		QTextCursor cursor = textCursor();
		cursor.movePosition( QTextCursor::End );
		cursor.setCharFormat( fmt );
		cursor.setBlockFormat( b );
		cursor.insertText( s.text() );
		setTextCursor( cursor );
	}

	document()->clearUndoRedoStacks();

	setObjectId( c.objectId() );

	setTextWidth( c.textWidth() );

	setPos( QPointF( c.pos().x(), c.pos().y() ) );

	setLink( c.link() );

	QRectF r = boundingRect();
	r.moveTo( pos() );

	d->m_proxy->setRect( r );
}
Esempio n. 21
0
void WAnchor::setResource(WResource *resource)
{
  setLink(WLink(resource));
}
Esempio n. 22
0
void WAnchor::setRefInternalPath(const std::string& path)
{
  setLink(WLink(WLink::InternalPath, path));
}
Esempio n. 23
0
void WAnchor::setRef(const std::string& url)
{
  setLink(WLink(WLink::Url, url));
}
Esempio n. 24
0
void *IndexedLineSet::read(DOMNode *node) {

	#ifdef DEBUG1
		cout << "Reading IndexedLineSet" << endl;
	#endif
	
	unsigned int i; 				// variable to counter
	DOMNamedNodeMap *attributes;	// variable to hold the node attributes
	DOMNodeList *children;			// variable to hold the node children
	char *ctemp;					// temporary variable

	
	#ifndef XERCES  // actualy is the xerces parser 
		char *ptrptr;
	#endif
	
	char* message;
	
	attributes = node->getAttributes();
	for (i = 0; i < attributes->getLength(); i++) {		
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "DEF")) {
			strcpy(this->DEF,XMLString::transcode (attributes->item(i)->getNodeValue()));
			setLink(XMLString::transcode(attributes->item(i)->getNodeValue()),this);
		} else
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "USE")) {
			return(getLink(XMLString::transcode(attributes->item(i)->getNodeValue())));
		} else
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()),"colorPerVertex")) {
			if (!strcasecmp(XMLString::transcode(attributes->item(i)->getNodeValue()),"TRUE")) {
				*this->colorPerVertex=true;
			} else {
				*this->colorPerVertex=false;
			}
		} else
		if ( !strcmp(XMLString::transcode (attributes->item(i)->getNodeName()) , "coordIndex")) {
			message = XMLString::transcode(attributes->item(i)->getNodeValue());
			ctemp = strtok(message,", \n");
			while (ctemp != NULL) {
				coordIndex[f++] = atoi(ctemp);
				ctemp = strtok(NULL,", \n");
				if(this->f>=Minimum_MFVec3f) { // corigir
					cerr << "Error IndexedLineSet bigger than buffer" << endl;
					return(NULL);;
				}				
			}
			if(coordIndex[f-1]!=-1) {
				coordIndex[f++]=-1;
			}
		} else
		if ( !strcmp(XMLString::transcode (attributes->item(i)->getNodeName()) , "colorIndex")) {

			#ifdef XERCES  // actualy is the xerces parser 
				
				XMLStringTokenizer *tok = new XMLStringTokenizer( attributes->item(i)->getNodeValue() , XMLString::transcode(", \t\n\r\f") );
			
				while(tok->hasMoreTokens()) {
					x3d::x3DValues->MFInt32[this->counterColor++] = atoi(XMLString::transcode(tok->nextToken()));
				
					if(x3d::x3DValues->MFInt32[this->counterColor] < -1) {
						cout << "Warning value of CoordIndex outside the range" << endl;
					}
					if(this->counterColor>=Minimum_MFInt32) {
						cerr << "Error coordIndex bigger than buffer" << endl;
						return(NULL);;
					}
			
				}	
			
				delete tok;
				
			
			#else
			
				if(XMLString::stringLen(attributes->item(i)->getNodeValue()) >= Size_X3D_Message) {
					cout << " Message exced the maximun size " << endl;
				}
				if(!XMLString::transcode(attributes->item(i)->getNodeValue(),x3d::message,Size_X3D_Message)) {
					cout << " Message exced the maximun size " << endl;
				}
				ctemp = strtok_r(x3d::message,", \n",&ptrptr);
				while (ctemp != NULL) {
					x3d::x3DValues->MFInt32[this->counterColor++] = atoi(ctemp);
					if(x3d::x3DValues->MFInt32[this->counterColor] < -1) {
						cout << "Warning value of ColorIndex outside the range" << endl;
					}
					ctemp = strtok_r(NULL,", \n",&ptrptr);
					if(this->counterColor>=Minimum_MFInt32) {
						cerr << "Error colorIndex bigger than buffer" << endl;
						return(NULL);;
					}
				}

			#endif


			if(x3d::x3DValues->MFInt32[this->counterColor-1]!=-1) {
				x3d::x3DValues->MFInt32[this->counterColor++]=-1;
			}
			this->colorIndex = new int[this->counterColor];
			//this->set_colorIndex = this->colorIndex;				// just a copy
			if( colorIndex==NULL ) 
				cerr << "Memory alocation problem at indexedFaceSet" << endl;
			for(int indexCounter=0;indexCounter < this->counterColor;indexCounter++) {
				colorIndex[indexCounter] = x3d::x3DValues->MFInt32[indexCounter];
			}
	
		}
	}

	#ifdef DEBUG1
		cout << "Reading children" << endl;
	#endif
	
	children = node->getChildNodes ();
	if (children != NULL) {
		for (i = 0; i < children->getLength (); i++) {			
			if (!strcmp (XMLString::transcode(children->item(i)->getNodeName()),"Coordinate")) {
				coordinate = Coordinate::get(children->item(i));
			} else
			if (!strcmp (XMLString::transcode(children->item(i)->getNodeName()),"Color")) {
				color = Color::get(children->item(i));
			}
		}
	}
	
	#ifdef DEBUG1
		cout << "Leaving Reding IndexedLineSet" << endl;
	#endif
	return(NULL);
	
}
Esempio n. 25
0
void WPushButton::setRef(const std::string& url)
{
  setLink(WLink(url));
}
Esempio n. 26
0
void *Color::read(DOMNode *node) {

	unsigned int i; 		// variable to counter
	DOMNamedNodeMap *attributes;	// variable to hold the node attributes
	
	#ifndef XERCES
		char *ctemp;			// temporary variable	
		char *ptrptr;
	#endif
	
	attributes = node->getAttributes();
	for (i = 0; i < attributes->getLength(); i++) {
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "DEF")) {
			setLink(XMLString::transcode(attributes->item(i)->getNodeValue()),this);
		} else
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "USE")) {
			return(getLink(XMLString::transcode(attributes->item(i)->getNodeValue())));
		} else
		if ( !strcmp(XMLString::transcode(attributes->item(i)->getNodeName()), "color")) {

			#ifdef XERCES  // actualy is the xerces parser 
			
				XMLStringTokenizer *tok = new XMLStringTokenizer( attributes->item(i)->getNodeValue() , XMLString::transcode(", \t\n\r\f") );
			
				while(tok->hasMoreTokens()) {
					x3d::x3DValues->MFColor[this->numberOfElements++] = atof(XMLString::transcode(tok->nextToken()));
					#ifdef DEGUB
						cout << "Coordinate [ " << this->numberOfElements-1 << " :" << x3d::x3DValues->MFVec3f[this->numberOfElements-1] << endl;
					#endif
					if(this->numberOfElements>=Minimum_MFVec3f) {
						cerr << "Error Coordinates bigger than buffer" << endl;
						return(NULL);
					}	
				}	
			
				delete tok;
				
			#else

				if(XMLString::stringLen(attributes->item(i)->getNodeValue()) >= Size_X3D_Message) {
					cout << " Message exced the maximun size " << endl;
				}
				if(!XMLString::transcode(attributes->item(i)->getNodeValue(),x3d::message,Size_X3D_Message)) {
					cout << " Message exced the maximun size " << endl;
				}
				ctemp = strtok_r(x3d::message,", \n",&ptrptr);
				while (ctemp != NULL) {
					x3d::x3DValues->MFColor[this->numberOfElements++] = atof(ctemp);
					ctemp = strtok_r(NULL,", \n",&ptrptr);
					#ifdef DEGUB
						cout << "Coordinate [ " << f-1 << " :" << x3d::x3DValues->MFColor[f-1] << endl;
					#endif
					if(this->numberOfElements>=Minimum_MFColor) {
						cerr << "Error Colors bigger than buffer" << endl;
						return(NULL);;
					}
				}

			#endif
		
		}
	}

	this->value->aloc(numberOfElements);
	
	unsigned int g;							// counter
	
	for(g=0;g<numberOfElements;g++){
		value->data[g]=x3d::x3DValues->MFColor[g];
	}
	
	return(NULL);

}
Esempio n. 27
0
void *NurbsCurve::read(DOMNode *node) {
	unsigned int i; 				//* variable to counter
	DOMNamedNodeMap *attributes;	//* variable to hold the node attributes
	
	char *ctemp;					//* temporary variable
	
	attributes = node->getAttributes();
	for (i = 0; i < attributes->getLength(); i++) {		
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "DEF")) {
			strcpy(this->DEF,XMLString::transcode (attributes->item(i)->getNodeValue()));
			setLink(XMLString::transcode(attributes->item(i)->getNodeValue()),this);
		} else
		if (!strcmp(XMLString::transcode(attributes->item(i)->getNodeName()) , "USE")) {
			return(getLink(XMLString::transcode(attributes->item(i)->getNodeValue())));
		}
	}
		
		
		
 	for (i = 0; i < attributes->getLength(); i++) {		
		if ( !strcmp(XMLString::transcode (attributes->item(i)->getNodeName()) , "tessellation")) {
		} else
		if ( !strcmp(XMLString::transcode (attributes->item(i)->getNodeName()) , "containerField")) {
		} else
		if ( !strcmp(XMLString::transcode (attributes->item(i)->getNodeName()) , "order")) {
		} else
		if ( !strcmp(XMLString::transcode (attributes->item(i)->getNodeName()) , "controlPoint")) {
			numberOfPoints=0;
			ctemp = strtok(XMLString::transcode (attributes->item(i)->getNodeValue())," ");
			while (ctemp != NULL) {
				points[numberOfPoints][0] = atof(ctemp);
				ctemp = strtok(NULL," ");
				points[numberOfPoints][1] = atof(ctemp);
				ctemp = strtok(NULL," ");
				points[numberOfPoints++][2] = atof(ctemp);
				ctemp = strtok(NULL," ");
			
				#ifdef DEBUG
					cout << "Points : " << points[numberOfPoints-1][0] << " , " << 
										   points[numberOfPoints-1][1] << " , " << 
										   points[numberOfPoints-1][2] << endl;
				#endif
			
			}
		}
	}
	

	#ifdef DEBUG
		cout << "Number of Points : " << numberOfPoints << endl;
	#endif

	controlPoint = new float[3*numberOfPoints];

	unsigned int f;
	for(f=0;f<routeStruct::routeCount;f++) {
		if (!strcmp (x3d::my_x3d->routeTable[f]->toNode,DEF)) {
			if(!strcmp(x3d::my_x3d->routeTable[f]->toField,"set_controlPoint")) {
				if((*x3d::my_x3d->routeTable[f]->field2)==NULL) {
					(*x3d::my_x3d->routeTable[f]->field2) = new float[3*numberOfPoints];
				}
				delete controlPoint;
				controlPoint = (float *)(*x3d::my_x3d->routeTable[f]->field2);
			}
		}
	}
	

	return(NULL);
	
}
Esempio n. 28
0
void LinkDisplay::setLink(const QString &title, const QString &icon, LinkLook *look, const QFont &font)
{
    setLink(title, icon, m_preview, look, font);
}