1 
2 // This file is part of the Alliance Project.
3 // Copyright (C) Laboratoire LIP6 - Departement ASIM
4 // Universite Pierre et Marie Curie
5 //
6 // The Alliance Project  is free software;  you can  redistribute it and/or
7 // modify  it  under the  terms  of  the  GNU  General  Public License  as
8 // published by  the Free  Software Foundation; either  version 2  of  the
9 // License, or (at your option) any later version.
10 //
11 // The Alliance Project  is distributed in the hope that it will be useful,
12 // but  WITHOUT  ANY  WARRANTY;  without  even  the  implied  warranty  of
13 // MERCHANTABILITY  or  FITNESS  FOR A  PARTICULAR PURPOSE.   See  the GNU
14 // General Public License for more details.
15 //
16 // You should have received a copy  of  the  GNU  General  Public  License
17 // along with  the Alliance Project;  if  not,  write to the  Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 //
21 // License-Tag
22 //
23 // Date   : 29/01/2004
24 // Author : Christophe Alexandre  <Christophe.Alexandre@lip6.fr>
25 //
26 // Authors-Tag
27 #include "mut.h"
28 #include "mph.h"
29 
30 #include "PConstants.h"
31 
32 #include "PIns.h"
33 
PIns(const loins * instance)34 PIns::PIns(const loins *instance):
35 PElem(), _instance(instance)
36 {
37     phfig* phmodel = getphfig(instance->FIGNAME, '0');
38     double InsWidth = (double)(phmodel->XAB2 - phmodel->XAB1);
39     _width = (double)(int)(InsWidth / PITCH + 0.5);
40 }
41 
42 PBBox
GetBBox() const43 PIns::GetBBox() const
44 {
45     return PBBox(PPos(GetPosX() - GetWidth() / 2.0, GetPosY() - GetHeight() / 2.0),
46                  PPos(GetPosX() + GetWidth() / 2.0, GetPosY() + GetHeight() / 2.0));
47 }
48 
49 ofstream&
Plot(ofstream & out) const50 PIns::Plot(ofstream& out) const
51 {
52   out << GetBBox().GetMinX()+0.4 << " " << GetBBox().GetMinY()+0.4 << endl
53       << GetBBox().GetMinX()+0.4 << " " << GetBBox().GetMaxY()-0.4 << endl
54       << GetBBox().GetMaxX()-0.4 << " " << GetBBox().GetMaxY()-0.4 << endl
55       << GetBBox().GetMaxX()-0.4 << " " << GetBBox().GetMinY()+0.4 << endl
56       << GetBBox().GetMinX()+0.4 << " " << GetBBox().GetMinY()+0.4 << endl << endl;
57 
58   return out;
59 }
60