HOMEPAGE

Development Sites - Information for Software-Developers

Developer Platform
The first instructions
Installations
System param. structures
connect to MeteoCom
simple screen drawing
own data drawing
Picture service
File Management
EmailBulletin Service

MeteoTools::GetColorMatrix

ColorMatrix& GetColorMatrix();

Return Value

    This returned a ColorMatrix, an Array of COLOR_MATRIX structures.
     A ColorMatrix is a CArray-Objekt and is defined in
MeteoToolsDefs.h


     typedef struct
	{
	COLORREF press;    // pressure color scale 
	COLORREF airtemp;  // temperature color scale
	COLORREF sfctemp;  // water / surface temperature color scale
	COLORREF wind;     // Speed of Wind color scale (in Beaufort)
	COLORREF clouds;   // cloud color scale
	COLORREF prcpt;    // Precipitation color scale
	COLORREF weasd;    // Snow deep color scale
	COLORREF waves;    // wave height color scale
	COLORREF rh;       // Relative humidity color scale
	COLORREF bathy;    // color scale of the bathymetry (sea and land)
	}COLOR_MATRIX;

     typedef CArray<COLOR_MATRIX,COLOR_MATRIX&> ColorMatrix;

Remarks

    In the CodePage you can find DrawingTools.cpp for more detail.

Example

ColorMatrix& myColors=GetColorMatrix();
 
void DrawPlanes(CDC* pDC, int type)
   {
   int i,z,end,start;
   COLORREF bcol,pcol;

   if(!myIsoLines.GetSize()) return;
   if(!myCoordinates.GetSize()) return;
   if(type>(myIsoPlanes.GetSize()-1)) return;

   end=myIsoPlanes[type].start+myIsoPlanes[type].len;
   if(end>myIsoLines.GetSize()) end=myIsoLines.GetSize();
   start=myIsoPlanes[type].start;

   for(i=start; i<end; i++)
      {
      if(i<0 || i>=myIsoLines.GetSize()) break;
      if(myIsoLines[i].type!=type) continue;

      if( myIsoLines[i].ymax < Screen_ymin) continue;
      if((myIsoLines[i].xmax < Screen_xmin)
      ||(myIsoLines[i].xmin > Screen_xmax)) continue;
      if( myIsoLines[i].ymin > Screen_ymax) continue;
      z=myIsoLines[i].value; z&=255;
      if((type==PLANE_CLOUDS || type==PLANE_CCLOUDS 
                 || type==PLANE_PRCPT) && !z) continue;

      switch(type)
         {
         case PLANE_PRESS:  bcol=myColors[z].press; //fill the poligone
                            z+=iso_width[type]*2; z&=255;
                            pcol=myColors[z].press; //with a outline 
                            break;
         case PLANE_TERM:   pcol=bcol=myColors[z].airtemp; break;
         case PLANE_WTERM:  pcol=bcol=myColors[z].sfctemp; break;
         case PLANE_HTSGW:  pcol=bcol=myColors[z].waves; break;
         case PLANE_CCLOUDS:pcol=bcol=myColors[z+8].clouds; break;
         case PLANE_CLOUDS: pcol=bcol=myColors[z].clouds; break;
         case PLANE_PRCPT:  pcol=bcol=myColors[z].prcpt; break;
         case PLANE_SNOW:   pcol=bcol=myColors[z].weasd; break;
         case PLANE_ICE:    pcol=bcol=RGB_WITHE; break;
         case PLANE_RH:     pcol=bcol=myColors[z].rh; break;
         }
      DrawIsoPolygon(pDC,&myCoordinates[myIsoLines[i].start],
         myIsoLines[i].len,bcol,pcol,1);
      }
   }

// center point of Screen
// sx = Screen.cx / 2; sy = Screen.cy / 2;
// xoff,yoff,xscale,yscale --> see
DrawSeaData

struct LinePoint
   {
   short x;
   short y;
   };
typedef CArray<POINT,POINT&> PolyPoints;

void DrawIsoPolygon(CDC* pDC, COORDIANTE *point, int count,
 COLORREF bcol, COLORREF pcol, int flag)
   {
   CBrush Brush(bcol);
   CBrush *pOldBrush=pDC->SelectObject(&Brush);
   CPen Pen(PS_SOLID, 1,pcol);
   CPen *pOldPen;
   //fill the poligone with color bcol
   if(flag && bcol!=pcol) pOldPen=pDC->SelectObject(&Pen); 
   //else, not fill, only lines with color pcol
   else pOldPen=(CPen*) pDC->SelectStockObject(NULL_PEN);  
   pDC->SetPolyFillMode(ALTERNATE);
   PolyPoints mPoints;
   mPoints.SetSize(count);
   for (int i=0; i<count; i++) 
      {
      mPoints[i].x=(int)((double)(((double)point[i].x + xoff)/xscale))+sx;
      mPoints[i].y=(int)((double)(((double)point[i].y + yoff)/yscale))+sy;
      }
   pDC->Polygon(mPoints.GetData(),count);
   pDC->SelectObject(pOldBrush);
   pDC->SelectObject(pOldPen);
   }
  

See Also   MeteoToolsDefs.h
 

   Copyright 2007 Bonito Germany.   
www.bonito.net