From b90b40f656fc119331244432d12a6b817373fe97 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 2 Nov 2010 16:05:29 +0000 Subject: [PATCH] * ./hurricane/src/hurricane: - New: In Query, adds an accessor to get the current path. - Bug: In NetExternalComponents, every component of an external net was considered as an external one. Now only truly external components are considered. * ./hurricane/src/isobar: - New: StratusScript, dedicated Stratus script laucher. - Bug: In CellWidget, when drawing selecteds Gos, the loop variable was not reset between loops resulting in incomplete display. * ./hurricane/src/isobar: - New: In PyHorizontal & PyVertical, adds mutator methods. --- hurricane/src/hurricane/Cell.cpp | 33 +++---- hurricane/src/hurricane/HyperNet.cpp | 1 + .../src/hurricane/NetExternalComponents.cpp | 2 +- hurricane/src/hurricane/Query.cpp | 14 +-- hurricane/src/hurricane/hurricane/Query.h | 21 +++-- hurricane/src/isobar/PyHorizontal.cpp | 17 +++- hurricane/src/isobar/PySegment.cpp | 4 +- hurricane/src/isobar/PyVertical.cpp | 19 +++- hurricane/src/viewer/CMakeLists.txt | 2 + hurricane/src/viewer/CellWidget.cpp | 30 ++++--- hurricane/src/viewer/SelectorCriterion.cpp | 4 +- hurricane/src/viewer/StratusScript.cpp | 88 +++++++++++++++++++ hurricane/src/viewer/StratusWidget.cpp | 12 ++- .../src/viewer/hurricane/viewer/CellWidget.h | 2 +- .../src/viewer/hurricane/viewer/Script.h | 21 +---- .../viewer/hurricane/viewer/StratusScript.h | 53 +++++++++++ 16 files changed, 249 insertions(+), 74 deletions(-) create mode 100644 hurricane/src/viewer/StratusScript.cpp create mode 100644 hurricane/src/viewer/hurricane/viewer/StratusScript.h diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index 311b6b8f..ed1e6ccf 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -189,20 +189,21 @@ void Cell::setAbutmentBox(const Box& abutmentBox) void Cell::flattenNets(bool buildRings) // ************************************ { - UpdateSession::open(); + UpdateSession::open(); - for_each_occurrence ( occurrence, getHyperNetRootNetOccurrences() ) { - HyperNet hyperNet ( occurrence ); - if ( !occurrence.getPath().isEmpty() ) { + forEach ( Occurrence, ioccurrence, getHyperNetRootNetOccurrences() ) { + Net* net = static_cast((*ioccurrence).getEntity()); + + HyperNet hyperNet ( *ioccurrence ); + if ( not (*ioccurrence).getPath().isEmpty() ) { DeepNet* deepNet = DeepNet::create ( hyperNet ); if (deepNet) deepNet->_createRoutingPads ( buildRings ); } else { RoutingPad* previousRP = NULL; RoutingPad* currentRP = NULL; - Net* net = static_cast(occurrence.getEntity()); - for_each_component ( component, net->getComponents() ) { - Plug* primaryPlug = dynamic_cast( component ); + forEach ( Component*, icomponent, net->getComponents() ) { + Plug* primaryPlug = dynamic_cast( *icomponent ); if ( primaryPlug ) { if ( !primaryPlug->getBodyHook()->getSlaveHooks().isEmpty() ) { cerr << "[ERROR] " << primaryPlug << "\n" @@ -211,29 +212,26 @@ void Cell::flattenNets(bool buildRings) primaryPlug->getBodyHook()->detach (); } } - end_for } - for_each_occurrence ( plugOccurrence, hyperNet.getLeafPlugOccurrences() ) { - currentRP = createRoutingPad ( net, plugOccurrence ); + forEach ( Occurrence, iplugOccurrence, hyperNet.getLeafPlugOccurrences() ) { + currentRP = createRoutingPad ( net, *iplugOccurrence ); currentRP->materialize (); if ( buildRings ) { if ( previousRP ) { currentRP->getBodyHook()->attach ( previousRP->getBodyHook() ); } - Plug* plug = static_cast( plugOccurrence.getEntity() ); - if ( plugOccurrence.getPath().isEmpty() ) { + Plug* plug = static_cast( (*iplugOccurrence).getEntity() ); + if ( (*iplugOccurrence).getPath().isEmpty() ) { plug->getBodyHook()->attach ( currentRP->getBodyHook() ); plug->getBodyHook()->detach (); } previousRP = currentRP; } - - end_for } - for_each_component ( component, net->getComponents() ) { - Pin* pin = dynamic_cast( component ); + forEach ( Component*, icomponent, net->getComponents() ) { + Pin* pin = dynamic_cast( *icomponent ); if ( pin ) { currentRP = createRoutingPad ( pin ); if ( buildRings ) { @@ -245,11 +243,8 @@ void Cell::flattenNets(bool buildRings) } previousRP = currentRP; } - - end_for } } - end_for } UpdateSession::close(); diff --git a/hurricane/src/hurricane/HyperNet.cpp b/hurricane/src/hurricane/HyperNet.cpp index 8f9cf633..514a43bf 100644 --- a/hurricane/src/hurricane/HyperNet.cpp +++ b/hurricane/src/hurricane/HyperNet.cpp @@ -356,6 +356,7 @@ bool isHyperNetRootNetOccurrence(Occurrence netoccurrence) { Net* net=dynamic_cast(netoccurrence.getEntity()); if (!net) return false; + if (net->isAutomatic() ) return false; if (!net->isExternal()) return true; if (netoccurrence.getPath().isEmpty()) return true; if (net->isGlobal()) return false; diff --git a/hurricane/src/hurricane/NetExternalComponents.cpp b/hurricane/src/hurricane/NetExternalComponents.cpp index 3d6c6d4c..a6bb8e03 100644 --- a/hurricane/src/hurricane/NetExternalComponents.cpp +++ b/hurricane/src/hurricane/NetExternalComponents.cpp @@ -94,7 +94,7 @@ namespace Hurricane { Net* net = component->getNet(); if (!net->isExternal()) return false; - return getRelation(net) != NULL; + return component->getProperty(_name) != NULL; } diff --git a/hurricane/src/hurricane/Query.cpp b/hurricane/src/hurricane/Query.cpp index a94f92ae..a3c0cc59 100644 --- a/hurricane/src/hurricane/Query.cpp +++ b/hurricane/src/hurricane/Query.cpp @@ -38,7 +38,7 @@ // x-----------------------------------------------------------------x -#include +#include #include "hurricane/BasicLayer.h" #include "hurricane/Slice.h" @@ -60,12 +60,12 @@ namespace Hurricane { QueryStack::QueryStack () : vector() - //, _tab(" ") - , _topCell(NULL) - , _topArea() - , _topTransformation() - , _startLevel(0) - , _stopLevel(UINT_MAX) + //, _tab (" ") + , _topCell (NULL) + , _topArea () + , _topTransformation () + , _startLevel (0) + , _stopLevel (std::numeric_limits::max()) { } diff --git a/hurricane/src/hurricane/hurricane/Query.h b/hurricane/src/hurricane/hurricane/Query.h index 38bc64b6..6994f78c 100644 --- a/hurricane/src/hurricane/hurricane/Query.h +++ b/hurricane/src/hurricane/hurricane/Query.h @@ -69,6 +69,7 @@ namespace Hurricane { inline QueryState ( Locator* locator , const Box& area , const Transformation& transformation + , const Path& path ); QueryState ( const QueryState& ); QueryState& operator= ( const QueryState& ); @@ -77,6 +78,7 @@ namespace Hurricane { Locator* _locator; Box _area; Transformation _transformation; + Path _path; friend class QueryStack; }; @@ -86,19 +88,22 @@ namespace Hurricane { inline QueryState::QueryState ( Locator* locator ) - : _locator(locator) - , _area() + : _locator (locator) + , _area () , _transformation() + , _path () { } inline QueryState::QueryState ( Locator* locator , const Box& area , const Transformation& transformation + , const Path& path ) - : _locator(locator) - , _area(area) + : _locator (locator) + , _area (area) , _transformation(transformation) + , _path (path) { } @@ -127,6 +132,7 @@ namespace Hurricane { inline Instance* getInstance (); inline const Box& getArea () const; inline const Transformation& getTransformation () const; + inline const Path& getPath () const; //inline const Tabulation& getTab () const; // Modifiers. inline void setTopCell ( Cell* cell ); @@ -168,6 +174,7 @@ namespace Hurricane { inline unsigned int QueryStack::getStopLevel () const { return _stopLevel; } inline const Box& QueryStack::getArea () const { return back()->_area; } inline const Transformation& QueryStack::getTransformation () const { return back()->_transformation; } + inline const Path& QueryStack::getPath () const { return back()->_path; } //inline const Tabulation& QueryStack::getTab () const { return _tab; } @@ -197,7 +204,7 @@ namespace Hurricane { { while ( !empty() ) levelUp(); - push_back ( new QueryState(NULL,_topArea,_topTransformation) ); + push_back ( new QueryState(NULL,_topArea,_topTransformation,Path()) ); //_tab++; progress ( true ); @@ -215,6 +222,8 @@ namespace Hurricane { instance->getTransformation().getInvert().applyOn ( child->_area ); parent->_transformation.applyOn ( child->_transformation ); + + child->_path = Path ( parent->_path, instance ); } @@ -321,6 +330,7 @@ namespace Hurricane { inline const BasicLayer* getBasicLayer () const; inline Cell* getMasterCell (); inline Instance* getInstance (); + inline Path getPath () const; //inline const Tabulation& getTab () const; virtual bool hasGoCallback () const; virtual bool hasMarkerCallback () const; @@ -374,6 +384,7 @@ namespace Hurricane { inline size_t Query::getDepth () const { return _stack.size(); } inline const Box& Query::getArea () const { return _stack.getArea(); } inline const Transformation& Query::getTransformation () const { return _stack.getTransformation(); } + inline Path Query::getPath () const { return _stack.getPath(); } inline const BasicLayer* Query::getBasicLayer () const { return _basicLayer; } inline Cell* Query::getMasterCell () { return _stack.getMasterCell(); } inline Instance* Query::getInstance () { return _stack.getInstance(); } diff --git a/hurricane/src/isobar/PyHorizontal.cpp b/hurricane/src/isobar/PyHorizontal.cpp index 06e68f7e..03c1a4fe 100644 --- a/hurricane/src/isobar/PyHorizontal.cpp +++ b/hurricane/src/isobar/PyHorizontal.cpp @@ -48,6 +48,13 @@ extern "C" { // x-------------------------------------------------------------x + DirectGetLongAttribute(PyHorizontal_getY ,getY ,PyHorizontal,Horizontal) + DirectGetLongAttribute(PyHorizontal_getDxSource,getDxSource,PyHorizontal,Horizontal) + DirectGetLongAttribute(PyHorizontal_getDxTarget,getDxTarget,PyHorizontal,Horizontal) + DirectSetLongAttribute(PyHorizontal_setY ,setY ,"Horizontal.setY",PyHorizontal,Horizontal) + DirectSetLongAttribute(PyHorizontal_setDxSource,setDxSource,"Horizontal.setDxSource",PyHorizontal,Horizontal) + DirectSetLongAttribute(PyHorizontal_setDxTarget,setDxTarget,"Horizontal.setDxTarget",PyHorizontal,Horizontal) + // Standart destroy (Attribute). DBoDestroyAttribute(PyHorizontal_destroy, PyHorizontal) @@ -56,8 +63,14 @@ extern "C" { // PyHorizontal Attribute Method table. PyMethodDef PyHorizontal_Methods[] = - { { "destroy" , (PyCFunction)PyHorizontal_destroy , METH_NOARGS - , "destroy associated hurricane object, the python object remains." } + { { "getY" , (PyCFunction)PyHorizontal_getY , METH_NOARGS , "Get the segment Y position." } + , { "getDxSource", (PyCFunction)PyHorizontal_getDxSource, METH_NOARGS , "Get the segment source X offset." } + , { "getDxTarget", (PyCFunction)PyHorizontal_getDxTarget, METH_NOARGS , "Get the segment target X offset." } + , { "setY" , (PyCFunction)PyHorizontal_setY , METH_VARARGS, "Modify the segment Y position." } + , { "setDxSource", (PyCFunction)PyHorizontal_setDxSource, METH_VARARGS, "Modify the segment source X offset." } + , { "setDxTarget", (PyCFunction)PyHorizontal_setDxTarget, METH_VARARGS, "Modify the segment target X offset." } + , { "destroy" , (PyCFunction)PyHorizontal_destroy , METH_NOARGS + , "destroy associated hurricane object, the python object remains." } , {NULL, NULL, 0, NULL} /* sentinel */ }; diff --git a/hurricane/src/isobar/PySegment.cpp b/hurricane/src/isobar/PySegment.cpp index 89157b93..736c91f8 100644 --- a/hurricane/src/isobar/PySegment.cpp +++ b/hurricane/src/isobar/PySegment.cpp @@ -55,7 +55,8 @@ extern "C" { // Standard Accessors (Attributes). DirectGetLongAttribute(PySegment_getSourceX,getSourceX,PySegment,Segment) DirectGetLongAttribute(PySegment_getSourceY,getSourceY,PySegment,Segment) - DirectGetLongAttribute(PySegment_getWidth ,getWidth, PySegment,Segment) + DirectGetLongAttribute(PySegment_getWidth ,getWidth ,PySegment,Segment) + DirectSetLongAttribute(PySegment_setWidth ,setWidth ,"Segment.setWidth",PySegment,Segment) // Standard Destroy (Attribute). DBoDestroyAttribute(PySegment_destroy, PySegment) @@ -112,6 +113,7 @@ extern "C" { , { "getSourcePosition" , (PyCFunction)PySegment_getSourcePosition, METH_NOARGS , "Return the Segment source point value." } , { "getTargetPosition" , (PyCFunction)PySegment_getTargetPosition, METH_NOARGS , "Return the Segment target point value." } , { "getWidth" , (PyCFunction)PySegment_getWidth , METH_NOARGS , "Return the segment width." } + , { "setWidth" , (PyCFunction)PySegment_setWidth , METH_VARARGS, "Modify the Segment width." } , { "destroy" , (PyCFunction)PySegment_destroy , METH_NOARGS , "Destroy associated hurricane object, the python object remains." } , {NULL, NULL, 0, NULL} /* sentinel */ diff --git a/hurricane/src/isobar/PyVertical.cpp b/hurricane/src/isobar/PyVertical.cpp index f3f7813b..470e01f2 100644 --- a/hurricane/src/isobar/PyVertical.cpp +++ b/hurricane/src/isobar/PyVertical.cpp @@ -45,6 +45,13 @@ extern "C" { // x-------------------------------------------------------------x + DirectGetLongAttribute(PyVertical_getX ,getX ,PyVertical,Vertical) + DirectGetLongAttribute(PyVertical_getDySource,getDySource,PyVertical,Vertical) + DirectGetLongAttribute(PyVertical_getDyTarget,getDyTarget,PyVertical,Vertical) + DirectSetLongAttribute(PyVertical_setX,setX,"Vertical.setX",PyVertical,Vertical) + DirectSetLongAttribute(PyVertical_setDySource,setDySource,"Vertical.setDySource",PyVertical,Vertical) + DirectSetLongAttribute(PyVertical_setDyTarget,setDyTarget,"Vertical.setDyTarget",PyVertical,Vertical) + // Standard destroy (Attribute). DBoDestroyAttribute(PyVertical_destroy, PyVertical) @@ -74,9 +81,15 @@ extern "C" { // PyVertical Attribute Method table. PyMethodDef PyVertical_Methods[] = - { { "destroy" , (PyCFunction)PyVertical_destroy , METH_NOARGS - , "Destroy associated hurricane object, the python object remains." } - , { "translate" , (PyCFunction)PyVertical_translate , METH_VARARGS, "Translates the Vertical segment of dx and dy." } + { { "getX" , (PyCFunction)PyVertical_getX , METH_NOARGS , "Get the segment X position." } + , { "getDySource", (PyCFunction)PyVertical_getDySource, METH_NOARGS , "Get the segment source Y offset." } + , { "getDyTarget", (PyCFunction)PyVertical_getDyTarget, METH_NOARGS , "Get the segment target Y offset." } + , { "setX" , (PyCFunction)PyVertical_setX , METH_VARARGS, "Modify the segment X position." } + , { "setDySource", (PyCFunction)PyVertical_setDySource, METH_VARARGS, "Modify the segment source Y offset." } + , { "setDyTarget", (PyCFunction)PyVertical_setDyTarget, METH_VARARGS, "Modify the segment target Y offset." } + , { "translate" , (PyCFunction)PyVertical_translate , METH_VARARGS, "Translates the Vertical segment of dx and dy." } + , { "destroy" , (PyCFunction)PyVertical_destroy , METH_NOARGS + , "Destroy associated hurricane object, the python object remains." } , {NULL, NULL, 0, NULL} /* sentinel */ }; diff --git a/hurricane/src/viewer/CMakeLists.txt b/hurricane/src/viewer/CMakeLists.txt index 3d86585a..894837f8 100644 --- a/hurricane/src/viewer/CMakeLists.txt +++ b/hurricane/src/viewer/CMakeLists.txt @@ -52,6 +52,7 @@ hurricane/viewer/HierarchyCommand.h hurricane/viewer/SelectorCriterion.h hurricane/viewer/CellWidgets.h + hurricane/viewer/StratusScript.h ) set ( pyincludes hurricane/viewer/PyCellViewer.h ) @@ -95,6 +96,7 @@ DisplayFilterWidget.cpp ControllerWidget.cpp ScriptWidget.cpp + StratusScript.cpp StratusWidget.cpp ) set ( pycpps PyViewer.cpp diff --git a/hurricane/src/viewer/CellWidget.cpp b/hurricane/src/viewer/CellWidget.cpp index e4229aa8..41567843 100644 --- a/hurricane/src/viewer/CellWidget.cpp +++ b/hurricane/src/viewer/CellWidget.cpp @@ -1015,8 +1015,8 @@ namespace Hurricane { bool CellWidget::SelectorCriterions::add ( const Net* net ) { - if ( !_cellWidget ) return false; - if ( !_cellWidget->isSelected(Occurrence(net)) ) { + if ( _cellWidget == NULL ) return false; + if ( not _cellWidget->isSelected(Occurrence(net)) ) { _criterions.push_back ( new NetSelectorCriterion(net) ); _criterions.back()->doSelection ( _cellWidget ); return true; @@ -1027,7 +1027,7 @@ namespace Hurricane { bool CellWidget::SelectorCriterions::add ( Box area ) { - if ( !_cellWidget ) return false; + if ( _cellWidget == NULL ) return false; _criterions.push_back ( new AreaSelectorCriterion(area) ); _criterions.back()->doSelection ( _cellWidget ); return true; @@ -1036,8 +1036,8 @@ namespace Hurricane { bool CellWidget::SelectorCriterions::remove ( const Net* net ) { - if ( !_cellWidget ) return false; - if ( !_cellWidget->isSelected(Occurrence(net)) ) return false; + if ( _cellWidget == NULL ) return false; + if ( not _cellWidget->isSelected(Occurrence(net)) ) return false; size_t i=0; for ( ; i<_criterions.size() ; i++ ) @@ -1065,7 +1065,7 @@ namespace Hurricane { void CellWidget::SelectorCriterions::revalidate () { - if ( !_cellWidget ) return; + if ( _cellWidget == NULL ) return; size_t i = 0; size_t last = _criterions.size (); @@ -1524,9 +1524,9 @@ namespace Hurricane { Occurrence occurrence = (*iselector)->getOccurrence(); Component* component = dynamic_cast(occurrence.getEntity()); - if ( !component ) break; - if ( !component->getLayer() ) continue; - if ( !component->getLayer()->contains(*basicLayer) ) continue; + if ( component == NULL ) continue; + if ( not component->getLayer() ) continue; + if ( not component->getLayer()->contains(*basicLayer) ) continue; Transformation transformation = occurrence.getPath().getTransformation(); _drawingQuery.drawGo ( dynamic_cast(occurrence.getEntity()) @@ -1540,6 +1540,7 @@ namespace Hurricane { _drawingPlanes.setPen ( Graphics::getPen ("boundaries") ); _drawingPlanes.setBrush ( Graphics::getBrush("boundaries") ); + iselector = _selectors.begin(); for ( ; iselector != _selectors.end() ; iselector++ ) { Occurrence occurrence = (*iselector)->getOccurrence(); Instance* instance = dynamic_cast(occurrence.getEntity()); @@ -1553,22 +1554,25 @@ namespace Hurricane { _drawingPlanes.setPen ( Graphics::getPen ("rubber") ); _drawingPlanes.setBrush ( Graphics::getBrush("rubber") ); + iselector = _selectors.begin(); for ( ; iselector != _selectors.end() ; iselector++ ) { Occurrence occurrence = (*iselector)->getOccurrence(); Rubber* rubber = dynamic_cast(occurrence.getEntity()); - if ( !rubber ) break; + if ( rubber == NULL ) continue; Transformation transformation = occurrence.getPath().getTransformation(); _drawingQuery.drawRubber ( rubber, redrawBox, transformation ); } Name extensionName = ""; + + iselector = _selectors.begin(); for ( ; iselector != _selectors.end() ; iselector++ ) { Occurrence occurrence = (*iselector)->getOccurrence(); ExtensionGo* eGo = dynamic_cast(occurrence.getEntity()); - if ( !eGo ) break; + if ( eGo == NULL ) continue; Transformation transformation = occurrence.getPath().getTransformation(); if ( eGo->getName() != extensionName ) { @@ -2802,8 +2806,8 @@ namespace Hurricane { Occurrence occurrence ( *component ); select ( occurrence ); } - forEach ( Rubber*, rubber, net->getRubbers() ) { - Occurrence occurrence ( *rubber ); + forEach ( Rubber*, irubber, net->getRubbers() ) { + Occurrence occurrence ( *irubber ); select ( occurrence ); } if ( _state->showSelection() ) _redrawManager.refresh (); diff --git a/hurricane/src/viewer/SelectorCriterion.cpp b/hurricane/src/viewer/SelectorCriterion.cpp index e02c19a5..e70c7259 100644 --- a/hurricane/src/viewer/SelectorCriterion.cpp +++ b/hurricane/src/viewer/SelectorCriterion.cpp @@ -66,8 +66,8 @@ namespace Hurricane { bool NetSelectorCriterion::isValid ( CellWidget* cw ) const { - if ( !cw->getCell() ) return false; - if ( !cw->getCell()->getNet(_name) ) return false; + if ( cw->getCell() == NULL ) return false; + if ( not cw->getCell()->getNet(_name) ) return false; return true; } diff --git a/hurricane/src/viewer/StratusScript.cpp b/hurricane/src/viewer/StratusScript.cpp new file mode 100644 index 00000000..67915cf1 --- /dev/null +++ b/hurricane/src/viewer/StratusScript.cpp @@ -0,0 +1,88 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | 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@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./StratusScript.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include +using namespace std; + +#include +namespace bfs = boost::filesystem; + +#include "hurricane/Warning.h" +#include "hurricane/viewer/StratusScript.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "StratusScript". + + + StratusScript::StratusScript ( const std::string& scriptName, CellViewer* editor ) + : _scriptName (scriptName) + , _scriptDirectory() + , _script (NULL) + { + bfs::path userStratus = _scriptName; + bfs::path userDirectory = userStratus.branch_path(); + + if ( not userDirectory.is_complete() ) + userDirectory = bfs::current_path() / userDirectory; + userDirectory.normalize(); + + _scriptDirectory = userDirectory.string(); + Isobar::Script::addPath ( _scriptDirectory ); + + _script = Isobar::Script::create ( userStratus.leaf() ); + _script->setEditor ( editor ); + } + + + StratusScript::~StratusScript () + { + Isobar::Script::removePath ( _scriptDirectory ); + _script->destroy (); + } + + + StratusScript* StratusScript::create ( const std::string& scriptName, CellViewer* editor ) + { + return new StratusScript ( scriptName, editor ); + } + + + void StratusScript::destroy () + { + delete this; + } + + + bool StratusScript::run () + { + return _script->runFunction ( "StratusScript", NULL, Isobar::Script::NoScriptArgs ); + } + + +} // End of Hurricane namespace. diff --git a/hurricane/src/viewer/StratusWidget.cpp b/hurricane/src/viewer/StratusWidget.cpp index 6754e094..0a4040b6 100644 --- a/hurricane/src/viewer/StratusWidget.cpp +++ b/hurricane/src/viewer/StratusWidget.cpp @@ -43,6 +43,7 @@ namespace bfs = boost::filesystem; #include #include "hurricane/viewer/Graphics.h" +#include "hurricane/viewer/StratusScript.h" #include "hurricane/viewer/StratusWidget.h" #include "hurricane/viewer/CellViewer.h" @@ -95,8 +96,8 @@ namespace Hurricane { setLayout ( vLayout ); //setModal ( true ); - connect ( okButton, SIGNAL(clicked()) , this, SLOT(accept()) ); - connect ( cancelButton, SIGNAL(clicked()) , this, SLOT(reject()) ); + connect ( okButton, SIGNAL(clicked()), this, SLOT(accept()) ); + connect ( cancelButton, SIGNAL(clicked()), this, SLOT(reject()) ); } @@ -115,6 +116,12 @@ namespace Hurricane { delete dialog; if ( not doRunStratus ) return false; + dbo_ptr script + = StratusScript::create ( scriptName.toStdString(), qobject_cast(parent) ); + + bool returnCode = script->run (); + +#if DEPRECATED if ( scriptName.endsWith(".py",Qt::CaseInsensitive) ) scriptName.truncate ( scriptName.size()-3 ); @@ -133,6 +140,7 @@ namespace Hurricane { bool returnCode = script->runFunction ( "StratusScript", NULL, Isobar::Script::NoScriptArgs ); Isobar::Script::removePath ( userDirectory.string() ); +#endif return returnCode; } diff --git a/hurricane/src/viewer/hurricane/viewer/CellWidget.h b/hurricane/src/viewer/hurricane/viewer/CellWidget.h index 4abcce28..91b4977b 100644 --- a/hurricane/src/viewer/hurricane/viewer/CellWidget.h +++ b/hurricane/src/viewer/hurricane/viewer/CellWidget.h @@ -908,7 +908,7 @@ namespace Hurricane { , _queryFilter (~Query::DoTerminalCells) , _startLevel (0) , _stopLevel (99) - , _rubberShape (CellWidget::Steiner) + , _rubberShape (CellWidget::Barycentric) , _cumulativeSelection(false) , _scaleHistory () , _ihistory (0) diff --git a/hurricane/src/viewer/hurricane/viewer/Script.h b/hurricane/src/viewer/hurricane/viewer/Script.h index 18a8a69e..cf1a88ed 100644 --- a/hurricane/src/viewer/hurricane/viewer/Script.h +++ b/hurricane/src/viewer/hurricane/viewer/Script.h @@ -1,23 +1,8 @@ // -*- C++ -*- // -// Copyright (c) BULL S.A. 2000-2010, All Rights Reserved -// -// This file is part of ISOBAR. -// -// ISOBAR 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. -// -// ISOBAR 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 ISOBAR. If not, see -// . +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // @@ -31,7 +16,7 @@ // | Author : Jean-Paul Chaput | // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | -// | C++ Header : "./hurricane/isobar/Script.h" | +// | C++ Header : "./hurricane/viewer/Script.h" | // | *************************************************************** | // | U p d a t e s | // | | diff --git a/hurricane/src/viewer/hurricane/viewer/StratusScript.h b/hurricane/src/viewer/hurricane/viewer/StratusScript.h new file mode 100644 index 00000000..3852a672 --- /dev/null +++ b/hurricane/src/viewer/hurricane/viewer/StratusScript.h @@ -0,0 +1,53 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | 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/viewer/StratusScript.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __VIEWER_STRATUS_SCRIPT__ +#define __VIEWER_STRATUS_SCRIPT__ + +#include "hurricane/viewer/Script.h" + + +namespace Hurricane { + + + class StratusScript { + public: + static StratusScript* create ( const std::string& scriptName, CellViewer* editor=NULL ); + bool run (); + void destroy (); + private: + std::string _scriptName; + std::string _scriptDirectory; + Isobar::Script* _script; + private: + StratusScript ( const std::string& scriptName, CellViewer* editor ); + ~StratusScript (); + }; + + +} // End of Hurricane namespace. + + +#endif // __VIEWER_STRATUS_SCRIPT__