ReducedNestingTreeNode.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #include "ReducedNestingTreeNode.h"
  2. ReducedNestingTreeNode::ReducedNestingTreeNode()
  3. {
  4. m_layerNode = NULL;
  5. m_nestingTreeNode = NULL;
  6. m_dAveragePosition = 0.0;
  7. }
  8. bool ReducedNestingTreeNode::isLayerNode()
  9. {
  10. return m_constBIsLayerNode;
  11. }
  12. void ReducedNestingTreeNode::addChildNode(double dAvgPosition, ReducedNestingTreeNode *reducedNestingTreeNodeRef)
  13. {
  14. m_mapChildrenRNTNodes.insert(dAvgPosition , reducedNestingTreeNodeRef);
  15. }
  16. void ReducedNestingTreeNode::setLayerNode(LayerNode *layerNode)
  17. {
  18. LAYOUT_ASSERT(m_nestingTreeNode == NULL && layerNode != NULL,
  19. LayoutException(__FUNCTION__
  20. ,LayoutExceptionEnum::REQUIRED_PARAMETER_NOT_SET
  21. ,"m_nestingTreeNode and layerNode"
  22. ,"ReducedNestingTreeNode"));
  23. m_layerNode = layerNode;
  24. m_constBIsLayerNode = true;
  25. }
  26. LayerNode *ReducedNestingTreeNode::getLayerNode()
  27. {
  28. Q_ASSERT_X(m_layerNode != NULL , "ReducedNestingTree Get LayerNode" , "Layer Node is not set");
  29. return m_layerNode;
  30. }
  31. void ReducedNestingTreeNode::setNestingTreeNode(NestingTreeSubgraphNode *nestingTreeNode)
  32. {
  33. LAYOUT_ASSERT(m_layerNode == NULL && nestingTreeNode != NULL,
  34. LayoutException(__FUNCTION__
  35. ,LayoutExceptionEnum::REQUIRED_PARAMETER_NOT_SET
  36. ,"m_nestingTreeNode and layerNode"
  37. ,"ReducedNestingTreeNode"));
  38. m_nestingTreeNode = nestingTreeNode;
  39. m_constBIsLayerNode = false;
  40. }
  41. NestingTreeSubgraphNode *ReducedNestingTreeNode::getNestingTreeNode()
  42. {
  43. LAYOUT_ASSERT(m_nestingTreeNode != NULL ,
  44. LayoutException(__FUNCTION__
  45. ,LayoutExceptionEnum::REQUIRED_PARAMETER_NOT_SET
  46. ,"Nesting Tree Node"
  47. ,"ReducedNestingTreeNode"));
  48. return m_nestingTreeNode;
  49. }
  50. double ReducedNestingTreeNode::getAveragePosition()
  51. {
  52. return m_dAveragePosition;
  53. }
  54. void ReducedNestingTreeNode::setAveragePosition(double dAveragePosition)
  55. {
  56. m_dAveragePosition = dAveragePosition;
  57. }
  58. int ReducedNestingTreeNode::getChildLayerNodeCount()
  59. {
  60. return m_iLayerNodeCount;
  61. }
  62. void ReducedNestingTreeNode::setChildLayerNodeCount(int iLayerNodeCount)
  63. {
  64. LAYOUT_ASSERT(iLayerNodeCount >= 0 ,
  65. LayoutException(__FUNCTION__
  66. ,LayoutExceptionEnum::INVALID_PARAMETER
  67. ,QString::number(iLayerNodeCount)
  68. ,"iLayerNodeCount"));
  69. m_iLayerNodeCount = iLayerNodeCount;
  70. }
  71. ReducedNestingTreeNode::IteratorMapAvgPosToChildRNTNode ReducedNestingTreeNode::getChildNodesIterator()
  72. {
  73. IteratorMapAvgPosToChildRNTNode iterChildNodes(m_mapChildrenRNTNodes);
  74. return iterChildNodes;
  75. }