Changeset 127 in Sophya for trunk/SophyaPI/PI/picmapview.cc
- Timestamp:
- Jul 31, 1998, 5:22:21 PM (27 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/picmapview.cc
r113 r127 1 #include <stdio.h> 2 #include <string.h> 1 // Module PI : Peida Interactive PICMapView 2 // Visualisation de table de couleur R. Ansari 07/98 3 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 3 4 4 5 #include "picmapview.h" … … 12 13 13 14 { 14 15 cmap = NULL; 15 16 } 16 17 … … 19 20 PICMapView::~PICMapView() 20 21 { 22 if (cmap) delete cmap; 21 23 } 22 24 23 25 24 26 /* --Methode-- */ 27 void PICMapView::SetColMap(PIColorMap* cmp, bool refr) 28 { 29 if (cmap) delete cmap; 30 if (cmp == NULL) cmap = NULL; 31 else cmap = new PIColorMap(*cmp); 32 if (refr) Refresh(); 33 return; 34 } 25 35 26 36 /* --Methode-- */ 27 void PICMapView:: Resize()37 void PICMapView::SetColMapId(CMapId cmapid, bool refr) 28 38 { 29 39 if (cmap && (cmap->Type() == cmapid) && (cmapid != CMAP_OTHER) ) return; 40 if (cmap) delete cmap; 41 cmap = new PIColorMap(cmapid); 42 if (refr) Refresh(); 43 return; 30 44 } 31 45 32 46 33 47 /* --Methode-- */ 34 void PICMapView::Draw(PIGraphicGen* g )48 void PICMapView::Draw(PIGraphicGen* g, int /*x0*/, int /*y0*/, int /*dx*/, int /*dy*/) 35 49 { 36 EraseWindow(); 37 g->SelLine(PI_NormalLine); 38 g->DrawBox(10,10, XSize()-20, YSize()-20); 50 if (!cmap) { 51 EraseWindow(0, 0, XSize(), YSize()); 52 return; 53 } 54 // On presente la table de couleur verticalement si SizeY > SizeX 55 // ou horizontale si SizeX > SizeY 39 56 40 g->SelLine(PI_ThinLine); 41 g->DrawFBox(20, 20, 20, 20); 42 g->DrawCircle(30, 30, 15); 57 int sx = XSize(); 58 int sy = YSize(); 43 59 44 g->SelForeground(PI_Red); 45 g->DrawFCircle(70, 30, 15); 46 47 g->SelForeground(PI_Yellow); 48 g->DrawFBox(10, 60, 100, 15); 49 50 g->SelForeground(PI_Black); 51 52 g->SelLine(PI_ThinLine); 53 g->DrawLine(10, 120, 40, 120); 54 g->SelLine(PI_NormalLine); 55 g->DrawLine(40, 120, 70, 120); 56 g->SelLine(PI_ThickLine); 57 g->DrawLine(70, 120, 100, 120); 58 59 g->SelForeground(PI_Magenta); 60 g->DrawFCircle(120, 30, 15); 61 g->SelForeground(PI_Grey); 62 g->DrawFCircle(120, 60, 15); 63 64 PIGrCoord x[5] = { 20, 35, 50, 65, 80 }; 65 PIGrCoord y[5] = { 130, 130, 130, 130, 130 }; 66 67 g->SelForeground(PI_Black); 68 g->DrawMarkers(x, y, 5); 69 return; 60 int k; 61 if (sx > sy) { // horizontal 62 int xc, dx; 63 xc = 0; 64 for(k=0; k<cmap->NCol(); k++) { 65 dx = (sx-xc)/(cmap->NCol()-k); 66 g->SelForeground((*cmap), k); 67 g->DrawFBox(xc, 0, dx, sy); 68 xc += dx; 69 } 70 } 71 else { // vertical 72 int yc, dy; 73 yc = sy; 74 for(k=0; k<cmap->NCol(); k++) { 75 dy = yc/(cmap->NCol()-k); 76 yc -= dy; 77 g->SelForeground((*cmap), k); 78 g->DrawFBox(0, yc, sx, dy); 79 } 80 } 81 82 return; 70 83 } 71 84
Note:
See TracChangeset
for help on using the changeset viewer.