Added first suppport for Polygons (Triangles).
This commit is contained in:
parent
d9ac21e594
commit
14fd994f69
|
@ -3,6 +3,7 @@
|
|||
|
||||
install ( FILES invertor.py
|
||||
fulladder.py
|
||||
polygons.py
|
||||
toolengines.py DESTINATION ${examplesInstallDir}/scripts )
|
||||
install ( DIRECTORY .coriolis2 DESTINATION ${examplesInstallDir}/scripts )
|
||||
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
from Hurricane import *
|
||||
from CRL import *
|
||||
|
||||
|
||||
def toDbU ( l ): return DbU.fromLambda(l)
|
||||
|
||||
|
||||
def doBreak ( level, message ):
|
||||
UpdateSession.close()
|
||||
Breakpoint.stop( level, message )
|
||||
UpdateSession.open()
|
||||
|
||||
|
||||
def buildPolygons ( editor ):
|
||||
UpdateSession.open()
|
||||
|
||||
cell = AllianceFramework.get().createCell( 'polygons' )
|
||||
cell.setTerminal( True )
|
||||
|
||||
cell.setAbutmentBox( Box( toDbU(0.0), toDbU(0.0), toDbU(15.0), toDbU(50.0) ) )
|
||||
|
||||
if editor:
|
||||
UpdateSession.close()
|
||||
editor.setCell( cell )
|
||||
editor.fit()
|
||||
UpdateSession.open()
|
||||
|
||||
technology = DataBase.getDB().getTechnology()
|
||||
metal1 = technology.getLayer( "METAL1" )
|
||||
poly = technology.getLayer( "POLY" )
|
||||
ptrans = technology.getLayer( "PTRANS" )
|
||||
ntrans = technology.getLayer( "NTRANS" )
|
||||
pdif = technology.getLayer( "PDIF" )
|
||||
ndif = technology.getLayer( "NDIF" )
|
||||
contdifn = technology.getLayer( "CONT_DIF_N" )
|
||||
contdifp = technology.getLayer( "CONT_DIF_P" )
|
||||
nwell = technology.getLayer( "NWELL" )
|
||||
contpoly = technology.getLayer( "CONT_POLY" )
|
||||
ntie = technology.getLayer( "NTIE" )
|
||||
|
||||
|
||||
net = Net.create( cell, 'my_net' )
|
||||
net.setExternal( True )
|
||||
t = Triangle.create( net, metal1, Point( toDbU( 0.0), toDbU( 0.0) )
|
||||
, Point( toDbU( 100.0), toDbU( 0.0) )
|
||||
, Point( toDbU( 50.0), toDbU( 50.0) ) )
|
||||
|
||||
UpdateSession.close()
|
||||
|
||||
#AllianceFramework.get().saveCell( cell, Catalog.State.Views )
|
||||
# No saving as we don't have
|
||||
return
|
||||
|
||||
|
||||
def ScriptMain ( **kw ):
|
||||
editor = None
|
||||
if kw.has_key('editor') and kw['editor']:
|
||||
editor = kw['editor']
|
||||
|
||||
buildPolygons( editor )
|
||||
return True
|
|
@ -92,6 +92,7 @@
|
|||
hurricane/Technology.h
|
||||
hurricane/Timer.h
|
||||
hurricane/Transformation.h
|
||||
hurricane/Triangle.h
|
||||
hurricane/DbU.h
|
||||
hurricane/UpdateSession.h
|
||||
hurricane/VectorCollection.h
|
||||
|
@ -160,6 +161,7 @@
|
|||
Horizontal.cpp
|
||||
Pad.cpp
|
||||
RoutingPad.cpp
|
||||
Triangle.cpp
|
||||
NetExternalComponents.cpp
|
||||
NetRoutingProperty.cpp
|
||||
Reference.cpp
|
||||
|
|
|
@ -0,0 +1,227 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
|
||||
//
|
||||
// This file is part of Hurricane.
|
||||
//
|
||||
// Hurricane is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// Hurricane is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
|
||||
// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the Lesser GNU General Public
|
||||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | H U R R I C A N E |
|
||||
// | V L S I B a c k e n d D a t a - B a s e |
|
||||
// | |
|
||||
// | Author : Jean-Paul Chaput |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./Triangle.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/Triangle.h"
|
||||
#include "hurricane/Net.h"
|
||||
#include "hurricane/BasicLayer.h"
|
||||
#include "hurricane/Layer.h"
|
||||
#include "hurricane/Error.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
Triangle::Triangle ( Net* net, const Layer* layer, const Point& a, const Point& b, const Point& c )
|
||||
: Super (net)
|
||||
, _layer (layer)
|
||||
, _points()
|
||||
{
|
||||
if (not _layer)
|
||||
throw Error("Can't create " + _TName("Triangle") + " : null layer");
|
||||
|
||||
_points[0] = a;
|
||||
_points[1] = b;
|
||||
_points[2] = c;
|
||||
}
|
||||
|
||||
|
||||
Triangle* Triangle::create ( Net* net, const Layer* layer, const Point& a, const Point& b, const Point& c )
|
||||
{
|
||||
Triangle* triangle = new Triangle ( net, layer, a, b, c );
|
||||
triangle->_postCreate();
|
||||
return triangle;
|
||||
}
|
||||
|
||||
|
||||
const Layer* Triangle::getLayer () const
|
||||
{ return _layer; };
|
||||
|
||||
|
||||
DbU::Unit Triangle::getX () const
|
||||
{
|
||||
DbU::Unit center = 0;
|
||||
for ( Point p : _points ) center += p.getX();
|
||||
return center/3;
|
||||
}
|
||||
|
||||
|
||||
DbU::Unit Triangle::getY () const
|
||||
{
|
||||
DbU::Unit center = 0;
|
||||
for ( Point p : _points ) center += p.getY();
|
||||
return center/3;
|
||||
}
|
||||
|
||||
|
||||
Box Triangle::getBoundingBox() const
|
||||
{
|
||||
DbU::Unit xmin = DbU::Max;
|
||||
DbU::Unit ymin = DbU::Max;
|
||||
DbU::Unit xmax = DbU::Min;
|
||||
DbU::Unit ymax = DbU::Min;
|
||||
|
||||
for ( Point p : _points ) {
|
||||
xmin = std::min( xmin, p.getX() );
|
||||
ymin = std::min( ymin, p.getY() );
|
||||
xmax = std::max( xmax, p.getX() );
|
||||
ymax = std::max( ymax, p.getY() );
|
||||
}
|
||||
|
||||
return Box( xmin, ymin, xmax, ymax );
|
||||
}
|
||||
|
||||
|
||||
Box Triangle::getBoundingBox ( const BasicLayer* basicLayer ) const
|
||||
{
|
||||
if (not _layer->contains(basicLayer)) return Box();
|
||||
return getBoundingBox();
|
||||
}
|
||||
|
||||
|
||||
void Triangle::translate ( const DbU::Unit& dx, const DbU::Unit& dy )
|
||||
{
|
||||
if ((dx != 0) or (dy != 0)) {
|
||||
invalidate(true);
|
||||
for ( Point p : _points ) p.translate( dx, dy );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Triangle::setLayer ( const Layer* layer )
|
||||
{
|
||||
if (not layer) throw Error("Can't set layer : null layer");
|
||||
|
||||
if (layer != _layer) {
|
||||
invalidate(false);
|
||||
_layer = layer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Triangle::setPoints ( const Point& a, const Point& b, const Point& c )
|
||||
{
|
||||
invalidate(true);
|
||||
_points[0] = a;
|
||||
_points[1] = b;
|
||||
_points[2] = c;
|
||||
}
|
||||
|
||||
|
||||
void Triangle::_toJson ( JsonWriter* writer ) const
|
||||
{
|
||||
Super::_toJson( writer );
|
||||
|
||||
jsonWrite( writer, "_layer" , _layer->getName() );
|
||||
jsonWrite( writer, "_points[0]", &_points[0] );
|
||||
jsonWrite( writer, "_points[1]", &_points[1] );
|
||||
jsonWrite( writer, "_points[2]", &_points[2] );
|
||||
}
|
||||
|
||||
|
||||
string Triangle::_getTypeName () const
|
||||
{ return _TName( "Triangle" ); };
|
||||
|
||||
|
||||
string Triangle::_getString() const
|
||||
{
|
||||
string s = Super::_getString();
|
||||
s.insert( s.length() - 1, " " + getString(_layer->getName()));
|
||||
s.insert( s.length() - 1, " " + getString(_points[0]));
|
||||
s.insert( s.length() - 1, " " + getString(_points[1]));
|
||||
s.insert( s.length() - 1, " " + getString(_points[2]));
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
Record* Triangle::_getRecord() const
|
||||
{
|
||||
Record* record = Inherit::_getRecord();
|
||||
if (record) {
|
||||
record->add( getSlot("_layer" , _layer ) );
|
||||
record->add( getSlot("_points", &_points) );
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
Initializer<JsonTriangle> jsonTriangleInit ( 0 );
|
||||
|
||||
|
||||
void JsonTriangle::initialize ()
|
||||
{ JsonTypes::registerType( new JsonTriangle (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonTriangle::JsonTriangle ( unsigned long flags )
|
||||
: JsonComponent(flags)
|
||||
{
|
||||
add( "_layer" , typeid(string) );
|
||||
add( "_point[0]", typeid(Point) );
|
||||
add( "_point[1]", typeid(Point) );
|
||||
add( "_point[2]", typeid(Point) );
|
||||
}
|
||||
|
||||
|
||||
string JsonTriangle::getTypeName () const
|
||||
{ return "Triangle"; }
|
||||
|
||||
|
||||
JsonTriangle* JsonTriangle::clone ( unsigned long flags ) const
|
||||
{ return new JsonTriangle ( flags ); }
|
||||
|
||||
|
||||
void JsonTriangle::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonTriangle::toData" );
|
||||
unsigned int jsonId = presetId( stack );
|
||||
|
||||
Triangle* triangle = Triangle::create
|
||||
( get<Net*>(stack,".Net")
|
||||
, DataBase::getDB()->getTechnology()->getLayer( get<const char*>(stack,"_layer") )
|
||||
, get<Point>(stack,".Point")
|
||||
, get<Point>(stack,".Point")
|
||||
, get<Point>(stack,".Point")
|
||||
);
|
||||
|
||||
JsonNet* jnet = jget<JsonNet>( stack );
|
||||
if (jnet) {
|
||||
jnet->addHookLink( triangle->getBodyHook(), jsonId, get<string>(stack,"_bodyHook" ) );
|
||||
} else {
|
||||
cerr << Error( "JsonTriangle::toData(): Missing (Json)Net in stack context." ) << endl;
|
||||
}
|
||||
|
||||
// Hook/Ring rebuild are done as a post-process.
|
||||
update( stack, triangle );
|
||||
}
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
|
@ -0,0 +1,90 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
|
||||
//
|
||||
// This file is part of Hurricane.
|
||||
//
|
||||
// Hurricane is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// Hurricane is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
|
||||
// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU
|
||||
// General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the Lesser GNU General Public
|
||||
// License along with Hurricane. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | H U R R I C A N E |
|
||||
// | V L S I B a c k e n d D a t a - B a s e |
|
||||
// | |
|
||||
// | Author : Jean-Paul Chaput |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./hurricane/Triangle.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef HURRICANE_TRIANGLE_H
|
||||
#define HURRICANE_TRIANGLE_H
|
||||
|
||||
#include "hurricane/Component.h"
|
||||
#include "hurricane/Triangles.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
class Layer;
|
||||
|
||||
|
||||
class Triangle : public Component {
|
||||
public:
|
||||
typedef Component Super;
|
||||
public:
|
||||
static Triangle* create ( Net*, const Layer*, const Point&, const Point&, const Point& );
|
||||
public:
|
||||
virtual DbU::Unit getX () const;
|
||||
virtual DbU::Unit getY () const;
|
||||
inline const Point& getPoint ( size_t ) const;
|
||||
virtual Box getBoundingBox () const;
|
||||
virtual Box getBoundingBox ( const BasicLayer* ) const;
|
||||
virtual const Layer* getLayer () const;
|
||||
void setLayer ( const Layer* layer );
|
||||
virtual void translate ( const DbU::Unit& dx, const DbU::Unit& dy );
|
||||
void setPoints ( const Point&, const Point&, const Point& );
|
||||
virtual void _toJson ( JsonWriter* ) const;
|
||||
static JsonObject* getJsonObject ( unsigned long flags );
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
protected:
|
||||
Triangle ( Net*, const Layer*, const Point&, const Point&, const Point& );
|
||||
private:
|
||||
const Layer* _layer;
|
||||
std::array<Point,3> _points;
|
||||
};
|
||||
|
||||
|
||||
inline const Point& Triangle::getPoint ( size_t i ) const { return _points[ (i<3) ? i : 0 ]; }
|
||||
|
||||
|
||||
class JsonTriangle : public JsonComponent {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonTriangle ( unsigned long flags );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonTriangle* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
INSPECTOR_P_SUPPORT(Hurricane::Triangle);
|
||||
|
||||
#endif // HURRICANE_TRIANGLE_H
|
|
@ -66,6 +66,7 @@
|
|||
PySegmentCollection.cpp
|
||||
PyTechnology.cpp
|
||||
PyTransformation.cpp
|
||||
PyTriangle.cpp
|
||||
PyOrientation.cpp
|
||||
PyDbU.cpp
|
||||
PyUpdateSession.cpp
|
||||
|
@ -132,6 +133,7 @@
|
|||
hurricane/isobar/PySegmentCollection.h
|
||||
hurricane/isobar/PyTechnology.h
|
||||
hurricane/isobar/PyTransformation.h
|
||||
hurricane/isobar/PyTriangle.h
|
||||
hurricane/isobar/PyOrientation.h
|
||||
hurricane/isobar/PyDbU.h
|
||||
hurricane/isobar/PyUpdateSession.h
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#include "hurricane/isobar/PyHorizontal.h"
|
||||
#include "hurricane/isobar/PyVertical.h"
|
||||
#include "hurricane/isobar/PyPad.h"
|
||||
#include "hurricane/isobar/PyTriangle.h"
|
||||
#include "hurricane/isobar/PyPath.h"
|
||||
#include "hurricane/isobar/PyOccurrence.h"
|
||||
#include "hurricane/isobar/PyOccurrenceCollection.h"
|
||||
|
@ -569,7 +570,9 @@ extern "C" {
|
|||
PyHorizontal_LinkPyType ();
|
||||
PyContact_LinkPyType ();
|
||||
PyPin_LinkPyType ();
|
||||
PyTriangle_LinkPyType ();
|
||||
PyPlug_LinkPyType ();
|
||||
PyTriangle_LinkPyType ();
|
||||
PyBreakpoint_LinkPyType ();
|
||||
PyQuery_LinkPyType ();
|
||||
PyQueryMask_LinkPyType ();
|
||||
|
@ -652,6 +655,7 @@ extern "C" {
|
|||
PYTYPE_READY_SUB ( Pin , Contact )
|
||||
PYTYPE_READY_SUB ( Plug , Component)
|
||||
PYTYPE_READY_SUB ( Pad , Component)
|
||||
PYTYPE_READY_SUB ( Triangle , Component)
|
||||
|
||||
// Identifier string can take up to 10 characters !
|
||||
__cs.addType ( "intv" , &PyTypeInterval , "<Interval>" , false );
|
||||
|
@ -703,6 +707,7 @@ extern "C" {
|
|||
__cs.addType ( "rp" , &PyTypeRoutingPad , "<RoutingPad>" , false, "comp" );
|
||||
__cs.addType ( "segment" , &PyTypeSegment , "<Segment>" , false, "comp" );
|
||||
__cs.addType ( "pad " , &PyTypePad , "<Pad>" , false, "comp" );
|
||||
__cs.addType ( "triangle" , &PyTypeTriangle , "<Triangle>" , false, "comp" );
|
||||
__cs.addType ( "segmentCol" , &PyTypeSegmentCollection , "<SegmentCollection>" , false );
|
||||
__cs.addType ( "db" , &PyTypeDataBase , "<DataBase>" , false );
|
||||
__cs.addType ( "techno" , &PyTypeTechnology , "<Technology>" , false );
|
||||
|
@ -801,6 +806,8 @@ extern "C" {
|
|||
PyModule_AddObject ( module, "Pin" , (PyObject*)&PyTypePin );
|
||||
Py_INCREF ( &PyTypePad );
|
||||
PyModule_AddObject ( module, "Pad" , (PyObject*)&PyTypePad );
|
||||
Py_INCREF ( &PyTypeTriangle );
|
||||
PyModule_AddObject ( module, "Triangle" , (PyObject*)&PyTypeTriangle );
|
||||
|
||||
|
||||
PyObject* dictionnary = PyModule_GetDict ( module );
|
||||
|
|
|
@ -0,0 +1,206 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2018-2018, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | I s o b a r - Hurricane / Python Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PyTriangle.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyPoint.h"
|
||||
#include "hurricane/isobar/PyNet.h"
|
||||
#include "hurricane/isobar/PyLayer.h"
|
||||
#include "hurricane/isobar/PyBox.h"
|
||||
#include "hurricane/isobar/PyTriangle.h"
|
||||
|
||||
|
||||
namespace Isobar {
|
||||
|
||||
using namespace Hurricane;
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
#undef ACCESS_OBJECT
|
||||
#undef ACCESS_CLASS
|
||||
#define ACCESS_OBJECT _baseObject._baseObject._object
|
||||
#define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject._baseObject)
|
||||
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Triangle,triangle,function)
|
||||
|
||||
|
||||
// +=================================================================+
|
||||
// | "PyTriangle" Python Module Code Part |
|
||||
// +=================================================================+
|
||||
|
||||
#if defined(__PYTHON_MODULE__)
|
||||
|
||||
// Standard Accessors (Attributes).
|
||||
DirectGetLongAttribute(PyTriangle_getX, getX, PyTriangle, Triangle)
|
||||
DirectGetLongAttribute(PyTriangle_getY, getY, PyTriangle, Triangle)
|
||||
|
||||
// Standard Destroy (Attribute).
|
||||
DBoDestroyAttribute(PyTriangle_destroy, PyTriangle)
|
||||
|
||||
|
||||
static PyObject* PyTriangle_create ( PyObject*, PyObject *args )
|
||||
{
|
||||
cdebug_log(20,0) << "PyTriangle_create()" << endl;
|
||||
|
||||
PyObject* arg0 = NULL;
|
||||
PyObject* arg1 = NULL;
|
||||
PyObject* arg2 = NULL;
|
||||
PyObject* arg3 = NULL;
|
||||
PyObject* arg4 = NULL;
|
||||
Triangle* triangle = NULL;
|
||||
|
||||
HTRY
|
||||
__cs.init( "Triangle.create" );
|
||||
if (!PyArg_ParseTuple(args,"O&O&O&O&O&:Triangle.create"
|
||||
,Converter,&arg0
|
||||
,Converter,&arg1
|
||||
,Converter,&arg2
|
||||
,Converter,&arg3
|
||||
,Converter,&arg4
|
||||
)) {
|
||||
PyErr_SetString( ConstructorError, "Invalid number of parameters for Triangle constructor." );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (__cs.getObjectIds() == ":ent:layer:point:point:point") {
|
||||
triangle = Triangle::create( PYNET_O (arg0)
|
||||
, PYLAYER_O(arg1)
|
||||
, *PYPOINT_O(arg2)
|
||||
, *PYPOINT_O(arg3)
|
||||
, *PYPOINT_O(arg4)
|
||||
);
|
||||
} else {
|
||||
PyErr_SetString( ConstructorError, "Bad type(s) of parameters for Triangle constructor." );
|
||||
return NULL;
|
||||
}
|
||||
HCATCH
|
||||
|
||||
return PyTriangle_Link(triangle);
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyTriangle_getBoundingBox ( PyTriangle *self )
|
||||
{
|
||||
cdebug_log(20,0) << "PyTriangle_getBoundingBox()" << endl;
|
||||
|
||||
METHOD_HEAD( "Triangle.BoundingBox()" )
|
||||
|
||||
PyBox* pyBox = PyObject_NEW( PyBox, &PyTypeBox );
|
||||
if (pyBox == NULL) { return NULL; }
|
||||
|
||||
HTRY
|
||||
pyBox->_object = new Box ( triangle->getBoundingBox() );
|
||||
HCATCH
|
||||
|
||||
return (PyObject*)pyBox;
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyTriangle_setPoints ( PyTriangle *self, PyObject* args )
|
||||
{
|
||||
cdebug_log(20,0) << "Triangle.setPoints()" << endl;
|
||||
|
||||
HTRY
|
||||
METHOD_HEAD( "Triangle.setPoints()" )
|
||||
|
||||
PyObject* arg0 = NULL;
|
||||
PyObject* arg1 = NULL;
|
||||
PyObject* arg2 = NULL;
|
||||
if (not PyArg_ParseTuple( args,"O&O&O&:Triangle.setPoints"
|
||||
,Converter,&arg0
|
||||
,Converter,&arg1
|
||||
,Converter,&arg2
|
||||
)) {
|
||||
PyErr_SetString( ConstructorError, "Invalid number of parameters for Triangle.setPoints()." );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (__cs.getObjectIds() == ":point:point:point") {
|
||||
triangle->setPoints( *PYPOINT_O(arg0)
|
||||
, *PYPOINT_O(arg1)
|
||||
, *PYPOINT_O(arg2)
|
||||
);
|
||||
} else {
|
||||
PyErr_SetString( ConstructorError, "Bad type(s) of parameters for Triangle.setPoints()." );
|
||||
return NULL;
|
||||
}
|
||||
HCATCH
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyTriangle_translate ( PyTriangle *self, PyObject* args )
|
||||
{
|
||||
cdebug_log(20,0) << "PyTriangle_translate ()" << endl;
|
||||
|
||||
HTRY
|
||||
METHOD_HEAD ( "Triangle.translate()" )
|
||||
PyObject* arg0 = NULL;
|
||||
PyObject* arg1 = NULL;
|
||||
__cs.init ("Triangle.translate");
|
||||
if (PyArg_ParseTuple(args,"O&O&:Triangle.translate", Converter, &arg0, Converter, &arg1)) {
|
||||
if (__cs.getObjectIds() == INTS2_ARG) triangle->translate( PyAny_AsLong(arg0), PyAny_AsLong(arg1) );
|
||||
else {
|
||||
PyErr_SetString ( ConstructorError, "Triangle.translate(): Invalid type for parameter(s)." );
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
PyErr_SetString ( ConstructorError, "Triangle.translate(): Invalid number of parameters." );
|
||||
return NULL;
|
||||
}
|
||||
HCATCH
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// PyTriangle Attribute Method table.
|
||||
|
||||
PyMethodDef PyTriangle_Methods[] =
|
||||
{ { "create" , (PyCFunction)PyTriangle_create , METH_VARARGS|METH_STATIC
|
||||
, "Create a new Triangle." }
|
||||
, { "getX" , (PyCFunction)PyTriangle_getX , METH_NOARGS , "Return the Triangle X value." }
|
||||
, { "getY" , (PyCFunction)PyTriangle_getY , METH_NOARGS , "Return the Triangle Y value." }
|
||||
, { "getBoundingBox", (PyCFunction)PyTriangle_getBoundingBox, METH_NOARGS , "Return the Triangle Bounding Box." }
|
||||
, { "setPoints" , (PyCFunction)PyTriangle_setPoints , METH_VARARGS, "Sets the Triangle Bounding Box." }
|
||||
, { "translate" , (PyCFunction)PyTriangle_translate , METH_VARARGS, "Translates the Triangle of dx and dy." }
|
||||
, { "destroy" , (PyCFunction)PyTriangle_destroy , METH_NOARGS
|
||||
, "Destroy associated hurricane object, the python object remains." }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
DBoDeleteMethod(Triangle)
|
||||
PyTypeObjectLinkPyType(Triangle)
|
||||
|
||||
|
||||
#else // Python Module Code Part.
|
||||
|
||||
|
||||
// +=================================================================+
|
||||
// | "PyTriangle" Shared Library Code Part |
|
||||
// +=================================================================+
|
||||
|
||||
|
||||
// Link/Creation Method.
|
||||
DBoLinkCreateMethod(Triangle)
|
||||
PyTypeInheritedObjectDefinitions(Triangle,Component)
|
||||
|
||||
#endif // Shared Library Code Part.
|
||||
|
||||
} // extern "C".
|
||||
|
||||
} // Isobar namespace.
|
|
@ -39,6 +39,7 @@
|
|||
#include "hurricane/Vertical.h"
|
||||
#include "hurricane/Contact.h"
|
||||
#include "hurricane/Pad.h"
|
||||
#include "hurricane/Triangle.h"
|
||||
#include "hurricane/RoutingPad.h"
|
||||
#include "hurricane/ExtensionGo.h"
|
||||
|
||||
|
@ -664,17 +665,32 @@ namespace Hurricane {
|
|||
static QRect rectangle;
|
||||
static unsigned int state;
|
||||
|
||||
const Triangle* triangle = dynamic_cast<const Triangle*>(go);
|
||||
if (triangle) {
|
||||
_goCount++;
|
||||
Box bb = transformation.getBox(triangle->getBoundingBox(basicLayer));
|
||||
rectangle = _cellWidget->dbuToScreenRect( bb );
|
||||
if ( (rectangle.width() > 4) and (rectangle.height() > 4) ) {
|
||||
QPoint points[3];
|
||||
points[0] = _cellWidget->dbuToScreenPoint( triangle->getPoint(0) );
|
||||
points[1] = _cellWidget->dbuToScreenPoint( triangle->getPoint(1) );
|
||||
points[2] = _cellWidget->dbuToScreenPoint( triangle->getPoint(2) );
|
||||
_cellWidget->drawScreenPolygon( points, 3 );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const Component* component = dynamic_cast<const Component*>(go);
|
||||
if ( component ) {
|
||||
if (component) {
|
||||
_goCount++;
|
||||
Box bb = transformation.getBox(component->getBoundingBox(basicLayer));
|
||||
rectangle = _cellWidget->dbuToScreenRect ( bb );
|
||||
rectangle = _cellWidget->dbuToScreenRect( bb );
|
||||
state = ( (rectangle.width() > 2) ? 1:0) | ( (rectangle.height() > 2) ? 2:0);
|
||||
switch ( state ) {
|
||||
case 0: break;
|
||||
case 1: _cellWidget->drawScreenLine ( rectangle.bottomLeft(), rectangle.bottomRight() ); break;
|
||||
case 2: _cellWidget->drawScreenLine ( rectangle.bottomLeft(), rectangle.topLeft () ); break;
|
||||
case 3: _cellWidget->drawScreenRect ( rectangle ); break;
|
||||
case 1: _cellWidget->drawScreenLine( rectangle.bottomLeft(), rectangle.bottomRight() ); break;
|
||||
case 2: _cellWidget->drawScreenLine( rectangle.bottomLeft(), rectangle.topLeft () ); break;
|
||||
case 3: _cellWidget->drawScreenRect( rectangle ); break;
|
||||
}
|
||||
|
||||
if ( _cellWidget->isDrawable("text.component")
|
||||
|
@ -682,9 +698,9 @@ namespace Hurricane {
|
|||
and (rectangle.width () > 30)
|
||||
and (rectangle.height() > 30) ) {
|
||||
const Net* net = component->getNet();
|
||||
if ( not net->isAutomatic() ) {
|
||||
if (not net->isAutomatic()) {
|
||||
const char* netName = net->getName()._getSharedName()->_getSString().c_str();
|
||||
_cellWidget->drawDisplayText ( rectangle, netName, BigFont|Bold|Center|Frame );
|
||||
_cellWidget->drawDisplayText( rectangle, netName, BigFont|Bold|Center|Frame );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue