1 /***************************************************************************** |
1 /***************************************************************************** |
2 * |
2 * |
3 * |
3 * |
4 * |
4 * |
5 * |
5 * |
6 * Copyright (C) 1997-2008 by Dimitri van Heesch. |
6 * Copyright (C) 1997-2010 by Dimitri van Heesch. |
7 * |
7 * |
8 * Permission to use, copy, modify, and distribute this software and its |
8 * Permission to use, copy, modify, and distribute this software and its |
9 * documentation under the terms of the GNU General Public License is hereby |
9 * documentation under the terms of the GNU General Public License is hereby |
10 * granted. No representations are made about the suitability of this software |
10 * granted. No representations are made about the suitability of this software |
11 * for any purpose. It is provided "as is" without express or implied warranty. |
11 * for any purpose. It is provided "as is" without express or implied warranty. |
716 { |
724 { |
717 t << ",color=\"black\", fillcolor=\"grey75\", style=\"filled\" fontcolor=\"black\""; |
725 t << ",color=\"black\", fillcolor=\"grey75\", style=\"filled\" fontcolor=\"black\""; |
718 } |
726 } |
719 else |
727 else |
720 { |
728 { |
721 if (!Config_getBool("DOT_TRANSPARENT")) |
729 static bool dotTransparent = Config_getBool("DOT_TRANSPARENT"); |
722 { |
730 static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); |
723 t << ",color=\"" << labCol << "\", fillcolor=\"white\", style=\"filled\""; |
731 if (!dotTransparent) |
|
732 { |
|
733 ClassDef* ccd=this->m_classDef; |
|
734 |
|
735 t << ",color=\"" << labCol << "\", fillcolor=\""; |
|
736 if (ccd && vhdlOpt && (VhdlDocGen::VhdlClasses)ccd->protection()==VhdlDocGen::ARCHITECTURECLASS) |
|
737 t << "khaki"; |
|
738 else |
|
739 t << "white"; |
|
740 t << "\", style=\"filled\""; |
724 } |
741 } |
725 else |
742 else |
726 { |
743 { |
727 t << ",color=\"" << labCol << "\""; |
744 t << ",color=\"" << labCol << "\""; |
728 } |
745 } |
914 } |
931 } |
915 } |
932 } |
916 t << " </node>" << endl; |
933 t << " </node>" << endl; |
917 } |
934 } |
918 |
935 |
919 void DotNode::writeXML(XmlStream &xt, bool isClassGraph) |
|
920 { |
|
921 QString idNumber; |
|
922 idNumber.setNum(m_number); |
|
923 XmlElement nodeElem(xt, "node", "id", idNumber); |
|
924 { |
|
925 XmlElement nodeLabel(xt, "label"); |
|
926 xt << m_label; |
|
927 } |
|
928 if (!m_url.isEmpty()) { |
|
929 QCString url(m_url); |
|
930 char *refPtr = url.data(); |
|
931 char *urlPtr = strchr(url.data(),'$'); |
|
932 if (urlPtr) { |
|
933 *urlPtr++='\0'; |
|
934 AttributeMap linkAttrs; |
|
935 linkAttrs["refid"] = convertToXML(urlPtr); |
|
936 if (*refPtr!='\0') { |
|
937 linkAttrs["external"] = convertToXML(refPtr); |
|
938 } |
|
939 XmlElement(xt, "link", linkAttrs); |
|
940 } |
|
941 } |
|
942 if (m_children) { |
|
943 QListIterator<DotNode> nli(*m_children); |
|
944 QListIterator<EdgeInfo> eli(*m_edgeInfo); |
|
945 DotNode *childNode; |
|
946 EdgeInfo *edgeInfo; |
|
947 for (;(childNode=nli.current());++nli,++eli) { |
|
948 edgeInfo=eli.current(); |
|
949 AttributeMap childAttrs; |
|
950 QString childIdNumber; |
|
951 childIdNumber.setNum(childNode->m_number); |
|
952 childAttrs["refid"] = childIdNumber; |
|
953 if (isClassGraph) { |
|
954 switch(edgeInfo->m_color) { |
|
955 case EdgeInfo::Blue: childAttrs["relation"] = "public-inheritance"; break; |
|
956 case EdgeInfo::Green: childAttrs["relation"] = "protected-inheritance"; break; |
|
957 case EdgeInfo::Red: childAttrs["relation"] = "private-inheritance"; break; |
|
958 case EdgeInfo::Purple: childAttrs["relation"] = "usage"; break; |
|
959 case EdgeInfo::Orange: childAttrs["relation"] = "template-instance"; break; |
|
960 case EdgeInfo::Grey: ASSERT(0); break; |
|
961 } |
|
962 } else { |
|
963 // include graph |
|
964 childAttrs["relation"] = "include"; |
|
965 } |
|
966 XmlElement childnodeElem(xt, "childnode", childAttrs); |
|
967 if (!edgeInfo->m_label.isEmpty()) { |
|
968 int p=0; |
|
969 int ni; |
|
970 while ((ni=edgeInfo->m_label.find('\n',p))!=-1) { |
|
971 XmlElement edgelabelElem(xt, "edgelabel"); |
|
972 xt << edgeInfo->m_label.mid(p,ni-p); |
|
973 p=ni+1; |
|
974 } |
|
975 XmlElement edgelabelElem(xt, "edgelabel"); |
|
976 xt << edgeInfo->m_label.right(edgeInfo->m_label.length()-p); |
|
977 } |
|
978 } |
|
979 } |
|
980 } |
|
981 |
|
982 void DotNode::writeXMLDITA(XmlStream &xt, bool isClassGraph) |
|
983 { |
|
984 QString idNumber; |
|
985 idNumber.setNum(m_number); |
|
986 XmlElement nodeElem(xt, "node", "id", idNumber); |
|
987 { |
|
988 XmlElement nodeLabel(xt, "label"); |
|
989 xt << m_label; |
|
990 } |
|
991 if (!m_url.isEmpty()) { |
|
992 QCString url(m_url); |
|
993 char *refPtr = url.data(); |
|
994 char *urlPtr = strchr(url.data(),'$'); |
|
995 if (urlPtr) { |
|
996 *urlPtr++='\0'; |
|
997 AttributeMap linkAttrs; |
|
998 linkAttrs["refid"] = convertToXML(urlPtr); |
|
999 if (*refPtr!='\0') { |
|
1000 linkAttrs["external"] = convertToXML(refPtr); |
|
1001 } |
|
1002 XmlElement(xt, "link", linkAttrs); |
|
1003 } |
|
1004 } |
|
1005 if (m_children) { |
|
1006 QListIterator<DotNode> nli(*m_children); |
|
1007 QListIterator<EdgeInfo> eli(*m_edgeInfo); |
|
1008 DotNode *childNode; |
|
1009 EdgeInfo *edgeInfo; |
|
1010 for (;(childNode=nli.current());++nli,++eli) { |
|
1011 edgeInfo=eli.current(); |
|
1012 AttributeMap childAttrs; |
|
1013 QString childIdNumber; |
|
1014 childIdNumber.setNum(childNode->m_number); |
|
1015 childAttrs["refid"] = childIdNumber; |
|
1016 if (isClassGraph) { |
|
1017 switch(edgeInfo->m_color) { |
|
1018 case EdgeInfo::Blue: childAttrs["relation"] = "public-inheritance"; break; |
|
1019 case EdgeInfo::Green: childAttrs["relation"] = "protected-inheritance"; break; |
|
1020 case EdgeInfo::Red: childAttrs["relation"] = "private-inheritance"; break; |
|
1021 case EdgeInfo::Purple: childAttrs["relation"] = "usage"; break; |
|
1022 case EdgeInfo::Orange: childAttrs["relation"] = "template-instance"; break; |
|
1023 case EdgeInfo::Grey: ASSERT(0); break; |
|
1024 } |
|
1025 } else { |
|
1026 // include graph |
|
1027 childAttrs["relation"] = "include"; |
|
1028 } |
|
1029 XmlElement childnodeElem(xt, "childnode", childAttrs); |
|
1030 if (!edgeInfo->m_label.isEmpty()) { |
|
1031 int p=0; |
|
1032 int ni; |
|
1033 while ((ni=edgeInfo->m_label.find('\n',p))!=-1) { |
|
1034 XmlElement edgelabelElem(xt, "edgelabel"); |
|
1035 xt << edgeInfo->m_label.mid(p,ni-p); |
|
1036 p=ni+1; |
|
1037 } |
|
1038 XmlElement edgelabelElem(xt, "edgelabel"); |
|
1039 xt << edgeInfo->m_label.right(edgeInfo->m_label.length()-p); |
|
1040 } |
|
1041 } |
|
1042 } |
|
1043 } |
|
1044 |
936 |
1045 void DotNode::writeDEF(QTextStream &t) |
937 void DotNode::writeDEF(QTextStream &t) |
1046 { |
938 { |
1047 const char* nodePrefix = " node-"; |
939 const char* nodePrefix = " node-"; |
1048 |
940 |