theStr<<thePrefix<<aName<<".SetNbColumns("<<aNbColumns<<")"<<endl;
CORBA::Long aNbRows = theTableAttr->GetNbRows();
- theStr<<thePrefix<<aName<<".SetNbRows("<<aNbRows<<")"<<endl;
+ // push values and their indices into streams
+ strstream values, rows, columns;
+ string comma = "";
for(CORBA::Long i = 1; i <= aNbColumns; i++){
- for(CORBA::Long j = 1; j <= aNbRows; j++){
- if(theTableAttr->HasValue(i,j)){
- CORBA::Double aValue = theTableAttr->GetValue(i,j);
- theStr<<thePrefix<<aName<<".PutValue("<<aValue<<","<<i<<","<<j<<")"<<endl;
+ for(CORBA::Long j = aNbRows; j > 0; j--){
+ if(theTableAttr->HasValue(j,i)){
+ values << comma << theTableAttr->GetValue(j,i);
+ rows << comma << j;
+ columns << comma << i;
+ if ( comma.empty() )
+ comma = ",";
}
}
}
-
- SALOMEDS::StringSeq_var aRowTitles = theTableAttr->GetRowTitles();
+ // push titles and units into streams
+ strstream rowUnits, rowTitles, colTitles;
SALOMEDS::StringSeq_var aRowUnits = theTableAttr->GetRowUnits();
+ SALOMEDS::StringSeq_var aRowTitles = theTableAttr->GetRowTitles();
+ comma = "";
for(CORBA::Long j = 1; j <= aNbRows; j++){
- theStr<<thePrefix<<aName<<".SetRowTitle("<<j<<",'"<<aRowTitles[j-1]<<"')"<<endl;
- theStr<<thePrefix<<aName<<".SetRowUnit("<<j<<",'"<<aRowUnits[j-1]<<"')"<<endl;
+ rowUnits << comma << "'" << aRowUnits [ j - 1 ] << "'";
+ rowTitles << comma << "'" << aRowTitles[ j - 1 ] << "'";
+ if ( comma.empty() )
+ comma = ",";
}
-
SALOMEDS::StringSeq_var aColumnTitles = theTableAttr->GetColumnTitles();
- for(CORBA::Long i = 1; i <= aNbColumns; i++){
- theStr<<thePrefix<<aName<<".SetColumnTitle("<<i<<",'"<<aColumnTitles[i-1]<<"')"<<endl;
+ comma = "";
+ for(CORBA::Long j = 1; j <= aNbColumns; j++){
+ colTitles << comma << "'" << aColumnTitles[ j - 1 ] << "'";
+ if ( comma.empty() )
+ comma = ",";
}
+ values << '\0';
+ rows << '\0';
+ columns << '\0';
+ rowUnits << '\0';
+ rowTitles << '\0';
+ colTitles << '\0';
+ // write FillTable command
+ theStr<< thePrefix << aName << "_values = [" << values.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_rows = [" << rows.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_columns = [" << columns.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_rUnits = [" << rowUnits.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_rTitles = [" << rowTitles.str() << "]" << endl;
+ theStr<< thePrefix << aName << "_cTitles = [" << colTitles.str() << "]" << endl;
+ theStr<< thePrefix << "visu.FillTable( "
+ << aName << ", "
+ << aName << "_values, "
+ << aName << "_rows, "
+ << aName << "_columns, "
+ << aName << "_rTitles, "
+ << aName << "_rUnits, "
+ << aName << "_cTitles )" << endl;
if(theSObject->FindAttribute(anAttr,"AttributeIOR")){
theStr<<endl;
}
return;
case VISU::TCURVE:
- if(Curve_i* aServant = dynamic_cast<Curve_i*>(GetServant(anObj).in())){
- theStr<<thePrefix<<aName<<" = aVisu.CreateCurve("<<theArgumentName<<
- ","<<aServant->GetHRow()<<
- ","<<aServant->GetVRow()<<
- ")"<<endl;
-
- theStr<<thePrefix<<"if "<<aName<<":"<<endl;
- thePrefix += PREFIX;
-
- theStr<<thePrefix<<"aName2ObjectMap['"<<aName<<"'] = "<<aName<<endl;
-
- theStr<<thePrefix<<aName<<".SetTitle('"<<aServant->GetTitle()<<"')"<<endl;
-
+ if(Curve_i* aServant = dynamic_cast<Curve_i*>(GetServant(anObj).in()))
+ {
+ theStr << thePrefix << "aName2ObjectMap['" << aName << "'] = visu.CreateCurve(" <<
+ theArgumentName<< // table
+ ","<<aServant->GetHRow()<< // H row
+ ","<<aServant->GetVRow()<< // V row
+ ",'"<<aServant->GetTitle()<<"'"; // title
SALOMEDS::Color aColor = aServant->GetColor();
- theStr<<thePrefix<<aName<<".SetColor(SALOMEDS.Color("<<
- aColor.R<<","<<aColor.G<<","<<aColor.B<<"))"<<endl;
+ theStr << ",SALOMEDS.Color("<<
+ aColor.R<<","<<aColor.G<<","<<aColor.B<<")"; // color
std::string aParam;
switch(aServant->GetMarker()){
- case Curve::NONE:
- aParam = "VISU.Curve.NONE";
- break;
- case Curve::CIRCLE:
- aParam = "VISU.Curve.CIRCLE";
- break;
- case Curve::RECTANGLE:
- aParam = "VISU.Curve.RECTANGLE";
- break;
- case Curve::DIAMOND:
- aParam = "VISU.Curve.DIAMOND";
- break;
- case Curve::DTRIANGLE:
- aParam = "VISU.Curve.DTRIANGLE";
- break;
- case Curve::UTRIANGLE:
- aParam = "VISU.Curve.UTRIANGLE";
- break;
- case Curve::LTRIANGLE:
- aParam = "VISU.Curve.LTRIANGLE";
- break;
- case Curve::RTRIANGLE:
- aParam = "VISU.Curve.RTRIANGLE";
- break;
- case Curve::CROSS:
- aParam = "VISU.Curve.CROSS";
- break;
- case Curve::XCROSS:
- aParam = "VISU.Curve.XCROSS";
- break;
+ case Curve::NONE: aParam = "VISU.Curve.NONE"; break;
+ case Curve::CIRCLE: aParam = "VISU.Curve.CIRCLE"; break;
+ case Curve::RECTANGLE: aParam = "VISU.Curve.RECTANGLE"; break;
+ case Curve::DIAMOND: aParam = "VISU.Curve.DIAMOND"; break;
+ case Curve::DTRIANGLE: aParam = "VISU.Curve.DTRIANGLE"; break;
+ case Curve::UTRIANGLE: aParam = "VISU.Curve.UTRIANGLE"; break;
+ case Curve::LTRIANGLE: aParam = "VISU.Curve.LTRIANGLE"; break;
+ case Curve::RTRIANGLE: aParam = "VISU.Curve.RTRIANGLE"; break;
+ case Curve::CROSS: aParam = "VISU.Curve.CROSS"; break;
+ case Curve::XCROSS: aParam = "VISU.Curve.XCROSS"; break;
}
- theStr<<thePrefix<<aName<<".SetMarker("<<aParam<<")"<<endl;
-
+ theStr<<","<<aParam; // marker
+
switch(aServant->GetLine()){
- case Curve::VOIDLINE:
- aParam = "VISU.Curve.VOIDLINE";
- break;
- case Curve::SOLIDLINE:
- aParam = "VISU.Curve.SOLIDLINE";
- break;
- case Curve::DASHLINE:
- aParam = "VISU.Curve.DASHLINE";
- break;
- case Curve::DOTLINE:
- aParam = "VISU.Curve.DOTLINE";
- break;
- case Curve::DASHDOTLINE:
- aParam = "VISU.Curve.DASHDOTLINE";
- break;
- case Curve::DASHDOTDOTLINE:
- aParam = "VISU.Curve.DASHDOTDOTLINE";
- break;
+ case Curve::VOIDLINE: aParam = "VISU.Curve.VOIDLINE"; break;
+ case Curve::SOLIDLINE: aParam = "VISU.Curve.SOLIDLINE"; break;
+ case Curve::DASHLINE: aParam = "VISU.Curve.DASHLINE"; break;
+ case Curve::DOTLINE: aParam = "VISU.Curve.DOTLINE"; break;
+ case Curve::DASHDOTLINE: aParam = "VISU.Curve.DASHDOTLINE"; break;
+ case Curve::DASHDOTDOTLINE: aParam = "VISU.Curve.DASHDOTDOTLINE"; break;
}
- theStr<<thePrefix<<aName<<".SetLine("<<aParam<<","<<aServant->GetLineWidth()<<")"<<endl;
-
- theStr<<thePrefix<<"pass"<<endl<<endl;
+ theStr<<","<<aParam<<","<<aServant->GetLineWidth()<<")"<<endl; // line type,width
}
return;
case VISU::TTABLE:
theStr<<thePrefix<<"if aName2ObjectMap.has_key('"<<anArg<<"'):"<<endl;
thePrefix += PREFIX;
theStr<<thePrefix<<"anObject = aName2ObjectMap['"<<anArg<<"']"<<endl;
- theStr<<thePrefix<<theArgumentName<<".AddCurve(anObject)"<<endl;
+ theStr<<thePrefix<<"if anObject: " <<theArgumentName<<".AddCurve(anObject)"<<endl;
theStr<<thePrefix<<"pass"<<endl<<endl;
}
}