mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0028205: Visualization - add functionality for dumping results of detection algorithms into image
StdSelect_ViewerSelector3d::ToPixMap() - added new method for dumping detection results into an image.
This commit is contained in:
@@ -23,6 +23,7 @@ StdSelect_ShapeTypeFilter.lxx
|
||||
StdSelect_TypeOfEdge.hxx
|
||||
StdSelect_TypeOfFace.hxx
|
||||
StdSelect_TypeOfResult.hxx
|
||||
StdSelect_TypeOfSelectionImage.hxx
|
||||
StdSelect_ViewerSelector3d.cxx
|
||||
StdSelect_ViewerSelector3d.hxx
|
||||
StdSelect_ViewerSelector3d.lxx
|
||||
|
30
src/StdSelect/StdSelect_TypeOfSelectionImage.hxx
Normal file
30
src/StdSelect/StdSelect_TypeOfSelectionImage.hxx
Normal file
@@ -0,0 +1,30 @@
|
||||
// Created on: 2016-12-09
|
||||
// Copyright (c) 2016 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.
|
||||
|
||||
#ifndef _StdSelect_TypeOfSelectionImage_HeaderFile
|
||||
#define _StdSelect_TypeOfSelectionImage_HeaderFile
|
||||
|
||||
//! Type of output selection image.
|
||||
enum StdSelect_TypeOfSelectionImage
|
||||
{
|
||||
StdSelect_TypeOfSelectionImage_NormalizedDepth = 0, //!< normalized depth (grayscale)
|
||||
StdSelect_TypeOfSelectionImage_NormalizedDepthInverted, //!< normalized depth, inverted
|
||||
StdSelect_TypeOfSelectionImage_UnnormalizedDepth, //!< unnormalized depth (grayscale)
|
||||
StdSelect_TypeOfSelectionImage_ColoredDetectedObject, //!< color of detected object
|
||||
StdSelect_TypeOfSelectionImage_ColoredEntity, //!< random color for each entity
|
||||
StdSelect_TypeOfSelectionImage_ColoredOwner, //!< random color for each owner
|
||||
StdSelect_TypeOfSelectionImage_ColoredSelectionMode //!< color of selection mode
|
||||
};
|
||||
|
||||
#endif
|
@@ -52,6 +52,10 @@
|
||||
#include <Aspect_Window.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
#include <math_BullardGenerator.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Quantity_ColorHasher.hxx>
|
||||
#include <Poly_Connect.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
|
||||
@@ -669,3 +673,438 @@ void StdSelect_ViewerSelector3d::updateZLayers (const Handle(V3d_View)& theView)
|
||||
myZLayerOrderMap.Bind (aLayerIter.Value(), aPos);
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
//! Abstract class for filling pixel with color.
|
||||
class BaseFiller : public Standard_Transient
|
||||
{
|
||||
DEFINE_STANDARD_RTTI_INLINE(BaseFiller, Standard_Transient)
|
||||
public:
|
||||
|
||||
//! Main constructor.
|
||||
BaseFiller (Image_PixMap& thePixMap,
|
||||
StdSelect_ViewerSelector3d* theSelector)
|
||||
: myImage (&thePixMap),
|
||||
myMainSel(theSelector) {}
|
||||
|
||||
//! Fill pixel at specified position.
|
||||
virtual void Fill (const Standard_Integer theCol,
|
||||
const Standard_Integer theRow,
|
||||
const Standard_Integer thePicked) = 0;
|
||||
|
||||
//! Flush results into final image.
|
||||
virtual void Flush() {}
|
||||
|
||||
protected:
|
||||
|
||||
//! Find the new unique random color.
|
||||
void randomPastelColor (Quantity_Color& theColor)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
nextRandomPastelColor (theColor);
|
||||
if (myUniqueColors.Add (theColor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! Fills the given color as random.
|
||||
void nextRandomPastelColor (Quantity_Color& theColor)
|
||||
{
|
||||
theColor = Quantity_Color (Standard_Real(myBullardGenerator.NextInt() % 256) / 255.0,
|
||||
Standard_Real(myBullardGenerator.NextInt() % 256) / 255.0,
|
||||
Standard_Real(myBullardGenerator.NextInt() % 256) / 255.0,
|
||||
Quantity_TOC_RGB);
|
||||
}
|
||||
|
||||
protected:
|
||||
Image_PixMap* myImage;
|
||||
StdSelect_ViewerSelector3d* myMainSel;
|
||||
math_BullardGenerator myBullardGenerator;
|
||||
NCollection_Map<Quantity_Color, Quantity_ColorHasher> myUniqueColors;
|
||||
};
|
||||
|
||||
//! Help class for filling pixel with random color.
|
||||
class GeneratedEntityColorFiller : public BaseFiller
|
||||
{
|
||||
DEFINE_STANDARD_RTTI_INLINE(GeneratedEntityColorFiller, BaseFiller)
|
||||
public:
|
||||
GeneratedEntityColorFiller (Image_PixMap& thePixMap,
|
||||
StdSelect_ViewerSelector3d* theSelector,
|
||||
const SelectMgr_SelectableObjectSet& theSelObjects)
|
||||
: BaseFiller (thePixMap, theSelector)
|
||||
{
|
||||
// generate per-entity colors in the order as they have been activated
|
||||
for (SelectMgr_SelectableObjectSet::Iterator anObjIter (theSelObjects); anObjIter.More(); anObjIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_SelectableObject)& anObj = anObjIter.Value();
|
||||
for (anObj->Init(); anObj->More(); anObj->Next())
|
||||
{
|
||||
const Handle(SelectMgr_Selection)& aSel = anObj->CurrentSelection();
|
||||
for (aSel->Init(); aSel->More(); aSel->Next())
|
||||
{
|
||||
const Handle(SelectMgr_SensitiveEntity)& aSens = aSel->Sensitive();
|
||||
if (!myMapEntityColors.IsBound (aSens->BaseSensitive()))
|
||||
{
|
||||
Quantity_Color aColor;
|
||||
randomPastelColor (aColor);
|
||||
myMapEntityColors.Bind (aSens->BaseSensitive(), aColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Fill (const Standard_Integer theCol,
|
||||
const Standard_Integer theRow,
|
||||
const Standard_Integer thePicked) Standard_OVERRIDE
|
||||
{
|
||||
if (thePicked < 1
|
||||
|| thePicked > myMainSel->NbPicked())
|
||||
{
|
||||
myImage->SetPixelColor (theCol, theRow, Quantity_Color(Quantity_NOC_BLACK));
|
||||
return;
|
||||
}
|
||||
|
||||
const Handle(SelectBasics_SensitiveEntity)& aPickedEntity = myMainSel->PickedEntity (thePicked);
|
||||
Quantity_Color aColor (Quantity_NOC_BLACK);
|
||||
myMapEntityColors.Find (aPickedEntity, aColor);
|
||||
myImage->SetPixelColor (theCol, theRow, aColor);
|
||||
}
|
||||
|
||||
protected:
|
||||
NCollection_DataMap<Handle(SelectBasics_SensitiveEntity), Quantity_Color> myMapEntityColors;
|
||||
};
|
||||
|
||||
//! Help class for filling pixel with normalized depth of ray.
|
||||
class NormalizedDepthFiller : public BaseFiller
|
||||
{
|
||||
DEFINE_STANDARD_RTTI_INLINE(NormalizedDepthFiller, BaseFiller)
|
||||
public:
|
||||
NormalizedDepthFiller (Image_PixMap& thePixMap,
|
||||
StdSelect_ViewerSelector3d* theSelector,
|
||||
const Standard_Boolean theToInverse)
|
||||
: BaseFiller (thePixMap, theSelector),
|
||||
myDepthMin ( RealLast()),
|
||||
myDepthMax (-RealLast()),
|
||||
myToInverse(theToInverse)
|
||||
{
|
||||
myUnnormImage.InitZero (Image_PixMap::ImgGrayF, thePixMap.SizeX(), thePixMap.SizeY());
|
||||
}
|
||||
|
||||
//! Accumulate the data.
|
||||
virtual void Fill (const Standard_Integer theCol,
|
||||
const Standard_Integer theRow,
|
||||
const Standard_Integer thePicked) Standard_OVERRIDE
|
||||
{
|
||||
if (myUnnormImage.IsEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (thePicked < 1
|
||||
|| thePicked > myMainSel->NbPicked())
|
||||
{
|
||||
myUnnormImage.ChangeValue<float> (theRow, theCol) = ShortRealLast();
|
||||
return;
|
||||
}
|
||||
|
||||
const SelectMgr_SortCriterion& aSortCriterion = myMainSel->PickedData (thePicked);
|
||||
myUnnormImage.ChangeValue<float> (theRow, theCol) = float(aSortCriterion.Depth);
|
||||
myDepthMin = Min (myDepthMin, aSortCriterion.Depth);
|
||||
myDepthMax = Max (myDepthMax, aSortCriterion.Depth);
|
||||
}
|
||||
|
||||
//! Normalize the depth values.
|
||||
virtual void Flush() Standard_OVERRIDE
|
||||
{
|
||||
Standard_Real aFrom = 0.0;
|
||||
Standard_Real aDelta = 1.0;
|
||||
if (myDepthMin <= myDepthMax)
|
||||
{
|
||||
aFrom = myDepthMin;
|
||||
if (myDepthMin != myDepthMax)
|
||||
{
|
||||
aDelta = myDepthMax - myDepthMin;
|
||||
}
|
||||
}
|
||||
for (Standard_Size aRowIter = 0; aRowIter < myUnnormImage.SizeY(); ++aRowIter)
|
||||
{
|
||||
for (Standard_Size aColIter = 0; aColIter < myUnnormImage.SizeX(); ++aColIter)
|
||||
{
|
||||
float aDepth = myUnnormImage.Value<float> (aRowIter, aColIter);
|
||||
if (aDepth <= -ShortRealLast()
|
||||
|| aDepth >= ShortRealLast())
|
||||
{
|
||||
myImage->SetPixelColor (Standard_Integer(aColIter), Standard_Integer(aRowIter),
|
||||
NCollection_Vec4<float> (0.0f, 0.0f, 0.0f, 1.0f));
|
||||
continue;
|
||||
}
|
||||
|
||||
float aNormDepth = float((Standard_Real(aDepth) - aFrom) / aDelta);
|
||||
if (myToInverse)
|
||||
{
|
||||
aNormDepth = 1.0f - aNormDepth;
|
||||
}
|
||||
myImage->SetPixelColor (Standard_Integer(aColIter), Standard_Integer(aRowIter),
|
||||
NCollection_Vec4<float> (aNormDepth, aNormDepth, aNormDepth, 1.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Image_PixMap myUnnormImage;
|
||||
Standard_Real myDepthMin;
|
||||
Standard_Real myDepthMax;
|
||||
Standard_Boolean myToInverse;
|
||||
};
|
||||
|
||||
//! Help class for filling pixel with unnormalized depth of ray.
|
||||
class UnnormalizedDepthFiller : public BaseFiller
|
||||
{
|
||||
DEFINE_STANDARD_RTTI_INLINE(UnnormalizedDepthFiller, BaseFiller)
|
||||
public:
|
||||
UnnormalizedDepthFiller (Image_PixMap& thePixMap,
|
||||
StdSelect_ViewerSelector3d* theSelector)
|
||||
: BaseFiller (thePixMap, theSelector) {}
|
||||
|
||||
virtual void Fill (const Standard_Integer theCol,
|
||||
const Standard_Integer theRow,
|
||||
const Standard_Integer thePicked) Standard_OVERRIDE
|
||||
{
|
||||
if (thePicked < 1
|
||||
|| thePicked > myMainSel->NbPicked())
|
||||
{
|
||||
myImage->SetPixelColor (theCol, theRow, NCollection_Vec4<float> (0.0f, 0.0f, 0.0f, 1.0f));
|
||||
return;
|
||||
}
|
||||
|
||||
const SelectMgr_SortCriterion& aSortCriterion = myMainSel->PickedData (thePicked);
|
||||
const float aDepth = float(aSortCriterion.Depth);
|
||||
myImage->SetPixelColor (theCol, theRow, NCollection_Vec4<float> (aDepth, aDepth, aDepth, 1.0f));
|
||||
}
|
||||
};
|
||||
|
||||
//! Help class for filling pixel with color of detected object.
|
||||
class GeneratedOwnerColorFiller : public BaseFiller
|
||||
{
|
||||
DEFINE_STANDARD_RTTI_INLINE(GeneratedOwnerColorFiller, BaseFiller)
|
||||
public:
|
||||
GeneratedOwnerColorFiller (Image_PixMap& thePixMap,
|
||||
StdSelect_ViewerSelector3d* theSelector,
|
||||
const SelectMgr_SelectableObjectSet& theSelObjects)
|
||||
: BaseFiller (thePixMap, theSelector)
|
||||
{
|
||||
// generate per-owner colors in the order as they have been activated
|
||||
for (SelectMgr_SelectableObjectSet::Iterator anObjIter (theSelObjects); anObjIter.More(); anObjIter.Next())
|
||||
{
|
||||
const Handle(SelectMgr_SelectableObject)& anObj = anObjIter.Value();
|
||||
for (anObj->Init(); anObj->More(); anObj->Next())
|
||||
{
|
||||
const Handle(SelectMgr_Selection)& aSel = anObj->CurrentSelection();
|
||||
for (aSel->Init(); aSel->More(); aSel->Next())
|
||||
{
|
||||
const Handle(SelectMgr_SensitiveEntity)& aSens = aSel->Sensitive();
|
||||
const Handle(SelectBasics_EntityOwner)& anOwner = aSens->BaseSensitive()->OwnerId();
|
||||
if (!myMapOwnerColors.IsBound (anOwner))
|
||||
{
|
||||
Quantity_Color aColor;
|
||||
randomPastelColor (aColor);
|
||||
myMapOwnerColors.Bind (anOwner, aColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Fill (const Standard_Integer theCol,
|
||||
const Standard_Integer theRow,
|
||||
const Standard_Integer thePicked) Standard_OVERRIDE
|
||||
{
|
||||
if (thePicked < 1
|
||||
|| thePicked > myMainSel->NbPicked())
|
||||
{
|
||||
myImage->SetPixelColor (theCol, theRow, Quantity_Color(Quantity_NOC_BLACK));
|
||||
return;
|
||||
}
|
||||
|
||||
const Handle(SelectMgr_EntityOwner)& aPickedOwner = myMainSel->Picked (thePicked);
|
||||
Quantity_Color aColor (Quantity_NOC_BLACK);
|
||||
myMapOwnerColors.Find (aPickedOwner, aColor);
|
||||
myImage->SetPixelColor (theCol, theRow, aColor);
|
||||
}
|
||||
|
||||
protected:
|
||||
NCollection_DataMap<Handle(SelectBasics_EntityOwner), Quantity_Color> myMapOwnerColors;
|
||||
};
|
||||
|
||||
//! Help class for filling pixel with random color for each selection mode.
|
||||
class GeneratedSelModeColorFiller : public BaseFiller
|
||||
{
|
||||
DEFINE_STANDARD_RTTI_INLINE(GeneratedSelModeColorFiller, BaseFiller)
|
||||
public:
|
||||
GeneratedSelModeColorFiller (Image_PixMap& thePixMap,
|
||||
StdSelect_ViewerSelector3d* theSelector)
|
||||
: BaseFiller (thePixMap, theSelector)
|
||||
{
|
||||
// generate standard modes in proper order, consider custom objects would use similar scheme
|
||||
myMapSelectionModeColors.Bind ( 0, Quantity_NOC_WHITE); // default (entire object selection)
|
||||
myMapSelectionModeColors.Bind ( 1, Quantity_NOC_YELLOW); // TopAbs_VERTEX
|
||||
myMapSelectionModeColors.Bind ( 2, Quantity_NOC_GREEN); // TopAbs_EDGE
|
||||
myMapSelectionModeColors.Bind ( 3, Quantity_NOC_RED); // TopAbs_WIRE
|
||||
myMapSelectionModeColors.Bind ( 4, Quantity_NOC_BLUE1); // TopAbs_FACE
|
||||
myMapSelectionModeColors.Bind ( 5, Quantity_NOC_CYAN1); // TopAbs_SHELL
|
||||
myMapSelectionModeColors.Bind ( 6, Quantity_NOC_PURPLE); // TopAbs_SOLID
|
||||
myMapSelectionModeColors.Bind ( 7, Quantity_NOC_MAGENTA1); // TopAbs_COMPSOLID
|
||||
myMapSelectionModeColors.Bind ( 8, Quantity_NOC_BROWN); // TopAbs_COMPOUND
|
||||
myMapSelectionModeColors.Bind (0x0010, Quantity_NOC_PINK); // MeshVS_SMF_Volume
|
||||
myMapSelectionModeColors.Bind (0x001E, Quantity_NOC_LIMEGREEN); // MeshVS_SMF_Element
|
||||
myMapSelectionModeColors.Bind (0x001F, Quantity_NOC_DARKOLIVEGREEN); // MeshVS_SMF_All
|
||||
myMapSelectionModeColors.Bind (0x0100, Quantity_NOC_GOLD); // MeshVS_SMF_Group
|
||||
}
|
||||
|
||||
virtual void Fill (const Standard_Integer theCol,
|
||||
const Standard_Integer theRow,
|
||||
const Standard_Integer thePicked) Standard_OVERRIDE
|
||||
{
|
||||
if (thePicked < 1
|
||||
|| thePicked > myMainSel->NbPicked())
|
||||
{
|
||||
myImage->SetPixelColor (theCol, theRow, Quantity_Color (Quantity_NOC_BLACK));
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Integer aSelectionMode = -1;
|
||||
const Handle(SelectMgr_SelectableObject)& aSelectable = myMainSel->Picked (thePicked)->Selectable();
|
||||
const Handle(SelectBasics_SensitiveEntity)& anEntity = myMainSel->PickedEntity (thePicked);
|
||||
for (aSelectable->Init(); aSelectable->More(); aSelectable->Next())
|
||||
{
|
||||
const Handle(SelectMgr_Selection)& aSelection = aSelectable->CurrentSelection();
|
||||
for (aSelection->Init(); aSelection->More(); aSelection->Next())
|
||||
{
|
||||
if (aSelection->Sensitive()->BaseSensitive() == anEntity)
|
||||
{
|
||||
aSelectionMode = aSelection->Mode();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (aSelectionMode == -1)
|
||||
{
|
||||
myImage->SetPixelColor (theCol, theRow, Quantity_Color (Quantity_NOC_BLACK));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myMapSelectionModeColors.IsBound (aSelectionMode))
|
||||
{
|
||||
Quantity_Color aColor;
|
||||
randomPastelColor (aColor);
|
||||
myMapSelectionModeColors.Bind (aSelectionMode, aColor);
|
||||
}
|
||||
|
||||
const Quantity_Color& aColor = myMapSelectionModeColors.Find (aSelectionMode);
|
||||
myImage->SetPixelColor (theCol, theRow, aColor);
|
||||
}
|
||||
|
||||
protected:
|
||||
NCollection_DataMap<Standard_Integer, Quantity_Color> myMapSelectionModeColors;
|
||||
};
|
||||
|
||||
//! Help class for filling pixel with color of detected shape.
|
||||
class DetectedObjectColorFiller : public BaseFiller
|
||||
{
|
||||
DEFINE_STANDARD_RTTI_INLINE(DetectedObjectColorFiller, BaseFiller)
|
||||
public:
|
||||
DetectedObjectColorFiller (Image_PixMap& thePixMap,
|
||||
StdSelect_ViewerSelector3d* theSelector)
|
||||
: BaseFiller (thePixMap, theSelector) {}
|
||||
|
||||
virtual void Fill (const Standard_Integer theCol,
|
||||
const Standard_Integer theRow,
|
||||
const Standard_Integer thePicked) Standard_OVERRIDE
|
||||
{
|
||||
Quantity_Color aColor (Quantity_NOC_BLACK);
|
||||
if (thePicked > 0
|
||||
&& thePicked <= myMainSel->NbPicked())
|
||||
{
|
||||
const Handle(SelectMgr_SelectableObject)& aSelectable = myMainSel->Picked (thePicked)->Selectable();
|
||||
aColor = aSelectable->Attributes()->Color();
|
||||
}
|
||||
myImage->SetPixelColor (theCol, theRow, aColor);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ToPixMap
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean StdSelect_ViewerSelector3d::ToPixMap (Image_PixMap& theImage,
|
||||
const Handle(V3d_View)& theView,
|
||||
const StdSelect_TypeOfSelectionImage theType,
|
||||
const Standard_Integer thePickedIndex)
|
||||
{
|
||||
if (theImage.IsEmpty())
|
||||
{
|
||||
Standard_ProgramError::Raise ("StdSelect_ViewerSelector3d::ToPixMap() has been called with empty image");
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
Handle(BaseFiller) aFiller;
|
||||
switch (theType)
|
||||
{
|
||||
case StdSelect_TypeOfSelectionImage_NormalizedDepth:
|
||||
case StdSelect_TypeOfSelectionImage_NormalizedDepthInverted:
|
||||
{
|
||||
aFiller = new NormalizedDepthFiller (theImage, this,
|
||||
theType == StdSelect_TypeOfSelectionImage_NormalizedDepthInverted);
|
||||
break;
|
||||
}
|
||||
case StdSelect_TypeOfSelectionImage_UnnormalizedDepth:
|
||||
{
|
||||
aFiller = new UnnormalizedDepthFiller (theImage, this);
|
||||
break;
|
||||
}
|
||||
case StdSelect_TypeOfSelectionImage_ColoredDetectedObject:
|
||||
{
|
||||
aFiller = new DetectedObjectColorFiller (theImage, this);
|
||||
break;
|
||||
}
|
||||
case StdSelect_TypeOfSelectionImage_ColoredEntity:
|
||||
{
|
||||
aFiller = new GeneratedEntityColorFiller (theImage, this, mySelectableObjects);
|
||||
break;
|
||||
}
|
||||
case StdSelect_TypeOfSelectionImage_ColoredOwner:
|
||||
{
|
||||
aFiller = new GeneratedOwnerColorFiller (theImage, this, mySelectableObjects);
|
||||
break;
|
||||
}
|
||||
case StdSelect_TypeOfSelectionImage_ColoredSelectionMode:
|
||||
{
|
||||
aFiller = new GeneratedSelModeColorFiller (theImage, this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aFiller.IsNull())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const Standard_Integer aSizeX = static_cast<Standard_Integer> (theImage.SizeX());
|
||||
const Standard_Integer aSizeY = static_cast<Standard_Integer> (theImage.SizeY());
|
||||
for (Standard_Integer aRowIter = 0; aRowIter < aSizeY; ++aRowIter)
|
||||
{
|
||||
for (Standard_Integer aColIter = 0; aColIter < aSizeX; ++aColIter)
|
||||
{
|
||||
Pick (aColIter, aRowIter, theView);
|
||||
aFiller->Fill (aColIter, aRowIter, thePickedIndex);
|
||||
}
|
||||
}
|
||||
aFiller->Flush();
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -25,7 +25,9 @@
|
||||
#include <Graphic3d_SequenceOfHClipPlane.hxx>
|
||||
#include <SelectMgr_ViewerSelector.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <StdSelect_TypeOfSelectionImage.hxx>
|
||||
#include <NCollection_Handle.hxx>
|
||||
#include <V3d_ImageDumpOptions.hxx>
|
||||
|
||||
class Graphic3d_Group;
|
||||
class Graphic3d_Structure;
|
||||
@@ -69,6 +71,18 @@ public:
|
||||
Standard_EXPORT void Pick (const TColgp_Array1OfPnt2d& thePolyline,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
//! Dump of detection results into image.
|
||||
//! This method performs axis picking for each pixel in the image
|
||||
//! and generates a color depending on picking results and selection image type.
|
||||
//! @param theImage result image, should be initialized
|
||||
//! @param theView 3D view defining camera position
|
||||
//! @param theType type of image to define
|
||||
//! @param thePickedIndex index of picked entity (1 means topmost)
|
||||
Standard_EXPORT Standard_Boolean ToPixMap (Image_PixMap& theImage,
|
||||
const Handle(V3d_View)& theView,
|
||||
const StdSelect_TypeOfSelectionImage theType,
|
||||
const Standard_Integer thePickedIndex = 1);
|
||||
|
||||
//! Displays sensitives in view <theView>.
|
||||
Standard_EXPORT void DisplaySensitive (const Handle(V3d_View)& theView);
|
||||
|
||||
|
Reference in New Issue
Block a user