Changeset 1122 in Sophya


Ignore:
Timestamp:
Jul 31, 2000, 7:07:02 PM (25 years ago)
Author:
ercodmgr
Message:

Ajout de tables de couleur MIDAS - NON termine , Reza 31/7/2000

Location:
trunk/SophyaPI/PI
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PI/picmap.cc

    r190 r1122  
    2222//--
    2323
    24 #define  MXMAPIDS   10
    25 static   int    MapNCols[MXMAPIDS] = {256, 256, 256, 256, 256, 256, 256, 256, 256, 256};
     24#define  MXMAPIDS   15
     25static   int    MapNCols[MXMAPIDS] = {256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
     26                                      256, 256, 256, 256, 256 };
    2627static   const char*  MapNoms[MXMAPIDS]  = {"Grey32","InvGrey32","ColRJ32","ColBR32",
    2728                               "ColRV32", "Grey128", "InvGrey128", "ColRJ128",
    28                                "ColBR128", "Col16"};
     29                               "ColBR128", "Col16",
     30                               "MIDAS_Pastel", "MIDAS_Heat", "MIDAS_Rainbow3",
     31                               "MIDAS_BlueRed", "MIDAS_BlueWhite" };
    2932static   CMapId MapIds[MXMAPIDS] = { CMAP_GREY32, CMAP_GREYINV32, CMAP_COLRJ32,
    3033                               CMAP_COLBR32, CMAP_COLRV32, CMAP_GREY128,
    3134                               CMAP_GREYINV128, CMAP_COLRJ128, CMAP_COLBR128, 
    32                                CMAP_COL16 } ;
     35                               CMAP_COL16,
     36                               CMAP_MIDAS_Pastel, CMAP_MIDAS_Heat, CMAP_MIDAS_Rainbow3,
     37                               CMAP_MIDAS_BlueRed, CMAP_MIDAS_BlueWhite } ;
    3338
    3439static   int mColTNums[8192];   // Max 8192 tables differentes pour le moment 
     
    3641
    3742static   int NMaxTableAuto = 0;
    38 static   PIColorMap* mMaps[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL };
     43static   PIColorMap* mMaps[15] = {NULL, NULL, NULL, NULL, NULL,
     44                                  NULL, NULL, NULL, NULL, NULL,
     45                                  NULL, NULL, NULL, NULL, NULL  };
     46
     47int  PIColorMap::NumberStandardColorMaps()
     48{
     49  return ( MXMAPIDS );
     50}
     51
     52CMapId PIColorMap::GetStandardColorMapId(int num)
     53{
     54  if ( (num < 0) || (num >= MXMAPIDS) )  num = 0;
     55  return (MapIds[num]) ;
     56}
     57
     58string PIColorMap::GetStandardColorMapName(int num)
     59{
     60  if ( (num < 0) || (num >= MXMAPIDS) )  num = 0;
     61  return (MapNoms[num]) ;
     62}
     63
    3964
    4065//++
     
    77102
    78103   if (NMaxTableAuto == 0) { //  Il faut allouer les tables de depart
    79      if ( TotNbColors() > 2048 ) NMaxTableAuto = MXMAPIDS-1;
     104     if ( TotNbColors() > 4096 ) NMaxTableAuto = MXMAPIDS-1;
    80105     else NMaxTableAuto = 3;
    81      for(k=0; k<NMaxTableAuto; k++)  {
     106     //     for(k=0; k<NMaxTableAuto; k++)  {
     107     for(k=0; k<3; k++)  {   // On alloue les 3 tables de depart
    82108        mnom = MapNoms[k];
     109        cout << " PIColorMap::PIColorMap(CMapId id) Allocating ColorMap "
     110             << mnom << " ... " << endl;
    83111        mMaps[k] = new PIColorMap(MapIds[k], MapNCols[k], mnom);
    84112     }
     
    88116   for(kdx=0; kdx<MXMAPIDS; kdx++)  if (id == MapIds[kdx])  break;
    89117   if (kdx == MXMAPIDS)  { id = MapIds[0];  kdx = 0; }
    90    for(k=0; k<NMaxTableAuto; k++) 
    91      if (id == mMaps[k]->Type()) {
     118   for(k=0; k<NMaxTableAuto; k++) {
     119     if ((MapIds[k] == id) && (mMaps[k] == NULL))  { //  Table pas encore alloue
     120       mnom = MapNoms[k];
     121       cout << " PIColorMap::PIColorMap(CMapId id) Allocating ColorMap "
     122             << mnom << " ... " << endl;
     123       mMaps[k] = new PIColorMap(MapIds[k], MapNCols[k], mnom);
     124     }
     125     if (mMaps[k] && (id == mMaps[k]->Type()) ) {
    92126       CopyFrom(mMaps[k]); 
    93127       mCTId = mMaps[k]->mCTId;  mColTNums[mCTId]++;
    94128       break;
    95129     }
     130   }
    96131   if (Type() != id)  {  // Table pas encore trouve dans la liste
    97132     k = NMaxTableAuto;
     
    353388      break;
    354389
     390  case CMAP_MIDAS_Pastel :   // Les valeurs correspondent a  je ne sais quel table MIDAS
     391  case CMAP_MIDAS_Heat :      // A faire  pour CMAP_MIDAS_Pastel CMAP_MIDAS_Heat
     392  case CMAP_MIDAS_Rainbow3 :  //    A faire  pour Heat Rainbow3 BlueRed BlueWhite
     393  case CMAP_MIDAS_BlueRed :   //    BlueRed -> idl11
     394  case CMAP_MIDAS_BlueWhite : //    BlueWhite -> blulut.lutlis
     395   {
     396    static float rgb_r[256] = {
     3970, 0, 0.01961, 0.0549, 0.08627, 0.1098, 0.13725, 0.15686, 0.18039, 0.2,
     3980.21569, 0.23529, 0.25098, 0.26275, 0.28235, 0.29412, 0.30588, 0.31765,
     3990.33333, 0.34118, 0.35294, 0.36078, 0.37255, 0.38431, 0.39216, 0.4,
     4000.41176, 0.41961, 0.43137, 0.43529, 0.44314, 0.45098, 0.45882, 0.46667,
     4010.47059, 0.48235, 0.48627, 0.49412, 0.50196, 0.50588, 0.5098, 0.51765,
     4020.52157, 0.53333, 0.53725, 0.54118, 0.54902, 0.55294, 0.55686, 0.56078,
     4030.56471, 0.57255, 0.58039, 0.58431, 0.58824, 0.59216, 0.59608, 0.6, 0.60392,
     4040.60784, 0.61176, 0.61569, 0.61961, 0.62745, 0.63137, 0.63529, 0.63922,
     4050.64314, 0.64706, 0.65098, 0.6549, 0.6549, 0.65882, 0.66275, 0.66667 ,
     4060.67059, 0.67843, 0.67843, 0.68235, 0.68627, 0.6902, 0.6902, 0.69412,
     4070.69804, 0.70196, 0.70196, 0.70588, 0.7098, 0.71373, 0.71373, 0.71765,
     4080.72157, 0.72157, 0.72941, 0.73333, 0.73333, 0.73725, 0.74118, 0.74118,
     4090.7451, 0.7451, 0.74902, 0.75294, 0.75294, 0.75686, 0.76078, 0.76078,
     4100.76471, 0.76471, 0.76863, 0.76863, 0.77255, 0.78039, 0.78039, 0.78431,
     4110.78431, 0.78824, 0.78824, 0.79216, 0.79216, 0.79608, 0.79608, 0.8, 0.8,
     4120.80392, 0.80392, 0.80784, 0.80784, 0.81176, 0.81176, 0.81569, 0.81569,
     4130.81961, 0.81961, 0.82745, 0.82745, 0.83137, 0.83137, 0.83529, 0.83529,
     4140.83922, 0.83922, 0.83922, 0.84314, 0.84314, 0.84706, 0.84706, 0.85098,
     4150.85098, 0.8549, 0.8549, 0.8549, 0.85882, 0.85882, 0.86275, 0.86275,
     4160.86275, 0.86667, 0.86667, 0.87059, 0.87059, 0.87059, 0.87843, 0.87843,
     4170.88235, 0.88235, 0.88235, 0.88627, 0.88627, 0.8902, 0.8902, 0.8902, 0.89412,
     4180.89412, 0.89412, 0.89804, 0.89804, 0.89804, 0.90196, 0.90196, 0.90588,
     4190.90588, 0.90588, 0.9098, 0.9098, 0.9098, 0.91373, 0.91373, 0.91373,
     4200.91765, 0.91765, 0.91765, 0.92157, 0.92157, 0.92157, 0.92941, 0.92941,
     4210.92941, 0.93333, 0.93333, 0.93333, 0.93725, 0.93725, 0.93725, 0.94118,
     4220.94118, 0.94118, 0.94118, 0.9451, 0.9451, 0.9451, 0.94902, 0.94902,
     4230.94902, 0.95294, 0.95294, 0.95294, 0.95686, 0.95686, 0.95686, 0.95686,
     4240.96078, 0.96078, 0.96078, 0.96471, 0.96471, 0.96471, 0.96471, 0.96863,
     4250.96863, 0.96863, 0.97255, 0.97255, 0.97255, 0.97255, 0.98039, 0.98039,
     4260.98039, 0.98039, 0.98431, 0.98431, 0.98431, 0.98824, 0.98824, 0.98824,
     4270.98824, 0.99216, 0.99216, 0.99216, 0.99216, 0.99608, 0.99608, 0.99608,
     4280.99608, 1, 1 };
     429    static float rgb_g[256] = {
     4300, 0, 0, 0, 0.00392, 0.00392, 0.00392, 0.00392, 0.00392, 0.00784,
     4310.00784, 0.00784, 0.00784, 0.01176, 0.01176, 0.01176, 0.01176, 0.01176,
     4320.01569, 0.01569, 0.01569, 0.01569, 0.01961, 0.01961, 0.01961, 0.01961,
     4330.02353, 0.02353, 0.02353, 0.02745, 0.02745, 0.02745, 0.02745, 0.03137,
     4340.03137, 0.03137, 0.03529, 0.03529, 0.03529, 0.03529, 0.04314, 0.04314,
     4350.04314, 0.04706, 0.04706, 0.04706, 0.05098, 0.05098, 0.05098, 0.0549,
     4360.0549, 0.0549, 0.05882, 0.05882, 0.05882, 0.06275, 0.06275, 0.06275, 0.06667,
     4370.06667, 0.06667, 0.07059, 0.07059, 0.07451, 0.07451, 0.07451, 0.07843,
     4380.07843, 0.08235, 0.08235, 0.08235, 0.08627, 0.08627, 0.0902, 0.0902,
     4390.0902, 0.09412, 0.09412, 0.09804, 0.09804, 0.10196, 0.10196, 0.10588,
     4400.10588, 0.1098, 0.1098, 0.1098, 0.11765, 0.11765, 0.12157, 0.12157,
     4410.12549, 0.12549, 0.12941, 0.12941, 0.13333, 0.13725, 0.13725, 0.14118,
     4420.14118, 0.1451, 0.1451, 0.14902, 0.14902, 0.15294, 0.15686, 0.15686,
     4430.16078, 0.16078, 0.16471, 0.16863, 0.16863, 0.17255, 0.17255, 0.17647,
     4440.18039, 0.18039, 0.18431, 0.18824, 0.18824, 0.19608, 0.2, 0.2, 0.20392,
     4450.20784, 0.20784, 0.21176, 0.21569, 0.21961, 0.21961, 0.22353, 0.22745,
     4460.23137, 0.23137, 0.23529, 0.23922, 0.24314, 0.24314, 0.24706, 0.25098,
     4470.2549, 0.25882, 0.26275, 0.26275, 0.27059, 0.27451, 0.27843, 0.28235,
     4480.28627, 0.2902, 0.29412, 0.29804, 0.29804, 0.30196, 0.30588, 0.3098,
     4490.31373, 0.31765, 0.32157, 0.32549, 0.33333, 0.33725, 0.34118, 0.3451,
     4500.34902, 0.35294, 0.35686, 0.36078, 0.36471, 0.37255, 0.37647, 0.38039,
     4510.38431, 0.38824, 0.39216, 0.4, 0.40392, 0.40784, 0.41176, 0.41961, 0.42353,
     4520.42745, 0.43529, 0.43922, 0.44314, 0.45098, 0.4549, 0.45882, 0.46667,
     4530.47059, 0.47843, 0.48235, 0.4902, 0.49412, 0.50196, 0.50588, 0.51373,
     4540.51765, 0.52549, 0.52941, 0.53725, 0.54118, 0.54902, 0.55686, 0.56078,
     4550.56863, 0.57647, 0.58039, 0.58824, 0.59608, 0.6, 0.60784, 0.61569,
     4560.62353, 0.63137, 0.63529, 0.64314, 0.65098, 0.65882, 0.66667, 0.67451,
     4570.68235, 0.6902, 0.69804, 0.70588, 0.71373, 0.72157, 0.72941, 0.73725, 0.7451,
     4580.75294, 0.76078, 0.77255, 0.78039, 0.78824, 0.79608, 0.80392, 0.81569,
     4590.82353, 0.83137, 0.84314, 0.85098, 0.86275, 0.87059, 0.87843, 0.8902 ,
     4600.89804, 0.9098, 0.91765, 0.92941, 0.94118, 0.94902, 0.96078, 0.97255,
     4610.98039, 0.99216 };
     462    static float rgb_b[256] = {
     4630, 0, 0, 0, 0.00392, 0.00392, 0.00392, 0.00392, 0.00392, 0.00784,
     4640.00784, 0.00784, 0.00784, 0.01176, 0.01176, 0.01176, 0.01176, 0.01176,
     4650.01569, 0.01569, 0.01569, 0.01569, 0.01961, 0.01961, 0.01961, 0.01961,
     4660.02353, 0.02353, 0.02353, 0.02745, 0.02745, 0.02745, 0.02745, 0.03137,
     4670.03137, 0.03137, 0.03529, 0.03529, 0.03529, 0.03529, 0.04314, 0.04314,
     4680.04314, 0.04706, 0.04706, 0.04706, 0.05098, 0.05098, 0.05098, 0.0549,
     4690.0549, 0.0549, 0.05882, 0.05882, 0.05882, 0.06275, 0.06275, 0.06275, 0.06667,
     4700.06667, 0.06667, 0.07059, 0.07059, 0.07451, 0.07451, 0.07451, 0.07843,
     4710.07843, 0.08235, 0.08235, 0.08235, 0.08627, 0.08627, 0.0902, 0.0902,
     4720.0902, 0.09412, 0.09412, 0.09804, 0.09804, 0.10196, 0.10196, 0.10588,
     4730.10588, 0.1098, 0.1098, 0.1098, 0.11765, 0.11765, 0.12157, 0.12157,
     4740.12549, 0.12549, 0.12941, 0.12941, 0.13333, 0.13725, 0.13725, 0.14118,
     4750.14118, 0.1451, 0.1451, 0.14902, 0.14902, 0.15294, 0.15686, 0.15686,
     4760.16078, 0.16078, 0.16471, 0.16863, 0.16863, 0.17255, 0.17255, 0.17647,
     4770.18039, 0.18039, 0.18431, 0.18824, 0.18824, 0.19608, 0.2, 0.2, 0.20392,
     4780.20784, 0.20784, 0.21176, 0.21569, 0.21961, 0.21961, 0.22353, 0.22745,
     4790.23137, 0.23137, 0.23529, 0.23922, 0.24314, 0.24314, 0.24706, 0.25098,
     4800.2549, 0.25882, 0.26275, 0.26275, 0.27059, 0.27451, 0.27843, 0.28235,
     4810.28627, 0.2902, 0.29412, 0.29804, 0.29804, 0.30196, 0.30588, 0.3098,
     4820.31373, 0.31765, 0.32157, 0.32549, 0.33333, 0.33725, 0.34118, 0.3451,
     4830.34902, 0.35294, 0.35686, 0.36078, 0.36471, 0.37255, 0.37647, 0.38039,
     4840.38431, 0.38824, 0.39216, 0.4, 0.40392, 0.40784, 0.41176, 0.41961, 0.42353,
     4850.42745, 0.43529, 0.43922, 0.44314, 0.45098, 0.4549, 0.45882, 0.46667,
     4860.47059, 0.47843, 0.48235, 0.4902, 0.49412, 0.50196, 0.50588, 0.51373,
     4870.51765, 0.52549, 0.52941, 0.53725, 0.54118, 0.54902, 0.55686, 0.56078,
     4880.56863, 0.57647, 0.58039, 0.58824, 0.59608, 0.6, 0.60784, 0.61569, 0.62353,
     4890.63137, 0.63529, 0.64314, 0.65098, 0.65882, 0.66667, 0.67451, 0.68235,
     4900.6902, 0.69804, 0.70588, 0.71373, 0.72157, 0.72941, 0.73725, 0.7451,
     4910.75294, 0.76078, 0.77255, 0.78039, 0.78824, 0.79608, 0.80392, 0.81569,
     4920.82353, 0.83137, 0.84314, 0.85098, 0.86275, 0.87059, 0.87843, 0.8902,
     4930.89804, 0.9098, 0.91765, 0.92941, 0.94118, 0.94902, 0.96078, 0.97255,
     4940.98039, 0.99216 };
     495    for(i=0; i<mNCol; i++) {
     496      mycol.red = (rgb_r[i]*65535.);
     497      mycol.green = (rgb_g[i]*65535.);
     498      mycol.blue = (rgb_b[i]*65535.);
     499      AllocColor(mycol, i);     
     500    }
     501   }
     502    break;
     503
    355504  default :
    356505    for(i=0; i<mNCol; i++) {
  • trunk/SophyaPI/PI/picmap.h

    r190 r1122  
    2222 CMAP_COLRJ128    = 8,     // 128 couleurs du rouge au jaune/blanc
    2323 CMAP_COLBR128    = 9,     // 128 couleurs du bleu au rouge
    24  CMAP_COL16       = 10     // 16 Couleurs Arcenciel
     24 CMAP_COL16       = 10,    // 16 Couleurs Arcenciel
     25
     26 // Tables de couleur importees de MIDAS
     27 CMAP_MIDAS_Pastel    = 101,   // Bleu-Violet-Rouge-Jaune
     28 CMAP_MIDAS_Heat      = 102,   // Noir-Rouge-Orange-Blanc
     29 CMAP_MIDAS_Rainbow3  = 103,   // Noir-Bleu-Vert-Jaune-Rouge-Violet-Blanc
     30 CMAP_MIDAS_BlueRed   = 104,   // Bleu-Violet-Rouge
     31 CMAP_MIDAS_BlueWhite = 105    // Noir-Bleu-Blanc
    2532 };
    2633
     
    3441
    3542  static void CleanColorMaps();
     43  static int  NumberStandardColorMaps();
     44  static CMapId GetStandardColorMapId(int num);
     45  static string GetStandardColorMapName(int num);
    3646
    3747protected:
  • trunk/SophyaPI/PI/piimgtools.cc

    r684 r1122  
    149149cpy = offy;
    150150mOptzc[0] = new PIOptMenu(this, "imglut-opt-3", bsx*1.75, bsy, cpx, cpy);
    151 mOptzc[0]->AppendItem("Grey32", 201);
    152 mOptzc[0]->AppendItem("GreyInv32", 202);
    153 mOptzc[0]->AppendItem("ColRJ32", 203);
    154 mOptzc[0]->AppendItem("ColBR32", 204);
    155 mOptzc[0]->AppendItem("ColRV32", 205);
    156 mOptzc[0]->AppendItem("Grey128", 206);
    157 mOptzc[0]->AppendItem("GreyInv128", 207);
    158 mOptzc[0]->AppendItem("ColRJ128", 208);
    159 mOptzc[0]->AppendItem("ColBR128", 209);
    160 mOptzc[0]->AppendItem("Col16", 210);
     151int kcc;
     152//  D'abord les tables standard de PI
     153for(kcc=0; kcc<10; kcc++) 
     154  mOptzc[0]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
     155// Les tables ramenees de MIDAS
     156mCaszc[0] = new PIMenu(mOptzc[0]->Menu(), "MIDAS-CMap");
     157for(kcc=10; kcc<PIColorMap::NumberStandardColorMaps(); kcc++)
     158  mCaszc[0]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(), 201+kcc);
     159mOptzc[0]->Menu()->AppendPDMenu(mCaszc[0]);
     160
    161161mOptzc[0]->SetValue(203);
    162162mOptzc[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     
    267267  delete mOptzc[i];
    268268  }
     269delete mCaszc[0];
    269270for(i=0; i<5; i++)  delete mButsz[i];
    270271for(i=0; i<3; i++)  delete mButcax[i];
     
    432433
    433434
    434 CMapId cmap[10] =  { CMAP_GREY32, CMAP_GREYINV32, CMAP_COLRJ32,
    435                       CMAP_COLBR32, CMAP_COLRV32, CMAP_GREY128,
    436                       CMAP_GREYINV128, CMAP_COLRJ128, CMAP_COLBR128,
    437                       CMAP_COL16 };
    438 
    439435if ((msg <= 110) && (msg >= 90))  // Zoom
    440436  PIImage::CurrentPIImage()->SetZoom((int)(msg-100), true);
    441 else if ((msg > 200) && (msg < 211)) // Changement de couleur
    442   PIImage::CurrentPIImage()->SetColMapId(cmap[msg-201], true);
     437else if ((msg > 200) && (msg < 299)) // Changement de couleur
     438  PIImage::CurrentPIImage()->SetColMapId(PIColorMap::GetStandardColorMapId(msg-201), true);
    443439
    444440// Cuts
  • trunk/SophyaPI/PI/piimgtools.h

    r557 r1122  
    3838// Pour la couleur et le zoom
    3939  PIOptMenu* mOptzc[2];
     40  PIMenu* mCaszc[2];
    4041// Pour expand et compress
    4142  PIButton* mButsz[5];
  • trunk/SophyaPI/PI/pioptmenux.cc

    r367 r1122  
    8383{
    8484// printf("PIOptMenuX::Process Msg= %d Sender= %lx \n", (int)msg, (long)sender);
    85 if (sender == mMen)   {
     85  // if (sender == mMen)   {    Ca peut venir d'un cascade menu !!
    8686  SetValue(UserMsg(msg));
    8787  ReSend(msg, this, NULL);
    88 }
     88  //}
    8989return;
    9090}
     
    114114int n;
    115115Arg warg[2];
     116
    116117n=mMen->GetNumItemMsg(msg);
    117118if (n < 0)  return;
Note: See TracChangeset for help on using the changeset viewer.