File indexing completed on 2025-01-18 10:04:53
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 Handle(SelectMgr_SelectionImageFiller) CreateFiller (Image_PixMap& thePixMap,
0031 SelectMgr_ViewerSelector* theSelector,
0032 StdSelect_TypeOfSelectionImage theType);
0033
0034 public:
0035
0036
0037 SelectMgr_SelectionImageFiller (Image_PixMap& thePixMap,
0038 SelectMgr_ViewerSelector* theSelector)
0039 : myImage (&thePixMap),
0040 myMainSel(theSelector) {}
0041
0042
0043 virtual void Fill (const Standard_Integer theCol,
0044 const Standard_Integer theRow,
0045 const Standard_Integer thePicked) = 0;
0046
0047
0048 virtual void Flush() {}
0049
0050 protected:
0051
0052
0053 void randomPastelColor (Quantity_Color& theColor)
0054 {
0055 for (;;)
0056 {
0057 nextRandomPastelColor (theColor);
0058 if (myUniqueColors.Add (theColor))
0059 {
0060 return;
0061 }
0062 }
0063 }
0064
0065
0066 void nextRandomPastelColor (Quantity_Color& theColor)
0067 {
0068 theColor = Quantity_Color (Standard_Real(myBullardGenerator.NextInt() % 256) / 255.0,
0069 Standard_Real(myBullardGenerator.NextInt() % 256) / 255.0,
0070 Standard_Real(myBullardGenerator.NextInt() % 256) / 255.0,
0071 Quantity_TOC_sRGB);
0072 }
0073
0074 protected:
0075 Image_PixMap* myImage;
0076 SelectMgr_ViewerSelector* myMainSel;
0077 math_BullardGenerator myBullardGenerator;
0078 NCollection_Map<Quantity_Color> myUniqueColors;
0079 };
0080
0081 #endif