1 Debian patch touch this file
| •1 | /** |
| 2 | * ditaa - Diagrams Through Ascii Art |
| 3 | * |
| •4 | * Copyright (C) 2004-2011 Efstathios Sideris |
| 5 | * |
| •6 | * ditaa is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU Lesser General Public License as |
| 8 | * published by the Free Software Foundation, either version 3 of |
| 9 | * the License, or (at your option) any later version. |
| 10 | * |
| •11 | * ditaa is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| •14 | * GNU Lesser General Public License for more details. |
| 15 | * |
| •16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with ditaa. If not, see <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | */ |
| 20 | package org.stathissideris.ascii2image.core; |
| 21 | |
| 22 | import java.util.Comparator; |
| 23 | |
| 24 | import org.stathissideris.ascii2image.graphics.DiagramShape; |
| 25 | |
| 26 | /** |
| 27 | * |
| 28 | * @author Efstathios Sideris |
| 29 | */ |
| •30 | public class Shape3DOrderingComparator implements Comparator<DiagramShape> { |
| 31 | |
| 32 | /** |
| 33 | * Puts diagram shapes in pseudo-3d order starting from back to front |
| 34 | * |
| 35 | */ |
| •36 | public int compare(DiagramShape shape1, DiagramShape shape2) { |
| 37 | double y1 = shape1.makeIntoPath().getBounds().getCenterY(); |
| 38 | double y2 = shape2.makeIntoPath().getBounds().getCenterY(); |
| 39 | |
| 40 | if(y1 > y2) return -1; |
| 41 | if(y1 < y2) return 1; |
| 42 | |
| 43 | return 0; |
| 44 | } |
| 45 | |
| 46 | } |