return NULL;
return (VISU_CutPlaneFunction*) myPlanes->GetItemAsObject(id);
}
+
+//*************************************************************
+ /* Returns -1 if Plane is not exists */
+int VISU_ClippingPlaneMgr::GetPlaneId(VISU_CutPlaneFunction* thePlane)
+{
+ int aTag = thePlane->getPlaneObject()->Tag();
+ int aRes = -1;
+ VISU_CutPlaneFunction* aPlane;
+ for (int i = 0; i < GetClippingPlanesNb(); i++) {
+ aPlane = GetClippingPlane(i);
+ if (aPlane->getPlaneObject()->Tag() == aTag) {
+ aRes = i;
+ break;
+ }
+ }
+ return aRes;
+}
+
//*************************************************************
/* Deletes clipping plane by its Id */
//---------------------------------------------------------------------------
+ void SetClippingPlane(Prs3d_i* thePrs, string theName,
+ std::ostream& theStr,
+ std::string thePrefix)
+ {
+ VISU_CutPlaneFunction* aPlane;
+ VISU_Gen_i* aGen = VISU_Gen_i::GetVisuGenImpl();
+ VISU_ClippingPlaneMgr& aMgr = aGen->GetClippingPlaneMgr();
+ int aId;
+ for (int i = 0; i < thePrs->GetNumberOfClippingPlanes(); i++) {
+ aPlane = dynamic_cast<VISU_CutPlaneFunction*>(thePrs->GetClippingPlane(i));
+ if (aPlane) {
+ if (!aPlane->isAuto()) {
+ aId = aMgr.GetPlaneId(aPlane);
+ if (aId > -1) {
+ theStr<<thePrefix<<"aVisu.ApplyClippingPlane("<<theName<<", "<<aId<<")"<<endl;
+ }
+ }
+ }
+ }
+ }
+
+
void
Prs3dToPython(VISU::Prs3d_i* theServant,
std::ostream& theStr,
float x, y, z;
theServant->GetOffset(x,y,z);
theStr<<thePrefix<<theName<<".SetOffset("<<x<<", "<<y<<", "<<z<<")"<<endl;
+ SetClippingPlane(theServant, theName, theStr, thePrefix);
}
//---------------------------------------------------------------------------
}
}
-
+
//---------------------------------------------------------------------------
void
theStr<<thePrefix<<endl;
}
+
+ void
+ DumpClippingPlanesToPython(SALOMEDS::Study_ptr theStudy,
+ CORBA::Boolean theIsPublished,
+ CORBA::Boolean& theIsValidScript,
+ SALOMEDS::SObject_ptr theSObject,
+ std::ostream& theStr,
+ std::string thePrefix,
+ VISU_ClippingPlaneMgr& thePlaneMgr)
+ {
+
+ if(!theIsPublished) return;
+
+ VISU_CutPlaneFunction* aPlane;
+ double aOrigin[3], aDir[3];
+ for (int i = 0; i < thePlaneMgr.GetClippingPlanesNb(); i++) {
+ aPlane = thePlaneMgr.GetClippingPlane(i);
+ aPlane->GetOrigin(aOrigin);
+ aPlane->GetNormal(aDir);
+
+ theStr<<thePrefix<<"aVisu.CreateClippingPlane("<<
+ aOrigin[0]<<","<<aOrigin[1]<<","<<aOrigin[2]<<","<<
+ aDir[0]<<","<<aDir[1]<<","<<aDir[2]<<","<<
+ aPlane->isAuto()<<",\""<<aPlane->getName()<<"\")"<<endl;
+ }
+ theStr<<endl;
+ }
+
+
//---------------------------------------------------------------------------
Engines::TMPFile*
VISU_Gen_i::
aStr<<endl;
SALOMEDS::SComponent_var aComponent = FindOrCreateVisuComponent(aStudy);
+
+ VISU::DumpClippingPlanesToPython(aStudy,
+ theIsPublished,
+ theIsValidScript,
+ aComponent.in(),
+ aStr,
+ aPrefix,
+ myClippingPlaneMgr);
+
+
VISU::DumpChildrenToPython(aStudy,
theIsPublished,
theIsValidScript,
aStr,
aPrefix);
+
//Output the script that sets up the visul parameters.
if(theIsPublished) {
char* script = aStudy->GetDefaultScript("Post-Pro", aPrefix.c_str());