VLayout.cpp

Go to the documentation of this file.
00001 #pragma ident "$Id: VLayout.cpp 1644 2009-01-27 19:26:14Z ckiesch $"
00002 
00004 
00005 //============================================================================
00006 //
00007 //  This file is part of GPSTk, the GPS Toolkit.
00008 //
00009 //  The GPSTk is free software; you can redistribute it and/or modify
00010 //  it under the terms of the GNU Lesser General Public License as published
00011 //  by the Free Software Foundation; either version 2.1 of the License, or
00012 //  any later version.
00013 //
00014 //  The GPSTk is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 //  GNU Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with GPSTk; if not, write to the Free Software Foundation,
00021 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //  
00023 //  Copyright 2004, The University of Texas at Austin
00024 //
00025 //============================================================================
00026 
00027 #include <iostream>
00028 #include "VLayout.hpp"
00029 
00030 namespace vdraw
00031 {
00032    VLayout::VLayout(const Frame& frame, int nframes) : 
00033      Layout(frame), targetList(nframes)
00034    {
00035       Frame parent=getParentFrame();
00036       double ylow=parent.ly();
00037       double yhigh=parent.uy();
00038       double height = parent.getHeight()/nframes;
00039       for (int i=0;i<nframes;i++)
00040       {
00041          double yloc = ylow + i*(yhigh-ylow)/nframes;
00042          targetList[i].setWidth(parent.getWidth());
00043          targetList[i].setHeight(height);
00044          targetList[i].nest(parent, 0, yloc);
00045       }
00046    }
00047 
00048    VLayout::VLayout(const Frame& frame, double fraction)
00049          : Layout(frame), targetList(2)
00050    {
00051       Frame parent=getParentFrame();
00052 
00053       double ylow=parent.ly();
00054 
00055       targetList[0].setHeight(parent.getHeight()*fraction);      
00056       targetList[0].setWidth(parent.getWidth());
00057       targetList[0].nest(parent, 0, ylow);
00058       targetList[1].setHeight(parent.getHeight()*(1.-fraction));      
00059       targetList[1].setWidth(parent.getWidth());
00060       targetList[1].nest(parent, 0, ylow+parent.getHeight()*fraction);
00061 
00062    }
00063    
00064 }

Generated on Wed Feb 8 03:31:04 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1