1 // Created on: 2018-06-10
2 // Created by: Natalia Ermolaeva
3 // Copyright (c) 2018-2020 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <TopoDS_AlertAttribute.hxx>
18 #include <Message_PrinterToReport.hxx>
20 IMPLEMENT_STANDARD_RTTIEXT(TopoDS_AlertAttribute, Message_Attribute)
22 //=======================================================================
23 //function : TopoDS_AlertAttribute
25 //=======================================================================
26 TopoDS_AlertAttribute::TopoDS_AlertAttribute (const TopoDS_Shape& theShape,
27 const TCollection_AsciiString& theName)
28 : Message_AttributeStream (Standard_SStream(), theName), myShape (theShape)
30 Standard_SStream aStream;
31 theShape.DumpJson (aStream);
36 //=======================================================================
39 //=======================================================================
40 void TopoDS_AlertAttribute::Send (const Handle(Message_Messenger)& theMessenger,
41 const TopoDS_Shape& theShape)
43 for (Message_SequenceOfPrinters::Iterator aPrinterIter (theMessenger->Printers()); aPrinterIter.More(); aPrinterIter.Next())
45 const Handle(Message_Printer)& aPrinter = aPrinterIter.Value();
46 if (!aPrinter->IsKind (STANDARD_TYPE (Message_PrinterToReport)))
51 Handle (Message_PrinterToReport) aPrinterToReport = Handle(Message_PrinterToReport)::DownCast (aPrinter);
52 const Handle(Message_Report)& aReport = aPrinterToReport->Report();
54 Message_AlertExtended::AddAlert (aReport, new TopoDS_AlertAttribute (theShape), Message_Info);
58 //=======================================================================
61 //=======================================================================
62 void TopoDS_AlertAttribute::DumpJson (Standard_OStream& theOStream,
63 Standard_Integer theDepth) const
65 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
66 OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Message_Attribute)
68 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myShape)