di<<"Info: Bounds\n ("<<Xmin<<","<<Ymin<<","<<Zmin<<")\n ("<<Xmax<<","<<Ymax<<","<<Zmax<<")"<<"\n";
// grid the bounding box
- Standard_Integer NumXsubvolumes = (Xmax - Xmin) / mesh_delt; if (NumXsubvolumes <= 0) NumXsubvolumes = 1;
- Standard_Integer NumYsubvolumes = (Ymax - Ymin) / mesh_delt; if (NumYsubvolumes <= 0) NumYsubvolumes = 1;
- Standard_Integer NumZsubvolumes = (Zmax - Zmin) / mesh_delt; if (NumZsubvolumes <= 0) NumZsubvolumes = 1;
+ Standard_Integer NumXsubvolumes = (Standard_Integer)((Xmax - Xmin) / mesh_delt); if (NumXsubvolumes <= 0) NumXsubvolumes = 1;
+ Standard_Integer NumYsubvolumes = (Standard_Integer)((Ymax - Ymin) / mesh_delt); if (NumYsubvolumes <= 0) NumYsubvolumes = 1;
+ Standard_Integer NumZsubvolumes = (Standard_Integer)((Zmax - Zmin) / mesh_delt); if (NumZsubvolumes <= 0) NumZsubvolumes = 1;
const Standard_Real StepX = (Xmax - Xmin) / NumXsubvolumes;
const Standard_Real StepY = (Ymax - Ymin) / NumYsubvolumes;
const Standard_Real StepZ = (Zmax - Zmin) / NumZsubvolumes;
#endif
static int BUC60609(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-// char file1[100];
gp_Pnt2d uvSurf;
- double U,V;
TopAbs_State state;
if (argc == 3) {
di << "Usage : "<< argv[0] << " shape name [U V]" << "\n";
return(-1);
}
-
- // MKV 30.03.05
-#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
- const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#else
- Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#endif
- Standard_Character *file1 = new Standard_Character [strlen(DD)+strlen(argv[1])+2];
- sprintf(file1,"%s/%s",DD,argv[1]);
+ TCollection_AsciiString aFilePath(argv[1]);
filebuf fic;
istream in(&fic);
- if (!fic.open(file1,ios::in)) {
- di << "Cannot open file for reading : " << file1 << "\n";
- delete file1;
+ if (!fic.open(aFilePath.ToCString(),ios::in)) {
+ di << "Cannot open file for reading : " << aFilePath << "\n";
return(-1);
}
S.Read(in);
S.Read(theShape,in);
}else{
- di << "Wrong entity type in " << file1 << "\n";
- delete file1;
+ di << "Wrong entity type in " << aFilePath << "\n";
return(-1);
}
}
istream in(&fic);
if (!fic.open(filename,ios::in)) {
di << "Cannot open file for reading : " << filename << "\n";
- delete filename;
+ delete [] filename;
return -1;
}
Sec.Build();
if(!Sec.IsDone()){
di << "Error performing intersection: not done." << "\n";
- delete filename;
+ delete [] filename;
return -1;
}
res = Sec.Shape();
Sec.Build();
if(!Sec.IsDone()){
di << "Error performing intersection: not done." << "\n";
- delete filename;
+ delete [] filename;
return -1;
}
res = Sec.Shape();
}catch(Standard_Failure){
Handle(Standard_Failure) error = Standard_Failure::Caught();
di << "Error performing intersection: not done." << "\n";
- delete filename;
+ delete [] filename;
return -1;
}
di << "Done" << "\n";
- delete filename;
+ delete [] filename;
return 0;
}
BRepTools::Write(Com,FileName);
- delete Ch;
- delete FileName;
+ delete [] Ch;
+ delete [] FileName;
return 0;
}
TCollection_ExtendedString Ext1("Dim1");
Handle(AIS_LengthDimension) Dim1 = new AIS_LengthDimension(V1,V2,Plane1,atof(a[2]),Ext1);
- myAIScontext->SetDisplayMode(Dim1, atof(a[1]));
+ myAIScontext->SetDisplayMode(Dim1, atoi(a[1]));
myAIScontext->Display(Dim1);
return 0;
}
for (i = 0; i < Glob_NbKnots; i++)
aMults.SetValue(i+1,Glob_Mults[i]);
// Create B-Spline curve
- const Standard_Real aDegree = 14;
+ const Standard_Integer aDegree = 14;
Handle(Geom_BSplineCurve) C1 = new Geom_BSplineCurve(aPoles,aKnots,aMults,aDegree);
// Create trimmed line
return 0;
}
-static int GetAllNew(const TopoDS_Shape& theShape, const TDF_Label& theAccess, const char* theName, Standard_Integer theIndex) {
+static int GetAllNew(const TopoDS_Shape& theShape, const TDF_Label& theAccess,
+ const TCollection_AsciiString& theName, Standard_Integer theIndex)
+{
TNaming_NewShapeIterator anIter(theShape,theAccess);
- char aName[200];
- for(;anIter.More();anIter.Next()) {
- if (!anIter.Shape().IsNull()) {
+ TCollection_AsciiString aName;
+ for(;anIter.More();anIter.Next())
+ {
+ if (!anIter.Shape().IsNull())
+ {
theIndex++;
- if (theName != NULL) {
- sprintf(aName,"%s_%d",theName,theIndex);
- DBRep::Set(aName,anIter.Shape());
+ if (!theName.IsEmpty())
+ {
+ aName = theName + "_" + theIndex;
+ DBRep::Set(aName.ToCString(),anIter.Shape());
}
theIndex = GetAllNew(anIter.Shape(),theAccess,theName,theIndex);
}
const char** arg) {
Standard_Integer aResult = 0;
if (nb==3 || nb==4) {
- const char* aName = (nb==4) ? arg[3] : NULL;
+ TCollection_AsciiString aName ((nb==4) ? arg[3] : "");
if (arg[2][0]=='0') { // label
TDF_Label aLabel;
TNaming_Iterator anIter(aNS);
for(a=1;anIter.More();anIter.Next(),a++) {
if (!anIter.NewShape().IsNull()) {
- char* aSubName;
- if (aName!=NULL) {
- aSubName = new char[200];
- sprintf(aSubName,"%s_%d",aName,a);
- } else aSubName = NULL;
- aResult+=GetAllNew(anIter.NewShape(),aLabel,aSubName,0);
- if (aSubName != NULL) delete [] aSubName;
+ TCollection_AsciiString aSubName;
+ if (!aName.IsEmpty())
+ {
+ aSubName += aName + "_";
+ aSubName += a;
+ }
+ aResult+=GetAllNew(anIter.NewShape(),aLabel,aSubName,0);
}
}
} else { // shape
return 0;
}
-static int GetAllOld(const TopoDS_Shape& theShape, const TDF_Label& theAccess, const char* theName, Standard_Integer theIndex) {
- char aName[200];
+static int GetAllOld(const TopoDS_Shape& theShape, const TDF_Label& theAccess,
+ const TCollection_AsciiString& theName, Standard_Integer theIndex)
+{
+ TCollection_AsciiString aName;
Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(theShape,theAccess);
if (aNS.IsNull()) return theIndex;
TNaming_Iterator anIter(aNS);
- for(;anIter.More();anIter.Next()) {
- if (!anIter.OldShape().IsNull() && !anIter.NewShape().IsNull()) if (anIter.NewShape().IsSame(theShape)) {
+ for(;anIter.More();anIter.Next())
+ {
+ if (!anIter.OldShape().IsNull() && !anIter.NewShape().IsNull()) if (anIter.NewShape().IsSame(theShape))
+ {
theIndex++;
- if (theName!=NULL) {
- sprintf(aName,"%s_%d",theName,theIndex);
- DBRep::Set(aName,anIter.OldShape());
+ if (!theName.IsEmpty())
+ {
+ aName = theName + "_" + theIndex;
+ DBRep::Set(aName.ToCString(),anIter.OldShape());
}
theIndex = GetAllOld(anIter.OldShape(),theAccess,theName,theIndex);
}
const char** arg) {
Standard_Integer aResult = 0;
if (nb==3 || nb==4) {
- const char* aName = (nb==4) ? arg[3] : NULL;
+ TCollection_AsciiString aName((nb==4) ? arg[3] : "");
if (arg[2][0]=='0') { // label
TDF_Label aLabel;
TNaming_Iterator anIter(aNS);
for(a=1;anIter.More();anIter.Next(),a++) {
if (!anIter.NewShape().IsNull()) {
- char* aSubName;
- if (aName!=NULL) {
- aSubName = new char[200];
- sprintf(aSubName,"%s_%d",aName,a);
- } else aSubName = NULL;
- aResult+=GetAllOld(anIter.NewShape(),aLabel,aSubName,0);
+ TCollection_AsciiString aSubName;
+ if (!aName.IsEmpty())
+ {
+ aSubName += aName + "_";
+ aSubName += a;
+ }
+ aResult+=GetAllOld(anIter.NewShape(),aLabel,aSubName,0);
}
}
} else { // shape
Standard_Integer QAAISXWindowSize_X = 0;
Standard_Integer QAAISXWindowSize_Y = 0;
QAAISWindow->Size(QAAISXWindowSize_X, QAAISXWindowSize_Y);
- Standard_ShortReal QAAISCoordinateX = atof (argv [1]);
- Standard_ShortReal QAAISCoordinateY = atof (argv [2]);
+ Standard_Integer QAAISCoordinateX = atoi (argv [1]);
+ Standard_Integer QAAISCoordinateY = atoi (argv [2]);
- Standard_ShortReal QAAISColorRED_V = 0;
- Standard_ShortReal QAAISColorGRN_V = 0;
- Standard_ShortReal QAAISColorBLU_V = 0;
+ Standard_Real QAAISColorRED_V = 0;
+ Standard_Real QAAISColorGRN_V = 0;
+ Standard_Real QAAISColorBLU_V = 0;
if ( argc == 6 ) {
QAAISColorRED_V = atof (argv [3]);
Standard_Integer i;
for(i=1; i<=aSeq->Length();i+=3) {
// mkv 29.04.03
- Standard_ShortReal QAAISColorRED_R = (((Standard_ShortReal) ((Standard_Integer) (aSeq->Value(i+0) * 1000000))) / 1000000.);
- Standard_ShortReal QAAISColorGRN_R = (((Standard_ShortReal) ((Standard_Integer) (aSeq->Value(i+1) * 1000000))) / 1000000.);
- Standard_ShortReal QAAISColorBLU_R = (((Standard_ShortReal) ((Standard_Integer) (aSeq->Value(i+2) * 1000000))) / 1000000.);
+ Standard_Real QAAISColorRED_R = (Floor(aSeq->Value(i+0) * 1000000.)) / 1000000.;
+ Standard_Real QAAISColorGRN_R = (Floor(aSeq->Value(i+1) * 1000000.)) / 1000000.;
+ Standard_Real QAAISColorBLU_R = (Floor(aSeq->Value(i+2) * 1000000.)) / 1000000.;
// mkv 29.04.03
if ( argc == 3 ) {
TDF_LabelMap scope;
TDF_ChildIterator itr(L.Root(), Standard_True);
i = 1;
- char aNotSolved[1000];
- aNotSolved[0]=0;
+ TCollection_AsciiString aNotSolved;
for (itr.Initialize(L, Standard_False); itr.More(); itr.Next(), i++) {
Handle(TNaming_NamedShape) aNS;
if (!itr.Value().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
TNaming_Selector SLSolving(itr.Value());
if (!SLSolving.Solve(scope)) {
isFailured = Standard_True;
- sprintf(aNotSolved,"%s %d",aNotSolved,i);
+ aNotSolved += " ";
+ aNotSolved += i;
continue;
}
const Handle(TNaming_NamedShape)& aResultOfSolving = SLSolving.NamedShape();
// cout<<"Failure of Solving: it didn't produced a shape!"<<endl;
// return 1;
isFailured = Standard_True;
- sprintf(aNotSolved,"%s %d",aNotSolved,i);
-// break;
+ aNotSolved += " ";
+ aNotSolved += i;
continue;
}
TopoDS_Shape aRes;
}
}
if (!aCoord1.IsEqual(aCoord2,Precision::Confusion()) || aRes.ShapeType() != allTranslatedSubShapes(i).ShapeType()) {
- sprintf(aNotSolved,"%s %d",aNotSolved,i);
- isFailured = Standard_True;
- // break;
- continue;
+ aNotSolved += " ";
+ aNotSolved += i;
+ isFailured = Standard_True;
+ continue;
}
}
// cout<<endl;
Standard_Integer nbs = aSMap.Extent();
if(nbs <= 1) return aRes;
- // math_Matrix aMat(1, nbs, 1, nbs, 0.0);
- int *aMat = new int[nbs*nbs];
+ math_Matrix aMat(1, nbs, 1, nbs, 0);
Standard_Integer aMax=nbs*nbs;
- for(Standard_Integer kk=0;kk<aMax;kk++) aMat[kk]=0;
TopTools_MapIteratorOfMapOfShape anMIter(aSMap);
Standard_Integer n = 1;
Standard_Integer connect;
const TopoDS_Shape& aFirstShape = anMIter.Key();
- // aMat(n,n) = 1.;
- aMat[0] = 1;
+ aMat(n,n) = 1;
anExp.Init(aFirstShape, TopAbs_VERTEX);
for(; anExp.More(); anExp.Next()) {
for(; anMIter.More(); anMIter.Next()) {
++n;
- aMat[(n-1)*nbs+n-1] = 1;
- // aMat(n,n) = 1.;
+ aMat(n,n) = 1;
const TopoDS_Shape& aShape = anMIter.Key();
anExp.Init(aShape, TopAbs_VERTEX);
for(; anExp.More(); anExp.Next()) {
- if(aMap.IsBound(anExp.Current())) {
- connect = aMap(anExp.Current());
- //aMat(n, connect) = 1.;
- //aMat(connect, n) = 1.;
- aMat[(n-1)*nbs+connect-1] = 1;
- aMat[(connect-1)*nbs+n-1] = 1;
+ if(aMap.IsBound(anExp.Current()))
+ {
+ connect = aMap(anExp.Current());
+ aMat(n, connect) = 1;
+ aMat(connect, n) = 1;
}
- else {
- aMap.Bind(anExp.Current(), n);
+ else
+ {
+ aMap.Bind(anExp.Current(), n);
}
}
}
Standard_Integer k,i,ncount=0;
Standard_Real p;
Standard_Boolean aNotChanged;
- // math_Vector aRow(1, nbs), aCol(1, nbs);
-
- // aRow = aMat.Row(1);
- for(k = 1; k <= nbs; k++) {
+ for (k = 1; k <= nbs; k++)
+ {
aRes = Standard_True;
aNotChanged = Standard_True;
- for(n = 1; n <= nbs; n++) {
- // if(aMat(1, n) < 1.) {
- if(aMat[n-1] == 0) {
- // aRow = aMat.Row(1);
- //aCol = aMat.Col(n);
- p=0.;
- for(i=1;i<=nbs;i++) {
- //ncount++;
- // if(aMat(1,i) > 0. && aMat(i,n)> 0.) {
- if(aMat[i-1] == 1 && aMat[(i-1)*nbs+n-1] == 1) {
- p=1.;
- break;
- }
- // p+=aMat(1,i)*aMat(i,n);
- }
- //p = aRow*aCol;
- if(p > 0.0) {
- // aMat(1, n) = 1.0;
- // aMat(n, 1) = 1.0;
- aMat[n-1] = 1;
- aMat[(n-1)*nbs+1-1] = 1;
- aNotChanged = Standard_False;
- }
- aRes = Standard_False;
+ for (n = 1; n <= nbs; n++)
+ {
+ if (aMat(1, n) == 0)
+ {
+ p = 0;
+ for (i = 1; i <= nbs; i++)
+ {
+ if (aMat(1, i) == 1 && aMat(i, n) == 1)
+ {
+ p = 1;
+ break;
+ }
+ }
+ if (p > 0)
+ {
+ aMat(1, n) = 1;
+ aMat(n, 1) = 1;
+ aNotChanged = Standard_False;
+ }
+ aRes = Standard_False;
}
}
if(aNotChanged) break;
if(aRes) break;
}
- delete [] aMat;
- // cout << "QANewModTopOpe::IsConnected END: aRes="<<aRes << ";ncount="<<ncount<<endl;
cout << "QANewModTopOpe::IsConnected END: aRes="<<aRes <<endl;
return aRes;