001/**
002 * Copyright (c) 2011, The University of Southampton and the individual contributors.
003 * All rights reserved.
004 *
005 * Redistribution and use in source and binary forms, with or without modification,
006 * are permitted provided that the following conditions are met:
007 *
008 *   *  Redistributions of source code must retain the above copyright notice,
009 *      this list of conditions and the following disclaimer.
010 *
011 *   *  Redistributions in binary form must reproduce the above copyright notice,
012 *      this list of conditions and the following disclaimer in the documentation
013 *      and/or other materials provided with the distribution.
014 *
015 *   *  Neither the name of the University of Southampton nor the names of its
016 *      contributors may be used to endorse or promote products derived from this
017 *      software without specific prior written permission.
018 *
019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
020 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
021 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
022 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
023 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
024 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
025 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
026 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
027 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
028 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029 */
030package org.openimaj.vis.ternary;
031
032import java.text.AttributedCharacterIterator.Attribute;
033import java.util.HashMap;
034import java.util.Map;
035
036import org.openimaj.image.colour.ColourMap;
037import org.openimaj.image.colour.RGBColour;
038import org.openimaj.image.typography.FontStyle;
039import org.openimaj.image.typography.general.GeneralFont;
040import org.openimaj.image.typography.mathml.MathMLFont;
041
042/**
043 *
044 * @author Sina Samangooei (ss@ecs.soton.ac.uk)
045 */
046/**
047 * @author Jonathon Hare (jsh2@ecs.soton.ac.uk)
048 *
049 */
050public class TernaryParams extends HashMap<String, Object> {
051        /**
052         *
053         */
054        public TernaryParams() {
055                this.put(COLOUR_MAP, ColourMap.Greys3);
056                this.put(BG_COLOUR, RGBColour.BLACK);
057                this.put(PADDING, 0);
058                Map<Attribute, Object> fontAttrs = new HashMap<Attribute, Object>();
059                fontAttrs.put(FontStyle.FONT, new GeneralFont("Arial", 16));
060                fontAttrs.put(FontStyle.FONT_SIZE, 16);
061                fontAttrs.put(FontStyle.HORIZONTAL_ALIGNMENT, FontStyle.HorizontalAlignment.HORIZONTAL_CENTER);
062
063                this.put(LABEL_FONT, fontAttrs);
064                this.put(TRIANGLE_BORDER, false);
065                this.put(TRIANGLE_BORDER_THICKNESS, 3);
066                this.put(TRIANGLE_BORDER_TICK_THICKNESS, 2);
067                this.put(TRIANGLE_BORDER_TICKS, false);
068                this.put(TRIANGLE_BORDER_COLOUR, RGBColour.BLACK);
069                this.put(DRAW_SCALE, false);
070
071                fontAttrs = new HashMap<Attribute, Object>();
072                fontAttrs.put(FontStyle.FONT, new GeneralFont("Arial", 16));
073                fontAttrs.put(FontStyle.FONT_SIZE, 16);
074                fontAttrs.put(FontStyle.COLOUR, RGBColour.BLACK);
075                fontAttrs.put(FontStyle.HORIZONTAL_ALIGNMENT, FontStyle.HorizontalAlignment.HORIZONTAL_RIGHT);
076                fontAttrs.put(FontStyle.VERTICAL_ALIGNMENT, FontStyle.VerticalAlignment.VERTICAL_TOP);
077                this.put(SCALE_FONT, fontAttrs);
078                this.put(SCALE_MIN, "min");
079                this.put(SCALE_MAX, "max");
080                fontAttrs = new HashMap<Attribute, Object>();
081                fontAttrs.put(FontStyle.FONT, new MathMLFont());
082                fontAttrs.put(FontStyle.FONT_SIZE, 12);
083                fontAttrs.put(FontStyle.COLOUR, RGBColour.BLACK);
084                fontAttrs.put(FontStyle.HORIZONTAL_ALIGNMENT, FontStyle.HorizontalAlignment.HORIZONTAL_CENTER);
085                fontAttrs.put(FontStyle.VERTICAL_ALIGNMENT, FontStyle.VerticalAlignment.VERTICAL_TOP);
086                this.put(TICK_FONT, fontAttrs);
087                this.put(LABEL_BACKGROUND, null);
088                this.put(LABEL_BORDER, null);
089                this.put(LABEL_PADDING, 0);
090        }
091
092        /**
093         *
094         */
095        private static final long serialVersionUID = -1188907996988444966L;
096        /**
097         *
098         */
099        public static final String COLOUR_MAP = "ternary.colour.map";
100        /**
101         *
102         */
103        public static final String PADDING = "ternary.border";
104        /**
105         *
106         */
107        public static final String LABELS = "ternary.label.data";
108        /**
109         *
110         */
111        public static final String LABEL_FONT = "ternary.label.font";
112
113        /**
114         *
115         */
116        public static final String LABEL_BACKGROUND = "ternary.label.background";
117
118        /**
119         *
120         */
121        public static final String LABEL_BORDER = "ternary.label.border";
122        /**
123         *
124         */
125        public static final String LABEL_PADDING = "ternary.label.padding";
126        /**
127         *
128         */
129        public static final String BG_COLOUR = "ternary.bg.colour";
130        /**
131         *
132         */
133        public static final String TRIANGLE_BORDER = "ternary.triangle_border.on";
134        /**
135         *
136         */
137        public static final String TRIANGLE_BORDER_THICKNESS = "ternary.triangle_border.thickness";
138        /**
139         *
140         */
141        public static final String TRIANGLE_BORDER_TICKS = "ternary.triangle_border.ticks";
142        /**
143         *
144         */
145        public static final String TRIANGLE_BORDER_COLOUR = "ternary.triangle_border.colour";
146        /**
147         *
148         */
149        public static final String TRIANGLE_BORDER_TICK_THICKNESS = "ternary.triangle_border.ticks.thickness";
150
151        /**
152         *
153         */
154        public static final String TICK_FONT = "ternary.triangle_border.ticks.font";
155        /**
156         *
157         */
158        public static final String DRAW_SCALE = "ternary.scale.draw";
159        /**
160         *
161         */
162        public static final float TOP_RIGHT_X = 0.9f;
163        /**
164         *
165         */
166        public static final float TOP_RIGHT_Y = 0.0f;
167        /**
168         *
169         */
170        public static final String SCALE_FONT = "ternary.scale.font";
171        /**
172         *
173         */
174        public static final String SCALE_MIN = "ternary.scale.min.text";
175        /**
176         *
177         */
178        public static final String SCALE_MAX = "ternary.scale.max.text";
179
180        /**
181         * @param param
182         * @return the entry
183         */
184        @SuppressWarnings("unchecked")
185        public <T> T getTyped(String param) {
186                return (T) this.get(param);
187        }
188
189}