Home > pathway > getPathwayDimensions.m

getPathwayDimensions

PURPOSE ^

getPathwayDimensions

SYNOPSIS ^

function dimensions=getPathwayDimensions(pathway)

DESCRIPTION ^

 getPathwayDimensions 
   Retrieves the dimensions of metabolic network in a pathway structure.
   Returns the position of the upper left corner, width and height.

   pathway         pathway structure representing the pathway to be drawn

   dimension       a 1x4 vector with x and y for the upper left corner,
                   height and width

   Usage: dimensions=getPathwayDimensions(pathway)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function dimensions=getPathwayDimensions(pathway)
0002 % getPathwayDimensions
0003 %   Retrieves the dimensions of metabolic network in a pathway structure.
0004 %   Returns the position of the upper left corner, width and height.
0005 %
0006 %   pathway         pathway structure representing the pathway to be drawn
0007 %
0008 %   dimension       a 1x4 vector with x and y for the upper left corner,
0009 %                   height and width
0010 %
0011 %   Usage: dimensions=getPathwayDimensions(pathway)
0012 
0013 right=0;
0014 left=inf;
0015 top=inf;
0016 bottom=0;
0017 
0018 %Loops through the compartments to find the right and bottom border and the
0019 %position of the upper left corner
0020 for i=1:length(pathway.listOfCompartments)
0021     if pathway.listOfCompartments(1,i).x<left
0022         left=pathway.listOfCompartments(1,i).x;
0023     end
0024     if pathway.listOfCompartments(1,i).y<top
0025         top=pathway.listOfCompartments(1,i).y;
0026     end
0027     if (pathway.listOfCompartments(1,i).x+pathway.listOfCompartments(1,i).w)>right
0028         right=pathway.listOfCompartments(1,i).x+pathway.listOfCompartments(1,i).w;
0029     end
0030     if (pathway.listOfCompartments(1,i).y+pathway.listOfCompartments(1,i).h)>bottom
0031         bottom=pathway.listOfCompartments(1,i).y+pathway.listOfCompartments(1,i).h;
0032     end
0033 end
0034 
0035 %Loops through the species to find the object furthest to the right, left,
0036 %top and bottom
0037 for i=1:length(pathway.listOfSpecies)
0038     if pathway.listOfSpecies(1,i).x<left
0039         left=pathway.listOfSpecies(1,i).x;
0040     end
0041     if pathway.listOfSpecies(1,i).y<top
0042         top=pathway.listOfSpecies(1,i).y;
0043     end
0044     if (pathway.listOfSpecies(1,i).x+pathway.listOfSpecies(1,i).w)>right
0045         right=pathway.listOfSpecies(1,i).x+pathway.listOfSpecies(1,i).w;
0046     end
0047     if (pathway.listOfSpecies(1,i).y+pathway.listOfSpecies(1,i).h)>bottom
0048         bottom=pathway.listOfSpecies(1,i).y+pathway.listOfSpecies(1,i).h;
0049     end
0050 end
0051 
0052 dimensions=[left,top,right-left,bottom-top];
0053 end

Generated by m2html © 2005