No Description
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.

Drawing.java 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. package org.insa.graphs.gui.drawing;
  2. import java.awt.Color;
  3. import org.insa.graphs.gui.drawing.overlays.MarkerOverlay;
  4. import org.insa.graphs.gui.drawing.overlays.PathOverlay;
  5. import org.insa.graphs.gui.drawing.overlays.PointSetOverlay;
  6. import org.insa.graphs.model.Graph;
  7. import org.insa.graphs.model.Path;
  8. import org.insa.graphs.model.Point;
  9. public interface Drawing {
  10. /**
  11. * Available fill mode for the creation of markers, see the documentation of
  12. * each value for more details.
  13. */
  14. enum AlphaMode {
  15. /**
  16. * Do not use the original transparency of the inner part to fill it.
  17. */
  18. OPAQUE,
  19. /**
  20. * Use the original transparency of the inner part to fill it.
  21. */
  22. TRANSPARENT
  23. }
  24. /**
  25. * Add a listener to click to this drawing.
  26. *
  27. * @param listener DrawingClickListener to add to this Drawing.
  28. */
  29. public void addDrawingClickListener(DrawingClickListener listener);
  30. /**
  31. * Remove the given listener from the drawing.
  32. *
  33. * @param listener DrawingClickListener to remove from this Drawing.
  34. */
  35. public void removeDrawingClickListener(DrawingClickListener listener);
  36. /**
  37. * Clear the drawing (overlays and underlying graph/map).
  38. */
  39. public void clear();
  40. /**
  41. * Remove overlays from the drawing (do not remove the underlying graph/map).
  42. */
  43. public void clearOverlays();
  44. /**
  45. * Draw a marker at the given position using the given colors and according to
  46. * the given mode.
  47. *
  48. * @param point Position of the marker to draw.
  49. * @param outer Color for the outer part of the marker to draw.
  50. * @param inner Color for the inner part of the marker to draw.
  51. * @param mode Mode for filling the inner par of the marker.
  52. *
  53. * @return A MarkerOverlay instance representing the newly drawn marker.
  54. */
  55. public MarkerOverlay drawMarker(Point point, Color outer, Color inner, AlphaMode mode);
  56. /**
  57. * Create a new PointSetOverlay that can be used to add overlay points to this
  58. * drawing.
  59. *
  60. * PointSetOverlay are heavy memory resources, do not use one for each point!
  61. *
  62. * @return A new PointSetOverlay for this drawing.
  63. */
  64. public PointSetOverlay createPointSetOverlay();
  65. /**
  66. * Create a new PointSetOverlay with the given initial width and color that can
  67. * be used to add overlay points to this drawing.
  68. *
  69. * PointSetOverlay are heavy memory resources, do not use one for each point!
  70. *
  71. * @param width Initial width of points in the overlay.
  72. * @param color Initial width of points in the overlay.
  73. *
  74. * @return A new PointSetOverlay for this drawing.
  75. */
  76. public PointSetOverlay createPointSetOverlay(int width, Color color);
  77. /**
  78. * Draw the given graph using the given palette.
  79. *
  80. * @param graph Graph to draw.
  81. * @param palette Palette to use to draw the graph.
  82. *
  83. * @see BasicGraphPalette
  84. * @see BlackAndWhiteGraphPalette
  85. */
  86. public void drawGraph(Graph graph, GraphPalette palette);
  87. /**
  88. * Draw the given graph using a default palette specific to the implementation.
  89. *
  90. * @param graph Graph to draw.
  91. */
  92. public void drawGraph(Graph graph);
  93. /**
  94. * Draw a path using the given color.
  95. *
  96. * @param path Path to draw.
  97. * @param color Color of the path to draw.
  98. * @param markers true to show origin and destination markers.
  99. *
  100. * @return A PathOverlay instance representing the newly drawn path.
  101. */
  102. public PathOverlay drawPath(Path path, Color color, boolean markers);
  103. /**
  104. * Draw a path with both origin and destination markers using the given color.
  105. *
  106. * @param path Path to draw.
  107. * @param color Color of the path to draw.
  108. *
  109. * @return A PathOverlay instance representing the newly drawn path.
  110. *
  111. * @see Drawing#drawPath(Path, Color, boolean)
  112. */
  113. public PathOverlay drawPath(Path path, Color color);
  114. /**
  115. * Draw a path using a default color specific to the implementation
  116. *
  117. * @param path Path to draw.
  118. * @param markers true to show origin and destination markers.
  119. *
  120. * @return A PathOverlay instance representing the newly drawn path.
  121. *
  122. * @see Drawing#drawPath(Path, Color, boolean)
  123. */
  124. public PathOverlay drawPath(Path path, boolean markers);
  125. /**
  126. * Draw a path with both origin and destination markers using a default color
  127. * specific to the implementation
  128. *
  129. *
  130. * @param path Path to draw.
  131. *
  132. * @return A PathOverlay instance representing the newly drawn path.
  133. *
  134. * @see Drawing#drawPath(Path, Color, boolean)
  135. */
  136. public PathOverlay drawPath(Path path);
  137. }