/* 
 * Thomas Pantzer: neuron_show.cc, v0.4.7  8.6.99 16:32 
 * Thomas Pantzer: neuron_show.cc, v0.1b  23.9.97 22:29 
 * 
 * 
 * Copyright 1997 by Thomas Pantzer
 * 
 * Permission to use, copy, modify, and distribute this software for noncommercial 
 * use and without fee is hereby granted, provided that the above copyright notice 
 * appear in all copies and that both that copyright notice and this permission 
 * notice appear in supporting documentation, and that the name of the Author not be 
 * used in advertising or publicity pertaining to distribution of the software 
 * without specific, written prior permission. The Author makes no representations about
 * the suitability of this software for any purpose.  It is provided "as is" 
 * without expressed or implied warranty. 
 * 
 * 
 * pantec@aix520.informatik.uni-leipzig.de   (Thomas Pantzer) 
 * 
 */


#include "copyright.h"

#include "forms.h"
#include "neuronal.h"
#include "neuron_show.h"
#include "graphix.h"



void Show_Synapse(t_vector &p1, t_vector &p2,int id,double weight)      
{
//  char st[256];
  
#ifdef DEBUG
  fprintf(stderr,"show_synapse(id=%d w=%g t=%d   %g,%g -> %g,%g\n",
                   id,weight,kind,p1.x,p1.y,p2.x,p2.y);
#endif

#define Max_Age 512
  
  if (weight > Max_Age/4.0) 
     {
      if (weight > Max_Age / 2.0)
         SetColor(FL_RED);
       else    
         SetColor(FL_DARKCYAN);
     }    
    else
      SetColor(FL_CYAN);
  
  int ZOOM = VScr.size;
  
/*  
  if (VScreen.width < VScreen.height)
     ZOOM = VScreen.width;
   else
     ZOOM = VScreen.height;  
 */
       
  drawline((int)(p1.x*ZOOM),(int)(p1.y*ZOOM),
           (int)(p2.x*ZOOM),(int)(p2.y*ZOOM));
  
//  sprintf(st,"%2.3g",weight);

//  VScr.SetColor(FL_RED);
//  OutTextXY((int)((p1.x + p2.x)*ZOOM)/2,(int)((p1.y + p2.y)*ZOOM)/2,st);
}

void Show_Neuron(t_vector &p,int id,double act,int kind)      
{
//  char st[256];
  int i,r,g,b;
#ifdef DEBUG
  fprintf(stderr,"show_neuron(id=%d b=%g t=%d   %g,%g\n",
                   id,act,kind,p.x,p.y);
#endif                   

  int ZOOM = VScr.size;
/*  
  if (VScreen.width < VScreen.height)
     ZOOM = VScreen.width;
   else
     ZOOM = VScreen.height;  
 */
                   
  i = (int)(act * 255.0); 
  i &= 0xff;
  
  r = g = b = 0;
  
  switch (kind)
    {
     case _HIDDEN_N:
       SetColor(FL_DOGERBLUE);
       break;

     default:
       SetColor(FL_GREEN);
       break;
    }
  

  FillCircle(
            (int)((p.x*ZOOM) - (NEURON_RADIUS/2)),
              (int)((p.y*ZOOM) - (NEURON_RADIUS/2)),
               NEURON_RADIUS);
/*
  XFillArc(VScreen.dpy,VScreen.win,VScreen.gc,
            (int)((p.x*ZOOM) - (NEURON_RADIUS/2)),
              (int)((p.y*ZOOM) - (NEURON_RADIUS/2)),
               NEURON_RADIUS,NEURON_RADIUS,0,360*64);
 */
 
//  sprintf(st,"%2.3g",Bias);               
//  VScr.SetColor(Text_COLOR);
//  OutTextXY((x*ZOOM) + NEURON_RADIUS,(y*ZOOM) + NEURON_RADIUS,st);
}









/**/
/**/
/**/
/**/
/**/
/**/
/**/
/**/
/*****  End Of File  ****************************/
