mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-06-30 12:14:08 +03:00
Refactor code. Set point marker style as default for point cloud object.
This commit is contained in:
parent
fe8bd8ca09
commit
0d16d59134
@ -15,7 +15,6 @@
|
||||
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <AIS_PointCloud.hxx>
|
||||
#include <AIS_PointCloud.lxx>
|
||||
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
@ -37,6 +36,7 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_PointCloud, AIS_InteractiveObject)
|
||||
AIS_PointCloud::AIS_PointCloud()
|
||||
: AIS_InteractiveObject()
|
||||
{
|
||||
SetHilightMode (0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -66,19 +66,15 @@ void AIS_PointCloud::SetPoints (const Handle(TColgp_HArray1OfPnt)& theCoords
|
||||
return;
|
||||
|
||||
Standard_Integer aNumPoints = theCoords->Length();
|
||||
Standard_Boolean hasColors = !theColors.IsNull() && aNumPoints == theColors->Length();
|
||||
|
||||
Standard_Boolean aHasColors = Standard_False;
|
||||
if (!theColors.IsNull() && aNumPoints == theColors->Length())
|
||||
aHasColors = Standard_True;
|
||||
|
||||
myPoints = new Graphic3d_ArrayOfPoints (aNumPoints, aHasColors);
|
||||
|
||||
myPoints = new Graphic3d_ArrayOfPoints (aNumPoints, hasColors);
|
||||
for (Standard_Integer aPntIter = theCoords->Lower(); aPntIter <= theCoords->Upper(); aPntIter++)
|
||||
{
|
||||
myPoints->AddVertex (theCoords->Value (aPntIter));
|
||||
}
|
||||
|
||||
if (aHasColors)
|
||||
if (hasColors)
|
||||
{
|
||||
Standard_Integer aNumVertex = 1;
|
||||
for(Standard_Integer aColorIter = theColors->Lower(); aColorIter <= theColors->Upper(); aColorIter++)
|
||||
@ -89,6 +85,15 @@ void AIS_PointCloud::SetPoints (const Handle(TColgp_HArray1OfPnt)& theCoords
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetPoints
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(Graphic3d_ArrayOfPoints)& AIS_PointCloud::GetPoints() const
|
||||
{
|
||||
return myPoints;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetColor
|
||||
//purpose :
|
||||
@ -125,15 +130,19 @@ void AIS_PointCloud::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePr
|
||||
{
|
||||
thePresentation->Clear();
|
||||
|
||||
if (GetPoints().IsNull() || !GetPoints()->IsValid())
|
||||
const Handle(Graphic3d_ArrayOfPoints)& aPoints = GetPoints();
|
||||
if (aPoints.IsNull() || !aPoints->IsValid())
|
||||
return;
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePresentation);
|
||||
if (myDrawer->HasPointAspect())
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAspect = myDrawer->PointAspect()->Aspect();
|
||||
if (!myDrawer->HasPointAspect())
|
||||
{
|
||||
aGroup->SetPrimitivesAspect (myDrawer->PointAspect()->Aspect());
|
||||
aMarkerAspect->SetType (Aspect_TOM_POINT);
|
||||
}
|
||||
aGroup->AddPrimitiveArray (GetPoints());
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePresentation);
|
||||
aGroup->SetGroupPrimitivesAspect (aMarkerAspect);
|
||||
aGroup->AddPrimitiveArray (aPoints);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -33,6 +33,7 @@
|
||||
DEFINE_STANDARD_HANDLE (AIS_PointCloud, AIS_InteractiveObject)
|
||||
|
||||
//! Interactive object for set of points.
|
||||
//! Selection services are not provided by this class.
|
||||
class AIS_PointCloud : public AIS_InteractiveObject
|
||||
{
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
// Created on: 2014-08-25
|
||||
// Created by: Maxim GLIBIN
|
||||
// Copyright (c) 2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
inline const Handle(Graphic3d_ArrayOfPoints)& AIS_PointCloud::GetPoints() const
|
||||
{
|
||||
return myPoints;
|
||||
}
|
@ -22,5 +22,4 @@ AIS_DiameterDimension.cxx
|
||||
AIS_RadiusDimension.hxx
|
||||
AIS_RadiusDimension.cxx
|
||||
AIS_PointCloud.hxx
|
||||
AIS_PointCloud.lxx
|
||||
AIS_PointCloud.cxx
|
||||
|
Loading…
x
Reference in New Issue
Block a user