Return true if geom object representes a shape.
For example, method return false for GEOM_MARKER
"""
- return False
+ return True
def IsSame( self, other ):
"""
"""
Get a GEOM.shape_type of the object value.
"""
- return GEOM.SHAPE
+ if self.data is None:
+ return GEOM.SHAPE
+ return self.data.type();
def IsMainShape( self ):
"""
Returns True if this object is not a sub-shape of another object.
"""
- return False
+ return True
def GetSubShapeIndices( self ):
"""
"""
Get a main shape object to which this object is a sub-shape.
"""
- return
+ return getShape()
def getShape( self ):
"""
Get the TopoDS_Shape, for colocated case only.
Called by GEOM_Client to get TopoDS_Shape pointer
"""
- return 0
+ if self.data is None:
+ return 0
+ return self.data.shape()
def GetShapeStream( self ):
"""
Get geometric shape of the object as a byte stream in BRep format
"""
- return ;
+ if self.data is None:
+ return
+ return self.data.shapeStream()
def SetShapeByStream(self, theStream):
"""
BRep_Builder aBuilder;
BRepTools::Read(myShape, streamBrep, aBuilder);
}
+
+
+GEOM::shape_type StudyData_Object::type() const
+{
+ if (myShape.IsNull())
+ return GEOM::SHAPE;
+ return (GEOM::shape_type) myShape.ShapeType();
+}
+
+
+SALOMEDS::TMPFile* StudyData_Object::shapeStream() const
+{
+ if (myShape.IsNull())
+ return NULL;
+
+ std::ostringstream streamShape;
+
+ //Write TopoDS_Shape in ASCII format to the stream
+ BRepTools::Write(myShape, streamShape);
+
+ //Returns the number of bytes that have been stored in the stream's buffer.
+ int size = streamShape.str().size();
+
+ //Allocate octect buffer of required size
+ CORBA::Octet* OctetBuf = SALOMEDS::TMPFile::allocbuf(size);
+
+ //Copy ostrstream content to the octect buffer
+ memcpy(OctetBuf, streamShape.str().c_str(), size);
+
+ //Create and return TMPFile
+ SALOMEDS::TMPFile_var SeqFile = new SALOMEDS::TMPFile(size, size, OctetBuf, 1);
+ return SeqFile._retn();
+}
+
+
+CORBA::LongLong StudyData_Object::shape() const
+{
+ return ((CORBA::LongLong)(&myShape));
+}
+
public:
StudyData_Object(const std::string theFile);
+ GEOM::shape_type type() const;
+
+ SALOMEDS::TMPFile* shapeStream() const;
+
+ CORBA::LongLong shape() const;
private:
TopoDS_Shape myShape;