-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// VISU OBJECT : interactive object for VISU entities implementation
// File : VISU_DumpPython.cc
// Author : Alexey PETROV
theServant->GetOffset(x,y,z);
theStr<<thePrefix<<theName<<".SetOffset("<<x<<", "<<y<<", "<<z<<")"<<endl;
SetClippingPlane(theServant, theName, theStr, thePrefix);
+
+ VISU::MarkerType aMarkerType = theServant->GetMarkerType();
+ if( aMarkerType != VISU::MT_NONE ) {
+ if( aMarkerType != VISU::MT_USER ) {
+ VISU::MarkerScale aMarkerScale = theServant->GetMarkerScale();
+ std::string aParam1, aParam2;
+ switch( aMarkerType ) {
+ case MT_POINT: aParam1 = "MT_POINT"; break;
+ case MT_PLUS: aParam1 = "MT_PLUS"; break;
+ case MT_STAR: aParam1 = "MT_STAR"; break;
+ case MT_O: aParam1 = "MT_O"; break;
+ case MT_X: aParam1 = "MT_X"; break;
+ case MT_O_POINT: aParam1 = "MT_O_POINT"; break;
+ case MT_O_PLUS: aParam1 = "MT_O_PLUS"; break;
+ case MT_O_STAR: aParam1 = "MT_O_STAR"; break;
+ case MT_O_X: aParam1 = "MT_O_X"; break;
+ default: aParam1 = "MT_NONE"; break;
+ }
+ switch( aMarkerScale ) {
+ case MS_10: aParam2 = "MS_10"; break;
+ case MS_15: aParam2 = "MS_15"; break;
+ case MS_20: aParam2 = "MS_20"; break;
+ case MS_25: aParam2 = "MS_25"; break;
+ case MS_30: aParam2 = "MS_30"; break;
+ case MS_35: aParam2 = "MS_35"; break;
+ case MS_40: aParam2 = "MS_40"; break;
+ case MS_45: aParam2 = "MS_45"; break;
+ case MS_50: aParam2 = "MS_50"; break;
+ case MS_55: aParam2 = "MS_55"; break;
+ case MS_60: aParam2 = "MS_60"; break;
+ case MS_65: aParam2 = "MS_65"; break;
+ case MS_70: aParam2 = "MS_70"; break;
+ default: aParam2 = "MT_NONE"; break;
+ }
+ theStr<<thePrefix<<theName<<".SetMarkerStd(VISU."<<aParam1<<", VISU."<<aParam2<<")"<<endl;
+ }
+ else {
+ int aMarkerTexture = theServant->GetMarkerTexture();
+ if( aMarkerTexture >= 0 )
+ theStr<<thePrefix<<theName<<".SetMarkerTexture(texture_map["<<aMarkerTexture<<"])"<<endl;
+ }
+ }
}
//---------------------------------------------------------------------------
if(Curve_i* aServant = dynamic_cast<Curve_i*>(GetServant(anObj).in()))
{
bool withZ = aServant->GetZRow()>0;
+ bool isV2 = aServant->GetIsV2();
theStr << thePrefix << "aName2ObjectMap['" << aName << "'] = visu.CreateCurve";
- if( withZ )
+ if( isV2 )
+ theStr << "WithZExt";
+ else if( withZ )
theStr << "WithZ";
theStr << "(" <<
theArgumentName<< // table
- ", "<<aServant->GetHRow()<< // H row
- ", "<<aServant->GetVRow(); // V row
- if( withZ )
+ ", "<<aServant->GetHRow()<< // H row
+ ", "<<aServant->GetVRow(); // V row
+ if( withZ || isV2 )
theStr << ", " << aServant->GetZRow(); // Z row
+ if( isV2 )
+ theStr << ", " << aServant->GetIsV2(); // right axis
theStr << ", '"<<aServant->GetTitle()<<"'"; // title
SALOMEDS::Color aColor = aServant->GetColor();
if (aTypeName == "ImportTables") {
QString aFileName = VISU::Storable::FindValue(aMap,"myFileName",&anIsExist);
if(anIsExist){
- std::string aName = GenerateName(theSObject,theName2EntryMap,theEntry2NameMap);
- theStr<<thePrefix<<aName<<" = aVisu.ImportTables('"<<aFileName.toLatin1().data()<<"')"<<endl;
+ std::string aName =
+ GenerateName(theSObject,theName2EntryMap,theEntry2NameMap);
+ QString aFirstStrAsTitle =
+ VISU::Storable::FindValue(aMap,"myFirstStrAsTitle",&anIsExist);
+ theStr<<thePrefix<<aName<<" = aVisu.ImportTables('"
+ <<aFileName.toLatin1().data()<<"',"
+ <<aFirstStrAsTitle.toLatin1().data()<<")"<<endl;
theStr<<thePrefix<<"if "<<aName<<":"<<endl;
thePrefix += PREFIX;
}
+ void
+ DumpTextureMapToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ std::string thePrefix,
+ const StudyId2MarkerMap& theMarkerMap)
+ {
+ if(!theIsPublished)
+ return;
+
+ if(CORBA::is_nil(theStudy))
+ return;
+
+ StudyId2MarkerMap::const_iterator anIter = theMarkerMap.find(theStudy->StudyId());
+ if(anIter == theMarkerMap.end())
+ return;
+
+ theStr<<thePrefix<<"texture_map = {}"<<endl<<endl;
+
+ const VTK::MarkerMap& aMarkerMap = anIter->second;
+ VTK::MarkerMap::const_iterator aMarkerIter = aMarkerMap.begin();
+ for(; aMarkerIter != aMarkerMap.end(); aMarkerIter++) {
+ int aMarkerId = aMarkerIter->first;
+ std::string aMarkerTexture = aMarkerIter->second.first;
+ theStr<<thePrefix<<"texture_map["<<aMarkerId<<"] = aVisu.LoadTexture(\""<<aMarkerTexture<<"\")"<<endl;
+ }
+ theStr<<endl;
+ }
+
+
//---------------------------------------------------------------------------
Engines::TMPFile*
VISU_Gen_i::
#endif
std::string aPrefix(PREFIX);
- aStr<< "# -*- coding: iso-8859-1 -*-" << endl;
- aStr<<"### This file is generated by SALOME automatically by dump python functionality"
- " of VISU component"<<endl<<endl;
aStr<<"def RebuildData(theStudy):"<<endl;
aStr<<aPrefix<<"from batchmode_salome import orb, naming_service, lcc, myStudyManager"<<endl;
aStr<<aPrefix<<"import SALOME_MED"<<endl;
aPrefix,
myClippingPlaneMgr);
+ VISU::DumpTextureMapToPython(aStudy,
+ theIsPublished,
+ theIsValidScript,
+ aComponent.in(),
+ aStr,
+ aPrefix,
+ myMarkerMap);
VISU::DumpChildrenToPython(aStudy,
theIsPublished,