// here is a code for displaying point clouds
// ive been, getting good results, i can load 40 million points max before running out of memory on 32 bit
// and 60 million points on 4 bit before running out of memory, whats funny is i still have memory available i have 8 gigs of memory, im not expert in memory, but i am suspecting, the memory manager stablishes a limit on memory consumtion, even when the operating system has the available memory.
or the task manager doesnt is not accurat enough to know how much memory is actually being used.
// but all in all i get the visual studio out of memory error after the 40mil-60mil points thresholds.
// here is the code, sorry for the use of Qt for point list's, can be easily made without the qlist, but im a newbie, not ready to let go of my qt training wheels.
// best
// AlexP
/// header file :
// AIS_PointCloud.h: interface for the AIS_PointCloud class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_AIS_PointCloud_H__A9B277C4_A69E_11D1_8DA4_0800369C8A03__INCLUDED_)
#define AFX_AIS_PointCloud_H__A9B277C4_A69E_11D1_8DA4_0800369C8A03__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
//#include
#include
#include
#include
#include
#include
class TCollection_AsciiString;
class PrsMgr_PresentationManager2d;
class Graphic2d_GraphicObject;
class SelectMgr_Selection;
DEFINE_STANDARD_HANDLE(AIS_PointCloud,AIS_InteractiveObject)
class AIS_PointCloud : public AIS_InteractiveObject
{
public:
//AIS_PointCloud(const Graphic3d_Array1OfVertex &points);
AIS_PointCloud(QList vertlist);
virtual ~AIS_PointCloud();
DEFINE_STANDARD_RTTI(AIS_PointCloud)
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode);
void Compute (const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation);
void Compute (const Handle(PrsMgr_PresentationManager2d)& aPresentationManager,
const Handle(Graphic2d_GraphicObject)& aGrObj,
const Standard_Integer unMode = 0) ;
void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer unMode) ;
// Fields PRIVATE
//
//const Graphic3d_Array1OfVertex &cloud_data;
QList vertlist;
};
#endif // !defined(AFX_AIS_PointCloud_H__A9B277C4_A69E_11D1_8DA4_0800369C8A03__INCLUDED_)
// AIS_PointCloud.cpp: implementation of the AIS_PointCloud class.
//
//////////////////////////////////////////////////////////////////////
//// following the code on this link:
//http://www.opencascade.org/org/forum/thread_1125/
#include "AIS_PointCloud.hxx"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
//#define new DEBUG_NEW
#endif
IMPLEMENT_STANDARD_HANDLE(AIS_PointCloud,AIS_InteractiveObject)
IMPLEMENT_STANDARD_RTTI(AIS_PointCloud,AIS_InteractiveObject)
//
// Foreach ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and
// a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro.
// We must respect the order: from the direct ancestor class
// to the base class.
//
IMPLEMENT_STANDARD_TYPE(AIS_PointCloud)
IMPLEMENT_STANDARD_SUPERTYPE(AIS_InteractiveObject)
IMPLEMENT_STANDARD_SUPERTYPE(SelectMgr_SelectableObject)
IMPLEMENT_STANDARD_SUPERTYPE(PrsMgr_PresentableObject)
IMPLEMENT_STANDARD_SUPERTYPE(MMgt_TShared)
IMPLEMENT_STANDARD_SUPERTYPE(Standard_Transient)
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY()
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(AIS_InteractiveObject)
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(SelectMgr_SelectableObject)
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(PrsMgr_PresentableObject)
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(MMgt_TShared)
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY(Standard_Transient)
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END()
IMPLEMENT_STANDARD_TYPE_END(AIS_PointCloud)
#include
#include
#include
#include
#include
#include
#include "PrsMgr_PresentationManager2d.hxx"
#include "SelectMgr_Selection.hxx"
#include
#include
#include
#include
#include
#include
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//AIS_PointCloud::AIS_PointCloud(const Graphic3d_Array1OfVertex &points)
//:cloud_data(points)
//{
//
//}
AIS_PointCloud::AIS_PointCloud(QList vlist)
:vertlist(vlist)
{
}
AIS_PointCloud::~AIS_PointCloud()
{
}
void AIS_PointCloud::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode)
{
Handle(Graphic3d_Structure) theStructure = Handle(Graphic3d_Structure)::DownCast(aPresentation);
Handle(Graphic3d_Group) theGroup= new Graphic3d_Group(theStructure);
double pcount = vertlist.length();
Handle_Graphic3d_ArrayOfPoints thepointcloud2= new Graphic3d_ArrayOfPoints(pcount);
int index =0;
index =0;
for(int i=0 ; i
{
index++;
thepointcloud2->AddVertex(vertlist.at(i));
//thepointcloud2->SetVertexColor(vertindx,colorlist.at(i));
}
theGroup->AddPrimitiveArray(thepointcloud2);
}
void AIS_PointCloud::Compute(const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation)
{
}
void AIS_PointCloud::Compute(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager,
const Handle(Graphic2d_GraphicObject)& aGrObj,
const Standard_Integer unMode)
{
}
void AIS_PointCloud::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer unMode)
{
}