File indexing completed on 2026-09-26 09:04:33
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _SelectMgr_SelectionImageFiller_HeaderFile
0015 #define _SelectMgr_SelectionImageFiller_HeaderFile
0016
0017 #include <Image_PixMap.hxx>
0018 #include <math_BullardGenerator.hxx>
0019 #include <NCollection_Map.hxx>
0020 #include <StdSelect_TypeOfSelectionImage.hxx>
0021
0022 class SelectMgr_ViewerSelector;
0023
0024
0025
0026 class SelectMgr_SelectionImageFiller : public Standard_Transient
0027 {
0028 public:
0029
0030 static occ::handle<SelectMgr_SelectionImageFiller> CreateFiller(
0031 Image_PixMap& thePixMap,
0032 SelectMgr_ViewerSelector* theSelector,
0033 StdSelect_TypeOfSelectionImage theType);
0034
0035 public:
0036
0037 SelectMgr_SelectionImageFiller(Image_PixMap& thePixMap, SelectMgr_ViewerSelector* theSelector)
0038 : myImage(&thePixMap),
0039 myMainSel(theSelector)
0040 {
0041 }
0042
0043
0044 virtual void Fill(const int theCol, const int theRow, const int thePicked) = 0;
0045
0046
0047 virtual void Flush() {}
0048
0049 protected:
0050
0051 void randomPastelColor(Quantity_Color& theColor)
0052 {
0053 for (;;)
0054 {
0055 nextRandomPastelColor(theColor);
0056 if (myUniqueColors.Add(theColor))
0057 {
0058 return;
0059 }
0060 }
0061 }
0062
0063
0064 void nextRandomPastelColor(Quantity_Color& theColor)
0065 {
0066 theColor = Quantity_Color(double(myBullardGenerator.NextInt() % 256) / 255.0,
0067 double(myBullardGenerator.NextInt() % 256) / 255.0,
0068 double(myBullardGenerator.NextInt() % 256) / 255.0,
0069 Quantity_TOC_sRGB);
0070 }
0071
0072 protected:
0073 Image_PixMap* myImage;
0074 SelectMgr_ViewerSelector* myMainSel;
0075 math_BullardGenerator myBullardGenerator;
0076 NCollection_Map<Quantity_Color> myUniqueColors;
0077 };
0078
0079 #endif