Exemplo n.º 1
0
BOOL CPreferencesPrint::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	SendDlgItemMessage(IDC_PRNDLG_HEADERBTN, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)CreateArrow());
	SendDlgItemMessage(IDC_PRNDLG_FOOTERBTN, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)CreateArrow());
	
	return TRUE;
}
Exemplo n.º 2
0
VirtualRobot::VisualizationNodePtr OSGVisualizationFactory::createArrow( const Eigen::Vector3f &n, float length /*= 50.0f*/, float width /*= 2.0f*/, const Color &color /*= Color::Gray()*/ )
{
	osg::Node* res = CreateArrow(n,length,width,color);

	VisualizationNodePtr node(new OSGVisualizationNode(res));
	return node;
}
Exemplo n.º 3
0
osg::Node* OSGVisualizationFactory::getOSGVisualization( TriMeshModelPtr model, bool showNormals, VisualizationFactory::Color color )
{
	osg::Group *res = new osg::Group;
	res->ref();
	Eigen::Vector3f v1,v2,v3;
	for (size_t i=0;i<model->faces.size();i++)
	{
		v1 = model->vertices[model->faces[i].id1];
		v2 = model->vertices[model->faces[i].id2];
		v3 = model->vertices[model->faces[i].id3];
		//v2.setValue(model->vertices[model->faces[i].id2](0),model->vertices[model->faces[i].id2](1),model->vertices[model->faces[i].id2](2));
		//v3.setValue(model->vertices[model->faces[i].id3](0),model->vertices[model->faces[i].id3](1),model->vertices[model->faces[i].id3](2));
		std::vector<Eigen::Vector3f> v;
		v.push_back(v1);
		v.push_back(v2);
		v.push_back(v3);
		osg::Node* s = CreatePolygonVisualization(v,color);
		res->addChild(s);
		if (showNormals)
		{
			v1 = (v1 + v2 + v3) / 3.0f;
			osg::Group* ar = new osg::Group;
			Eigen::Matrix4f mat = Eigen::Matrix4f::Identity();
			mat.block(0,3,3,1) = v1;
			osg::MatrixTransform *mt = getMatrixTransform(mat);
			ar->addChild(mt);

			osg::Node *n = CreateArrow(model->faces[i].normal,30.0f,1.5f);
			mt->addChild(n);

			res->addChild(ar);
		}
	}
	res->unref_nodelete();
	return res;
}
Exemplo n.º 4
0
osg::Node* OSGVisualizationFactory::CreateCoordSystemVisualization(float scaling, std::string *text, float axisLength, float axisSize, int nrOfBlocks)
{

	osg::Node* xAxis = CreateArrow(Eigen::Vector3f(1,0,0),axisLength,axisSize,Color::Red());
	osg::Node* yAxis = CreateArrow(Eigen::Vector3f(0,1,0),axisLength,axisSize,Color::Green());
	osg::Node* zAxis = CreateArrow(Eigen::Vector3f(0,0,1),axisLength,axisSize,Color::Blue());

	osg::Group* g = new osg::Group;
	g->addChild(xAxis);
	g->addChild(yAxis);
	g->addChild(zAxis);
	return g;
	/*float blockSize = axisSize+0.5f;
	float blockWidth = 0.1f;
	if (axisSize>10.0f)
	{
		blockSize += axisSize / 10.0f;
		blockWidth += axisSize / 10.0f;
	}

	float axisBlockTranslation;
	if (nrOfBlocks!=0)
	{
		axisBlockTranslation = axisLength / nrOfBlocks;
	} else
		axisBlockTranslation = axisLength / 10.0f;

	SoSeparator* result = new SoSeparator();

	SbMatrix m;
	m.makeIdentity();
	SoMatrixTransform *mtr = new SoMatrixTransform();
	mtr->matrix.setValue(m);
	result->addChild(mtr);

	//SoScale *sc = new SoScale();
	//sc->scaleFactor.setValue(scaling,scaling,scaling);
	//result->addChild(sc);

	for (int i=0;i<3;i++)
	{
		SoSeparator *tmp1 = new SoSeparator();
		SoTransform *t = new SoTransform();
		SoMaterial *m = new SoMaterial();
		if (i==0)
		{
			m->diffuseColor.setValue(1.0f,0,0);
			t->translation.setValue((axisLength/2.0f + axisSize/2.0f)*scaling,0,0);
		} else if (i==1)
		{
			m->diffuseColor.setValue(0,1.0f,0);
			t->translation.setValue(0,(axisLength/2.0f + axisSize/2.0f)*scaling,0);
		} else
		{
			m->diffuseColor.setValue(0,0,1.0f);
			t->translation.setValue(0,0,(axisLength/2.0f + axisSize/2.0f)*scaling);
		}

		tmp1->addChild(m);
		tmp1->addChild(t);
		SoCube *c = new SoCube();
		SoCube *c2 = new SoCube();
		SoTransform *t2 = new SoTransform();
		if (i==0)
		{
			c->width = axisLength*scaling;
			c->height = axisSize*scaling;
			c->depth = axisSize*scaling;
			c2->width = blockWidth*scaling;
			c2->height = blockSize*scaling;
			c2->depth = blockSize*scaling;
			t2->translation.setValue(axisBlockTranslation*scaling,0,0);
		} else if (i==1)
		{
			c->height = axisLength*scaling;
			c->width = axisSize*scaling;
			c->depth = axisSize*scaling;
			c2->width = blockSize*scaling;
			c2->height = blockWidth*scaling;
			c2->depth = blockSize*scaling;
			t2->translation.setValue(0,axisBlockTranslation*scaling,0);
		} else
		{
			c->depth = axisLength*scaling;
			c->height = axisSize*scaling;
			c->width = axisSize*scaling;
			c2->width = blockSize*scaling;
			c2->height = blockSize*scaling;
			c2->depth = blockWidth*scaling;
			t2->translation.setValue(0,0,axisBlockTranslation*scaling);
		}
		tmp1->addChild(c);
		result->addChild(tmp1);

		SoSeparator *tmp2 = new SoSeparator();
		SoMaterial *m2 = new SoMaterial();
		m2->diffuseColor.setValue(1.0f,1.0f,1.0f);
		tmp2->addChild(m2);

		for (int j=0;j<nrOfBlocks;j++)
		{
			tmp2->addChild(t2);
			tmp2->addChild(c2);
		}

		result->addChild(tmp2);
	}

	if (text!=NULL)
	{
		SoSeparator *textSep = new SoSeparator();
		SoTranslation *moveT = new SoTranslation();
		moveT->translation.setValue(2.0f,2.0f,0.0f);
		textSep->addChild(moveT);
		SoAsciiText *textNode = new SoAsciiText();
		/*std::string text2(*text);
		text2.replace( ' ', "_" );* /
		SbString text2(text->c_str());
		text2.apply( &IVToolsHelper_ReplaceSpaceWithUnderscore );
		textNode->string.set(text2.getString());
		textSep->addChild(textNode);
		result->addChild(textSep);
	}
	return result;*/
}