Ignore:
Timestamp:
Dec 1, 2011, 12:44:42 PM (9 years ago)
Author:
sommeria
Message:

bug reapirs in view of vector colors and grid in civ

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/set_col_vec.m

    r102 r313  
    11%'set_col_vec': sets the color code for vectors depending on a scalar vec_C and parameters given by the struct colcode
    2 %function [colorlist,col_vec,minC,colcode1,colcode2,maxC]=colvec(colcode,vec_C)
     2%function [colorlist,col_vec,minC,ColCode1,ColCode2,maxC]=colvec(colcode,vec_C)
    33%OUTPUT
    44%colorlist(nb,3); %list of nb colors
    55%col_vec, size=[length(vec_C),3)];%list of color indices corresponding to vec_C
    66%minC, maxC: min and max of vec_C
    7 %colcode1, colcode2: absolute threshold in vec_C corresponding to colcode.colcode1 and colcode.colcode2
     7%ColCode1, ColCode2: absolute threshold in vec_C corresponding to colcode.ColCode1 and colcode.ColCode2
    88%INPUT
    99% colcode: struture setting the colorcode for vectors
    1010            % colcode.CName: 'ima_cor','black','white',...
    11             % colcode.ColorCode ='black', 'white', 'rgb','brg', '64 colors'
     11            % colcode.ListColorCode ='black', 'white', 'rgb','brg', '64 colors'
    1212            % colcode.FixedCbounds =0; thresholds scaling relative to min and max, =1 fixed thresholds
    1313            % colcode.MinC; min
    1414            % colcode.MaxC; max
    15             % colcode.colcode1: first threshold for rgb, relative to min (0) and max (1)
    16             % colcode.colcode2: second threshold for rgb, relative to min (0) and max (1),
    17             % rmq: we need min <= colcode1 <= colcode2 <= max, otherwise
    18             % colcode1 and colcode2 are adjusted to the bounds
     15            % colcode.ColCode1: first threshold for rgb, relative to min (0) and max (1)
     16            % colcode.ColCode2: second threshold for rgb, relative to min (0) and max (1),
     17            % rmq: we need min <= ColCode1 <= ColCode2 <= max, otherwise
     18            % ColCode1 and ColCode2 are adjusted to the bounds
    1919% vec_C: matlab vector representing the scalar setting the color
    2020function [colorlist,col_vec,colcode_out]=set_col_vec(colcode,vec_C)
     
    2727    return
    2828end
    29 if (isfield(colcode,'FixedCbounds') && isequal(colcode.FixedCbounds,1))
    30     minC=colcode.MinC;
    31     maxC=colcode.MaxC;
     29if (isfield(colcode,'CheckFixVecColor') && isequal(colcode.CheckFixVecColor,1))
     30    minC=colcode.MinVec;
     31    maxC=colcode.MaxVec;
    3232else
    3333    minC=min(vec_C);
     
    3737%default input parameters
    3838if ~isstruct(colcode),colcode=[];end;
    39 if ~isfield(colcode,'ColorCode') || isempty(colcode.ColorCode)
     39if ~isfield(colcode,'ListColorCode') || isempty(colcode.ListColorCode)
    4040    colorlist=[0 0 1]; %blue 
    4141    col_vec=ones(size(vec_C));
    4242    return
    4343end
    44 if  isfield(colcode,'colcode1')
    45     colcode1=minC+colcode.colcode1*(maxC-minC);
     44if  isfield(colcode,'ColCode1')
     45    ColCode1=minC+colcode.ColCode1*(maxC-minC);
    4646else
    47     colcode1=minC+(maxC-minC)/3;%default
     47    ColCode1=minC+(maxC-minC)/3;%default
    4848end
    49 if isfield(colcode,'colcode2')
    50     colcode2=minC+colcode.colcode2*(maxC-minC);
     49if isfield(colcode,'ColCode2')
     50    ColCode2=minC+colcode.ColCode2*(maxC-minC);
    5151else
    52     colcode2=minC+2*(maxC-minC)/3;%default
     52    ColCode2=minC+2*(maxC-minC)/3;%default
    5353end
    5454colcode_out.MinC=minC;
    5555colcode_out.MaxC=maxC;
    56 if strcmp(colcode.ColorCode,'black')
     56if strcmp(colcode.ListColorCode,'black')
    5757    colorlist(1,:)=[0 0 0];%black
    5858    col_vec=ones(size(vec_C));%all vectors at color#1
    59 elseif strcmp(colcode.ColorCode,'white')
     59elseif strcmp(colcode.ListColorCode,'white')
    6060    colorlist(1,:)=[1 1 1];%white
    6161    col_vec=ones(size(vec_C));%all vectors at color#1
    62 elseif strcmp(colcode.ColorCode,'rgb')|| strcmp(colcode.ColorCode,'bgr')% 3 color representation
    63     ind1=find(vec_C < colcode1); % =1 for red vectors
    64     ind_green=find((vec_C >= colcode1) & (vec_C < colcode2));% =1 for green vectors
    65     ind3=find(vec_C >= colcode2);% =1 for blue vectors
     62elseif strcmp(colcode.ListColorCode,'rgb')|| strcmp(colcode.ListColorCode,'bgr')% 3 color representation
     63    ind1=find(vec_C < ColCode1); % =1 for red vectors
     64    ind_green=find((vec_C >= ColCode1) & (vec_C < ColCode2));% =1 for green vectors
     65    ind3=find(vec_C >= ColCode2);% =1 for blue vectors
    6666    colorlist(2,:)=[0 1 0];%green
    6767    col_vec(ind1)=1;
    6868    col_vec(ind_green)=2;
    6969    col_vec(ind3)=3;
    70     if strcmp(colcode.ColorCode,'rgb')
     70    if strcmp(colcode.ListColorCode,'rgb')
    7171        colorlist(1,:)=[1 0 0];%red
    7272        colorlist(3,:)=[0 0 1];%blue
Note: See TracChangeset for help on using the changeset viewer.