Exemplo n.º 1
0
Data::OsgNode::OsgNode( qlonglong id, QString name, Data::Type* type, Data::Graph* graph, float scaling, osg::Vec3f position )
	:DbNode( id,name,type,graph,scaling )
{
	this->mTargetPosition = position;
	this->currentPosition = position * Util::ApplicationConfig::get()->getValue( "Viewer.Display.NodeDistanceScale" ).toFloat();

	this->setBall( NULL );
	this->setParentBall( NULL );


	insertChild( INDEX_LABEL, createLabel( this->type->getScale(), labelText ) , false );
	insertChild( INDEX_SQUARE, createNodeSquare( this->scale, OsgNode::createStateSet( this->type ) ) , false );
	insertChild( INDEX_SPHERE, createNodeSphere( this->scale, OsgNode::createStateSet( this->type ) ), false );
	setValue( graph->getNodeVisual(), true );

	this->square = createNode( this->scale * 4, OsgNode::createStateSet( this->type ) );
	this->focusedSquare = createNode( this->scale * 16, OsgNode::createStateSet( this->type ) );
//    this->label = createLabel( this->type->getScale(), labelText );
	this->force = osg::Vec3f();
	this->velocity = osg::Vec3f( 0,0,0 );
	this->selected = false;

	this->usingInterpolation = true;

	//nastavenie farebneho typu
	float r = type->getSettings()->value( "color.R" ).toFloat();
	float g = type->getSettings()->value( "color.G" ).toFloat();
	float b = type->getSettings()->value( "color.B" ).toFloat();
	float a = type->getSettings()->value( "color.A" ).toFloat();

	this->colorOfNode=osg::Vec4( r, g, b, a );
	this->setColor( colorOfNode );

	setScale( type->getSettings()->value( "scale" ).toFloat() );
}
Exemplo n.º 2
0
Data::Node::Node( qlonglong id, QString name, Data::Type* type, float scaling, Data::Graph* graph, osg::Vec3f position )
	: OsgNode( id, name, type, graph, scaling, position )
{
	//konstruktor
	this->mIsFocused = false;
	this->edges = new QMap<qlonglong, osg::ref_ptr<Data::Edge> >;
	this->cluster = NULL;
	// Duransky start - Pociatocne nastavenie roznych cisiel vertigo rovin pre uzly
	this->numberOfVertigoPlane = id;
	// Duransky end - Pociatocne nastavenie roznych cisiel vertigo rovin pre uzly

	settings = new QMap<QString, QString>();
	//APA

	settings->insert( "Velkost","4242" );
	settings->insert( "Farba","ruzova" );
	//APA

	int pos = 0;
	int cnt = 0;

	labelText = this->name;

	while ( ( pos = labelText.indexOf( QString( " " ), pos + 1 ) ) != -1 ) {
		if ( ++cnt % 3 == 0 ) {
			labelText = labelText.replace( pos, 1, "\n" );
		}
	}

	insertChild( INDEX_LABEL, createLabel( this->type->getScale(), labelText ) , false );
	insertChild( INDEX_SQUARE, createNodeSquare( this->scale, Node::createStateSet( this->type ) ) , false );
	insertChild( INDEX_SPHERE, createNodeSphere( this->scale, Node::createStateSet( this->type ) ), false );
	setValue( graph->getNodeVisual(), true );

	this->force = osg::Vec3f();
	this->velocity = osg::Vec3f( 0,0,0 );
	this->fixed = false;
	this->positionCanBeRestricted = true;
	this->removableByUser = true;
	this->selected = false;
	this->usingInterpolation = true;

	//nastavenie farebneho typu
	float r = type->getSettings()->value( "color.R" ).toFloat();
	float g = type->getSettings()->value( "color.G" ).toFloat();
	float b = type->getSettings()->value( "color.B" ).toFloat();
	float a = type->getSettings()->value( "color.A" ).toFloat();

	this->color=osg::Vec4( r, g, b, a );
	this->setDrawableColor( 0, color );

	// merging Britvik: this was here
	//setDefaultColor();

	//volovar_zac
	layerID = 0;  //node is not on layer of radial layout
	radialLayout = NULL;  //node does not belong to radial layout
	//volovar_kon
}
Exemplo n.º 3
0
void Data::OsgNode::setIsFocused( bool value )
{
	mIsFocused = value;

	if ( mIsFocused ) {
		removeChild( INDEX_SQUARE, 1 );
		this->insertChild( INDEX_SQUARE, createNodeSquare( this->scale, OsgNode::createStateSet( this->type ) ) , false );
		removeChild( INDEX_SPHERE, 1 );
		this->insertChild( INDEX_SPHERE, createNodeSphere( this->scale , OsgNode::createStateSet( this->type ) ) , false );
		setDrawableColor( osg::Vec4( 0.5f, 1.0f, 0.0f, 1.0 ) );
	}
	else {
		removeChild( INDEX_SQUARE, 1 );
		this->insertChild( INDEX_SQUARE, createNodeSquare( this->scale , OsgNode::createStateSet( this->type ) ), false );
		removeChild( INDEX_SPHERE, 1 );
		this->insertChild( INDEX_SPHERE, createNodeSphere( this->scale , OsgNode::createStateSet( this->type ) ) , false );
		setDrawableColor( osg::Vec4( 1.0f, 1.0f, 1.0f, 1.0 ) );
	}
	setValue( graph->getNodeVisual(), true );
}
Exemplo n.º 4
0
void Data::OsgNode::reloadConfig()
{
	removeChildren( 0, 4 );
	this->insertChild( INDEX_LABEL, createLabel( this->type->getScale(), labelText ) , false );
	this->insertChild( INDEX_SQUARE, createNodeSquare( this->scale, OsgNode::createStateSet( this->type->getTypeTexture() ) ), false );
	this->insertChild( INDEX_SPHERE, createNodeSphere( this->scale, OsgNode::createStateSet( this->type->getTypeTexture() ) ), false );
	this->insertChild( INDEX_RESIDENCE, createNodeResidence( this->scale ), false );
	setSelected( selected );
	setColor( color );
	setValue( graph->getNodeVisual(), true );
}
Exemplo n.º 5
0
void Data::OsgNode::reloadConfig()
{
	removeChildren( 0, 3 );
    if(	type->getName() != "node" ) {
        setScale( type->getScale() );
    }
    this->insertChild( INDEX_LABEL, createLabel( this->scale, labelText ) , false );
	this->insertChild( INDEX_SQUARE, createNodeSquare( this->scale, OsgNode::createStateSet( this->type ) ), false );
	this->insertChild( INDEX_SPHERE, createNodeSphere( this->scale, OsgNode::createStateSet( this->type ) ), false );
	setSelected( selected );
    setColor( color );
	setValue( graph->getNodeVisual(), true );
}