From: skv Date: Thu, 25 Sep 2014 06:28:23 +0000 (+0400) Subject: Add creation Information X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1b9098f1b36c3e28cd5a23fa9f0c73b64de58ac3;p=modules%2Fgeom.git Add creation Information --- diff --git a/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx b/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx index 1c182c9cb..9c508c2f7 100644 --- a/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx @@ -294,10 +294,9 @@ GetCreationInformation(std::string& theOperationName, GEOMImpl_ICurveParametric aIP( function ); Standard_Integer aType = function->GetType(); - theOperationName = "CURVE"; - switch ( aType ) { case POLYLINE_POINTS: + theOperationName = "CURVE"; AddParam( theParams, "Type", "Polyline"); if ( aIP.HasData() ) { @@ -334,6 +333,103 @@ GetCreationInformation(std::string& theOperationName, AddParam( theParams, "Is closed", aCI.GetIsClosed() ); } break; + case POLYLINE2D_PLN_COORDS: + case POLYLINE2D_PLN_OBJECT: + { + theOperationName = "SKETCH"; + + GEOMImpl_IPolyline2D aP2d(function); + Handle(TColStd_HArray1OfExtendedString) aNames = aP2d.GetNames(); + + if (aNames.IsNull() == Standard_False) { + if (aNames->Length() == 1) { + // This is the single curve. Make its full dump. + AddParam(theParams, "Name", aNames->Value(aNames->Lower())); + + Handle(TColStd_HArray1OfByte) aTypes = aP2d.GetTypes(); + + if (aTypes.IsNull() == Standard_False && aTypes->Length() == 1) { + Standard_Integer aType = aTypes->Value(aTypes->Lower()); + + if (aType == GEOMImpl_ICurvesOperations::Polyline) { + AddParam(theParams, "Type") << "Polyline"; + } else if (aType == GEOMImpl_ICurvesOperations::Interpolation) { + AddParam(theParams, "Type") << "Interpolation"; + } + } + + Handle(TColStd_HArray1OfByte) aCloseds = aP2d.GetClosedFlags(); + + if (aCloseds.IsNull() == Standard_False && aCloseds->Length() == 1) { + const char *aYesNo = + aCloseds->Value(aCloseds->Lower()) ? "Yes" : "No"; + + AddParam(theParams, "Is closed", aYesNo); + } + + std::list > aCoords; + + aP2d.GetCoords(aCoords); + + if (aCoords.size() == 1) { + AddParam(theParams, "Number of points", aCoords.front().size()); + } + } else { + // There are more than 1 curve. + Standard_Integer aNbCurves = aNames->Length(); + Standard_Integer i; + std::list > aCoords; + + AddParam(theParams, "Number of curves", aNbCurves); + aP2d.GetCoords(aCoords); + + Standard_Integer aNbCoords = aCoords.size(); + std::list >::const_iterator + anIt = aCoords.begin(); + + for (i = 0; i < aNbCurves; i++) { + TCollection_AsciiString aName("Curve "); + TCollection_ExtendedString + aValue(aNames->Value(aNames->Lower() + i)); + + aName.AssignCat(i + 1); + + if (anIt != aCoords.end()) { + aValue.AssignCat(" ("); + aValue.AssignCat(Standard_Integer(anIt->size())); + aValue.AssignCat(" points)"); + anIt++; + } + + AddParam(theParams, aName.ToCString(), aValue); + } + } + } + + if (aType == POLYLINE2D_PLN_COORDS) { + Handle(TColStd_HArray1OfReal) aPln = aP2d.GetWorkingPlaneDbls(); + + if (aPln.IsNull() == Standard_False && aPln->Length() == 9) { + Standard_Integer i = aPln->Lower(); + + AddParam( theParams, "Origin") + << aPln->Value(i) << " " + << aPln->Value(i + 1) << " " + << aPln->Value(i + 2); + AddParam( theParams, "OZ") + << aPln->Value(i + 3) << " " + << aPln->Value(i + 4) << " " + << aPln->Value(i + 5); + AddParam( theParams, "OX") + << aPln->Value(i + 6) << " " + << aPln->Value(i + 7) << " " + << aPln->Value(i + 8); + } + } else { + AddParam(theParams, "Working plane", aP2d.GetWorkingPlane(), "XOY"); + } + } + break; default: return false; } diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index 4ee695c3e..3b29c3889 100644 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -252,7 +252,9 @@ #define PARTITION_HALF 2 #define PARTITION_NO_SELF_INTERSECTIONS 3 -#define POLYLINE_POINTS 1 +#define POLYLINE_POINTS 1 +#define POLYLINE2D_PLN_COORDS 2 +#define POLYLINE2D_PLN_OBJECT 3 #define SPLINE_BEZIER 1 #define SPLINE_INTERPOLATION 2 @@ -367,8 +369,5 @@ #define IMPORTEXPORT_EXPORTXAO 1 #define IMPORTEXPORT_IMPORTXAO 2 -#define POLYLINE2D_PLN_COORDS 1 -#define POLYLINE2D_PLN_OBJECT 2 - // Advanced functions (base = 200) #define ADVANCED_BASE 200 // NO OPERATION (advanced operations base)