Page 1 of 1

Obtenir les dimensions générales

Posted: Mon Oct 13, 2008 9:10 am
by letux
Bonjour,

Je développe une application avec la librairie open source qcadlib pour une application de gestion de production. J'arrive à faire ce dont j'ai besoin mais j'aurais encore besoin d'obtenir les dimensions générales (hauteur, largeur) des pièces en millimètre. Comment puis-je faire cela. Toutes les autres dimensions ne m'intéresses pas, uniquement les deux principales.

Merci pour l'aide.

In english:

I am developping an application with the open source library qcadlib. I can do what I need but I need to obtain the main dimensions (width, height). How is it possible to do that? The others dimension is not needed.

Thank you for you help

Posted: Wed Oct 15, 2008 2:28 pm
by letux
pour ceux que ça intéresse, j'ai fait cela comme cela:

Code: Select all

RS_LayerList *layerList = graphic->getLayerList ();
		for(int i=0; i < graphic->countLayers(); i++)
		{
			if( graphic->countLayerEntities ( layerList->at(i) ) > 0)
			{
				double minX = graphic->entityAt(0)->getMin().x;
				double minY = graphic->entityAt(0)->getMin().y;
				double maxX = graphic->entityAt(0)->getMax().x;
				double maxY = graphic->entityAt(0)->getMax().y;
				
				
				for(int j=0; j< graphic->countLayerEntities ( layerList->at(i) ); j++)
				{
					RS_Entity *entity = graphic->entityAt(j);
					
					if(entity)
					{
						RS_Vector min = entity->getMin();
						RS_Vector max = entity->getMax();
						
						if(min.x < minX) minX = min.x;
						if(min.y < minY) minY = min.y;
						if(max.x > maxX) maxX = max.x;
						if(max.y > maxY) maxY = max.y;
					}
				}
				
				qDebug() << (maxX - minX) << " x " << (maxY - minY);
			}
		} 
graphic est un RS_Graphic