X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.trend%2Fsrc%2Forg%2Fsimantics%2Ftrend%2Fimpl%2FJarisPaints.java;fp=bundles%2Forg.simantics.trend%2Fsrc%2Forg%2Fsimantics%2Ftrend%2Fimpl%2FJarisPaints.java;h=bcbbb9524be00f97a7a197509cfa4ca24cc3ffc1;hp=06e63535729deb0d3ad9aec82734c392b0203108;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.trend/src/org/simantics/trend/impl/JarisPaints.java b/bundles/org.simantics.trend/src/org/simantics/trend/impl/JarisPaints.java index 06e635357..bcbbb9524 100644 --- a/bundles/org.simantics.trend/src/org/simantics/trend/impl/JarisPaints.java +++ b/bundles/org.simantics.trend/src/org/simantics/trend/impl/JarisPaints.java @@ -1,80 +1,80 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Association for Decentralized Information Management in - * Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.trend.impl; - -import java.awt.Color; - -public class JarisPaints { - - public static final Color[] JarisPaintSequence; - public static final String[] JarisPaintName; - - /** - * Get color. First color ( blue ) is 1. - * @param paintIndex - * @return - */ - public static Color getColor( int paintIndex ) - { - return JarisPaintSequence[ modulus(paintIndex-1, JarisPaintSequence.length) ]; - } - - public static int modulus( int a, int b ) - { - return a>=0? a%b : (((a%b)+b)%b); - } - - static { - JarisPaintSequence = new Color[] { - new Color(0.00f, 0.00f, 1.00f), - new Color(0.00f, 0.50f, 0.00f), - new Color(1.00f, 0.00f, 0.00f), - new Color(0.00f, 0.75f, 0.75f), - new Color(0.75f, 0.00f, 0.75f), - new Color(0.40f, 0.40f, 0.00f), // Keltainen - new Color(0.25f, 0.25f, 0.25f), - new Color(0.75f, 0.25f, 0.25f), - new Color(0.75f, 0.75f, 0.00f), // Kirkkaampi keltainen - new Color(0.25f, 0.25f, 0.75f), - new Color(0.58f, 0.58f, 0.58f), - new Color(0.00f, 1.00f, 0.00f), - new Color(0.76f, 0.57f, 0.17f), - new Color(0.54f, 0.63f, 0.22f), - new Color(0.80f, 0.52f, 0.85f), - new Color(0.10f, 0.49f, 0.47f), - new Color(0.66f, 0.34f, 0.65f), - new Color(0.99f, 0.41f, 0.23f) - }; - JarisPaintName = new String[] { - Messages.JarisPaints_0, - Messages.JarisPaints_1, - Messages.JarisPaints_2, - Messages.JarisPaints_3, - Messages.JarisPaints_4, - Messages.JarisPaints_5, - Messages.JarisPaints_6, - Messages.JarisPaints_7, - Messages.JarisPaints_8, - Messages.JarisPaints_9, - Messages.JarisPaints_10, - Messages.JarisPaints_11, - Messages.JarisPaints_12, - Messages.JarisPaints_13, - Messages.JarisPaints_14, - Messages.JarisPaints_15, - Messages.JarisPaints_16, - Messages.JarisPaints_17 - }; - - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2011 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.trend.impl; + +import java.awt.Color; + +public class JarisPaints { + + public static final Color[] JarisPaintSequence; + public static final String[] JarisPaintName; + + /** + * Get color. First color ( blue ) is 1. + * @param paintIndex + * @return + */ + public static Color getColor( int paintIndex ) + { + return JarisPaintSequence[ modulus(paintIndex-1, JarisPaintSequence.length) ]; + } + + public static int modulus( int a, int b ) + { + return a>=0? a%b : (((a%b)+b)%b); + } + + static { + JarisPaintSequence = new Color[] { + new Color(0.00f, 0.00f, 1.00f), + new Color(0.00f, 0.50f, 0.00f), + new Color(1.00f, 0.00f, 0.00f), + new Color(0.00f, 0.75f, 0.75f), + new Color(0.75f, 0.00f, 0.75f), + new Color(0.40f, 0.40f, 0.00f), // Keltainen + new Color(0.25f, 0.25f, 0.25f), + new Color(0.75f, 0.25f, 0.25f), + new Color(0.75f, 0.75f, 0.00f), // Kirkkaampi keltainen + new Color(0.25f, 0.25f, 0.75f), + new Color(0.58f, 0.58f, 0.58f), + new Color(0.00f, 1.00f, 0.00f), + new Color(0.76f, 0.57f, 0.17f), + new Color(0.54f, 0.63f, 0.22f), + new Color(0.80f, 0.52f, 0.85f), + new Color(0.10f, 0.49f, 0.47f), + new Color(0.66f, 0.34f, 0.65f), + new Color(0.99f, 0.41f, 0.23f) + }; + JarisPaintName = new String[] { + Messages.JarisPaints_0, + Messages.JarisPaints_1, + Messages.JarisPaints_2, + Messages.JarisPaints_3, + Messages.JarisPaints_4, + Messages.JarisPaints_5, + Messages.JarisPaints_6, + Messages.JarisPaints_7, + Messages.JarisPaints_8, + Messages.JarisPaints_9, + Messages.JarisPaints_10, + Messages.JarisPaints_11, + Messages.JarisPaints_12, + Messages.JarisPaints_13, + Messages.JarisPaints_14, + Messages.JarisPaints_15, + Messages.JarisPaints_16, + Messages.JarisPaints_17 + }; + + } + +}