#include <CDM_Document.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
+#include <Message_ProgressSentry.hxx>
#include <LDOM_DocumentType.hxx>
#include <LDOM_LDOMImplementation.hxx>
#include <LDOM_XmlWriter.hxx>
//purpose :
//=======================================================================
void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDocument,
- const TCollection_ExtendedString& theFileName)
+ const TCollection_ExtendedString& theFileName,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
myFileName = theFileName;
if (aFileStream.is_open() && aFileStream.good())
{
- Write (theDocument, aFileStream);
+ Write (theDocument, aFileStream, theProgress);
}
else
{
//function : Write
//purpose :
//=======================================================================
-Standard_EXPORT void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDocument,
- Standard_OStream& theOStream)
+void XmlLDrivers_DocumentStorageDriver::Write (const Handle(CDM_Document)& theDocument,
+ Standard_OStream& theOStream,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
Handle(Message_Messenger) aMessageDriver = theDocument->Application()->MessageDriver();
::take_time (~0, " +++++ Start STORAGE procedures ++++++", aMessageDriver);
// Fill the document with data
XmlObjMgt_Element anElement = aDOMDoc.getDocumentElement();
- if (WriteToDomDocument (theDocument, anElement) == Standard_False) {
+ if (WriteToDomDocument (theDocument, anElement, theProgress) == Standard_False) {
LDOM_XmlWriter aWriter;
aWriter.SetIndentation(1);
// data to XML, this method should be reimplemented avoiding step 3
//=======================================================================
-Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument (const Handle(CDM_Document)& theDocument,
- XmlObjMgt_Element& theElement)
+Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteToDomDocument
+ (const Handle(CDM_Document)& theDocument,
+ XmlObjMgt_Element& theElement,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
SetIsError(Standard_False);
Handle(Message_Messenger) aMessageDriver =
aCommentsElem.appendChild (aCItem);
XmlObjMgt::SetExtendedString (aCItem, aComments(i));
}
-
+ Message_ProgressSentry aPS(theProgress, "Writing", 0, 2, 1);
// 2a. Write document contents
Standard_Integer anObjNb = 0;
{
try
{
OCC_CATCH_SIGNALS
- anObjNb = MakeDocument(theDocument, theElement);
+ anObjNb = MakeDocument(theDocument, theElement, theProgress);
+ if (!aPS.More())
+ {
+ SetIsError(Standard_True);
+ SetStoreStatus(PCDM_SS_UserBreak);
+ return IsError();
+ }
+ aPS.Next();
}
catch (Standard_Failure const& anException)
{
myRelocTable.Clear();
// 4. Write Shapes section
- if(WriteShapeSection(theElement))
+ if (WriteShapeSection(theElement, theProgress))
::take_time (0, " +++ Fin DOM data for Shapes : ", aMessageDriver);
+ if (!aPS.More())
+ {
+ SetIsError(Standard_True);
+ SetStoreStatus(PCDM_SS_UserBreak);
+ return IsError();
+ }
+ aPS.Next();
return IsError();
}
//=======================================================================
Standard_Integer XmlLDrivers_DocumentStorageDriver::MakeDocument
(const Handle(CDM_Document)& theTDoc,
- XmlObjMgt_Element& theElement)
+ XmlObjMgt_Element& theElement,
+ const Handle(Message_ProgressIndicator)& theProgress)
{
TCollection_ExtendedString aMessage;
Handle(TDocStd_Document) TDOC = Handle(TDocStd_Document)::DownCast(theTDoc);
if (myDrivers.IsNull()) myDrivers = AttributeDrivers (aMessageDriver);
// Retrieve from DOM_Document
- XmlMDF::FromTo (aTDF, theElement, myRelocTable, myDrivers);
+ XmlMDF::FromTo (aTDF, theElement, myRelocTable, myDrivers, theProgress);
#ifdef OCCT_DEBUGXML
aMessage = "First step successfull";
aMessageDriver -> Send (aMessage.ToExtString(), Message_Warning);
//purpose : defines WriteShapeSection
//=======================================================================
Standard_Boolean XmlLDrivers_DocumentStorageDriver::WriteShapeSection
- (XmlObjMgt_Element& /*theElement*/)
+ (XmlObjMgt_Element& /*theElement*/,
+ const Handle(Message_ProgressIndicator)& /*theProgress*/)
{
// empty; should be redefined in subclasses
return Standard_False;