Home > RAVEN > 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)

   Rasmus Agren, 2010-12-16

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 %   Rasmus Agren, 2010-12-16
0014 %
0015 
0016 right=0;
0017 left=inf;
0018 top=inf;
0019 bottom=0;
0020 
0021 %Loops through the compartments to find the right and bottom border and the
0022 %position of the upper left corner
0023 for i=1:length(pathway.listOfCompartments)
0024     if pathway.listOfCompartments(1,i).x<left
0025         left=pathway.listOfCompartments(1,i).x;
0026     end
0027     if pathway.listOfCompartments(1,i).y<top
0028         top=pathway.listOfCompartments(1,i).y;
0029     end
0030     if (pathway.listOfCompartments(1,i).x+pathway.listOfCompartments(1,i).w)>right
0031         right=pathway.listOfCompartments(1,i).x+pathway.listOfCompartments(1,i).w;
0032     end
0033     if (pathway.listOfCompartments(1,i).y+pathway.listOfCompartments(1,i).h)>bottom
0034         bottom=pathway.listOfCompartments(1,i).y+pathway.listOfCompartments(1,i).h;
0035     end
0036 end
0037 
0038 %Loops through the species to find the object furthest to the right, left, top
0039 %and bottom
0040 for i=1:length(pathway.listOfSpecies)
0041     if pathway.listOfSpecies(1,i).x<left
0042         left=pathway.listOfSpecies(1,i).x;
0043     end
0044     if pathway.listOfSpecies(1,i).y<top
0045         top=pathway.listOfSpecies(1,i).y;
0046     end
0047     if (pathway.listOfSpecies(1,i).x+pathway.listOfSpecies(1,i).w)>right
0048         right=pathway.listOfSpecies(1,i).x+pathway.listOfSpecies(1,i).w;
0049     end
0050     if (pathway.listOfSpecies(1,i).y+pathway.listOfSpecies(1,i).h)>bottom
0051         bottom=pathway.listOfSpecies(1,i).y+pathway.listOfSpecies(1,i).h;
0052     end
0053 end
0054 
0055 dimensions=[left,top,right-left,bottom-top];

Generated on Tue 16-Jul-2013 21:50:02 by m2html © 2005