- else {
- int delta = 0;
- float er,eg,eb;
- float nr,ng,nb;
- vtkFloatingPointType otr,otg,otb;
- //Old case backsurface color is independent
- if( colors.count() == 16 ) {
- QColor ffc;
- SMESH::GetColor( "SMESH", "fill_color", ffc, delta, "0,170,255|-100" ) ;
- er = colors[9].toFloat();
- eg = colors[10].toFloat();
- eb = colors[11].toFloat();
-
- nr = colors[13].toFloat();
- ng = colors[14].toFloat();
- nb = colors[15].toFloat();
- SMESH::GetColor("SMESH", "outline_color", otr, otg, otb, QColor( 0, 70, 0 ) );
- } else {
- //New case backsurface color depends on surface color
- delta = colors[5].toInt();
-
- er = colors[7].toFloat();
- eg = colors[8].toFloat();
- eb = colors[9].toFloat();
-
- nr = colors[11].toFloat();
- ng = colors[12].toFloat();
- nb = colors[13].toFloat();
-
- otr = colors[15].toFloat();
- otg = colors[16].toFloat();
- otb = colors[17].toFloat();
- }
- aSmeshActor->SetSufaceColor(colors[1].toFloat(), colors[2].toFloat(), colors[3].toFloat(), delta);
- aSmeshActor->SetEdgeColor(er,eg,eb);
- aSmeshActor->SetNodeColor(nr,ng,nb);
- aSmeshActor->SetOutlineColor(otr,otg,otb);
+ else if ( type == "backsurface" ) {
+ // backface color can be defined in several ways
+ // - in old versions, it is set as rgb triple r:g:b - this was is unsupported now
+ // - in latest versions, it is set as delta coefficient
+ bool rgbOk = false, deltaOk;
+ if ( i+1 >= colors.count() ) break; // format error
+ r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
+ int delta = colors[i+1].toInt( &deltaOk );
+ i++; // shift index
+ if ( i+1 < colors.count() ) // index is shifted to 1
+ g = colors[i+1].toDouble( &rgbOk );
+ if ( rgbOk ) i++; // shift index
+ if ( rgbOk && i+1 < colors.count() ) // index is shifted to 2
+ b = colors[i+1].toDouble( &rgbOk );
+ if ( rgbOk ) i++;
+ // - as currently there's no way to set directly backsurface color as it was before,
+ // we ignore old dump where r,g,b triple was set
+ // - also we check that delta parameter is set properly
+ if ( !rgbOk && deltaOk )
+ deltaF = delta;
+ }
+ else if ( type == "volume" ) {
+ // volume color is set by 4 values r:g:b:delta, where
+ // - r,g,b - is a normal volume rgb color components
+ // - delta - is a reversed volume color delta coefficient
+ if ( i+1 >= colors.count() ) break; // format error
+ r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+2 >= colors.count() ) break; // format error
+ g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+3 >= colors.count() ) break; // format error
+ b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+4 >= colors.count() ) break; // format error
+ int delta = colors[i+4].toInt( &bOk );
+ if ( !bOk ) break; // format error
+ volumeColor.setRgbF( r, g, b );
+ deltaV = delta;
+ i += 4;
+ }
+ else if ( type == "edge" ) {
+ // edge color is set by 3 values r:g:b, where
+ // - r,g,b - is rgb color components
+ if ( i+1 >= colors.count() ) break; // format error
+ r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+2 >= colors.count() ) break; // format error
+ g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+3 >= colors.count() ) break; // format error
+ b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
+ edgeColor.setRgbF( r, g, b );
+ i += 3;
+ }
+ else if ( type == "node" ) {
+ // node color is set by 3 values r:g:b, where
+ // - r,g,b - is rgb color components
+ if ( i+1 >= colors.count() ) break; // format error
+ r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+2 >= colors.count() ) break; // format error
+ g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+3 >= colors.count() ) break; // format error
+ b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
+ nodeColor.setRgbF( r, g, b );
+ i += 3;
+ }
+ else if ( type == "elem0d" ) {
+ // 0d element color is set by 3 values r:g:b, where
+ // - r,g,b - is rgb color components
+ if ( i+1 >= colors.count() ) break; // format error
+ r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+2 >= colors.count() ) break; // format error
+ g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+3 >= colors.count() ) break; // format error
+ b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
+ elem0dColor.setRgbF( r, g, b );
+ i += 3;
+ }
+ else if ( type == "ball" ) {
+ // ball color is set by 3 values r:g:b, where
+ // - r,g,b - is rgb color components
+ if ( i+1 >= colors.count() ) break; // format error
+ r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+2 >= colors.count() ) break; // format error
+ g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+3 >= colors.count() ) break; // format error
+ b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
+ ballColor.setRgbF( r, g, b );
+ i += 3;
+ }
+ else if ( type == "outline" ) {
+ // outline color is set by 3 values r:g:b, where
+ // - r,g,b - is rgb color components
+ if ( i+1 >= colors.count() ) break; // format error
+ r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+2 >= colors.count() ) break; // format error
+ g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+3 >= colors.count() ) break; // format error
+ b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
+ outlineColor.setRgbF( r, g, b );
+ i += 3;
+ }
+ else if ( type == "orientation" ) {
+ // orientation color is set by 3 values r:g:b, where
+ // - r,g,b - is rgb color components
+ if ( i+1 >= colors.count() ) break; // format error
+ r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+2 >= colors.count() ) break; // format error
+ g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
+ if ( i+3 >= colors.count() ) break; // format error
+ b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
+ orientationColor.setRgbF( r, g, b );
+ i += 3;