- if (vType == SVTK_Viewer::Type())
- {
- QVector<SUIT_ViewWindow*> views = vman->getViews();
- for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++)
- {
- if (SVTK_ViewWindow* vtkView = dynamic_cast<SVTK_ViewWindow*>(views[i]))
- {
- vtkActorCollection* allActors = vtkView->getRenderer()->GetActors();
- allActors->InitTraversal();
- while (vtkActor* actor = allActors->GetNextActor())
- {
- if (actor->GetVisibility()) // store only visible actors
- {
- GEOM_Actor* aGeomActor = 0;
- if (actor->IsA("GEOM_Actor"))
- aGeomActor = GEOM_Actor::SafeDownCast(actor);
- if (aGeomActor && aGeomActor->hasIO())
- {
- Handle(SALOME_InteractiveObject) io = aGeomActor->getIO();
- if (io->hasEntry())
- {
- // entry is "encoded" = it does NOT contain component adress, since it is a
- // subject to change on next component loading
- std::string entry = ip->encodeEntry(io->getEntry(), componentName);
-
- std::string param, occParam = vType.toLatin1().data();
- occParam += gSeparator;
- occParam += QString::number(vtkViewers).toLatin1().data();
- occParam += gSeparator;
-
- param = occParam + "Visibility";
- ip->setParameter(entry, param, "On");
-
- param = occParam + "DisplayMode";
- ip->setParameter(entry, param, QString::number
- (aGeomActor->getDisplayMode()).toLatin1().data());
-
- vtkFloatingPointType r, g, b;
- aGeomActor->GetColor(r, g, b);
- QString colorStr = QString::number(r);
- colorStr += gDigitsSep; colorStr += QString::number(g);
- colorStr += gDigitsSep; colorStr += QString::number(b);
- param = occParam + "Color";
- ip->setParameter(entry, param, colorStr.toLatin1().data());
-
- param = occParam + "Opacity";
- ip->setParameter(entry, param, QString::number(aGeomActor->GetOpacity()).toLatin1().data());
-
- int nbUIso(0), nbVIso(0);
- aGeomActor->GetNbIsos(nbUIso,nbVIso);
- QString isosStr = QString::number(nbUIso);
- isosStr += gDigitsSep;
- isosStr += QString::number(nbVIso);
- param = occParam + "Isos";
- ip->setParameter(entry, param, isosStr.toLatin1().data());
- } // if (io->hasEntry())
- } // GEOM_Actor && hasIO
- } // isVisible
- } // while.. actors traversal
- } // if (vtkView)
- } // for (views)
- vtkViewers++;
- } // if (SVTK view model)
- else if (vType == SOCC_Viewer::Type()) // processing OCC viewers
- {
- QVector<SUIT_ViewWindow*> views = vman->getViews();
- for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++)
- {
- OCCViewer_ViewWindow* occView = dynamic_cast<OCCViewer_ViewWindow*>(views[i]);
- if (occView)
- {
- //Handle(AIS_InteractiveContext) ic =
- // ((OCCViewer_Viewer*)(occView->getViewManager()->getViewModel()))->getAISContext();
- OCCViewer_Viewer* viewModel = (OCCViewer_Viewer*)(vman->getViewModel());
- //OCCViewer_Viewer* viewModel = ((OCCViewer_ViewManager*)vman)->getOCCViewer();
- Handle(AIS_InteractiveContext) ic = viewModel->getAISContext();
-
- AIS_ListOfInteractive aList;
- ic->DisplayedObjects(aList);
-
- AIS_ListIteratorOfListOfInteractive ite (aList);
- for (; ite.More(); ite.Next())
- {
- if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape)))
- {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
- if (aSh->hasIO())
- {
- Handle(SALOME_InteractiveObject) io =
- Handle(SALOME_InteractiveObject)::DownCast(aSh->getIO());
- if (io->hasEntry())
- {
- // entry is "encoded": it does NOT contain component adress,
- // since it is a subject to change on next component loading
- std::string entry = ip->encodeEntry(io->getEntry(), componentName);
-
- std::string param, occParam = vType.toLatin1().data();
- occParam += gSeparator;
- occParam += QString::number(occViewers).toLatin1().data();
- occParam += gSeparator;
-
- // Visibility
- param = occParam + "Visibility";
- ip->setParameter(entry, param, "On");
-
- // DisplayMode
- param = occParam + "DisplayMode";
- int dm = aSh->DisplayMode();
- ip->setParameter(entry, param, QString::number(dm).toLatin1().data());
-
- // Color
- // is a property of GEOM_Object, it is stored by GEOM engine
-
- // Transparency
- param = occParam + "Transparency";
- ip->setParameter(entry, param, QString::number(aSh->Transparency()).toLatin1().data());
-
- // Isos
- Handle(AIS_Drawer) aDrawer = aSh->Attributes();
- int nbUIso = aDrawer->UIsoAspect()->Number();
- int nbVIso = aDrawer->VIsoAspect()->Number();
- QString isosStr = QString::number(nbUIso);
- isosStr += gDigitsSep;
- isosStr += QString::number(nbVIso);
- param = occParam + "Isos";
- ip->setParameter(entry, param, isosStr.toLatin1().data());
- } // if (io->hasEntry())
- } // if (io)
- } // if (GEOM_AISShape)
- } // for (AIS_ListOfInteractive)
- } // if ( occView )
- } // for ( views )
- occViewers++;
- } // if (SOCC view model)
- else
- {
- // unknown viewer type
- }
+ QVector<SUIT_ViewWindow*> views = vman->getViews();
+ for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++) {
+ const ObjMap anObjects = appStudy->getObjectMap(aMgrId);
+ ObjMap::ConstIterator o_it = anObjects.begin();
+ for (; o_it != anObjects.end(); o_it++) {
+ const PropMap aProps = o_it.value();
+
+ //Check that object exists in the study
+ _PTR(SObject) obj( studyDS->FindObjectID( o_it.key().toLatin1().data() ) );
+ if ( !obj || !(aProps.count() > 0))
+ continue;
+ // entry is "encoded" = it does NOT contain component adress, since it is a
+ // subject to change on next component loading
+
+ std::string entry = ip->encodeEntry(o_it.key().toLatin1().data(), componentName);
+
+ _PTR(GenericAttribute) anAttr;
+ if( !obj->FindAttribute(anAttr, "AttributeIOR"))
+ continue;
+
+ std::string param,occParam = vType.toLatin1().data();
+ occParam += NAME_SEPARATOR;
+ occParam += QString::number(aMgrId).toLatin1().data();
+ occParam += NAME_SEPARATOR;
+
+ if(aProps.contains(VISIBILITY_PROP)) {
+ param = occParam + VISIBILITY_PROP;
+ ip->setParameter(entry, param, aProps.value(VISIBILITY_PROP).toInt() == 1 ? "On" : "Off");
+ }
+
+ if(aProps.contains(DISPLAY_MODE_PROP)) {
+ param = occParam + DISPLAY_MODE_PROP;
+ ip->setParameter(entry, param, QString::number(aProps.value(DISPLAY_MODE_PROP).toInt()).toLatin1().data());
+ }
+
+ if(aProps.contains(COLOR_PROP)) {
+ QColor c = aProps.value(COLOR_PROP).value<QColor>();
+ QString colorStr = QString::number(c.red()/255.);
+ colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.green()/255.);
+ colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.blue()/255.);
+ param = occParam + COLOR_PROP;
+ ip->setParameter(entry, param, colorStr.toLatin1().data());
+ }
+
+ if(vType == SVTK_Viewer::Type()) {
+ if(aProps.contains(OPACITY_PROP)) {
+ param = occParam + OPACITY_PROP;
+ ip->setParameter(entry, param, QString::number(1. - aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+ }
+ } else if (vType == SOCC_Viewer::Type()) {
+ if(aProps.contains(TRANSPARENCY_PROP)) {
+ param = occParam + TRANSPARENCY_PROP;
+ ip->setParameter(entry, param, QString::number(aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+ }
+ }
+
+ if(aProps.contains(ISOS_PROP)) {
+ param = occParam + ISOS_PROP;
+ ip->setParameter(entry, param, aProps.value(ISOS_PROP).toString().toLatin1().data());
+ }
+
+ if(aProps.contains(VECTOR_MODE_PROP)) {
+ param = occParam + VECTOR_MODE_PROP;
+ ip->setParameter(entry, param, QString::number(aProps.value(VECTOR_MODE_PROP).toInt()).toLatin1().data());
+ }
+
+ if(aProps.contains(DEFLECTION_COEFF_PROP)) {
+ param = occParam + DEFLECTION_COEFF_PROP;
+ ip->setParameter(entry, param, QString::number(aProps.value(DEFLECTION_COEFF_PROP).toDouble()).toLatin1().data());
+ }
+
+ //Marker type of the vertex - ONLY for the "Vertex" and "Compound of the Vertex"
+ if(aProps.contains(MARKER_TYPE_PROP)) {
+ param = occParam + MARKER_TYPE_PROP;
+ ip->setParameter(entry, param, aProps.value(MARKER_TYPE_PROP).toString().toLatin1().data());
+ }
+
+ if(aProps.contains(FRONT_MATERIAL_PROP)) {
+ param = occParam + FRONT_MATERIAL_PROP;
+ ip->setParameter(entry, param, aProps.value(FRONT_MATERIAL_PROP).toString().toLatin1().data());
+ }
+
+ if(aProps.contains(BACK_MATERIAL_PROP)) {
+ param = occParam + BACK_MATERIAL_PROP;
+ ip->setParameter(entry, param, aProps.value(BACK_MATERIAL_PROP).toString().toLatin1().data());
+
+ }
+
+ if(aProps.contains( EDGE_WIDTH_PROP )) {
+ param = occParam + EDGE_WIDTH_PROP;
+ ip->setParameter(entry, param, aProps.value(EDGE_WIDTH_PROP).toString().toLatin1().data());
+ }
+
+ if(aProps.contains( ISOS_WIDTH_PROP )) {
+ param = occParam + ISOS_WIDTH_PROP;
+ ip->setParameter(entry, param, aProps.value(ISOS_WIDTH_PROP).toString().toLatin1().data());
+ }
+ } // object iterator
+ } // for (views)