You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.2 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software: you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation, either version 3 of the License, or (at your
  9. * option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include <vector>
  20. #include <math/vector2d.h>
  21. #include <sch_rtree.h>
  22. class SCH_JUNCTION;
  23. namespace JUNCTION_HELPERS
  24. {
  25. /**
  26. * A selection of information about a point in the schematic that might
  27. * be eligible for turning into a junction.
  28. */
  29. struct POINT_INFO
  30. {
  31. /// True if the point has 3+ wires and/or 3+ buses meeting there
  32. bool isJunction;
  33. /// True if there is already junction dot at the point
  34. bool hasExplicitJunctionDot;
  35. /// True if there is a bus entry at the point (either end)
  36. bool hasBusEntry;
  37. /// True if there is a bus entry at the point and it connects to more than one wire
  38. bool hasBusEntryToMultipleWires;
  39. };
  40. /**
  41. * Check a tree of items for a confluence at a given point and work out what kind of junction
  42. * it is, if any.
  43. */
  44. POINT_INFO AnalyzePoint( const EE_RTREE& aItem, const VECTOR2I& aPosition, bool aBreakCrossings );
  45. /**
  46. * Determine the points where explicit junctions would be required if the given
  47. * temporary items were committed to the schematic.
  48. *
  49. * @param aScreen The schematic screen containing the existing items.
  50. * @param aItems Temporary items not yet added to the screen.
  51. * @return Locations of needed junctions represented as new SCH_JUNCTION items.
  52. */
  53. std::vector<SCH_JUNCTION*> PreviewJunctions( const class SCH_SCREEN* aScreen,
  54. const std::vector<class SCH_ITEM*>& aItems );
  55. } // namespace JUNCTION_HELPERS