| 108 | void legend::horizontal(bool horizontal) { vertical(!horizontal); } |
| 109 | |
| 110 | legend::general_alignment legend::location() const { |
| 111 | switch (horizontal_location_) { |
| 112 | case horizontal_alignment::left: |
| 113 | switch (vertical_location_) { |
| 114 | case vertical_alignment::top: |
| 115 | return general_alignment::topleft; |
| 116 | case vertical_alignment::center: |
| 117 | return general_alignment::left; |
| 118 | case vertical_alignment::bottom: |
| 119 | return general_alignment::bottomleft; |
| 120 | } |
| 121 | break; |
| 122 | case horizontal_alignment::center: |
| 123 | switch (vertical_location_) { |
| 124 | case vertical_alignment::top: |
| 125 | return general_alignment::top; |
| 126 | case vertical_alignment::center: |
| 127 | return general_alignment::center; |
| 128 | case vertical_alignment::bottom: |
| 129 | return general_alignment::bottom; |
| 130 | } |
| 131 | break; |
| 132 | case horizontal_alignment::right: |
| 133 | switch (vertical_location_) { |
| 134 | case vertical_alignment::top: |
| 135 | return general_alignment::topright; |
| 136 | case vertical_alignment::center: |
| 137 | return general_alignment::right; |
| 138 | case vertical_alignment::bottom: |
| 139 | return general_alignment::bottomright; |
| 140 | } |
| 141 | break; |
| 142 | } |
| 143 | throw std::logic_error("legend::location: could not find the legend location"); |
| 144 | } |
| 145 | |
| 146 | void legend::location(general_alignment alignment) { |
| 147 | switch (alignment) { |